@luxalgo/vela-ui 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +89 -0
- package/README.md +5 -2
- package/dist/badge.js +1 -1
- package/dist/bar-chart.js +1 -1
- package/dist/button.d.ts +18 -4
- package/dist/button.js +4 -3
- package/dist/calendar.d.ts +3 -1
- package/dist/calendar.js +1 -1
- package/dist/callout-bubble.d.ts +6 -1
- package/dist/callout-bubble.js +12 -8
- package/dist/card.d.ts +52 -0
- package/dist/card.js +179 -0
- package/dist/checkbox.js +5 -5
- package/dist/{chunk-X4YPSIW6.js → chunk-5BJV5FY5.js} +1 -1
- package/dist/{chunk-FCO3YZLT.js → chunk-ALAHGSLC.js} +1 -1
- package/dist/{chunk-5QHXOAZA.js → chunk-B2EZB5ZG.js} +4 -4
- package/dist/{chunk-G7IQLY3A.js → chunk-C3PXY2SW.js} +5 -0
- package/dist/chunk-DXDCKZ2M.js +117 -0
- package/dist/{chunk-6NXY62JS.js → chunk-FYVQO5TN.js} +1 -1
- package/dist/{chunk-V6TTTMTE.js → chunk-GVRX3UAV.js} +4 -1
- package/dist/{chunk-XJAPCCOJ.js → chunk-IOOYDSSK.js} +4 -4
- package/dist/{chunk-OBLIX3VN.js → chunk-KKS6NEGI.js} +2 -2
- package/dist/{chunk-SAPURP46.js → chunk-OJ2SEMN6.js} +3 -3
- package/dist/{chunk-2Q4JRINP.js → chunk-OQXFQMZM.js} +3 -3
- package/dist/{chunk-AJ2IYSOI.js → chunk-TBXUF5YX.js} +35 -3
- package/dist/{chunk-ZB3BZHSN.js → chunk-UEO6W37Z.js} +4 -4
- package/dist/{chunk-CH3DV6FD.js → chunk-WWHNUKSZ.js} +5 -5
- package/dist/chunk-XBEL4K33.js +142 -0
- package/dist/collapsible.d.ts +49 -0
- package/dist/collapsible.js +106 -0
- package/dist/color-picker.js +5 -5
- package/dist/context-menu.js +5 -5
- package/dist/css.d.ts +3 -1
- package/dist/css.js +1 -1
- package/dist/data-table.d.ts +39 -2
- package/dist/data-table.js +1 -1
- package/dist/date-picker.js +3 -3
- package/dist/dialog.d.ts +8 -0
- package/dist/dialog.js +15 -5
- package/dist/donut.js +1 -1
- package/dist/drawer.js +2 -2
- package/dist/dropdown-menu.js +4 -4
- package/dist/empty.js +2 -2
- package/dist/field.js +13 -13
- package/dist/glyph-select.js +5 -5
- package/dist/h-Bl37qUis.d.ts +24 -0
- package/dist/hover-card.d.ts +1 -1
- package/dist/hover-card.js +3 -3
- package/dist/icons.js +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.js +3 -3
- package/dist/input-group.js +4 -3
- package/dist/input.js +2 -2
- package/dist/item.d.ts +72 -0
- package/dist/item.js +131 -0
- package/dist/kbd.js +2 -2
- package/dist/line-chart.js +1 -1
- package/dist/manifest.json +1336 -65
- package/dist/month-grid.d.ts +45 -0
- package/dist/month-grid.js +157 -0
- package/dist/number-input.js +5 -5
- package/dist/popover.js +3 -3
- package/dist/scatter-chart.js +1 -1
- package/dist/select.js +7 -7
- package/dist/slider.d.ts +46 -0
- package/dist/slider.js +111 -0
- package/dist/sort-button.d.ts +41 -0
- package/dist/sort-button.js +88 -0
- package/dist/sparkline.js +1 -1
- package/dist/stat.js +1 -1
- package/dist/switch.js +3 -3
- package/dist/tabs.d.ts +3 -1
- package/dist/tabs.js +13 -8
- package/dist/text-area.js +2 -2
- package/dist/theme-Ct-q58xz.d.ts +341 -0
- package/dist/theme.d.ts +42 -181
- package/dist/theme.js +2 -2
- package/dist/theme.schema.json +541 -1
- package/dist/toast.d.ts +49 -0
- package/dist/toast.js +463 -0
- package/dist/toggle-group.js +4 -4
- package/dist/tooltip.js +2 -2
- package/dist/treemap.d.ts +80 -0
- package/dist/treemap.js +470 -0
- package/docs/theming.md +6 -0
- package/docs/writing-a-component.md +4 -1
- package/llms.txt +11 -3
- package/package.json +1 -1
- package/registry/button.ts +105 -21
- package/registry/callout-bubble.ts +14 -3
- package/registry/card.ts +379 -0
- package/registry/collapsible.ts +271 -0
- package/registry/dialog.ts +16 -0
- package/registry/dropdown-menu.ts +3 -3
- package/registry/item.ts +376 -0
- package/registry/month-grid.ts +328 -0
- package/registry/slider.ts +259 -0
- package/registry/sort-button.ts +189 -0
- package/registry/tabs.ts +38 -4
- package/registry/toast.ts +965 -0
- package/registry/treemap.ts +847 -0
- package/skills/using-vela-ui-components/SKILL.md +14 -9
- package/src/components/button.ts +105 -21
- package/src/components/callout-bubble.ts +14 -3
- package/src/components/card.ts +379 -0
- package/src/components/collapsible.ts +271 -0
- package/src/components/dialog.ts +16 -0
- package/src/components/dropdown-menu.ts +3 -3
- package/src/components/item.ts +376 -0
- package/src/components/month-grid.ts +328 -0
- package/src/components/slider.ts +259 -0
- package/src/components/sort-button.ts +189 -0
- package/src/components/tabs.ts +38 -4
- package/src/components/toast.ts +965 -0
- package/src/components/treemap.ts +847 -0
- package/src/lib/calendar.ts +5 -0
- package/src/lib/component-index.ts +34 -2
- package/src/lib/css.ts +6 -2
- package/src/lib/icons.ts +7 -0
- package/src/lib/scope.ts +135 -0
- package/src/lib/theme.ts +21 -5
- package/dist/chunk-EZQXTO6K.js +0 -89
- package/dist/chunk-IDA2BT7D.js +0 -29
- package/dist/data-table-DtU3FX9j.d.ts +0 -61
package/dist/item.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { iconEl } from './chunk-C3PXY2SW.js';
|
|
2
|
+
import { variants } from './chunk-LZWZV2ZS.js';
|
|
3
|
+
import { h, append } from './chunk-Q6WTDVH6.js';
|
|
4
|
+
import { t } from './chunk-6QCILIT2.js';
|
|
5
|
+
import { defineComponent } from './chunk-VMCR3S2A.js';
|
|
6
|
+
import { defineStyles, css } from './chunk-XBEL4K33.js';
|
|
7
|
+
import './chunk-2GQIZM5Z.js';
|
|
8
|
+
import './chunk-BXMWQIBO.js';
|
|
9
|
+
import './chunk-X66RJAIS.js';
|
|
10
|
+
|
|
11
|
+
// src/components/item.ts
|
|
12
|
+
var itemDef = defineComponent({
|
|
13
|
+
name: "item",
|
|
14
|
+
parts: ["root", "media", "content", "title", "description", "meta", "actions", "group"],
|
|
15
|
+
settings: { radius: t.radius.md, gap: "10px" }
|
|
16
|
+
});
|
|
17
|
+
var itemVariants = variants({ variant: ["default", "outline", "muted"], size: ["default", "sm"] });
|
|
18
|
+
var CONTROL = 'button, a[href], input, select, textarea, label, summary, [role="button"], [role="checkbox"], [role="switch"], [role="menuitem"], [role="option"], [role="link"], [contenteditable]:not([contenteditable="false"])';
|
|
19
|
+
var injectStyles = defineStyles(
|
|
20
|
+
"vela-ui-item",
|
|
21
|
+
css`@layer vela.ui{[data-slot=item]{box-sizing:border-box;border-radius:${itemDef.vars.radius};min-width:0;color:${t.fg};text-align:start;transition:background ${t.dur.fast} ease, border-color ${t.dur.fast} ease;border:1px solid #0000;padding:8px 10px;font-size:13px;position:relative}[data-slot=item]:where(:not([hidden])){align-items:center;gap:${itemDef.vars.gap};display:flex}[data-slot=item][data-size=sm]{gap:8px;padding:4px 8px;font-size:12px}[data-slot=item][data-variant=outline]{border-color:${t.border}}[data-slot=item][data-variant=muted]{background:${t.surface.sunken}}[data-slot=item][data-clickable]{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}[data-slot=item][data-clickable]:not([data-disabled]):hover{background:${t.hover}}[data-slot=item][data-selected],[data-slot=item][data-selected][data-clickable]:hover{background:${t.active}}[data-slot=item]:focus-visible{outline:2px solid ${t.focus};outline-offset:-2px}[data-slot=item][data-disabled]{cursor:default;opacity:.5}[data-slot=item-media]{color:${t.fg.muted};flex:none}[data-slot=item-media]:where(:not([hidden])){justify-content:center;align-items:center;display:inline-flex}[data-slot=item-media]>[data-icon]{width:1em;height:1em;font-size:16px;line-height:0}[data-slot=item-media]>[data-icon]>svg{width:100%;height:100%}[data-slot=item-content]{flex:auto;min-width:0}[data-slot=item-content]:where(:not([hidden])){flex-direction:column;gap:2px;display:flex}[data-slot=item-content][role=button]:focus-visible{outline:2px solid ${t.focus};outline-offset:2px;border-radius:${t.radius.sm}}[data-slot=item-title],[data-slot=item-description]{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}[data-slot=item-title]{color:${t.fg.bright};font-weight:500;line-height:18px}[data-slot=item-description]{color:${t.fg.muted};font-size:12px;line-height:16px}[data-slot=item-description]:is([data-size=sm] *){font-size:11px;line-height:14px}[data-slot=item-meta]{color:${t.fg};font-variant-numeric:tabular-nums;text-align:end;white-space:nowrap;flex:none;gap:8px}[data-slot=item-meta]:where(:not([hidden])){align-items:center;display:inline-flex}[data-slot=item-actions]{flex:none;gap:4px}[data-slot=item-actions]:where(:not([hidden])){align-items:center;display:inline-flex}[data-slot=item-actions]:is([data-reveal-actions]>*){opacity:0;transition:opacity ${t.dur.fast} ease}[data-slot=item-actions]:is([data-reveal-actions]:hover>*,[data-reveal-actions]:focus-within>*){opacity:1}@media (hover:none){[data-slot=item-actions]:is([data-reveal-actions]>*){opacity:1}}[data-slot=item-group]{min-width:0}[data-slot=item-group]:where(:not([hidden])){flex-direction:column;gap:2px;display:flex}[data-slot=item-group][data-separated]{gap:0}[data-slot=item-group][data-separated]>[data-slot=item]{border-bottom-color:${t.border.faint};border-radius:0}}`
|
|
22
|
+
);
|
|
23
|
+
var ItemImpl = class {
|
|
24
|
+
constructor(props) {
|
|
25
|
+
this.props = props;
|
|
26
|
+
this.descriptionEl = null;
|
|
27
|
+
this.disabled = false;
|
|
28
|
+
this.onClick = (e) => {
|
|
29
|
+
if (this.disabled) return;
|
|
30
|
+
const control = e.target instanceof Element ? e.target.closest(CONTROL) : null;
|
|
31
|
+
if (control && control !== this.control && control !== this.el && this.el.contains(control)) return;
|
|
32
|
+
this.props.onSelect?.(e);
|
|
33
|
+
};
|
|
34
|
+
this.onKey = (e) => {
|
|
35
|
+
if (this.disabled || e.target !== this.control || e.key !== "Enter" && e.key !== " ") return;
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
this.props.onSelect?.(e);
|
|
38
|
+
};
|
|
39
|
+
injectStyles(document);
|
|
40
|
+
const clickable = !!props.onSelect;
|
|
41
|
+
const textControl = clickable && props.role === void 0 && props.actions !== void 0 && props.actions !== null;
|
|
42
|
+
const role = props.role ?? (clickable ? "button" : null);
|
|
43
|
+
this.option = role === "option";
|
|
44
|
+
let media = null;
|
|
45
|
+
if (props.media !== void 0) {
|
|
46
|
+
media = h("div", { slot: itemDef.slot("media") });
|
|
47
|
+
if (typeof props.media === "string") {
|
|
48
|
+
const icon = iconEl(props.media, document);
|
|
49
|
+
icon.dataset.icon = "";
|
|
50
|
+
media.appendChild(icon);
|
|
51
|
+
} else media.appendChild(props.media);
|
|
52
|
+
}
|
|
53
|
+
this.titleEl = h("div", { slot: itemDef.slot("title") }, props.title);
|
|
54
|
+
this.content = h("div", { slot: itemDef.slot("content"), attrs: textControl ? { role, tabindex: "0" } : void 0 }, this.titleEl);
|
|
55
|
+
const trailing = (part, children) => {
|
|
56
|
+
if (children === void 0 || children === null) return null;
|
|
57
|
+
const el = h("div", { slot: itemDef.slot(part) });
|
|
58
|
+
append(el, [children]);
|
|
59
|
+
return el;
|
|
60
|
+
};
|
|
61
|
+
this.el = h(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
className: props.className,
|
|
65
|
+
slot: itemDef.slot("root"),
|
|
66
|
+
attrs: { ...itemVariants(props), role: textControl ? null : role, tabindex: clickable && !textControl ? "0" : null },
|
|
67
|
+
data: { clickable: clickable || null, "reveal-actions": props.revealActions || null }
|
|
68
|
+
},
|
|
69
|
+
media,
|
|
70
|
+
this.content,
|
|
71
|
+
trailing("meta", props.meta),
|
|
72
|
+
trailing("actions", props.actions)
|
|
73
|
+
);
|
|
74
|
+
this.control = textControl ? this.content : this.el;
|
|
75
|
+
if (props.description !== void 0) this.setDescription(props.description);
|
|
76
|
+
if (clickable) {
|
|
77
|
+
this.el.addEventListener("click", this.onClick);
|
|
78
|
+
this.control.addEventListener("keydown", this.onKey);
|
|
79
|
+
}
|
|
80
|
+
this.setSelected(props.selected ?? false);
|
|
81
|
+
this.setDisabled(props.disabled ?? false);
|
|
82
|
+
}
|
|
83
|
+
setSelected(selected) {
|
|
84
|
+
this.el.toggleAttribute("data-selected", selected);
|
|
85
|
+
if (this.option) this.control.setAttribute("aria-selected", String(selected));
|
|
86
|
+
else if (selected) this.control.setAttribute("aria-current", "true");
|
|
87
|
+
else this.control.removeAttribute("aria-current");
|
|
88
|
+
}
|
|
89
|
+
setDisabled(disabled) {
|
|
90
|
+
this.disabled = disabled;
|
|
91
|
+
this.el.toggleAttribute("data-disabled", disabled);
|
|
92
|
+
if (disabled) this.control.setAttribute("aria-disabled", "true");
|
|
93
|
+
else this.control.removeAttribute("aria-disabled");
|
|
94
|
+
if (this.props.onSelect) this.control.tabIndex = disabled ? -1 : 0;
|
|
95
|
+
}
|
|
96
|
+
setTitle(title) {
|
|
97
|
+
this.titleEl.replaceChildren(title);
|
|
98
|
+
}
|
|
99
|
+
setDescription(description) {
|
|
100
|
+
if (description === null) {
|
|
101
|
+
this.descriptionEl?.remove();
|
|
102
|
+
this.descriptionEl = null;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
this.descriptionEl ?? (this.descriptionEl = this.content.appendChild(h("div", { slot: itemDef.slot("description") })));
|
|
106
|
+
this.descriptionEl.replaceChildren(description);
|
|
107
|
+
}
|
|
108
|
+
destroy() {
|
|
109
|
+
this.el.removeEventListener("click", this.onClick);
|
|
110
|
+
this.control.removeEventListener("keydown", this.onKey);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
function createItem(props) {
|
|
114
|
+
return new ItemImpl(props);
|
|
115
|
+
}
|
|
116
|
+
function createItemGroup(props = {}) {
|
|
117
|
+
injectStyles(document);
|
|
118
|
+
const el = h("div", {
|
|
119
|
+
className: props.className,
|
|
120
|
+
slot: itemDef.slot("group"),
|
|
121
|
+
attrs: { role: props.role ?? (props.label ? "group" : null), "aria-label": props.label ?? null },
|
|
122
|
+
data: { separated: props.separated || null }
|
|
123
|
+
});
|
|
124
|
+
const setItems = (items) => {
|
|
125
|
+
el.replaceChildren(...items.map((item) => item instanceof HTMLElement ? item : item.el));
|
|
126
|
+
};
|
|
127
|
+
setItems(props.items ?? []);
|
|
128
|
+
return { el, setItems, destroy: () => el.remove() };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { createItem, createItemGroup, itemDef, itemVariants };
|
package/dist/kbd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { createKbd, kbdDef, shortcutKeys } from './chunk-
|
|
1
|
+
export { createKbd, kbdDef, shortcutKeys } from './chunk-FYVQO5TN.js';
|
|
2
2
|
import './chunk-Q6WTDVH6.js';
|
|
3
3
|
import './chunk-6QCILIT2.js';
|
|
4
4
|
import './chunk-VMCR3S2A.js';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-XBEL4K33.js';
|
|
6
6
|
import './chunk-2GQIZM5Z.js';
|
|
7
7
|
import './chunk-BXMWQIBO.js';
|
|
8
8
|
import './chunk-X66RJAIS.js';
|
package/dist/line-chart.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { chartFrame, niceStep, showTip, escapeXml } from './chunk-A2FJ7Y7D.js';
|
|
2
2
|
import { t } from './chunk-6QCILIT2.js';
|
|
3
3
|
import { defineComponent } from './chunk-VMCR3S2A.js';
|
|
4
|
-
import { defineStyles, css } from './chunk-
|
|
4
|
+
import { defineStyles, css } from './chunk-XBEL4K33.js';
|
|
5
5
|
import './chunk-2GQIZM5Z.js';
|
|
6
6
|
import './chunk-BXMWQIBO.js';
|
|
7
7
|
import { pageUid } from './chunk-X66RJAIS.js';
|