zsui 0.3.0-alpha.2

Rust-first feature-gated native UI framework for Win32, AppKit, and Linux.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
use serde::Serialize;

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
pub enum ZsuiFeatureCategory {
    Core,
    Shell,
    Widget,
    Platform,
    Backend,
    Service,
    Tooling,
    Profile,
}

impl ZsuiFeatureCategory {
    pub const fn category_name(self) -> &'static str {
        match self {
            Self::Core => "core",
            Self::Shell => "shell",
            Self::Widget => "widget",
            Self::Platform => "platform",
            Self::Backend => "backend",
            Self::Service => "service",
            Self::Tooling => "tooling",
            Self::Profile => "profile",
        }
    }
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub struct ZsuiCargoFeature {
    pub name: &'static str,
    pub category: ZsuiFeatureCategory,
    pub category_name: &'static str,
    pub default_enabled: bool,
    pub optional_dependency_names: Vec<&'static str>,
    pub enables: Vec<&'static str>,
    pub compile_boundary: &'static str,
}

impl ZsuiCargoFeature {
    pub fn new(
        name: &'static str,
        category: ZsuiFeatureCategory,
        default_enabled: bool,
        optional_dependency_names: Vec<&'static str>,
        enables: Vec<&'static str>,
        compile_boundary: &'static str,
    ) -> Self {
        Self {
            name,
            category,
            category_name: category.category_name(),
            default_enabled,
            optional_dependency_names,
            enables,
            compile_boundary,
        }
    }

    pub fn enables_optional_dependency(&self) -> bool {
        !self.optional_dependency_names.is_empty()
    }
}

pub fn zsui_default_feature_names() -> Vec<&'static str> {
    vec!["window", "button", "label"]
}

pub fn zsui_optional_dependency_feature_names() -> Vec<&'static str> {
    zsui_feature_manifest()
        .into_iter()
        .filter(ZsuiCargoFeature::enables_optional_dependency)
        .map(|feature| feature.name)
        .collect()
}

