@snap-rail/ui 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/LICENSE +202 -0
  2. package/lib/charts.js +118 -0
  3. package/lib/contract.js +527 -0
  4. package/lib/fallback.js +399 -0
  5. package/lib/index.js +1282 -0
  6. package/lib/pages.js +68 -0
  7. package/lib/runtime.js +3003 -0
  8. package/lib/settings.js +2069 -0
  9. package/lib/skins.js +258 -0
  10. package/lib/slots.js +267 -0
  11. package/lib/types/charts.d.ts +62 -0
  12. package/lib/types/charts.js +41 -0
  13. package/lib/types/components/button.d.ts +39 -0
  14. package/lib/types/components/button.js +27 -0
  15. package/lib/types/components/controls.d.ts +66 -0
  16. package/lib/types/components/controls.js +66 -0
  17. package/lib/types/components/dialog.d.ts +58 -0
  18. package/lib/types/components/dialog.js +46 -0
  19. package/lib/types/components/feedback.d.ts +46 -0
  20. package/lib/types/components/feedback.js +20 -0
  21. package/lib/types/components/form.d.ts +31 -0
  22. package/lib/types/components/form.js +13 -0
  23. package/lib/types/components/index.d.ts +15 -0
  24. package/lib/types/components/index.js +15 -0
  25. package/lib/types/components/input.d.ts +40 -0
  26. package/lib/types/components/input.js +18 -0
  27. package/lib/types/components/layout.d.ts +103 -0
  28. package/lib/types/components/layout.js +80 -0
  29. package/lib/types/components/schema-form.d.ts +44 -0
  30. package/lib/types/components/schema-form.js +84 -0
  31. package/lib/types/components/surface.d.ts +49 -0
  32. package/lib/types/components/surface.js +59 -0
  33. package/lib/types/contract.d.ts +350 -0
  34. package/lib/types/contract.js +231 -0
  35. package/lib/types/fallback.d.ts +14 -0
  36. package/lib/types/fallback.js +50 -0
  37. package/lib/types/index.d.ts +19 -0
  38. package/lib/types/index.js +19 -0
  39. package/lib/types/pages.d.ts +40 -0
  40. package/lib/types/pages.js +69 -0
  41. package/lib/types/runtime.d.ts +93 -0
  42. package/lib/types/runtime.js +233 -0
  43. package/lib/types/settings-pages/appearance.d.ts +15 -0
  44. package/lib/types/settings-pages/appearance.js +128 -0
  45. package/lib/types/settings-pages/index.d.ts +3 -0
  46. package/lib/types/settings-pages/index.js +3 -0
  47. package/lib/types/settings-pages/plugin-feed.d.ts +17 -0
  48. package/lib/types/settings-pages/plugin-feed.js +66 -0
  49. package/lib/types/settings-pages/plugins.d.ts +21 -0
  50. package/lib/types/settings-pages/plugins.js +372 -0
  51. package/lib/types/settings.d.ts +59 -0
  52. package/lib/types/settings.js +176 -0
  53. package/lib/types/skins.d.ts +137 -0
  54. package/lib/types/skins.js +271 -0
  55. package/lib/types/slots.d.ts +69 -0
  56. package/lib/types/slots.js +210 -0
  57. package/lib/types/utils.d.ts +15 -0
  58. package/lib/types/utils.js +26 -0
  59. package/package.json +105 -3
  60. package/src/styles/base.css +329 -0
  61. package/src/styles/default.css +735 -0
  62. package/README.md +0 -3
