@luxalgo/vela-ui 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/README.md +5 -2
  3. package/dist/badge.js +1 -1
  4. package/dist/bar-chart.js +1 -1
  5. package/dist/button.d.ts +18 -4
  6. package/dist/button.js +4 -3
  7. package/dist/calendar.d.ts +3 -1
  8. package/dist/calendar.js +1 -1
  9. package/dist/callout-bubble.d.ts +6 -1
  10. package/dist/callout-bubble.js +12 -8
  11. package/dist/card.d.ts +52 -0
  12. package/dist/card.js +179 -0
  13. package/dist/checkbox.js +5 -5
  14. package/dist/{chunk-X4YPSIW6.js → chunk-5BJV5FY5.js} +1 -1
  15. package/dist/{chunk-FCO3YZLT.js → chunk-ALAHGSLC.js} +1 -1
  16. package/dist/{chunk-5QHXOAZA.js → chunk-B2EZB5ZG.js} +4 -4
  17. package/dist/{chunk-G7IQLY3A.js → chunk-C3PXY2SW.js} +5 -0
  18. package/dist/chunk-DXDCKZ2M.js +117 -0
  19. package/dist/{chunk-6NXY62JS.js → chunk-FYVQO5TN.js} +1 -1
  20. package/dist/{chunk-V6TTTMTE.js → chunk-GVRX3UAV.js} +4 -1
  21. package/dist/{chunk-XJAPCCOJ.js → chunk-IOOYDSSK.js} +4 -4
  22. package/dist/{chunk-OBLIX3VN.js → chunk-KKS6NEGI.js} +2 -2
  23. package/dist/{chunk-SAPURP46.js → chunk-OJ2SEMN6.js} +3 -3
  24. package/dist/{chunk-2Q4JRINP.js → chunk-OQXFQMZM.js} +3 -3
  25. package/dist/{chunk-AJ2IYSOI.js → chunk-TBXUF5YX.js} +35 -3
  26. package/dist/{chunk-ZB3BZHSN.js → chunk-UEO6W37Z.js} +4 -4
  27. package/dist/{chunk-CH3DV6FD.js → chunk-WWHNUKSZ.js} +5 -5
  28. package/dist/chunk-XBEL4K33.js +142 -0
  29. package/dist/collapsible.d.ts +49 -0
  30. package/dist/collapsible.js +106 -0
  31. package/dist/color-picker.js +5 -5
  32. package/dist/context-menu.js +5 -5
  33. package/dist/css.d.ts +3 -1
  34. package/dist/css.js +1 -1
  35. package/dist/data-table.d.ts +39 -2
  36. package/dist/data-table.js +1 -1
  37. package/dist/date-picker.js +3 -3
  38. package/dist/dialog.d.ts +8 -0
  39. package/dist/dialog.js +15 -5
  40. package/dist/donut.js +1 -1
  41. package/dist/drawer.js +2 -2
  42. package/dist/dropdown-menu.js +4 -4
  43. package/dist/empty.js +2 -2
  44. package/dist/field.js +13 -13
  45. package/dist/glyph-select.js +5 -5
  46. package/dist/h-Bl37qUis.d.ts +24 -0
  47. package/dist/hover-card.d.ts +1 -1
  48. package/dist/hover-card.js +3 -3
  49. package/dist/icons.js +1 -1
  50. package/dist/index.d.ts +10 -2
  51. package/dist/index.js +3 -3
  52. package/dist/input-group.js +4 -3
  53. package/dist/input.js +2 -2
  54. package/dist/item.d.ts +72 -0
  55. package/dist/item.js +131 -0
  56. package/dist/kbd.js +2 -2
  57. package/dist/line-chart.js +1 -1
  58. package/dist/manifest.json +1336 -65
  59. package/dist/month-grid.d.ts +45 -0
  60. package/dist/month-grid.js +157 -0
  61. package/dist/number-input.js +5 -5
  62. package/dist/popover.js +3 -3
  63. package/dist/scatter-chart.js +1 -1
  64. package/dist/select.js +7 -7
  65. package/dist/slider.d.ts +46 -0
  66. package/dist/slider.js +111 -0
  67. package/dist/sort-button.d.ts +41 -0
  68. package/dist/sort-button.js +88 -0
  69. package/dist/sparkline.js +1 -1
  70. package/dist/stat.js +1 -1
  71. package/dist/switch.js +3 -3
  72. package/dist/tabs.d.ts +3 -1
  73. package/dist/tabs.js +13 -8
  74. package/dist/text-area.js +2 -2
  75. package/dist/theme-Ct-q58xz.d.ts +341 -0
  76. package/dist/theme.d.ts +42 -181
  77. package/dist/theme.js +2 -2
  78. package/dist/theme.schema.json +541 -1
  79. package/dist/toast.d.ts +49 -0
  80. package/dist/toast.js +463 -0
  81. package/dist/toggle-group.js +4 -4
  82. package/dist/tooltip.js +2 -2
  83. package/dist/treemap.d.ts +80 -0
  84. package/dist/treemap.js +470 -0
  85. package/docs/theming.md +6 -0
  86. package/docs/writing-a-component.md +4 -1
  87. package/llms.txt +11 -3
  88. package/package.json +1 -1
  89. package/registry/button.ts +105 -21
  90. package/registry/callout-bubble.ts +14 -3
  91. package/registry/card.ts +379 -0
  92. package/registry/collapsible.ts +271 -0
  93. package/registry/dialog.ts +16 -0
  94. package/registry/dropdown-menu.ts +3 -3
  95. package/registry/item.ts +376 -0
  96. package/registry/month-grid.ts +328 -0
  97. package/registry/slider.ts +259 -0
  98. package/registry/sort-button.ts +189 -0
  99. package/registry/tabs.ts +38 -4
  100. package/registry/toast.ts +965 -0
  101. package/registry/treemap.ts +847 -0
  102. package/skills/using-vela-ui-components/SKILL.md +14 -9
  103. package/src/components/button.ts +105 -21
  104. package/src/components/callout-bubble.ts +14 -3
  105. package/src/components/card.ts +379 -0
  106. package/src/components/collapsible.ts +271 -0
  107. package/src/components/dialog.ts +16 -0
  108. package/src/components/dropdown-menu.ts +3 -3
  109. package/src/components/item.ts +376 -0
  110. package/src/components/month-grid.ts +328 -0
  111. package/src/components/slider.ts +259 -0
  112. package/src/components/sort-button.ts +189 -0
  113. package/src/components/tabs.ts +38 -4
  114. package/src/components/toast.ts +965 -0
  115. package/src/components/treemap.ts +847 -0
  116. package/src/lib/calendar.ts +5 -0
  117. package/src/lib/component-index.ts +34 -2
  118. package/src/lib/css.ts +6 -2
  119. package/src/lib/icons.ts +7 -0
  120. package/src/lib/scope.ts +135 -0
  121. package/src/lib/theme.ts +21 -5
  122. package/dist/chunk-EZQXTO6K.js +0 -89
  123. package/dist/chunk-IDA2BT7D.js +0 -29
  124. package/dist/data-table-DtU3FX9j.d.ts +0 -61
