@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
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { Popover } from './chunk-OBLIX3VN.js';
|
|
2
|
+
import { iconAt } from './chunk-G7IQLY3A.js';
|
|
3
|
+
import './chunk-J2QJATCD.js';
|
|
4
|
+
import './chunk-S7USVSYP.js';
|
|
5
|
+
import './chunk-AJ2IYSOI.js';
|
|
6
|
+
import './chunk-TAKSIV57.js';
|
|
7
|
+
import './chunk-MMTMOV6R.js';
|
|
8
|
+
import './chunk-3Q32K4PE.js';
|
|
9
|
+
import './chunk-A72NWYNP.js';
|
|
10
|
+
import './chunk-Q6WTDVH6.js';
|
|
11
|
+
import { t } from './chunk-6QCILIT2.js';
|
|
12
|
+
import { defineComponent } from './chunk-VMCR3S2A.js';
|
|
13
|
+
import { css, defineStyles } from './chunk-IDA2BT7D.js';
|
|
14
|
+
import './chunk-2GQIZM5Z.js';
|
|
15
|
+
import './chunk-BXMWQIBO.js';
|
|
16
|
+
import './chunk-X66RJAIS.js';
|
|
17
|
+
|
|
18
|
+
// src/components/callout-bubble.ts
|
|
19
|
+
function closesPanel(item) {
|
|
20
|
+
return item.close !== false;
|
|
21
|
+
}
|
|
22
|
+
function calloutPanelRows(items) {
|
|
23
|
+
const rows = [];
|
|
24
|
+
for (const item of items) {
|
|
25
|
+
if (item.type === "text") {
|
|
26
|
+
rows.push({ type: "text", text: item.text });
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const last = rows[rows.length - 1];
|
|
30
|
+
if (last && last.type === "buttons") last.buttons.push(item);
|
|
31
|
+
else rows.push({ type: "buttons", buttons: [item] });
|
|
32
|
+
}
|
|
33
|
+
return rows;
|
|
34
|
+
}
|
|
35
|
+
var calloutBubbleDef = defineComponent({
|
|
36
|
+
name: "callout-bubble",
|
|
37
|
+
parts: ["root", "panel", "title", "text", "actions", "button"],
|
|
38
|
+
settings: { "panel-radius": t.radius.md, "button-radius": "5px" }
|
|
39
|
+
});
|
|
40
|
+
var CALLOUT_STYLE_ID = "vela-ui-callout-bubble";
|
|
41
|
+
var CALLOUT_CSS = css`@layer vela.ui{[data-slot=callout-bubble]{box-sizing:border-box;cursor:default;-webkit-user-select:none;user-select:none;border-radius:50%;flex:none;place-items:center;line-height:0}[data-slot=callout-bubble]:where(:not([hidden])){display:inline-grid}[data-slot=callout-bubble][role=button]{cursor:pointer}[data-slot=callout-bubble] svg{display:block}[data-slot=callout-bubble-panel]{box-sizing:border-box;background:${t.surface.elev};border:1px solid ${t.border.strong};border-radius:${calloutBubbleDef.vars["panel-radius"]};max-width:280px;box-shadow:${t.shadow};color:${t.fg};font:${t.fontSize.md} ${t.font};flex-direction:column;gap:8px;padding:10px 12px;display:flex}[data-slot=callout-bubble-title]{color:${t.fg.bright};font-weight:600}[data-slot=callout-bubble-text]{color:${t.fg.muted};white-space:pre-line;line-height:1.45}[data-slot=callout-bubble-actions]{flex-wrap:wrap;gap:8px;display:flex}[data-slot=callout-bubble-button]{cursor:pointer;border-radius:${calloutBubbleDef.vars["button-radius"]};border:1px solid ${t.border};height:26px;color:${t.fg};font-size:${t.fontSize.md};transition:background ${t.dur.fast} ease, color ${t.dur.fast} ease, opacity ${t.dur.fast} ease, border-color ${t.dur.fast} ease;background:0 0;padding:0 10px;font-family:inherit}[data-slot=callout-bubble-button]:where([data-primary]){border-color:${t.selected.bg};background:${t.selected.bg};color:${t.selected.fg}}[data-slot=callout-bubble-button]:hover{background:${t.hover};color:${t.fg.bright};border-color:${t.fg.muted}}[data-slot=callout-bubble-button]:where([data-primary]):hover{background:${t.selected.bg};color:${t.selected.fg};opacity:.85;border-color:${t.selected.bg}}}`;
|
|
42
|
+
var injectStyles = defineStyles(CALLOUT_STYLE_ID, CALLOUT_CSS);
|
|
43
|
+
var CalloutBubble = class {
|
|
44
|
+
constructor(opts) {
|
|
45
|
+
this.pop = null;
|
|
46
|
+
this.spec = { icon: opts.icon, background: opts.background, label: opts.label };
|
|
47
|
+
if (opts.color !== void 0) this.spec.color = opts.color;
|
|
48
|
+
if (opts.panel !== void 0) this.spec.panel = opts.panel;
|
|
49
|
+
this.size = opts.size ?? 16;
|
|
50
|
+
this.host = opts.host;
|
|
51
|
+
this.theme = opts.theme;
|
|
52
|
+
this.placement = { ...opts, collisionBoundary: opts.collisionBoundary ?? opts.boundary };
|
|
53
|
+
const doc = (opts.host ?? document.body).ownerDocument;
|
|
54
|
+
injectStyles(doc);
|
|
55
|
+
this.el = doc.createElement("span");
|
|
56
|
+
this.el.className = "vela-callout";
|
|
57
|
+
this.el.dataset.slot = calloutBubbleDef.slot("root");
|
|
58
|
+
this.el.style.width = `${this.size}px`;
|
|
59
|
+
this.el.style.height = `${this.size}px`;
|
|
60
|
+
this.el.addEventListener("click", (e) => {
|
|
61
|
+
if (!this.spec.panel) return;
|
|
62
|
+
e.stopPropagation();
|
|
63
|
+
this.toggle();
|
|
64
|
+
});
|
|
65
|
+
this.el.addEventListener("dblclick", (e) => {
|
|
66
|
+
if (this.spec.panel) e.stopPropagation();
|
|
67
|
+
});
|
|
68
|
+
this.el.addEventListener("keydown", (e) => {
|
|
69
|
+
if (!this.spec.panel || e.key !== "Enter" && e.key !== " ") return;
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
this.toggle();
|
|
72
|
+
});
|
|
73
|
+
this.dress();
|
|
74
|
+
}
|
|
75
|
+
/** Re-dress the bubble (a status change: new icon, tint, label, panel). */
|
|
76
|
+
set(spec) {
|
|
77
|
+
this.spec = { ...this.spec, ...spec };
|
|
78
|
+
if ("panel" in spec) this.pop?.hide();
|
|
79
|
+
this.dress();
|
|
80
|
+
}
|
|
81
|
+
/** Whether the deployed panel is currently open. */
|
|
82
|
+
get open() {
|
|
83
|
+
return this.pop?.open ?? false;
|
|
84
|
+
}
|
|
85
|
+
/** Close the deployed panel, if any. The bubble itself stays. */
|
|
86
|
+
hidePanel() {
|
|
87
|
+
this.pop?.hide();
|
|
88
|
+
}
|
|
89
|
+
destroy() {
|
|
90
|
+
this.pop?.destroy();
|
|
91
|
+
this.pop = null;
|
|
92
|
+
this.el.remove();
|
|
93
|
+
}
|
|
94
|
+
dress() {
|
|
95
|
+
const clickable = this.spec.panel !== void 0;
|
|
96
|
+
this.el.style.background = this.spec.background;
|
|
97
|
+
this.el.style.color = this.spec.color ?? "";
|
|
98
|
+
this.el.innerHTML = iconAt(this.spec.icon, this.size - 4);
|
|
99
|
+
this.el.setAttribute("aria-label", this.spec.label);
|
|
100
|
+
if (clickable) {
|
|
101
|
+
this.el.setAttribute("role", "button");
|
|
102
|
+
this.el.tabIndex = 0;
|
|
103
|
+
} else {
|
|
104
|
+
this.el.removeAttribute("role");
|
|
105
|
+
this.el.removeAttribute("tabindex");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
toggle() {
|
|
109
|
+
if (this.pop?.open) {
|
|
110
|
+
this.pop.hide();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const panel = this.spec.panel;
|
|
114
|
+
if (!panel) return;
|
|
115
|
+
this.pop?.destroy();
|
|
116
|
+
this.pop = new Popover({
|
|
117
|
+
trigger: this.el,
|
|
118
|
+
side: this.placement.side,
|
|
119
|
+
align: this.placement.align,
|
|
120
|
+
sideOffset: this.placement.sideOffset ?? 6,
|
|
121
|
+
alignOffset: this.placement.alignOffset,
|
|
122
|
+
avoidCollisions: this.placement.avoidCollisions,
|
|
123
|
+
collisionPadding: this.placement.collisionPadding,
|
|
124
|
+
content: (body) => this.buildPanel(body, panel),
|
|
125
|
+
...this.host ? { host: this.host } : {},
|
|
126
|
+
...this.theme ? { theme: this.theme() } : {},
|
|
127
|
+
...this.placement.collisionBoundary ? { collisionBoundary: this.placement.collisionBoundary } : {}
|
|
128
|
+
});
|
|
129
|
+
this.pop.show();
|
|
130
|
+
}
|
|
131
|
+
buildPanel(body, panel) {
|
|
132
|
+
const doc = body.ownerDocument;
|
|
133
|
+
const part = (tag, className, name) => {
|
|
134
|
+
const el = doc.createElement(tag);
|
|
135
|
+
el.className = className;
|
|
136
|
+
el.dataset.slot = calloutBubbleDef.slot(name);
|
|
137
|
+
return el;
|
|
138
|
+
};
|
|
139
|
+
const root = part("div", "vela-callout-panel", "panel");
|
|
140
|
+
if (panel.title) {
|
|
141
|
+
const title = part("div", "vela-callout-title", "title");
|
|
142
|
+
title.textContent = panel.title;
|
|
143
|
+
root.appendChild(title);
|
|
144
|
+
}
|
|
145
|
+
for (const row of calloutPanelRows(panel.items)) {
|
|
146
|
+
if (row.type === "text") {
|
|
147
|
+
const text = part("div", "vela-callout-text", "text");
|
|
148
|
+
text.textContent = row.text;
|
|
149
|
+
root.appendChild(text);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
const actions = part("div", "vela-callout-actions", "actions");
|
|
153
|
+
for (const item of row.buttons) {
|
|
154
|
+
const btn = part("button", "vela-callout-btn" + (item.primary ? " vela-callout-btn-primary" : ""), "button");
|
|
155
|
+
btn.type = "button";
|
|
156
|
+
if (item.primary) btn.dataset.primary = "";
|
|
157
|
+
btn.textContent = item.label;
|
|
158
|
+
btn.addEventListener("click", () => {
|
|
159
|
+
item.run();
|
|
160
|
+
if (closesPanel(item)) this.pop?.hide();
|
|
161
|
+
});
|
|
162
|
+
actions.appendChild(btn);
|
|
163
|
+
}
|
|
164
|
+
root.appendChild(actions);
|
|
165
|
+
}
|
|
166
|
+
body.appendChild(root);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
function createCalloutBubble(props) {
|
|
170
|
+
return new CalloutBubble(props);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export { CALLOUT_CSS, CALLOUT_STYLE_ID, CalloutBubble, calloutBubbleDef, calloutPanelRows, closesPanel, createCalloutBubble };
|
package/dist/chart.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** A round step for `range` in about `ticks` steps: 1, 2 or 5 times a power of ten. */
|
|
2
|
+
declare function niceStep(range: number, ticks: number): number;
|
|
3
|
+
/**
|
|
4
|
+
* A value axis spanning `lo..hi` in about `count` round steps: its bounds widened to whole
|
|
5
|
+
* steps, and its ticks from bound to bound with zero among them. One step serves both, so no
|
|
6
|
+
* tick falls outside the plot.
|
|
7
|
+
*/
|
|
8
|
+
declare function valueAxis(lo: number, hi: number, count: number): {
|
|
9
|
+
min: number;
|
|
10
|
+
max: number;
|
|
11
|
+
step: number;
|
|
12
|
+
ticks: number[];
|
|
13
|
+
};
|
|
14
|
+
/** `1.2k`, `-3.4M`, `0.25`. */
|
|
15
|
+
declare function compactNumber(v: number): string;
|
|
16
|
+
declare function escapeXml(s: string): string;
|
|
17
|
+
/** Fill the tip with a readout and place it beside the point at (x, y), inside the box. */
|
|
18
|
+
declare function showTip(tip: HTMLElement, content: string | Node, box: {
|
|
19
|
+
w: number;
|
|
20
|
+
h: number;
|
|
21
|
+
}, x: number, y: number): void;
|
|
22
|
+
/** A chart's root (sized by its parent), its SVG and its tip, redrawn as the root resizes. */
|
|
23
|
+
declare function chartFrame(rootSlot: string, tipSlot: string, className: string | undefined, draw: () => void): {
|
|
24
|
+
el: HTMLElement;
|
|
25
|
+
svg: SVGSVGElement;
|
|
26
|
+
tip: HTMLElement;
|
|
27
|
+
disconnect(): void;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { chartFrame, compactNumber, escapeXml, niceStep, showTip, valueAxis };
|
package/dist/chart.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { chartFrame, compactNumber, escapeXml, niceStep, showTip, valueAxis } from './chunk-A2FJ7Y7D.js';
|
|
@@ -0,0 +1,60 @@
|
|
|
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 CheckboxSize = 'sm' | 'md';
|
|
6
|
+
/** `bright` = settings-dialog fill (`--vela-fg-bright`); `selected` = `--vela-selected-bg`. */
|
|
7
|
+
type CheckboxTone = 'bright' | 'selected';
|
|
8
|
+
interface CheckboxControllerOptions {
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
/** The state it starts in when `checked` is not given. */
|
|
11
|
+
defaultChecked?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
size?: CheckboxSize;
|
|
14
|
+
tone?: CheckboxTone;
|
|
15
|
+
/** Called when the user toggles it. */
|
|
16
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
17
|
+
/** @deprecated Use `onCheckedChange`. */
|
|
18
|
+
onChange?: (checked: boolean) => void;
|
|
19
|
+
}
|
|
20
|
+
interface CheckboxController {
|
|
21
|
+
checked: boolean;
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
size: CheckboxSize;
|
|
24
|
+
tone: CheckboxTone;
|
|
25
|
+
setChecked(v: boolean): void;
|
|
26
|
+
toggle(): boolean;
|
|
27
|
+
}
|
|
28
|
+
/** The switch's state without DOM: checked, and the option mapping. */
|
|
29
|
+
declare function checkboxController(opts?: CheckboxControllerOptions): CheckboxController;
|
|
30
|
+
declare const checkboxDef: ComponentDef<"checkbox", "root" | "icon", "radius">;
|
|
31
|
+
declare const checkboxVariants: VariantFn<{
|
|
32
|
+
readonly size: readonly ["md", "sm"];
|
|
33
|
+
readonly tone: readonly ["bright", "selected"];
|
|
34
|
+
}>;
|
|
35
|
+
interface CheckboxOptions extends CheckboxControllerOptions {
|
|
36
|
+
id?: string;
|
|
37
|
+
/** Submitted with its form under this name (`on` when checked). */
|
|
38
|
+
name?: string;
|
|
39
|
+
/** A form does not submit while it is off. */
|
|
40
|
+
required?: boolean;
|
|
41
|
+
}
|
|
42
|
+
type CheckboxProps = CheckboxOptions;
|
|
43
|
+
declare class Checkbox {
|
|
44
|
+
readonly el: HTMLLabelElement;
|
|
45
|
+
private readonly input;
|
|
46
|
+
private readonly machine;
|
|
47
|
+
private readonly mid;
|
|
48
|
+
private readonly release;
|
|
49
|
+
/** The state as the switch's users see it, at once: the machine settles a beat later. */
|
|
50
|
+
private current;
|
|
51
|
+
constructor(opts?: CheckboxOptions);
|
|
52
|
+
get checked(): boolean;
|
|
53
|
+
setChecked(v: boolean): void;
|
|
54
|
+
destroy(): void;
|
|
55
|
+
private api;
|
|
56
|
+
private render;
|
|
57
|
+
}
|
|
58
|
+
declare function createCheckbox(props?: CheckboxProps): Checkbox;
|
|
59
|
+
|
|
60
|
+
export { Checkbox, type CheckboxController, type CheckboxControllerOptions, type CheckboxOptions, type CheckboxProps, type CheckboxSize, type CheckboxTone, checkboxController, checkboxDef, checkboxVariants, createCheckbox };
|
package/dist/checkbox.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { Checkbox, checkboxController, checkboxDef, checkboxVariants, createCheckbox } from './chunk-XJAPCCOJ.js';
|
|
2
|
+
import './chunk-LZWZV2ZS.js';
|
|
3
|
+
import './chunk-G7IQLY3A.js';
|
|
4
|
+
import './chunk-P4MTEMT7.js';
|
|
5
|
+
import './chunk-A72NWYNP.js';
|
|
6
|
+
import './chunk-Q6WTDVH6.js';
|
|
7
|
+
import './chunk-6QCILIT2.js';
|
|
8
|
+
import './chunk-VMCR3S2A.js';
|
|
9
|
+
import './chunk-IDA2BT7D.js';
|
|
10
|
+
import './chunk-2GQIZM5Z.js';
|
|
11
|
+
import './chunk-BXMWQIBO.js';
|
|
12
|
+
import './chunk-X66RJAIS.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/lib/styles.ts
|
|
2
|
+
function overlayScrollbarCss(selector, width) {
|
|
3
|
+
const size = width === void 0 ? "var(--vela-scroll-size, 5px)" : `${width}px`;
|
|
4
|
+
return `${selector}::-webkit-scrollbar{width:${size};height:${size};}${selector}::-webkit-scrollbar-thumb{background:var(--vela-scroll);border-radius:${size};}${selector}::-webkit-scrollbar-track,${selector}::-webkit-scrollbar-corner{background:transparent;}${selector}::-webkit-scrollbar-button{display:none;width:0;height:0;}`;
|
|
5
|
+
}
|
|
6
|
+
var FIELD_FOCUS_CSS = "outline:none;transition:border-color .12s ease,box-shadow .12s ease;";
|
|
7
|
+
var FIELD_FOCUS_RING = "border-color:var(--vela-focus);box-shadow:0 0 0 3px var(--vela-focus-soft);";
|
|
8
|
+
var LAYER_ORDER = "@layer vela.theme, vela.ui, vela.chrome, vela.pro, vela.custom;";
|
|
9
|
+
function injectLayerOrder(root = document) {
|
|
10
|
+
const sheet = injectStyles("vela-layers", LAYER_ORDER, root);
|
|
11
|
+
const parent = sheet?.parentNode;
|
|
12
|
+
if (!sheet || !parent) return;
|
|
13
|
+
const first = Array.from(parent.children).find((el) => el.tagName === "STYLE" && el.id.startsWith("vela"));
|
|
14
|
+
if (first && first !== sheet) parent.insertBefore(sheet, first);
|
|
15
|
+
}
|
|
16
|
+
function injectStyles(id, css, root = document) {
|
|
17
|
+
if (typeof document === "undefined") return null;
|
|
18
|
+
const host = root instanceof Document ? root.head : root;
|
|
19
|
+
const existing = typeof root.getElementById === "function" ? root.getElementById(id) : host.querySelector(`#${CSS.escape(id)}`);
|
|
20
|
+
if (existing) return existing;
|
|
21
|
+
const s = document.createElement("style");
|
|
22
|
+
s.id = id;
|
|
23
|
+
s.textContent = css;
|
|
24
|
+
host.appendChild(s);
|
|
25
|
+
return s;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { FIELD_FOCUS_CSS, FIELD_FOCUS_RING, LAYER_ORDER, injectLayerOrder, injectStyles, overlayScrollbarCss };
|