@snap-rail/ui 0.1.0 → 0.2.0

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 (49) hide show
  1. package/lib/charts.js +6 -29
  2. package/lib/contract.js +119 -78
  3. package/lib/fallback.js +11 -1
  4. package/lib/index.js +2466 -735
  5. package/lib/runtime.js +1552 -490
  6. package/lib/settings.js +1162 -244
  7. package/lib/skins.js +163 -189
  8. package/lib/types/charts.d.ts +1 -1
  9. package/lib/types/charts.js +5 -5
  10. package/lib/types/components/alert.d.ts +57 -0
  11. package/lib/types/components/alert.js +46 -0
  12. package/lib/types/components/controls.d.ts +74 -11
  13. package/lib/types/components/controls.js +60 -17
  14. package/lib/types/components/dialog.d.ts +5 -5
  15. package/lib/types/components/dialog.js +2 -2
  16. package/lib/types/components/form-rhf.d.ts +56 -0
  17. package/lib/types/components/form-rhf.js +74 -0
  18. package/lib/types/components/form.d.ts +33 -5
  19. package/lib/types/components/form.js +22 -6
  20. package/lib/types/components/index.d.ts +7 -0
  21. package/lib/types/components/index.js +7 -0
  22. package/lib/types/components/input.d.ts +16 -7
  23. package/lib/types/components/input.js +39 -9
  24. package/lib/types/components/layout.d.ts +32 -7
  25. package/lib/types/components/layout.js +88 -15
  26. package/lib/types/components/overlay.d.ts +95 -0
  27. package/lib/types/components/overlay.js +138 -0
  28. package/lib/types/components/schema-form.d.ts +16 -4
  29. package/lib/types/components/schema-form.js +69 -40
  30. package/lib/types/components/slider.d.ts +18 -0
  31. package/lib/types/components/slider.js +15 -0
  32. package/lib/types/contract.d.ts +49 -37
  33. package/lib/types/contract.js +49 -33
  34. package/lib/types/fallback.js +1 -1
  35. package/lib/types/runtime.d.ts +23 -1
  36. package/lib/types/runtime.js +77 -20
  37. package/lib/types/settings-pages/appearance.d.ts +6 -4
  38. package/lib/types/settings-pages/appearance.js +33 -36
  39. package/lib/types/settings-pages/plugin-feed.d.ts +17 -0
  40. package/lib/types/settings-pages/plugin-feed.js +66 -0
  41. package/lib/types/settings-pages/plugins.d.ts +10 -5
  42. package/lib/types/settings-pages/plugins.js +284 -21
  43. package/lib/types/settings.d.ts +1 -0
  44. package/lib/types/settings.js +14 -8
  45. package/lib/types/skins.d.ts +38 -44
  46. package/lib/types/skins.js +172 -169
  47. package/package.json +16 -9
  48. package/src/styles/base.css +251 -5
  49. package/src/styles/default.css +315 -136
@@ -1,58 +1,87 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { part } from "../utils.js";
2
3
  import { Field } from "./form.js";
3
4
  import { Input, NumberInput, Textarea } from "./input.js";
4
5
  import { Switch, TouchSelect } from "./controls.js";
6
+ /** The closed literal set a property may take: its `enum`, or — for a union of
7
+ * scalar literals — the flattened `const` values of the `anyOf` branches, in
8
+ * declaration order. `undefined` when the property is not a closed literal set
9
+ * (open unions, non-scalar consts, absent both fields). */
10
+ export function literalValuesOf(property) {
11
+ if (Array.isArray(property.enum))
12
+ return property.enum;
13
+ const branches = property.anyOf;
14
+ if (!Array.isArray(branches) || branches.length === 0)
15
+ return undefined;
16
+ const values = [];
17
+ for (const branch of branches) {
18
+ if (branch === null || typeof branch !== 'object' || branch.anyOf !== undefined)
19
+ return undefined;
20
+ if (!('const' in branch))
21
+ return undefined;
22
+ const value = branch.const;
23
+ if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean')
24
+ return undefined;
25
+ values.push(value);
26
+ }
27
+ return values;
28
+ }
5
29
  function asRecord(value) {
6
30
  return value !== null && typeof value === 'object' && !Array.isArray(value)
7
31
  ? value
8
32
  : {};
9
33
  }
10
34
  /** Render a flat JSON-Schema object as semantic fields. */
