1pub mod element {
2 #[doc(alias = "menu")]
6 #[non_exhaustive]
7 #[derive(PartialEq, Clone, Default)]
8 pub struct Menu {
9 sys: html_sys::text::Menu,
10 children: Vec<super::child::MenuChild>,
11 }
12 impl Menu {
13 pub fn builder() -> super::builder::MenuBuilder {
15 super::builder::MenuBuilder::new(Default::default())
16 }
17 }
18 impl Menu {
19 pub fn data_map(&self) -> &html_sys::DataMap {
21 &self.sys.data_map
22 }
23 pub fn data_map_mut(&mut self) -> &mut html_sys::DataMap {
25 &mut self.sys.data_map
26 }
27 }
28 impl Menu {
29 pub fn role(&self) -> std::option::Option<&str> {
31 self.sys.role.as_deref()
32 }
33 pub fn set_role(
35 &mut self,
36 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
37 ) {
38 self.sys.role = value.map(|v| v.into());
39 }
40 pub fn aria_active_descendant_element(&self) -> std::option::Option<&str> {
42 self.sys.aria_active_descendant_element.as_deref()
43 }
44 pub fn set_aria_active_descendant_element(
46 &mut self,
47 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
48 ) {
49 self.sys.aria_active_descendant_element = value.map(|v| v.into());
50 }
51 pub fn aria_atomic(&self) -> bool {
53 self.sys.aria_atomic
54 }
55 pub fn set_aria_atomic(&mut self, value: bool) {
57 self.sys.aria_atomic = value;
58 }
59 pub fn aria_braille_label(&self) -> std::option::Option<&str> {
61 self.sys.aria_braille_label.as_deref()
62 }
63 pub fn set_aria_braille_label(
65 &mut self,
66 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
67 ) {
68 self.sys.aria_braille_label = value.map(|v| v.into());
69 }
70 pub fn aria_braille_role_description(&self) -> std::option::Option<&str> {
72 self.sys.aria_braille_role_description.as_deref()
73 }
74 pub fn set_aria_braille_role_description(
76 &mut self,
77 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
78 ) {
79 self.sys.aria_braille_role_description = value.map(|v| v.into());
80 }
81 pub fn aria_busy(&self) -> bool {
83 self.sys.aria_busy
84 }
85 pub fn set_aria_busy(&mut self, value: bool) {
87 self.sys.aria_busy = value;
88 }
89 pub fn aria_controls_elements(&self) -> std::option::Option<&str> {
91 self.sys.aria_controls_elements.as_deref()
92 }
93 pub fn set_aria_controls_elements(
95 &mut self,
96 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
97 ) {
98 self.sys.aria_controls_elements = value.map(|v| v.into());
99 }
100 pub fn aria_current(&self) -> std::option::Option<&str> {
102 self.sys.aria_current.as_deref()
103 }
104 pub fn set_aria_current(
106 &mut self,
107 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
108 ) {
109 self.sys.aria_current = value.map(|v| v.into());
110 }
111 pub fn aria_described_by_elements(&self) -> std::option::Option<&str> {
113 self.sys.aria_described_by_elements.as_deref()
114 }
115 pub fn set_aria_described_by_elements(
117 &mut self,
118 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
119 ) {
120 self.sys.aria_described_by_elements = value.map(|v| v.into());
121 }
122 pub fn aria_description(&self) -> std::option::Option<&str> {
124 self.sys.aria_description.as_deref()
125 }
126 pub fn set_aria_description(
128 &mut self,
129 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
130 ) {
131 self.sys.aria_description = value.map(|v| v.into());
132 }
133 pub fn aria_details_elements(&self) -> std::option::Option<&str> {
135 self.sys.aria_details_elements.as_deref()
136 }
137 pub fn set_aria_details_elements(
139 &mut self,
140 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
141 ) {
142 self.sys.aria_details_elements = value.map(|v| v.into());
143 }
144 pub fn aria_disabled(&self) -> bool {
146 self.sys.aria_disabled
147 }
148 pub fn set_aria_disabled(&mut self, value: bool) {
150 self.sys.aria_disabled = value;
151 }
152 pub fn aria_drop_effect(&self) -> std::option::Option<&str> {
154 self.sys.aria_drop_effect.as_deref()
155 }
156 pub fn set_aria_drop_effect(
158 &mut self,
159 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
160 ) {
161 self.sys.aria_drop_effect = value.map(|v| v.into());
162 }
163 pub fn aria_error_message_elements(&self) -> std::option::Option<&str> {
165 self.sys.aria_error_message_elements.as_deref()
166 }
167 pub fn set_aria_error_message_elements(
169 &mut self,
170 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
171 ) {
172 self.sys.aria_error_message_elements = value.map(|v| v.into());
173 }
174 pub fn aria_expanded(&self) -> bool {
176 self.sys.aria_expanded
177 }
178 pub fn set_aria_expanded(&mut self, value: bool) {
180 self.sys.aria_expanded = value;
181 }
182 pub fn aria_flow_to_elements(&self) -> std::option::Option<&str> {
184 self.sys.aria_flow_to_elements.as_deref()
185 }
186 pub fn set_aria_flow_to_elements(
188 &mut self,
189 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
190 ) {
191 self.sys.aria_flow_to_elements = value.map(|v| v.into());
192 }
193 pub fn aria_grabbed(&self) -> bool {
195 self.sys.aria_grabbed
196 }
197 pub fn set_aria_grabbed(&mut self, value: bool) {
199 self.sys.aria_grabbed = value;
200 }
201 pub fn aria_has_popup(&self) -> std::option::Option<&str> {
203 self.sys.aria_has_popup.as_deref()
204 }
205 pub fn set_aria_has_popup(
207 &mut self,
208 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
209 ) {
210 self.sys.aria_has_popup = value.map(|v| v.into());
211 }
212 pub fn aria_hidden(&self) -> bool {
214 self.sys.aria_hidden
215 }
216 pub fn set_aria_hidden(&mut self, value: bool) {
218 self.sys.aria_hidden = value;
219 }
220 pub fn aria_invalid(&self) -> std::option::Option<&str> {
222 self.sys.aria_invalid.as_deref()
223 }
224 pub fn set_aria_invalid(
226 &mut self,
227 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
228 ) {
229 self.sys.aria_invalid = value.map(|v| v.into());
230 }
231 pub fn aria_key_shortcuts(&self) -> std::option::Option<&str> {
233 self.sys.aria_key_shortcuts.as_deref()
234 }
235 pub fn set_aria_key_shortcuts(
237 &mut self,
238 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
239 ) {
240 self.sys.aria_key_shortcuts = value.map(|v| v.into());
241 }
242 pub fn aria_label(&self) -> std::option::Option<&str> {
244 self.sys.aria_label.as_deref()
245 }
246 pub fn set_aria_label(
248 &mut self,
249 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
250 ) {
251 self.sys.aria_label = value.map(|v| v.into());
252 }
253 pub fn aria_labelled_by_elements(&self) -> std::option::Option<&str> {
255 self.sys.aria_labelled_by_elements.as_deref()
256 }
257 pub fn set_aria_labelled_by_elements(
259 &mut self,
260 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
261 ) {
262 self.sys.aria_labelled_by_elements = value.map(|v| v.into());
263 }
264 pub fn aria_live(&self) -> std::option::Option<&str> {
266 self.sys.aria_live.as_deref()
267 }
268 pub fn set_aria_live(
270 &mut self,
271 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
272 ) {
273 self.sys.aria_live = value.map(|v| v.into());
274 }
275 pub fn aria_multi_selectable(&self) -> bool {
277 self.sys.aria_multi_selectable
278 }
279 pub fn set_aria_multi_selectable(&mut self, value: bool) {
281 self.sys.aria_multi_selectable = value;
282 }
283 pub fn aria_orientation(&self) -> std::option::Option<&str> {
285 self.sys.aria_orientation.as_deref()
286 }
287 pub fn set_aria_orientation(
289 &mut self,
290 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
291 ) {
292 self.sys.aria_orientation = value.map(|v| v.into());
293 }
294 pub fn aria_owns_elements(&self) -> std::option::Option<&str> {
296 self.sys.aria_owns_elements.as_deref()
297 }
298 pub fn set_aria_owns_elements(
300 &mut self,
301 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
302 ) {
303 self.sys.aria_owns_elements = value.map(|v| v.into());
304 }
305 pub fn aria_read_only(&self) -> bool {
307 self.sys.aria_read_only
308 }
309 pub fn set_aria_read_only(&mut self, value: bool) {
311 self.sys.aria_read_only = value;
312 }
313 pub fn aria_relevant(&self) -> std::option::Option<&str> {
315 self.sys.aria_relevant.as_deref()
316 }
317 pub fn set_aria_relevant(
319 &mut self,
320 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
321 ) {
322 self.sys.aria_relevant = value.map(|v| v.into());
323 }
324 pub fn aria_required(&self) -> bool {
326 self.sys.aria_required
327 }
328 pub fn set_aria_required(&mut self, value: bool) {
330 self.sys.aria_required = value;
331 }
332 pub fn aria_role_description(&self) -> std::option::Option<&str> {
334 self.sys.aria_role_description.as_deref()
335 }
336 pub fn set_aria_role_description(
338 &mut self,
339 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
340 ) {
341 self.sys.aria_role_description = value.map(|v| v.into());
342 }
343 pub fn access_key(&self) -> std::option::Option<&str> {
345 self.sys.access_key.as_deref()
346 }
347 pub fn set_access_key(
349 &mut self,
350 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
351 ) {
352 self.sys.access_key = value.map(|v| v.into());
353 }
354 pub fn auto_capitalize(&self) -> std::option::Option<&str> {
356 self.sys.auto_capitalize.as_deref()
357 }
358 pub fn set_auto_capitalize(
360 &mut self,
361 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
362 ) {
363 self.sys.auto_capitalize = value.map(|v| v.into());
364 }
365 pub fn autofocus(&self) -> bool {
367 self.sys.autofocus
368 }
369 pub fn set_autofocus(&mut self, value: bool) {
371 self.sys.autofocus = value;
372 }
373 pub fn class(&self) -> std::option::Option<&str> {
375 self.sys.class.as_deref()
376 }
377 pub fn set_class(
379 &mut self,
380 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
381 ) {
382 self.sys.class = value.map(|v| v.into());
383 }
384 pub fn content_editable(&self) -> std::option::Option<&str> {
386 self.sys.content_editable.as_deref()
387 }
388 pub fn set_content_editable(
390 &mut self,
391 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
392 ) {
393 self.sys.content_editable = value.map(|v| v.into());
394 }
395 pub fn direction(&self) -> std::option::Option<&str> {
397 self.sys.direction.as_deref()
398 }
399 pub fn set_direction(
401 &mut self,
402 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
403 ) {
404 self.sys.direction = value.map(|v| v.into());
405 }
406 pub fn draggable(&self) -> bool {
408 self.sys.draggable
409 }
410 pub fn set_draggable(&mut self, value: bool) {
412 self.sys.draggable = value;
413 }
414 pub fn enter_key_hint(&self) -> std::option::Option<&str> {
416 self.sys.enter_key_hint.as_deref()
417 }
418 pub fn set_enter_key_hint(
420 &mut self,
421 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
422 ) {
423 self.sys.enter_key_hint = value.map(|v| v.into());
424 }
425 pub fn export_parts(&self) -> std::option::Option<&str> {
427 self.sys.export_parts.as_deref()
428 }
429 pub fn set_export_parts(
431 &mut self,
432 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
433 ) {
434 self.sys.export_parts = value.map(|v| v.into());
435 }
436 pub fn hidden(&self) -> std::option::Option<&str> {
438 self.sys.hidden.as_deref()
439 }
440 pub fn set_hidden(
442 &mut self,
443 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
444 ) {
445 self.sys.hidden = value.map(|v| v.into());
446 }
447 pub fn id(&self) -> std::option::Option<&str> {
449 self.sys.id.as_deref()
450 }
451 pub fn set_id(
453 &mut self,
454 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
455 ) {
456 self.sys.id = value.map(|v| v.into());
457 }
458 pub fn inert(&self) -> bool {
460 self.sys.inert
461 }
462 pub fn set_inert(&mut self, value: bool) {
464 self.sys.inert = value;
465 }
466 pub fn input_mode(&self) -> std::option::Option<&str> {
468 self.sys.input_mode.as_deref()
469 }
470 pub fn set_input_mode(
472 &mut self,
473 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
474 ) {
475 self.sys.input_mode = value.map(|v| v.into());
476 }
477 pub fn is_(&self) -> std::option::Option<&str> {
479 self.sys.is_.as_deref()
480 }
481 pub fn set_is_(
483 &mut self,
484 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
485 ) {
486 self.sys.is_ = value.map(|v| v.into());
487 }
488 pub fn item_id(&self) -> std::option::Option<&str> {
490 self.sys.item_id.as_deref()
491 }
492 pub fn set_item_id(
494 &mut self,
495 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
496 ) {
497 self.sys.item_id = value.map(|v| v.into());
498 }
499 pub fn item_prop(&self) -> std::option::Option<&str> {
501 self.sys.item_prop.as_deref()
502 }
503 pub fn set_item_prop(
505 &mut self,
506 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
507 ) {
508 self.sys.item_prop = value.map(|v| v.into());
509 }
510 pub fn item_ref(&self) -> std::option::Option<&str> {
512 self.sys.item_ref.as_deref()
513 }
514 pub fn set_item_ref(
516 &mut self,
517 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
518 ) {
519 self.sys.item_ref = value.map(|v| v.into());
520 }
521 pub fn item_scope(&self) -> std::option::Option<&str> {
523 self.sys.item_scope.as_deref()
524 }
525 pub fn set_item_scope(
527 &mut self,
528 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
529 ) {
530 self.sys.item_scope = value.map(|v| v.into());
531 }
532 pub fn item_type(&self) -> std::option::Option<&str> {
534 self.sys.item_type.as_deref()
535 }
536 pub fn set_item_type(
538 &mut self,
539 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
540 ) {
541 self.sys.item_type = value.map(|v| v.into());
542 }
543 pub fn lang(&self) -> std::option::Option<&str> {
545 self.sys.lang.as_deref()
546 }
547 pub fn set_lang(
549 &mut self,
550 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
551 ) {
552 self.sys.lang = value.map(|v| v.into());
553 }
554 pub fn nonce(&self) -> std::option::Option<&str> {
556 self.sys.nonce.as_deref()
557 }
558 pub fn set_nonce(
560 &mut self,
561 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
562 ) {
563 self.sys.nonce = value.map(|v| v.into());
564 }
565 pub fn part(&self) -> std::option::Option<&str> {
567 self.sys.part.as_deref()
568 }
569 pub fn set_part(
571 &mut self,
572 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
573 ) {
574 self.sys.part = value.map(|v| v.into());
575 }
576 pub fn slot(&self) -> std::option::Option<&str> {
578 self.sys.slot.as_deref()
579 }
580 pub fn set_slot(
582 &mut self,
583 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
584 ) {
585 self.sys.slot = value.map(|v| v.into());
586 }
587 pub fn spellcheck(&self) -> std::option::Option<&str> {
589 self.sys.spellcheck.as_deref()
590 }
591 pub fn set_spellcheck(
593 &mut self,
594 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
595 ) {
596 self.sys.spellcheck = value.map(|v| v.into());
597 }
598 pub fn style(&self) -> std::option::Option<&str> {
600 self.sys.style.as_deref()
601 }
602 pub fn set_style(
604 &mut self,
605 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
606 ) {
607 self.sys.style = value.map(|v| v.into());
608 }
609 pub fn tab_index(&self) -> std::option::Option<i64> {
611 self.sys.tab_index
612 }
613 pub fn set_tab_index(&mut self, value: std::option::Option<i64>) {
615 self.sys.tab_index = value;
616 }
617 pub fn title(&self) -> std::option::Option<&str> {
619 self.sys.title.as_deref()
620 }
621 pub fn set_title(
623 &mut self,
624 value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
625 ) {
626 self.sys.title = value.map(|v| v.into());
627 }
628 pub fn translate(&self) -> bool {
630 self.sys.translate
631 }
632 pub fn set_translate(&mut self, value: bool) {
634 self.sys.translate = value;
635 }
636 }
637 impl Menu {
638 pub fn children(&self) -> &[super::child::MenuChild] {
640 self.children.as_ref()
641 }
642 pub fn children_mut(&mut self) -> &mut Vec<super::child::MenuChild> {
644 &mut self.children
645 }
646 }
647 impl crate::Render for Menu {
648 fn render(
649 &self,
650 f: &mut std::fmt::Formatter<'_>,
651 depth: usize,
652 ) -> std::fmt::Result {
653 write!(f, "{:level$}", "", level = depth * 4)?;
654 html_sys::RenderElement::write_opening_tag(&self.sys, f)?;
655 if !self.children.is_empty() {
656 write!(f, "\n")?;
657 }
658 for el in &self.children {
659 crate::Render::render(&el, f, depth)?;
660 write!(f, "\n")?;
661 }
662 write!(f, "{:level$}", "", level = depth * 4)?;
663 html_sys::RenderElement::write_closing_tag(&self.sys, f)?;
664 Ok(())
665 }
666 }
667 impl std::fmt::Debug for Menu {
668 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
669 crate::Render::render(self, f, 0)?;
670 Ok(())
671 }
672 }
673 impl std::fmt::Display for Menu {
674 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
675 html_sys::RenderElement::write_opening_tag(&self.sys, f)?;
676 for el in &self.children {
677 write!(f, "{el}")?;
678 }
679 html_sys::RenderElement::write_closing_tag(&self.sys, f)?;
680 Ok(())
681 }
682 }
683 impl crate::HtmlElement for Menu {}
684 impl crate::FlowContent for Menu {}
685 impl crate::PalpableContent for Menu {}
686 impl std::convert::Into<html_sys::text::Menu> for Menu {
687 fn into(self) -> html_sys::text::Menu {
688 self.sys
689 }
690 }
691 impl From<html_sys::text::Menu> for Menu {
692 fn from(sys: html_sys::text::Menu) -> Self {
693 Self { sys, children: vec![] }
694 }
695 }
696}
697pub mod child {
698 #[derive(PartialEq, Clone)]
700 pub enum MenuChild {
701 ListItem(crate::generated::all::ListItem),
703 Script(crate::generated::all::Script),
705 Template(crate::generated::all::Template),
707 }
708 impl std::convert::From<crate::generated::all::ListItem> for MenuChild {
709 fn from(value: crate::generated::all::ListItem) -> Self {
710 Self::ListItem(value)
711 }
712 }
713 impl std::convert::From<crate::generated::all::Script> for MenuChild {
714 fn from(value: crate::generated::all::Script) -> Self {
715 Self::Script(value)
716 }
717 }
718 impl std::convert::From<crate::generated::all::Template> for MenuChild {
719 fn from(value: crate::generated::all::Template) -> Self {
720 Self::Template(value)
721 }
722 }
723 impl crate::Render for MenuChild {
724 fn render(
725 &self,
726 f: &mut std::fmt::Formatter<'_>,
727 depth: usize,
728 ) -> std::fmt::Result {
729 match self {
730 Self::ListItem(el) => crate::Render::render(el, f, depth + 1),
731 Self::Script(el) => crate::Render::render(el, f, depth + 1),
732 Self::Template(el) => crate::Render::render(el, f, depth + 1),
733 }
734 }
735 }
736 impl std::fmt::Debug for MenuChild {
737 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
738 crate::Render::render(self, f, 0)?;
739 Ok(())
740 }
741 }
742 impl std::fmt::Display for MenuChild {
743 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
744 match self {
745 Self::ListItem(el) => write!(f, "{el}"),
746 Self::Script(el) => write!(f, "{el}"),
747 Self::Template(el) => write!(f, "{el}"),
748 }
749 }
750 }
751}
752pub mod builder {
753 pub struct MenuBuilder {
755 element: super::element::Menu,
756 }
757 impl MenuBuilder {
758 pub(crate) fn new(element: super::element::Menu) -> Self {
759 Self { element }
760 }
761 pub fn build(&mut self) -> super::element::Menu {
763 self.element.clone()
764 }
765 pub fn data(
767 &mut self,
768 data_key: impl Into<std::borrow::Cow<'static, str>>,
769 value: impl Into<std::borrow::Cow<'static, str>>,
770 ) -> &mut MenuBuilder {
771 self.element.data_map_mut().insert(data_key.into(), value.into());
772 self
773 }
774 pub fn list_item<F>(&mut self, f: F) -> &mut Self
776 where
777 F: for<'a> FnOnce(
778 &'a mut crate::generated::all::builders::ListItemBuilder,
779 ) -> &'a mut crate::generated::all::builders::ListItemBuilder,
780 {
781 let ty: crate::generated::all::ListItem = Default::default();
782 let mut ty_builder = crate::generated::all::builders::ListItemBuilder::new(
783 ty,
784 );
785 (f)(&mut ty_builder);
786 let ty = ty_builder.build();
787 self.element.children_mut().push(ty.into());
788 self
789 }
790 pub fn script<F>(&mut self, f: F) -> &mut Self
792 where
793 F: for<'a> FnOnce(
794 &'a mut crate::generated::all::builders::ScriptBuilder,
795 ) -> &'a mut crate::generated::all::builders::ScriptBuilder,
796 {
797 let ty: crate::generated::all::Script = Default::default();
798 let mut ty_builder = crate::generated::all::builders::ScriptBuilder::new(ty);
799 (f)(&mut ty_builder);
800 let ty = ty_builder.build();
801 self.element.children_mut().push(ty.into());
802 self
803 }
804 pub fn template<F>(&mut self, f: F) -> &mut Self
806 where
807 F: for<'a> FnOnce(
808 &'a mut crate::generated::all::builders::TemplateBuilder,
809 ) -> &'a mut crate::generated::all::builders::TemplateBuilder,
810 {
811 let ty: crate::generated::all::Template = Default::default();
812 let mut ty_builder = crate::generated::all::builders::TemplateBuilder::new(
813 ty,
814 );
815 (f)(&mut ty_builder);
816 let ty = ty_builder.build();
817 self.element.children_mut().push(ty.into());
818 self
819 }
820 pub fn role(
822 &mut self,
823 value: impl Into<std::borrow::Cow<'static, str>>,
824 ) -> &mut Self {
825 self.element.set_role(Some(value.into()));
826 self
827 }
828 pub fn aria_active_descendant_element(
830 &mut self,
831 value: impl Into<std::borrow::Cow<'static, str>>,
832 ) -> &mut Self {
833 self.element.set_aria_active_descendant_element(Some(value.into()));
834 self
835 }
836 pub fn aria_atomic(&mut self, value: bool) -> &mut Self {
838 self.element.set_aria_atomic(value);
839 self
840 }
841 pub fn aria_braille_label(
843 &mut self,
844 value: impl Into<std::borrow::Cow<'static, str>>,
845 ) -> &mut Self {
846 self.element.set_aria_braille_label(Some(value.into()));
847 self
848 }
849 pub fn aria_braille_role_description(
851 &mut self,
852 value: impl Into<std::borrow::Cow<'static, str>>,
853 ) -> &mut Self {
854 self.element.set_aria_braille_role_description(Some(value.into()));
855 self
856 }
857 pub fn aria_busy(&mut self, value: bool) -> &mut Self {
859 self.element.set_aria_busy(value);
860 self
861 }
862 pub fn aria_controls_elements(
864 &mut self,
865 value: impl Into<std::borrow::Cow<'static, str>>,
866 ) -> &mut Self {
867 self.element.set_aria_controls_elements(Some(value.into()));
868 self
869 }
870 pub fn aria_current(
872 &mut self,
873 value: impl Into<std::borrow::Cow<'static, str>>,
874 ) -> &mut Self {
875 self.element.set_aria_current(Some(value.into()));
876 self
877 }
878 pub fn aria_described_by_elements(
880 &mut self,
881 value: impl Into<std::borrow::Cow<'static, str>>,
882 ) -> &mut Self {
883 self.element.set_aria_described_by_elements(Some(value.into()));
884 self
885 }
886 pub fn aria_description(
888 &mut self,
889 value: impl Into<std::borrow::Cow<'static, str>>,
890 ) -> &mut Self {
891 self.element.set_aria_description(Some(value.into()));
892 self
893 }
894 pub fn aria_details_elements(
896 &mut self,
897 value: impl Into<std::borrow::Cow<'static, str>>,
898 ) -> &mut Self {
899 self.element.set_aria_details_elements(Some(value.into()));
900 self
901 }
902 pub fn aria_disabled(&mut self, value: bool) -> &mut Self {
904 self.element.set_aria_disabled(value);
905 self
906 }
907 pub fn aria_drop_effect(
909 &mut self,
910 value: impl Into<std::borrow::Cow<'static, str>>,
911 ) -> &mut Self {
912 self.element.set_aria_drop_effect(Some(value.into()));
913 self
914 }
915 pub fn aria_error_message_elements(
917 &mut self,
918 value: impl Into<std::borrow::Cow<'static, str>>,
919 ) -> &mut Self {
920 self.element.set_aria_error_message_elements(Some(value.into()));
921 self
922 }
923 pub fn aria_expanded(&mut self, value: bool) -> &mut Self {
925 self.element.set_aria_expanded(value);
926 self
927 }
928 pub fn aria_flow_to_elements(
930 &mut self,
931 value: impl Into<std::borrow::Cow<'static, str>>,
932 ) -> &mut Self {
933 self.element.set_aria_flow_to_elements(Some(value.into()));
934 self
935 }
936 pub fn aria_grabbed(&mut self, value: bool) -> &mut Self {
938 self.element.set_aria_grabbed(value);
939 self
940 }
941 pub fn aria_has_popup(
943 &mut self,
944 value: impl Into<std::borrow::Cow<'static, str>>,
945 ) -> &mut Self {
946 self.element.set_aria_has_popup(Some(value.into()));
947 self
948 }
949 pub fn aria_hidden(&mut self, value: bool) -> &mut Self {
951 self.element.set_aria_hidden(value);
952 self
953 }
954 pub fn aria_invalid(
956 &mut self,
957 value: impl Into<std::borrow::Cow<'static, str>>,
958 ) -> &mut Self {
959 self.element.set_aria_invalid(Some(value.into()));
960 self
961 }
962 pub fn aria_key_shortcuts(
964 &mut self,
965 value: impl Into<std::borrow::Cow<'static, str>>,
966 ) -> &mut Self {
967 self.element.set_aria_key_shortcuts(Some(value.into()));
968 self
969 }
970 pub fn aria_label(
972 &mut self,
973 value: impl Into<std::borrow::Cow<'static, str>>,
974 ) -> &mut Self {
975 self.element.set_aria_label(Some(value.into()));
976 self
977 }
978 pub fn aria_labelled_by_elements(
980 &mut self,
981 value: impl Into<std::borrow::Cow<'static, str>>,
982 ) -> &mut Self {
983 self.element.set_aria_labelled_by_elements(Some(value.into()));
984 self
985 }
986 pub fn aria_live(
988 &mut self,
989 value: impl Into<std::borrow::Cow<'static, str>>,
990 ) -> &mut Self {
991 self.element.set_aria_live(Some(value.into()));
992 self
993 }
994 pub fn aria_multi_selectable(&mut self, value: bool) -> &mut Self {
996 self.element.set_aria_multi_selectable(value);
997 self
998 }
999 pub fn aria_orientation(
1001 &mut self,
1002 value: impl Into<std::borrow::Cow<'static, str>>,
1003 ) -> &mut Self {
1004 self.element.set_aria_orientation(Some(value.into()));
1005 self
1006 }
1007 pub fn aria_owns_elements(
1009 &mut self,
1010 value: impl Into<std::borrow::Cow<'static, str>>,
1011 ) -> &mut Self {
1012 self.element.set_aria_owns_elements(Some(value.into()));
1013 self
1014 }
1015 pub fn aria_read_only(&mut self, value: bool) -> &mut Self {
1017 self.element.set_aria_read_only(value);
1018 self
1019 }
1020 pub fn aria_relevant(
1022 &mut self,
1023 value: impl Into<std::borrow::Cow<'static, str>>,
1024 ) -> &mut Self {
1025 self.element.set_aria_relevant(Some(value.into()));
1026 self
1027 }
1028 pub fn aria_required(&mut self, value: bool) -> &mut Self {
1030 self.element.set_aria_required(value);
1031 self
1032 }
1033 pub fn aria_role_description(
1035 &mut self,
1036 value: impl Into<std::borrow::Cow<'static, str>>,
1037 ) -> &mut Self {
1038 self.element.set_aria_role_description(Some(value.into()));
1039 self
1040 }
1041 pub fn access_key(
1043 &mut self,
1044 value: impl Into<std::borrow::Cow<'static, str>>,
1045 ) -> &mut Self {
1046 self.element.set_access_key(Some(value.into()));
1047 self
1048 }
1049 pub fn auto_capitalize(
1051 &mut self,
1052 value: impl Into<std::borrow::Cow<'static, str>>,
1053 ) -> &mut Self {
1054 self.element.set_auto_capitalize(Some(value.into()));
1055 self
1056 }
1057 pub fn autofocus(&mut self, value: bool) -> &mut Self {
1059 self.element.set_autofocus(value);
1060 self
1061 }
1062 pub fn class(
1064 &mut self,
1065 value: impl Into<std::borrow::Cow<'static, str>>,
1066 ) -> &mut Self {
1067 self.element.set_class(Some(value.into()));
1068 self
1069 }
1070 pub fn content_editable(
1072 &mut self,
1073 value: impl Into<std::borrow::Cow<'static, str>>,
1074 ) -> &mut Self {
1075 self.element.set_content_editable(Some(value.into()));
1076 self
1077 }
1078 pub fn direction(
1080 &mut self,
1081 value: impl Into<std::borrow::Cow<'static, str>>,
1082 ) -> &mut Self {
1083 self.element.set_direction(Some(value.into()));
1084 self
1085 }
1086 pub fn draggable(&mut self, value: bool) -> &mut Self {
1088 self.element.set_draggable(value);
1089 self
1090 }
1091 pub fn enter_key_hint(
1093 &mut self,
1094 value: impl Into<std::borrow::Cow<'static, str>>,
1095 ) -> &mut Self {
1096 self.element.set_enter_key_hint(Some(value.into()));
1097 self
1098 }
1099 pub fn export_parts(
1101 &mut self,
1102 value: impl Into<std::borrow::Cow<'static, str>>,
1103 ) -> &mut Self {
1104 self.element.set_export_parts(Some(value.into()));
1105 self
1106 }
1107 pub fn hidden(
1109 &mut self,
1110 value: impl Into<std::borrow::Cow<'static, str>>,
1111 ) -> &mut Self {
1112 self.element.set_hidden(Some(value.into()));
1113 self
1114 }
1115 pub fn id(
1117 &mut self,
1118 value: impl Into<std::borrow::Cow<'static, str>>,
1119 ) -> &mut Self {
1120 self.element.set_id(Some(value.into()));
1121 self
1122 }
1123 pub fn inert(&mut self, value: bool) -> &mut Self {
1125 self.element.set_inert(value);
1126 self
1127 }
1128 pub fn input_mode(
1130 &mut self,
1131 value: impl Into<std::borrow::Cow<'static, str>>,
1132 ) -> &mut Self {
1133 self.element.set_input_mode(Some(value.into()));
1134 self
1135 }
1136 pub fn is_(
1138 &mut self,
1139 value: impl Into<std::borrow::Cow<'static, str>>,
1140 ) -> &mut Self {
1141 self.element.set_is_(Some(value.into()));
1142 self
1143 }
1144 pub fn item_id(
1146 &mut self,
1147 value: impl Into<std::borrow::Cow<'static, str>>,
1148 ) -> &mut Self {
1149 self.element.set_item_id(Some(value.into()));
1150 self
1151 }
1152 pub fn item_prop(
1154 &mut self,
1155 value: impl Into<std::borrow::Cow<'static, str>>,
1156 ) -> &mut Self {
1157 self.element.set_item_prop(Some(value.into()));
1158 self
1159 }
1160 pub fn item_ref(
1162 &mut self,
1163 value: impl Into<std::borrow::Cow<'static, str>>,
1164 ) -> &mut Self {
1165 self.element.set_item_ref(Some(value.into()));
1166 self
1167 }
1168 pub fn item_scope(
1170 &mut self,
1171 value: impl Into<std::borrow::Cow<'static, str>>,
1172 ) -> &mut Self {
1173 self.element.set_item_scope(Some(value.into()));
1174 self
1175 }
1176 pub fn item_type(
1178 &mut self,
1179 value: impl Into<std::borrow::Cow<'static, str>>,
1180 ) -> &mut Self {
1181 self.element.set_item_type(Some(value.into()));
1182 self
1183 }
1184 pub fn lang(
1186 &mut self,
1187 value: impl Into<std::borrow::Cow<'static, str>>,
1188 ) -> &mut Self {
1189 self.element.set_lang(Some(value.into()));
1190 self
1191 }
1192 pub fn nonce(
1194 &mut self,
1195 value: impl Into<std::borrow::Cow<'static, str>>,
1196 ) -> &mut Self {
1197 self.element.set_nonce(Some(value.into()));
1198 self
1199 }
1200 pub fn part(
1202 &mut self,
1203 value: impl Into<std::borrow::Cow<'static, str>>,
1204 ) -> &mut Self {
1205 self.element.set_part(Some(value.into()));
1206 self
1207 }
1208 pub fn slot(
1210 &mut self,
1211 value: impl Into<std::borrow::Cow<'static, str>>,
1212 ) -> &mut Self {
1213 self.element.set_slot(Some(value.into()));
1214 self
1215 }
1216 pub fn spellcheck(
1218 &mut self,
1219 value: impl Into<std::borrow::Cow<'static, str>>,
1220 ) -> &mut Self {
1221 self.element.set_spellcheck(Some(value.into()));
1222 self
1223 }
1224 pub fn style(
1226 &mut self,
1227 value: impl Into<std::borrow::Cow<'static, str>>,
1228 ) -> &mut Self {
1229 self.element.set_style(Some(value.into()));
1230 self
1231 }
1232 pub fn tab_index(&mut self, value: i64) -> &mut Self {
1234 self.element.set_tab_index(Some(value));
1235 self
1236 }
1237 pub fn title(
1239 &mut self,
1240 value: impl Into<std::borrow::Cow<'static, str>>,
1241 ) -> &mut Self {
1242 self.element.set_title(Some(value.into()));
1243 self
1244 }
1245 pub fn translate(&mut self, value: bool) -> &mut Self {
1247 self.element.set_translate(value);
1248 self
1249 }
1250 pub fn push<T>(&mut self, child_el: T) -> &mut Self
1252 where
1253 T: Into<crate::generated::all::children::MenuChild>,
1254 {
1255 let child_el = child_el.into();
1256 self.element.children_mut().push(child_el);
1257 self
1258 }
1259 pub fn extend<I, T>(&mut self, iter: I) -> &mut Self
1261 where
1262 I: IntoIterator<Item = T>,
1263 T: Into<crate::generated::all::children::MenuChild>,
1264 {
1265 let iter = iter.into_iter().map(|child_el| child_el.into());
1266 self.element.children_mut().extend(iter);
1267 self
1268 }
1269 }
1270}