vlite3 0.6.1 → 0.6.3

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,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
  };