@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,280 @@
|
|
|
1
|
+
import { variants } from './chunk-LZWZV2ZS.js';
|
|
2
|
+
import { openPopoverTrigger, closeOpenPopovers, Popover } from './chunk-OBLIX3VN.js';
|
|
3
|
+
import { iconEl } from './chunk-G7IQLY3A.js';
|
|
4
|
+
import { nextUid, runMachine, normalizeProps, spreadProps } from './chunk-P4MTEMT7.js';
|
|
5
|
+
import { ownTeardown } from './chunk-A72NWYNP.js';
|
|
6
|
+
import { addSlot, h } from './chunk-Q6WTDVH6.js';
|
|
7
|
+
import { t } from './chunk-6QCILIT2.js';
|
|
8
|
+
import { defineComponent } from './chunk-VMCR3S2A.js';
|
|
9
|
+
import { css, defineStyles } from './chunk-IDA2BT7D.js';
|
|
10
|
+
import * as zagListbox from '@zag-js/listbox';
|
|
11
|
+
|
|
12
|
+
function selectController(opts) {
|
|
13
|
+
const options = opts.options;
|
|
14
|
+
let value = opts.value ?? opts.defaultValue ?? (opts.placeholder !== void 0 ? "" : options[0]?.value ?? "");
|
|
15
|
+
const size = opts.size ?? "md";
|
|
16
|
+
return {
|
|
17
|
+
options,
|
|
18
|
+
get value() {
|
|
19
|
+
return value;
|
|
20
|
+
},
|
|
21
|
+
size,
|
|
22
|
+
fill: opts.fill ?? size !== "sm",
|
|
23
|
+
disabled: opts.disabled ?? false,
|
|
24
|
+
setValue(v) {
|
|
25
|
+
value = v;
|
|
26
|
+
},
|
|
27
|
+
labelOf(v) {
|
|
28
|
+
return options.find((o) => o.value === v)?.label ?? v;
|
|
29
|
+
},
|
|
30
|
+
pick(v) {
|
|
31
|
+
value = v;
|
|
32
|
+
const label = options.find((o) => o.value === v)?.label ?? v;
|
|
33
|
+
opts.onValueChange?.(v, label);
|
|
34
|
+
opts.onChange?.(v, label);
|
|
35
|
+
return { value: v, label };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
var selectDef = defineComponent({
|
|
40
|
+
name: "select",
|
|
41
|
+
parts: ["root", "trigger", "value", "icon", "sizer", "native", "content", "viewport", "item", "rail", "thumb"],
|
|
42
|
+
settings: { radius: t.radius.md, "content-radius": t.radius.md, "thumb-radius": "2px", "focus-ring": `0 0 0 3px ${t.focus.soft}` }
|
|
43
|
+
});
|
|
44
|
+
var selectVariants = variants({ size: ["md", "sm"] });
|
|
45
|
+
var SELECT_STYLE_ID = "vela-ui-select-3";
|
|
46
|
+
var SELECT_CSS = css`@layer vela.ui{[data-slot=select-trigger]{box-sizing:border-box;border:1px solid ${t.border.strong};border-radius:${selectDef.vars.radius};width:100%;min-width:0;height:34px;color:${t.fg.bright};cursor:pointer;text-align:start;transition:border-color ${t.dur.fast} ease, box-shadow ${t.dur.fast} ease;background:0 0;outline:2px solid #0000;align-items:center;padding-block:0;padding-inline:8px 26px;font-family:inherit;font-size:14px;display:flex}[data-slot=select-trigger]:hover{border-color:${t.fg.muted}}[data-slot=select-trigger]:focus{border-color:${t.focus};box-shadow:${selectDef.vars["focus-ring"]}}[data-slot=select-value]{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}[data-slot=select-icon]{inset-inline-end:8px;pointer-events:none;opacity:.55;color:inherit;line-height:0;display:flex;position:absolute;top:50%;transform:translateY(-50%)}[data-slot=select-icon]>span,[data-slot=select-icon] svg{width:12px;height:12px;display:block}[data-slot=select-sizer]{visibility:hidden;height:0;font-size:13px;overflow:hidden}[data-slot=select-sizer] span{white-space:nowrap;border-inline:1px solid #0000;height:0;padding-block:0;padding-inline:8px 26px;display:block}[data-slot=select-viewport]{width:max-content;min-width:100%;max-height:none;overflow:hidden}[data-slot=select-rail]{pointer-events:none;flex:none;width:3px;margin-block:2px;margin-inline:0 1px;position:relative}[data-slot=select-thumb]{border-radius:${selectDef.vars["thumb-radius"]};background:${t.scroll};width:3px}[data-slot=select-item]{white-space:nowrap;text-align:start;border-radius:${t.radius.sm};width:auto;min-width:100%;color:inherit;cursor:pointer;font:inherit;background:0 0;border:none;padding:7px 10px;font-weight:400;display:block}[data-slot=select-item]:hover,[data-slot=select-item][data-highlighted]{background:${t.hover}}[data-slot=select-item][data-checked]{background:${t.hover.strong};color:${t.fg.bright}}[data-slot=select-item][data-checked]:hover,[data-slot=select-item][data-checked][data-highlighted]{background:${t.hover.strong}}[data-slot=select-viewport]:focus{outline:2px solid #0000}[data-slot=select-value][data-placeholder]{color:${t.fg.muted}}[data-slot=select-native]{clip-path:inset(50%);white-space:nowrap;pointer-events:none;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}[data-slot=select]{min-width:0;position:relative}[data-slot=select]:where(:not([hidden])){display:inline-block}[data-slot=select][data-fill]{width:100%}[data-slot=select]:not([data-fill]){flex:none;justify-self:start;width:100px}[data-slot=select][data-size=sm] [data-slot=select-trigger]{background:${t.surface.elev};border-radius:${t.radius.sm};height:28px;color:${t.fg};box-shadow:none;font-size:13px}[data-slot=select][data-size=sm] [data-slot=select-trigger]:focus{box-shadow:none;border-color:${t.fg.muted}}[data-slot=select][data-size=sm]:not([data-fill]){width:auto;max-width:200px}[data-slot~=select-content]{background:${t.bg};width:max-content;color:${t.fg};border-radius:${selectDef.vars["content-radius"]};box-shadow:${t.shadow};font:14px ${t.font};border:none;padding:4px;overflow:hidden}[data-slot~=select-content][data-size=sm]{background:${t.surface.overlay};font-size:13px}[data-slot~=select-content][data-scroll]{align-items:stretch;gap:2px;display:flex}[data-slot~=select-content][data-scroll] [data-slot=select-viewport]{scrollbar-width:none;flex:auto;min-width:min-content;max-height:240px;overflow-y:auto}[data-slot~=select-content][data-scroll] [data-slot=select-viewport]::-webkit-scrollbar{width:0;height:0;display:none}}`;
|
|
47
|
+
var injectStyles = defineStyles(SELECT_STYLE_ID, SELECT_CSS);
|
|
48
|
+
function syncThumb(list, thumb) {
|
|
49
|
+
const view = list.clientHeight;
|
|
50
|
+
const total = list.scrollHeight;
|
|
51
|
+
if (total <= view) {
|
|
52
|
+
thumb.style.height = "0";
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const thumbH = Math.max(20, view / total * view);
|
|
56
|
+
const top = list.scrollTop / (total - view) * (view - thumbH);
|
|
57
|
+
thumb.style.height = `${Math.round(thumbH)}px`;
|
|
58
|
+
thumb.style.transform = `translateY(${Math.round(top)}px`;
|
|
59
|
+
}
|
|
60
|
+
function fillSelectList(menu, options, current, onPick) {
|
|
61
|
+
injectStyles(menu.ownerDocument);
|
|
62
|
+
addSlot(menu, selectDef.slot("content"));
|
|
63
|
+
let picked = false;
|
|
64
|
+
const choose = (value) => {
|
|
65
|
+
const option = options.find((o) => o.value === value);
|
|
66
|
+
if (picked || !option) return;
|
|
67
|
+
picked = true;
|
|
68
|
+
onPick(option.value, option.label);
|
|
69
|
+
};
|
|
70
|
+
const items = options.map(
|
|
71
|
+
(p) => h("button", {
|
|
72
|
+
className: "vela-select-item",
|
|
73
|
+
slot: selectDef.slot("item"),
|
|
74
|
+
attrs: { type: "button", tabindex: -1 },
|
|
75
|
+
data: { checked: p.value === current ? "1" : null },
|
|
76
|
+
text: p.label,
|
|
77
|
+
on: {
|
|
78
|
+
click: (e) => {
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
choose(p.value);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
const viewport = h("div", { className: "vela-select-items", slot: selectDef.slot("viewport") }, items);
|
|
86
|
+
menu.replaceChildren(viewport);
|
|
87
|
+
const mid = nextUid("vela-select-list");
|
|
88
|
+
const known = options.some((o) => o.value === current);
|
|
89
|
+
const machine2 = runMachine(
|
|
90
|
+
zagListbox.machine,
|
|
91
|
+
{
|
|
92
|
+
id: mid,
|
|
93
|
+
collection: zagListbox.collection({ items: options, itemToValue: (o) => o.value, itemToString: (o) => o.label }),
|
|
94
|
+
selectionMode: "single",
|
|
95
|
+
defaultValue: known ? [current] : [],
|
|
96
|
+
defaultHighlightedValue: known ? current : null,
|
|
97
|
+
// The keyboard's pick (Enter) arrives here, a beat after the key.
|
|
98
|
+
onSelect: ({ value }) => choose(value)
|
|
99
|
+
},
|
|
100
|
+
(service) => {
|
|
101
|
+
const api = zagListbox.connect(service, normalizeProps);
|
|
102
|
+
spreadProps(viewport, api.getContentProps(), mid);
|
|
103
|
+
options.forEach((item, i) => spreadProps(items[i], api.getItemProps({ item, highlightOnHover: true }), mid));
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
viewport.addEventListener("keydown", (e) => {
|
|
107
|
+
if (e.key === "Enter" || e.key === " ") e.preventDefault();
|
|
108
|
+
});
|
|
109
|
+
return () => machine2.stop();
|
|
110
|
+
}
|
|
111
|
+
function decorateSelectScroll(menu) {
|
|
112
|
+
const list = menu.querySelector(`[data-slot='${selectDef.slot("viewport")}']`);
|
|
113
|
+
if (!list) return;
|
|
114
|
+
if (list.scrollHeight > 240) {
|
|
115
|
+
menu.classList.add("is-scroll");
|
|
116
|
+
menu.dataset.scroll = "";
|
|
117
|
+
const thumb = h("div", { className: "vela-select-thumb", slot: selectDef.slot("thumb") });
|
|
118
|
+
menu.appendChild(h("div", { className: "vela-select-rail", slot: selectDef.slot("rail") }, thumb));
|
|
119
|
+
list.addEventListener("scroll", () => syncThumb(list, thumb));
|
|
120
|
+
syncThumb(list, thumb);
|
|
121
|
+
}
|
|
122
|
+
menu.querySelector(`[data-slot='${selectDef.slot("item")}'][data-checked]`)?.scrollIntoView({ block: "nearest" });
|
|
123
|
+
list.dispatchEvent(new Event("scroll"));
|
|
124
|
+
}
|
|
125
|
+
function toggleSelectList(trigger, options, current, onPick, opts = {}) {
|
|
126
|
+
if (openPopoverTrigger() === trigger) {
|
|
127
|
+
closeOpenPopovers();
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
return openSelectList(trigger, options, current, onPick, opts);
|
|
131
|
+
}
|
|
132
|
+
function openSelectList(trigger, options, current, onPick, opts = {}) {
|
|
133
|
+
injectStyles(trigger.ownerDocument);
|
|
134
|
+
closeOpenPopovers();
|
|
135
|
+
let dispose = null;
|
|
136
|
+
const pop = new Popover({
|
|
137
|
+
trigger,
|
|
138
|
+
theme: opts.theme,
|
|
139
|
+
matchWidth: opts.matchWidth ?? true,
|
|
140
|
+
collisionBoundary: opts.collisionBoundary ?? opts.boundary,
|
|
141
|
+
boundaryInset: opts.boundaryInset,
|
|
142
|
+
side: opts.side,
|
|
143
|
+
sideOffset: opts.sideOffset ?? opts.gap ?? 4,
|
|
144
|
+
align: opts.align ?? "start",
|
|
145
|
+
alignOffset: opts.alignOffset,
|
|
146
|
+
avoidCollisions: opts.avoidCollisions,
|
|
147
|
+
collisionPadding: opts.collisionPadding,
|
|
148
|
+
host: opts.host,
|
|
149
|
+
position: opts.position,
|
|
150
|
+
zIndex: opts.zIndex,
|
|
151
|
+
className: "vela-select-list",
|
|
152
|
+
slot: selectDef.slot("content"),
|
|
153
|
+
onClose: () => {
|
|
154
|
+
dispose?.();
|
|
155
|
+
dispose = null;
|
|
156
|
+
const active = trigger.ownerDocument.activeElement;
|
|
157
|
+
if (opts.focusList && (!active || active === trigger.ownerDocument.body || pop.el.contains(active))) trigger.focus({ preventScroll: true });
|
|
158
|
+
opts.onClose?.();
|
|
159
|
+
},
|
|
160
|
+
content: (el) => {
|
|
161
|
+
if (opts.size) el.dataset.size = opts.size;
|
|
162
|
+
dispose = fillSelectList(el, options, current, (value, label) => {
|
|
163
|
+
pop.hide();
|
|
164
|
+
onPick(value, label);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
pop.show();
|
|
169
|
+
decorateSelectScroll(pop.el);
|
|
170
|
+
pop.reposition();
|
|
171
|
+
if (opts.focusList) pop.el.querySelector(`[data-slot='${selectDef.slot("viewport")}']`)?.focus({ preventScroll: true });
|
|
172
|
+
return pop;
|
|
173
|
+
}
|
|
174
|
+
var Select = class {
|
|
175
|
+
constructor(opts) {
|
|
176
|
+
this.list = null;
|
|
177
|
+
const doc = opts.list?.host?.ownerDocument ?? document;
|
|
178
|
+
injectStyles(doc);
|
|
179
|
+
this.ctrl = selectController(opts);
|
|
180
|
+
const placed = Object.fromEntries(
|
|
181
|
+
["side", "align", "sideOffset", "alignOffset", "avoidCollisions", "collisionPadding", "collisionBoundary"].filter((k) => opts[k] !== void 0).map((k) => [k, opts[k]])
|
|
182
|
+
);
|
|
183
|
+
this.listOpts = { ...opts.list, ...placed, theme: opts.theme ?? opts.list?.theme, size: this.ctrl.size };
|
|
184
|
+
this.placeholder = opts.placeholder;
|
|
185
|
+
const label = h("span", { className: "vela-select-label", slot: selectDef.slot("value") });
|
|
186
|
+
const btn = h(
|
|
187
|
+
"button",
|
|
188
|
+
{
|
|
189
|
+
className: "vela-select-trigger",
|
|
190
|
+
slot: selectDef.slot("trigger"),
|
|
191
|
+
attrs: { type: "button", id: opts.id, "aria-haspopup": "listbox", "aria-expanded": "false", "aria-required": opts.required ? "true" : void 0 }
|
|
192
|
+
},
|
|
193
|
+
label,
|
|
194
|
+
h("span", { className: "vela-select-chevron", slot: selectDef.slot("icon") }, iconEl("chevron-down", doc))
|
|
195
|
+
);
|
|
196
|
+
btn.disabled = this.ctrl.disabled;
|
|
197
|
+
const sizer = this.ctrl.size === "sm" ? h(
|
|
198
|
+
"div",
|
|
199
|
+
{ className: "vela-select-sizer", slot: selectDef.slot("sizer"), attrs: { "aria-hidden": "true" } },
|
|
200
|
+
this.ctrl.options.map((o) => h("span", { text: o.label }))
|
|
201
|
+
) : null;
|
|
202
|
+
this.native = opts.name !== void 0 ? h(
|
|
203
|
+
"select",
|
|
204
|
+
{ slot: selectDef.slot("native"), attrs: { name: opts.name, "aria-hidden": "true", tabindex: -1 } },
|
|
205
|
+
opts.placeholder !== void 0 ? h("option", { attrs: { value: "" } }) : null,
|
|
206
|
+
this.ctrl.options.map((o) => h("option", { attrs: { value: o.value }, text: o.label }))
|
|
207
|
+
) : null;
|
|
208
|
+
if (this.native) {
|
|
209
|
+
this.native.required = opts.required === true;
|
|
210
|
+
this.native.disabled = this.ctrl.disabled;
|
|
211
|
+
}
|
|
212
|
+
this.el = h("div", { className: "vela-select", slot: selectDef.slot("root"), attrs: selectVariants({ size: this.ctrl.size }), data: { fill: this.ctrl.fill } }, btn, sizer, this.native);
|
|
213
|
+
btn.addEventListener("pointerdown", (e) => {
|
|
214
|
+
e.preventDefault();
|
|
215
|
+
btn.focus({ preventScroll: true });
|
|
216
|
+
});
|
|
217
|
+
btn.addEventListener("click", (e) => {
|
|
218
|
+
e.stopPropagation();
|
|
219
|
+
this.toggle();
|
|
220
|
+
});
|
|
221
|
+
btn.addEventListener("keydown", (e) => {
|
|
222
|
+
if ((e.key === "ArrowDown" || e.key === "ArrowUp") && !this.list) {
|
|
223
|
+
e.preventDefault();
|
|
224
|
+
this.toggle();
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
this.trigger = btn;
|
|
228
|
+
this.labelEl = label;
|
|
229
|
+
this.paint();
|
|
230
|
+
this.release = ownTeardown(this.el, () => {
|
|
231
|
+
this.list?.hide();
|
|
232
|
+
this.list = null;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
get value() {
|
|
236
|
+
return this.ctrl.value;
|
|
237
|
+
}
|
|
238
|
+
setValue(v) {
|
|
239
|
+
this.ctrl.setValue(v);
|
|
240
|
+
this.paint();
|
|
241
|
+
}
|
|
242
|
+
/** The trigger shows the picked option's label, or the placeholder while none is picked. */
|
|
243
|
+
paint() {
|
|
244
|
+
const v = this.ctrl.value;
|
|
245
|
+
const empty = this.placeholder !== void 0 && !this.ctrl.options.some((o) => o.value === v);
|
|
246
|
+
this.labelEl.textContent = empty ? this.placeholder ?? "" : this.ctrl.labelOf(v);
|
|
247
|
+
this.labelEl.toggleAttribute("data-placeholder", empty);
|
|
248
|
+
if (this.native) this.native.value = empty ? "" : v;
|
|
249
|
+
}
|
|
250
|
+
toggle() {
|
|
251
|
+
this.list = toggleSelectList(
|
|
252
|
+
this.trigger,
|
|
253
|
+
this.ctrl.options,
|
|
254
|
+
this.ctrl.value,
|
|
255
|
+
(value) => {
|
|
256
|
+
this.ctrl.pick(value);
|
|
257
|
+
this.paint();
|
|
258
|
+
this.list = null;
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
...this.listOpts,
|
|
262
|
+
focusList: true,
|
|
263
|
+
onClose: () => {
|
|
264
|
+
this.list = null;
|
|
265
|
+
this.trigger.setAttribute("aria-expanded", "false");
|
|
266
|
+
this.listOpts.onClose?.();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
this.trigger.setAttribute("aria-expanded", String(this.list !== null));
|
|
271
|
+
}
|
|
272
|
+
destroy() {
|
|
273
|
+
this.release();
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
function createSelect(props) {
|
|
277
|
+
return new Select(props);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export { SELECT_CSS, SELECT_STYLE_ID, Select, createSelect, decorateSelectScroll, fillSelectList, openSelectList, selectController, selectDef, selectVariants, toggleSelectList };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { variants } from './chunk-LZWZV2ZS.js';
|
|
2
|
+
import { iconEl } from './chunk-G7IQLY3A.js';
|
|
3
|
+
import { h } from './chunk-Q6WTDVH6.js';
|
|
4
|
+
import { t } from './chunk-6QCILIT2.js';
|
|
5
|
+
import { defineComponent } from './chunk-VMCR3S2A.js';
|
|
6
|
+
import { css, defineStyles } from './chunk-IDA2BT7D.js';
|
|
7
|
+
|
|
8
|
+
// src/components/button.ts
|
|
9
|
+
var buttonDef = defineComponent({
|
|
10
|
+
name: "button",
|
|
11
|
+
parts: ["root", "icon"],
|
|
12
|
+
settings: {
|
|
13
|
+
radius: t.radius.md,
|
|
14
|
+
height: "34px",
|
|
15
|
+
"height-xs": "26px",
|
|
16
|
+
"height-sm": "30px",
|
|
17
|
+
"height-lg": "40px",
|
|
18
|
+
"font-size": "14px",
|
|
19
|
+
"font-size-xs": "12px",
|
|
20
|
+
"font-size-sm": "13px"
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
var buttonVariants = variants({
|
|
24
|
+
variant: ["default", "outline", "secondary", "ghost", "destructive", "link", "up", "down"],
|
|
25
|
+
size: ["default", "xs", "sm", "lg", "icon", "icon-xs", "icon-sm", "icon-lg"]
|
|
26
|
+
});
|
|
27
|
+
var BUTTON_STYLE_ID = "vela-ui-button";
|
|
28
|
+
var BUTTON_CSS = css`@layer vela.ui{[data-slot=button]{cursor:pointer;height:${buttonDef.vars.height};border-radius:${buttonDef.vars.radius};border:1px solid ${t.border.strong};color:${t.fg};font-weight:400;font-size:${buttonDef.vars["font-size"]};white-space:nowrap;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 11px;font-family:inherit}[data-slot=button]:where(:not([hidden])){justify-content:center;align-items:center;gap:6px;display:inline-flex}[data-slot=button]>[data-icon]{flex:none;width:1em;height:1em;font-size:16px}[data-slot=button]>[data-icon]>svg{width:100%;height:100%}[data-slot=button][data-size=xs]>[data-icon],[data-slot=button][data-size=icon-xs]>[data-icon]{font-size:12px}[data-slot=button][data-size=sm],[data-slot=button][data-size=icon-sm]{height:${buttonDef.vars["height-sm"]};font-size:${buttonDef.vars["font-size-sm"]}}[data-slot=button][data-size=xs],[data-slot=button][data-size=icon-xs]{height:${buttonDef.vars["height-xs"]};font-size:${buttonDef.vars["font-size-xs"]};border-radius:${t.radius.sm};padding:0 8px}[data-slot=button][data-size=lg],[data-slot=button][data-size=icon-lg]{height:${buttonDef.vars["height-lg"]};padding:0 14px}[data-slot=button][data-size=icon]{width:${buttonDef.vars.height};padding:0}[data-slot=button][data-size=icon-sm]{width:${buttonDef.vars["height-sm"]};padding:0}[data-slot=button][data-size=icon-xs]{width:${buttonDef.vars["height-xs"]};padding:0}[data-slot=button][data-size=icon-lg]{width:${buttonDef.vars["height-lg"]};padding:0}[data-slot=button]:disabled{cursor:default;opacity:.5}[data-slot=button]:focus-visible{outline:2px solid ${t.focus};outline-offset:1px}[data-slot=button]:not(:disabled):hover,[data-slot=button][aria-expanded=true]{background:${t.hover};color:${t.fg.bright};border-color:${t.fg.muted}}[data-slot=button][data-variant=default]{border-color:${t.selected.bg};background:${t.selected.bg};color:${t.selected.fg}}[data-slot=button][data-variant=default]:not(:disabled):hover,[data-slot=button][data-variant=default][aria-expanded=true]{background:${t.selected.bg};color:${t.selected.fg};opacity:.85;border-color:${t.selected.bg}}[data-slot=button][data-variant=secondary]{background:${t.surface.sunken};border-color:${t.border}}[data-slot=button][data-variant=secondary]:not(:disabled):hover,[data-slot=button][data-variant=secondary][aria-expanded=true]{border-color:${t.border.strong}}[data-slot=button][data-variant=ghost]{color:${t.fg.muted};border-color:#0000}[data-slot=button][data-variant=ghost]:not(:disabled):hover,[data-slot=button][data-variant=ghost][aria-expanded=true]{border-color:#0000}[data-slot=button][data-variant=destructive]{background:color-mix(in srgb, ${t.danger} 14%, transparent);color:${t.danger};border-color:#0000}[data-slot=button][data-variant=destructive]:not(:disabled):hover{background:color-mix(in srgb, ${t.danger} 24%, transparent);color:${t.danger};border-color:#0000}[data-slot=button][data-variant=link]{color:${t.accent};text-underline-offset:4px;background:0 0;border-color:#0000;padding-inline:0}[data-slot=button][data-variant=link]:not(:disabled):hover{color:${t.accent};background:0 0;border-color:#0000;text-decoration:underline}[data-slot=button][data-variant=up],[data-slot=button][data-variant=up]:not(:disabled):hover{background:${t.up};color:${t.fg.onFill};border-color:#0000}[data-slot=button][data-variant=down],[data-slot=button][data-variant=down]:not(:disabled):hover{background:${t.down};color:${t.fg.onFill};border-color:#0000}[data-slot=button][data-variant=up]:not(:disabled):hover,[data-slot=button][data-variant=down]:not(:disabled):hover{opacity:.88}[data-slot=button][data-pressed]{background:${t.active};color:${t.fg.bright}}}`;
|
|
29
|
+
var injectStyles = defineStyles(BUTTON_STYLE_ID, BUTTON_CSS);
|
|
30
|
+
var ButtonImpl = class {
|
|
31
|
+
constructor(props) {
|
|
32
|
+
injectStyles(document);
|
|
33
|
+
const { variant, size } = buttonVariants.resolve(props);
|
|
34
|
+
this.iconOnly = size.startsWith("icon");
|
|
35
|
+
this.label = props.label ?? props.text;
|
|
36
|
+
this.pressedState = props.pressed;
|
|
37
|
+
const icon = (id, side) => {
|
|
38
|
+
const el = iconEl(id, document);
|
|
39
|
+
el.dataset.slot = buttonDef.slot("icon");
|
|
40
|
+
el.dataset.icon = side;
|
|
41
|
+
return el;
|
|
42
|
+
};
|
|
43
|
+
this.textNode = !this.iconOnly && props.text !== void 0 ? document.createTextNode(props.text) : null;
|
|
44
|
+
this.el = h(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
className: props.className ? `vela-btn ${props.className}` : "vela-btn",
|
|
48
|
+
slot: buttonDef.slot("root"),
|
|
49
|
+
attrs: { type: "button", ...buttonVariants({ variant, size }) },
|
|
50
|
+
on: props.onClick ? { click: props.onClick } : void 0
|
|
51
|
+
},
|
|
52
|
+
props.icon ? icon(props.icon, "inline-start") : null,
|
|
53
|
+
this.textNode,
|
|
54
|
+
props.iconEnd && !this.iconOnly ? icon(props.iconEnd, "inline-end") : null
|
|
55
|
+
);
|
|
56
|
+
this.el.disabled = props.disabled ?? false;
|
|
57
|
+
this.paint();
|
|
58
|
+
}
|
|
59
|
+
get pressed() {
|
|
60
|
+
return this.pressedState;
|
|
61
|
+
}
|
|
62
|
+
setPressed(pressed) {
|
|
63
|
+
this.pressedState = pressed;
|
|
64
|
+
this.paint();
|
|
65
|
+
}
|
|
66
|
+
setDisabled(disabled) {
|
|
67
|
+
this.el.disabled = disabled;
|
|
68
|
+
}
|
|
69
|
+
setText(text) {
|
|
70
|
+
this.label = text;
|
|
71
|
+
if (this.textNode) this.textNode.data = text;
|
|
72
|
+
this.paint();
|
|
73
|
+
}
|
|
74
|
+
destroy() {
|
|
75
|
+
}
|
|
76
|
+
paint() {
|
|
77
|
+
const el = this.el;
|
|
78
|
+
el.toggleAttribute("data-pressed", this.pressedState === true);
|
|
79
|
+
if (this.pressedState === void 0) el.removeAttribute("aria-pressed");
|
|
80
|
+
else el.setAttribute("aria-pressed", String(this.pressedState));
|
|
81
|
+
if (this.iconOnly && this.label !== void 0) el.setAttribute("aria-label", this.label);
|
|
82
|
+
else el.removeAttribute("aria-label");
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
function createButton(props = {}) {
|
|
86
|
+
return new ButtonImpl(props);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { BUTTON_CSS, BUTTON_STYLE_ID, buttonDef, buttonVariants, createButton };
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
|
|
7
|
+
// src/components/text-area.ts
|
|
8
|
+
function textAreaController(opts = {}) {
|
|
9
|
+
let value = opts.value ?? opts.defaultValue ?? "";
|
|
10
|
+
return {
|
|
11
|
+
get value() {
|
|
12
|
+
return value;
|
|
13
|
+
},
|
|
14
|
+
size: opts.size ?? "md",
|
|
15
|
+
rows: opts.rows ?? 3,
|
|
16
|
+
disabled: opts.disabled ?? false,
|
|
17
|
+
commit(next) {
|
|
18
|
+
if (next === value) return null;
|
|
19
|
+
value = next;
|
|
20
|
+
opts.onChange?.(next);
|
|
21
|
+
return next;
|
|
22
|
+
},
|
|
23
|
+
sync(next) {
|
|
24
|
+
value = next;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
var textAreaDef = defineComponent({
|
|
29
|
+
name: "text-area",
|
|
30
|
+
parts: ["root", "input"],
|
|
31
|
+
settings: { radius: t.radius.md, "focus-ring": `0 0 0 3px ${t.focus.soft}` }
|
|
32
|
+
});
|
|
33
|
+
var textAreaVariants = variants({ size: ["md", "sm"] });
|
|
34
|
+
var injectStyles = defineStyles(
|
|
35
|
+
"vela-ui-textarea",
|
|
36
|
+
css`@layer vela.ui{[data-slot=text-area-input]{box-sizing:border-box;border:1px solid ${t.border.strong};border-radius:${textAreaDef.vars.radius};width:100%;min-height:64px;color:${t.fg.bright};resize:vertical;transition:border-color ${t.dur.fast} ease, box-shadow ${t.dur.fast} ease;-webkit-user-select:text;user-select:text;background:0 0;outline:2px solid #0000;padding:8px;font-family:inherit;font-size:14px;line-height:1.4;display:block}[data-slot=text-area-input]:hover{border-color:${t.fg.muted}}[data-slot=text-area-input]:focus{border-color:${t.focus};box-shadow:${textAreaDef.vars["focus-ring"]}}[data-slot=text-area-input]::placeholder{color:currentColor;opacity:.4}[data-slot=text-area]{width:100%;min-width:0}[data-slot=text-area]:where(:not([hidden])){display:block}[data-slot=text-area][data-autogrow] [data-slot=text-area-input]{resize:none;min-height:46px;overflow-y:hidden}[data-slot=text-area][data-size=sm] [data-slot=text-area-input]{min-height:46px;padding:6px 9px;font-size:13px;line-height:18px}}`
|
|
37
|
+
);
|
|
38
|
+
var TextArea = class {
|
|
39
|
+
constructor(opts = {}) {
|
|
40
|
+
injectStyles(document);
|
|
41
|
+
this.ctrl = textAreaController(opts);
|
|
42
|
+
this.autoGrow = opts.autoGrow === true;
|
|
43
|
+
this.maxLines = opts.maxLines ?? 4;
|
|
44
|
+
const ta = h("textarea", { className: "vela-textarea-field", slot: textAreaDef.slot("input"), attrs: { id: opts.id, placeholder: opts.placeholder, name: opts.name } });
|
|
45
|
+
ta.required = opts.required === true;
|
|
46
|
+
ta.rows = this.ctrl.rows;
|
|
47
|
+
ta.value = this.ctrl.value;
|
|
48
|
+
ta.disabled = this.ctrl.disabled;
|
|
49
|
+
ta.addEventListener("blur", () => {
|
|
50
|
+
this.ctrl.commit(ta.value);
|
|
51
|
+
});
|
|
52
|
+
if (this.autoGrow) ta.addEventListener("input", () => this.grow());
|
|
53
|
+
this.el = h("div", { className: "vela-textarea", slot: textAreaDef.slot("root"), attrs: textAreaVariants({ size: this.ctrl.size }), data: { autogrow: this.autoGrow } }, ta);
|
|
54
|
+
this.input = ta;
|
|
55
|
+
if (this.autoGrow) this.grow();
|
|
56
|
+
}
|
|
57
|
+
get value() {
|
|
58
|
+
return this.ctrl.value;
|
|
59
|
+
}
|
|
60
|
+
setValue(v) {
|
|
61
|
+
this.ctrl.sync(v);
|
|
62
|
+
this.input.value = v;
|
|
63
|
+
if (this.autoGrow) this.grow();
|
|
64
|
+
}
|
|
65
|
+
destroy() {
|
|
66
|
+
}
|
|
67
|
+
grow() {
|
|
68
|
+
const ta = this.input;
|
|
69
|
+
const lh = parseFloat(getComputedStyle(ta).lineHeight) || 18;
|
|
70
|
+
const pad = ta.clientHeight - (ta.offsetHeight ? lh * (ta.rows || 1) : 0);
|
|
71
|
+
const max = lh * this.maxLines + (Number.isFinite(pad) && pad > 0 ? pad : 12);
|
|
72
|
+
ta.style.height = "auto";
|
|
73
|
+
ta.style.height = `${Math.min(ta.scrollHeight, max)}px`;
|
|
74
|
+
ta.style.overflowY = ta.scrollHeight > max ? "auto" : "hidden";
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
function createTextArea(props = {}) {
|
|
78
|
+
return new TextArea(props);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { TextArea, createTextArea, textAreaController, textAreaDef, textAreaVariants };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/lib/i18n.ts
|
|
2
|
+
function msg(id, defaultMessage) {
|
|
3
|
+
return Object.freeze({ id, defaultMessage });
|
|
4
|
+
}
|
|
5
|
+
function textOf(i18n, message) {
|
|
6
|
+
if (i18n) return i18n.t(message);
|
|
7
|
+
return typeof message === "string" ? message : message.defaultMessage;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { msg, textOf };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { pageState } from './chunk-X66RJAIS.js';
|
|
2
|
+
|
|
3
|
+
// src/lib/kit-text.ts
|
|
4
|
+
var scope = pageState("kit-text@1", () => ({ current: null }));
|
|
5
|
+
function withKitTranslator(i18n, build) {
|
|
6
|
+
const previous = scope.current;
|
|
7
|
+
scope.current = i18n ?? null;
|
|
8
|
+
try {
|
|
9
|
+
return build();
|
|
10
|
+
} finally {
|
|
11
|
+
scope.current = previous;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function kitTranslator() {
|
|
15
|
+
return scope.current;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { kitTranslator, withKitTranslator };
|