@luxalgo/vela-ui 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +28 -0
  4. package/README.md +86 -3
  5. package/cli/engine.mjs +282 -0
  6. package/cli/index.mjs +154 -0
  7. package/dist/badge.d.ts +26 -0
  8. package/dist/badge.js +44 -0
  9. package/dist/bar-chart.d.ts +40 -0
  10. package/dist/bar-chart.js +105 -0
  11. package/dist/button.d.ts +55 -0
  12. package/dist/button.js +11 -0
  13. package/dist/calendar.d.ts +24 -0
  14. package/dist/calendar.js +1 -0
  15. package/dist/callout-bubble.d.ts +103 -0
  16. package/dist/callout-bubble.js +177 -0
  17. package/dist/chart.d.ts +30 -0
  18. package/dist/chart.js +1 -0
  19. package/dist/checkbox.d.ts +60 -0
  20. package/dist/checkbox.js +12 -0
  21. package/dist/chunk-2GQIZM5Z.js +28 -0
  22. package/dist/chunk-3Q32K4PE.js +85 -0
  23. package/dist/chunk-6QCILIT2.js +52 -0
  24. package/dist/chunk-7VMN7NKJ.js +133 -0
  25. package/dist/chunk-A2FJ7Y7D.js +55 -0
  26. package/dist/chunk-A72NWYNP.js +26 -0
  27. package/dist/chunk-B5ZSRUDQ.js +227 -0
  28. package/dist/chunk-BXMWQIBO.js +66 -0
  29. package/dist/chunk-C3ICYMI3.js +25 -0
  30. package/dist/chunk-CC3DDNFC.js +117 -0
  31. package/dist/chunk-E2FE6V2N.js +81 -0
  32. package/dist/chunk-FN2BUFNM.js +10 -0
  33. package/dist/chunk-FVH6L7FM.js +18 -0
  34. package/dist/chunk-G7IQLY3A.js +183 -0
  35. package/dist/chunk-GVRX3UAV.js +82 -0
  36. package/dist/chunk-J2QJATCD.js +12 -0
  37. package/dist/chunk-LZWZV2ZS.js +18 -0
  38. package/dist/chunk-MJ4RUGX7.js +403 -0
  39. package/dist/chunk-MMTMOV6R.js +31 -0
  40. package/dist/chunk-P4MTEMT7.js +23 -0
  41. package/dist/chunk-Q6WTDVH6.js +31 -0
  42. package/dist/chunk-S7USVSYP.js +50 -0
  43. package/dist/chunk-TAKSIV57.js +90 -0
  44. package/dist/chunk-U3EH42YY.js +72 -0
  45. package/dist/chunk-V2Q4MRMS.js +573 -0
  46. package/dist/chunk-VMCR3S2A.js +22 -0
  47. package/dist/chunk-WBGSYCV2.js +101 -0
  48. package/dist/chunk-WGULXRWD.js +351 -0
  49. package/dist/chunk-WXH3EFV5.js +219 -0
  50. package/dist/chunk-X66RJAIS.js +14 -0
  51. package/dist/chunk-XBEL4K33.js +142 -0
  52. package/dist/chunk-Z5PINFQO.js +280 -0
  53. package/dist/collapsible.d.ts +49 -0
  54. package/dist/collapsible.js +106 -0
  55. package/dist/color-picker.d.ts +103 -0
  56. package/dist/color-picker.js +19 -0
  57. package/dist/color.d.ts +24 -0
  58. package/dist/color.js +1 -0
  59. package/dist/context-menu.d.ts +72 -0
  60. package/dist/context-menu.js +161 -0
  61. package/dist/css.d.ts +17 -0
  62. package/dist/css.js +4 -0
  63. package/dist/data-table.d.ts +40 -0
  64. package/dist/data-table.js +88 -0
  65. package/dist/date-picker.d.ts +90 -0
  66. package/dist/date-picker.js +257 -0
  67. package/dist/define-D5u3F5Dj.d.ts +21 -0
  68. package/dist/dialog.d.ts +89 -0
  69. package/dist/dialog.js +258 -0
  70. package/dist/dispose.d.ts +9 -0
  71. package/dist/dispose.js +2 -0
  72. package/dist/donut.d.ts +27 -0
  73. package/dist/donut.js +67 -0
  74. package/dist/drawer.d.ts +119 -0
  75. package/dist/drawer.js +326 -0
  76. package/dist/dropdown-menu.d.ts +114 -0
  77. package/dist/dropdown-menu.js +18 -0
  78. package/dist/empty.d.ts +21 -0
  79. package/dist/empty.js +38 -0
  80. package/dist/field.d.ts +147 -0
  81. package/dist/field.js +328 -0
  82. package/dist/glyph-select.d.ts +57 -0
  83. package/dist/glyph-select.js +17 -0
  84. package/dist/h-Bl37qUis.d.ts +24 -0
  85. package/dist/headless.d.ts +6 -0
  86. package/dist/headless.js +9 -0
  87. package/dist/hover-card.d.ts +43 -0
  88. package/dist/hover-card.js +97 -0
  89. package/dist/i18n.d.ts +20 -0
  90. package/dist/i18n.js +1 -0
  91. package/dist/icons.d.ts +20 -0
  92. package/dist/icons.js +2 -0
  93. package/dist/index.d.ts +51 -0
  94. package/dist/index.js +13 -0
  95. package/dist/input-group.d.ts +57 -0
  96. package/dist/input-group.js +87 -0
  97. package/dist/input.d.ts +54 -0
  98. package/dist/input.js +9 -0
  99. package/dist/item.d.ts +72 -0
  100. package/dist/item.js +131 -0
  101. package/dist/kbd.d.ts +19 -0
  102. package/dist/kbd.js +8 -0
  103. package/dist/kit-text.d.ts +8 -0
  104. package/dist/kit-text.js +2 -0
  105. package/dist/line-chart.d.ts +32 -0
  106. package/dist/line-chart.js +120 -0
  107. package/dist/manifest.json +4508 -0
  108. package/dist/month-grid.d.ts +45 -0
  109. package/dist/month-grid.js +157 -0
  110. package/dist/number-input.d.ts +99 -0
  111. package/dist/number-input.js +14 -0
  112. package/dist/page.d.ts +7 -0
  113. package/dist/page.js +1 -0
  114. package/dist/palette.d.ts +55 -0
  115. package/dist/palette.js +1 -0
  116. package/dist/placement.d.ts +98 -0
  117. package/dist/placement.js +1 -0
  118. package/dist/popover.d.ts +107 -0
  119. package/dist/popover.js +15 -0
  120. package/dist/scatter-chart.d.ts +32 -0
  121. package/dist/scatter-chart.js +121 -0
  122. package/dist/select.d.ts +112 -0
  123. package/dist/select.js +19 -0
  124. package/dist/slider.d.ts +46 -0
  125. package/dist/slider.js +111 -0
  126. package/dist/sort-button.d.ts +41 -0
  127. package/dist/sort-button.js +88 -0
  128. package/dist/sparkline.d.ts +22 -0
  129. package/dist/sparkline.js +72 -0
  130. package/dist/stat.d.ts +29 -0
  131. package/dist/stat.js +41 -0
  132. package/dist/styles.d.ts +22 -0
  133. package/dist/styles.js +2 -0
  134. package/dist/surface-events.d.ts +17 -0
  135. package/dist/surface-events.js +1 -0
  136. package/dist/surface-exit.d.ts +25 -0
  137. package/dist/surface-exit.js +1 -0
  138. package/dist/switch.d.ts +54 -0
  139. package/dist/switch.js +92 -0
  140. package/dist/t.d.ts +89 -0
  141. package/dist/t.js +1 -0
  142. package/dist/tabs.d.ts +65 -0
  143. package/dist/tabs.js +155 -0
  144. package/dist/text-area.d.ts +54 -0
  145. package/dist/text-area.js +9 -0
  146. package/dist/theme.d.ts +199 -0
  147. package/dist/theme.js +8 -0
  148. package/dist/theme.schema.json +1994 -0
  149. package/dist/themes/dark.css +3 -0
  150. package/dist/themes/light.css +3 -0
  151. package/dist/toggle-group.d.ts +56 -0
  152. package/dist/toggle-group.js +130 -0
  153. package/dist/tokens.d.ts +16 -0
  154. package/dist/tokens.js +3 -0
  155. package/dist/tooltip.d.ts +47 -0
  156. package/dist/tooltip.js +74 -0
  157. package/dist/variants-B4stUBnY.d.ts +16 -0
  158. package/dist/zag.d.ts +19 -0
  159. package/dist/zag.js +2 -0
  160. package/docs/theming.md +217 -0
  161. package/docs/what-to-change.md +20 -0
  162. package/docs/writing-a-component.md +250 -0
  163. package/llms.txt +71 -0
  164. package/package.json +90 -6
  165. package/registry/badge.ts +119 -0
  166. package/registry/bar-chart.ts +215 -0
  167. package/registry/button.ts +379 -0
  168. package/registry/callout-bubble.ts +347 -0
  169. package/registry/checkbox.ts +234 -0
  170. package/registry/collapsible.ts +271 -0
  171. package/registry/color-picker.ts +582 -0
  172. package/registry/context-menu.ts +208 -0
  173. package/registry/data-table.ts +215 -0
  174. package/registry/date-picker.ts +483 -0
  175. package/registry/dialog.ts +535 -0
  176. package/registry/donut.ts +145 -0
  177. package/registry/drawer.ts +636 -0
  178. package/registry/dropdown-menu.ts +762 -0
  179. package/registry/empty.ts +91 -0
  180. package/registry/field.ts +585 -0
  181. package/registry/glyph-select.ts +268 -0
  182. package/registry/hover-card.ts +222 -0
  183. package/registry/input-group.ts +229 -0
  184. package/registry/input.ts +181 -0
  185. package/registry/item.ts +376 -0
  186. package/registry/kbd.ts +64 -0
  187. package/registry/line-chart.ts +218 -0
  188. package/registry/month-grid.ts +328 -0
  189. package/registry/number-input.ts +443 -0
  190. package/registry/popover.ts +368 -0
  191. package/registry/scatter-chart.ts +221 -0
  192. package/registry/select.ts +620 -0
  193. package/registry/slider.ts +259 -0
  194. package/registry/sort-button.ts +189 -0
  195. package/registry/sparkline.ts +114 -0
  196. package/registry/stat.ts +96 -0
  197. package/registry/switch.ts +205 -0
  198. package/registry/tabs.ts +426 -0
  199. package/registry/text-area.ts +186 -0
  200. package/registry/toggle-group.ts +295 -0
  201. package/registry/tooltip.ts +156 -0
  202. package/skills/theming-vela-ui/SKILL.md +137 -0
  203. package/skills/using-vela-ui-components/SKILL.md +137 -0
  204. package/skills/writing-vela-ui-components/SKILL.md +163 -0
  205. package/src/components/badge.ts +119 -0
  206. package/src/components/bar-chart.ts +215 -0
  207. package/src/components/button.ts +379 -0
  208. package/src/components/callout-bubble.ts +347 -0
  209. package/src/components/checkbox.ts +234 -0
  210. package/src/components/collapsible.ts +271 -0
  211. package/src/components/color-picker.ts +582 -0
  212. package/src/components/context-menu.ts +208 -0
  213. package/src/components/data-table.ts +215 -0
  214. package/src/components/date-picker.ts +483 -0
  215. package/src/components/dialog.ts +535 -0
  216. package/src/components/donut.ts +145 -0
  217. package/src/components/drawer.ts +636 -0
  218. package/src/components/dropdown-menu.ts +762 -0
  219. package/src/components/empty.ts +91 -0
  220. package/src/components/field.ts +585 -0
  221. package/src/components/glyph-select.ts +268 -0
  222. package/src/components/hover-card.ts +222 -0
  223. package/src/components/input-group.ts +229 -0
  224. package/src/components/input.ts +181 -0
  225. package/src/components/item.ts +376 -0
  226. package/src/components/kbd.ts +64 -0
  227. package/src/components/line-chart.ts +218 -0
  228. package/src/components/month-grid.ts +328 -0
  229. package/src/components/number-input.ts +443 -0
  230. package/src/components/popover.ts +368 -0
  231. package/src/components/scatter-chart.ts +221 -0
  232. package/src/components/select.ts +620 -0
  233. package/src/components/slider.ts +259 -0
  234. package/src/components/sort-button.ts +189 -0
  235. package/src/components/sparkline.ts +114 -0
  236. package/src/components/stat.ts +96 -0
  237. package/src/components/switch.ts +205 -0
  238. package/src/components/tabs.ts +426 -0
  239. package/src/components/text-area.ts +186 -0
  240. package/src/components/toggle-group.ts +295 -0
  241. package/src/components/tooltip.ts +156 -0
  242. package/src/index.ts +24 -0
  243. package/src/lib/calendar.ts +117 -0
  244. package/src/lib/chart.ts +72 -0
  245. package/src/lib/color.ts +89 -0
  246. package/src/lib/component-index.ts +151 -0
  247. package/src/lib/css.ts +48 -0
  248. package/src/lib/define.ts +45 -0
  249. package/src/lib/dispose.ts +36 -0
  250. package/src/lib/h.ts +55 -0
  251. package/src/lib/headless.ts +16 -0
  252. package/src/lib/i18n.ts +30 -0
  253. package/src/lib/icons.ts +237 -0
  254. package/src/lib/kit-text.ts +26 -0
  255. package/src/lib/page.ts +24 -0
  256. package/src/lib/palette.ts +81 -0
  257. package/src/lib/placement.ts +188 -0
  258. package/src/lib/scope.ts +135 -0
  259. package/src/lib/styles.ts +53 -0
  260. package/src/lib/surface-events.ts +31 -0
  261. package/src/lib/surface-exit.ts +87 -0
  262. package/src/lib/t.ts +68 -0
  263. package/src/lib/theme.ts +664 -0
  264. package/src/lib/tokens.ts +111 -0
  265. package/src/lib/variants.ts +32 -0
  266. package/src/lib/zag.ts +46 -0
  267. package/stylelint/index.mjs +60 -0
  268. package/stylelint/lint.mjs +81 -0
  269. package/stylelint/plugin.mjs +115 -0
