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.
@@ -1,25 +1,25 @@
1
- import { defineComponent as X, computed as c, ref as _, watch as Y, onMounted as Z, nextTick as T, openBlock as i, createElementBlock as f, createElementVNode as l, createVNode as w, withDirectives as ee, vModelText as te, createTextVNode as I, toDisplayString as u, createCommentVNode as b, Fragment as M, renderList as j, normalizeClass as z, createBlock as oe } from "vue";
2
- import { useRouter as ne } from "vue-router";
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 re = { class: "command-palette-content flex flex-col w-full h-full max-h-[70vh]" }, se = { class: "flex items-center gap-3 px-4 py-3.5 border-b border-border/60 shrink-0" }, le = ["placeholder", "aria-activedescendant"], ae = ["aria-label"], ce = {
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" }, ie = { class: "text-foreground font-semibold" }, de = { class: "text-xs text-muted-foreground/60 mt-1" }, fe = ["aria-label"], pe = ["aria-label"], me = ["id", "aria-selected", "aria-disabled", "data-active", "onClick", "onMouseenter"], xe = { class: "flex-1 min-w-0" }, ve = { class: "block font-medium truncate text-inherit leading-tight" }, be = {
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
- }, he = {
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
- }, ge = {
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
- }, ke = {
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
- }, ye = { class: "flex items-center gap-1 text-[11px] text-muted-foreground/60" }, _e = { class: "flex items-center gap-1 text-[11px] text-muted-foreground/60" }, we = { class: "flex items-center gap-1 text-[11px] text-muted-foreground/60" }, Ie = { class: "ml-auto text-[11px] text-muted-foreground/50" }, Pe = /* @__PURE__ */ X({
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(R) {
33
- const d = R, p = (t, o) => {
33
+ setup(M) {
34
+ const d = M, p = (t, o) => {
34
35
  const n = C(t);
35
36
  return n !== t ? n : o;
36
- }, B = c(() => {
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
- }), F = c(() => p("vlite.commandPalette.noResults", "No results for")), L = c(
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
- ), S = c(() => p("vlite.commandPalette.navigate", "Navigate")), K = c(() => p("vlite.commandPalette.open", "Open")), O = c(() => p("vlite.commandPalette.close", "Close")), N = c(() => p("vlite.commandPalette.result", "result")), P = c(() => p("vlite.commandPalette.results", "results"));
45
- function D(t) {
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 $(t) {
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), E = _(null), V = _(null), U = ne();
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
- const s = n === 0 ? e.label : o ?? "Navigation";
64
- (e.to || e.href || e.action) && r.push({
65
- id: e.id ?? (typeof e.to == "string" ? e.to : "") ?? e.label,
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: s,
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
- }), e.children?.length && r.push(...q(e.children, s, n + 1));
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 W = c(() => {
79
- const t = q(d.menuItems), o = /* @__PURE__ */ new Set(), n = [];
80
- for (const r of [...d.items, ...t])
81
- o.has(r.id) || (o.add(r.id), n.push(r));
82
- return n;
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 H(t, o) {
88
- const n = g(D(t)), r = g($(t)), e = (t.keywords ?? []).map(g).join(" "), s = g(o);
89
- return n === s ? 100 : n.startsWith(s) ? 80 : n.includes(s) ? 60 : r.includes(s) || e.includes(s) ? 40 : 0;
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 k = c(() => {
111
+ const y = c(() => {
92
112
  const t = v.value.trim();
93
- let o = W.value.filter((e) => !e.disabled);
94
- t && (o = o.map((e) => ({ item: e, s: H(e, t) })).filter(({ s: e }) => e > 0).sort((e, s) => s.s - e.s).map(({ item: e }) => e));
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 s = e.group ?? "Actions";
98
- n.has(s) || n.set(s, []), n.get(s).push(e);
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, s] of n)
121
+ for (const [e, l] of n)
102
122
  r.push({
103
123
  key: e,
104
124
  label: e,
105
- items: s.slice(0, d.maxResultsPerGroup)
125
+ items: l.slice(0, d.maxResultsPerGroup)
106
126
  });
107
127
  return r;
108
- }), y = c(() => k.value.flatMap((t) => t.items)), m = c(() => y.value.length), J = (t) => {
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 = y.value[a.value];
124
- o && G(o);
143
+ const o = k.value[a.value];
144
+ o && F(o);
125
145
  }
126
146
  }, A = () => {
127
- T(() => {
128
- V.value?.querySelector('[data-active="true"]')?.scrollIntoView({ block: "nearest" });
147
+ G(() => {
148
+ S.value?.querySelector('[data-active="true"]')?.scrollIntoView({ block: "nearest" });
129
149
  });
130
150
  };
131
- Y(v, () => {
151
+ ee(v, () => {
132
152
  a.value = 0;
133
153
  });
134
- const G = (t) => {
154
+ const F = (t) => {
135
155
  if (!t.disabled) {
136
- if (d.close(), t.action) {
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
- U.push(t.to).catch(() => {
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 += k.value[r].items.length;
174
+ n += y.value[r].items.length;
151
175
  return n + o;
152
176
  };
153
- return Z(() => {
154
- T(() => {
155
- E.value?.focus();
177
+ return te(() => {
178
+ G(() => {
179
+ $.value?.focus();
156
180
  });
157
- }), (t, o) => (i(), f("div", re, [
158
- l("div", se, [
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
- ee(l("input", {
187
+ oe(s("input", {
164
188
  ref_key: "inputRef",
165
- ref: E,
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: B.value,
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": y.value[a.value] ? `cp-item-${y.value[a.value].id}` : void 0,
198
+ "aria-activedescendant": k.value[a.value] ? `cp-item-${k.value[a.value].id}` : void 0,
175
199
  "aria-controls": "cp-listbox",
176
- onKeydown: J
177
- }, null, 40, le), [
178
- [te, v.value]
200
+ onKeydown: X
201
+ }, null, 40, ce), [
202
+ [ne, v.value]
179
203
  ]),
180
- l("button", {
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) => R.close && R.close(...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
- l("div", {
218
+ s("div", {
195
219
  id: "cp-listbox",
196
220
  ref_key: "listRef",
197
- ref: V,
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 ? N.value : P.value}`
224
+ "aria-label": `${m.value} ${m.value === 1 ? R.value : D.value}`
201
225
  }, [
202
- m.value === 0 ? (i(), f("div", ce, [
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
- l("p", ue, [
208
- I(u(F.value) + " ", 1),
209
- l("span", ie, '"' + u(v.value) + '"', 1)
231
+ s("p", ue, [
232
+ I(i(z.value) + " ", 1),
233
+ s("span", fe, '"' + i(v.value) + '"', 1)
210
234
  ]),
211
- l("p", de, u(L.value), 1)
235
+ s("p", pe, i(L.value), 1)
212
236
  ])) : b("", !0),
213
- (i(!0), f(M, null, j(k.value, (n, r) => (i(), f(M, {
237
+ (u(!0), f(P, null, O(y.value, (n, r) => (u(), f(P, {
214
238
  key: n.key
215
239
  }, [
216
- l("div", {
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
- }, u(n.label), 9, fe),
220
- l("div", {
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
- (i(!0), f(M, null, j(n.items, (e, s) => (i(), f("button", {
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, s) === a.value,
254
+ "aria-selected": x(r, l) === a.value,
231
255
  "aria-disabled": e.disabled || void 0,
232
- "data-active": x(r, s) === a.value,
233
- class: z(["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", [
234
- x(r, s) === a.value ? "bg-primary/10 text-foreground" : "text-muted-foreground hover:bg-muted/70 hover:text-foreground",
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: (Q) => G(e),
239
- onMouseenter: (Q) => a.value = x(r, s)
262
+ onClick: (Y) => F(e),
263
+ onMouseenter: (Y) => a.value = x(r, l)
240
264
  }, [
241
- l("span", {
242
- class: z([
265
+ s("span", {
266
+ class: T([
243
267
  "shrink-0 flex items-center justify-center w-7 h-7 rounded-md",
244
- x(r, s) === a.value ? "bg-primary/20 text-primary" : "bg-muted/80 text-muted-foreground"
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
- l("span", xe, [
253
- l("span", ve, u(D(e)), 1),
254
- e.description || e.descriptionI18n ? (i(), f("span", be, u($(e)), 1)) : b("", !0)
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 ? (i(), oe(h, {
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, s) === a.value ? (i(), f("kbd", he, " ↵ ")) : b("", !0)
262
- ], 42, me))), 128))
263
- ], 8, pe),
264
- r < k.value.length - 1 ? (i(), f("div", ge)) : 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)
265
289
  ], 64))), 128))
266
- ], 8, ae),
267
- l("div", ke, [
268
- l("span", ye, [
269
- o[2] || (o[2] = l("kbd", { class: "px-1 rounded border border-border/60 bg-background text-[10px]" }, "↑↓", -1)),
270
- I(" " + u(S.value), 1)
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
- l("span", _e, [
273
- o[3] || (o[3] = l("kbd", { class: "px-1 rounded border border-border/60 bg-background text-[10px]" }, "↵", -1)),
274
- I(" " + u(K.value), 1)
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
- l("span", we, [
277
- o[4] || (o[4] = l("kbd", { class: "px-1 rounded border border-border/60 bg-background text-[10px]" }, "Esc", -1)),
278
- I(" " + u(O.value), 1)
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
- l("span", Ie, u(m.value) + " " + u(m.value === 1 ? N.value : P.value), 1)
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
- Pe as default
310
+ Be as default
287
311
  };
@@ -1,6 +1,6 @@
1
1
  import { SidebarMenuItemSchema } from './SidebarMenu/types';
2
- export interface CommandPaletteItem {
3
- id: string;
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 h, ref as b, onMounted as y, onUnmounted as g, watch as v, computed as m, openBlock as x, createElementBlock as w, Fragment as k, createElementVNode as l, normalizeClass as C, createVNode as u, toDisplayString as d, createCommentVNode as I } from "vue";
2
- import P from "./Icon.vue.js";
3
- import E from "./Modal.vue.js";
4
- import K from "./CommandPaletteContent.vue.js";
5
- import { $t as M } from "../utils/i18n.js";
6
- const G = { class: "hidden sm:block truncate max-w-[180px] -text-fs-1.5" }, L = { class: "hidden ml-auto lg: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" }, D = /* @__PURE__ */ h({
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 n = t, o = b(!1), s = () => {
20
- o.value = !0;
21
- }, i = () => {
22
- o.value = !1;
23
- }, a = (e) => {
24
- if (!n.enabled) return;
25
- (e.metaKey || e.ctrlKey) && e.key === n.shortcutKey && (e.preventDefault(), o.value ? i() : s());
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
- y(() => {
28
- n.enabled && window.addEventListener("keydown", a);
29
- }), g(() => {
30
- window.removeEventListener("keydown", a);
31
- }), v(
32
- () => n.enabled,
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", a) : (window.removeEventListener("keydown", a), o.value && i());
36
+ e ? window.addEventListener("keydown", r) : (window.removeEventListener("keydown", r), l.value && u());
35
37
  }
36
38
  );
37
- const c = m(() => {
38
- if (n.placeholderI18n) {
39
- const e = M(n.placeholderI18n);
40
- if (e !== n.placeholderI18n) return 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 n.placeholder;
43
- }), p = m(
44
+ return o.placeholder;
45
+ }), g = y(
44
46
  () => typeof navigator < "u" ? /mac/i.test(navigator.platform) : !0
45
47
  );
46
- return (e, r) => t.enabled ? (x(), w(k, { key: 0 }, [
47
- l("button", {
48
+ return (e, n) => t.enabled ? (I(), E(K, { key: 0 }, [
49
+ a("button", {
48
50
  type: "button",
49
- class: C(["command-palette-trigger hidden md: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]),
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: s
53
+ onClick: b
52
54
  }, [
53
- u(P, {
55
+ c(G, {
54
56
  icon: "lucide:search",
55
57
  class: "w-3.5 h-3.5 shrink-0"
56
58
  }),
57
- l("span", G, d(c.value.split(",")[0]) + "...", 1),
58
- l("kbd", L, [
59
- l("span", null, d(p.value ? "⌘" : "Ctrl"), 1),
60
- l("span", null, d(t.shortcutKey.toUpperCase()), 1)
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
- u(E, {
64
- show: o.value,
65
- "onUpdate:show": r[0] || (r[0] = (f) => o.value = f),
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: K,
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
- ], 64)) : I("", !0);
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
- D as default
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 m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-1f9be4e0"]]);
4
+ const s = /* @__PURE__ */ r(o, [["__scopeId", "data-v-c5641678"]]);
5
5
  export {
6
- m as default
6
+ s as default
7
7
  };