@snap-rail/ui 0.1.1 → 0.3.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 (45) hide show
  1. package/lib/charts.js +12 -5
  2. package/lib/components/index.js +2195 -0
  3. package/lib/contract.js +138 -62
  4. package/lib/fallback.js +21 -4
  5. package/lib/index.js +4287 -261
  6. package/lib/runtime.js +206 -77
  7. package/lib/settings-pages/index.js +1326 -0
  8. package/lib/settings.js +122 -72
  9. package/lib/types/charts.d.ts +1 -1
  10. package/lib/types/charts.js +5 -5
  11. package/lib/types/components/alert.d.ts +57 -0
  12. package/lib/types/components/alert.js +46 -0
  13. package/lib/types/components/button.js +2 -2
  14. package/lib/types/components/combobox.d.ts +45 -0
  15. package/lib/types/components/combobox.js +108 -0
  16. package/lib/types/components/controls.d.ts +74 -11
  17. package/lib/types/components/controls.js +67 -24
  18. package/lib/types/components/dialog.js +1 -1
  19. package/lib/types/components/form-rhf.d.ts +56 -0
  20. package/lib/types/components/form-rhf.js +74 -0
  21. package/lib/types/components/form.d.ts +33 -5
  22. package/lib/types/components/form.js +22 -6
  23. package/lib/types/components/index.d.ts +8 -0
  24. package/lib/types/components/index.js +8 -0
  25. package/lib/types/components/input.d.ts +11 -5
  26. package/lib/types/components/input.js +34 -7
  27. package/lib/types/components/layout.d.ts +28 -6
  28. package/lib/types/components/layout.js +86 -13
  29. package/lib/types/components/overlay.d.ts +110 -0
  30. package/lib/types/components/overlay.js +185 -0
  31. package/lib/types/components/schema-form.d.ts +3 -1
  32. package/lib/types/components/schema-form.js +46 -40
  33. package/lib/types/components/slider.d.ts +18 -0
  34. package/lib/types/components/slider.js +15 -0
  35. package/lib/types/components/surface.js +12 -12
  36. package/lib/types/contract.d.ts +55 -30
  37. package/lib/types/contract.js +55 -30
  38. package/lib/types/runtime.js +3 -2
  39. package/lib/types/settings-pages/appearance.js +2 -2
  40. package/lib/types/settings-pages/plugins.js +2 -2
  41. package/lib/types/utils.d.ts +7 -1
  42. package/lib/types/utils.js +7 -1
  43. package/package.json +14 -7
  44. package/src/styles/base.css +315 -5
  45. package/src/styles/default.css +194 -6
@@ -1,4 +1,5 @@
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";
@@ -31,51 +32,56 @@ function asRecord(value) {
31
32
  : {};
32
33
  }
33
34
  /** Render a flat JSON-Schema object as semantic fields. */
34
- export function SchemaForm({ schema, value, onChange, idPrefix = 'schema' }) {
35
+ export function SchemaForm({ schema, value, onChange, idPrefix = 'schema', columns }) {
35
36
  const properties = schema.properties ?? {};
36
37
  const required = new Set(schema.required ?? []);
37
38
  const update = (key, next) => {
38
39
  onChange({ ...value, [key]: next });
39
40
  };
40
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 'var(--snap-space-md)' }, children: [Object.entries(properties).map(([key, property]) => {
41
- const id = `${idPrefix}-${key}`;
42
- const current = value[key] ?? property.default;
43
- const label = property.title ?? key;
44
- const common = {
45
- label,
46
- htmlFor: id,
47
- ...(property.description !== undefined ? { help: property.description } : {}),
48
- ...(required.has(key) ? { required: true } : {}),
49
- };
50
- const values = literalValuesOf(property);
51
- if (values !== undefined) {
52
- const options = values.map(item => ({ value: String(item), label: String(item) }));
53
- return (_jsx(Field, { ...common, children: _jsx(TouchSelect, { ...current !== undefined ? { value: String(current) } : {}, options: options, onValueChange: next => {
54
- update(key, values.find(item => String(item) === next) ?? next);
55
- }, "aria-label": String(label) }) }, key));
56
- }
57
- if (property.type === 'boolean') {
58
- return (_jsx(Field, { ...common, children: _jsx(Switch, { checked: current === true, onCheckedChange: next => update(key, next), label: current === true ? '开启' : '关闭' }) }, key));
59
- }
60
- if (property.type === 'number' || property.type === 'integer') {
61
- 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 => {
62
- const raw = event.target.value;
63
- update(key, raw === '' ? undefined : Number(raw));
64
- } }) }, key));
65
- }
66
- if (property.type === 'object' || property.type === 'array') {
67
- 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 => {
68
- try {
69
- update(key, JSON.parse(event.target.value));
70
- }
71
- catch {
72
- // Keep the invalid draft in the textarea; the driver's
73
- // schema rejects it on submit with a readable error.
74
- }
75
- } }) }, key));
76
- }
77
- 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));
78
- }), 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" }))] }));
79
85
  }
