@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,527 @@
1
+ //#region lib/types/contract.js
2
+ /**
3
+ * The semantic UI contract: component names, region-slot ids, scoped slot
4
+ * contexts, and the author-facing UI profile vocabulary. This module is pure
5
+ * (types, constants, guards) so host and renderer faces can both import it
6
+ * without dragging React or the renderer runtime into the host graph.
7
+ *
8
+ * @module @snap-rail/ui/contract
9
+ */
10
+ /** The author-declared relationship between a plugin and the skin contract. */
11
+ const UI_PROFILES = [
12
+ "native",
13
+ "integrated",
14
+ "custom"
15
+ ];
16
+ /** The stable region slots every layout may provide. */
17
+ const UI_SLOT_IDS = {
18
+ /** The one active layout of the operator window. */
19
+ layout: "shell.layout",
20
+ /** The operator titlebar. */
21
+ titlebar: "shell.titlebar",
22
+ /** Contributed titlebar actions. */
23
+ titlebarActions: "shell.titlebar.actions",
24
+ /** Sidebar extension area. */
25
+ sidebar: "shell.sidebar",
26
+ /** Statusbar extension area. */
27
+ statusbar: "shell.statusbar",
28
+ /** The global overlay stack (dialogs, confirms). */
29
+ overlay: "shell.overlay",
30
+ /** The floating ball surface face. */
31
+ ball: "shell.ball",
32
+ /** The settings trigger. */
33
+ settingsEntry: "settings.entry",
34
+ /** The settings surface itself. */
35
+ settingsSurface: "settings.surface"
36
+ };
37
+ /** A named custom slot is owned by a publisher package. */
38
+ const CUSTOM_SLOT_PATTERN = /^custom:[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*$/;
39
+ /** Check a region-slot id at runtime. */
40
+ function isValidSlotId(value) {
41
+ return Object.values(UI_SLOT_IDS).includes(value) || CUSTOM_SLOT_PATTERN.test(value);
42
+ }
43
+ /** The occupancy mode of every built-in slot. */
44
+ const UI_SLOT_MODES = {
45
+ [UI_SLOT_IDS.layout]: "one",
46
+ [UI_SLOT_IDS.titlebar]: "one",
47
+ [UI_SLOT_IDS.titlebarActions]: "many",
48
+ [UI_SLOT_IDS.sidebar]: "many",
49
+ [UI_SLOT_IDS.statusbar]: "many",
50
+ [UI_SLOT_IDS.overlay]: "many",
51
+ [UI_SLOT_IDS.ball]: "one",
52
+ [UI_SLOT_IDS.settingsEntry]: "one",
53
+ [UI_SLOT_IDS.settingsSurface]: "one"
54
+ };
55
+ /** Diagnostic kinds surfaced by the UI registry. */
56
+ const UI_DIAGNOSTIC_KINDS = [
57
+ "unknown-slot",
58
+ "missing-provider",
59
+ "invalid-context",
60
+ "duplicate-id",
61
+ "render-failed",
62
+ "declared-not-rendered"
63
+ ];
64
+ /**
65
+ * The component catalog. It is the shared vocabulary for the gallery, skin
66
+ * coverage checks, and author documentation; adding a component here is a
67
+ * contract change, not an implementation detail.
68
+ */
69
+ const UI_COMPONENTS = {
70
+ button: {
71
+ parts: [
72
+ "button.root",
73
+ "button.label",
74
+ "button.icon",
75
+ "button.spinner"
76
+ ],
77
+ slots: ["label", "icon"],
78
+ props: [
79
+ "intent",
80
+ "emphasis",
81
+ "size",
82
+ "loading",
83
+ "disabled"
84
+ ]
85
+ },
86
+ "icon-button": {
87
+ parts: ["icon-button.root", "icon-button.icon"],
88
+ slots: ["icon"],
89
+ props: [
90
+ "intent",
91
+ "emphasis",
92
+ "size",
93
+ "active",
94
+ "disabled"
95
+ ]
96
+ },
97
+ input: {
98
+ parts: [
99
+ "input.root",
100
+ "input.field",
101
+ "input.prefix",
102
+ "input.suffix",
103
+ "input.clear"
104
+ ],
105
+ slots: ["prefix", "suffix"],
106
+ props: [
107
+ "size",
108
+ "invalid",
109
+ "disabled"
110
+ ]
111
+ },
112
+ textarea: {
113
+ parts: ["textarea.root", "textarea.field"],
114
+ props: [
115
+ "size",
116
+ "invalid",
117
+ "disabled"
118
+ ]
119
+ },
120
+ "number-input": {
121
+ parts: [
122
+ "number-input.root",
123
+ "number-input.field",
124
+ "number-input.step-up",
125
+ "number-input.step-down"
126
+ ],
127
+ props: [
128
+ "size",
129
+ "invalid",
130
+ "disabled"
131
+ ]
132
+ },
133
+ select: {
134
+ parts: [
135
+ "select.root",
136
+ "select.trigger",
137
+ "select.value",
138
+ "select.chevron",
139
+ "select.content",
140
+ "select.item",
141
+ "select.item-indicator",
142
+ "select.empty"
143
+ ],
144
+ slots: ["empty"],
145
+ props: [
146
+ "size",
147
+ "invalid",
148
+ "disabled",
149
+ "presentation"
150
+ ]
151
+ },
152
+ "touch-select": {
153
+ parts: [
154
+ "touch-select.root",
155
+ "touch-select.trigger",
156
+ "touch-select.sheet",
157
+ "touch-select.option"
158
+ ],
159
+ props: ["invalid", "disabled"]
160
+ },
161
+ checkbox: {
162
+ parts: [
163
+ "checkbox.root",
164
+ "checkbox.box",
165
+ "checkbox.indicator",
166
+ "checkbox.label"
167
+ ],
168
+ slots: ["label"],
169
+ props: [
170
+ "checked",
171
+ "invalid",
172
+ "disabled"
173
+ ]
174
+ },
175
+ switch: {
176
+ parts: [
177
+ "switch.root",
178
+ "switch.thumb",
179
+ "switch.label"
180
+ ],
181
+ slots: ["label"],
182
+ props: ["checked", "disabled"]
183
+ },
184
+ "radio-group": {
185
+ parts: [
186
+ "radio-group.root",
187
+ "radio-group.item",
188
+ "radio-group.indicator",
189
+ "radio-group.label"
190
+ ],
191
+ props: ["value", "disabled"]
192
+ },
193
+ tabs: {
194
+ parts: [
195
+ "tabs.root",
196
+ "tabs.list",
197
+ "tabs.trigger",
198
+ "tabs.content"
199
+ ],
200
+ slots: ["list", "content"],
201
+ props: ["value", "presentation"]
202
+ },
203
+ table: {
204
+ parts: [
205
+ "table.root",
206
+ "table.header",
207
+ "table.body",
208
+ "table.row",
209
+ "table.head",
210
+ "table.cell",
211
+ "table.empty"
212
+ ],
213
+ slots: ["empty"]
214
+ },
215
+ card: {
216
+ parts: [
217
+ "card.root",
218
+ "card.header",
219
+ "card.title",
220
+ "card.description",
221
+ "card.body",
222
+ "card.footer"
223
+ ],
224
+ slots: [
225
+ "header",
226
+ "title",
227
+ "description",
228
+ "body",
229
+ "footer"
230
+ ]
231
+ },
232
+ panel: {
233
+ parts: [
234
+ "panel.root",
235
+ "panel.header",
236
+ "panel.title",
237
+ "panel.body",
238
+ "panel.footer"
239
+ ],
240
+ slots: [
241
+ "header",
242
+ "title",
243
+ "body",
244
+ "footer"
245
+ ]
246
+ },
247
+ dialog: {
248
+ parts: [
249
+ "dialog.root",
250
+ "dialog.overlay",
251
+ "dialog.panel",
252
+ "dialog.header",
253
+ "dialog.title",
254
+ "dialog.description",
255
+ "dialog.body",
256
+ "dialog.footer",
257
+ "dialog.close"
258
+ ],
259
+ slots: [
260
+ "header",
261
+ "title",
262
+ "description",
263
+ "body",
264
+ "footer"
265
+ ],
266
+ props: [
267
+ "open",
268
+ "presentation",
269
+ "size"
270
+ ]
271
+ },
272
+ sheet: {
273
+ parts: [
274
+ "sheet.root",
275
+ "sheet.overlay",
276
+ "sheet.panel",
277
+ "sheet.header",
278
+ "sheet.body",
279
+ "sheet.footer"
280
+ ],
281
+ slots: [
282
+ "header",
283
+ "body",
284
+ "footer"
285
+ ],
286
+ props: ["open", "presentation"]
287
+ },
288
+ popover: {
289
+ parts: [
290
+ "popover.root",
291
+ "popover.trigger",
292
+ "popover.content"
293
+ ],
294
+ slots: ["trigger", "content"]
295
+ },
296
+ tooltip: {
297
+ parts: [
298
+ "tooltip.root",
299
+ "tooltip.trigger",
300
+ "tooltip.content"
301
+ ],
302
+ slots: ["trigger", "content"]
303
+ },
304
+ menu: {
305
+ parts: [
306
+ "menu.root",
307
+ "menu.trigger",
308
+ "menu.content",
309
+ "menu.item",
310
+ "menu.separator"
311
+ ],
312
+ slots: ["trigger", "content"]
313
+ },
314
+ toast: {
315
+ parts: [
316
+ "toast.root",
317
+ "toast.title",
318
+ "toast.description",
319
+ "toast.action",
320
+ "toast.close"
321
+ ],
322
+ slots: ["action"]
323
+ },
324
+ progress: { parts: [
325
+ "progress.root",
326
+ "progress.track",
327
+ "progress.indicator"
328
+ ] },
329
+ badge: { parts: ["badge.root"] },
330
+ led: {
331
+ parts: ["led.root", "led.halo"],
332
+ props: ["tone"]
333
+ },
334
+ spinner: { parts: ["spinner.root"] },
335
+ "empty-state": {
336
+ parts: [
337
+ "empty-state.root",
338
+ "empty-state.icon",
339
+ "empty-state.title",
340
+ "empty-state.description",
341
+ "empty-state.action"
342
+ ],
343
+ slots: [
344
+ "icon",
345
+ "title",
346
+ "description",
347
+ "action"
348
+ ]
349
+ },
350
+ form: {
351
+ parts: [
352
+ "form.root",
353
+ "form.fields",
354
+ "form.actions"
355
+ ],
356
+ slots: ["fields", "actions"]
357
+ },
358
+ field: {
359
+ parts: [
360
+ "field.root",
361
+ "field.label",
362
+ "field.control",
363
+ "field.help",
364
+ "field.error"
365
+ ],
366
+ slots: [
367
+ "label",
368
+ "control",
369
+ "help",
370
+ "error"
371
+ ],
372
+ props: [
373
+ "invalid",
374
+ "required",
375
+ "disabled"
376
+ ]
377
+ },
378
+ "schema-form": {
379
+ parts: ["schema-form.root", "schema-form.field"],
380
+ slots: ["fields"]
381
+ },
382
+ "app-shell": {
383
+ parts: [
384
+ "app-shell.root",
385
+ "app-shell.header",
386
+ "app-shell.sidebar",
387
+ "app-shell.main",
388
+ "app-shell.footer"
389
+ ],
390
+ slots: [
391
+ "header",
392
+ "sidebar",
393
+ "main",
394
+ "footer"
395
+ ]
396
+ },
397
+ page: {
398
+ parts: [
399
+ "page.root",
400
+ "page.header",
401
+ "page.title",
402
+ "page.description",
403
+ "page.actions",
404
+ "page.body"
405
+ ],
406
+ slots: [
407
+ "header",
408
+ "title",
409
+ "description",
410
+ "actions",
411
+ "body"
412
+ ]
413
+ },
414
+ section: {
415
+ parts: [
416
+ "section.root",
417
+ "section.header",
418
+ "section.title",
419
+ "section.actions",
420
+ "section.body"
421
+ ],
422
+ slots: [
423
+ "header",
424
+ "title",
425
+ "actions",
426
+ "body"
427
+ ]
428
+ },
429
+ toolbar: {
430
+ parts: [
431
+ "toolbar.root",
432
+ "toolbar.start",
433
+ "toolbar.end"
434
+ ],
435
+ slots: ["start", "end"]
436
+ },
437
+ stack: {
438
+ parts: ["stack.root"],
439
+ props: [
440
+ "gap",
441
+ "padding",
442
+ "align"
443
+ ]
444
+ },
445
+ row: {
446
+ parts: ["row.root"],
447
+ props: [
448
+ "gap",
449
+ "padding",
450
+ "align",
451
+ "justify"
452
+ ]
453
+ },
454
+ grid: {
455
+ parts: ["grid.root"],
456
+ props: [
457
+ "gap",
458
+ "columns",
459
+ "padding"
460
+ ]
461
+ },
462
+ split: {
463
+ parts: [
464
+ "split.root",
465
+ "split.start",
466
+ "split.end"
467
+ ],
468
+ slots: ["start", "end"]
469
+ },
470
+ "scroll-area": { parts: [
471
+ "scroll-area.root",
472
+ "scroll-area.viewport",
473
+ "scroll-area.scrollbar"
474
+ ] },
475
+ "drag-scroll": { parts: ["drag-scroll.root", "drag-scroll.viewport"] },
476
+ visualization: {
477
+ parts: [
478
+ "visualization.root",
479
+ "visualization.header",
480
+ "visualization.title",
481
+ "visualization.actions",
482
+ "visualization.body",
483
+ "visualization.empty",
484
+ "visualization.error",
485
+ "visualization.loading"
486
+ ],
487
+ slots: [
488
+ "header",
489
+ "title",
490
+ "actions",
491
+ "body",
492
+ "empty",
493
+ "error",
494
+ "loading"
495
+ ],
496
+ props: ["state"]
497
+ },
498
+ "chart-frame": {
499
+ parts: [
500
+ "chart-frame.root",
501
+ "chart-frame.header",
502
+ "chart-frame.title",
503
+ "chart-frame.actions",
504
+ "chart-frame.body"
505
+ ],
506
+ slots: [
507
+ "header",
508
+ "title",
509
+ "actions",
510
+ "body"
511
+ ]
512
+ },
513
+ settings: { parts: [
514
+ "settings.root",
515
+ "settings.header",
516
+ "settings.title",
517
+ "settings.body",
518
+ "settings.nav",
519
+ "settings.nav-item",
520
+ "settings.nav-icon",
521
+ "settings.group",
522
+ "settings.group-title",
523
+ "settings.content"
524
+ ] }
525
+ };
526
+ //#endregion
527
+ export { CUSTOM_SLOT_PATTERN, UI_COMPONENTS, UI_DIAGNOSTIC_KINDS, UI_PROFILES, UI_SLOT_IDS, UI_SLOT_MODES, isValidSlotId };