package/dist/empty.js ADDED
@@ -0,0 +1,38 @@
1
+ import { iconEl } from './chunk-G7IQLY3A.js';
2
+ import { h } from './chunk-Q6WTDVH6.js';
3
+ import { defineComponent } from './chunk-VMCR3S2A.js';
4
+ import { defineStyles, css } from './chunk-XBEL4K33.js';
5
+ import './chunk-2GQIZM5Z.js';
6
+ import './chunk-BXMWQIBO.js';
7
+ import './chunk-X66RJAIS.js';
8
+ import { t } from './chunk-6QCILIT2.js';
9
+
10
+ // src/components/empty.ts
11
+ var emptyDef = defineComponent({
12
+ name: "empty",
13
+ parts: ["root", "icon", "title", "description"],
14
+ settings: { "icon-radius": "9px" }
15
+ });
16
+ var injectStyles = defineStyles(
17
+ "vela-ui-empty-state",
18
+ css`@layer vela.ui{[data-slot=empty]{text-align:center;color:${t.fg.muted};padding:28px 16px}[data-slot=empty]:where(:not([hidden])){flex-direction:column;justify-content:center;align-items:center;gap:8px;display:flex}[data-slot=empty-icon]{border-radius:${emptyDef.vars["icon-radius"]};background:${t.hover};width:32px;height:32px;color:${t.fg};padding:7px}[data-slot=empty-icon]>svg{width:18px;height:18px}[data-slot=empty-title]{color:${t.fg.bright};font-size:12.5px;font-weight:600}[data-slot=empty-description]{max-width:260px;font-size:11.5px;line-height:1.45}}`
19
+ );
20
+ function createEmpty(props) {
21
+ injectStyles(document);
22
+ let icon = null;
23
+ if (props.icon) {
24
+ icon = iconEl(props.icon, document);
25
+ icon.dataset.slot = emptyDef.slot("icon");
26
+ }
27
+ const el = h(
28
+ "div",
29
+ { className: props.className, slot: emptyDef.slot("root") },
30
+ icon,
31
+ h("div", { slot: emptyDef.slot("title"), text: props.title }),
32
+ props.description ? h("div", { slot: emptyDef.slot("description"), text: props.description }) : null,
33
+ props.action ?? null
34
+ );
35
+ return { el, destroy: () => el.remove() };
36
+ }
37
+
38
+ export { createEmpty, emptyDef };
@@ -0,0 +1,147 @@
1
+ import { C as ComponentDef } from './define-D5u3F5Dj.js';
2
+ import { ChartTheme } from './tokens.js';
3
+ import { ColorFieldOpts } from './color-picker.js';
4
+ import { SelectOption, SelectListPopoverOpts } from './select.js';
5
+ import './t.js';
6
+ import './placement.js';
7
+ import './popover.js';
8
+ import './i18n.js';
9
+ import './variants-B4stUBnY.js';
10
+
11
+ type FieldGridVariant = 'settings' | 'inputs';
12
+ type FieldLabelSize = 'sm' | 'md';
13
+ /** Label↔control and between-row rhythm shared by the settings surfaces. */
14
+ declare const FIELD_GAP_PX = 16;
15
+ /** Grid tracks for a field grid. Settings hugs both columns; inputs give leftover
16
+ * space to the control column. Mobile flips the label to a flexible track. */
17
+ declare function fieldGridColumns(variant: FieldGridVariant, mobile: boolean): string;
18
+ declare const fieldDef: ComponentDef<"field", "label" | "section" | "span" | "grid" | "row" | "cell" | "bool" | "stacked" | "stacked-head" | "inline" | "inline-item" | "toggle-label" | "sep", never>;
19
+ interface FieldGridOptions {
20
+ variant?: FieldGridVariant;
21
+ mobile?: boolean;
22
+ }
23
+ /** Shared label/control grid. Rows with `display:contents` participate in these tracks. */
24
+ declare function fieldGrid(opts?: FieldGridOptions): HTMLElement;
25
+ interface FieldSectionOptions {
26
+ variant?: FieldGridVariant;
27
+ first?: boolean;
28
+ }
29
+ /** Uppercase group heading that spans the field grid. */
30
+ declare function fieldSection(title: string, opts?: FieldSectionOptions): HTMLElement;
31
+ /** Vertical breathing space between row clusters. */
32
+ declare function fieldSeparator(): HTMLElement;
33
+ interface FieldToggleOpts {
34
+ checked: boolean;
35
+ onChange: (v: boolean) => void;
36
+ get?: () => boolean;
37
+ id?: string;
38
+ }
39
+ interface FieldInlineItem {
40
+ label?: string;
41
+ id?: string;
42
+ control: HTMLElement;
43
+ /** Toggle sits left of its label (bool companion on an inline row). */
44
+ toggleFirst?: boolean;
45
+ fit?: boolean;
46
+ }
47
+ interface FieldRowOptions {
48
+ label: string;
49
+ id?: string;
50
+ control?: HTMLElement | HTMLElement[];
51
+ info?: HTMLElement;
52
+ toggle?: FieldToggleOpts;
53
+ /** Full-width toggle + label (no control column). */
54
+ bool?: boolean;
55
+ /** Full-width stacked: centered label above a full-width control (textarea). */
56
+ stacked?: boolean;
57
+ /** Full-width wrap of several labeled controls. */
58
+ inline?: FieldInlineItem[];
59
+ /** Skip the 100px control wrap (color / session / time). */
60
+ fit?: boolean;
61
+ /** Wrap a single control at this width (indicator dialog number/select column). */
62
+ controlWidth?: number;
63
+ labelSize?: FieldLabelSize;
64
+ className?: string;
65
+ }
66
+ /** Label + control slot, optional master toggle, optional ⓘ. Grid-aware. */
67
+ declare function fieldRow(opts: FieldRowOptions): HTMLElement;
68
+ interface FieldControlHandle {
69
+ el: HTMLElement;
70
+ setValue?: (v: unknown) => void;
71
+ /** Release the control. Discarding a subtree with {@link disposeWithin} does it too. */
72
+ destroy(): void;
73
+ }
74
+ type FieldControlDesc = {
75
+ kind: 'number';
76
+ id?: string;
77
+ value: number;
78
+ min?: number;
79
+ max?: number;
80
+ step?: number;
81
+ integer?: boolean;
82
+ commit?: 'blur' | 'live';
83
+ steppers?: boolean;
84
+ fill?: boolean;
85
+ compact?: boolean;
86
+ clamp?: boolean;
87
+ placeholder?: string;
88
+ emptyValue?: number;
89
+ title?: string;
90
+ onChange: (v: number) => void;
91
+ sync?: () => number;
92
+ } | {
93
+ kind: 'select';
94
+ id?: string;
95
+ options: readonly SelectOption[];
96
+ value: string;
97
+ fill?: boolean;
98
+ theme?: ChartTheme;
99
+ list?: SelectListPopoverOpts;
100
+ title?: string;
101
+ onChange: (v: string) => void;
102
+ sync?: () => string;
103
+ } | {
104
+ kind: 'switch';
105
+ id?: string;
106
+ checked: boolean;
107
+ onChange: (v: boolean) => void;
108
+ sync?: () => boolean;
109
+ } | {
110
+ kind: 'color';
111
+ id?: string;
112
+ theme: ChartTheme;
113
+ get: () => string;
114
+ onChange: (v: string) => void;
115
+ popover?: ColorFieldOpts['popover'];
116
+ /** Opacity-drag commit policy (default `'live'`): `'release'` when `onChange` recomputes rather than repaints. */
117
+ commit?: ColorFieldOpts['commit'];
118
+ title?: string;
119
+ } | {
120
+ kind: 'text';
121
+ id?: string;
122
+ value: string;
123
+ fill?: boolean;
124
+ placeholder?: string;
125
+ onChange: (v: string) => void;
126
+ sync?: () => string;
127
+ } | {
128
+ kind: 'textarea';
129
+ id?: string;
130
+ value: string;
131
+ rows?: number;
132
+ autoGrow?: boolean;
133
+ maxLines?: number;
134
+ placeholder?: string;
135
+ onChange: (v: string) => void;
136
+ sync?: () => string;
137
+ } | {
138
+ kind: 'width';
139
+ theme: ChartTheme;
140
+ get: () => number;
141
+ onChange: (v: number) => void;
142
+ title?: string;
143
+ };
144
+ /** One kit control from a neutral descriptor. `sync` re-reads on `vela-sync`. */
145
+ declare function buildFieldControl(desc: FieldControlDesc): FieldControlHandle;
146
+
147
+ export { FIELD_GAP_PX, type FieldControlDesc, type FieldControlHandle, type FieldGridOptions, type FieldGridVariant, type FieldInlineItem, type FieldLabelSize, type FieldRowOptions, type FieldSectionOptions, type FieldToggleOpts, buildFieldControl, fieldDef, fieldGrid, fieldGridColumns, fieldRow, fieldSection, fieldSeparator };
package/dist/field.js ADDED
@@ -0,0 +1,328 @@
1
+ import { TextArea } from './chunk-E2FE6V2N.js';
2
+ import { NumberInput } from './chunk-WXH3EFV5.js';
3
+ import { Select } from './chunk-Z5PINFQO.js';
4
+ import { widthField } from './chunk-7VMN7NKJ.js';
5
+ import { Input } from './chunk-U3EH42YY.js';
6
+ import { Checkbox } from './chunk-WBGSYCV2.js';
7
+ import './chunk-LZWZV2ZS.js';
8
+ import './chunk-G7IQLY3A.js';
9
+ import { ColorField } from './chunk-MJ4RUGX7.js';
10
+ import './chunk-FVH6L7FM.js';
11
+ import './chunk-FN2BUFNM.js';
12
+ import './chunk-B5ZSRUDQ.js';
13
+ import './chunk-J2QJATCD.js';
14
+ import './chunk-S7USVSYP.js';
15
+ import './chunk-V2Q4MRMS.js';
16
+ import './chunk-TAKSIV57.js';
17
+ import './chunk-MMTMOV6R.js';
18
+ import './chunk-3Q32K4PE.js';
19
+ import { disposeWithin } from './chunk-A72NWYNP.js';
20
+ import './chunk-P4MTEMT7.js';
21
+ import './chunk-Q6WTDVH6.js';
22
+ import { defineComponent } from './chunk-VMCR3S2A.js';
23
+ import { defineStyles, css } from './chunk-XBEL4K33.js';
24
+ import { injectStyles } from './chunk-2GQIZM5Z.js';
25
+ import './chunk-BXMWQIBO.js';
26
+ import './chunk-X66RJAIS.js';
27
+ import { t } from './chunk-6QCILIT2.js';
28
+
29
+ // src/components/field.ts
30
+ var FIELD_GAP_PX = 16;
31
+ function fieldGridColumns(variant, mobile) {
32
+ if (variant === "inputs") return mobile ? "minmax(0,1fr) auto" : "max-content 1fr";
33
+ return mobile ? "minmax(0,1fr) max-content" : "max-content max-content";
34
+ }
35
+ var fieldDef = defineComponent({
36
+ name: "field",
37
+ parts: ["grid", "row", "span", "label", "cell", "bool", "stacked", "stacked-head", "inline", "inline-item", "toggle-label", "section", "sep"]
38
+ });
39
+ var GAP = `${FIELD_GAP_PX}px`;
40
+ var injectFieldStyles = defineStyles(
41
+ "vela-ui-field",
42
+ css`@layer vela.ui{[data-slot~=field-grid]{align-content:start;align-items:center;column-gap:${GAP};row-gap:${GAP}}[data-slot~=field-grid]:where(:not([hidden])){display:grid}[data-slot~=field-grid][data-variant=inputs]{grid-template-columns:max-content 1fr}[data-slot~=field-grid][data-variant=inputs][data-mobile]{grid-template-columns:minmax(0,1fr) auto}[data-slot~=field-grid][data-variant=settings]{grid-template-columns:max-content max-content;column-gap:12px}[data-slot~=field-grid][data-variant=settings][data-mobile]{grid-template-columns:minmax(0,1fr) max-content}[data-slot~=field-row]:where(:not([hidden])){display:contents}[data-slot~=field-span]{grid-column:1/-1}[data-slot~=field-label]{opacity:.9;white-space:nowrap;text-overflow:ellipsis;font-size:14px;overflow:hidden}[data-slot~=field-label][data-size=sm]{font-size:inherit;opacity:.85}[data-slot~=field-cell]{justify-self:start;align-items:center;gap:8px;display:flex}[data-slot~=field-bool]:where(:not([hidden])){align-items:center;gap:8px;min-height:22px;display:flex}[data-slot~=field-stacked]:where(:not([hidden])){flex-direction:column;gap:8px;display:flex}[data-slot~=field-stacked-head]{justify-content:center;align-items:center;gap:8px;display:flex}[data-slot~=field-inline]:where(:not([hidden])){flex-wrap:wrap;align-items:center;gap:12px;display:flex}[data-slot~=field-inline-item],[data-slot~=field-toggle-label]{align-items:center;gap:8px;display:flex}[data-slot~=field-section]{font-size:${t.fontSize.sm};letter-spacing:.05em;text-transform:uppercase;color:${t.fg.muted};grid-column:1/-1;margin:24px 0 0;padding-bottom:8px;font-weight:700}[data-slot~=field-section][data-variant=inputs]{margin:0;padding:20px 0 8px;font-size:11px;font-weight:600}[data-slot~=field-section][data-variant=inputs][data-first]{padding-top:4px}[data-slot~=field-sep]{grid-column:1/-1;height:14px}}`
43
+ );
44
+ var DIM_CSS = ".vela-field-dim { opacity: 0.4 !important; pointer-events: none !important; }";
45
+ function injectStyles2(doc) {
46
+ injectFieldStyles(doc);
47
+ injectStyles("vela-ui-field-dim", DIM_CSS, doc);
48
+ }
49
+ function cls(el, ...parts) {
50
+ el.className = parts.map((p) => `vela-field-${p}`).join(" ");
51
+ el.setAttribute("data-slot", parts.map((p) => fieldDef.slot(p)).join(" "));
52
+ }
53
+ function fieldGrid(opts = {}) {
54
+ injectStyles2(document);
55
+ const el = document.createElement("div");
56
+ cls(el, "grid");
57
+ const variant = opts.variant ?? "inputs";
58
+ el.dataset.variant = variant;
59
+ if (opts.mobile) el.dataset.mobile = "";
60
+ el.style.gridTemplateColumns = fieldGridColumns(variant, opts.mobile === true);
61
+ return el;
62
+ }
63
+ function fieldSection(title, opts = {}) {
64
+ injectStyles2(document);
65
+ const el = document.createElement("div");
66
+ cls(el, "section");
67
+ if (opts.variant) el.dataset.variant = opts.variant;
68
+ if (opts.first) el.dataset.first = "";
69
+ el.textContent = title;
70
+ return el;
71
+ }
72
+ function fieldSeparator() {
73
+ injectStyles2(document);
74
+ const el = document.createElement("div");
75
+ cls(el, "sep");
76
+ return el;
77
+ }
78
+ function labelEl(text, opts) {
79
+ const el = document.createElement("span");
80
+ cls(el, "label");
81
+ if (opts.size) el.dataset.size = opts.size;
82
+ el.textContent = text;
83
+ const id = opts.id;
84
+ if (id) {
85
+ el.id = `${id}--title`;
86
+ queueMicrotask(() => {
87
+ el.ownerDocument.getElementById(id)?.setAttribute("aria-labelledby", el.id);
88
+ });
89
+ }
90
+ return el;
91
+ }
92
+ function asList(control) {
93
+ if (!control) return [];
94
+ return Array.isArray(control) ? control : [control];
95
+ }
96
+ function applyClass(el, extra) {
97
+ if (extra) {
98
+ for (const c of extra.split(/\s+/)) if (c) el.classList.add(c);
99
+ }
100
+ }
101
+ function dimControls(controls, on) {
102
+ for (const c of controls) {
103
+ if (c.dataset.sdSelfGated === "1") continue;
104
+ c.classList.toggle("vela-field-dim", !on);
105
+ }
106
+ }
107
+ function fieldRow(opts) {
108
+ injectStyles2(document);
109
+ const size = opts.labelSize;
110
+ if (opts.inline) {
111
+ const wrap2 = document.createElement("div");
112
+ cls(wrap2, "span", "inline");
113
+ for (const item of opts.inline) {
114
+ const it = document.createElement("div");
115
+ cls(it, "inline-item");
116
+ if (item.toggleFirst) it.style.flexDirection = "row-reverse";
117
+ if (item.label) {
118
+ it.appendChild(labelEl(item.label, { id: item.id, size }));
119
+ }
120
+ if (item.fit) it.appendChild(item.control);
121
+ else {
122
+ const cw = document.createElement("div");
123
+ cw.style.width = "100px";
124
+ cw.appendChild(item.control);
125
+ it.appendChild(cw);
126
+ }
127
+ wrap2.appendChild(it);
128
+ }
129
+ if (opts.info) wrap2.appendChild(opts.info);
130
+ applyClass(wrap2, opts.className);
131
+ return wrap2;
132
+ }
133
+ if (opts.bool) {
134
+ const wrap2 = document.createElement("div");
135
+ cls(wrap2, "span", "bool");
136
+ const sw = new Checkbox({
137
+ id: opts.toggle?.id ?? opts.id,
138
+ checked: opts.toggle?.checked ?? false,
139
+ size: "md",
140
+ tone: "bright",
141
+ onCheckedChange: (v) => opts.toggle?.onChange(v)
142
+ });
143
+ wrap2.append(sw.el, labelEl(opts.label, { id: opts.toggle?.id ?? opts.id, size }));
144
+ if (opts.info) wrap2.appendChild(opts.info);
145
+ if (opts.toggle?.get) {
146
+ const get = opts.toggle.get;
147
+ wrap2.addEventListener("vela-sync", () => {
148
+ sw.setChecked(get());
149
+ });
150
+ }
151
+ applyClass(wrap2, opts.className);
152
+ return wrap2;
153
+ }
154
+ if (opts.stacked) {
155
+ const wrap2 = document.createElement("div");
156
+ cls(wrap2, "span", "stacked");
157
+ const head = document.createElement("div");
158
+ cls(head, "stacked-head");
159
+ head.appendChild(labelEl(opts.label, { id: opts.id, size }));
160
+ if (opts.info) head.appendChild(opts.info);
161
+ wrap2.appendChild(head);
162
+ for (const c of asList(opts.control)) wrap2.appendChild(c);
163
+ applyClass(wrap2, opts.className);
164
+ return wrap2;
165
+ }
166
+ const wrap = document.createElement("div");
167
+ cls(wrap, "row");
168
+ const controls = asList(opts.control);
169
+ if (opts.toggle) {
170
+ const left = document.createElement("div");
171
+ cls(left, "toggle-label");
172
+ const sw = new Checkbox({
173
+ id: opts.toggle.id ?? opts.id,
174
+ checked: opts.toggle.checked,
175
+ size: "md",
176
+ tone: "bright",
177
+ onCheckedChange: (v) => {
178
+ opts.toggle.onChange(v);
179
+ if (controls.length > 0) dimControls(controls, v);
180
+ }
181
+ });
182
+ left.append(sw.el, labelEl(opts.label, { id: opts.toggle.id ?? opts.id, size }));
183
+ wrap.appendChild(left);
184
+ if (controls.length > 0) dimControls(controls, opts.toggle.checked);
185
+ if (opts.toggle.get) {
186
+ const get = opts.toggle.get;
187
+ wrap.addEventListener("vela-sync", () => {
188
+ const v = get();
189
+ sw.setChecked(v);
190
+ if (controls.length > 0) dimControls(controls, v);
191
+ });
192
+ }
193
+ } else {
194
+ wrap.appendChild(labelEl(opts.label, { id: opts.id, size }));
195
+ }
196
+ const cell = document.createElement("div");
197
+ cls(cell, "cell");
198
+ if (opts.controlWidth != null && controls.length === 1 && !opts.fit) {
199
+ const cw = document.createElement("div");
200
+ cw.style.width = `${opts.controlWidth}px`;
201
+ cw.appendChild(controls[0]);
202
+ cell.appendChild(cw);
203
+ } else {
204
+ for (const c of controls) cell.appendChild(c);
205
+ }
206
+ if (opts.info) cell.appendChild(opts.info);
207
+ wrap.appendChild(cell);
208
+ applyClass(wrap, opts.className);
209
+ return wrap;
210
+ }
211
+ function buildFieldControl(desc) {
212
+ if (desc.kind === "number") {
213
+ const ni = new NumberInput({
214
+ id: desc.id,
215
+ value: desc.value,
216
+ min: desc.min,
217
+ max: desc.max,
218
+ step: desc.step,
219
+ integer: desc.integer,
220
+ size: "md",
221
+ fill: desc.fill,
222
+ compact: desc.compact,
223
+ commit: desc.commit,
224
+ steppers: desc.steppers,
225
+ clamp: desc.clamp,
226
+ placeholder: desc.placeholder,
227
+ emptyValue: desc.emptyValue,
228
+ title: desc.title,
229
+ onChange: desc.onChange
230
+ });
231
+ if (desc.sync) {
232
+ const sync = desc.sync;
233
+ ni.el.addEventListener("vela-sync", () => {
234
+ ni.setValue(sync());
235
+ });
236
+ }
237
+ return { el: ni.el, setValue: (v) => ni.setValue(Number(v)), destroy: () => ni.destroy() };
238
+ }
239
+ if (desc.kind === "select") {
240
+ const sel = new Select({
241
+ id: desc.id,
242
+ options: desc.options,
243
+ value: desc.value,
244
+ size: "md",
245
+ fill: desc.fill,
246
+ theme: desc.theme,
247
+ list: desc.list,
248
+ onValueChange: desc.onChange
249
+ });
250
+ if (desc.title) sel.el.title = desc.title;
251
+ if (desc.sync) {
252
+ const sync = desc.sync;
253
+ sel.el.addEventListener("vela-sync", () => {
254
+ sel.setValue(sync());
255
+ });
256
+ }
257
+ return { el: sel.el, setValue: (v) => sel.setValue(String(v)), destroy: () => sel.destroy() };
258
+ }
259
+ if (desc.kind === "switch") {
260
+ const sw = new Checkbox({
261
+ id: desc.id,
262
+ checked: desc.checked,
263
+ size: "md",
264
+ tone: "bright",
265
+ onCheckedChange: desc.onChange
266
+ });
267
+ if (desc.sync) {
268
+ const sync = desc.sync;
269
+ sw.el.addEventListener("vela-sync", () => {
270
+ sw.setChecked(sync());
271
+ });
272
+ }
273
+ return { el: sw.el, setValue: (v) => sw.setChecked(Boolean(v)), destroy: () => sw.destroy() };
274
+ }
275
+ if (desc.kind === "color") {
276
+ const field = new ColorField({
277
+ theme: desc.theme,
278
+ getVal: desc.get,
279
+ onVal: desc.onChange,
280
+ shape: "circle",
281
+ id: desc.id,
282
+ popover: desc.popover,
283
+ commit: desc.commit
284
+ });
285
+ if (desc.title) field.el.title = desc.title;
286
+ return { el: field.el, destroy: () => field.destroy() };
287
+ }
288
+ if (desc.kind === "text") {
289
+ const tf = new Input({
290
+ id: desc.id,
291
+ value: desc.value,
292
+ size: "md",
293
+ fill: desc.fill,
294
+ onChange: desc.onChange
295
+ });
296
+ if (desc.placeholder) tf.input.placeholder = desc.placeholder;
297
+ if (desc.sync) {
298
+ const sync = desc.sync;
299
+ tf.el.addEventListener("vela-sync", () => {
300
+ tf.setValue(sync());
301
+ });
302
+ }
303
+ return { el: tf.el, setValue: (v) => tf.setValue(String(v)), destroy: () => tf.destroy() };
304
+ }
305
+ if (desc.kind === "textarea") {
306
+ const ta = new TextArea({
307
+ id: desc.id,
308
+ value: desc.value,
309
+ rows: desc.rows,
310
+ autoGrow: desc.autoGrow,
311
+ maxLines: desc.maxLines,
312
+ placeholder: desc.placeholder,
313
+ onChange: desc.onChange
314
+ });
315
+ if (desc.sync) {
316
+ const sync = desc.sync;
317
+ ta.el.addEventListener("vela-sync", () => {
318
+ ta.setValue(sync());
319
+ });
320
+ }
321
+ return { el: ta.el, setValue: (v) => ta.setValue(String(v)), destroy: () => ta.destroy() };
322
+ }
323
+ const el = widthField(desc.theme, desc.get, desc.onChange);
324
+ if (desc.title) el.title = desc.title;
325
+ return { el, destroy: () => disposeWithin(el) };
326
+ }
327
+
328
+ export { FIELD_GAP_PX, buildFieldControl, fieldDef, fieldGrid, fieldGridColumns, fieldRow, fieldSection, fieldSeparator };
@@ -0,0 +1,57 @@
1
+ import { C as ComponentDef } from './define-D5u3F5Dj.js';
2
+ import { PlacementProps } from './placement.js';
3
+ import { ChartTheme } from './tokens.js';
4
+ import './t.js';
5
+
6
+ interface GlyphOption<T extends string | number = string | number> {
7
+ value: T;
8
+ label: string;
9
+ /** Inner HTML of the preview glyph (currentColor stroke). */
10
+ glyph: string;
11
+ }
12
+ interface GlyphSelectControllerOptions<T extends string | number = string | number> {
13
+ options: readonly GlyphOption<T>[];
14
+ value: T;
15
+ onChange?: (value: T) => void;
16
+ }
17
+ interface GlyphSelectController<T extends string | number = string | number> {
18
+ options: readonly GlyphOption<T>[];
19
+ value: T;
20
+ setValue(v: T): void;
21
+ optionOf(value: T): GlyphOption<T> | undefined;
22
+ pick(value: T): T;
23
+ }
24
+ /** The glyph select's options and current value, without DOM. */
25
+ declare function glyphSelectController<T extends string | number>(opts: GlyphSelectControllerOptions<T>): GlyphSelectController<T>;
26
+ /** The classic 1–5 px line-width ladder. */
27
+ declare const WIDTH_FIELD_OPTIONS: readonly number[];
28
+ /** A horizontal line glyph whose stroke IS the previewed weight. */
29
+ declare function lineWidthGlyph(width: number): string;
30
+ declare function widthFieldOptions(): readonly GlyphOption<number>[];
31
+ declare const glyphSelectDef: ComponentDef<"glyph-select", "root" | "icon" | "content" | "value" | "item", "radius" | "content-radius" | "focus-ring">;
32
+ /** Where the list opens beside the field (shadcn's placement props; default below and
33
+ * end-aligned, 6px away). */
34
+ interface GlyphSelectOptions<T extends string | number = string | number> extends GlyphSelectControllerOptions<T>, PlacementProps {
35
+ theme: ChartTheme;
36
+ title?: string;
37
+ get?: () => T;
38
+ }
39
+ type GlyphSelectProps<T extends string | number = string | number> = GlyphSelectOptions<T>;
40
+ declare class GlyphSelect<T extends string | number = string | number> {
41
+ readonly el: HTMLButtonElement;
42
+ private readonly ctrl;
43
+ private readonly theme;
44
+ private readonly get;
45
+ private readonly placement;
46
+ constructor(opts: GlyphSelectOptions<T>);
47
+ setValue(v: T): void;
48
+ destroy(): void;
49
+ private paint;
50
+ private toggle;
51
+ }
52
+ declare function createGlyphSelect<T extends string | number = string | number>(props: GlyphSelectProps<T>): GlyphSelect<T>;
53
+ /** Settings-dialog line-width field (1–5 px glyphs). */
54
+ declare function widthField(theme: ChartTheme, getVal: () => number, onVal: (v: number) => void): HTMLElement;
55
+ declare function closeWidthPopover(): void;
56
+
57
+ export { type GlyphOption, GlyphSelect, type GlyphSelectController, type GlyphSelectControllerOptions, type GlyphSelectOptions, type GlyphSelectProps, WIDTH_FIELD_OPTIONS, closeWidthPopover, createGlyphSelect, glyphSelectController, glyphSelectDef, lineWidthGlyph, widthField, widthFieldOptions };
@@ -0,0 +1,17 @@
1
+ export { GlyphSelect, WIDTH_FIELD_OPTIONS, closeWidthPopover, createGlyphSelect, glyphSelectController, glyphSelectDef, lineWidthGlyph, widthField, widthFieldOptions } from './chunk-7VMN7NKJ.js';
2
+ import './chunk-G7IQLY3A.js';
3
+ import './chunk-B5ZSRUDQ.js';
4
+ import './chunk-J2QJATCD.js';
5
+ import './chunk-S7USVSYP.js';
6
+ import './chunk-V2Q4MRMS.js';
7
+ import './chunk-TAKSIV57.js';
8
+ import './chunk-MMTMOV6R.js';
9
+ import './chunk-3Q32K4PE.js';
10
+ import './chunk-A72NWYNP.js';
11
+ import './chunk-Q6WTDVH6.js';
12
+ import './chunk-VMCR3S2A.js';
13
+ import './chunk-XBEL4K33.js';
14
+ import './chunk-2GQIZM5Z.js';
15
+ import './chunk-BXMWQIBO.js';
16
+ import './chunk-X66RJAIS.js';
17
+ import './chunk-6QCILIT2.js';
@@ -0,0 +1,24 @@
1
+ type Child = Node | string | number | null | undefined | false | readonly Child[];
2
+ type AttrValue = string | number | boolean | null | undefined;
3
+ interface ElementProps {
4
+ className?: string;
5
+ /** The part's `data-slot` (take it from the component's `defineComponent`). */
6
+ slot?: string;
7
+ /** `data-*` attributes (`{ icon: 'inline-start' }` → `data-icon="inline-start"`). `true`
8
+ * writes an empty value; `false`, `null` and `undefined` write nothing. */
9
+ data?: Record<string, AttrValue>;
10
+ /** Plain attributes, with the same value rules as `data`. */
11
+ attrs?: Record<string, AttrValue>;
12
+ style?: string;
13
+ text?: string;
14
+ on?: {
15
+ [K in keyof HTMLElementEventMap]?: (e: HTMLElementEventMap[K]) => void;
16
+ };
17
+ }
18
+ declare function h<K extends keyof HTMLElementTagNameMap>(tag: K, props?: ElementProps, ...children: Child[]): HTMLElementTagNameMap[K];
19
+ declare function append(el: Node, children: readonly Child[]): void;
20
+ /** Add a part to an element's slot, keeping the ones it has: a shell one component owns and
21
+ * another builds on carries both (`data-slot="popover-content select-content"`). */
22
+ declare function addSlot(el: Element, slot: string): void;
23
+
24
+ export { type Child as C, type ElementProps as E, addSlot as a, append as b, h };
@@ -0,0 +1,6 @@
1
+ /** Attributes for one part. `false` and `undefined` mean "absent"; `true` is the empty value. */
2
+ type PartProps = Readonly<Record<string, string | number | boolean | undefined>>;
3
+ /** Write a part's attributes onto its element, removing the ones that turned absent. */
4
+ declare function applyProps(el: Element, props: PartProps): void;
5
+
6
+ export { type PartProps, applyProps };
@@ -0,0 +1,9 @@
1
+ // src/lib/headless.ts
2
+ function applyProps(el, props) {
3
+ for (const [name, value] of Object.entries(props)) {
4
+ if (value === false || value === void 0) el.removeAttribute(name);
5
+ else el.setAttribute(name, value === true ? "" : String(value));
6
+ }
7
+ }
8
+
9
+ export { applyProps };
@@ -0,0 +1,43 @@
1
+ import { C as ComponentDef } from './define-D5u3F5Dj.js';
2
+ import { PlacementProps, Side } from './placement.js';
3
+ import './t.js';
4
+
5
+ declare const hoverCardDef: ComponentDef<"hover-card", "root" | "body" | "title" | "icon" | "description" | "heading" | "hint", "radius" | "shadow" | "width" | "icon-radius" | "wide-width">;
6
+ interface HoverCardContent {
7
+ title: string;
8
+ description?: string;
9
+ /** Icon id from the kit's registry, in a tile beside the title. */
10
+ icon?: string;
11
+ /** A shortcut drawn as keycaps (`Alt+A`). */
12
+ shortcut?: string;
13
+ /** A secondary line at the bottom ("Shift-click to open alongside"). */
14
+ hint?: string;
15
+ /** Rich content under the description (figures, a sparkline). */
16
+ body?: Node;
17
+ /** A wider card, for rich content. */
18
+ wide?: boolean;
19
+ }
20
+ type HoverCardSide = Side;
21
+ /** Where the card opens beside its trigger: on the right, centered, 8px away by default. */
22
+ type HoverCardPlacement = PlacementProps;
23
+ interface HoverCardHandle {
24
+ readonly el: HTMLElement;
25
+ /** Place the card beside `anchor`, kept inside its collision area. `gap` overrides the
26
+ * placement's `sideOffset`. */
27
+ place(anchor: DOMRect, gap?: number): void;
28
+ destroy(): void;
29
+ }
30
+ declare function createHoverCard(content: HoverCardContent, placement?: HoverCardSide | HoverCardPlacement): HoverCardHandle;
31
+ interface AttachHoverCardOptions extends HoverCardPlacement {
32
+ /** ms the pointer rests before the card opens (default 300). */
33
+ openDelay?: number;
34
+ /** @deprecated Use `openDelay`. */
35
+ delay?: number;
36
+ /** Where the card mounts: the themed shell root, so the card takes its theme. */
37
+ host: HTMLElement;
38
+ }
39
+ /** Show a hover card for `trigger` while the pointer rests on it; `content` is read at each
40
+ * open (null: no card this time). Returns the detach. */
41
+ declare function attachHoverCard(trigger: HTMLElement, content: () => HoverCardContent | null, opts: AttachHoverCardOptions): () => void;
42
+
43
+ export { type AttachHoverCardOptions, type HoverCardContent, type HoverCardHandle, type HoverCardPlacement, type HoverCardSide, attachHoverCard, createHoverCard, hoverCardDef };