80
86
  /** Normalize a driver's JSON Schema (which may carry `$schema`). */
81
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, { className: cn('snap-slider', className), "aria-label": label, ...props, ...part('slider', 'root'), 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
@@ -2,31 +2,31 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn, part } from "../utils.js";
3
3
  /** A content card. */
4
4
  export function Card({ className, children, ...props }) {
5
- return _jsx("div", { ...part('card', 'root'), className: cn('snap-card', className), ...props, children: children });
5
+ return _jsx("div", { className: cn('snap-card', className), ...props, ...part('card', 'root'), children: children });
6
6
  }
7
7
  /** The card header region. */
8
8
  export function CardHeader({ className, children, ...props }) {
9
- return _jsx("div", { ...part('card', 'header'), className: cn('snap-card-header', className), ...props, children: children });
9
+ return _jsx("div", { className: cn('snap-card-header', className), ...props, ...part('card', 'header'), children: children });
10
10
  }
11
11
  /** The card title. */
12
12
  export function CardTitle({ className, children, ...props }) {
13
- return _jsx("div", { ...part('card', 'title'), className: cn('snap-card-title', className), ...props, children: children });
13
+ return _jsx("div", { className: cn('snap-card-title', className), ...props, ...part('card', 'title'), children: children });
14
14
  }
15
15
  /** The card description. */
16
16
  export function CardDescription({ className, children, ...props }) {
17
- return _jsx("div", { ...part('card', 'description'), className: cn('snap-card-description', className), ...props, children: children });
17
+ return _jsx("div", { className: cn('snap-card-description', className), ...props, ...part('card', 'description'), children: children });
18
18
  }
19
19
  /** The card body. */
20
20
  export function CardContent({ className, children, ...props }) {
21
- return _jsx("div", { ...part('card', 'body'), className: cn('snap-card-content', className), ...props, children: children });
21
+ return _jsx("div", { className: cn('snap-card-content', className), ...props, ...part('card', 'body'), children: children });
22
22
  }
23
23
  /** The card footer. */
24
24
  export function CardFooter({ className, children, ...props }) {
25
- return _jsx("div", { ...part('card', 'footer'), className: cn('snap-card-footer', className), ...props, children: children });
25
+ return _jsx("div", { className: cn('snap-card-footer', className), ...props, ...part('card', 'footer'), children: children });
26
26
  }
27
27
  /** A bounded panel with optional header/footer. */
28
28
  export function Panel({ title, actions, footer, className, children, ...props }) {
29
- return (_jsxs("div", { ...part('panel', 'root'), className: cn('snap-panel', className), ...props, children: [(title !== undefined || actions !== undefined) && (_jsxs("div", { ...part('panel', 'header'), className: "snap-panel-header", children: [_jsx("div", { ...part('panel', 'title'), children: title }), actions !== undefined && _jsx("div", { children: actions })] })), _jsx("div", { ...part('panel', 'body'), className: "snap-panel-body", children: children }), footer !== undefined && _jsx("div", { ...part('panel', 'footer'), className: "snap-panel-footer", children: footer })] }));
29
+ return (_jsxs("div", { className: cn('snap-panel', className), ...props, ...part('panel', 'root'), children: [(title !== undefined || actions !== undefined) && (_jsxs("div", { ...part('panel', 'header'), className: "snap-panel-header", children: [_jsx("div", { ...part('panel', 'title'), children: title }), actions !== undefined && _jsx("div", { children: actions })] })), _jsx("div", { ...part('panel', 'body'), className: "snap-panel-body", children: children }), footer !== undefined && _jsx("div", { ...part('panel', 'footer'), className: "snap-panel-footer", children: footer })] }));
30
30
  }
