vlite3 0.7.13 → 0.7.15

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.
Files changed (58) hide show
  1. package/components/Button.vue.js +1 -1
  2. package/components/ColorPicker/ColorIro.vue3.js +2 -2
  3. package/components/ColorPicker/ColorPicker.vue.js +18 -17
  4. package/components/{CommandPaletteContent.vue.d.ts → CommandPalette/CommandPaletteContent.vue.d.ts} +3 -3
  5. package/components/CommandPalette/CommandPaletteContent.vue.js +7 -0
  6. package/components/CommandPalette/CommandPaletteContent.vue2.js +180 -0
  7. package/components/CommandPalette/CommandPaletteItem.vue.d.ts +15 -0
  8. package/components/CommandPalette/CommandPaletteItem.vue2.js +7 -0
  9. package/components/CommandPalette/CommandPaletteItem.vue3.js +60 -0
  10. package/components/CommandPalette/index.d.ts +5 -0
  11. package/components/CommandPalette/types.d.ts +40 -0
  12. package/components/CommandPalette/useCommandPaletteItems.d.ts +15 -0
  13. package/components/CommandPalette/useCommandPaletteItems.js +99 -0
  14. package/components/CommandPalette/useCommandPaletteNav.d.ts +13 -0
  15. package/components/CommandPalette/useCommandPaletteNav.js +49 -0
  16. package/components/DataList/DataList.vue.js +53 -50
  17. package/components/DataTable/DataTable.vue.js +185 -173
  18. package/components/DatePicker.vue.js +3 -2
  19. package/components/DateRangePicker.vue.js +26 -25
  20. package/components/Dropdown/Dropdown.vue.js +20 -20
  21. package/components/Dropdown/DropdownMenu.vue.js +5 -256
  22. package/components/Dropdown/DropdownMenu.vue2.js +256 -2
  23. package/components/Form/CustomFields.vue.js +1 -1
  24. package/components/Form/CustomFields.vue2.js +102 -97
  25. package/components/Form/Form.vue.d.ts +0 -1
  26. package/components/Form/Form.vue.js +2 -2
  27. package/components/Form/Form.vue2.js +20 -20
  28. package/components/Form/FormFields.vue.js +2 -2
  29. package/components/Form/FormFields.vue2.js +90 -78
  30. package/components/IconPicker.vue.js +3 -2
  31. package/components/ImportData/ImportStep2.vue.js +10 -9
  32. package/components/List/List.vue.js +205 -180
  33. package/components/Modal.vue.js +2 -2
  34. package/components/Modal.vue2.js +82 -96
  35. package/components/MultiSelect/MultiSelect.vue.js +7 -7
  36. package/components/Navbar/Navbar.vue.js +12 -12
  37. package/components/NavbarCommandPalette.vue.d.ts +7 -30
  38. package/components/NavbarCommandPalette.vue.js +40 -40
  39. package/components/PermissionMatrix/PermissionEditorList.vue.js +1 -1
  40. package/components/PermissionMatrix/PermissionEditorList.vue2.js +84 -75
  41. package/components/PermissionMatrix/PermissionEditorMatrix.vue.js +2 -2
  42. package/components/PermissionMatrix/PermissionEditorMatrix.vue2.js +122 -107
  43. package/components/PermissionMatrix/PermissionMatrix.vue.js +2 -2
  44. package/components/PermissionMatrix/PermissionMatrix.vue2.js +161 -138
  45. package/components/PermissionMatrix/PermissionTopBar.vue.js +19 -18
  46. package/components/Screen/Screen.vue.js +169 -166
  47. package/components/Screen/ScreenFilter.vue.js +4 -3
  48. package/components/SidePanel.vue.js +5 -146
  49. package/components/SidePanel.vue2.js +146 -2
  50. package/components/SidebarMenu/SidebarMenuItem.vue.js +26 -25
  51. package/components/Workbook/Sheet.vue.js +3 -2
  52. package/index.d.ts +1 -1
  53. package/index.js +1 -1
  54. package/package.json +1 -1
  55. package/style.css +1 -1
  56. package/components/CommandPaletteContent.vue.js +0 -7
  57. package/components/CommandPaletteContent.vue2.js +0 -311
  58. /package/components/ColorPicker/{ColorIro.vue.js → ColorIro.vue2.js} +0 -0
