@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,294 @@
1
+ import { computed, onMounted, ref } from "vue";
2
+ import { useRuntimeConfig } from "#app";
3
+ import { useAbracadabra, useJunEffectiveConfig, useJunOptions } from "#imports";
4
+ import {
5
+ JUN_OFFLINE_MEDIA_KEY,
6
+ JUN_OFFLINE_MODE_KEY,
7
+ JUN_OFFLINE_MODE_URL,
8
+ JUN_OFFLINE_SAVED_KEY,
9
+ junEstimateCopyBytes,
10
+ junOfflineBudgetBytes,
11
+ junOfflineCacheName,
12
+ junOfflineSavable,
13
+ junPageAssets,
14
+ junReadOfflineMode
15
+ } from "../utils/junOffline.js";
16
+ const open = ref(false);
17
+ const mounted = ref(false);
18
+ const mode = ref("visited");
19
+ const media = ref(false);
20
+ const receipt = ref(null);
21
+ const manifest = ref(null);
22
+ const usage = ref(null);
23
+ const syncing = ref(false);
24
+ const syncedDocs = ref(0);
25
+ const syncTotal = ref(0);
26
+ const saving = ref(false);
27
+ const savedCount = ref(0);
28
+ const savedTotal = ref(0);
29
+ const savedBytes = ref(0);
30
+ const lastError = ref(null);
31
+ let hydrated = false;
32
+ function readJson(key) {
33
+ try {
34
+ const raw = localStorage.getItem(key);
35
+ return raw ? JSON.parse(raw) : null;
36
+ } catch {
37
+ return null;
38
+ }
39
+ }
40
+ export function useJunOffline() {
41
+ const options = useJunOptions();
42
+ const config = useJunEffectiveConfig();
43
+ const runtime = useRuntimeConfig();
44
+ const build = runtime.app?.buildId ?? "dev";
45
+ const cacheName = junOfflineCacheName(build);
46
+ const apiBase = options.apiBase;
47
+ const policy = computed(() => {
48
+ const site = config.value;
49
+ const ceiling = options.offline;
50
+ return {
51
+ enabled: ceiling.enabled && site.offlineOffer !== false,
52
+ fullSite: ceiling.fullSite && site.offlineFullSite !== false,
53
+ media: site.offlineMedia ?? ceiling.media,
54
+ docSync: site.offlineDocSync ?? ceiling.docSync,
55
+ budgetBytes: junOfflineBudgetBytes(site.offlineBudgetMb ?? ceiling.budgetMb),
56
+ defaultMode: site.offlineDefault ?? ceiling.defaultMode
57
+ };
58
+ });
59
+ onMounted(() => {
60
+ mounted.value = true;
61
+ if (hydrated) return;
62
+ hydrated = true;
63
+ mode.value = junReadOfflineMode(localStorage.getItem(JUN_OFFLINE_MODE_KEY), policy.value.defaultMode);
64
+ media.value = localStorage.getItem(JUN_OFFLINE_MEDIA_KEY) === "1";
65
+ receipt.value = readJson(JUN_OFFLINE_SAVED_KEY);
66
+ void refreshUsage();
67
+ });
68
+ async function refreshUsage() {
69
+ try {
70
+ const estimate2 = await navigator.storage?.estimate?.();
71
+ if (estimate2) usage.value = { used: estimate2.usage ?? 0, quota: estimate2.quota ?? 0 };
72
+ } catch {
73
+ usage.value = null;
74
+ }
75
+ }
76
+ async function cache() {
77
+ return caches.open(cacheName);
78
+ }
79
+ function nudgeWorker() {
80
+ try {
81
+ navigator.serviceWorker?.controller?.postMessage("jun:mode-changed");
82
+ } catch {
83
+ }
84
+ }
85
+ async function writeMode(next) {
86
+ if (!("caches" in globalThis)) return;
87
+ const store = await cache();
88
+ await store.put(
89
+ JUN_OFFLINE_MODE_URL,
90
+ new Response(JSON.stringify({ mode: next }), { headers: { "content-type": "application/json" } })
91
+ );
92
+ }
93
+ async function setMode(next) {
94
+ mode.value = next;
95
+ try {
96
+ localStorage.setItem(JUN_OFFLINE_MODE_KEY, next);
97
+ } catch {
98
+ }
99
+ await writeMode(next);
100
+ nudgeWorker();
101
+ if (next === "off") await purge();
102
+ await refreshUsage();
103
+ }
104
+ async function setMedia(next) {
105
+ media.value = next;
106
+ try {
107
+ localStorage.setItem(JUN_OFFLINE_MEDIA_KEY, next ? "1" : "0");
108
+ } catch {
109
+ }
110
+ }
111
+ async function loadManifest() {
112
+ try {
113
+ const res = await fetch(`${apiBase}/offline`);
114
+ if (!res.ok) return null;
115
+ const body = await res.json();
116
+ if (!body || !Array.isArray(body.pages)) return null;
117
+ manifest.value = body;
118
+ return body;
119
+ } catch {
120
+ return null;
121
+ }
122
+ }
123
+ async function estimate() {
124
+ const list = manifest.value ?? await loadManifest();
125
+ if (!list?.count) return 0;
126
+ try {
127
+ const res = await fetch("/", { headers: { accept: "text/html" } });
128
+ const sample = (await res.arrayBuffer()).byteLength;
129
+ return junEstimateCopyBytes(sample, list.count);
130
+ } catch {
131
+ return 0;
132
+ }
133
+ }
134
+ async function save(paths) {
135
+ if (saving.value) return null;
136
+ if (!("caches" in globalThis)) {
137
+ lastError.value = "This browser has no Cache Storage.";
138
+ return null;
139
+ }
140
+ const list = paths ?? (manifest.value ?? await loadManifest())?.pages;
141
+ if (!list?.length) {
142
+ lastError.value = "Could not read the list of pages.";
143
+ return null;
144
+ }
145
+ const wanted = list.filter(junOfflineSavable);
146
+ saving.value = true;
147
+ lastError.value = null;
148
+ savedCount.value = 0;
149
+ savedTotal.value = wanted.length;
150
+ savedBytes.value = 0;
151
+ const store = await cache();
152
+ const budget = policy.value.budgetBytes;
153
+ const withMedia = media.value && policy.value.media;
154
+ const assets = /* @__PURE__ */ new Set();
155
+ let stopped;
156
+ let assetCount = 0;
157
+ try {
158
+ for (const path of wanted) {
159
+ if (savedBytes.value >= budget) {
160
+ stopped = "budget";
161
+ break;
162
+ }
163
+ try {
164
+ const res = await fetch(path, { headers: { accept: "text/html" } });
165
+ if (!res.ok || res.type !== "basic") continue;
166
+ const html = await res.clone().text();
167
+ savedBytes.value += new Blob([html]).size;
168
+ await store.put(path, res);
169
+ for (const asset of junPageAssets(html, { media: withMedia })) assets.add(asset);
170
+ } catch {
171
+ }
172
+ savedCount.value++;
173
+ }
174
+ for (const asset of assets) {
175
+ if (savedBytes.value >= budget) {
176
+ stopped = "budget";
177
+ break;
178
+ }
179
+ if (await store.match(asset)) continue;
180
+ try {
181
+ const res = await fetch(asset);
182
+ if (!res.ok || res.type !== "basic") continue;
183
+ savedBytes.value += Number(res.headers.get("content-length")) || 0;
184
+ await store.put(asset, res);
185
+ assetCount++;
186
+ } catch {
187
+ }
188
+ }
189
+ const saved = {
190
+ at: Date.now(),
191
+ pages: savedCount.value,
192
+ assets: assetCount,
193
+ bytes: savedBytes.value,
194
+ build,
195
+ ...stopped ? { stopped } : {}
196
+ };
197
+ receipt.value = saved;
198
+ try {
199
+ localStorage.setItem(JUN_OFFLINE_SAVED_KEY, JSON.stringify(saved));
200
+ } catch {
201
+ }
202
+ if (mode.value !== "site") await setMode("site");
203
+ await refreshUsage();
204
+ return saved;
205
+ } finally {
206
+ saving.value = false;
207
+ }
208
+ }
209
+ async function purge() {
210
+ if (!("caches" in globalThis)) return;
211
+ await caches.delete(cacheName);
212
+ receipt.value = null;
213
+ try {
214
+ localStorage.removeItem(JUN_OFFLINE_SAVED_KEY);
215
+ } catch {
216
+ }
217
+ await writeMode(mode.value);
218
+ nudgeWorker();
219
+ await refreshUsage();
220
+ }
221
+ async function syncDocuments() {
222
+ if (syncing.value) return;
223
+ const { provider, client } = useAbracadabra();
224
+ if (!provider.value || !client.value) {
225
+ lastError.value = "Not connected yet.";
226
+ return;
227
+ }
228
+ syncing.value = true;
229
+ syncedDocs.value = 0;
230
+ syncTotal.value = 0;
231
+ try {
232
+ const { BackgroundSyncManager } = await import("@abraca/dabra");
233
+ const manager = new BackgroundSyncManager(provider.value, client.value, null, {
234
+ // Two at a time, with a gap. This opens a real WebSocket per document
235
+ // against the site's own backend; a visitor's button press must not
236
+ // look like a load test, and the server caps connections per IP —
237
+ // everything past the cap gets 429 and never syncs at all.
238
+ concurrency: 2,
239
+ throttleMs: 200,
240
+ // Files are the heavy half here exactly as images are for the pages,
241
+ // and the panel's media switch is about the PAGE copy. Prefetching
242
+ // every upload from a button labelled "keep the documents" would be
243
+ // the same silent download wearing a different name.
244
+ prefetchFiles: false
245
+ });
246
+ await manager.init();
247
+ const states = manager.getSyncStatus();
248
+ syncTotal.value = states.size;
249
+ await manager.syncAll();
250
+ syncedDocs.value = [...manager.getSyncStatus().values()].filter((state) => state.status === "synced").length;
251
+ syncTotal.value = manager.getSyncStatus().size;
252
+ manager.destroy();
253
+ await refreshUsage();
254
+ } catch (err) {
255
+ lastError.value = err instanceof Error ? err.message : "Could not sync the documents.";
256
+ } finally {
257
+ syncing.value = false;
258
+ }
259
+ }
260
+ const receiptStale = computed(() => !!receipt.value && receipt.value.build !== build);
261
+ const progress = computed(() => savedTotal.value > 0 ? Math.min(1, savedCount.value / savedTotal.value) : 0);
262
+ return {
263
+ open,
264
+ openOffline: () => {
265
+ open.value = true;
266
+ },
267
+ /** Deferred to mount — every reader below is client-only state. */
268
+ mounted,
269
+ mode,
270
+ media,
271
+ policy,
272
+ manifest,
273
+ usage,
274
+ receipt,
275
+ receiptStale,
276
+ saving,
277
+ savedCount,
278
+ savedTotal,
279
+ savedBytes,
280
+ progress,
281
+ lastError,
282
+ syncing,
283
+ syncedDocs,
284
+ syncTotal,
285
+ syncDocuments,
286
+ setMode,
287
+ setMedia,
288
+ loadManifest,
289
+ estimate,
290
+ save,
291
+ purge,
292
+ refreshUsage
293
+ };
294
+ }
@@ -10,6 +10,7 @@ export declare function useJunBrand(): import("vue").ComputedRef<{
10
10
  logoMark: import("../types.js").JunLogoMark;
11
11
  logoVariant: import("../types.js").JunLogoVariant;
12
12
  themeColor: string;
13
+ lang: string;
13
14
  iconBackground: string;
14
15
  schemaType: import("../types.js").JunBrand["schemaType"];
15
16
  }>;
