ferrokit 0.10.0

Native macOS GUI framework for Rust: every view a real AppKit control (NSTableView, NSOutlineView, NSTextView), updated in place by fine-grained signals
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
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
# ferrokit 0.10.0 API

Every public item of `ferrokit`, and the `ferrokit-core` types it re-exports, on one page: the signature as written and the first paragraph of its docs. Generated by `scripts/api-md.sh` from rustdoc; the full docs, and the guide, are on [docs.rs](https://docs.rs/ferrokit). Items are grouped by the source file that defines them.

AI coding agents: read `AGENTS.md`, beside this file, first: the rules, recipes and known limits. This page is for looking up what a type can do.

Conventions: views are built once and update from signals; models (`TableModel`, `TextModel`) are created once; row indices are model indices; text offsets are UTF-8 bytes; everything runs on the main thread.

**Where to look:** app, windows, menus and the shell → App and windows, `chrome`, `dialogs`, `commands`; state → `signal`, `resource`, `store`, `undo`; views and modifiers → `view`, `layout`, `appkit_views`, `controls`, `style`, `motion`; tables, outlines, text → `models`, `table`, `outline`, `text`; charts → `charts`, `canvas`; checks → Module `testing`.

**Contents:** [App and windows (lib)](#app-and-windows-lib) · [signal](#signal) · [view](#view) · [layout](#layout) · [appkit_views](#appkit_views) · [controls](#controls) · [models](#models) · [table](#table) · [outline](#outline) · [text](#text) · [commands](#commands) · [chrome](#chrome) · [dialogs](#dialogs) · [appearance](#appearance) · [frame](#frame) · [store](#store) · [undo](#undo) · [resource](#resource) · [task](#task) · [documents](#documents) · [collection](#collection) · [syntax](#syntax) · [style](#style) · [surface](#surface) · [material](#material) · [widgets](#widgets) · [media](#media) · [browser](#browser) · [crash](#crash) · [updates](#updates) · [failure](#failure) · [filter](#filter) · [form](#form) · [quicklook](#quicklook) · [services](#services) · [status](#status) · [motion](#motion) · [popover](#popover) · [canvas](#canvas) · [native](#native) · [related](#related) · [value](#value) · [transfer](#transfer) · [l10n](#l10n) · [charts](#charts) · [host](#host) · [Module updates](#module-updates) · [Module testing](#module-testing) · [Module input](#module-input) · [Module soak](#module-soak)

## App and windows (lib)

- `pub fn right_to_left() -> bool`: Whether the app lays out right to left: its language is Arabic, Hebrew, Persian or Urdu (the app's localisation and the user's languages), or the `NSForceRightToLeftWritingDirection` default is set. Ferrokit mirrors its layout then, as AppKit mirrors its own.
- `pub fn layout_times_us() -> Vec<f64>`: Microseconds of the recent layout passes, oldest first (diagnostic; at least the last 10,000).
- `pub fn layout_passes() -> u64`: Layout passes so far. With `layout_times_us`, the times of the passes since an earlier count: `let t = layout_times_us(); &t[t.len() - (layout_passes() - n0) as usize..]`.
- `pub fn open_tab(beside: &NSWindow, window: Window) -> Retained<NSWindow>`: Opens `window` as a new tab of `beside` (the tab bar's + and a "New Tab" command use this).
- `pub fn toggle_full_screen(window: &NSWindow)`: Puts `window` into full screen, or takes it out (as the green button and View ▸ Enter Full Screen do).
- `pub fn is_full_screen(window: &NSWindow) -> bool`: Whether `window` is in full screen.
- `pub fn set_dock_badge(badge: Option<&str>)`: The Dock icon's badge: a count or a short word (`Some("3")`), or none.
- `pub fn dock_badge() -> Option<String>`: The Dock icon's badge, if any.
- `pub fn open_with(make: impl FnOnce() -> Window) -> Retained<NSWindow>`: Opens the window `make` builds, now, and returns it: the signals `make` creates (a form's fields, a selection) belong to the window and are freed when it closes. Prefer it to `open` in an action: a signal made in an action outside any view lives as long as the app.
- `pub fn open(window: Window) -> Retained<NSWindow>`: Opens `window` now (while the app runs) and returns it.
- `pub fn open_settings() -> Option<Retained<NSWindow>>`: Opens the app's Settings window (see `App::settings`), or brings it to the front, and returns it. `None` if the app has none.
- `pub fn close_window(window: &NSWindow)`: Closes `window` and tears down its views (its node is dropped: effects stop, native views go). The app no longer lists it in `windows`.
- `pub fn windows() -> Vec<Retained<NSWindow>>`: The app's windows, in the order they were opened.
- `pub fn later(f: impl Fn() + 'static)`: Runs `f` on a later pass of the main run loop.
- `pub fn set_appearance(appearance: Appearance)`: Sets the app's appearance; every native view follows, and an `AppEvent::AppearanceChanged` is delivered.
- `pub fn quit()`: Ends the app (as ⌘Q does), on the next pass of the run loop. Quitting can wait for answers (a document app asks about unsaved changes) inside a nested run loop; starting it outside the caller's batch keeps the UI updating meanwhile.
- `pub fn spawn<T: Send + 'static>(work: impl FnOnce() -> T + Send + 'static, then: impl FnOnce(T) + 'static)`: Runs `work` on a background thread, then `then` with its result on the main thread, inside a `batch`. Call from the main thread.
- `pub fn spawn_with_progress<T: Send + 'static>(progress: &Signal<Option<f64>>, work: impl FnOnce(&Reporter) -> T + Send + 'static, then: impl FnOnce(T) + 'static)`: `spawn` for a long job that reports how far it is: `progress` reads `Some(0.0)` at once, the fractions `work` reports through its `Reporter` as it goes, and `None` once it's done (just before `then` runs; also if `work` panics, when `then` doesn't run). Show it with `progress`:

### `Window`

`pub struct Window`: A window to open when the app starts.

- `pub fn on_drop_files(mut self, extensions: &[&str], action: impl Fn(Vec<std::path::PathBuf>) + 'static) -> Self`: Files dropped anywhere on the window (that its views don't take themselves) go to `action`: those with one of `extensions`, or any file if it's empty. The pointer shows a copy badge over the window while they're dragged.
- `pub fn new(title: &str) -> Self`: A titled, resizable window of 800 × 600 points.
- `pub fn sidebar(mut self, view: impl View) -> Self`: A sidebar beside the window's `view`, as in Mail, Notes and the Finder (AppKit's split view controller): full height, under the title bar, on the sidebar material; the title and toolbar items start beside it, a Toggle Sidebar button leads the toolbar, and the user can drag it narrower, wider or shut. Put an `outline` or a source-list `sidebar` in it.
- `pub fn sidebar_hidden(mut self, hidden: &Signal<bool>) -> Self`: Whether the sidebar is hidden, bound two ways: setting it shows or hides the sidebar (animated), and the user's toggling sets it.
- `pub fn inspector(mut self, view: impl View) -> Self`: An inspector after the window's `view`, as in Keynote and Xcode (AppKit's inspector split item, macOS 14): full height, a Toggle Inspector button ending the toolbar, the user can drag it wider or shut.
- `pub fn inspector_hidden(mut self, hidden: &Signal<bool>) -> Self`: Whether the inspector is hidden, bound two ways.
- `pub fn tabbing(mut self, tabbing: Tabbing, group: Option<&str>) -> Self`: How the window joins its app's other windows as tabs. Windows join those with the same `group` (all the app's, if `None`); the Window menu's Show Tab Bar, Merge All Windows and the tab bar's + work as in any Mac app.
- `pub fn no_full_screen(mut self) -> Self`: No full screen: the green button only zooms (a palette, a small utility). Resizable windows can go full screen by default.
- `pub fn panel(mut self, style: PanelStyle) -> Self`: Makes it a panel (`NSPanel`): floating above the app's windows, hidden while the app is inactive, and not in the Window menu's list of documents.
- `pub fn toolbar_style(mut self, style: ToolbarStyle) -> Self`: How the toolbar sits with the title (`ToolbarStyle::Unified` by default).
- `pub fn hide_title(mut self) -> Self`: Hides the title in the title bar (it still names the window in the Window menu and Mission Control): for windows whose content says what they are.
- `pub fn transparent_title_bar(mut self) -> Self`: A title bar without its own background: the window's background shows through it, so the title bar and content read as one surface.
- `pub fn full_size_content(mut self) -> Self`: Content under the title bar and toolbar, which become transparent. The content's backgrounds and materials, and a `split`'s panes, reach the window's top edge (a sidebar's material runs up behind the window buttons, as in Apple's apps), while the content itself starts below the title bar.
- `pub fn background(mut self, color: Color) -> Self`: The window's background colour (the system's window background by default). Named colours follow Dark Mode.
- `pub fn size(mut self, width: f64, height: f64) -> Self`: The content size in points.
- `pub fn view(mut self, view: impl View) -> Self`: The window's content: `view`, laid out to fill the window.
- `pub fn toolbar(mut self, items: Vec<ToolbarItem>) -> Self`: A unified toolbar with these items.
- `pub fn customizable_toolbar(mut self, name: &str) -> Self`: Lets the user customise the toolbar: Customize Toolbar… on its right-click menu (and in a View menu, with `customize_toolbar_item`) opens AppKit's sheet, where items can be added, removed and moved, including optional ones and spaces; Command-dragging moves them too. The layout is remembered under `name` across launches; until the user changes it, the app's own layout shows.
- `pub fn on_command(mut self, command: Command, action: impl Fn() + 'static) -> Self`: Handles `command` while this window is focused and nothing nearer the focus handles it (see `Command`), wherever the focus is: in the content, the sidebar or the inspector.
- `pub fn on_command_when(mut self, command: Command, enabled: impl Fn() -> bool + 'static, action: impl Fn() + 'static) -> Self`: Handles `command` like `on_command`, enabled only while `enabled` returns true.
- `pub fn remember_frame(mut self, name: &str) -> Self`: Saves the window's position and size under `name` whenever they change, and reopens it there next time (AppKit's frame autosave, in the app's user defaults).
- `pub fn content(mut self, build: impl FnOnce() -> Retained<NSView> + 'static) -> Self`: A plain `NSView` as the window's content (escape hatch; no layout).

### `Tabbing`

`pub enum Tabbing`: Whether a window opens as a tab of its app's other windows (`Window::tabbing`).

- `Automatic`: As the user set in System Settings ▸ Desktop & Dock ("Prefer tabs").
- `Preferred`: Always as a tab, as Safari's and the Finder's windows do.
- `Disallowed`: Never as a tab, and no tab bar (a settings window, a viewer).

### `PanelStyle`

`pub enum PanelStyle`: A panel's kind (`Window::panel`): a secondary window serving the main ones, which hides while the app is in the background.

- `Floating`: Stays above the app's other windows: an inspector, a palette, a find panel. It becomes key only when a field in it is clicked, so the main window keeps the keyboard.
- `Utility`: As `Floating`, with a slimmer title bar: tool palettes.
- `Hud`: A dark, translucent heads-up panel over media or a canvas.

### `ToolbarStyle`

`pub enum ToolbarStyle`: How a window's toolbar sits with its title (see `Window::toolbar_style`).

