vlite3 0.1.6 → 0.1.7
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/Navbar/Navbar.vue.js +121 -107
- package/package.json +1 -1
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
import { defineComponent as j, ref as
|
|
1
|
+
import { defineComponent as j, ref as y, useSlots as T, onMounted as L, onUnmounted as M, computed as g, provide as N, watch as P, openBlock as s, createElementBlock as r, normalizeClass as d, Fragment as k, createElementVNode as n, renderSlot as o, createVNode as h, createBlock as w, resolveDynamicComponent as E, withCtx as v, createCommentVNode as a, toDisplayString as V, createTextVNode as A } from "vue";
|
|
2
2
|
import { useRoute as H } from "vue-router";
|
|
3
3
|
import $ from "../Icon.vue.js";
|
|
4
4
|
import O from "../SidePanel.vue.js";
|
|
5
5
|
import D from "../Logo.vue.js";
|
|
6
|
-
const U = { class: "flex items-center gap-4 shrink-0 z-10" }, F = {
|
|
6
|
+
const U = { class: "flex items-center gap-4 shrink-0 z-10" }, F = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "shrink-0"
|
|
9
|
+
}, R = { key: 1 }, Y = { key: 2 }, q = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "h-16 flex items-center px-6 z-10"
|
|
12
|
+
}, G = { class: "flex-1 px-4 py-4 overflow-y-auto space-y-4 scrollbar-thin" }, I = {
|
|
13
|
+
key: 1,
|
|
14
|
+
class: "p-4 border-t border-border shrink-0 bg-background mt-auto"
|
|
15
|
+
}, J = { class: "flex flex-col space-y-6 pt-4 h-full" }, K = {
|
|
7
16
|
key: 0,
|
|
8
17
|
class: "flex flex-col space-y-1"
|
|
9
18
|
}, Q = {
|
|
10
19
|
key: 1,
|
|
11
20
|
class: "flex flex-col space-y-4 flex-1 overflow-y-auto"
|
|
12
|
-
}, W = {
|
|
21
|
+
}, W = {
|
|
22
|
+
key: 2,
|
|
23
|
+
class: "mt-auto pt-4 border-t border-border"
|
|
24
|
+
}, oe = /* @__PURE__ */ j({
|
|
13
25
|
__name: "Navbar",
|
|
14
26
|
props: {
|
|
15
27
|
variant: { default: "header" },
|
|
@@ -27,47 +39,47 @@ const U = { class: "flex items-center gap-4 shrink-0 z-10" }, F = { class: "shri
|
|
|
27
39
|
mobileBreakpoint: { default: "md" }
|
|
28
40
|
},
|
|
29
41
|
emits: ["toggle-mobile"],
|
|
30
|
-
setup(
|
|
31
|
-
const
|
|
42
|
+
setup(f, { emit: X }) {
|
|
43
|
+
const l = f, m = y(!1), b = y(!1);
|
|
32
44
|
T();
|
|
33
45
|
const x = () => {
|
|
34
|
-
|
|
46
|
+
b.value = window.scrollY > 10;
|
|
35
47
|
};
|
|
36
48
|
L(() => {
|
|
37
49
|
window.addEventListener("scroll", x, { passive: !0 });
|
|
38
50
|
}), M(() => {
|
|
39
51
|
window.removeEventListener("scroll", x);
|
|
40
52
|
});
|
|
41
|
-
const C =
|
|
42
|
-
const
|
|
53
|
+
const C = g(() => {
|
|
54
|
+
const e = l.variant === "sidebar", t = {
|
|
43
55
|
fixed: "fixed top-0 left-0 z-40",
|
|
44
56
|
sticky: "sticky top-0 z-40",
|
|
45
57
|
relative: "relative z-10",
|
|
46
58
|
absolute: "absolute top-0 left-0 w-full z-40"
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
}, u = "bg-body", p = [
|
|
60
|
+
l.glass && (b.value || e || l.floating) ? "backdrop-blur-md bg-background/80 supports-[backdrop-filter]:bg-background/60" : "bg-background",
|
|
61
|
+
l.border && !l.floating ? e ? "border-r border-border" : "border-b border-border" : "",
|
|
62
|
+
l.floating ? "m-4 rounded-xl shadow-lg border border-border/50" : "",
|
|
63
|
+
b.value && !l.floating && !e && l.position === "sticky" ? "shadow-sm" : ""
|
|
52
64
|
];
|
|
53
65
|
let c = "";
|
|
54
|
-
return
|
|
55
|
-
}),
|
|
56
|
-
const
|
|
66
|
+
return e ? c = i.value.sidebarLayout : c = `flex items-center gap-4 w-full px-4 sm:px-6 lg:px-8 ${l.height}`, [u, t[l.position], ...p, c, l.class].join(" ");
|
|
67
|
+
}), i = g(() => {
|
|
68
|
+
const e = l.mobileBreakpoint || "md", t = {
|
|
57
69
|
sm: "sm:hidden",
|
|
58
70
|
md: "md:hidden",
|
|
59
71
|
lg: "lg:hidden",
|
|
60
72
|
xl: "xl:hidden"
|
|
61
|
-
},
|
|
73
|
+
}, u = {
|
|
62
74
|
sm: "hidden sm:flex",
|
|
63
75
|
md: "hidden md:flex",
|
|
64
76
|
lg: "hidden lg:flex",
|
|
65
77
|
xl: "hidden xl:flex"
|
|
66
|
-
},
|
|
67
|
-
sm: `flex flex-col max-sm:w-full ${
|
|
68
|
-
md: `flex flex-col max-md:w-full ${
|
|
69
|
-
lg: `flex flex-col max-lg:w-full ${
|
|
70
|
-
xl: `flex flex-col max-xl:w-full ${
|
|
78
|
+
}, p = {
|
|
79
|
+
sm: `flex flex-col max-sm:w-full ${l.compact ? "w-20" : l.width} h-auto sm:h-full sm:max-h-screen`,
|
|
80
|
+
md: `flex flex-col max-md:w-full ${l.compact ? "w-20" : l.width} h-auto md:h-full md:max-h-screen`,
|
|
81
|
+
lg: `flex flex-col max-lg:w-full ${l.compact ? "w-20" : l.width} h-auto lg:h-full lg:max-h-screen`,
|
|
82
|
+
xl: `flex flex-col max-xl:w-full ${l.compact ? "w-20" : l.width} h-auto xl:h-full xl:max-h-screen`
|
|
71
83
|
}, c = {
|
|
72
84
|
sm: "sm:hidden flex items-center justify-between px-4 py-3 shrink-0 bg-background",
|
|
73
85
|
md: "md:hidden flex items-center justify-between px-4 py-3 shrink-0 bg-background",
|
|
@@ -80,161 +92,163 @@ const U = { class: "flex items-center gap-4 shrink-0 z-10" }, F = { class: "shri
|
|
|
80
92
|
xl: "hidden xl:flex flex-col h-full w-full overflow-hidden"
|
|
81
93
|
};
|
|
82
94
|
return {
|
|
83
|
-
mobileTrigger: t[
|
|
84
|
-
desktopContent:
|
|
85
|
-
sidebarLayout:
|
|
86
|
-
mobileHeader: c[
|
|
87
|
-
desktopSidebar: S[
|
|
95
|
+
mobileTrigger: t[e],
|
|
96
|
+
desktopContent: u[e],
|
|
97
|
+
sidebarLayout: p[e],
|
|
98
|
+
mobileHeader: c[e],
|
|
99
|
+
desktopSidebar: S[e]
|
|
88
100
|
};
|
|
89
|
-
}), B =
|
|
90
|
-
if (
|
|
91
|
-
switch (
|
|
101
|
+
}), B = g(() => {
|
|
102
|
+
if (l.variant === "sidebar") return "flex-1 py-4 overflow-y-auto";
|
|
103
|
+
switch (l.centerPosition) {
|
|
92
104
|
case "left":
|
|
93
105
|
return "flex items-center justify-start";
|
|
94
106
|
case "right":
|
|
95
107
|
return "flex items-center justify-end ml-auto";
|
|
96
108
|
default:
|
|
97
|
-
return `${
|
|
109
|
+
return `${i.value.desktopContent} items-center justify-center mx-auto`;
|
|
98
110
|
}
|
|
99
111
|
});
|
|
100
112
|
N("navbar-context", {
|
|
101
|
-
compact:
|
|
113
|
+
compact: g(() => l.compact)
|
|
102
114
|
});
|
|
103
115
|
const z = H();
|
|
104
116
|
return P(
|
|
105
117
|
() => z.path,
|
|
106
118
|
() => {
|
|
107
|
-
|
|
119
|
+
m.value = !1;
|
|
108
120
|
}
|
|
109
|
-
), (
|
|
110
|
-
class:
|
|
121
|
+
), (e, t) => (s(), r("nav", {
|
|
122
|
+
class: d(C.value),
|
|
111
123
|
role: "navigation"
|
|
112
124
|
}, [
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
125
|
+
f.variant === "header" ? (s(), r(k, { key: 0 }, [
|
|
126
|
+
n("div", U, [
|
|
127
|
+
o(e.$slots, "mobile-trigger", {}, () => [
|
|
128
|
+
n("button", {
|
|
117
129
|
type: "button",
|
|
118
|
-
class:
|
|
119
|
-
onClick: t[0] || (t[0] = (
|
|
130
|
+
class: d(["p-2 -ml-2 text-muted-foreground hover:bg-accent rounded-md shrink-0", i.value.mobileTrigger]),
|
|
131
|
+
onClick: t[0] || (t[0] = (u) => m.value = !0)
|
|
120
132
|
}, [
|
|
121
|
-
|
|
133
|
+
h($, {
|
|
122
134
|
icon: "lucide:menu",
|
|
123
135
|
class: "w-5 h-5"
|
|
124
136
|
}),
|
|
125
|
-
t[3] || (t[3] =
|
|
137
|
+
t[3] || (t[3] = n("span", { class: "sr-only" }, "Open Menu", -1))
|
|
126
138
|
], 2)
|
|
127
139
|
]),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
(
|
|
131
|
-
src:
|
|
140
|
+
e.$slots?.logo ? (s(), r("div", F, [
|
|
141
|
+
o(e.$slots, "logo", {}, () => [
|
|
142
|
+
(s(), w(E(l.logo ? "img" : "div"), {
|
|
143
|
+
src: l.logo,
|
|
132
144
|
class: "h-8 w-auto font-bold text-xl flex items-center gap-2"
|
|
133
145
|
}, {
|
|
134
|
-
default:
|
|
135
|
-
|
|
146
|
+
default: v(() => [
|
|
147
|
+
l.logo ? a("", !0) : (s(), w(D, {
|
|
136
148
|
key: 0,
|
|
137
149
|
class: "h-6 w-6"
|
|
138
150
|
})),
|
|
139
|
-
!
|
|
151
|
+
!l.logo && l.logoAlt ? (s(), r("span", R, V(l.logoAlt), 1)) : l.logo ? a("", !0) : (s(), r("span", Y, "Brand"))
|
|
140
152
|
]),
|
|
141
153
|
_: 1
|
|
142
154
|
}, 8, ["src"]))
|
|
143
155
|
])
|
|
144
|
-
]),
|
|
145
|
-
|
|
146
|
-
|
|
156
|
+
])) : a("", !0),
|
|
157
|
+
e.$slots?.left ? (s(), r("div", {
|
|
158
|
+
key: 1,
|
|
159
|
+
class: d(["items-center gap-1 overflow-x-auto no-scrollbar mask-gradient", i.value.desktopContent])
|
|
147
160
|
}, [
|
|
148
|
-
|
|
149
|
-
], 2)
|
|
161
|
+
o(e.$slots, "left")
|
|
162
|
+
], 2)) : a("", !0)
|
|
150
163
|
]),
|
|
151
|
-
|
|
152
|
-
|
|
164
|
+
e.$slots?.center ? (s(), r("div", {
|
|
165
|
+
key: 0,
|
|
166
|
+
class: d([
|
|
153
167
|
B.value,
|
|
154
168
|
// Width constraint to ensure it doesn't crush others, but allows simple resizing
|
|
155
169
|
"max-w-full"
|
|
156
170
|
])
|
|
157
171
|
}, [
|
|
158
|
-
|
|
159
|
-
], 2),
|
|
160
|
-
|
|
161
|
-
class:
|
|
172
|
+
o(e.$slots, "center")
|
|
173
|
+
], 2)) : a("", !0),
|
|
174
|
+
n("div", {
|
|
175
|
+
class: d(["flex items-center gap-2 shrink-0 max-w-[40%] z-10", {
|
|
162
176
|
// Always push to end unless Center is pushing it.
|
|
163
177
|
// If Center is 'center' (mx-auto) or 'right' (ml-auto), this naturally falls to end.
|
|
164
178
|
// If Center is 'left', we MUST have ml-auto here.
|
|
165
|
-
"ml-auto":
|
|
179
|
+
"ml-auto": f.centerPosition === "left" || f.centerPosition === "center"
|
|
166
180
|
// If center is 'right', Center has ml-auto. Right just sits next to it.
|
|
167
181
|
// But if we add ml-auto here too, they might split space? No, flexbox parses strictly.
|
|
168
182
|
}])
|
|
169
183
|
}, [
|
|
170
|
-
|
|
184
|
+
o(e.$slots, "right")
|
|
171
185
|
], 2)
|
|
172
|
-
], 64)) : (
|
|
173
|
-
|
|
174
|
-
class:
|
|
186
|
+
], 64)) : (s(), r(k, { key: 1 }, [
|
|
187
|
+
n("div", {
|
|
188
|
+
class: d(i.value.mobileHeader)
|
|
175
189
|
}, [
|
|
176
|
-
|
|
177
|
-
t[4] || (t[4] =
|
|
178
|
-
]),
|
|
179
|
-
|
|
190
|
+
e.$slots?.right ? o(e.$slots, "logo", { key: 0 }, () => [
|
|
191
|
+
t[4] || (t[4] = n("div", { class: "font-bold text-xl truncate" }, "Brand", -1))
|
|
192
|
+
]) : a("", !0),
|
|
193
|
+
n("button", {
|
|
180
194
|
type: "button",
|
|
181
195
|
class: "p-2 -mr-2 text-muted-foreground hover:bg-accent rounded-md",
|
|
182
|
-
onClick: t[1] || (t[1] = (
|
|
196
|
+
onClick: t[1] || (t[1] = (u) => m.value = !0)
|
|
183
197
|
}, [
|
|
184
|
-
|
|
198
|
+
h($, {
|
|
185
199
|
icon: "lucide:menu",
|
|
186
200
|
class: "w-5 h-5"
|
|
187
201
|
}),
|
|
188
|
-
t[5] || (t[5] =
|
|
202
|
+
t[5] || (t[5] = n("span", { class: "sr-only" }, "Open Menu", -1))
|
|
189
203
|
])
|
|
190
204
|
], 2),
|
|
191
|
-
|
|
192
|
-
class:
|
|
205
|
+
n("div", {
|
|
206
|
+
class: d(i.value.desktopSidebar)
|
|
193
207
|
}, [
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
t[6] || (t[6] =
|
|
208
|
+
e.$slots?.logo ? (s(), r("div", q, [
|
|
209
|
+
o(e.$slots, "logo", {}, () => [
|
|
210
|
+
t[6] || (t[6] = n("div", { class: "font-bold text-xl truncate" }, "Brand", -1))
|
|
197
211
|
])
|
|
212
|
+
])) : a("", !0),
|
|
213
|
+
n("div", G, [
|
|
214
|
+
o(e.$slots, "left"),
|
|
215
|
+
o(e.$slots, "default"),
|
|
216
|
+
o(e.$slots, "center")
|
|
198
217
|
]),
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
s(l.$slots, "center")
|
|
203
|
-
]),
|
|
204
|
-
o("div", I, [
|
|
205
|
-
s(l.$slots, "right")
|
|
206
|
-
])
|
|
218
|
+
e.$slots?.right ? (s(), r("div", I, [
|
|
219
|
+
o(e.$slots, "right")
|
|
220
|
+
])) : a("", !0)
|
|
207
221
|
], 2)
|
|
208
222
|
], 64)),
|
|
209
|
-
|
|
210
|
-
show:
|
|
211
|
-
"onUpdate:show": t[2] || (t[2] = (
|
|
223
|
+
h(O, {
|
|
224
|
+
show: m.value,
|
|
225
|
+
"onUpdate:show": t[2] || (t[2] = (u) => m.value = u),
|
|
212
226
|
position: "left",
|
|
213
227
|
size: "sm",
|
|
214
|
-
triggerClass:
|
|
215
|
-
class:
|
|
228
|
+
triggerClass: i.value.mobileTrigger,
|
|
229
|
+
class: d(["z-60", i.value.mobileTrigger])
|
|
216
230
|
}, {
|
|
217
|
-
header:
|
|
218
|
-
|
|
231
|
+
header: v(() => [
|
|
232
|
+
o(e.$slots, "logo", {}, () => [
|
|
219
233
|
t[7] || (t[7] = A("Brand", -1))
|
|
220
234
|
])
|
|
221
235
|
]),
|
|
222
|
-
default:
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
t[8] || (t[8] =
|
|
228
|
-
|
|
236
|
+
default: v(() => [
|
|
237
|
+
n("div", J, [
|
|
238
|
+
f.variant === "header" ? (s(), r("div", K, [
|
|
239
|
+
o(e.$slots, "mobile-menu", {}, () => [
|
|
240
|
+
o(e.$slots, "left"),
|
|
241
|
+
t[8] || (t[8] = n("div", { class: "h-px bg-border my-2" }, null, -1)),
|
|
242
|
+
o(e.$slots, "center")
|
|
229
243
|
])
|
|
230
|
-
])) : (
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
244
|
+
])) : (s(), r("div", Q, [
|
|
245
|
+
o(e.$slots, "left"),
|
|
246
|
+
o(e.$slots, "default"),
|
|
247
|
+
o(e.$slots, "center")
|
|
234
248
|
])),
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
])
|
|
249
|
+
e.$slots?.right ? (s(), r("div", W, [
|
|
250
|
+
o(e.$slots, "right")
|
|
251
|
+
])) : a("", !0)
|
|
238
252
|
])
|
|
239
253
|
]),
|
|
240
254
|
_: 3
|