package/dist/theme.d.ts CHANGED
@@ -1,188 +1,49 @@
1
- import { badgeDef } from './badge.js';
2
- import { barChartDef } from './bar-chart.js';
3
- import { buttonDef } from './button.js';
4
- import { calloutBubbleDef } from './callout-bubble.js';
5
- import { colorPickerDef } from './color-picker.js';
6
- import { d as dataTableDef } from './data-table-DtU3FX9j.js';
7
- import { datePickerDef } from './date-picker.js';
8
- import { dialogDef } from './dialog.js';
9
- import { donutDef } from './donut.js';
10
- import { drawerDef } from './drawer.js';
11
- import { emptyDef } from './empty.js';
12
- import { fieldDef } from './field.js';
13
- import { glyphSelectDef } from './glyph-select.js';
14
- import { hoverCardDef } from './hover-card.js';
15
- import { kbdDef } from './kbd.js';
16
- import { lineChartDef } from './line-chart.js';
17
- import { dropdownMenuDef } from './dropdown-menu.js';
18
- import { numberInputDef } from './number-input.js';
19
- import { popoverDef } from './popover.js';
20
- import { scatterChartDef } from './scatter-chart.js';
21
- import { selectDef } from './select.js';
22
- import { sparklineDef } from './sparkline.js';
23
- import { statDef } from './stat.js';
24
- import { checkboxDef } from './checkbox.js';
25
- import { tabsDef } from './tabs.js';
26
- import { textAreaDef } from './text-area.js';
27
- import { inputDef } from './input.js';
28
- import { inputGroupDef } from './input-group.js';
29
- import { switchDef } from './switch.js';
30
- import { toggleGroupDef } from './toggle-group.js';
31
- import { tooltipDef } from './tooltip.js';
32
- import { C as ComponentDef } from './define-D5u3F5Dj.js';
33
- import { ChartTheme } from './tokens.js';
1
+ import './badge.js';
2
+ import './bar-chart.js';
3
+ import './button.js';
4
+ import './callout-bubble.js';
5
+ import './card.js';
6
+ import './color-picker.js';
7
+ import './data-table.js';
8
+ import './date-picker.js';
9
+ import './dialog.js';
10
+ import './donut.js';
11
+ import './drawer.js';
12
+ import './empty.js';
13
+ import './field.js';
14
+ import './glyph-select.js';
15
+ import './hover-card.js';
16
+ import './kbd.js';
17
+ import './line-chart.js';
18
+ import './dropdown-menu.js';
19
+ import './number-input.js';
20
+ import './popover.js';
21
+ import './scatter-chart.js';
22
+ import './select.js';
23
+ import './sparkline.js';
24
+ import './stat.js';
25
+ import './checkbox.js';
26
+ import './collapsible.js';
27
+ import './tabs.js';
28
+ import './text-area.js';
29
+ import './input.js';
30
+ import './input-group.js';
31
+ import './item.js';
32
+ import './month-grid.js';
33
+ import './slider.js';
34
+ import './sort-button.js';
35
+ import './switch.js';
36
+ export { C as ComponentDefs, a as ComponentSettings, b as CreateThemeOptions, D as DARK_CHART, L as LIGHT_CHART, T as TOKEN_NAMES, c as ThemeInput, d as ThemeSettings, e as ThemedChart, f as TokenName, U as UiTheme, y as applyPlotOverlayTokens, g as applyTheme, z as applyThemeTokens, h as checkTheme, i as createTheme, A as ensureUIHost, B as floatingLayerHost, F as themeCss } from './theme-Ct-q58xz.js';
37
+ import './toggle-group.js';
38
+ import './tooltip.js';
39
+ import './treemap.js';
40
+ import './define-D5u3F5Dj.js';
41
+ import './tokens.js';
34
42
  import './variants-B4stUBnY.js';