- `Unified`: The title and toolbar items in one bar (the default).
- `UnifiedCompact`: One bar, shorter: for windows with few toolbar items.
- `Expanded`: The title above the toolbar, items labelled (as in Settings windows). The other styles show symbols alone.
- `Preference`: The title above the toolbar, items centred (Settings' tabs).

### `AppEvent`

`pub enum AppEvent`: What the app hears about its environment.

- `AppearanceChanged`: Dark Mode or the accent colour changed. Read `is_dark` / `system_colors`.

### `App`

`pub struct App`: The application: a name, its windows and the AppKit run loop.

- `pub fn new(name: &str) -> Self`: An app called `name` (shown in the menu bar).
- `pub fn window(mut self, window: Window) -> Self`: Opens `window` at launch. Call more than once for several windows.
- `pub fn translations(self, tables: &[(&str, &str)]) -> Self`: The app's translations: `(language, .strings text)` pairs, e.g. `("de", include_str!("../locales/de.strings"))`. The languages here are the ones the app speaks; see `t` and the `l10n` functions.
- `pub fn menu(mut self, title: &str, items: Vec<MenuItem>) -> Self`: Adds a menu to the menu bar, between Edit and Window ("View", "Go"…). A menu titled "Edit" adds its items to the standard Edit menu (after Find), and one titled "Help" fills the standard Help menu. A menu titled "File" fills the standard File menu instead, above its Close item. Items run in a `batch`; their enabled and checked states are evaluated when the menu opens or a key equivalent fires.
- `pub fn about(mut self, credits: &str, link: Option<(&str, &str)>) -> Self`: Credits for About {app}: `credits` under the app's name, icon and version (from the bundle), and `link` (title, URL) after it, e.g. `.about("Made with Ferrokit.", Some(("ferrokit.dev", "https://…")))`.
- `pub fn settings(mut self, window: Window) -> Self`: The app's Settings window: "Settings…" (⌘,) in the app menu opens it (built on first use, then brought to the front). It isn't resizable or listed in the Window menu, and it remembers its position.
- `pub fn documents<T: Clone + PartialEq + 'static>(mut self, kind: DocumentType<T>) -> Self`: Makes this a document app for `kind` (see `DocumentType`): the File menu gets New, Open…, Open Recent, Save, Save As… and Revert to Saved; closing an edited document asks to save it, and quitting reviews the unsaved ones. With no windows given, the app starts with an untitled document.
- `pub fn welcome(mut self, make: impl Fn() -> Window + 'static) -> Self`: A welcome window for a document app, shown at launch instead of an untitled document (as Xcode's is): recent documents, a sample, Open… `make` builds it each time it opens. It closes when a document opens, and Window ▸ Welcome to … (⇧⌘1) or `show_welcome` brings it back.
- `pub fn menu_bar_extra(mut self, extra: MenuBarExtra) -> Self`: Adds an item to the right side of the menu bar, with a menu or a panel (see `MenuBarExtra`).
- `pub fn menu_bar_only(mut self) -> Self`: Makes this a menu-bar app: no Dock icon and no menu bar of its own, only its `menu_bar_extra`s (and any windows it opens).
- `pub fn dock_menu(mut self, items: impl Fn() -> Vec<MenuItem> + 'static) -> Self`: Items for the Dock icon's menu (Control-click or a long press on the icon), above the system's own: "New Window", a recent item. `items` runs each time the menu opens, so it can read the app's state.
- `pub fn on_open_url(mut self, f: impl Fn(&str) + 'static) -> Self`: Links in the app's own URL schemes: `f` gets each one opened while the app runs or that launched it (`myapp://open?id=3`, from a web page, another app or `open` in Terminal), after its windows are up. Declare the schemes in `Cargo.toml`: `cargo ferrokit bundle` writes them into the app's `Info.plist`, and macOS learns them the first time the bundled app runs (`cargo ferrokit run` does both):
- `pub fn crash_reports(mut self, f: impl Fn(CrashReport) + 'static) -> Self`: Crash reports. From now on, a panic Ferrokit doesn't catch (one outside a control's action, menu item, timer or the like, which `on_error` hears about and survives; or one on a background thread) writes a report before the app ends: the app, its version, macOS, the thread, the message and where, and the backtrace, in `~/Library/Logs/<app>/Crashes`. At the next launch, after the windows are on screen, `f` gets each report not yet marked sent: ask the user to send it, send it to a service, or keep it.
- `pub fn on_launch(mut self, f: impl FnOnce() + 'static) -> Self`: Runs `f` on the first run-loop pass after the windows are on screen.
- `pub fn on_command(self, command: Command, action: impl Fn() + 'static) -> Self`: Handles `command` when nothing nearer the focus does (or no window is open). See `Command`.
- `pub fn on_error(self, f: impl Fn(&Failure) + 'static) -> Self`: Calls `f` when something fails where AppKit called into the app (an action, a menu item, a timer, a notification, a sheet's completion): an Objective-C exception or a Rust panic, caught there so the app goes on (it's also printed to stderr). Log it, or tell the user.
- `pub fn on_event(self, f: impl Fn(AppEvent) + 'static) -> Self`: Calls `f` for every `AppEvent`.
- `pub fn run(self)`: Creates the menu bar and windows, then runs the AppKit run loop. Does not return while the app is running.

### `Appearance`

`pub enum Appearance`: The app's appearance.

- `System`: Follow the system setting.
- `Light`: Always light.
- `Dark`: Always dark.

### `Reporter`

`pub struct Reporter`: What a job started by `spawn_with_progress` reports its progress through, from its background thread.

- `pub fn report(&self, fraction: f64)`: How far the job is, from 0 to 1 (clamped). Cheap to call often: the signal gets the latest value on the main thread's next pass.

## signal

- `pub fn after_batch(f: impl Fn() + 'static)`: Registers `f` to run after every outermost batch, once its effects have run (the layout pass hooks in here).
- `pub fn batch<R>(f: impl FnOnce() -> R) -> R`: Runs `f`; effects triggered inside run once, when the outermost batch ends.
- `pub fn effect_runs() -> u64`: Total effect runs on this thread so far (diagnostic).
- `pub fn live_signals() -> usize`: Live signals in the arena (diagnostic: freed ones are reused).
- `pub fn untrack<R>(f: impl FnOnce() -> R) -> R`: Reads signals inside `f` without subscribing the running effect to them.

### `Effect`

`pub struct Effect(Rc<EffectInner>)`: A side effect that re-runs when the signals it read change. It stops when the handle is dropped.

- `pub fn new(f: impl FnMut() + 'static) -> Effect`: Runs `f` now, and again (once per batch) whenever a signal it read during its last run changes.

### `Memo`

`pub struct Memo<T>`: Derived state: recomputed when its inputs change; readers are notified only when the value actually changes. A `Copy` handle, owned like a `Signal`.

- `pub fn new(f: impl Fn() -> T + 'static) -> Self`: A value computed by `f` from other signals.
- `pub fn get(&self) -> T`: The current value, subscribing the running effect.
- `pub fn with<R>(&self, f: impl FnOnce(&T) -> R) -> R`: Reads the value through `f`, subscribing the running effect.
- `pub fn get_untracked(&self) -> T`: The current value, without subscribing.
- `pub fn with_untracked<R>(&self, f: impl FnOnce(&T) -> R) -> R`: Reads the value through `f` without subscribing.

### `Signal`

`pub struct Signal<T>`: Mutable state: a `Copy` handle (closures capture it as is). It belongs to the owner current when it was made (see the module docs) and is freed with it; afterwards reading it panics and setting it does nothing.

- `pub fn new(value: T) -> Self`: A signal holding `value`, owned by the current owner (if any).
- `pub fn is_alive(&self) -> bool`: Whether the signal still exists (its owner hasn't been dropped).
- `pub fn try_get(&self) -> Option<T> where T: Clone`: A copy of the value, subscribing the running effect; `None` once the signal was freed.
- `pub fn with<R>(&self, f: impl FnOnce(&T) -> R) -> R`: Reads the value through `f`, subscribing the running effect.
- `pub fn get(&self) -> T where T: Clone`: A copy of the value, subscribing the running effect.
- `pub fn get_untracked(&self) -> T where T: Clone`: A copy of the value, without subscribing.
- `pub fn with_untracked<R>(&self, f: impl FnOnce(&T) -> R) -> R`: Reads the value through `f` without subscribing: like `with`, for a large value (a `Vec`, a tree) that an effect reads but shouldn't re-run for.
- `pub fn set(&self, value: T)`: Replaces the value and notifies readers (nothing, once freed).
- `pub fn set_if_changed(&self, value: T) where T: PartialEq`: Replaces the value and notifies readers only if it changed.
- `pub fn update(&self, f: impl FnOnce(&mut T))`: Changes the value in place and notifies readers (nothing, once freed).

## view

- `pub fn dynamic<V: View>(f: impl Fn() -> V + 'static) -> Dynamic`: A region rebuilt when the signals `f` reads change (see `Dynamic`).
- `pub fn for_each<T, V>(items: impl Fn() -> Vec<T> + 'static, row: impl Fn(T) -> V + 'static) -> ForEach where T: Identifiable + 'static, V: View`: One view per item from `items` (re-run when the signals it reads change).
- `pub fn grid(rows: impl IntoIterator<Item = impl Views>) -> Grid`: A grid from rows of views (rows may be shorter than others).
- `pub fn hstack(children: impl Views) -> Stack`: Children left to right.
- `pub fn zstack(children: impl Views) -> Layers`: Children on top of one another, the first at the back: text or a glass panel over a picture, a badge over an icon. The stack is as large as its largest child. Children that fill (a picture with `.fill_width()` and `.fill_height()`) take its whole size; the others keep their own and are centred, or placed by `alignment`.
- `pub fn live_nodes() -> usize`: Number of live nodes (diagnostic, for teardown checks).
- `pub fn spacer() -> Spacer`: Flexible empty space along its stack's axis.
- `pub fn vstack(children: impl Views) -> Stack`: Children top to bottom.
- `pub fn watch(f: impl FnMut() + 'static) -> Watch`: A side effect owned by the view tree (see `Watch`).

### `Align`

`pub enum Align`: Alignment across a stack's axis.

- `Start`: Leading (vertical stacks) or top (horizontal stacks).
- `Center`: Centred.
- `End`: Trailing or bottom.

### `AnyView`

`pub struct AnyView`: A type-erased view (any `View` converts into one).

- `pub fn new(view: impl View) -> Self`: Erases `view`.

### `Axis`

`pub enum Axis`: Stack direction.

- `Horizontal`: Children left to right.
- `Vertical`: Children top to bottom.

### `Cx`

`pub struct Cx`: Where a view is being built: the native view its leaves are added to.

### `Dynamic`

`pub struct Dynamic(Box<dyn Fn() -> AnyView>)`: A region whose content is rebuilt when the signals `f` reads change. If the new view has the same `.id(..)` as the current one, the current node (and its native views) is kept.

### `ForEach`

`pub struct ForEach(Box<dyn FnOnce(&mut Cx) -> Node>)`: One view per item. When the items change, items whose id is still present keep their node (and native views); new ones are built; removed ones are torn down. Order follows the items.

### `Grid`

`pub struct Grid`: Rows of cells in aligned columns: each column is as wide as its widest cell, each row as tall as its tallest. Columns (rows) with a flexible cell share the extra space.

- `pub fn align_column(mut self, column: usize, align: Align) -> Self`: Horizontal alignment of the cells in `column` (default leading). Mac forms right-align their label column: `.align_column(0, Align::End)`.
- `pub fn spacing(mut self, columns: f64, rows: f64) -> Self`: Space between columns and between rows (default 8, 8).

### `Identifiable` (trait)

`pub trait Identifiable`: Items with a stable identity, for `for_each`.

- `type Id: Hash + Eq + Clone + 'static`: The identity type.
- `fn id(&self) -> Self::Id`: This item's identity.

### `Modified`

`pub struct Modified<V>`: A view with modifiers applied (see `ViewExt`). Layout and look modifiers apply in the order written, as SwiftUI's do: `.frame(18.0, 18.0).padding(7.0)` is an 18-point view with 7 points around it, and `.padding(16.0).background(..)` puts the background under the padding too, while `.background(..).padding(16.0)` doesn't.

- `pub fn popover<P: View>(self, shown: &Signal<bool>, content: impl Fn() -> P + 'static) -> Self`: Shows `content` in a popover pointing at this view while `shown` is true; closing it (Escape, a click outside) sets `shown` to false. The content is built each time it opens and freed when it closes.
- `pub fn popover_on<P: View>(mut self, edge: crate::Edge, shown: &Signal<bool>, content: impl Fn() -> P + 'static) -> Self`: `popover` on a given side of the view.
- `pub fn on_command(mut self, command: crate::Command, action: impl Fn() + 'static) -> Self`: Handles `command` while the focus is in this view (or nothing nearer the focus handles it). See `Command`.
- `pub fn on_command_when(mut self, command: crate::Command, enabled: impl Fn() -> bool + 'static, action: impl Fn() + 'static) -> Self`: Handles `command` like `on_command`, enabled only while `enabled` returns true (a disabled handler still answers: the menu item is greyed out, and handlers further out aren't asked).
- `pub fn focused_value<T: Clone + 'static>(mut self, name: &'static str, value: T) -> Self`: Publishes `value` under `name` while the focus is in this view, for `focused_value` (a signal, typically: the list's selection, the editor's document).
- `pub fn accessibility_label(mut self, label: &str) -> Self`: The name VoiceOver reads for this view's native views.
- `pub fn context_menu(mut self, items: Vec<crate::chrome::MenuItem>) -> Self`: A right-click menu on this view's native views.
- `pub fn fill_width(mut self) -> Self`: Takes all the width its container offers.
- `pub fn fill_height(mut self) -> Self`: Takes all the height its container offers.
- `pub fn padding(mut self, points: f64) -> Self`: Inset on all sides, in points.
- `pub fn padding_xy(mut self, horizontal: f64, vertical: f64) -> Self`: Inset left and right, and above and below (see `ViewExt::padding_xy`).
- `pub fn width(mut self, points: f64) -> Self`: A fixed width.
- `pub fn min_width(mut self, points: f64) -> Self`: A minimum width (see `ViewExt::min_width`).
- `pub fn min_height(mut self, points: f64) -> Self`: A minimum height (see `ViewExt::min_height`).
- `pub fn height(mut self, points: f64) -> Self`: A fixed height.
- `pub fn background(mut self, color: impl crate::IntoValue<crate::Color>) -> Self`: A background behind the view (see `ViewExt::background`).
- `pub fn corner_radius(mut self, points: f64) -> Self`: Rounded corners for the background and border.
- `pub fn border(mut self, color: crate::Color, width: f64) -> Self`: A border around the view.
- `pub fn shadow(mut self, shadow: crate::Shadow) -> Self`: A drop shadow under the view's background.
- `pub fn opacity(mut self, opacity: impl crate::IntoValue<f64>) -> Self`: The view at `opacity` (see `ViewExt::opacity`).
- `pub fn font(mut self, font: crate::Font) -> Self`: The font of the text inside (see `ViewExt::font`).
- `pub fn color(mut self, color: impl crate::IntoValue<crate::Color>) -> Self`: The colour of the text and symbols inside (see `ViewExt::color`).
- `pub fn accessibility_value(mut self, value: impl crate::IntoValue<String>) -> Self`: What VoiceOver reads as the value (see `ViewExt::accessibility_value`).
- `pub fn material(mut self, material: crate::Material) -> Self`: A system material behind the view (see `ViewExt::material`).
- `pub fn glass(mut self, glass: crate::Glass) -> Self`: Liquid Glass behind the view (see `ViewExt::glass`).
- `pub fn background_when(self, color: impl Fn() -> crate::Color + 'static) -> Self`: A background following signals (now `background` takes a closure).
- `pub fn opacity_when(self, opacity: impl Fn() -> f64 + 'static) -> Self`: Opacity following signals (now `opacity` takes a closure).
- `pub fn matched_geometry(mut self, id: &str) -> Self`: Matched geometry (see `ViewExt::matched_geometry`).
- `pub fn transition(mut self, transition: crate::Transition) -> Self`: How the view comes and goes (see `ViewExt::transition`).
- `pub fn on_hover(mut self, action: impl Fn(bool) + 'static) -> Self`: Hover in and out (see `ViewExt::on_hover`).
- `pub fn hover_highlight(mut self, color: crate::Color) -> Self`: A background while hovered (see `ViewExt::hover_highlight`).
- `pub fn tooltip(mut self, text: &str) -> Self`: A tooltip (see `ViewExt::tooltip`).
- `pub fn disabled(mut self, when: impl crate::IntoValue<bool>) -> Self`: Disabled controls (see `ViewExt::disabled`).
- `pub fn hidden(mut self, when: impl crate::IntoValue<bool>) -> Self`: Hidden while `when()` is true (see `ViewExt::hidden`).
- `pub fn on_click(mut self, action: impl Fn() + 'static) -> Self`: The view as a button (see `ViewExt::on_click`).

### `Node`

`pub struct Node`: A built view: native views, effects and helper objects it owns.

### `Size`

`pub struct Size`: A size in points.

- `pub w: f64`: Width.
- `pub h: f64`: Height.

### `Spacer`

`pub struct Spacer`: Flexible empty space along its stack's axis.

### `Stack`

`pub struct Stack`: A stack of views along one axis.

- `pub fn alignment(mut self, align: Align) -> Self`: Alignment across the axis (default: leading for vertical stacks, centred for horizontal ones).
- `pub fn spacing(mut self, points: f64) -> Self`: Space between children, in points (default 8).

### `View` (trait)

`pub trait View: 'static`: Something that can be shown. Build-once: `View::build` creates native views and effects; it is never called again for the same place.

- `fn build(self, cx: &mut Cx) -> Node`: Creates the node (native views are added to `cx`'s container).
- `fn id(self, id: impl Hash) -> AnyView where Self: Sized`: Gives the view an identity: a `dynamic` region keeps the existing node instead of rebuilding when the new view has the same id.

### `ViewExt` (trait)

`pub trait ViewExt: View + Sized`: Modifiers every view has.

- `fn on_command(self, command: crate::Command, action: impl Fn() + 'static) -> Modified<Self>`: Handles `command` while the focus is in this view (see `Command`).
- `fn on_command_when(self, command: crate::Command, enabled: impl Fn() -> bool + 'static, action: impl Fn() + 'static) -> Modified<Self>`: Handles `command`, enabled only while `enabled` returns true.
- `fn focused_value<T: Clone + 'static>(self, name: &'static str, value: T) -> Modified<Self>`: Publishes `value` under `name` to the focus (see `focused_value`).
- `fn padding(self, points: f64) -> Modified<Self>`: Inset on all sides, in points.
- `fn padding_xy(self, horizontal: f64, vertical: f64) -> Modified<Self>`: Inset `horizontal` points left and right and `vertical` above and below: a row's `.padding_xy(10.0, 7.0)`, as SwiftUI's `.padding(.horizontal, 10)` and `.padding(.vertical, 7)`.
- `fn width(self, points: f64) -> Modified<Self>`: A fixed width.
- `fn min_width(self, points: f64) -> Modified<Self>`: At least `points` wide (SwiftUI's `frame(minWidth:)`).
- `fn min_height(self, points: f64) -> Modified<Self>`: At least `points` tall (SwiftUI's `frame(minHeight:)`).
- `fn height(self, points: f64) -> Modified<Self>`: A fixed height.
- `fn frame(self, width: f64, height: f64) -> Modified<Self>`: A fixed size.
- `fn fill_width(self) -> Modified<Self>`: Takes all the width its container offers.
- `fn fill_height(self) -> Modified<Self>`: Takes all the height its container offers.
- `fn popover<P: View>(self, shown: &Signal<bool>, content: impl Fn() -> P + 'static) -> Modified<Self>`: Shows `content` in a popover pointing at this view while `shown` is true (see `Modified::popover`).
- `fn context_menu(self, items: Vec<crate::chrome::MenuItem>) -> Modified<Self>`: A right-click menu on this view's native views.
- `fn accessibility_label(self, label: &str) -> Modified<Self>`: The name VoiceOver reads for this view's native views ("Name", "Volume"), for controls whose visible label is a separate view or that have none (a field after a `text("Name:")`, an icon button).
- `fn background(self, color: impl crate::IntoValue<crate::Color>) -> Modified<Self>`: A background behind the view, its padding included: with `corner_radius` and `shadow`, a card. `Color::QuaternaryFill` is the system's grouped-card colour. A closure computes it from signals (a selected row, a status); it changes smoothly inside `animated`.
- `fn corner_radius(self, points: f64) -> Modified<Self>`: Rounds the corners of the view's background and border, in points.
- `fn border(self, color: crate::Color, width: f64) -> Modified<Self>`: A border `width` points wide around the view (inside its padding).
- `fn shadow(self, shadow: crate::Shadow) -> Modified<Self>`: A drop shadow under the view's background (give it a background).
- `fn opacity(self, opacity: impl crate::IntoValue<f64>) -> Modified<Self>`: The view at `opacity` (0 transparent, 1 opaque), all of it, or a closure computing it from signals; it fades inside `animated`.
- `fn font(self, font: crate::Font) -> Modified<Self>`: The font of the text inside the view (all of it, when it's a row or a card): a text style or a custom font. Works after any modifier.
- `fn color(self, color: impl crate::IntoValue<crate::Color>) -> Modified<Self>`: The colour of the text and symbols inside the view, or a closure computing it from signals. Works after any modifier.
- `fn accessibility_value(self, value: impl crate::IntoValue<String>) -> Modified<Self>`: What VoiceOver reads as the view's value, after its name: a card's state ("done"), a gauge's level. A closure keeps it current.
- `fn material(self, material: crate::Material) -> Modified<Self>`: A system material behind the view, its padding included: a translucent sidebar, header or panel that blurs what's behind it. `corner_radius` rounds it.
- `fn glass(self, glass: crate::Glass) -> Modified<Self>`: Liquid Glass behind the view, its padding included (macOS 26; a translucent material on macOS 15). `corner_radius` rounds it.
- `fn background_when(self, color: impl Fn() -> crate::Color + 'static) -> Modified<Self>`: A background following signals (now `background` takes a closure).
- `fn opacity_when(self, opacity: impl Fn() -> f64 + 'static) -> Modified<Self>`: Opacity following signals (now `opacity` takes a closure).
- `fn transition(self, transition: crate::Transition) -> Modified<Self>`: How the view comes and goes when it's added or removed (by `dynamic` or `for_each`) inside `animated`.
- `fn matched_geometry(self, id: &str) -> Modified<Self>`: Matched geometry (SwiftUI's `matchedGeometryEffect`): when, in one `animated` change, a view with this `id` goes and another with it comes (a thumbnail replaced by its detail, a selection marker moving), the new one starts where and as large as the old one was, and moves to its place.
- `fn on_hover(self, action: impl Fn(bool) + 'static) -> Modified<Self>`: Calls `action` with `true` when the pointer moves over the view and `false` when it leaves (while the app is active).
- `fn hover_highlight(self, color: crate::Color) -> Modified<Self>`: A background of `color` while the pointer is over the view, fading in and out: for rows and cards that can be clicked.
- `fn tooltip(self, text: &str) -> Modified<Self>`: A tooltip: `text` appears in a small box when the pointer rests on the view (SwiftUI's `help`). VoiceOver reads it as the view's help.
- `fn hidden(self, when: impl crate::IntoValue<bool>) -> Modified<Self>`: Hides the view while `when()` is true, following the signals it reads: its native views stay built (no rebuild, the state inside kept) but aren't shown, and it takes no room in its stack, as if it weren't there. For a panel shown in one mode only, rather than a `dynamic` that rebuilds it each time. VoiceOver and Tab skip it.
- `fn disabled(self, when: impl crate::IntoValue<bool>) -> Modified<Self>`: Disables the view's controls while `when()` is true (a picker that only matters once a checkbox is on, a form while it's saving), following the signals it reads. SwiftUI's `disabled`.
- `fn on_click(self, action: impl Fn() + 'static) -> Modified<Self>`: Makes the whole view a button: a click on it calls `action`, it dims while pressed, and VoiceOver reads it as a button named by its text. For rows, cards and tiles; controls inside it don't get clicks.

### `Views` (trait)

`pub trait Views`: A list of child views: a tuple of up to 16 views, or a `Vec<AnyView>` (`vec![AnyView::new(a), AnyView::new(b), ..]`) for more. A nested stack also groups children: `vstack((header, vstack((a, b, c)), footer))`.

- `fn into_views(self) -> Vec<AnyView>`: Erases the children, in order.

### `Layers`

`pub struct Layers`: Children on top of one another (see `zstack`).

- `pub fn alignment(mut self, horizontal: Align, vertical: Align) -> Self`: Where children smaller than the stack sit, across and down (default centred): `Align::Start` is leading or top, `Align::End` trailing or bottom.

### `Watch`

`pub struct Watch(Box<dyn FnMut()>)`: Runs a side effect for as long as this place in the tree exists; takes no space. For work that follows signals but shows nothing (applying a setting, saving a value).

## layout

- `pub fn layout_stats() -> (u64, u64, u64)`: Layout counters since the app started: nodes placed, subtrees skipped as clean, and ideal sizes computed (cache misses). Diagnostic.

## appkit_views

- `pub type Label = Text`: `Text`: `label(f)` was the name for text computed from signals; `text` takes a closure too.
- `pub fn button(title: impl crate::IntoValue<String>, action: impl Fn() + 'static) -> Button`: A push button; `action` runs inside a batch. The title is fixed, or a closure computing it from signals ("Show Sidebar" or "Hide Sidebar").
- `pub fn divider() -> Divider`: A separator line across its stack.
- `pub fn help_button(action: impl Fn() + 'static) -> HelpButton`: The round "?" button that opens help for the window or panel it's in (put it in the bottom corner of a settings pane or sheet). VoiceOver reads it as "Help".
- `pub fn label(f: impl Fn() -> String + 'static) -> Text`: Text computed from signals: the same as `text` with a closure.
- `pub fn menu_button(title: &str, items: Vec<crate::MenuItem>) -> MenuButton`: A button showing a menu of actions when clicked (a pull-down button: "Export" with "CSV…", "JSON…", "PDF…"). The items are menu items, as in the menu bar: enabled, checked and with key equivalents.
- `pub fn scroll(content: impl View) -> Scroll`: Vertically scrolling `content`.
- `pub fn text(content: impl crate::IntoValue<String>) -> Text`: Text: fixed (`text("Packing list")`), or computed from signals and updated in place (`text(move || format!("{} left", left.get()))`).

### `Button`

`pub struct Button`: A push button.

- `pub fn disabled(mut self, when: impl crate::IntoValue<bool>) -> Self`: Disables the button: `true`, or a closure reading signals (disabled while it returns true).
- `pub fn symbol(mut self, name: impl crate::IntoValue<String>) -> Self`: An SF Symbol on the button, before its title, or alone when the title is empty (the title is then what VoiceOver reads; give it one with `accessibility_label`). A closure changes it with signals: Play and Pause, `move || if playing.get() { "pause.fill" } else { "play.fill" }`.
- `pub fn default_action(mut self) -> Self`: Makes this the window's default button: blue, and Return presses it.
- `pub fn cancel_action(mut self) -> Self`: Makes this the window's cancel button: Escape presses it, as in a sheet's Cancel.
- `pub fn style(mut self, style: ButtonStyle) -> Self`: How it's drawn: borderless, inline, recessed, circular, toolbar, glass.
- `pub fn control_size(mut self, size: ControlSize) -> Self`: Mini, small, regular or large.
- `pub fn destructive(mut self) -> Self`: Marks the action as destructive (Delete, Discard): AppKit draws it in red where the style allows, and it's never pressed by Return.

### `ButtonStyle`

`pub enum ButtonStyle`: How a button is drawn (`Button::style`, `MenuButton::style`).

- `Standard`: The standard rounded push button.
- `Borderless`: No bezel: the title or symbol alone, highlighted when pressed.
- `Inline`: A small capsule, for buttons inside text or a list row.
- `Recessed`: A bezel that shows only on hover and press, for filter bars (Mail's "All" and "Unread" above a list).
- `Circular`: A round button, for a symbol alone.
- `Toolbar`: The toolbar's look, for buttons in a bar of the content.
- `Glass`: Liquid Glass (macOS 26); the standard style before it.

### `ControlSize`

`pub enum ControlSize`: A control's size, as in Apple's apps: small controls in inspectors and dense panels, large ones for a welcome window's main actions.

- `Mini`: The smallest, for tight spaces.
- `Small`: Inspectors and panels.
- `Regular`: The usual size.
- `Large`: Prominent actions.

### `Divider`

`pub struct Divider`: A thin separator line across its stack: horizontal in a vertical stack, vertical in a horizontal one.

### `HelpButton`

`pub struct HelpButton(Box<dyn Fn()>)`: See `help_button`.

### `MenuButton`

`pub struct MenuButton`: See `menu_button`.

- `pub fn symbol(mut self, name: &str) -> Self`: An SF Symbol before the title, or alone when the title is empty (give it an `accessibility_label` then): `"ellipsis.circle"` for a "More" menu.
- `pub fn style(mut self, style: ButtonStyle) -> Self`: How it's drawn (`ButtonStyle`); borderless suits a symbol alone.
- `pub fn control_size(mut self, size: ControlSize) -> Self`: Mini, small, regular or large.
- `pub fn disabled(mut self, when: impl crate::IntoValue<bool>) -> Self`: Disables it: `true`, or a closure reading signals.

### `Scroll`

`pub struct Scroll(AnyView)`: Vertically scrolling content (`NSScrollView`). The content is laid out at the visible width and at least the visible height.

### `Text`

`pub struct Text`: Text (see `text`).

- `pub fn font(mut self, font: crate::Font) -> Self`: Its font: a text style (`Font::title()`, `Font::caption()`) or a custom one.
- `pub fn color(mut self, color: impl crate::IntoValue<crate::Color>) -> Self`: Its colour (`Color::Secondary` for less prominent text), or a closure computing it from signals (a balance red when it's negative).
- `pub fn color_when(self, f: impl Fn() -> crate::Color + 'static) -> Self`: A colour computed from signals (now `color` takes a closure).
- `pub fn truncate(mut self) -> Self`: On one line, shortened with "…" when there isn't room for it all, instead of pushing past its row (a file's path, a long value). With `.min_width(w)` it shrinks to `w` and no further, so a status line beside a fixed-width row stays readable.

## controls

- `pub fn color_well(value: &Signal<Color>) -> ColorWell`: A colour well bound two ways to `value`.
- `pub fn combo_box(value: &Signal<String>, suggestions: Vec<&str>) -> ComboBox`: A text field bound two ways to `value`, with `suggestions` in a pop-up list (typing completes from them).
- `pub fn combo_box_with(value: &Signal<String>, suggestions: impl Fn() -> Vec<String> + 'static) -> ComboBox`: A combo box whose suggestions come from `suggestions`, re-read when the signals it reads change (names already used in the app's data, say). Bound two ways to `value`, like `combo_box`.
- `pub fn date_picker(value: &Signal<std::time::SystemTime>) -> DatePicker`: A date picker bound two ways to `value` (date only; see `DatePicker::with_time`).
- `pub fn search_field(value: &Signal<String>) -> SearchField`: A search field bound two ways to `value` (updated as the user types).
- `pub fn segmented<T: PartialEq + Clone + 'static>(value: &Signal<T>, options: Vec<(&str, T)>) -> Segmented<T>`: A segmented control bound two ways to `value`, one segment per option (title, value). VoiceOver reads each segment's title.
- `pub fn segmented_with<T: PartialEq + Clone + 'static>(value: &Signal<T>, options: impl Fn() -> Vec<(String, T)> + 'static) -> Segmented<T>`: A segmented control whose segments come from `options` (title, value), re-read when the signals it reads change: segments are added, removed and retitled in place (a tab bar of documents or queries). Bound two ways to `value`; no segment is selected while `value` matches none.
- `pub fn time_picker(value: &Signal<(u32, u32)>) -> TimePicker`: A time-of-day picker bound two ways to `value`, an hour (0–23) and a minute: for a daily reminder or an opening time, which keep their hour and minute whatever the date or time zone. For a moment in time, use `date_picker` with `DatePicker::with_time`.
- `pub fn checkbox(title: &str, value: &Signal<bool>) -> Checkbox`: A checkbox titled `title`, bound two ways to `value`.
- `pub fn image(symbol: &str) -> Image`: An SF Symbol by name (e.g. `"star.fill"`). A name this macOS doesn't have (a newer symbol, a typo) shows a placeholder and is reported as a failure (see `App::on_error`).
- `pub fn image_data(bytes: &[u8]) -> Image`: A picture from bytes in a file format (PNG, JPEG…): one built into the app with `include_bytes!`.
- `pub fn image_file(path: impl AsRef<std::path::Path>) -> Image`: A picture from a file (PNG, JPEG, HEIC, PDF…), shown at its own size unless given one (`.frame(..)`). An unreadable file shows nothing.
- `pub fn picker<T: PartialEq + Clone + 'static>(value: &Signal<T>, options: Vec<(&str, T)>) -> Picker<T>`: A pop-up menu bound two ways to `value`, offering `options` (title, value).
- `pub fn progress(f: impl Fn() -> Option<f64> + 'static) -> Progress`: A progress bar driven by `f` (reading signals): `Some(0.0..=1.0)` or `None` while the amount is unknown. `spinner` makes it a spinner.
- `pub fn secure_field(value: &Signal<String>) -> TextField`: A password field (`NSSecureTextField`) bound two ways to `value`.
- `pub fn slider(value: &Signal<f64>, min: f64, max: f64) -> Slider`: A slider over `min..=max`, bound two ways to `value`: horizontal and continuous unless given `ticks`, `vertical` or `circular`.
- `pub fn stepper(value: &Signal<f64>, min: f64, max: f64, step: f64) -> Stepper`: A stepper over `min..=max` in steps of `step`, bound two ways to `value`.
- `pub fn text_field(value: &Signal<String>) -> TextField`: A text field bound two ways to `value`.
- `pub fn toggle(title: &str, value: &Signal<bool>) -> impl View`: A labelled switch (`NSSwitch`) bound two ways to `value`. With an empty title, the switch alone (a `form_row` names it).

### `ColorWell`

`pub struct ColorWell(Signal<Color>)`: A colour well bound two ways to `value`: a click opens the system's colour picker.

### `ComboBox`

`pub struct ComboBox`: A text field with a list of suggestions (`NSComboBox`).

- `pub fn placeholder(mut self, text: &str) -> Self`: Grey text shown while it's empty.

### `DatePicker`

`pub struct DatePicker`: A date (and optionally time) picker bound two ways to `value`.

- `pub fn with_time(mut self) -> Self`: Also picks the time of day.
- `pub fn calendar(mut self) -> Self`: A month calendar (clock too, with `with_time`) instead of a text field with a stepper.
- `pub fn range(mut self, min: std::time::SystemTime, max: std::time::SystemTime) -> Self`: Only dates from `min` to `max` can be picked.

### `SearchField`

`pub struct SearchField`: A search field (rounded, with a clear button) bound to `value`.

- `pub fn placeholder(mut self, text: &str) -> Self`: Grey text shown while it's empty (default "Search").
- `pub fn on_submit(mut self, f: impl Fn() + 'static) -> Self`: Runs `f` on Return.

### `Segmented`

`pub struct Segmented<T>`: A segmented control choosing one of several values.

### `TimePicker`

`pub struct TimePicker(Signal<(u32, u32)>)`: A time-of-day picker (hour and minute, in the user's 12- or 24-hour format) bound two ways to `value`.

### `Checkbox`

`pub struct Checkbox`: A checkbox (`NSButton`) bound two ways to `value`.

### `Image`

`pub struct Image`: An image: an SF Symbol (`image`), or a picture from a file or bytes (`image_file`, `image_data`).

- `pub fn description(mut self, text: &str) -> Self`: What VoiceOver says. Without one the image is decorative and VoiceOver skips it (as for an icon beside a labelled control).
- `pub fn symbol_size(mut self, points: f64) -> Self`: A symbol's size in points (as text of that size would be).
- `pub fn symbol_weight(mut self, weight: crate::Weight) -> Self`: A symbol's stroke weight, to match the text beside it.
- `pub fn color(mut self, color: Color) -> Self`: A symbol's colour (one colour for all of it).
- `pub fn hierarchical(mut self, color: Color) -> Self`: A symbol in shades of `color`: its layers from full to faint.
- `pub fn palette(mut self, colors: &[Color]) -> Self`: A symbol's layers in these colours, in order.
- `pub fn multicolor(mut self) -> Self`: A symbol in its own colours, where it has them (`"cloud.sun.fill"`).
- `pub fn fill(mut self) -> Self`: A picture fills its frame, cropping what doesn't fit (a cover, an avatar). By default it fits inside, all of it shown.
- `pub fn effect(mut self, effect: SymbolEffect, active: impl crate::IntoValue<bool>) -> Self`: A symbol effect running while `active` is true (`true`, or a closure reading signals): `image("wifi").effect(SymbolEffect::VariableColor, move || searching.get())`. For the repeating effects: pulse, variable colour, scale, rotate, breathe.
- `pub fn effect_on<T: std::hash::Hash>(mut self, effect: SymbolEffect, trigger: impl Fn() -> T + 'static) -> Self`: A symbol effect played once each time `trigger`'s value changes (it reads signals): `image("bell").effect_on(SymbolEffect::Bounce, move || unread.get())`. For the one-shot effects: bounce, wiggle, rotate.
- `pub fn corner_radius(mut self, points: f64) -> Self`: Rounds the picture's corners, in points (half its size for a circle). For a background's corners, see `ViewExt::corner_radius`.

### `Picker`

`pub struct Picker<T>`: A pop-up menu choosing one of several values.

### `Progress`

`pub struct Progress`: A progress bar or spinner: `Some(fraction)` (0–1) or `None` for indeterminate.

- `pub fn spinner(mut self) -> Self`: A spinner instead of a bar: spinning while the amount is unknown, a filling circle while it's known. For "loading" beside a label or in a toolbar.
- `pub fn control_size(mut self, size: crate::ControlSize) -> Self`: Mini, small, regular or large (a small spinner suits a text line).

### `Slider`

`pub struct Slider`: A slider bound two ways to `value`.

- `pub fn ticks(mut self, n: usize) -> Self`: `n` tick marks along it, from end to end (a 0–100 slider with 11 ticks marks every 10).
- `pub fn snap_to_ticks(mut self) -> Self`: Only the tick marks' values can be picked (give it `ticks`).
- `pub fn vertical(mut self) -> Self`: Upright, filling the height it's given (a volume or level control).
- `pub fn circular(mut self) -> Self`: A dial, turned around its centre (an angle or a rotation); `min` is at the top.
- `pub fn control_size(mut self, size: crate::ControlSize) -> Self`: Mini, small, regular or large.

### `Stepper`

`pub struct Stepper`: Up/down arrows stepping `value` within a range.

### `SymbolEffect`

`pub enum SymbolEffect`: An SF Symbol animation (`Image::effect`, `Image::effect_on`), drawn by AppKit (macOS 14; Wiggle, Rotate and Breathe from macOS 15; nothing on older systems). AppKit tones them down under Reduce motion.

- `Bounce`: A bounce: a new message, an item added.
- `Pulse`: A fade in and out: waiting, recording.
- `VariableColor`: Layers lit one after another: searching, connecting (`"wifi"`).
- `Scale`: Grown slightly while it lasts: selected, hovered.
- `Wiggle`: A shake: an error, attention needed.
- `Rotate`: A turn: syncing, refreshing (`"arrow.triangle.2.circlepath"`).
- `Breathe`: A slow swell: alive, listening.

### `TextField`

`pub struct TextField`: A single-line text field bound to a `Signal<String>`.

- `pub fn placeholder(mut self, text: &str) -> Self`: Grey text shown while the field is empty.
- `pub fn on_submit(mut self, f: impl Fn() + 'static) -> Self`: Runs (in a batch) when the user presses Return in the field.
- `pub fn on_commit(mut self, f: impl Fn() + 'static) -> Self`: Runs (in a batch) whenever editing ends: Return, Tab, or a click elsewhere, so an edit is never lost by leaving the field. The value may be unchanged (the user only passed through).

## models

- `pub fn table<T: 'static>(model: &Rc<TableModel<T>>) -> Table<T>`: A native table showing `model` (see `Table`).
- `pub fn text_editor(model: &TextModel) -> TextEditor`: A native text editor showing `model` (see `TextEditor`).

### `Table`

`pub struct Table<T: 'static>`: A native `NSTableView` showing a `TableModel`: millions of rows, sorting, column resizing, type-select and VoiceOver come from AppKit.

- `pub fn on_key(mut self, key: TableKey, f: impl Fn(Vec<usize>) + 'static) -> Self`: A bare key on the table, without ⌘: `f` gets the selected rows (model indices) when the user presses `key` with rows selected. `TableKey::Delete` (⌫ or ⌦) to remove them, `TableKey::Space` to Quick Look them, as in the Finder. Put the same action in a menu too (Edit ▸ Delete, File ▸ Quick Look), where people look for it.
- `pub fn selection(mut self, rows: &Signal<Vec<usize>>) -> Self`: Binds the selection (model indices) to `rows`, both ways: the user selecting rows sets it, and setting it selects them (scrolling the first into view). `TableModel::set_rows` clears the selection, and `rows` follows; set it after replacing the rows to select again.
- `pub fn cell_focus(mut self, column: &Signal<Option<String>>) -> Self`: Cell focus, as in a spreadsheet: `column` holds the focused column's id, both ways. Clicking a cell focuses its column, ← and → move it, and the focused cell of each selected row is outlined. An action on "the cell" (Set to NULL, Copy Value) reads the selection and `column`; give it a menu item with a shortcut, such as ⌥⌫.
- `pub fn row_menu(mut self, title: &str, action: impl Fn(usize) + 'static) -> Self`: A right-click menu for rows: each action gets the clicked row (model index), or the selected row when invoked another way.
- `pub fn on_select(mut self, f: impl Fn(Vec<usize>) + 'static) -> Self`: The selected rows (model indices) changed.
- `pub fn on_activate(mut self, f: impl Fn(usize) + 'static) -> Self`: A row was double-clicked, or Return pressed on it.
- `pub fn on_sort(mut self, f: impl Fn(Sort) + 'static) -> Self`: The user sorted by a column (rows are already shown in the new order).
- `pub fn on_toggle(mut self, f: impl Fn(usize, String, bool) + 'static) -> Self`: A checkbox cell was clicked: (row, column id, new value).
- `pub fn on_edit(mut self, f: impl Fn(usize, String, String) + 'static) -> Self`: An editable cell was edited: (row, column id, new text). Apply it to the row with `TableModel::update_row`.
- `pub fn row_drag(mut self) -> Self`: Rows can be dragged to other apps (as tab-separated text). ⌘C copies the selected rows the same way, always.
- `pub fn alternating_rows(mut self, on: bool) -> Self`: Rows in alternating colours (`true`, the default) or all on the content background (`false`): a data grid reads better striped, a short list in a modern window plainer.
- `pub fn column_lines(mut self) -> Self`: Hairlines between the columns, as in Numbers and data browsers.
- `pub fn reorderable(mut self, f: impl Fn(Vec<usize>, Option<usize>) + 'static) -> Self`: The user can drag rows to a new place: `f` gets the dragged rows and the row they were dropped above (`None`: the end), as model indices. Apply it with `TableModel::move_rows`. Not while the table is sorted.
- `pub fn on_files_dropped(mut self, extensions: &[&str], f: impl Fn(Vec<PathBuf>, Option<usize>) + 'static) -> Self`: Files with these extensions (any file if empty) can be dropped on the table: `f` gets their paths and the row they were dropped above.
- `pub fn animated(self) -> Self`: Rows the model inserts and removes one at a time fade and slide in and out (see `TableModel::set_animates`).
- `pub fn on_urls_dropped(mut self, f: impl Fn(Vec<String>, Option<usize>) + 'static) -> Self`: Web addresses dragged from a browser (a link, or the address bar's icon) can be dropped on the table: `f` gets them (`https://…`) and the row they were dropped above. Files go to `Table::on_files_dropped`.
- `pub fn on_paste(mut self, f: impl Fn(String) + 'static) -> Self`: ⌘V on the table: `f` gets the pasted text (rows copied from a table arrive as tab-separated lines).
- `pub fn on_columns_changed(mut self, f: impl Fn(Vec<ColumnState>) + 'static) -> Self`: Columns were moved or resized (save them to restore later).

### `TextEditor`

`pub struct TextEditor`: A native plain-text editor (`NSTextView` in a scroll view) showing a `TextModel`: input methods, spell checking, find, undo, text services and VoiceOver come from AppKit.

- `pub fn shared_undo(mut self) -> Self`: Records edits in the window's undo history, with its text fields and app-level changes (`undoable`), instead of the editor's own. Then ⌘Z anywhere in the window undoes the latest change, wherever it was made.
- `pub fn bind(mut self, text: &Signal<String>) -> Self`: Binds the text two ways to `text`: edits set it (not while an input method is composing); setting it replaces the editor's text (clearing undo, like `TextModel::set_text`) unless it already matches.
- `pub fn on_change(mut self, f: impl Fn(String) + 'static) -> Self`: The text changed (typing, paste, undo, a committed composition).
- `pub fn on_selection(mut self, f: impl Fn(std::ops::Range<usize>) + 'static) -> Self`: The selection or caret moved (UTF-8 byte range).
- `pub fn on_composition(mut self, f: impl Fn(Option<String>) + 'static) -> Self`: An input method is composing (`Some(marked text)`) or stopped (`None`).
- `pub fn highlight(mut self, f: impl Fn(&str) -> Vec<(std::ops::Range<usize>, TextStyle)> + 'static) -> Self`: Styles the text: `f` gets the text and returns runs (UTF-8 byte ranges) with their `TextStyle`s. It runs after every edit, before it's drawn, and again when signals it reads change (a search term to mark, say). See `TextModel::set_highlighter`.
- `pub fn syntax(self, syntax: crate::Syntax) -> Self`: Syntax highlighting with `syntax` (e.g. `Syntax::sql`), for code: see `code`.
- `pub fn rich(mut self) -> Self`: Rich text: the user styles it (fonts, bold, colours, alignment, lists, pictures) with ⌘B and friends, the font panel and `format_menu`; see `TextModel::set_rich`. Read and load it as RTF or HTML on the model, or bind it with `bind_rtf`.
- `pub fn ruler(mut self) -> Self`: Rich text with the ruler shown (margins, tabs, alignment, lists).
- `pub fn format_bar(mut self) -> Self`: Rich text with TextEdit's format bar above it (font, size, colours, bold, italic, alignment, spacing, lists).
- `pub fn bind_rtf(mut self, rtf: &Signal<Vec<u8>>) -> Self`: Rich text bound two ways to `rtf`, its RTF (what a rich document saves): edits, styling ones too, set it; setting it loads it (clearing undo) unless it's what the editor shows.
- `pub fn code(mut self) -> Self`: An editor for code: quotes and dashes stay as typed (no smart quotes), and no text replacement, autocorrection or spell checking (`TextModel::set_code_input`). `syntax` implies it.

## table

### `CellImage`

`pub enum CellImage`: A small image shown before a cell's text (see `Column::icon`).

- `Symbol(String)`: An SF Symbol by name.
- `FileIcon(std::path::PathBuf)`: The Finder's icon for a file or folder.

### `CellStyle`

`pub struct CellStyle`: How a cell's text looks (see `Column::style`): the default for each field is the table's own look.

- `pub color: Option<crate::text::Color>`: The text's colour.
- `pub background: Option<crate::text::Color>`: A tint behind the cell (a changed value, say).
- `pub italic: bool`: Italic text (a placeholder such as NULL).
- `pub strikethrough: bool`: Struck-through text (a row about to be deleted).

### `Column`

`pub struct Column<T>`: A column: an id (stable, used for sorting and saved state), a title, and how to get the cell value from a row.

- `pub fn text(id: &str, title: &str, value: impl Fn(&T) -> String + 'static) -> Self`: A text column.
- `pub fn number(id: &str, title: &str, value: impl Fn(&T) -> f64 + 'static) -> Self`: A right-aligned number column, sorted numerically. `f64::NAN` is no value (a database's NULL, say): shown as nothing.
- `pub fn check(id: &str, title: &str, value: impl Fn(&T) -> bool + 'static) -> Self`: A checkbox column. Clicking a checkbox emits `TableEvent::Toggle`; the model doesn't change the row itself.
- `pub fn progress(id: &str, title: &str, value: impl Fn(&T) -> f64 + 'static) -> Self`: A progress bar from 0 to 1 (values outside are clamped). Sorted and copied as the number; VoiceOver reads it as a percentage.
- `pub fn date(id: &str, title: &str, value: impl Fn(&T) -> Option<std::time::SystemTime> + 'static) -> Self`: A date column: shown in the user's format and language ("12 Mar 2024", "Today", "Yesterday"), sorted by date, oldest first; `None` shows nothing and sorts before every date. Copied as shown. `with_time` adds the time.
- `pub fn with_time(mut self) -> Self`: Shows a date column's time too ("Today at 09:41").
- `pub fn none_text(mut self, text: &str) -> Self`: What a date column shows for `None` (default nothing): "Running" for a timer with no end yet, "Never" for a file never opened. It still sorts before every date, and is copied as shown.
- `pub fn icon(mut self, image: impl Fn(&T) -> Option<CellImage> + 'static) -> Self`: Shows an image before each cell's text (a text or number column), e.g. a file's icon before its name. `None` leaves the space empty.
- `pub fn style(mut self, style: impl Fn(&T) -> CellStyle + 'static) -> Self`: Styles each cell of a text or number column from its row: a colour, a background tint, italic or struck-through text. The style is read when a cell is shown; after changing what it depends on, refresh the rows (`TableModel::update_row`).
- `pub fn fit(mut self) -> Self`: Sizes the column to its widest content (and its title) whenever the rows change. With many rows, the longest values are measured.
- `pub fn width(mut self, width: f64) -> Self`: Initial width in points (default 120).
- `pub fn min_width(mut self, min_width: f64) -> Self`: Smallest width the user can drag the column to.
- `pub fn decimals(mut self, decimals: usize) -> Self`: Decimal places shown for a number column (default 0).
- `pub fn editable(mut self, editable: bool) -> Self`: Lets the user edit this column's text or number cells (double-click, or Return on the selected row's cell). Finishing an edit (Return, Tab or a click elsewhere; not Escape) emits `TableEvent::Edit`; the model doesn't change the row: apply it with `TableModel::update_row`. No effect on checkbox columns.
- `pub fn sortable(mut self, sortable: bool) -> Self`: Whether a header click sorts by this column (default true).

### `ColumnState`

`pub struct ColumnState`: A column's place and width, as the user arranged them (for saving).

- `pub id: String`: The column id.
- `pub width: f64`: Width in points.

### `Sort`

`pub struct Sort`: The table's sort: a column id and a direction.

- `pub column: String`: The column id.
- `pub ascending: bool`: Ascending (A→Z, 0→9) or descending.

### `TableKey`

`pub enum TableKey`: A key a table can take without ⌘ (see `TableModel::set_keys`).

- `Delete`: Delete (⌫) or Forward Delete (⌦): remove the selected rows, say.
- `Space`: Space: Quick Look the selected rows, say.

### `TableModel`

`pub struct TableModel<T: 'static>`: A native table backed by rows of `T`. See the module docs.

- `pub fn new(id: ViewId, columns: Vec<Column<T>>) -> Self`: Creates the native table (not yet in a window: it's added the first time the host draws it, see `TableModel::ensure_mounted`).
- `pub fn id(&self) -> ViewId`: The view id the table was created with.
- `pub fn ensure_mounted(&self)`: Adds the table to the attached window if it isn't yet. Called by the host widget before placing it.
- `pub fn set_columns(&self, columns: Vec<Column<T>>)`: Replaces the columns, keeping the same native table (a query browser's results change shape with every query). The sort is cleared. Call `set_rows` after it when the rows change too: nothing is drawn in between.
- `pub fn set_rows(&self, rows: Vec<T>)`: Replaces all rows (the current sort is applied). Clears the selection.
- `pub fn rows(&self) -> Ref<'_, Vec<T>>`: The rows, in model order (unsorted).
- `pub fn len(&self) -> usize`: Number of rows.
- `pub fn is_empty(&self) -> bool`: Whether there are no rows.
- `pub fn update_row(&self, index: usize, row: T)`: Replaces one row. Redraws only that row unless the table is sorted (then the order is recomputed; the selection is kept).
- `pub fn insert(&self, index: usize, row: T)`: Inserts a row at a model index (the selection is kept).
- `pub fn append(&self, rows: Vec<T>)`: Appends rows in one step, for live data (a log tail, a feed): when unsorted, the new rows are added to the end and AppKit only learns the new count (cost independent of the rows already there; the selection is kept). When sorted, the order is recomputed.
- `pub fn scroll_to_end(&self)`: Scrolls so the last row is visible.
- `pub fn is_at_end(&self) -> bool`: Whether the table is scrolled to its last row (within one row), e.g. to keep following new rows only while the user hasn't scrolled up.
- `pub fn push(&self, row: T)`: Appends a row.
- `pub fn remove(&self, index: usize) -> Option<T>`: Removes a row (the selection is kept for the other rows).
- `pub fn move_rows(&self, rows: &[usize], before: Option<usize>) -> Vec<usize>`: Moves `rows` (model indices) to just above the row `before` (or to the end), keeping their order, as a drop reported by `TableEvent::RowsMoved` asks. Returns their new model indices; they end up selected.
- `pub fn set_row_drag(&self, on: bool)`: Lets rows be dragged out: each carries its cells as tab-separated text (for other apps), and its model index for `set_reorderable`. Off by default (a drag then extends the selection).
- `pub fn set_reorderable(&self, on: bool)`: Lets the user drag rows to a new place (also turns on `set_row_drag`); each drop is reported as `TableEvent::RowsMoved`. Refused while the table is sorted.
- `pub fn set_file_drop(&self, extensions: Option<&[&str]>)`: Accepts files dropped from the Finder: `Some(&["csv", "txt"])` for those extensions, `Some(&[])` for any file, `None` to stop. Each drop is reported as `TableEvent::FilesDropped`.
- `pub fn set_animates(&self, on: bool)`: Rows added by `insert` and `push`, and removed by `remove`, fade and slide in and out instead of appearing at once; the other rows keep their cells. Not in a grouped table, and not for `set_rows` or `append` (whole lists and live feeds). Off by default.
- `pub fn set_url_drop(&self, on: bool)`: Accepts web addresses dragged from a browser (a link, or the address bar's icon). Each drop is reported as `TableEvent::UrlsDropped`. Off by default.
- `pub fn set_pastes(&self, on: bool)`: Reports ⌘V on the table as `TableEvent::Paste` (and enables Paste in the Edit menu while there is text to paste). Off by default.
- `pub fn set_keys(&self, keys: &[TableKey])`: Reports these keys, pressed without ⌘, ⌥ or ⌃ while rows are selected, as `TableEvent::Key` instead of AppKit's handling (Space would type-select, Delete beep). None by default.
- `pub fn set_cell_focus(&self, on: bool)`: Cell focus, as in a spreadsheet: the table keeps a focused column, which a click on a cell moves to its column and ← and → move one column at a time (`TableEvent::FocusedColumn`). The focused cell of each selected row is outlined. With the selection it names the cells an action applies to (Set to NULL, Copy Cell). Off by default.
- `pub fn focused_column(&self) -> Option<String>`: The focused column's id (see `set_cell_focus`).
- `pub fn set_focused_column(&self, column: Option<&str>)`: Focuses a column by id (`None`: no column), scrolling it into view. Doesn't report an event.
- `pub fn focus_ring(&self, view_row: usize) -> Option<(f64, f64, f64, f64)>`: The focused cell's outline in row `view_row` (a view position), in the row's coordinates, if the row is shown, selected and a column is focused. For checks.
- `pub fn selected_text(&self) -> String`: The selected rows as tab-separated text (columns in their current order, one line per row, as ⌘C copies them).
- `pub fn copy_to(&self, pasteboard: &NSPasteboard) -> bool`: Copies the selected rows to `pasteboard` (what ⌘C does with the general pasteboard). False if nothing is selected.
- `pub fn paste_from(&self, pasteboard: &NSPasteboard) -> bool`: Pastes `pasteboard`'s text (what ⌘V does with the general pasteboard): queues `TableEvent::Paste` if the table takes pastes.
- `pub fn row_at(&self, position: usize) -> Option<usize>`: The model index of the row shown at `position` (0 = top row as currently sorted); `None` past the end or for a group header.
- `pub fn set_group_by(&self, key: Option<GroupKey<T>>)`: Groups the rows under headers by `key` (e.g. a date or a category): groups appear in the order their first row has in the model, rows keep the sort's order within each group, and each group starts with a header row showing the key (full width, not selectable, floating while its rows scroll). `None` ungroups. Row indices in events stay model indices.
- `pub fn groups(&self) -> Vec<String>`: The groups' titles, in the order shown (empty when not grouped).
- `pub fn shown_rows(&self) -> usize`: The number of rows shown, group headers included.
- `pub fn selection(&self) -> Vec<usize>`: Selected rows (model indices, ascending in view order).
- `pub fn select(&self, rows: &[usize])`: Selects rows by model index (emits no event).
- `pub fn sort(&self) -> Option<Sort>`: The current sort, if any.
- `pub fn set_sort(&self, sort: Option<Sort>)`: Sets the sort (shown in the header) and, with built-in sorting, applies it.
- `pub fn set_sorts_in_place(&self, on: bool)`: Built-in sorting (default on): header clicks reorder the rows here. Turn it off to sort yourself on `TableEvent::Sort` (e.g. in a database) and call `TableModel::set_rows`.
- `pub fn column_state(&self) -> Vec<ColumnState>`: Columns in their current order, with widths.
- `pub fn set_column_state(&self, state: &[ColumnState])`: Restores a saved arrangement (unknown ids are ignored).
- `pub fn drain_events(&self) -> Vec<TableEvent>`: Takes the queued user events (for the host widget).
- `pub fn cells_created(&self) -> usize`: Diagnostics: cell views created so far (reuse keeps this near the number of visible cells).
- `pub fn scroll_view(&self) -> Retained<NSScrollView>`: The `NSScrollView` holding the table, for hosts that place it themselves (no `crate::attach`ed window).
- `pub fn table_view(&self) -> Retained<NSTableView>`: The underlying `NSTableView` (escape hatch).

## outline

- `pub fn outline<T: Identifiable + 'static>(roots: impl Fn() -> Vec<TreeNode<T>> + 'static, title: impl Fn(&T) -> String + 'static,) -> Outline<T>`: A native outline: `roots` (reading signals) gives the tree, `title` each item's text.
- `pub fn sidebar<T: Identifiable + 'static>(sections: impl Fn() -> Vec<TreeNode<T>> + 'static, title: impl Fn(&T) -> String + 'static,) -> Outline<T>`: A Mac sidebar: an outline in the source-list style whose top-level items are section headers, expanded.

### `Outline`

`pub struct Outline<T: Identifiable + 'static>`: A native outline view over a tree (see the module docs).

- `pub fn expanded(mut self) -> Self`: Every item shown expanded, each time the tree changes (a plan, a document's outline: trees read whole).
- `pub fn icon(mut self, f: impl Fn(&T) -> Option<String> + 'static) -> Self`: An SF Symbol per item (or `None`).
- `pub fn icon_color(mut self, f: impl Fn(&T) -> Option<crate::Color> + 'static) -> Self`: A colour per item's icon (or `None` for the sidebar's own), as Mail's mailboxes and Reminders' lists show theirs.
- `pub fn badge(mut self, f: impl Fn(&T) -> Option<String> + 'static) -> Self`: A badge per item (or `None`): a count or a short word at the end of its row, in secondary text, as Mail's unread counts are. It's read when the tree is, so a signal the tree reads updates it.
- `pub fn column(mut self, title: &str, width: f64, value: impl Fn(&T) -> String + 'static) -> Self`: A column beside the tree, as the Finder's list view has (Date Modified, Kind): its title, width and each item's text. With columns the outline shows a header, and the tree's own column is titled "Name".
- `pub fn number_column(mut self, title: &str, width: f64, value: impl Fn(&T) -> String + 'static) -> Self`: A column of numbers or sizes: as `Outline::column`, right-aligned with digits all one width (the Finder's Size).
- `pub fn lazy_children(mut self, has_children: impl Fn(&T) -> bool + 'static, load: impl Fn(T::Id) + 'static) -> Self`: Items for which `has_children` is true are expandable before their children are known (a folder not read yet): expanding one calls `load` with its id, which reads them and puts them in the tree the outline shows (setting a signal it reads). Expanded items stay expanded when the tree changes.
- `pub fn selection(mut self, selected: &Signal<Option<T::Id>>) -> Self`: Two-way selection by item id.

### `TreeNode`

`pub struct TreeNode<T>`: One item of a tree, with its children.

- `pub value: T`: The item.
- `pub children: Vec<TreeNode<T>>`: Its children (empty for a leaf).
- `pub fn leaf(value: T) -> Self`: A leaf.
- `pub fn branch(value: T, children: Vec<TreeNode<T>>) -> Self`: An item with children.

## text

### `Color`

`pub enum Color`: A colour: for text, backgrounds, borders, drawing. The named ones are the system's colours: they follow Dark Mode, Increase Contrast and the user's accent colour.

- `Primary`: The text colour (what unstyled text uses).
- `Secondary`: Less prominent text.
- `Tertiary`: Even less prominent text (comments, placeholders).
- `Quaternary`: The least prominent text and fills.
- `Fill`: The system's fill for thin shapes (a slider's track, a progress ring's track): the strongest of the fills, a translucent grey.
- `SecondaryFill`: A fill for medium shapes (a switch's background).
- `TertiaryFill`: A fill for large shapes (an input field, a search bar).
- `QuaternaryFill`: A fill for large areas with content on them: grouped cards, as SwiftUI's `GroupBox` and grouped forms draw them.
- `Accent`: The user's accent colour (System Settings › Appearance).
- `Link`: Links.
- `Red`: System red.
- `Orange`: System orange.
- `Yellow`: System yellow.
- `Green`: System green.
- `Mint`: System mint.
- `Teal`: System teal.
- `Cyan`: System cyan.
- `Blue`: System blue.
- `Indigo`: System indigo.
- `Purple`: System purple.
- `Pink`: System pink.
- `Brown`: System brown.
- `Gray`: System gray.
- `Background`: The background of content (text, tables): white, or dark in Dark Mode.
- `WindowBackground`: The window's background (behind content).
- `ControlBackground`: The background of controls and grouped content: cards, panels.
- `Separator`: Separator lines and grids.
- `Clear`: Fully transparent.
- `Rgb(f64, f64, f64)`: A fixed sRGB colour (components 0–1; the same in light and dark).
- `Rgba(f64, f64, f64, f64)`: A fixed sRGB colour with opacity (components 0–1).
- `pub const fn rgb(r: f64, g: f64, b: f64) -> Color`: An opaque sRGB colour (components 0–1).
- `pub const fn rgba(r: f64, g: f64, b: f64, a: f64) -> Color`: An sRGB colour with opacity (components 0–1).
- `pub fn hex(hex: &str) -> Color`: A colour from a hex string: `"#3a7bd5"`, `"3a7bd5"`, or with opacity `"#3a7bd580"`. Black for anything else.
- `pub fn opacity(self, opacity: f64) -> Color`: The same colour at `opacity` (0–1), on top of its own.
- `pub fn components(self) -> Option<(f64, f64, f64, f64)>`: Its sRGB components (red, green, blue, opacity), resolved for the current appearance for the named colours.
- `pub fn ns(self) -> Retained<NSColor>`: The `NSColor` (dynamic for the named colours).
- `pub fn from_ns(color: &NSColor) -> Option<Color>`: The colour an `NSColor` is: a named one if it's one of those, else its sRGB components.

### `Completion`

`pub struct Completion`: What a completer offers at the caret: the text it completes (a byte range ending at the caret, such as the partial word) and the words that would replace it, best first. See `TextModel::set_completer`.

- `pub range: Range<usize>`: The text the chosen word replaces (UTF-8 bytes, ending at the caret).
- `pub items: Vec<String>`: The words offered, in order.

### `TextModel`

`pub struct TextModel`: A native plain-text editor. Cheap to clone (a handle); main thread only.

- `pub fn new(id: ViewId, text: &str) -> Self`: Creates the editor (added to the window the first time the host draws it). Defaults: plain text, system font 13 pt, continuous spell checking, find bar, undo, Tab inserts a tab (Ctrl-Tab moves focus on).
- `pub fn id(&self) -> ViewId`: The view id the editor was created with.
- `pub fn ensure_mounted(&self)`: Adds the editor to the attached window if it isn't yet (the host widget calls this before placing it).
- `pub fn text(&self) -> String`: The whole text.
- `pub fn set_text(&self, text: &str)`: Replaces the whole text (e.g. loading a document). Clears the undo history and emits no event.
- `pub fn share_undo(&self, manager: Option<&NSUndoManager>)`: Records edits in `manager` (e.g. the window's, shared with other views and app-level changes) instead of the editor's own history, or in a fresh history of its own again with `None`. Edits recorded so far are dropped.
- `pub fn undo_manager(&self) -> Retained<NSUndoManager>`: The undo history the editor records in.
- `pub fn replace_selection(&self, text: &str)`: Replaces the selection as if typed: undoable, emits `Changed`.
- `pub fn selection(&self) -> Range<usize>`: Selected byte range (empty: the caret).
- `pub fn set_selection(&self, range: Range<usize>)`: Selects a byte range (emits no event).
- `pub fn composition(&self) -> Option<String>`: Whether an input method is composing, and its marked text.
- `pub fn set_editable(&self, editable: bool)`: Read-only (`false`) or editable. Read-only text can still be selected and copied.
- `pub fn is_editable(&self) -> bool`: Whether the user can edit the text.
- `pub fn set_font(&self, name: Option<&str>, size: f64)`: Font: `None` for the system font, else a family or PostScript name.
- `pub fn set_completer(&self, f: Option<impl Fn(&str, usize) -> Option<Completion> + 'static>)`: Completes as the user types, in AppKit's completion list: `f` gets the text and the caret (a byte offset) and says what it completes there and with which words (`Completion`), or `None`. Typing a word character or a dot opens the list (⌥⎋ or F5 open it too); typing on filters it (`f` is asked again), ↑ and ↓ move, Return or Tab or a click puts the word in, and Escape closes it.
- `pub fn complete(&self)`: Opens the completion list at the caret now (as ⌥⎋ does).
- `pub fn offered_completions(&self) -> Vec<String>`: The words the completion list showed last (for checks).
- `pub fn set_highlighter(&self, f: Option<impl Fn(&str) -> Vec<(Range<usize>, TextStyle)> + 'static>)`: Styles the text with `f`: given the text, it returns runs (UTF-8 byte ranges) and their styles; the rest is plain. It runs now and after every edit (typing, paste, undo, `set_text`), before the edit is drawn, so keep it fast: it sees the whole text each time. `None` makes the text plain again.
- `pub fn restyle(&self)`: Runs the highlighter again, for when what it depends on changed other than the text (a search term, a theme).
- `pub fn style_at(&self, offset: usize) -> TextStyle`: The style of the character at byte `offset`, as shown (for checks).
- `pub fn set_rich(&self, rich: bool)`: Rich text (`true`) or plain (`false`, the default). Rich, the user styles the text: fonts and sizes (the font panel, ⌘T), bold, italic and underline (⌘B, ⌘I, ⌘U), colours, alignment, spacing and lists (the ruler and the format bar); pasted text keeps its styles, and pictures can be pasted or dropped in. Don't combine it with a highlighter, which restyles the text itself.
- `pub fn is_rich(&self) -> bool`: Whether the text is rich (see `set_rich`).
- `pub fn set_format_bar(&self, shown: bool)`: TextEdit's format bar above the text (rich text): font, size, colours, bold, italic, underline, alignment, line spacing and lists.
- `pub fn has_format_bar(&self) -> bool`: Whether the format bar is shown.
- `pub fn set_ruler_visible(&self, shown: bool)`: The ruler above the text (rich text): margins, tab stops, alignment, spacing and lists. Format ▸ Text ▸ Show Ruler (⌃⌘R) toggles it too.
- `pub fn is_ruler_visible(&self) -> bool`: Whether the ruler is shown.
- `pub fn rtf(&self) -> Vec<u8>`: The text with its styles, as RTF (what TextEdit saves). Pictures aren't included.
- `pub fn set_rtf(&self, rtf: &[u8]) -> bool`: Replaces the text with RTF's (from `rtf`, TextEdit or Word), styles and all. Clears the undo history and emits no event. False (and nothing changes) if `rtf` isn't RTF.
- `pub fn html(&self) -> String`: The text with its styles as an HTML document (for the web, mail or the clipboard).
- `pub fn set_html(&self, html: &str) -> bool`: Replaces the text with HTML's, styles and all (headings, bold, links, lists). Clears the undo history and emits no event. False if AppKit can't read it.
- `pub fn font_size(&self) -> Option<f64>`: The current font size in points.
- `pub fn set_insets(&self, horizontal: f64, vertical: f64)`: Space between the text and the view's edges, in points.
- `pub fn set_spell_checking(&self, on: bool)`: Continuous spell checking (on by default).
- `pub fn set_grammar_checking(&self, on: bool)`: Grammar checking (off by default).
- `pub fn set_code_input(&self, code: bool)`: Input for code (`true`) or prose (`false`, the default): code turns off what helps prose and breaks code: smart quotes and dashes (`"` becoming `“`), text replacement, spelling correction, spell checking and the spaces smart paste adds.
- `pub fn set_accepts_tab(&self, accepts: bool)`: Whether plain Tab inserts a tab (default) or moves focus on.
- `pub fn show_find(&self)`: Shows the find bar, as Edit ▸ Find ▸ Find… (⌘F) does in a Ferrokit app while the focus is in the editor.
- `pub fn set_wraps(&self, wraps: bool)`: Whether long lines wrap at the editor's width (the default), or run on with a horizontal scroller (code, logs, tables of text).
- `pub fn wraps(&self) -> bool`: Whether long lines wrap (see `set_wraps`).
- `pub fn is_find_visible(&self) -> bool`: Whether the find bar is showing.
- `pub fn can_undo(&self) -> bool`: Whether there is something to undo.
- `pub fn undo(&self)`: Undoes the last edit (as ⌘Z does).
- `pub fn drain_events(&self) -> Vec<TextEvent>`: Takes the queued user events (for the host widget).
- `pub fn scroll_view(&self) -> Retained<NSScrollView>`: The `NSScrollView` holding the text view, for hosts that place it themselves (no `crate::attach`ed window).
- `pub fn text_view(&self) -> Retained<NSTextView>`: The underlying `NSTextView` (escape hatch).

### `TextStyle`

`pub struct TextStyle`: How a run of text looks. What it leaves unset stays as the editor's own (its font and text colour).

- `pub color: Option<Color>`: The text colour.
- `pub background: Option<Color>`: A background behind the run.
- `pub bold: bool`: Bold (the font's bold face).
- `pub italic: bool`: Italic (the font's italic face, where it has one).
- `pub underline: bool`: Underlined.
- `pub fn new() -> Self`: A style that changes nothing.
- `pub fn color(mut self, color: Color) -> Self`: With this text colour.
- `pub fn background(mut self, color: Color) -> Self`: With this background.
- `pub fn bold(mut self) -> Self`: Bold.
- `pub fn italic(mut self) -> Self`: Italic.
- `pub fn underline(mut self) -> Self`: Underlined.

## commands

- `pub fn can_perform(command: Command) -> bool`: Whether `perform` would run something now.
- `pub fn can_perform_in(window: Option<&NSWindow>, command: Command) -> bool`: Whether `perform_in` would run something.
- `pub fn focused_value<T: Clone + 'static>(name: &str) -> Option<T>`: The value published under `name` nearest the focus (see `ViewExt::focused_value`): what a menu command acts on, such as the selected note of the focused list. `None` if nothing near the focus publishes one of type `T`.
- `pub fn focused_value_in<T: Clone + 'static>(window: &NSWindow, name: &str) -> Option<T>`: `focused_value` as if `window` were focused.
- `pub fn focused_window() -> Option<Retained<NSWindow>>`: The window commands go to: the window of the toolbar button acting, the key window, else the main window, else the most recently opened visible one (an inactive app has neither). A key window with nothing of the app's in it, such as the Quick Look panel or the font and colour panels, passes commands to the main window, as the Finder's menus act on its window while Quick Look shows; a sheet (an Open panel, an alert) keeps them.
- `pub fn menu_command(title: impl crate::IntoValue<String>, command: Command) -> MenuItem`: A menu item that performs `command` on whatever has focus, enabled only while something handles it. Add `.key(..)` for a shortcut.
- `pub fn perform(command: Command) -> bool`: Runs `command` in the focused window (see `focused_window`); false if nothing handles it there or its handler is disabled.
- `pub fn perform_in(window: Option<&NSWindow>, command: Command) -> bool`: Runs `command` as if `window` were focused (`None`: the app's handler).
- `pub fn toolbar_command(id: &str, label: &str, symbol: &str, command: Command) -> ToolbarItem`: A toolbar button that performs `command` on its window's focus, disabled while nothing there handles it.

### `Command`

`pub struct Command(&'static str)`: A named action that menus, toolbars and code invoke, and views, windows or the app handle. Declare one as a constant:

- `pub const fn new(name: &'static str) -> Self`: A command named `name` (names identify commands, so keep them unique).
- `pub fn name(&self) -> &'static str`: The command's name.

## chrome

- `pub fn customize_toolbar_item() -> MenuItem`: Customize Toolbar…, for a View menu: opens the main window's toolbar customisation sheet; enabled when that toolbar is customisable (see `Window::customizable_toolbar`).
- `pub fn dynamic_submenu(title: &str, items: impl Fn() -> Vec<MenuItem> + 'static) -> MenuItem`: A submenu whose items `items` builds each time it opens (Open Recent, a list of servers…), so it always shows the current state.
- `pub fn format_menu() -> Vec<MenuItem>`: TextEdit's Format menu, for rich text editors (`TextEditor::rich`): Font (Show Fonts, Bold, Italic, Underline, Bigger, Smaller, Show Colors, Copy and Paste Style) and Text (alignment, Show Ruler, Copy and Paste Ruler), with their usual shortcuts. AppKit enables what applies to the focused editor.
- `pub fn submenu(title: &str, items: Vec<MenuItem>) -> MenuItem`: A submenu.
- `pub fn menu_item(title: impl crate::IntoValue<String>, action: impl Fn() + 'static) -> MenuItem`: A menu command. The title is fixed, or a closure read each time the menu opens ("Show Sidebar" or "Hide Sidebar").
- `pub fn menu_separator() -> MenuItem`: A separator line.
- `pub fn split(panes: impl crate::view::Views) -> Split`: Panes side by side with draggable dividers (see `Split`).
- `pub fn toolbar_button(id: &str, label: &str, symbol: &str, action: impl Fn() + 'static) -> ToolbarItem`: A toolbar button: identifier, label, SF Symbol, action.
- `pub fn toolbar_fixed_space() -> ToolbarItem`: A fixed space in the toolbar.
- `pub fn toolbar_group(id: &str, label: &str, buttons: Vec<ToolbarItem>) -> ToolbarItem`: Related buttons in one capsule (zoom out and in, back and forward), made by `toolbar_button`; one item to the overflow menu and the customisation sheet, under `label`.
- `pub fn toolbar_picker<T: Clone + PartialEq + 'static>(id: &str, label: &str, value: &Signal<T>, choices: Vec<(&str, &str, T)>) -> ToolbarItem`: A choice of one in the toolbar, as segments with SF Symbols (Finder's view modes): `value` is set to the chosen choice's value, and the segment follows it. Each choice is a label (for VoiceOver, tooltips and the overflow menu), a symbol and a value.
- `pub fn toolbar_search(id: &str, query: &Signal<String>) -> ToolbarItem`: A toolbar search field bound two ways to `query`.
- `pub fn toolbar_space() -> ToolbarItem`: Flexible space in the toolbar.

### `MenuItem`

`pub struct MenuItem(Entry)`: An item of a menu: a command, a separator or a submenu. Used for context menus and the menu bar (see `App::menu`).

- `pub fn disabled(mut self, when: impl crate::IntoValue<bool>) -> Self`: Disabled: `true`, or a closure (read when the menu opens, and before the item's key equivalent fires).
- `pub fn checked(mut self, when: impl crate::IntoValue<bool>) -> Self`: A checkmark: `true`, or a closure (read when the menu opens).
- `pub fn enabled_when(self, f: impl Fn() -> bool + 'static) -> Self`: Enabled while `f` returns true (now `disabled`).
- `pub fn checked_when(self, f: impl Fn() -> bool + 'static) -> Self`: A checkmark while `f` returns true (now `checked`).
- `pub fn title_when(mut self, f: impl Fn() -> String + 'static) -> Self`: The title `f` returns (now `menu_item` takes a closure as its title).
- `pub fn key(self, key: &str) -> Self`: A ⌘ shortcut: `"n"` is ⌘N, `"N"` is ⇧⌘N, `","` is ⌘,.
- `pub fn key_with(mut self, key: &str, modifiers: &[Modifier]) -> Self`: A shortcut with more modifiers than ⌘, e.g. `key_with("n", &[Modifier::Option])` for ⌥⌘N.

### `Modifier`

`pub enum Modifier`: A modifier key of a menu item's shortcut (Command is always included).

- `Shift`: ⇧ (an uppercase key implies it too).
- `Option`: ⌥
- `Control`: ⌃

### `Split`

`pub struct Split`: Side-by-side panes with draggable dividers (`NSSplitView`). The first pane keeps its width when the window resizes (a sidebar); the others share the change. `stacked` puts them top to bottom. `collapsible` panes (a sidebar, an inspector) hide and show with a signal, or when dragged shut.

- `pub fn collapsible(mut self, index: usize, collapsed: &Signal<bool>) -> Self`: Pane `index` collapses while `collapsed` is true, and can be dragged shut (which sets it). Like the first pane, it keeps its size when the window resizes. For a sidebar (`0`) or an inspector (the last):
- `pub fn trailing(mut self, points: f64) -> Self`: The last pane's initial width (height when stacked), in points: an inspector's.
- `pub fn stacked(mut self) -> Self`: Panes top to bottom, with dividers across (an editor over its results). The first pane keeps its height when the window resizes.
- `pub fn position(mut self, points: f64) -> Self`: Initial position of the first divider, in points from the left (from the top when `stacked`).
- `pub fn remember(mut self, name: &str) -> Self`: Saves the divider position the user drags to under `name` (in user defaults) and starts there next time, instead of at `position`.

### `ToolbarItem`

`pub enum ToolbarItem`: An item of a window's toolbar: made by `toolbar_button`, `toolbar_group`, `toolbar_picker`, `toolbar_search`, `toolbar_space` or `toolbar_fixed_space`.

- `Button`: A button with an SF Symbol and a label.
- `FlexibleSpace`: Flexible space between items.
- `Space`: A fixed space between items.
- `Search`: A search field bound to a signal.
- `Group`: Buttons side by side in one capsule, as one item (see `toolbar_group`).
- `Picker`: A choice of one, shown as segments (see `toolbar_picker`).
- `Optional(Box<ToolbarItem>)`: An item the user can add from the customisation sheet, not in the toolbar at first (see `ToolbarItem::optional`).
- `pub fn disabled(self, when: impl crate::IntoValue<bool>) -> Self`: Disabled: `true`, or a closure reading signals.
- `pub fn optional(self) -> Self`: Offered in the customisation sheet (with `Window::customizable_toolbar`), but not in the toolbar until the user adds it.

## dialogs

- `pub fn alert(window: &NSWindow, alert: Alert, on_response: impl FnOnce(usize) + 'static)`: Shows `alert` as a sheet on `window`; `on_response` gets the index of the button chosen.
- `pub fn open_panel(window: &NSWindow, options: OpenOptions, on_done: impl FnOnce(Option<Vec<PathBuf>>) + 'static)`: Shows the Open panel as a sheet on `window`; `on_done` gets the chosen paths, or `None` if cancelled.
- `pub fn save_panel(window: &NSWindow, name: &str, directory: Option<&std::path::Path>, on_done: impl FnOnce(Option<PathBuf>) + 'static)`: Shows the Save panel as a sheet on `window`, proposing `name` (in `directory`, if given); `on_done` gets the chosen path, or `None` if cancelled. Nothing is written: saving is the app's job.
- `pub fn sheet(parent: &NSWindow, content: Window, on_close: impl FnOnce() + 'static) -> SheetHandle`: Shows `content` (a `Window` built as usual: size and view) as a sheet on `parent`. `on_close` runs when it closes; the view tree is then dropped.
- `pub fn sheet_with(parent: &NSWindow, make: impl FnOnce() -> crate::Window, on_close: impl FnOnce() + 'static) -> SheetHandle`: `sheet` for the window `make` builds: the signals `make` creates (the sheet's fields) belong to the sheet and are freed when it closes, not kept for the app's life as signals made in an action would be.

### `Alert`

`pub struct Alert`: An alert shown as a sheet (see `alert`).

- `pub fn new(title: &str, message: &str) -> Self`: An alert with a title and an informative message.
- `pub fn button(mut self, title: &str) -> Self`: Adds a button (the first is the default; Return presses it, Escape presses one titled "Cancel").
- `pub fn destructive(mut self, index: usize) -> Self`: Marks button `index` as destructive (shown in red).
- `pub fn warning(mut self) -> Self`: Shows the warning style (a caution icon).

### `OpenOptions`

`pub struct OpenOptions`: What the Open panel allows.

- `pub extensions: Vec<String>`: File name extensions to allow (e.g. `["csv", "txt"]`); empty: any.
- `pub multiple: bool`: Allow choosing several files.
- `pub directories: bool`: Choose folders instead of files.

### `SheetHandle`

`pub struct SheetHandle`: A sheet showing a view tree (see `sheet`). Closing it tears the tree down.

- `pub fn close(&self)`: Closes the sheet (its `on_close` runs).
- `pub fn window(&self) -> Retained<NSWindow>`: The sheet's window.

## appearance

- `pub fn is_dark() -> bool`: Whether the app currently resolves to a dark appearance (system setting or app override).
- `pub fn system_colors() -> SystemColors`: Resolves the system colours for the app's appearance.

## frame

- `pub fn on_frame(window: &NSWindow, f: impl FnMut(f64) + 'static) -> FrameLoop`: Calls `f` once per frame of the display `window` is on, in step with its refresh (60 or 120 Hz), with the frame's target time in seconds. Runs in a `batch`, so signal updates and layout happen once per frame: the place to apply data that arrived since the last frame.

### `FrameLoop`

`pub struct FrameLoop`: Calls a function once per frame of the display a window is on (see `on_frame`). Dropping it stops the calls.

- `pub fn counts(&self) -> (u64, u64)`: Calls so far: (driven by display frames, by the stand-in timer).

## store

- `pub fn read_stored<T: Stored>(key: &str) -> Option<T>`: The user-defaults value under `key`, if there is one: for values kept per document or per item (a database's open tabs, a diagram's layout), where a `stored` signal for each, living as long as the app, would pile up.
- `pub fn remove_stored(key: &str)`: Removes the user-defaults value under `key`.
- `pub fn stored<T: Stored>(key: &str, default: T) -> Signal<T>`: A signal holding the user-defaults value under `key` (or `default` when there is none yet); every change is written back. Bind it to a control in a Settings window and read it anywhere: it lives as long as the app, and every `stored` with the same key (and type) gives the same signal.
- `pub fn write_stored<T: Stored>(key: &str, value: &T)`: Writes `value` under `key` in user defaults now (see `read_stored`).

### `Stored` (trait)

`pub trait Stored: Clone + PartialEq + 'static`: A value `stored` can keep in user defaults.

- `fn read(defaults: &NSUserDefaults, key: &NSString) -> Option<Self>`: Reads the value under `key`, if there is one.
- `fn write(&self, defaults: &NSUserDefaults, key: &NSString)`: Writes the value under `key`.

## undo

- `pub fn set_undoable<T: Clone + PartialEq + 'static>(title: &str, signal: &Signal<T>, value: T)`: Sets `signal` to `value` as an undoable change named `title` (see `undoable`). Nothing is recorded if the value is unchanged.
- `pub fn undoable(title: &str, apply: impl Fn() + 'static, revert: impl Fn() + 'static)`: Makes a change the user can undo: runs `apply` now (in a `batch`) and records `revert` in the frontmost window's undo history under `title` ("Rename", "Delete Row"…). ⌘Z runs `revert`, ⇧⌘Z runs `apply` again.
- `pub fn undoable_in(window: &NSWindow, title: &str, apply: impl Fn() + 'static, revert: impl Fn() + 'static)`: As `undoable`, in `window`'s undo history.

## resource

### `Cancel`

`pub struct Cancel(Arc<AtomicBool>)`: Tells a load whether its result is still wanted. A load is cancelled when a newer one starts (its inputs changed, or `Resource::refetch`) or the resource's owner goes; long work can check and stop early.

- `pub fn is_cancelled(&self) -> bool`: Whether a newer load replaced this one (its result will be dropped).

### `Load`

`pub enum Load<T>`: A resource's state, from `Resource::state`.

- `Loading`: The first load hasn't finished.
- `Ready(T)`: The latest finished load succeeded (a newer one may be running: see `Resource::loading`).
- `Failed(String)`: The latest finished load failed, with its error's text.

### `Resource`

`pub struct Resource<T>`: A value loaded on a background thread from inputs read on the main thread. When the signals `source` reads change, a new load starts and the one running is cancelled: only the newest result is ever shown, so search-as-you-type can't show an older query's rows. The last value stays readable while a new one loads.

- `pub fn new<S, E>(source: impl Fn() -> S + 'static, fetch: impl Fn(S, &Cancel) -> Result<T, E> + Send + Sync + 'static) -> Self where S: Send + 'static, E: fmt::Display`: Loads with `fetch(source())` on a background thread, again whenever the signals `source` reads change. Call from the main thread.
- `pub fn get(&self) -> Option<T>`: The latest loaded value (kept while a newer load runs), subscribing the running effect. `None` until the first load succeeds.
- `pub fn get_untracked(&self) -> Option<T>`: The latest value, without subscribing (for event handlers).
- `pub fn with<R>(&self, f: impl FnOnce(Option<&T>) -> R) -> R`: Reads the latest value through `f` without copying it.
- `pub fn loading(&self) -> bool`: Whether a load is running.
- `pub fn error(&self) -> Option<String>`: The error of the latest finished load, if it failed.
- `pub fn state(&self) -> Load<T>`: Loading, the latest value, or the latest error: whichever the most recent finished load produced (`Loading` only before the first).
- `pub fn refetch(&self)`: Loads again with the same inputs (the running load is cancelled).

## task

- `pub fn background<T: Send + 'static>(work: impl FnOnce() -> T + Send + 'static) -> Background<T>`: Runs `work` on a background thread now, and returns a future for its result, to await in a `spawn_local` task: `spawn` for async code. Call from the main thread.
- `pub fn sleep(duration: Duration) -> Sleep`: A future that's ready after `duration`, timed on the main run loop (in the common modes, so it fires while a menu is open). The timer starts at the first poll. Call from the main thread; await it in a `spawn_local` task.
- `pub fn spawn_local(future: impl Future<Output = ()> + 'static) -> Task`: Runs `future` on the main thread, as a task of the main run loop: it can read and set signals and touch views between its `.await`s, so it needn't be `Send`. Call from the main thread. The first poll is on a later pass of the run loop, not inside this call.

### `Background`

`pub struct Background<T>`: A future for work on a background thread, from `background`.

### `Sleep`

`pub struct Sleep`: A future that's ready after a time, from `sleep`.

### `Task`

`pub struct Task(u64)`: A task started by `spawn_local`. A `Copy` handle; dropping it neither cancels nor detaches the task.

- `pub fn cancel(self)`: Stops the task: its future is dropped now (at the `.await` it's waiting at; called from inside the task, as soon as its current poll returns). Work a `background` call already started on its thread runs to the end; its result is dropped. Nothing happens if the task has finished.
- `pub fn detach(self)`: Keeps the task running after its owner goes (a closed window, a removed view), until it finishes or is cancelled.
- `pub fn is_finished(self) -> bool`: Whether the task is over: its future finished, panicked or was cancelled (also by its owner going).

## documents

- `pub fn choose_documents()`: Shows the Open panel for the app's document types, as File ▸ Open… does (a button on a welcome window, say), and opens what's chosen.
- `pub fn document_edited(window: &NSWindow) -> bool`: Whether the document in `window` has unsaved changes.
- `pub fn new_document() -> Option<Retained<NSWindow>>`: Opens a new, empty document. `None` if the app has no document type.
- `pub fn open_document(path: &Path) -> std::io::Result<Retained<NSWindow>>`: Opens the document at `path`, or brings its window to the front if it's already open.
- `pub fn recent_documents() -> Vec<PathBuf>`: The recently opened or saved documents, newest first (that still exist).
- `pub fn regain_access(path: &Path) -> bool`: Reaches `path` again in the App Sandbox through the bookmark `remember_access` kept, until the app quits (a folder's contents too). Whether the app can reach it: `true` outside the sandbox, `false` when no bookmark was kept or it no longer resolves (the folder was deleted): ask the user to choose it again.
- `pub fn remember_access(path: &Path)`: Keeps the app's access to `path` (a folder or file the user chose in an Open panel, or dropped) for later launches: in the App Sandbox the app reaches it only while it runs, and this keeps a security-scoped bookmark to it in the app's defaults. Call `regain_access` for it after a relaunch, before reading it. Does nothing outside the sandbox (or for a path the app can't reach now). Documents opened through `DocumentType` are kept already.
- `pub fn revert_document(window: &NSWindow) -> std::io::Result<()>`: Reads the document in `window` back from its file, dropping its changes.
- `pub fn save_document(window: &NSWindow) -> std::io::Result<()>`: Saves the document in `window` to its file. An error if it has none yet (use `save_document_as`, or the Save menu item, which asks).
- `pub fn save_document_as(window: &NSWindow, path: &Path) -> std::io::Result<()>`: Saves the document in `window` to `path` (Save As… without the panel); it then belongs to that file.
- `pub fn show_welcome() -> bool`: Shows the app's welcome window (see `App::welcome`), opening it again if it was closed. False if the app has none.
- `pub fn welcome_window() -> Option<Retained<NSWindow>>`: The welcome window, while it's open.

### `Document`

`pub struct Document<T: 'static>(Rc<DocInner<T>>)`: An open document: its content and its file. Cloning gives another handle.

- `pub fn content(&self) -> &Signal<T>`: The content. Change it (or bind a view to it) to edit the document.
- `pub fn path(&self) -> Option<PathBuf>`: The file, once opened or saved.
- `pub fn is_edited(&self) -> bool`: Whether the content differs from the file (or an empty document).
- `pub fn title(&self) -> String`: The name shown in the title bar: the file name, or "Untitled".
- `pub fn window(&self) -> Option<Retained<NSWindow>>`: The document's window, while it's open.

### `DocumentType`

`pub struct DocumentType<T: 'static>`: One kind of document: its file extensions, how to make an empty one, read and write it, and the view of its window.

- `pub fn new<V: View>(extensions: &[&str], empty: impl Fn() -> T + 'static, view: impl Fn(&Document<T>) -> V + 'static) -> Self`: A document type with these file extensions (the first is used for new files; Open… shows only these). `empty` is a new document's content and `view` builds a document's window content. Add `read` to open files and `write` to save them.
- `pub fn read(mut self, f: impl Fn(&Path) -> std::io::Result<T> + 'static) -> Self`: Reads a file into a document's content (Open…, Open Recent, Revert).
- `pub fn write(mut self, f: impl Fn(&T, &Path) -> std::io::Result<()> + 'static) -> Self`: Writes a document's content to a file (Save, Save As…). Without it documents are read-only (a viewer).
- `pub fn write_returning(mut self, f: impl Fn(&T, &Path) -> std::io::Result<T> + 'static) -> Self`: Like `write`, for documents whose content changes when it's saved: `f` writes the content and returns what the document holds afterwards, which becomes its saved state. A database with staged changes, say: saving commits them and returns the database with none staged.
- `pub fn related(mut self, suffixes: &[&str]) -> Self`: Files beside each document that it reads and writes too, named by these suffixes (a SQLite database's `"-journal"`, `"-wal"`, `"-shm"`): the document holds access to them while it's open (see `related_files`), before it's read and after Save As…. In the App Sandbox, declare them too (`related = [...]` in `cargo ferrokit`'s document type).
- `pub fn toolbar(mut self, items: impl Fn(&Document<T>) -> Vec<ToolbarItem> + 'static) -> Self`: A toolbar for each document window, built with the window's view.
- `pub fn size(mut self, width: f64, height: f64) -> Self`: The size of new document windows (default 640 × 480).
- `pub fn window(mut self, style: impl Fn(Window) -> Window + 'static) -> Self`: Styles each document window: `style` gets the window as the document type made it and returns it with `Window`'s chrome methods applied, e.g. `.window(|w| w.full_size_content().toolbar_style(ToolbarStyle::Unified))`.

## collection

- `pub fn collection<T: Identifiable + Clone + 'static>(items: impl Fn() -> Vec<T> + 'static, describe: impl Fn(&T) -> CollectionItem + 'static) -> Collection<T>`: A native grid: `items` (reading signals) gives the items, `describe` what each shows (see `CollectionItem`).
- `pub fn collection_cells_made() -> u64`: Collection cells made since launch: stays near a screenful however many items scroll past (diagnostic).

### `Collection`

`pub struct Collection<T: Identifiable + 'static>`: A grid of items (see `collection`).

- `pub fn item_size(mut self, width: f64, height: f64) -> Self`: The size of each item, in points (default 120 × 110).
- `pub fn selection(mut self, selected: &Signal<Vec<T::Id>>) -> Self`: Two-way selection by item id (one item; see `multiple`).
- `pub fn multiple(mut self) -> Self`: Lets the user select several items (⌘-click, ⇧-click, drag).
- `pub fn on_activate(mut self, f: impl Fn(T) + 'static) -> Self`: Runs `f` with an item when it's double-clicked, or Return is pressed on it.

### `CollectionItem`

`pub struct CollectionItem`: What a collection shows for one item.

- `pub title: String`: The name under the image (and what VoiceOver reads).
- `pub subtitle: Option<String>`: A second, smaller line.
- `pub image: ItemImage`: The image.
- `pub fn new(title: impl Into<String>, image: ItemImage) -> Self`: An item with a title and an image.
- `pub fn subtitle(mut self, text: impl Into<String>) -> Self`: Adds a second line.

### `ItemImage`

`pub enum ItemImage`: What an item's image is.

- `Symbol(String)`: An SF Symbol by name.
- `FileIcon(PathBuf)`: The Finder's icon for a file or folder.
- `Color(Color)`: A swatch of a colour.
- `None`: No image.

## syntax

### `Syntax`

`pub struct Syntax`: How to colour a language. Build one with `Syntax::new` and its methods, or start from `Syntax::sql` or `Syntax::rust`.

- `pub fn new() -> Self`: A syntax that styles nothing yet.
- `pub fn keywords(mut self, words: &[&str], style: TextStyle) -> Self`: Words shown in `style`. Call again for other groups (types, functions) in other styles; a word's first group wins.
- `pub fn ignore_case(mut self) -> Self`: Keywords match in any case (SQL). Call before `keywords`.
- `pub fn strings(mut self, quotes: &str, style: TextStyle) -> Self`: String literals: each character of `quotes` opens one, closed by the same character.
- `pub fn escape(mut self, escape: char) -> Self`: Inside strings, `escape` makes the next character literal (`\` in most languages).
- `pub fn doubled_quotes(mut self) -> Self`: Inside strings, a doubled quote is a literal quote (`'it''s'` in SQL).
- `pub fn quoted_identifiers(mut self, pairs: &[(char, char)]) -> Self`: Quoted identifiers (`"name"`, `` `name` ``, `[name]` in SQL), left unstyled so a quoted keyword isn't coloured as one.
- `pub fn line_comment(mut self, prefix: &str, style: TextStyle) -> Self`: Comments from `prefix` to the end of the line. Call again for more prefixes; the style is the last given (shared with block comments).
- `pub fn block_comment(mut self, open: &str, close: &str, style: TextStyle) -> Self`: Comments from `open` to `close` (to the end of the text if unclosed).
- `pub fn numbers(mut self, style: TextStyle) -> Self`: Numbers: a word starting with a digit (`42`, `3.14`, `0x1F`, `1e-9`).
- `pub fn sql() -> Self`: SQL (SQLite's dialect, which covers the common ones): keywords pink and bold, types purple, functions indigo, strings red, numbers blue, comments gray and italic.
- `pub fn rust() -> Self`: Rust: keywords pink and bold, common types purple, strings red, numbers blue, comments gray and italic.
- `pub fn highlight(&self, text: &str) -> Vec<(Range<usize>, TextStyle)>`: The styled runs of `text`, in order (UTF-8 byte ranges).

## style

### `Font`

`pub struct Font`: A font: one of the system's text styles (sized as the Mac sizes them: `body` is 13 pt, `large_title` 26 pt), or a custom one. Change its weight, size or slant with the methods.

- `fn large_title()`: The largest title (26 pt).
- `fn title()`: A window or section title (22 pt).
- `fn title2()`: A smaller title (17 pt).
- `fn title3()`: A smaller title still (15 pt).
- `fn headline()`: Emphasised body text, as in a list's headings (13 pt, bold).
- `fn subheadline()`: Secondary headings (11 pt).
- `fn body()`: Body text, what labels use (13 pt).
- `fn callout()`: Text set apart from the body (12 pt).
- `fn footnote()`: Footnotes (10 pt).
- `fn caption()`: Captions (10 pt).
- `fn caption2()`: Secondary captions (10 pt).
- `pub fn system(size: f64) -> Font`: The system font at `size` points.
- `pub fn monospaced(size: f64) -> Font`: The system's monospaced font (SF Mono) at `size` points.
- `pub fn named(name: &str, size: f64) -> Font`: A font by family or PostScript name (`"Avenir Next"`, `"Georgia-Bold"`) at `size` points; the system font if it isn't installed.
- `pub fn weight(mut self, weight: Weight) -> Font`: The same font at another weight.
- `pub fn bold(self) -> Font`: The same font, bold.
- `pub fn size(mut self, points: f64) -> Font`: The same font at `points` (a text style keeps its weight).
- `pub fn italic(mut self) -> Font`: The same font, italic (slanted, for fonts without an italic face).
- `pub fn monospaced_digits(mut self) -> Font`: Digits all the same width, so changing numbers don't shift (totals, timers, tables of figures). The system font only.
- `pub fn ns(&self) -> Retained<NSFont>`: The `NSFont`.

### `Weight`

`pub enum Weight`: How heavy a font's strokes are.

- `UltraLight`: The thinnest.
- `Thin`: Thin.
- `Light`: Light.
- `Regular`: The usual weight.
- `Medium`: Slightly heavier than regular.
- `Semibold`: Between medium and bold: titles, emphasis.
- `Bold`: Bold.
- `Heavy`: Heavier than bold.
- `Black`: The heaviest.

## surface

### `Shadow`

`pub struct Shadow`: A drop shadow (see `ViewExt::shadow`).

- `pub color: Color`: Its colour (black at partial opacity, usually).
- `pub radius: f64`: How far it blurs, in points.
- `pub x: f64`: How far it falls right, in points.
- `pub y: f64`: How far it falls down, in points.
- `pub fn new(radius: f64, y: f64) -> Shadow`: A shadow blurred over `radius` points, falling `y` points down.
- `pub fn soft() -> Shadow`: A light, close shadow: cards on a background.
- `pub fn floating() -> Shadow`: A deeper shadow: something floating above the content.
- `pub fn color(mut self, color: Color) -> Shadow`: The same shadow in another colour.

## material

- `pub fn has_liquid_glass() -> bool`: Whether this Mac has Liquid Glass (macOS 26 and later).

### `Glass`

`pub enum Glass`: Liquid Glass behind a view (see `ViewExt::glass`). On macOS 15, where there's no Liquid Glass, a translucent popover material takes its place.

- `Regular`: The standard glass: frosted, for controls and panels.
- `Clear`: Clearer glass, for content over rich backgrounds (photos, video).
- `Tinted(Color)`: Regular glass tinted with a colour (give it some transparency).

### `Material`

`pub enum Material`: A system material behind a view (see `ViewExt::material`): translucent, blurring what's behind it, and following Dark Mode, Reduce Transparency and the window's active state as the system's own sidebars and panels do.

- `Sidebar`: A source list or sidebar, showing the desktop through the window.
- `Header`: A section or table header over scrolling content.
- `Titlebar`: A window's title bar or toolbar area.
- `Menu`: A menu.
- `Popover`: A popover.
- `Hud`: A heads-up display: a dark floating panel.
- `Sheet`: A sheet.
- `Window`: A window's background.
- `Content`: The background of content (a document, a list).
- `UnderWindow`: Behind a window's content, showing the desktop.
- `UnderPage`: Behind pages (as in Preview's page view).
- `Selection`: A selection highlight (follows the accent colour).
- `ToolTip`: A tooltip.

## widgets

- `pub fn gauge(value: impl Fn() -> f64 + 'static, max: f64) -> Gauge`: A level indicator showing `value()` out of `max` (0 to `max`), redrawn when the signals it reads change: storage used, a battery, signal strength. Give it a `warning` and `critical` level to colour it.
- `pub fn link(title: &str, url: &str) -> Link`: A link titled `title` that opens `url` (a web page, `mailto:`, or a `file://` URL) in its app when clicked. VoiceOver reads it as a link.
- `pub fn path_control(path: &Signal<PathBuf>) -> PathControl`: The folders down to a file or folder, as the Finder's path bar shows them, bound two ways to `path`: clicking a folder sets `path` to it.
- `pub fn radio_group<T: PartialEq + Clone + 'static>(value: &Signal<T>, options: Vec<(&str, T)>) -> RadioGroup<T>`: Radio buttons bound two ways to `value`, one per option (title, value), one above another (or `horizontal`).
- `pub fn rating(value: &Signal<f64>, max: u32) -> Gauge`: Stars from 0 to `max`, bound two ways to `value`: clicking a star sets it, as in Music and Photos.
- `pub fn tabs<T: PartialEq + Clone + 'static>(value: &Signal<T>, pages: Vec<(&str, T, AnyView)>) -> Tabs<T>`: Panes chosen by tabs, bound two ways to `value`: one per page (its tab title, the value that selects it, its content). Every pane is built once and keeps its state while hidden.
- `pub fn token_field(value: &Signal<Vec<String>>) -> TokenField`: A token field bound two ways to `value`: words or names as tokens (tags, recipients), finished with Return or a comma.

### `Gauge`

`pub struct Gauge`: A level indicator (see `gauge` and `rating`).

- `pub fn discrete(mut self) -> Self`: Segments instead of a continuous bar.
- `pub fn warning(mut self, value: f64) -> Self`: Turns yellow from `value` up (or down, if it's above the critical value): a disk filling up, a battery running down.
- `pub fn critical(mut self, value: f64) -> Self`: Turns red from `value` up (or down, if it's below the warning value).

### `Link`

`pub struct Link`: A link to a web page or file (see `link`).

### `PathControl`

`pub struct PathControl(Signal<PathBuf>)`: A path control (see `path_control`).

### `RadioGroup`

`pub struct RadioGroup<T>`: Radio buttons choosing one of several values (see `radio_group`).

- `pub fn horizontal(mut self) -> Self`: The buttons side by side instead of one above another.

### `TabStyle`

`pub enum TabStyle`: How `tabs` shows its tabs.

- `Bordered`: AppKit's tab view: tabs along the top of a bordered box, as in System Settings' older panes and many inspectors.
- `Segmented`: A segmented control above borderless content, as in Finder's Get Info sections and most modern Mac apps.

### `Tabs`

`pub struct Tabs<T>`: Panes chosen by tabs (see `tabs`).

- `pub fn style(mut self, style: TabStyle) -> Self`: How the tabs look (`TabStyle::Bordered` by default).

### `TokenField`

`pub struct TokenField`: A token field (see `token_field`).

- `pub fn suggestions(mut self, suggestions: &[&str]) -> Self`: Completions offered as the user types (those starting with what they've typed, ignoring case).
- `pub fn placeholder(mut self, text: &str) -> Self`: Grey text shown while it's empty.

## media

- `pub fn pdf_view(path: impl Fn() -> Option<PathBuf> + 'static) -> PdfView`: A PDF view showing the file at `path()`, reloaded when the signals it reads change (`None` shows nothing). It's Preview's view: zoom, text selection, copy and find. Its size is flexible.
- `pub fn pdf_view_data(data: impl Fn() -> Vec<u8> + 'static) -> PdfView`: A PDF view showing the document in `data()` (from `pdf_data`, a download or a database).
- `pub fn video_player(path: impl Fn() -> Option<PathBuf> + 'static) -> VideoPlayer`: A video player for the file at `path()`, replaced when the signals it reads change (`None` shows nothing): AVKit's player, with the system's controls, Picture in Picture and full screen. Plays sound files too.
- `pub fn video_stream(url: impl Fn() -> Option<String> + 'static) -> VideoPlayer`: A video player streaming from a web address (an HLS `.m3u8` playlist or a plain video file on a server).
- `pub fn web_view(page: &WebPage) -> WebView`: A web view showing `page`: a real `WKWebView`, with the system's scrolling, text selection, find and Look Up. Its size is flexible.

### `PdfView`

`pub struct PdfView`: A PDF view (see `pdf_view`).

- `pub fn page(mut self, page: &Signal<usize>) -> Self`: The page shown, from 0, bound two ways: scrolling changes it, and setting it goes to that page.
- `pub fn page_count(mut self, count: &Signal<usize>) -> Self`: Sets `count` to the document's number of pages.
- `pub fn highlight(mut self, query: impl Fn() -> String + 'static) -> Self`: Highlights every match of `query()` (ignoring case) and goes to the first, as Preview's search does.
- `pub fn single_page(mut self) -> Self`: One page at a time instead of a continuous scroll.
- `pub fn two_up(mut self) -> Self`: Pages side by side, as a book's spread.

### `VideoControls`

`pub enum VideoControls`: The playback controls of a `video_player`.

- `Inline`: A bar along the bottom, shown while the pointer is over the video.
- `Floating`: A floating panel, as QuickTime Player shows.
- `Minimal`: Only a play button, for short clips.
- `Hidden`: None: the app plays and pauses it through `playing`.

### `VideoPlayer`

`pub struct VideoPlayer`: A video player (see `video_player`).

- `pub fn playing(mut self, playing: &Signal<bool>) -> Self`: Whether it's playing, bound two ways: the controls set it, and setting it plays or pauses.
- `pub fn time(mut self, seconds: &Signal<f64>) -> Self`: The time played, in seconds, bound two ways: it follows playback (four times a second), and setting it jumps there.
- `pub fn duration(mut self, seconds: &Signal<f64>) -> Self`: Sets `seconds` to the length of the video once it's known.
- `pub fn muted(mut self, muted: impl Fn() -> bool + 'static) -> Self`: Mutes the sound while `muted()` is true.
- `pub fn loops(mut self) -> Self`: Starts again from the beginning at the end.
- `pub fn controls(mut self, controls: VideoControls) -> Self`: The playback controls (inline by default).

### `WebPage`

`pub struct WebPage(Rc<PageState>)`: A web page shown by a `web_view`: what it loads, and its title, address and loading state as signals. It's SwiftUI's `WebPage`.

- `pub fn new() -> Self`: An empty page; load something with `load`, `load_html` or `load_file`.
- `pub fn load(&self, url: &str)`: Loads a web address (`https://…`) or a `file://` URL.
- `pub fn load_html(&self, html: &str, base_url: Option<&str>)`: Shows `html`. Relative links and images resolve against `base_url` (a web address, or a `file://` folder the page may read).
- `pub fn load_file(&self, path: impl AsRef<Path>)`: Shows a local HTML file, allowed to read the files in its folder.
- `pub fn title(&self) -> String`: The page's title (a signal read: views showing it follow it).
- `pub fn url(&self) -> String`: The page's address (a signal read).
- `pub fn is_loading(&self) -> bool`: Whether the page is loading (a signal read).
- `pub fn can_go_back(&self) -> bool`: Whether there's a page to go back to (a signal read).
- `pub fn can_go_forward(&self) -> bool`: Whether there's a page to go forward to (a signal read).
- `pub fn back(&self)`: Goes back a page.
- `pub fn forward(&self)`: Goes forward a page.
- `pub fn reload(&self)`: Loads the page again.
- `pub fn evaluate(&self, script: &str, then: impl FnOnce(Result<String, String>) + 'static)`: Runs `script` in the page, then calls `then` with its result as text (a string's value, a number's digits) or the error's description.

### `WebView`

`pub struct WebView`: A web view (see `web_view`).

- `pub fn links_open_in_browser(mut self) -> Self`: Opens links the user clicks in their web browser instead of in the view: for help pages, previews and HTML the app made itself. Only web and mail links go out (`http`, `https`, `mailto`), and only on a click; other schemes and windows a page opens by script are dropped, and a link within the page (`#section`) scrolls in place.

## browser

- `pub fn column_browser<T: Identifiable + 'static>(roots: impl Fn() -> Vec<TreeNode<T>> + 'static, title: impl Fn(&T) -> String + 'static) -> ColumnBrowser<T>`: A column browser, as Finder's column view: `roots` (reading signals) gives the tree, `title` each item's text; the first column shows the roots, and selecting an item with children shows them in the next. Arrow keys move through it, type-select finds an item, and VoiceOver reads it as a browser. Name it with `accessibility_label`.

### `ColumnBrowser`

`pub struct ColumnBrowser<T: Identifiable + 'static>`: A column browser (see `column_browser`).

- `pub fn icon(mut self, f: impl Fn(&T) -> Option<String> + 'static) -> Self`: An SF Symbol per item (or `None`).
- `pub fn selection(mut self, path: &Signal<Vec<T::Id>>) -> Self`: The selected item's path, bound two ways: the ids from the first column's item to the selected one (empty for none). Setting it opens the columns down to that item.
- `pub fn on_activate(mut self, f: impl Fn(&T) + 'static) -> Self`: Called with an item the user double-clicks (opening a file, say).
- `pub fn column_width(mut self, points: f64) -> Self`: The columns' width at first, in points (200 unless set); the user can resize them.

## crash

### `CrashReport`

`pub struct CrashReport`: A report of a crash in an earlier run (see `App::crash_reports`).

- `pub path: PathBuf`: The report's file.
- `pub text: String`: What it says: the app and its version, macOS, when, the thread, the panic's message and place, and the backtrace.
- `pub when: Option<SystemTime>`: When the app crashed.
- `pub fn mark_sent(&self) -> std::io::Result<()>`: Moves the report to the `Sent` folder beside it, so it isn't handed to the app again: call it once it's sent (or the user declined).

## updates

### `UpdateEvent`

`pub enum UpdateEvent`: What Sparkle's updater did (see `on_event`).

- `Found`: The feed has a newer version than this one.
- `UpToDate`: The check found nothing newer.
- `ReadyOnQuit`: The update is downloaded and checked, and installs when the app quits (Sparkle's automatic updates, or the user chose Install on Quit).
- `Failed`: A check or an update failed: the feed couldn't be read, the download or its signature was bad, the install failed.

## failure

### `Failure`

`pub struct Failure`: Something that failed in the app's code or in AppKit, caught where AppKit called in (see `App::on_error`).

- `pub place: &'static str`: What was running: "a control's action", "a timer"…
- `pub message: String`: What happened: the exception's name and reason, or the panic's message.
- `pub exception: bool`: An Objective-C exception (`true`) or a Rust panic.

## filter

- `pub fn filter_editor(filter: &Signal<Filter>, fields: Vec<FilterField>) -> FilterEditor`: AppKit's filter builder (`NSPredicateEditor`, as Mail's rules and Finder's smart folders use), bound two ways to `filter`: a line saying whether all, any or none of the rules must hold, then a row per rule (a field, a test, a value), with + and − to add and remove rows; Option with + adds a nested group. It grows as rows are added. Text fields test contains, begins with, ends with, is and is not; numbers compare; choices are, or aren't, one of theirs.

### `FieldKind`

`pub enum FieldKind`: What kind of values a `FilterField` has, and so its tests.

- `Text`: Text: contains, begins with, ends with, is, is not.
- `Number`: Numbers: is, is not, is less than, is greater than, at most, at least.
- `Choice(Vec<String>)`: One of these choices: is, is not.

### `FieldValue`

`pub enum FieldValue`: A field's value, for `Filter::matches`.

- `Text(String)`: Text (or a choice).
- `Number(f64)`: A number.
- `Missing`: No value: every test fails on it (but "is not" holds).

### `Filter`

`pub struct Filter`: Rules, all, any or none of which must hold: what a `filter_editor` edits. An empty filter lets everything through, and a number rule whose number isn't filled in yet (NaN) is left out.

- `pub combine: Match`: How the rules combine.
- `pub rules: Vec<FilterRule>`: The rules.
- `pub fn matches(&self, value: impl Fn(&str) -> FieldValue) -> bool`: Whether a row passes: `value(key)` gives the row's value for a field. An empty filter passes everything.
- `pub fn to_sql(&self) -> String`: The filter as a SQL condition (for a `WHERE`): field keys become double-quoted column names and values quoted literals, so what the user types can't change the query. Text tests other than "is" ignore ASCII case, as SQLite's `LIKE` does. An empty filter is `1`.

### `FilterEditor`

`pub struct FilterEditor`: A filter builder (see `filter_editor`).

### `FilterField`

`pub struct FilterField`: A field a `filter_editor` offers: its key (in the `Filter`), its title (in the editor) and its kind.

- `pub key: String`: The key rules name it by.
- `pub title: String`: What the editor shows.
- `pub kind: FieldKind`: Its values.
- `pub fn text(key: &str, title: &str) -> Self`: A text field.
- `pub fn number(key: &str, title: &str) -> Self`: A number field.
- `pub fn choice(key: &str, title: &str, choices: &[&str]) -> Self`: A field with one of `choices`.

### `FilterRule`

`pub enum FilterRule`: A rule of a `Filter`: a test of one field, or a group of rules.

- `Field`: The field with this key passes the test.
- `Group(Filter)`: Rules of their own, combined their own way (the user makes one by Option-clicking + in the editor).

### `FilterTest`

`pub enum FilterTest`: What a rule tests a field for.

- `Contains(String)`: Text containing this (ignoring case).
- `BeginsWith(String)`: Text beginning with this (ignoring case).
- `EndsWith(String)`: Text ending with this (ignoring case).
- `Is(String)`: Text (or a choice) that is exactly this.
- `IsNot(String)`: Text (or a choice) that isn't this.
- `Equal(f64)`: A number equal to this.
- `NotEqual(f64)`: A number other than this.
- `Less(f64)`: A number less than this.
- `Greater(f64)`: A number greater than this.
- `AtMost(f64)`: A number at most this.
- `AtLeast(f64)`: A number at least this.

### `Match`

`pub enum Match`: How a `Filter`'s rules combine.

- `All`: Every rule holds ("All of the following are true").
- `Any`: At least one holds.
- `None`: None holds.

## form

- `pub fn disclosure<V: View>(title: &str, expanded: &Signal<bool>, content: impl Fn() -> V + 'static) -> impl View`: A title with a disclosure triangle; clicking either shows or hides `content`, built when it's shown (`expanded` says whether it is, both ways). For advanced settings and details.
- `pub fn form(sections: Vec<Section>) -> Form`: A form of `sections` (see `Form`).
- `pub fn form_content(content: impl View) -> FormRow`: A row of content without a label (a checkbox, a note, a button).
- `pub fn form_row(label: &str, control: impl View) -> FormRow`: A row with `label` and its control. VoiceOver reads the label as the control's name (unless it has a title of its own, as a checkbox does).
- `pub fn group_box(title: &str, content: impl View) -> impl View`: A titled box: `content` on the system's fill for grouped content, rounded, its title above (SwiftUI's `GroupBox`).
- `pub fn section(title: &str, rows: Vec<FormRow>) -> Section`: A section of a `form`: a title and rows.

### `Form`

`pub struct Form`: Settings and inspectors as Mac apps lay them out (see `FormStyle`).

- `pub fn style(mut self, style: FormStyle) -> Self`: How the rows are laid out (`FormStyle::Grouped` unless set).

### `FormRow`

`pub struct FormRow`: A row of a `section`: a label and its control (`form_row`), or content across the row (`form_content`).

- `pub fn help(mut self, text: &str) -> Self`: A line of smaller text under the row, saying more about it.

### `FormStyle`

`pub enum FormStyle`: How a `form` lays out its rows.

- `Grouped`: As System Settings: each section a rounded box of rows, labels on the left and controls on the right, lines between rows.
- `Columns`: As classic settings windows: labels right-aligned in one column ending in a colon, controls in the next, aligned across sections.

### `Section`

`pub struct Section`: A group of rows in a `form`, with a title (`""` for none).

- `pub fn footer(mut self, text: &str) -> Self`: Smaller text under the section: what its settings do.

## quicklook

- `pub fn close_quick_look()`: Closes the Quick Look panel, if it's open.
- `pub fn is_quick_look_open() -> bool`: Whether the Quick Look panel is open.
- `pub fn quick_look(paths: Vec<PathBuf>, index: usize)`: Opens the Quick Look panel on `paths`, at `paths[index]`, as Space does in Finder (or shows them in the panel if it's open): the arrow keys move between them, and the panel offers Open With and Share.
- `pub fn thumbnail(path: impl Fn() -> Option<PathBuf> + 'static) -> Thumbnail`: A file's thumbnail, as Finder and the Open panel draw it: a page of a PDF, a frame of a video, a picture, a document's first page. Its icon shows until the thumbnail is made (on a worker thread); it follows `path()`'s signals, and VoiceOver reads the file's name.

### `Thumbnail`

`pub struct Thumbnail`: A file's thumbnail (see `thumbnail`).

- `pub fn size(mut self, width: f64, height: f64) -> Self`: Its size in points (64 × 64 unless set); the picture keeps its proportions within it.

## services

- `pub const FULL_DISK_ACCESS_SETTINGS: &str = "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles"`: System Settings ▸ Privacy & Security ▸ Full Disk Access, for `open_url`: where the user allows an app to read every folder.
- `pub fn asks_before_reading(path: impl AsRef<Path>, full_disk_access: bool) -> bool`: Whether reading the folder at `path` may stop to ask the user's consent, so an app walking the disk should stay out of it (show it as "not scanned" instead). `full_disk_access` is what `has_full_disk_access` says; read it once per walk.
- `pub fn cancel_notification(id: &str)`: Removes the notification `id`: a daily one stops repeating, and one already shown leaves Notification Center.
- `pub fn file_dates(path: impl AsRef<Path>) -> std::io::Result<FileDates>`: The dates of the file or folder at `path` (not following a symbolic link): for "last opened" lists, "date added" columns and the like. Reading them is cheap (no Spotlight query): a few thousand files take a few milliseconds.
- `pub fn has_full_disk_access() -> bool`: Whether this app has Full Disk Access. It never prompts (it tries to read the privacy database, which only apps with access can). An app gets access after a relaunch, so read it at launch or before a walk.
- `pub fn move_to_trash(path: impl AsRef<Path>) -> std::io::Result<PathBuf>`: Moves `path` (a file or a folder) to the Trash of its volume, as the Finder's Move to Trash does, and returns where it is now: keep it to put the item back (undo) with `std::fs::rename` to the old path. The name in the Trash can differ from the old one when the Trash already has an item with that name.
- `pub fn notifications_supported() -> bool`: Whether this app can post notifications: it must run from an app bundle with a bundle identifier (a plain `cargo run` binary can't).
- `pub fn notify(notification: Notification)`: Posts `notification` through Notification Center. The first time, macOS asks the user whether to allow the app's notifications; while the app is in front they show as banners too. Without an app bundle (`notifications_supported`) it does nothing.
- `pub fn open_url(url: &str) -> bool`: Opens `url` in the app that handles it: a web page in the browser, a `mailto:` in Mail, a System Settings pane (such as `FULL_DISK_ACCESS_SETTINGS`). False if no app handles it.
- `pub fn pdf_data(view: impl View) -> Vec<u8>`: `view` as a PDF (see `save_pdf`).
- `pub fn print(window: &NSWindow, title: &str, view: impl View)`: Prints `view` laid out at the page's width, across as many pages as it needs, with the Print sheet on `window` (printer, copies, Save as PDF).
- `pub fn reveal_in_finder<P: AsRef<Path>>(paths: &[P])`: Shows `paths` selected in the Finder (File ▸ Show in Finder, ⌘R in many apps): one Finder window per folder, the items selected, the Finder brought to the front.
- `pub fn save_pdf(view: impl View, path: impl AsRef<Path>) -> std::io::Result<()>`: Saves `view` as a PDF at `path`, on letter or A4 pages (the user's default paper) as `print()` would print it, with no panel.
- `pub fn share_button(items: impl Fn() -> Vec<ShareItem> + 'static) -> ShareButton`: A button showing the system's Share menu (Mail, Messages, AirDrop, Notes…) for what `items()` returns when it's clicked.

### `FileDates`

`pub struct FileDates`: A file's dates (see `file_dates`); `None` where the file system doesn't keep one.

- `pub modified: Option<std::time::SystemTime>`: When its content last changed.
- `pub created: Option<std::time::SystemTime>`: When it was made.
- `pub added: Option<std::time::SystemTime>`: When it was put in its folder (moved, copied or downloaded there). Copying files to a new Mac, or restoring them, resets it.
- `pub last_opened: Option<std::time::SystemTime>`: When it was last opened in an app (the date Spotlight calls Last Opened, `kMDItemLastUsedDate`); `None` if never.

### `Notification`

`pub struct Notification`: A notification (see `notify`).

- `pub fn new(title: &str) -> Self`: A notification titled `title`.
- `pub fn subtitle(mut self, text: &str) -> Self`: A second line under the title, in bold.
- `pub fn body(mut self, text: &str) -> Self`: The message.
- `pub fn sound(mut self) -> Self`: Plays the system's notification sound.
- `pub fn id(mut self, id: &str) -> Self`: Its identifier: a new notification with the same one replaces it in Notification Center (a download's progress, today's summary).
- `pub fn daily_at(mut self, hour: u32, minute: u32) -> Self`: Shows it every day at `hour:minute` local time (a habit's reminder) instead of now, until `cancel_notification` with its `id`. Posting another with the same id replaces it.
- `pub fn on_click(mut self, action: impl Fn() + 'static) -> Self`: Runs `action` when the user clicks the notification (the app comes to the front first), while the app is still running.

### `SentNotification`

`pub struct SentNotification`: A sent notification's text, as `testing::sent_notifications` reports it.

- `pub id: String`: Its identifier.
- `pub title: String`: Its title.
- `pub subtitle: String`: Its subtitle.
- `pub body: String`: Its message.
- `pub sound: bool`: Whether it plays a sound.
- `pub daily: Option<(u32, u32)>`: The time it repeats at every day, if it does.

### `ShareButton`

`pub struct ShareButton`: A Share button (see `share_button`).

- `pub fn title(mut self, title: &str) -> Self`: A titled button ("Share…") instead of the icon alone.

### `ShareItem`

`pub enum ShareItem`: Something to share (see `share_button`).

- `Text(String)`: Plain text.
- `Url(String)`: A web address.
- `File(PathBuf)`: A file, shared as itself (AirDrop sends it, Mail attaches it).

## status

### `MenuBarExtra`

`pub struct MenuBarExtra`: An item in the menu bar (see `App::menu_bar_extra`): SwiftUI's `MenuBarExtra`.

- `pub fn new(symbol: &str) -> Self`: An extra showing the SF Symbol `symbol` (drawn as a template, so it follows the menu bar's colours). Give it a `menu` or a `panel`.
- `pub fn title(mut self, title: impl Fn() -> String + 'static) -> Self`: Text beside the icon, updated when the signals it reads change: a timer, a count, a temperature.
- `pub fn accessibility_label(mut self, label: &str) -> Self`: The name VoiceOver reads for it (the app's name if not set).
- `pub fn menu(mut self, items: Vec<MenuItem>) -> Self`: A menu shown when it's clicked.
- `pub fn panel(mut self, view: impl View) -> Self`: A panel of the app's own views shown under it when it's clicked, as the Wi-Fi and Sound panels show. It's built once and keeps its state; clicking elsewhere closes it.

## motion

- `pub fn animate(value: &Signal<f64>, to: f64, animation: Animation)`: Animates `value` from where it is to `to` with `animation`, setting it every frame (about 120 times a second): views and drawings that read it follow. A spring passes `to` and comes back; a new animation of the same signal takes over from where it is. With Reduce Motion on, it's set to `to` at once.
- `pub fn animated<R>(f: impl FnOnce() -> R) -> R`: Runs `f` (as a `batch`) and animates what it changes: views that move or resize because of it, opacity and colours set by `opacity_when` and `background_when`, and views with a `transition` that come or go. Over a quarter of a second, easing in and out.
- `pub fn animated_with<R>(animation: Animation, f: impl FnOnce() -> R) -> R`: `animated` with your own timing.
- `pub fn keyframes(value: &Signal<f64>, frames: Keyframes)`: Takes `value` through `frames` (SwiftUI's keyframe animator): a pulse, a shake, a count-up, a bounce; each step reached with its own timing. Reduce Motion skips to the last value (a repeating one stays at its start).
- `pub fn reduce_motion() -> bool`: Whether the user asked for less motion (System Settings › Accessibility › Display › Reduce motion). Animated changes respect it on their own.
- `pub fn stop_animation(value: &Signal<f64>)`: Stops animating `value` (where it is now).

### `Animation`

`pub struct Animation`: How an animated change moves (see `animated_with`).

- `pub fn ease_in_out(seconds: f64) -> Animation`: Easing in and out over `seconds`: for things that move.
- `pub fn ease_out(seconds: f64) -> Animation`: Starting fast and settling over `seconds`: for things that appear.
- `pub fn ease_in(seconds: f64) -> Animation`: Starting slowly over `seconds`: for things that leave.
- `pub fn linear(seconds: f64) -> Animation`: At a constant pace over `seconds`.
- `pub fn spring(response: f64, damping: f64) -> Animation`: A spring, as SwiftUI's: `response` is how quickly it moves (its period undamped, in seconds), `damping` how it settles: 1 without overshooting, less with a bounce (0.5 bounces a few times). It lasts until it's still. Things moved by a spring can be moved again mid-flight: they go on from where they are.
- `pub fn bouncy() -> Animation`: A spring with a visible bounce, about a tenth past the end (response 0.5, damping 0.6).
- `pub fn snappy() -> Animation`: A quick spring with a hint of bounce (response 0.3, damping 0.85).
- `pub fn smooth() -> Animation`: A spring that settles without overshooting (response 0.5, damping 1).
- `pub fn progress(&self, seconds: f64) -> f64`: How far along it is `seconds` in: 0 at the start, 1 at the end (a spring passes 1 and comes back).
- `pub fn duration(&self) -> f64`: How long it takes, in seconds.

### `Keyframes`

`pub struct Keyframes`: Values a signal goes through over time, each reached with its own animation (see `keyframes`).

- `pub fn new(value: f64) -> Keyframes`: Keyframes starting at `value` (or, with `from_current`, wherever the signal is).
- `pub fn from_current() -> Keyframes`: Keyframes starting wherever the signal is.
- `pub fn to(self, value: f64, seconds: f64) -> Keyframes`: Then to `value` over `seconds`, easing in and out.
- `pub fn linear(self, value: f64, seconds: f64) -> Keyframes`: Then to `value` at a constant pace over `seconds`.
- `pub fn with(mut self, value: f64, animation: Animation) -> Keyframes`: Then to `value` with `animation` (a spring, say).
- `pub fn repeating(mut self) -> Keyframes`: Over again from the start when it ends, until `stop_animation` (or the signal goes).
- `pub fn duration(&self) -> f64`: How long one run takes, in seconds.

### `Transition`

`pub enum Transition`: How a view comes and goes when it's added or removed inside `animated` (see `ViewExt::transition`). Outside an animation it appears and disappears at once.

- `Fade`: Fades in and out.
- `Slide(Edge)`: Fades while sliding a short way in from the edge, and back out to it. With Reduce Motion on, it only fades.

## popover

- `pub fn toolbar_popover<V: crate::View>(id: &str, label: &str, symbol: &str, content: impl Fn() -> V + 'static) -> crate::ToolbarItem`: A toolbar button that shows `content` in a popover pointing at the button, as Safari's and Mail's toolbar popovers do; a second press, a click outside or Escape closes it. The content is made each time it opens. `.disabled(..)` and `.optional()` work as on `toolbar_button`.

### `Edge`

`pub enum Edge`: Which side of its view a popover appears on (it moves to the other side when there isn't room).

- `Below`: Below the view.
- `Above`: Above the view.
- `Leading`: Before the view (left, in left-to-right languages).
- `Trailing`: After the view.

## canvas

- `pub fn canvas(draw: impl Fn(&mut Painter) + 'static) -> Canvas`: A canvas drawn by `draw`, again whenever the signals it reads change or the canvas resizes:

### `Canvas`

`pub struct Canvas`: A drawing canvas, made by `canvas`.

- `pub fn on_drag(mut self, f: impl Fn(CanvasDrag) + 'static) -> Self`: Drags inside the canvas: moving something it draws (a card on a diagram). `f` gets `CanvasDrag::Began` once the pointer has moved a few points with the button down, then `Moved` and `Ended`. A canvas with `on_drag` doesn't start `draggable`'s drag out.
- `pub fn on_hover(mut self, f: impl Fn(Option<(f64, f64)>) + 'static) -> Self`: Called with the pointer's position as it moves over the canvas, and `None` when it leaves (while the app is active).
- `pub fn on_click(mut self, f: impl Fn(f64, f64) + 'static) -> Self`: Called with the position of a click.
- `pub fn on_double_click(mut self, f: impl Fn(f64, f64) + 'static) -> Self`: Called with the position of a double click, after `on_click` runs for its second click (so a click can select a tile and a double click open it, as in the Finder). The interval is the user's double-click setting.
- `pub fn on_scroll(mut self, f: impl Fn(f64, f64, f64, f64) -> bool + 'static) -> Self`: Called with how far the user scrolls over the canvas (`dx, dy` in points, positive to the right and down… as the content would move) and the pointer's position; returns whether it used the scroll. What it doesn't use scrolls an enclosing scroll view.
- `pub fn on_magnify(mut self, f: impl Fn(f64, f64, f64) -> bool + 'static) -> Self`: Called as the user pinches (or ⌘-scrolls) over the canvas: how much larger (0.1 is 10%; negative is smaller) and the pointer's position; returns whether it used it.
- `pub fn description(mut self, f: impl Fn() -> String + 'static) -> Self`: What VoiceOver reads for the canvas (an image to it), kept up to date as the signals `f` reads change.
- `pub fn draggable(mut self, f: impl Fn() -> Option<crate::DragItem> + 'static) -> Self`: Dragging the canvas carries what `f` returns (nothing if `None`): text, an image, a file, or a file written where it's dropped.
- `pub fn exportable(mut self, name: &str) -> Self`: The canvas as an image: a right-click menu with Copy Image and Save Image…, and dragging it out gives `name`.png (to the Finder, Mail, a document). Charts use this for exporting.
- `pub fn min_size(mut self, width: f64, height: f64) -> Self`: The smallest size it's laid out at (default 200 × 120); it takes the room it's given beyond that.

### `CanvasDrag`

`pub enum CanvasDrag`: A drag inside a canvas (see `Canvas::on_drag`), in the canvas's coordinates.

- `Began(f64, f64)`: The drag started: where the mouse went down (x, y).
- `Moved(f64, f64)`: The pointer moved, the button still down.
- `Ended(f64, f64)`: The button came up.

### `Painter`

`pub struct Painter`: Draws on a `canvas`: shapes and text, in points from the top-left corner.

- `pub fn width(&self) -> f64`: The canvas's width in points.
- `pub fn height(&self) -> f64`: The canvas's height in points.
- `pub fn set_opacity(&mut self, opacity: f64)`: The opacity (0–1) of what's drawn next.
- `pub fn fill_rect(&mut self, x: f64, y: f64, w: f64, h: f64, color: Color)`: Fills a rectangle.
- `pub fn fill_rounded_rect(&mut self, x: f64, y: f64, w: f64, h: f64, radius: f64, color: Color)`: Fills a rectangle with rounded corners.
- `pub fn stroke_rect(&mut self, x: f64, y: f64, w: f64, h: f64, color: Color, width: f64)`: Outlines a rectangle.
- `pub fn fill_circle(&mut self, cx: f64, cy: f64, r: f64, color: Color)`: Fills a circle around `cx, cy`.
- `pub fn stroke_circle(&mut self, cx: f64, cy: f64, r: f64, color: Color, width: f64)`: Outlines a circle around `cx, cy`.
- `pub fn stroke_arc(&mut self, cx: f64, cy: f64, r: f64, degrees: std::ops::Range<f64>, color: Color, width: f64)`: Part of a circle around `cx, cy`, clockwise through `degrees` with 0 at the top, with round ends: progress rings and gauges. `stroke_arc(cx, cy, r, 0.0..360.0 * done, ..)` is a ring `done` full.
- `pub fn line(&mut self, x1: f64, y1: f64, x2: f64, y2: f64, color: Color, width: f64)`: A straight line.
- `pub fn polyline(&mut self, points: &[(f64, f64)], color: Color, width: f64)`: Lines through `points`.
- `pub fn fill_polygon(&mut self, points: &[(f64, f64)], color: Color)`: Fills the polygon through `points`.
- `pub fn text(&mut self, x: f64, y: f64, text: &str, size: f64, color: Color, align: Align)`: Text in the system font at `size` points. `x` is its start, centre or end (`align`); `y` is its top.
- `pub fn bold_text(&mut self, x: f64, y: f64, text: &str, size: f64, color: Color, align: Align)`: Bold text (see `text`).
- `pub fn measure(&self, text: &str, size: f64) -> (f64, f64)`: The width and height of `text` at `size` points.

## native

- `pub fn native<V>(make: impl FnOnce(MainThreadMarker) -> Retained<V> + 'static) -> NativeView<V> where V: Message + AsRef<NSView> + 'static`: Wraps an `NSView` Ferrokit doesn't have: `make` builds it, once, when the view is built (on the main thread; `mtm` is the marker AppKit's initialisers take). Any view works: AppKit's, another framework's (`MKMapView`, `SCNView`), or the app's own subclass made with `define_class!`.

### `NativeView`

`pub struct NativeView<V: 'static>`: An `NSView` of the app's choosing, wrapped as a Ferrokit view (see `native`).

- `pub fn update(mut self, f: impl FnMut(&V) + 'static) -> Self`: Changes the view in place: `f` runs as an effect, now and again whenever a signal it read changes. After each run the view is measured again (its neighbours move if its size changed) and redrawn (`setNeedsDisplay`). Each `update` is an effect of its own, so unrelated properties don't re-apply together.
- `pub fn measure(mut self, f: impl Fn(&V) -> Size + 'static) -> Self`: The view's ideal size, asked when it's built and after each `update`. Without it, the view's `fittingSize` (its Auto Layout size, which is zero for a plain `NSView`).
- `pub fn flexible(mut self, horizontal: bool, vertical: bool) -> Self`: Whether the view stretches across (`horizontal`) and down (`vertical`) to fill the room it gets. Both by default (a map, a drawing); `(false, false)` keeps it at its measured size, like a control.
- `pub fn keep<T: Message + 'static>(mut self, object: Retained<T>) -> Self`: Keeps `object` alive as long as the view: a delegate, a target, an observer (AppKit holds delegates weakly).
- `pub fn on_remove(mut self, f: impl FnOnce(&V) + 'static) -> Self`: Runs `f` once the view has left its window (removed from the tree, or its window closed), after its updates have stopped: stop a timer, end an observation, clear a delegate.

## related

- `pub fn related_files(document: &Path, suffixes: &[&str]) -> RelatedFiles`: Lets the app create, read and write the files beside `document` named by appending each of `suffixes` to its name (`"-wal"` gives `data.sqlite-wal`), for as long as the returned value lives.

### `RelatedFiles`

`pub struct RelatedFiles`: Access to the files beside a document, held while this lives (see `related_files`).

- `pub fn paths(&self) -> &[PathBuf]`: The related files' paths (whether or not they exist yet).

## value

### `IntoValue` (trait)

`pub trait IntoValue<T>`: What a view or modifier taking a value accepts: the value itself, or a closure computing it from signals.

- `fn into_value(self) -> Value<T>`: The `Value`.

### `Value`

`pub enum Value<T>`: A value a view shows: fixed, or computed from signals (see the module docs). Made by `IntoValue`.

- `Fixed(T)`: The same value always.
- `Computed(Rc<dyn Fn() -> T>)`: Computed again when the signals it reads change.
- `pub fn get(&self) -> T`: The value now (reading its signals, inside an effect, subscribes it).
- `pub fn is_fixed(&self) -> bool`: Whether it never changes.

## transfer

- `pub type WriteFile = Arc<dyn Fn(&Path) -> std::io::Result<()> + Send + Sync>`: A file's writer: called with where to write it.

### `Clipboard`

`pub struct Clipboard(Retained<NSPasteboard>, bool)`: A pasteboard: `Clipboard::general` is the system clipboard (⌘C/⌘V); `Clipboard::private` is one of the app's own (for tests, or data that mustn't reach the clipboard).

- `pub fn general() -> Self`: The system clipboard.
- `pub fn private() -> Self`: A new pasteboard of the app's own, released when dropped.
- `pub fn pasteboard(&self) -> &NSPasteboard`: The `NSPasteboard`.
- `pub fn set_text(&self, text: &str)`: Replaces the contents with `text`.
- `pub fn text(&self) -> Option<String>`: The text on it, if any.
- `pub fn set_png(&self, png: &[u8])`: Replaces the contents with a PNG image.
- `pub fn png(&self) -> Option<Vec<u8>>`: The PNG image on it, if any.
- `pub fn set_files(&self, paths: &[PathBuf])`: Replaces the contents with files (as the Finder's ⌘C does).
- `pub fn files(&self) -> Vec<PathBuf>`: The files on it (copied in the Finder, or dragged).
- `pub fn clear(&self)`: Empties it.
- `pub fn set(&self, item: &DragItem)`: Puts `item` on it, as a drag would carry it. A promised file is written now, into the temporary folder, and put on as that file.

### `DragItem`

`pub enum DragItem`: What a drag carries out of the app (see `Canvas::draggable`).

- `Text(String)`: Text.
- `Png(Vec<u8>)`: A PNG image.
- `File(PathBuf)`: A file that exists.
- `Promise`: A file written where it's dropped (the Finder, Mail, a folder in another app), named `name`: `write` gets its path when the drop lands, so nothing is written for a cancelled drag.
- `pub fn promise(name: &str, write: impl Fn(&Path) -> std::io::Result<()> + Send + Sync + 'static) -> Self`: A promised file named `name`, written by `write` when dropped.

## l10n

- `pub fn format_date(seconds: f64, template: &str) -> String`: `seconds` since 1970 as the user's locale writes the date format `template`: `"EEEEdMMMM"` is "Friday, 31 October" in English and "Freitag, 31. Oktober" in German; `"MMMd"`, `"yMMM"`, `"EEE"`, `"jm"` (a time, 12 or 24 hours as the user prefers).
- `pub fn format_number(value: f64, decimals: usize) -> String`: `value` with `decimals` decimals, grouped and pointed as the user's region writes numbers (1,234.5 in the US, 1.234,5 in Germany).
- `pub fn format_number_for(value: f64, decimals: usize, identifier: &str) -> String`: `format_number` for the locale named `identifier` (`"de_DE"`).
- `pub fn local_day(seconds: f64) -> i64`: The calendar day `seconds` since 1970 falls on in the user's time zone, counted in days from 1 January 1970: a key for "done today", streaks and calendars that stays right through daylight saving.
- `pub fn local_day_start(day: i64) -> f64`: Local midnight at the start of `day` (see `local_day`), in seconds since 1970.
- `pub fn today() -> i64`: Today, as a `local_day`.
- `pub fn weekday(day: i64) -> u32`: The weekday of a `local_day`, 0 for Monday to 6 for Sunday.
- `pub fn language() -> String`: The language the app's strings are in: a code like `"de"` or `"pt-BR"`, or `"en"` (the keys' own language).
- `pub fn parse_strings(text: &str) -> HashMap<String, String>`: Parses a `.strings` table: `"key" = "value";` lines, with `/* */` and `//` comments and the escapes `\"`, `\\`, `\n`, `\t` and `\Uxxxx`. Malformed entries are skipped.
- `pub fn plural_category(language: &str, n: i64) -> &'static str`: The plural category of `n` in `language` (CLDR's rules for integers): `"one"`, `"few"`, `"many"` or `"other"`.
- `pub fn set_language(language: Option<&str>)`: Uses `language` (`"de"`, `"fr"`…) instead of the user's choice, or the user's again with `None`: for tests and in-app language pickers. Strings already shown (menus, labels that don't read a signal) stay as they are.
- `pub fn t(key: &str) -> String`: `key` translated into the app's language, or `key` itself if there's no translation.
- `pub fn t_plural(n: i64, one: &str, other: &str) -> String`: A count in the app's language: `t_plural(n, "{n} row", "{n} rows")`. The English forms are the keys. A table gives each form as `"{n} rows#one"`, `"{n} rows#few"`, `"{n} rows#many"`, `"{n} rows#other"` (or just `"{n} rows"` for the other form). `{n}` is the number formatted for the user's region (1,000 or 1.000).
- `pub fn t_with(key: &str, args: &[(&str, &dyn std::fmt::Display)]) -> String`: `t` with `{name}` placeholders filled in: `t_with("Open “{file}”", &[("file", &name)])`. Translations can put them in any order.

## charts

- `pub fn area_chart(series: impl Fn() -> Vec<Series> + 'static) -> Chart`: A line chart filled down to zero under each line: totals over time.
- `pub fn bar_chart(data: impl Fn() -> Vec<(String, f64)> + 'static) -> Chart`: A bar chart of labelled values. Hovering a bar shows its value.
- `pub fn heatmap(cells: impl Fn() -> Vec<(String, String, f64)> + 'static) -> Chart`: A grid of cells shaded by their values: `(column, row, value)`, with rows and columns in the order they first appear. A missing cell stays empty; hovering shows a cell's value, and a scale from the lowest to the highest is drawn above (unless `no_legend`). The shade is the first of `colors`, else blue.
- `pub fn histogram(values: impl Fn() -> Vec<f64> + 'static) -> Chart`: How many values fall in each range: bars side by side over round-number bins (about 10, or `bins`). The values print with `value_format`; hovering a bar shows its range and count.
- `pub fn line_chart(series: impl Fn() -> Vec<Series> + 'static) -> Chart`: A line chart of one or more series. Hovering shows each series' value at that x. Series of any length draw quickly: at most a few points per pixel column are kept.
- `pub fn pie_chart(data: impl Fn() -> Vec<(String, f64)> + 'static) -> Chart`: Shares of a whole as slices, with a legend of names, values and percentages. `donut` makes a ring with the total in its middle. Values of zero or less are left out.
- `pub fn scatter_chart(series: impl Fn() -> Vec<Series> + 'static) -> Chart`: Points without lines: how two values relate. Hovering shows the point nearest the pointer.
- `pub fn sparkline(values: impl Fn() -> Vec<f64> + 'static) -> Chart`: A small line with no axes, its last value marked: a trend beside a number or in a row. It takes the width it's given at a fixed height (80 × 24 unless `min_size` says). A `Rule::y` draws a faint target line.
- `pub fn stacked_bar_chart(data: impl Fn() -> Vec<(String, Vec<f64>)> + 'static) -> Chart`: Bars made of several series per category, stacked (or side by side with `grouped`): each category's values are in the order of `series_names`.

### `Chart`

`pub struct Chart`: A chart, made by `bar_chart`, `stacked_bar_chart`, `line_chart`, `area_chart`, `scatter_chart`, `pie_chart`, `histogram`, `heatmap` or `sparkline`: drawn on a canvas, redrawn when the signals its data function reads change, with values on hover, a legend for more than one series, and a summary for VoiceOver.

- `pub fn value_format(mut self, format: Format) -> Self`: How values print (the value axis, the readout, VoiceOver): `Format::Currency`, `Format::Percent`…
- `pub fn x_format(mut self, format: Format) -> Self`: How x values print on line, area and scatter charts: dates with `Format::Date`, money, percentages…
- `pub fn colors(mut self, colors: &[Color]) -> Self`: The colours of the series (or bars, or slices), in order, repeating. A `Series` with its own colour keeps it.
- `pub fn series_names(mut self, names: &[&str]) -> Self`: The names of a stacked bar chart's series, in the order of each category's values (for the legend and the readout).
- `pub fn grouped(mut self) -> Self`: A stacked bar chart's series side by side instead of stacked.
- `pub fn donut(mut self) -> Self`: A pie chart with a hole in the middle, showing the total.
- `pub fn rule(mut self, rule: Rule) -> Self`: A `Rule` across or down the chart: a threshold, a target, an average. Add as many as needed.
- `pub fn selection(mut self, selected: &Signal<Option<usize>>) -> Self`: Clicking a bar, a stacked bar's category, a slice, a histogram's bin or a heatmap's cell (row × columns + column) sets `selected` to its index, and clicking off the marks to `None`; the others dim while one is selected. Setting the signal selects from code.
- `pub fn x_selection(mut self, x: &Signal<Option<f64>>) -> Self`: Clicking a line, area or scatter chart sets `x` to the nearest point's x (on a scatter chart, the point's under the pointer), and clicking off it to `None`; a line marks it, with each series' value.
- `pub fn x_range(mut self, range: &Signal<Option<(f64, f64)>>) -> Self`: The x range a line, area or scatter chart shows, bound two ways: `None` shows all of it; `Some((from, to))` zooms in (the value axis fits what's shown). With `zoomable`, pinching and scrolling change it.
- `pub fn zoomable(mut self) -> Self`: Pinching (or ⌘-scrolling) zooms a line, area or scatter chart in and out around the pointer, and scrolling sideways moves along; zooming out all the way shows everything again. Vertical scrolling still scrolls what the chart is in.
- `pub fn bins(mut self, bins: usize) -> Self`: About how many bins a `histogram` sorts its values into (10 unless set); their edges fall on round numbers.
- `pub fn no_legend(mut self) -> Self`: Hides the legend (shown when there's more than one series, and a heatmap's scale).
- `pub fn min_size(mut self, width: f64, height: f64) -> Self`: The smallest size it's laid out at (default 200 × 120); it takes the room it's given beyond that.
- `pub fn exportable(mut self, name: &str) -> Self`: Copy Image and Save Image… on its right-click menu, and dragging it out gives `name`.png (see `Canvas::exportable`).

### `Format`

`pub enum Format`: How a chart prints its values: on the axes, in the hover readout and in what VoiceOver reads.

- `Number`: Plain numbers; large ones compact on the axis (12k, 1.5M).
- `Decimals(usize)`: Numbers with this many decimals, grouped as the user's locale does.
- `Currency(String)`: Money in the currency with this ISO code (`"USD"`, `"EUR"`), as the user's locale writes it.
- `Percent`: Fractions as percentages: 0.25 is 25%.
- `Date`: Dates: values are seconds since 1970 (UTC), shown in the user's time zone, with ticks on whole days, weeks, months or years.
- `DateTime`: Dates with times of day, ticks on whole hours where they fit.

### `Rule`

`pub struct Rule`: A straight line across a chart at a value: a threshold, a target, an average. `Rule::y` runs across at a value (bar, line, area, scatter and histogram charts, and sparklines); `Rule::x` runs down at an x (line, area and scatter charts, and histograms). The chart's range takes it in, so a target above every value still shows.

- `pub fn y(value: f64) -> Rule`: A line across the chart at `value` on the value axis.
- `pub fn x(x: f64) -> Rule`: A line down the chart at `x`.
- `pub fn label(mut self, label: &str) -> Rule`: A label at its end, also read by VoiceOver.
- `pub fn color(mut self, color: Color) -> Rule`: Its colour (red unless set).

### `Series`

`pub struct Series`: One line of a `line_chart`: a name and its points (sorted by x or not; they're sorted for drawing).

- `pub name: String`: The name in the legend and the hover readout.
- `pub points: Vec<(f64, f64)>`: `(x, y)` points.
- `pub color: Option<Color>`: Its own colour (else the chart's next one).
- `pub fn new(name: &str, points: Vec<(f64, f64)>) -> Self`: A series named `name` through `points`.
- `pub fn color(mut self, color: Color) -> Self`: The same series drawn in `color`.

## host

### `ViewId`

`pub struct ViewId(pub u64)`: Identifies a mounted native view. Chosen by the caller; stable for the view's lifetime (views are created once and updated in place).

## Module `updates`

Updates through Sparkle 2: when the app's bundle holds `Sparkle.framework` and names a feed (`cargo ferrokit bundle` puts both in from `[package.metadata.ferrokit.updates]`), the app starts Sparkle's updater at launch and gets **Check for Updates…** in its app menu. Sparkle checks the feed on its schedule (it asks the user first), shows what's new, downloads, checks the update's signature, installs and relaunches.

### updates

- `pub fn available() -> bool`: Whether the app has Sparkle (it was bundled with updates).
- `pub fn check()`: Checks for updates as **Check for Updates…** does: Sparkle shows its progress and what it finds.
- `pub fn check_in_background()`: Checks without showing anything unless there's an update (as Sparkle's scheduled checks do). With automatic checks and downloads both on, an update is downloaded and installed when the app quits; otherwise Sparkle shows it.
- `pub fn can_check() -> bool`: Whether a check can start now (there's Sparkle and none is running).
- `pub fn automatic_checks() -> bool`: Whether Sparkle checks on its schedule (daily by default). Sparkle asks the user at the second launch; this is their answer, or what the app set.
- `pub fn set_automatic_checks(on: bool)`: Turns scheduled checks on or off (a Settings checkbox, say). Kept in the app's defaults.
- `pub fn automatic_downloads() -> bool`: Whether updates found by scheduled checks download on their own and install when the app quits (Sparkle does this only while automatic checks are on too).
- `pub fn set_automatic_downloads(on: bool)`: Turns automatic downloads on or off. Kept in the app's defaults.
- `pub fn last_check() -> Option<SystemTime>`: When Sparkle last checked, if it has.
- `pub fn on_event(f: impl Fn(&UpdateEvent) + 'static)`: Calls `f` with what the updater does: found an update, up to date, ready to install on quit, failed. Sparkle shows its own windows for checks the user starts; this is for the app's own status (a badge, a line in Settings) and for checks.

## Module `testing`

Helpers for automated checks of apps built with ferrokit: the accessibility tree as VoiceOver sees it, key equivalents through the menu, simulated edits, memory footprint and window snapshots. Used by the checklist and the example apps' self-checks.

### testing

- `pub fn check(name: &str, pass: bool, note: impl std::fmt::Display)`: Reports one self-check as `cargo ferrokit check` reads them: prints `[check] <name> PASS <note>` or `FAIL`, and counts the failures for `finish`. Put what was seen in `note`, so a failure says why.
- `pub fn skip(name: &str, why: impl std::fmt::Display)`: Reports a self-check that couldn't run here (the screen is locked, a permission isn't granted): `[check] <name> SKIP <why>`. Not a failure; `cargo ferrokit check` counts it apart.
- `pub fn finish() -> !`: Ends a self-check run: prints `[check] done, <n> failed` and exits, with a failing status if any `check` failed.
- `pub fn steps(pause_ms: u64, steps: Vec<Box<dyn FnOnce()>>)`: Runs `steps` one after another, each in a turn of its own `pause_ms` after the one before, then `finish`es. A self-check acts in one step and looks in the next: effects, table updates and sheets settle after the step that caused them returns.
- `pub fn view_labeled(window: &objc2_app_kit::NSWindow, label: &str) -> Option<Retained<objc2_app_kit::NSView>>`: The first view in `window` with the accessibility label `label` (what `.accessibility_label(..)` set), for a check to read or drive: a field, a table, an editor's text view, a web view.
- `pub fn footprint_mb() -> f64`: Physical footprint in MB (what Activity Monitor shows; RSS keeps freed heap pages and overstates growth), via vmmap.
- `pub fn peak_footprint_mb() -> f64`: The process's peak physical footprint so far, in MB (via vmmap).
- `pub fn ax_tree(window: &objc2_app_kit::NSWindow) -> Vec<(String, String, String)>`: The window's accessibility tree, flattened: (role, subrole, label/title) for every element under the content view, as VoiceOver sees it. On macOS 27, AppKit's text fields and checkboxes host SwiftUI internally, so the AX element is a child of the NSView, not the view itself.
- `pub fn has_ax(tree: &[(String, String, String)], role: &str, subrole: &str, label: &str) -> bool`: Whether the tree has an element with this role (and subrole and label, unless empty).
- `pub fn post_edit(field: &NSTextField, text: &str)`: Sets a text field's text and posts the change notification, as typing does.
- `pub fn send_action(control: &objc2_app_kit::NSControl) -> bool`: Sends a control's action to its target, as a click or Return does.
- `pub fn symbol_effects() -> (isize, usize)`: Symbol effects running (`Image::effect` while active) and one-shot effects played so far (`Image::effect_on`).
- `pub fn step_motion(seconds: f64)`: Moves the clock springs, `animate` and `keyframes` run on forward by `seconds` and runs a frame: what's animating lands where it would be that much later.
- `pub fn set_right_to_left(on: Option<bool>)`: Lays out right to left (`Some(true)`), left to right, or as the app's language says (`None`): for checking a layout mirrors. Windows lay out again as they change; call it before opening the window to check.
- `pub fn remember_open_documents()`: Remembers the documents open now, as quitting does (they reopen at the next launch when the user keeps windows: `NSQuitAlwaysKeepsWindows`, which a launch argument can set for one run).
- `pub fn motion_running() -> usize`: Value and spring animations running now.
- `pub fn failures() -> Vec<crate::Failure>`: The failures caught where AppKit called in (exceptions and panics; the last 100): see `App::on_error`.
- `pub fn thumbnails_made() -> usize`: Quick Look thumbnails made so far (`thumbnail`).
- `pub fn quick_look_state() -> (Vec<std::path::PathBuf>, Option<usize>)`: The files the Quick Look panel was given, and the one it shows (`None` while it's closed).
- `pub fn snapshot_windows(dir: &str)`: Renders every window to `<dir>/<title>.png` (AppKit's own drawing, no screen-recording permission needed). The window's frame view is drawn, so the image includes the title bar and the window background (which the content view alone doesn't draw).
- `pub fn key_equiv(w: &objc2_app_kit::NSWindow, chars: &str, shift: bool) -> bool`: Sends a ⌘-key equivalent through the main menu, as a key press would.
- `pub fn about_shown() -> u32`: How many times About {app} was shown with `App::about`'s credits.
- `pub fn app_menu_titles() -> Vec<String>`: The titles of the app menu's items (the first menu: About, Check for Updates…, Settings…, Hide, Quit), separators as `"-"`.
- `pub fn menu_key(chars: &str, modifiers: objc2_app_kit::NSEventModifierFlags) -> bool`: Sends a key-down with `chars` and `modifiers` to the main menu's key equivalents (no window needed); true if an enabled item took it.
- `pub fn shortcut(window: &objc2_app_kit::NSWindow, chars: &str, shift: bool) -> bool`: Performs a keyboard shortcut the way the menu bar does, without needing the app to be active: finds the main-menu item for ⌘`chars` (⇧⌘ when `shift`; AppKit's rule: an uppercase key equivalent implies Shift). An item of the app's own (`menu_item`, `menu_command`) runs if it's enabled; a standard item (Undo, Select All) sends its action along `window`'s responder chain, starting at its first responder. Returns whether an item matched and something handled it.
- `pub fn set_preview_mode(on: bool)`: Turns preview mode on or off for windows opened from now on, as `cargo ferrokit preview` does with `FERROKIT_PREVIEW=1`: a window without `remember_frame` keeps its frame under its title.
- `pub fn capture_reveals(on: bool)`: From now on, `reveal_in_finder` records what it's asked to show instead of opening Finder windows (`false` stops).
- `pub fn revealed() -> Vec<Vec<std::path::PathBuf>>`: What `reveal_in_finder` was asked to show since the last call, while `capture_reveals` is on: one list of paths per call.
- `pub fn set_last_opened(path: &std::path::Path, secs: Option<i64>) -> std::io::Result<()>`: Sets `path`'s last-opened date (seconds since 1970, `None` for never), for checks of lists that use `file_dates`.
- `pub fn catching(f: impl FnOnce())`: Runs `f` the way Ferrokit runs code AppKit calls in (an action, a timer): a panic in it is caught and reported (see `failures`), not a crash.
- `pub fn pending_crash_reports(dir: &std::path::Path) -> Vec<crate::CrashReport>`: The crash reports in `dir` not yet marked sent, oldest first (what `App::crash_reports` hands the app at launch). Checks point `FERROKIT_CRASH_DIR` at a folder of their own.
- `pub fn is_misspelled(word: &str) -> bool`: Whether the system spell checker flags `word` in English. (With automatic language detection one isolated word can be guessed as another language and pass, so the language is given.)
- `pub fn context_menu_for_word(view: &objc2_app_kit::NSTextView, word: &str) -> Vec<String>`: The titles of a text view's context menu for a right-click on `word`.
- `pub fn capture_window(window: &objc2_app_kit::NSWindow) -> Option<Retained<objc2_app_kit::NSBitmapImageRep>>`: Captures `window` as the window server shows it (lossless, no shadow, via `screencapture -l`): what's on screen, which in-process snapshots can miss (Core Animation layers, animations, vibrancy). Needs the screen-recording permission; `None` without it.
- `pub fn captured_pixels(rep: &objc2_app_kit::NSBitmapImageRep, view: &objc2_app_kit::NSView, step: usize) -> Vec<Vec<(f64, f64, f64)>>`: The sRGB colours (r, g, b in 0…1) of a capture from `capture_window` inside `view`'s bounds: rows from the top, every `step` pixels.
- `pub fn ax_elements(window: &objc2_app_kit::NSWindow) -> Vec<AxElement>`: Every accessibility element under `window`'s content view, depth first, including those inside SwiftUI views (`NSHostingView`), which SwiftUI makes only once the system's accessibility API is asked: the walk asks it first, as VoiceOver does.
- `pub fn ax_audit(window: &objc2_app_kit::NSWindow) -> Vec<String>`: What VoiceOver users would miss in `window`: controls with no name to read (fields, editors, sliders, pop-ups, checkboxes, switches, buttons, steppers), and images and controls read as a symbol name ("speaker.wave.2"). Empty when every control can be told apart by ear.
- `pub fn heap_in_use_mb() -> f64`: Memory the process has allocated and not freed, in MB (all malloc zones). Unlike `footprint_mb`, it drops as soon as something is freed: the allocator returns freed pages to the system in batches, at times of its own (seconds later when the machine is busy), so footprint can't tell a leak from memory not yet handed back. Use this for leak checks.
- `pub fn virtual_machine() -> bool`: Whether this Mac is a virtual machine (GitHub's macOS runners are). There the window server has no GPU, so materials don't blur, drawing is slower and window-server input doesn't arrive: checks of those say SKIP rather than fail.
- `pub fn canvas_drawing(view: &objc2_app_kit::NSView) -> Option<Vec<String>>`: What a `canvas` (or chart) drew last, one line per operation (`fill rect 10,20 30x40 Blue`, `text "Jan" 11pt`); `None` if `view` isn't one.
- `pub fn canvas_png(view: &objc2_app_kit::NSView) -> Option<Vec<u8>>`: A canvas as a PNG, on the content background: what its Copy Image puts on the clipboard. `None` if `view` isn't a canvas.
- `pub fn canvas_click(view: &objc2_app_kit::NSView, x: f64, y: f64) -> bool`: Clicks a `canvas` at `x, y` (points from its top left), running its `on_click` handler; false if it has none.
- `pub fn canvas_scroll(view: &objc2_app_kit::NSView, dx: f64, dy: f64, x: f64, y: f64) -> bool`: Scrolls a `canvas` (or chart) by `dx, dy` points with the pointer at `x, y`, as a trackpad would; false if it didn't use it.
- `pub fn canvas_magnify(view: &objc2_app_kit::NSView, amount: f64, x: f64, y: f64) -> bool`: Pinches a `canvas` (or chart) by `amount` (0.5 is 50% larger) at `x, y`; false if it didn't use it.
- `pub fn canvas_drag(view: &objc2_app_kit::NSView) -> Option<crate::DragItem>`: What dragging a canvas would carry now (its `draggable`, or the image of an `exportable` one), without a drag session.
- `pub fn canvas_move(view: &objc2_app_kit::NSView, from: (f64, f64), to: (f64, f64)) -> bool`: Drags inside a canvas from `from` to `to` (its coordinates), as a user's drag reaches its `on_drag`; false without one.
- `pub fn fulfil(item: &crate::DragItem, dir: &std::path::Path) -> std::io::Result<std::path::PathBuf>`: Writes a promised file into `dir` as a drop there would; the path.
- `pub fn drop_on_view(view: &objc2_app_kit::NSView, pasteboard: &objc2_app_kit::NSPasteboard) -> bool`: Drops whatever is on `pasteboard` onto `view` as AppKit does at the end of a drag (entered, then perform). Whether it was taken.
- `pub fn set_reduce_motion(on: Option<bool>)`: Overrides the Reduce Motion setting animated changes follow (`None`: the system's), so checks can run both paths without changing it.
- `pub fn leaving_views() -> usize`: How many native views are still animating out after a transition.
- `pub fn hover(view: &objc2_app_kit::NSView, inside: bool) -> bool`: Sends a view made with `on_hover` or `hover_highlight` (its interaction view, a `FerrokitInteraction`) the pointer entering or leaving. False if `view` isn't one.
- `pub fn press(view: &objc2_app_kit::NSView, down: bool) -> bool`: Presses (`down`) or releases a view made with `on_click` (its `FerrokitInteraction`), as the mouse does: the press dims it, the release clicks. False if `view` isn't one.
- `pub fn is_pressed(view: &objc2_app_kit::NSView) -> Option<bool>`: Whether a clickable view's interaction is pressed (`None` if `view` isn't one).
- `pub fn hold_notifications()`: Makes `notify` record notifications instead of posting them (no permission prompt, no banners); read them with `sent_notifications`.
- `pub fn sent_notifications() -> Vec<crate::SentNotification>`: The notifications recorded since `hold_notifications`, oldest first (one posted again with the same id replaces it; cancelled ones go).
- `pub fn click_notification(id: &str) -> bool`: Runs the click action of the notification `id`, as clicking it in Notification Center would; false if it has none.
- `pub fn shared_items(button: &objc2_app_kit::NSButton) -> Option<Vec<crate::ShareItem>>`: What a `share_button` would share if clicked now.
- `pub fn menu_bar_extras() -> Vec<(Retained<objc2_app_kit::NSStatusItem>, Option<Retained<objc2_app_kit::NSPopover>>)>`: The app's menu-bar extras, oldest first, each with its panel's popover (for extras with a panel).

### `AxElement`

`pub struct AxElement`: One accessibility element as VoiceOver gets it.

- `pub depth: usize`: Nesting depth under the window's content view.
- `pub role: String`: `AXButton`, `AXTextField`…
- `pub subrole: String`: `AXSwitch`, `AXSearchField`…
- `pub name: String`: What VoiceOver reads as the name: the label, else the title, else a linked title element's value, else the placeholder; for static text (labels, table and sidebar rows) and a list's items, its text.
- `pub label: String`: The element's own label (set with `accessibility_label`).

## Module `input`

Real input for checks: clicks and keystrokes that take the path a user's do, not AppKit's entry points (`performClick`, `selectRowIndexes`).

### input

- `pub fn ready(window: &NSWindow) -> bool`: Brings the app to the front and makes `window` key, so input reaches it. True once both hold (it can take a run-loop turn: call it, wait a moment, and call it again before sending input).
- `pub fn click_at_with(view: &NSView, x: f64, y: f64, mods: &[Mod]) -> bool`: Clicks `view` at `x, y` points from its top-left corner, holding `mods`.
- `pub fn click_at(view: &NSView, x: f64, y: f64) -> bool`: Clicks `view` at `x, y` points from its top-left corner.
- `pub fn click(view: &NSView) -> bool`: Clicks the middle of `view`, as the user would: the window hit-tests the point, so whatever is on top there gets the click.
- `pub fn double_click(view: &NSView) -> bool`: Double-clicks the middle of `view`.
- `pub fn key(window: &NSWindow, key: Key, mods: &[Mod])`: Presses `key` with `mods` in `window` (to its first responder, or the menus' key equivalents when ⌘ is held).
- `pub fn type_text(window: &NSWindow, text: &str)`: Types `text` into `window`'s first responder, a key at a time (capitals with ⇧, line breaks as Return).
- `pub fn server_available() -> bool`: Whether window-server input can be posted: this process is trusted for Accessibility. (Asking for it is the user's to do, in System Settings.)
- `pub fn server_click(view: &NSView) -> bool`: Clicks the middle of `view` through the window server (see the module docs); false if that isn't available.
- `pub fn server_type(text: &str) -> bool`: Types `text` through the window server (see the module docs); false if that isn't available.

### `Mod`

`pub enum Mod`: A modifier key held with `key`.

- `Command`: ⌘
- `Shift`: ⇧
- `Option`: ⌥
- `Control`: ⌃

### `Key`

`pub enum Key`: A key for `key`.

- `Char(char)`: A character key: a letter, digit or punctuation.
- `Return`: Return.
- `Tab`: Tab.
- `Escape`: Escape.
- `Delete`: Delete (backspace).
- `Left`: The arrow keys.
- `Right`: →
- `Up`: ↑
- `Down`: ↓

## Module `soak`

Soak tests: random user actions for a long time, watching for crashes, hangs and growth.

### soak

- `pub fn action(name: &'static str, weight: u32, run: impl Fn(&mut Rng) + 'static) -> Action`: An action called `name`, picked `weight` times as often as one of weight 1.
- `pub fn run(settings: Settings, actions: Vec<Action>)`: Runs the soak, then exits the process: 0 if no hang was seen, 1 if one was. Call it from `on_launch`, once the windows are up.

### `Rng`

`pub struct Rng(u64)`: A small, seeded random generator (xorshift), for repeatable runs.

- `pub fn new(seed: u64) -> Rng`: A generator from `seed` (not 0).
- `pub fn below(&mut self, n: usize) -> usize`: A number in `0..n` (0 when `n` is 0).
- `pub fn chance(&mut self, p: f64) -> bool`: True with probability `p`.
- `pub fn pick<'a, T>(&mut self, items: &'a [T]) -> &'a T`: One of `items`.

### `Action`

`pub struct Action`: One kind of action: a name for the log, a weight, and what it does.

### `Settings`

`pub struct Settings`: How long and how fast.

- `pub duration: Duration`: How long to run.
- `pub interval: Duration`: Time between actions.
- `pub seed: u64`: The random seed.
- `pub fn from_env() -> Settings`: From the environment: `SOAK` minutes (default 10), `SOAK_SEED` (default the time), `SOAK_MS` between actions (default 120); `SOAK_ONLY=<action>` runs just that one (see `run`).