@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,210 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Component, createContext, useContext, useSyncExternalStore, } from 'react';
3
+ import { UI_SLOT_IDS, UI_SLOT_MODES, isValidSlotId, } from "./contract.js";
4
+ const MAX_DIAGNOSTICS = 100;
5
+ /** The default definition of a built-in slot. */
6
+ function builtinDefinition(slot) {
7
+ return {
8
+ id: slot,
9
+ mode: UI_SLOT_MODES[slot] ?? 'many',
10
+ };
11
+ }
12
+ /** Mount the `ctx.ui` registry. */
13
+ const slotsPlugin = {
14
+ name: 'snap-rail ui slots',
15
+ apply(ctx) {
16
+ const entries = new Map();
17
+ const layouts = new Map();
18
+ const listeners = new Set();
19
+ const diagnostics = [];
20
+ let revision = 0;
21
+ let layoutSeq = 0;
22
+ for (const slot of Object.values(UI_SLOT_IDS)) {
23
+ entries.set(slot, {
24
+ def: builtinDefinition(slot),
25
+ contributions: new Map(),
26
+ nextSeq: 0,
27
+ });
28
+ }
29
+ const notify = (slot) => {
30
+ revision += 1;
31
+ for (const listener of listeners)
32
+ listener();
33
+ ctx.emit('ui/changed');
34
+ if (slot !== undefined)
35
+ ctx.emit('ui/slot-changed', slot);
36
+ };
37
+ const diagnose = (diagnostic) => {
38
+ diagnostics.push({ ...diagnostic, time: Date.now() });
39
+ if (diagnostics.length > MAX_DIAGNOSTICS)
40
+ diagnostics.shift();
41
+ };
42
+ const activeLayoutOf = () => {
43
+ const ranked = [...layouts.values()].sort((a, b) => {
44
+ const pa = a.layout.precedence ?? 0;
45
+ const pb = b.layout.precedence ?? 0;
46
+ return pb - pa || a.layout.order - b.layout.order || b.seq - a.seq;
47
+ });
48
+ return ranked[0]?.layout;
49
+ };
50
+ const ensureEntry = (slot) => {
51
+ const existing = entries.get(slot);
52
+ if (existing !== undefined)
53
+ return existing;
54
+ const entry = {
55
+ def: { id: slot, mode: 'many' },
56
+ contributions: new Map(),
57
+ nextSeq: 0,
58
+ };
59
+ entries.set(slot, entry);
60
+ return entry;
61
+ };
62
+ ctx.provide('ui', {
63
+ defineSlot(caller, def) {
64
+ if (!isValidSlotId(def.id)) {
65
+ diagnose({ kind: 'unknown-slot', slot: def.id, message: `插槽 id 不合法:${def.id}` });
66
+ return () => { };
67
+ }
68
+ if (Object.values(UI_SLOT_IDS).includes(def.id)) {
69
+ diagnose({ kind: 'duplicate-id', slot: def.id, message: `内置插槽不能被重新定义:${def.id}` });
70
+ return () => { };
71
+ }
72
+ const entry = ensureEntry(def.id);
73
+ entry.def = def;
74
+ notify(def.id);
75
+ const remove = () => {
76
+ if (entries.delete(def.id))
77
+ notify(def.id);
78
+ };
79
+ caller.effect(() => remove);
80
+ return remove;
81
+ },
82
+ registerLayout(caller, layout) {
83
+ for (const slot of layout.provides) {
84
+ if (!isValidSlotId(slot)) {
85
+ diagnose({ kind: 'unknown-slot', id: layout.id, slot, message: `布局 ${layout.id} 声明了非法插槽:${slot}` });
86
+ }
87
+ else if (!entries.has(slot)) {
88
+ diagnose({ kind: 'unknown-slot', id: layout.id, slot, message: `布局 ${layout.id} 声明了未定义的插槽:${slot}` });
89
+ }
90
+ }
91
+ layouts.set(layout.id, { layout, seq: layoutSeq++ });
92
+ notify();
93
+ const remove = () => {
94
+ if (layouts.delete(layout.id))
95
+ notify();
96
+ };
97
+ caller.effect(() => remove);
98
+ return remove;
99
+ },
100
+ contribute(caller, slot, contribution) {
101
+ if (!isValidSlotId(slot)) {
102
+ diagnose({ kind: 'unknown-slot', id: contribution.id, slot, message: `贡献 ${contribution.id} 指向非法插槽:${slot}` });
103
+ return () => { };
104
+ }
105
+ const entry = entries.get(slot);
106
+ if (entry === undefined) {
107
+ diagnose({ kind: 'unknown-slot', id: contribution.id, slot, message: `贡献 ${contribution.id} 指向未定义的插槽:${slot}` });
108
+ }
109
+ const target = entry ?? ensureEntry(slot);
110
+ target.contributions.set(contribution.id, {
111
+ contribution: contribution,
112
+ seq: target.nextSeq++,
113
+ });
114
+ notify(slot);
115
+ const remove = () => {
116
+ if (target.contributions.delete(contribution.id))
117
+ notify(slot);
118
+ };
119
+ caller.effect(() => remove);
120
+ return remove;
121
+ },
122
+ list(slot) {
123
+ const entry = entries.get(slot);
124
+ if (entry === undefined)
125
+ return [];
126
+ const ranked = [...entry.contributions.values()]
127
+ .sort((a, b) => a.contribution.order - b.contribution.order || a.seq - b.seq);
128
+ if (entry.def.mode !== 'one' || ranked.length === 0) {
129
+ return ranked.map(item => item.contribution);
130
+ }
131
+ const winner = ranked.reduce((best, item) => {
132
+ const delta = (item.contribution.precedence ?? 0) - (best.contribution.precedence ?? 0);
133
+ return delta > 0 || (delta === 0 && item.seq > best.seq) ? item : best;
134
+ });
135
+ return [winner.contribution];
136
+ },
137
+ definition: (slot) => entries.get(slot)?.def,
138
+ activeLayout: activeLayoutOf,
139
+ hasProvider(slot) {
140
+ const active = activeLayoutOf();
141
+ return active !== undefined && active.provides.includes(slot);
142
+ },
143
+ diagnostics: () => diagnostics,
144
+ subscribe(listener) {
145
+ listeners.add(listener);
146
+ return () => { listeners.delete(listener); };
147
+ },
148
+ version: () => revision,
149
+ });
150
+ },
151
+ };
152
+ /** The React context carrying the active UI service. */
153
+ const UiContext = createContext(null);
154
+ /** Provide the UI service to a slot tree. */
155
+ export function UiProvider(props) {
156
+ return _jsx(UiContext.Provider, { value: props.service, children: props.children });
157
+ }
158
+ /** Read the UI service; throws when a slot tree is mounted outside the runtime. */
159
+ export function useUi() {
160
+ const service = useContext(UiContext);
161
+ if (service === null)
162
+ throw new Error('useUi: no UiProvider in the tree');
163
+ return service;
164
+ }
165
+ /** Re-render on every registry change. */
166
+ export function useUiVersion(service) {
167
+ return useSyncExternalStore(service.subscribe, service.version, service.version);
168
+ }
169
+ /** Keep one broken contribution from taking down the whole shell. */
170
+ class SlotBoundary extends Component {
171
+ state = { failed: false };
172
+ static getDerivedStateFromError() {
173
+ return { failed: true };
174
+ }
175
+ componentDidCatch(error) {
176
+ this.props.onError(error);
177
+ }
178
+ render() {
179
+ return this.state.failed ? null : this.props.children;
180
+ }
181
+ }
182
+ /** A region-slot outlet rendered by a layout. */
183
+ export function Slot(props) {
184
+ const service = useUi();
185
+ useUiVersion(service);
186
+ const provided = service.hasProvider(props.name);
187
+ const entry = service.list(props.name);
188
+ const def = service.definition(props.name);
189
+ const context = (props.context ?? {});
190
+ if (!provided) {
191
+ // A layout that renders a slot it did not declare is a contract bug, but
192
+ // the shell still renders the fallback rather than throwing.
193
+ return null;
194
+ }
195
+ if (entry.length === 0) {
196
+ const fallback = def?.fallback;
197
+ return fallback?.(context) ?? null;
198
+ }
199
+ return (_jsx(_Fragment, { children: entry.map(item => (_jsx(SlotBoundary, { onError: error => {
200
+ console.error(`[snap-rail ui] slot ${props.name} contribution ${item.id} failed`, error);
201
+ }, children: item.render(context) }, item.id))) }));
202
+ }
203
+ /** Re-render when the active layout changes. */
204
+ export function useActiveLayout() {
205
+ const service = useUi();
206
+ useUiVersion(service);
207
+ return service.activeLayout();
208
+ }
209
+ export default slotsPlugin;
210
+ //# sourceMappingURL=slots.js.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Small helpers shared by the headless semantic components: class merging and
3
+ * the stable `data-snap-*` anatomy that skins target.
4
+ *
5
+ * @module @snap-rail/ui/utils
6
+ */
7
+ /** Join truthy class names. */
8
+ export declare function cn(...values: ReadonlyArray<string | false | null | undefined>): string;
9
+ /** The anatomy attributes every semantic component renders. */
10
+ export declare function part(component: string, name: string): Record<string, string>;
11
+ /** Map a semantic size token to a control-height CSS variable. */
12
+ export declare function controlHeight(size: 'sm' | 'md' | 'lg'): string;
13
+ /** Map a semantic spacing token to a CSS variable. */
14
+ export declare function space(token: 'xs' | 'sm' | 'md' | 'lg' | 'xl'): string;
15
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Small helpers shared by the headless semantic components: class merging and
3
+ * the stable `data-snap-*` anatomy that skins target.
4
+ *
5
+ * @module @snap-rail/ui/utils
6
+ */
7
+ /** Join truthy class names. */
8
+ export function cn(...values) {
9
+ return values.filter((value) => typeof value === 'string' && value.length > 0).join(' ');
10
+ }
11
+ /** The anatomy attributes every semantic component renders. */
12
+ export function part(component, name) {
13
+ return {
14
+ 'data-snap-component': component,
15
+ 'data-snap-part': `${component}.${name}`,
16
+ };
17
+ }
18
+ /** Map a semantic size token to a control-height CSS variable. */
19
+ export function controlHeight(size) {
20
+ return `var(--snap-control-height-${size})`;
21
+ }
22
+ /** Map a semantic spacing token to a CSS variable. */
23
+ export function space(token) {
24
+ return `var(--snap-space-${token})`;
25
+ }
26
+ //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,108 @@
1
1
  {
2
2
  "name": "@snap-rail/ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "The built-in UI substrate: semantic components, typed region slots, skins, settings and renderer runtime",
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "main": "lib/index.js",
7
+ "types": "lib/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/types/index.d.ts",
11
+ "default": "./lib/index.js"
12
+ },
13
+ "./contract": {
14
+ "types": "./lib/types/contract.d.ts",
15
+ "default": "./lib/contract.js"
16
+ },
17
+ "./components": {
18
+ "types": "./lib/types/components/index.d.ts",
19
+ "default": "./lib/components/index.js"
20
+ },
21
+ "./charts": {
22
+ "types": "./lib/types/charts.d.ts",
23
+ "default": "./lib/charts.js"
24
+ },
25
+ "./slots": {
26
+ "types": "./lib/types/slots.d.ts",
27
+ "default": "./lib/slots.js"
28
+ },
29
+ "./skins": {
30
+ "types": "./lib/types/skins.d.ts",
31
+ "default": "./lib/skins.js"
32
+ },
33
+ "./settings": {
34
+ "types": "./lib/types/settings.d.ts",
35
+ "default": "./lib/settings.js"
36
+ },
37
+ "./settings-pages": {
38
+ "types": "./lib/types/settings-pages/index.d.ts",
39
+ "default": "./lib/settings-pages/index.js"
40
+ },
41
+ "./runtime": {
42
+ "types": "./lib/types/runtime.d.ts",
43
+ "default": "./lib/runtime.js"
44
+ },
45
+ "./pages": {
46
+ "types": "./lib/types/pages.d.ts",
47
+ "default": "./lib/pages.js"
48
+ },
49
+ "./fallback": {
50
+ "types": "./lib/types/fallback.d.ts",
51
+ "default": "./lib/fallback.js"
52
+ },
53
+ "./styles/base.css": "./src/styles/base.css",
54
+ "./styles/default.css": "./src/styles/default.css",
55
+ "./src/*": "./src/*",
56
+ "./package.json": "./package.json"
57
+ },
58
+ "files": [
59
+ "lib/**/*.js",
60
+ "lib/types/**/*.d.ts",
61
+ "src/**/*.css"
62
+ ],
63
+ "license": "Apache-2.0",
64
+ "dependencies": {
65
+ "@radix-ui/react-checkbox": "^1.1.3",
66
+ "@radix-ui/react-dialog": "^1.1.6",
67
+ "@radix-ui/react-label": "^2.1.2",
68
+ "@radix-ui/react-radio-group": "^1.2.3",
69
+ "@radix-ui/react-scroll-area": "^1.2.18",
70
+ "@radix-ui/react-select": "^2.2.6",
71
+ "@radix-ui/react-slot": "^1.3.3",
72
+ "@radix-ui/react-switch": "^1.3.7",
73
+ "@radix-ui/react-tabs": "^1.1.13",
74
+ "@radix-ui/react-tooltip": "^1.2.16"
75
+ },
76
+ "peerDependencies": {
77
+ "react": ">=19",
78
+ "react-dom": ">=19",
79
+ "zod": "^4.4.3",
80
+ "@snap-rail/connection": "^0.1.0",
81
+ "@snap-rail/protocol": "^0.1.3",
82
+ "@snap-rail/cordis": "^4.0.3",
83
+ "@snap-rail/shell": "^0.2.2"
84
+ },
85
+ "devDependencies": {
86
+ "@types/react": "^19.2.14",
87
+ "@types/react-dom": "^19.2.3",
88
+ "happy-dom": "^20.0.11",
89
+ "react": "^19.2.8",
90
+ "react-dom": "^19.2.8",
91
+ "tsdown": "^0.22.2",
92
+ "typescript": "^6.0.3",
93
+ "vitest": "^4.1.8",
94
+ "zod": "^4.4.3",
95
+ "@snap-rail/client-kernel": "^0.1.2",
96
+ "@snap-rail/app-boot": "^0.1.3",
97
+ "@snap-rail/connection": "^0.1.0",
98
+ "@snap-rail/cordis-plugin-timer": "^1.1.3",
99
+ "@snap-rail/cordis": "^4.0.3",
100
+ "@snap-rail/protocol": "^0.1.3",
101
+ "@snap-rail/shell": "^0.2.2",
102
+ "@snap-rail/station-rpc": "^0.1.0"
103
+ },
104
+ "snapRail": {
105
+ "layer": "base",
106
+ "title": "界面基座"
107
+ }
6
108
  }
