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