@@ -1,4 +1,4 @@
1
- export type JunSettingsSection = 'identity' | 'navigation' | 'mark' | 'theme' | 'announcement' | 'campfire' | 'footer' | 'visitors' | 'renderers';
1
+ export type JunSettingsSection = 'identity' | 'navigation' | 'mark' | 'theme' | 'announcement' | 'campfire' | 'footer' | 'visitors' | 'offline' | 'renderers';
2
2
  export interface JunSettingsSectionDef {
3
3
  id: JunSettingsSection;
4
4
  label: string;
@@ -8,6 +8,8 @@ export const JUN_SETTINGS_SECTIONS = [
8
8
  { id: "campfire", label: "User center", icon: "i-lucide-flame", hint: "Chat, presence, reactions" },
9
9
  { id: "footer", label: "Footer", icon: "i-lucide-panel-bottom", hint: "The line at the bottom" },
10
10
  { id: "visitors", label: "Visitors", icon: "i-lucide-users", hint: "Guestbook, feeds, people" },
11
+ // After Visitors, because it is about what a visitor may take away with them.
12
+ { id: "offline", label: "Offline", icon: "i-lucide-cloud-download", hint: "What a reader may keep on their device" },
11
13
  // Last, because it is the only section that configures CONTENT rather than
12
14
  // chrome — and the only one whose controls are generated from the renderers'
13
15
  // own specs rather than written out here.
@@ -0,0 +1,30 @@
1
+ /**
2
+ * useJunSiblings — the pages either side of this one.
3
+ *
4
+ * Round eight gave journal entries a "newer / older" pair, computed inside the
5
+ * renderer. Round nine needs the same pair for a SWIPE, on any page type, so
6
+ * the arithmetic moved here — one list, one order, one visibility rule, read by
7
+ * the renderer that draws the links and by the gesture that follows them.
8
+ *
9
+ * Two things it will not do:
10
+ *
11
+ * - **Wrap.** A finite collection should feel finite; see `junNeighboursOf`.
12
+ * - **Offer a page nobody was shown.** Drafts, hidden pages, owner-only
13
+ * documents and the parent's own self-descriptor are all filtered out — a
14
+ * "next" that lands on the Site Config document is worse than no next.
15
+ */
16
+ import { type ComputedRef, type Ref } from 'vue';
17
+ import { type JunNeighbourPair } from '../utils/junGesture.js';
18
+ export interface JunSibling {
19
+ id: string;
20
+ label: string;
21
+ parentId?: string | null;
22
+ type?: string;
23
+ order?: number;
24
+ meta?: Record<string, unknown>;
25
+ }
26
+ export declare function useJunSiblings(docId: Ref<string | null> | ComputedRef<string | null>): {
27
+ siblings: ComputedRef<JunSibling[]>;
28
+ neighbours: ComputedRef<JunNeighbourPair<JunSibling>>;
29
+ parentId: ComputedRef<string | null>;
30
+ };
@@ -0,0 +1,38 @@
1
+ import { computed } from "vue";
2
+ import { useDocTree, useJunOptions } from "#imports";
3
+ import { junNeighboursOf, junSortSiblings } from "../utils/junGesture.js";
4
+ export function useJunSiblings(docId) {
5
+ const { entries, getEntry } = useDocTree();
6
+ const opts = useJunOptions();
7
+ const parentId = computed(() => {
8
+ const id = docId.value;
9
+ return id ? getEntry(id)?.parentId ?? null : null;
10
+ });
11
+ const orderMode = computed(() => {
12
+ const parentType = parentId.value ? getEntry(parentId.value)?.type : void 0;
13
+ return parentType && opts.feedItemTypes?.includes(parentType) ? "dated" : "order";
14
+ });
15
+ const siblings = computed(() => {
16
+ const parent = parentId.value;
17
+ if (!parent) return [];
18
+ const list = entries.value.filter(
19
+ (entry) => entry.parentId === parent && entry.id !== parent && !entry.trashed && !!entry.label && entry.meta?.draft !== true && entry.meta?.hidden !== true && entry.meta?.ownerOnly !== true && entry.meta?.siteConfig !== true && !entry.meta?.signerId && entry.meta?.replyTo == null
20
+ ).map((entry) => ({
21
+ id: entry.id,
22
+ label: entry.label ?? "",
23
+ parentId: entry.parentId ?? null,
24
+ type: entry.type,
25
+ order: entry.order,
26
+ meta: entry.meta
27
+ }));
28
+ return junSortSiblings(
29
+ list.map((entry) => ({ ...entry, date: entry.meta?.date })),
30
+ orderMode.value
31
+ );
32
+ });
33
+ const neighbours = computed(() => {
34
+ const id = docId.value;
35
+ return id ? junNeighboursOf(siblings.value, id) : { prev: null, next: null };
36
+ });
37
+ return { siblings, neighbours, parentId };
38
+ }
@@ -48,13 +48,20 @@
48
48
  */
49
49
  import { type ComputedRef } from 'vue';
50
50
  import type { TreeEntry } from '@abraca/nuxt';
51
- import type { JunBackdropKind, JunBackgroundFit, JunCampfirePillMode, JunCampfirePlacement, JunCampfireRosterStyle, JunCampfireSize, JunCampfireTab, JunNavActiveStyle, JunNavItemMode, JunNavLogoAction, JunNavPlacement, JunNavShape, JunNavSize } from '../types.js';
52
- export type { JunBackdropKind, JunBackgroundFit, JunCampfirePillMode, JunCampfirePlacement, JunCampfireRosterStyle, JunCampfireSize, JunCampfireTab, JunNavActiveStyle, JunNavItemMode, JunNavLogoAction, JunNavPlacement, JunNavShape, JunNavSize, } from '../types.js';
51
+ import type { JunBackdropKind, JunBackgroundFit, JunCampfirePillMode, JunCampfirePlacement, JunCampfireRosterStyle, JunCampfireSize, JunCampfireTab, JunNavActiveStyle, JunNavAlign, JunNavBreakpoint, JunNavChildrenMode, JunNavItemMode, JunNavLogoAction, JunNavMenuIcon, JunNavMenuSide, JunNavMobileItemMode, JunNavMobileMode, JunNavMobilePlacement, JunNavOverflow, JunNavPlacement, JunNavCountMode, JunNavSectionMode, JunNavRailBreakpoint, JunNavShape, JunNavSize, JunNavWidth } from '../types.js';
52
+ export type { JunBackdropKind, JunBackgroundFit, JunCampfirePillMode, JunCampfirePlacement, JunCampfireRosterStyle, JunCampfireSize, JunCampfireTab, JunNavActiveStyle, JunNavAlign, JunNavBreakpoint, JunNavChildrenMode, JunNavItemMode, JunNavLogoAction, JunNavMenuIcon, JunNavMenuSide, JunNavMobileItemMode, JunNavMobileMode, JunNavMobilePlacement, JunNavOverflow, JunNavPlacement, JunNavRailBreakpoint, JunNavShape, JunNavSize, JunNavWidth, } from '../types.js';
53
53
  export type JunThemeRadius = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
54
54
  export type JunThemeAccent = 'mono' | 'sun' | 'blue' | 'emerald' | 'violet' | 'amber' | 'rose' | 'teal';
55
55
  export type JunThemeNeutral = 'slate' | 'zinc' | 'stone';
56
56
  export type JunThemeBlobs = 'off' | 'quiet' | 'normal' | 'bold';
57
- export type JunThemeFont = 'default' | 'serif' | 'grotesk' | 'mono';
57
+ /**
58
+ * The site's typeface.
59
+ *
60
+ * The first four are ONE face each and are what the module has always offered;
61
+ * the last three are PAIRINGS — a body face and a display face — because a
62
+ * site's type is two decisions and only one of them was on offer.
63
+ */
64
+ export type JunThemeFont = 'default' | 'serif' | 'grotesk' | 'mono' | 'editorial' | 'humanist' | 'technical';
58
65
  /**
59
66
  * How much glass the site wears. `backdrop-filter` is the most expensive thing
60
67
  * on the page and this site has a lot of them, so this is a performance
@@ -67,10 +74,49 @@ export interface JunSiteConfig {
67
74
  seoTitleTemplate?: string;
68
75
  seoDescription?: string;
69
76
  seoOgImage?: string;
77
+ /**
78
+ * The address this site calls its own — `https://jun.is`.
79
+ *
80
+ * Only the owner can answer it. A site reachable at a preview domain, an IP,
81
+ * `www.` and bare has to name ONE of them in its canonical tag and its
82
+ * `og:url`, or every address competes with the others for the same page.
83
+ * Empty means "whatever address the visitor arrived on", which is right for
84
+ * a deployment with one.
85
+ */
86
+ seoSiteUrl?: string;
87
+ /** The site's language for `<html lang>` — a BCP-47 tag. */
88
+ seoLang?: string;
89
+ /**
90
+ * Offline — what a visitor may keep on their own device.
91
+ *
92
+ * Every key here LOWERS a ceiling the build already set (`jun.offline`), and
93
+ * none of them downloads anything: the default posture is "the pages this
94
+ * reader opened", and a whole-site copy is something they press a button for.
95
+ * Unset means the build's answer throughout.
96
+ */
97
+ offlineOffer?: boolean;
98
+ /** May a visitor save the whole site in one press? */
99
+ offlineFullSite?: boolean;
100
+ /** May images be part of a saved copy? The heavy half — off by default. */
101
+ offlineMedia?: boolean;
102
+ /** Ceiling on one saved copy, in megabytes. */
103
+ offlineBudgetMb?: number;
104
+ /** Offer the CRDT half: every document into IndexedDB. Owner-only. */
105
+ offlineDocSync?: boolean;
106
+ /** What a device that has never chosen gets. Never `site` — see the option type. */
107
+ offlineDefault?: 'off' | 'visited';
108
+ /** Swipe left/right to reach the next or previous page. Unset means on. */
109
+ gesturePages?: boolean;
110
+ /** Swipe in from a screen edge to open the navigation menu. Unset means on. */
111
+ gestureEdge?: boolean;
70
112
  /** Navigation — every key falls back to the build-time `jun.navigation` default. */
71
113
  navItemMode?: JunNavItemMode;
72
114
  navActiveStyle?: JunNavActiveStyle;
73
115
  navPlacement?: JunNavPlacement;
116
+ /** The section bar's shape. `off` is the default and what the site did before. */
117
+ navSection?: JunNavSectionMode;
118
+ /** What a nav item's badge counts. `off` is the default. */
119
+ navCounts?: JunNavCountMode;
74
120
  navShape?: JunNavShape;
75
121
  navSize?: JunNavSize;
76
122
  navAutoHide?: boolean;
@@ -89,6 +135,27 @@ export interface JunSiteConfig {
89
135
  /** The fellow-travellers dot stack, and whether hovering it names them. */
90
136
  navTravellers?: boolean;
91
137
  navTravellersList?: boolean;
138
+ /** Mobile navigation — the menu that replaces the track below `navBreakpoint`. */
139
+ navMobileMode?: JunNavMobileMode;
140
+ navMobilePlacement?: JunNavMobilePlacement;
141
+ navBreakpoint?: JunNavBreakpoint;
142
+ navMenuIcon?: JunNavMenuIcon;
143
+ navMenuSide?: JunNavMenuSide;
144
+ navMobileItemMode?: JunNavMobileItemMode;
145
+ navMenuChildren?: boolean;
146
+ navMenuExtras?: boolean;
147
+ /** Collapse the DESKTOP navbar into the same menu. */
148
+ navDesktopMenu?: boolean;
149
+ /** Track layout — overflow, submenus, alignment, width and the scroll chrome. */
150
+ navOverflow?: JunNavOverflow;
151
+ navChildren?: JunNavChildrenMode;
152
+ navAlign?: JunNavAlign;
153
+ navWidth?: JunNavWidth;
154
+ navSeparators?: boolean;
155
+ navScrollArrows?: boolean;
156
+ navEdgeFade?: boolean;
157
+ navSnap?: boolean;
158
+ navRailBreakpoint?: JunNavRailBreakpoint;
92
159
  /** Which built-in mark `<JunLogo>` draws, and whether it carries the name. */
93
160
  brandLogo?: 'sprout' | 'node' | 'page' | 'sun';
94
161
  brandLogoVariant?: 'mark' | 'lockup' | 'wordmark';
@@ -38,7 +38,10 @@ const BLOBS = {
38
38
  const FONT_CLASS = {
39
39
  serif: "jun-font-serif",
40
40
  grotesk: "jun-font-grotesk",
41
- mono: "jun-font-mono"
41
+ mono: "jun-font-mono",
42
+ editorial: "jun-font-editorial",
43
+ humanist: "jun-font-humanist",
44
+ technical: "jun-font-technical"
42
45
  };
43
46
  const SURFACE_CLASS = {
44
47
  glass: "",
@@ -1,8 +1,16 @@
1
+ import { getCurrentInstance, onMounted, ref } from "vue";
1
2
  import { useItemPresence } from "#imports";
2
3
  export function useJunViewingAccent() {
3
4
  const { getViewers } = useItemPresence();
5
+ const mounted = ref(false);
6
+ if (getCurrentInstance()) {
7
+ onMounted(() => {
8
+ mounted.value = true;
9
+ });
10
+ }
4
11
  const tint = (color, pct) => `color-mix(in oklab, ${color} ${pct}%, transparent)`;
5
12
  function accentStyle(id) {
13
+ if (!mounted.value) return void 0;
6
14
  const color = getViewers(id)[0]?.color;
7
15
  if (!color) return void 0;
8
16
  return {
@@ -10,6 +18,7 @@ export function useJunViewingAccent() {
10
18
  };
11
19
  }
12
20
  function accentInsetStyle(id) {
21
+ if (!mounted.value) return void 0;
13
22
  const color = getViewers(id)[0]?.color;
14
23
  if (!color) return void 0;
15
24
  return {
@@ -17,6 +26,7 @@ export function useJunViewingAccent() {
17
26
  };
18
27
  }
19
28
  function accentTitle(id) {
29
+ if (!mounted.value) return void 0;
20
30
  const viewers = getViewers(id);
21
31
  if (!viewers.length) return void 0;
22
32
  const first = viewers[0].name;
@@ -15,7 +15,7 @@ import {
15
15
  useJunStudio,
16
16
  useJunThemeApply
17
17
  } from "#imports";
18
- const { features, contextMenu } = useJunOptions();
18
+ const { features, contextMenu, offline, pwa } = useJunOptions();
19
19
  const { kind: backdropKind } = useJunBackdrop();
20
20
  const backdropComponent = computed(() => {
21
21
  if (backdropKind.value === "shader") return resolveComponent("JunShaderBackdrop");
@@ -31,6 +31,7 @@ const campfireLit = computed(() => campfireSettings.value.enabled);
31
31
  const { contentVeiled } = useJunIntro();
32
32
  if (features.presence) useJunPresenceBroadcast();
33
33
  const effectiveConfig = useJunEffectiveConfig();
34
+ const offlineOffered = computed(() => pwa && offline.enabled && effectiveConfig.value.offlineOffer !== false);
34
35
  const presenceBlobsLit = computed(() => {
35
36
  if (!features.presence || !features.awareBlobs) return false;
36
37
  const stored = effectiveConfig.value.presenceBlobs;
@@ -57,6 +58,26 @@ if (import.meta.client && contextMenu.suppressNative) {
57
58
 
58
59
  <template>
59
60
  <div class="relative min-h-screen">
61
+ <!-- Bypass the navbar. THE FIRST FOCUSABLE THING ON THE PAGE, and that is
62
+ the whole feature: put it inside `<JunShell>` and the navbar renders
63
+ first, so the link is stop twenty-six rather than stop one. (It was,
64
+ briefly. The check that caught it presses Tab once and reads what has
65
+ focus.)
66
+
67
+ Measured before it was written: a keyboard visitor passes FOURTEEN
68
+ stops without reaching the content on this demo, and the navbar has
69
+ twenty-three items — so the real number is about twenty-five, on every
70
+ page of the site. WCAG 2.4.1 is a Level A criterion; this is its
71
+ standard remedy.
72
+
73
+ Outside the veil, too: the intro fades the CONTENT in, and a skip link
74
+ that is invisible for the first second is invisible exactly when a
75
+ keyboard reader arrives. -->
76
+ <a
77
+ href="#jun-main"
78
+ class="jun-skip-link"
79
+ >Skip to content</a>
80
+
60
81
  <!-- The persistent ambient backdrop. Always present; it quiets itself on
61
82
  locked page types. The page base stays the plain theme background —
62
83
  the backdrop paints ONLY the blobs. -->
@@ -91,7 +112,10 @@ if (import.meta.client && contextMenu.suppressNative) {
91
112
  :class="contentVeiled ? 'jun-content-veiled' : ''"
92
113
  >
93
114
  <JunShell>
94
- <UMain>
115
+ <UMain
116
+ id="jun-main"
117
+ tabindex="-1"
118
+ >
95
119
  <slot />
96
120
  </UMain>
97
121
 
@@ -157,6 +181,12 @@ if (import.meta.client && contextMenu.suppressNative) {
157
181
  > which is what pointed at shared state rather than node position. -->
158
182
  <JunSettings />
159
183
 
184
+ <!-- The visitor's own panel — what this SITE keeps on THIS device. Mounted
185
+ beside the settings for the same reason: the palette and the navigation
186
+ menu both open it, and neither is inside it. Renders nothing until
187
+ somebody asks, and not at all on a site with the PWA switched off. -->
188
+ <JunOfflinePanel v-if="offlineOffered" />
189
+
160
190
  <!-- Every renderer's media taps route here. Mounted once. -->
161
191
  <JunImagePopup v-if="features.lightbox" />
162
192
 
@@ -132,6 +132,8 @@ const cachedHtml = computed(() => hidden.value ? "" : resolved.value?.html ?? ""
132
132
  :editable="editing"
133
133
  :entry="cachedEntry"
134
134
  :html="cachedHtml"
135
+ :section="resolved?.section ?? null"
136
+ :trail="resolved?.trail"
135
137
  breadcrumbs
136
138
  />
137
139
 
@@ -67,6 +67,8 @@ function addChild() {
67
67
  :editable="editing"
68
68
  :entry="cachedEntry"
69
69
  :html="cachedHtml"
70
+ :section="resolved?.section ?? null"
71
+ :trail="resolved?.trail"
70
72
  >
71
73
  <template #footer>
72
74
  <div
@@ -1,3 +1,4 @@
1
+ import { type JunJanitorStatus } from '../utils/junJanitorStatus.js';
1
2
  import { type JunReadinessState } from '../../utils/junReadiness.js';
2
3
  export interface JunHealthReport {
3
4
  state: JunReadinessState;
@@ -14,6 +15,20 @@ export interface JunHealthReport {
14
15
  sweptMsAgo: number | null;
15
16
  rootDocId: string;
16
17
  ageMs: number;
18
+ /**
19
+ * The `@abraca/junis` version this image was BUILT from — the answer to "is
20
+ * the fix actually deployed", which is not a question the source tree can be
21
+ * asked. See `JunRuntimeOptions.version`.
22
+ */
23
+ version: string;
24
+ /** When this image was built, epoch ms — see `JunRuntimeOptions.builtAt`. */
25
+ builtAt: number | null;
26
+ /**
27
+ * What the janitor runner is doing. Reported even when the feature is off, so
28
+ * "there is no janitor" is always distinguishable from "there is no janitor
29
+ * IN THIS BUILD" — the two states that cost jun.is weeks.
30
+ */
31
+ janitor: JunJanitorStatus;
17
32
  }
18
33
  declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<JunHealthReport>>;
19
34
  export default _default;
@@ -2,6 +2,7 @@ import { defineEventHandler, setResponseStatus } from "h3";
2
2
  import { useRuntimeConfig, useStorage } from "nitropack/runtime";
3
3
  import { junDocTree, junHeartbeat, junRootDocId, junSlugMap } from "../utils/junCache.js";
4
4
  import { junBootedAt } from "../utils/junBoot.js";
5
+ import { junJanitorStatus } from "../utils/junJanitorStatus.js";
5
6
  import { junReadiness } from "../../utils/junReadiness.js";
6
7
  export default defineEventHandler(async (event) => {
7
8
  const storage = useStorage();
@@ -13,7 +14,8 @@ export default defineEventHandler(async (event) => {
13
14
  ]);
14
15
  const ageMs = Date.now() - junBootedAt();
15
16
  const sweptMsAgo = beat && beat.at >= junBootedAt() ? Date.now() - beat.at : null;
16
- const features = (useRuntimeConfig().public.jun ?? {}).features ?? {};
17
+ const jun = useRuntimeConfig().public.jun ?? {};
18
+ const features = jun.features ?? {};
17
19
  const verdict = junReadiness({
18
20
  treeSize: Object.keys(tree).length,
19
21
  slugCount: Object.keys(slugs).length,
@@ -35,6 +37,9 @@ export default defineEventHandler(async (event) => {
35
37
  },
36
38
  sweptMsAgo,
37
39
  rootDocId: junRootDocId(),
38
- ageMs
40
+ ageMs,
41
+ version: jun.version ?? "unknown",
42
+ builtAt: jun.builtAt ?? null,
43
+ janitor: junJanitorStatus()
39
44
  };
40
45
  });