1#![allow(non_upper_case_globals)]
12
13macro_rules! define_accessibility_attributes {
14 () => {
15 pub const accessibility_text: $crate::AttributeDescription =
17 ("accessibility_text", None, false);
18 pub const accessibility_description: $crate::AttributeDescription =
20 ("accessibility_description", None, false);
21 pub const accessibility_group: $crate::AttributeDescription =
23 ("accessibility_group", None, false);
24 pub const accessibility_mode: $crate::AttributeDescription =
27 ("accessibility_mode", None, false);
28 pub const accessibility_role: $crate::AttributeDescription =
31 ("accessibility_role", None, false);
32 pub const accessibility_actions: $crate::AttributeDescription =
35 ("accessibility_actions", None, false);
36 pub const accessibility_disabled: $crate::AttributeDescription =
38 ("accessibility_disabled", None, false);
39 pub const accessibility_selected: $crate::AttributeDescription =
41 ("accessibility_selected", None, false);
42 pub const accessibility_checked: $crate::AttributeDescription =
44 ("accessibility_checked", None, false);
45 pub const accessibility_value_min: $crate::AttributeDescription =
47 ("accessibility_value_min", None, false);
48 pub const accessibility_value_max: $crate::AttributeDescription =
50 ("accessibility_value_max", None, false);
51 pub const accessibility_value_current: $crate::AttributeDescription =
53 ("accessibility_value_current", None, false);
54 pub const accessibility_value_range_min: $crate::AttributeDescription =
56 ("accessibility_value_range_min", None, false);
57 pub const accessibility_value_range_max: $crate::AttributeDescription =
59 ("accessibility_value_range_max", None, false);
60 pub const accessibility_value_range_current: $crate::AttributeDescription =
62 ("accessibility_value_range_current", None, false);
63 pub const accessibility_value_text: $crate::AttributeDescription =
65 ("accessibility_value_text", None, false);
66 };
67}
68
69macro_rules! define_accessibility_extension_methods {
70 () => {
71 fn accessibility_text(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
72 self.push_attribute("accessibility_text", None, value, false)
73 }
74
75 fn accessibility_description(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
76 self.push_attribute("accessibility_description", None, value, false)
77 }
78
79 fn accessibility_group(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
80 self.push_attribute("accessibility_group", None, value, false)
81 }
82
83 fn accessibility_mode(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
84 self.push_attribute("accessibility_mode", None, value, false)
85 }
86
87 fn accessibility_role(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
88 self.push_attribute("accessibility_role", None, value, false)
89 }
90
91 fn accessibility_actions(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
92 self.push_attribute("accessibility_actions", None, value, false)
93 }
94
95 fn accessibility_disabled(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
96 self.push_attribute("accessibility_disabled", None, value, false)
97 }
98
99 fn accessibility_selected(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
100 self.push_attribute("accessibility_selected", None, value, false)
101 }
102
103 fn accessibility_checked(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
104 self.push_attribute("accessibility_checked", None, value, false)
105 }
106
107 fn accessibility_value_min(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
108 self.push_attribute("accessibility_value_min", None, value, false)
109 }
110
111 fn accessibility_value_max(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
112 self.push_attribute("accessibility_value_max", None, value, false)
113 }
114
115 fn accessibility_value_current(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
116 self.push_attribute("accessibility_value_current", None, value, false)
117 }
118
119 fn accessibility_value_range_min(
120 self,
121 value: impl dioxus_core::IntoAttributeValue,
122 ) -> Self {
123 self.push_attribute("accessibility_value_range_min", None, value, false)
124 }
125
126 fn accessibility_value_range_max(
127 self,
128 value: impl dioxus_core::IntoAttributeValue,
129 ) -> Self {
130 self.push_attribute("accessibility_value_range_max", None, value, false)
131 }
132
133 fn accessibility_value_range_current(
134 self,
135 value: impl dioxus_core::IntoAttributeValue,
136 ) -> Self {
137 self.push_attribute("accessibility_value_range_current", None, value, false)
138 }
139
140 fn accessibility_value_text(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
141 self.push_attribute("accessibility_value_text", None, value, false)
142 }
143 };
144}
145
146macro_rules! define_element {
147 (
148 $(#[$meta:meta])*
149 $name:ident => $tag:literal, $extension:ident {
150 $( $attr:ident ),* $(,)?
151 }
152 ) => {
153 define_element! {
154 $(#[$meta])*
155 $name => $tag {
156 $( $attr ),*
157 }
158 }
159
160 #[doc(hidden)]
161 pub trait $extension: dioxus_core::HasAttributes + Sized {
162 define_accessibility_extension_methods!();
163
164 fn focus_scope(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
165 self.push_attribute("focus_scope", None, value, false)
166 }
167 fn focus_trap(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
168 self.push_attribute("focus_trap", None, value, false)
169 }
170 fn focus_navigation(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
171 self.push_attribute("focus_navigation", None, value, false)
172 }
173 fn key_capture(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
174 self.push_attribute("key_capture", None, value, false)
175 }
176 fn axis_capture(self, value: impl dioxus_core::IntoAttributeValue) -> Self {
177 self.push_attribute("axis_capture", None, value, false)
178 }
179
180 $(
181 fn $attr(
182 self,
183 value: impl dioxus_core::IntoAttributeValue,
184 ) -> Self {
185 let description = $name::$attr;
186 self.push_attribute(
187 description.0,
188 description.1,
189 value,
190 description.2,
191 )
192 }
193 )*
194 }
195 };
196 (
197 $(#[$meta:meta])*
198 $name:ident => $tag:literal {
199 $( $attr:ident ),* $(,)?
200 }
201 ) => {
202 $(#[$meta])*
203 pub mod $name {
204 pub const TAG_NAME: &'static str = $tag;
206 pub const NAME_SPACE: Option<&'static str> = Some("arkui");
208 pub const native_ref: $crate::AttributeDescription = ("native_ref", None, false);
210
211 define_accessibility_attributes!();
212 pub const focus_scope: $crate::AttributeDescription = ("focus_scope", None, false);
214 pub const focus_trap: $crate::AttributeDescription = ("focus_trap", None, false);
216 pub const focus_navigation: $crate::AttributeDescription = ("focus_navigation", None, false);
218 pub const key_capture: $crate::AttributeDescription = ("key_capture", None, false);
220 pub const axis_capture: $crate::AttributeDescription = ("axis_capture", None, false);
222
223 $(
224 pub const $attr: $crate::AttributeDescription = (stringify!($attr), None, false);
225 )*
226 }
227 };
228}
229
230define_element! {
234 portal => "portal" {
237 portal_layer, width, height, alignment, hit_test_behavior, z_index,
238 }
239}
240
241define_element! {
242 xcomponent => "xcomponent" {
244 focusable, focus_on_touch, default_focus, tab_stop, focused,
245 background_color, margin, margin_top, margin_bottom, margin_left,
246 margin_right, margin_x, margin_y, margin_horizontal, margin_vertical, width, height,
247 opacity, border_radius, border_width, border_color, visibility,
248 enabled, clip, hit_test_behavior, aspect_ratio, position, z_index,
249 }
250}
251
252define_element! {
253 column => "column", ColumnExtension {
255 font_size, font_color, font_weight, foreground_color, background_color, padding, padding_top, padding_right, padding_bottom, padding_left, padding_x, padding_y, padding_horizontal, padding_vertical, margin,
256 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
257 width, height, max_width_constraint, constraint_size, min_width, max_width, min_height, max_height, align_items, justify_content,
258 align_self, item_alignment, layout_weight, opacity, border_radius, border_width,
259 border_color, border_style, shadow, custom_shadow, visibility, enabled, clip, focusable,
260 focus_on_touch, default_focus, tab_stop, hit_test_behavior, alignment, aspect_ratio, position, z_index,
261 }
262}
263
264define_element! {
265 row => "row", RowExtension {
267 font_size, font_color, font_weight, foreground_color, background_color, padding, padding_top, padding_right, padding_bottom, padding_left, padding_x, padding_y, padding_horizontal, padding_vertical, margin,
268 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
269 width, height, max_width_constraint, constraint_size, min_width, max_width, min_height, max_height, align_items, justify_content,
270 align_self, item_alignment, layout_weight, opacity, border_radius, border_width,
271 border_color, border_style, shadow, custom_shadow, visibility, enabled, clip, focusable,
272 focus_on_touch, default_focus, tab_stop, hit_test_behavior, alignment, aspect_ratio, position, z_index,
273 }
274}
275
276#[doc(hidden)]
278pub mod extensions {
279 pub use super::{ColumnExtension, RowExtension};
280}
281
282define_element! {
283 custom => "custom" {
285 background_color, padding, margin, margin_top, margin_bottom, margin_left,
286 margin_right, margin_x, margin_y, margin_horizontal, margin_vertical, width, height, opacity,
287 border_radius, border_width, border_color, visibility, enabled, clip,
288 hit_test_behavior, aspect_ratio, position, z_index,
289 }
290}
291
292define_element! {
293 stack => "stack" {
295 background_color, padding, padding_top, padding_right, padding_bottom, padding_left, padding_x, padding_y, padding_horizontal, padding_vertical, margin,
296 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
297 width, height, max_width_constraint, constraint_size, min_width, max_width, min_height, max_height, alignment, opacity,
298 border_radius, border_width, border_color, border_style, shadow, custom_shadow, visibility,
299 enabled, clip, focusable, focus_on_touch, default_focus, tab_stop, hit_test_behavior, aspect_ratio,
300 position, z_index,
301 }
302}
303
304define_element! {
305 flex => "flex" {
307 background_color, padding, padding_top, padding_right, padding_bottom, padding_left, padding_x, padding_y, padding_horizontal, padding_vertical, margin,
308 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
309 width, height, max_width_constraint, constraint_size, min_width, max_width, min_height, max_height, align_items, justify_content,
310 align_self, item_alignment, flex_direction, flex_wrap, flex_align_content,
311 layout_weight, opacity, border_radius, border_width, border_color, border_style,
312 shadow, custom_shadow, visibility, enabled, clip, focusable, focus_on_touch, default_focus, tab_stop,
313 hit_test_behavior, aspect_ratio, position, z_index,
314 }
315}
316
317define_element! {
318 text => "text" {
320 font_size, font_color, font_weight, font_family, font_style, line_height,
321 text_align, text_letter_spacing, text_decoration, text_overflow, max_lines,
322 content, background_color, padding, padding_top, padding_right, padding_bottom, padding_left, padding_x, padding_y, padding_horizontal, padding_vertical, margin,
323 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
324 width, height, max_width_constraint, constraint_size, min_width, max_width, min_height, max_height, opacity, border_radius,
325 border_width, border_color, border_style, shadow, custom_shadow, visibility, enabled, clip,
326 focusable, focus_on_touch, default_focus, tab_stop, hit_test_behavior, aspect_ratio, position, z_index,
327 }
328}
329
330define_element! {
331 button => "button" {
333 font_size, font_color, font_weight, foreground_color, background_color, padding, padding_top, padding_right, padding_bottom, padding_left, padding_x, padding_y, padding_horizontal, padding_vertical, margin,
334 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
335 width, height, max_width_constraint, constraint_size, min_width, max_width, min_height, max_height, button_type, label,
336 opacity, border_radius, border_width, border_color, border_style, shadow, custom_shadow,
337 visibility, enabled, clip, focusable, focus_on_touch, default_focus, tab_stop, focused, focus_status, hit_test_behavior,
338 align_self, item_alignment, alignment, aspect_ratio, position, z_index,
339 }
340}
341
342define_element! {
343 image => "image" {
345 src, object_fit, background_color, padding, padding_top, padding_right, padding_bottom, padding_left, padding_x, padding_y, padding_horizontal, padding_vertical, margin,
346 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
347 width, height, opacity, border_radius,
348 border_width, border_color, border_style, shadow, custom_shadow, visibility, enabled, clip,
349 focusable, focus_on_touch, default_focus, tab_stop, hit_test_behavior, aspect_ratio, position, z_index,
350 }
351}
352
353define_element! {
354 checkbox => "checkbox" {
356 checked, checkbox_select_color, background_color, padding, margin,
357 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
358 width, height, opacity, border_radius,
359 border_width, border_color, shadow, custom_shadow, visibility, enabled, clip, focusable, focus_on_touch, hit_test_behavior,
360 aspect_ratio, position, z_index,
361 }
362}
363
364define_element! {
365 toggle => "toggle" {
367 checked, toggle_selected_color, toggle_unselected_color,
368 toggle_switch_point_color, background_color, padding, margin,
369 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
370 width, height, opacity, border_radius,
371 border_width, border_color, shadow, custom_shadow, visibility, enabled, clip, focusable, focus_on_touch, hit_test_behavior,
372 aspect_ratio, position, z_index,
373 }
374}
375
376define_element! {
377 radio => "radio" {
379 checked, radio_value, value, background_color, padding, margin,
380 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
381 width, height, opacity, border_radius,
382 border_width, border_color, shadow, custom_shadow, visibility, enabled, clip, focusable, focus_on_touch, hit_test_behavior,
383 aspect_ratio, position, z_index,
384 }
385}
386
387define_element! {
388 slider => "slider" {
390 value, slider_value, slider_min, slider_max, slider_step, background_color,
391 padding, margin, margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
392 width, height, opacity, border_radius,
393 border_width, border_color, shadow, custom_shadow, visibility, enabled, clip, focusable, focus_on_touch, hit_test_behavior,
394 block_color, selected_color, track_color, aspect_ratio, position, z_index,
395 }
396}
397
398define_element! {
399 progress => "progress" {
401 value, progress_value, progress_total, progress_color, progress_type,
402 background_color, padding, margin, margin_top, margin_bottom, margin_left,
403 margin_right, margin_x, margin_y, margin_horizontal, margin_vertical, width, height, opacity,
404 border_radius, border_width, border_color, visibility, enabled, clip,
405 hit_test_behavior, aspect_ratio, position, z_index,
406 }
407}
408
409define_element! {
410 loadingprogress => "loadingprogress" {
412 loading_progress_color, loading_progress_enable_loading,
413 background_color, padding, margin, margin_top, margin_bottom, margin_left,
414 margin_right, margin_x, margin_y, margin_horizontal, margin_vertical, width, height, opacity,
415 border_radius, border_width, border_color, visibility, enabled, clip,
416 hit_test_behavior, aspect_ratio, position, z_index,
417 }
418}
419
420define_element! {
421 scroll => "scroll" {
429 scroll_bar, scroll_direction, scroll_enabled, scroll_edge_effect, scroll_offset, background_color, padding, margin,
430 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
431 width, height, constraint_size, min_width, max_width, min_height, max_height,
432 layout_weight, opacity, border_radius,
433 border_width, border_color, visibility, enabled, clip, hit_test_behavior,
434 alignment, aspect_ratio, position, z_index,
435 }
436}
437
438define_element! {
439 swiper => "swiper" {
441 swiper_index, swiper_swipe_to_index, swiper_loop, swiper_auto_play, swiper_show_indicator,
442 swiper_disable_swipe, swiper_cached_count, swiper_display_count,
443 swiper_vertical, swiper_interval, swiper_duration, swiper_curve, swiper_item_space,
444 background_color, padding, margin, margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
445 width, height, opacity, border_radius,
446 border_width, border_color, border_style, shadow, custom_shadow, visibility, enabled, clip, hit_test_behavior,
447 aspect_ratio, position, z_index,
448 }
449}
450
451define_element! {
452 grid => "grid" {
456 virtual_source,
457 scroll_bar, grid_column_template, grid_row_template, grid_column_gap, grid_row_gap,
458 grid_cached_count, background_color, padding, margin, margin_top,
459 margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
460 width, height, layout_weight, opacity, border_radius, border_width,
461 border_color, visibility, enabled, clip, hit_test_behavior, aspect_ratio,
462 position, z_index,
463 }
464}
465
466define_element! {
467 griditem => "griditem" {
469 background_color, padding, margin, margin_top, margin_bottom, margin_left,
470 margin_right, margin_x, margin_y, margin_horizontal, margin_vertical, width, height, opacity,
471 border_radius, border_width, border_color, visibility, enabled, clip,
472 hit_test_behavior, aspect_ratio, position, z_index,
473 }
474}
475
476define_element! {
477 list => "list" {
484 virtual_source,
485 scroll_bar, list_cached_count, list_sticky, scroll_to_index, background_color, padding, margin, margin_top,
486 margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
487 width, height, layout_weight, opacity, border_radius, border_width,
488 border_color, visibility, enabled, clip, hit_test_behavior, aspect_ratio,
489 position, z_index,
490 }
491}
492
493define_element! {
494 listitem => "listitem" {
496 background_color, padding, margin, margin_top, margin_bottom, margin_left,
497 margin_right, margin_x, margin_y, margin_horizontal, margin_vertical, width, height, opacity,
498 border_radius, border_width, border_color, visibility, enabled, clip,
499 hit_test_behavior, aspect_ratio, position, z_index,
500 }
501}
502
503define_element! {
504 waterflow => "waterflow" {
508 virtual_source,
509 scroll_bar, water_flow_column_template, water_flow_row_template, water_flow_column_gap,
510 water_flow_row_gap, water_flow_cached_count, background_color, padding, margin,
511 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
512 width, height, layout_weight, opacity, border_radius,
513 border_width, border_color, visibility, enabled, clip, hit_test_behavior,
514 aspect_ratio, position, z_index,
515 }
516}
517
518define_element! {
519 flowitem => "flowitem" {
521 background_color, padding, margin, margin_top, margin_bottom, margin_left,
522 margin_right, margin_x, margin_y, margin_horizontal, margin_vertical, width, height, opacity,
523 border_radius, border_width, border_color, visibility, enabled, clip,
524 hit_test_behavior, aspect_ratio, position, z_index,
525 }
526}
527
528define_element! {
529 refresh => "refresh" {
531 refresh_state, refreshing, refresh_offset, refresh_pull_to_refresh,
532 background_color, padding, margin, margin_top, margin_bottom, margin_left,
533 margin_right, margin_x, margin_y, margin_horizontal, margin_vertical, width, height, opacity,
534 border_radius, border_width, border_color, visibility, enabled, clip,
535 hit_test_behavior, aspect_ratio, position, z_index,
536 }
537}
538
539define_element! {
540 calendar => "calendarpicker" {
542 background_color, padding, margin,
543 margin_top, margin_bottom, margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
544 width, height, opacity, border_radius, border_width,
545 border_color, visibility, enabled, clip, hit_test_behavior, aspect_ratio,
546 position, z_index,
547 }
548}
549
550define_element! {
551 datepicker => "datepicker" {
553 background_color, padding, margin, margin_top, margin_bottom,
554 margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical, width, height,
555 opacity, border_radius, border_width, border_color, visibility, enabled, clip,
556 hit_test_behavior, aspect_ratio, position, z_index,
557 }
558}
559
560define_element! {
561 textinput => "textinput" {
563 value, placeholder, placeholder_color, caret_color, input_type, input_filter, max_length,
564 show_password_icon,
565 font_size, font_color,
566 font_weight, font_family, font_style, line_height, text_align, background_color, padding,
567 padding_top, padding_right, padding_bottom, padding_left, padding_x, padding_y, padding_horizontal, padding_vertical, margin, margin_top, margin_bottom,
568 margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
569 width, height, opacity, border_radius, border_width,
570 border_color, border_style, shadow, custom_shadow, visibility, enabled, clip, focusable, focus_on_touch, default_focus, tab_stop,
571 focused, focus_status,
572 hit_test_behavior, aspect_ratio, position, z_index,
573 }
574}
575
576define_element! {
577 textarea => "textarea" {
579 value, placeholder, placeholder_color, caret_color, font_size, font_color,
580 font_weight, font_family, font_style, line_height, text_align, background_color, padding,
581 padding_top, padding_right, padding_bottom, padding_left, padding_x, padding_y, padding_horizontal, padding_vertical, margin, margin_top, margin_bottom,
582 margin_left, margin_right, margin_x, margin_y, margin_horizontal, margin_vertical,
583 width, height, opacity, border_radius, border_width,
584 border_color, border_style, shadow, custom_shadow, visibility, enabled, clip, focusable, focus_on_touch, default_focus, tab_stop,
585 focused, focus_status,
586 hit_test_behavior, aspect_ratio, position, z_index,
587 }
588}
589
590#[doc(hidden)]
593#[allow(non_camel_case_types)]
594pub mod completions {
595 pub enum CompleteWithBraces {
596 column {},
597 custom {},
598 row {},
599 stack {},
600 flex {},
601 text {},
602 button {},
603 image {},
604 checkbox {},
605 toggle {},
606 radio {},
607 slider {},
608 progress {},
609 loadingprogress {},
610 scroll {},
611 swiper {},
612 grid {},
613 griditem {},
614 list {},
615 listitem {},
616 waterflow {},
617 flowitem {},
618 refresh {},
619 calendar {},
620 datepicker {},
621 textinput {},
622 textarea {},
623 xcomponent {},
624 portal {},
625 }
626}