35
43
  import './t.js';
36
44
  import './placement.js';
45
+ import './h-Bl37qUis.js';
37
46
  import './i18n.js';
38
47
  import '@zag-js/dialog';
39
48
  import '@zag-js/menu';
40
49
  import '@zag-js/tooltip';
41
-
42
- /** The built-in dark chart theme. */
43
- declare const DARK_CHART: ChartTheme;
44
- /** The built-in light chart theme. Candle hues are shared across themes: switching themes
45
- * recolors surfaces and text, never the series. */
46
- declare const LIGHT_CHART: ChartTheme;
47
- /** Every token, by name without the `--vela-` prefix. A test checks the list against what
48
- * `createTheme` writes. */
49
- declare const TOKEN_NAMES: readonly ["space-1", "space-2", "space-3", "space-4", "radius-sm", "radius-md", "radius-lg", "z-tooltip", "z-menu", "z-dialog", "z-popover", "ease", "dur-fast", "dur-med", "font-size-sm", "font-size-md", "font-size-lg", "scroll-size", "font", "bg", "fg", "fg-muted", "fg-faint", "fg-bright", "surface", "surface-elev", "surface-overlay", "surface-sunken", "border", "border-strong", "border-soft", "border-faint", "hover", "active", "hover-strong", "focus", "focus-soft", "separator-hover-band", "separator-hover-line", "scroll", "accent", "accent-bright", "highlight", "selected-bg", "selected-fg", "fg-on-fill", "up", "down", "profit", "loss", "danger", "shadow", "shadow-dialog", "backdrop"];
50
- type TokenName = (typeof TOKEN_NAMES)[number];
51
- /** The components a theme can set, by name: each one's declaration. A package with
52
- * components of its own adds them here by declaration merging. */
53
- interface ComponentDefs {
54
- badge: typeof badgeDef;
55
- 'bar-chart': typeof barChartDef;
56
- button: typeof buttonDef;
57
- 'callout-bubble': typeof calloutBubbleDef;
58
- 'color-picker': typeof colorPickerDef;
59
- 'data-table': typeof dataTableDef;
60
- 'date-picker': typeof datePickerDef;
61
- dialog: typeof dialogDef;
62
- donut: typeof donutDef;
63
- drawer: typeof drawerDef;
64
- empty: typeof emptyDef;
65
- field: typeof fieldDef;
66
- 'glyph-select': typeof glyphSelectDef;
67
- 'hover-card': typeof hoverCardDef;
68
- kbd: typeof kbdDef;
69
- 'line-chart': typeof lineChartDef;
70
- 'dropdown-menu': typeof dropdownMenuDef;
71
- 'number-input': typeof numberInputDef;
72
- popover: typeof popoverDef;
73
- 'scatter-chart': typeof scatterChartDef;
74
- select: typeof selectDef;
75
- sparkline: typeof sparklineDef;
76
- stat: typeof statDef;
77
- checkbox: typeof checkboxDef;
78
- tabs: typeof tabsDef;
79
- 'text-area': typeof textAreaDef;
80
- input: typeof inputDef;
81
- 'input-group': typeof inputGroupDef;
82
- switch: typeof switchDef;
83
- 'toggle-group': typeof toggleGroupDef;
84
- tooltip: typeof tooltipDef;
85
- }
86
- type SettingsOf<D> = D extends ComponentDef<string, string, infer S> ? S : never;
87
- type PartsOf<D> = D extends ComponentDef<string, infer P, string> ? P : never;
88
- /** Settings by component, then by setting (`{ button: { radius: '2px' } }`), each written
89
- * as `--vela-<component>-<setting>`. `css` restyles the component's parts completely: each
90
- * part's CSS, written with the `css` tag, applies to that part under the theme, after every
91
- * other layer of the kit. */
92
- type ComponentSettings = {
93
- [K in keyof ComponentDefs]?: {
94
- [S in SettingsOf<ComponentDefs[K]>]?: string;
95
- } & {
96
- css?: {
97
- [P in PartsOf<ComponentDefs[K]>]?: string;
98
- };
99
- };
100
- };
101
- interface CreateThemeOptions {
102
- /** Apply part CSS that was not written with the `css` tag (a theme loaded from data).
103
- * Off by default: CSS from someone else can restyle the page to mislead, and load
104
- * remote images that leak what the page shows. */
105
- allowCss?: boolean;
106
- }
107
- /** A theme's settings beyond the chart's colors. */
108
- interface ThemeSettings {
109
- /** The brand color; its readable ink derives from it. */
110
- accent?: string;
111
- /** Scales every radius token: `none`, `sm`, `md` (default), `lg`. */
112
- radius?: 'none' | 'sm' | 'md' | 'lg';
113
- font?: string;
114
- /** Any token, by name. */
115
- tokens?: Partial<Record<TokenName, string>>;
116
- components?: ComponentSettings;
117
- }
118
- /** The choices a theme is built from. Every field is optional: `createTheme()` is the dark theme. */
119
- interface ThemeInput extends ThemeSettings {
120
- /** The theme to start from: `dark` (default), `light`, or a chart theme's seven fields. */
121
- base?: 'dark' | 'light' | ChartTheme;
122
- /** A theme from colors alone: everything else derives from them, light or dark read
123
- * from the background. */
124
- colors?: {
125
- background?: string;
126
- text?: string;
127
- grid?: string;
128
- border?: string;
129
- up?: string;
130
- down?: string;
131
- accent?: string;
132
- };
133
- }
134
- /** A theme built by {@link createTheme}. */
135
- interface UiTheme {
136
- /** Derived from the values: equal themes share one rule. */
137
- readonly id: string;
138
- /** The chart's colors and font. */
139
- readonly chart: ChartTheme;
140
- /** Every token, by custom property (`--vela-accent`). */
141
- readonly tokens: Readonly<Record<string, string>>;
142
- /** Component settings, by component then setting. */
143
- readonly components: Readonly<Record<string, Readonly<Record<string, string>>>>;
144
- /** Part CSS, by component then part. */
145
- readonly css: Readonly<Record<string, Readonly<Record<string, string>>>>;
146
- /** Its settings beyond the chart's colors: with {@link chart}, they rebuild the theme. */
147
- readonly settings: Readonly<ThemeSettings>;
148
- }
149
- /** A chart theme with optional settings: its seven fields seed the UI theme and `ui`
150
- * adjusts it. Chrome that recolors its surface (an overlay following the plot's
151
- * background) keeps the settings. */
152
- type ThemedChart = ChartTheme & {
153
- readonly ui?: ThemeSettings;
154
- };
155
- /** What is wrong with a theme's input: unknown tokens, components, settings and parts, colors
156
- * the theme cannot derive from, text with too little contrast on its background, and part
157
- * CSS that is left out or reaches past the component's contract. `createTheme` warns about
158
- * each. */
159
- declare function checkTheme(input?: ThemeInput, options?: CreateThemeOptions): string[];
160
- /** Build a theme. Without overrides, `dark` and `light` give exactly the built-in tokens. */
161
- declare function createTheme(input?: ThemeInput, options?: CreateThemeOptions): UiTheme;
162
- /** The theme's rules: every token and component setting, by default on the hosts that carry
163
- * its id; and the part CSS, on those parts inside them, in the last layer. */
164
- declare function themeCss(theme: UiTheme, selector?: string): string;
165
- /** Theme a host and everything inside it. A chart theme's seven fields build the theme on
166
- * the way, keeping the choices of the UI theme it carries. */
167
- declare function applyTheme(host: HTMLElement, theme: UiTheme | ThemedChart): UiTheme;
168
- /** Theme a host from a chart theme's seven fields.
169
- * @deprecated Use {@link applyTheme}, which also takes a theme from {@link createTheme}. */
170
- declare function applyThemeTokens(el: HTMLElement, t: ThemedChart): void;
171
- /** Re-token a chart-overlay host (statusline, watermark, toast — chrome floating OVER
172
- * the plot) from the LIVE plot surface: a config edit can recolor the plot background
173
- * independently of the app theme (a white plot typed into settings on the dark theme),
174
- * and the overlay ink must stay readable either way. `config` is the renderer's
175
- * `getConfig()` snapshot; a missing/shapeless one falls back to the base app theme.
176
- * Floating menus and dropdowns do NOT use this — they mount on {@link floatingLayerHost}
177
- * so their surface follows the app theme alone. */
178
- declare function applyPlotOverlayTokens(host: HTMLElement, base: ThemedChart, config: unknown): void;
179
- /** Mount floating kit layers (menus, select lists) on the nearest `.vela-ui` so they
180
- * inherit the app-theme tokens. A plot-overlay host (the cell) retokens from
181
- * `layout.background`; chrome panels must not follow that. Falls back to `fallback`
182
- * (typically `document.body`) when no kit host is an ancestor. */
183
- declare function floatingLayerHost(from: HTMLElement, fallback?: HTMLElement): HTMLElement;
184
- /** Mark an element as a kit host (the `.vela-ui` class and the shared sheet), themed when
185
- * a theme is given. */
186
- declare function ensureUIHost(el: HTMLElement, theme?: UiTheme | ThemedChart): void;
187
-
188
- export { type ComponentDefs, type ComponentSettings, type CreateThemeOptions, DARK_CHART, LIGHT_CHART, TOKEN_NAMES, type ThemeInput, type ThemeSettings, type ThemedChart, type TokenName, type UiTheme, applyPlotOverlayTokens, applyTheme, applyThemeTokens, checkTheme, createTheme, ensureUIHost, floatingLayerHost, themeCss };
package/dist/theme.js CHANGED
@@ -1,8 +1,8 @@
1
- export { DARK_CHART, LIGHT_CHART, TOKEN_NAMES, applyPlotOverlayTokens, applyTheme, applyThemeTokens, checkTheme, createTheme, ensureUIHost, floatingLayerHost, themeCss } from './chunk-AJ2IYSOI.js';
1
+ export { DARK_CHART, LIGHT_CHART, TOKEN_NAMES, applyPlotOverlayTokens, applyTheme, applyThemeTokens, checkTheme, createTheme, ensureUIHost, floatingLayerHost, themeCss } from './chunk-TBXUF5YX.js';
2
2
  import './chunk-TAKSIV57.js';
3
3
  import './chunk-MMTMOV6R.js';
4
4
  import './chunk-VMCR3S2A.js';
5
- import './chunk-IDA2BT7D.js';
5
+ import './chunk-XBEL4K33.js';
6
6
  import './chunk-2GQIZM5Z.js';
7
7
  import './chunk-BXMWQIBO.js';
8
8
  import './chunk-X66RJAIS.js';