31
31
  /** A semantic table. */
32
32
  export function Table({ className, children, ...props }) {
@@ -34,23 +34,23 @@ export function Table({ className, children, ...props }) {
34
34
  }
35
35
  /** The table head. */
36
36
  export function TableHeader({ className, children, ...props }) {
37
- return _jsx("thead", { ...part('table', 'header'), className: cn('snap-table-header', className), ...props, children: children });
37
+ return _jsx("thead", { className: cn('snap-table-header', className), ...props, ...part('table', 'header'), children: children });
38
38
  }
39
39
  /** The table body. */
40
40
  export function TableBody({ className, children, ...props }) {
41
- return _jsx("tbody", { ...part('table', 'body'), className: cn('snap-table-body', className), ...props, children: children });
41
+ return _jsx("tbody", { className: cn('snap-table-body', className), ...props, ...part('table', 'body'), children: children });
42
42
  }
43
43
  /** A table row. */
44
44
  export function TableRow({ className, children, ...props }) {
45
- return _jsx("tr", { ...part('table', 'row'), className: cn('snap-table-row', className), ...props, children: children });
45
+ return _jsx("tr", { className: cn('snap-table-row', className), ...props, ...part('table', 'row'), children: children });
46
46
  }
47
47
  /** A table header cell. */
48
48
  export function TableHead({ className, children, ...props }) {
49
- return _jsx("th", { ...part('table', 'head'), className: cn('snap-table-head', className), ...props, children: children });
49
+ return _jsx("th", { className: cn('snap-table-head', className), ...props, ...part('table', 'head'), children: children });
50
50
  }
51
51
  /** A table body cell. */
52
52
  export function TableCell({ className, children, ...props }) {
53
- return _jsx("td", { ...part('table', 'cell'), className: cn('snap-table-cell', className), ...props, children: children });
53
+ return _jsx("td", { className: cn('snap-table-cell', className), ...props, ...part('table', 'cell'), children: children });
54
54
  }
55
55
  /** A full-width empty row. */
56
56
  export function TableEmpty({ colSpan, children }) {
@@ -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,36 @@ 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
- readonly parts: readonly ["touch-select.root", "touch-select.trigger", "touch-select.sheet", "touch-select.option"];
207
+ readonly parts: readonly ["touch-select.root", "touch-select.trigger", "touch-select.sheet", "touch-select.options"];
208
208
  readonly props: readonly ["invalid", "disabled"];
209
209
  };
210
+ readonly combobox: {
211
+ readonly parts: readonly ["combobox.root", "combobox.anchor", "combobox.list", "combobox.option", "combobox.empty"];
212
+ readonly slots: readonly ["empty"];
213
+ readonly props: readonly ["value", "options", "size", "invalid", "disabled", "loading", "onInputValueChange"];
214
+ };
210
215
  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"];
216
+ readonly parts: readonly ["checkbox.root", "checkbox.indicator", "checkbox.label", "checkbox.field", "checkbox.description"];
217
+ readonly slots: readonly ["label", "description"];
218
+ readonly props: readonly ["checked", "invalid", "disabled", "labelPosition"];
214
219
  };
215
220
  readonly switch: {
216
- readonly parts: readonly ["switch.root", "switch.thumb", "switch.label"];
217
- readonly slots: readonly ["label"];
218
- readonly props: readonly ["checked", "disabled"];
221
+ readonly parts: readonly ["switch.root", "switch.thumb", "switch.label", "switch.field", "switch.description"];
222
+ readonly slots: readonly ["label", "description"];
223
+ readonly props: readonly ["checked", "disabled", "labelPosition"];
219
224
  };
220
225
  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"];