pub fn zsui_feature_manifest() -> Vec<ZsuiCargoFeature> {
    use ZsuiFeatureCategory::{Backend, Core, Platform, Profile, Service, Shell, Tooling, Widget};

    vec![
        ZsuiCargoFeature::new(
            "window",
            Shell,
            true,
            Vec::new(),
            vec!["windows-win32", "macos-appkit", "linux-direct"],
            "window declarations and target-native Win32, AppKit or lightweight Wayland/X11 host paths",
        ),
        ZsuiCargoFeature::new(
            "button",
            Widget,
            true,
            Vec::new(),
            vec!["widgets-base"],
            "button component declarations and base widget surface",
        ),
        ZsuiCargoFeature::new(
            "accordion",
            Widget,
            false,
            Vec::new(),
            vec!["button", "label"],
            "typed single or multiple disclosure sections with arbitrary nested View content",
        ),
        ZsuiCargoFeature::new(
            "badge",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base"],
            "noninteractive dot, numeric and semantic-icon information badges with platform-owned metrics",
        ),
        ZsuiCargoFeature::new(
            "split-view",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base", "resize"],
            "two-pane adaptive/inline/overlay composition with explicit open state and platform-owned metrics",
        ),
        ZsuiCargoFeature::new(
            "resize", Core, false, Vec::new(), Vec::new(),
            "typed divider geometry, bounded pointer resizing and controlled extent changes",
        ),
        ZsuiCargoFeature::new(
            "label",
            Widget,
            true,
            Vec::new(),
            vec!["widgets-base"],
            "label/text component declarations and renderer-backed Label component",
        ),
        ZsuiCargoFeature::new(
            "grid",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base"],
            "typed row/column grid layout with fixed and fractional tracks, gaps and spans",
        ),
        ZsuiCargoFeature::new(
            "canvas",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base"],
            "retained custom drawing surface with local-DP geometry, semantic colors and typed activation",
        ),
        ZsuiCargoFeature::new(
            "icon",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base"],
            "standalone semantic icon surface with platform-owned metrics and native icon sources",
        ),
        ZsuiCargoFeature::new(
            "flyout",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base"],
            "anchored arbitrary-content overlay with platform-native composition and typed dismissal",
        ),
        ZsuiCargoFeature::new(
            "menu-flyout",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base"],
            "anchored menu overlay with typed commands, platform-adaptive metrics and keyboard routing",
        ),
        ZsuiCargoFeature::new(
            "context-menu",
            Widget,
            false,
            Vec::new(),
            vec!["menu-flyout"],
            "secondary-click menu wrapper with framework-owned invocation, pointer anchoring and dismissal",
        ),
        ZsuiCargoFeature::new(
            "widgets-base",
            Widget,
            false,
            Vec::new(),
            Vec::new(),
            "small built-in component declarations shared by button and label",
        ),
        ZsuiCargoFeature::new(
            "widgets-input",
            Widget,
            false,
            Vec::new(),
            Vec::new(),
            "input widget declarations such as checkboxes and toggles",
        ),
        ZsuiCargoFeature::new(
            "text-input-core",
            Widget,
            false,
            vec!["unicode-segmentation"],
            vec!["widgets-input"],
            "shared Unicode grapheme editing plus target-native shaped caret, visual navigation and hit geometry",
        ),
        ZsuiCargoFeature::new(
            "widgets-list",
            Widget,
            false,
            Vec::new(),
            Vec::new(),
            "list-like widget declarations",
        ),
        ZsuiCargoFeature::new(
            "scroll",
            Widget,
            false,
            Vec::new(),
            Vec::new(),
            "scroll container declarations and future host contracts",
        ),
        ZsuiCargoFeature::new(
            "list",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-list", "scroll"],
            "list widget declarations",
        ),
        ZsuiCargoFeature::new(
            "tree",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-list"],
            "typed hierarchical rows with strong IDs and self-drawn platform disclosure profiles",
        ),
        ZsuiCargoFeature::new(
            "virtual-list",
            Widget,
            false,
            Vec::new(),
            vec!["list", "scroll"],
            "viewport-based list layout that materializes and paints visible rows only",
        ),
        ZsuiCargoFeature::new(
            "paged-list",
            Widget,
            false,
            Vec::new(),
            vec!["virtual-list"],
            "background page loading, request deduplication and bounded LRU page caching",
        ),
        ZsuiCargoFeature::new(
            "textbox",
            Widget,
            false,
            Vec::new(),
            vec!["text-input-core"],
            "text input component declarations",
        ),
        ZsuiCargoFeature::new(
            "password-box",
            Widget,
            false,
            vec!["zeroize"],
            vec!["text-input-core"],
            "single-line secure input with redacted state, platform reveal policy and self-drawn native profiles",
        ),
        ZsuiCargoFeature::new(
            "tooltip",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base"],
            "attached noninteractive help overlay with platform metrics and native hover/focus timing",
        ),
        ZsuiCargoFeature::new(
            "dialog",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base"],
            "modal self-drawn content dialog with platform action layout, typed responses and independently focusable accessibility buttons",
        ),
        ZsuiCargoFeature::new(
            "toggle-button",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-input"],
            "explicit-state toggle button with self-drawn platform profiles, typed activation and native accessibility toggle state",
        ),
        ZsuiCargoFeature::new(
            "checkbox",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-input"],
            "checkbox component declarations",
        ),
        ZsuiCargoFeature::new(
            "toggle",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-input"],
            "owner-drawn toggle declarations and typed View input",
        ),
        ZsuiCargoFeature::new(
            "slider",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-input"],
            "range-normalized slider layout, paint, typed input and adjustable native accessibility range",
        ),
        ZsuiCargoFeature::new(
            "number-box",
            Widget,
            false,
            Vec::new(),
            vec!["text-input-core"],
            "editable finite number input with validated range, platform-style steppers, typed commits and native SpinButton range semantics",
        ),
        ZsuiCargoFeature::new(
            "radio",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-input"],
            "explicit-state radio button layout, paint and typed selection input",
        ),
        ZsuiCargoFeature::new(
            "progress",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base"],
            "determinate/indeterminate progress, platform-native status styling and read-only UIA/AppKit/AccessKit range semantics",
        ),
        ZsuiCargoFeature::new(
            "progress-ring",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base"],
            "independently selectable determinate/indeterminate ring with platform metrics, native animation timers and read-only progress semantics",
        ),
        ZsuiCargoFeature::new(
            "auto-suggest",
            Widget,
            false,
            Vec::new(),
            vec!["text-input-core"],
            "application-owned strong-id suggestions with platform search-field metrics, popup overlay and typed text, choice or submission events",
        ),
        ZsuiCargoFeature::new(
            "command-palette",
            Widget,
            false,
            Vec::new(),
            vec!["text-input-core"],
            "application-owned strong-id commands with self-drawn platform search/list overlays and typed query, highlight, invoke or dismiss events",
        ),
        ZsuiCargoFeature::new(
            "combo",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-input"],
            "explicit-state combo header, popup overlay and typed pointer or keyboard selection",
        ),
        ZsuiCargoFeature::new(
            "date-picker",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-input"],
            "calendar date picker with typed date state, popup month navigation and selection",
        ),
        ZsuiCargoFeature::new(
            "time-picker",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-input"],
            "time picker with typed wall-clock state, minute increments and platform-adaptive popup selection",
        ),
        ZsuiCargoFeature::new(
            "color-picker",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-input"],
            "application-owned RGBA color well with platform-adaptive self-drawn channel editor and typed input",
        ),
        ZsuiCargoFeature::new(
            "tabs",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base"],
            "self-drawn tab view with strong tab ids, selected content and platform keyboard behavior",
        ),
        ZsuiCargoFeature::new(
            "table",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-list", "resize"],
            "typed read-only data grid with strong row and column IDs, sorting and platform-adaptive self-drawn metrics",
        ),
        ZsuiCargoFeature::new(
            "dark-mode",
            Service,
            false,
            Vec::new(),
            Vec::new(),
            "theme selection contracts without forcing a renderer backend",
        ),
        ZsuiCargoFeature::new(
            "style",
            Service,
            false,
            Vec::new(),
            Vec::new(),
            "style tokens, theme data and future renderer style binding",
        ),
        ZsuiCargoFeature::new(
            "localization",
            Service,
            false,
            vec!["fluent-bundle", "sys-locale", "unic-langid"],
            Vec::new(),
            "application-owned Fluent catalogs, locale fallback, runtime language changes and text-direction metadata",
        ),
        ZsuiCargoFeature::new(
            "shell",
            Shell,
            false,
            Vec::new(),
            vec!["button", "label", "resize"],
            "desktop shell integration boundary",
        ),
        ZsuiCargoFeature::new(
            "document-shell",
            Shell,
            false,
            Vec::new(),
            vec!["style"],
            "self-drawn document chrome plus reusable UTF-8/UTF-16 text document lifecycle",
        ),
        ZsuiCargoFeature::new(
            "calculator",
            Shell,
            false,
            vec!["rust_decimal"],
            vec!["style", "button", "label", "grid"],
            "decimal calculator engine and platform-adaptive typed View shell",
        ),
        ZsuiCargoFeature::new(
            "tray",
            Shell,
            false,
            Vec::new(),
            vec!["shell"],
            "tray/status item declarations and host contracts",
        ),
        ZsuiCargoFeature::new(
            "hotkey",
            Shell,
            false,
            Vec::new(),
            vec!["shell"],
            "global hotkey declarations and host contracts",
        ),
        ZsuiCargoFeature::new(
            "settings",
            Shell,
            false,
            Vec::new(),
            vec!["widgets-input", "widgets-list", "toggle"],
            "settings page model and settings control declarations",
        ),
        ZsuiCargoFeature::new(
            "product-adapter",
            Service,
            false,
            Vec::new(),
            Vec::new(),
            "product adapter runtime harness and AI/tool boundary contracts",
        ),
        ZsuiCargoFeature::new(
            "ui-document",
            Tooling,
            false,
            Vec::new(),
            Vec::new(),
            "versioned semantic UI document schema, typed binding manifest and validation tooling",
        ),
        ZsuiCargoFeature::new(
            "ui-document-runtime",
            Core,
            false,
            Vec::new(),
            vec!["ui-document"],
            "release-safe UI document to View compiler without file watching or preview transport",
        ),
        ZsuiCargoFeature::new(
            "ui-viewer",
            Tooling,
            false,
            Vec::new(),
            vec![
                "ui-document-runtime",
                "window",
                "button",
                "accordion",
                "badge",
                "split-view",
                "breadcrumb",
                "canvas",
                "icon",
                "label",
                "checkbox",
                "toggle",
                "toggle-button",
                "textbox",
                "password-box",
                "radio",
                "slider",
                "number-box",
                "combo",
                "auto-suggest",
                "command-palette",
                "tree",
                "grid-view",
                "table",
                "date-picker",
                "time-picker",
                "color-picker",
                "list",
                "virtual-list",
                "image-preview",
                "video",
                "tabs",
                "grid",
                "progress",
                "progress-ring",
                "dialog",
                "toast",
                "info-bar",
                "tooltip",
                "teaching-tip",
                "flyout",
                "menu-flyout",
                "context-menu",
                "scroll",
                "shell",
                "document-shell",
                "native-smoke",
            ],
            "prebuilt target-native development viewer with validated file reload and final-surface smoke",
        ),
        ZsuiCargoFeature::new(
            "android",
            Platform,
            false,
            Vec::new(),
            Vec::new(),
            "Android Activity host scaffold and future runtime bridge",
        ),
        ZsuiCargoFeature::new(
            "mobile",
            Platform,
            false,
            Vec::new(),
            vec!["android"],
            "Android mobile platform scaffold",
        ),
        ZsuiCargoFeature::new(
            "clipboard",
            Service,
            false,
            vec!["arboard"],
            Vec::new(),
            "system UTF-8 text and validated RGBA image clipboard bridge; file lists remain backend-gated",
        ),
        ZsuiCargoFeature::new(
            "accessibility",
            Service,
            false,
            vec!["windows", "windows-core"],
            Vec::new(),
            "optional shared accessibility semantics plus Win32 UI Automation, AppKit NSAccessibility and GTK4 accessible properties",
        ),
        ZsuiCargoFeature::new(
            "image",
            Service,
            false,
            vec!["png"],
            Vec::new(),
            "PNG decode/encode helpers used by smoke screenshots and GDI icons",
        ),
        ZsuiCargoFeature::new(
            "image-preview",
            Widget,
            false,
            Vec::new(),
            vec!["image", "widgets-base"],
            "retained image preview with coalesced background PNG decode and atomic frame replacement",
        ),
        ZsuiCargoFeature::new(
            "video",
            Widget,
            false,
            Vec::new(),
            vec!["widgets-base"],
            "latest-frame video and camera-preview surface with application-owned decoding, capture and audio",
        ),
        ZsuiCargoFeature::new(
            "native-smoke",
            Tooling,
            false,
            Vec::new(),
            vec!["image"],
            "native target-smoke artifact writing and review helpers",
        ),
        ZsuiCargoFeature::new(
            "fluent-icons",
            Widget,
            false,
            Vec::new(),
            Vec::new(),
            "MIT-licensed Fluent System Icons SVG fallback assets for missing native symbols",
        ),
        ZsuiCargoFeature::new(
            "notepad-demo",
            Tooling,
            false,
            Vec::new(),
            vec![
                "window",
                "button",
                "label",
                "textbox",
                "tabs",
                "dialog",
                "clipboard",
                "document-shell",
            ],
            "shared self-drawn notepad acceptance example on target-native Win32, AppKit and Linux hosts",
        ),
        ZsuiCargoFeature::new(
            "notepad-demo-gtk",
            Tooling,
            false,
            Vec::new(),
            vec![
                "linux-gtk",
                "button",
                "label",
                "textbox",
                "tabs",
                "dialog",
                "clipboard",
                "document-shell",
            ],
            "same shared notepad source built against the real GTK4 application and DrawingArea host",
        ),
        ZsuiCargoFeature::new(
            "notepad-demo-lite",
            Tooling,
            false,
            Vec::new(),
            vec![
                "linux-direct-lite",
                "button",
                "label",
                "textbox",
                "tabs",
                "dialog",
                "clipboard",
                "document-shell",
                "native-smoke",
            ],
            "same shared notepad source built against the opt-in pure-Rust Linux renderer",
        ),
        ZsuiCargoFeature::new(
            "calculator-demo",
            Tooling,
            false,
            Vec::new(),
            vec!["window", "calculator", "native-smoke"],
            "shared calculator acceptance example on target-native Win32, AppKit and Linux hosts",
        ),
        ZsuiCargoFeature::new(
            "component-gallery-demo",
            Tooling,
            false,
            Vec::new(),
            vec!["window", "all-widgets", "native-smoke", "style", "dark-mode"],
            "complete opt-in component gallery and native smoke acceptance surface",
        ),
        ZsuiCargoFeature::new(
            "desktop-winit",
            Backend,
            false,
            vec!["winit"],
            Vec::new(),
            "first-pass macOS/Linux desktop event loop fallback",
        ),
        ZsuiCargoFeature::new(
            "windows-gdi",
            Backend,
            false,
            vec!["windows-sys"],
            vec!["image"],
            "Windows GDI renderer, text layout and no-flicker paint foundation",
        ),
        ZsuiCargoFeature::new(
            "windows-win32",
            Backend,
            false,
            Vec::new(),
            vec!["windows-rust-text"],
            "direct Win32 HWND host and message loop with ZSUI-owned Rust text and a buffered GDI fallback",
        ),
        ZsuiCargoFeature::new(
            "windows-directwrite",
            Backend,
            false,
            vec!["windows", "windows-core"],
            vec!["windows-gdi"],
            "opt-in system DirectWrite shaping and rasterization inside the buffered Win32 GDI surface",
        ),
        ZsuiCargoFeature::new(
            "rust-text",
            Backend,
            false,
            vec!["cosmic-text", "skrifa", "swash", "ttf-parser"],
            Vec::new(),
            "ZSUI-owned Rust shaping, retained layout and hinted rasterization pipeline used by the Win32 host",
        ),
        ZsuiCargoFeature::new(
            "rust-text-proof",
            Tooling,
            false,
            Vec::new(),
            vec!["rust-text"],
            "development-only text geometry, JSON, SVG and pixel-difference support",
        ),
        ZsuiCargoFeature::new(
            "windows-rust-text",
            Backend,
            false,
            Vec::new(),
            vec!["windows-gdi", "rust-text"],
            "ZSUI Rust text compositor inside the buffered Win32 GDI surface with GDI fallback",
        ),
        ZsuiCargoFeature::new(
            "windows-text-proof",
            Tooling,
            false,
            Vec::new(),
            vec!["windows-directwrite", "rust-text-proof"],
            "safe DirectWrite glyph-geometry oracle for ZSUI Rust JSON and SVG comparison",
        ),
        ZsuiCargoFeature::new(
            "macos-appkit",
            Backend,
            false,
            vec!["objc2", "objc2-app-kit", "objc2-foundation", "objc2-core-graphics"],
            Vec::new(),
            "macOS AppKit backend boundary with native window, clipboard, file-dialog and typed menu services",
        ),
        ZsuiCargoFeature::new(
            "linux-direct-host",
            Backend,
            false,
            vec!["dbus", "rfd", "softbuffer", "winit"],
            Vec::new(),
            "shared Wayland/X11 window, input, IME, menu, portal and software-presentation host",
        ),
        ZsuiCargoFeature::new(
            "linux-direct-accessibility",
            Backend,
            false,
            vec!["accesskit", "accesskit_winit"],
            vec!["accessibility", "linux-direct-host"],
            "optional AccessKit AT-SPI bridge for the Winit-based Linux direct host",
        ),
        ZsuiCargoFeature::new(
            "linux-direct",
            Backend,
            false,
            vec!["cairo-rs", "pango", "pangocairo"],
            vec!["linux-direct-host"],
            "lightweight Linux native-window backend with direct software presentation, Pango text, built-in symbolic vectors and XDG portal dialogs",
        ),
        ZsuiCargoFeature::new(
            "linux-direct-lite",
            Backend,
            false,
            vec!["tiny-skia"],
            vec!["linux-direct-host", "rust-text"],
            "opt-in pure-Rust Linux renderer using the retained ZSUI text engine and tiny-skia on the shared Wayland/X11 host",
        ),
        ZsuiCargoFeature::new(
            "linux-system-icons",
            Backend,
            false,
            vec!["freedesktop-icons", "gdk-pixbuf"],
            vec!["linux-direct"],
            "optional freedesktop icon-theme lookup and raster decoding for Linux applications that require exact desktop theme icons",
        ),
        ZsuiCargoFeature::new(
            "linux-gtk",
            Backend,
            false,
            vec!["gtk4"],
            Vec::new(),
            "Linux GTK4 backend boundary with native window, clipboard, file-dialog and typed menu services",
        ),
        ZsuiCargoFeature::new(
            "desktop-native",
            Profile,
            false,
            Vec::new(),
            vec!["windows-win32", "macos-appkit", "linux-direct"],
            "target-native desktop backend profile without exposing platform handles to applications",
        ),
        ZsuiCargoFeature::new(
            "all-widgets",
            Profile,
            false,
            Vec::new(),
            vec![
                "button",
                "accordion",
                "badge",
                "split-view",
                "breadcrumb",
                "canvas",
                "flyout",
                "menu-flyout",
                "context-menu",
                "toggle-button",
                "icon",
                "label",
                "grid",
                "grid-view",
                "scroll",
                "list",
                "virtual-list",
                "paged-list",
                "image-preview",
                "video",
                "textbox",
                "password-box",
                "tooltip",
                "dialog",
                "toast",
                "info-bar",
                "teaching-tip",
                "checkbox",
                "toggle",
                "slider",
                "number-box",
                "radio",
                "progress",
                "progress-ring",
                "auto-suggest",
                "command-palette",
                "tree",
                "combo",
                "date-picker",
                "time-picker",
                "color-picker",
                "tabs",
                "table",
            ],
            "explicit opt-in profile for all current widget feature gates",
        ),
        ZsuiCargoFeature::new(
            "full",
            Profile,
            false,
            Vec::new(),
            vec![
                "accessibility",
                "all-widgets",
                "clipboard",
                "calculator",
                "dark-mode",
                "document-shell",
                "desktop-native",
                "desktop-winit",
                "hotkey",
                "localization",
                "linux-gtk",
                "linux-direct-accessibility",
                "linux-system-icons",
                "mobile",
                "native-smoke",
                "product-adapter",
                "ui-document",
                "ui-document-runtime",
                "ui-viewer",
                "settings",
                "style",
                "tray",
                "window",
            ],
            "developer profile for checking all current optional surfaces together",
        ),
    ]
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn default_feature_set_stays_small() {
        assert_eq!(
            zsui_default_feature_names(),
            vec!["window", "button", "label"]
        );
        let defaults: Vec<_> = zsui_feature_manifest()
            .into_iter()
            .filter(|feature| feature.default_enabled)
            .map(|feature| feature.name)
            .collect();
        assert_eq!(defaults, zsui_default_feature_names());

        let window = zsui_feature_manifest()
            .into_iter()
            .find(|feature| feature.name == "window")
            .expect("window feature should be listed");
        assert_eq!(
            window.enables,
            vec!["windows-win32", "macos-appkit", "linux-direct"]
        );
    }

    #[test]
    fn optional_dependency_features_are_explicit() {
        let names = zsui_optional_dependency_feature_names();

        assert!(names.contains(&"clipboard"));
        assert!(names.contains(&"accessibility"));
        assert!(names.contains(&"calculator"));
        assert!(names.contains(&"image"));
        assert!(names.contains(&"desktop-winit"));
        assert!(names.contains(&"windows-gdi"));
        assert!(names.contains(&"windows-directwrite"));
        assert!(names.contains(&"rust-text"));
        assert!(names.contains(&"macos-appkit"));
        assert!(names.contains(&"linux-direct"));
        assert!(names.contains(&"linux-system-icons"));
        assert!(names.contains(&"linux-gtk"));
        assert!(names.contains(&"password-box"));
        assert!(names.contains(&"text-input-core"));
        assert!(names.contains(&"localization"));
        assert!(!names.contains(&"button"));
        assert!(!names.contains(&"label"));
    }

    #[test]
    fn text_feature_graph_is_explicit() {
        let manifest = zsui_feature_manifest();
        let windows_rust = manifest
            .iter()
            .find(|feature| feature.name == "windows-rust-text")
            .expect("Windows Rust text feature should be listed");
        assert_eq!(windows_rust.enables, vec!["windows-gdi", "rust-text"]);
        assert!(windows_rust.optional_dependency_names.is_empty());

        let proof = manifest
            .iter()
            .find(|feature| feature.name == "windows-text-proof")
            .expect("Windows text proof feature should be listed");
        assert_eq!(
            proof.enables,
            vec!["windows-directwrite", "rust-text-proof"]
        );
        assert!(proof.optional_dependency_names.is_empty());

        let rust_proof = manifest
            .iter()
            .find(|feature| feature.name == "rust-text-proof")
            .expect("portable text proof feature should be listed");
        assert_eq!(rust_proof.enables, vec!["rust-text"]);
        assert!(rust_proof.optional_dependency_names.is_empty());

        let linux_lite = manifest
            .iter()
            .find(|feature| feature.name == "linux-direct-lite")
            .expect("Linux lite text feature should be listed");
        assert_eq!(linux_lite.enables, vec!["linux-direct-host", "rust-text"]);
        assert_eq!(linux_lite.optional_dependency_names, vec!["tiny-skia"]);
    }

    #[test]
    fn notepad_gtk_profile_selects_only_the_gtk_host() {
        let manifest = zsui_feature_manifest();
        let gtk = manifest
            .iter()
            .find(|feature| feature.name == "notepad-demo-gtk")
            .expect("GTK notepad profile should be listed");

        assert!(gtk.enables.contains(&"linux-gtk"));
        assert!(!gtk.enables.contains(&"window"));
        assert!(!gtk.enables.contains(&"linux-direct"));
        assert!(!gtk.enables.contains(&"linux-direct-lite"));
    }

    #[test]
    fn unicode_segmentation_stays_inside_text_capable_input_slices() {
        let manifest = zsui_feature_manifest();
        let text_core = manifest
            .iter()
            .find(|feature| feature.name == "text-input-core")
            .expect("text input core should be listed");
        let textbox = manifest
            .iter()
            .find(|feature| feature.name == "textbox")
            .expect("textbox should be listed");
        let checkbox = manifest
            .iter()
            .find(|feature| feature.name == "checkbox")
            .expect("checkbox should be listed");

        assert_eq!(
            text_core.optional_dependency_names,
            vec!["unicode-segmentation"]
        );
        assert_eq!(text_core.enables, vec!["widgets-input"]);
        assert_eq!(textbox.enables, vec!["text-input-core"]);
        assert_eq!(checkbox.enables, vec!["widgets-input"]);
        assert!(!checkbox.enables.contains(&"text-input-core"));
    }

    #[test]
    fn native_accessibility_stays_out_of_defaults_and_widget_profiles() {
        let manifest = zsui_feature_manifest();
        let accessibility = manifest
            .iter()
            .find(|feature| feature.name == "accessibility")
            .expect("accessibility feature should be listed");
        let all_widgets = manifest
            .iter()
            .find(|feature| feature.name == "all-widgets")
            .expect("all-widgets feature should be listed");
        let linux_direct = manifest
            .iter()
            .find(|feature| feature.name == "linux-direct-accessibility")
            .expect("Linux direct accessibility feature should be listed");
        let full = manifest
            .iter()
            .find(|feature| feature.name == "full")
            .expect("full feature should be listed");

        assert!(!accessibility.default_enabled);
        assert_eq!(
            accessibility.optional_dependency_names,
            vec!["windows", "windows-core"]
        );
        assert!(!all_widgets.enables.contains(&"accessibility"));
        assert_eq!(
            linux_direct.optional_dependency_names,
            vec!["accesskit", "accesskit_winit"]
        );
        assert_eq!(
            linux_direct.enables,
            vec!["accessibility", "linux-direct-host"]
        );
        assert!(full.enables.contains(&"accessibility"));
        assert!(full.enables.contains(&"linux-direct-accessibility"));
    }

    #[test]
    fn localization_is_an_opt_in_service_included_by_full() {
        let manifest = zsui_feature_manifest();
        let localization = manifest
            .iter()
            .find(|feature| feature.name == "localization")
            .expect("localization feature should be listed");
        let all_widgets = manifest
            .iter()
            .find(|feature| feature.name == "all-widgets")
            .expect("all-widgets feature should be listed");
        let full = manifest
            .iter()
            .find(|feature| feature.name == "full")
            .expect("full feature should be listed");

        assert!(!localization.default_enabled);
        assert_eq!(
            localization.optional_dependency_names,
            vec!["fluent-bundle", "sys-locale", "unic-langid"]
        );
        assert!(!all_widgets.enables.contains(&"localization"));
        assert!(full.enables.contains(&"localization"));
    }

    #[test]
    fn ui_document_tooling_is_opt_in_and_included_by_full() {
        let manifest = zsui_feature_manifest();
        let ui_document = manifest
            .iter()
            .find(|feature| feature.name == "ui-document")
            .expect("UI document feature should be listed");
        let full = manifest
            .iter()
            .find(|feature| feature.name == "full")
            .expect("full feature should be listed");

        assert!(!ui_document.default_enabled);
        assert!(ui_document.optional_dependency_names.is_empty());
        assert!(full.enables.contains(&"ui-document"));
        let ui_document_runtime = manifest
            .iter()
            .find(|feature| feature.name == "ui-document-runtime")
            .expect("UI document runtime feature should be listed");
        assert_eq!(ui_document_runtime.enables, vec!["ui-document"]);
        assert!(full.enables.contains(&"ui-document-runtime"));
        let ui_viewer = manifest
            .iter()
            .find(|feature| feature.name == "ui-viewer")
            .expect("UI viewer feature should be listed");
        assert!(ui_viewer.enables.contains(&"ui-document-runtime"));
        assert!(ui_viewer.enables.contains(&"window"));
        assert!(ui_viewer.enables.contains(&"canvas"));
        assert!(ui_viewer.enables.contains(&"date-picker"));
        assert!(ui_viewer.enables.contains(&"time-picker"));
        assert!(ui_viewer.enables.contains(&"color-picker"));
        assert!(ui_viewer.enables.contains(&"auto-suggest"));
        assert!(ui_viewer.enables.contains(&"command-palette"));
        assert!(ui_viewer.enables.contains(&"tree"));
        assert!(ui_viewer.enables.contains(&"grid-view"));
        assert!(ui_viewer.enables.contains(&"virtual-list"));
        assert!(ui_viewer.enables.contains(&"image-preview"));
        assert!(full.enables.contains(&"ui-viewer"));
    }

    #[test]
    fn widget_profile_is_opt_in_not_default() {
        let manifest = zsui_feature_manifest();
        let grid = manifest
            .iter()
            .find(|feature| feature.name == "grid")
            .expect("grid feature should be listed");
        let table = manifest
            .iter()
            .find(|feature| feature.name == "table")
            .expect("table feature should be listed");
        let dialog = manifest
            .iter()
            .find(|feature| feature.name == "dialog")
            .expect("dialog feature should be listed");
        let flyout = manifest
            .iter()
            .find(|feature| feature.name == "flyout")
            .expect("flyout feature should be listed");
        let menu_flyout = manifest
            .iter()
            .find(|feature| feature.name == "menu-flyout")
            .expect("menu-flyout feature should be listed");
        let context_menu = manifest
            .iter()
            .find(|feature| feature.name == "context-menu")
            .expect("context-menu feature should be listed");
        let accordion = manifest
            .iter()
            .find(|feature| feature.name == "accordion")
            .expect("accordion feature should be listed");
        let image_preview = manifest
            .iter()
            .find(|feature| feature.name == "image-preview")
            .expect("image preview feature should be listed");
        let video = manifest
            .iter()
            .find(|feature| feature.name == "video")
            .expect("video feature should be listed");
        let all_widgets = manifest
            .iter()
            .find(|feature| feature.name == "all-widgets")
            .expect("all-widgets feature should be listed");

        assert!(!grid.default_enabled);
        assert!(!table.default_enabled);
        assert!(!dialog.default_enabled);
        assert_eq!(dialog.enables, vec!["widgets-base"]);
        assert_eq!(flyout.enables, vec!["widgets-base"]);
        assert_eq!(menu_flyout.enables, vec!["widgets-base"]);
        assert_eq!(context_menu.enables, vec!["menu-flyout"]);
        assert_eq!(accordion.enables, vec!["button", "label"]);
        assert_eq!(table.enables, vec!["widgets-list", "resize"]);
        assert_eq!(image_preview.enables, vec!["image", "widgets-base"]);
        assert_eq!(video.enables, vec!["widgets-base"]);
        assert!(!table.enables.contains(&"list"));
        assert!(!table.enables.contains(&"scroll"));
        assert!(!all_widgets.default_enabled);
        assert!(all_widgets.enables.contains(&"grid"));
        assert!(all_widgets.enables.contains(&"canvas"));
        assert!(all_widgets.enables.contains(&"flyout"));
        assert!(all_widgets.enables.contains(&"menu-flyout"));
        assert!(all_widgets.enables.contains(&"context-menu"));
        assert!(all_widgets.enables.contains(&"accordion"));
        assert!(all_widgets.enables.contains(&"textbox"));
        assert!(all_widgets.enables.contains(&"password-box"));
        assert!(all_widgets.enables.contains(&"image-preview"));
        assert!(all_widgets.enables.contains(&"video"));
        assert!(all_widgets.enables.contains(&"tooltip"));
        assert!(all_widgets.enables.contains(&"dialog"));
        assert!(all_widgets.enables.contains(&"toggle-button"));
        assert!(all_widgets.enables.contains(&"toggle"));
        assert!(all_widgets.enables.contains(&"slider"));
        assert!(all_widgets.enables.contains(&"number-box"));
        assert!(all_widgets.enables.contains(&"radio"));
        assert!(all_widgets.enables.contains(&"progress"));
        assert!(all_widgets.enables.contains(&"progress-ring"));
        assert!(all_widgets.enables.contains(&"auto-suggest"));
        assert!(all_widgets.enables.contains(&"command-palette"));
        assert!(all_widgets.enables.contains(&"tree"));
        assert!(all_widgets.enables.contains(&"combo"));
        assert!(all_widgets.enables.contains(&"date-picker"));
        assert!(all_widgets.enables.contains(&"time-picker"));
        assert!(all_widgets.enables.contains(&"color-picker"));
        assert!(all_widgets.enables.contains(&"tabs"));
        assert!(all_widgets.enables.contains(&"table"));
    }
}