@abraca/junis 2.92.0 → 2.95.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.json +1 -1
- package/dist/module.mjs +27 -5
- package/dist/runtime/assets/css/jun.css +1 -1
- package/dist/runtime/components/JunDocSurface.vue +1 -1
- package/dist/runtime/components/JunHead.vue +35 -4
- package/dist/runtime/components/JunHorizontalTimeline.vue +1 -1
- package/dist/runtime/components/JunImagePopup.client.vue +7 -2
- package/dist/runtime/components/JunNavMenu.client.vue +3 -3
- package/dist/runtime/components/JunNavPreview.d.vue.ts +2 -1
- package/dist/runtime/components/JunNavPreview.vue +61 -1
- package/dist/runtime/components/JunNavPreview.vue.d.ts +2 -1
- package/dist/runtime/components/JunNavigation.vue +110 -4
- package/dist/runtime/components/JunNotFound.vue +1 -1
- package/dist/runtime/components/JunReaders.vue +1 -1
- package/dist/runtime/components/JunShell.vue +20 -3
- package/dist/runtime/components/JunStudioBar.client.vue +1 -1
- package/dist/runtime/components/renderers/JunConfigRenderer.vue +179 -0
- package/dist/runtime/components/renderers/JunGardenRenderer.vue +45 -8
- package/dist/runtime/components/renderers/JunHomeRenderer.vue +2 -2
- package/dist/runtime/composables/useJunMobile.d.ts +5 -0
- package/dist/runtime/composables/useJunMobile.js +56 -0
- package/dist/runtime/composables/useJunNavItems.js +22 -1
- package/dist/runtime/composables/useJunNavSettings.d.ts +8 -1
- package/dist/runtime/composables/useJunNavSettings.js +21 -1
- package/dist/runtime/composables/useJunOptions.d.ts +2 -2
- package/dist/runtime/composables/useJunSettings.d.ts +1 -1
- package/dist/runtime/composables/useJunSettings.js +4 -0
- package/dist/runtime/composables/useJunSiteConfig.d.ts +63 -2
- package/dist/runtime/composables/useJunTheme.js +3 -7
- package/dist/runtime/error.vue +2 -2
- package/dist/runtime/layouts/jun.vue +3 -1
- package/dist/runtime/pages/doc.vue +1 -1
- package/dist/runtime/pages/index.vue +1 -1
- package/dist/runtime/server/janitor/junJanitorActor.d.ts +40 -0
- package/dist/runtime/server/janitor/junJanitorActor.js +118 -3
- package/dist/runtime/server/janitor/junJanitorMachine.js +25 -2
- package/dist/runtime/server/janitor/junJanitorStore.d.ts +30 -6
- package/dist/runtime/server/janitor/junJanitorStore.js +32 -15
- package/dist/runtime/server/plugins/jun-doc-cache.js +6 -8
- package/dist/runtime/server/plugins/jun-janitor.js +7 -0
- package/dist/runtime/server/routes/manifest.webmanifest.get.js +18 -0
- package/dist/runtime/types.d.ts +56 -2
- package/dist/runtime/utils/junIdentity.d.ts +13 -0
- package/dist/runtime/utils/junIdentity.js +7 -3
- package/dist/runtime/utils/junMark.d.ts +35 -0
- package/dist/runtime/utils/junMark.js +11 -0
- package/dist/runtime/utils/junNavValue.js +8 -1
- package/package.json +2 -1
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
import { junHear } from "./junJanitorListen.js";
|
|
25
25
|
import { junBlockNames, junBlocks, displayToBody, displayToBodyPos, junCursorState, junFragmentText } from "./junJanitorYText.js";
|
|
26
26
|
import { junIsAdopted } from "../../utils/junAdopt.js";
|
|
27
|
+
import { junJanitorNote } from "../utils/junJanitorStatus.js";
|
|
27
28
|
import { junPerform, junRangeMatches } from "./junJanitorPerform.js";
|
|
28
29
|
import {
|
|
29
30
|
junBin,
|
|
@@ -41,6 +42,8 @@ const BREAK_MAX_MS = 12 * 6e4;
|
|
|
41
42
|
const LEASE_CHECK_MS = 6e4;
|
|
42
43
|
const LEASE_STALE_MS = 5 * 6e4;
|
|
43
44
|
const GRUDGE_COOLDOWN_MS = 30 * 6e4;
|
|
45
|
+
const CHORE_RETRY_MS = [6e4, 5 * 6e4, 15 * 6e4, 30 * 6e4];
|
|
46
|
+
const CHORE_TROUBLE_AT = 3;
|
|
44
47
|
const IMPATIENT_AT = 3;
|
|
45
48
|
const GIVE_UP_AT = 5;
|
|
46
49
|
export function createJunJanitorMachine(options, deps) {
|
|
@@ -64,6 +67,7 @@ export function createJunJanitorMachine(options, deps) {
|
|
|
64
67
|
});
|
|
65
68
|
const memory = /* @__PURE__ */ new Map();
|
|
66
69
|
const seenEntries = /* @__PURE__ */ new Map();
|
|
70
|
+
const choreTrouble = /* @__PURE__ */ new Map();
|
|
67
71
|
const choreTimes = [];
|
|
68
72
|
let running = false;
|
|
69
73
|
let phase = "off";
|
|
@@ -360,6 +364,7 @@ export function createJunJanitorMachine(options, deps) {
|
|
|
360
364
|
}
|
|
361
365
|
async function turn() {
|
|
362
366
|
const at = now();
|
|
367
|
+
await deps.actor.ensureSession();
|
|
363
368
|
if (baselineHandle && at - leaseCheckedAt > LEASE_CHECK_MS) {
|
|
364
369
|
leaseCheckedAt = at;
|
|
365
370
|
const held = junClaimLease(baselineHandle, instanceId, at, LEASE_STALE_MS);
|
|
@@ -439,8 +444,12 @@ export function createJunJanitorMachine(options, deps) {
|
|
|
439
444
|
}
|
|
440
445
|
adoptNew(live);
|
|
441
446
|
const treeChores = planTreeChores(baselineSnapshot, live, { policy: chorePolicy() }).filter((c) => c.kind !== "body.remove" && c.kind !== "body.restore" && c.kind !== "body.replace").filter((c) => remember(c.docId).givenUpUntil < at);
|
|
442
|
-
|
|
443
|
-
|
|
447
|
+
const planned = new Set(treeChores.map((c) => c.id));
|
|
448
|
+
for (const id of [...choreTrouble.keys()]) {
|
|
449
|
+
if (!planned.has(id)) choreTrouble.delete(id);
|
|
450
|
+
}
|
|
451
|
+
const chore = treeChores.find((c) => (choreTrouble.get(c.id)?.retryAfter ?? 0) <= at);
|
|
452
|
+
if (chore && withinBudget(at)) {
|
|
444
453
|
const description = describeChore(chore);
|
|
445
454
|
const occupant = someoneOn(chore.docId);
|
|
446
455
|
await speak("notice", { page: labelOf(live, chore.docId), what: description.what, who: occupant });
|
|
@@ -449,9 +458,23 @@ export function createJunJanitorMachine(options, deps) {
|
|
|
449
458
|
const ok = await performTreeChore(chore, live);
|
|
450
459
|
deps.log(`${ok ? "did" : "gave up on"} ${chore.kind} on "${labelOf(live, chore.docId)}"`);
|
|
451
460
|
if (ok) {
|
|
461
|
+
choreTrouble.delete(chore.id);
|
|
452
462
|
noteChore(now());
|
|
453
463
|
remember(chore.docId).grudge++;
|
|
454
464
|
await speak("done", { page: labelOf(live, chore.docId) });
|
|
465
|
+
} else {
|
|
466
|
+
const trouble = choreTrouble.get(chore.id) ?? { failures: 0, retryAfter: 0 };
|
|
467
|
+
trouble.failures++;
|
|
468
|
+
trouble.retryAfter = now() + CHORE_RETRY_MS[Math.min(trouble.failures - 1, CHORE_RETRY_MS.length - 1)];
|
|
469
|
+
choreTrouble.set(chore.id, trouble);
|
|
470
|
+
deps.log(
|
|
471
|
+
`${chore.kind} on "${labelOf(live, chore.docId)}" has failed ${trouble.failures}\xD7 \u2014 setting it down for ${Math.round((trouble.retryAfter - now()) / 6e4)}m`
|
|
472
|
+
);
|
|
473
|
+
if (trouble.failures >= CHORE_TROUBLE_AT) {
|
|
474
|
+
junJanitorNote({
|
|
475
|
+
lastError: `${chore.kind} on "${labelOf(live, chore.docId)}" has failed ${trouble.failures}\xD7`
|
|
476
|
+
});
|
|
477
|
+
}
|
|
455
478
|
}
|
|
456
479
|
deps.actor.setStatus(null);
|
|
457
480
|
return idleWait();
|
|
@@ -19,12 +19,17 @@
|
|
|
19
19
|
*
|
|
20
20
|
* ## Tree writes
|
|
21
21
|
*
|
|
22
|
-
* Renames, reorders, meta and trashing
|
|
23
|
-
*
|
|
24
|
-
* on the shared root document before calling it
|
|
25
|
-
* resolved write mean *persisted and
|
|
26
|
-
*
|
|
27
|
-
* imaginary site.
|
|
22
|
+
* Renames, reorders, meta and trashing are transactions on the janitor's OWN
|
|
23
|
+
* root document — the socket the actor is already holding — and then WAIT for
|
|
24
|
+
* the server's echo on the runner's shared root document before calling it
|
|
25
|
+
* done. That wait is what makes a resolved write mean *persisted and
|
|
26
|
+
* broadcast* rather than *sent*. A runner whose identity lacks write scope
|
|
27
|
+
* fails loudly here instead of tidying an imaginary site.
|
|
28
|
+
*
|
|
29
|
+
* When the actor has no root document (disconnected, or a caller that passes
|
|
30
|
+
* none) it falls back to `jun-rpc`'s shape: a short-lived standalone provider
|
|
31
|
+
* per write. That was the ONLY path until 2026-09-02, and it cost a WebSocket
|
|
32
|
+
* plus a full root-document sync per chore — see `janitorRoot`.
|
|
28
33
|
*/
|
|
29
34
|
import * as Y from 'yjs';
|
|
30
35
|
import { AbracadabraProvider } from '@abraca/dabra';
|
|
@@ -54,6 +59,25 @@ export interface JunTreeWriterOptions {
|
|
|
54
59
|
/** The runner's shared, always-synced root document — where echoes land. */
|
|
55
60
|
sharedRoot: Y.Doc;
|
|
56
61
|
client: unknown;
|
|
62
|
+
/**
|
|
63
|
+
* The janitor's OWN root document, already open and already authenticated.
|
|
64
|
+
*
|
|
65
|
+
* When this answers, a tree write is a transaction on a socket that is
|
|
66
|
+
* standing there anyway. When it does not — the actor is disconnected, or
|
|
67
|
+
* there is no actor — the writer falls back to its own short-lived provider,
|
|
68
|
+
* which is what it used to do for every single write.
|
|
69
|
+
*
|
|
70
|
+
* That fallback was the default for the life of this file, and it is
|
|
71
|
+
* expensive in a way that only shows up under failure: one WebSocket and one
|
|
72
|
+
* full root-document sync to put a five-character label back. A shift that
|
|
73
|
+
* repeats a failing chore therefore opened a socket every twenty seconds for
|
|
74
|
+
* the life of the process — and once the janitor's token had expired, every
|
|
75
|
+
* one of those sockets was refused at the handshake and died eight seconds
|
|
76
|
+
* later having synced nothing.
|
|
77
|
+
*/
|
|
78
|
+
janitorRoot?: () => Y.Doc | null;
|
|
79
|
+
/** Make sure the identity behind `client` is still valid before connecting. */
|
|
80
|
+
ensureSession?: () => Promise<boolean>;
|
|
57
81
|
log?: (message: string) => void;
|
|
58
82
|
}
|
|
59
83
|
/**
|
|
@@ -33,8 +33,35 @@ export function junReadTree(tree, rootDocId) {
|
|
|
33
33
|
export function createJunTreeWriter(options) {
|
|
34
34
|
let chain = Promise.resolve();
|
|
35
35
|
const shared = () => options.sharedRoot.getMap("doc-tree");
|
|
36
|
+
function awaitEcho(confirmed) {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
if (confirmed()) return resolve();
|
|
39
|
+
const map = shared();
|
|
40
|
+
const timer = setTimeout(() => {
|
|
41
|
+
map.unobserve(check);
|
|
42
|
+
reject(new Error("write did not propagate \u2014 does the janitor have write access?"));
|
|
43
|
+
}, ECHO_TIMEOUT_MS);
|
|
44
|
+
const check = () => {
|
|
45
|
+
if (!confirmed()) return;
|
|
46
|
+
clearTimeout(timer);
|
|
47
|
+
map.unobserve(check);
|
|
48
|
+
resolve();
|
|
49
|
+
};
|
|
50
|
+
map.observe(check);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
36
53
|
function withTree(mutate, confirmed) {
|
|
37
54
|
const run = async () => {
|
|
55
|
+
await options.ensureSession?.();
|
|
56
|
+
const own = options.janitorRoot?.();
|
|
57
|
+
if (own) {
|
|
58
|
+
let result;
|
|
59
|
+
own.transact(() => {
|
|
60
|
+
result = mutate(own.getMap("doc-tree"));
|
|
61
|
+
});
|
|
62
|
+
await awaitEcho(confirmed);
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
38
65
|
const doc = new Y.Doc({ guid: options.rootDocId });
|
|
39
66
|
const provider = new AbracadabraProvider({
|
|
40
67
|
name: options.rootDocId,
|
|
@@ -49,21 +76,7 @@ export function createJunTreeWriter(options) {
|
|
|
49
76
|
doc.transact(() => {
|
|
50
77
|
result = mutate(doc.getMap("doc-tree"));
|
|
51
78
|
});
|
|
52
|
-
await
|
|
53
|
-
if (confirmed()) return resolve();
|
|
54
|
-
const map = shared();
|
|
55
|
-
const timer = setTimeout(() => {
|
|
56
|
-
map.unobserve(check);
|
|
57
|
-
reject(new Error("write did not propagate \u2014 does the janitor have write access?"));
|
|
58
|
-
}, ECHO_TIMEOUT_MS);
|
|
59
|
-
const check = () => {
|
|
60
|
-
if (!confirmed()) return;
|
|
61
|
-
clearTimeout(timer);
|
|
62
|
-
map.unobserve(check);
|
|
63
|
-
resolve();
|
|
64
|
-
};
|
|
65
|
-
map.observe(check);
|
|
66
|
-
});
|
|
79
|
+
await awaitEcho(confirmed);
|
|
67
80
|
return result;
|
|
68
81
|
} finally {
|
|
69
82
|
await new Promise((resolve) => setTimeout(resolve, FLUSH_MS));
|
|
@@ -71,6 +84,10 @@ export function createJunTreeWriter(options) {
|
|
|
71
84
|
provider.destroy();
|
|
72
85
|
} catch {
|
|
73
86
|
}
|
|
87
|
+
try {
|
|
88
|
+
doc.destroy();
|
|
89
|
+
} catch {
|
|
90
|
+
}
|
|
74
91
|
}
|
|
75
92
|
};
|
|
76
93
|
const next = chain.then(run, run);
|
|
@@ -107,17 +107,15 @@ export default defineNitroPlugin((nitroApp) => {
|
|
|
107
107
|
try {
|
|
108
108
|
if (!provider.isSynced) {
|
|
109
109
|
await new Promise((resolve) => {
|
|
110
|
-
const
|
|
111
|
-
provider.off("synced", done);
|
|
112
|
-
resolve();
|
|
113
|
-
};
|
|
114
|
-
const t = setTimeout(done, SYNC_TIMEOUT_MS);
|
|
110
|
+
const t = setTimeout(() => done(), SYNC_TIMEOUT_MS);
|
|
115
111
|
timers.add(t);
|
|
116
|
-
|
|
112
|
+
function done() {
|
|
117
113
|
clearTimeout(t);
|
|
118
114
|
timers.delete(t);
|
|
119
|
-
done
|
|
120
|
-
|
|
115
|
+
provider.off("synced", done);
|
|
116
|
+
resolve();
|
|
117
|
+
}
|
|
118
|
+
provider.on("synced", done);
|
|
121
119
|
});
|
|
122
120
|
}
|
|
123
121
|
unobserveDoc(docId);
|
|
@@ -119,6 +119,12 @@ async function hire(ctx, options, log) {
|
|
|
119
119
|
rootDocId: ctx.rootDocId,
|
|
120
120
|
sharedRoot: ctx.rootDoc,
|
|
121
121
|
client: actor.httpClient ?? ctx.client,
|
|
122
|
+
// Write on the socket the janitor is already standing on, and keep its
|
|
123
|
+
// session valid before falling back to opening a new one. Both are
|
|
124
|
+
// functions rather than values because the actor reconnects underneath
|
|
125
|
+
// this writer and a captured Y.Doc would outlive its provider.
|
|
126
|
+
janitorRoot: () => actor.rootDocument,
|
|
127
|
+
ensureSession: () => actor.ensureSession(),
|
|
122
128
|
log
|
|
123
129
|
});
|
|
124
130
|
let baselineHandle = null;
|
|
@@ -130,6 +136,7 @@ async function hire(ctx, options, log) {
|
|
|
130
136
|
return null;
|
|
131
137
|
}
|
|
132
138
|
try {
|
|
139
|
+
await actor.ensureSession();
|
|
133
140
|
const docId = await ensureBaselineDoc(ctx, actor, tree, log);
|
|
134
141
|
if (!docId) {
|
|
135
142
|
baselineFailed = true;
|
|
@@ -37,6 +37,24 @@ export default defineEventHandler(async (event) => {
|
|
|
37
37
|
// to `standalone`, which is the same thing `display` already said.
|
|
38
38
|
display_override: ["standalone", "minimal-ui"],
|
|
39
39
|
orientation: "any",
|
|
40
|
+
/*
|
|
41
|
+
* The installed app's status bar, and the splash behind its icon.
|
|
42
|
+
*
|
|
43
|
+
* A manifest is SCHEME-BLIND — one value, whatever the device is set to —
|
|
44
|
+
* so this is the one surface that cannot simply follow `--jun-canvas`. It
|
|
45
|
+
* takes the DARK canvas, and that is a choice with a reason rather than a
|
|
46
|
+
* default: an app with a dark status bar is a thing apps do (it is the same
|
|
47
|
+
* posture `apple-mobile-web-app-status-bar-style: black-translucent` fixes
|
|
48
|
+
* on iOS, so the two platforms now agree), and a splash that flashes white
|
|
49
|
+
* before a dark page is worse than one that flashes dark before a light
|
|
50
|
+
* one. What it must NOT be is a fifth independent grey, which is what
|
|
51
|
+
* `brand.themeColor`'s literal `#0e0f11` was against a `#0c0a09` page.
|
|
52
|
+
*
|
|
53
|
+
* `brand.themeColor` still wins when a site states one: that key exists
|
|
54
|
+
* precisely so an owner can say "this is my app's colour", and a derived
|
|
55
|
+
* value must not overrule a stated one. `junIdentity` resolves that
|
|
56
|
+
* precedence — stated, else the dark canvas — so this reads one field.
|
|
57
|
+
*/
|
|
40
58
|
background_color: brand.themeColor,
|
|
41
59
|
theme_color: brand.themeColor,
|
|
42
60
|
icons: [
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -404,6 +404,51 @@ export type JunNavMobileMode = 'track' | 'sheet' | 'drawer-left' | 'drawer-right
|
|
|
404
404
|
* within thumb reach is a phone one.
|
|
405
405
|
*/
|
|
406
406
|
export type JunNavMobilePlacement = 'inherit' | 'top' | 'top-bar' | 'bottom';
|
|
407
|
+
/**
|
|
408
|
+
* What the phone bar IS — as opposed to `mobileMode`, which is what OPENS.
|
|
409
|
+
*
|
|
410
|
+
* The two were conflated, and the report was exact: *"mobile navigation always
|
|
411
|
+
* shows a bar on top the same way no matter what the mobile menu is."*
|
|
412
|
+
* Measured across all seven `mobileMode` values at 390px, five of them
|
|
413
|
+
* (`sheet`, `drawer-left`, `drawer-right`, `fullscreen`, `grid`) rendered a
|
|
414
|
+
* byte-identical 374×34 pill holding a mark, a trigger and a search button —
|
|
415
|
+
* because the mode only ever decided what the OVERLAY looked like once opened.
|
|
416
|
+
* There was no setting for the bar itself.
|
|
417
|
+
*
|
|
418
|
+
* - `bar` — the panel, as it always was. The default; nothing moves.
|
|
419
|
+
* - `inset` — the same panel shrunk to its CONTENTS and pushed to the side
|
|
420
|
+
* `menuSide` names. A compact pill rather than something spanning the
|
|
421
|
+
* screen; the page shows through beside it.
|
|
422
|
+
* - `edge` — full-bleed and flush: no radius, no side borders, the top inset
|
|
423
|
+
* absorbed as internal padding, the page starting underneath. The shape a
|
|
424
|
+
* native app's title bar has, and the only one that reaches the corners.
|
|
425
|
+
* - `split` — the panel loses its surface entirely and the two controls keep
|
|
426
|
+
* their own: the mark in one corner, the trigger in the other, the page
|
|
427
|
+
* running between them. The most common shape on the mobile web, and the
|
|
428
|
+
* one this module had no way to express at all.
|
|
429
|
+
* - `float` — no panel and no mark. The trigger alone, as a circular button in
|
|
430
|
+
* the corner `menuSide` names, at the placement `mobilePlacement` names.
|
|
431
|
+
* The "give the page the whole screen" answer, and with `mobilePlacement:
|
|
432
|
+
* 'bottom'` the thumb-reachable one.
|
|
433
|
+
* - `none` — no bar and no trigger. Only defensible when something ELSE
|
|
434
|
+
* navigates: the dock, or the edge-swipe gesture. The settings row says so.
|
|
435
|
+
*
|
|
436
|
+
* The first four are the PANEL, restyled — one element, so the logo's slot, the
|
|
437
|
+
* palette-versus-home behaviour, the intro veil and the chrome measurement are
|
|
438
|
+
* all shared and cannot drift. The last two hide the panel and render a
|
|
439
|
+
* standalone trigger, because a panel reduced to one control is not a panel.
|
|
440
|
+
*/
|
|
441
|
+
export type JunNavMobileBar = 'bar' | 'inset' | 'edge' | 'split' | 'float' | 'none';
|
|
442
|
+
/**
|
|
443
|
+
* What the phone bar NAMES.
|
|
444
|
+
*
|
|
445
|
+
* An app's top bar says where you are; this one said nothing, on every page, in
|
|
446
|
+
* every mode. `off` is what it always did and stays the default — a title is a
|
|
447
|
+
* second copy of the page's own `<h1>`, which is right on a phone (the heading
|
|
448
|
+
* scrolls away) and redundant on a desktop, so this only ever applies below the
|
|
449
|
+
* breakpoint.
|
|
450
|
+
*/
|
|
451
|
+
export type JunNavMobileTitle = 'off' | 'page' | 'site';
|
|
407
452
|
/** The viewport width below which the MOBILE mode applies. Tailwind's scale. */
|
|
408
453
|
export type JunNavBreakpoint = 'sm' | 'md' | 'lg';
|
|
409
454
|
/**
|
|
@@ -531,6 +576,10 @@ export interface JunNavigationOptions {
|
|
|
531
576
|
mobileMode?: JunNavMobileMode;
|
|
532
577
|
/** A phone-only placement, or `inherit` to keep the site's. */
|
|
533
578
|
mobilePlacement?: JunNavMobilePlacement;
|
|
579
|
+
/** What the phone bar IS — a panel, a bare floating trigger, or nothing. */
|
|
580
|
+
mobileBar?: JunNavMobileBar;
|
|
581
|
+
/** What the phone bar names: nothing, the page, or the site. */
|
|
582
|
+
mobileTitle?: JunNavMobileTitle;
|
|
534
583
|
/** The width below which `mobileMode` applies. */
|
|
535
584
|
breakpoint?: JunNavBreakpoint;
|
|
536
585
|
/** The glyph on the menu trigger. */
|
|
@@ -1125,11 +1174,16 @@ export interface JunRuntimeOptions {
|
|
|
1125
1174
|
avatar: string;
|
|
1126
1175
|
logoMark: JunLogoMark;
|
|
1127
1176
|
logoVariant: JunLogoVariant;
|
|
1128
|
-
|
|
1177
|
+
/**
|
|
1178
|
+
* OPTIONAL at runtime, and that is the point: unset means "derive it from
|
|
1179
|
+
* the site's neutral" (`junCanvasColors`), so the app's chrome is the
|
|
1180
|
+
* colour the page actually is. A stated value always wins.
|
|
1181
|
+
*/
|
|
1182
|
+
themeColor?: string;
|
|
1129
1183
|
/** BCP-47, for `<html lang>`. `en` unless a site says otherwise. */
|
|
1130
1184
|
lang: string;
|
|
1131
1185
|
/** The app-icon tile. Defaults to `themeColor`; see `JunBrand`. */
|
|
1132
|
-
iconBackground
|
|
1186
|
+
iconBackground?: string;
|
|
1133
1187
|
schemaType: JunBrand['schemaType'];
|
|
1134
1188
|
};
|
|
1135
1189
|
features: Required<JunFeatures>;
|
|
@@ -30,6 +30,19 @@ export interface JunIdentity {
|
|
|
30
30
|
*/
|
|
31
31
|
tile: string;
|
|
32
32
|
themeColor: string;
|
|
33
|
+
/**
|
|
34
|
+
* `--jun-canvas`, per scheme — the colour the PAGE is, which is what a mobile
|
|
35
|
+
* browser's toolbar and an installed app's status bar have to agree with.
|
|
36
|
+
*
|
|
37
|
+
* They did not. The `theme-color` metas were a hard `#ffffff` and the brand's
|
|
38
|
+
* `themeColor`, against a page painted from the neutral ramp: `#ffffff` over
|
|
39
|
+
* `#f5f5f4` on light, `#0e0f11` over `#0c0a09` on dark. Small numbers, and a
|
|
40
|
+
* seam across the top of every page on a phone — the same fault the backdrop
|
|
41
|
+
* had in 2026-08-07, one surface further out. Derived from the site's chosen
|
|
42
|
+
* neutral, so picking `zinc` moves the toolbar too.
|
|
43
|
+
*/
|
|
44
|
+
canvasLight: string;
|
|
45
|
+
canvasDark: string;
|
|
33
46
|
/**
|
|
34
47
|
* Everything above, as a short stable string, used as the cache-buster on
|
|
35
48
|
* every icon URL. The icon responses are `immutable` for a year; without this
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { junMarkColorsFor, junMarkName } from "./junMark.js";
|
|
1
|
+
import { junCanvasColors, junMarkColorsFor, junMarkName } from "./junMark.js";
|
|
2
2
|
const HEX_RE = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
3
|
-
const DEFAULT_THEME_COLOR = "#0e0f11";
|
|
4
3
|
const SHORT_NAME_MAX = 12;
|
|
5
4
|
function str(v) {
|
|
6
5
|
return typeof v === "string" && v.trim() ? v.trim() : void 0;
|
|
@@ -22,7 +21,8 @@ export function junIdentity(brand, cfg) {
|
|
|
22
21
|
const description = str(cfg.seoDescription) ?? str(brand?.seoDescription) ?? str(brand?.tagline) ?? "";
|
|
23
22
|
const mark = junMarkName(cfg.brandLogo ?? brand?.logoMark, "sun");
|
|
24
23
|
const { light, dark } = junMarkColorsFor(cfg);
|
|
25
|
-
const
|
|
24
|
+
const canvas = junCanvasColors(cfg);
|
|
25
|
+
const themeColor = hex(brand?.themeColor, canvas.dark);
|
|
26
26
|
const tile = hex(brand?.iconBackground, themeColor);
|
|
27
27
|
return {
|
|
28
28
|
name,
|
|
@@ -33,11 +33,15 @@ export function junIdentity(brand, cfg) {
|
|
|
33
33
|
dark,
|
|
34
34
|
tile,
|
|
35
35
|
themeColor,
|
|
36
|
+
canvasLight: canvas.light,
|
|
37
|
+
canvasDark: canvas.dark,
|
|
36
38
|
version: junFingerprint([
|
|
37
39
|
name,
|
|
38
40
|
mark,
|
|
39
41
|
tile,
|
|
40
42
|
themeColor,
|
|
43
|
+
canvas.light,
|
|
44
|
+
canvas.dark,
|
|
41
45
|
light.ink,
|
|
42
46
|
light.sunFrom,
|
|
43
47
|
light.sunTo,
|
|
@@ -181,6 +181,41 @@ export declare function junMarkColorsFor(cfg: {
|
|
|
181
181
|
light: JunMarkColors;
|
|
182
182
|
dark: JunMarkColors;
|
|
183
183
|
};
|
|
184
|
+
/**
|
|
185
|
+
* The interface's greyscale, as ELEVEN steps per neutral.
|
|
186
|
+
*
|
|
187
|
+
* It lived in `useJunTheme`, which emits it as `--color-neutral-*`. It is here
|
|
188
|
+
* for the reason `junShade`, `junSunColors` and `JUN_ACCENTS` are here: the
|
|
189
|
+
* canvas colour has to be resolvable from Nitro (the web manifest) and from a
|
|
190
|
+
* `<head>` that renders on both sides, and neither of those can load a
|
|
191
|
+
* composable. `useJunTheme` imports it from here now, so there is one ramp.
|
|
192
|
+
*/
|
|
193
|
+
export declare const JUN_NEUTRAL_STEPS: readonly ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
|
|
194
|
+
export declare const JUN_NEUTRALS: Record<'slate' | 'zinc' | 'stone', string[]>;
|
|
195
|
+
/**
|
|
196
|
+
* `--jun-canvas`, in both schemes, as literal hexes.
|
|
197
|
+
*
|
|
198
|
+
* The colour the page IS: ramp step **100** on light and **950** on dark, which
|
|
199
|
+
* is exactly what `jun.css` declares and `junThemeCss()` re-emits for the
|
|
200
|
+
* chosen neutral. Stated here as a function because two consumers cannot read
|
|
201
|
+
* a stylesheet at all — the `theme-color` metas, which colour a mobile
|
|
202
|
+
* browser's toolbar, and the web manifest, which colours an installed app's
|
|
203
|
+
* status bar and its splash.
|
|
204
|
+
*
|
|
205
|
+
* Those two were the last surfaces still holding their own answer. `<html>`,
|
|
206
|
+
* `<body>` and all three backdrops were unified on `--jun-canvas` in 2026-08-07
|
|
207
|
+
* after "the backdrop does not expand all the way down on mobile" turned out
|
|
208
|
+
* to be three greys rather than a layout fault; the BROWSER CHROME was not in
|
|
209
|
+
* that sweep, so the toolbar was a hard `#ffffff` over a `#f5f5f4` page and the
|
|
210
|
+
* installed app a hard `#0e0f11` over a `#0c0a09` one. Same bug, one surface
|
|
211
|
+
* further out, and the same fix: one value, derived from the site's neutral.
|
|
212
|
+
*/
|
|
213
|
+
export declare function junCanvasColors(cfg: {
|
|
214
|
+
themeNeutral?: unknown;
|
|
215
|
+
}): {
|
|
216
|
+
light: string;
|
|
217
|
+
dark: string;
|
|
218
|
+
};
|
|
184
219
|
/** A stored `brandLogo` value, validated against what this build can draw. */
|
|
185
220
|
export declare function junMarkName(value: unknown, fallback?: JunMarkName): JunMarkName;
|
|
186
221
|
/**
|
|
@@ -112,6 +112,17 @@ export function junMarkColorsFor(cfg) {
|
|
|
112
112
|
dark: junMarkColors("dark", customDark ?? preset?.dark, customDark ? void 0 : preset?.orb?.dark)
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
+
export const JUN_NEUTRAL_STEPS = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
|
|
116
|
+
export const JUN_NEUTRALS = {
|
|
117
|
+
slate: ["#f8fafc", "#f1f5f9", "#e2e8f0", "#cbd5e1", "#94a3b8", "#64748b", "#475569", "#334155", "#1e293b", "#0f172a", "#020617"],
|
|
118
|
+
zinc: ["#fafafa", "#f4f4f5", "#e4e4e7", "#d4d4d8", "#a1a1aa", "#71717a", "#52525b", "#3f3f46", "#27272a", "#18181b", "#09090b"],
|
|
119
|
+
stone: ["#fafaf9", "#f5f5f4", "#e7e5e4", "#d6d3d1", "#a8a29e", "#78716c", "#57534e", "#44403c", "#292524", "#1c1917", "#0c0a09"]
|
|
120
|
+
};
|
|
121
|
+
export function junCanvasColors(cfg) {
|
|
122
|
+
const key = typeof cfg.themeNeutral === "string" ? cfg.themeNeutral : "stone";
|
|
123
|
+
const ramp = JUN_NEUTRALS[key] ?? JUN_NEUTRALS.stone;
|
|
124
|
+
return { light: ramp[1], dark: ramp[10] };
|
|
125
|
+
}
|
|
115
126
|
export function junMarkName(value, fallback = "sun") {
|
|
116
127
|
return typeof value === "string" && JUN_MARK_NAMES.includes(value) ? value : fallback;
|
|
117
128
|
}
|
|
@@ -21,7 +21,14 @@ const PREVIEW_KEYS = {
|
|
|
21
21
|
placement: "navPlacement",
|
|
22
22
|
item: "navItemMode",
|
|
23
23
|
autohide: "navAutoHide",
|
|
24
|
-
section: "navSection"
|
|
24
|
+
section: "navSection",
|
|
25
|
+
// `bar` and `title` are SITE settings with no document layer — a page cannot
|
|
26
|
+
// decide it has no navbar, and should not be able to. They are previewable
|
|
27
|
+
// anyway because the invariant above is about not inventing states, and a
|
|
28
|
+
// site CAN be `mobileBar: 'float'`; `useJunNavSettings` reads them from this
|
|
29
|
+
// object directly rather than through `docNav`, so the layering is unchanged.
|
|
30
|
+
bar: "navMobileBar",
|
|
31
|
+
title: "navMobileTitle"
|
|
25
32
|
};
|
|
26
33
|
export function junNavPreview(raw) {
|
|
27
34
|
const text = Array.isArray(raw) ? raw[0] : raw;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abraca/junis",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.95.0",
|
|
4
4
|
"description": "Website-builder Nuxt module for the Abracadabra CRDT platform — page-type renderers, presence chrome, studio editing and SSR, all driven by documents",
|
|
5
5
|
"repository": "abracadabra/jun-is",
|
|
6
6
|
"license": "MIT",
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"parity:follow": "node scripts/parity-follow.mjs",
|
|
107
107
|
"parity:studio": "node scripts/parity-studio.mjs",
|
|
108
108
|
"parity:touch": "node scripts/parity-touch.mjs",
|
|
109
|
+
"parity:mobile": "node scripts/parity-mobile.mjs",
|
|
109
110
|
"parity:offline": "node scripts/parity-offline.mjs",
|
|
110
111
|
"parity:weight": "node scripts/parity-weight.mjs",
|
|
111
112
|
"deploy:check": "node scripts/deploy-check.mjs",
|