@@ -1,311 +0,0 @@
1
- import { defineComponent as Z, computed as c, ref as _, watch as ee, onMounted as te, nextTick as G, openBlock as u, createElementBlock as f, createElementVNode as s, createVNode as w, withDirectives as oe, vModelText as ne, createTextVNode as I, toDisplayString as i, createCommentVNode as b, Fragment as P, renderList as O, normalizeClass as T, createBlock as re } from "vue";
2
- import { useRouter as le } from "vue-router";
3
- import h from "./Icon.vue.js";
4
- import { $t as C } from "../utils/i18n.js";
5
- const se = { class: "command-palette-content flex flex-col w-full h-full max-h-[70vh]" }, ae = { class: "flex items-center gap-3 px-4 py-3.5 border-b border-border/60 shrink-0" }, ce = ["placeholder", "aria-activedescendant"], ie = ["aria-label"], de = {
6
- key: 0,
7
- class: "flex flex-col items-center justify-center py-14 px-6 text-center select-none",
8
- "aria-live": "polite"
9
- }, ue = { class: "text-sm font-medium text-muted-foreground" }, fe = { class: "text-foreground font-semibold" }, pe = { class: "text-xs text-muted-foreground/60 mt-1" }, me = ["aria-label"], xe = ["aria-label"], ve = ["id", "aria-selected", "aria-disabled", "data-active", "onClick", "onMouseenter"], be = { class: "flex-1 min-w-0" }, he = { class: "block font-medium truncate text-inherit leading-tight" }, ge = {
10
- key: 0,
11
- class: "block text-xs text-muted-foreground/70 truncate mt-0.5"
12
- }, ye = {
13
- key: 1,
14
- class: "shrink-0 hidden sm:inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-mono border border-border/60 bg-background/80 text-muted-foreground ml-1"
15
- }, ke = {
16
- key: 0,
17
- class: "my-1.5 mx-3 h-px bg-border/40",
18
- "aria-hidden": "true"
19
- }, _e = {
20
- class: "px-4 py-2.5 border-t border-border/40 flex items-center gap-4 shrink-0 bg-muted/30",
21
- "aria-hidden": "true"
22
- }, we = { class: "flex items-center gap-1 text-[11px] text-muted-foreground/60" }, Ie = { class: "flex items-center gap-1 text-[11px] text-muted-foreground/60" }, Ce = { class: "flex items-center gap-1 text-[11px] text-muted-foreground/60" }, Me = { class: "ml-auto text-[11px] text-muted-foreground/50" }, Be = /* @__PURE__ */ Z({
23
- __name: "CommandPaletteContent",
24
- props: {
25
- close: { type: Function },
26
- items: {},
27
- menuItems: {},
28
- placeholder: {},
29
- placeholderI18n: {},
30
- maxResultsPerGroup: {},
31
- onOpenDynamicModal: { type: Function }
32
- },
33
- setup(M) {
34
- const d = M, p = (t, o) => {
35
- const n = C(t);
36
- return n !== t ? n : o;
37
- }, j = c(() => {
38
- if (d.placeholderI18n) {
39
- const t = C(d.placeholderI18n);
40
- if (t !== d.placeholderI18n) return t;
41
- }
42
- return d.placeholder;
43
- }), z = c(() => p("vlite.commandPalette.noResults", "No results for")), L = c(
44
- () => p("vlite.commandPalette.noResultsDesc", "Try a different term or browse with arrow keys")
45
- ), K = c(() => p("vlite.commandPalette.navigate", "Navigate")), U = c(() => p("vlite.commandPalette.open", "Open")), W = c(() => p("vlite.commandPalette.close", "Close")), R = c(() => p("vlite.commandPalette.result", "result")), D = c(() => p("vlite.commandPalette.results", "results"));
46
- function N(t) {
47
- if (t.labelI18n) {
48
- const o = C(t.labelI18n);
49
- if (o !== t.labelI18n) return o;
50
- }
51
- return t.label;
52
- }
53
- function B(t) {
54
- if (t.descriptionI18n) {
55
- const o = C(t.descriptionI18n);
56
- if (o !== t.descriptionI18n) return o;
57
- }
58
- return t.description ?? "";
59
- }
60
- const v = _(""), a = _(0), $ = _(null), S = _(null), H = le();
61
- function E(t) {
62
- return typeof t == "function" ? t() : t !== void 0 ? t : !0;
63
- }
64
- function V(t, o, n = 0) {
65
- const r = [];
66
- for (const e of t) {
67
- if (!E(e.show)) continue;
68
- const l = n === 0 ? e.label : o ?? "Navigation";
69
- (e.to || e.href || e.action || e.modalBody) && r.push({
70
- ...e,
71
- id: e.id ?? e.to ?? e.label ?? Math.random().toString(),
72
- group: e.group ?? l
73
- }), e.children?.length && r.push(...V(e.children, l, n + 1));
74
- }
75
- return r;
76
- }
77
- function q(t, o, n = 0) {
78
- const r = [];
79
- for (const e of t) {
80
- if (!E(e.show)) continue;
81
- const l = n === 0 ? e.label : o ?? "Navigation";
82
- (e.to || e.href || e.action || e.modalBody) && r.push({
83
- id: e.id ?? (typeof e.to == "string" ? e.to : "") ?? e.label ?? Math.random().toString(),
84
- label: e.label,
85
- labelI18n: e.labelI18n,
86
- icon: e.icon,
87
- group: e.group ?? l,
88
- to: typeof e.to == "string" ? e.to : e.to?.path,
89
- href: e.href,
90
- action: e.action ? () => e.action(e) : void 0,
91
- disabled: e.disabled,
92
- modalBody: e.modalBody,
93
- modalProps: e.modalProps
94
- }), e.children?.length && r.push(...q(e.children, l, n + 1));
95
- }
96
- return r;
97
- }
98
- const J = c(() => {
99
- const t = q(d.menuItems || []), o = V(d.items || []), n = /* @__PURE__ */ new Set(), r = [];
100
- for (const e of [...o, ...t])
101
- e.id && !n.has(e.id) && (n.add(e.id), r.push(e));
102
- return r;
103
- });
104
- function g(t) {
105
- return t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
106
- }
107
- function Q(t, o) {
108
- const n = g(N(t)), r = g(B(t)), e = (t.keywords ?? []).map(g).join(" "), l = g(o);
109
- return n === l ? 100 : n.startsWith(l) ? 80 : n.includes(l) ? 60 : r.includes(l) || e.includes(l) ? 40 : 0;
110
- }
111
- const y = c(() => {
112
- const t = v.value.trim();
113
- let o = J.value.filter((e) => !e.disabled);
114
- t && (o = o.map((e) => ({ item: e, s: Q(e, t) })).filter(({ s: e }) => e > 0).sort((e, l) => l.s - e.s).map(({ item: e }) => e));
115
- const n = /* @__PURE__ */ new Map();
116
- for (const e of o) {
117
- const l = e.group ?? "Actions";
118
- n.has(l) || n.set(l, []), n.get(l).push(e);
119
- }
120
- const r = [];
121
- for (const [e, l] of n)
122
- r.push({
123
- key: e,
124
- label: e,
125
- items: l.slice(0, d.maxResultsPerGroup)
126
- });
127
- return r;
128
- }), k = c(() => y.value.flatMap((t) => t.items)), m = c(() => k.value.length), X = (t) => {
129
- if (t.key === "Escape") {
130
- d.close();
131
- return;
132
- }
133
- if (t.key === "ArrowDown") {
134
- t.preventDefault(), a.value = Math.min(a.value + 1, m.value - 1), A();
135
- return;
136
- }
137
- if (t.key === "ArrowUp") {
138
- t.preventDefault(), a.value = Math.max(a.value - 1, 0), A();
139
- return;
140
- }
141
- if (t.key === "Enter") {
142
- t.preventDefault();
143
- const o = k.value[a.value];
144
- o && F(o);
145
- }
146
- }, A = () => {
147
- G(() => {
148
- S.value?.querySelector('[data-active="true"]')?.scrollIntoView({ block: "nearest" });
149
- });
150
- };
151
- ee(v, () => {
152
- a.value = 0;
153
- });
154
- const F = (t) => {
155
- if (!t.disabled) {
156
- if (d.close(), t.modalBody) {
157
- d.onOpenDynamicModal(t.modalBody, t.modalProps);
158
- return;
159
- }
160
- if (t.action) {
161
- t.action();
162
- return;
163
- }
164
- if (t.to) {
165
- H.push(t.to).catch(() => {
166
- });
167
- return;
168
- }
169
- t.href && window.open(t.href, "_blank", "noopener,noreferrer");
170
- }
171
- }, x = (t, o) => {
172
- let n = 0;
173
- for (let r = 0; r < t; r++)
174
- n += y.value[r].items.length;
175
- return n + o;
176
- };
177
- return te(() => {
178
- G(() => {
179
- $.value?.focus();
180
- });
181
- }), (t, o) => (u(), f("div", se, [
182
- s("div", ae, [
183
- w(h, {
184
- icon: "lucide:search",
185
- class: "w-4 h-4 text-muted-foreground shrink-0"
186
- }),
187
- oe(s("input", {
188
- ref_key: "inputRef",
189
- ref: $,
190
- "onUpdate:modelValue": o[0] || (o[0] = (n) => v.value = n),
191
- type: "text",
192
- autocomplete: "off",
193
- autocorrect: "off",
194
- spellcheck: "false",
195
- placeholder: j.value,
196
- class: "flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/60 outline-none min-w-0",
197
- "aria-autocomplete": "list",
198
- "aria-activedescendant": k.value[a.value] ? `cp-item-${k.value[a.value].id}` : void 0,
199
- "aria-controls": "cp-listbox",
200
- onKeydown: X
201
- }, null, 40, ce), [
202
- [ne, v.value]
203
- ]),
204
- s("button", {
205
- type: "button",
206
- class: "shrink-0 p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
207
- "aria-label": "Close",
208
- tabindex: "-1",
209
- onClick: o[1] || (o[1] = //@ts-ignore
210
- (...n) => M.close && M.close(...n))
211
- }, [
212
- w(h, {
213
- icon: "lucide:x",
214
- class: "w-3.5 h-3.5"
215
- })
216
- ])
217
- ]),
218
- s("div", {
219
- id: "cp-listbox",
220
- ref_key: "listRef",
221
- ref: S,
222
- role: "listbox",
223
- class: "flex-1 overflow-y-auto py-2 scrollbar-thin",
224
- "aria-label": `${m.value} ${m.value === 1 ? R.value : D.value}`
225
- }, [
226
- m.value === 0 ? (u(), f("div", de, [
227
- w(h, {
228
- icon: "lucide:search-x",
229
- class: "w-9 h-9 text-muted-foreground/40 mb-3"
230
- }),
231
- s("p", ue, [
232
- I(i(z.value) + " ", 1),
233
- s("span", fe, '"' + i(v.value) + '"', 1)
234
- ]),
235
- s("p", pe, i(L.value), 1)
236
- ])) : b("", !0),
237
- (u(!0), f(P, null, O(y.value, (n, r) => (u(), f(P, {
238
- key: n.key
239
- }, [
240
- s("div", {
241
- class: "px-4 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60 select-none",
242
- "aria-label": `Group: ${n.label}`
243
- }, i(n.label), 9, me),
244
- s("div", {
245
- role: "group",
246
- "aria-label": n.label,
247
- class: "px-2"
248
- }, [
249
- (u(!0), f(P, null, O(n.items, (e, l) => (u(), f("button", {
250
- key: e.id,
251
- id: `cp-item-${e.id}`,
252
- type: "button",
253
- role: "option",
254
- "aria-selected": x(r, l) === a.value,
255
- "aria-disabled": e.disabled || void 0,
256
- "data-active": x(r, l) === a.value,
257
- class: T(["command-palette-item w-full flex items-center gap-3 px-3! py-2.5 mx-1 rounded-lg text-sm transition-colors duration-100 text-left cursor-pointer select-none focus-visible:outline-none", [
258
- x(r, l) === a.value ? "bg-gray-200/80 text-foreground" : "text-muted-foreground hover:bg-muted/70 hover:text-foreground",
259
- e.disabled ? "opacity-40 cursor-not-allowed" : ""
260
- ]]),
261
- style: { width: "calc(100% - 8px)" },
262
- onClick: (Y) => F(e),
263
- onMouseenter: (Y) => a.value = x(r, l)
264
- }, [
265
- s("span", {
266
- class: T([
267
- "shrink-0 flex items-center justify-center w-7 h-7 rounded-md",
268
- x(r, l) === a.value ? "bg-gray-300/80 text-gray-900" : "bg-muted/80 text-muted-foreground"
269
- ])
270
- }, [
271
- w(h, {
272
- icon: e.icon ?? "lucide:arrow-right",
273
- class: "w-3.5 h-3.5"
274
- }, null, 8, ["icon"])
275
- ], 2),
276
- s("span", be, [
277
- s("span", he, i(N(e)), 1),
278
- e.description || e.descriptionI18n ? (u(), f("span", ge, i(B(e)), 1)) : b("", !0)
279
- ]),
280
- e.href ? (u(), re(h, {
281
- key: 0,
282
- icon: "lucide:external-link",
283
- class: "shrink-0 w-3 h-3 text-muted-foreground/50"
284
- })) : b("", !0),
285
- x(r, l) === a.value ? (u(), f("kbd", ye, " ↵ ")) : b("", !0)
286
- ], 42, ve))), 128))
287
- ], 8, xe),
288
- r < y.value.length - 1 ? (u(), f("div", ke)) : b("", !0)
289
- ], 64))), 128))
290
- ], 8, ie),
291
- s("div", _e, [
292
- s("span", we, [
293
- o[2] || (o[2] = s("kbd", { class: "px-1 rounded border border-border/60 bg-background text-[10px]" }, "↑↓", -1)),
294
- I(" " + i(K.value), 1)
295
- ]),
296
- s("span", Ie, [
297
- o[3] || (o[3] = s("kbd", { class: "px-1 rounded border border-border/60 bg-background text-[10px]" }, "↵", -1)),
298
- I(" " + i(U.value), 1)
299
- ]),
300
- s("span", Ce, [
301
- o[4] || (o[4] = s("kbd", { class: "px-1 rounded border border-border/60 bg-background text-[10px]" }, "Esc", -1)),
302
- I(" " + i(W.value), 1)
303
- ]),
304
- s("span", Me, i(m.value) + " " + i(m.value === 1 ? R.value : D.value), 1)
305
- ])
306
- ]));
307
- }
308
- });
309
- export {
310
- Be as default
311
- };