@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/field.js
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { Select } from './chunk-CH3DV6FD.js';
|
|
2
|
+
import { TextArea } from './chunk-FCO3YZLT.js';
|
|
3
|
+
import { widthField } from './chunk-SAPURP46.js';
|
|
4
|
+
import { Input } from './chunk-X4YPSIW6.js';
|
|
5
|
+
import { NumberInput } from './chunk-ZB3BZHSN.js';
|
|
6
|
+
import { Checkbox } from './chunk-XJAPCCOJ.js';
|
|
7
|
+
import './chunk-LZWZV2ZS.js';
|
|
8
|
+
import { ColorField } from './chunk-2Q4JRINP.js';
|
|
9
|
+
import './chunk-OBLIX3VN.js';
|
|
10
|
+
import './chunk-G7IQLY3A.js';
|
|
11
|
+
import './chunk-FVH6L7FM.js';
|
|
12
|
+
import './chunk-FN2BUFNM.js';
|
|
13
|
+
import './chunk-J2QJATCD.js';
|
|
14
|
+
import './chunk-S7USVSYP.js';
|
|
15
|
+
import './chunk-AJ2IYSOI.js';
|
|
16
|
+
import './chunk-TAKSIV57.js';
|
|
17
|
+
import './chunk-MMTMOV6R.js';
|
|
18
|
+
import './chunk-3Q32K4PE.js';
|
|
19
|
+
import './chunk-P4MTEMT7.js';
|
|
20
|
+
import { disposeWithin } from './chunk-A72NWYNP.js';
|
|
21
|
+
import './chunk-Q6WTDVH6.js';
|
|
22
|
+
import { t } from './chunk-6QCILIT2.js';
|
|
23
|
+
import { defineComponent } from './chunk-VMCR3S2A.js';
|
|
24
|
+
import { defineStyles, css } from './chunk-IDA2BT7D.js';
|
|
25
|
+
import { injectStyles } from './chunk-2GQIZM5Z.js';
|
|
26
|
+
import './chunk-BXMWQIBO.js';
|
|
27
|
+
import './chunk-X66RJAIS.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-SAPURP46.js';
|
|
2
|
+
import './chunk-OBLIX3VN.js';
|
|
3
|
+
import './chunk-G7IQLY3A.js';
|
|
4
|
+
import './chunk-J2QJATCD.js';
|
|
5
|
+
import './chunk-S7USVSYP.js';
|
|
6
|
+
import './chunk-AJ2IYSOI.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-6QCILIT2.js';
|
|
13
|
+
import './chunk-VMCR3S2A.js';
|
|
14
|
+
import './chunk-IDA2BT7D.js';
|
|
15
|
+
import './chunk-2GQIZM5Z.js';
|
|
16
|
+
import './chunk-BXMWQIBO.js';
|
|
17
|
+
import './chunk-X66RJAIS.js';
|
|
@@ -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 };
|
package/dist/headless.js
ADDED
|
@@ -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", "body" | "title" | "root" | "icon" | "description" | "heading" | "hint", "width" | "shadow" | "radius" | "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 };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { shortcutKeys } from './chunk-6NXY62JS.js';
|
|
2
|
+
import { iconEl } from './chunk-G7IQLY3A.js';
|
|
3
|
+
import { viewportRect, placePopover, intersectRects } from './chunk-3Q32K4PE.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
|
+
|
|
12
|
+
// src/components/hover-card.ts
|
|
13
|
+
var hoverCardDef = defineComponent({
|
|
14
|
+
name: "hover-card",
|
|
15
|
+
parts: ["root", "heading", "icon", "title", "description", "body", "hint"],
|
|
16
|
+
settings: { radius: t.radius.md, width: "240px", "wide-width": "280px", "icon-radius": "5px", shadow: t.shadow.toString() }
|
|
17
|
+
});
|
|
18
|
+
var injectStyles = defineStyles(
|
|
19
|
+
"vela-ui-hover-card",
|
|
20
|
+
css`@layer vela.ui{[data-slot=hover-card]{z-index:${t.z.tooltip};width:max-content;max-width:${hoverCardDef.vars.width};border-radius:${hoverCardDef.vars.radius};border:1px solid ${t.border};background:${t.surface.elev};color:${t.fg};box-shadow:${hoverCardDef.vars.shadow};font-family:${t.font};pointer-events:none;animation:vela-hover-card-in ${t.dur.med} ${t.ease};padding:8px 10px;font-size:12px;line-height:1.4;position:fixed}[data-slot=hover-card][data-wide]{width:${hoverCardDef.vars["wide-width"]};max-width:${hoverCardDef.vars["wide-width"]}}[data-slot=hover-card][data-side=left]{--_from:4px}[data-slot=hover-card][data-side=right]{--_from:-4px}[data-slot=hover-card-heading]:where(:not([hidden])){align-items:center;gap:7px;display:flex}[data-slot=hover-card-heading]:where(:not([hidden]))>[data-slot=kbd]:first-of-type{margin-inline-start:auto}[data-slot=hover-card-icon]{border:1px solid ${t.border};border-radius:${hoverCardDef.vars["icon-radius"]};background:${t.hover};width:20px;height:20px;color:${t.fg.bright};flex:0 0 20px;justify-content:center}[data-slot=hover-card-icon]>svg{width:12px;height:12px}[data-slot=hover-card-title]{color:${t.fg.bright};font-size:11.5px;font-weight:600}[data-slot=hover-card-description]{border-top:1px solid ${t.border};color:${t.fg.muted};margin:6px 0 0;padding-top:6px;font-size:12px}[data-slot=hover-card-hint]:where(:not([hidden])){color:${t.fg.muted};align-items:center;gap:6px;margin-top:6px;font-size:11px;display:flex}@keyframes vela-hover-card-in{0%{opacity:0;transform:translateX(var(--_from,0))}to{opacity:1;transform:none}}}`
|
|
21
|
+
);
|
|
22
|
+
function createHoverCard(content, placement = "right") {
|
|
23
|
+
const p = typeof placement === "string" ? { side: placement } : placement;
|
|
24
|
+
const side = p.side ?? "right";
|
|
25
|
+
injectStyles(document);
|
|
26
|
+
let icon = null;
|
|
27
|
+
if (content.icon) {
|
|
28
|
+
icon = iconEl(content.icon, document);
|
|
29
|
+
icon.dataset.slot = hoverCardDef.slot("icon");
|
|
30
|
+
}
|
|
31
|
+
const heading = h("div", { slot: hoverCardDef.slot("heading") }, icon, h("strong", { slot: hoverCardDef.slot("title"), text: content.title }), content.shortcut ? shortcutKeys(content.shortcut) : null);
|
|
32
|
+
const body = content.body ? h("div", { slot: hoverCardDef.slot("body") }, content.body) : null;
|
|
33
|
+
const el = h(
|
|
34
|
+
"div",
|
|
35
|
+
{ slot: hoverCardDef.slot("root"), data: { side, wide: content.wide ?? false }, attrs: { role: "tooltip" } },
|
|
36
|
+
heading,
|
|
37
|
+
content.description ? h("p", { slot: hoverCardDef.slot("description"), text: content.description }) : null,
|
|
38
|
+
body,
|
|
39
|
+
content.hint ? h("div", { slot: hoverCardDef.slot("hint"), text: content.hint }) : null
|
|
40
|
+
);
|
|
41
|
+
return {
|
|
42
|
+
el,
|
|
43
|
+
place(anchor, gap) {
|
|
44
|
+
const view = viewportRect(window.innerWidth, window.innerHeight, p.collisionPadding ?? 6);
|
|
45
|
+
const b = p.collisionBoundary;
|
|
46
|
+
const bound = !b || b === "viewport" ? null : typeof b === "function" ? b() : b.getBoundingClientRect();
|
|
47
|
+
const pos = placePopover({
|
|
48
|
+
trigger: anchor,
|
|
49
|
+
pop: { width: el.offsetWidth, height: el.offsetHeight },
|
|
50
|
+
gap: gap ?? p.sideOffset ?? 8,
|
|
51
|
+
align: p.align ?? "center",
|
|
52
|
+
side,
|
|
53
|
+
alignOffset: p.alignOffset,
|
|
54
|
+
avoidCollisions: p.avoidCollisions,
|
|
55
|
+
clamp: bound ? intersectRects(view, bound) : view,
|
|
56
|
+
originX: 0,
|
|
57
|
+
originY: 0
|
|
58
|
+
});
|
|
59
|
+
el.style.left = `${pos.left}px`;
|
|
60
|
+
el.style.top = `${pos.top}px`;
|
|
61
|
+
el.dataset.side = pos.side;
|
|
62
|
+
},
|
|
63
|
+
destroy: () => el.remove()
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function attachHoverCard(trigger, content, opts) {
|
|
67
|
+
let timer = null;
|
|
68
|
+
let card = null;
|
|
69
|
+
const hide = () => {
|
|
70
|
+
if (timer) clearTimeout(timer);
|
|
71
|
+
timer = null;
|
|
72
|
+
card?.destroy();
|
|
73
|
+
card = null;
|
|
74
|
+
};
|
|
75
|
+
const show = () => {
|
|
76
|
+
const c = content();
|
|
77
|
+
if (!c || !trigger.isConnected) return;
|
|
78
|
+
card = createHoverCard(c, opts);
|
|
79
|
+
opts.host.appendChild(card.el);
|
|
80
|
+
card.place(trigger.getBoundingClientRect());
|
|
81
|
+
};
|
|
82
|
+
const enter = () => {
|
|
83
|
+
hide();
|
|
84
|
+
timer = setTimeout(show, opts.openDelay ?? opts.delay ?? 300);
|
|
85
|
+
};
|
|
86
|
+
trigger.addEventListener("pointerenter", enter);
|
|
87
|
+
trigger.addEventListener("pointerleave", hide);
|
|
88
|
+
trigger.addEventListener("pointerdown", hide);
|
|
89
|
+
return () => {
|
|
90
|
+
hide();
|
|
91
|
+
trigger.removeEventListener("pointerenter", enter);
|
|
92
|
+
trigger.removeEventListener("pointerleave", hide);
|
|
93
|
+
trigger.removeEventListener("pointerdown", hide);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { attachHoverCard, createHoverCard, hoverCardDef };
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface MessageDescriptor {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly defaultMessage: string;
|
|
4
|
+
}
|
|
5
|
+
interface Translator {
|
|
6
|
+
t(message: MessageDescriptor | string): string;
|
|
7
|
+
/** The locale tag (default English). Names months and weekdays in the date picker. */
|
|
8
|
+
readonly locale?: string;
|
|
9
|
+
/** The numbering system of digits (default `latn`). */
|
|
10
|
+
readonly numberingSystem?: string;
|
|
11
|
+
/** The first day of the week in date pickers (0 Sunday, 1 Monday, 6 Saturday). */
|
|
12
|
+
readonly weekStart?: 0 | 1 | 6;
|
|
13
|
+
}
|
|
14
|
+
/** Declare a message. The build extracts every call with literal arguments into the English
|
|
15
|
+
* catalog, so keep both arguments string literals. */
|
|
16
|
+
declare function msg(id: string, defaultMessage: string): MessageDescriptor;
|
|
17
|
+
/** A message in the translator's language, or its English text without one. */
|
|
18
|
+
declare function textOf(i18n: Translator | null | undefined, message: MessageDescriptor | string): string;
|
|
19
|
+
|
|
20
|
+
export { type MessageDescriptor, type Translator, msg, textOf };
|
package/dist/i18n.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { msg, textOf } from './chunk-FN2BUFNM.js';
|
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Register (or replace) an icon's raw `<svg>` markup under an id. */
|
|
2
|
+
declare function registerIcon(id: string, svg: string): void;
|
|
3
|
+
/** The raw `<svg>` markup for an id, or null. */
|
|
4
|
+
declare function iconMarkup(id: string): string | null;
|
|
5
|
+
/** The markup for an id, or empty markup — for the `innerHTML` sites that always want a
|
|
6
|
+
* string. An unknown id renders nothing rather than breaking the surrounding chrome. */
|
|
7
|
+
declare function icon(id: string): string;
|
|
8
|
+
/** {@link icon} pinned to an explicit pixel size, for slots that cannot inherit one (a
|
|
9
|
+
* glyph dropped into a row whose font-size belongs to the text beside it). */
|
|
10
|
+
declare function iconAt(id: string, px: number): string;
|
|
11
|
+
/** Tier A: a 16×16 chrome icon. `extra` overrides root attributes (e.g. a filled variant). */
|
|
12
|
+
declare function svg16(body: string, extra?: string): string;
|
|
13
|
+
/** Tier B: a 24×24 drawing-tool icon. `extra` overrides root attributes. */
|
|
14
|
+
declare function svg24(body: string, extra?: string): string;
|
|
15
|
+
/** A tier-B glyph drawn as a solid shape rather than a stroke (grips, dots, carets). */
|
|
16
|
+
declare function svg24Solid(body: string): string;
|
|
17
|
+
/** A ready-to-insert element rendering the icon (empty span when unknown). */
|
|
18
|
+
declare function iconEl(id: string, doc?: Document): HTMLElement;
|
|
19
|
+
|
|
20
|
+
export { icon, iconAt, iconEl, iconMarkup, registerIcon, svg16, svg24, svg24Solid };
|
package/dist/icons.js
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export { C as Child, E as ElementProps, a as addSlot, b as append, h } from './data-table-DtU3FX9j.js';
|
|
2
|
+
export { css, defineStyles } from './css.js';
|
|
3
|
+
export { Token, t, tokenNames } from './t.js';
|
|
4
|
+
export { V as VariantFn, a as VariantProps, b as VariantSpec, c as VariantValues, v as variants } from './variants-B4stUBnY.js';
|
|
5
|
+
export { C as ComponentDef, d as defineComponent } from './define-D5u3F5Dj.js';
|
|
6
|
+
export { disposeWithin, ownTeardown } from './dispose.js';
|
|
7
|
+
export { Align, CollisionBoundary, PlacementProps, Side, placePopover, zagPositioning } from './placement.js';
|
|
8
|
+
export { ComponentDefs, ComponentSettings, CreateThemeOptions, DARK_CHART, LIGHT_CHART, TOKEN_NAMES, ThemeInput, ThemeSettings, ThemedChart, TokenName, UiTheme, applyTheme, checkTheme, createTheme } from './theme.js';
|
|
9
|
+
export { ChartTheme } from './tokens.js';
|
|
10
|
+
export { LAYER_ORDER, injectLayerOrder } from './styles.js';
|
|
11
|
+
import './badge.js';
|
|
12
|
+
import './bar-chart.js';
|
|
13
|
+
import './button.js';
|
|
14
|
+
import './callout-bubble.js';
|
|
15
|
+
import './popover.js';
|
|
16
|
+
import './color-picker.js';
|
|
17
|
+
import './i18n.js';
|
|
18
|
+
import './date-picker.js';
|
|
19
|
+
import './dialog.js';
|
|
20
|
+
import '@zag-js/dialog';
|
|
21
|
+
import './donut.js';
|
|
22
|
+
import './drawer.js';
|
|
23
|
+
import './empty.js';
|
|
24
|
+
import './field.js';
|
|
25
|
+
import './select.js';
|
|
26
|
+
import './glyph-select.js';
|
|
27
|
+
import './hover-card.js';
|
|
28
|
+
import './kbd.js';
|
|
29
|
+
import './line-chart.js';
|
|
30
|
+
import './dropdown-menu.js';
|
|
31
|
+
import '@zag-js/menu';
|
|
32
|
+
import './number-input.js';
|
|
33
|
+
import './scatter-chart.js';
|
|
34
|
+
import './sparkline.js';
|
|
35
|
+
import './stat.js';
|
|
36
|
+
import './checkbox.js';
|
|
37
|
+
import './tabs.js';
|
|
38
|
+
import './text-area.js';
|
|
39
|
+
import './input.js';
|
|
40
|
+
import './input-group.js';
|
|
41
|
+
import './switch.js';
|
|
42
|
+
import './toggle-group.js';
|
|
43
|
+
import './tooltip.js';
|
|
44
|
+
import '@zag-js/tooltip';
|
|
45
|
+
import './color.js';
|