lurq 0.65.1

A Rust UI toolkit with typed components, retained state, reactive signals, GPU rendering, and DevTools.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
mod button;
#[cfg(feature = "canvas")]
mod canvas;
mod checkbox;
mod column;
mod drag_container;
mod draggable;
mod drop_zone;
#[cfg(feature = "form")]
mod form;
#[cfg(all(feature = "raster", feature = "wgpu"))]
mod gpu_viewport;
mod grid;
#[cfg(feature = "raster")]
mod image;
#[cfg(feature = "router")]
mod link;
#[cfg(feature = "markdown")]
mod markdown;
#[cfg(feature = "router")]
mod outlet;
mod popup;
mod rect;
pub(crate) mod pager;
pub(crate) mod refresh;
#[cfg(feature = "router")]
mod router_component;
mod row;
mod scroll;
mod select;
pub(crate) mod sheet;
mod slider;
mod slot;
mod spacer;
mod stack;
#[cfg(feature = "router")]
pub(crate) mod stack_outlet;
#[cfg(feature = "markdown")]
pub(crate) mod styled_text;
#[cfg(feature = "canvas")]
mod svg;
pub(crate) mod swipe_row;
#[cfg(feature = "router")]
pub(crate) mod tabs;
pub(crate) mod text;
mod text_input;
mod text_input_controller;
mod text_input_tokens;
#[cfg(feature = "raster")]
mod video;
mod virtualized_list;
mod window_chrome;
mod window_controls;
pub(crate) mod zoom;

pub use button::Button;
#[cfg(feature = "canvas")]
pub use canvas::Canvas;
#[allow(deprecated)]
pub use checkbox::Checkbox;
pub use column::Column;
pub use drag_container::{DragBounds, DragContainer, DragContainerProps};
pub use draggable::{DragMovement, DragOverridePolicy, Draggable, DraggableProps, DropMissBehavior};
pub use drop_zone::{DropZone, DropZoneProps};
#[cfg(feature = "form")]
pub(crate) use form::FormContext;
#[cfg(feature = "form")]
pub use form::{
  Control, ControlOptions, ControlState, ErrorVisibility, Form, FormCheckboxInput, FormCheckboxInputProps,
  FormControlField, FormData, FormErrors, FormField, FormFieldProps, FormHandle, FormOptions, FormPrimaryButton,
  FormPrimaryButtonProps, FormProps, FormRangeSliderInput, FormRangeSliderInputProps, FormSecondaryButton,
  FormSecondaryButtonProps, FormSliderInput, FormSliderInputProps, FormTextInput, FormTextInputProps, FormValue,
  FormValues, ResolvedControl, ValidationResult, validators,
};
#[cfg(all(feature = "raster", feature = "wgpu"))]
pub use gpu_viewport::GpuViewport;
pub use grid::Grid;
#[cfg(feature = "raster")]
#[allow(deprecated)]
pub use image::Image;
#[cfg(feature = "router")]
pub use link::Link;
#[cfg(feature = "markdown")]
pub use markdown::{Markdown, MarkdownLink, MarkdownLinkPresentation, MarkdownList, MarkdownProps, MarkdownRun};
#[cfg(feature = "router")]
pub use outlet::Outlet;
pub use pager::Pager;
pub use popup::{Popover, Popup};
pub use rect::Rect;
#[allow(deprecated)]
pub use refresh::ActivityIndicator;
pub use refresh::{ActivityIndicatorProps, PullToRefresh, PullToRefreshPart, PullToRefreshProps, PullToRefreshStyle};
#[cfg(feature = "router")]
pub use router_component::{Router, RouterProps};
pub use row::Row;
pub use scroll::{ScrollBoth, ScrollHorizontal, ScrollVertical};
pub use select::{Select, SelectOption, SelectTriggerState};
pub use sheet::{
  Sheet, SheetDetent, SheetDress, SheetHost, SheetHostPart, SheetHostProps, SheetHostStyle, SheetNode, SheetProps,
  SheetStyle,
};
pub use slider::Slider;
pub use slot::Slot;
pub use spacer::Spacer;
pub use stack::Stack;
#[cfg(feature = "router")]
pub use stack_outlet::{
  NavigationBar, NavigationBarBuilder, NavigationBarPart, NavigationBarScreen, NavigationBarState, NavigationItem,
  NavigationSearch, StackMotion, StackOutlet, StackOutletProps, StackPart,
};
#[cfg(feature = "markdown")]
pub use styled_text::{
  InlineObject, LinkClick, MarkPresence, ParagraphKind, ParagraphMarker, ParagraphStyle, ParagraphStyles, RichText,
  SelectionStyle, SpanStyle, StyledChange, StyledEdit, StyledSpan, StyledText, TextMark,
};
#[cfg(feature = "canvas")]
pub use svg::Svg;
pub use swipe_row::{SwipeAction, SwipeRow, SwipeRowPart, SwipeRowProps, SwipeRowStyle};
#[cfg(feature = "router")]
pub use tabs::{
  TabBar, TabBarBuilder, TabBarPart, TabBarPlace, TabBarState, TabEntry, TabItem, TabOutlet, TabOutletProps, Tabs,
};
pub use text::{OBJECT_CHARACTER, Text, TextOverflow};
pub use text_input::{
  ContentKind, InputGhost, InputSquiggles, KeyboardKind, LineGutter, ReturnKey, TextInput, TextInputOverflow,
  TextInputOverflowAnchor,
};
pub use text_input_controller::{InputCaretPoint, InputEditError, InputSelection, TextInputController};
pub use text_input_tokens::{InputToken, InputTokenError, InputTokenIcon, InputTokenStyle, InputTokens};
#[cfg(feature = "raster")]
pub use video::Video;
pub use virtualized_list::VirtualizedList;
pub use window_chrome::{
  ChromeBorderPolicy, ChromeTitleBar, ResizeHandlePlacement, ResizeHandlePolicy, WindowChrome, WindowChromeMetrics,
  WindowChromeMode, WindowChromeProps,
};
pub use window_controls::{
  TrafficLightColors, WindowControlColors, WindowControlContent, WindowControlKind, WindowControlStyle, WindowControls,
};
pub use zoom::{ZoomScroll, ZoomScrollProps};

pub use crate::{
  app::ctx::{CollisionStrategy, Modal, ModalTarget, OpenState, OutsidePress, Overlay, Parent, Placement, Root},
  node::text_highlight::TextHighlight,
};

