vlite3 0.6.1 → 0.6.4

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,11 +1,11 @@
1
- import { defineComponent as N, ref as P, watch as b, onUnmounted as D, computed as f, openBlock as s, createElementBlock as r, Fragment as T, createElementVNode as c, mergeProps as C, withModifiers as V, renderSlot as i, createCommentVNode as l, createBlock as y, Teleport as K, createVNode as h, Transition as k, withCtx as g, normalizeClass as d, toDisplayString as w, resolveDynamicComponent as j } from "vue";
2
- import F from "./Button.vue.js";
3
- import { useKeyStroke as L } from "../composables/useKeyStroke.js";
4
- import { $t as x } from "../utils/i18n.js";
5
- const M = { class: "text-lg font-bold text-foreground" }, U = {
1
+ import { defineComponent as N, ref as P, inject as D, watch as C, onMounted as V, onUnmounted as j, computed as c, openBlock as l, createElementBlock as i, Fragment as K, createElementVNode as m, mergeProps as g, withModifiers as M, renderSlot as d, createCommentVNode as n, createBlock as p, Teleport as F, createVNode as h, Transition as k, withCtx as w, normalizeClass as u, toDisplayString as x, resolveDynamicComponent as L } from "vue";
2
+ import U from "./Button.vue.js";
3
+ import { useKeyStroke as q } from "../composables/useKeyStroke.js";
4
+ import { $t as $ } from "../utils/i18n.js";
5
+ const G = { class: "text-lg font-bold text-foreground" }, H = {
6
6
  key: 0,
7
7
  class: "mt-1 text-sm text-muted-foreground"
8
- }, Q = /* @__PURE__ */ N({
8
+ }, X = /* @__PURE__ */ N({
9
9
  inheritAttrs: !1,
10
10
  __name: "SidePanel",
11
11
  props: {
@@ -29,45 +29,47 @@ const M = { class: "text-lg font-bold text-foreground" }, U = {
29
29
  bodyProps: {}
30
30
  },
31
31
  emits: ["close", "update:show", "onOpen", "onAfterOpen", "onAfterClose"],
32
- setup(t, { emit: $ }) {
33
- const o = t, m = $, a = P(o.show);
34
- b(
32
+ setup(t, { emit: B }) {
33
+ const o = t, y = B, s = P(o.show), r = D("dropdown-context", null);
34
+ C(
35
35
  () => o.show,
36
36
  (e) => {
37
- a.value = e, e && m("onOpen");
37
+ s.value = e, e && (y("onOpen"), r?.close());
38
38
  }
39
39
  );
40
- const B = () => {
41
- a.value = !0;
42
- }, n = () => {
43
- a.value = !1, m("update:show", !1), m("close");
44
- }, z = () => {
45
- o.closeOutside && n();
46
- }, { onKeyStroke: A } = L();
47
- A("Escape", n), b(a, (e) => {
48
- e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "";
49
- }), D(() => {
50
- document.body.style.overflow = "";
40
+ const z = () => {
41
+ s.value = !0, r?.close();
42
+ }, a = () => {
43
+ s.value = !1, y("update:show", !1), y("close");
44
+ }, A = () => {
45
+ o.closeOutside && a();
46
+ }, { onKeyStroke: O } = q();
47
+ O("Escape", a), C(s, (e) => {
48
+ r?.onChildToggle?.(e), e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "";
49
+ }), V(() => {
50
+ s.value && r?.onChildToggle?.(!0);
51
+ }), j(() => {
52
+ s.value && r?.onChildToggle?.(!1), document.body.style.overflow = "";
51
53
  });
52
- const O = {
54
+ const I = {
53
55
  sm: "max-w-sm",
54
56
  md: "max-w-md",
55
57
  lg: "max-w-lg",
56
58
  xl: "max-w-xl",
57
59
  full: "max-w-full"
58
- }, I = f(() => o.position === "left" ? "left-0" : "right-0"), S = f(() => o.position === "left" ? "slide-left" : "slide-right"), p = f(() => o.titleI18n ? x(o.titleI18n) : o.title), v = f(
59
- () => o.descriptionI18n ? x(o.descriptionI18n) : o.description
60
+ }, T = c(() => o.position === "left" ? "left-0" : "right-0"), S = c(() => o.position === "left" ? "slide-left" : "slide-right"), v = c(() => o.titleI18n ? $(o.titleI18n) : o.title), b = c(
61
+ () => o.descriptionI18n ? $(o.descriptionI18n) : o.description
60
62
  );
61
- return (e, u) => (s(), r(T, null, [
62
- c("span", C({
63
- onClick: V(B, ["stop"]),
63
+ return (e, f) => (l(), i(K, null, [
64
+ m("span", g({
65
+ onClick: M(z, ["stop"]),
64
66
  class: `${t.triggerClass}`
65
67
  }, e.$attrs), [
66
- i(e.$slots, "trigger", {}, () => [
67
- t.body ? i(e.$slots, "default", { key: 0 }) : l("", !0)
68
+ d(e.$slots, "trigger", {}, () => [
69
+ t.body ? d(e.$slots, "default", { key: 0 }) : n("", !0)
68
70
  ])
69
71
  ], 16),
70
- (s(), y(K, { to: "body" }, [
72
+ (l(), p(F, { to: "body" }, [
71
73
  h(k, {
72
74
  "enter-active-class": "transition-opacity duration-300 ease-out",
73
75
  "enter-from-class": "opacity-0",
@@ -76,60 +78,60 @@ const M = { class: "text-lg font-bold text-foreground" }, U = {
76
78
  "leave-from-class": "opacity-100",
77
79
  "leave-to-class": "opacity-0"
78
80
  }, {
79
- default: g(() => [
80
- a.value ? (s(), r("div", {
81
+ default: w(() => [
82
+ s.value ? (l(), i("div", {
81
83
  key: 0,
82
- class: d(["fixed inset-0 z-50 bg-[#00000033]", [t.overlayClass, { "backdrop-blur-[2px]": t.backdrop }]]),
83
- onClick: z
84
- }, null, 2)) : l("", !0)
84
+ class: u(["fixed inset-0 z-50 bg-[#00000033] v-sidepanel-overlay", [t.overlayClass, { "backdrop-blur-[2px]": t.backdrop }]]),
85
+ onClick: A
86
+ }, null, 2)) : n("", !0)
85
87
  ]),
86
88
  _: 1
87
89
  }),
88
90
  h(k, {
89
91
  name: S.value,
90
- onAfterEnter: u[0] || (u[0] = (E) => e.$emit("onAfterOpen")),
91
- onAfterLeave: u[1] || (u[1] = (E) => e.$emit("onAfterClose"))
92
+ onAfterEnter: f[0] || (f[0] = (E) => e.$emit("onAfterOpen")),
93
+ onAfterLeave: f[1] || (f[1] = (E) => e.$emit("onAfterClose"))
92
94
  }, {
93
- default: g(() => [
94
- a.value ? (s(), r("div", {
95
+ default: w(() => [
96
+ s.value ? (l(), i("div", {
95
97
  key: 0,
96
- class: d(["sidepanel-body fixed inset-y-0 z-50 flex flex-col bg-body shadow-sm border transition-transform duration-300 ease-in-out w-full", [O[t.size], I.value, o.class]])
98
+ class: u(["sidepanel-body fixed inset-y-0 z-50 flex flex-col bg-body shadow-sm border transition-transform duration-300 ease-in-out w-full", [I[t.size], T.value, o.class]])
97
99
  }, [
98
- p.value || e.$slots.header ? (s(), r("div", {
100
+ v.value || e.$slots.header ? (l(), i("div", {
99
101
  key: 0,
100
- class: d([t.headerClass, "flex-none flex items-center justify-between px-6 py-2 border-b border-border"])
102
+ class: u([t.headerClass, "flex-none flex items-center justify-between px-6 py-2 border-b border-border"])
101
103
  }, [
102
- i(e.$slots, "header", {}, () => [
103
- c("div", null, [
104
- c("h3", M, w(p.value), 1),
105
- v.value ? (s(), r("p", U, w(v.value), 1)) : l("", !0)
104
+ d(e.$slots, "header", {}, () => [
105
+ m("div", null, [
106
+ m("h3", G, x(v.value), 1),
107
+ b.value ? (l(), i("p", H, x(b.value), 1)) : n("", !0)
106
108
  ])
107
109
  ]),
108
- t.hideCloseButton ? l("", !0) : (s(), y(F, {
110
+ t.hideCloseButton ? n("", !0) : (l(), p(U, {
109
111
  key: 0,
110
112
  rounded: "full",
111
113
  size: "sm",
112
114
  variant: "ghost",
113
115
  icon: "lucide:x",
114
- onClick: n,
116
+ onClick: a,
115
117
  class: "-mr-2"
116
118
  }))
117
- ], 2)) : l("", !0),
118
- c("div", {
119
- class: d(["flex-1 overflow-y-auto px-6 py-4", t.bodyClass])
119
+ ], 2)) : n("", !0),
120
+ m("div", {
121
+ class: u(["flex-1 overflow-y-auto px-6 py-4", t.bodyClass])
120
122
  }, [
121
- t.body ? (s(), y(j(t.body), C({ key: 0 }, { ...t.bodyProps, ...e.$attrs }, { close: n }), null, 16)) : i(e.$slots, "default", {
123
+ t.body ? (l(), p(L(t.body), g({ key: 0 }, { ...t.bodyProps, ...e.$attrs }, { close: a }), null, 16)) : d(e.$slots, "default", {
122
124
  key: 1,
123
- close: n
125
+ close: a
124
126
  })
125
127
  ], 2),
126
- e.$slots.footer ? (s(), r("div", {
128
+ e.$slots.footer ? (l(), i("div", {
127
129
  key: 1,
128
- class: d(["flex-none px-6 py-3 border-t border-border", t.footerClass])
130
+ class: u(["flex-none px-6 py-3 border-t border-border", t.footerClass])
129
131
  }, [
130
- i(e.$slots, "footer", { close: n })
131
- ], 2)) : l("", !0)
132
- ], 2)) : l("", !0)
132
+ d(e.$slots, "footer", { close: a })
133
+ ], 2)) : n("", !0)
134
+ ], 2)) : n("", !0)
133
135
  ]),
134
136
  _: 3
135
137
  }, 8, ["name"])
@@ -138,5 +140,5 @@ const M = { class: "text-lg font-bold text-foreground" }, U = {
138
140
  }
139
141
  });
140
142
  export {
141
- Q as default
143
+ X as default
142
144
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as S, inject as I, ref as w, computed as n, watch as h, reactive as E, provide as N, openBlock as g, createElementBlock as y, normalizeClass as L, Fragment as P, renderList as A, createBlock as O } from "vue";
2
- import { useRoute as F } from "vue-router";
3
- import { useBreakpoints as W, breakpointsTailwind as H } from "@vueuse/core";
4
- import D from "./SidebarMenuItem.vue.js";
1
+ import { defineComponent as S, inject as E, ref as T, computed as l, watch as g, reactive as N, provide as L, openBlock as C, createElementBlock as k, normalizeClass as P, Fragment as A, renderList as O, createBlock as F } from "vue";
2
+ import { useRoute as W } from "vue-router";
3
+ import { useBreakpoints as H, breakpointsTailwind as D } from "@vueuse/core";
4
+ import R from "./SidebarMenuItem.vue.js";
5
5
  /* empty css */
6
- const J = /* @__PURE__ */ S({
6
+ const K = /* @__PURE__ */ S({
7
7
  __name: "SidebarMenu",
8
8
  props: {
9
9
  items: { default: () => [] },
@@ -15,7 +15,7 @@ const J = /* @__PURE__ */ S({
15
15
  showCompactLabels: { type: Boolean, default: !1 },
16
16
  renderMode: { default: "tree" },
17
17
  iconSize: { default: "16px" },
18
- compactIconSize: { default: "20px" },
18
+ compactIconSize: { default: "21px" },
19
19
  labelClass: { default: "text-sm" },
20
20
  compactLabelClass: { default: "text-[11.5px] mt-1" },
21
21
  itemPadding: { default: "py-2 px-2" },
@@ -29,112 +29,114 @@ const J = /* @__PURE__ */ S({
29
29
  showTooltip: { type: Boolean, default: !0 }
30
30
  },
31
31
  setup(m) {
32
- const d = I("navbar-context", null), t = m, c = F(), T = W(H), u = w([...t.defaultExpanded]), i = w(null), k = n(() => !t.mobileBreakpoint || t.mobileBreakpoint === "none" ? !0 : T.greaterOrEqual(t.mobileBreakpoint).value), v = n(() => k.value && t.orientation || "vertical"), M = (l, s) => {
33
- if (i.value === l.id) return !0;
34
- if (l.to) {
35
- const a = typeof l.to == "string" ? l.to : l.to.path;
36
- if (a && (s === a || s.startsWith(a) && a !== "/" && a.length > 1))
37
- return !0;
32
+ const c = E("navbar-context", null), e = m, f = W(), y = H(D), d = T([...e.defaultExpanded]), s = T(null), B = l(() => !e.mobileBreakpoint || e.mobileBreakpoint === "none" ? !0 : y.greaterOrEqual(e.mobileBreakpoint).value), v = l(() => B.value && e.orientation || "vertical"), r = (t) => t.id || (typeof t.to == "string" ? t.to : null) || t.label, M = (t, o) => {
33
+ if (s.value === r(t)) return !0;
34
+ if (t.to) {
35
+ const a = typeof t.to == "string" ? t.to : t.to.path;
36
+ if (a) {
37
+ if (o === a) return !0;
38
+ if (o.startsWith(a) && a !== "/" && a.length > 1) {
39
+ const i = o[a.length];
40
+ if (!i || i === "/" || i === "?")
41
+ return !0;
42
+ }
43
+ }
38
44
  }
39
45
  return !1;
40
- }, b = (l, s, a = []) => {
41
- let r = !1;
42
- for (const e of l) {
43
- const o = e.id || (typeof e.to == "string" ? e.to : null) || e.label;
44
- let f = !1;
45
- e.children && (f = b(e.children, s, [...a, o]), f && (r = !0));
46
- const p = M(e, s), z = f && d?.renderNestedTabs?.value && a.length === 0;
47
- (p || z) && (i.value = o, a.forEach((C) => {
48
- u.value.includes(C) || u.value.push(C);
49
- }), r = !0);
46
+ }, b = (t, o, a = []) => {
47
+ let i = !1;
48
+ for (const n of t) {
49
+ const u = r(n);
50
+ let p = !1;
51
+ n.children && (p = b(n.children, o, [...a, u]), p && (i = !0));
52
+ const x = M(n, o), z = p && c?.renderNestedTabs?.value && a.length === 0;
53
+ (x || z) && (s.value = u, a.forEach((w) => {
54
+ d.value.includes(w) || d.value.push(w);
55
+ }), i = !0);
50
56
  }
51
- return r;
52
- }, x = (l) => {
53
- if (!d?.renderNestedTabs?.value) return;
54
- const s = t.items.find((a) => i.value === (a.id || a.label || a.to) ? !0 : a.children?.some((e) => i.value === (e.id || e.label || e.to) || e.children && e.children.some(
55
- (o) => i.value === (o.id || o.label || o.to)
56
- )) || M(a, l));
57
- if (s && s.children) {
58
- const a = s.children.map((e) => ({
59
- label: e.label,
60
- labelI18n: e.labelI18n,
61
- value: e.id || (typeof e.to == "string" ? e.to : null) || e.label,
62
- icon: e.icon,
63
- disabled: e.disabled,
64
- to: e.to,
65
- href: e.href
57
+ return i;
58
+ }, h = (t) => {
59
+ if (!c?.renderNestedTabs?.value) return;
60
+ const o = e.items.find((a) => s.value === r(a) ? !0 : a.children?.some((n) => s.value === r(n) || n.children && n.children.some((u) => s.value === r(u))) || M(a, t));
61
+ if (o && o.children) {
62
+ const a = o.children.map((n) => ({
63
+ label: n.label,
64
+ labelI18n: n.labelI18n,
65
+ value: r(n),
66
+ icon: n.icon,
67
+ disabled: n.disabled,
68
+ to: n.to,
69
+ href: n.href
66
70
  }));
67
- let r = a[0].value;
68
- if (i.value) {
69
- const e = a.find((o) => o.value === i.value);
70
- if (e)
71
- r = e.value;
71
+ let i = a[0].value;
72
+ if (s.value) {
73
+ const n = a.find((u) => u.value === s.value);
74
+ if (n)
75
+ i = n.value;
72
76
  else {
73
- const o = s.children.find((f) => f.children?.some(
74
- (p) => (p.id || p.label || p.to) === i.value
75
- ));
76
- o && (r = o.id || (typeof o.to == "string" ? o.to : null) || o.label);
77
+ const u = o.children.find((p) => p.children?.some((x) => r(x) === s.value));
78
+ u && (i = r(u));
77
79
  }
78
80
  }
79
- d.setNestedTabs(a, r);
81
+ c.setNestedTabs(a, i);
80
82
  } else
81
- t.items.some(
82
- (r) => r.children?.some((e) => (e.id || e.label || e.to) === i.value)
83
- ) || d.setNestedTabs([], "");
83
+ e.items.some(
84
+ (i) => i.children?.some((n) => r(n) === s.value)
85
+ ) || c.setNestedTabs([], "");
84
86
  };
85
- h(
86
- () => c?.path,
87
- (l) => {
88
- l && (b(t.items, l), x(l));
87
+ g(
88
+ () => f?.path,
89
+ (t) => {
90
+ t && (b(e.items, t), h(t));
89
91
  },
90
92
  { immediate: !0 }
91
- ), h(
92
- () => t.items,
93
+ ), g(
94
+ () => e.items,
93
95
  () => {
94
- c?.path && (b(t.items, c.path), x(c.path));
96
+ f?.path && (b(e.items, f.path), h(f.path));
95
97
  },
96
98
  { deep: !0 }
97
- ), h(
98
- () => i.value,
99
+ ), g(
100
+ () => s.value,
99
101
  () => {
100
- d?.renderNestedTabs?.value && x(c?.path || "");
102
+ c?.renderNestedTabs?.value && h(f?.path || "");
101
103
  }
102
104
  );
103
- const B = E({
104
- activeItem: i,
105
- expandedItems: u,
106
- toggleExpand: (l) => {
107
- u.value.includes(l) ? u.value = u.value.filter((a) => a !== l) : t.allowMultiple ? u.value.push(l) : u.value = [l];
105
+ const I = N({
106
+ activeItem: s,
107
+ expandedItems: d,
108
+ toggleExpand: (t) => {
109
+ d.value.includes(t) ? d.value = d.value.filter((a) => a !== t) : e.allowMultiple ? d.value.push(t) : d.value = [t];
108
110
  },
109
- setActive: (l) => {
110
- i.value = l;
111
+ setActive: (t) => {
112
+ s.value = t;
111
113
  },
112
- indentSize: n(() => t.indentSize),
113
- variant: n(() => t.variant),
114
- renderMode: n(() => t.renderMode || "tree"),
115
- renderNestedTabs: n(() => !!d?.renderNestedTabs?.value),
116
- compact: n(() => t.compact),
117
- showCompactLabels: n(() => t.showCompactLabels),
118
- iconSize: n(() => t.iconSize),
119
- compactIconSize: n(() => t.compactIconSize),
120
- labelClass: n(() => t.labelClass),
121
- compactLabelClass: n(() => t.compactLabelClass),
122
- itemPadding: n(() => t.itemPadding),
123
- compactItemPadding: n(() => t.compactItemPadding),
124
- nestedMenuWidth: n(() => t.nestedMenuWidth),
125
- nestedMenuMaxHeight: n(() => t.nestedMenuMaxHeight),
114
+ indentSize: l(() => e.indentSize),
115
+ variant: l(() => e.variant),
116
+ renderMode: l(() => e.renderMode || "tree"),
117
+ renderNestedTabs: l(() => !!c?.renderNestedTabs?.value),
118
+ compact: l(() => e.compact),
119
+ showCompactLabels: l(() => e.showCompactLabels),
120
+ iconSize: l(() => e.iconSize),
121
+ compactIconSize: l(() => e.compactIconSize),
122
+ labelClass: l(() => e.labelClass),
123
+ compactLabelClass: l(() => e.compactLabelClass),
124
+ itemPadding: l(() => e.itemPadding),
125
+ compactItemPadding: l(() => e.compactItemPadding),
126
+ nestedMenuWidth: l(() => e.nestedMenuWidth),
127
+ nestedMenuMaxHeight: l(() => e.nestedMenuMaxHeight),
126
128
  currentOrientation: v,
127
- showTooltip: n(() => t.showTooltip)
129
+ showTooltip: l(() => e.showTooltip)
128
130
  });
129
- return N("sidebar-menu-ctx", B), (l, s) => (g(), y("nav", {
130
- class: L(["flex w-full transition-all duration-300", [
131
+ return L("sidebar-menu-ctx", I), (t, o) => (C(), k("nav", {
132
+ class: P(["flex w-full transition-all duration-300", [
131
133
  v.value === "horizontal" ? "flex-row flex-wrap gap-2 items-center" : "flex-col",
132
- v.value === "vertical" && !t.compact ? "space-y-1" : ""
134
+ v.value === "vertical" && !e.compact ? "space-y-1" : ""
133
135
  ]]),
134
136
  role: "tree",
135
137
  "aria-label": "Sidebar Menu"
136
138
  }, [
137
- (g(!0), y(P, null, A(m.items, (a) => (g(), O(D, {
139
+ (C(!0), k(A, null, O(m.items, (a) => (C(), F(R, {
138
140
  key: a.id || a.label,
139
141
  item: a,
140
142
  itemClass: m.itemClass,
@@ -144,5 +146,5 @@ const J = /* @__PURE__ */ S({
144
146
  }
145
147
  });
146
148
  export {
147
- J as default
149
+ K as default
148
150
  };