226
+ readonly parts: readonly ["radio-group.root", "radio-group.item", "radio-group.indicator", "radio-group.label", "radio-group.block", "radio-group.description"];
227
+ readonly props: readonly ["value", "disabled", "label", "description"];
223
228
  };
224
229
  readonly tabs: {
225
230
  readonly parts: readonly ["tabs.root", "tabs.list", "tabs.trigger", "tabs.content"];
226
231
  readonly slots: readonly ["list", "content"];
227
- readonly props: readonly ["value", "presentation"];
232
+ readonly props: readonly ["value"];
228
233
  };
229
234
  readonly table: {
230
235
  readonly parts: readonly ["table.root", "table.header", "table.body", "table.row", "table.head", "table.cell", "table.empty"];
@@ -239,29 +244,29 @@ export declare const UI_COMPONENTS: {
239
244
  readonly slots: readonly ["header", "title", "body", "footer"];
240
245
  };
241
246
  readonly dialog: {
242
- readonly parts: readonly ["dialog.root", "dialog.overlay", "dialog.panel", "dialog.header", "dialog.title", "dialog.description", "dialog.body", "dialog.footer", "dialog.close"];
247
+ readonly parts: readonly ["dialog.overlay", "dialog.panel", "dialog.header", "dialog.title", "dialog.description", "dialog.body", "dialog.footer", "dialog.close"];
243
248
  readonly slots: readonly ["header", "title", "description", "body", "footer"];
244
249
  readonly props: readonly ["open", "presentation", "size"];
245
250
  };
246
251
  readonly sheet: {
247
- readonly parts: readonly ["sheet.root", "sheet.overlay", "sheet.panel", "sheet.header", "sheet.body", "sheet.footer"];
252
+ readonly parts: readonly ["dialog.overlay", "dialog.panel", "dialog.header", "dialog.title", "dialog.description", "dialog.body", "dialog.footer"];
248
253
  readonly slots: readonly ["header", "body", "footer"];
249
254
  readonly props: readonly ["open", "presentation"];
250
255
  };
251
256
  readonly popover: {
252
- readonly parts: readonly ["popover.root", "popover.trigger", "popover.content"];
257
+ readonly parts: readonly ["popover.trigger", "popover.content"];
253
258
  readonly slots: readonly ["trigger", "content"];
254
259
  };
255
260
  readonly tooltip: {
256
- readonly parts: readonly ["tooltip.root", "tooltip.trigger", "tooltip.content"];
261
+ readonly parts: readonly ["tooltip.trigger", "tooltip.content"];
257
262
  readonly slots: readonly ["trigger", "content"];
258
263
  };
259
264
  readonly menu: {
260
- readonly parts: readonly ["menu.root", "menu.trigger", "menu.content", "menu.item", "menu.separator"];
265
+ readonly parts: readonly ["menu.trigger", "menu.content", "menu.item", "menu.checkbox-item", "menu.item-indicator", "menu.separator"];
261
266
  readonly slots: readonly ["trigger", "content"];
262
267
  };
263
268
  readonly toast: {
264
- readonly parts: readonly ["toast.root", "toast.title", "toast.description", "toast.action", "toast.close"];
269
+ readonly parts: readonly ["toast.root", "toast.title", "toast.description", "toast.action", "toast.close", "toast.viewport"];
265
270
  readonly slots: readonly ["action"];
266
271
  };
267
272
  readonly progress: {
@@ -274,6 +279,28 @@ export declare const UI_COMPONENTS: {
274
279
  readonly parts: readonly ["led.root", "led.halo"];
275
280
  readonly props: readonly ["tone"];
276
281
  };
282
+ readonly alert: {
283
+ readonly parts: readonly ["alert.root", "alert.title", "alert.description"];
284
+ readonly slots: readonly ["title", "description"];
285
+ readonly props: readonly ["intent"];
286
+ };
287
+ readonly separator: {
288
+ readonly parts: readonly ["separator.root"];
289
+ readonly props: readonly ["orientation"];
290
+ };
291
+ readonly skeleton: {
292
+ readonly parts: readonly ["skeleton.root"];
293
+ readonly props: readonly ["variant"];
294
+ };
295
+ readonly list: {
296
+ readonly parts: readonly ["list.root", "list.item", "list.leading", "list.content", "list.trailing"];
297
+ readonly slots: readonly ["leading", "trailing"];
298
+ readonly props: readonly ["divided", "selected", "disabled"];
299
+ };
300
+ readonly slider: {
301
+ readonly parts: readonly ["slider.root", "slider.track", "slider.range", "slider.thumb"];
302
+ readonly props: readonly ["value", "min", "max", "step"];
303
+ };
277
304
  readonly spinner: {
278
305
  readonly parts: readonly ["spinner.root"];
279
306
  };
@@ -284,15 +311,17 @@ export declare const UI_COMPONENTS: {
284
311
  readonly form: {
285
312
  readonly parts: readonly ["form.root", "form.fields", "form.actions"];
286
313
  readonly slots: readonly ["fields", "actions"];
314
+ readonly props: readonly ["orientation", "gap", "columns", "form"];
287
315
  };
288
316
  readonly field: {
289
317
  readonly parts: readonly ["field.root", "field.label", "field.control", "field.help", "field.error"];
290
318
  readonly slots: readonly ["label", "control", "help", "error"];
291
- readonly props: readonly ["invalid", "required", "disabled"];
319
+ readonly props: readonly ["invalid", "required", "orientation", "labelWidth", "labelAlign"];
292
320
  };
293
321
  readonly 'schema-form': {
294
322
  readonly parts: readonly ["schema-form.root", "schema-form.field"];
295
323
  readonly slots: readonly ["fields"];
324
+ readonly props: readonly ["columns"];
296
325
  };
297
326
  readonly 'app-shell': {
298
327
  readonly parts: readonly ["app-shell.root", "app-shell.header", "app-shell.sidebar", "app-shell.main", "app-shell.footer"];
@@ -307,7 +336,7 @@ export declare const UI_COMPONENTS: {
307
336
  readonly slots: readonly ["header", "title", "actions", "body"];
308
337
  };
309
338
  readonly toolbar: {
310
- readonly parts: readonly ["toolbar.root", "toolbar.start", "toolbar.end"];
339
+ readonly parts: readonly ["toolbar.root", "toolbar.start", "toolbar.center", "toolbar.end"];
311
340
  readonly slots: readonly ["start", "end"];
312
341
  };
313
342
  readonly stack: {
@@ -327,19 +356,15 @@ export declare const UI_COMPONENTS: {
327
356
  readonly slots: readonly ["start", "end"];
328
357
  };
329
358
  readonly 'scroll-area': {
330
- readonly parts: readonly ["scroll-area.root", "scroll-area.viewport", "scroll-area.scrollbar"];
359
+ readonly parts: readonly ["scroll-area.root", "scroll-area.viewport", "scroll-area.scrollbar", "scroll-area.thumb"];
331
360
  };
332
361
  readonly 'drag-scroll': {
333
362
  readonly parts: readonly ["drag-scroll.root", "drag-scroll.viewport"];
334
363
  };
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
364
  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"];
365
+ 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"];
366
+ readonly slots: readonly ["header", "title", "description", "actions", "body", "empty", "error", "loading"];
367
+ readonly props: readonly ["state"];
343
368
  };
344
369
  readonly settings: {
345
370
  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"];
@@ -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,36 @@ 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
- parts: ['touch-select.root', 'touch-select.trigger', 'touch-select.sheet', 'touch-select.option'],
95
+ parts: ['touch-select.root', 'touch-select.trigger', 'touch-select.sheet', 'touch-select.options'],
96
96
  props: ['invalid', 'disabled'],
97
97
  },
98
+ combobox: {
99
+ parts: ['combobox.root', 'combobox.anchor', 'combobox.list', 'combobox.option', 'combobox.empty'],
100
+ slots: ['empty'],
101
+ props: ['value', 'options', 'size', 'invalid', 'disabled', 'loading', 'onInputValueChange'],
102
+ },
98
103
  checkbox: {
99
- parts: ['checkbox.root', 'checkbox.box', 'checkbox.indicator', 'checkbox.label'],
100
- slots: ['label'],
101
- props: ['checked', 'invalid', 'disabled'],
104
+ parts: ['checkbox.root', 'checkbox.indicator', 'checkbox.label', 'checkbox.field', 'checkbox.description'],
105
+ slots: ['label', 'description'],
106
+ props: ['checked', 'invalid', 'disabled', 'labelPosition'],
102
107
  },
103
108
  switch: {
104
- parts: ['switch.root', 'switch.thumb', 'switch.label'],
105
- slots: ['label'],
106
- props: ['checked', 'disabled'],
109
+ parts: ['switch.root', 'switch.thumb', 'switch.label', 'switch.field', 'switch.description'],
110
+ slots: ['label', 'description'],
111
+ props: ['checked', 'disabled', 'labelPosition'],
107
112
  },
108
113
  'radio-group': {
109
- parts: ['radio-group.root', 'radio-group.item', 'radio-group.indicator', 'radio-group.label'],
110
- props: ['value', 'disabled'],
114
+ parts: ['radio-group.root', 'radio-group.item', 'radio-group.indicator', 'radio-group.label', 'radio-group.block', 'radio-group.description'],
115
+ props: ['value', 'disabled', 'label', 'description'],
111
116
  },
112
117
  tabs: {
113
118
  parts: ['tabs.root', 'tabs.list', 'tabs.trigger', 'tabs.content'],
114
119
  slots: ['list', 'content'],
115
- props: ['value', 'presentation'],
120
+ props: ['value'],
116
121
  },
117
122
  table: {
118
123
  parts: ['table.root', 'table.header', 'table.body', 'table.row', 'table.head', 'table.cell', 'table.empty'],
@@ -127,29 +132,29 @@ export const UI_COMPONENTS = {
127
132
  slots: ['header', 'title', 'body', 'footer'],
128
133
  },
129
134
  dialog: {
130
- parts: ['dialog.root', 'dialog.overlay', 'dialog.panel', 'dialog.header', 'dialog.title', 'dialog.description', 'dialog.body', 'dialog.footer', 'dialog.close'],
135
+ parts: ['dialog.overlay', 'dialog.panel', 'dialog.header', 'dialog.title', 'dialog.description', 'dialog.body', 'dialog.footer', 'dialog.close'],
131
136
  slots: ['header', 'title', 'description', 'body', 'footer'],
132
137
  props: ['open', 'presentation', 'size'],
133
138
  },
134
139
  sheet: {
135
- parts: ['sheet.root', 'sheet.overlay', 'sheet.panel', 'sheet.header', 'sheet.body', 'sheet.footer'],
140
+ parts: ['dialog.overlay', 'dialog.panel', 'dialog.header', 'dialog.title', 'dialog.description', 'dialog.body', 'dialog.footer'],
136
141
  slots: ['header', 'body', 'footer'],
137
142
  props: ['open', 'presentation'],
138
143
  },
139
144
  popover: {
140
- parts: ['popover.root', 'popover.trigger', 'popover.content'],
145
+ parts: ['popover.trigger', 'popover.content'],
141
146
  slots: ['trigger', 'content'],
142
147
  },
143
148
  tooltip: {
144
- parts: ['tooltip.root', 'tooltip.trigger', 'tooltip.content'],
149
+ parts: ['tooltip.trigger', 'tooltip.content'],
145
150
  slots: ['trigger', 'content'],
146
151
  },
147
152
  menu: {
148
- parts: ['menu.root', 'menu.trigger', 'menu.content', 'menu.item', 'menu.separator'],
153
+ parts: ['menu.trigger', 'menu.content', 'menu.item', 'menu.checkbox-item', 'menu.item-indicator', 'menu.separator'],
149
154
  slots: ['trigger', 'content'],
150
155
  },
151
156
  toast: {
152
- parts: ['toast.root', 'toast.title', 'toast.description', 'toast.action', 'toast.close'],
157
+ parts: ['toast.root', 'toast.title', 'toast.description', 'toast.action', 'toast.close', 'toast.viewport'],
153
158
  slots: ['action'],
154
159
  },
155
160
  progress: {
@@ -162,6 +167,28 @@ export const UI_COMPONENTS = {
162
167
  parts: ['led.root', 'led.halo'],
163
168
  props: ['tone'],
164
169
  },
170
+ alert: {
171
+ parts: ['alert.root', 'alert.title', 'alert.description'],
172
+ slots: ['title', 'description'],
173
+ props: ['intent'],
174
+ },
175
+ separator: {
176
+ parts: ['separator.root'],
177
+ props: ['orientation'],
178
+ },
179
+ skeleton: {
180
+ parts: ['skeleton.root'],
181
+ props: ['variant'],
182
+ },
183
+ list: {
184
+ parts: ['list.root', 'list.item', 'list.leading', 'list.content', 'list.trailing'],
185
+ slots: ['leading', 'trailing'],
186
+ props: ['divided', 'selected', 'disabled'],
187
+ },
188
+ slider: {
189
+ parts: ['slider.root', 'slider.track', 'slider.range', 'slider.thumb'],
190
+ props: ['value', 'min', 'max', 'step'],
191
+ },
165
192
  spinner: {
166
193
  parts: ['spinner.root'],
167
194
  },
@@ -172,15 +199,17 @@ export const UI_COMPONENTS = {
172
199
  form: {
173
200
  parts: ['form.root', 'form.fields', 'form.actions'],
174
201
  slots: ['fields', 'actions'],
202
+ props: ['orientation', 'gap', 'columns', 'form'],
175
203
  },
176
204
  field: {
177
205
  parts: ['field.root', 'field.label', 'field.control', 'field.help', 'field.error'],
178
206
  slots: ['label', 'control', 'help', 'error'],
179
- props: ['invalid', 'required', 'disabled'],
207
+ props: ['invalid', 'required', 'orientation', 'labelWidth', 'labelAlign'],
180
208
  },
181
209
  'schema-form': {
182
210
  parts: ['schema-form.root', 'schema-form.field'],
183
211
  slots: ['fields'],
212
+ props: ['columns'],
184
213
  },
185
214
  'app-shell': {
186
215
  parts: ['app-shell.root', 'app-shell.header', 'app-shell.sidebar', 'app-shell.main', 'app-shell.footer'],
@@ -195,23 +224,19 @@ export const UI_COMPONENTS = {
195
224
  slots: ['header', 'title', 'actions', 'body'],
196
225
  },
197
226
  toolbar: {
198
- parts: ['toolbar.root', 'toolbar.start', 'toolbar.end'],
227
+ parts: ['toolbar.root', 'toolbar.start', 'toolbar.center', 'toolbar.end'],
199
228
  slots: ['start', 'end'],
200
229
  },
201
230
  stack: { parts: ['stack.root'], props: ['gap', 'padding', 'align'] },
202
231
  row: { parts: ['row.root'], props: ['gap', 'padding', 'align', 'justify'] },
203
232
  grid: { parts: ['grid.root'], props: ['gap', 'columns', 'padding'] },
204
233
  split: { parts: ['split.root', 'split.start', 'split.end'], slots: ['start', 'end'] },
205
- 'scroll-area': { parts: ['scroll-area.root', 'scroll-area.viewport', 'scroll-area.scrollbar'] },
234
+ 'scroll-area': { parts: ['scroll-area.root', 'scroll-area.viewport', 'scroll-area.scrollbar', 'scroll-area.thumb'] },
206
235
  '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
236
  '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'],
237
+ 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'],
238
+ slots: ['header', 'title', 'description', 'actions', 'body', 'empty', 'error', 'loading'],
239
+ props: ['state'],
215
240
  },
216
241
  settings: {
217
242
  parts: [
@@ -17,6 +17,7 @@ import { shellContract } from '@snap-rail/shell/contract';
17
17
  import { createContext, useContext, useEffect, useRef, useSyncExternalStore } from 'react';
18
18
  import { createRoot } from 'react-dom/client';
19
19
  import fallbackPlugin from "./fallback.js";
20
+ import { Toaster, TooltipProvider } from "./components/overlay.js";
20
21
  import pagesPlugin from "./pages.js";
21
22
  import settingsPlugin from "./settings.js";
22
23
  import { UI_SLOT_IDS } from "./contract.js";
@@ -101,7 +102,7 @@ function SettingsFallbackHost(props) {
101
102
  /** The operator-window root. */
102
103
  function MainRoot(props) {
103
104
  const layout = useActiveLayout();
104
- return (_jsxs(_Fragment, { children: [_jsx(StageProfiles, { ctx: props.ctx, layout: layout }), layout === undefined ? _jsx("div", { style: { padding: 24 }, children: "\u6CA1\u6709\u5DF2\u52A0\u8F7D\u7684\u5E03\u5C40\u63D2\u4EF6\u3002" }) : layout.render(), _jsx(OverlayHost, { ctx: props.ctx }), _jsx(SettingsFallbackHost, { ctx: props.ctx })] }));
105
+ return (_jsx(_Fragment, { children: _jsxs(TooltipProvider, { children: [_jsx(StageProfiles, { ctx: props.ctx, layout: layout }), layout === undefined ? _jsx("div", { style: { padding: 24 }, children: "\u6CA1\u6709\u5DF2\u52A0\u8F7D\u7684\u5E03\u5C40\u63D2\u4EF6\u3002" }) : layout.render(), _jsx(OverlayHost, { ctx: props.ctx }), _jsx(SettingsFallbackHost, { ctx: props.ctx }), _jsx(Toaster, {})] }) }));
105
106
  }
106
107
  /**
107
108
  * The fallback ball face used when no plugin occupies `shell.ball`: a themed
@@ -130,7 +131,7 @@ function BallRoot(props) {
130
131
  });
131
132
  }, [hasOccupant, link]);
132
133
  if (occupant !== undefined) {
133
- return _jsx("div", { style: { width: '100%', height: '100%' }, children: occupant.render({ surface: 'ball' }) });
134
+ return (_jsxs(TooltipProvider, { children: [_jsx("div", { style: { width: '100%', height: '100%' }, children: occupant.render({ surface: 'ball' }) }), _jsx(Toaster, {})] }));
134
135
  }
135
136
  return (_jsx("div", { ref: rootRef, "data-snap-part": "ball.root", style: {
136
137
  display: 'flex',
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { rpcErrorText } from '@snap-rail/connection';
3
3
  import { useEffect, useState } from 'react';
4
- import { Button, Page, Row, Section, Stack, Switch, Tabs, TabsList, TabsTrigger } from "../components/index.js";
4
+ import { Alert, Button, Page, Row, Section, Stack, Switch, Tabs, TabsList, TabsTrigger } from "../components/index.js";
5
5
  import { useSkinId, useSkins } from "../skins.js";
6
6
  import { useClient } from "../runtime.js";
7
7
  const THEME_KEY = 'ui.theme';
@@ -118,7 +118,7 @@ export function AppearancePage() {
118
118
  .catch(cause => { setError(cause instanceof Error ? cause.message : String(cause)); })
119
119
  .finally(() => { setBusy(false); });
120
120
  };
121
- return (_jsx(Page, { title: "\u5916\u89C2\u4E0E\u663E\u793A", description: "\u4E3B\u9898\u3001\u4E3B\u7A97\u53E3\u5C3A\u5BF8\u548C\u60AC\u6D6E\u7403\u5916\u89C2\u3002", children: _jsxs(Stack, { gap: "lg", children: [error !== undefined && _jsx("div", { role: "alert", style: { color: 'var(--snap-color-danger)' }, children: error }), _jsx(Section, { title: "\u4E3B\u9898", children: _jsx(Tabs, { value: activeId, onValueChange: value => {
121
+ return (_jsx(Page, { title: "\u5916\u89C2\u4E0E\u663E\u793A", description: "\u4E3B\u9898\u3001\u4E3B\u7A97\u53E3\u5C3A\u5BF8\u548C\u60AC\u6D6E\u7403\u5916\u89C2\u3002", children: _jsxs(Stack, { gap: "lg", children: [error !== undefined && _jsx(Alert, { intent: "danger", children: error }), _jsx(Section, { title: "\u4E3B\u9898", children: _jsx(Tabs, { value: activeId, onValueChange: value => {
122
122
  const tab = tabs.find(item => item.id === value);
123
123
  if (tab !== undefined)
124
124
  selectTheme(tab);