@luxalgo/vela-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.
- package/CHANGELOG.md +43 -0
- package/LICENSE +201 -0
- package/NOTICE +28 -0
- package/README.md +83 -3
- package/cli/engine.mjs +282 -0
- package/cli/index.mjs +154 -0
- package/dist/badge.d.ts +26 -0
- package/dist/badge.js +44 -0
- package/dist/bar-chart.d.ts +40 -0
- package/dist/bar-chart.js +105 -0
- package/dist/button.d.ts +41 -0
- package/dist/button.js +10 -0
- package/dist/calendar.d.ts +22 -0
- package/dist/calendar.js +1 -0
- package/dist/callout-bubble.d.ts +98 -0
- package/dist/callout-bubble.js +173 -0
- package/dist/chart.d.ts +30 -0
- package/dist/chart.js +1 -0
- package/dist/checkbox.d.ts +60 -0
- package/dist/checkbox.js +12 -0
- package/dist/chunk-2GQIZM5Z.js +28 -0
- package/dist/chunk-2Q4JRINP.js +403 -0
- package/dist/chunk-3Q32K4PE.js +85 -0
- package/dist/chunk-5QHXOAZA.js +351 -0
- package/dist/chunk-6NXY62JS.js +25 -0
- package/dist/chunk-6QCILIT2.js +52 -0
- package/dist/chunk-A2FJ7Y7D.js +55 -0
- package/dist/chunk-A72NWYNP.js +26 -0
- package/dist/chunk-AJ2IYSOI.js +553 -0
- package/dist/chunk-BXMWQIBO.js +66 -0
- package/dist/chunk-CH3DV6FD.js +280 -0
- package/dist/chunk-EZQXTO6K.js +89 -0
- package/dist/chunk-FCO3YZLT.js +81 -0
- package/dist/chunk-FN2BUFNM.js +10 -0
- package/dist/chunk-FVH6L7FM.js +18 -0
- package/dist/chunk-G7IQLY3A.js +183 -0
- package/dist/chunk-IDA2BT7D.js +29 -0
- package/dist/chunk-J2QJATCD.js +12 -0
- package/dist/chunk-LZWZV2ZS.js +18 -0
- package/dist/chunk-MMTMOV6R.js +31 -0
- package/dist/chunk-OBLIX3VN.js +227 -0
- package/dist/chunk-P4MTEMT7.js +23 -0
- package/dist/chunk-Q6WTDVH6.js +31 -0
- package/dist/chunk-S7USVSYP.js +50 -0
- package/dist/chunk-SAPURP46.js +133 -0
- package/dist/chunk-TAKSIV57.js +90 -0
- package/dist/chunk-V6TTTMTE.js +79 -0
- package/dist/chunk-VMCR3S2A.js +22 -0
- package/dist/chunk-X4YPSIW6.js +72 -0
- package/dist/chunk-X66RJAIS.js +14 -0
- package/dist/chunk-XJAPCCOJ.js +101 -0
- package/dist/chunk-ZB3BZHSN.js +219 -0
- package/dist/color-picker.d.ts +103 -0
- package/dist/color-picker.js +19 -0
- package/dist/color.d.ts +24 -0
- package/dist/color.js +1 -0
- package/dist/context-menu.d.ts +72 -0
- package/dist/context-menu.js +161 -0
- package/dist/css.d.ts +15 -0
- package/dist/css.js +4 -0
- package/dist/data-table-DtU3FX9j.d.ts +61 -0
- package/dist/data-table.d.ts +3 -0
- package/dist/data-table.js +88 -0
- package/dist/date-picker.d.ts +90 -0
- package/dist/date-picker.js +257 -0
- package/dist/define-D5u3F5Dj.d.ts +21 -0
- package/dist/dialog.d.ts +89 -0
- package/dist/dialog.js +258 -0
- package/dist/dispose.d.ts +9 -0
- package/dist/dispose.js +2 -0
- package/dist/donut.d.ts +27 -0
- package/dist/donut.js +67 -0
- package/dist/drawer.d.ts +119 -0
- package/dist/drawer.js +326 -0
- package/dist/dropdown-menu.d.ts +114 -0
- package/dist/dropdown-menu.js +18 -0
- package/dist/empty.d.ts +21 -0
- package/dist/empty.js +38 -0
- package/dist/field.d.ts +147 -0
- package/dist/field.js +328 -0
- package/dist/glyph-select.d.ts +57 -0
- package/dist/glyph-select.js +17 -0
- package/dist/headless.d.ts +6 -0
- package/dist/headless.js +9 -0
- package/dist/hover-card.d.ts +43 -0
- package/dist/hover-card.js +97 -0
- package/dist/i18n.d.ts +20 -0
- package/dist/i18n.js +1 -0
- package/dist/icons.d.ts +20 -0
- package/dist/icons.js +2 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +13 -0
- package/dist/input-group.d.ts +57 -0
- package/dist/input-group.js +86 -0
- package/dist/input.d.ts +54 -0
- package/dist/input.js +9 -0
- package/dist/kbd.d.ts +19 -0
- package/dist/kbd.js +8 -0
- package/dist/kit-text.d.ts +8 -0
- package/dist/kit-text.js +2 -0
- package/dist/line-chart.d.ts +32 -0
- package/dist/line-chart.js +120 -0
- package/dist/manifest.json +3854 -0
- package/dist/number-input.d.ts +99 -0
- package/dist/number-input.js +14 -0
- package/dist/page.d.ts +7 -0
- package/dist/page.js +1 -0
- package/dist/palette.d.ts +55 -0
- package/dist/palette.js +1 -0
- package/dist/placement.d.ts +98 -0
- package/dist/placement.js +1 -0
- package/dist/popover.d.ts +107 -0
- package/dist/popover.js +15 -0
- package/dist/scatter-chart.d.ts +32 -0
- package/dist/scatter-chart.js +121 -0
- package/dist/select.d.ts +112 -0
- package/dist/select.js +19 -0
- package/dist/sparkline.d.ts +22 -0
- package/dist/sparkline.js +72 -0
- package/dist/stat.d.ts +29 -0
- package/dist/stat.js +41 -0
- package/dist/styles.d.ts +22 -0
- package/dist/styles.js +2 -0
- package/dist/surface-events.d.ts +17 -0
- package/dist/surface-events.js +1 -0
- package/dist/surface-exit.d.ts +25 -0
- package/dist/surface-exit.js +1 -0
- package/dist/switch.d.ts +54 -0
- package/dist/switch.js +92 -0
- package/dist/t.d.ts +89 -0
- package/dist/t.js +1 -0
- package/dist/tabs.d.ts +63 -0
- package/dist/tabs.js +150 -0
- package/dist/text-area.d.ts +54 -0
- package/dist/text-area.js +9 -0
- package/dist/theme.d.ts +188 -0
- package/dist/theme.js +8 -0
- package/dist/theme.schema.json +1745 -0
- package/dist/themes/dark.css +3 -0
- package/dist/themes/light.css +3 -0
- package/dist/toggle-group.d.ts +56 -0
- package/dist/toggle-group.js +130 -0
- package/dist/tokens.d.ts +16 -0
- package/dist/tokens.js +3 -0
- package/dist/tooltip.d.ts +47 -0
- package/dist/tooltip.js +74 -0
- package/dist/variants-B4stUBnY.d.ts +16 -0
- package/dist/zag.d.ts +19 -0
- package/dist/zag.js +2 -0
- package/docs/theming.md +211 -0
- package/docs/what-to-change.md +20 -0
- package/docs/writing-a-component.md +247 -0
- package/llms.txt +66 -0
- package/package.json +90 -6
- package/registry/badge.ts +119 -0
- package/registry/bar-chart.ts +215 -0
- package/registry/button.ts +303 -0
- package/registry/callout-bubble.ts +336 -0
- package/registry/checkbox.ts +234 -0
- package/registry/color-picker.ts +582 -0
- package/registry/context-menu.ts +208 -0
- package/registry/data-table.ts +215 -0
- package/registry/date-picker.ts +483 -0
- package/registry/dialog.ts +535 -0
- package/registry/donut.ts +145 -0
- package/registry/drawer.ts +636 -0
- package/registry/dropdown-menu.ts +762 -0
- package/registry/empty.ts +91 -0
- package/registry/field.ts +585 -0
- package/registry/glyph-select.ts +268 -0
- package/registry/hover-card.ts +222 -0
- package/registry/input-group.ts +229 -0
- package/registry/input.ts +181 -0
- package/registry/kbd.ts +64 -0
- package/registry/line-chart.ts +218 -0
- package/registry/number-input.ts +443 -0
- package/registry/popover.ts +368 -0
- package/registry/scatter-chart.ts +221 -0
- package/registry/select.ts +620 -0
- package/registry/sparkline.ts +114 -0
- package/registry/stat.ts +96 -0
- package/registry/switch.ts +205 -0
- package/registry/tabs.ts +392 -0
- package/registry/text-area.ts +186 -0
- package/registry/toggle-group.ts +295 -0
- package/registry/tooltip.ts +156 -0
- package/skills/theming-vela-ui/SKILL.md +137 -0
- package/skills/using-vela-ui-components/SKILL.md +134 -0
- package/skills/writing-vela-ui-components/SKILL.md +163 -0
- package/src/components/badge.ts +119 -0
- package/src/components/bar-chart.ts +215 -0
- package/src/components/button.ts +303 -0
- package/src/components/callout-bubble.ts +336 -0
- package/src/components/checkbox.ts +234 -0
- package/src/components/color-picker.ts +582 -0
- package/src/components/context-menu.ts +208 -0
- package/src/components/data-table.ts +215 -0
- package/src/components/date-picker.ts +483 -0
- package/src/components/dialog.ts +535 -0
- package/src/components/donut.ts +145 -0
- package/src/components/drawer.ts +636 -0
- package/src/components/dropdown-menu.ts +762 -0
- package/src/components/empty.ts +91 -0
- package/src/components/field.ts +585 -0
- package/src/components/glyph-select.ts +268 -0
- package/src/components/hover-card.ts +222 -0
- package/src/components/input-group.ts +229 -0
- package/src/components/input.ts +181 -0
- package/src/components/kbd.ts +64 -0
- package/src/components/line-chart.ts +218 -0
- package/src/components/number-input.ts +443 -0
- package/src/components/popover.ts +368 -0
- package/src/components/scatter-chart.ts +221 -0
- package/src/components/select.ts +620 -0
- package/src/components/sparkline.ts +114 -0
- package/src/components/stat.ts +96 -0
- package/src/components/switch.ts +205 -0
- package/src/components/tabs.ts +392 -0
- package/src/components/text-area.ts +186 -0
- package/src/components/toggle-group.ts +295 -0
- package/src/components/tooltip.ts +156 -0
- package/src/index.ts +24 -0
- package/src/lib/calendar.ts +112 -0
- package/src/lib/chart.ts +72 -0
- package/src/lib/color.ts +89 -0
- package/src/lib/component-index.ts +131 -0
- package/src/lib/css.ts +44 -0
- package/src/lib/define.ts +45 -0
- package/src/lib/dispose.ts +36 -0
- package/src/lib/h.ts +55 -0
- package/src/lib/headless.ts +16 -0
- package/src/lib/i18n.ts +30 -0
- package/src/lib/icons.ts +237 -0
- package/src/lib/kit-text.ts +26 -0
- package/src/lib/page.ts +24 -0
- package/src/lib/palette.ts +81 -0
- package/src/lib/placement.ts +188 -0
- package/src/lib/styles.ts +53 -0
- package/src/lib/surface-events.ts +31 -0
- package/src/lib/surface-exit.ts +87 -0
- package/src/lib/t.ts +68 -0
- package/src/lib/theme.ts +654 -0
- package/src/lib/tokens.ts +111 -0
- package/src/lib/variants.ts +32 -0
- package/src/lib/zag.ts +46 -0
- package/stylelint/index.mjs +60 -0
- package/stylelint/lint.mjs +81 -0
- package/stylelint/plugin.mjs +115 -0
package/dist/select.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { V as VariantFn } from './variants-B4stUBnY.js';
|
|
2
|
+
import { C as ComponentDef } from './define-D5u3F5Dj.js';
|
|
3
|
+
import { PlacementProps } from './placement.js';
|
|
4
|
+
import { ChartTheme } from './tokens.js';
|
|
5
|
+
import { PopoverBoundary, PopoverOptions, Popover } from './popover.js';
|
|
6
|
+
import './t.js';
|
|
7
|
+
|
|
8
|
+
type SelectSize = 'sm' | 'md';
|
|
9
|
+
interface SelectOption {
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
interface SelectControllerOptions {
|
|
14
|
+
options: readonly SelectOption[];
|
|
15
|
+
value?: string;
|
|
16
|
+
/** The value it starts with when `value` is not given. */
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
/** Shown while no option is picked: the value stays `''` until the user picks one. Without
|
|
19
|
+
* it, the first option is picked to start with. */
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
size?: SelectSize;
|
|
22
|
+
/** Stretch the trigger to its parent. Off: the shared 100px kit column (ellipsis). */
|
|
23
|
+
fill?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** Called when the user picks an option. */
|
|
26
|
+
onValueChange?: (value: string, label: string) => void;
|
|
27
|
+
/** @deprecated Use `onValueChange`. */
|
|
28
|
+
onChange?: (value: string, label: string) => void;
|
|
29
|
+
}
|
|
30
|
+
interface SelectController {
|
|
31
|
+
options: readonly SelectOption[];
|
|
32
|
+
value: string;
|
|
33
|
+
size: SelectSize;
|
|
34
|
+
fill: boolean;
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
setValue(v: string): void;
|
|
37
|
+
labelOf(value: string): string;
|
|
38
|
+
pick(value: string): {
|
|
39
|
+
value: string;
|
|
40
|
+
label: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** The select's options and current value, without DOM. */
|
|
44
|
+
declare function selectController(opts: SelectControllerOptions): SelectController;
|
|
45
|
+
declare const selectDef: ComponentDef<"select", "root" | "viewport" | "icon" | "trigger" | "content" | "value" | "thumb" | "item" | "sizer" | "native" | "rail", "radius" | "content-radius" | "focus-ring" | "thumb-radius">;
|
|
46
|
+
declare const selectVariants: VariantFn<{
|
|
47
|
+
readonly size: readonly ["md", "sm"];
|
|
48
|
+
}>;
|
|
49
|
+
/** Where the list opens and how (shadcn's placement props, defaults below and start-aligned,
|
|
50
|
+
* 4px away, as wide as the trigger at least). */
|
|
51
|
+
interface SelectListPopoverOpts extends PlacementProps {
|
|
52
|
+
theme?: ChartTheme;
|
|
53
|
+
matchWidth?: boolean;
|
|
54
|
+
/** @deprecated Use `collisionBoundary`. */
|
|
55
|
+
boundary?: PopoverBoundary;
|
|
56
|
+
boundaryInset?: number;
|
|
57
|
+
/** @deprecated Use `sideOffset`. */
|
|
58
|
+
gap?: number;
|
|
59
|
+
host?: HTMLElement;
|
|
60
|
+
position?: PopoverOptions['position'];
|
|
61
|
+
zIndex?: string | number;
|
|
62
|
+
size?: SelectSize;
|
|
63
|
+
/** Move the focus into the open list, for the arrow keys and typeahead (and back to the
|
|
64
|
+
* trigger when it closes). Off by default: a trigger the user types in keeps the focus. */
|
|
65
|
+
focusList?: boolean;
|
|
66
|
+
onClose?: () => void;
|
|
67
|
+
}
|
|
68
|
+
interface SelectOptions extends SelectControllerOptions, PlacementProps {
|
|
69
|
+
id?: string;
|
|
70
|
+
/** Submitted with its form under this name: a hidden native select carries the value. */
|
|
71
|
+
name?: string;
|
|
72
|
+
/** A form does not submit while no option is picked (with `placeholder`). */
|
|
73
|
+
required?: boolean;
|
|
74
|
+
theme?: ChartTheme;
|
|
75
|
+
/** The open list's other options (its host, layer, width). Its placement props are the
|
|
76
|
+
* select's own; set here, they give way to those. */
|
|
77
|
+
list?: SelectListPopoverOpts;
|
|
78
|
+
}
|
|
79
|
+
type SelectProps = SelectOptions;
|
|
80
|
+
declare const SELECT_STYLE_ID = "vela-ui-select-3";
|
|
81
|
+
declare const SELECT_CSS: string;
|
|
82
|
+
/** Fill `menu` with the options, a listbox (Zag's listbox machine: the arrow keys, Home/End,
|
|
83
|
+
* Enter and typeahead while it has the focus). A click picks at once; one pick per fill.
|
|
84
|
+
* Call {@link decorateSelectScroll} after the menu is on screen; call the returned function
|
|
85
|
+
* when the menu goes away. */
|
|
86
|
+
declare function fillSelectList(menu: HTMLElement, options: readonly SelectOption[], current: string, onPick: (value: string, label: string) => void): () => void;
|
|
87
|
+
/** Overlay scrollbar + scroll-into-view — needs a laid-out list (after the popover is shown). */
|
|
88
|
+
declare function decorateSelectScroll(menu: HTMLElement): void;
|
|
89
|
+
/** Open (or re-click close) a themed option list under `trigger`. */
|
|
90
|
+
declare function toggleSelectList(trigger: HTMLElement, options: readonly SelectOption[], current: string, onPick: (value: string, label: string) => void, opts?: SelectListPopoverOpts): Popover | null;
|
|
91
|
+
declare function openSelectList(trigger: HTMLElement, options: readonly SelectOption[], current: string, onPick: (value: string, label: string) => void, opts?: SelectListPopoverOpts): Popover;
|
|
92
|
+
declare class Select {
|
|
93
|
+
readonly el: HTMLElement;
|
|
94
|
+
private readonly trigger;
|
|
95
|
+
private readonly labelEl;
|
|
96
|
+
private readonly ctrl;
|
|
97
|
+
private readonly listOpts;
|
|
98
|
+
private readonly placeholder;
|
|
99
|
+
private readonly native;
|
|
100
|
+
private readonly release;
|
|
101
|
+
private list;
|
|
102
|
+
constructor(opts: SelectOptions);
|
|
103
|
+
get value(): string;
|
|
104
|
+
setValue(v: string): void;
|
|
105
|
+
/** The trigger shows the picked option's label, or the placeholder while none is picked. */
|
|
106
|
+
private paint;
|
|
107
|
+
toggle(): void;
|
|
108
|
+
destroy(): void;
|
|
109
|
+
}
|
|
110
|
+
declare function createSelect(props: SelectProps): Select;
|
|
111
|
+
|
|
112
|
+
export { SELECT_CSS, SELECT_STYLE_ID, Select, type SelectController, type SelectControllerOptions, type SelectListPopoverOpts, type SelectOption, type SelectOptions, type SelectProps, type SelectSize, createSelect, decorateSelectScroll, fillSelectList, openSelectList, selectController, selectDef, selectVariants, toggleSelectList };
|
package/dist/select.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { SELECT_CSS, SELECT_STYLE_ID, Select, createSelect, decorateSelectScroll, fillSelectList, openSelectList, selectController, selectDef, selectVariants, toggleSelectList } from './chunk-CH3DV6FD.js';
|
|
2
|
+
import './chunk-LZWZV2ZS.js';
|
|
3
|
+
import './chunk-OBLIX3VN.js';
|
|
4
|
+
import './chunk-G7IQLY3A.js';
|
|
5
|
+
import './chunk-J2QJATCD.js';
|
|
6
|
+
import './chunk-S7USVSYP.js';
|
|
7
|
+
import './chunk-AJ2IYSOI.js';
|
|
8
|
+
import './chunk-TAKSIV57.js';
|
|
9
|
+
import './chunk-MMTMOV6R.js';
|
|
10
|
+
import './chunk-3Q32K4PE.js';
|
|
11
|
+
import './chunk-P4MTEMT7.js';
|
|
12
|
+
import './chunk-A72NWYNP.js';
|
|
13
|
+
import './chunk-Q6WTDVH6.js';
|
|
14
|
+
import './chunk-6QCILIT2.js';
|
|
15
|
+
import './chunk-VMCR3S2A.js';
|
|
16
|
+
import './chunk-IDA2BT7D.js';
|
|
17
|
+
import './chunk-2GQIZM5Z.js';
|
|
18
|
+
import './chunk-BXMWQIBO.js';
|
|
19
|
+
import './chunk-X66RJAIS.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { C as ComponentDef } from './define-D5u3F5Dj.js';
|
|
2
|
+
import './t.js';
|
|
3
|
+
|
|
4
|
+
declare const sparklineDef: ComponentDef<"sparkline", "area" | "line" | "root" | "baseline", "stroke-width">;
|
|
5
|
+
interface SparklineProps {
|
|
6
|
+
values: readonly number[];
|
|
7
|
+
/** px (default 56 × 20). */
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
/** A soft area under the line. */
|
|
11
|
+
area?: boolean;
|
|
12
|
+
/** A dotted line at this value; the tone compares the last value with it. */
|
|
13
|
+
baseline?: number | null;
|
|
14
|
+
}
|
|
15
|
+
interface SparklineHandle {
|
|
16
|
+
readonly el: SVGSVGElement;
|
|
17
|
+
setValues(values: readonly number[], baseline?: number | null): void;
|
|
18
|
+
destroy(): void;
|
|
19
|
+
}
|
|
20
|
+
declare function createSparkline(props: SparklineProps): SparklineHandle;
|
|
21
|
+
|
|
22
|
+
export { type SparklineHandle, type SparklineProps, createSparkline, sparklineDef };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { t } from './chunk-6QCILIT2.js';
|
|
2
|
+
import { defineComponent } from './chunk-VMCR3S2A.js';
|
|
3
|
+
import { defineStyles, css } from './chunk-IDA2BT7D.js';
|
|
4
|
+
import './chunk-2GQIZM5Z.js';
|
|
5
|
+
import './chunk-BXMWQIBO.js';
|
|
6
|
+
import './chunk-X66RJAIS.js';
|
|
7
|
+
|
|
8
|
+
// src/components/sparkline.ts
|
|
9
|
+
var sparklineDef = defineComponent({
|
|
10
|
+
name: "sparkline",
|
|
11
|
+
parts: ["root", "area", "baseline", "line"],
|
|
12
|
+
settings: { "stroke-width": "1.25" }
|
|
13
|
+
});
|
|
14
|
+
var NS = "http://www.w3.org/2000/svg";
|
|
15
|
+
var injectStyles = defineStyles(
|
|
16
|
+
"vela-ui-sparkline",
|
|
17
|
+
css`@layer vela.ui{[data-slot=sparkline]{--_ink:${t.profit};overflow:visible}[data-slot=sparkline][data-tone=loss]{--_ink:${t.loss}}[data-slot=sparkline-line]{fill:none;stroke:var(--_ink);stroke-width:${sparklineDef.vars["stroke-width"]};stroke-linejoin:round}[data-slot=sparkline-area]{fill:color-mix(in srgb, var(--_ink) 14%, transparent)}[data-slot=sparkline-baseline]{stroke:${t.fg.faint};stroke-dasharray:1.5 2}}`
|
|
18
|
+
);
|
|
19
|
+
function part(name) {
|
|
20
|
+
const el = document.createElementNS(NS, name === "baseline" ? "line" : "path");
|
|
21
|
+
el.setAttribute("data-slot", sparklineDef.slot(name));
|
|
22
|
+
return el;
|
|
23
|
+
}
|
|
24
|
+
function createSparkline(props) {
|
|
25
|
+
injectStyles(document);
|
|
26
|
+
const w = props.width ?? 56;
|
|
27
|
+
const ht = props.height ?? 20;
|
|
28
|
+
const el = document.createElementNS(NS, "svg");
|
|
29
|
+
el.setAttribute("viewBox", `0 0 ${w} ${ht}`);
|
|
30
|
+
el.setAttribute("width", String(w));
|
|
31
|
+
el.setAttribute("height", String(ht));
|
|
32
|
+
el.setAttribute("data-slot", sparklineDef.slot("root"));
|
|
33
|
+
el.setAttribute("aria-hidden", "true");
|
|
34
|
+
const draw = (values, baseline) => {
|
|
35
|
+
el.replaceChildren();
|
|
36
|
+
const pts = values.filter((v) => Number.isFinite(v));
|
|
37
|
+
if (pts.length < 2) return;
|
|
38
|
+
const ref = baseline ?? pts[0];
|
|
39
|
+
let lo = Math.min(...pts, baseline ?? Infinity);
|
|
40
|
+
let hi = Math.max(...pts, baseline ?? -Infinity);
|
|
41
|
+
if (hi === lo) {
|
|
42
|
+
hi += 1;
|
|
43
|
+
lo -= 1;
|
|
44
|
+
}
|
|
45
|
+
const y = (v) => 1.5 + (ht - 3) * (1 - (v - lo) / (hi - lo));
|
|
46
|
+
const x = (i) => i / (pts.length - 1) * w;
|
|
47
|
+
const d = pts.map((v, i) => `${i ? "L" : "M"}${x(i).toFixed(1)} ${y(v).toFixed(1)}`).join("");
|
|
48
|
+
el.setAttribute("data-tone", pts[pts.length - 1] >= ref ? "profit" : "loss");
|
|
49
|
+
if (props.area) {
|
|
50
|
+
const area = part("area");
|
|
51
|
+
area.setAttribute("d", `${d}L${w} ${ht}L0 ${ht}Z`);
|
|
52
|
+
el.appendChild(area);
|
|
53
|
+
}
|
|
54
|
+
if (baseline != null) {
|
|
55
|
+
const base = part("baseline");
|
|
56
|
+
const by = y(baseline).toFixed(1);
|
|
57
|
+
for (const [k, v] of [["x1", "0"], ["x2", String(w)], ["y1", by], ["y2", by]]) base.setAttribute(k, v);
|
|
58
|
+
el.appendChild(base);
|
|
59
|
+
}
|
|
60
|
+
const line = part("line");
|
|
61
|
+
line.setAttribute("d", d);
|
|
62
|
+
el.appendChild(line);
|
|
63
|
+
};
|
|
64
|
+
draw(props.values, props.baseline ?? null);
|
|
65
|
+
return {
|
|
66
|
+
el,
|
|
67
|
+
setValues: (values, baseline = props.baseline ?? null) => draw(values, baseline),
|
|
68
|
+
destroy: () => el.remove()
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { createSparkline, sparklineDef };
|
package/dist/stat.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { V as VariantFn, a as VariantProps } from './variants-B4stUBnY.js';
|
|
2
|
+
import { C as ComponentDef } from './define-D5u3F5Dj.js';
|
|
3
|
+
import './t.js';
|
|
4
|
+
|
|
5
|
+
declare const statDef: ComponentDef<"stat", "label" | "sub" | "root" | "value", never>;
|
|
6
|
+
declare const statVariants: VariantFn<{
|
|
7
|
+
readonly tone: readonly ["neutral", "profit", "loss"];
|
|
8
|
+
}>;
|
|
9
|
+
type StatTone = (typeof statVariants.spec.tone)[number];
|
|
10
|
+
interface StatProps extends VariantProps<typeof statVariants> {
|
|
11
|
+
label: string;
|
|
12
|
+
/** The figure (default `—`). */
|
|
13
|
+
value?: string;
|
|
14
|
+
/** A line under the figure (a count, a percentage). */
|
|
15
|
+
sub?: string;
|
|
16
|
+
/** Extra class names (layout hooks). */
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
interface StatHandle {
|
|
20
|
+
readonly el: HTMLElement;
|
|
21
|
+
/** A new figure, its tone and its line (`null` hides the line). */
|
|
22
|
+
set(value: string, tone?: StatTone, sub?: string | null): void;
|
|
23
|
+
destroy(): void;
|
|
24
|
+
}
|
|
25
|
+
/** The tone of a signed figure: a gain, a loss, or neither. */
|
|
26
|
+
declare function toneOf(n: number): StatTone;
|
|
27
|
+
declare function createStat(props: StatProps): StatHandle;
|
|
28
|
+
|
|
29
|
+
export { type StatHandle, type StatProps, type StatTone, createStat, statDef, statVariants, toneOf };
|
package/dist/stat.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { variants } from './chunk-LZWZV2ZS.js';
|
|
2
|
+
import { h } from './chunk-Q6WTDVH6.js';
|
|
3
|
+
import { t } from './chunk-6QCILIT2.js';
|
|
4
|
+
import { defineComponent } from './chunk-VMCR3S2A.js';
|
|
5
|
+
import { defineStyles, css } from './chunk-IDA2BT7D.js';
|
|
6
|
+
import './chunk-2GQIZM5Z.js';
|
|
7
|
+
import './chunk-BXMWQIBO.js';
|
|
8
|
+
import './chunk-X66RJAIS.js';
|
|
9
|
+
|
|
10
|
+
// src/components/stat.ts
|
|
11
|
+
var statDef = defineComponent({
|
|
12
|
+
name: "stat",
|
|
13
|
+
parts: ["root", "label", "value", "sub"]
|
|
14
|
+
});
|
|
15
|
+
var statVariants = variants({ tone: ["neutral", "profit", "loss"] });
|
|
16
|
+
function toneOf(n) {
|
|
17
|
+
return n > 0 ? "profit" : n < 0 ? "loss" : "neutral";
|
|
18
|
+
}
|
|
19
|
+
var injectStyles = defineStyles(
|
|
20
|
+
"vela-ui-stat",
|
|
21
|
+
css`@layer vela.ui{[data-slot=stat]:where(:not([hidden])){flex-direction:column;gap:3px;min-width:0;display:flex}[data-slot=stat-label]{color:${t.fg.muted};white-space:nowrap;text-overflow:ellipsis;font-size:11px;overflow:hidden}[data-slot=stat-value]{color:${t.fg.bright};font-variant-numeric:tabular-nums;white-space:nowrap;font-size:14px;font-weight:600}[data-slot=stat-value]:is([data-tone=profit]>*){color:${t.profit}}[data-slot=stat-value]:is([data-tone=loss]>*){color:${t.loss}}[data-slot=stat-sub]{color:${t.fg.muted};font-variant-numeric:tabular-nums;font-size:11px}}`
|
|
22
|
+
);
|
|
23
|
+
function createStat(props) {
|
|
24
|
+
injectStyles(document);
|
|
25
|
+
const value = h("span", { slot: statDef.slot("value"), text: props.value ?? "\u2014" });
|
|
26
|
+
const sub = h("span", { slot: statDef.slot("sub"), text: props.sub ?? "" });
|
|
27
|
+
sub.hidden = !props.sub;
|
|
28
|
+
const el = h("div", { className: props.className, slot: statDef.slot("root"), attrs: statVariants(props) }, h("span", { slot: statDef.slot("label"), text: props.label }), value, sub);
|
|
29
|
+
return {
|
|
30
|
+
el,
|
|
31
|
+
set(next, tone = "neutral", line = null) {
|
|
32
|
+
value.textContent = next;
|
|
33
|
+
el.setAttribute("data-tone", tone);
|
|
34
|
+
sub.textContent = line ?? "";
|
|
35
|
+
sub.hidden = !line;
|
|
36
|
+
},
|
|
37
|
+
destroy: () => el.remove()
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { createStat, statDef, statVariants, toneOf };
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { withAlpha } from './color.js';
|
|
2
|
+
|
|
3
|
+
/** The kit's scrollbar on `selector`, for a scroller outside a kit host (inside one, every
|
|
4
|
+
* scroller already has it). `width` overrides the `--vela-scroll-size` token, in px. */
|
|
5
|
+
declare function overlayScrollbarCss(selector: string, width?: number): string;
|
|
6
|
+
/** Focus ring shared by typeable fields (combo inputs, textareas). */
|
|
7
|
+
declare const FIELD_FOCUS_CSS = "outline:none;transition:border-color .12s ease,box-shadow .12s ease;";
|
|
8
|
+
declare const FIELD_FOCUS_RING = "border-color:var(--vela-focus);box-shadow:0 0 0 3px var(--vela-focus-soft);";
|
|
9
|
+
/** The kit's cascade layers, lowest first. Declared before any layered sheet, so a host's
|
|
10
|
+
* own unlayered CSS beats every one of them without `!important`. */
|
|
11
|
+
declare const LAYER_ORDER = "@layer vela.theme, vela.ui, vela.chrome, vela.pro, vela.custom;";
|
|
12
|
+
/**
|
|
13
|
+
* Declare the layer order in a root, ahead of every Vela sheet already there: a layer's rank
|
|
14
|
+
* is its first appearance. It goes before the first `vela…` sheet rather than first in the
|
|
15
|
+
* head, so layers a host declared earlier (a framework's base styles) stay below Vela's.
|
|
16
|
+
*/
|
|
17
|
+
declare function injectLayerOrder(root?: Document | ShadowRoot): void;
|
|
18
|
+
/** Inject a stylesheet once per root (document or shadow root). Idempotent by id; returns
|
|
19
|
+
* the sheet's element. */
|
|
20
|
+
declare function injectStyles(id: string, css: string, root?: Document | ShadowRoot): HTMLStyleElement | null;
|
|
21
|
+
|
|
22
|
+
export { FIELD_FOCUS_CSS, FIELD_FOCUS_RING, LAYER_ORDER, injectLayerOrder, injectStyles, overlayScrollbarCss };
|
package/dist/styles.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Dispatched on a surface's element once it is shown. */
|
|
2
|
+
declare const SURFACE_OPEN_EVENT = "vela:surface-open";
|
|
3
|
+
/** Dispatched on a surface's element as it starts to close, before it hides or leaves the DOM. */
|
|
4
|
+
declare const SURFACE_CLOSE_EVENT = "vela:surface-close";
|
|
5
|
+
/** What opened or closed: a menu (submenus included), a popover (select lists, color
|
|
6
|
+
* pickers, mark cards, the layout picker), a dialog, a drawer, or a side panel. */
|
|
7
|
+
type SurfaceKind = 'menu' | 'popover' | 'dialog' | 'drawer' | 'panel';
|
|
8
|
+
/** The `detail` of a {@link SURFACE_OPEN_EVENT} / {@link SURFACE_CLOSE_EVENT} event. */
|
|
9
|
+
interface SurfaceEventDetail {
|
|
10
|
+
kind: SurfaceKind;
|
|
11
|
+
/** The element that opened it, when there is one (a menu's button, a popover's trigger). */
|
|
12
|
+
trigger: HTMLElement | null;
|
|
13
|
+
}
|
|
14
|
+
/** Announce that `el` opened or is closing. Bubbles and crosses shadow roots. */
|
|
15
|
+
declare function announceSurface(el: HTMLElement, open: boolean, kind: SurfaceKind, trigger?: HTMLElement | null): void;
|
|
16
|
+
|
|
17
|
+
export { SURFACE_CLOSE_EVENT, SURFACE_OPEN_EVENT, type SurfaceEventDetail, type SurfaceKind, announceSurface };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SURFACE_CLOSE_EVENT, SURFACE_OPEN_EVENT, announceSurface } from './chunk-J2QJATCD.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The longest a close waits for its exit animation before it completes anyway. */
|
|
2
|
+
declare const SURFACE_EXIT_CAP_MS = 1000;
|
|
3
|
+
/** A close held for its exit animation. */
|
|
4
|
+
interface SurfaceExit {
|
|
5
|
+
/** The surface reopened: unmark it and make it interactive again, without completing the close. */
|
|
6
|
+
cancel(): void;
|
|
7
|
+
/** Complete the close now (a teardown cannot wait for the animation). */
|
|
8
|
+
finish(): void;
|
|
9
|
+
}
|
|
10
|
+
interface SurfaceExitOptions {
|
|
11
|
+
/** Elements to keep inert during the exit without marking them — a full-viewport
|
|
12
|
+
* positioner around the surface must not swallow clicks meant for the page. */
|
|
13
|
+
inert?: readonly HTMLElement[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Close `els` (one surface, or a surface and its scrim) through their exit animation, then
|
|
17
|
+
* run `done` — the caller's hide or removal. The elements get `data-closing` and turn inert;
|
|
18
|
+
* `done` runs once every finite CSS animation or transition that attribute started on them
|
|
19
|
+
* or their descendants has finished, or after {@link SURFACE_EXIT_CAP_MS}, whichever comes
|
|
20
|
+
* first. Returns null when the close completed synchronously (no exit animation started, or
|
|
21
|
+
* the DOM cannot report animations); otherwise the handle to cancel or finish the exit.
|
|
22
|
+
*/
|
|
23
|
+
declare function holdForExit(els: HTMLElement | readonly HTMLElement[], done: () => void, opts?: SurfaceExitOptions): SurfaceExit | null;
|
|
24
|
+
|
|
25
|
+
export { SURFACE_EXIT_CAP_MS, type SurfaceExit, type SurfaceExitOptions, holdForExit };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SURFACE_EXIT_CAP_MS, holdForExit } from './chunk-S7USVSYP.js';
|
package/dist/switch.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { V as VariantFn } from './variants-B4stUBnY.js';
|
|
2
|
+
import { C as ComponentDef } from './define-D5u3F5Dj.js';
|
|
3
|
+
import './t.js';
|
|
4
|
+
|
|
5
|
+
type SwitchSize = 'default' | 'sm';
|
|
6
|
+
type SwitchVariant = 'default' | 'destructive';
|
|
7
|
+
declare const switchDef: ComponentDef<"switch", "root" | "thumb" | "control", "height" | "width" | "height-sm" | "thumb-size" | "width-sm" | "thumb-size-sm">;
|
|
8
|
+
declare const switchVariants: VariantFn<{
|
|
9
|
+
readonly size: readonly ["default", "sm"];
|
|
10
|
+
readonly variant: readonly ["default", "destructive"];
|
|
11
|
+
}>;
|
|
12
|
+
interface SwitchProps {
|
|
13
|
+
/** On or off. Given, the switch is controlled: it moves only through `setChecked`. */
|
|
14
|
+
checked?: boolean;
|
|
15
|
+
/** The state it starts in when `checked` is not given. */
|
|
16
|
+
defaultChecked?: boolean;
|
|
17
|
+
/** Called when the user toggles it, with the state asked for. */
|
|
18
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Submitted with its form under this name while on. */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** What it submits while on (default `on`). */
|
|
23
|
+
value?: string;
|
|
24
|
+
/** A form does not submit while it is off. */
|
|
25
|
+
required?: boolean;
|
|
26
|
+
/** The id of its focusable control, so a `<label for>` reaches it. */
|
|
27
|
+
id?: string;
|
|
28
|
+
/** Its accessible name, when no `<label>` names it. */
|
|
29
|
+
label?: string;
|
|
30
|
+
size?: SwitchSize;
|
|
31
|
+
variant?: SwitchVariant;
|
|
32
|
+
}
|
|
33
|
+
declare class Switch {
|
|
34
|
+
readonly el: HTMLLabelElement;
|
|
35
|
+
private readonly input;
|
|
36
|
+
private readonly machine;
|
|
37
|
+
private readonly mid;
|
|
38
|
+
private readonly release;
|
|
39
|
+
private readonly control;
|
|
40
|
+
private readonly thumb;
|
|
41
|
+
/** The state as the switch's users see it, at once: the machine settles a beat later. */
|
|
42
|
+
private current;
|
|
43
|
+
private disabled;
|
|
44
|
+
constructor(opts?: SwitchProps);
|
|
45
|
+
get checked(): boolean;
|
|
46
|
+
setChecked(v: boolean): void;
|
|
47
|
+
setDisabled(disabled: boolean): void;
|
|
48
|
+
destroy(): void;
|
|
49
|
+
private api;
|
|
50
|
+
private render;
|
|
51
|
+
}
|
|
52
|
+
declare function createSwitch(props?: SwitchProps): Switch;
|
|
53
|
+
|
|
54
|
+
export { Switch, type SwitchProps, type SwitchSize, type SwitchVariant, createSwitch, switchDef, switchVariants };
|
package/dist/switch.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { variants } from './chunk-LZWZV2ZS.js';
|
|
2
|
+
import { nextUid, runMachine, normalizeProps, spreadProps } from './chunk-P4MTEMT7.js';
|
|
3
|
+
import { ownTeardown } from './chunk-A72NWYNP.js';
|
|
4
|
+
import { h } from './chunk-Q6WTDVH6.js';
|
|
5
|
+
import { t } from './chunk-6QCILIT2.js';
|
|
6
|
+
import { defineComponent } from './chunk-VMCR3S2A.js';
|
|
7
|
+
import { defineStyles, css } from './chunk-IDA2BT7D.js';
|
|
8
|
+
import './chunk-2GQIZM5Z.js';
|
|
9
|
+
import './chunk-BXMWQIBO.js';
|
|
10
|
+
import './chunk-X66RJAIS.js';
|
|
11
|
+
import * as zagSwitch from '@zag-js/switch';
|
|
12
|
+
|
|
13
|
+
var switchDef = defineComponent({
|
|
14
|
+
name: "switch",
|
|
15
|
+
parts: ["root", "control", "thumb"],
|
|
16
|
+
settings: { width: "32px", height: "18px", "thumb-size": "14px", "width-sm": "24px", "height-sm": "14px", "thumb-size-sm": "10px" }
|
|
17
|
+
});
|
|
18
|
+
var switchVariants = variants({ size: ["default", "sm"], variant: ["default", "destructive"] });
|
|
19
|
+
var injectStyles = defineStyles(
|
|
20
|
+
"vela-ui-switch",
|
|
21
|
+
css`@layer vela.ui{[data-slot=switch]{--_w:${switchDef.vars.width};--_h:${switchDef.vars.height};--_thumb:${switchDef.vars["thumb-size"]};cursor:pointer;flex:none;align-items:center;line-height:0;position:relative}[data-slot=switch]:where(:not([hidden])){display:inline-flex}[data-slot=switch][data-size=sm]{--_w:${switchDef.vars["width-sm"]};--_h:${switchDef.vars["height-sm"]};--_thumb:${switchDef.vars["thumb-size-sm"]}}[data-slot=switch][data-disabled]{opacity:.5;cursor:default}[data-slot=switch-control]{width:var(--_w);height:var(--_h);background:color-mix(in srgb, ${t.fg.bright} 15%, transparent);transition:background ${t.dur.med} ease;border-radius:999px;flex:none;position:relative}[data-slot=switch-thumb]{top:calc((var(--_h) - var(--_thumb)) / 2);width:var(--_thumb);height:var(--_thumb);background:${t.fg.onFill};transition:inset-inline-start ${t.dur.med} ease, background ${t.dur.med} ease;border-radius:50%;position:absolute;inset-inline-start:calc((var(--_h) - var(--_thumb)) / 2)}[data-slot=switch][data-focus-visible] [data-slot=switch-control]{outline:2px solid ${t.focus};outline-offset:2px}[data-slot=switch][data-state=checked] [data-slot=switch-control]{background:${t.selected.bg}}[data-slot=switch][data-state=checked] [data-slot=switch-thumb]{background:${t.selected.fg};inset-inline-start:calc(var(--_w) - var(--_thumb) - (var(--_h) - var(--_thumb)) / 2)}[data-slot=switch][data-variant=destructive][data-state=checked] [data-slot=switch-control]{background:${t.danger}}[data-slot=switch][data-variant=destructive][data-state=checked] [data-slot=switch-thumb]{background:${t.fg.onFill}}}`
|
|
22
|
+
);
|
|
23
|
+
var Switch = class {
|
|
24
|
+
constructor(opts = {}) {
|
|
25
|
+
injectStyles(document);
|
|
26
|
+
this.mid = nextUid("vela-switch");
|
|
27
|
+
this.current = opts.checked ?? opts.defaultChecked ?? false;
|
|
28
|
+
this.disabled = opts.disabled ?? false;
|
|
29
|
+
const controlled = opts.checked !== void 0;
|
|
30
|
+
this.input = h("input", {});
|
|
31
|
+
this.thumb = h("span", { slot: switchDef.slot("thumb") });
|
|
32
|
+
this.control = h("span", { slot: switchDef.slot("control") }, this.thumb);
|
|
33
|
+
this.el = h("label", { className: "vela-toggle-switch", slot: switchDef.slot("root"), attrs: switchVariants({ size: opts.size ?? "default", variant: opts.variant ?? "default" }) }, this.input, this.control);
|
|
34
|
+
this.machine = runMachine(
|
|
35
|
+
zagSwitch.machine,
|
|
36
|
+
() => ({
|
|
37
|
+
id: this.mid,
|
|
38
|
+
...opts.id ? { ids: { hiddenInput: opts.id } } : {},
|
|
39
|
+
defaultChecked: this.current,
|
|
40
|
+
disabled: this.disabled,
|
|
41
|
+
...opts.name !== void 0 ? { name: opts.name } : {},
|
|
42
|
+
...opts.value !== void 0 ? { value: opts.value } : {},
|
|
43
|
+
...opts.required !== void 0 ? { required: opts.required } : {}
|
|
44
|
+
}),
|
|
45
|
+
(service) => this.render(service, opts.label)
|
|
46
|
+
);
|
|
47
|
+
this.release = ownTeardown(this.el, () => this.machine.stop());
|
|
48
|
+
this.input.addEventListener("change", () => {
|
|
49
|
+
const asked = this.input.checked;
|
|
50
|
+
if (controlled) this.api().setChecked(this.current);
|
|
51
|
+
else this.current = asked;
|
|
52
|
+
opts.onCheckedChange?.(asked);
|
|
53
|
+
});
|
|
54
|
+
this.el.addEventListener("pointerdown", (e) => {
|
|
55
|
+
if (this.disabled) return;
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
this.input.focus({ preventScroll: true });
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
get checked() {
|
|
61
|
+
return this.current;
|
|
62
|
+
}
|
|
63
|
+
setChecked(v) {
|
|
64
|
+
if (v === this.current) return;
|
|
65
|
+
this.current = v;
|
|
66
|
+
this.api().setChecked(v);
|
|
67
|
+
}
|
|
68
|
+
setDisabled(disabled) {
|
|
69
|
+
if (disabled === this.disabled) return;
|
|
70
|
+
this.disabled = disabled;
|
|
71
|
+
this.machine.flush();
|
|
72
|
+
}
|
|
73
|
+
destroy() {
|
|
74
|
+
this.release();
|
|
75
|
+
}
|
|
76
|
+
api() {
|
|
77
|
+
return zagSwitch.connect(this.machine.service, normalizeProps);
|
|
78
|
+
}
|
|
79
|
+
render(service, label) {
|
|
80
|
+
const api = zagSwitch.connect(service, normalizeProps);
|
|
81
|
+
spreadProps(this.el, api.getRootProps(), this.mid);
|
|
82
|
+
spreadProps(this.control, api.getControlProps(), this.mid);
|
|
83
|
+
spreadProps(this.thumb, api.getThumbProps(), this.mid);
|
|
84
|
+
spreadProps(this.input, api.getHiddenInputProps(), this.mid);
|
|
85
|
+
if (label) this.input.setAttribute("aria-label", label);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
function createSwitch(props = {}) {
|
|
89
|
+
return new Switch(props);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { Switch, createSwitch, switchDef, switchVariants };
|
package/dist/t.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
interface Token {
|
|
2
|
+
/** The custom property, `--vela-…`. */
|
|
3
|
+
readonly name: string;
|
|
4
|
+
/** `var(--vela-…)`, also what the token prints as in a template. */
|
|
5
|
+
readonly var: string;
|
|
6
|
+
toString(): string;
|
|
7
|
+
}
|
|
8
|
+
declare const t: {
|
|
9
|
+
space: {
|
|
10
|
+
readonly 1: Token;
|
|
11
|
+
readonly 2: Token;
|
|
12
|
+
readonly 3: Token;
|
|
13
|
+
readonly 4: Token;
|
|
14
|
+
};
|
|
15
|
+
radius: {
|
|
16
|
+
readonly sm: Token;
|
|
17
|
+
readonly md: Token;
|
|
18
|
+
readonly lg: Token;
|
|
19
|
+
};
|
|
20
|
+
z: {
|
|
21
|
+
readonly tooltip: Token;
|
|
22
|
+
readonly menu: Token;
|
|
23
|
+
readonly dialog: Token;
|
|
24
|
+
readonly popover: Token;
|
|
25
|
+
};
|
|
26
|
+
ease: Token;
|
|
27
|
+
dur: {
|
|
28
|
+
readonly fast: Token;
|
|
29
|
+
readonly med: Token;
|
|
30
|
+
};
|
|
31
|
+
fontSize: {
|
|
32
|
+
readonly sm: Token;
|
|
33
|
+
readonly md: Token;
|
|
34
|
+
readonly lg: Token;
|
|
35
|
+
};
|
|
36
|
+
font: Token;
|
|
37
|
+
bg: Token;
|
|
38
|
+
fg: Token & {
|
|
39
|
+
readonly muted: Token;
|
|
40
|
+
readonly faint: Token;
|
|
41
|
+
readonly bright: Token;
|
|
42
|
+
readonly onFill: Token;
|
|
43
|
+
};
|
|
44
|
+
surface: Token & {
|
|
45
|
+
readonly elev: Token;
|
|
46
|
+
readonly overlay: Token;
|
|
47
|
+
readonly sunken: Token;
|
|
48
|
+
};
|
|
49
|
+
border: Token & {
|
|
50
|
+
readonly strong: Token;
|
|
51
|
+
readonly soft: Token;
|
|
52
|
+
readonly faint: Token;
|
|
53
|
+
};
|
|
54
|
+
hover: Token & {
|
|
55
|
+
readonly strong: Token;
|
|
56
|
+
};
|
|
57
|
+
active: Token;
|
|
58
|
+
focus: Token & {
|
|
59
|
+
readonly soft: Token;
|
|
60
|
+
};
|
|
61
|
+
separatorHover: {
|
|
62
|
+
readonly band: Token;
|
|
63
|
+
readonly line: Token;
|
|
64
|
+
};
|
|
65
|
+
scroll: Token & {
|
|
66
|
+
readonly size: Token;
|
|
67
|
+
};
|
|
68
|
+
accent: Token & {
|
|
69
|
+
readonly bright: Token;
|
|
70
|
+
};
|
|
71
|
+
highlight: Token;
|
|
72
|
+
selected: {
|
|
73
|
+
readonly bg: Token;
|
|
74
|
+
readonly fg: Token;
|
|
75
|
+
};
|
|
76
|
+
up: Token;
|
|
77
|
+
down: Token;
|
|
78
|
+
profit: Token;
|
|
79
|
+
loss: Token;
|
|
80
|
+
danger: Token;
|
|
81
|
+
shadow: Token & {
|
|
82
|
+
readonly dialog: Token;
|
|
83
|
+
};
|
|
84
|
+
backdrop: Token;
|
|
85
|
+
};
|
|
86
|
+
/** Every token reachable from `t`, by custom property name. */
|
|
87
|
+
declare function tokenNames(): string[];
|
|
88
|
+
|
|
89
|
+
export { type Token, t, tokenNames };
|
package/dist/t.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t, tokenNames } from './chunk-6QCILIT2.js';
|