Skip to main content

gpui_macos/
interpretation.rs

1//! Auditable macOS presentation contract for the complete component catalog.
2//!
3//! A counterpart describes the design being followed, not a claim that a
4//! GPUI element is an AppKit control instance. System-backed entries identify
5//! their actual native integrations and retain deterministic canvas fallbacks.
6
7/// How a component obtains its macOS presentation.
8#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
9pub enum RenderingKind {
10    /// Host AppKit chrome, material, or artwork, composed with GPUI content.
11    AppKitBacked,
12    /// GPUI rendering and behavior following an existing macOS control.
13    GpuiReplica,
14    /// A macOS composition for a workflow without one equivalent AppKit control.
15    MacInterpretation,
16}
17
18impl RenderingKind {
19    pub const fn label(self) -> &'static str {
20        match self {
21            Self::AppKitBacked => "AppKit backed",
22            Self::GpuiReplica => "GPUI replica",
23            Self::MacInterpretation => "macOS interpretation",
24        }
25    }
26}
27
28/// The operating-system integration actually used by an entry.
29#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
30pub enum NativeIntegration {
31    WindowChrome,
32    UnifiedToolbar,
33    GlassMaterial,
34    SfSymbols,
35    SystemAppearance,
36    Clipboard,
37    InputMethod,
38    SpeechRecognizer,
39}
40
41/// Optional upstream capabilities keep their original feature requirements.
42#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
43pub enum FeatureRequirement {
44    TreeSitterLanguages,
45    Speech,
46}
47
48/// The counterpart, reusable API, and behavior retained by a gallery page.
49#[derive(Clone, Copy, Debug, PartialEq, Eq)]
50pub struct ComponentInterpretation {
51    pub id: &'static str,
52    pub rendering: RenderingKind,
53    pub counterpart: &'static str,
54    pub design: &'static str,
55    pub api: &'static str,
56    pub capabilities: &'static [&'static str],
57    pub native_integrations: &'static [NativeIntegration],
58    pub optional_features: &'static [FeatureRequirement],
59}
60
61/// Each pinned public Kit module maps to actual catalog pages, including
62/// supporting modules that do not have a dedicated upstream documentation page.
63#[derive(Clone, Copy, Debug, PartialEq, Eq)]
64pub struct ModuleCoverage {
65    pub module: &'static str,
66    pub pages: &'static [&'static str],
67    pub role: &'static str,
68}
69
70pub const UPSTREAM_REVISION: &str = "0bbd9870ce420af9feacbf948b21d3824d82dc0b";
71
72pub const INTERPRETATIONS: &[ComponentInterpretation] = &[
73    ComponentInterpretation {
74        id: "overview",
75        rendering: RenderingKind::MacInterpretation,
76        counterpart: "System Settings preference pane",
77        design: "Quiet grouped rows, aligned labels and trailing save actions",
78        api: "gpui_macos::settings_group / gpui_macos::settings_row",
79        capabilities: &[
80            "Editable workspace",
81            "retained selections",
82            "save and cancel",
83        ],
84        native_integrations: &[],
85        optional_features: &[],
86    },
87    ComponentInterpretation {
88        id: "theme",
89        rendering: RenderingKind::MacInterpretation,
90        counterpart: "macOS semantic appearance",
91        design: "System font, label hierarchy, accent and appearance tokens",
92        api: "gpui_macos::Theme",
93        capabilities: &[
94            "Light and dark",
95            "system following",
96            "accessibility preferences",
97        ],
98        native_integrations: &[NativeIntegration::SystemAppearance],
99        optional_features: &[],
100    },
101    ComponentInterpretation {
102        id: "root",
103        rendering: RenderingKind::MacInterpretation,
104        counterpart: "macOS application content host",
105        design: "Transparent Root with native chrome and opaque content panes",
106        api: "gpui_macos::kit::Root",
107        capabilities: &[
108            "Overlay hosting",
109            "focus",
110            "selectable text",
111            "notifications",
112        ],
113        native_integrations: &[NativeIntegration::WindowChrome],
114        optional_features: &[],
115    },
116    ComponentInterpretation {
117        id: "focus_trap",
118        rendering: RenderingKind::MacInterpretation,
119        counterpart: "Modal keyboard focus scope",
120        design: "Tab traversal remains inside a presented control group",
121        api: "gpui_macos::kit::FocusTrapElement",
122        capabilities: &["Forward and reverse focus", "stable trigger restoration"],
123        native_integrations: &[],
124        optional_features: &[],
125    },
126    ComponentInterpretation {
127        id: "button",
128        rendering: RenderingKind::GpuiReplica,
129        counterpart: "NSButton",
130        design: "Compact system bezel and activation-aware accent",
131        api: "gpui_macos::button",
132        capabilities: &[
133            "Primary and secondary",
134            "disabled",
135            "pointer and keyboard activation",
136        ],
137        native_integrations: &[],
138        optional_features: &[],
139    },
140    ComponentInterpretation {
141        id: "button_group",
142        rendering: RenderingKind::GpuiReplica,
143        counterpart: "NSSegmentedControl",
144        design: "Joined 24-point segments with selected bezel",
145        api: "gpui_macos::button_group / gpui_macos::segmented_control",
146        capabilities: &[
147            "Single selection",
148            "disabled segments",
149            "keyboard navigation",
150        ],
151        native_integrations: &[],
152        optional_features: &[],
153    },
154    ComponentInterpretation {
155        id: "dropdown_button",
156        rendering: RenderingKind::GpuiReplica,
157        counterpart: "NSPopUpButton command menu",
158        design: "Compact command bezel, disclosure and menu alignment",
159        api: "gpui_macos::menu / gpui_macos::button",
160        capabilities: &["Separators", "disabled commands", "action callbacks"],
161        native_integrations: &[],
162        optional_features: &[],
163    },
164    ComponentInterpretation {
165        id: "link",
166        rendering: RenderingKind::MacInterpretation,
167        counterpart: "macOS linked text and URL action",
168        design: "System accent text with focus and pointer feedback",
169        api: "gpui_macos::link",
170        capabilities: &["URL opening", "keyboard activation", "disabled state"],
171        native_integrations: &[],
172        optional_features: &[],
173    },
174    ComponentInterpretation {
175        id: "toggle",
176        rendering: RenderingKind::GpuiReplica,
177        counterpart: "NSButton toggle mode",
178        design: "Retained selected bezel, compact spacing and focus ring",
179        api: "gpui_macos::toggle",
180        capabilities: &[
181            "Controlled selection",
182            "keyboard activation",
183            "disabled state",
184        ],
185        native_integrations: &[],
186        optional_features: &[],
187    },
188    ComponentInterpretation {
189        id: "toggle_group",
190        rendering: RenderingKind::GpuiReplica,
191        counterpart: "NSSegmentedControl multiple-selection mode",
192        design: "Joined command segments with independent selection",
193        api: "gpui_macos::toggle_group",
194        capabilities: &[
195            "Multiple selection",
196            "disabled commands",
197            "keyboard traversal",
198        ],
199        native_integrations: &[],
200        optional_features: &[],
201    },
202    ComponentInterpretation {
203        id: "clipboard",
204        rendering: RenderingKind::MacInterpretation,
205        counterpart: "Copy command with inline confirmation",
206        design: "Compact SF copy symbol and temporary success feedback",
207        api: "gpui_macos::kit::clipboard::Clipboard",
208        capabilities: &[
209            "System clipboard",
210            "value ownership",
211            "accessible activation",
212        ],
213        native_integrations: &[NativeIntegration::Clipboard],
214        optional_features: &[],
215    },
216    ComponentInterpretation {
217        id: "command",
218        rendering: RenderingKind::MacInterpretation,
219        counterpart: "Spotlight-style command search",
220        design: "Searchable compact command list with sections and shortcuts",
221        api: "gpui_macos::kit::command::Command",
222        capabilities: &[
223            "Filtering",
224            "grouped commands",
225            "disabled entries",
226            "Enter confirmation",
227        ],
228        native_integrations: &[],
229        optional_features: &[],
230    },
231    ComponentInterpretation {
232        id: "input",
233        rendering: RenderingKind::GpuiReplica,
234        counterpart: "NSTextField",
235        design: "24-point inset content well and native label density",
236        api: "gpui_macos::input",
237        capabilities: &[
238            "Selection",
239            "undo and redo",
240            "clipboard",
241            "IME",
242            "validation",
243        ],
244        native_integrations: &[NativeIntegration::InputMethod, NativeIntegration::Clipboard],
245        optional_features: &[],
246    },
247    ComponentInterpretation {
248        id: "textarea",
249        rendering: RenderingKind::GpuiReplica,
250        counterpart: "NSTextView",
251        design: "Multiline content well with ordinary document typography",
252        api: "gpui_macos::textarea",
253        capabilities: &[
254            "Multiline editing",
255            "selection",
256            "clipboard",
257            "IME",
258            "scrolling",
259        ],
260        native_integrations: &[NativeIntegration::InputMethod, NativeIntegration::Clipboard],
261        optional_features: &[],
262    },
263    ComponentInterpretation {
264        id: "editor",
265        rendering: RenderingKind::MacInterpretation,
266        counterpart: "Xcode-style source editor",
267        design: "Monospaced editing pane, line gutters and restrained chrome",
268        api: "gpui_macos::kit::input::Editor",
269        capabilities: &[
270            "Find",
271            "multiple cursors",
272            "folding",
273            "diagnostics",
274            "optional syntax grammars",
275        ],
276        native_integrations: &[NativeIntegration::InputMethod, NativeIntegration::Clipboard],
277        optional_features: &[FeatureRequirement::TreeSitterLanguages],
278    },
279    ComponentInterpretation {
280        id: "number_input",
281        rendering: RenderingKind::GpuiReplica,
282        counterpart: "NSTextField with NSStepper",
283        design: "Compact numeric editor and increment/decrement commands",
284        api: "gpui_macos::number_input",
285        capabilities: &[
286            "Numeric editing",
287            "stepping",
288            "bounds",
289            "controlled updates",
290        ],
291        native_integrations: &[],
292        optional_features: &[],
293    },
294    ComponentInterpretation {
295        id: "input_group",
296        rendering: RenderingKind::MacInterpretation,
297        counterpart: "Composite macOS text-field accessory row",
298        design: "Field-aligned prefix, suffix and accessory commands",
299        api: "gpui_macos::kit::input::InputGroup",
300        capabilities: &[
301            "Shared editor",
302            "affixes",
303            "accessory alignment",
304            "keyboard input",
305        ],
306        native_integrations: &[NativeIntegration::InputMethod, NativeIntegration::Clipboard],
307        optional_features: &[],
308    },
309    ComponentInterpretation {
310        id: "select",
311        rendering: RenderingKind::GpuiReplica,
312        counterpart: "NSPopUpButton selection mode",
313        design: "Compact popup bezel with selected label and checkmark",
314        api: "gpui_macos::select",
315        capabilities: &[
316            "Controlled selection",
317            "grouped values",
318            "disabled options",
319            "native glass popup",
320            "opaque fallback",
321        ],
322        native_integrations: &[NativeIntegration::GlassMaterial],
323        optional_features: &[],
324    },
325    ComponentInterpretation {
326        id: "combobox",
327        rendering: RenderingKind::GpuiReplica,
328        counterpart: "NSComboBox",
329        design: "Inset search field and compact matching-value list",
330        api: "gpui_macos::combobox",
331        capabilities: &[
332            "Filtering",
333            "keyboard selection",
334            "focus",
335            "retained value",
336            "native glass popup",
337            "opaque fallback",
338        ],
339        native_integrations: &[NativeIntegration::GlassMaterial],
340        optional_features: &[],
341    },
342    ComponentInterpretation {
343        id: "calendar",
344        rendering: RenderingKind::GpuiReplica,
345        counterpart: "NSDatePicker calendar style",
346        design: "Compact calendar grid, system labels and accent date",
347        api: "gpui_macos::calendar",
348        capabilities: &[
349            "Month navigation",
350            "date selection",
351            "focus",
352            "disabled dates",
353        ],
354        native_integrations: &[],
355        optional_features: &[],
356    },
357    ComponentInterpretation {
358        id: "date_picker",
359        rendering: RenderingKind::GpuiReplica,
360        counterpart: "NSDatePicker",
361        design: "Compact date field with calendar disclosure",
362        api: "gpui_macos::date_picker",
363        capabilities: &[
364            "Retained date",
365            "date formatting",
366            "popup calendar",
367            "keyboard input",
368            "native glass calendar popup",
369            "opaque fallback",
370        ],
371        native_integrations: &[NativeIntegration::GlassMaterial],
372        optional_features: &[],
373    },
374    ComponentInterpretation {
375        id: "time_field",
376        rendering: RenderingKind::GpuiReplica,
377        counterpart: "NSDatePicker hour/minute style",
378        design: "Compact segmented time editing with native label size",
379        api: "gpui_macos::kit::time_field::TimeField",
380        capabilities: &["Time value", "segment focus", "increment and decrement"],
381        native_integrations: &[],
382        optional_features: &[],
383    },
384    ComponentInterpretation {
385        id: "color_picker",
386        rendering: RenderingKind::GpuiReplica,
387        counterpart: "NSColorWell with NSColorPanel",
388        design: "Small color well opening an editable color inspector",
389        api: "gpui_macos::color_picker",
390        capabilities: &[
391            "Hex and channel editing",
392            "commit and cancel",
393            "retained color",
394            "native glass inspector popup",
395            "opaque fallback",
396        ],
397        native_integrations: &[NativeIntegration::GlassMaterial],
398        optional_features: &[],
399    },
400    ComponentInterpretation {
401        id: "otp_input",
402        rendering: RenderingKind::MacInterpretation,
403        counterpart: "macOS verification-code entry",
404        design: "Compact aligned fields in a verification form",
405        api: "gpui_macos::otp_input",
406        capabilities: &[
407            "Digit filtering",
408            "paste distribution",
409            "completion",
410            "focus movement",
411        ],
412        native_integrations: &[],
413        optional_features: &[],
414    },
415    ComponentInterpretation {
416        id: "slider",
417        rendering: RenderingKind::GpuiReplica,
418        counterpart: "NSSlider",
419        design: "Thin track and horizontal pill thumb, with inactive colors",
420        api: "gpui_macos::slider",
421        capabilities: &[
422            "Single value",
423            "range values",
424            "keyboard changes",
425            "disabled state",
426        ],
427        native_integrations: &[],
428        optional_features: &[],
429    },
430    ComponentInterpretation {
431        id: "checkbox",
432        rendering: RenderingKind::GpuiReplica,
433        counterpart: "NSButton checkbox type",
434        design: "16-point rounded indicator and SF check/minus marks",
435        api: "gpui_macos::checkbox",
436        capabilities: &[
437            "Checked and mixed",
438            "controlled updates",
439            "disabled",
440            "keyboard activation",
441        ],
442        native_integrations: &[],
443        optional_features: &[],
444    },
445    ComponentInterpretation {
446        id: "switch",
447        rendering: RenderingKind::GpuiReplica,
448        counterpart: "NSSwitch",
449        design: "54-by-24 track, elongated thumb and activation-aware color",
450        api: "gpui_macos::switch",
451        capabilities: &[
452            "Controlled value",
453            "animated thumb",
454            "reduced motion",
455            "disabled",
456        ],
457        native_integrations: &[],
458        optional_features: &[],
459    },
460    ComponentInterpretation {
461        id: "radio",
462        rendering: RenderingKind::GpuiReplica,
463        counterpart: "NSButton radio type",
464        design: "16-point circular indicator and compact option rows",
465        api: "gpui_macos::radio",
466        capabilities: &[
467            "Exclusive selection",
468            "arrow navigation",
469            "focus",
470            "disabled",
471        ],
472        native_integrations: &[],
473        optional_features: &[],
474    },
475    ComponentInterpretation {
476        id: "form",
477        rendering: RenderingKind::MacInterpretation,
478        counterpart: "System Settings editable preference group",
479        design: "Aligned labels, secondary help and trailing save action",
480        api: "gpui_macos::interpretation::form / gpui_macos::kit::form::Form",
481        capabilities: &[
482            "Fields",
483            "validation ownership",
484            "horizontal and multicolumn layout",
485            "submission",
486        ],
487        native_integrations: &[],
488        optional_features: &[],
489    },
490    ComponentInterpretation {
491        id: "questionnaire",
492        rendering: RenderingKind::MacInterpretation,
493        counterpart: "Setup Assistant guided preferences",
494        design: "Quiet grouped radio rows, progress and Back/Continue actions",
495        api: "gpui_macos::interpretation::questionnaire / gpui_macos::kit::questionnaire::*",
496        capabilities: &[
497            "Retained answers",
498            "validation",
499            "shortcuts",
500            "previous/next",
501            "submission",
502        ],
503        native_integrations: &[],
504        optional_features: &[],
505    },
506    ComponentInterpretation {
507        id: "stepper",
508        rendering: RenderingKind::MacInterpretation,
509        counterpart: "Setup Assistant stage navigation",
510        design: "Compact stages with current-step emphasis",
511        api: "gpui_macos::kit::stepper::Stepper",
512        capabilities: &["Selected stage", "pointer and keyboard stage activation"],
513        native_integrations: &[],
514        optional_features: &[],
515    },
516    ComponentInterpretation {
517        id: "search_field",
518        rendering: RenderingKind::GpuiReplica,
519        counterpart: "NSSearchField",
520        design: "Inset field with SF magnifier and native editing density",
521        api: "gpui_macos::search_field",
522        capabilities: &["Search text", "selection", "undo", "clipboard", "IME"],
523        native_integrations: &[NativeIntegration::InputMethod, NativeIntegration::Clipboard],
524        optional_features: &[],
525    },
526    ComponentInterpretation {
527        id: "secure_field",
528        rendering: RenderingKind::GpuiReplica,
529        counterpart: "NSSecureTextField",
530        design: "Inset field with masked display and secure copy behavior",
531        api: "gpui_macos::secure_field",
532        capabilities: &[
533            "Masked editing",
534            "secure clipboard policy",
535            "IME",
536            "retained value",
537        ],
538        native_integrations: &[NativeIntegration::InputMethod],
539        optional_features: &[],
540    },
541    ComponentInterpretation {
542        id: "menu",
543        rendering: RenderingKind::GpuiReplica,
544        counterpart: "NSMenu",
545        design: "Compact command rows, checks, separators and submenus",
546        api: "gpui_macos::menu / gpui_macos::kit::native_menu::NativeMenu",
547        capabilities: &[
548            "GPUI command foreground",
549            "full native-menu API",
550            "disabled commands",
551            "shortcuts",
552            "separate native glass submenu panels",
553            "owner-window command dispatch",
554            "opaque fallback",
555        ],
556        native_integrations: &[NativeIntegration::GlassMaterial],
557        optional_features: &[],
558    },
559    ComponentInterpretation {
560        id: "tabs",
561        rendering: RenderingKind::GpuiReplica,
562        counterpart: "NSTabView with segmented tab selector",
563        design: "Compact joined tab labels above retained content",
564        api: "gpui_macos::tabs / gpui_macos::tab_list",
565        capabilities: &["Controlled tab", "keyboard traversal", "disabled tabs"],
566        native_integrations: &[],
567        optional_features: &[],
568    },
569    ComponentInterpretation {
570        id: "accordion",
571        rendering: RenderingKind::MacInterpretation,
572        counterpart: "macOS disclosure preference sections",
573        design: "Disclosure symbol and plain expandable content rows",
574        api: "gpui_macos::accordion",
575        capabilities: &[
576            "Open state",
577            "exclusive or multiple expansion",
578            "keyboard activation",
579        ],
580        native_integrations: &[],
581        optional_features: &[],
582    },
583    ComponentInterpretation {
584        id: "collapsible",
585        rendering: RenderingKind::MacInterpretation,
586        counterpart: "macOS disclosure group",
587        design: "Quiet disclosure row with measured expansion",
588        api: "gpui_macos::collapsible",
589        capabilities: &["Retained open state", "accessible expansion", "animation"],
590        native_integrations: &[],
591        optional_features: &[],
592    },
593    ComponentInterpretation {
594        id: "nav_stack",
595        rendering: RenderingKind::MacInterpretation,
596        counterpart: "macOS drill-down navigation",
597        design: "Back/Forward commands and retained detail panes",
598        api: "gpui_macos::nav_stack",
599        capabilities: &[
600            "Push and pop",
601            "forward history",
602            "retained page state",
603            "motion",
604        ],
605        native_integrations: &[],
606        optional_features: &[],
607    },
608    ComponentInterpretation {
609        id: "pagination",
610        rendering: RenderingKind::MacInterpretation,
611        counterpart: "macOS paged document navigation",
612        design: "Compact previous/next controls and current-page label",
613        api: "gpui_macos::pagination",
614        capabilities: &[
615            "Controlled page",
616            "disabled boundaries",
617            "keyboard activation",
618        ],
619        native_integrations: &[],
620        optional_features: &[],
621    },
622    ComponentInterpretation {
623        id: "breadcrumb",
624        rendering: RenderingKind::MacInterpretation,
625        counterpart: "Finder-style path navigation",
626        design: "Compact path segments and disclosure separators",
627        api: "gpui_macos::kit::breadcrumb::Breadcrumb",
628        capabilities: &[
629            "Clickable ancestors",
630            "disabled current location",
631            "overflow composition",
632        ],
633        native_integrations: &[],
634        optional_features: &[],
635    },
636    ComponentInterpretation {
637        id: "sidebar",
638        rendering: RenderingKind::AppKitBacked,
639        counterpart: "NSOutlineView-style source list on NSGlassEffectView",
640        design: "Edge-aligned glass source list with semibold selected labels",
641        api: "gpui_macos::sidebar / gpui_macos::sidebar_item",
642        capabilities: &[
643            "Selection",
644            "keyboard traversal",
645            "native glass",
646            "deterministic fallback",
647        ],
648        native_integrations: &[
649            NativeIntegration::GlassMaterial,
650            NativeIntegration::SfSymbols,
651        ],
652        optional_features: &[],
653    },
654    ComponentInterpretation {
655        id: "sheet",
656        rendering: RenderingKind::GpuiReplica,
657        counterpart: "NSWindow sheet presentation",
658        design: "Attached task pane with content, actions and focus containment",
659        api: "gpui_macos::sheet",
660        capabilities: &[
661            "Open and close",
662            "Escape",
663            "focus trap",
664            "trigger restoration",
665        ],
666        native_integrations: &[],
667        optional_features: &[],
668    },
669    ComponentInterpretation {
670        id: "dialog",
671        rendering: RenderingKind::GpuiReplica,
672        counterpart: "NSPanel task dialog",
673        design: "Compact modal task layout with trailing actions",
674        api: "gpui_macos::dialog",
675        capabilities: &[
676            "Controlled open state",
677            "focus trap",
678            "Escape",
679            "trigger restoration",
680        ],
681        native_integrations: &[],
682        optional_features: &[],
683    },
684    ComponentInterpretation {
685        id: "alert_dialog",
686        rendering: RenderingKind::GpuiReplica,
687        counterpart: "NSAlert",
688        design: "Clear warning hierarchy and safe default action",
689        api: "gpui_macos::alert_dialog",
690        capabilities: &["Destructive confirmation", "cancellation", "keyboard focus"],
691        native_integrations: &[],
692        optional_features: &[],
693    },
694    ComponentInterpretation {
695        id: "popover",
696        rendering: RenderingKind::GpuiReplica,
697        counterpart: "NSPopover",
698        design: "Compact anchored content well with rounded edges",
699        api: "gpui_macos::popover",
700        capabilities: &[
701            "Anchor placement",
702            "outside dismiss",
703            "focus",
704            "collision handling",
705            "native glass foreground panel",
706            "opaque fallback",
707        ],
708        native_integrations: &[NativeIntegration::GlassMaterial],
709        optional_features: &[],
710    },
711    ComponentInterpretation {
712        id: "tooltip",
713        rendering: RenderingKind::GpuiReplica,
714        counterpart: "NSView toolTip",
715        design: "Small supplementary label with delayed appearance",
716        api: "gpui_macos::tooltip",
717        capabilities: &["Hover and focus", "delay", "placement", "accessible label"],
718        native_integrations: &[],
719        optional_features: &[],
720    },
721    ComponentInterpretation {
722        id: "hover_card",
723        rendering: RenderingKind::MacInterpretation,
724        counterpart: "macOS contextual preview popover",
725        design: "Compact preview content with secondary metadata",
726        api: "gpui_macos::hover_card",
727        capabilities: &[
728            "Delayed hover",
729            "focus retention",
730            "dismiss and placement",
731            "native glass preview panel",
732            "opaque fallback",
733        ],
734        native_integrations: &[NativeIntegration::GlassMaterial],
735        optional_features: &[],
736    },
737    ComponentInterpretation {
738        id: "toast",
739        rendering: RenderingKind::MacInterpretation,
740        counterpart: "macOS transient in-app status",
741        design: "Compact status row with symbol, text and optional undo",
742        api: "gpui_macos::toast / gpui_kit::base::ToastManager",
743        capabilities: &[
744            "Independent messages",
745            "timeout",
746            "pause on hover/focus",
747            "actions",
748        ],
749        native_integrations: &[],
750        optional_features: &[],
751    },
752    ComponentInterpretation {
753        id: "notification",
754        rendering: RenderingKind::MacInterpretation,
755        counterpart: "macOS in-app notification banner",
756        design: "Compact semantic notification with close and optional action",
757        api: "gpui_macos::kit::notification::Notification",
758        capabilities: &["Success/warning/error", "stacking", "dismissal", "timeout"],
759        native_integrations: &[],
760        optional_features: &[],
761    },
762    ComponentInterpretation {
763        id: "icon",
764        rendering: RenderingKind::AppKitBacked,
765        counterpart: "NSImage system symbols",
766        design: "Host SF geometry, optical weight and inherited template color",
767        api: "gpui_macos::icon",
768        capabilities: &["SF lookup", "tint", "cached masks", "full Lucide fallback"],
769        native_integrations: &[NativeIntegration::SfSymbols],
770        optional_features: &[],
771    },
772    ComponentInterpretation {
773        id: "avatar",
774        rendering: RenderingKind::MacInterpretation,
775        counterpart: "macOS account/contact image",
776        design: "Small circular contact image with initials fallback",
777        api: "gpui_macos::avatar",
778        capabilities: &["Image content", "initials", "loading fallback", "sizing"],
779        native_integrations: &[],
780        optional_features: &[],
781    },
782    ComponentInterpretation {
783        id: "text_view",
784        rendering: RenderingKind::GpuiReplica,
785        counterpart: "NSTextView document presentation",
786        design: "Readable document typography and restrained link styling",
787        api: "gpui_macos::markdown / gpui_macos::html",
788        capabilities: &["HTML and Markdown", "selection", "links", "text layout"],
789        native_integrations: &[],
790        optional_features: &[],
791    },
792    ComponentInterpretation {
793        id: "label",
794        rendering: RenderingKind::MacInterpretation,
795        counterpart: "macOS primary and secondary labels",
796        design: "13-point primary text and semantic secondary help",
797        api: "gpui_macos::kit::label::Label",
798        capabilities: &[
799            "Highlights",
800            "masking",
801            "secondary text",
802            "content composition",
803        ],
804        native_integrations: &[],
805        optional_features: &[],
806    },
807    ComponentInterpretation {
808        id: "panel",
809        rendering: RenderingKind::MacInterpretation,
810        counterpart: "macOS grouped content section",
811        design: "Quiet section heading and natural-height content",
812        api: "gpui_macos::panel",
813        capabilities: &[
814            "Heading",
815            "content",
816            "configurable layout",
817            "grouped controls",
818        ],
819        native_integrations: &[],
820        optional_features: &[],
821    },
822    ComponentInterpretation {
823        id: "group_box",
824        rendering: RenderingKind::GpuiReplica,
825        counterpart: "NSBox",
826        design: "Quiet filled or outlined group with an overlapping title",
827        api: "gpui_macos::kit::group_box::GroupBox",
828        capabilities: &[
829            "Title",
830            "footer",
831            "filled/outlined variants",
832            "arbitrary content",
833        ],
834        native_integrations: &[],
835        optional_features: &[],
836    },
837    ComponentInterpretation {
838        id: "description_list",
839        rendering: RenderingKind::MacInterpretation,
840        counterpart: "Finder Get Info property rows",
841        design: "Aligned secondary labels and primary values",
842        api: "gpui_macos::interpretation::description_list / gpui_macos::kit::description_list::DescriptionList",
843        capabilities: &[
844            "Horizontal/vertical",
845            "columns",
846            "spans",
847            "structured values",
848        ],
849        native_integrations: &[],
850        optional_features: &[],
851    },
852    ComponentInterpretation {
853        id: "list",
854        rendering: RenderingKind::GpuiReplica,
855        counterpart: "NSTableView single-column list",
856        design: "Flat selectable rows with SF file symbols",
857        api: "gpui_macos::kit::list::ListItem",
858        capabilities: &["Selection", "pointer callbacks", "custom row content"],
859        native_integrations: &[],
860        optional_features: &[],
861    },
862    ComponentInterpretation {
863        id: "virtual_list",
864        rendering: RenderingKind::GpuiReplica,
865        counterpart: "NSTableView virtualized source rows",
866        design: "Compact lazy rows measured at the current zoom",
867        api: "gpui_macos::virtual_list",
868        capabilities: &[
869            "Virtualization",
870            "scroll handle",
871            "visible range",
872            "retained selection",
873        ],
874        native_integrations: &[],
875        optional_features: &[],
876    },
877    ComponentInterpretation {
878        id: "scrollbar",
879        rendering: RenderingKind::GpuiReplica,
880        counterpart: "NSScroller",
881        design: "Thin overlay scroller with native density",
882        api: "gpui_macos::scrollbar",
883        capabilities: &["Horizontal and vertical", "scroll position", "hover/drag"],
884        native_integrations: &[],
885        optional_features: &[],
886    },
887    ComponentInterpretation {
888        id: "scrollable",
889        rendering: RenderingKind::GpuiReplica,
890        counterpart: "NSScrollView",
891        design: "Bounded document pane with ordinary row separators",
892        api: "gpui_kit::StatefulInteractiveElement",
893        capabilities: &[
894            "Overflow",
895            "wheel and trackpad",
896            "scroll position",
897            "clipping",
898        ],
899        native_integrations: &[],
900        optional_features: &[],
901    },
902    ComponentInterpretation {
903        id: "table",
904        rendering: RenderingKind::GpuiReplica,
905        counterpart: "NSTableView",
906        design: "Compact header labels and alternating document rows",
907        api: "gpui_macos::table",
908        capabilities: &["Headers", "cells", "selection", "custom rendering"],
909        native_integrations: &[],
910        optional_features: &[],
911    },
912    ComponentInterpretation {
913        id: "data_table",
914        rendering: RenderingKind::GpuiReplica,
915        counterpart: "NSTableView sortable data view",
916        design: "Compact sortable headers, document metadata and row stripes",
917        api: "gpui_macos::kit::table::DataTable",
918        capabilities: &[
919            "Virtual rows",
920            "selection",
921            "column sorting",
922            "resizing",
923            "delegate callbacks",
924        ],
925        native_integrations: &[],
926        optional_features: &[],
927    },
928    ComponentInterpretation {
929        id: "tree",
930        rendering: RenderingKind::GpuiReplica,
931        counterpart: "NSOutlineView",
932        design: "Indented disclosure rows with compact selection",
933        api: "gpui_macos::tree",
934        capabilities: &[
935            "Expand/collapse",
936            "hierarchy",
937            "selection",
938            "keyboard traversal",
939        ],
940        native_integrations: &[],
941        optional_features: &[],
942    },
943    ComponentInterpretation {
944        id: "resizable",
945        rendering: RenderingKind::GpuiReplica,
946        counterpart: "NSSplitView",
947        design: "Thin divider separating ordinary desktop panes",
948        api: "gpui_macos::resizable",
949        capabilities: &[
950            "Drag resize",
951            "minimum sizes",
952            "orientation",
953            "retained state",
954        ],
955        native_integrations: &[],
956        optional_features: &[],
957    },
958    ComponentInterpretation {
959        id: "dock",
960        rendering: RenderingKind::MacInterpretation,
961        counterpart: "Xcode-style docked workbench",
962        design: "Pane titles, compact tabs and resizable tool/content regions",
963        api: "gpui_macos::dock_area",
964        capabilities: &[
965            "Dock layout",
966            "tabs",
967            "split panes",
968            "serialization",
969            "panel state",
970        ],
971        native_integrations: &[],
972        optional_features: &[],
973    },
974    ComponentInterpretation {
975        id: "separator",
976        rendering: RenderingKind::GpuiReplica,
977        counterpart: "NSBox separator type",
978        design: "One-pixel semantic divider between related content",
979        api: "gpui_macos::separator",
980        capabilities: &[
981            "Horizontal and vertical",
982            "semantic color",
983            "zoom-safe hairline",
984        ],
985        native_integrations: &[],
986        optional_features: &[],
987    },
988    ComponentInterpretation {
989        id: "keycap",
990        rendering: RenderingKind::MacInterpretation,
991        counterpart: "macOS keyboard shortcut annotation",
992        design: "Compact system key names and unobtrusive key bezel",
993        api: "gpui_macos::keycap",
994        capabilities: &[
995            "Modifier symbols",
996            "key combinations",
997            "readable command hints",
998        ],
999        native_integrations: &[],
1000        optional_features: &[],
1001    },
1002    ComponentInterpretation {
1003        id: "badge",
1004        rendering: RenderingKind::MacInterpretation,
1005        counterpart: "macOS compact status annotation",
1006        design: "Small semantic capsule with system label density",
1007        api: "gpui_macos::badge",
1008        capabilities: &["Status variants", "color", "text", "sizing"],
1009        native_integrations: &[],
1010        optional_features: &[],
1011    },
1012    ComponentInterpretation {
1013        id: "tag",
1014        rendering: RenderingKind::MacInterpretation,
1015        counterpart: "Finder-style document tag",
1016        design: "Compact semantic document label with restrained outline",
1017        api: "gpui_macos::kit::tag::Tag",
1018        capabilities: &["Semantic variants", "outline", "custom content"],
1019        native_integrations: &[],
1020        optional_features: &[],
1021    },
1022    ComponentInterpretation {
1023        id: "alert",
1024        rendering: RenderingKind::MacInterpretation,
1025        counterpart: "macOS inline validation/status message",
1026        design: "Compact symbol, explanation and semantic accent",
1027        api: "gpui_macos::alert",
1028        capabilities: &["Status variants", "inline content", "custom actions"],
1029        native_integrations: &[],
1030        optional_features: &[],
1031    },
1032    ComponentInterpretation {
1033        id: "empty_state",
1034        rendering: RenderingKind::MacInterpretation,
1035        counterpart: "macOS empty document/library pane",
1036        design: "Centered SF symbol, short explanation and optional command",
1037        api: "gpui_macos::empty_state",
1038        capabilities: &["Empty content", "primary action", "layout customization"],
1039        native_integrations: &[],
1040        optional_features: &[],
1041    },
1042    ComponentInterpretation {
1043        id: "progress",
1044        rendering: RenderingKind::GpuiReplica,
1045        counterpart: "NSProgressIndicator bar style",
1046        design: "Thin activation-aware track and progress fill",
1047        api: "gpui_macos::progress",
1048        capabilities: &["Controlled progress", "bounds", "semantic status"],
1049        native_integrations: &[],
1050        optional_features: &[],
1051    },
1052    ComponentInterpretation {
1053        id: "spinner",
1054        rendering: RenderingKind::AppKitBacked,
1055        counterpart: "NSImage progress.indicator with GPUI animation",
1056        design: "Host radial artwork, system tint and linear activity motion",
1057        api: "gpui_macos::native_spinner / kit::spinner::Spinner",
1058        capabilities: &[
1059            "Size",
1060            "color",
1061            "easing",
1062            "custom artwork",
1063            "reduced motion",
1064        ],
1065        native_integrations: &[NativeIntegration::SfSymbols],
1066        optional_features: &[],
1067    },
1068    ComponentInterpretation {
1069        id: "skeleton",
1070        rendering: RenderingKind::MacInterpretation,
1071        counterpart: "macOS loading content placeholders",
1072        design: "Quiet neutral blocks matching the eventual document rows",
1073        api: "gpui_macos::kit::skeleton::Skeleton",
1074        capabilities: &["Shapes", "primary/secondary placeholders", "reduced motion"],
1075        native_integrations: &[],
1076        optional_features: &[],
1077    },
1078    ComponentInterpretation {
1079        id: "shimmer",
1080        rendering: RenderingKind::MacInterpretation,
1081        counterpart: "macOS subtle loading text",
1082        design: "Secondary text with restrained animated emphasis",
1083        api: "gpui_macos::kit::shimmer::ShimmerText",
1084        capabilities: &["Text content", "tint", "animation", "reduced motion"],
1085        native_integrations: &[],
1086        optional_features: &[],
1087    },
1088    ComponentInterpretation {
1089        id: "rating",
1090        rendering: RenderingKind::GpuiReplica,
1091        counterpart: "NSLevelIndicator rating style",
1092        design: "Compact SF star row with a retained score",
1093        api: "gpui_macos::kit::rating::Rating",
1094        capabilities: &[
1095            "Editable rating",
1096            "read-only rating",
1097            "disabled",
1098            "size and color",
1099        ],
1100        native_integrations: &[],
1101        optional_features: &[],
1102    },
1103    ComponentInterpretation {
1104        id: "carousel",
1105        rendering: RenderingKind::MacInterpretation,
1106        counterpart: "Quick Look document preview navigation",
1107        design: "Document thumbnails, filename metadata and compact previous/next controls",
1108        api: "gpui_macos::interpretation::carousel / gpui_macos::kit::carousel::*",
1109        capabilities: &[
1110            "Retained selection",
1111            "arrows",
1112            "pagination",
1113            "keyboard",
1114            "reduced motion",
1115        ],
1116        native_integrations: &[],
1117        optional_features: &[],
1118    },
1119    ComponentInterpretation {
1120        id: "image",
1121        rendering: RenderingKind::GpuiReplica,
1122        counterpart: "NSImageView",
1123        design: "Actual document illustrations in bounded image previews",
1124        api: "gpui_kit::img",
1125        capabilities: &[
1126            "Asset/local/remote sources",
1127            "contain/cover",
1128            "loading and fallback",
1129        ],
1130        native_integrations: &[],
1131        optional_features: &[],
1132    },
1133    ComponentInterpretation {
1134        id: "diff",
1135        rendering: RenderingKind::MacInterpretation,
1136        counterpart: "Xcode-style source comparison",
1137        design: "Monospaced code panes and compact comparison-mode command",
1138        api: "gpui_macos::kit::diff::Diff",
1139        capabilities: &[
1140            "Unified/split modes",
1141            "file hunks",
1142            "synchronized scroll",
1143            "source styles",
1144        ],
1145        native_integrations: &[],
1146        optional_features: &[FeatureRequirement::TreeSitterLanguages],
1147    },
1148    ComponentInterpretation {
1149        id: "message",
1150        rendering: RenderingKind::MacInterpretation,
1151        counterpart: "Messages-style conversation row",
1152        design: "Compact contact label, aligned bubble and delivery metadata",
1153        api: "gpui_macos::interpretation::message / gpui_macos::kit::message::*",
1154        capabilities: &[
1155            "Avatar/header/content/footer slots",
1156            "alignment",
1157            "accessible identity",
1158        ],
1159        native_integrations: &[],
1160        optional_features: &[],
1161    },
1162    ComponentInterpretation {
1163        id: "bubble",
1164        rendering: RenderingKind::MacInterpretation,
1165        counterpart: "Messages-style conversation surface",
1166        design: "Neutral incoming and accent outgoing bubbles with compact typography",
1167        api: "gpui_macos::interpretation::bubble_content / gpui_macos::kit::bubble::*",
1168        capabilities: &[
1169            "Variants",
1170            "alignment",
1171            "rich content",
1172            "reactions",
1173            "grouped bubbles",
1174        ],
1175        native_integrations: &[],
1176        optional_features: &[],
1177    },
1178    ComponentInterpretation {
1179        id: "marker",
1180        rendering: RenderingKind::MacInterpretation,
1181        counterpart: "Conversation date and activity separator",
1182        design: "Centered secondary timestamp or compact activity label",
1183        api: "gpui_macos::kit::marker::Marker",
1184        capabilities: &["Text markers", "loading marker", "arbitrary content"],
1185        native_integrations: &[],
1186        optional_features: &[],
1187    },
1188    ComponentInterpretation {
1189        id: "attachment",
1190        rendering: RenderingKind::MacInterpretation,
1191        counterpart: "Mail-style attached document row",
1192        design: "SF file symbol, filename, size and trailing retry/remove commands",
1193        api: "gpui_macos::interpretation::attachment / gpui_macos::kit::attachment::*",
1194        capabilities: &[
1195            "Pending/success/error",
1196            "media",
1197            "retry",
1198            "remove",
1199            "action slots",
1200        ],
1201        native_integrations: &[],
1202        optional_features: &[],
1203    },
1204    ComponentInterpretation {
1205        id: "message_scroller",
1206        rendering: RenderingKind::MacInterpretation,
1207        counterpart: "Messages-style retained transcript",
1208        design: "Bounded virtual conversation pane that follows new messages",
1209        api: "gpui_macos::kit::message_scroller::MessageScroller",
1210        capabilities: &[
1211            "Virtualization",
1212            "append/prepend",
1213            "jump to bottom",
1214            "retained scroll",
1215        ],
1216        native_integrations: &[],
1217        optional_features: &[],
1218    },
1219    ComponentInterpretation {
1220        id: "speech",
1221        rendering: RenderingKind::MacInterpretation,
1222        counterpart: "macOS dictation command and level feedback",
1223        design: "Compact microphone command and waveform in a transcript pane",
1224        api: "gpui_macos::kit::speech::{SpeechButton, SpeechWaveform}",
1225        capabilities: &[
1226            "System recognition",
1227            "partial/final text",
1228            "errors",
1229            "supported/disabled state",
1230        ],
1231        native_integrations: &[NativeIntegration::SpeechRecognizer],
1232        optional_features: &[FeatureRequirement::Speech],
1233    },
1234    ComponentInterpretation {
1235        id: "title_bar",
1236        rendering: RenderingKind::GpuiReplica,
1237        counterpart: "NSWindow titlebar and traffic-light controls",
1238        design: "Clear current-view title with space for real system window controls",
1239        api: "gpui_macos::title_bar / gpui_macos::native_window_options / gpui_macos::window_options",
1240        capabilities: &[
1241            "Drag region",
1242            "native traffic lights",
1243            "custom title content",
1244        ],
1245        native_integrations: &[NativeIntegration::WindowChrome],
1246        optional_features: &[],
1247    },
1248    ComponentInterpretation {
1249        id: "toolbar",
1250        rendering: RenderingKind::AppKitBacked,
1251        counterpart: "NSToolbar",
1252        design: "Unified AppKit commands and search, with a composable GPUI fallback",
1253        api: "gpui_macos::toolbar / gpui_macos::toolbar_group / gpui_macos::toolbar_button / gpui_macos::native_toolbar_group / gpui_macos::native::install_native_toolbar",
1254        capabilities: &[
1255            "Native commands",
1256            "native search",
1257            "enable state",
1258            "title updates",
1259            "canvas groups",
1260        ],
1261        native_integrations: &[
1262            NativeIntegration::UnifiedToolbar,
1263            NativeIntegration::SfSymbols,
1264        ],
1265        optional_features: &[],
1266    },
1267    ComponentInterpretation {
1268        id: "status_bar",
1269        rendering: RenderingKind::MacInterpretation,
1270        counterpart: "Finder-style document status row",
1271        design: "Small secondary status labels at the bottom of the content",
1272        api: "gpui_macos::status_bar",
1273        capabilities: &["Leading/trailing content", "selection count", "saved state"],
1274        native_integrations: &[],
1275        optional_features: &[],
1276    },
1277    ComponentInterpretation {
1278        id: "settings",
1279        rendering: RenderingKind::MacInterpretation,
1280        counterpart: "System Settings grouped preferences",
1281        design: "Natural-height gray groups and aligned labeled control rows",
1282        api: "gpui_macos::settings_group / gpui_macos::settings_row",
1283        capabilities: &[
1284            "Editable values",
1285            "help text",
1286            "live updates",
1287            "save actions",
1288        ],
1289        native_integrations: &[],
1290        optional_features: &[],
1291    },
1292    ComponentInterpretation {
1293        id: "inspector",
1294        rendering: RenderingKind::MacInterpretation,
1295        counterpart: "Finder Get Info/Xcode inspector pane",
1296        design: "Narrow property pane with secondary labels and editable values",
1297        api: "gpui_macos::inspector",
1298        capabilities: &["Property rows", "editable content", "debug inspection API"],
1299        native_integrations: &[],
1300        optional_features: &[],
1301    },
1302    ComponentInterpretation {
1303        id: "inset_list",
1304        rendering: RenderingKind::MacInterpretation,
1305        counterpart: "System Settings inset navigation rows",
1306        design: "Quiet inset source rows with trailing disclosure",
1307        api: "gpui_macos::inset_list / gpui_macos::inset_list_row",
1308        capabilities: &[
1309            "Selectable rows",
1310            "custom controls",
1311            "disclosure",
1312            "callbacks",
1313        ],
1314        native_integrations: &[],
1315        optional_features: &[],
1316    },
1317    ComponentInterpretation {
1318        id: "material",
1319        rendering: RenderingKind::AppKitBacked,
1320        counterpart: "NSGlassEffectView navigation material",
1321        design: "Opt-in native system material plus deterministic canvas fills",
1322        api: "gpui_macos::material / gpui_macos::native_material / gpui_macos::native::open_glass_panel",
1323        capabilities: &[
1324            "Native underlay",
1325            "separate system glass foreground panels",
1326            "semantic roles",
1327            "tint",
1328            "clipping",
1329            "accessibility fallback",
1330        ],
1331        native_integrations: &[NativeIntegration::GlassMaterial],
1332        optional_features: &[],
1333    },
1334    ComponentInterpretation {
1335        id: "plot",
1336        rendering: RenderingKind::MacInterpretation,
1337        counterpart: "macOS analytical chart canvas",
1338        design: "Ordinary content pane with readable axes and precise data labels",
1339        api: "gpui_macos::plot",
1340        capabilities: &["Scales", "axes", "points", "tooltip", "custom marks"],
1341        native_integrations: &[],
1342        optional_features: &[],
1343    },
1344    ComponentInterpretation {
1345        id: "line_chart",
1346        rendering: RenderingKind::MacInterpretation,
1347        counterpart: "macOS time-series chart",
1348        design: "Thin series, restrained grid and compact legend",
1349        api: "gpui_macos::LineChart",
1350        capabilities: &["Series", "scales", "axes", "points", "tooltip"],
1351        native_integrations: &[],
1352        optional_features: &[],
1353    },
1354    ComponentInterpretation {
1355        id: "bar_chart",
1356        rendering: RenderingKind::MacInterpretation,
1357        counterpart: "macOS comparison chart",
1358        design: "Clear category bars and readable baseline labels",
1359        api: "gpui_macos::BarChart",
1360        capabilities: &["Categories", "multiple series", "axes", "tooltip"],
1361        native_integrations: &[],
1362        optional_features: &[],
1363    },
1364    ComponentInterpretation {
1365        id: "area_chart",
1366        rendering: RenderingKind::MacInterpretation,
1367        counterpart: "macOS cumulative/time-series chart",
1368        design: "Translucent series fill and restrained plot chrome",
1369        api: "gpui_macos::AreaChart",
1370        capabilities: &["Multiple series", "scales", "axes", "tooltip"],
1371        native_integrations: &[],
1372        optional_features: &[],
1373    },
1374    ComponentInterpretation {
1375        id: "pie_chart",
1376        rendering: RenderingKind::MacInterpretation,
1377        counterpart: "macOS proportion chart",
1378        design: "Color-coded sectors, readable legend and proportion labels",
1379        api: "gpui_macos::PieChart",
1380        capabilities: &["Values", "sectors", "colors", "tooltip"],
1381        native_integrations: &[],
1382        optional_features: &[],
1383    },
1384    ComponentInterpretation {
1385        id: "radar_chart",
1386        rendering: RenderingKind::MacInterpretation,
1387        counterpart: "macOS multi-attribute chart",
1388        design: "Restrained radial grid and labeled attribute axes",
1389        api: "gpui_macos::RadarChart",
1390        capabilities: &["Multiple series", "attributes", "scales", "tooltip"],
1391        native_integrations: &[],
1392        optional_features: &[],
1393    },
1394    ComponentInterpretation {
1395        id: "candlestick_chart",
1396        rendering: RenderingKind::MacInterpretation,
1397        counterpart: "macOS financial chart",
1398        design: "Precise open/high/low/close marks with readable axes",
1399        api: "gpui_macos::CandlestickChart",
1400        capabilities: &[
1401            "OHLC values",
1402            "time scale",
1403            "rising/falling colors",
1404            "tooltip",
1405        ],
1406        native_integrations: &[],
1407        optional_features: &[],
1408    },
1409    ComponentInterpretation {
1410        id: "sankey_chart",
1411        rendering: RenderingKind::MacInterpretation,
1412        counterpart: "macOS flow-analysis chart",
1413        design: "Readable node labels and restrained weighted links",
1414        api: "gpui_macos::SankeyChart",
1415        capabilities: &["Nodes", "links", "flow widths", "colors", "tooltip"],
1416        native_integrations: &[],
1417        optional_features: &[],
1418    },
1419];
1420pub const MODULE_COVERAGE: &[ModuleCoverage] = &[
1421    ModuleCoverage {
1422        module: "global_state",
1423        pages: &["root"],
1424        role: "Window-level overlay and interaction coordination",
1425    },
1426    ModuleCoverage {
1427        module: "accordion",
1428        pages: &["accordion"],
1429        role: "Full public Kit module and its macOS catalog presentation",
1430    },
1431    ModuleCoverage {
1432        module: "alert",
1433        pages: &["alert"],
1434        role: "Full public Kit module and its macOS catalog presentation",
1435    },
1436    ModuleCoverage {
1437        module: "attachment",
1438        pages: &["attachment"],
1439        role: "Full public Kit module and its macOS catalog presentation",
1440    },
1441    ModuleCoverage {
1442        module: "avatar",
1443        pages: &["avatar"],
1444        role: "Full public Kit module and its macOS catalog presentation",
1445    },
1446    ModuleCoverage {
1447        module: "badge",
1448        pages: &["badge"],
1449        role: "Full public Kit module and its macOS catalog presentation",
1450    },
1451    ModuleCoverage {
1452        module: "breadcrumb",
1453        pages: &["breadcrumb"],
1454        role: "Full public Kit module and its macOS catalog presentation",
1455    },
1456    ModuleCoverage {
1457        module: "bubble",
1458        pages: &["bubble"],
1459        role: "Full public Kit module and its macOS catalog presentation",
1460    },
1461    ModuleCoverage {
1462        module: "button",
1463        pages: &["button"],
1464        role: "Full public Kit module and its macOS catalog presentation",
1465    },
1466    ModuleCoverage {
1467        module: "carousel",
1468        pages: &["carousel"],
1469        role: "Full public Kit module and its macOS catalog presentation",
1470    },
1471    ModuleCoverage {
1472        module: "chart",
1473        pages: &[
1474            "line_chart",
1475            "bar_chart",
1476            "area_chart",
1477            "pie_chart",
1478            "radar_chart",
1479            "candlestick_chart",
1480            "sankey_chart",
1481        ],
1482        role: "All seven public chart families",
1483    },
1484    ModuleCoverage {
1485        module: "checkbox",
1486        pages: &["checkbox"],
1487        role: "Full public Kit module and its macOS catalog presentation",
1488    },
1489    ModuleCoverage {
1490        module: "clipboard",
1491        pages: &["clipboard"],
1492        role: "Full public Kit module and its macOS catalog presentation",
1493    },
1494    ModuleCoverage {
1495        module: "collapsible",
1496        pages: &["collapsible"],
1497        role: "Full public Kit module and its macOS catalog presentation",
1498    },
1499    ModuleCoverage {
1500        module: "color_picker",
1501        pages: &["color_picker"],
1502        role: "Full public Kit module and its macOS catalog presentation",
1503    },
1504    ModuleCoverage {
1505        module: "combobox",
1506        pages: &["combobox"],
1507        role: "Full public Kit module and its macOS catalog presentation",
1508    },
1509    ModuleCoverage {
1510        module: "command",
1511        pages: &["command"],
1512        role: "Full public Kit module and its macOS catalog presentation",
1513    },
1514    ModuleCoverage {
1515        module: "description_list",
1516        pages: &["description_list"],
1517        role: "Full public Kit module and its macOS catalog presentation",
1518    },
1519    ModuleCoverage {
1520        module: "dialog",
1521        pages: &["dialog"],
1522        role: "Full public Kit module and its macOS catalog presentation",
1523    },
1524    ModuleCoverage {
1525        module: "diff",
1526        pages: &["diff"],
1527        role: "Full public Kit module and its macOS catalog presentation",
1528    },
1529    ModuleCoverage {
1530        module: "dock",
1531        pages: &["dock"],
1532        role: "Full public Kit module and its macOS catalog presentation",
1533    },
1534    ModuleCoverage {
1535        module: "empty",
1536        pages: &["empty_state"],
1537        role: "Catalog naming alias",
1538    },
1539    ModuleCoverage {
1540        module: "form",
1541        pages: &["form"],
1542        role: "Full public Kit module and its macOS catalog presentation",
1543    },
1544    ModuleCoverage {
1545        module: "group_box",
1546        pages: &["group_box"],
1547        role: "Full public Kit module and its macOS catalog presentation",
1548    },
1549    ModuleCoverage {
1550        module: "highlighter",
1551        pages: &["editor", "diff"],
1552        role: "Diagnostics, syntax registries and optional language grammars",
1553    },
1554    ModuleCoverage {
1555        module: "history",
1556        pages: &["input", "textarea", "editor"],
1557        role: "Undo/redo state used by the editor primitives",
1558    },
1559    ModuleCoverage {
1560        module: "hover_card",
1561        pages: &["hover_card"],
1562        role: "Full public Kit module and its macOS catalog presentation",
1563    },
1564    ModuleCoverage {
1565        module: "input",
1566        pages: &["input"],
1567        role: "Full public Kit module and its macOS catalog presentation",
1568    },
1569    ModuleCoverage {
1570        module: "kbd",
1571        pages: &["keycap"],
1572        role: "Catalog naming alias",
1573    },
1574    ModuleCoverage {
1575        module: "label",
1576        pages: &["label"],
1577        role: "Full public Kit module and its macOS catalog presentation",
1578    },
1579    ModuleCoverage {
1580        module: "link",
1581        pages: &["link"],
1582        role: "Full public Kit module and its macOS catalog presentation",
1583    },
1584    ModuleCoverage {
1585        module: "list",
1586        pages: &["list"],
1587        role: "Full public Kit module and its macOS catalog presentation",
1588    },
1589    ModuleCoverage {
1590        module: "marker",
1591        pages: &["marker"],
1592        role: "Full public Kit module and its macOS catalog presentation",
1593    },
1594    ModuleCoverage {
1595        module: "menu",
1596        pages: &["menu"],
1597        role: "Full public Kit module and its macOS catalog presentation",
1598    },
1599    ModuleCoverage {
1600        module: "message",
1601        pages: &["message"],
1602        role: "Full public Kit module and its macOS catalog presentation",
1603    },
1604    ModuleCoverage {
1605        module: "message_scroller",
1606        pages: &["message_scroller"],
1607        role: "Full public Kit module and its macOS catalog presentation",
1608    },
1609    ModuleCoverage {
1610        module: "native_menu",
1611        pages: &["menu"],
1612        role: "OS-native popup menus alongside the GPUI menu replica",
1613    },
1614    ModuleCoverage {
1615        module: "notification",
1616        pages: &["notification"],
1617        role: "Full public Kit module and its macOS catalog presentation",
1618    },
1619    ModuleCoverage {
1620        module: "pagination",
1621        pages: &["pagination"],
1622        role: "Full public Kit module and its macOS catalog presentation",
1623    },
1624    ModuleCoverage {
1625        module: "plot",
1626        pages: &["plot"],
1627        role: "Full public Kit module and its macOS catalog presentation",
1628    },
1629    ModuleCoverage {
1630        module: "popover",
1631        pages: &["popover"],
1632        role: "Full public Kit module and its macOS catalog presentation",
1633    },
1634    ModuleCoverage {
1635        module: "progress",
1636        pages: &["progress"],
1637        role: "Full public Kit module and its macOS catalog presentation",
1638    },
1639    ModuleCoverage {
1640        module: "questionnaire",
1641        pages: &["questionnaire"],
1642        role: "Full public Kit module and its macOS catalog presentation",
1643    },
1644    ModuleCoverage {
1645        module: "radio",
1646        pages: &["radio"],
1647        role: "Full public Kit module and its macOS catalog presentation",
1648    },
1649    ModuleCoverage {
1650        module: "rating",
1651        pages: &["rating"],
1652        role: "Full public Kit module and its macOS catalog presentation",
1653    },
1654    ModuleCoverage {
1655        module: "resizable",
1656        pages: &["resizable"],
1657        role: "Full public Kit module and its macOS catalog presentation",
1658    },
1659    ModuleCoverage {
1660        module: "scroll",
1661        pages: &["scrollable", "scrollbar"],
1662        role: "Scroll containers, overlay scrollers and handle helpers",
1663    },
1664    ModuleCoverage {
1665        module: "searchable_list",
1666        pages: &["command", "combobox", "list"],
1667        role: "Search delegates, grouped values, filtering and keyboard selection",
1668    },
1669    ModuleCoverage {
1670        module: "select",
1671        pages: &["select"],
1672        role: "Full public Kit module and its macOS catalog presentation",
1673    },
1674    ModuleCoverage {
1675        module: "separator",
1676        pages: &["separator"],
1677        role: "Full public Kit module and its macOS catalog presentation",
1678    },
1679    ModuleCoverage {
1680        module: "setting",
1681        pages: &["settings"],
1682        role: "Grouped preference composition",
1683    },
1684    ModuleCoverage {
1685        module: "sheet",
1686        pages: &["sheet"],
1687        role: "Full public Kit module and its macOS catalog presentation",
1688    },
1689    ModuleCoverage {
1690        module: "shimmer",
1691        pages: &["shimmer"],
1692        role: "Full public Kit module and its macOS catalog presentation",
1693    },
1694    ModuleCoverage {
1695        module: "sidebar",
1696        pages: &["sidebar"],
1697        role: "Full public Kit module and its macOS catalog presentation",
1698    },
1699    ModuleCoverage {
1700        module: "skeleton",
1701        pages: &["skeleton"],
1702        role: "Full public Kit module and its macOS catalog presentation",
1703    },
1704    ModuleCoverage {
1705        module: "slider",
1706        pages: &["slider"],
1707        role: "Full public Kit module and its macOS catalog presentation",
1708    },
1709    ModuleCoverage {
1710        module: "speech",
1711        pages: &["speech"],
1712        role: "Full public Kit module and its macOS catalog presentation",
1713    },
1714    ModuleCoverage {
1715        module: "spinner",
1716        pages: &["spinner"],
1717        role: "Full public Kit module and its macOS catalog presentation",
1718    },
1719    ModuleCoverage {
1720        module: "status_bar",
1721        pages: &["status_bar"],
1722        role: "Full public Kit module and its macOS catalog presentation",
1723    },
1724    ModuleCoverage {
1725        module: "stepper",
1726        pages: &["stepper"],
1727        role: "Full public Kit module and its macOS catalog presentation",
1728    },
1729    ModuleCoverage {
1730        module: "switch",
1731        pages: &["switch"],
1732        role: "Full public Kit module and its macOS catalog presentation",
1733    },
1734    ModuleCoverage {
1735        module: "tab",
1736        pages: &["tabs"],
1737        role: "Tab controls and retained panel content",
1738    },
1739    ModuleCoverage {
1740        module: "table",
1741        pages: &["table"],
1742        role: "Full public Kit module and its macOS catalog presentation",
1743    },
1744    ModuleCoverage {
1745        module: "tag",
1746        pages: &["tag"],
1747        role: "Full public Kit module and its macOS catalog presentation",
1748    },
1749    ModuleCoverage {
1750        module: "text",
1751        pages: &["text_view", "label"],
1752        role: "Document text, labels and selectable presentation",
1753    },
1754    ModuleCoverage {
1755        module: "theme",
1756        pages: &["theme"],
1757        role: "Full public Kit module and its macOS catalog presentation",
1758    },
1759    ModuleCoverage {
1760        module: "toolbar",
1761        pages: &["toolbar"],
1762        role: "Full public Kit module and its macOS catalog presentation",
1763    },
1764    ModuleCoverage {
1765        module: "tooltip",
1766        pages: &["tooltip"],
1767        role: "Full public Kit module and its macOS catalog presentation",
1768    },
1769    ModuleCoverage {
1770        module: "tree",
1771        pages: &["tree"],
1772        role: "Full public Kit module and its macOS catalog presentation",
1773    },
1774];
1775
1776/// Look up the explicit contract for a catalog identifier.
1777pub fn interpretation(id: &str) -> Option<&'static ComponentInterpretation> {
1778    INTERPRETATIONS.iter().find(|entry| entry.id == id)
1779}
1780
1781use crate::{ActiveTheme as _, kit};
1782use gpui_kit::{
1783    App, ElementId, Entity, InteractiveElement as _, IntoElement, ParentElement as _, SharedString,
1784    StyleRefinement, Styled as _, div, relative, rems,
1785};
1786use kit::Sizable as _;
1787
1788/// A setup-assistant form retaining the complete Kit questionnaire state API.
1789pub fn questionnaire(
1790    state: &Entity<kit::questionnaire::QuestionnaireState>,
1791    cx: &App,
1792) -> kit::questionnaire::Questionnaire {
1793    kit::questionnaire::Questionnaire::new(state)
1794        .with_size(kit::Size::Small)
1795        .font_family(cx.macos().font.clone())
1796        .text_size(rems(0.8125))
1797        .gap(rems(0.875))
1798}
1799
1800/// A grouped macOS preference form with the complete Kit Field/footer API.
1801pub fn form(window: &gpui_kit::Window, cx: &App) -> kit::form::Form {
1802    kit::form::Form::horizontal()
1803        .label_width(rems(8.5).to_pixels(window.rem_size()))
1804        .label_text_size(rems(0.8125))
1805        .font_family(cx.macos().font.clone())
1806        .text_size(rems(0.8125))
1807        .bg(cx.macos().normal_fill())
1808        .rounded(rems(0.625))
1809        .p(rems(1.))
1810}
1811
1812/// Finder-style aligned property rows rather than a bordered web data grid.
1813pub fn description_list() -> kit::description_list::DescriptionList {
1814    kit::description_list::DescriptionList::horizontal()
1815        .columns(1)
1816        .label_width(rems(8.5))
1817        .bordered(false)
1818}
1819
1820/// A quiet macOS radio/checkbox row, with Kit validation, focus and shortcuts.
1821/// Custom indicator and shortcut builders remain available on the return value.
1822pub fn questionnaire_choice(
1823    state: &Entity<kit::questionnaire::QuestionnaireState>,
1824    item: impl Into<SharedString>,
1825    value: impl Into<SharedString>,
1826    cx: &App,
1827) -> kit::questionnaire::QuestionnaireChoice {
1828    let item = item.into();
1829    let value = value.into();
1830    let selector = format!("mac-questionnaire-{}-{item}-{value}", state.entity_id());
1831    let multiple = state
1832        .read(cx)
1833        .item_state(&item)
1834        .is_some_and(|item| item.is_multiple());
1835    let content = state
1836        .read(cx)
1837        .choice_definition(&item, &value)
1838        .map(|definition| {
1839            (
1840                definition.accessibility_label().clone(),
1841                definition.description().cloned(),
1842            )
1843        });
1844    kit::questionnaire::QuestionnaireChoice::new(state, item, value)
1845        // Kit uses this scale for a 16-point indicator on a 24-point answer
1846        // line. The named label below keeps the native 13-point typography.
1847        .with_size(kit::Size::Size(gpui_kit::px(16.)))
1848        .min_h(rems(1.5))
1849        .px(rems(0.))
1850        .py(rems(0.))
1851        .gap(rems(0.5))
1852        .rounded(rems(0.25))
1853        .border_0()
1854        .bg(cx.macos().background.opacity(0.))
1855        .content_style(
1856            StyleRefinement::default()
1857                .text_size(rems(0.8125))
1858                .gap(rems(0.)),
1859        )
1860        .children(content.map(|(label, description)| {
1861            div()
1862                .flex()
1863                .flex_col()
1864                .child(
1865                    div()
1866                        .text_size(rems(0.8125))
1867                        .line_height(rems(1.5))
1868                        .child(label),
1869                )
1870                .children(description.map(|description| {
1871                    div()
1872                        .text_size(rems(0.6875))
1873                        .line_height(rems(1.))
1874                        .text_color(cx.macos().secondary)
1875                        .child(description)
1876                }))
1877        }))
1878        .render_indicator(move |choice, window, cx| {
1879            let t = cx.macos();
1880            let active = window.is_window_active();
1881            div()
1882                .debug_selector({
1883                    let selector = selector.clone();
1884                    move || selector.clone()
1885                })
1886                .size(rems(1.))
1887                .flex_shrink_0()
1888                .rounded(rems(if multiple { 0.25 } else { 0.5 }))
1889                .bg(if choice.is_selected() {
1890                    crate::controls::control_selection(t, active)
1891                } else {
1892                    crate::controls::unchecked_control_fill(t, active)
1893                })
1894                .flex()
1895                .items_center()
1896                .justify_center()
1897                .children(choice.is_selected().then(|| {
1898                    if multiple {
1899                        crate::icon(crate::IconName::Check)
1900                            .size(rems(0.875))
1901                            .text_color(crate::controls::control_mark(t, active))
1902                            .into_any_element()
1903                    } else {
1904                        div()
1905                            .size(rems(0.25))
1906                            .rounded_full()
1907                            .bg(crate::controls::control_mark(t, active))
1908                            .into_any_element()
1909                    }
1910                }))
1911                .into_any_element()
1912        })
1913}
1914
1915/// Setup navigation uses the native command density and a trailing action row.
1916pub fn questionnaire_actions(
1917    state: &Entity<kit::questionnaire::QuestionnaireState>,
1918    cx: &App,
1919) -> kit::questionnaire::QuestionnaireActions {
1920    kit::questionnaire::QuestionnaireActions::new(state)
1921        .justify_end()
1922        .gap(rems(0.5))
1923        .pt(rems(0.75))
1924        .border_t_1()
1925        .border_color(cx.macos().divider())
1926}
1927
1928/// The Back command, present when Kit can navigate to an earlier question.
1929pub fn questionnaire_previous(
1930    state: &Entity<kit::questionnaire::QuestionnaireState>,
1931    cx: &App,
1932) -> Option<crate::Button> {
1933    state
1934        .read(cx)
1935        .navigation_state()
1936        .is_previous_visible()
1937        .then(|| {
1938            questionnaire_action(
1939                state,
1940                "Previous",
1941                "Back",
1942                crate::ButtonVariant::Secondary,
1943                kit::questionnaire::QuestionnaireState::go_previous,
1944                cx,
1945            )
1946        })
1947}
1948
1949/// The Continue command. Kit retains validation and invalid-answer focus.
1950pub fn questionnaire_next(
1951    state: &Entity<kit::questionnaire::QuestionnaireState>,
1952    cx: &App,
1953) -> Option<crate::Button> {
1954    state
1955        .read(cx)
1956        .navigation_state()
1957        .is_next_visible()
1958        .then(|| {
1959            questionnaire_action(
1960                state,
1961                "Next",
1962                "Continue",
1963                crate::ButtonVariant::Primary,
1964                kit::questionnaire::QuestionnaireState::go_next,
1965                cx,
1966            )
1967        })
1968}
1969
1970/// The Done command, present on the final enabled question.
1971pub fn questionnaire_submit(
1972    state: &Entity<kit::questionnaire::QuestionnaireState>,
1973    cx: &App,
1974) -> Option<crate::Button> {
1975    state
1976        .read(cx)
1977        .navigation_state()
1978        .is_submit_visible()
1979        .then(|| {
1980            questionnaire_action(
1981                state,
1982                "Submit",
1983                "Done",
1984                crate::ButtonVariant::Primary,
1985                kit::questionnaire::QuestionnaireState::submit,
1986                cx,
1987            )
1988        })
1989}
1990
1991/// Skip an optional question using Kit's original clear-and-advance behavior.
1992pub fn questionnaire_skip(
1993    state: &Entity<kit::questionnaire::QuestionnaireState>,
1994    cx: &App,
1995) -> Option<crate::Button> {
1996    state
1997        .read(cx)
1998        .navigation_state()
1999        .is_skip_visible()
2000        .then(|| {
2001            questionnaire_action(
2002                state,
2003                "Skip",
2004                "Skip",
2005                crate::ButtonVariant::Secondary,
2006                kit::questionnaire::QuestionnaireState::skip_current,
2007                cx,
2008            )
2009        })
2010}
2011
2012fn questionnaire_action(
2013    state: &Entity<kit::questionnaire::QuestionnaireState>,
2014    action: &'static str,
2015    label: &'static str,
2016    variant: crate::ButtonVariant,
2017    handler: fn(
2018        &mut kit::questionnaire::QuestionnaireState,
2019        &mut gpui_kit::Window,
2020        &mut gpui_kit::Context<kit::questionnaire::QuestionnaireState>,
2021    ) -> bool,
2022    cx: &App,
2023) -> crate::Button {
2024    let selector = format!("questionnaire-{}-{action}", state.entity_id());
2025    let target = state.clone();
2026    crate::button(ElementId::Name(selector.clone().into()), label, variant, cx)
2027        .debug_selector(move || selector.clone())
2028        .h(rems(1.5))
2029        .on_click(move |_, window, cx| {
2030            target.update(cx, |state, cx| {
2031                handler(state, window, cx);
2032            });
2033        })
2034}
2035
2036/// A compact Messages-style row. All named Kit slots remain configurable.
2037pub fn message(alignment: kit::message::MessageAlignment, cx: &App) -> kit::message::Message {
2038    kit::message::Message::new()
2039        .alignment(alignment)
2040        .font_family(cx.macos().font.clone())
2041        .gap(rems(0.25))
2042        .with_stack_style(StyleRefinement::default().gap(rems(0.25)))
2043}
2044
2045/// The visible conversation surface; the surrounding Bubble keeps its full API.
2046pub fn bubble_content(
2047    alignment: kit::message::MessageAlignment,
2048    cx: &App,
2049) -> kit::bubble::BubbleContent {
2050    let t = cx.macos();
2051    let outgoing = alignment == kit::message::MessageAlignment::End;
2052    kit::bubble::BubbleContent::new()
2053        .max_w(rems(31.))
2054        .rounded(rems(1.))
2055        .border_0()
2056        .px(rems(0.75))
2057        .py(rems(0.5))
2058        .text_size(rems(0.8125))
2059        .line_height(relative(1.4))
2060        .bg(if outgoing { t.accent } else { t.normal_fill() })
2061        .text_color(if outgoing { t.on_accent } else { t.foreground })
2062}
2063
2064/// A compact Mail-style file row with Kit's complete lifecycle and action API.
2065pub fn attachment(cx: &App) -> kit::attachment::Attachment {
2066    kit::attachment::Attachment::new()
2067        .with_size(kit::Size::Small)
2068        .axis(gpui_kit::Axis::Horizontal)
2069        .rounded(rems(0.5))
2070        .border_0()
2071        .bg(cx.macos().normal_fill())
2072        .text_size(rems(0.8125))
2073}
2074
2075/// A bounded document-preview navigator, retaining Kit's full carousel API.
2076pub fn carousel(
2077    id: impl Into<ElementId>,
2078    state: &Entity<kit::carousel::CarouselState>,
2079    cx: &App,
2080) -> kit::carousel::Carousel {
2081    kit::carousel::Carousel::new(id, state)
2082        .font_family(cx.macos().font.clone())
2083        .text_size(rems(0.8125))
2084}
2085
2086/// An inline previous-document command for the macOS carousel interpretation.
2087pub fn carousel_previous(state: &Entity<kit::carousel::CarouselState>, cx: &App) -> crate::Button {
2088    let target = state.clone();
2089    crate::toolbar_button(
2090        ("mac-carousel-previous", state.entity_id()),
2091        crate::IconName::ChevronLeft,
2092        "Previous document",
2093        cx,
2094    )
2095    .disabled(!state.read(cx).has_previous())
2096    .on_click(move |_, _, cx| {
2097        target.update(cx, |state, cx| {
2098            state.select_previous(cx);
2099        });
2100    })
2101}
2102
2103/// An inline next-document command for the macOS carousel interpretation.
2104pub fn carousel_next(state: &Entity<kit::carousel::CarouselState>, cx: &App) -> crate::Button {
2105    let target = state.clone();
2106    crate::toolbar_button(
2107        ("mac-carousel-next", state.entity_id()),
2108        crate::IconName::ChevronRight,
2109        "Next document",
2110        cx,
2111    )
2112    .disabled(!state.read(cx).has_next())
2113    .on_click(move |_, _, cx| {
2114        target.update(cx, |state, cx| {
2115            state.select_next(cx);
2116        });
2117    })
2118}
2119
2120#[cfg(test)]
2121mod tests {
2122    use super::*;
2123    use crate::catalog::{COMPONENTS, component};
2124    use gpui_kit::test::TestQueryExt as _;
2125    use gpui_kit::{AppContext as _, Context, Render, TestAppContext, Window, px};
2126    use std::collections::HashSet;
2127
2128    // Compilation proves the untrimmed public facade still exposes every
2129    // pinned component module, including support modules without doc pages.
2130    #[allow(unused_imports)]
2131    use crate::kit::{
2132        accordion, alert, attachment, avatar, badge, breadcrumb, bubble, button, carousel, chart,
2133        checkbox, clipboard, collapsible, color_picker, combobox, command, description_list,
2134        dialog, diff, dock, empty, form, global_state, group_box, highlighter, history, hover_card,
2135        input, kbd, label, link, list, marker, menu, message, message_scroller, native_menu,
2136        notification, pagination, plot, popover, progress, questionnaire, radio, rating, resizable,
2137        scroll, searchable_list, select, separator, setting, sheet, shimmer, sidebar, skeleton,
2138        slider, speech, spinner, status_bar, stepper, switch, tab, table, tag, text, theme,
2139        toolbar, tooltip, tree,
2140    };
2141
2142    fn inventory() -> serde_json::Value {
2143        serde_json::from_str(include_str!("../docs/upstream-inventory.json")).unwrap()
2144    }
2145
2146    fn strings(value: &serde_json::Value) -> Vec<&str> {
2147        value
2148            .as_array()
2149            .unwrap()
2150            .iter()
2151            .map(|item| item.as_str().unwrap())
2152            .collect()
2153    }
2154
2155    struct OptionalQuestion {
2156        state: Entity<kit::questionnaire::QuestionnaireState>,
2157    }
2158
2159    impl Render for OptionalQuestion {
2160        fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
2161            questionnaire(&self.state, cx).child(
2162                questionnaire_actions(&self.state, cx)
2163                    .children(questionnaire_skip(&self.state, cx)),
2164            )
2165        }
2166    }
2167
2168    #[gpui_kit::test]
2169    fn native_skip_command_clears_the_answer_and_submits_the_optional_last_question(
2170        cx: &mut TestAppContext,
2171    ) {
2172        use kit::questionnaire::{
2173            QuestionnaireChoiceDefinition, QuestionnaireItemDefinition, QuestionnaireItemStatus,
2174            QuestionnaireState,
2175        };
2176
2177        cx.update(crate::init);
2178        let (view, cx) = cx.add_window_view(|_, cx| OptionalQuestion {
2179            state: cx.new(|cx| {
2180                QuestionnaireState::new(
2181                    vec![
2182                        QuestionnaireItemDefinition::new("preference", "Optional preference")
2183                            .with_choices([QuestionnaireChoiceDefinition::new("yes", "Yes")
2184                                .with_default_selected(true)]),
2185                    ],
2186                    cx,
2187                )
2188                .unwrap()
2189            }),
2190        });
2191        let point = cx.update(|window, cx| {
2192            window.draw(cx).clear(cx);
2193            let state = view.read(cx).state.read(cx);
2194            assert!(!state.answer("preference").unwrap().is_empty());
2195            let skip = window.find_by_label("Skip");
2196            assert_eq!(skip.role(), Some(gpui_kit::Role::Button));
2197            assert_eq!(skip.bounds().size.height, px(24.));
2198            skip.bounds().center()
2199        });
2200        cx.simulate_click(point, Default::default());
2201        cx.update(|_, cx| {
2202            let state = view.read(cx).state.read(cx);
2203            assert!(state.answer("preference").unwrap().is_empty());
2204            assert_eq!(
2205                state.item_state("preference").unwrap().status(),
2206                QuestionnaireItemStatus::Skipped
2207            );
2208            assert!(state.is_complete());
2209        });
2210    }
2211
2212    #[test]
2213    fn every_catalog_page_has_one_explicit_and_useful_contract() {
2214        let ids: HashSet<_> = INTERPRETATIONS.iter().map(|entry| entry.id).collect();
2215        assert_eq!(ids.len(), INTERPRETATIONS.len(), "contracts are unique");
2216        let catalog: HashSet<_> = COMPONENTS.iter().map(|entry| entry.id).collect();
2217        assert_eq!(
2218            ids, catalog,
2219            "new pages cannot bypass interpretation review"
2220        );
2221        for entry in INTERPRETATIONS {
2222            assert!(
2223                !entry.counterpart.is_empty(),
2224                "{}: name its native counterpart or composition",
2225                entry.id
2226            );
2227            assert!(
2228                !entry.design.is_empty() && !entry.api.is_empty(),
2229                "{}: publish the design and reusable API",
2230                entry.id
2231            );
2232            assert!(
2233                !entry.capabilities.is_empty()
2234                    && entry
2235                        .capabilities
2236                        .iter()
2237                        .all(|capability| !capability.is_empty())
2238            );
2239            if entry.rendering == RenderingKind::AppKitBacked {
2240                assert!(
2241                    !entry.native_integrations.is_empty(),
2242                    "{}: system-backed claims require an actual native integration",
2243                    entry.id
2244                );
2245            }
2246            assert_eq!(component(entry.id).unwrap().interpretation(), entry);
2247        }
2248    }
2249
2250    #[test]
2251    fn all_pinned_documentation_topics_and_modules_are_represented() {
2252        let inventory = inventory();
2253        assert_eq!(inventory["revision"], UPSTREAM_REVISION);
2254        let documented: HashSet<_> = COMPONENTS
2255            .iter()
2256            .filter_map(|entry| entry.documentation)
2257            .collect();
2258        for topic in strings(&inventory["documentation_topics"]) {
2259            assert!(
2260                documented.contains(topic),
2261                "missing upstream topic: {topic}"
2262            );
2263        }
2264        let mapped: HashSet<_> = MODULE_COVERAGE.iter().map(|entry| entry.module).collect();
2265        assert_eq!(mapped.len(), MODULE_COVERAGE.len());
2266        let expected: HashSet<_> = strings(&inventory["component_modules"])
2267            .into_iter()
2268            .collect();
2269        assert_eq!(
2270            mapped, expected,
2271            "all public modules require a page or supporting role"
2272        );
2273        for entry in MODULE_COVERAGE {
2274            assert!(!entry.pages.is_empty() && !entry.role.is_empty());
2275            for page in entry.pages {
2276                assert!(
2277                    component(page).is_some(),
2278                    "{} maps to missing page {page}",
2279                    entry.module
2280                );
2281            }
2282        }
2283    }
2284
2285    #[test]
2286    fn snapshot_matches_the_vendored_component_exports() {
2287        let source = include_str!("../docs/upstream-component-exports.rs");
2288        let vendored = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
2289            .join("vendor/gpui-component/src/lib.rs");
2290        if vendored.exists() {
2291            assert_eq!(
2292                std::fs::read_to_string(vendored).unwrap(),
2293                source,
2294                "the packaged source fixture must match the actual checkout exports"
2295            );
2296        }
2297        let inventory = inventory();
2298        let modules: Vec<_> = source
2299            .lines()
2300            .filter_map(|line| {
2301                line.strip_prefix("pub mod ")
2302                    .and_then(|module| module.strip_suffix(';'))
2303            })
2304            .collect();
2305        assert_eq!(
2306            modules,
2307            strings(&inventory["component_modules"]),
2308            "audit exported modules when updating the pinned source"
2309        );
2310        let mut uses = Vec::new();
2311        let mut current = String::new();
2312        for line in source.lines() {
2313            if let Some(statement) = line.strip_prefix("pub use ") {
2314                current = statement.to_string();
2315            } else if !current.is_empty() {
2316                current.push(' ');
2317                current.push_str(line);
2318            } else {
2319                continue;
2320            }
2321            if let Some((statement, _)) = current.split_once(';') {
2322                uses.push(statement.split_whitespace().collect::<Vec<_>>().join(" "));
2323                current.clear();
2324            }
2325        }
2326        assert_eq!(
2327            uses,
2328            strings(&inventory["root_reexport_groups"]),
2329            "root reexports must remain complete as well as modules"
2330        );
2331    }
2332
2333    #[test]
2334    fn interpretations_do_not_mislabel_gpui_controls_as_appkit_instances() {
2335        for id in [
2336            "button",
2337            "checkbox",
2338            "radio",
2339            "switch",
2340            "input",
2341            "secure_field",
2342            "slider",
2343            "select",
2344            "table",
2345            "tree",
2346        ] {
2347            assert_eq!(
2348                interpretation(id).unwrap().rendering,
2349                RenderingKind::GpuiReplica,
2350                "{id} is rendered by GPUI"
2351            );
2352        }
2353        for id in [
2354            "questionnaire",
2355            "message",
2356            "bubble",
2357            "carousel",
2358            "diff",
2359            "stepper",
2360            "dock",
2361            "sankey_chart",
2362        ] {
2363            assert_eq!(
2364                interpretation(id).unwrap().rendering,
2365                RenderingKind::MacInterpretation
2366            );
2367        }
2368        for id in [
2369            "select",
2370            "combobox",
2371            "menu",
2372            "date_picker",
2373            "color_picker",
2374            "popover",
2375            "hover_card",
2376        ] {
2377            let entry = interpretation(id).unwrap();
2378            assert!(
2379                entry
2380                    .native_integrations
2381                    .contains(&NativeIntegration::GlassMaterial),
2382                "{id} retains GPUI foreground controls while using native glass presentation"
2383            );
2384            assert_ne!(entry.rendering, RenderingKind::AppKitBacked);
2385        }
2386        assert_eq!(
2387            interpretation("toolbar").unwrap().native_integrations,
2388            &[
2389                NativeIntegration::UnifiedToolbar,
2390                NativeIntegration::SfSymbols
2391            ]
2392        );
2393        assert_eq!(
2394            interpretation("speech").unwrap().optional_features,
2395            &[FeatureRequirement::Speech]
2396        );
2397        assert_eq!(
2398            interpretation("editor").unwrap().optional_features,
2399            &[FeatureRequirement::TreeSitterLanguages]
2400        );
2401        assert!(interpretation("unknown-component").is_none());
2402    }
2403}