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
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
//! Facade crate: the public `frust` framework API.
//!
//! App authors depend on this single crate. It exposes [`run`], the canonical
//! app entry point, and curates the view/widget/reactive
//! vocabulary from the underlying framework crates so the declarative call
//! shape reads exactly as the spec promises:
//!
//! ```no_run
//! use frust::{AnyView, Column, Component, View, any, text};
//!
//! // A small stateless widget: a plain fn, generic over the state of
//! // whichever component places it.
//! fn greeting<S: 'static>(message: &str) -> impl View<S> + use<S> {
//! text(message.to_owned()).size(24.0)
//! }
//!
//! struct Counter;
//!
//! impl Component for Counter {
//! type State = i32;
//!
//! fn init(&self) -> i32 {
//! 0
//! }
//!
//! // The whole UI lives in `build`; split it into widget fns like
//! // `greeting` rather than nesting ever deeper inside it.
//! fn build(&self, state: &mut i32) -> AnyView<i32> {
//! any(Column(vec![
//! any(greeting("Hello from Frust")),
//! any(text(format!("count: {state}")).size(32.0)),
//! ]))
//! }
//! }
//!
//! frust::run(Counter).unwrap();
//! ```
//!
//! The composition rule: stateless pieces are plain widget functions called
//! from `build`; a piece with its own state is a child [`Component`] mounted
//! with [`component`], which gives it a private state boundary. [`run`] (or
//! the [`app!`] macro, which also covers the mobile and web shells) starts it.
//!
//! ## Low-level escape hatch: `App::new`
//!
//! [`App`] is the low-level primitive [`run`] and [`app!`] expand into
//! (`App::new(state, move |state| root.build(state))`): a single ambient
//! `State` and a build closure, with no [`Component`] state-boundary or
//! retained local state. Ordinary apps use a [`Component`] with [`run`] or
//! [`app!`]; reach for `App::new` directly only when you need that raw
//! `(state, build)` pair:
//!
//! ```no_run
//! struct AppState {
//! greeting: String,
//! }
//!
//! let build = |state: &mut AppState| -> frust::AnyView<AppState> {
//! frust::any(frust::text(state.greeting.clone()).size(32.0))
//! };
//!
//! frust::App::new(AppState { greeting: "Hello from Frust".into() }, build)
//! .run()
//! .unwrap();
//! ```
//!
//! ## Layout containers
//!
//! The primitive containers compose heterogeneous children through
//! [`any`] (type erasure) into the declarative call shape:
//!
//! ```
//! use frust::{Align, Alignment, Column, EdgeInsets, Padding, Row, SizedBox, any, text};
//!
//! struct Layouts;
//!
//! impl frust::Component for Layouts {
//! type State = ();
//!
//! fn init(&self) {}
//!
//! fn build(&self, _state: &mut ()) -> frust::AnyView<()> {
//! any(Column(vec![
//! any(text("title").size(24.0)),
//! any(Row(vec![any(text("left")), any(text("right"))])),
//! any(Padding(EdgeInsets::all(8.0), text("padded"))),
//! any(Align(Alignment::CENTER, text("centered"))),
//! any(SizedBox(Some(0.0), Some(12.0))),
//! ]))
//! }
//! }
//! # let _ = Layouts;
//! ```
pub use ;
pub use ;
// [`NavigatorController::push_with_options`] (an existing method on the
// already-flat-re-exported [`NavigatorController`] below) needed its argument
// type actually constructible from `frust::` — added here as part of the
// baseline re-export list, alongside the other bare navigator vocabulary
// (`NavigatorController`/`NavigatorId`/`PageBuilder`/`PopResult`) it was
// missing:
//
// - [`PushOptions`] carries a pushed page's back-press [`BackPolicy`] (and,
// for a [`BackPolicy::DismissAnimated`] overlay, the shared dismiss-signal
// cell) alongside opacity/transition/result.
// - [`PushOptions::on_visibility`]/[`NavigatorController::transition`] hand
// back [`PageVisibility`]/[`TransitionState`] respectively — both
// otherwise unnameable without [`PageVisibility`]/[`VisibilityCallback`]/
// [`TransitionState`] themselves in scope.
//
// This closes a re-export gap: a design-system plugin's own modal helper
// (`frust_glyph::show_glyph_dialog` is the shipped example —
// `push_with_options(.., PushOptions::transparent())` with a custom
// [`BackPolicy`]) depends on exactly this seam, so an app- or plugin-authored
// dialog/sheet could reach the *method* through [`NavigatorController`] but
// never construct a call to it. See this file's
// `push_with_options_dismiss_animated` test module below for the worked
// `BackPolicy::DismissAnimated` + dismiss-signal example — an app-authored
// modal staging its own exit on Android back instead of vanishing.
pub use ;
/// The overlay portal's own vocabulary, flat-re-exported from `frust-core`:
/// which z-band a floated surface sits in, whether the pointer reaches it, and
/// what a press landing outside it delivers.
///
/// [`overlay_portal`] floats a surface above the whole app, anchored to its
/// child's bounds and painted after the entire main tree — so it escapes both
/// the child's paint order and every ancestor's clip, and follows the child
/// across scroll and relayout with nothing subscribed. The surface is mounted
/// while [`OverlayPortalView::overlay`] is `Some`; a widget that hosts a
/// surface of its own instead reaches for `authoring::OverlaySlot`.
///
/// Lifted flat for [`EditCommand`]'s reason: an app or design system naming a
/// band, an input class or a light-dismiss policy is configuring a portal, not
/// authoring a widget.
///
/// ```
/// use frust::{
/// OverlayBand, OverlayInput, OverlayPlacement, OverlaySide, View, any, overlay_portal, text,
/// };
///
/// struct App {
/// hovering: bool,
/// }
///
/// // A tooltip: above its trigger, in the topmost band, and transparent to the
/// // pointer so hovering the trigger is never interrupted by its own tip.
/// fn trigger(state: &mut App) -> impl View<App> + use<> {
/// overlay_portal(text("Save"))
/// .overlay(state.hovering.then(|| any(text("Save the document"))))
/// .placement(OverlayPlacement::on(OverlaySide::Top))
/// .band(OverlayBand::Tooltip)
/// .input(OverlayInput::Transparent)
/// }
/// # let _ = trigger;
/// ```
pub use ;
/// The clipboard/selection command vocabulary, flat-re-exported from
/// `frust-core::event` (and also available through
/// [`authoring::EditCommand`]).
///
/// [`InputEvent::EditCommand`](authoring::InputEvent) delivers one of
/// [`EditCommand::Copy`], [`EditCommand::Cut`], [`EditCommand::Paste`] or
/// [`EditCommand::SelectAll`] down the focus chain, already decoded by the shell
/// from the platform's own gesture — `Cmd+C` on macOS, `Ctrl+C` or `Ctrl+Insert`
/// elsewhere, a hardware clipboard key, an Android `ACTION_PROCESS_TEXT`, an iOS
/// edit-menu tap — so app and design-system code never decodes a chord itself.
///
/// Lifted flat rather than left inside [`authoring`] for [`CursorIcon`]'s reason:
/// a design system's own context menu or toolbar builder names these verbs in
/// its public API without being a widget author. `Paste` carries its text
/// because the shell has already read the host clipboard; its [`Debug`] redacts
/// that text, since a paste payload can be a password or a token.
pub use EditCommand;
/// The selection-toolbar seam: the request a text field publishes when it
/// has a selection ([`SelectionToolbarRequest`]/[`SelectionToolbarActions`]),
/// and the knobs that decide who draws it.
///
/// [`set_selection_toolbar_policy`] chooses
/// [`SelectionToolbarPolicy::Framework`] (the default — a field floats its
/// own pod through the overlay portal) or [`SelectionToolbarPolicy::Native`]
/// (the platform's own edit menu, e.g. iOS's `UIEditMenuInteraction`) — see
/// that type's own docs for the two-route split. This is **not** an
/// unconditional free choice, though: a platform shell whose system owns the
/// menu can LOCK it instead, with `frust_core::lock_selection_toolbar_policy`
/// — once locked, [`set_selection_toolbar_policy`] is refused rather than
/// obeyed, so an app cannot silently undo a platform requirement it doesn't
/// know exists. iOS's shell locks [`SelectionToolbarPolicy::Native`] at
/// start-up for exactly this reason: a framework-drawn toolbar's own Paste
/// button would break the exemption that keeps iOS's per-app paste-permission
/// prompt from firing on every paste.
///
/// [`set_selection_toolbar_builder`] installs the view a `Framework`-policy
/// pod floats, **replacing** whatever the framework's own baseline (installed
/// at bootstrap, before the first frame) or an earlier design system already
/// installed. A design system's own installer should reach for
/// `frust_core::install_selection_toolbar_builder_if_unset` instead — the
/// cooperative, set-if-unset half of the same pair — so two catalogs linked
/// into one binary never fight over the slot, and neither ever undoes an
/// app's own explicit override.
///
/// ```
/// use frust::{
/// SelectionToolbarPolicy, lock_selection_toolbar_policy, set_selection_toolbar_policy,
/// };
///
/// // A shell whose platform owns its own system edit menu locks the route,
/// // so that requirement wins no matter what app code does afterward.
/// let claimed = lock_selection_toolbar_policy(SelectionToolbarPolicy::Native);
/// assert!(claimed, "the first claim always takes the lock");
///
/// // An app's later override is refused rather than obeyed once locked.
/// set_selection_toolbar_policy(SelectionToolbarPolicy::Framework);
/// ```
pub use ;
/// Platform-view embedding (platform-views feature): reserve
/// layout space for a native view (a map, a video player, ...) composited
/// alongside the frust surface. [`platform_view`] takes the
/// `"dev.frust.<Factory>"`-style native factory name registered on each
/// platform and returns a builder ([`PlatformViewView`]) over the
/// params/size contract — flat-re-exported from `frust-widgets` so app code
/// never names that crate directly.
///
/// # Paint contract (Mode B)
///
/// Under Mode B compositing the frust surface itself is translucent, so
/// **any region this slot's parent doesn't paint over is a window straight
/// through to the native view (or the OS background) behind it** — this is
/// the mechanism Mode B relies on, not a bug. Size/position a slot
/// deliberately, and don't rely on an unpainted sibling region staying
/// opaque.
///
/// Mode B is selected by the generated host's `FRUST_TRANSLUCENT_SURFACE`
/// (Android)/`translucentSurface` (iOS) build-time constant — **not** from
/// Rust: that constant drives, in one host-glue branch, the native window's
/// pixel format (`PixelFormat.TRANSLUCENT`/`CAMetalLayer.isOpaque = false`),
/// the native-sibling z-order/subview arrangement, and the
/// `nativeSetSurfaceMode`/`frust_set_surface_mode` call together
/// (flipping only some of these is a host-template defect). There is
/// no app-Rust opt-in call; the generated project's template is
/// the sole route into Mode B.
///
/// ```no_run
/// use frust::{AnyView, Column, Component, any, platform_view, text};
///
/// #[derive(Default)]
/// struct MapDemo;
///
/// impl Component for MapDemo {
/// type State = ();
///
/// fn init(&self) -> Self::State {}
///
/// fn build(&self, _state: &mut Self::State) -> AnyView<Self::State> {
/// any(Column(vec![
/// any(text("map below")),
/// any(platform_view("dev.frust.MapFactory")
/// .params_json(r#"{"style":"dark"}"#)
/// .size(320.0, 240.0)),
/// ]))
/// }
/// }
///
/// frust::app!(MapDemo);
/// # fn main() {}
/// ```
///
/// # Z-shields ([`shield`])
///
/// A slot marked `.interactive()` forwards a touch-DOWN inside its rect to the
/// native view, including one that landed on frust chrome painted over it (the
/// OS-side hit test knows nothing about the frust scene). Wrap that chrome in
/// [`shield`] and it keeps winning input: the wrapper reports the rect it
/// painted every frame, and the shell hands the overlapping ones to the host
/// with the slot's placement.
pub use ;
/// Declarative custom painting over the [`PaintScene`] trait object — a chart,
/// a node-and-edge graph, a game board — without hand-rolling a `View`/
/// `Widget` pair. [`canvas`] takes a paint closure that runs in **local
/// space** (the widget's own top-left is always `(0, 0)`, and painting past
/// its own size is clipped, never a bug to chase) — flat-re-exported from
/// `frust-widgets` so app code never names that crate directly. See
/// [`CanvasView`]'s own doc for the full builder contract (`.size`/`.expand`
/// sizing, `.on_hit`-gated `.on_tap`/`.on_pointer`, and `.repaint_key` for
/// paint-only dirtying driven by data outside the ordinary `View` diff).
///
/// ```no_run
/// use frust::authoring::{PaintCtx, PaintScene};
/// use frust::{AnyView, Component, any, canvas};
/// use kurbo::{Point, Size};
/// use peniko::Color;
///
/// #[derive(Default)]
/// struct Clock;
///
/// impl Component for Clock {
/// type State = u32;
///
/// fn init(&self) -> Self::State {
/// 0
/// }
///
/// fn build(&self, state: &mut Self::State) -> AnyView<Self::State> {
/// let ticks = *state;
/// any(canvas(move |scene: &mut dyn PaintScene, size: Size, _ctx: &PaintCtx| {
/// scene.fill_rect(Point::ZERO, size, Color::from_rgb8(0x10, 0x10, 0x10));
/// })
/// .expand()
/// .repaint_key(ticks))
/// }
/// }
///
/// frust::app!(Clock);
/// # fn main() {}
/// ```
pub use ;
/// A pan/zoom viewport over one child — a node-and-edge graph, a map, a large
/// image — without hand-rolling the gesture math. [`pan_zoom`] lays its child
/// out at its natural size and places it under a scale-then-translate
/// transform ([`PanZoomTransform`]) the user drives: primary drag pans (unless
/// the child claims the press), a touch pinch or a desktop ctrl/⌘+wheel and
/// trackpad pinch zooms about the gesture's focal point, clamped to
/// `.min_scale`/`.max_scale`. A plain wheel still reaches the child, and the
/// child sees its own unscaled local coordinates at any zoom. Flat-re-exported
/// from `frust-widgets` so app code never names that crate directly; see
/// [`PanZoomView`]'s own doc for the full contract (`.inertia` glide,
/// `.on_transform` notification, and the [`PanZoomController`] handle's
/// `jump_to`/`fit_to_bounds`/`fit_rect`).
///
/// ```no_run
/// use frust::authoring::{PaintCtx, PaintScene};
/// use frust::{AnyView, Component, PanZoomController, PanZoomTransform, any, canvas, pan_zoom};
/// use kurbo::{Point, Size};
/// use peniko::Color;
///
/// #[derive(Default)]
/// struct Board;
///
/// struct BoardState {
/// zoom: PanZoomController,
/// transform: PanZoomTransform,
/// }
///
/// impl Component for Board {
/// type State = BoardState;
///
/// fn init(&self) -> Self::State {
/// BoardState {
/// zoom: PanZoomController::new(),
/// transform: PanZoomTransform::IDENTITY,
/// }
/// }
///
/// fn build(&self, state: &mut Self::State) -> AnyView<Self::State> {
/// let board = canvas(|scene: &mut dyn PaintScene, size: Size, _ctx: &PaintCtx| {
/// scene.fill_rect(Point::ZERO, size, Color::from_rgb8(0x20, 0x20, 0x20));
/// })
/// .size(Size::new(2000.0, 1500.0));
/// any(pan_zoom(board)
/// .max_scale(4.0)
/// .inertia(true)
/// .controller(state.zoom.clone())
/// .on_transform(|state: &mut BoardState, t| state.transform = t))
/// }
/// }
///
/// frust::app!(Board);
/// # fn main() {}
/// ```
pub use ;
/// The vendored Material Symbols starter icon set,
/// flat-re-exported so app code names `frust::icons::HOME` rather than the
/// underlying `frust-widgets` crate. Each entry is an
/// [`IconSource`](crate::IconSource) usable directly with [`icon`](crate::icon);
/// an app can also supply its own vector icons via
/// [`IconData::from_path`](crate::IconData::from_path).
pub use icons;
/// The declarative router vocabulary (a go_router-subset layer),
/// flat-re-exported from `frust-widgets` so app code never names that
/// crate directly: [`Router`] resolves a location against a [`Route`] table
/// (built via [`RouteBuilder`]) into [`Resolution`]/[`ResolvedPage`]s driving
/// a [`NavigatorController`], with `:param`/query parsing
/// ([`Location`]/[`PathPattern`]/[`RouteParams`]), per-route/top-level
/// [`Redirect`]s (loop-guarded at [`DEFAULT_REDIRECT_LIMIT`]), and an
/// [`ErrorBuilder`] fallback for an unmatched location.
///
/// A page builder receives the location's query merged **under** its path
/// captures, so `/terminal?session=abc` reads its own parameter.
///
/// [`RouteNavigator`] is the seam a screen navigates through: a `Send + Sync`
/// queue of [`NavRequest`] data (paths and names, never closures) that rides
/// `provide_context` — the [`Router`] itself cannot, since it holds `Rc` page
/// builders. [`RouterDeepLinks::track`] drains it every rebuild, so a request
/// queued in an event handler (on any thread — the queue never panics
/// off-thread) applies on the next frame.
///
/// [`shell_route`] is the nested-navigator binding: its children resolve onto a
/// second [`NavigatorController`] the app owns and its own page — the chrome
/// wrapping that inner navigator — stays retained while they do, so navigating
/// between siblings inside the shell never rebuilds the chrome. See its docs
/// for the keep rule and the per-verb table.
pub use ;
/// The page-transition **resolve/drive** path: the framework's own reduce-
/// motion collapse policy, re-exported so an app-authored animation reuses it
/// rather than re-deriving it.
///
/// [`resolve_spec`] applies `Theme.motion.reduce_motion`'s hard accessibility
/// rule to a [`TransitionSpec`] — collapsing any animated preset to a
/// `≤120ms` linear cross-fade — and resolves a bare [`Timing::ThemeDefault`]
/// against the active [`MotionScheme`]. [`make_driver`] then turns the
/// resolved [`Timing`] into a running [`TransitionDriver`] (advanced each
/// frame via `TransitionDriver::advance`) plus the [`SpringDesc`] to settle it
/// with later (an interactive edge-swipe's release fling). This is exactly
/// the pair `frust-widgets`' own navigator and
/// [`motion::switcher::PatternSwitcher`](crate::motion::switcher::PatternSwitcher)
/// drive their transitions through — before this re-export, an app widget
/// implementing its own page/dialog animation had to hand-roll the
/// reduce-motion collapse (read `Theme.motion.reduce_motion`, apply the
/// `120ms` + linear + zero-motion rule) instead of calling the framework's one
/// implementation, so the two would silently drift the next time the
/// framework's rule changes.
///
/// Not otherwise re-exported at `frust-widgets`' own crate root (reached here
/// via `frust_widgets::nav::transition`, a `pub mod` two levels down) — this
/// is the facade's job precisely so app code never has to know that.
///
/// ```
/// use frust::{Curve, PageTransition, Theme, Timing, TransitionDriver, TransitionSpec};
///
/// // A theme with reduce_motion on: resolve_spec collapses the spec to the
/// // framework's own linear cross-fade, with no app-side collapse logic.
/// let mut theme = Theme::neutral();
/// theme.motion.reduce_motion = true;
///
/// let spec = TransitionSpec::duration(PageTransition::SlideUp);
/// let resolved = frust::resolve_spec(spec, Some(&theme.motion));
/// assert_eq!(resolved.preset, PageTransition::ReducedCrossfade);
/// assert_eq!(
/// resolved.timing,
/// Timing::Duration(std::time::Duration::from_millis(120), Curve::Linear)
/// );
///
/// let (driver, _settle_spring) = frust::make_driver(resolved.timing);
/// assert!(matches!(driver, TransitionDriver::Auto(_)));
/// ```
pub use ;
/// The `motion` module: declarative
/// implicit-animation wrappers (`AnimatedOpacity`/`AnimatedScale` today;
/// `switcher`/`patterns` land later) over `frust-core`'s `anim`
/// vocabulary. Re-exported **wholesale**
/// (`pub use frust_widgets::motion;`), mirroring `frust_widgets::icons`'s
/// existing wholesale-module precedent — the only other one in this facade —
/// so later types under `frust_widgets::motion` ride along under
/// `frust::motion::*` with no further facade edits (see that module's own
/// docs for the full rationale).
///
/// ```
/// use frust::motion::{AnimatedOpacity, AnimatedOpacityView, AnimatedScale};
/// use frust::text;
///
/// let _opacity: AnimatedOpacityView<()> = AnimatedOpacity(1.0, text("hi"));
/// let _scale: frust::motion::AnimatedScaleView<()> = AnimatedScale(1.0, text("hi"));
/// ```
pub use motion;
/// Everything needed to author a custom `View`/`Widget` pair.
///
/// **`frust` alone is sufficient**: an app that implements its own
/// layout/paint/event widget should need no framework dependency but this
/// crate. If something is reachable through neither this module nor the flat
/// facade, that is a bug — file it rather than reaching for `frust-core`
/// directly.
///
/// `use frust::authoring::*;` covers the widget-authoring vocabulary proper.
/// Two neighbouring surfaces are deliberately *not* duplicated here because
/// they are already reachable flat, and a real widget usually wants them too:
///
/// - [`frust::input`](crate::input) — gesture constants such as `TOUCH_SLOP`.
/// - The animation vocabulary — [`AnimationController`](crate::AnimationController),
/// [`Curve`](crate::Curve), [`FrameTime`](crate::FrameTime) and friends.
///
/// For anything the by-name lists below omit, reach for the whole-crate valves:
/// [`frust::kurbo`](crate::kurbo), [`frust::peniko`](crate::peniko),
/// [`frust::accesskit`](crate::accesskit).
///
/// Not feature-gated (unlike the design-system re-exports above): an app that
/// disables every catalog (`--no-default-features`) still needs this seam to
/// build its own design system, so it always resolves.
///
/// # The `EditingState` split
///
/// `frust_core::event::EditingState` (flat, right here in `authoring`) and
/// `frust_text::editor::EditingState` (nested in [`text`](authoring::text))
/// are **two genuinely distinct types** — the first is the retained
/// IME-surface payload an event-routing widget publishes/receives
/// (`ImeState`/`ImeEvent`), the second is `TextEditor`'s own byte-indexed
/// editing snapshot. A glob importing both into one scope will not compile
/// (`use frust::authoring::*; use frust::authoring::text::*;` collides on the
/// name); reach for the flat one for event/IME plumbing and
/// `authoring::text::EditingState` only alongside a `TextEditor` you're
/// driving yourself.
///
/// # Example: a one-child container widget
///
/// A container that offsets its single child, wired through the full
/// lifecycle — build, rebuild, teardown, layout, paint, event routing,
/// semantics forwarding — with **only** `frust` named. Ported from
/// `frust_widgets::authoring`'s own worked example (the toolkit this module
/// re-exports), which an app cannot reach directly without depending on
/// `frust-widgets` itself.
///
/// ```
/// use frust::authoring::*;
///
/// /// The declarative half: a child plus the offset to apply to it.
/// struct OffsetView<State: 'static> {
/// offset: Point,
/// child: AnyView<State>,
/// }
///
/// /// The view-fn app code calls; `any` erases the concrete child view.
/// fn offset<State: 'static, V: View<State>>(offset: Point, child: V) -> OffsetView<State> {
/// OffsetView { offset, child: any(child) }
/// }
///
/// /// The retained half: the live child pod plus the applied offset.
/// struct OffsetWidget {
/// offset: Point,
/// child: ChildPod,
/// }
///
/// impl<State: 'static> View<State> for OffsetView<State> {
/// type Element = OffsetWidget;
///
/// fn build(&self, ctx: &mut BuildCtx<'_>) -> OffsetWidget {
/// OffsetWidget { offset: self.offset, child: build_child(&self.child, ctx) }
/// }
///
/// fn rebuild(
/// &self,
/// prev: &Self,
/// element: &mut OffsetWidget,
/// ctx: &mut BuildCtx<'_>,
/// ) -> ChangeFlags {
/// let mut flags = ChangeFlags::NONE;
/// if prev.offset != self.offset {
/// element.offset = self.offset;
/// flags |= ChangeFlags::LAYOUT;
/// }
/// flags | rebuild_child(&prev.child, &self.child, &mut element.child, ctx)
/// }
///
/// fn teardown(&self, element: &mut OffsetWidget, ctx: &mut BuildCtx<'_>) {
/// teardown_child(&self.child, &mut element.child, ctx);
/// }
/// }
///
/// impl Widget for OffsetWidget {
/// fn layout(&mut self, ctx: &mut LayoutCtx, bc: &BoxConstraints) -> Size {
/// let size = self.child.layout_child(ctx, bc);
/// self.child.set_origin(self.offset);
/// bc.constrain(size)
/// }
///
/// fn paint(&mut self, ctx: &mut PaintCtx, scene: &mut dyn PaintScene) {
/// self.child.paint_child(ctx, scene);
/// }
///
/// fn event(&mut self, ctx: &mut EventCtx, event: &InputEvent) -> EventResult {
/// // Never re-hit-test a captured child by hand — this helper owns the
/// // capture/focus fast paths and the blur-on-outside-tap rule.
/// route_event_single(&mut self.child, ctx, event)
/// }
///
/// fn semantics(&self, ctx: &mut SemanticsCtx) {
/// // A transparent wrapper still MUST forward, or the child's whole
/// // subtree drops out of the accessibility tree.
/// self.child.semantics_child(ctx);
/// }
/// }
/// # fn main() {}
/// ```
/// The GPU substrate seam, behind the non-default `gpu` cargo feature: the
/// `frust-gpu` device/texture/pipeline vocabulary an app — or a future
/// 3D-rendering crate sitting beside the facade — needs to register an
/// externally owned GPU texture and draw it through
/// [`authoring::scene::SceneBuilder::scene_texture`], without a direct
/// `frust-render`/`frust-gpu` dependency of its own.
///
/// [`Context`] is `frust-gpu`'s `RenderContext` (the device/instance
/// foundation every shell already owns) under the name this seam exposes it
/// as. [`Texture`]/[`TextureDesc`]/[`RenderTarget`] describe a GPU texture
/// and where it can be rendered into; [`SceneTextureId`] is the
/// process-unique id [`Texture::as_scene_texture`] mints, and is the value a
/// [`authoring::scene::Command::SceneTexture`] resolves against — an id
/// nothing binds simply draws nothing, never an error (see
/// `scene_texture`'s own docs). [`CommandBuffer`], [`ShaderLibrary`], and
/// [`RenderPipelineDesc`] are the lower-level encode/pipeline vocabulary a
/// caller driving its own render pass beside the engine's needs.
///
/// This seam is deliberately narrow: nothing above RENDER depends on
/// `frust-gpu` today (`docs/ARCHITECTURE.md`'s GPU-substrate layer
/// boundary), and this feature-gated re-export is the one sanctioned
/// exception — an app opts in explicitly, and the facade's own default build
/// carries none of it.
///
/// A real [`Texture`] is built from a [`TextureDesc`] naming a
/// `wgpu::TextureFormat`/`wgpu::TextureUsages` pair directly — this crate
/// does not re-export `wgpu` itself (only the GPU-substrate *types* built on
/// it), so a caller filling in those two fields depends on `wgpu` in its own
/// right, exactly as any other code driving a render pass beside the engine
/// does. Once minted, [`Texture::as_scene_texture`]'s id composes with
/// [`authoring::scene::SceneBuilder::scene_texture`] with no GPU device in
/// the loop at all:
///
/// ```
/// use frust::authoring::Rect;
/// use frust::authoring::scene::{Command, Scene, SceneBuilder};
/// use frust::gpu::Texture;
///
/// // Checked at compile time over any texture/view pair a caller supplies —
/// // `Texture::as_scene_texture()`'s minted id composes with
/// // `SceneBuilder::scene_texture` with no live `Texture` needed to prove it.
/// fn draw_registered_texture<T, V>(texture: &Texture<T, V>, scene: &mut Scene, dest: Rect) {
/// let mut builder = SceneBuilder::new(scene);
/// builder.scene_texture(texture.as_scene_texture().get(), dest);
/// }
///
/// // The same recording behavior, exercised at runtime with the same opaque
/// // `u64` id a minted `SceneTextureId::get()` ultimately is.
/// let id = 42;
/// let dest = Rect::new(0.0, 0.0, 64.0, 64.0);
/// let mut scene = Scene::new();
/// SceneBuilder::new(&mut scene).scene_texture(id, dest);
///
/// match &scene.commands()[0] {
/// Command::SceneTexture { id: recorded, .. } => assert_eq!(*recorded, id),
/// other => panic!("expected SceneTexture, got {other:?}"),
/// }
/// ```
///
/// # Reaching the shell's own live device: [`with_context`]
///
/// Everything above builds a *standalone* [`Context`] — useful for a
/// headless harness, but a second device, not the one the running shell
/// already created and is presenting frames through. [`with_context`] reaches
/// that one instead: the shell's render executor installs its
/// [`DeviceHandle`] (the device/queue/adapter pair, cheap to clone since
/// wgpu's own types are `Arc`-backed) into a process-wide slot the first time
/// a surface — and so a device — comes up
/// (`frust_shell_common::gpu::install_gpu_handle`, see that module's docs),
/// and [`with_context`] reads it back through the identical seam
/// (`frust_shell_common::gpu::gpu_handle`). It answers `None` before that
/// first surface exists (desktop's zero-config preview window, a mobile
/// shell before its first frame) — check the `Option`, never assume `Some`.
/// Never blocks: once installed, the read is a lock-free `OnceLock::get`, so
/// calling this from the UI thread is always safe.
///
/// Only the desktop shell installs one today; the two mobile shells forward
/// the `gpu` feature but do not install yet (an accepted gap — see
/// `frust-shell-android`/`frust-shell-ios`'s own crate docs), so
/// `with_context` always answers `None` there for now.
///
/// ```
/// // No device exists in this doctest process, so `with_context` answers
/// // `None` — exactly the state an app sees before its shell's first frame.
/// let adapter_name = frust::gpu::with_context(|handle| handle.caps.adapter_name.clone());
/// assert!(adapter_name.is_none());
/// ```
///
/// # Rendering your own texture every frame: [`ExternalPass`]
///
/// Everything above binds a texture whose *pixels* something else already
/// produced. A caller whose pixels are produced by GPU work of its own — a 3D
/// scene, a simulation, a video frame converted on the GPU — needs that work
/// recorded inside the frame that samples it, and needs it recorded every
/// frame. That is [`ExternalPass`]: implement it, register it under an id,
/// and the engine tier's renderer calls it once per frame with the frame's
/// own device, queue and `wgpu::CommandEncoder` ([`ExternalFrame`]) before
/// anything of the scene is recorded.
///
/// The four steps a widget owning such a texture takes:
///
/// 1. **Mint an id**, once, and keep it: [`SceneTextureId::mint`] when the
/// widget has no [`Texture`] to mint from (the usual case here — the pass
/// creates and re-creates its own target), or
/// [`Texture::as_scene_texture`] when it does. One id survives every
/// re-creation of the underlying texture, which is what lets the display
/// list keep naming the same thing across a resize.
/// 2. **Register a pass** under it with [`register_external_pass`], handing
/// over an `Arc<dyn ExternalPass>`. It answers `false` if that id already
/// has a pass, and changes nothing — a registration is a claim, never a
/// silent takeover.
/// 3. **Paint the id.** In `Widget::paint`, record
/// [`authoring::PaintScene::draw_scene_texture`] with
/// `id.get()` and the destination rectangle. The pass's binding and the
/// display list naming it meet inside one frame, so the ordering is
/// already right; an id whose pass has not bound anything yet simply draws
/// nothing that frame, never an error.
/// 4. **Unregister on teardown** with [`unregister_external_pass`] — in
/// `View::teardown` (a component's `ComponentWidget::teardown`) or
/// `on_cleanup` for reactive state, never a hand-rolled `Drop`
/// (`docs/CODE_STANDARDS.md`'s State & Reactivity rule: `Drop` order
/// across a component's state/element/owner triple is not a contract,
/// `on_cleanup`/`teardown` are). The next *drained* frame clears the
/// engine's binding for that id before it runs any pass, so no view is
/// kept alive for a texture whose owner is gone — though unregistering is
/// not itself a barrier: a drain already mid-flight when it runs may still
/// call this pass's `record` once more, and the unbind
/// lands only once a frame is actually drained, not while the surface is
/// idle.
///
/// A widget whose texture is *animating* asks for the next frame exactly as
/// any other animating widget does — `PaintCtx::request_frame` (or
/// `request_frame_paced` for a decorative loop). A pass is called once per
/// frame the app actually renders; it does not drive the frame loop, and
/// registering one does not by itself keep frames coming.
///
/// ```text
/// struct Starfield { target: Mutex<Option<wgpu::Texture>> }
///
/// impl frust::gpu::ExternalPass for Starfield {
/// fn record(&self, frame: &mut frust::gpu::ExternalFrame<'_>) {
/// let texture = self.ensure_target(frame.device()); // my own target
/// let view = texture.create_view(&Default::default());
/// {
/// let mut pass = frame.encoder().begin_render_pass(&/* … */);
/// // … draw into `view` …
/// } // pass ends here
/// frame.bind_texture((WIDTH, HEIGHT), view); // engine draws it, under this pass's own id
/// }
/// }
/// ```
///
/// Four rules that go with it:
///
/// - **A pass renders into its own target, never into the frame's.** The
/// engine clears the frame's colour attachment when it records the scene,
/// so pixels a pass wrote there are gone; what survives is what the scene
/// composites from a bound texture. A pass also never submits — the
/// renderer submits the whole frame, once, which is what puts the pass's
/// work ahead of the scene's in a single command buffer.
/// - **A pass never shares the frame's own depth attachment.** It records
/// only into attachments it owns, on a target it owns, sized however that
/// target needs to be — [`ExternalFrame`] hands out no depth view of its
/// own. `frust-gpu::encoder`'s two depth caller rules — the module
/// [`CommandBuffer`] comes from — are for a *host* sharing one depth buffer
/// across renderers of its own; they have nothing to do with a pass
/// registered here.
/// - **The result is always composited blended**, never treated as opaque:
/// the engine does not read the caller's texels, so it cannot know they are
/// (`docs/LIMITATIONS.md`'s `engine-scene-texture-always-blended`). Return
/// premultiplied colour, the convention every paint in an engine frame
/// travels in.
/// - **A pass's recorded work is submitted only if the frame is** — a
/// refused engine frame drops the encoder unsubmitted, and every command a
/// pass recorded into it goes with it — **but [`ExternalFrame::bind_texture`]
/// is not part of that encoder**; it writes the engine's registry directly,
/// inside `record`, so its side effect survives a refusal the recorded draw
/// commands do not. A pass whose target must never be sampled half-written
/// binds only once that target genuinely holds something, rather than
/// relying on the frame that was meant to fill it having been accepted.
///
/// The registry itself is shell-agnostic — a process-wide map with no device,
/// window or platform in it, registerable from anywhere at any time. The
/// gate is which frame path drains it: any engine-tier `SurfaceRenderer`
/// frame, `submit` and `submit_deferred` alike, which is what the Android and
/// iOS shells call exactly as desktop does — a registered pass is not
/// desktop-only by construction, unlike [`with_context`], which genuinely
/// does answer `None` on mobile today (no shell there has installed a
/// [`DeviceHandle`] yet). Only the desktop headless path has actually been
/// *exercised* so far (`docs/LIMITATIONS.md`'s
/// `facade-external-pass-desktop-only`) — mobile is wired and compiles the
/// seam, but no registered pass has been driven through either shell's own
/// frame loop yet.
///
/// A panic inside `record` is caught in a debug build: the pass is reported,
/// unregistered and unbound, and the frame is recorded without it. The
/// workspace's `release` profile is `panic = "abort"`, so that is a
/// development net rather than a shipped guarantee — a pass must not panic.
/// The accessibility vocabulary crate, whole — the long-tail valve behind
/// [`authoring`]'s by-name `Node`/`NodeId`/`Role`, for the rest of what a
/// semantics-contributing widget may need (`Action`, `Live`, `Toggled`, …).
/// Re-exported through `frust-core`, which owns the `accesskit` version pin
/// (see `docs/DEVELOPMENT.md` § Version-Pin Policy) — naming it here keeps an
/// app on that single pinned version rather than declaring its own.
pub use accesskit;
/// The geometry crate, whole, for types [`authoring`] does not lift by name
/// (e.g. `kurbo::Circle`) — the long-tail escape valve alongside the by-name
/// list above.
pub use kurbo;
/// The brush/color crate, whole, for types [`authoring`] does not lift by name
/// (e.g. `peniko::Blob`, `peniko::color::DynamicColor`) — the long-tail escape
/// valve alongside [`Color`]/the by-name list above.
pub use peniko;
/// Android back-press ⇄ navigator auto-wiring:
/// [`attach_back_handler`]/[`BackHandler`] pop a [`NavigatorController`] on a
/// platform back press and keep `frust-reactive`'s `handles_back` flag in
/// sync with the stack depth, so a shell knows whether a root-level back should
/// fall through to the platform (activity finish). Mirrors
/// [`RouterDeepLinks`]'s shape and, like it, is the ONLY place in the facade
/// that sees both `frust-widgets`' `NavigatorController` and
/// `frust-reactive`'s back-press source together — see [`BackHandler`]'s doc
/// for the consume/dedupe and timing contracts. Call [`BackHandler::track`]
/// from every `Component::build`.
pub use ;
/// Build a [`NavigatorView`] driven by `controller` — the facade's back-aware
/// wrapper over [`frust_widgets::navigator`].
///
/// Interposes on the flat widget re-export: same signature and return shape, but
/// every rebuild it *additionally* auto-wires Android/gesture back handling for
/// `controller` — so an app using `frust::navigator` gets the full back contract
/// (dismissable overlay dismiss → navigation pop → app exit at the root) with
/// **zero** back-specific app code, and with `frust::handles_back` reporting
/// whether a root-level press should fall through to the platform.
///
/// The wiring routes a consumed press through
/// [`NavigatorController::request_back`] (honoring each page's back policy —
/// pop / animated-dismiss / veto — rather than a bare pop) and computes
/// `handles_back` from the navigator's predictive-back interest. It shares a
/// single process-wide consumption source with any explicit [`BackHandler`] on
/// the same controller, so constructing a `BackHandler` *and* calling
/// `frust::navigator` (as `examples/huddle` does) still consumes each press
/// exactly once — no double-pop. See [`back_glue`]'s module docs for the
/// consume/dedupe and timing contracts.
///
/// ```no_run
/// use frust::{AnyView, Component, NavigatorController, any, navigator, text};
///
/// #[derive(Default)]
/// struct App;
///
/// struct AppState {
/// nav: NavigatorController<AppState>,
/// }
///
/// impl Component for App {
/// type State = AppState;
///
/// fn init(&self) -> AppState {
/// AppState { nav: NavigatorController::new() }
/// }
///
/// fn build(&self, state: &mut AppState) -> AnyView<AppState> {
/// // Back handling is automatic — no BackHandler needed.
/// any(navigator(&state.nav, || any(text("home"))))
/// }
/// }
///
/// frust::app!(App);
/// # fn main() {}
/// ```
///
/// Also sets the platform-aware edge-swipe default
/// ([`NavigatorView::platform_pop_swipe`]) to `cfg!(target_os = "ios")`: the
/// interactive pop-swipe is on by default on iOS and off on Android/desktop
/// (where the system/window-manager back gesture already exists), with no
/// app-side wiring. An app can still override it per navigator
/// ([`NavigatorView::pop_swipe`]) or per page
/// ([`frust_widgets::PushOptions::pop_swipe`]).
/// Build a **root overlay host** driven by `controller`, wrapping the app's
/// whole root view — the facade's back-aware wrapper over
/// [`frust_widgets::overlay_host`].
///
/// The host is a [`navigator`] whose root page is the entire app (chrome, tab
/// shell, inner navigator and all) and whose pushed pages are app-level modals,
/// with two defaults changed: no edge-swipe pop, and no host transition (each
/// overlay stages its own). Because it sits *above* every piece of chrome, an
/// overlay pushed here dims and blocks chrome that an overlay on an inner
/// navigator cannot reach — and the chrome goes inert to pointers *and* to
/// assistive technology for free, since the navigator routes input and forwards
/// accessibility nodes for the top page only.
///
/// Like [`navigator`], every rebuild additionally auto-wires back handling for
/// `controller` — here as a **host**, the rank that claims a press ahead of any
/// plain navigator (**R44-back**), whenever and however often either wires. A
/// host with no overlays open claims nothing, so back falls through to the inner
/// navigator exactly as before the host existed. See [`back_glue`]'s module docs
/// for the arbitration contract.
///
/// ```no_run
/// use frust::{
/// AnyView, Component, NavigatorController, Stack, any, navigator, overlay_host, text,
/// };
///
/// #[derive(Default)]
/// struct App;
///
/// struct AppState {
/// nav: NavigatorController<AppState>,
/// overlays: NavigatorController<AppState>,
/// }
///
/// impl Component for App {
/// type State = AppState;
///
/// fn init(&self) -> AppState {
/// AppState {
/// nav: NavigatorController::new(),
/// overlays: NavigatorController::new(),
/// }
/// }
///
/// fn build(&self, state: &mut AppState) -> AnyView<AppState> {
/// let nav = state.nav.clone();
/// // The former root view moves INSIDE the host's page builder — which
/// // is also what puts the inner navigator's wiring after the host's.
/// any(overlay_host(&state.overlays, move || {
/// any(Stack(vec![
/// any(navigator(&nav, || any(text("home")))),
/// any(text("persistent chrome")),
/// ]))
/// }))
/// }
/// }
///
/// frust::app!(App);
/// # fn main() {}
/// ```
///
/// Also sets the platform-aware edge-swipe default like [`navigator`] does,
/// though it never actually changes the host's own behaviour: `overlay_host`
/// pins an *explicit* [`NavigatorView::pop_swipe(false)`](NavigatorView::pop_swipe)
/// (an edge swipe must never dismiss an overlay), which outranks the platform
/// slot by construction.
/// Router ⇄ deep-link auto-wiring: [`router_with_deep_links`]/
/// [`RouterDeepLinks`] resolve a [`Router`]'s start location from the process's
/// cold-start deep link (falling back to an app-supplied default) and keep
/// navigating it on every subsequent warm link — see [`RouterDeepLinks`]'s doc
/// for the precedence and dedupe contracts. This is the ONLY place in the
/// facade that sees both `frust-widgets`' `Router` and `frust-reactive`'s
/// deep-link source together; neither underlying crate depends on the other.
pub use ;
/// The reactive route-state observable: [`RouteObserver`] is the signal
/// face over `frust_widgets`' signal-free `RouteStack`/[`NavChange`] — the
/// counterpart to [`RouteNavigator`] (*intent*, queued requests) that reads
/// *fact* (the last-published stack) instead. Construct once (typically in
/// `Component::init`) and attach with
/// [`observe`](RouteObserver::observe)`(navigator(...))`;
/// [`RouterDeepLinks::routes`] hands out the one it wired for a router-driven
/// navigator. See `route_state`'s module docs for why this bridge lives in
/// the facade rather than `frust-widgets`.
pub use RouteObserver;
/// The design-token vocabulary: the [`Theme`] bundle plus its
/// component token tables, flat-re-exported from `frust-theme` so app code
/// never names that crate directly. A root component reads the active theme via
/// [`use_context`]`::<`[`Theme`]`>()`; a widget reads it during paint/layout via
/// `PaintCtx::theme_as`/`LayoutCtx::theme_as` (or `Theme::from_paint_ctx`).
///
/// Includes the glass material tokens — this crate ships the opaque recipe,
/// and a design system authors its own translucent one over the same types:
///
/// ```
/// use frust::GlassScale;
///
/// let glass = GlassScale::opaque_material();
/// assert_eq!(glass.chrome.blur_radius_intent, 0.0);
/// assert!(glass.control.is_opaque());
/// ```
///
/// Also the composable-theming surface:
/// [`ThemeBuilder`] (`defineTheme`/`copyWith` analog), the no-lock-in typed
/// extension slot ([`ThemeExtensions`]) plus its first consumer
/// [`StatusPalette`]/[`StatusColors`] (success/warning/info), and the motion
/// vocabulary ([`MotionDurations`]/[`EasingSet`]) — all flat-re-exported so an
/// app (or a design-system plugin) authors a theme against `frust::*` alone.
pub use ;
/// The color type every [`ColorScheme`] role is expressed in
/// ([`peniko::Color`]), re-exported so app code can author its own color
/// values (e.g. a custom accent palette that composes onto a baseline
/// [`ColorScheme`]) without naming `peniko` directly — the same
/// facade-only-dependency rule the theme re-exports above follow. Construct
/// one with [`Color::from_rgb8`]/[`Color::new`]; read its channels via
/// `Color::components` (`[f32; 4]`, straight-alpha RGBA).
pub use Color;
/// App-facing theme override:
/// [`set_app_theme`] forces the app's active [`Theme`] end-to-end — both
/// delivery paths a shell owned exclusively before this (widget paint/layout
/// via `RenderRoot::set_theme`, and `use_context::<Theme>()` via
/// `provide_context`) — reflecting the change the next time the running shell
/// polls (once per frame; desktop before rebuild, mobile at the top of the
/// frame callback). [`clear_app_theme`] returns to the platform's own
/// light/dark-derived default. See `frust_shell_common::theme_override`'s
/// module docs for the full layering rationale, the thread contract (a plain
/// `Mutex`-guarded process-global — no UI-thread panic, unlike
/// [`push_deep_link`]), and the override-wins-over-appearance rule (an app
/// override, once set, is never overridden back by a live platform dark-mode
/// flip until [`clear_app_theme`] runs).
///
/// ```no_run
/// use frust::{Brightness, Theme, set_app_theme};
///
/// // Force one appearance end-to-end regardless of what the platform reports
/// // — e.g. an in-app light/dark toggle. Any `Theme` works here; a design
/// // system passes its own baseline instead of the neutral floor.
/// set_app_theme(Theme::neutral().with_brightness(Brightness::Dark));
/// ```
pub use ;
/// Design-system-facing base-theme seed:
/// [`set_default_theme`] supplies the *starting* theme a shell seeds itself
/// with, in place of its own built-in fallback — the seam a design-system
/// plugin's `install()` calls. Unlike [`set_app_theme`], this does NOT pin
/// brightness: the shell keeps re-deriving light/dark from the platform's own
/// appearance against this same base, so a design-system-themed app installed
/// this way still honours system dark mode. See
/// `frust_shell_common::theme_default`'s module docs for the full precedence
/// order ([`set_app_theme`] override → [`set_default_theme`] base → the
/// shell's built-in fallback) and the brightness-following contrast with
/// [`set_app_theme`] spelled out in full.
///
/// ```no_run
/// use frust::{Color, Theme, set_default_theme};
///
/// // A design-system plugin's install() call, seeding its own base theme as
/// // the app's starting point without pinning brightness. A real installer
/// // hands over its whole token set; this one edits a single role off the
/// // neutral floor to keep the example dependency-free.
/// let base = Theme::builder(Theme::neutral())
/// .map_colors_light(|mut c| {
/// c.primary = Color::from_rgb8(0x6B, 0x4E, 0xFF);
/// c
/// })
/// .build();
/// set_default_theme(base);
/// ```
pub use set_default_theme;
/// App-facing system-UI (system-bar) override:
/// [`set_system_ui_mode`] requests a status-/navigation-bar visibility mode —
/// the Flutter `SystemChrome.setEnabledSystemUIMode` analog — reaching
/// whichever shell is running the next time it polls (once per frame,
/// mirroring [`set_app_theme`]'s delivery timing). See
/// `frust_shell_common::system_ui`'s module docs for the full layering
/// rationale, the thread contract (a plain `Mutex`-guarded process-global,
/// callable from any thread), the FFI wire format each mobile shell exports, and
/// where Android/iOS diverge from the five-mode vocabulary.
///
/// ```no_run
/// use frust::{SystemUiMode, set_system_ui_mode};
///
/// // Hide all system bars; an edge swipe re-shows them.
/// set_system_ui_mode(SystemUiMode::Immersive);
/// ```
pub use ;
/// App-facing pending-font registry:
/// [`register_app_fonts`] pushes raw font bytes (TTF/OTF, or a TTC/OTC
/// collection) to be registered into the running shell's `TextContext` the
/// next time it drains this registry (construction time, and once per
/// frame -- each shell's own wiring). See
/// `frust_shell_common::font_registry`'s module docs for the full layering
/// rationale and thread contract (mirrors [`set_app_theme`]'s: a plain
/// `Mutex`-guarded process-global, callable from any thread).
///
/// ```no_run
/// // Push bundled font bytes (e.g. loaded via `include_bytes!` at the app
/// // crate's own build) before or after the app starts running; the shell
/// // picks them up on its next drain.
/// let font_bytes: Vec<u8> = vec![];
/// frust::register_app_fonts(font_bytes);
/// ```
pub use register_app_fonts;
// No app-facing translucent-surface opt-in lives here: Mode B is a
// build-time HOST configuration selected by the
// generated template's `FRUST_TRANSLUCENT_SURFACE`/`translucentSurface`
// constant, never a runtime Rust call — see [`platform_view`]'s Mode B
// section above. `frust_shell_common::declare_host_translucent_surface`
// exists only for the generated host glue (Android's `nativeSetSurfaceMode`,
// iOS's `frust_set_surface_mode`) to call from the same branch that already
// configured the native window translucent, and is deliberately not
// re-exported past that crate.
/// App-facing **resolved** surface mode — the
/// read-only outward half of the Mode B seam whose setter is deliberately
/// absent (see the comment above): what the platform actually gave this
/// process, not what the host asked for.
///
/// [`resolved_surface_mode`] answers [`ResolvedSurfaceMode::Unknown`] until a
/// shell publishes (no surface yet, or the desktop preview, which has no Mode
/// B host seam), then `Opaque`/`Translucent` — or
/// [`ResolvedSurfaceMode::RefusedTranslucent`], the case this exists for: the
/// host declared Mode B and the platform resolved the surface opaque anyway
/// (no matching `CompositeAlphaMode`; see `docs/NATIVE_WIDGETS_ARCHITECTURE.md`'s
/// Mode-B paragraph). frust's paint side degrades to
/// the Mode A contract on its own, but the host's native-sibling z-order was
/// fixed at build time, so a sibling arranged *behind* the surface is
/// invisible **and untappable**. Branch on
/// [`ResolvedSurfaceMode::translucency_refused`] to render a deliberate
/// fallback instead of a dead rect.
///
/// **This is a poll, not a subscription** — the same contract as
/// [`set_app_theme`]'s slot: reading it subscribes to nothing and a change
/// never wakes a frame by itself. Read it during a rebuild (or paint/an event
/// handler) on the UI thread, exactly where you'd read any other
/// process-global shell state, and if the answer must change your UI's shape,
/// write it into your own state so the normal dirty path runs.
///
/// ```no_run
/// use frust::{ResolvedSurfaceMode, resolved_surface_mode};
///
/// // A native-widget slot deciding whether its platform sibling can actually
/// // be seen this frame.
/// let native_sibling_visible = match resolved_surface_mode() {
/// ResolvedSurfaceMode::RefusedTranslucent => false,
/// ResolvedSurfaceMode::Unknown
/// | ResolvedSurfaceMode::Opaque
/// | ResolvedSurfaceMode::Translucent => true,
/// };
/// ```
pub use ;
/// The animation vocabulary: the shell-fed frame clock ([`FrameTime`])
/// plus the pure easing/interpolation/spring math a widget or app advances it
/// through, flat-re-exported from `frust-core::anim`. Time enters from the
/// shell during paint (`PaintCtx::frame_time`); nothing here reads a clock.
pub use ;
/// The window's shape, flat-re-exported from `frust-core::app` so app code
/// (not just widget authors, see [`authoring::WindowMetrics`]) can recover it
/// via `use_context::<`[`WindowMetrics`]`>()` inside `Component::build` — a
/// component laying itself out around window size/scale/orientation reads
/// this the same way it reads a [`Theme`] via `use_context`. Delivered as a
/// plain value (not an `RwSignal`); see [`WindowMetrics`]'s own doc for the
/// derived-[`Orientation`] and rebuild-cost notes.
pub use ;
/// The pointer-cursor vocabulary, flat-re-exported from `frust-core::event` (and
/// also available through [`authoring::CursorIcon`]).
///
/// A widget asks for a shape from its own pointer handling —
/// `ctx.set_cursor(CursorIcon::Pointer)` — and the desktop shell applies whatever
/// the pass resolved; the request is per-pass and stateless, so a widget that
/// stops asking falls back to [`CursorIcon::Default`] with nothing to clear. Lifted
/// flat rather than left inside [`authoring`] because a design-system plugin's
/// public builder API can *name* a cursor (a `Button::cursor(..)` override, a
/// disabled control asking for [`CursorIcon::NotAllowed`]) without being a widget
/// author itself. `#[non_exhaustive]`: match with a wildcard arm.
///
/// Honoured on desktop only — the mobile shells never read the resolved value, so
/// setting a cursor unconditionally is safe on every platform.
pub use CursorIcon;
/// Pure input/gesture helpers (slop constants, [`input::VelocityTracker`], the
/// fling-decay math) re-exported for app authors and advanced widgets.
/// The reactive-programming vocabulary [`Component`] state is built
/// on: signals, memos, and context, flat-re-exported from `frust-reactive`/
/// `reactive_graph` so app authors never name either crate directly.
pub use ;
/// The deep-link read surface (`frust-reactive`'s `app_links`-
/// style process-wide source — see its module docs for the semantics): a
/// mobile shell delivers a platform link via `frust-reactive`'s
/// [`push_deep_link`], and app code reads it here —
/// [`deep_links()`] returns a [`DeepLinks`] snapshot ([`DeepLinks::initial`])
/// plus the live, trackable [`DeepLinks::latest`] signal a
/// [`Component::build`] reads to react to cold-start and subsequent links
/// uniformly. Router auto-wiring (resolving `deep_links()` against a
/// [`Router`]) is a separate opt-in, not automatic here.
///
/// ```no_run
/// use frust::{AnyView, Route, Router, any, deep_links, text};
///
/// struct AppState;
///
/// struct NavDemo;
///
/// fn build_router() -> Router<AppState> {
/// Router::new(vec![Route::new("/", |_params| -> AnyView<AppState> {
/// any(text("home"))
/// })])
/// }
///
/// impl frust::Component for NavDemo {
/// type State = AppState;
///
/// fn init(&self) -> AppState {
/// AppState
/// }
///
/// fn build(&self, _state: &mut AppState) -> AnyView<AppState> {
/// let _router = build_router();
/// // A late-subscribed read: `initial` sees a cold-start link (if any);
/// // `latest` is the live signal a rebuild tracks for warm links.
/// let links = deep_links();
/// let _ = links.initial;
/// let _ = links.latest;
/// any(text("nav demo"))
/// }
/// }
/// # let _ = NavDemo;
/// ```
/// [`push_deep_link`] is normally called by a mobile shell's platform-link
/// handler; it is also re-exported here as the desktop dev seam
/// (no shell writes on desktop yet) — `examples/navdemo`'s
/// "simulate deep link" button calls it directly to demonstrate warm-link
/// navigation without a real platform link.
pub use ;
/// The Android back-press source (`frust-reactive`'s
/// process-wide back source — see its `back` module docs). A mobile shell
/// delivers a hardware/gesture back press via [`push_back_press`], and the
/// facade's [`BackHandler`] reads it via [`back_presses`] to pop a navigator;
/// [`set_handles_back`]/[`handles_back`] are the "framework consumes the next
/// back" flag a shell polls to decide whether a root-level back falls through
/// to the platform. App code normally uses [`attach_back_handler`] rather than
/// these directly; [`push_back_press`] is also the desktop dev seam (no shell
/// writes on desktop yet).
pub use ;
/// The **menu-activation** read surface (`frust-reactive`'s process-wide menu
/// source — see its module docs): a per-OS desktop shell drains its native menu
/// queue once per frame and reports each activation, and app code observes it
/// here. [`menu_events()`] returns the live [`MenuEvents`] handle whose `latest`
/// signal carries a [`MenuEvent`] — the activated item's `id` exactly as the
/// app wrote it in its [`MenuSpec`], plus a monotonic `sequence` so choosing
/// the same item twice reads as two activations rather than one stale value.
///
/// ```no_run
/// use frust::{AnyView, Component, Get, any, menu_events, text};
///
/// #[derive(Default)]
/// struct MenuDemo;
///
/// impl Component for MenuDemo {
/// type State = ();
///
/// fn init(&self) -> Self::State {}
///
/// fn build(&self, _state: &mut Self::State) -> AnyView<Self::State> {
/// // A tracked read: this rebuild re-runs when an item is activated.
/// let label = match menu_events().latest.get() {
/// Some(event) => format!("chose {}", event.id),
/// None => "nothing chosen yet".to_string(),
/// };
/// any(text(label))
/// }
/// }
/// ```
///
/// Available on **every** target, unlike the [`MenuSpec`] vocabulary that
/// describes the menu itself: a component reading menu events compiles on
/// Android/iOS too (where nothing ever pushes one), so shared component code
/// needs no `cfg` of its own.
///
/// Unlike [`push_deep_link`], the *push* side is deliberately **not**
/// re-exported: a menu activation has exactly one producer — the per-OS shell
/// that owns the platform menu — and nothing in an app simulates one the way
/// `examples/navdemo` simulates a warm deep link.
pub use ;
pub use Memo;
pub use ;
// The access traits the signal types' methods are defined through — without
// these in scope, `sig.get()`/`sig.set(..)`/`sig.update(..)` do not compile,
// so a facade-only consumer could name the types but never use them.
pub use ;
/// Spawns a `Send` future on the background reactive runtime (Tokio-backed —
/// see `frust_reactive::ReactiveRuntime`). A thin wrapper over
/// `any_spawner::Executor::spawn`; app authors never name `any_spawner`.
/// Spawns a `!Send` future on the UI-thread local task queue, drained each
/// frame by the shell (`ReactiveRuntime::pump_local`). A thin wrapper over
/// `any_spawner::Executor::spawn_local`; must be called on the UI thread —
/// see `frust_reactive::ReactiveRuntime::pump_local`'s doc for the panic
/// this triggers off-thread.
/// The heavy-work idiom: [`AsyncValue`] state,
/// [`use_task`] (the blessed load/compute helper), [`UseTask`] handle, and
/// [`spawn_blocking`] (the CPU-bound entry point) — Frust's counterpart to
/// Flutter's `compute()`/`FutureBuilder`, with explicit cancellation on
/// component teardown. `spawn_blocking` joins the existing
/// [`spawn`]/[`spawn_local`] routing pair (async IO / UI-thread `!Send` /
/// one-off CPU work). App crates need no new dependency: this is the whole
/// heavy-work surface. See `frust_reactive::task` for the threading contract.
pub use ;
/// Off-thread image decode: [`decode_image_async`] wraps
/// the existing synchronous `ImageSource::decode` in `spawn_blocking`, so it
/// composes with [`use_task`] for the full load/error/ready idiom without
/// ever blocking the UI thread on a decode. See `image_async`'s module docs
/// for why this lives in the facade rather than `frust-widgets` (which stays
/// reactive-free by charter) and for the Arc-move contract the decoded
/// [`ImageSource`] crosses threads under.
pub use ;
// Re-export the Android JNI-bridge macro so generated apps write
// `frust::android_app!(AppState, build)`. `pub use` of a
// `#[macro_export]` macro re-exports it on edition 2021+; the macro only expands
// to real code where its call site is `#[cfg(target_os = "android")]`, so this is
// inert on desktop.
pub use android_app;
// Re-export the iOS C-ABI-bridge macro so generated apps write
// `frust::ios_app!(AppState, build)`. Unlike `android_app!`,
// the invocation is unconditional — the macro's generated `frust_*` exports
// are each `#[cfg(target_os = "ios")]`, so it is inert off-iOS.
pub use ios_app;
// Hidden, wasm32-only re-export of the `wasm-bindgen` crate.
// [`web_app!`]'s generated `#[wasm_bindgen(start)]` shim references the
// attribute through `$crate::__wasm_bindgen::prelude::wasm_bindgen` rather
// than a bare `wasm_bindgen::prelude::wasm_bindgen`, so a generated app never
// needs `wasm-bindgen` in its own `Cargo.toml` — the same reason
// `frust-shell-android`'s `android_app!` routes its JNI types through that
// crate's own `__jni` re-export instead of naming `jni` directly (see that
// crate's `lib.rs`).
pub use wasm_bindgen as __wasm_bindgen;
// Hidden, wasm32-only re-export of the browser shell crate, for the identical
// reason as `__wasm_bindgen` above. [`web_app!`]'s generated shim hands the
// initialized state and build closure to `__frust_shell_web::run_app`
// (`fn run_app<State: 'static, Build, V>(state: State, build: Build)`,
// mirroring `frust_shell_desktop::run_desktop_with`'s `(state, build, ..)`
// convention), the browser shell's entry point: it wraps `spawn_app`, which
// owns the canvas-bound event loop and the `requestAnimationFrame` frame
// pipeline, and reports an event-loop construction failure through the `log`
// facade because the `wasm_bindgen(start)` shim has nowhere to return one to.
// The reference lives inside a `macro_rules!` body, so it is type-checked
// only where a caller invokes [`web_app!`]/[`app!`] for a wasm32 target —
// `cargo check --target wasm32-unknown-unknown -p frust-ui --tests` covers it.
pub use frust_shell_web as __frust_shell_web;
/// Browser panic hook + console log sink, installed once at the top of
/// [`web_app!`]'s generated start shim — the wasm32 counterpart of the
/// bring-up boilerplate a desktop binary gets for free from a terminal.
/// Without the panic hook a Rust panic reaches the browser console as a bare
/// `unreachable` trap with no message; without the log sink, `log::warn!`
/// and friends (including `frust-render`/`frust-gpu`/`wgpu`'s own records)
/// go nowhere, since stderr is a silent no-op in a browser. Mirrors the
/// proven shape in the browser render probe (`examples/web-spike/src/main.rs`'s
/// `mod web::start`), at `Warn` rather than that probe's `Debug`/`Info` — a
/// shipped app's default should not carry wgpu's naga typifier chatter.
///
/// `#[doc(hidden)]` and free-standing (not inside the macro body): this
/// function only calls real, already-present dependencies
/// (`console_error_panic_hook`, `console_log`, `log`), so it is safe to keep
/// as ordinary always-compiled code rather than deferring it into
/// `web_app!`'s uninstantiated macro text the way [`__frust_shell_web`]'s
/// `run_app` reference must be.
/// Brings up the process-wide [`frust_reactive::ReactiveRuntime`] (the w0-04
/// wasm arm — `ReactiveRuntime::init`'s `#[cfg(target_family = "wasm")]` arm
/// calls `Executor::init_wasm_bindgen()` explicitly, since no automatic wasm
/// executor default exists; see `frust_reactive::runtime`'s module docs) and
/// runs `state_init` under its root [`frust_reactive::Owner`], exactly the
/// [`run_with_setup_and_config`] shape every other platform's entry uses —
/// so a signal or context `state_init` creates already has a runtime and an
/// owner to be created under.
///
/// Real, already-present dependencies only (`frust-reactive`), so — like
/// [`__web_bootstrap`] — this stays ordinary always-compiled code rather than
/// living inside [`web_app!`]'s macro text.
/// Install the baseline framework-drawn selection-toolbar view
/// ([`frust_widgets::selection_toolbar`]) as the process's default
/// [`SelectionToolbarBuilder`](frust_core::SelectionToolbarBuilder), **set-if-
/// unset** (`frust_core::install_selection_toolbar_builder_if_unset`) — so a
/// design system that already installed its own keeps it, whether that
/// install happened earlier in `main` (before `frust::app!`/`frust::run`
/// ran at all) or inside an `app!` `setup = { .. }` block.
///
/// Called once, on the UI thread, at the same point on every platform this
/// crate starts an app from — after any `setup = { .. }` block and
/// immediately before the root [`Component::init`] (Android/iOS/wasm32, from
/// inside [`app!`]'s `@emit_mobile` closures) or before the desktop shell is
/// constructed ([`run_desktop_configured`], which every desktop entry point —
/// [`App::run`], [`run`], [`run_with_setup`], [`run_desktop_config`],
/// [`run_with_setup_and_config`] and `app!`'s desktop arm — funnels through).
/// Running it *after* setup, not before, is deliberate: a design system's own
/// cooperative install (also `install_selection_toolbar_builder_if_unset`,
/// called from inside a `setup = { .. }` block) must get first claim on the
/// empty slot, or this baseline would win the race and leave the design
/// system's own catalog toolbar never installed.
///
/// `#[doc(hidden)]`, not part of the public API: reached only through
/// `$crate::` from [`app!`]'s macro expansion and this crate's own desktop
/// entry points, exactly like [`__web_bootstrap`]/[`__web_init_state`].
/// The browser counterpart of [`android_app!`]/[`ios_app!`]: binds a
/// [`Component`]'s state and build closure to the browser shell's wasm-bindgen
/// entry point. Takes the identical two-argument (state type + build
/// expression, state built via `Default`) / three-argument (state type +
/// explicit state-init expression + build expression) shape
/// `android_app!` does, and `app!` drives it through the three-argument form
/// exactly the way it drives `android_app!`/`ios_app!` (see `@emit_mobile`
/// below) — most apps reach this through `app!`/`web_app!` rather than
/// hand-writing the explicit `state_init` form.
///
/// Expands to two `#[cfg(target_arch = "wasm32")]` functions — so, like
/// [`ios_app!`], the invocation itself is unconditional and self-gating:
/// calling `web_app!` off wasm32 expands to nothing. `__frust_web_start` is
/// `#[wasm_bindgen(start)]` — wasm-bindgen's own module-init entry point, run
/// once when the browser instantiates the compiled `.wasm` — and its body is
/// a single call into `__frust_web_run`, kept deliberately separate: feeding
/// `wasm_bindgen`'s attribute macro a body built straight out of
/// `$state_init`/`$build` (closures that can carry a macro-substituted
/// `$($setup)?` block nested inside another closure — see `app!`'s
/// `@emit_mobile` arm) trips its own re-parse of the function into a spurious
/// syntax error on that nested-block shape; a plain, macro-fragment-free call
/// is all it ever sees. `__frust_web_run` carries the real work, in order:
///
/// 1. [`__web_bootstrap`]: installs the panic hook and console log sink.
/// 2. [`__web_init_state`]: brings up the [`frust_reactive::ReactiveRuntime`]
/// and runs `$state_init` under its root owner — the point at which a
/// `setup = { .. }` block bundled into `$state_init` by `app!` (see
/// `@emit_mobile`) runs, identically ordered to every other platform.
/// 3. Hands the initialized state and `$build` to
/// `frust_shell_web::run_app` (via the hidden [`__frust_shell_web`]
/// re-export) — the browser shell's own entry point, which owns the
/// canvas-bound event loop and the `requestAnimationFrame` frame pipeline
/// (see [`__frust_shell_web`]'s doc comment for the contract).
/// The desktop app's identity and native-integration vocabulary, re-exported
/// from the desktop core so app code never names a shell crate:
/// [`DesktopConfig`] (the whole declaration — app name, reverse-DNS id, window
/// icon, menu bar, last-window-close policy — handed to [`App::desktop`],
/// [`run_desktop_config`] or [`app!`]'s `desktop = { .. }` argument),
/// [`MenuSpec`]/[`MenuItemSpec`]/[`MenuRole`] (the platform-independent native
/// menu tree a per-OS shell translates into an NSApp menu bar or an `HMENU`),
/// [`DesktopIconData`] (decoded, tightly-packed RGBA8 — decoding a
/// PNG/ICO/ICNS is the caller's job), and [`DEFAULT_APP_NAME`] (the window
/// title a config that names nothing still gets).
///
/// `frust-shell-desktop`'s `IconData` is re-exported **renamed**: the facade
/// already carries `frust-widgets`' [`IconData`], an in-UI vector icon, and the
/// two are unrelated (one is a `BezPath` a widget paints, the other is the
/// window/taskbar bitmap the OS shows). The `Desktop` prefix matches
/// [`DesktopConfig`], whose `with_window_icon` is its only consumer.
///
/// ```no_run
/// use frust::{DesktopConfig, MenuItemSpec, MenuRole, MenuSpec};
///
/// let file = MenuSpec::new()
/// .with_item(MenuItemSpec::item("file.open", "Open…").with_accelerator("CmdOrCtrl+O"))
/// .with_item(MenuItemSpec::separator())
/// .with_item(MenuItemSpec::role(MenuRole::Quit));
///
/// let config = DesktopConfig::new()
/// .with_app_name("Huddle")
/// .with_app_id("dev.frust.huddle")
/// .with_menu_spec(MenuSpec::new().with_item(MenuItemSpec::submenu("File", file)));
/// # let _ = config;
/// ```
///
/// **Desktop-only**, unlike the [`menu_events`] read side: these types are
/// defined in `frust-shell-desktop`, which is not in a mobile build's or a
/// wasm32 build's dependency graph at all (see this crate's `Cargo.toml`).
/// Code shared with a mobile or wasm32 target keeps a `DesktopConfig` behind
/// its own
/// `#[cfg(not(any(target_os = "android", target_os = "ios", target_arch = "wasm32")))]`
/// — or, more simply, writes it inline in [`app!`]'s `desktop = { .. }`
/// argument, which the macro already emits only on the targets that have it.
pub use ;
/// A Frust application: the app state plus the `build` closure that maps it
/// to a view tree.
///
/// This is the low-level primitive. [`app!`] and [`run`] expand into
/// `App::new(state, move |state| root.build(state))` (see
/// [`run_with_setup_and_config`]); ordinary apps write a [`Component`] and
/// start it with those instead of constructing an `App` by hand.
///
/// Construct with [`App::new`] and start the event loop with [`App::run`],
/// optionally naming a desktop identity with [`App::desktop`] in between.
///
/// The view type is intentionally *not* a parameter of this struct: capturing a
/// build fn's `impl View<State>` opaque return type into a stored type
/// parameter defeats method resolution (the opaque type's trait bounds can't
/// be re-proven on the already-typed value). Instead [`App::run`] infers the
/// view type freshly at the call site, so `App::new(state, build).run()`
/// compiles for both `impl View` and concrete-typed `build`.
// On a mobile target the fields are consumed only by the desktop-gated `run`,
// so they read as dead there; the app is driven through `android_app!`/JNI or
// `ios_app!`/C-ABI instead.
/// Start the shared desktop core with this target's native shell attached.
///
/// The extension is built *before* the config moves into the core: every per-OS
/// constructor takes `&DesktopConfig` and clones out the fields it acts on
/// (`app_id`, `window_icon`, `menu_spec`, the close policy), while the core
/// itself takes ownership to title the window.
///
/// This is the single desktop choke point every desktop entry funnels
/// through — [`App::run`] directly, and [`run`]/[`run_with_setup`]/
/// [`run_desktop_config`]/[`run_with_setup_and_config`]/`app!`'s desktop arm
/// indirectly, via `App::new(..).desktop(config).run()` — which is why
/// [`__install_default_selection_toolbar`] sits here rather than duplicated
/// across each of those: whatever path an app took to get here, any `setup`
/// it ran (and any explicit override that ran even earlier, in `main`) has
/// already had its chance to claim the selection-toolbar builder slot before
/// this call, and this is the one point strictly before the shell — and
/// therefore the first frame — starts.
/// The per-OS shell selection: one arm per shell crate this crate's manifest
/// gates in, under the identical `cfg` the dependency itself carries.
///
/// This function is the whole of the facade's platform knowledge on desktop —
/// nothing else here names a per-OS shell crate.
+ use<>
/// See the macOS arm above.
+ use<>
/// See the macOS arm above.
+ use<>
/// The fallback arm: a desktop target with no per-OS shell crate of its own (a
/// BSD, say) runs the shared winit core with the whole-set no-op extension —
/// window, input, theme and accessibility all work, and only the native
/// identity/menu integration is absent. `config` is still threaded through, so
/// such a host keeps its window title.
+ use<>
/// Run a root [`Component`] in the desktop preview shell until the window
/// closes — the canonical `runApp` equivalent for the Component model.
///
/// `root.init()` seeds the component's retained `State` once; the resulting
/// `AnyView<C::State>` is then driven through the same desktop preview loop
/// [`App::run`] uses, rebuilding from `root.build(state)` every frame.
///
/// Initializes the process-wide [`frust_reactive::ReactiveRuntime`] with a
/// no-op waker *before* `root.init()` runs, since a signal or context created
/// there must already have a runtime to be created under — the desktop
/// preview loop's own later `ReactiveRuntime::init` call swaps in the real
/// proxy waker on top of this seed, the documented swap-on-reinit behavior.
///
/// `root.init()` runs under the runtime's root [`Owner`] (via
/// [`with_owner`](frust_reactive::ReactiveRuntime::with_owner)): `init`
/// unblocks signal/executor creation, but `provide_context`/`on_cleanup` are
/// no-ops unless an `Owner` is ambient, and a root component has no enclosing
/// component to supply one — so the root component registers against the root
/// owner (process lifetime, never disposed). The desktop loop separately wraps
/// each per-frame rebuild in the same owner.
///
/// Desktop-only, matching [`App::run`]: on Android the app is driven by
/// [`android_app!`]/JNI and on iOS by [`ios_app!`]'s C-ABI entry points
/// instead, not by this loop.
///
/// Zero-config: the window is [`DesktopConfig::default()`]'s. Name the app, its
/// icon or its menu bar with [`run_desktop_config`] (or [`app!`]'s
/// `desktop = { .. }` argument) instead.
/// [`run`] with a **setup** closure run once, immediately before
/// `root.init()` — the desktop half of [`app!`]'s `setup = { .. }` block.
///
/// `setup` runs on this (the UI) thread, after
/// [`frust_reactive::ReactiveRuntime::init`] and under the runtime's root
/// [`Owner`], and therefore *before* the desktop shell is constructed — which
/// is the one moment the shell reads [`set_default_theme`]'s slot and drains
/// [`register_app_fonts`]' registry. That is exactly the placement `app!`'s
/// Android/iOS arms get for free (both run the block inside the state factory
/// `create_handle`/`ffi_glue::init` calls before building their `AppHandle`),
/// so the ordering contract is identical on all three platforms.
///
/// A design-system plugin's installer (`frust_glyph::install`, or any other
/// design system's equivalent) is the intended payload; app code normally
/// reaches this through [`app!`] rather than calling it directly.
///
/// Desktop-only, matching [`run`]/[`App::run`].
/// [`run`] with the app's desktop identity ([`DesktopConfig`]) — the
/// no-setup half of the config-carrying pair, and the function
/// [`app!`]'s `desktop = { .. }` argument routes through when no
/// `setup = { .. }` block accompanies it.
///
/// ```no_run
/// # use frust::{AnyView, Component, any, text};
/// # #[derive(Default)]
/// # struct MyApp;
/// # impl Component for MyApp {
/// # type State = ();
/// # fn init(&self) -> Self::State {}
/// # fn build(&self, _state: &mut Self::State) -> AnyView<Self::State> { any(text("hi")) }
/// # }
/// frust::run_desktop_config(
/// MyApp,
/// frust::DesktopConfig::new()
/// .with_app_name("Huddle")
/// .with_app_id("dev.frust.huddle"),
/// )
/// .unwrap();
/// ```
///
/// Desktop-only, matching [`run`]/[`App::run`].
/// [`run_with_setup`] and [`run_desktop_config`] at once: the single desktop
/// entry point the other three delegate to, differing only in which of `setup`
/// and `config` they default.
///
/// `setup` keeps the ordering contract [`run_with_setup`] documents; `config`
/// reaches the shared desktop core and this target's native shell together (see
/// [`App::desktop`]).
///
/// Desktop-only, matching [`run`]/[`App::run`].
/// The canonical app entry point: one line binds a root
/// [`Component`] to all three platforms.
///
/// ```no_run
/// use frust::{AnyView, Component, any, text};
///
/// #[derive(Default)]
/// struct App;
///
/// impl Component for App {
/// type State = i32;
///
/// fn init(&self) -> i32 {
/// 0
/// }
///
/// fn build(&self, state: &mut i32) -> AnyView<i32> {
/// any(text(format!("count: {state}")).size(32.0))
/// }
/// }
///
/// frust::app!(App);
/// # fn main() {}
/// ```
///
/// Expands to:
/// - **Android**: `#[cfg(target_os = "android")] frust::android_app!(...)`
/// bound to `Root::State`/`Root::build`, mirroring [`android_app!`]'s own
/// not-self-gating contract (its generated symbols only compile where the
/// Android FFI glue they call into exists).
/// - **iOS**: `frust::ios_app!(...)`, invoked unconditionally — like a
/// direct `ios_app!` call, it self-gates: every symbol it emits is itself
/// `#[cfg(target_os = "ios")]`, so the invocation expands to nothing
/// off-iOS. Plus a `#[cfg(target_os = "ios")] __frust_main` **stub**: the
/// generated `main.rs` calls `__frust_main()` under
/// `#[cfg(not(target_os = "android"))]`, and Xcode builds that bin target,
/// so the symbol must exist on iOS even though no desktop shell does. The
/// stub explains itself on stderr and exits non-zero rather than silently
/// doing nothing — a real iOS app is launched by its Xcode host through the
/// C-ABI entry points above, never by running this binary.
/// - **Every other target** (desktop): a hidden
/// `#[doc(hidden)] pub fn __frust_main()` that runs `Root` through
/// [`run`] (or, with a `desktop = { .. }` argument,
/// [`run_with_setup_and_config`]), printing the error and exiting non-zero
/// on failure. `app!`
/// never emits a `fn main` itself — a generated project splits `lib.rs`
/// (where `app!` is called) from `main.rs` (a one-line `fn main() {
/// <crate>::__frust_main() }`, scaffolded by `frust create` and never
/// hand-edited), since only the binary crate may define `main`.
///
/// `Root` must implement `Component + Default`: the macro constructs a `Root`
/// twice with no arguments (once to build each platform's state factory,
/// once to close over `build`) — a root component is stateless configuration
/// (any real data lives in its `Component::State`), so two independent,
/// short-lived instances are inexpensive and behaviorally identical.
///
/// # `setup = { .. }`: run code before the shell exists
///
/// An optional second argument is a **setup block** the macro emits at the top
/// of each platform's entry, before the shell is constructed:
///
/// ```no_run
/// # use frust::{AnyView, Component, any, text};
/// # #[derive(Default)]
/// # struct MyApp;
/// # impl Component for MyApp {
/// # type State = ();
/// # fn init(&self) -> Self::State {}
/// # fn build(&self, _state: &mut Self::State) -> AnyView<Self::State> { any(text("hi")) }
/// # }
/// frust::app!(MyApp, setup = { my_design_system::install(); });
/// # mod my_design_system {
/// # pub fn install() { frust::set_default_theme(frust::Theme::neutral()); }
/// # }
/// # fn main() {}
/// ```
///
/// This exists because a design system's installer must reach
/// [`set_default_theme`]/[`register_app_fonts`] *before* a shell reads them,
/// and Android has no `main` at all (its entry is the JNI `nativeInit`
/// `android_app!` generates). Any plugin can use it; it is not tied to one
/// design system — `frust_glyph::install` is just the first caller.
///
/// **When it runs**, identically on all three platforms: on the UI thread,
/// after `ReactiveRuntime::init`, under the root reactive `Owner`, immediately
/// before the root component's `Component::init` — and therefore before any
/// shell construction, which is the one point a shell reads
/// `set_default_theme`'s slot and drains the pending-font registry. The
/// *expansions* differ per platform (Android/iOS place the block inside the
/// state factory `android_app!`/`ios_app!` receive, which
/// `jni_glue::create_handle`/`ffi_glue::init` call before building their
/// `AppHandle`; the desktop arm routes through [`run_with_setup`]); the
/// ordering contract above is what is guaranteed.
///
/// The one-argument form is unchanged: no setup tokens are emitted, the two
/// mobile state factories expand to exactly what they always did, and the
/// desktop arm's `run_with_setup(root, || {})` is literally what [`run`] itself
/// is.
///
/// # `desktop = { .. }`: name the app on desktop
///
/// A second optional argument, alongside or instead of `setup`, is an
/// expression evaluating to a [`DesktopConfig`] — the app's desktop identity
/// (name, reverse-DNS id, window icon, native menu bar, close policy):
///
/// ```no_run
/// # use frust::{AnyView, Component, any, text};
/// # #[derive(Default)]
/// # struct MyApp;
/// # impl Component for MyApp {
/// # type State = ();
/// # fn init(&self) -> Self::State {}
/// # fn build(&self, _state: &mut Self::State) -> AnyView<Self::State> { any(text("hi")) }
/// # }
/// frust::app!(MyApp, desktop = {
/// frust::DesktopConfig::new()
/// .with_app_name("Huddle")
/// .with_app_id("dev.frust.huddle")
/// .with_menu_spec(
/// frust::MenuSpec::new()
/// .with_item(frust::MenuItemSpec::role(frust::MenuRole::Quit)),
/// )
/// });
/// # fn main() {}
/// ```
///
/// The two may be combined in either order
/// (`setup = { .. }, desktop = { .. }` or the reverse). The expression is
/// emitted **only** into the desktop `__frust_main`, so it may name
/// desktop-only types like [`DesktopConfig`] without any `cfg` of its own and
/// the mobile arms never see it — an app whose menu/identity matters on desktop
/// still compiles unchanged for Android and iOS. It is evaluated once, at
/// startup: the macro passes it straight into the run call, so it runs
/// *before* the `setup` block (which runs inside, under the reactive owner) and
/// before the shell is constructed — a config expression must not depend on
/// what `setup` installs.
///
/// Omitting it is exactly today's behavior:
/// [`DesktopConfig::default()`]'s window, through the same
/// [`run_with_setup`] call the pre-config macro emitted.
/// Compile-only smoke of [`app!`]'s `setup = { .. }` form: a
/// `Component + Default` fixture bound to all four platforms in one call —
/// `cargo test --workspace` compiles this on host (criterion 1: `__frust_main`
/// present, no Android JNI symbols), and `cargo check --target
/// aarch64-linux-android -p frust-ui --tests` / `--target
/// aarch64-apple-ios-sim -p frust-ui --tests` compile it for the two mobile
/// targets (criterion 2: the respective platform's exports appear,
/// `__frust_main` absent on Android). Lives behind `cfg(test)` — never
/// linked into a cdylib/staticlib/binary, so the fixed JNI/C-ABI export names
/// `app!` stamps out (via `android_app!`/`ios_app!`) never collide with a
/// real generated app's; [`web_app!`]'s single `#[wasm_bindgen(start)]`
/// function is the same kind of fixed, per-crate-unique export name, for the
/// same reason.
///
/// The fourth platform's own compile-check, `cargo check --target
/// wasm32-unknown-unknown -p frust-ui --tests`, type-checks `web_app!`'s
/// generated shim (which calls `frust_shell_web::run_app` — see
/// [`__frust_shell_web`]'s doc comment) and is part of the documented wasm
/// gate in `docs/DEVELOPMENT.md`.
///
/// **Exactly one `app!` invocation may be compiled per target** — a second one
/// would stamp the same fixed JNI/C-ABI export names — so this fixture takes
/// the *setup* form (the newer, ordering-critical arm, whose per-platform
/// expansions differ) and [`macro_expansion_no_setup`]/
/// [`macro_expansion_desktop_config`] below carry the remaining forms on host
/// only. The one-argument form's mobile expansion is
/// unchanged from the pre-setup macro (`@emit $root,` emits no setup tokens)
/// and every generated project plus `examples/huddle`/`examples/glyph-catalog`
/// exercises it.
///
/// The rule binds *targets*, not modules: the host-only fixtures below invoke
/// `app!` again, which is fine because on host the macro emits a plain
/// `pub fn __frust_main` (one per module, no fixed export name) and the
/// `android_app!`/`ios_app!` halves expand to nothing.
///
/// The setup payload here names no design system
/// ([`set_default_theme`] with [`Theme::neutral`] rather than a plugin's
/// `install()`), so this fixture depends on the facade alone.
/// Compile-only smoke of [`app!`]'s **one-argument** form, host-only for the
/// one-invocation-per-target reason spelled out on [`macro_expansion`] above:
/// on a mobile target this module is cfg'd out so the fixture there stays the
/// single setup-form invocation.
/// Compile-only smoke of [`app!`]'s **`desktop = { .. }`** forms — all three of
/// them (config alone, and combined with `setup` in either order), one per
/// submodule because each expansion defines its own `__frust_main`.
///
/// Host-only, for two reasons: the one-invocation-per-target rule spelled out
/// on [`macro_expansion`] above, and [`DesktopConfig`] itself, which is not in
/// a mobile build's dependency graph at all — which is precisely the property
/// these fixtures pin, since a `desktop = { .. }` expression must reach only
/// the desktop `__frust_main` and never the mobile state factories.
///
/// The config payload exercises the full re-exported vocabulary
/// ([`DesktopConfig`] + [`MenuSpec`]/[`MenuItemSpec`]/[`MenuRole`]) through the
/// facade only, so a re-export dropped from `lib.rs` fails to compile here
/// rather than in an app.
/// The config-threading half of the desktop run path: [`App::desktop`] is what
/// carries an app's [`DesktopConfig`] to the shell, and a zero-config
/// [`App::new`] still carries [`DesktopConfig::default()`] — the window the
/// preview has always opened.
///
/// Opening a window isn't testable headless, so this asserts against the value
/// `run` would hand `run_desktop_with` rather than the window itself.
/// Facade-level regression test: [`run`] runs a root
/// [`Component`]'s `init` under the process-wide root [`Owner`], so a
/// `provide_context` there actually registers (rather than silently no-opping
/// with no ambient owner). Opening a preview window isn't testable headless, so
/// this exercises `run`'s init-wrapping *equivalent* directly — the same
/// `ReactiveRuntime::init` + `with_owner(|| root.init())` shape — and asserts
/// the context resolves for code running under that same owner (the extent the
/// desktop loop's per-frame rebuild also runs in).
/// Facade-level check that the glass material tokens
/// ([`GlassScale`]/[`GlassMaterial`]/[`GlassFill`]) re-export through the
/// `frust` facade — including enough of the type to let a design-system
/// plugin author its own translucent recipe against `frust::*` alone.
/// Facade-level check that the pointer-cursor vocabulary ([`CursorIcon`])
/// re-exports through the `frust` facade — flat *and* through
/// [`authoring`](crate::authoring), since a design-system plugin reaches for it
/// from both sides (its public builder API names a shape; its widget internals
/// request one).
/// Facade-level check that the native-typeface vocabulary
/// ([`FontFace`]/[`NativeTypefaces`]) re-export through the
/// `frust` facade — the seam a design system attaches via [`ThemeExtensions`]
/// for a native-widgets plugin to consume.
/// Facade-level check that the pluggable scroll-physics vocabulary
/// ([`ScrollPhysics`]/[`Bouncing`]/[`OverscrollEffect`]/[`RubberBand`],
/// alongside the rest of `frust_widgets::physics`'s flat re-export) resolves
/// through the `frust` facade — the seam [`ScrollView::physics`]/
/// [`ScrollView::overscroll_effect`] need a consumer to actually construct an
/// argument for without reaching into `frust_widgets` directly.
/// Acceptance test: an app-authored animation composed entirely
/// from facade names ([`resolve_spec`]/[`make_driver`]/[`TransitionDriver`]),
/// with **no** hand-rolled reduce-motion branch anywhere in this module — the
/// bar this test sets is the *absence* of an app-side `if reduce_motion { .. }`
/// check, not merely that these names resolve.
/// A second acceptance case, the sharper half: an app-authored modal using
/// [`PushOptions`]/[`BackPolicy`]/[`NavigatorController::push_with_options`] —
/// now facade-reachable — with [`BackPolicy::DismissAnimated`]
/// and a dismiss-signal cell, the same mechanism `frust-widgets`' own
/// `show_glyph_dialog` depends on. Previously `PushOptions`/`BackPolicy`
/// were unnameable through `frust::`, so this call could not be constructed at
/// all: Android back on an app-authored sheet had no way to stage the exit and
/// the sheet would vanish instead of sliding down (the `pop`-not-`request_back`
/// symptom this policy prevents).
///
/// Uses `NavigatorController::request_back` directly rather than the full
/// `frust::navigator`-auto-wired + `push_back_press()` path deliberately: the
/// auto-wiring reads `frust-reactive`'s process-wide back-press signal, which
/// needs an active `ReactiveRuntime` and races `back_glue`'s own
/// `TEST_LOCK`-guarded suite if run concurrently in the same test binary.
/// `request_back` is the exact call `back_glue::route_back` makes on a real
/// consumed press (see `back_glue`'s module docs), so this covers the same
/// mechanism without that shared global.
/// [`__install_default_selection_toolbar`]'s two contracts: it installs the
/// framework baseline when the slot is empty, and a prior explicit
/// [`set_selection_toolbar_builder`] always survives it.
///
/// `frust-core` keeps its builder slot private and offers no way to reset it
/// (unlike its own in-crate tests, which reach the static directly) — this is
/// the only test in this crate's suite that touches the process-global slot,
/// so its very first touch below really is that slot's virgin state in this
/// process; every assertion after that is made deterministic by an explicit
/// `set_selection_toolbar_builder`/[`Arc::ptr_eq`] check instead of relying on
/// ambient state again.