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