#[macro_export]
macro_rules! impl_into_node {
  ($(#[$attribute:meta])* $struct_name:ident) => {
    $(#[$attribute])*
    pub struct $struct_name {
      pub(crate) node: Box<$crate::node::Node>,
    }

    impl $struct_name {
      pub(crate) fn from_node(node: $crate::node::Node) -> Self {
        Self {
          node: $crate::node::element::boxed_node(node.with_tag_name(Self::tag_name())),
        }
      }

      pub(crate) fn update_node(&mut self, f: impl FnOnce(&mut $crate::node::Node)) {
        f(&mut *self.node);
      }

      pub(crate) fn tag_name() -> std::sync::Arc<str> {
        static TAG_NAME: std::sync::OnceLock<std::sync::Arc<str>> = std::sync::OnceLock::new();
        TAG_NAME
          .get_or_init(|| std::sync::Arc::from(stringify!($struct_name)))
          .clone()
      }

      pub fn node_id(&self) -> $crate::core::NodeId {
        self.node.node_id()
      }

      pub fn key(mut self, key: impl Into<std::sync::Arc<str>>) -> Self {
        let key = key.into();
        self.update_node(|node| node.set_component_key(Some(&key)));
        self
      }

      /// Gives the element the style of a part of a themed component: what a
      /// renderer of `lurq::ui` builds a component's nodes with.
      pub fn part(mut self, part: &$crate::ui::ResolvedPart) -> Self {
        self.update_node(|node| part.apply(node));
        self
      }

      /// Attach a semantic annotation surfaced to tooling — the devtools
      /// tree and the MCP `lurq_read_tree` — so agents can find and target
      /// this element, e.g. `.describe("role", "save-button")`. A no-op
      /// unless a tooling feature (`devtools`/`mcp`) is enabled.
      pub fn describe(mut self, name: impl Into<std::sync::Arc<str>>, value: impl Into<std::sync::Arc<str>>) -> Self {
        let name = name.into();
        let value = value.into();
        self.update_node(|node| $crate::node::NodeUpdate::describe(node, name, value));
        self
      }

      /// HTML-like `id` attribute for `Tree::get_element_by_id` lookup.
      /// Also participates in retained-node identity across sibling changes.
      /// Keep IDs stable; changing one can reset the node's runtime state.
      pub fn id(mut self, id: impl Into<std::sync::Arc<str>>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::id(node, id));
        self
      }

      /// Appends an HTML-like class for `Tree::get_elements_by_class_name`
      /// lookup. Classes do not affect reconciliation or styling.
      pub fn class(mut self, class: impl Into<std::sync::Arc<str>>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::class(node, class));
        self
      }

      /// Appends several classes at once; see `class`.
      pub fn classes<C: Into<std::sync::Arc<str>>>(mut self, classes: impl IntoIterator<Item = C>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::classes(node, classes));
        self
      }

      pub fn background(mut self, color: impl Into<$crate::node::BackgroundColor>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::background(node, color));
        self
      }

      pub fn background_gradient(mut self, gradient: impl Into<$crate::node::Gradient>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::background_gradient(node, gradient));
        self
      }

      /// Sets the color of the text in this element and under it, like CSS
      /// `color`: a `Text` that names no color of its own is drawn in the
      /// foreground of its nearest ancestor that has one (see
      /// `Node::foreground`).
      pub fn foreground(mut self, color: impl Into<$crate::node::TextColor>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::foreground(node, color));
        self
      }

      /// Draws a line around the element, outside its box and taking no
      /// room in layout, like CSS `outline` with `outline-offset` (see
      /// `Outline`). Put it in `focus_visible` for a focus ring.
      pub fn outline(mut self, outline: $crate::node::Outline) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::outline(node, outline));
        self
      }

      /// CSS-like `box-shadow`: a [`ShadowStyle`](crate::app::theme::ShadowStyle)
      /// theme role, one [`BoxShadow`](crate::node::BoxShadow), or a list
      /// (the first on top). Paint only: it does not change layout or hit testing.
      pub fn box_shadow(mut self, shadow: impl Into<$crate::node::BoxShadowValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::box_shadow(node, shadow));
        self
      }

      pub fn size(
        mut self,
        width: impl Into<$crate::node::dimension::Dimension>,
        height: impl Into<$crate::node::dimension::Dimension>,
      ) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::size(node, width, height));
        self
      }

      pub fn width(mut self, width: impl Into<$crate::node::dimension::Dimension>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::width(node, width));
        self
      }

      pub fn height(mut self, height: impl Into<$crate::node::dimension::Dimension>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::height(node, height));
        self
      }

      pub fn min_width(mut self, width: impl Into<$crate::node::dimension::Dimension>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::min_width(node, width));
        self
      }

      pub fn max_width(mut self, width: impl Into<$crate::node::dimension::Dimension>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::max_width(node, width));
        self
      }

      pub fn min_height(mut self, height: impl Into<$crate::node::dimension::Dimension>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::min_height(node, height));
        self
      }

      pub fn max_height(mut self, height: impl Into<$crate::node::dimension::Dimension>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::max_height(node, height));
        self
      }

      /// The box's width over its height, as CSS `aspect-ratio`: `16.0 / 9.0` for a box of 16 by 9.
      ///
      /// It gives the axis that is auto from the one that is known: a width that is said, a percentage of
      /// a parent whose size is known, or a size the parent fixes (a child that fills a row, a stretched
      /// one). With neither axis known the box is as wide as the room it is given and its height follows;
      /// where the width has no bound it is as high as the room and its width follows. With both axes
      /// said, or both fixed by the parent, it does nothing. `min_*` and `max_*` still bound the axis it
      /// gives. On an image it stands for the picture's own ratio, and holds the box of one whose pixels
      /// are not there yet; the pixels are then placed by the image's fit. A ratio that is not a positive
      /// number is ignored.
      pub fn aspect_ratio(mut self, ratio: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::aspect_ratio(node, ratio));
        self
      }

      pub fn min_size(
        mut self,
        width: impl Into<$crate::node::dimension::Dimension>,
        height: impl Into<$crate::node::dimension::Dimension>,
      ) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::min_size(node, width, height));
        self
      }

      pub fn max_size(
        mut self,
        width: impl Into<$crate::node::dimension::Dimension>,
        height: impl Into<$crate::node::dimension::Dimension>,
      ) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::max_size(node, width, height));
        self
      }

      pub fn padding_left(mut self, val: impl Into<$crate::node::SpacingValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::padding_left(node, val));
        self
      }

      pub fn padding_right(mut self, val: impl Into<$crate::node::SpacingValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::padding_right(node, val));
        self
      }

      pub fn padding_top(mut self, val: impl Into<$crate::node::SpacingValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::padding_top(node, val));
        self
      }

      pub fn padding_bottom(mut self, val: impl Into<$crate::node::SpacingValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::padding_bottom(node, val));
        self
      }

      pub fn padding_horizontal(mut self, val: impl Into<$crate::node::SpacingValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::padding_horizontal(node, val));
        self
      }

      pub fn padding_vertical(mut self, val: impl Into<$crate::node::SpacingValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::padding_vertical(node, val));
        self
      }

      pub fn padding(mut self, padding: impl Into<$crate::node::padding::Padding>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::padding(node, padding));
        self
      }

      pub fn padding_custom(mut self, padding: $crate::node::padding::Padding) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::padding_custom(node, padding));
        self
      }

      pub fn frame(mut self, frame: $crate::layout::layout_kind::FrameConstraints) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::frame(node, frame));
        self
      }

      pub fn offset(mut self, x: f32, y: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::offset(node, x, y));
        self
      }

      /// Moves the element by shares of its own width and height, once it is laid out, on top of
      /// `offset`: `.offset_by_size(-0.5, -0.5)` puts its middle where its top left corner was, whatever
      /// its size turns out to be. The room it takes in its parent stays where it was.
      pub fn offset_by_size(mut self, x: f32, y: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::offset_by_size(node, x, y));
        self
      }

      pub fn relative(mut self, x: f32, y: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::relative(node, x, y));
        self
      }

      /// Holds the element at an edge of the scroll container it is in while that scrolls, as CSS
      /// `position: sticky`: `.sticky(Sticky::top(0.0))` for a header. See
      /// [`Sticky`]($crate::layout::layout_kind::Sticky).
      pub fn sticky(mut self, sticky: $crate::layout::layout_kind::Sticky) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::sticky(node, sticky));
        self
      }

      /// Lays the element's children out side by side in the tracks of a table's columns, one child to a track,
      /// each as wide as its track and the element's gap apart: a row of a table, which every other row of
      /// the table lines up with whatever is in its cells. See
      /// [`ColumnTracks`]($crate::layout::column_tracks::ColumnTracks).
      pub fn column_tracks(mut self, tracks: &$crate::layout::column_tracks::ColumnTracks) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::column_tracks(node, tracks.clone()));
        self
      }

      /// Measures the cells of the rows in the element that lay their children out in `tracks`, its children
      /// and the children of those: what holds the rows of a table. A track sized by its content is as wide as
      /// the widest of them. See [`ColumnTracks`]($crate::layout::column_tracks::ColumnTracks).
      /// How many tracks of the row of [`ColumnTracks`]($crate::layout::column_tracks::ColumnTracks) it is in the
      /// element takes, from the one it would take: as wide as those tracks and the gaps between them. One room
      /// for the columns a table does not build where they are out of view, in place of a cell for each.
      pub fn track_span(mut self, span: usize) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::track_span(node, span));
        self
      }

      pub fn measures_column_tracks(mut self, tracks: &$crate::layout::column_tracks::ColumnTracks) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::measures_column_tracks(node, tracks.clone()));
        self
      }

      pub fn absolute(
        mut self,
        x: f32,
        y: f32,
        width: impl Into<$crate::node::dimension::Dimension>,
        height: impl Into<$crate::node::dimension::Dimension>,
      ) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::absolute(node, x, y, width, height));
        self
      }

      pub fn absolute_position(mut self, x: f32, y: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::absolute_position(node, x, y));
        self
      }

      pub fn align(mut self, alignment: $crate::layout::Alignment) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::align(node, alignment));
        self
      }

      pub fn flex(mut self, factor: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::flex(node, factor));
        self
      }

      /// The column of a [`Grid`]($crate::components::Grid) the element starts in, counted from 0. Without
      /// one it takes the next cell that has room.
      pub fn grid_column(mut self, index: usize) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::grid_cell(node, |cell| cell.set_column(index)));
        self
      }

      /// The row of a [`Grid`]($crate::components::Grid) the element starts in, counted from 0.
      pub fn grid_row(mut self, index: usize) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::grid_cell(node, |cell| cell.set_row(index)));
        self
      }

      /// How many columns of a [`Grid`]($crate::components::Grid) the element takes; one by default.
      pub fn column_span(mut self, columns: usize) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::grid_cell(node, |cell| cell.set_column_span(columns)));
        self
      }

      /// How many rows of a [`Grid`]($crate::components::Grid) the element takes; one by default.
      pub fn row_span(mut self, rows: usize) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::grid_cell(node, |cell| cell.set_row_span(rows)));
        self
      }

      pub fn flex_shrink(mut self, factor: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::flex_shrink(node, factor));
        self
      }

      pub fn flex_full(mut self, grow: f32, shrink: f32, basis: Option<f32>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::flex_full(node, grow, shrink, basis));
        self
      }

      /// The give-way order of a shrinking child (one with a `flex_shrink`
      /// factor) in a single-line `Row`/`Column`; 0 by default. When the line
      /// overflows, the children with the lowest order give way first, down
      /// to their [`ShrinkLimit`](crate::layout::layout_kind::ShrinkLimit),
      /// before any child of the next order shrinks at all. Children of one
      /// order share their part of the overflow by shrink factor, in whole
      /// pixels except for the child with the largest factor.
      pub fn shrink_order(mut self, order: i32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::shrink_order(node, order));
        self
      }

      /// How far a shrinking child (one with a `flex_shrink` factor) of a
      /// single-line `Row`/`Column` gives way: down to its minimum size (the
      /// default), down to its content, or not at all and then dropped. See
      /// [`ShrinkLimit`](crate::layout::layout_kind::ShrinkLimit).
      pub fn shrink_limit(mut self, limit: $crate::layout::layout_kind::ShrinkLimit) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::shrink_limit(node, limit));
        self
      }

      /// Lets a shrinking child (one with a `flex_shrink` factor) of a
      /// single-line `Row`/`Column` give way in two steps: it first shrinks
      /// like its [`ShrinkLimit`](crate::layout::layout_kind::ShrinkLimit),
      /// but no further than `size` on the main axis, and when its order
      /// still cannot absorb the overflow with every shrinking child at its
      /// floor, it drops like `ShrinkLimit::Drop` before the next order
      /// shrinks. A child narrower than `size` drops without shrinking. A
      /// negative or NaN `size` counts as 0.
      pub fn shrink_drop_below(mut self, size: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::shrink_drop_below(node, size));
        self
      }

      /// Lays this child of a `Stack` out only while the stack is within `bounds`
      /// ([`SizeBounds`](crate::layout::layout_kind::SizeBounds)); outside them it is dropped, as
      /// [`ShrinkLimit::Drop`](crate::layout::layout_kind::ShrinkLimit::Drop) drops a child of a line: laid
      /// out at zero size, neither drawn nor hit, with no Tab stop in it and no focus kept in it, while it
      /// stays mounted and keeps its state. It is how a component is another thing at another size with
      /// nothing measured and no frame in between: each form is a child with the bounds it lives in.
      ///
      /// The size asked is the stack's own, which its constraints and its other children make: a child with
      /// bounds never makes its stack larger, and is laid out within the size the stack came to. In a
      /// stack that holds only such children, that size is the least its constraints allow. On a child of
      /// anything but a `Stack` it does nothing.
      ///
      /// ```
      /// use lurq::{
      ///   components::{Rect, Stack, Text},
      ///   layout::layout_kind::SizeBounds,
      /// };
      ///
      /// // A caption over a picture, on a picture wide enough to hold it.
      /// let picture = Stack::new()
      ///   .child(Rect::new(320.0, 180.0))
      ///   .child(Text::new("The lake at dusk").drop_outside(SizeBounds::new().min_width(240.0)));
      /// ```
      pub fn drop_outside(mut self, bounds: $crate::layout::layout_kind::SizeBounds) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::drop_outside(node, bounds));
        self
      }

      /// Where the image the element draws (its own pixels, or its background image) is held in its box
      /// where it is cut or does not fill it, as CSS `object-position`: `x` and `y` from 0, its start edge on
      /// the box's, through 0.5, the middle and the default, to 1, its end edge on the box's. A cover that
      /// cuts the top and the bottom keeps the top with `(0.5, 0.0)`; a contained image stands at the left
      /// with `(0.0, 0.5)`. A stretched image fills its box and has nothing to hold.
      pub fn image_anchor(mut self, x: f32, y: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::image_anchor(node, x, y));
        self
      }

      /// Makes this child of a single-line `Row`/`Column` the one that stands
      /// for what the line dropped
      /// ([`ShrinkLimit::Drop`](crate::layout::layout_kind::ShrinkLimit::Drop)):
      /// it takes its room only while another child of the line is dropped,
      /// and is dropped itself while none is. The More button at the end of a
      /// toolbar, which opens a menu of the controls that did not fit. The line
      /// gives way as it would without it, and when that drops a child, gives
      /// way again with its room taken: what fits beside it stays, the rest
      /// drops. It does not shrink; one marker to a line.
      pub fn drop_marker(mut self, marker: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::drop_marker(node, marker));
        self
      }

      pub fn corner_radius(mut self, radius: impl Into<$crate::node::RadiusValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::corner_radius(node, radius));
        self
      }

      pub fn corner_radius_custom(mut self, radius: $crate::node::border::BorderRadius) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::corner_radius_custom(node, radius));
        self
      }

      pub fn corner_radius_top_left(mut self, radius: impl Into<$crate::node::RadiusValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::corner_radius_top_left(node, radius));
        self
      }

      pub fn corner_radius_top_right(mut self, radius: impl Into<$crate::node::RadiusValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::corner_radius_top_right(node, radius));
        self
      }

      pub fn corner_radius_bottom_right(mut self, radius: impl Into<$crate::node::RadiusValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::corner_radius_bottom_right(node, radius));
        self
      }

      pub fn corner_radius_bottom_left(mut self, radius: impl Into<$crate::node::RadiusValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::corner_radius_bottom_left(node, radius));
        self
      }

      pub fn rounded(mut self, radius: impl Into<$crate::node::RadiusValue>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::rounded(node, radius));
        self
      }

      pub fn border_inside(
        mut self,
        width: impl Into<$crate::node::BorderSizeValue>,
        color: impl Into<$crate::node::BackgroundColor>,
      ) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::border_inside(node, width, color));
        self
      }

      pub fn border_outside(
        mut self,
        width: impl Into<$crate::node::BorderSizeValue>,
        color: impl Into<$crate::node::BackgroundColor>,
      ) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::border_outside(node, width, color));
        self
      }

      pub fn border_center(
        mut self,
        width: impl Into<$crate::node::BorderSizeValue>,
        color: impl Into<$crate::node::BackgroundColor>,
      ) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::border_center(node, width, color));
        self
      }

      pub fn border(mut self, border: $crate::node::border::Border) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::border(node, border));
        self
      }

      pub fn border_custom(mut self, border: $crate::node::border::Borders) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::border_custom(node, border));
        self
      }

      pub fn border_top(mut self, border: $crate::node::border::Border) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::border_top(node, border));
        self
      }

      pub fn border_right(mut self, border: $crate::node::border::Border) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::border_right(node, border));
        self
      }

      pub fn border_bottom(mut self, border: $crate::node::border::Border) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::border_bottom(node, border));
        self
      }

      pub fn border_left(mut self, border: $crate::node::border::Border) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::border_left(node, border));
        self
      }

      #[cfg(feature = "raster")]
      pub fn background_image(mut self, data: impl Into<$crate::images::ImageKind>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::background_image(node, data));
        self
      }

      #[cfg(feature = "raster")]
      pub fn background_size(mut self, size: $crate::node::BackgroundSize) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::background_size(node, size));
        self
      }

      #[cfg(feature = "raster")]
      pub fn background_cover(mut self) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::background_cover(node));
        self
      }

      #[cfg(feature = "raster")]
      pub fn background_contain(mut self) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::background_contain(node));
        self
      }

      pub fn cursor(mut self, cursor: $crate::node::CursorIcon) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::cursor(node, cursor));
        self
      }

      pub fn hovered_style(mut self, style: $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::hovered_style(node, style));
        self
      }

      pub fn active_style(mut self, style: $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::active_style(node, style));
        self
      }

      /// Merged over the element's style while it has focus, however the
      /// focus got there (pointer, keyboard or a request).
      pub fn focused_style(mut self, style: $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::focused_style(node, style));
        self
      }

      /// Merged over the element's style (and over `focused_style`) while it
      /// has keyboard focus, like CSS `:focus-visible`: a focus ring that a
      /// pointer press does not show. Text inputs show it for any focus.
      pub fn focus_visible_style(mut self, style: $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::focus_visible_style(node, style));
        self
      }

      /// Merged over the element's style while files from the OS are
      /// dragged over it (`on_file_drag_enter` fired, `on_file_drag_leave`
      /// has not), so a drop target can highlight.
      pub fn drag_over_style(mut self, style: $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::drag_over_style(node, style));
        self
      }

      pub fn hovered(mut self, f: impl FnOnce($crate::node::Style) -> $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::hovered(node, f));
        self
      }

      /// Takes the element and everything in it out of input: no press,
      /// click, tap or gesture reaches them, none of them is hovered,
      /// pressed or focused, and Tab passes them by. The element still
      /// covers what is behind it (see `Node::disabled`).
      pub fn disabled(mut self, disabled: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::disabled(node, disabled));
        self
      }

      /// Merged over the element's style, after every other state style,
      /// while it is disabled, by itself or by an element it is in. It
      /// changes painting only.
      pub fn disabled_style(mut self, style: $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::disabled_style(node, style));
        self
      }

      /// Builder form of `disabled_style`.
      pub fn when_disabled(mut self, f: impl FnOnce($crate::node::Style) -> $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::when_disabled(node, f));
        self
      }

      /// Merged over the element's style, under every other state style, while the
      /// [interaction group](Self::interaction_group) it is in is under the pointer or holds the focus: an action
      /// at the end of a row shown only then. It changes painting only.
      pub fn within_style(mut self, style: $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::within_style(node, style));
        self
      }

      /// Merged over the element's [`within_style`](Self::within_style) while the interaction group it is in is
      /// under the pointer, not while it only holds the focus: a cell that stays as a row scrolls, veiled with
      /// its row under the pointer. It changes painting only.
      pub fn within_hovered_style(mut self, style: $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::within_hovered_style(node, style));
        self
      }

      /// Merged over the element's [`within_hovered_style`](Self::within_hovered_style) while the interaction
      /// group it is in is held down. It changes painting only.
      pub fn within_pressed_style(mut self, style: $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::within_pressed_style(node, style));
        self
      }

      /// Whether the element is an interaction group: while the pointer is on it, or the focus is on it or in
      /// it, the elements in it show their [`within_style`](Self::within_style). An element in two groups answers
      /// to the innermost.
      pub fn interaction_group(mut self, group: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::interaction_group(node, group));
        self
      }

      /// Draws the boxes of the element and of everything in it on whole device pixels: each edge of a fill or a
      /// border is moved to the device pixel nearest it when the frame is painted, so that at a scale that is no
      /// whole number (150%) an edge is crisp, and two boxes that meet still meet. A grid of cells that must read
      /// sharp, as the modules of a QR code. What is laid out and what a pointer hits are as before; a text, an
      /// image and a box that is turned are drawn where they are.
      pub fn snap_to_pixels(mut self, snap: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::snap_to_pixels(node, snap));
        self
      }

      /// Paints what the element holds again and again across its box: a watermark, a pattern. What it holds is
      /// laid out once, and is the first tile; the tiles are its first child's box with the repeat's gap after
      /// it, across and down both ways, every other row moved by the repeat's stagger. Only the tiles that can be
      /// seen are painted, so a pattern over a page of any length in a scroll costs the tiles in view. The copies
      /// are paint alone: no pointer hits them and tooling does not read them. See [`Repeat`]($crate::layout::Repeat).
      pub fn repeat(mut self, repeat: $crate::layout::Repeat) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::repeat(node, Some(repeat)));
        self
      }

      /// Says the element is one of the window's controls, in a title bar the app draws itself: the control that
      /// minimizes the window, maximizes it (or restores it) or closes it. The shell tells the system where it
      /// is: on Windows the window answers the system's hit test there with the minimize, the maximize or the
      /// close button, so that Windows 11 opens its snap layouts over the maximize control. The element is
      /// otherwise as before: its states, its `on_click`, its cursor and its keys are its own, and it is what
      /// acts on the window. On other platforms this does nothing.
      pub fn window_control(mut self, control: $crate::node::WindowControl) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::window_control(node, control));
        self
      }

      /// Builder form of `drag_over_style`.
      pub fn drag_over(mut self, f: impl FnOnce($crate::node::Style) -> $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::drag_over(node, f));
        self
      }

      pub fn active(mut self, f: impl FnOnce($crate::node::Style) -> $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::active(node, f));
        self
      }

      pub fn focused(mut self, f: impl FnOnce($crate::node::Style) -> $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::focused(node, f));
        self
      }

      /// Builder form of `focus_visible_style`.
      pub fn focus_visible(mut self, f: impl FnOnce($crate::node::Style) -> $crate::node::Style) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::focus_visible(node, f));
        self
      }

      pub fn on_click(mut self, f: impl $crate::node::IntoMouseEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_click(node, f));
        self
      }

      pub fn off_click(mut self, f: impl $crate::node::IntoMouseEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_click(node, f));
        self
      }

      pub fn on_mouse_click(
        mut self,
        button: $crate::app::events::MouseButton,
        f: impl $crate::node::IntoMouseEventHandler,
      ) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_mouse_click(node, button, f));
        self
      }

      pub fn off_mouse_click(
        mut self,
        button: $crate::app::events::MouseButton,
        f: impl $crate::node::IntoMouseEventHandler,
      ) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_mouse_click(node, button, f));
        self
      }

      pub fn on_dblclick(mut self, f: impl $crate::node::IntoMouseEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_dblclick(node, f));
        self
      }

      pub fn off_dblclick(mut self, f: impl $crate::node::IntoMouseEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_dblclick(node, f));
        self
      }

      pub fn on_mouse_down(mut self, f: impl $crate::node::IntoMouseEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_mouse_down(node, f));
        self
      }

      pub fn off_mouse_down(mut self, f: impl $crate::node::IntoMouseEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_mouse_down(node, f));
        self
      }

      pub fn on_mouse_up(mut self, f: impl $crate::node::IntoMouseEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_mouse_up(node, f));
        self
      }

      pub fn off_mouse_up(mut self, f: impl $crate::node::IntoMouseEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_mouse_up(node, f));
        self
      }

      pub fn on_mouse_move(mut self, f: impl $crate::node::IntoMouseEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_mouse_move(node, f));
        self
      }

      pub fn off_mouse_move(mut self, f: impl $crate::node::IntoMouseEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_mouse_move(node, f));
        self
      }

      pub fn start_drag_buttons(mut self, buttons: $crate::app::events::MouseButtonMask) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::start_drag_buttons(node, buttons));
        self
      }

      /// Whether a finger that lands on the element drags it at once and scrolls nothing, where it is inside
      /// content that scrolls: see `Node::finger_drags`. Off by default.
      pub fn finger_drags(mut self, drags: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::finger_drags(node, drags));
        self
      }

      /// Whether a drag that starts on the element scrolls the scroll container around it while the pointer is
      /// at the container's edge or past it, and tells the drag's `on_drag_move` after each step: see
      /// `Node::drag_autoscroll`. Off by default.
      pub fn drag_autoscroll(mut self, enabled: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::drag_autoscroll(node, enabled));
        self
      }

      pub fn on_drag_start(mut self, f: impl $crate::node::IntoDragEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_drag_start(node, f));
        self
      }

      pub fn off_drag_start(mut self, f: impl $crate::node::IntoDragEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_drag_start(node, f));
        self
      }

      pub fn on_drag_move(mut self, f: impl $crate::node::IntoDragEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_drag_move(node, f));
        self
      }

      pub fn off_drag_move(mut self, f: impl $crate::node::IntoDragEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_drag_move(node, f));
        self
      }

      pub fn on_drag_end(mut self, f: impl $crate::node::IntoDragEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_drag_end(node, f));
        self
      }

      pub fn off_drag_end(mut self, f: impl $crate::node::IntoDragEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_drag_end(node, f));
        self
      }

      pub fn on_drop(mut self, f: impl $crate::node::IntoDropEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_drop(node, f));
        self
      }

      pub fn off_drop(mut self, f: impl $crate::node::IntoDropEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_drop(node, f));
        self
      }

      /// Files from the OS (Explorer, Finder) dragged into the window reach
      /// the element under the pointer: this fires once when the drag
      /// enters the element, `on_file_drag_over` on every move over it,
      /// `on_file_drag_leave` when it leaves without a drop, and
      /// `on_file_drop` on the drop. The events bubble to ancestors; the
      /// paths are given once for the whole drag.
      pub fn on_file_drag_enter(mut self, f: impl $crate::node::IntoFileDragEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_file_drag_enter(node, f));
        self
      }

      pub fn off_file_drag_enter(mut self, f: impl $crate::node::IntoFileDragEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_file_drag_enter(node, f));
        self
      }

      pub fn on_file_drag_over(mut self, f: impl $crate::node::IntoFileDragEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_file_drag_over(node, f));
        self
      }

      pub fn off_file_drag_over(mut self, f: impl $crate::node::IntoFileDragEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_file_drag_over(node, f));
        self
      }

      pub fn on_file_drag_leave(mut self, f: impl $crate::node::IntoVoidEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_file_drag_leave(node, f));
        self
      }

      pub fn off_file_drag_leave(mut self, f: impl $crate::node::IntoVoidEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_file_drag_leave(node, f));
        self
      }

      pub fn on_file_drop(mut self, f: impl $crate::node::IntoFileDropEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_file_drop(node, f));
        self
      }

      pub fn off_file_drop(mut self, f: impl $crate::node::IntoFileDropEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_file_drop(node, f));
        self
      }

      /// A paste into the focused text input, before its text is inserted:
      /// on the input, or on an ancestor it bubbles to. The handler sees
      /// what the clipboard holds and may `prevent_default()` to take an
      /// image or files instead of inserting text.
      pub fn on_paste(mut self, f: impl $crate::node::IntoPasteEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_paste(node, f));
        self
      }

      pub fn off_paste(mut self, f: impl $crate::node::IntoPasteEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_paste(node, f));
        self
      }

      /// A copy or a cut from the focused element where it is not a text input (Ctrl+C, Ctrl+X, or an Edit menu's
      /// `Ctx::edit(EditCommand::Copy)`): on the element, or on an ancestor it bubbles to. The handler says what goes
      /// on the clipboard with `set_text`; a cut also takes away what it copied. A handler that sets no text passes
      /// it on, and a text selected on the page is copied where none set one.
      pub fn on_copy(mut self, f: impl $crate::node::IntoCopyEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_copy(node, f));
        self
      }

      pub fn off_copy(mut self, f: impl $crate::node::IntoCopyEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_copy(node, f));
        self
      }

      /// Undo on the focused element, or on one in it: Ctrl+Z (Cmd+Z on a Mac), or an Edit menu's Undo
      /// (`Ctx::edit(EditCommand::Undo)`). The handler takes back the last change of what the element holds; one that has nothing to
      /// take back calls `event.pass_on()`, and the command goes on out to the elements around, innermost first, to
      /// the first that takes it. A focused text input takes back its own edits first. Which keys are undo is lurq's
      /// to know (`KeyboardEvent::edit_command`): a component never matches them itself. See
      /// [`EditEvent`]($crate::app::events::EditEvent).
      pub fn on_undo(mut self, f: impl $crate::node::IntoEditEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_undo(node, f));
        self
      }

      pub fn off_undo(mut self, f: impl $crate::node::IntoEditEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_undo(node, f));
        self
      }

      /// Redo on the focused element, or on one in it: Ctrl+Shift+Z or Ctrl+Y (Cmd+Shift+Z on a Mac), or an Edit
      /// menu's Redo (`Ctx::edit(EditCommand::Redo)`). As [`on_undo`](Self::on_undo), for what was taken back.
      pub fn on_redo(mut self, f: impl $crate::node::IntoEditEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_redo(node, f));
        self
      }

      pub fn off_redo(mut self, f: impl $crate::node::IntoEditEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_redo(node, f));
        self
      }

      /// Select all on the focused element, or on one in it: Ctrl+A (Cmd+A on a Mac), or an Edit menu's Select All
      /// (`Ctx::edit(EditCommand::SelectAll)`). The handler selects every item of what it holds; one that selects
      /// nothing (a list of which one item is chosen) calls `event.pass_on()`. A focused text input selects its text
      /// itself. As [`on_undo`](Self::on_undo).
      pub fn on_select_all(mut self, f: impl $crate::node::IntoEditEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_select_all(node, f));
        self
      }

      pub fn off_select_all(mut self, f: impl $crate::node::IntoEditEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_select_all(node, f));
        self
      }

      /// A swipe between pages ended over this element: two fingers moved sideways on a trackpad that nothing under
      /// the pointer scrolled with, or a finger came in from the left or the right edge. Its default is going back or
      /// forward by the event's `direction` (`on_history_back` hears it); a handler that does something else with the
      /// swipe calls `prevent_default`. See [`HistorySwipeEvent`]($crate::app::events::HistorySwipeEvent).
      pub fn on_history_swipe(mut self, f: impl $crate::node::IntoHistorySwipeEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_history_swipe(node, f));
        self
      }

      pub fn off_history_swipe(mut self, f: impl $crate::node::IntoHistorySwipeEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_history_swipe(node, f));
        self
      }

      /// Going back on the focused element, or on one in it, or under the pointer: Alt+← (Cmd+[ on a Mac), the
      /// mouse's back button, a trackpad's swipe or a finger from the left edge, Android's back, a browser's back, or
      /// the app's `Ctx::history_back`. The handler goes back from what is its own (a dialog closes, a wizard steps
      /// back); one that has nothing to do calls `event.pass_on()`, and the command goes on out to the elements
      /// around, innermost first, and the router mounted there, to the first that takes it. Which keys and buttons
      /// go back is lurq's to know (`KeyboardEvent::navigation_command`): a component never matches them itself.
      /// See [`HistoryEvent`]($crate::app::events::HistoryEvent).
      pub fn on_history_back(mut self, f: impl $crate::node::IntoHistoryEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_history_back(node, f));
        self
      }

      pub fn off_history_back(mut self, f: impl $crate::node::IntoHistoryEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_history_back(node, f));
        self
      }

      /// Going forward: Alt+→ (Cmd+] on a Mac), the mouse's forward button, a swipe the other way, a browser's
      /// forward, `Ctx::history_forward`. As [`on_history_back`](Self::on_history_back).
      pub fn on_history_forward(mut self, f: impl $crate::node::IntoHistoryEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_history_forward(node, f));
        self
      }

      pub fn off_history_forward(mut self, f: impl $crate::node::IntoHistoryEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_history_forward(node, f));
        self
      }

      /// A finger landed on this element; see [`TouchEvent`](crate::app::events::TouchEvent). A handler that calls
      /// `prevent_default` takes the finger for itself: no mouse events, click or scrolling follow for this touch.
      pub fn on_touch_start(mut self, f: impl $crate::node::IntoTouchEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_touch_start(node, f));
        self
      }

      pub fn off_touch_start(mut self, f: impl $crate::node::IntoTouchEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_touch_start(node, f));
        self
      }

      /// A finger that landed on this element moved, wherever it now is; see
      /// [`TouchEvent`](crate::app::events::TouchEvent).
      pub fn on_touch_move(mut self, f: impl $crate::node::IntoTouchEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_touch_move(node, f));
        self
      }

      pub fn off_touch_move(mut self, f: impl $crate::node::IntoTouchEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_touch_move(node, f));
        self
      }

      /// A finger that landed on this element lifted; see [`TouchEvent`](crate::app::events::TouchEvent).
      pub fn on_touch_end(mut self, f: impl $crate::node::IntoTouchEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_touch_end(node, f));
        self
      }

      pub fn off_touch_end(mut self, f: impl $crate::node::IntoTouchEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_touch_end(node, f));
        self
      }

      /// The system took away a finger that landed on this element; see [`TouchEvent`](crate::app::events::TouchEvent).
      pub fn on_touch_cancel(mut self, f: impl $crate::node::IntoTouchEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_touch_cancel(node, f));
        self
      }

      pub fn off_touch_cancel(mut self, f: impl $crate::node::IntoTouchEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_touch_cancel(node, f));
        self
      }

      /// A finger rested on this element for half a second; see [`LongPressEvent`](crate::app::events::LongPressEvent).
      pub fn on_long_press(mut self, f: impl $crate::node::IntoLongPressEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_long_press(node, f));
        self
      }

      pub fn off_long_press(mut self, f: impl $crate::node::IntoLongPressEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_long_press(node, f));
        self
      }

      /// Two fingers on this element moved apart or together; see [`PinchEvent`](crate::app::events::PinchEvent).
      pub fn on_pinch(mut self, f: impl $crate::node::IntoPinchEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_pinch(node, f));
        self
      }

      pub fn off_pinch(mut self, f: impl $crate::node::IntoPinchEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_pinch(node, f));
        self
      }

      /// Two fingers on this element turned about their middle; see [`RotateEvent`](crate::app::events::RotateEvent).
      pub fn on_rotate(mut self, f: impl $crate::node::IntoRotateEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_rotate(node, f));
        self
      }

      pub fn off_rotate(mut self, f: impl $crate::node::IntoRotateEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_rotate(node, f));
        self
      }

      /// One or more fingers tapped this element; see [`TapEvent`](crate::app::events::TapEvent).
      pub fn on_tap(mut self, f: impl $crate::node::IntoTapEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_tap(node, f));
        self
      }

      pub fn off_tap(mut self, f: impl $crate::node::IntoTapEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_tap(node, f));
        self
      }

      /// Two taps in a row on this element; see [`TapEvent`](crate::app::events::TapEvent). While it listens, a
      /// tap's click is held back for the time of a double tap.
      pub fn on_double_tap(mut self, f: impl $crate::node::IntoTapEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_double_tap(node, f));
        self
      }

      pub fn off_double_tap(mut self, f: impl $crate::node::IntoTapEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_double_tap(node, f));
        self
      }

      /// Fingers flicked across this element; see [`SwipeEvent`](crate::app::events::SwipeEvent).
      pub fn on_swipe(mut self, f: impl $crate::node::IntoSwipeEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_swipe(node, f));
        self
      }

      pub fn off_swipe(mut self, f: impl $crate::node::IntoSwipeEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_swipe(node, f));
        self
      }

      /// Fingers are travelling over this element; see [`PanEvent`](crate::app::events::PanEvent).
      pub fn on_pan(mut self, f: impl $crate::node::IntoPanEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_pan(node, f));
        self
      }

      pub fn off_pan(mut self, f: impl $crate::node::IntoPanEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_pan(node, f));
        self
      }

      /// A finger came in from an edge of the window over this element; see
      /// [`EdgePanEvent`](crate::app::events::EdgePanEvent).
      pub fn on_edge_pan(mut self, f: impl $crate::node::IntoEdgePanEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_edge_pan(node, f));
        self
      }

      pub fn off_edge_pan(mut self, f: impl $crate::node::IntoEdgePanEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_edge_pan(node, f));
        self
      }

      pub fn on_mouse_enter(mut self, f: impl $crate::node::IntoVoidEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_mouse_enter(node, f));
        self
      }

      pub fn off_mouse_enter(mut self, f: impl $crate::node::IntoVoidEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_mouse_enter(node, f));
        self
      }

      pub fn on_mouse_leave(mut self, f: impl $crate::node::IntoVoidEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_mouse_leave(node, f));
        self
      }

      pub fn off_mouse_leave(mut self, f: impl $crate::node::IntoVoidEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_mouse_leave(node, f));
        self
      }

      pub fn on_key_down(mut self, f: impl $crate::node::IntoKeyboardEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_key_down(node, f));
        self
      }

      pub fn off_key_down(mut self, f: impl $crate::node::IntoKeyboardEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_key_down(node, f));
        self
      }

      pub fn on_key_up(mut self, f: impl $crate::node::IntoKeyboardEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_key_up(node, f));
        self
      }

      pub fn off_key_up(mut self, f: impl $crate::node::IntoKeyboardEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_key_up(node, f));
        self
      }

      pub fn on_focus(mut self, f: impl $crate::node::IntoVoidEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_focus(node, f));
        self
      }

      pub fn off_focus(mut self, f: impl $crate::node::IntoVoidEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_focus(node, f));
        self
      }

      pub fn on_blur(mut self, f: impl $crate::node::IntoVoidEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_blur(node, f));
        self
      }

      pub fn off_blur(mut self, f: impl $crate::node::IntoVoidEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_blur(node, f));
        self
      }

      pub fn on_scroll(mut self, f: impl $crate::node::IntoScrollEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_scroll(node, f));
        self
      }

      /// A wheel or a trackpad turned over the element, before anything is scrolled by it and whether or
      /// not anything can be (see `Node::on_wheel`): for an element the wheel is for something other than
      /// scrolling, which takes it with `prevent_default`.
      pub fn on_wheel(mut self, f: impl $crate::node::IntoScrollEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_wheel(node, f));
        self
      }

      pub fn off_wheel(mut self, f: impl $crate::node::IntoScrollEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_wheel(node, f));
        self
      }

      pub fn off_scroll(mut self, f: impl $crate::node::IntoScrollEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_scroll(node, f));
        self
      }

      pub fn on_scroll_start(mut self, f: impl $crate::node::IntoScrollEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_scroll_start(node, f));
        self
      }

      pub fn off_scroll_start(mut self, f: impl $crate::node::IntoScrollEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_scroll_start(node, f));
        self
      }

      pub fn on_scroll_end(mut self, f: impl $crate::node::IntoScrollEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_scroll_end(node, f));
        self
      }

      pub fn off_scroll_end(mut self, f: impl $crate::node::IntoScrollEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_scroll_end(node, f));
        self
      }

      pub fn on_scroll_reach_top(mut self, f: impl $crate::node::IntoScrollEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_scroll_reach_top(node, f));
        self
      }

      pub fn off_scroll_reach_top(mut self, f: impl $crate::node::IntoScrollEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_scroll_reach_top(node, f));
        self
      }

      pub fn on_scroll_reach_bottom(mut self, f: impl $crate::node::IntoScrollEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_scroll_reach_bottom(node, f));
        self
      }

      pub fn off_scroll_reach_bottom(mut self, f: impl $crate::node::IntoScrollEventHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_scroll_reach_bottom(node, f));
        self
      }

      /// The scroll container came to rest on another page, a page being as long as its viewport: the handler
      /// is given the page, counted from 0, along the way the container scrolls (down, where it scrolls both
      /// ways). Called once the content has stopped there, whatever took it, and not while it is on its way.
      /// See [`ScrollState::page_signal`]($crate::layout::layout_kind::ScrollState::page_signal) for the same
      /// in a render.
      pub fn on_page_change(mut self, f: impl $crate::node::IntoPageHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::on_page_change(node, f));
        self
      }

      pub fn off_page_change(mut self, f: impl $crate::node::IntoPageHandler) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::off_page_change(node, f));
        self
      }

      pub fn scrollbar(mut self, style: $crate::layout::scrollbar::ScrollBarStyle) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::scrollbar(node, style));
        self
      }

      pub fn scrollbar_hovered(
        mut self,
        f: impl Fn($crate::layout::scrollbar::ScrollBarStyle) -> $crate::layout::scrollbar::ScrollBarStyle
        + Send
        + Sync
        + 'static,
      ) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::scrollbar_hovered(node, f));
        self
      }

      pub fn hit_test(mut self, behavior: $crate::node::HitTestBehavior) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::hit_test(node, behavior));
        self
      }

      pub fn pointer_events_none(mut self) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::pointer_events_none(node));
        self
      }

      pub fn ref_element(mut self, element_ref: impl Into<$crate::core::ElementRef>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::ref_element(node, element_ref));
        self
      }

      /// A click of the element focuses `target`: the first element that takes the focus under the one the ref is
      /// on, as `Ctx::focus` finds it. What a label does for its control. A click on
      /// something under the element that takes the focus itself focuses that instead, and a disabled target is
      /// not focused. A button given one gives the focus on when it is pressed, by a click or by the keyboard: a
      /// link to a field. On an element that is dragged, the press that begins a drag focuses `target` too, as the
      /// drag gives no click.
      pub fn focuses(mut self, target: &$crate::core::ElementRef) -> Self {
        let target = target.clone();
        self.update_node(|node| node.events.focuses = Some(target));
        self
      }

      /// Whether a press of the element repeats while it is held, as the buttons that step a number do: the
      /// press of the primary button runs the element's `on_click` handlers at once, and again while the button
      /// stays down over the element, first after 400 ms and then every 50 ms. The release clicks nothing more,
      /// and what the element `focuses` is focused at the press. Enter and Space on a focused one click it once.
      pub fn repeat_press(mut self, repeats: bool) -> Self {
        self.update_node(|node| node.events.press_repeats = repeats);
        self
      }

      /// Whether Tab stops at the element, where it would: `false` passes it by, and it still takes the focus
      /// that a press, `Ctx::focus` or the arrow keys of a focus group it is in give it. A focused button so
      /// passed by is still pressed by Enter and Space. What the pointer and shortcuts reach, and Tab does not.
      pub fn tab_stop(mut self, stops: bool) -> Self {
        // Read first: writing the default would give the node the box of handlers it has none of.
        self.update_node(|node| {
          if node.events.skips_tab == stops {
            node.events.skips_tab = !stops;
          }
        });
        self
      }

      /// Whether a press of the element with the pointer focuses it, where it takes the focus: `false` leaves
      /// the focus where it was, in a field being typed in or nowhere, and runs the press as before. The element
      /// still takes the focus from Tab, `Ctx::focus` and a focus group's arrow keys. What it `focuses` is
      /// focused by the press as before.
      pub fn focus_on_press(mut self, focuses: bool) -> Self {
        self.update_node(|node| {
          if node.events.press_keeps_focus == focuses {
            node.events.press_keeps_focus = !focuses;
          }
        });
        self
      }

      /// Called as a press of the element that repeats (`repeat_press`) is let go, wherever the pointer is then, or
      /// is taken by the OS: the end of the held press, after the last of its clicks.
      pub fn on_press_end(mut self, f: impl Fn() + Send + Sync + 'static) -> Self {
        self.update_node(|node| node.events.on_press_end.push($crate::node::VoidEventHandler::new(f)));
        self
      }

      pub fn interactive(mut self, state: $crate::node::interaction_state::InteractionState) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::interactive(node, state));
        self
      }

      /// Whether the element can take focus. Buttons, text inputs,
      /// checkboxes, sliders, selects and elements with a `tab_index` are
      /// focusable by default. `focusable(true)` makes any element focusable
      /// by click and `Ctx::focus`; `focusable(false)` keeps it from ever
      /// taking focus, by click, Tab or request.
      pub fn focusable(mut self, focusable: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::focusable(node, focusable));
        self
      }

      /// Takes the element and everything in it out of the focus and the pointer, while it is still painted: Tab
      /// and a focus group's arrows pass it by, no focus request reaches it, no press, hover or drop reaches it
      /// (what is under it gets them), and the focus in it leaves when it becomes inert, to the next stop of the
      /// focus group it was in or to nothing. A splitter's closed pane, a panel on its way out. An element ref
      /// makes it so with no render: `ElementRefMut::set_inert`.
      pub fn inert(mut self, inert: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::inert(node, inert));
        self
      }

      /// While the element is in the tree it takes every key of the window before anything else does: its own
      /// `on_key_down` and `on_key_up` handlers alone are told of a key (with `focus_within` true), and nothing the
      /// window does with a key is done: no Tab, Enter or Escape, no arrows of a focus group, no Alt of a row of
      /// menus, no typing in an input, no handler of another element, and no accelerator of the app's menu. It lets
      /// go when it is built with `false` or leaves the tree. What records a shortcut, while it records. Where two
      /// capture at once, the first in the order of the tree takes the keys.
      pub fn captures_keys(mut self, captures: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::captures_keys(node, captures));
        self
      }

      /// While the focus is on the element or in it, the element and what is in it hear a key before the rest of the
      /// tree, and a key one of their handlers stops (`stop_propagation`) the rest of the tree does not hear. What the
      /// window does with the key by default (Enter presses the focused button, Escape closes the top layer, Tab moves
      /// the focus) is done as before, unless a handler prevents it. A panel over the page whose keys are its own
      /// while it has the focus: its Enter and its Ctrl+W are not also those of the page under it.
      pub fn keys_first(mut self, first: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::keys_first(node, first));
        self
      }

      /// HTML `tabindex`. Inside a form, controls are in the Tab order
      /// without one; outside a form, only elements with `tab_index(0)` or
      /// higher are. Positive values come first in ascending order, then `0`
      /// (and unset form controls) in tree order. `-1` removes the element
      /// from the Tab order but keeps it focusable by click. Setting a tab
      /// index makes the element focusable unless it is `focusable(false)`.
      pub fn tab_index(mut self, tab_index: i32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::tab_index(node, tab_index));
        self
      }

      /// Makes the element a group the arrow keys move the focus within,
      /// while the focus is on something in it: see
      /// [`FocusGroup`]($crate::node::FocusGroup).
      pub fn focus_group(mut self, group: $crate::node::FocusGroup) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::focus_group(node, group));
        self
      }

      /// Marks the element as where Tab enters the one-stop
      /// [`FocusGroup`]($crate::node::FocusGroup) it is in: the chosen radio,
      /// the chosen segment. Without one Tab enters at the first.
      pub fn focus_entry(mut self, entry: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::focus_entry(node, entry));
        self
      }

      /// Whether Tab also stops at what takes the focus inside this element where it is a button, after the
      /// button itself: a card pressed as a whole with buttons of its own in it. Off, a button's content is
      /// part of the button.
      pub fn stops_inside(mut self, stops: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::stops_inside(node, stops));
        self
      }

      /// Whether the focus goes to this element as the modal or the overlay that takes the focus it is in
      /// opens, in place of its first stop of Tab: the default button of a message box. It is a stop of Tab
      /// as it was, in its place.
      pub fn autofocus(mut self, autofocus: bool) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::autofocus(node, autofocus));
        self
      }

      /// What typing a letter in a [`FocusGroup`]($crate::node::FocusGroup)
      /// with typeahead matches the element by: a menu item's label, where
      /// its text is not only that.
      pub fn focus_label(mut self, label: impl Into<std::sync::Arc<str>>) -> Self {
        let label = label.into();
        self.update_node(|node| $crate::node::NodeUpdate::focus_label(node, label));
        self
      }

      /// The level the element is at in a nested
      /// [`FocusGroup`]($crate::node::FocusGroup): 1 at the top, 2 in an
      /// element at the top, and so on. Left goes from it to the nearest
      /// element before it at a lower level.
      pub fn focus_level(mut self, level: u32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::focus_level(node, level));
        self
      }

      /// That the element opens and closes in a nested
      /// [`FocusGroup`]($crate::node::FocusGroup), and whether it is open:
      /// Right, Left and `*` call `toggle` with what it is to be. What it
      /// holds is the elements after it at a higher level, there while it is
      /// open.
      pub fn focus_expanded(mut self, open: bool, toggle: impl Fn(bool) + Send + Sync + 'static) -> Self {
        let toggle: std::sync::Arc<dyn Fn(bool) + Send + Sync> = std::sync::Arc::new(toggle);
        self.update_node(|node| $crate::node::NodeUpdate::focus_expanded(node, open, toggle));
        self
      }

      /// Which row of the [`FocusRows`]($crate::node::FocusRows) of its focus group the element is: the group
      /// steps over the rows, and focuses the element of the row it steps to.
      pub fn focus_row(mut self, row: usize) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::focus_row(node, row));
        self
      }

      /// The column of its row the element is in, in a group of [`FocusRows`]($crate::node::FocusRows) whose
      /// rows hold several stops each (the cells of a grid, with `.focus_row(row)` on each): Up, Down, PageUp and
      /// PageDown go to the stop of the same column in the row they go to, and Ctrl+Home and Ctrl+End to the
      /// first stop of the first row and the last of the last. Left and Right are a group of each row's own.
      pub fn focus_column(mut self, column: usize) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::focus_column(node, column));
        self
      }

      /// The rows the [`FocusGroup`]($crate::node::FocusGroup) of this element steps over, where a list builds
      /// only some of them: see [`FocusRows`]($crate::node::FocusRows).
      pub fn focus_rows(mut self, rows: std::sync::Arc<dyn $crate::node::FocusRows>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::focus_rows(node, rows));
        self
      }

      #[cfg(feature = "form")]
      pub fn name(mut self, name: impl Into<std::sync::Arc<str>>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::name(node, name));
        self
      }

      /// What a selection copies of the element where it stands in a line of rich text, as an object of it
      /// ([`Text::object`](crate::components::Text::object)): a mention's name, a link's `[title](url)`. Without one
      /// an object copies nothing, and never its object character.
      pub fn copy_text(mut self, text: &str) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::copy_text(node, Some(std::sync::Arc::from(text))));
        self
      }

      /// What the element gives the form it is in under its [`name`](Self::name), where it is no engine control
      /// that gives its own (a text input gives its text, a checkbox `on`): a control of the design system made of
      /// plain elements, as a shortcut recorder gives `Ctrl+Shift+P`. `None` gives nothing.
      #[cfg(feature = "form")]
      pub fn form_value(mut self, value: Option<std::sync::Arc<str>>) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::form_value(node, value));
        self
      }

      pub fn clip(mut self) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::clip(node));
        self
      }

      pub fn overflow_visible(mut self) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::overflow_visible(node));
        self
      }

      /// Lays the element and what is in it out, and paints them, with
      /// `theme` in place of the window's: its palette, its radii, its type,
      /// its shadows. A dark panel in a light window. Components built
      /// inside take their recipes from the theme they are built in: see
      /// [`Ctx::in_theme`]($crate::app::ctx::Ctx::in_theme), which does both.
      pub fn theme(mut self, theme: &$crate::app::theme::Theme) -> Self {
        self.update_node(|node| node.set_theme_scope(theme));
        self
      }

      pub fn intrinsic(mut self, width: f32, height: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::intrinsic(node, width, height));
        self
      }

      pub fn opacity(mut self, value: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::opacity(node, value));
        self
      }

      /// Blurs the component and its content as one layer (see `Node::blur`).
      pub fn blur(mut self, radius: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::blur(node, radius));
        self
      }

      /// Blurs what is painted behind the component's box (see
      /// `Node::backdrop_blur`).
      pub fn backdrop_blur(mut self, radius: f32) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::backdrop_blur(node, radius));
        self
      }

      pub fn transition(mut self, spec: $crate::animation::Transition) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::transition(node, spec));
        self
      }

      pub fn animation(mut self, spec: $crate::animation::Animation) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::animation(node, spec));
        self
      }

      /// Keeps a child that is removed from the element where it was until the child's exit animation
      /// ends. Only a child with a key or an id and an `.exit_animation(...)` of its own is kept.
      pub fn presence(mut self) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::presence(node, true));
        self
      }

      /// The animation the element leaves with. In an `Overlay`, a `Popup`
      /// or a `Modal` it plays when the layer closes, and the layer's content
      /// stays on screen, taking no input, until the longest exit animation
      /// in it ends. On a child with a key or an id of a container with
      /// `.presence()`, it plays when a render removes the child, which
      /// stays where it was until it ends.
      pub fn exit_animation(mut self, spec: $crate::animation::Animation) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::exit_animation(node, spec));
        self
      }

      pub fn transform(mut self, t: $crate::node::transform::Transform2D) -> Self {
        self.update_node(|node| $crate::node::NodeUpdate::transform(node, t));
        self
      }
    }

    impl From<$struct_name> for $crate::node::Element {
      fn from(component: $struct_name) -> Self {
        $crate::node::Element::from_boxed_node(component.node)
      }
    }
  };
}