@abraca/junis 2.84.0 → 2.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.d.mts +17 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +270 -22
- package/dist/runtime/assets/css/jun.css +1 -1
- package/dist/runtime/components/JunBlobBackdrop.client.vue +1 -1
- package/dist/runtime/components/JunCampfirePresence.client.vue +75 -10
- package/dist/runtime/components/JunCollectionIntro.d.vue.ts +11 -0
- package/dist/runtime/components/JunCollectionIntro.vue +45 -0
- package/dist/runtime/components/JunCollectionIntro.vue.d.ts +11 -0
- package/dist/runtime/components/JunConfigRow.d.vue.ts +43 -0
- package/dist/runtime/components/JunConfigRow.vue +34 -0
- package/dist/runtime/components/JunConfigRow.vue.d.ts +43 -0
- package/dist/runtime/components/JunFooter.vue +1 -1
- package/dist/runtime/components/JunHead.vue +37 -5
- package/dist/runtime/components/JunHorizontalTimeline.d.vue.ts +30 -0
- package/dist/runtime/components/JunHorizontalTimeline.vue.d.ts +30 -0
- package/dist/runtime/components/JunLinksRow.d.vue.ts +16 -1
- package/dist/runtime/components/JunLinksRow.vue +17 -7
- package/dist/runtime/components/JunLinksRow.vue.d.ts +16 -1
- package/dist/runtime/components/JunLogo.vue +10 -45
- package/dist/runtime/components/JunMedia.client.d.vue.ts +1 -1
- package/dist/runtime/components/JunMedia.client.vue.d.ts +1 -1
- package/dist/runtime/components/JunNavigation.vue +21 -4
- package/dist/runtime/components/JunNoteLinks.d.vue.ts +6 -0
- package/dist/runtime/components/JunNoteLinks.vue +57 -0
- package/dist/runtime/components/JunNoteLinks.vue.d.ts +6 -0
- package/dist/runtime/components/JunPageHero.d.vue.ts +8 -2
- package/dist/runtime/components/JunPageHero.vue +15 -3
- package/dist/runtime/components/JunPageHero.vue.d.ts +8 -2
- package/dist/runtime/components/JunPatternBackdrop.client.vue +1 -1
- package/dist/runtime/components/JunReaders.d.vue.ts +11 -0
- package/dist/runtime/components/JunReaders.vue +99 -0
- package/dist/runtime/components/JunReaders.vue.d.ts +11 -0
- package/dist/runtime/components/JunSearch.client.vue +2 -2
- package/dist/runtime/components/JunSectionPresence.client.d.vue.ts +17 -0
- package/dist/runtime/components/JunSectionPresence.client.vue +99 -0
- package/dist/runtime/components/JunSectionPresence.client.vue.d.ts +17 -0
- package/dist/runtime/components/JunShaderBackdrop.client.vue +1 -1
- package/dist/runtime/components/JunThreadComposer.d.vue.ts +37 -0
- package/dist/runtime/components/JunThreadComposer.vue +54 -0
- package/dist/runtime/components/JunThreadComposer.vue.d.ts +37 -0
- package/dist/runtime/components/JunTravellersChip.vue +35 -5
- package/dist/runtime/components/JunVideoEmbed.client.d.vue.ts +1 -1
- package/dist/runtime/components/JunVideoEmbed.client.vue.d.ts +1 -1
- package/dist/runtime/components/JunViewControl.d.vue.ts +29 -0
- package/dist/runtime/components/JunViewControl.vue +340 -0
- package/dist/runtime/components/JunViewControl.vue.d.ts +29 -0
- package/dist/runtime/components/JunViewControls.d.vue.ts +27 -0
- package/dist/runtime/components/JunViewControls.vue +94 -0
- package/dist/runtime/components/JunViewControls.vue.d.ts +27 -0
- package/dist/runtime/components/renderers/JunAppsRenderer.vue +45 -4
- package/dist/runtime/components/renderers/JunCinemaRenderer.vue +42 -4
- package/dist/runtime/components/renderers/JunConfigRenderer.vue +362 -239
- package/dist/runtime/components/renderers/JunCourseRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunCourseRenderer.vue +229 -0
- package/dist/runtime/components/renderers/JunCourseRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunCvRenderer.vue +44 -6
- package/dist/runtime/components/renderers/JunDeckRenderer.d.vue.ts +9 -0
- package/dist/runtime/components/renderers/JunDeckRenderer.vue +370 -0
- package/dist/runtime/components/renderers/JunDeckRenderer.vue.d.ts +9 -0
- package/dist/runtime/components/renderers/JunEntryRenderer.vue +157 -31
- package/dist/runtime/components/renderers/JunFestivalRenderer.vue +42 -5
- package/dist/runtime/components/renderers/JunGardenRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunGardenRenderer.vue +280 -0
- package/dist/runtime/components/renderers/JunGardenRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunGuestbookRenderer.vue +96 -14
- package/dist/runtime/components/renderers/JunHomeRenderer.vue +31 -132
- package/dist/runtime/components/renderers/JunItemRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunItemRenderer.vue +398 -0
- package/dist/runtime/components/renderers/JunItemRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunJournalRenderer.vue +141 -11
- package/dist/runtime/components/renderers/JunLibraryRenderer.vue +295 -12
- package/dist/runtime/components/renderers/JunLinksRenderer.vue +33 -1
- package/dist/runtime/components/renderers/JunLiveRenderer.vue +38 -2
- package/dist/runtime/components/renderers/JunMosaicRenderer.vue +3 -2
- package/dist/runtime/components/renderers/JunMovieRenderer.vue +32 -5
- package/dist/runtime/components/renderers/JunNowRenderer.vue +40 -7
- package/dist/runtime/components/renderers/JunPollRenderer.d.vue.ts +9 -0
- package/dist/runtime/components/renderers/JunPollRenderer.vue +231 -0
- package/dist/runtime/components/renderers/JunPollRenderer.vue.d.ts +9 -0
- package/dist/runtime/components/renderers/JunProjectRenderer.vue +74 -18
- package/dist/runtime/components/renderers/JunServicesRenderer.vue +40 -2
- package/dist/runtime/components/renderers/JunStatsRenderer.vue +37 -50
- package/dist/runtime/components/renderers/JunThreadRenderer.d.vue.ts +9 -0
- package/dist/runtime/components/renderers/JunThreadRenderer.vue +304 -0
- package/dist/runtime/components/renderers/JunThreadRenderer.vue.d.ts +9 -0
- package/dist/runtime/components/renderers/JunTrackRenderer.vue +32 -4
- package/dist/runtime/components/renderers/JunUsesRenderer.vue +57 -13
- package/dist/runtime/components/renderers/JunWallRenderer.vue +60 -5
- package/dist/runtime/composables/useJunDeck.d.ts +66 -0
- package/dist/runtime/composables/useJunDeck.js +61 -0
- package/dist/runtime/composables/useJunDocPage.d.ts +14 -11
- package/dist/runtime/composables/useJunDocPage.js +67 -3
- package/dist/runtime/composables/useJunFollow.d.ts +65 -9
- package/dist/runtime/composables/useJunFollow.js +237 -20
- package/dist/runtime/composables/useJunGarden.d.ts +67 -0
- package/dist/runtime/composables/useJunGarden.js +92 -0
- package/dist/runtime/composables/useJunOptions.d.ts +1 -0
- package/dist/runtime/composables/useJunPresence.d.ts +26 -0
- package/dist/runtime/composables/useJunPresence.js +9 -2
- package/dist/runtime/composables/useJunSections.d.ts +73 -0
- package/dist/runtime/composables/useJunSections.js +117 -0
- package/dist/runtime/composables/useJunSettings.d.ts +1 -1
- package/dist/runtime/composables/useJunSettings.js +5 -1
- package/dist/runtime/composables/useJunSiteConfig.d.ts +37 -0
- package/dist/runtime/composables/useJunTheme.js +49 -50
- package/dist/runtime/composables/useJunViewOptions.d.ts +85 -0
- package/dist/runtime/composables/useJunViewOptions.js +63 -0
- package/dist/runtime/pages/doc.vue +14 -8
- package/dist/runtime/plugins/jun-sw.client.d.ts +2 -0
- package/dist/runtime/plugins/jun-sw.client.js +36 -0
- package/dist/runtime/server/api/health.get.d.ts +19 -0
- package/dist/runtime/server/api/health.get.js +40 -0
- package/dist/runtime/server/api/links.get.d.ts +19 -0
- package/dist/runtime/server/api/links.get.js +37 -0
- package/dist/runtime/server/api/resolve/[...slug].get.d.ts +9 -0
- package/dist/runtime/server/api/resolve/[...slug].get.js +5 -0
- package/dist/runtime/server/api/stats.get.js +2 -1
- package/dist/runtime/server/janitor/junJanitorChores.js +8 -0
- package/dist/runtime/server/plugins/jun-bootstrap.js +103 -15
- package/dist/runtime/server/plugins/jun-doc-cache.js +42 -4
- package/dist/runtime/server/plugins/jun-janitor.js +9 -1
- package/dist/runtime/server/plugins/jun-rpc.js +293 -0
- package/dist/runtime/server/plugins/jun-watchdog.d.ts +2 -0
- package/dist/runtime/server/plugins/jun-watchdog.js +54 -0
- package/dist/runtime/server/routes/jun-icon.png.get.d.ts +2 -0
- package/dist/runtime/server/routes/jun-icon.png.get.js +25 -0
- package/dist/runtime/server/routes/jun-icon.svg.get.d.ts +2 -0
- package/dist/runtime/server/routes/jun-icon.svg.get.js +9 -0
- package/dist/runtime/server/routes/jun-splash.png.get.d.ts +2 -0
- package/dist/runtime/server/routes/jun-splash.png.get.js +37 -0
- package/dist/runtime/server/routes/jun-sw.js.get.d.ts +2 -0
- package/dist/runtime/server/routes/jun-sw.js.get.js +126 -0
- package/dist/runtime/server/routes/manifest.webmanifest.get.d.ts +24 -0
- package/dist/runtime/server/routes/manifest.webmanifest.get.js +51 -0
- package/dist/runtime/server/routes/sitemap.xml.get.js +2 -0
- package/dist/runtime/server/utils/junBoot.d.ts +1 -0
- package/dist/runtime/server/utils/junBoot.js +4 -0
- package/dist/runtime/server/utils/junBrand.d.ts +4 -0
- package/dist/runtime/server/utils/junBrand.js +9 -0
- package/dist/runtime/server/utils/junCache.d.ts +17 -0
- package/dist/runtime/server/utils/junCache.js +5 -0
- package/dist/runtime/server/utils/junIcon.d.ts +44 -0
- package/dist/runtime/server/utils/junIcon.js +374 -0
- package/dist/runtime/server/utils/junSeedGate.d.ts +68 -0
- package/dist/runtime/server/utils/junSeedGate.js +41 -0
- package/dist/runtime/types.d.ts +82 -3
- package/dist/runtime/utils/junCourse.d.ts +106 -0
- package/dist/runtime/utils/junCourse.js +65 -0
- package/dist/runtime/utils/junGarden.d.ts +193 -0
- package/dist/runtime/utils/junGarden.js +233 -0
- package/dist/runtime/utils/junIdentity.d.ts +121 -0
- package/dist/runtime/utils/junIdentity.js +115 -0
- package/dist/runtime/utils/junMark.d.ts +254 -0
- package/dist/runtime/utils/junMark.js +169 -0
- package/dist/runtime/utils/junMetaSchemas.js +8 -1
- package/dist/runtime/utils/junModeration.d.ts +67 -0
- package/dist/runtime/utils/junModeration.js +20 -0
- package/dist/runtime/utils/junMotion.d.ts +26 -0
- package/dist/runtime/utils/junMotion.js +31 -0
- package/dist/runtime/utils/junPeople.d.ts +43 -0
- package/dist/runtime/utils/junPeople.js +9 -0
- package/dist/runtime/utils/junPoll.d.ts +79 -0
- package/dist/runtime/utils/junPoll.js +82 -0
- package/dist/runtime/utils/junReadiness.d.ts +131 -0
- package/dist/runtime/utils/junReadiness.js +69 -0
- package/dist/runtime/utils/junSections.d.ts +115 -0
- package/dist/runtime/utils/junSections.js +45 -0
- package/dist/runtime/utils/junSlides.d.ts +66 -0
- package/dist/runtime/utils/junSlides.js +47 -0
- package/dist/runtime/utils/junThread.d.ts +81 -0
- package/dist/runtime/utils/junThread.js +75 -0
- package/dist/runtime/utils/junViewSpecs.d.ts +671 -0
- package/dist/runtime/utils/junViewSpecs.js +534 -0
- package/dist/runtime/utils/junViewValues.d.ts +125 -0
- package/dist/runtime/utils/junViewValues.js +104 -0
- package/dist/types.d.mts +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The arithmetic behind `jun-thread` — flat documents into a conversation.
|
|
3
|
+
*
|
|
4
|
+
* No Vue and no `#imports`. Its ONE import is `junModeration` — what "removed"
|
|
5
|
+
* and "pinned" mean is shared with the guestbook, and two spellings of removed
|
|
6
|
+
* would mean a post hidden on one page and visible on another.
|
|
7
|
+
*
|
|
8
|
+
* ── Posts are documents, and replies are meta ────────────────────────────────
|
|
9
|
+
*
|
|
10
|
+
* Every post is a hidden child document of the thread — the same shape the
|
|
11
|
+
* guestbook's signatures have, so moderation, trash, search exclusion and the
|
|
12
|
+
* permission cascade all work without inventing anything. A reply carries
|
|
13
|
+
* `meta.replyTo`, the id of the post it answers.
|
|
14
|
+
*
|
|
15
|
+
* That is deliberately NOT a nested data structure in one document: a thread that
|
|
16
|
+
* lived in a single meta blob would rewrite every reply on every post, which is
|
|
17
|
+
* both a merge conflict waiting to happen and a way to lose somebody else's words
|
|
18
|
+
* while adding your own.
|
|
19
|
+
*
|
|
20
|
+
* ── Two rules a conversation needs and a list does not ───────────────────────
|
|
21
|
+
*
|
|
22
|
+
* **A cycle is not a conversation.** `meta.replyTo` is a string somebody wrote:
|
|
23
|
+
* two posts can point at each other, and a naive walk would recurse until the
|
|
24
|
+
* stack gave out. Anything unreachable from the root is re-parented to the top
|
|
25
|
+
* rather than dropped — losing a reply because its parent was deleted is worse
|
|
26
|
+
* than showing it in the wrong place.
|
|
27
|
+
*
|
|
28
|
+
* **Depth has to stop.** Not for looks: each level costs indentation, and past
|
|
29
|
+
* three or four a reply on a phone is a column one word wide.
|
|
30
|
+
*/
|
|
31
|
+
/** How deep a rendered conversation may nest before replies flatten. */
|
|
32
|
+
export declare const JUN_THREAD_DEPTH_MAX = 6;
|
|
33
|
+
export interface JunThreadPostInput {
|
|
34
|
+
id: string;
|
|
35
|
+
label: string;
|
|
36
|
+
parentId?: string | null;
|
|
37
|
+
trashed?: boolean;
|
|
38
|
+
meta?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export interface JunThreadPost {
|
|
41
|
+
id: string;
|
|
42
|
+
/** The handle the server stamped, falling back to the document's label. */
|
|
43
|
+
handle: string;
|
|
44
|
+
message: string;
|
|
45
|
+
date: number;
|
|
46
|
+
/** The signer id, so a reader can be shown their own posts. */
|
|
47
|
+
signerId: string | null;
|
|
48
|
+
hidden: boolean;
|
|
49
|
+
pinned: boolean;
|
|
50
|
+
depth: number;
|
|
51
|
+
replies: JunThreadPost[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Build the conversation.
|
|
55
|
+
*
|
|
56
|
+
* `newest` orders siblings at every level, including the root, because a thread
|
|
57
|
+
* read newest-first is a different thing from one read in order and both are
|
|
58
|
+
* legitimate — an announcement wants oldest first, a question wants newest.
|
|
59
|
+
*
|
|
60
|
+
* Pinned posts always come first at the root, whatever the order: pinning is an
|
|
61
|
+
* owner saying "read this one", and an order that could bury it makes the act
|
|
62
|
+
* meaningless.
|
|
63
|
+
*/
|
|
64
|
+
export declare function junThreadTree(posts: JunThreadPostInput[], options?: {
|
|
65
|
+
threadId: string;
|
|
66
|
+
newest?: boolean;
|
|
67
|
+
depthMax?: number;
|
|
68
|
+
includeHidden?: boolean;
|
|
69
|
+
}): JunThreadPost[];
|
|
70
|
+
/** How many posts a conversation has, replies and all. */
|
|
71
|
+
export declare function junThreadCount(list: JunThreadPost[]): number;
|
|
72
|
+
/**
|
|
73
|
+
* Is `replyTo` a legal parent for a new post in this thread?
|
|
74
|
+
*
|
|
75
|
+
* The server's check. A reply may only answer a post in the SAME thread — without
|
|
76
|
+
* this, a `replyTo` pointing at any document id would let somebody graft a
|
|
77
|
+
* conversation onto a page that is not a thread at all.
|
|
78
|
+
*/
|
|
79
|
+
export declare function junCanReplyTo(
|
|
80
|
+
/** Only identity and parentage matter here — the server has no labels to hand. */
|
|
81
|
+
posts: Pick<JunThreadPostInput, 'id' | 'parentId' | 'trashed'>[], threadId: string, replyTo: string | null | undefined): boolean;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { junIsModerated, junIsPinned } from "./junModeration.js";
|
|
2
|
+
export const JUN_THREAD_DEPTH_MAX = 6;
|
|
3
|
+
function text(value) {
|
|
4
|
+
return typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "";
|
|
5
|
+
}
|
|
6
|
+
export function junThreadTree(posts, options = { threadId: "" }) {
|
|
7
|
+
const depthMax = Math.max(1, Math.min(options.depthMax ?? 4, JUN_THREAD_DEPTH_MAX));
|
|
8
|
+
const flat = /* @__PURE__ */ new Map();
|
|
9
|
+
const replyTo = /* @__PURE__ */ new Map();
|
|
10
|
+
for (const entry of posts) {
|
|
11
|
+
if (!entry?.id || entry.trashed) continue;
|
|
12
|
+
if (options.threadId && entry.parentId !== options.threadId) continue;
|
|
13
|
+
const meta = entry.meta ?? {};
|
|
14
|
+
const message = text(meta.message);
|
|
15
|
+
if (!message) continue;
|
|
16
|
+
const hidden = junIsModerated(meta);
|
|
17
|
+
if (hidden && !options.includeHidden) continue;
|
|
18
|
+
flat.set(entry.id, {
|
|
19
|
+
id: entry.id,
|
|
20
|
+
handle: text(meta.signerHandle) || text(entry.label) || "Traveller",
|
|
21
|
+
message,
|
|
22
|
+
date: typeof meta.date === "number" ? meta.date : 0,
|
|
23
|
+
signerId: typeof meta.signerId === "string" ? meta.signerId : null,
|
|
24
|
+
hidden,
|
|
25
|
+
pinned: junIsPinned(meta),
|
|
26
|
+
depth: 0,
|
|
27
|
+
replies: []
|
|
28
|
+
});
|
|
29
|
+
const parent = text(meta.replyTo);
|
|
30
|
+
if (parent && parent !== entry.id) replyTo.set(entry.id, parent);
|
|
31
|
+
}
|
|
32
|
+
function reaches(id, parent) {
|
|
33
|
+
let at = parent;
|
|
34
|
+
let steps = 0;
|
|
35
|
+
while (at && steps++ < flat.size + 1) {
|
|
36
|
+
if (at === id) return true;
|
|
37
|
+
at = replyTo.get(at);
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
const roots = [];
|
|
42
|
+
for (const post of flat.values()) {
|
|
43
|
+
const parentId = replyTo.get(post.id);
|
|
44
|
+
const parent = parentId ? flat.get(parentId) : void 0;
|
|
45
|
+
if (!parent || reaches(post.id, parentId)) {
|
|
46
|
+
roots.push(post);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
parent.replies.push(post);
|
|
50
|
+
}
|
|
51
|
+
const sort = (a, b) => options.newest ? b.date - a.date : a.date - b.date;
|
|
52
|
+
function settle(list, depth) {
|
|
53
|
+
list.sort(sort);
|
|
54
|
+
for (const post of list) {
|
|
55
|
+
post.depth = depth;
|
|
56
|
+
const replies = settle(post.replies, Math.min(depth + 1, depthMax));
|
|
57
|
+
if (depth + 1 > depthMax) {
|
|
58
|
+
post.replies = [];
|
|
59
|
+
list.push(...replies.map((r) => ({ ...r, depth })));
|
|
60
|
+
} else {
|
|
61
|
+
post.replies = replies;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return list;
|
|
65
|
+
}
|
|
66
|
+
const settled = settle(roots, 0);
|
|
67
|
+
return [...settled].sort((a, b) => Number(b.pinned) - Number(a.pinned));
|
|
68
|
+
}
|
|
69
|
+
export function junThreadCount(list) {
|
|
70
|
+
return list.reduce((total, post) => total + 1 + junThreadCount(post.replies), 0);
|
|
71
|
+
}
|
|
72
|
+
export function junCanReplyTo(posts, threadId, replyTo) {
|
|
73
|
+
if (!replyTo) return true;
|
|
74
|
+
return posts.some((p) => p.id === replyTo && p.parentId === threadId && !p.trashed);
|
|
75
|
+
}
|