@@ -0,0 +1,321 @@
1
+ /*
2
+ * Structural baseline for every semantic component. Visual design lives in
3
+ * the active skin; this file only guarantees that the anatomy is laid out and
4
+ * focusable even before/without a skin.
5
+ */
6
+ @layer snap.base {
7
+ *,
8
+ *::before,
9
+ *::after {
10
+ box-sizing: border-box;
11
+ }
12
+
13
+ html,
14
+ body,
15
+ #root {
16
+ height: 100%;
17
+ }
18
+
19
+ body {
20
+ margin: 0;
21
+ background: var(--snap-color-bg);
22
+ color: var(--snap-color-text);
23
+ font-family: var(--snap-font-sans);
24
+ font-size: var(--snap-text-md);
25
+ line-height: var(--snap-leading-normal);
26
+ }
27
+
28
+ button,
29
+ input,
30
+ textarea,
31
+ select {
32
+ font: inherit;
33
+ color: inherit;
34
+ }
35
+
36
+ [data-snap-component] {
37
+ box-sizing: border-box;
38
+ }
39
+
40
+ [data-snap-component='button'] {
41
+ display: inline-flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ gap: var(--snap-space-sm);
45
+ border: var(--snap-border-width) solid transparent;
46
+ cursor: pointer;
47
+ min-height: var(--snap-control-height-md);
48
+ }
49
+
50
+ [data-snap-component='button'][data-size='sm'] {
51
+ min-height: var(--snap-control-height-sm);
52
+ }
53
+
54
+ [data-snap-component='button'][data-size='lg'] {
55
+ min-height: var(--snap-control-height-lg);
56
+ }
57
+
58
+ [data-snap-component='icon-button'] {
59
+ display: inline-flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ border: var(--snap-border-width) solid transparent;
63
+ cursor: pointer;
64
+ }
65
+
66
+ [data-snap-component='input'],
67
+ [data-snap-component='number-input'] {
68
+ display: flex;
69
+ align-items: center;
70
+ gap: var(--snap-space-sm);
71
+ }
72
+
73
+ [data-snap-component='input'] [data-snap-part='input.field'],
74
+ [data-snap-component='number-input'] [data-snap-part='number-input.field'],
75
+ [data-snap-part='textarea.field'] {
76
+ min-width: 0;
77
+ flex: 1;
78
+ border: 0;
79
+ outline: 0;
80
+ background: transparent;
81
+ padding: 0;
82
+ }
83
+
84
+ [data-snap-component='textarea'] {
85
+ display: flex;
86
+ }
87
+
88
+ [data-snap-part='textarea.field'] {
89
+ width: 100%;
90
+ min-height: 120px;
91
+ resize: vertical;
92
+ }
93
+
94
+ [data-snap-component='select'] {
95
+ display: inline-flex;
96
+ }
97
+
98
+ [data-snap-part='select.trigger'] {
99
+ display: inline-flex;
100
+ align-items: center;
101
+ justify-content: space-between;
102
+ gap: var(--snap-space-sm);
103
+ width: 100%;
104
+ min-height: var(--snap-control-height-md);
105
+ border: var(--snap-border-width) solid var(--snap-color-border);
106
+ background: transparent;
107
+ cursor: pointer;
108
+ }
109
+
110
+ [data-snap-part='select.content'] {
111
+ z-index: var(--snap-z-modal);
112
+ }
113
+
114
+ [data-snap-part='switch.root'],
115
+ [data-snap-part='checkbox.root'],
116
+ [data-snap-part='radio-group.item'] {
117
+ display: inline-flex;
118
+ flex-shrink: 0;
119
+ align-items: center;
120
+ justify-content: center;
121
+ cursor: pointer;
122
+ }
123
+
124
+ .snap-switch-label,
125
+ .snap-checkbox-label {
126
+ display: inline-flex;
127
+ align-items: center;
128
+ gap: var(--snap-space-sm);
129
+ cursor: pointer;
130
+ }
131
+
132
+ [data-snap-part='switch.label'],
133
+ [data-snap-part='checkbox.label'],
134
+ [data-snap-part='checkbox.thumb'],
135
+ [data-snap-part='radio-group.label'] {
136
+ display: inline-flex;
137
+ align-items: center;
138
+ }
139
+
140
+ [data-snap-part='tabs.list'] {
141
+ display: inline-flex;
142
+ align-items: center;
143
+ gap: var(--snap-space-xs);
144
+ }
145
+
146
+ [data-snap-part='tabs.trigger'] {
147
+ cursor: pointer;
148
+ border: 0;
149
+ background: transparent;
150
+ }
151
+
152
+ [data-snap-part='tabs.content'] {
153
+ outline: 0;
154
+ }
155
+
156
+ [data-snap-part='table.root'] {
157
+ width: 100%;
158
+ overflow: auto;
159
+ }
160
+
161
+ [data-snap-part='table.root'] table {
162
+ width: 100%;
163
+ border-collapse: collapse;
164
+ }
165
+
166
+ [data-snap-part='table.head'],
167
+ [data-snap-part='table.cell'] {
168
+ text-align: left;
169
+ }
170
+
171
+ [data-snap-part='card.root'],
172
+ [data-snap-part='panel.root'] {
173
+ display: flex;
174
+ flex-direction: column;
175
+ min-width: 0;
176
+ }
177
+
178
+ [data-snap-part='card.header'],
179
+ [data-snap-part='panel.header'],
180
+ [data-snap-part='section.header'] {
181
+ display: flex;
182
+ align-items: flex-start;
183
+ justify-content: space-between;
184
+ gap: var(--snap-space-md);
185
+ }
186
+
187
+ [data-snap-part='dialog.overlay'] {
188
+ position: fixed;
189
+ inset: 0;
190
+ }
191
+
192
+ [data-snap-part='dialog.panel'] {
193
+ position: fixed;
194
+ outline: 0;
195
+ z-index: var(--snap-z-modal);
196
+ }
197
+
198
+ [data-snap-part='field.root'] {
199
+ display: flex;
200
+ flex-direction: column;
201
+ gap: var(--snap-space-xs);
202
+ min-width: 0;
203
+ }
204
+
205
+ [data-snap-part='form.root'],
206
+ [data-snap-part='form.fields'] {
207
+ display: flex;
208
+ flex-direction: column;
209
+ gap: var(--snap-space-md);
210
+ }
211
+
212
+ [data-snap-part='form.actions'] {
213
+ display: flex;
214
+ align-items: center;
215
+ justify-content: flex-end;
216
+ gap: var(--snap-space-sm);
217
+ }
218
+
219
+ [data-snap-part='toolbar.root'] {
220
+ display: flex;
221
+ align-items: center;
222
+ justify-content: space-between;
223
+ gap: var(--snap-space-sm);
224
+ }
225
+
226
+ [data-snap-part='badge.root'],
227
+ [data-snap-part='led.root'],
228
+ [data-snap-part='progress.root'] {
229
+ display: inline-flex;
230
+ align-items: center;
231
+ }
232
+
233
+ [data-snap-part='progress.track'] {
234
+ position: relative;
235
+ overflow: hidden;
236
+ width: 100%;
237
+ }
238
+
239
+ [data-snap-part='progress.indicator'] {
240
+ height: 100%;
241
+ }
242
+
243
+ [data-snap-part='empty-state.root'] {
244
+ display: flex;
245
+ flex-direction: column;
246
+ align-items: center;
247
+ justify-content: center;
248
+ gap: var(--snap-space-sm);
249
+ text-align: center;
250
+ }
251
+
252
+ [data-snap-part='visualization.root'],
253
+ [data-snap-part='chart-frame.root'] {
254
+ display: flex;
255
+ flex-direction: column;
256
+ min-width: 0;
257
+ min-height: 0;
258
+ }
259
+
260
+ [data-snap-part='settings.root'] {
261
+ display: flex;
262
+ flex-direction: column;
263
+ height: 100%;
264
+ min-height: 0;
265
+ }
266
+
267
+ [data-snap-part='settings.header'] {
268
+ display: flex;
269
+ align-items: center;
270
+ justify-content: space-between;
271
+ gap: var(--snap-space-md);
272
+ flex-shrink: 0;
273
+ }
274
+
275
+ [data-snap-part='settings.body'] {
276
+ display: flex;
277
+ flex: 1;
278
+ min-height: 0;
279
+ }
280
+
281
+ [data-snap-part='settings.nav'] {
282
+ display: flex;
283
+ flex-direction: column;
284
+ flex-shrink: 0;
285
+ overflow: auto;
286
+ }
287
+
288
+ [data-snap-part='settings.content'] {
289
+ flex: 1;
290
+ min-width: 0;
291
+ overflow: auto;
292
+ }
293
+
294
+ [data-snap-part='settings.nav-item'] {
295
+ display: flex;
296
+ align-items: center;
297
+ gap: var(--snap-space-sm);
298
+ width: 100%;
299
+ border: 0;
300
+ background: transparent;
301
+ cursor: pointer;
302
+ text-align: left;
303
+ }
304
+
305
+ [data-snap-part='visualization.body'],
306
+ [data-snap-part='chart-frame.body'] {
307
+ flex: 1;
308
+ min-height: 0;
309
+ }
310
+
311
+ [data-snap-component='button']:focus-visible,
312
+ [data-snap-component='icon-button']:focus-visible,
313
+ [data-snap-part='select.trigger']:focus-visible,
314
+ [data-snap-part='tabs.trigger']:focus-visible,
315
+ [data-snap-part='switch.root']:focus-visible,
316
+ [data-snap-part='checkbox.root']:focus-visible,
317
+ [data-snap-part='radio-group.item']:focus-visible {
318
+ outline: 2px solid var(--snap-color-focus);
319
+ outline-offset: 2px;
320
+ }
321
+ }