@abraca/junis 2.86.0 → 2.88.0
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/dist/module.d.mts +4 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +82 -8
- package/dist/runtime/assets/css/jun.css +2 -2
- package/dist/runtime/components/JunDocSurface.d.vue.ts +20 -2
- package/dist/runtime/components/JunDocSurface.vue +30 -2
- package/dist/runtime/components/JunDocSurface.vue.d.ts +20 -2
- package/dist/runtime/components/JunHead.vue +16 -4
- package/dist/runtime/components/JunNavDock.d.vue.ts +15 -0
- package/dist/runtime/components/JunNavDock.vue +94 -0
- package/dist/runtime/components/JunNavDock.vue.d.ts +15 -0
- package/dist/runtime/components/JunNavMenu.client.d.vue.ts +15 -0
- package/dist/runtime/components/JunNavMenu.client.vue +478 -0
- package/dist/runtime/components/JunNavMenu.client.vue.d.ts +15 -0
- package/dist/runtime/components/JunNavPreview.d.vue.ts +17 -0
- package/dist/runtime/components/JunNavPreview.vue +169 -0
- package/dist/runtime/components/JunNavPreview.vue.d.ts +17 -0
- package/dist/runtime/components/JunNavigation.d.vue.ts +4 -11
- package/dist/runtime/components/JunNavigation.vue +813 -138
- package/dist/runtime/components/JunNavigation.vue.d.ts +4 -11
- package/dist/runtime/components/JunNoteLinks.vue +1 -1
- package/dist/runtime/components/JunPageHero.vue +3 -3
- package/dist/runtime/components/JunSectionBar.d.vue.ts +41 -0
- package/dist/runtime/components/JunSectionBar.vue +144 -0
- package/dist/runtime/components/JunSectionBar.vue.d.ts +41 -0
- package/dist/runtime/components/renderers/JunConfigRenderer.vue +486 -6
- package/dist/runtime/components/renderers/JunEntryRenderer.vue +48 -0
- package/dist/runtime/components/renderers/JunGlobeRenderer.vue +43 -26
- package/dist/runtime/composables/useJunCreatePage.js +7 -1
- package/dist/runtime/composables/useJunDocPage.d.ts +28 -0
- package/dist/runtime/composables/useJunDocPage.js +111 -20
- package/dist/runtime/composables/useJunGarden.d.ts +1 -1
- package/dist/runtime/composables/useJunGarden.js +3 -2
- package/dist/runtime/composables/useJunGestures.d.ts +53 -0
- package/dist/runtime/composables/useJunGestures.js +89 -0
- package/dist/runtime/composables/useJunMenuState.d.ts +4 -0
- package/dist/runtime/composables/useJunMenuState.js +5 -0
- package/dist/runtime/composables/useJunNavItems.d.ts +50 -0
- package/dist/runtime/composables/useJunNavItems.js +188 -0
- package/dist/runtime/composables/useJunNavSettings.d.ts +58 -1
- package/dist/runtime/composables/useJunNavSettings.js +110 -8
- package/dist/runtime/composables/useJunOptions.d.ts +1 -0
- package/dist/runtime/composables/useJunSiblings.d.ts +30 -0
- package/dist/runtime/composables/useJunSiblings.js +38 -0
- package/dist/runtime/composables/useJunSiteConfig.d.ts +51 -3
- package/dist/runtime/composables/useJunTheme.js +4 -1
- package/dist/runtime/composables/useJunViewingAccent.js +10 -0
- package/dist/runtime/layouts/jun.vue +21 -1
- package/dist/runtime/pages/doc.vue +41 -35
- package/dist/runtime/pages/index.vue +63 -35
- package/dist/runtime/plugins/jun-doc-tree.d.ts +2 -0
- package/dist/runtime/plugins/jun-doc-tree.js +26 -0
- package/dist/runtime/server/api/health.get.d.ts +15 -0
- package/dist/runtime/server/api/health.get.js +7 -2
- package/dist/runtime/server/api/links.get.js +27 -3
- package/dist/runtime/server/api/resolve/[...slug].get.d.ts +20 -0
- package/dist/runtime/server/api/resolve/[...slug].get.js +33 -2
- package/dist/runtime/server/api/search.get.d.ts +1 -1
- package/dist/runtime/server/api/search.get.js +42 -39
- package/dist/runtime/server/api/tree.get.d.ts +9 -0
- package/dist/runtime/server/api/tree.get.js +25 -0
- package/dist/runtime/server/janitor/junJanitorActor.d.ts +13 -0
- package/dist/runtime/server/janitor/junJanitorActor.js +36 -5
- package/dist/runtime/server/janitor/junJanitorChores.d.ts +14 -7
- package/dist/runtime/server/janitor/junJanitorChores.js +21 -3
- package/dist/runtime/server/janitor/junJanitorMachine.js +36 -4
- package/dist/runtime/server/janitor/junJanitorPerform.d.ts +15 -1
- package/dist/runtime/server/janitor/junJanitorPerform.js +13 -5
- package/dist/runtime/server/janitor/junJanitorYText.d.ts +40 -3
- package/dist/runtime/server/janitor/junJanitorYText.js +60 -14
- package/dist/runtime/server/plugins/jun-janitor.js +132 -81
- package/dist/runtime/server/routes/jun-card.png.get.d.ts +2 -0
- package/dist/runtime/server/routes/jun-card.png.get.js +40 -0
- package/dist/runtime/server/utils/junCard.d.ts +39 -0
- package/dist/runtime/server/utils/junCard.js +159 -0
- package/dist/runtime/server/utils/junIcon.d.ts +27 -2
- package/dist/runtime/server/utils/junIcon.js +5 -5
- package/dist/runtime/server/utils/junJanitorStatus.d.ts +59 -0
- package/dist/runtime/server/utils/junJanitorStatus.js +27 -0
- package/dist/runtime/types.d.ts +225 -0
- package/dist/runtime/utils/junAdopt.d.ts +43 -0
- package/dist/runtime/utils/junAdopt.js +7 -0
- package/dist/runtime/utils/junGesture.d.ts +84 -0
- package/dist/runtime/utils/junGesture.js +40 -0
- package/dist/runtime/utils/junLetters.d.ts +86 -0
- package/dist/runtime/utils/junLetters.js +173 -0
- package/dist/runtime/utils/junNavValue.d.ts +56 -0
- package/dist/runtime/utils/junNavValue.js +36 -0
- package/dist/runtime/utils/junSearchRank.d.ts +79 -0
- package/dist/runtime/utils/junSearchRank.js +73 -0
- package/dist/runtime/utils/junSocial.d.ts +59 -0
- package/dist/runtime/utils/junSocial.js +56 -0
- package/dist/runtime/utils/junViewSpecs.d.ts +38 -0
- package/dist/runtime/utils/junViewSpecs.js +92 -1
- package/package.json +10 -8
- /package/dist/runtime/components/{JunSectionPresence.client.d.vue.ts → JunSectionPresence.d.vue.ts} +0 -0
- /package/dist/runtime/components/{JunSectionPresence.client.vue → JunSectionPresence.vue} +0 -0
- /package/dist/runtime/components/{JunSectionPresence.client.vue.d.ts → JunSectionPresence.vue.d.ts} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { JunNavMobileMode } from '../types.js';
|
|
2
|
+
import { type JunNavigationItem } from '../composables/useJunNavItems.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
items: JunNavigationItem[];
|
|
6
|
+
/** `dock` has no overlay of its own — its `⋯` tab opens the sheet. */
|
|
7
|
+
mode: JunNavMobileMode;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
"update:open": (args_0: boolean) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
"onUpdate:open"?: ((args_0: boolean) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, nextTick, onUnmounted, ref, watch } from "vue";
|
|
3
|
+
import { useRoute } from "#imports";
|
|
4
|
+
import { onKeyStroke } from "@vueuse/core";
|
|
5
|
+
import { useJunNavItems } from "../composables/useJunNavItems";
|
|
6
|
+
import { useJunNavSettings } from "../composables/useJunNavSettings";
|
|
7
|
+
import { useJunOptions } from "../composables/useJunOptions";
|
|
8
|
+
import { useJunSearch } from "../composables/useJunSearch";
|
|
9
|
+
import { useJunStudio } from "../composables/useJunStudio";
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
open: { type: Boolean, required: true },
|
|
12
|
+
items: { type: Array, required: true },
|
|
13
|
+
mode: { type: String, required: true }
|
|
14
|
+
});
|
|
15
|
+
const emit = defineEmits(["update:open"]);
|
|
16
|
+
const route = useRoute();
|
|
17
|
+
const { features } = useJunOptions();
|
|
18
|
+
const nav = useJunNavSettings();
|
|
19
|
+
const { openSearch } = useJunSearch();
|
|
20
|
+
const { editing, canEdit, openLogin } = useJunStudio();
|
|
21
|
+
const items = computed(() => props.items);
|
|
22
|
+
const {
|
|
23
|
+
iconFor,
|
|
24
|
+
navLabelFor,
|
|
25
|
+
redirectTargetFor,
|
|
26
|
+
isExternalTarget,
|
|
27
|
+
childrenOf,
|
|
28
|
+
presenceFor,
|
|
29
|
+
activeTrail,
|
|
30
|
+
labelOf
|
|
31
|
+
} = useJunNavItems(items);
|
|
32
|
+
const shape = computed(() => props.mode === "dock" ? "sheet" : props.mode);
|
|
33
|
+
const close = () => emit("update:open", false);
|
|
34
|
+
const expanded = ref(/* @__PURE__ */ new Set());
|
|
35
|
+
function toggleChildren(id) {
|
|
36
|
+
if (!id) return;
|
|
37
|
+
const next = new Set(expanded.value);
|
|
38
|
+
if (next.has(id)) next.delete(id);
|
|
39
|
+
else next.add(id);
|
|
40
|
+
expanded.value = next;
|
|
41
|
+
}
|
|
42
|
+
const childrenFor = (id) => nav.menuChildren.value ? childrenOf(id) : [];
|
|
43
|
+
const gridBranch = ref(null);
|
|
44
|
+
const gridParent = computed(
|
|
45
|
+
() => items.value.find((i) => i.id === gridBranch.value) ?? null
|
|
46
|
+
);
|
|
47
|
+
const gridItems = computed(() => gridBranch.value ? childrenFor(gridBranch.value).map((child) => ({ ...child, current: route.path === child.href })) : items.value);
|
|
48
|
+
const trail = computed(() => activeTrail());
|
|
49
|
+
const rows = computed(() => {
|
|
50
|
+
const out = [];
|
|
51
|
+
const pushTop = (item, depth) => {
|
|
52
|
+
if (!item.id) return;
|
|
53
|
+
const kids = childrenFor(item.id);
|
|
54
|
+
const target = redirectTargetFor(item);
|
|
55
|
+
out.push({
|
|
56
|
+
id: item.id,
|
|
57
|
+
name: navLabelFor(item),
|
|
58
|
+
href: target ?? item.href,
|
|
59
|
+
icon: iconFor(item),
|
|
60
|
+
depth,
|
|
61
|
+
hasChildren: kids.length > 0,
|
|
62
|
+
isOpen: expanded.value.has(item.id),
|
|
63
|
+
current: item.current,
|
|
64
|
+
external: isExternalTarget(target),
|
|
65
|
+
presence: presenceFor(item.id).length,
|
|
66
|
+
presenceColor: presenceFor(item.id)[0]?.color
|
|
67
|
+
});
|
|
68
|
+
if (expanded.value.has(item.id)) walk(kids, depth + 1);
|
|
69
|
+
};
|
|
70
|
+
function walk(list, depth) {
|
|
71
|
+
if (depth > 10) return;
|
|
72
|
+
for (const child of list) {
|
|
73
|
+
const kids = childrenFor(child.id);
|
|
74
|
+
out.push({
|
|
75
|
+
id: child.id,
|
|
76
|
+
name: child.name,
|
|
77
|
+
href: child.href,
|
|
78
|
+
icon: child.icon,
|
|
79
|
+
depth,
|
|
80
|
+
hasChildren: kids.length > 0,
|
|
81
|
+
isOpen: expanded.value.has(child.id),
|
|
82
|
+
current: route.path === child.href,
|
|
83
|
+
external: false,
|
|
84
|
+
presence: presenceFor(child.id).length,
|
|
85
|
+
presenceColor: presenceFor(child.id)[0]?.color
|
|
86
|
+
});
|
|
87
|
+
if (expanded.value.has(child.id)) walk(kids, depth + 1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
for (const item of items.value) pushTop(item, 0);
|
|
91
|
+
return out;
|
|
92
|
+
});
|
|
93
|
+
const locationLabels = computed(() => trail.value.map((id) => labelOf(id)));
|
|
94
|
+
const panel = ref(null);
|
|
95
|
+
let restoreOverflow = "";
|
|
96
|
+
let opener = null;
|
|
97
|
+
let giveFocusBack = false;
|
|
98
|
+
watch(() => props.open, async (open) => {
|
|
99
|
+
if (!import.meta.client) return;
|
|
100
|
+
const root = document.documentElement;
|
|
101
|
+
if (open) {
|
|
102
|
+
opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
103
|
+
giveFocusBack = true;
|
|
104
|
+
restoreOverflow = root.style.overflow;
|
|
105
|
+
root.style.overflow = "hidden";
|
|
106
|
+
root.dataset.junNavMenu = "open";
|
|
107
|
+
if (nav.menuChildren.value) {
|
|
108
|
+
const next = new Set(expanded.value);
|
|
109
|
+
for (const id of trail.value) next.add(id);
|
|
110
|
+
expanded.value = next;
|
|
111
|
+
}
|
|
112
|
+
await nextTick();
|
|
113
|
+
panel.value?.focus();
|
|
114
|
+
} else {
|
|
115
|
+
root.style.overflow = restoreOverflow;
|
|
116
|
+
delete root.dataset.junNavMenu;
|
|
117
|
+
dragY.value = 0;
|
|
118
|
+
gridBranch.value = null;
|
|
119
|
+
await nextTick();
|
|
120
|
+
if (giveFocusBack) {
|
|
121
|
+
const recorded = opener?.isConnected && opener !== document.body ? opener : null;
|
|
122
|
+
const back = recorded ?? document.querySelector('[aria-controls="jun-nav-menu-panel"]');
|
|
123
|
+
back?.focus();
|
|
124
|
+
}
|
|
125
|
+
opener = null;
|
|
126
|
+
giveFocusBack = false;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
onUnmounted(() => {
|
|
130
|
+
if (!import.meta.client) return;
|
|
131
|
+
document.documentElement.style.overflow = restoreOverflow;
|
|
132
|
+
delete document.documentElement.dataset.junNavMenu;
|
|
133
|
+
});
|
|
134
|
+
onKeyStroke("Escape", () => {
|
|
135
|
+
if (!props.open) return;
|
|
136
|
+
if (gridBranch.value) gridBranch.value = null;
|
|
137
|
+
else close();
|
|
138
|
+
});
|
|
139
|
+
watch(() => route.path, () => {
|
|
140
|
+
if (!props.open) return;
|
|
141
|
+
giveFocusBack = false;
|
|
142
|
+
close();
|
|
143
|
+
});
|
|
144
|
+
function onTab(e) {
|
|
145
|
+
const root = panel.value;
|
|
146
|
+
if (!root) return;
|
|
147
|
+
const focusable = Array.from(root.querySelectorAll(
|
|
148
|
+
'a[href], button:not([disabled]), input, [tabindex]:not([tabindex="-1"])'
|
|
149
|
+
)).filter((el) => el.offsetParent !== null);
|
|
150
|
+
if (!focusable.length) return;
|
|
151
|
+
const first = focusable[0];
|
|
152
|
+
const last = focusable[focusable.length - 1];
|
|
153
|
+
if (e.shiftKey && document.activeElement === first) {
|
|
154
|
+
e.preventDefault();
|
|
155
|
+
last.focus();
|
|
156
|
+
} else if (!e.shiftKey && document.activeElement === last) {
|
|
157
|
+
e.preventDefault();
|
|
158
|
+
first.focus();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const dragY = ref(0);
|
|
162
|
+
let dragFrom = 0;
|
|
163
|
+
let dragging = false;
|
|
164
|
+
function onGrabDown(e) {
|
|
165
|
+
if (shape.value !== "sheet") return;
|
|
166
|
+
dragging = true;
|
|
167
|
+
dragFrom = e.clientY;
|
|
168
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
169
|
+
}
|
|
170
|
+
function onGrabMove(e) {
|
|
171
|
+
if (!dragging) return;
|
|
172
|
+
dragY.value = Math.max(0, e.clientY - dragFrom);
|
|
173
|
+
}
|
|
174
|
+
function onGrabUp() {
|
|
175
|
+
if (!dragging) return;
|
|
176
|
+
dragging = false;
|
|
177
|
+
if (dragY.value > 96) close();
|
|
178
|
+
else dragY.value = 0;
|
|
179
|
+
}
|
|
180
|
+
const panelClass = computed(() => {
|
|
181
|
+
switch (shape.value) {
|
|
182
|
+
case "drawer-left":
|
|
183
|
+
return "inset-y-0 left-0 w-[min(20rem,85vw)] rounded-r-2xl";
|
|
184
|
+
case "drawer-right":
|
|
185
|
+
return "inset-y-0 right-0 w-[min(20rem,85vw)] rounded-l-2xl";
|
|
186
|
+
case "fullscreen":
|
|
187
|
+
case "grid":
|
|
188
|
+
return "inset-0";
|
|
189
|
+
default:
|
|
190
|
+
return "inset-x-0 bottom-0 max-h-[85vh] rounded-t-2xl";
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
const transitionName = computed(() => {
|
|
194
|
+
switch (shape.value) {
|
|
195
|
+
case "drawer-left":
|
|
196
|
+
return "jun-menu-left";
|
|
197
|
+
case "drawer-right":
|
|
198
|
+
return "jun-menu-right";
|
|
199
|
+
case "fullscreen":
|
|
200
|
+
case "grid":
|
|
201
|
+
return "jun-menu-fade";
|
|
202
|
+
default:
|
|
203
|
+
return "jun-menu-up";
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
const isGrid = computed(() => shape.value === "grid");
|
|
207
|
+
const showIcon = computed(() => isGrid.value || nav.menuItemMode.value !== "text");
|
|
208
|
+
const showLabel = computed(() => !isGrid.value ? nav.menuItemMode.value !== "icon" : true);
|
|
209
|
+
const hasExtras = computed(() => nav.menuExtras.value);
|
|
210
|
+
</script>
|
|
211
|
+
|
|
212
|
+
<template>
|
|
213
|
+
<Teleport to="body">
|
|
214
|
+
<Transition name="jun-menu-scrim">
|
|
215
|
+
<div
|
|
216
|
+
v-if="open"
|
|
217
|
+
class="jun-nav-menu-scrim fixed inset-0 z-[60] bg-black/40"
|
|
218
|
+
aria-hidden="true"
|
|
219
|
+
@click="close"
|
|
220
|
+
/>
|
|
221
|
+
</Transition>
|
|
222
|
+
|
|
223
|
+
<Transition :name="transitionName">
|
|
224
|
+
<div
|
|
225
|
+
v-if="open"
|
|
226
|
+
id="jun-nav-menu-panel"
|
|
227
|
+
ref="panel"
|
|
228
|
+
class="jun-nav-menu jun-blur fixed z-[61] flex flex-col overflow-hidden border border-white/10 shadow-2xl shadow-black/30 ring-1 ring-black/5 focus:outline-none dark:border-black/5 dark:ring-white/10"
|
|
229
|
+
:class="panelClass"
|
|
230
|
+
:style="dragY ? { transform: `translateY(${dragY}px)`, transition: 'none' } : void 0"
|
|
231
|
+
role="dialog"
|
|
232
|
+
aria-modal="true"
|
|
233
|
+
aria-label="Navigation"
|
|
234
|
+
tabindex="-1"
|
|
235
|
+
@keydown.tab="onTab"
|
|
236
|
+
>
|
|
237
|
+
<!-- The grabber. Present on a sheet only — a drawer does not drag down,
|
|
238
|
+
and a full-screen panel has nowhere to go. -->
|
|
239
|
+
<div
|
|
240
|
+
v-if="shape === 'sheet'"
|
|
241
|
+
class="jun-nav-menu-grab flex flex-none cursor-grab justify-center pb-1 pt-3"
|
|
242
|
+
@pointerdown="onGrabDown"
|
|
243
|
+
@pointermove="onGrabMove"
|
|
244
|
+
@pointerup="onGrabUp"
|
|
245
|
+
@pointercancel="onGrabUp"
|
|
246
|
+
>
|
|
247
|
+
<span class="h-1 w-10 rounded-full bg-black/15 dark:bg-white/20" />
|
|
248
|
+
</div>
|
|
249
|
+
|
|
250
|
+
<header class="flex flex-none items-center justify-between gap-3 px-5 pb-2 pt-4">
|
|
251
|
+
<JunLogo class="h-6 w-auto" />
|
|
252
|
+
<button
|
|
253
|
+
type="button"
|
|
254
|
+
class="flex size-8 items-center justify-center rounded-full text-black/55 transition-colors hover:text-black dark:text-white/55 dark:hover:text-white"
|
|
255
|
+
aria-label="Close navigation"
|
|
256
|
+
@click="close"
|
|
257
|
+
>
|
|
258
|
+
<UIcon
|
|
259
|
+
name="i-lucide-x"
|
|
260
|
+
class="size-5"
|
|
261
|
+
/>
|
|
262
|
+
</button>
|
|
263
|
+
</header>
|
|
264
|
+
|
|
265
|
+
<!-- Where you are. Only when the page IS somewhere in this tree — on a
|
|
266
|
+
stand-alone URL there is no branch to name, and a breadcrumb to
|
|
267
|
+
nothing is worse than none. -->
|
|
268
|
+
<p
|
|
269
|
+
v-if="locationLabels.length > 1"
|
|
270
|
+
class="flex-none truncate px-5 pb-2 text-[11px] text-black/45 dark:text-white/45"
|
|
271
|
+
>
|
|
272
|
+
{{ locationLabels.join(" \u203A ") }}
|
|
273
|
+
</p>
|
|
274
|
+
|
|
275
|
+
<nav
|
|
276
|
+
class="min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 pb-3"
|
|
277
|
+
:style="{ paddingBottom: 'calc(0.75rem + env(safe-area-inset-bottom, 0px))' }"
|
|
278
|
+
>
|
|
279
|
+
<!-- GRID is a launcher, so it stays ONE SCREEN deep and drills
|
|
280
|
+
rather than nesting: the tile opens the page, the chevron opens
|
|
281
|
+
its sub-pages on a screen of their own. A launcher with a tree
|
|
282
|
+
drawn into it is a list, which is what the other modes are. -->
|
|
283
|
+
<template v-if="isGrid">
|
|
284
|
+
<button
|
|
285
|
+
v-if="gridBranch"
|
|
286
|
+
type="button"
|
|
287
|
+
class="jun-nav-menu-item mx-2 mb-1 flex w-[calc(100%-1rem)] items-center gap-2 rounded-xl px-3 py-2.5 text-left text-sm text-black/70 transition-colors hover:bg-black/5 dark:text-white/70 dark:hover:bg-white/10"
|
|
288
|
+
@click="gridBranch = null"
|
|
289
|
+
>
|
|
290
|
+
<UIcon
|
|
291
|
+
name="i-lucide-chevron-left"
|
|
292
|
+
class="size-4 flex-none"
|
|
293
|
+
/>
|
|
294
|
+
<span class="min-w-0 truncate">{{ gridParent ? navLabelFor(gridParent) : "Back" }}</span>
|
|
295
|
+
</button>
|
|
296
|
+
<ul class="grid grid-cols-3 gap-2 p-2">
|
|
297
|
+
<li
|
|
298
|
+
v-for="item in gridItems"
|
|
299
|
+
:key="item.id || item.href"
|
|
300
|
+
class="relative"
|
|
301
|
+
>
|
|
302
|
+
<NuxtLink
|
|
303
|
+
:to="redirectTargetFor(item) ?? item.href"
|
|
304
|
+
:target="isExternalTarget(redirectTargetFor(item)) ? '_blank' : void 0"
|
|
305
|
+
:rel="isExternalTarget(redirectTargetFor(item)) ? 'noopener noreferrer' : void 0"
|
|
306
|
+
class="jun-nav-menu-item relative flex aspect-square flex-col items-center justify-center gap-2 rounded-xl px-3 py-3 text-center text-black/70 transition-colors hover:bg-black/5 dark:text-white/70 dark:hover:bg-white/10"
|
|
307
|
+
:class="item.current ? 'bg-black/5 font-medium text-black dark:bg-white/10 dark:text-white' : ''"
|
|
308
|
+
@click="close"
|
|
309
|
+
>
|
|
310
|
+
<UIcon
|
|
311
|
+
:name="iconFor(item)"
|
|
312
|
+
class="size-6 flex-none"
|
|
313
|
+
/>
|
|
314
|
+
<span class="min-w-0 truncate text-xs">{{ navLabelFor(item) }}</span>
|
|
315
|
+
<span
|
|
316
|
+
v-if="presenceFor(item.id).length"
|
|
317
|
+
class="jun-nav-presence-dot absolute right-2 top-2 size-1.5 rounded-full"
|
|
318
|
+
:style="{ background: presenceFor(item.id)[0].color }"
|
|
319
|
+
/>
|
|
320
|
+
</NuxtLink>
|
|
321
|
+
<!-- Its own control, and its own hit box: tapping the TILE must
|
|
322
|
+
still open the page. A tile that drills instead would make
|
|
323
|
+
a section with children unreachable from its own menu. -->
|
|
324
|
+
<button
|
|
325
|
+
v-if="!gridBranch && childrenFor(item.id).length"
|
|
326
|
+
type="button"
|
|
327
|
+
class="absolute bottom-1 right-1 flex size-8 items-center justify-center rounded-lg text-black/45 transition-colors hover:bg-black/10 hover:text-black dark:text-white/45 dark:hover:bg-white/15 dark:hover:text-white"
|
|
328
|
+
:aria-label="`Sub-pages of ${navLabelFor(item)}`"
|
|
329
|
+
@click.stop.prevent="gridBranch = item.id ?? null"
|
|
330
|
+
>
|
|
331
|
+
<UIcon
|
|
332
|
+
name="i-lucide-chevron-right"
|
|
333
|
+
class="size-4"
|
|
334
|
+
/>
|
|
335
|
+
</button>
|
|
336
|
+
</li>
|
|
337
|
+
</ul>
|
|
338
|
+
</template>
|
|
339
|
+
|
|
340
|
+
<!-- Everything else is the flat row list, with a depth on each row.
|
|
341
|
+
`paddingLeft` is inline because it is a MEASUREMENT off the
|
|
342
|
+
depth, and a class assembled from a number is a class Tailwind
|
|
343
|
+
never generated. -->
|
|
344
|
+
<ul
|
|
345
|
+
v-else
|
|
346
|
+
class="flex flex-col gap-0.5 p-1"
|
|
347
|
+
>
|
|
348
|
+
<li
|
|
349
|
+
v-for="row in rows"
|
|
350
|
+
:key="row.id"
|
|
351
|
+
>
|
|
352
|
+
<div class="flex items-center gap-1">
|
|
353
|
+
<NuxtLink
|
|
354
|
+
:to="row.href"
|
|
355
|
+
:target="row.external ? '_blank' : void 0"
|
|
356
|
+
:rel="row.external ? 'noopener noreferrer' : void 0"
|
|
357
|
+
class="jun-nav-menu-item relative flex min-w-0 flex-1 items-center gap-3 rounded-xl px-3 text-black/70 transition-colors hover:bg-black/5 dark:text-white/70 dark:hover:bg-white/10"
|
|
358
|
+
:class="[
|
|
359
|
+
row.depth ? 'py-2 text-sm' : 'py-3 text-base',
|
|
360
|
+
row.current ? 'bg-black/5 font-medium text-black dark:bg-white/10 dark:text-white' : ''
|
|
361
|
+
]"
|
|
362
|
+
:style="{ paddingLeft: `${0.75 + row.depth * 1}rem` }"
|
|
363
|
+
:aria-current="row.current ? 'page' : void 0"
|
|
364
|
+
@click="close"
|
|
365
|
+
>
|
|
366
|
+
<UIcon
|
|
367
|
+
v-if="showIcon && !row.depth"
|
|
368
|
+
:name="row.icon ?? 'i-lucide-file'"
|
|
369
|
+
class="size-5 flex-none"
|
|
370
|
+
/>
|
|
371
|
+
<span
|
|
372
|
+
v-else-if="row.depth"
|
|
373
|
+
class="size-1 flex-none rounded-full bg-current opacity-30"
|
|
374
|
+
aria-hidden="true"
|
|
375
|
+
/>
|
|
376
|
+
<span
|
|
377
|
+
v-if="showLabel"
|
|
378
|
+
class="min-w-0 truncate"
|
|
379
|
+
>{{ row.name }}</span>
|
|
380
|
+
<UIcon
|
|
381
|
+
v-if="row.external"
|
|
382
|
+
name="i-lucide-arrow-up-right"
|
|
383
|
+
class="size-3.5 flex-none opacity-60"
|
|
384
|
+
aria-hidden="true"
|
|
385
|
+
/>
|
|
386
|
+
<span
|
|
387
|
+
v-if="row.presence"
|
|
388
|
+
class="jun-nav-presence-dot absolute right-2 top-2 size-1.5 rounded-full"
|
|
389
|
+
:style="{ background: row.presenceColor }"
|
|
390
|
+
:title="`${row.presence} here`"
|
|
391
|
+
/>
|
|
392
|
+
</NuxtLink>
|
|
393
|
+
|
|
394
|
+
<!-- Children are DISCLOSED, never auto-expanded — except on the
|
|
395
|
+
branch the visitor is already inside, which the open
|
|
396
|
+
handler expands for them.
|
|
397
|
+
|
|
398
|
+
No `aria-controls`: the children are SIBLING ROWS in one
|
|
399
|
+
flat list, not a container this button could point at, and
|
|
400
|
+
an `aria-controls` naming an element that does not exist is
|
|
401
|
+
worse than none. `aria-expanded` alone is valid and is what
|
|
402
|
+
a screen reader announces. -->
|
|
403
|
+
<button
|
|
404
|
+
v-if="row.hasChildren"
|
|
405
|
+
type="button"
|
|
406
|
+
class="flex size-9 flex-none items-center justify-center rounded-lg text-black/45 transition-transform hover:text-black dark:text-white/45 dark:hover:text-white"
|
|
407
|
+
:class="row.isOpen ? 'rotate-180' : ''"
|
|
408
|
+
:aria-expanded="row.isOpen"
|
|
409
|
+
:aria-label="`Sub-pages of ${row.name}`"
|
|
410
|
+
@click="toggleChildren(row.id)"
|
|
411
|
+
>
|
|
412
|
+
<UIcon
|
|
413
|
+
name="i-lucide-chevron-down"
|
|
414
|
+
class="size-4"
|
|
415
|
+
/>
|
|
416
|
+
</button>
|
|
417
|
+
</div>
|
|
418
|
+
</li>
|
|
419
|
+
</ul>
|
|
420
|
+
</nav>
|
|
421
|
+
|
|
422
|
+
<!-- The extras. On a desktop these live in the ⌘K palette, which a
|
|
423
|
+
phone has no keyboard for — so a menu that omits them takes them
|
|
424
|
+
away from exactly the visitors who cannot reach them otherwise. -->
|
|
425
|
+
<footer
|
|
426
|
+
v-if="hasExtras"
|
|
427
|
+
class="flex flex-none items-center gap-2 border-t border-black/5 px-4 py-3 dark:border-white/10"
|
|
428
|
+
:style="{ paddingBottom: 'calc(0.75rem + env(safe-area-inset-bottom, 0px))' }"
|
|
429
|
+
>
|
|
430
|
+
<button
|
|
431
|
+
v-if="features.search"
|
|
432
|
+
type="button"
|
|
433
|
+
class="flex flex-1 items-center gap-2 rounded-xl bg-black/5 px-3 py-2.5 text-sm text-black/60 transition-colors hover:text-black dark:bg-white/10 dark:text-white/60 dark:hover:text-white"
|
|
434
|
+
@click="close();
|
|
435
|
+
openSearch()"
|
|
436
|
+
>
|
|
437
|
+
<UIcon
|
|
438
|
+
name="i-lucide-search"
|
|
439
|
+
class="size-4 flex-none"
|
|
440
|
+
/>
|
|
441
|
+
<span>Search</span>
|
|
442
|
+
</button>
|
|
443
|
+
|
|
444
|
+
<JunThemeToggle />
|
|
445
|
+
|
|
446
|
+
<button
|
|
447
|
+
v-if="features.studio && !canEdit"
|
|
448
|
+
type="button"
|
|
449
|
+
class="flex size-8 items-center justify-center rounded-full text-black/55 transition-colors hover:text-black dark:text-white/55 dark:hover:text-white"
|
|
450
|
+
aria-label="Sign in"
|
|
451
|
+
title="Sign in"
|
|
452
|
+
@click="close();
|
|
453
|
+
openLogin()"
|
|
454
|
+
>
|
|
455
|
+
<UIcon
|
|
456
|
+
name="i-lucide-key-round"
|
|
457
|
+
class="size-4"
|
|
458
|
+
/>
|
|
459
|
+
</button>
|
|
460
|
+
<span
|
|
461
|
+
v-else-if="editing"
|
|
462
|
+
class="flex size-8 items-center justify-center rounded-full bg-black/5 text-black/55 dark:bg-white/10 dark:text-white/55"
|
|
463
|
+
title="Editing"
|
|
464
|
+
>
|
|
465
|
+
<UIcon
|
|
466
|
+
name="i-lucide-pen"
|
|
467
|
+
class="size-4"
|
|
468
|
+
/>
|
|
469
|
+
</span>
|
|
470
|
+
</footer>
|
|
471
|
+
</div>
|
|
472
|
+
</Transition>
|
|
473
|
+
</Teleport>
|
|
474
|
+
</template>
|
|
475
|
+
|
|
476
|
+
<style scoped>
|
|
477
|
+
.jun-menu-left-enter-active,.jun-menu-left-leave-active,.jun-menu-right-enter-active,.jun-menu-right-leave-active,.jun-menu-up-enter-active,.jun-menu-up-leave-active{transition:translate .32s cubic-bezier(.22,1,.36,1),opacity .24s ease}.jun-menu-up-enter-from,.jun-menu-up-leave-to{translate:0 100%}.jun-menu-left-enter-from,.jun-menu-left-leave-to{translate:-100% 0}.jun-menu-right-enter-from,.jun-menu-right-leave-to{translate:100% 0}.jun-menu-fade-enter-active,.jun-menu-fade-leave-active,.jun-menu-scrim-enter-active,.jun-menu-scrim-leave-active{transition:opacity .22s ease}.jun-menu-fade-enter-from,.jun-menu-fade-leave-to,.jun-menu-scrim-enter-from,.jun-menu-scrim-leave-to{opacity:0}@media (prefers-reduced-motion:reduce){.jun-menu-left-enter-active,.jun-menu-left-leave-active,.jun-menu-right-enter-active,.jun-menu-right-leave-active,.jun-menu-up-enter-active,.jun-menu-up-leave-active{transition:opacity .2s ease}.jun-menu-left-enter-from,.jun-menu-left-leave-to,.jun-menu-right-enter-from,.jun-menu-right-leave-to,.jun-menu-up-enter-from,.jun-menu-up-leave-to{opacity:0;translate:none}}
|
|
478
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { JunNavMobileMode } from '../types.js';
|
|
2
|
+
import { type JunNavigationItem } from '../composables/useJunNavItems.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
items: JunNavigationItem[];
|
|
6
|
+
/** `dock` has no overlay of its own — its `⋯` tab opens the sheet. */
|
|
7
|
+
mode: JunNavMobileMode;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
"update:open": (args_0: boolean) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
"onUpdate:open"?: ((args_0: boolean) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JunNavMobileMode, JunNavOverflow, JunNavPlacement } from '../types.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** What to draw. Exactly one of these is honoured, in this order. */
|
|
4
|
+
mobile?: JunNavMobileMode;
|
|
5
|
+
overflow?: JunNavOverflow;
|
|
6
|
+
placement?: JunNavPlacement;
|
|
7
|
+
/** Draw it as a phone rather than a window. */
|
|
8
|
+
phone?: boolean;
|
|
9
|
+
/** Lit, because it is the option currently chosen. */
|
|
10
|
+
active?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
13
|
+
active: boolean;
|
|
14
|
+
phone: boolean;
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|