@snap-rail/ui 0.0.0-stage → 0.1.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 (60) hide show
  1. package/LICENSE +202 -0
  2. package/lib/charts.js +142 -0
  3. package/lib/contract.js +543 -0
  4. package/lib/fallback.js +400 -0
  5. package/lib/index.js +3345 -0
  6. package/lib/pages.js +68 -0
  7. package/lib/runtime.js +2064 -0
  8. package/lib/settings.js +1195 -0
  9. package/lib/skins.js +284 -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 +37 -0
  26. package/lib/types/components/input.js +15 -0
  27. package/lib/types/components/layout.d.ts +100 -0
  28. package/lib/types/components/layout.js +80 -0
  29. package/lib/types/components/schema-form.d.ts +34 -0
  30. package/lib/types/components/schema-form.js +61 -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 +358 -0
  34. package/lib/types/contract.js +235 -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 +71 -0
  42. package/lib/types/runtime.js +177 -0
  43. package/lib/types/settings-pages/appearance.d.ts +13 -0
  44. package/lib/types/settings-pages/appearance.js +131 -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/plugins.d.ts +16 -0
  48. package/lib/types/settings-pages/plugins.js +109 -0
  49. package/lib/types/settings.d.ts +58 -0
  50. package/lib/types/settings.js +170 -0
  51. package/lib/types/skins.d.ts +143 -0
  52. package/lib/types/skins.js +268 -0
  53. package/lib/types/slots.d.ts +69 -0
  54. package/lib/types/slots.js +210 -0
  55. package/lib/types/utils.d.ts +15 -0
  56. package/lib/types/utils.js +26 -0
  57. package/package.json +105 -3
  58. package/src/styles/base.css +321 -0
  59. package/src/styles/default.css +734 -0
  60. package/README.md +0 -3
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn, part, space } from "../utils.js";
3
+ /** A vertical flow. */
4
+ export function Stack({ gap = 'md', padding, align, className, style, children }) {
5
+ return (_jsx("div", { ...part('stack', 'root'), className: cn('snap-stack', className), style: {
6
+ display: 'flex',
7
+ flexDirection: 'column',
8
+ gap: space(gap),
9
+ ...padding !== undefined ? { padding: space(padding) } : {},
10
+ ...align !== undefined ? { alignItems: align } : {},
11
+ ...style,
12
+ }, children: children }));
13
+ }
14
+ /** A horizontal flow. */
15
+ export function Row({ gap = 'sm', padding, align, justify, wrap = false, className, style, children }) {
16
+ return (_jsx("div", { ...part('row', 'root'), className: cn('snap-row', className), style: {
17
+ display: 'flex',
18
+ flexDirection: 'row',
19
+ gap: space(gap),
20
+ ...padding !== undefined ? { padding: space(padding) } : {},
21
+ ...align !== undefined ? { alignItems: align } : {},
22
+ ...justify !== undefined ? { justifyContent: justify } : {},
23
+ ...wrap ? { flexWrap: 'wrap' } : {},
24
+ ...style,
25
+ }, children: children }));
26
+ }
27
+ /** A responsive grid. */
28
+ export function Grid({ gap = 'md', padding, columns = 2, minColumnWidth, className, style, children }) {
29
+ const template = typeof columns === 'number'
30
+ ? `repeat(${columns}, minmax(0, 1fr))`
31
+ : columns;
32
+ return (_jsx("div", { ...part('grid', 'root'), className: cn('snap-grid', className), style: {
33
+ display: 'grid',
34
+ gap: space(gap),
35
+ gridTemplateColumns: minColumnWidth !== undefined
36
+ ? `repeat(auto-fit, minmax(${minColumnWidth}, 1fr))`
37
+ : template,
38
+ ...padding !== undefined ? { padding: space(padding) } : {},
39
+ ...style,
40
+ }, children: children }));
41
+ }
42
+ /** A two-pane split (sidebar + content, list + detail). */
43
+ export function Split({ start, end, gap = 'md', ratio = 'minmax(0, 2fr) minmax(0, 3fr)', className, style }) {
44
+ return (_jsxs("div", { ...part('split', 'root'), className: cn('snap-split', className), style: { display: 'grid', gridTemplateColumns: ratio, gap: space(gap), minHeight: 0, ...style }, children: [_jsx("div", { ...part('split', 'start'), style: { minWidth: 0, minHeight: 0 }, children: start }), _jsx("div", { ...part('split', 'end'), style: { minWidth: 0, minHeight: 0 }, children: end })] }));
45
+ }
46
+ /** The operator-window shell frame. */
47
+ export function AppShell({ header, sidebar, footer, className, style, children }) {
48
+ return (_jsxs("div", { ...part('app-shell', 'root'), className: cn('snap-app-shell', className), style: { display: 'flex', flexDirection: 'column', height: '100%', minHeight: 0, ...style }, children: [header !== undefined && _jsx("div", { ...part('app-shell', 'header'), style: { flexShrink: 0 }, children: header }), _jsxs("div", { style: { display: 'flex', flex: 1, minHeight: 0 }, children: [sidebar !== undefined && (_jsx("div", { ...part('app-shell', 'sidebar'), style: { flexShrink: 0, minHeight: 0 }, children: sidebar })), _jsx("div", { ...part('app-shell', 'main'), style: { flex: 1, minWidth: 0, minHeight: 0, overflow: 'auto' }, children: children })] }), footer !== undefined && _jsx("div", { ...part('app-shell', 'footer'), style: { flexShrink: 0 }, children: footer })] }));
49
+ }
50
+ /** A page body with its own header/actions anatomy. */
51
+ export function Page({ header, actions, title, description, className, style, children }) {
52
+ return (_jsxs("div", { ...part('page', 'root'), className: cn('snap-page', className), style: { display: 'flex', flexDirection: 'column', minHeight: 0, ...style }, children: [(header !== undefined || title !== undefined || description !== undefined || actions !== undefined) && (_jsxs("div", { ...part('page', 'header'), style: { display: 'flex', flexDirection: 'column', gap: space('sm'), flexShrink: 0 }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between', gap: space('md') }, children: [title !== undefined && _jsx("div", { ...part('page', 'title'), children: title }), actions !== undefined && _jsx("div", { ...part('page', 'actions'), children: actions })] }), description !== undefined && _jsx("div", { ...part('page', 'description'), children: description }), header] })), _jsx("div", { ...part('page', 'body'), style: { display: 'flex', flexDirection: 'column', flex: 1, minHeight: 0 }, children: children })] }));
53
+ }
54
+ /** A titled content section. */
55
+ export function Section({ title, description, actions, className, style, children }) {
56
+ return (_jsxs("section", { ...part('section', 'root'), className: cn('snap-section', className), style: { display: 'flex', flexDirection: 'column', gap: space('sm'), ...style }, children: [(title !== undefined || actions !== undefined) && (_jsxs("div", { ...part('section', 'header'), style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: space('md') }, children: [_jsxs("div", { children: [title !== undefined && _jsx("div", { ...part('section', 'title'), children: title }), description !== undefined && _jsx("div", { children: description })] }), actions !== undefined && _jsx("div", { ...part('section', 'actions'), children: actions })] })), _jsx("div", { ...part('section', 'body'), children: children })] }));
57
+ }
58
+ /** A compact action bar. */
59
+ export function Toolbar({ start, end, className, style }) {
60
+ return (_jsxs("div", { ...part('toolbar', 'root'), className: cn('snap-toolbar', className), style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: space('sm'), ...style }, children: [_jsx("div", { ...part('toolbar', 'start'), style: { display: 'flex', alignItems: 'center', gap: space('sm'), minWidth: 0 }, children: start }), _jsx("div", { ...part('toolbar', 'end'), style: { display: 'flex', alignItems: 'center', gap: space('sm'), flexShrink: 0 }, children: end })] }));
61
+ }
62
+ /** A native scroll container with a stable anatomy. */
63
+ export function ScrollArea({ direction = 'vertical', className, style, children }) {
64
+ return (_jsx("div", { ...part('scroll-area', 'root'), className: cn('snap-scroll-area', className), style: {
65
+ overflowY: direction === 'horizontal' ? 'hidden' : 'auto',
66
+ overflowX: direction === 'vertical' ? 'hidden' : 'auto',
67
+ minHeight: 0,
68
+ ...style,
69
+ }, children: _jsx("div", { ...part('scroll-area', 'viewport'), children: children }) }));
70
+ }
71
+ /** A touch-friendly scroll container; pointer dragging pans the viewport. */
72
+ export function DragScroll({ direction = 'vertical', className, style, children }) {
73
+ return (_jsx("div", { ...part('drag-scroll', 'root'), className: cn('snap-drag-scroll', className), style: {
74
+ overflowY: direction === 'horizontal' ? 'hidden' : 'auto',
75
+ overflowX: direction === 'vertical' ? 'hidden' : 'auto',
76
+ minHeight: 0,
77
+ ...style,
78
+ }, children: _jsx("div", { ...part('drag-scroll', 'viewport'), children: children }) }));
79
+ }
80
+ //# sourceMappingURL=layout.js.map
@@ -0,0 +1,34 @@
1
+ /**
2
+ * A small JSON-Schema form renderer for driver dialect schemas. It covers the
3
+ * flat object shapes drivers commonly declare: string, number/integer,
4
+ * boolean, and enum. Nested objects/arrays fall back to a JSON textarea; a
5
+ * driver that needs a bespoke interaction should ship a registered component
6
+ * instead of growing this renderer.
7
+ *
8
+ * @module @snap-rail/ui/components/schema-form
9
+ */
10
+ import type { ReactNode } from 'react';
11
+ /** The JSON-Schema subset a driver dialect form uses. */
12
+ export interface JsonSchemaNode {
13
+ type?: string;
14
+ title?: string;
15
+ description?: string;
16
+ properties?: Readonly<Record<string, JsonSchemaNode>>;
17
+ required?: readonly string[];
18
+ enum?: readonly unknown[];
19
+ default?: unknown;
20
+ minimum?: number;
21
+ maximum?: number;
22
+ }
23
+ /** Props of {@link SchemaForm}. */
24
+ export interface SchemaFormProps {
25
+ schema: JsonSchemaNode;
26
+ value: Readonly<Record<string, unknown>>;
27
+ onChange: (value: Record<string, unknown>) => void;
28
+ idPrefix?: string;
29
+ }
30
+ /** Render a flat JSON-Schema object as semantic fields. */
31
+ export declare function SchemaForm({ schema, value, onChange, idPrefix }: SchemaFormProps): ReactNode;
32
+ /** Normalize a driver's JSON Schema (which may carry `$schema`). */
33
+ export declare function schemaNodeOf(value: unknown): JsonSchemaNode;
34
+ //# sourceMappingURL=schema-form.d.ts.map
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Field } from "./form.js";
3
+ import { Input, NumberInput, Textarea } from "./input.js";
4
+ import { Switch, TouchSelect } from "./controls.js";
5
+ function asRecord(value) {
6
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
7
+ ? value
8
+ : {};
9
+ }
10
+ /** Render a flat JSON-Schema object as semantic fields. */
11
+ export function SchemaForm({ schema, value, onChange, idPrefix = 'schema' }) {
12
+ const properties = schema.properties ?? {};
13
+ const required = new Set(schema.required ?? []);
14
+ const update = (key, next) => {
15
+ onChange({ ...value, [key]: next });
16
+ };
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" }))] }));
56
+ }
57
+ /** Normalize a driver's JSON Schema (which may carry `$schema`). */
58
+ export function schemaNodeOf(value) {
59
+ return asRecord(value);
60
+ }
61
+ //# sourceMappingURL=schema-form.js.map
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Surface primitives: cards, panels, and tables. Their structure is semantic
3
+ * (headers/bodies/rows); skins own borders, density, hover, and empty states.
4
+ *
5
+ * @module @snap-rail/ui/components/surface
6
+ */
7
+ import type { HTMLAttributes, ReactNode, TdHTMLAttributes, ThHTMLAttributes } from 'react';
8
+ /** Props of {@link Card}. */
9
+ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
10
+ children?: ReactNode;
11
+ }
12
+ /** A content card. */
13
+ export declare function Card({ className, children, ...props }: CardProps): ReactNode;
14
+ /** The card header region. */
15
+ export declare function CardHeader({ className, children, ...props }: HTMLAttributes<HTMLDivElement>): ReactNode;
16
+ /** The card title. */
17
+ export declare function CardTitle({ className, children, ...props }: HTMLAttributes<HTMLDivElement>): ReactNode;
18
+ /** The card description. */
19
+ export declare function CardDescription({ className, children, ...props }: HTMLAttributes<HTMLDivElement>): ReactNode;
20
+ /** The card body. */
21
+ export declare function CardContent({ className, children, ...props }: HTMLAttributes<HTMLDivElement>): ReactNode;
22
+ /** The card footer. */
23
+ export declare function CardFooter({ className, children, ...props }: HTMLAttributes<HTMLDivElement>): ReactNode;
24
+ /** Props of {@link Panel}. */
25
+ export interface PanelProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
26
+ title?: ReactNode;
27
+ actions?: ReactNode;
28
+ footer?: ReactNode;
29
+ }
30
+ /** A bounded panel with optional header/footer. */
31
+ export declare function Panel({ title, actions, footer, className, children, ...props }: PanelProps): ReactNode;
32
+ /** A semantic table. */
33
+ export declare function Table({ className, children, ...props }: HTMLAttributes<HTMLTableElement>): ReactNode;
34
+ /** The table head. */
35
+ export declare function TableHeader({ className, children, ...props }: HTMLAttributes<HTMLTableSectionElement>): ReactNode;
36
+ /** The table body. */
37
+ export declare function TableBody({ className, children, ...props }: HTMLAttributes<HTMLTableSectionElement>): ReactNode;
38
+ /** A table row. */
39
+ export declare function TableRow({ className, children, ...props }: HTMLAttributes<HTMLTableRowElement>): ReactNode;
40
+ /** A table header cell. */
41
+ export declare function TableHead({ className, children, ...props }: ThHTMLAttributes<HTMLTableCellElement>): ReactNode;
42
+ /** A table body cell. */
43
+ export declare function TableCell({ className, children, ...props }: TdHTMLAttributes<HTMLTableCellElement>): ReactNode;
44
+ /** A full-width empty row. */
45
+ export declare function TableEmpty({ colSpan, children }: {
46
+ colSpan: number;
47
+ children: ReactNode;
48
+ }): ReactNode;
49
+ //# sourceMappingURL=surface.d.ts.map
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn, part } from "../utils.js";
3
+ /** A content card. */
4
+ export function Card({ className, children, ...props }) {
5
+ return _jsx("div", { ...part('card', 'root'), className: cn('snap-card', className), ...props, children: children });
6
+ }
7
+ /** The card header region. */
8
+ export function CardHeader({ className, children, ...props }) {
9
+ return _jsx("div", { ...part('card', 'header'), className: cn('snap-card-header', className), ...props, children: children });
10
+ }
11
+ /** The card title. */
12
+ export function CardTitle({ className, children, ...props }) {
13
+ return _jsx("div", { ...part('card', 'title'), className: cn('snap-card-title', className), ...props, children: children });
14
+ }
15
+ /** The card description. */
16
+ export function CardDescription({ className, children, ...props }) {
17
+ return _jsx("div", { ...part('card', 'description'), className: cn('snap-card-description', className), ...props, children: children });
18
+ }
19
+ /** The card body. */
20
+ export function CardContent({ className, children, ...props }) {
21
+ return _jsx("div", { ...part('card', 'body'), className: cn('snap-card-content', className), ...props, children: children });
22
+ }
23
+ /** The card footer. */
24
+ export function CardFooter({ className, children, ...props }) {
25
+ return _jsx("div", { ...part('card', 'footer'), className: cn('snap-card-footer', className), ...props, children: children });
26
+ }
27
+ /** A bounded panel with optional header/footer. */
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 })] }));
30
+ }
31
+ /** A semantic table. */
32
+ export function Table({ className, children, ...props }) {
33
+ return (_jsx("div", { ...part('table', 'root'), className: cn('snap-table', className), children: _jsx("table", { ...props, children: children }) }));
34
+ }
35
+ /** The table head. */
36
+ export function TableHeader({ className, children, ...props }) {
37
+ return _jsx("thead", { ...part('table', 'header'), className: cn('snap-table-header', className), ...props, children: children });
38
+ }
39
+ /** The table body. */
40
+ export function TableBody({ className, children, ...props }) {
41
+ return _jsx("tbody", { ...part('table', 'body'), className: cn('snap-table-body', className), ...props, children: children });
42
+ }
43
+ /** A table row. */
44
+ export function TableRow({ className, children, ...props }) {
45
+ return _jsx("tr", { ...part('table', 'row'), className: cn('snap-table-row', className), ...props, children: children });
46
+ }
47
+ /** A table header cell. */
48
+ export function TableHead({ className, children, ...props }) {
49
+ return _jsx("th", { ...part('table', 'head'), className: cn('snap-table-head', className), ...props, children: children });
50
+ }
51
+ /** A table body cell. */
52
+ export function TableCell({ className, children, ...props }) {
53
+ return _jsx("td", { ...part('table', 'cell'), className: cn('snap-table-cell', className), ...props, children: children });
54
+ }
55
+ /** A full-width empty row. */
56
+ export function TableEmpty({ colSpan, children }) {
57
+ return (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: colSpan, children: _jsx("div", { ...part('table', 'empty'), children: children }) }) }));
58
+ }
59
+ //# sourceMappingURL=surface.js.map
@@ -0,0 +1,358 @@
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
+ /** 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
+ //# sourceMappingURL=contract.d.ts.map