@@ -0,0 +1,350 @@
1
+ /**
2
+ * The semantic UI contract: component names, region-slot ids, scoped slot
3
+ * contexts, and the author-facing UI profile vocabulary. This module is pure
4
+ * (types, constants, guards) so host and renderer faces can both import it
5
+ * without dragging React or the renderer runtime into the host graph.
6
+ *
7
+ * @module @snap-rail/ui/contract
8
+ */
9
+ import type { ReactNode } from 'react';
10
+ import type { SurfaceId } from '@snap-rail/protocol';
11
+ import type { BallProfile, WindowProfile } from '@snap-rail/shell/contract';
12
+ /** The author-declared relationship between a plugin and the skin contract. */
13
+ export declare const UI_PROFILES: readonly ["native", "integrated", "custom"];
14
+ /** One UI profile. */
15
+ export type UiProfile = (typeof UI_PROFILES)[number];
16
+ /** The stable region slots every layout may provide. */
17
+ export declare const UI_SLOT_IDS: {
18
+ /** The one active layout of the operator window. */
19
+ readonly layout: "shell.layout";
20
+ /** The operator titlebar. */
21
+ readonly titlebar: "shell.titlebar";
22
+ /** Contributed titlebar actions. */
23
+ readonly titlebarActions: "shell.titlebar.actions";
24
+ /** Sidebar extension area. */
25
+ readonly sidebar: "shell.sidebar";
26
+ /** Statusbar extension area. */
27
+ readonly statusbar: "shell.statusbar";
28
+ /** The global overlay stack (dialogs, confirms). */
29
+ readonly overlay: "shell.overlay";
30
+ /** The floating ball surface face. */
31
+ readonly ball: "shell.ball";
32
+ /** The settings trigger. */
33
+ readonly settingsEntry: "settings.entry";
34
+ /** The settings surface itself. */
35
+ readonly settingsSurface: "settings.surface";
36
+ };
37
+ /** A named custom slot is owned by a publisher package. */
38
+ export declare const CUSTOM_SLOT_PATTERN: RegExp;
39
+ /** Any region-slot id: a built-in id or a publisher-owned custom seat. */
40
+ export type SlotId = (typeof UI_SLOT_IDS)[keyof typeof UI_SLOT_IDS] | `custom:${string}`;
41
+ /** Check a region-slot id at runtime. */
42
+ export declare function isValidSlotId(value: string): value is SlotId;
43
+ /** How a slot renders its occupants. */
44
+ export type SlotMode = 'one' | 'many';
45
+ /** The occupancy mode of every built-in slot. */
46
+ export declare const UI_SLOT_MODES: {
47
+ readonly "shell.layout": "one";
48
+ readonly "shell.titlebar": "one";
49
+ readonly "shell.titlebar.actions": "many";
50
+ readonly "shell.sidebar": "many";
51
+ readonly "shell.statusbar": "many";
52
+ readonly "shell.overlay": "many";
53
+ readonly "shell.ball": "one";
54
+ readonly "settings.entry": "one";
55
+ readonly "settings.surface": "one";
56
+ };
57
+ /** The operator-window controls a layout exposes to chrome contributions. */
58
+ export type WindowControl = 'minimize' | 'toggle-maximize' | 'close';
59
+ /** The context a settings trigger receives from the layout that hosts it. */
60
+ export interface SettingsEntryContext {
61
+ /** `icon` for a glyph-only chrome button, `label` for a labelled action. */
62
+ presentation: 'icon' | 'label';
63
+ /** Open the settings surface (the last page stays active). */
64
+ open(): void;
65
+ /** Whether the settings surface is currently open. */
66
+ isOpen: boolean;
67
+ }
68
+ /** A settings page as the settings surface sees it. */
69
+ export interface SettingsPageInfo {
70
+ id: string;
71
+ title: string;
72
+ group?: string | undefined;
73
+ order: number;
74
+ }
75
+ /** The context a settings surface receives. */
76
+ export interface SettingsSurfaceContext {
77
+ pages: readonly SettingsPageInfo[];
78
+ activeId?: string | undefined;
79
+ close(): void;
80
+ }
81
+ /**
82
+ * Scoped context carried by each built-in region slot. The `Slot` component
83
+ * infers its context type from this map; custom slots declare their own
84
+ * generic context through `ctx.ui.defineSlot`.
85
+ */
86
+ export interface SlotContextMap {
87
+ 'shell.layout': {
88
+ surface: SurfaceId;
89
+ };
90
+ 'shell.titlebar': {
91
+ surface: SurfaceId;
92
+ controls: WindowControl;
93
+ };
94
+ 'shell.titlebar.actions': {
95
+ surface: SurfaceId;
96
+ controls: WindowControl;
97
+ };
98
+ 'shell.sidebar': {
99
+ surface: SurfaceId;
100
+ };
101
+ 'shell.statusbar': {
102
+ surface: SurfaceId;
103
+ };
104
+ 'shell.overlay': {
105
+ surface: SurfaceId;
106
+ };
107
+ 'shell.ball': {
108
+ surface: 'ball';
109
+ };
110
+ 'settings.entry': SettingsEntryContext;
111
+ 'settings.surface': SettingsSurfaceContext;
112
+ }
113
+ /** The scoped context type of one built-in slot. */
114
+ export type SlotContextOf<S extends keyof SlotContextMap> = SlotContextMap[S];
115
+ /** A region-slot declaration. */
116
+ export interface SlotDefinition<C = unknown> {
117
+ /** The stable slot id (built-in or `custom:<publisher>.<name>`). */
118
+ id: string;
119
+ /** Occupancy mode; defaults to `many`. */
120
+ mode?: SlotMode;
121
+ /** The surface this slot belongs to; defaults to `all`. */
122
+ surface?: SurfaceId | 'all';
123
+ /** The default content when no occupant is registered. */
124
+ fallback?: (context: C) => ReactNode;
125
+ }
126
+ /** A contribution to a region slot. */
127
+ export interface SlotContribution<C = unknown> {
128
+ /** Stable contribution id; a later same-id registration replaces it. */
129
+ id: string;
130
+ /** Render order within the slot; ties break by registration time. */
131
+ order: number;
132
+ /** Winner election for `one` slots; ignored in `many` slots. */
133
+ precedence?: number;
134
+ /** Render the contribution against the slot's scoped context. */
135
+ render(context: C): ReactNode;
136
+ }
137
+ /** A layout contribution: provides region slots and owns the stage profiles. */
138
+ export interface LayoutContribution {
139
+ id: string;
140
+ order: number;
141
+ /** Winner election among layout occupants; the highest wins. */
142
+ precedence?: number;
143
+ /** Region-slot ids this layout renders. */
144
+ provides: readonly SlotId[];
145
+ /** The operator-window stage preferred by this layout/suite. */
146
+ window?: WindowProfile;
147
+ /** The floating-ball stage preferred by this layout/suite. */
148
+ ball?: BallProfile;
149
+ render(): ReactNode;
150
+ }
151
+ /** Diagnostic kinds surfaced by the UI registry. */
152
+ export declare const UI_DIAGNOSTIC_KINDS: readonly ["unknown-slot", "missing-provider", "invalid-context", "duplicate-id", "render-failed", "declared-not-rendered"];
153
+ /** One diagnostic kind. */
154
+ export type UiDiagnosticKind = (typeof UI_DIAGNOSTIC_KINDS)[number];
155
+ /** A non-fatal UI contract violation. */
156
+ export interface UiDiagnostic {
157
+ kind: UiDiagnosticKind;
158
+ message: string;
159
+ slot?: string | undefined;
160
+ id?: string | undefined;
161
+ time: number;
162
+ }
163
+ /** One semantic component's public anatomy. */
164
+ export interface UiComponentSpec {
165
+ /** Stable `data-snap-part` names the skin may target. */
166
+ parts: readonly string[];
167
+ /** Component slots (children/header/footer/actions/...). */
168
+ slots?: readonly string[];
169
+ /** Semantic prop names (intent/emphasis/size/...); documentation only. */
170
+ props?: readonly string[];
171
+ }
172
+ /**
173
+ * The component catalog. It is the shared vocabulary for the gallery, skin
174
+ * coverage checks, and author documentation; adding a component here is a
175
+ * contract change, not an implementation detail.
176
+ */
177
+ export declare const UI_COMPONENTS: {
178
+ readonly button: {
179
+ readonly parts: readonly ["button.root", "button.label", "button.icon", "button.spinner"];
180
+ readonly slots: readonly ["label", "icon"];
181
+ readonly props: readonly ["intent", "emphasis", "size", "loading", "disabled"];
182
+ };
183
+ readonly 'icon-button': {
184
+ readonly parts: readonly ["icon-button.root", "icon-button.icon"];
185
+ readonly slots: readonly ["icon"];
186
+ readonly props: readonly ["intent", "emphasis", "size", "active", "disabled"];
187
+ };
188
+ readonly input: {
189
+ readonly parts: readonly ["input.root", "input.field", "input.prefix", "input.suffix", "input.clear"];
190
+ readonly slots: readonly ["prefix", "suffix"];
191
+ readonly props: readonly ["size", "invalid", "disabled"];
192
+ };
193
+ readonly textarea: {
194
+ readonly parts: readonly ["textarea.root", "textarea.field"];
195
+ readonly props: readonly ["size", "invalid", "disabled"];
196
+ };
197
+ readonly 'number-input': {
198
+ readonly parts: readonly ["number-input.root", "number-input.field", "number-input.step-up", "number-input.step-down"];
199
+ readonly props: readonly ["size", "invalid", "disabled"];
200
+ };
201
+ readonly select: {
202
+ readonly parts: readonly ["select.root", "select.trigger", "select.value", "select.chevron", "select.content", "select.item", "select.item-indicator", "select.empty"];
203
+ readonly slots: readonly ["empty"];
204
+ readonly props: readonly ["size", "invalid", "disabled", "presentation"];
205
+ };
206
+ readonly 'touch-select': {
207
+ readonly parts: readonly ["touch-select.root", "touch-select.trigger", "touch-select.sheet", "touch-select.option"];
208
+ readonly props: readonly ["invalid", "disabled"];
209
+ };
210
+ readonly checkbox: {
211
+ readonly parts: readonly ["checkbox.root", "checkbox.box", "checkbox.indicator", "checkbox.label"];
212
+ readonly slots: readonly ["label"];
213
+ readonly props: readonly ["checked", "invalid", "disabled"];
214
+ };
215
+ readonly switch: {
216
+ readonly parts: readonly ["switch.root", "switch.thumb", "switch.label"];
217
+ readonly slots: readonly ["label"];
218
+ readonly props: readonly ["checked", "disabled"];
219
+ };
220
+ readonly 'radio-group': {
221
+ readonly parts: readonly ["radio-group.root", "radio-group.item", "radio-group.indicator", "radio-group.label"];
222
+ readonly props: readonly ["value", "disabled"];
223
+ };
224
+ readonly tabs: {
225
+ readonly parts: readonly ["tabs.root", "tabs.list", "tabs.trigger", "tabs.content"];
226
+ readonly slots: readonly ["list", "content"];
227
+ readonly props: readonly ["value", "presentation"];
228
+ };
229
+ readonly table: {
230
+ readonly parts: readonly ["table.root", "table.header", "table.body", "table.row", "table.head", "table.cell", "table.empty"];
231
+ readonly slots: readonly ["empty"];
232
+ };
233
+ readonly card: {
234
+ readonly parts: readonly ["card.root", "card.header", "card.title", "card.description", "card.body", "card.footer"];
235
+ readonly slots: readonly ["header", "title", "description", "body", "footer"];
236
+ };
237
+ readonly panel: {
238
+ readonly parts: readonly ["panel.root", "panel.header", "panel.title", "panel.body", "panel.footer"];
239
+ readonly slots: readonly ["header", "title", "body", "footer"];
240
+ };
241
+ readonly dialog: {
242
+ readonly parts: readonly ["dialog.root", "dialog.overlay", "dialog.panel", "dialog.header", "dialog.title", "dialog.description", "dialog.body", "dialog.footer", "dialog.close"];
243
+ readonly slots: readonly ["header", "title", "description", "body", "footer"];
244
+ readonly props: readonly ["open", "presentation", "size"];
245
+ };
246
+ readonly sheet: {
247
+ readonly parts: readonly ["sheet.root", "sheet.overlay", "sheet.panel", "sheet.header", "sheet.body", "sheet.footer"];
248
+ readonly slots: readonly ["header", "body", "footer"];
249
+ readonly props: readonly ["open", "presentation"];
250
+ };
251
+ readonly popover: {
252
+ readonly parts: readonly ["popover.root", "popover.trigger", "popover.content"];
253
+ readonly slots: readonly ["trigger", "content"];
254
+ };
255
+ readonly tooltip: {
256
+ readonly parts: readonly ["tooltip.root", "tooltip.trigger", "tooltip.content"];
257
+ readonly slots: readonly ["trigger", "content"];
258
+ };
259
+ readonly menu: {
260
+ readonly parts: readonly ["menu.root", "menu.trigger", "menu.content", "menu.item", "menu.separator"];
261
+ readonly slots: readonly ["trigger", "content"];
262
+ };
263
+ readonly toast: {
264
+ readonly parts: readonly ["toast.root", "toast.title", "toast.description", "toast.action", "toast.close"];
265
+ readonly slots: readonly ["action"];
266
+ };
267
+ readonly progress: {
268
+ readonly parts: readonly ["progress.root", "progress.track", "progress.indicator"];
269
+ };
270
+ readonly badge: {
271
+ readonly parts: readonly ["badge.root"];
272
+ };
273
+ readonly led: {
274
+ readonly parts: readonly ["led.root", "led.halo"];
275
+ readonly props: readonly ["tone"];
276
+ };
277
+ readonly spinner: {
278
+ readonly parts: readonly ["spinner.root"];
279
+ };
280
+ readonly 'empty-state': {
281
+ readonly parts: readonly ["empty-state.root", "empty-state.icon", "empty-state.title", "empty-state.description", "empty-state.action"];
282
+ readonly slots: readonly ["icon", "title", "description", "action"];
283
+ };
284
+ readonly form: {
285
+ readonly parts: readonly ["form.root", "form.fields", "form.actions"];
286
+ readonly slots: readonly ["fields", "actions"];
287
+ };
288
+ readonly field: {
289
+ readonly parts: readonly ["field.root", "field.label", "field.control", "field.help", "field.error"];
290
+ readonly slots: readonly ["label", "control", "help", "error"];
291
+ readonly props: readonly ["invalid", "required", "disabled"];
292
+ };
293
+ readonly 'schema-form': {
294
+ readonly parts: readonly ["schema-form.root", "schema-form.field"];
295
+ readonly slots: readonly ["fields"];
296
+ };
297
+ readonly 'app-shell': {
298
+ readonly parts: readonly ["app-shell.root", "app-shell.header", "app-shell.sidebar", "app-shell.main", "app-shell.footer"];
299
+ readonly slots: readonly ["header", "sidebar", "main", "footer"];
300
+ };
301
+ readonly page: {
302
+ readonly parts: readonly ["page.root", "page.header", "page.title", "page.description", "page.actions", "page.body"];
303
+ readonly slots: readonly ["header", "title", "description", "actions", "body"];
304
+ };
305
+ readonly section: {
306
+ readonly parts: readonly ["section.root", "section.header", "section.title", "section.actions", "section.body"];
307
+ readonly slots: readonly ["header", "title", "actions", "body"];
308
+ };
309
+ readonly toolbar: {
310
+ readonly parts: readonly ["toolbar.root", "toolbar.start", "toolbar.end"];
311
+ readonly slots: readonly ["start", "end"];
312
+ };
313
+ readonly stack: {
314
+ readonly parts: readonly ["stack.root"];
315
+ readonly props: readonly ["gap", "padding", "align"];
316
+ };
317
+ readonly row: {
318
+ readonly parts: readonly ["row.root"];
319
+ readonly props: readonly ["gap", "padding", "align", "justify"];
320
+ };
321
+ readonly grid: {
322
+ readonly parts: readonly ["grid.root"];
323
+ readonly props: readonly ["gap", "columns", "padding"];
324
+ };
325
+ readonly split: {
326
+ readonly parts: readonly ["split.root", "split.start", "split.end"];
327
+ readonly slots: readonly ["start", "end"];
328
+ };
329
+ readonly 'scroll-area': {
330
+ readonly parts: readonly ["scroll-area.root", "scroll-area.viewport", "scroll-area.scrollbar"];
331
+ };
332
+ readonly 'drag-scroll': {
333
+ readonly parts: readonly ["drag-scroll.root", "drag-scroll.viewport"];
334
+ };
335
+ readonly visualization: {
336
+ readonly parts: readonly ["visualization.root", "visualization.header", "visualization.title", "visualization.actions", "visualization.body", "visualization.empty", "visualization.error", "visualization.loading"];
337
+ readonly slots: readonly ["header", "title", "actions", "body", "empty", "error", "loading"];
338
+ readonly props: readonly ["state"];
339
+ };
340
+ readonly 'chart-frame': {
341
+ readonly parts: readonly ["chart-frame.root", "chart-frame.header", "chart-frame.title", "chart-frame.actions", "chart-frame.body"];
342
+ readonly slots: readonly ["header", "title", "actions", "body"];
343
+ };
344
+ readonly settings: {
345
+ readonly parts: readonly ["settings.root", "settings.header", "settings.title", "settings.body", "settings.nav", "settings.nav-item", "settings.nav-icon", "settings.group", "settings.group-title", "settings.content"];
346
+ };
347
+ };
348
+ /** One semantic component name. */
349
+ export type UiComponentName = keyof typeof UI_COMPONENTS;
350
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1,231 @@
1
+ /**
2
+ * The semantic UI contract: component names, region-slot ids, scoped slot
3
+ * contexts, and the author-facing UI profile vocabulary. This module is pure
4
+ * (types, constants, guards) so host and renderer faces can both import it
5
+ * without dragging React or the renderer runtime into the host graph.
6
+ *
7
+ * @module @snap-rail/ui/contract
8
+ */
9
+ /** The author-declared relationship between a plugin and the skin contract. */
10
+ export const UI_PROFILES = ['native', 'integrated', 'custom'];
11
+ /** The stable region slots every layout may provide. */
12
+ export const UI_SLOT_IDS = {
13
+ /** The one active layout of the operator window. */
14
+ layout: 'shell.layout',
15
+ /** The operator titlebar. */
16
+ titlebar: 'shell.titlebar',
17
+ /** Contributed titlebar actions. */
18
+ titlebarActions: 'shell.titlebar.actions',
19
+ /** Sidebar extension area. */
20
+ sidebar: 'shell.sidebar',
21
+ /** Statusbar extension area. */
22
+ statusbar: 'shell.statusbar',
23
+ /** The global overlay stack (dialogs, confirms). */
24
+ overlay: 'shell.overlay',
25
+ /** The floating ball surface face. */
26
+ ball: 'shell.ball',
27
+ /** The settings trigger. */
28
+ settingsEntry: 'settings.entry',
29
+ /** The settings surface itself. */
30
+ settingsSurface: 'settings.surface',
31
+ };
32
+ /** A named custom slot is owned by a publisher package. */
33
+ export const CUSTOM_SLOT_PATTERN = /^custom:[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*$/;
34
+ /** Check a region-slot id at runtime. */
35
+ export function isValidSlotId(value) {
36
+ return Object.values(UI_SLOT_IDS).includes(value)
37
+ || CUSTOM_SLOT_PATTERN.test(value);
38
+ }
39
+ /** The occupancy mode of every built-in slot. */
40
+ export const UI_SLOT_MODES = {
41
+ [UI_SLOT_IDS.layout]: 'one',
42
+ [UI_SLOT_IDS.titlebar]: 'one',
43
+ [UI_SLOT_IDS.titlebarActions]: 'many',
44
+ [UI_SLOT_IDS.sidebar]: 'many',
45
+ [UI_SLOT_IDS.statusbar]: 'many',
46
+ [UI_SLOT_IDS.overlay]: 'many',
47
+ [UI_SLOT_IDS.ball]: 'one',
48
+ [UI_SLOT_IDS.settingsEntry]: 'one',
49
+ [UI_SLOT_IDS.settingsSurface]: 'one',
50
+ };
51
+ /** Diagnostic kinds surfaced by the UI registry. */
52
+ export const UI_DIAGNOSTIC_KINDS = [
53
+ 'unknown-slot',
54
+ 'missing-provider',
55
+ 'invalid-context',
56
+ 'duplicate-id',
57
+ 'render-failed',
58
+ 'declared-not-rendered',
59
+ ];
60
+ /**
61
+ * The component catalog. It is the shared vocabulary for the gallery, skin
62
+ * coverage checks, and author documentation; adding a component here is a
63
+ * contract change, not an implementation detail.
64
+ */
65
+ export const UI_COMPONENTS = {
66
+ button: {
67
+ parts: ['button.root', 'button.label', 'button.icon', 'button.spinner'],
68
+ slots: ['label', 'icon'],
69
+ props: ['intent', 'emphasis', 'size', 'loading', 'disabled'],
70
+ },
71
+ 'icon-button': {
72
+ parts: ['icon-button.root', 'icon-button.icon'],
73
+ slots: ['icon'],
74
+ props: ['intent', 'emphasis', 'size', 'active', 'disabled'],
75
+ },
76
+ input: {
77
+ parts: ['input.root', 'input.field', 'input.prefix', 'input.suffix', 'input.clear'],
78
+ slots: ['prefix', 'suffix'],
79
+ props: ['size', 'invalid', 'disabled'],
80
+ },
81
+ textarea: {
82
+ parts: ['textarea.root', 'textarea.field'],
83
+ props: ['size', 'invalid', 'disabled'],
84
+ },
85
+ 'number-input': {
86
+ parts: ['number-input.root', 'number-input.field', 'number-input.step-up', 'number-input.step-down'],
87
+ props: ['size', 'invalid', 'disabled'],
88
+ },
89
+ select: {
90
+ parts: ['select.root', 'select.trigger', 'select.value', 'select.chevron', 'select.content', 'select.item', 'select.item-indicator', 'select.empty'],
91
+ slots: ['empty'],
92
+ props: ['size', 'invalid', 'disabled', 'presentation'],
93
+ },
94
+ 'touch-select': {
95
+ parts: ['touch-select.root', 'touch-select.trigger', 'touch-select.sheet', 'touch-select.option'],
96
+ props: ['invalid', 'disabled'],
97
+ },
98
+ checkbox: {
99
+ parts: ['checkbox.root', 'checkbox.box', 'checkbox.indicator', 'checkbox.label'],
100
+ slots: ['label'],
101
+ props: ['checked', 'invalid', 'disabled'],
102
+ },
103
+ switch: {
104
+ parts: ['switch.root', 'switch.thumb', 'switch.label'],
105
+ slots: ['label'],
106
+ props: ['checked', 'disabled'],
107
+ },
108
+ 'radio-group': {
109
+ parts: ['radio-group.root', 'radio-group.item', 'radio-group.indicator', 'radio-group.label'],
110
+ props: ['value', 'disabled'],
111
+ },
112
+ tabs: {
113
+ parts: ['tabs.root', 'tabs.list', 'tabs.trigger', 'tabs.content'],
114
+ slots: ['list', 'content'],
115
+ props: ['value', 'presentation'],
116
+ },
117
+ table: {
118
+ parts: ['table.root', 'table.header', 'table.body', 'table.row', 'table.head', 'table.cell', 'table.empty'],
119
+ slots: ['empty'],
120
+ },
121
+ card: {
122
+ parts: ['card.root', 'card.header', 'card.title', 'card.description', 'card.body', 'card.footer'],
123
+ slots: ['header', 'title', 'description', 'body', 'footer'],
124
+ },
125
+ panel: {
126
+ parts: ['panel.root', 'panel.header', 'panel.title', 'panel.body', 'panel.footer'],
127
+ slots: ['header', 'title', 'body', 'footer'],
128
+ },
129
+ dialog: {
130
+ parts: ['dialog.root', 'dialog.overlay', 'dialog.panel', 'dialog.header', 'dialog.title', 'dialog.description', 'dialog.body', 'dialog.footer', 'dialog.close'],
131
+ slots: ['header', 'title', 'description', 'body', 'footer'],
132
+ props: ['open', 'presentation', 'size'],
133
+ },
134
+ sheet: {
135
+ parts: ['sheet.root', 'sheet.overlay', 'sheet.panel', 'sheet.header', 'sheet.body', 'sheet.footer'],
136
+ slots: ['header', 'body', 'footer'],
137
+ props: ['open', 'presentation'],
138
+ },
139
+ popover: {
140
+ parts: ['popover.root', 'popover.trigger', 'popover.content'],
141
+ slots: ['trigger', 'content'],
142
+ },
143
+ tooltip: {
144
+ parts: ['tooltip.root', 'tooltip.trigger', 'tooltip.content'],
145
+ slots: ['trigger', 'content'],
146
+ },
147
+ menu: {
148
+ parts: ['menu.root', 'menu.trigger', 'menu.content', 'menu.item', 'menu.separator'],
149
+ slots: ['trigger', 'content'],
150
+ },
151
+ toast: {
152
+ parts: ['toast.root', 'toast.title', 'toast.description', 'toast.action', 'toast.close'],
153
+ slots: ['action'],
154
+ },
155
+ progress: {
156
+ parts: ['progress.root', 'progress.track', 'progress.indicator'],
157
+ },
158
+ badge: {
159
+ parts: ['badge.root'],
160
+ },
161
+ led: {
162
+ parts: ['led.root', 'led.halo'],
163
+ props: ['tone'],
164
+ },
165
+ spinner: {
166
+ parts: ['spinner.root'],
167
+ },
168
+ 'empty-state': {
169
+ parts: ['empty-state.root', 'empty-state.icon', 'empty-state.title', 'empty-state.description', 'empty-state.action'],
170
+ slots: ['icon', 'title', 'description', 'action'],
171
+ },
172
+ form: {
173
+ parts: ['form.root', 'form.fields', 'form.actions'],
174
+ slots: ['fields', 'actions'],
175
+ },
176
+ field: {
177
+ parts: ['field.root', 'field.label', 'field.control', 'field.help', 'field.error'],
178
+ slots: ['label', 'control', 'help', 'error'],
179
+ props: ['invalid', 'required', 'disabled'],
180
+ },
181
+ 'schema-form': {
182
+ parts: ['schema-form.root', 'schema-form.field'],
183
+ slots: ['fields'],
184
+ },
185
+ 'app-shell': {
186
+ parts: ['app-shell.root', 'app-shell.header', 'app-shell.sidebar', 'app-shell.main', 'app-shell.footer'],
187
+ slots: ['header', 'sidebar', 'main', 'footer'],
188
+ },
189
+ page: {
190
+ parts: ['page.root', 'page.header', 'page.title', 'page.description', 'page.actions', 'page.body'],
191
+ slots: ['header', 'title', 'description', 'actions', 'body'],
192
+ },
193
+ section: {
194
+ parts: ['section.root', 'section.header', 'section.title', 'section.actions', 'section.body'],
195
+ slots: ['header', 'title', 'actions', 'body'],
196
+ },
197
+ toolbar: {
198
+ parts: ['toolbar.root', 'toolbar.start', 'toolbar.end'],
199
+ slots: ['start', 'end'],
200
+ },
201
+ stack: { parts: ['stack.root'], props: ['gap', 'padding', 'align'] },
202
+ row: { parts: ['row.root'], props: ['gap', 'padding', 'align', 'justify'] },
203
+ grid: { parts: ['grid.root'], props: ['gap', 'columns', 'padding'] },
204
+ split: { parts: ['split.root', 'split.start', 'split.end'], slots: ['start', 'end'] },
205
+ 'scroll-area': { parts: ['scroll-area.root', 'scroll-area.viewport', 'scroll-area.scrollbar'] },
206
+ 'drag-scroll': { parts: ['drag-scroll.root', 'drag-scroll.viewport'] },
207
+ visualization: {
208
+ parts: ['visualization.root', 'visualization.header', 'visualization.title', 'visualization.actions', 'visualization.body', 'visualization.empty', 'visualization.error', 'visualization.loading'],
209
+ slots: ['header', 'title', 'actions', 'body', 'empty', 'error', 'loading'],
210
+ props: ['state'],
211
+ },
212
+ 'chart-frame': {
213
+ parts: ['chart-frame.root', 'chart-frame.header', 'chart-frame.title', 'chart-frame.actions', 'chart-frame.body'],
214
+ slots: ['header', 'title', 'actions', 'body'],
215
+ },
216
+ settings: {
217
+ parts: [
218
+ 'settings.root',
219
+ 'settings.header',
220
+ 'settings.title',
221
+ 'settings.body',
222
+ 'settings.nav',
223
+ 'settings.nav-item',
224
+ 'settings.nav-icon',
225
+ 'settings.group',
226
+ 'settings.group-title',
227
+ 'settings.content',
228
+ ],
229
+ },
230
+ };
231
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The built-in fallback layout: a minimal titlebar, a settings seat, window
3
+ * controls, and an empty state pointing at the plugin manager. It is an
4
+ * ordinary low-precedence layout occupant, not a special shell branch; a
5
+ * suite layout with higher precedence replaces it and its disposal brings the
6
+ * fallback back automatically.
7
+ *
8
+ * @module @snap-rail/ui/fallback
9
+ */
10
+ import { type Plugin } from '@snap-rail/cordis';
11
+ /** The fallback layout occupant. */
12
+ declare const fallbackPlugin: Plugin.Object<void>;
13
+ export default fallbackPlugin;
14
+ //# sourceMappingURL=fallback.d.ts.map
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AppShell, Button, EmptyState, IconButton } from "./components/index.js";
3
+ import { UI_SLOT_IDS } from "./contract.js";
4
+ import { usePagesVersion } from "./pages.js";
5
+ import { Slot, useUiVersion } from "./slots.js";
6
+ /** A compact glyph for the window controls. */
7
+ function Glyph(props) {
8
+ return _jsx("span", { "aria-hidden": "true", style: { lineHeight: 1 }, children: props.children });
9
+ }
10
+ /** The fallback body. */
11
+ function FallbackShell(props) {
12
+ useUiVersion(props.ctx.ui);
13
+ usePagesVersion(props.ctx);
14
+ const active = props.ctx.pages.active();
15
+ const control = (action) => {
16
+ void props.ctx.client.link.call('window.control', { action }).catch(() => { });
17
+ };
18
+ const header = (_jsxs("div", { className: "snap-fallback-titlebar", style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', minHeight: 48, paddingLeft: 16 }, children: [_jsxs("span", { style: { color: 'var(--snap-color-muted)', fontSize: 'var(--snap-text-sm)' }, children: ["snap-rail", active !== undefined ? ` · ${active.title}` : ''] }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [_jsx(Slot, { name: UI_SLOT_IDS.settingsEntry, context: {
19
+ presentation: 'icon',
20
+ open: () => props.ctx.settings.open(),
21
+ isOpen: props.ctx.settings.isOpen(),
22
+ } }), _jsx(IconButton, { icon: _jsx(Glyph, { children: "\u2014" }), label: "\u6700\u5C0F\u5316", onClick: () => control('minimize') }), _jsx(IconButton, { icon: _jsx(Glyph, { children: "\u25A1" }), label: "\u6700\u5927\u5316\u5207\u6362", onClick: () => control('toggle-maximize') }), _jsx(IconButton, { icon: _jsx(Glyph, { children: "\u00D7" }), label: "\u5173\u95ED", onClick: () => control('close') })] })] }));
23
+ return (_jsx(AppShell, { header: header, children: active !== undefined
24
+ ? active.render()
25
+ : (_jsx("div", { style: { display: 'flex', minHeight: '100%', alignItems: 'center', justifyContent: 'center', padding: 24 }, children: _jsx(EmptyState, { title: "\u5C1A\u672A\u6FC0\u6D3B\u4E1A\u52A1\u5957\u4EF6", action: _jsx(Button, { intent: "primary", onClick: () => props.ctx.settings.open('plugins'), children: "\u6253\u5F00\u8BBE\u7F6E" }) }) })) }));
26
+ }
27
+ /** The fallback layout occupant. */
28
+ const fallbackPlugin = {
29
+ name: 'snap-rail fallback layout',
30
+ inject: ['ui', 'settings', 'pages', 'client'],
31
+ apply(ctx) {
32
+ ctx.ui.registerLayout(ctx, {
33
+ id: 'fallback',
34
+ order: 200,
35
+ precedence: 0,
36
+ provides: [
37
+ UI_SLOT_IDS.titlebar,
38
+ UI_SLOT_IDS.titlebarActions,
39
+ UI_SLOT_IDS.sidebar,
40
+ UI_SLOT_IDS.statusbar,
41
+ UI_SLOT_IDS.settingsEntry,
42
+ ],
43
+ window: { width: 1280, height: 800, minWidth: 960, minHeight: 600 },
44
+ ball: { size: 128 },
45
+ render: () => _jsx(FallbackShell, { ctx: ctx }),
46
+ });
47
+ },
48
+ };
49
+ export default fallbackPlugin;
50
+ //# sourceMappingURL=fallback.js.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The built-in UI substrate's root barrel: semantic contract, region slots,
3
+ * skin registry, and (as they land) components, layout primitives, settings,
4
+ * charts, runtime, and fallback.
5
+ *
6
+ * @module @snap-rail/ui
7
+ */
8
+ export * from './contract.ts';
9
+ export * from './charts.tsx';
10
+ export * from './components/index.ts';
11
+ export * from './fallback.tsx';
12
+ export * from './pages.tsx';
13
+ export * from './runtime.tsx';
14
+ export * from './settings.tsx';
15
+ export * from './slots.tsx';
16
+ export * from './skins.tsx';
17
+ export { default as slotsPlugin } from './slots.tsx';
18
+ export { default as skinsPlugin } from './skins.tsx';
19
+ //# sourceMappingURL=index.d.ts.map