11
- export function SchemaForm({ schema, value, onChange, idPrefix = 'schema' }) {
35
+ export function SchemaForm({ schema, value, onChange, idPrefix = 'schema', columns }) {
12
36
  const properties = schema.properties ?? {};
13
37
  const required = new Set(schema.required ?? []);
14
38
  const update = (key, next) => {
15
39
  onChange({ ...value, [key]: next });
16
40
  };
17
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 'var(--snap-space-md)' }, children: [Object.entries(properties).map(([key, property]) => {
18
- const id = `${idPrefix}-${key}`;
19
- const current = value[key] ?? property.default;
20
- const label = property.title ?? key;
21
- const common = {
22
- label,
23
- htmlFor: id,
24
- ...(property.description !== undefined ? { help: property.description } : {}),
25
- ...(required.has(key) ? { required: true } : {}),
26
- };
27
- if (Array.isArray(property.enum)) {
28
- const values = property.enum;
29
- const options = values.map(item => ({ value: String(item), label: String(item) }));
30
- return (_jsx(Field, { ...common, children: _jsx(TouchSelect, { ...current !== undefined ? { value: String(current) } : {}, options: options, onValueChange: next => {
31
- update(key, values.find(item => String(item) === next) ?? next);
32
- }, "aria-label": String(label) }) }, key));
33
- }
34
- if (property.type === 'boolean') {
35
- return (_jsx(Field, { ...common, children: _jsx(Switch, { checked: current === true, onCheckedChange: next => update(key, next), label: current === true ? '开启' : '关闭' }) }, key));
36
- }
37
- if (property.type === 'number' || property.type === 'integer') {
38
- return (_jsx(Field, { ...common, children: _jsx(NumberInput, { id: id, value: typeof current === 'number' ? current : '', ...property.minimum !== undefined ? { min: property.minimum } : {}, ...property.maximum !== undefined ? { max: property.maximum } : {}, onChange: event => {
39
- const raw = event.target.value;
40
- update(key, raw === '' ? undefined : Number(raw));
41
- } }) }, key));
42
- }
43
- if (property.type === 'object' || property.type === 'array') {
44
- return (_jsx(Field, { ...common, help: property.description ?? 'JSON 值', children: _jsx(Textarea, { id: id, rows: 4, defaultValue: JSON.stringify(current ?? (property.type === 'array' ? [] : {}), null, 2), onBlur: event => {
45
- try {
46
- update(key, JSON.parse(event.target.value));
47
- }
48
- catch {
49
- // Keep the invalid draft in the textarea; the driver's
50
- // schema rejects it on submit with a readable error.
51
- }
52
- } }) }, key));
53
- }
54
- return (_jsx(Field, { ...common, children: _jsx(Input, { id: id, value: typeof current === 'string' || typeof current === 'number' ? String(current) : '', onChange: event => update(key, event.target.value) }) }, key));
55
- }), Object.keys(properties).length === 0 && (_jsx("span", { style: { color: 'var(--snap-color-muted)' }, children: "\u8BE5\u9A71\u52A8\u6CA1\u6709\u989D\u5916\u914D\u7F6E\u9879\u3002" }))] }));
41
+ const renderField = (key, property) => {
42
+ const id = `${idPrefix}-${key}`;
43
+ const current = value[key] ?? property.default;
44
+ const label = property.title ?? key;
45
+ const common = {
46
+ label,
47
+ htmlFor: id,
48
+ ...(property.description !== undefined ? { help: property.description } : {}),
49
+ ...(required.has(key) ? { required: true } : {}),
50
+ };
51
+ const values = literalValuesOf(property);
52
+ if (values !== undefined) {
53
+ const options = values.map(item => ({ value: String(item), label: String(item) }));
54
+ return (_jsx(Field, { ...common, children: _jsx(TouchSelect, { ...current !== undefined ? { value: String(current) } : {}, options: options, onValueChange: next => {
55
+ update(key, values.find(item => String(item) === next) ?? next);
56
+ }, "aria-label": String(label) }) }));
57
+ }
58
+ if (property.type === 'boolean') {
59
+ // The field title is the label; the switch itself stays unlabeled so
60
+ // the row does not repeat a hardcoded on/off caption.
61
+ return (_jsx(Field, { ...common, children: _jsx(Switch, { checked: current === true, onCheckedChange: next => update(key, next), "aria-label": String(label) }) }));
62
+ }
63
+ if (property.type === 'number' || property.type === 'integer') {
64
+ return (_jsx(Field, { ...common, children: _jsx(NumberInput, { id: id, value: typeof current === 'number' ? current : '', ...property.minimum !== undefined ? { min: property.minimum } : {}, ...property.maximum !== undefined ? { max: property.maximum } : {}, onChange: event => {
65
+ const raw = event.target.value;
66
+ update(key, raw === '' ? undefined : Number(raw));
67
+ } }) }));
68
+ }
69
+ if (property.type === 'object' || property.type === 'array') {
70
+ return (_jsx(Field, { ...common, help: property.description ?? 'JSON 值', children: _jsx(Textarea, { id: id, rows: 4, defaultValue: JSON.stringify(current ?? (property.type === 'array' ? [] : {}), null, 2), onBlur: event => {
71
+ try {
72
+ update(key, JSON.parse(event.target.value));
73
+ }
74
+ catch {
75
+ // Keep the invalid draft in the textarea; the driver's
76
+ // schema rejects it on submit with a readable error.
77
+ }
78
+ } }) }));
79
+ }
80
+ return (_jsx(Field, { ...common, children: _jsx(Input, { id: id, value: typeof current === 'string' || typeof current === 'number' ? String(current) : '', onChange: event => update(key, event.target.value) }) }));
81
+ };
82
+ return (_jsxs("div", { ...part('schema-form', 'root'), className: "snap-schema-form", style: columns !== undefined
83
+ ? { display: 'grid', gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`, gap: 'var(--snap-space-md)' }
84
+ : { display: 'flex', flexDirection: 'column', gap: 'var(--snap-space-md)' }, children: [Object.entries(properties).map(([key, property]) => (_jsx("div", { ...part('schema-form', 'field'), children: renderField(key, property) }, key))), Object.keys(properties).length === 0 && (_jsx("span", { style: { color: 'var(--snap-color-muted)' }, children: "\u8BE5\u9A71\u52A8\u6CA1\u6709\u989D\u5916\u914D\u7F6E\u9879\u3002" }))] }));
56
85
  }
57
86
  /** Normalize a driver's JSON Schema (which may carry `$schema`). */
58
87
  export function schemaNodeOf(value) {
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Coarse value adjustment for touch operation: a Radix slider with the
3
+ * semantic anatomy (`slider.root/track/range/thumb`). Thumb size rides the
4
+ * skin's control tokens so gloved operation keeps a real target.
5
+ *
6
+ * @module @snap-rail/ui/components/slider
7
+ */
8
+ import * as SliderPrimitive from '@radix-ui/react-slider';
9
+ import type { ComponentPropsWithoutRef, ReactNode } from 'react';
10
+ /** Props of {@link Slider}. */
11
+ export interface SliderProps extends ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {
12
+ /** The track label announced to assistive tech. */
13
+ label?: string;
14
+ children?: ReactNode;
15
+ }
16
+ /** A ranged control with a large touch target and keyboard stepping. */
17
+ export declare function Slider({ label, className, children, ...props }: SliderProps): ReactNode;
18
+ //# sourceMappingURL=slider.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Coarse value adjustment for touch operation: a Radix slider with the
4
+ * semantic anatomy (`slider.root/track/range/thumb`). Thumb size rides the
5
+ * skin's control tokens so gloved operation keeps a real target.
6
+ *
7
+ * @module @snap-rail/ui/components/slider
8
+ */
9
+ import * as SliderPrimitive from '@radix-ui/react-slider';
10
+ import { cn, part } from "../utils.js";
11
+ /** A ranged control with a large touch target and keyboard stepping. */
12
+ export function Slider({ label, className, children, ...props }) {
13
+ return (_jsxs(SliderPrimitive.Root, { ...part('slider', 'root'), className: cn('snap-slider', className), "aria-label": label, ...props, children: [_jsx(SliderPrimitive.Track, { ...part('slider', 'track'), className: "snap-slider-track", children: _jsx(SliderPrimitive.Range, { ...part('slider', 'range'), className: "snap-slider-range" }) }), _jsx(SliderPrimitive.Thumb, { ...part('slider', 'thumb'), className: "snap-slider-thumb", "aria-label": label }), children] }));
14
+ }
15
+ //# sourceMappingURL=slider.js.map
@@ -188,11 +188,11 @@ export declare const UI_COMPONENTS: {
188
188
  readonly input: {
189
189
  readonly parts: readonly ["input.root", "input.field", "input.prefix", "input.suffix", "input.clear"];
190
190
  readonly slots: readonly ["prefix", "suffix"];
191
- readonly props: readonly ["size", "invalid", "disabled"];
191
+ readonly props: readonly ["size", "invalid", "disabled", "fieldClassName"];
192
192
  };
193
193
  readonly textarea: {
194
194
  readonly parts: readonly ["textarea.root", "textarea.field"];
195
- readonly props: readonly ["size", "invalid", "disabled"];
195
+ readonly props: readonly ["size", "invalid", "disabled", "fieldClassName"];
196
196
  };
197
197
  readonly 'number-input': {
198
198
  readonly parts: readonly ["number-input.root", "number-input.field", "number-input.step-up", "number-input.step-down"];
@@ -200,31 +200,31 @@ export declare const UI_COMPONENTS: {
200
200
  };
201
201
  readonly select: {
202
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"];
203
+ readonly slots: readonly ["empty", "children"];
204
+ readonly props: readonly ["size", "invalid", "disabled", "defaultValue", "side", "align"];
205
205
  };
206
206
  readonly 'touch-select': {
207
207
  readonly parts: readonly ["touch-select.root", "touch-select.trigger", "touch-select.sheet", "touch-select.option"];
208
208
  readonly props: readonly ["invalid", "disabled"];
209
209
  };
210
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"];
211
+ readonly parts: readonly ["checkbox.root", "checkbox.indicator", "checkbox.label", "checkbox.field", "checkbox.description"];
212
+ readonly slots: readonly ["label", "description"];
213
+ readonly props: readonly ["checked", "invalid", "disabled", "labelPosition"];
214
214
  };
215
215
  readonly switch: {
216
- readonly parts: readonly ["switch.root", "switch.thumb", "switch.label"];
217
- readonly slots: readonly ["label"];
218
- readonly props: readonly ["checked", "disabled"];
216
+ readonly parts: readonly ["switch.root", "switch.thumb", "switch.label", "switch.field", "switch.description"];
217
+ readonly slots: readonly ["label", "description"];
218
+ readonly props: readonly ["checked", "disabled", "labelPosition"];
219
219
  };
220
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"];
221
+ readonly parts: readonly ["radio-group.root", "radio-group.item", "radio-group.indicator", "radio-group.label", "radio-group.block", "radio-group.description"];
222
+ readonly props: readonly ["value", "disabled", "label", "description"];
223
223
  };
224
224
  readonly tabs: {
225
225
  readonly parts: readonly ["tabs.root", "tabs.list", "tabs.trigger", "tabs.content"];
226
226
  readonly slots: readonly ["list", "content"];
227
- readonly props: readonly ["value", "presentation"];
227
+ readonly props: readonly ["value"];
228
228
  };
229
229
  readonly table: {
230
230
  readonly parts: readonly ["table.root", "table.header", "table.body", "table.row", "table.head", "table.cell", "table.empty"];
@@ -239,29 +239,29 @@ export declare const UI_COMPONENTS: {
239
239
  readonly slots: readonly ["header", "title", "body", "footer"];
240
240
  };
241
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"];
242
+ readonly parts: readonly ["dialog.overlay", "dialog.panel", "dialog.header", "dialog.title", "dialog.description", "dialog.body", "dialog.footer", "dialog.close"];
243
243
  readonly slots: readonly ["header", "title", "description", "body", "footer"];
244
244
  readonly props: readonly ["open", "presentation", "size"];
245
245
  };
246
246
  readonly sheet: {
247
- readonly parts: readonly ["sheet.root", "sheet.overlay", "sheet.panel", "sheet.header", "sheet.body", "sheet.footer"];
247
+ readonly parts: readonly ["dialog.overlay", "dialog.panel", "dialog.header", "dialog.title", "dialog.description", "dialog.body", "dialog.footer"];
248
248
  readonly slots: readonly ["header", "body", "footer"];
249
249
  readonly props: readonly ["open", "presentation"];
250
250
  };
251
251
  readonly popover: {
252
- readonly parts: readonly ["popover.root", "popover.trigger", "popover.content"];
252
+ readonly parts: readonly ["popover.trigger", "popover.content"];
253
253
  readonly slots: readonly ["trigger", "content"];
254
254
  };
255
255
  readonly tooltip: {
256
- readonly parts: readonly ["tooltip.root", "tooltip.trigger", "tooltip.content"];
256
+ readonly parts: readonly ["tooltip.trigger", "tooltip.content"];
257
257
  readonly slots: readonly ["trigger", "content"];
258
258
  };
259
259
  readonly menu: {
260
- readonly parts: readonly ["menu.root", "menu.trigger", "menu.content", "menu.item", "menu.separator"];
260
+ readonly parts: readonly ["menu.trigger", "menu.content", "menu.item", "menu.checkbox-item", "menu.item-indicator", "menu.separator"];
261
261
  readonly slots: readonly ["trigger", "content"];
262
262
  };
263
263
  readonly toast: {
264
- readonly parts: readonly ["toast.root", "toast.title", "toast.description", "toast.action", "toast.close"];
264
+ readonly parts: readonly ["toast.root", "toast.title", "toast.description", "toast.action", "toast.close", "toast.viewport"];
265
265
  readonly slots: readonly ["action"];
266
266
  };
267
267
  readonly progress: {
@@ -274,6 +274,28 @@ export declare const UI_COMPONENTS: {
274
274
  readonly parts: readonly ["led.root", "led.halo"];
275
275
  readonly props: readonly ["tone"];
276
276
  };
277
+ readonly alert: {
278
+ readonly parts: readonly ["alert.root", "alert.title", "alert.description"];
279
+ readonly slots: readonly ["title", "description"];
280
+ readonly props: readonly ["intent"];
281
+ };
282
+ readonly separator: {
283
+ readonly parts: readonly ["separator.root"];
284
+ readonly props: readonly ["orientation"];
285
+ };
286
+ readonly skeleton: {
287
+ readonly parts: readonly ["skeleton.root"];
288
+ readonly props: readonly ["variant"];
289
+ };
290
+ readonly list: {
291
+ readonly parts: readonly ["list.root", "list.item", "list.leading", "list.content", "list.trailing"];
292
+ readonly slots: readonly ["leading", "trailing"];
293
+ readonly props: readonly ["divided", "selected", "disabled"];
294
+ };
295
+ readonly slider: {
296
+ readonly parts: readonly ["slider.root", "slider.track", "slider.range", "slider.thumb"];
297
+ readonly props: readonly ["value", "min", "max", "step"];
298
+ };
277
299
  readonly spinner: {
278
300
  readonly parts: readonly ["spinner.root"];
279
301
  };
@@ -284,15 +306,17 @@ export declare const UI_COMPONENTS: {
284
306
  readonly form: {
285
307
  readonly parts: readonly ["form.root", "form.fields", "form.actions"];
286
308
  readonly slots: readonly ["fields", "actions"];
309
+ readonly props: readonly ["orientation", "gap", "columns", "form"];
287
310
  };
288
311
  readonly field: {
289
312
  readonly parts: readonly ["field.root", "field.label", "field.control", "field.help", "field.error"];
290
313
  readonly slots: readonly ["label", "control", "help", "error"];
291
- readonly props: readonly ["invalid", "required", "disabled"];
314
+ readonly props: readonly ["invalid", "required", "orientation", "labelWidth", "labelAlign"];
292
315
  };
293
316
  readonly 'schema-form': {
294
317
  readonly parts: readonly ["schema-form.root", "schema-form.field"];
295
318
  readonly slots: readonly ["fields"];
319
+ readonly props: readonly ["columns"];
296
320
  };
297
321
  readonly 'app-shell': {
298
322
  readonly parts: readonly ["app-shell.root", "app-shell.header", "app-shell.sidebar", "app-shell.main", "app-shell.footer"];
@@ -307,7 +331,7 @@ export declare const UI_COMPONENTS: {
307
331
  readonly slots: readonly ["header", "title", "actions", "body"];
308
332
  };
309
333
  readonly toolbar: {
310
- readonly parts: readonly ["toolbar.root", "toolbar.start", "toolbar.end"];
334
+ readonly parts: readonly ["toolbar.root", "toolbar.start", "toolbar.center", "toolbar.end"];
311
335
  readonly slots: readonly ["start", "end"];
312
336
  };
313
337
  readonly stack: {
@@ -327,19 +351,15 @@ export declare const UI_COMPONENTS: {
327
351
  readonly slots: readonly ["start", "end"];
328
352
  };
329
353
  readonly 'scroll-area': {
330
- readonly parts: readonly ["scroll-area.root", "scroll-area.viewport", "scroll-area.scrollbar"];
354
+ readonly parts: readonly ["scroll-area.root", "scroll-area.viewport", "scroll-area.scrollbar", "scroll-area.thumb"];
331
355
  };
332
356
  readonly 'drag-scroll': {
333
357
  readonly parts: readonly ["drag-scroll.root", "drag-scroll.viewport"];
334
358
  };
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
359
  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"];
360
+ readonly parts: readonly ["chart-frame.root", "chart-frame.header", "chart-frame.title", "chart-frame.description", "chart-frame.actions", "chart-frame.body", "chart-frame.loading", "chart-frame.empty", "chart-frame.error"];
361
+ readonly slots: readonly ["header", "title", "description", "actions", "body", "empty", "error", "loading"];
362
+ readonly props: readonly ["state"];
343
363
  };
344
364
  readonly settings: {
345
365
  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"];
@@ -347,12 +367,4 @@ export declare const UI_COMPONENTS: {
347
367
  };
348
368
  /** One semantic component name. */
349
369
  export type UiComponentName = keyof typeof UI_COMPONENTS;
350
- /** The presentation targets a skin may tune. */
351
- export declare const PRESENTATION_TARGETS: readonly ["dialog", "select", "tabs", "toast"];
352
- /** One presentation target. */
353
- export type PresentationTarget = (typeof PRESENTATION_TARGETS)[number];
354
- /** The presentation variants the core implements. */
355
- export declare const PRESENTATION_VARIANTS: readonly ["modal", "sheet", "fullscreen", "popover", "segmented", "inline"];
356
- /** One presentation variant. */
357
- export type PresentationVariant = (typeof PRESENTATION_VARIANTS)[number];
358
370
  //# sourceMappingURL=contract.d.ts.map
@@ -76,11 +76,11 @@ export const UI_COMPONENTS = {
76
76
  input: {
77
77
  parts: ['input.root', 'input.field', 'input.prefix', 'input.suffix', 'input.clear'],
78
78
  slots: ['prefix', 'suffix'],
79
- props: ['size', 'invalid', 'disabled'],
79
+ props: ['size', 'invalid', 'disabled', 'fieldClassName'],
80
80
  },
81
81
  textarea: {
82
82
  parts: ['textarea.root', 'textarea.field'],
83
- props: ['size', 'invalid', 'disabled'],
83
+ props: ['size', 'invalid', 'disabled', 'fieldClassName'],
84
84
  },
85
85
  'number-input': {
86
86
  parts: ['number-input.root', 'number-input.field', 'number-input.step-up', 'number-input.step-down'],
@@ -88,31 +88,31 @@ export const UI_COMPONENTS = {
88
88
  },
89
89
  select: {
90
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'],
91
+ slots: ['empty', 'children'],
92
+ props: ['size', 'invalid', 'disabled', 'defaultValue', 'side', 'align'],
93
93
  },
94
94
  'touch-select': {
95
95
  parts: ['touch-select.root', 'touch-select.trigger', 'touch-select.sheet', 'touch-select.option'],
96
96
  props: ['invalid', 'disabled'],
97
97
  },
98
98
  checkbox: {
99
- parts: ['checkbox.root', 'checkbox.box', 'checkbox.indicator', 'checkbox.label'],
100
- slots: ['label'],
101
- props: ['checked', 'invalid', 'disabled'],
99
+ parts: ['checkbox.root', 'checkbox.indicator', 'checkbox.label', 'checkbox.field', 'checkbox.description'],
100
+ slots: ['label', 'description'],
101
+ props: ['checked', 'invalid', 'disabled', 'labelPosition'],
102
102
  },
103
103
  switch: {
104
- parts: ['switch.root', 'switch.thumb', 'switch.label'],
105
- slots: ['label'],
106
- props: ['checked', 'disabled'],
104
+ parts: ['switch.root', 'switch.thumb', 'switch.label', 'switch.field', 'switch.description'],
105
+ slots: ['label', 'description'],
106
+ props: ['checked', 'disabled', 'labelPosition'],
107
107
  },
108
108
  'radio-group': {
109
- parts: ['radio-group.root', 'radio-group.item', 'radio-group.indicator', 'radio-group.label'],
110
- props: ['value', 'disabled'],
109
+ parts: ['radio-group.root', 'radio-group.item', 'radio-group.indicator', 'radio-group.label', 'radio-group.block', 'radio-group.description'],
110
+ props: ['value', 'disabled', 'label', 'description'],
111
111
  },
112
112
  tabs: {
113
113
  parts: ['tabs.root', 'tabs.list', 'tabs.trigger', 'tabs.content'],
114
114
  slots: ['list', 'content'],
115
- props: ['value', 'presentation'],
115
+ props: ['value'],
116
116
  },
117
117
  table: {
118
118
  parts: ['table.root', 'table.header', 'table.body', 'table.row', 'table.head', 'table.cell', 'table.empty'],
@@ -127,29 +127,29 @@ export const UI_COMPONENTS = {
127
127
  slots: ['header', 'title', 'body', 'footer'],
128
128
  },
129
129
  dialog: {
130
- parts: ['dialog.root', 'dialog.overlay', 'dialog.panel', 'dialog.header', 'dialog.title', 'dialog.description', 'dialog.body', 'dialog.footer', 'dialog.close'],
130
+ parts: ['dialog.overlay', 'dialog.panel', 'dialog.header', 'dialog.title', 'dialog.description', 'dialog.body', 'dialog.footer', 'dialog.close'],
131
131
  slots: ['header', 'title', 'description', 'body', 'footer'],
132
132
  props: ['open', 'presentation', 'size'],
133
133
  },
134
134
  sheet: {
135
- parts: ['sheet.root', 'sheet.overlay', 'sheet.panel', 'sheet.header', 'sheet.body', 'sheet.footer'],
135
+ parts: ['dialog.overlay', 'dialog.panel', 'dialog.header', 'dialog.title', 'dialog.description', 'dialog.body', 'dialog.footer'],
136
136
  slots: ['header', 'body', 'footer'],
137
137
  props: ['open', 'presentation'],
138
138
  },
139
139
  popover: {
140
- parts: ['popover.root', 'popover.trigger', 'popover.content'],
140
+ parts: ['popover.trigger', 'popover.content'],
141
141
  slots: ['trigger', 'content'],
142
142
  },
143
143
  tooltip: {
144
- parts: ['tooltip.root', 'tooltip.trigger', 'tooltip.content'],
144
+ parts: ['tooltip.trigger', 'tooltip.content'],
145
145
  slots: ['trigger', 'content'],
146
146
  },
147
147
  menu: {
148
- parts: ['menu.root', 'menu.trigger', 'menu.content', 'menu.item', 'menu.separator'],
148
+ parts: ['menu.trigger', 'menu.content', 'menu.item', 'menu.checkbox-item', 'menu.item-indicator', 'menu.separator'],
149
149
  slots: ['trigger', 'content'],
150
150
  },
151
151
  toast: {
152
- parts: ['toast.root', 'toast.title', 'toast.description', 'toast.action', 'toast.close'],
152
+ parts: ['toast.root', 'toast.title', 'toast.description', 'toast.action', 'toast.close', 'toast.viewport'],
153
153
  slots: ['action'],
154
154
  },
155
155
  progress: {
@@ -162,6 +162,28 @@ export const UI_COMPONENTS = {
162
162
  parts: ['led.root', 'led.halo'],
163
163
  props: ['tone'],
164
164
  },
165
+ alert: {
166
+ parts: ['alert.root', 'alert.title', 'alert.description'],
167
+ slots: ['title', 'description'],
168
+ props: ['intent'],
169
+ },
170
+ separator: {
171
+ parts: ['separator.root'],
172
+ props: ['orientation'],
173
+ },
174
+ skeleton: {
175
+ parts: ['skeleton.root'],
176
+ props: ['variant'],
177
+ },
178
+ list: {
179
+ parts: ['list.root', 'list.item', 'list.leading', 'list.content', 'list.trailing'],
180
+ slots: ['leading', 'trailing'],
181
+ props: ['divided', 'selected', 'disabled'],
182
+ },
183
+ slider: {
184
+ parts: ['slider.root', 'slider.track', 'slider.range', 'slider.thumb'],
185
+ props: ['value', 'min', 'max', 'step'],
186
+ },
165
187
  spinner: {
166
188
  parts: ['spinner.root'],
167
189
  },
@@ -172,15 +194,17 @@ export const UI_COMPONENTS = {
172
194
  form: {
173
195
  parts: ['form.root', 'form.fields', 'form.actions'],
174
196
  slots: ['fields', 'actions'],
197
+ props: ['orientation', 'gap', 'columns', 'form'],
175
198
  },
176
199
  field: {
177
200
  parts: ['field.root', 'field.label', 'field.control', 'field.help', 'field.error'],
178
201
  slots: ['label', 'control', 'help', 'error'],
179
- props: ['invalid', 'required', 'disabled'],
202
+ props: ['invalid', 'required', 'orientation', 'labelWidth', 'labelAlign'],
180
203
  },
181
204
  'schema-form': {
182
205
  parts: ['schema-form.root', 'schema-form.field'],
183
206
  slots: ['fields'],
207
+ props: ['columns'],
184
208
  },
185
209
  'app-shell': {
186
210
  parts: ['app-shell.root', 'app-shell.header', 'app-shell.sidebar', 'app-shell.main', 'app-shell.footer'],
@@ -195,23 +219,19 @@ export const UI_COMPONENTS = {
195
219
  slots: ['header', 'title', 'actions', 'body'],
196
220
  },
197
221
  toolbar: {
198
- parts: ['toolbar.root', 'toolbar.start', 'toolbar.end'],
222
+ parts: ['toolbar.root', 'toolbar.start', 'toolbar.center', 'toolbar.end'],
199
223
  slots: ['start', 'end'],
200
224
  },
201
225
  stack: { parts: ['stack.root'], props: ['gap', 'padding', 'align'] },
202
226
  row: { parts: ['row.root'], props: ['gap', 'padding', 'align', 'justify'] },
203
227
  grid: { parts: ['grid.root'], props: ['gap', 'columns', 'padding'] },
204
228
  split: { parts: ['split.root', 'split.start', 'split.end'], slots: ['start', 'end'] },
205
- 'scroll-area': { parts: ['scroll-area.root', 'scroll-area.viewport', 'scroll-area.scrollbar'] },
229
+ 'scroll-area': { parts: ['scroll-area.root', 'scroll-area.viewport', 'scroll-area.scrollbar', 'scroll-area.thumb'] },
206
230
  '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
231
  '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'],
232
+ parts: ['chart-frame.root', 'chart-frame.header', 'chart-frame.title', 'chart-frame.description', 'chart-frame.actions', 'chart-frame.body', 'chart-frame.loading', 'chart-frame.empty', 'chart-frame.error'],
233
+ slots: ['header', 'title', 'description', 'actions', 'body', 'empty', 'error', 'loading'],
234
+ props: ['state'],
215
235
  },
216
236
  settings: {
217
237
  parts: [
@@ -228,8 +248,4 @@ export const UI_COMPONENTS = {
228
248
  ],
229
249
  },
230
250
  };
231
- /** The presentation targets a skin may tune. */
232
- export const PRESENTATION_TARGETS = ['dialog', 'select', 'tabs', 'toast'];
233
- /** The presentation variants the core implements. */
234
- export const PRESENTATION_VARIANTS = ['modal', 'sheet', 'fullscreen', 'popover', 'segmented', 'inline'];
235
251
  //# sourceMappingURL=contract.js.map
@@ -22,7 +22,7 @@ function FallbackShell(props) {
22
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
23
  return (_jsx(AppShell, { header: header, children: active !== undefined
24
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", description: "\u6253\u5F00\u8BBE\u7F6E\u7684\u300C\u63D2\u4EF6\u7BA1\u7406\u300D\u9875\uFF0C\u5B89\u88C5\u5E76\u542F\u7528\u4E00\u4E2A\u4E1A\u52A1\u5957\u4EF6\uFF1B\u9A71\u52A8\u4E5F\u5728\u540C\u4E00\u5904\u5B89\u88C5\u3002", action: _jsx(Button, { intent: "primary", onClick: () => props.ctx.settings.open('plugins'), children: "\u6253\u5F00\u8BBE\u7F6E" }) }) })) }));
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
26
  }
27
27
  /** The fallback layout occupant. */
28
28
  const fallbackPlugin = {
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @module @snap-rail/ui/runtime
9
9
  */
10
- import type { ClientHandle } from '@snap-rail/client-kernel';
10
+ import { type ClientHandle } from '@snap-rail/client-kernel';
11
11
  import { type HostLink } from '@snap-rail/connection';
12
12
  import { Context, type Plugin } from '@snap-rail/cordis';
13
13
  import type { SurfaceId } from '@snap-rail/protocol';
@@ -38,6 +38,28 @@ export declare function ClientProvider(props: {
38
38
  }): ReactNode;
39
39
  /** Read the client services (host link + surface) from a builtin page. */
40
40
  export declare function useClient(): ClientServices;
41
+ /**
42
+ * Options for {@link attachBallDrag}. Declared here (not re-exported from the
43
+ * kernel) so the published substrate's d.ts stands alone: the kernel is
44
+ * app-internal and never reaches npm, while this module is a base seed every
45
+ * pool face can `require` at runtime.
46
+ */
47
+ export interface BallDragOptions {
48
+ /** The surface's host link; the drag rides `shell.ball.move`. */
49
+ link: HostLink;
50
+ /** Answered when a press-release never turned into a drag. */
51
+ onClick: () => void;
52
+ /** Pointer travel in px beyond which a press becomes a drag (default 4). */
53
+ threshold?: number;
54
+ }
55
+ /**
56
+ * Wire an element as a ball face's single drag/click surface. Past the travel
57
+ * threshold the face only signals `shell.ball.move` `begin`/`end`; the host
58
+ * anchors the grab from the OS cursor and runs the dock settle, so the face
59
+ * never streams coordinates. A press-release inside the threshold is the
60
+ * click. Returns the disposer removing every listener.
61
+ */
62
+ export declare const attachBallDrag: (element: HTMLElement, options: BallDragOptions) => () => void;
41
63
  /** One occupant seat. */
42
64
  export interface OccupantSpec {
43
65
  plugin: Plugin;