@abraca/junis 2.85.0 → 2.87.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 +253 -21
- package/dist/runtime/assets/css/jun.css +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/JunDocSurface.vue +3 -0
- package/dist/runtime/components/JunFooter.vue +1 -1
- 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/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/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.d.vue.ts +17 -0
- package/dist/runtime/components/JunSectionPresence.vue +99 -0
- package/dist/runtime/components/JunSectionPresence.vue.d.ts +17 -0
- 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 +348 -225
- 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 +151 -23
- package/dist/runtime/components/renderers/JunFestivalRenderer.vue +41 -4
- 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/JunGlobeRenderer.vue +43 -26
- package/dist/runtime/components/renderers/JunGuestbookRenderer.vue +96 -14
- package/dist/runtime/components/renderers/JunHomeRenderer.vue +28 -129
- 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 +37 -1
- 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 +38 -5
- 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 +51 -5
- 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/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 +40 -2
- package/dist/runtime/composables/useJunViewOptions.d.ts +85 -0
- package/dist/runtime/composables/useJunViewOptions.js +63 -0
- package/dist/runtime/pages/doc.vue +52 -42
- package/dist/runtime/pages/index.vue +61 -35
- package/dist/runtime/plugins/jun-doc-tree.d.ts +2 -0
- package/dist/runtime/plugins/jun-doc-tree.js +26 -0
- package/dist/runtime/server/api/health.get.d.ts +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 +7 -2
- package/dist/runtime/server/api/stats.get.js +2 -1
- package/dist/runtime/server/api/tree.get.d.ts +9 -0
- package/dist/runtime/server/api/tree.get.js +23 -0
- package/dist/runtime/server/janitor/junJanitorActor.d.ts +13 -0
- package/dist/runtime/server/janitor/junJanitorActor.js +36 -5
- package/dist/runtime/server/janitor/junJanitorChores.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 +7 -0
- 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/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/junCache.d.ts +17 -0
- package/dist/runtime/server/utils/junCache.js +5 -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 +57 -1
- 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/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,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
docId: string;
|
|
3
|
+
docLabel?: string;
|
|
4
|
+
docMeta?: Record<string, unknown>;
|
|
5
|
+
editable?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -13,8 +13,10 @@ import {
|
|
|
13
13
|
useJunPlayer,
|
|
14
14
|
useJunRename,
|
|
15
15
|
useJunStudio,
|
|
16
|
-
useJunUpload
|
|
16
|
+
useJunUpload,
|
|
17
|
+
useJunViewOptions
|
|
17
18
|
} from "#imports";
|
|
19
|
+
import { junViewSpecFor } from "../../utils/junViewSpecs";
|
|
18
20
|
const props = defineProps({
|
|
19
21
|
docId: { type: String, required: true },
|
|
20
22
|
docLabel: { type: String, required: false },
|
|
@@ -42,6 +44,10 @@ const title = computed(() => entry.value?.label ?? props.docLabel ?? "Track");
|
|
|
42
44
|
function patchMeta(p) {
|
|
43
45
|
tree.updateMeta(props.docId, p);
|
|
44
46
|
}
|
|
47
|
+
const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
|
|
48
|
+
typeKey: "track",
|
|
49
|
+
options: junViewSpecFor("track")
|
|
50
|
+
}, () => props.docMeta);
|
|
45
51
|
const titleEl = ref(null);
|
|
46
52
|
function commitTitle() {
|
|
47
53
|
const t = titleEl.value?.textContent?.trim();
|
|
@@ -175,7 +181,13 @@ const factLine = computed(
|
|
|
175
181
|
v-motion="junMotion(junStagger(0, { delayMs: 0 }))"
|
|
176
182
|
class="flex flex-col gap-6 sm:flex-row sm:items-end"
|
|
177
183
|
>
|
|
178
|
-
|
|
184
|
+
<!-- `|| editing`: hiding the artwork must not take away the only place an
|
|
185
|
+
owner can change it. -->
|
|
186
|
+
<div
|
|
187
|
+
v-if="view.artwork || editing"
|
|
188
|
+
class="group relative aspect-square w-full max-w-56 shrink-0 overflow-hidden rounded-2xl bg-black/5 shadow-xl ring-1 ring-black/5 dark:bg-white/10 dark:ring-white/10"
|
|
189
|
+
data-jun-track="artwork"
|
|
190
|
+
>
|
|
179
191
|
<img
|
|
180
192
|
v-if="artwork"
|
|
181
193
|
:src="artwork"
|
|
@@ -229,12 +241,27 @@ const factLine = computed(
|
|
|
229
241
|
{{ title }}
|
|
230
242
|
</h1>
|
|
231
243
|
<p
|
|
232
|
-
v-if="factLine"
|
|
244
|
+
v-if="factLine && view.facts"
|
|
233
245
|
class="mt-2 text-sm text-muted"
|
|
246
|
+
data-jun-track="facts"
|
|
234
247
|
>
|
|
235
248
|
{{ factLine }}
|
|
236
249
|
</p>
|
|
237
250
|
|
|
251
|
+
<ClientOnly>
|
|
252
|
+
<div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1">
|
|
253
|
+
<JunReaders :doc-id="docId" />
|
|
254
|
+
<JunViewControls
|
|
255
|
+
v-if="editing"
|
|
256
|
+
:options="viewOptions"
|
|
257
|
+
:values="view"
|
|
258
|
+
:is-default="viewIsDefault"
|
|
259
|
+
@set="setView"
|
|
260
|
+
@reset="resetView"
|
|
261
|
+
/>
|
|
262
|
+
</div>
|
|
263
|
+
</ClientOnly>
|
|
264
|
+
|
|
238
265
|
<div class="mt-4 flex flex-wrap items-center gap-2">
|
|
239
266
|
<UButton
|
|
240
267
|
:icon="isCurrent && player.playing.value ? 'i-lucide-pause' : 'i-lucide-play'"
|
|
@@ -329,8 +356,9 @@ const factLine = computed(
|
|
|
329
356
|
</div>
|
|
330
357
|
|
|
331
358
|
<section
|
|
332
|
-
v-if="upNext.length"
|
|
359
|
+
v-if="view.upNext && upNext.length"
|
|
333
360
|
class="mt-10"
|
|
361
|
+
data-jun-track="up-next"
|
|
334
362
|
>
|
|
335
363
|
<div class="mb-3 flex items-baseline gap-3">
|
|
336
364
|
<h2 class="text-xs font-medium tracking-[0.22em] text-dimmed uppercase">
|
|
@@ -10,8 +10,10 @@ import {
|
|
|
10
10
|
useJunGroupedDnD,
|
|
11
11
|
useJunRename,
|
|
12
12
|
useJunStudio,
|
|
13
|
-
useJunViewingAccent
|
|
13
|
+
useJunViewingAccent,
|
|
14
|
+
useJunViewOptions
|
|
14
15
|
} from "#imports";
|
|
16
|
+
import { junViewSpecFor } from "../../utils/junViewSpecs";
|
|
15
17
|
const props = defineProps({
|
|
16
18
|
docId: { type: String, required: true },
|
|
17
19
|
docLabel: { type: String, required: false },
|
|
@@ -25,6 +27,10 @@ const { getEntry } = useDocTree();
|
|
|
25
27
|
const { editing } = useJunStudio();
|
|
26
28
|
const { renameDoc } = useJunRename();
|
|
27
29
|
const { accentInsetStyle, accentTitle } = useJunViewingAccent();
|
|
30
|
+
const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
|
|
31
|
+
typeKey: "uses",
|
|
32
|
+
options: junViewSpecFor("uses")
|
|
33
|
+
}, () => props.docMeta);
|
|
28
34
|
const pageMeta = computed(
|
|
29
35
|
() => getEntry(props.docId)?.meta ?? props.docMeta ?? {}
|
|
30
36
|
);
|
|
@@ -68,6 +74,7 @@ const {
|
|
|
68
74
|
ghostIconFor: () => "i-lucide-wrench"
|
|
69
75
|
});
|
|
70
76
|
const sections = computed(() => {
|
|
77
|
+
if (!view.value.group) return [{ category: "", items: orderedItems.value }];
|
|
71
78
|
const byCat = /* @__PURE__ */ new Map();
|
|
72
79
|
for (const item of orderedItems.value) {
|
|
73
80
|
const cat = item.meta?.category?.trim() || "";
|
|
@@ -101,11 +108,33 @@ function addItem(category) {
|
|
|
101
108
|
<template>
|
|
102
109
|
<div class="relative mx-auto w-full max-w-3xl px-4 pt-12 pb-16 sm:px-8">
|
|
103
110
|
<JunPageHero
|
|
111
|
+
:doc-id="docId"
|
|
104
112
|
:title="pageTitle"
|
|
105
113
|
:subtitle="subtitle"
|
|
106
114
|
:editable="editing"
|
|
107
115
|
@rename="renamePage"
|
|
108
116
|
@rename-subtitle="renameSubtitle"
|
|
117
|
+
>
|
|
118
|
+
<template #right>
|
|
119
|
+
<JunViewControls
|
|
120
|
+
v-if="editing"
|
|
121
|
+
:options="viewOptions"
|
|
122
|
+
:values="view"
|
|
123
|
+
:is-default="viewIsDefault"
|
|
124
|
+
@set="setView"
|
|
125
|
+
@reset="resetView"
|
|
126
|
+
/>
|
|
127
|
+
</template>
|
|
128
|
+
</JunPageHero>
|
|
129
|
+
|
|
130
|
+
<!-- The page's own prose, above its children. Collapses to nothing
|
|
131
|
+
when the document has no body, which is every site that has never
|
|
132
|
+
written one. -->
|
|
133
|
+
<JunCollectionIntro
|
|
134
|
+
:doc-id="docId"
|
|
135
|
+
:doc-label="pageTitle"
|
|
136
|
+
:doc-meta="docMeta"
|
|
137
|
+
placeholder="What this list is, and how you pick…"
|
|
109
138
|
/>
|
|
110
139
|
|
|
111
140
|
<!-- The section list is meta, so it edits like any other field. -->
|
|
@@ -149,11 +178,24 @@ function addItem(category) {
|
|
|
149
178
|
@dragleave="onGroupDragLeave($event)"
|
|
150
179
|
@drop="onGroupDrop(section.category, $event)"
|
|
151
180
|
>
|
|
152
|
-
<div
|
|
153
|
-
|
|
181
|
+
<div
|
|
182
|
+
v-if="section.category || editing"
|
|
183
|
+
class="mb-3 flex items-baseline gap-3 px-1"
|
|
184
|
+
>
|
|
185
|
+
<h2
|
|
186
|
+
v-if="section.category"
|
|
187
|
+
class="text-xs font-medium tracking-[0.22em] text-dimmed uppercase"
|
|
188
|
+
>
|
|
154
189
|
{{ section.category }}
|
|
155
190
|
</h2>
|
|
156
|
-
<div
|
|
191
|
+
<div
|
|
192
|
+
v-if="section.category"
|
|
193
|
+
class="h-px flex-1 bg-black/10 dark:bg-white/10"
|
|
194
|
+
/>
|
|
195
|
+
<div
|
|
196
|
+
v-else
|
|
197
|
+
class="flex-1"
|
|
198
|
+
/>
|
|
157
199
|
<UButton
|
|
158
200
|
v-if="editing"
|
|
159
201
|
icon="i-lucide-plus"
|
|
@@ -168,7 +210,7 @@ function addItem(category) {
|
|
|
168
210
|
<TransitionGroup
|
|
169
211
|
tag="ul"
|
|
170
212
|
name="jun-uses"
|
|
171
|
-
class="flex flex-col gap-3 px-1"
|
|
213
|
+
:class="view.variant === 'grid' ? 'grid grid-cols-1 gap-3 px-1 sm:grid-cols-2' : 'flex flex-col gap-3 px-1'"
|
|
172
214
|
>
|
|
173
215
|
<li
|
|
174
216
|
v-for="(entry, i) in section.items"
|
|
@@ -194,6 +236,10 @@ function addItem(category) {
|
|
|
194
236
|
:accent="accentInsetStyle(entry.id)"
|
|
195
237
|
:accent-title="accentTitle(entry.id)"
|
|
196
238
|
:force-internal="editing"
|
|
239
|
+
:show-icon="!!view.icons"
|
|
240
|
+
:show-description="!!view.descriptions"
|
|
241
|
+
:show-host="!!view.hosts"
|
|
242
|
+
:compact="!!view.compact"
|
|
197
243
|
/>
|
|
198
244
|
</JunItemMenu>
|
|
199
245
|
|
|
@@ -13,8 +13,10 @@ import {
|
|
|
13
13
|
useJunRename,
|
|
14
14
|
useJunStudio,
|
|
15
15
|
useJunUpload,
|
|
16
|
-
useJunViewingAccent
|
|
16
|
+
useJunViewingAccent,
|
|
17
|
+
useJunViewOptions
|
|
17
18
|
} from "#imports";
|
|
19
|
+
import { junViewSpecFor } from "../../utils/junViewSpecs";
|
|
18
20
|
const props = defineProps({
|
|
19
21
|
docId: { type: String, required: true },
|
|
20
22
|
docLabel: { type: String, required: false },
|
|
@@ -32,6 +34,33 @@ const { imageFiles } = useJunUpload();
|
|
|
32
34
|
const { importFile } = useDocImport();
|
|
33
35
|
const { openImagePopup } = useJunImagePopup();
|
|
34
36
|
const { accentInsetStyle, accentTitle } = useJunViewingAccent();
|
|
37
|
+
const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
|
|
38
|
+
typeKey: "wall",
|
|
39
|
+
options: junViewSpecFor("wall")
|
|
40
|
+
}, () => props.docMeta);
|
|
41
|
+
const COLUMN_CLASS = {
|
|
42
|
+
1: "columns-1",
|
|
43
|
+
2: "columns-1 sm:columns-2",
|
|
44
|
+
3: "columns-2 sm:columns-3",
|
|
45
|
+
4: "columns-2 sm:columns-4",
|
|
46
|
+
5: "columns-2 sm:columns-5"
|
|
47
|
+
};
|
|
48
|
+
const GAP_CLASS = {
|
|
49
|
+
tight: { track: "gap-2 sm:gap-2", item: "mb-2 sm:mb-2" },
|
|
50
|
+
normal: { track: "gap-3 sm:gap-4", item: "mb-3 sm:mb-4" },
|
|
51
|
+
airy: { track: "gap-5 sm:gap-7", item: "mb-5 sm:mb-7" }
|
|
52
|
+
};
|
|
53
|
+
const wallClass = computed(() => [
|
|
54
|
+
COLUMN_CLASS[Number(view.value.columns)] ?? COLUMN_CLASS[3],
|
|
55
|
+
GAP_CLASS[String(view.value.gap)]?.track ?? GAP_CLASS.normal.track,
|
|
56
|
+
"[column-fill:_balance]"
|
|
57
|
+
]);
|
|
58
|
+
const figureClass = computed(
|
|
59
|
+
() => GAP_CLASS[String(view.value.gap)]?.item ?? GAP_CLASS.normal.item
|
|
60
|
+
);
|
|
61
|
+
const mediaClass = computed(
|
|
62
|
+
() => view.value.muted ? "w-full h-auto grayscale-[0.15] group-hover:grayscale-0 transition-[filter] duration-500" : "w-full h-auto"
|
|
63
|
+
);
|
|
35
64
|
const pageTitle = computed(() => getEntry(props.docId)?.label ?? props.docLabel ?? "Wall");
|
|
36
65
|
const subtitle = computed(() => {
|
|
37
66
|
const meta = getEntry(props.docId)?.meta;
|
|
@@ -142,11 +171,33 @@ function commitCaption(p, e) {
|
|
|
142
171
|
onContainerDrop($event)"
|
|
143
172
|
>
|
|
144
173
|
<JunPageHero
|
|
174
|
+
:doc-id="docId"
|
|
145
175
|
:title="pageTitle"
|
|
146
176
|
:subtitle="subtitle"
|
|
147
177
|
:editable="editing"
|
|
148
178
|
@rename="renamePage"
|
|
149
179
|
@rename-subtitle="renameSubtitle"
|
|
180
|
+
>
|
|
181
|
+
<template #right>
|
|
182
|
+
<JunViewControls
|
|
183
|
+
v-if="editing"
|
|
184
|
+
:options="viewOptions"
|
|
185
|
+
:values="view"
|
|
186
|
+
:is-default="viewIsDefault"
|
|
187
|
+
@set="setView"
|
|
188
|
+
@reset="resetView"
|
|
189
|
+
/>
|
|
190
|
+
</template>
|
|
191
|
+
</JunPageHero>
|
|
192
|
+
|
|
193
|
+
<!-- The page's own prose, above its children. Collapses to nothing
|
|
194
|
+
when the document has no body, which is every site that has never
|
|
195
|
+
written one. -->
|
|
196
|
+
<JunCollectionIntro
|
|
197
|
+
:doc-id="docId"
|
|
198
|
+
:doc-label="pageTitle"
|
|
199
|
+
:doc-meta="docMeta"
|
|
200
|
+
placeholder="What these images are…"
|
|
150
201
|
/>
|
|
151
202
|
|
|
152
203
|
<div
|
|
@@ -190,17 +241,20 @@ function commitCaption(p, e) {
|
|
|
190
241
|
masonry read as a wall rather than a grid with gaps. -->
|
|
191
242
|
<div
|
|
192
243
|
v-else
|
|
193
|
-
class="
|
|
244
|
+
:class="wallClass"
|
|
194
245
|
>
|
|
195
246
|
<figure
|
|
196
247
|
v-for="(p, i) in orderedItems"
|
|
197
248
|
:key="p.id"
|
|
198
249
|
v-motion="junMotion(junStagger(Math.min(i, 8), { delayMs: 50 }))"
|
|
199
250
|
:data-jun-anchor="`doc:${p.id}`"
|
|
200
|
-
class="
|
|
251
|
+
class="break-inside-avoid"
|
|
201
252
|
:data-dnd-id="p.id"
|
|
202
253
|
:draggable="editing ? true : void 0"
|
|
203
|
-
:class="
|
|
254
|
+
:class="[
|
|
255
|
+
figureClass,
|
|
256
|
+
editing ? dragId === p.id ? 'cursor-grabbing opacity-70' : 'cursor-grab' : ''
|
|
257
|
+
]"
|
|
204
258
|
@dragstart="onItemDragStart(p, $event)"
|
|
205
259
|
@dragend="onItemDragEnd($event)"
|
|
206
260
|
>
|
|
@@ -225,11 +279,12 @@ function commitCaption(p, e) {
|
|
|
225
279
|
:mime-type="p.meta.coverMimeType || 'image/jpeg'"
|
|
226
280
|
:alt="p.label"
|
|
227
281
|
:size="900"
|
|
228
|
-
media-class="
|
|
282
|
+
:media-class="mediaClass"
|
|
229
283
|
/>
|
|
230
284
|
</div>
|
|
231
285
|
</JunItemMenu>
|
|
232
286
|
<figcaption
|
|
287
|
+
v-if="view.captions || editing"
|
|
233
288
|
class="mt-1.5 truncate px-0.5 text-xs text-muted outline-none"
|
|
234
289
|
:contenteditable="editing ? 'plaintext-only' : void 0"
|
|
235
290
|
spellcheck="false"
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useJunDeck — somebody is presenting, and you can go with them.
|
|
3
|
+
*
|
|
4
|
+
* The half of `jun-deck` that only works because this site is live. A presenter
|
|
5
|
+
* broadcasts which slide they are on; anybody else on the page is offered a
|
|
6
|
+
* Watch* button and then sees what the speaker sees, moving when they move. No
|
|
7
|
+
* screen share, no second tool, and no round trip through a server — it is one
|
|
8
|
+
* awareness field on a page both people already have open.
|
|
9
|
+
*
|
|
10
|
+
* ── Why this is not `useJunFollow` ───────────────────────────────────────────
|
|
11
|
+
*
|
|
12
|
+
* Following mirrors a leader's ROUTE and SCROLL, which is the right thing for
|
|
13
|
+
* reading a site together and the wrong thing here: the audience is already on the
|
|
14
|
+
* page, must not be dragged elsewhere if the speaker opens a link, and a slide
|
|
15
|
+
* index is not a scroll offset. Watching a deck is a narrower relationship than
|
|
16
|
+
* following a person — it ends when the deck does — so it gets its own field and
|
|
17
|
+
* its own opt-in. Follow still works on top of it: follow someone into a talk and
|
|
18
|
+
* you arrive at the page, then choose to watch.
|
|
19
|
+
*
|
|
20
|
+
* ── One field, three states ──────────────────────────────────────────────────
|
|
21
|
+
*
|
|
22
|
+
* `presenting: true` — I am driving, watch me.
|
|
23
|
+
* `presenting: false` — I am on this slide, but nobody should follow me: a
|
|
24
|
+
* viewer, so the presenter can see the room has kept up.
|
|
25
|
+
* absent — I am not in a deck at all.
|
|
26
|
+
*/
|
|
27
|
+
import { type ComputedRef, type Ref } from 'vue';
|
|
28
|
+
/** The awareness field. Namespaced by `useAAEphemeral` as `peer:junSlide`. */
|
|
29
|
+
export declare const JUN_SLIDE_FIELD = "junSlide";
|
|
30
|
+
/** What one peer broadcasts. Short keys — this rides on every awareness update. */
|
|
31
|
+
export interface JunSlideMark {
|
|
32
|
+
/** Which document, so a deck on another page is never mistaken for this one. */
|
|
33
|
+
d: string;
|
|
34
|
+
/** Slide index. */
|
|
35
|
+
i: number;
|
|
36
|
+
/** Driving, rather than merely present. */
|
|
37
|
+
p: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface JunDeckPeer {
|
|
40
|
+
clientId: number;
|
|
41
|
+
name: string;
|
|
42
|
+
color: string;
|
|
43
|
+
publicKey: string | null;
|
|
44
|
+
slide: number;
|
|
45
|
+
presenting: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface JunDeckPresenceApi {
|
|
48
|
+
/** Everyone in this deck, one entry per person. */
|
|
49
|
+
peers: ComputedRef<JunDeckPeer[]>;
|
|
50
|
+
/** Those driving. More than one is legal — a handover is two for a moment. */
|
|
51
|
+
presenters: ComputedRef<JunDeckPeer[]>;
|
|
52
|
+
/** People in the deck who are not presenting. The room, from the stage. */
|
|
53
|
+
audience: ComputedRef<JunDeckPeer[]>;
|
|
54
|
+
/** The session being watched, or null. */
|
|
55
|
+
watchingClientId: Ref<number | null>;
|
|
56
|
+
/** The slide the watched presenter is on, or null. */
|
|
57
|
+
watchedSlide: ComputedRef<number | null>;
|
|
58
|
+
/** Watch a presenter — or stop, if it is the one already being watched. */
|
|
59
|
+
toggleWatch: (clientId: number) => void;
|
|
60
|
+
stopWatching: () => void;
|
|
61
|
+
/** Say where I am. `presenting` makes me offerable as somebody to watch. */
|
|
62
|
+
announce: (slide: number, presenting: boolean) => void;
|
|
63
|
+
/** Leave the deck: clears my field entirely. */
|
|
64
|
+
leave: () => void;
|
|
65
|
+
}
|
|
66
|
+
export declare function useJunDeckPresence(docId: Ref<string> | ComputedRef<string>): JunDeckPresenceApi;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { computed, onBeforeUnmount, ref, watch } from "vue";
|
|
2
|
+
import { useAAEphemeral } from "#imports";
|
|
3
|
+
import { junDedupePeople } from "../utils/junPeople.js";
|
|
4
|
+
import { junClampSlide } from "../utils/junSlides.js";
|
|
5
|
+
export const JUN_SLIDE_FIELD = "junSlide";
|
|
6
|
+
export function useJunDeckPresence(docId) {
|
|
7
|
+
const { peers: raw, setLocal } = useAAEphemeral(JUN_SLIDE_FIELD);
|
|
8
|
+
const watchingClientId = ref(null);
|
|
9
|
+
const peers = computed(() => {
|
|
10
|
+
const out = [];
|
|
11
|
+
for (const peer of raw.value) {
|
|
12
|
+
const mark = peer.value;
|
|
13
|
+
if (!mark || mark.d !== docId.value || typeof mark.i !== "number") continue;
|
|
14
|
+
out.push({
|
|
15
|
+
clientId: peer.clientId,
|
|
16
|
+
name: peer.user?.name || "Traveller",
|
|
17
|
+
color: peer.user?.color || "var(--ui-text-muted)",
|
|
18
|
+
publicKey: typeof peer.user?.publicKey === "string" ? peer.user.publicKey : null,
|
|
19
|
+
slide: Math.trunc(mark.i),
|
|
20
|
+
presenting: mark.p === true
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return junDedupePeople(out);
|
|
24
|
+
});
|
|
25
|
+
const presenters = computed(() => peers.value.filter((p) => p.presenting));
|
|
26
|
+
const audience = computed(() => peers.value.filter((p) => !p.presenting));
|
|
27
|
+
const watchedSlide = computed(() => {
|
|
28
|
+
const id = watchingClientId.value;
|
|
29
|
+
if (id == null) return null;
|
|
30
|
+
const leader = peers.value.find((p) => p.clientId === id);
|
|
31
|
+
return leader ? leader.slide : null;
|
|
32
|
+
});
|
|
33
|
+
watch([peers, watchingClientId], ([list, id]) => {
|
|
34
|
+
if (id == null) return;
|
|
35
|
+
if (!list.some((p) => p.clientId === id && p.presenting)) watchingClientId.value = null;
|
|
36
|
+
});
|
|
37
|
+
function toggleWatch(clientId) {
|
|
38
|
+
watchingClientId.value = watchingClientId.value === clientId ? null : clientId;
|
|
39
|
+
}
|
|
40
|
+
function stopWatching() {
|
|
41
|
+
watchingClientId.value = null;
|
|
42
|
+
}
|
|
43
|
+
function announce(slide, presenting) {
|
|
44
|
+
setLocal({ d: docId.value, i: junClampSlide(slide, Number.MAX_SAFE_INTEGER), p: presenting });
|
|
45
|
+
}
|
|
46
|
+
function leave() {
|
|
47
|
+
setLocal(null);
|
|
48
|
+
}
|
|
49
|
+
onBeforeUnmount(leave);
|
|
50
|
+
return {
|
|
51
|
+
peers,
|
|
52
|
+
presenters,
|
|
53
|
+
audience,
|
|
54
|
+
watchingClientId,
|
|
55
|
+
watchedSlide,
|
|
56
|
+
toggleWatch,
|
|
57
|
+
stopWatching,
|
|
58
|
+
announce,
|
|
59
|
+
leave
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -47,6 +47,16 @@ export interface JunResolvedDoc {
|
|
|
47
47
|
title?: string | null;
|
|
48
48
|
type?: string;
|
|
49
49
|
meta?: Record<string, unknown>;
|
|
50
|
+
/**
|
|
51
|
+
* The page ABOVE this one, as a renderer hint. A collection's children are
|
|
52
|
+
* plain documents, so what a book page looks like is a fact about the
|
|
53
|
+
* Library — and the live tree that would answer it is empty during SSR and
|
|
54
|
+
* for the first moments after, which is exactly when the layout bucket is
|
|
55
|
+
* chosen. Type and label only; not a copy of the parent.
|
|
56
|
+
*/
|
|
57
|
+
parentId?: string | null;
|
|
58
|
+
parentType?: string | null;
|
|
59
|
+
parentTitle?: string | null;
|
|
50
60
|
html?: string | null;
|
|
51
61
|
}
|
|
52
62
|
export type JunLayoutBucket = 'immersive' | 'panel' | 'flowing';
|
|
@@ -56,20 +66,13 @@ export interface UseJunDocPageOptions {
|
|
|
56
66
|
/** The server resolve payload, when the route fetched one. */
|
|
57
67
|
resolved?: MaybeResolved;
|
|
58
68
|
}
|
|
59
|
-
/**
|
|
60
|
-
* SYNCHRONOUS on purpose — do not add an `await` to this function.
|
|
61
|
-
*
|
|
62
|
-
* `useHead`, `useNuxtData` and friends resolve the Nuxt instance from an
|
|
63
|
-
* async-local context that is LOST across an await boundary. An earlier
|
|
64
|
-
* revision awaited the site-config fetch here and every page 500'd with "A
|
|
65
|
-
* composable that requires access to the Nuxt instance was called outside of
|
|
66
|
-
* a plugin…". Anything this needs must therefore already be in the payload:
|
|
67
|
-
* `JunHead` blocks on the site config in `app.vue`, so it is warm by the time
|
|
68
|
-
* any page's setup runs, and this reads it back through `useNuxtData`.
|
|
69
|
-
*/
|
|
70
69
|
export declare function useJunDocPage(docId: Ref<string | null> | ComputedRef<string | null>, options?: UseJunDocPageOptions): {
|
|
71
70
|
entry: ComputedRef<TreeEntry | undefined>;
|
|
72
71
|
docType: ComputedRef<string | null>;
|
|
72
|
+
/** True when this page renders through the shared item renderer. */
|
|
73
|
+
isItem: ComputedRef<boolean>;
|
|
74
|
+
/** The parent collection's item presentation, when it is one. */
|
|
75
|
+
itemPresentation: ComputedRef<import("../types.js").JunItemPresentation | undefined>;
|
|
73
76
|
bucket: ComputedRef<JunLayoutBucket>;
|
|
74
77
|
immersive: ComputedRef<boolean>;
|
|
75
78
|
panel: ComputedRef<boolean>;
|
|
@@ -10,6 +10,13 @@ import {
|
|
|
10
10
|
junConfigStr,
|
|
11
11
|
isJunOwnerOnlyDoc
|
|
12
12
|
} from "#imports";
|
|
13
|
+
import { JUN_CHROME_OPTIONS } from "../utils/junViewSpecs.js";
|
|
14
|
+
import { junResolveViewValue } from "../utils/junViewValues.js";
|
|
15
|
+
const FLAG = {
|
|
16
|
+
chromeNav: "no-nav",
|
|
17
|
+
chromeFooter: "no-footer",
|
|
18
|
+
chromeBackdrop: "no-backdrop"
|
|
19
|
+
};
|
|
13
20
|
export function useJunDocPage(docId, options = {}) {
|
|
14
21
|
const { resolved } = options;
|
|
15
22
|
const opts = useJunOptions();
|
|
@@ -26,10 +33,23 @@ export function useJunDocPage(docId, options = {}) {
|
|
|
26
33
|
editorMaxW
|
|
27
34
|
} = useJunLayoutPolicy();
|
|
28
35
|
const entry = computed(() => docId.value ? getEntry(docId.value) : void 0);
|
|
29
|
-
const
|
|
36
|
+
const storedType = computed(() => {
|
|
30
37
|
if (!docId.value) return null;
|
|
31
38
|
return resolveType(entry.value?.type ?? resolved?.value?.type ?? "doc") ?? "doc";
|
|
32
39
|
});
|
|
40
|
+
const parentType = computed(() => {
|
|
41
|
+
if (!docId.value) return null;
|
|
42
|
+
const live = entry.value?.parentId ? getEntry(entry.value.parentId)?.type : void 0;
|
|
43
|
+
return resolveType(live ?? resolved?.value?.parentType ?? void 0) ?? null;
|
|
44
|
+
});
|
|
45
|
+
const itemPresentation = computed(() => {
|
|
46
|
+
const t = parentType.value;
|
|
47
|
+
return t ? opts.itemParents[t] : void 0;
|
|
48
|
+
});
|
|
49
|
+
const isItem = computed(
|
|
50
|
+
() => !!itemPresentation.value && !opts.pageTypes.includes(storedType.value ?? "doc")
|
|
51
|
+
);
|
|
52
|
+
const docType = computed(() => isItem.value ? opts.itemType : storedType.value);
|
|
33
53
|
const immersive = computed(() => isImmersiveType(docType.value));
|
|
34
54
|
const panel = computed(() => isPanelType(docType.value));
|
|
35
55
|
const locked = computed(() => isLockedType(docType.value));
|
|
@@ -51,7 +71,18 @@ export function useJunDocPage(docId, options = {}) {
|
|
|
51
71
|
() => `${docId.value}:${docType.value}:${editing.value ? "edit" : "read"}`
|
|
52
72
|
);
|
|
53
73
|
const cachedEntry = computed(() => {
|
|
54
|
-
if (!docId.value
|
|
74
|
+
if (!docId.value) return null;
|
|
75
|
+
if (isItem.value) {
|
|
76
|
+
const live = entry.value;
|
|
77
|
+
if (live) return { label: live.label ?? "", type: opts.itemType, meta: live.meta ?? {} };
|
|
78
|
+
if (!resolved?.value?.found) return null;
|
|
79
|
+
return {
|
|
80
|
+
label: resolved.value.title ?? "",
|
|
81
|
+
type: opts.itemType,
|
|
82
|
+
meta: resolved.value.meta ?? {}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (entry.value || !resolved?.value?.found) return null;
|
|
55
86
|
return {
|
|
56
87
|
label: resolved.value.title ?? "",
|
|
57
88
|
type: resolved.value.type ?? "doc",
|
|
@@ -86,7 +117,7 @@ export function useJunDocPage(docId, options = {}) {
|
|
|
86
117
|
});
|
|
87
118
|
const jsonLd = computed(() => {
|
|
88
119
|
const type = docType.value;
|
|
89
|
-
const builder = type ? opts.jsonLd?.[type] : void 0;
|
|
120
|
+
const builder = isItem.value ? itemPresentation.value?.jsonLd : type ? opts.jsonLd?.[type] : void 0;
|
|
90
121
|
if (!builder || !resolved?.value?.found || ownerOnly.value) return "";
|
|
91
122
|
const out = junBuildJsonLd(builder, {
|
|
92
123
|
title: resolved.value.title ?? "",
|
|
@@ -100,6 +131,35 @@ export function useJunDocPage(docId, options = {}) {
|
|
|
100
131
|
description: () => description.value,
|
|
101
132
|
ogDescription: () => description.value
|
|
102
133
|
});
|
|
134
|
+
const typeKey = computed(() => {
|
|
135
|
+
const id = docType.value;
|
|
136
|
+
if (!id) return void 0;
|
|
137
|
+
const hit = Object.entries(opts.typeIds).find(([, value]) => value === id);
|
|
138
|
+
return hit?.[0];
|
|
139
|
+
});
|
|
140
|
+
const chromeFlags = computed(() => {
|
|
141
|
+
const meta = entry.value?.meta ?? resolved?.value?.meta ?? {};
|
|
142
|
+
const stored = meta.junView && typeof meta.junView === "object" && !Array.isArray(meta.junView) ? meta.junView : {};
|
|
143
|
+
const key = typeKey.value;
|
|
144
|
+
const house = key ? {
|
|
145
|
+
...opts.renderers?.[key] ?? {},
|
|
146
|
+
...siteConfig.value.renderers?.[key] ?? {}
|
|
147
|
+
} : {};
|
|
148
|
+
const off = [];
|
|
149
|
+
for (const option of JUN_CHROME_OPTIONS) {
|
|
150
|
+
if (junResolveViewValue(option, stored, house, meta) === false) {
|
|
151
|
+
off.push(FLAG[option.key] ?? "");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const flags = off.filter(Boolean).join(" ");
|
|
155
|
+
return flags || void 0;
|
|
156
|
+
});
|
|
157
|
+
useHead({
|
|
158
|
+
htmlAttrs: {
|
|
159
|
+
"data-jun-type": computed(() => typeKey.value),
|
|
160
|
+
"data-jun-chrome": computed(() => chromeFlags.value)
|
|
161
|
+
}
|
|
162
|
+
});
|
|
103
163
|
useHead({
|
|
104
164
|
script: computed(
|
|
105
165
|
() => jsonLd.value ? [{ key: "jun-jsonld", type: "application/ld+json", textContent: jsonLd.value }] : []
|
|
@@ -108,6 +168,10 @@ export function useJunDocPage(docId, options = {}) {
|
|
|
108
168
|
return {
|
|
109
169
|
entry,
|
|
110
170
|
docType,
|
|
171
|
+
/** True when this page renders through the shared item renderer. */
|
|
172
|
+
isItem,
|
|
173
|
+
/** The parent collection's item presentation, when it is one. */
|
|
174
|
+
itemPresentation,
|
|
111
175
|
bucket,
|
|
112
176
|
immersive,
|
|
113
177
|
panel,
|
|
@@ -1,11 +1,67 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* useJunFollow — travel with a fellow visitor.
|
|
3
|
+
*
|
|
4
|
+
* Broadcasts where I am, mirrors where the leader is, and — this is the part
|
|
5
|
+
* that makes it a journey rather than a URL — mirrors how far down the page
|
|
6
|
+
* they have read. Built on @abraca/nuxt's `useAAFollowPeer`, which also mirrors
|
|
7
|
+
* the leader's live aware-ui state (open panels, active tabs).
|
|
8
|
+
*
|
|
9
|
+
* ── The break rule is OURS, and the upstream default was wrong here ──────────
|
|
10
|
+
*
|
|
11
|
+
* `useAAFollowPeer()` defaults to `breakOn: 'any'`, which installs `unfollow()`
|
|
12
|
+
* on `keydown`, `wheel` and `pointerdown`. That is right for following a peer's
|
|
13
|
+
* CAMERA around a map, where your own scroll is a takeover gesture. It is
|
|
14
|
+
* exactly wrong for following someone's journey through a WEBSITE, where
|
|
15
|
+
* scrolling is how you read the page they just took you to: the first wheel
|
|
16
|
+
* tick ended the follow, silently, and so did the first click — including the
|
|
17
|
+
* click on the Unfollow button, which unfollowed on its own pointerdown before
|
|
18
|
+
* its handler ever ran, and every click inside the panel that offers the
|
|
19
|
+
* follow, since nothing passed `ignoreWithin` either.
|
|
20
|
+
*
|
|
21
|
+
* So: `breakOn: 'none'`, and this file decides. Three things end a follow, and
|
|
22
|
+
* each one is the visitor SAYING SO:
|
|
23
|
+
*
|
|
24
|
+
* 1. the stop button, or Escape;
|
|
25
|
+
* 2. clicking a link — you asked to go somewhere the leader is not;
|
|
26
|
+
* 3. Back/Forward.
|
|
27
|
+
*
|
|
28
|
+
* **Not `router.afterEach`.** Every navigation would qualify, including the
|
|
29
|
+
* ones this site makes on its own behalf: `doc.vue` `router.replace`s onto a
|
|
30
|
+
* document's new slug whenever anybody renames a page, so a rename anywhere on
|
|
31
|
+
* the site would have quietly ended every follow in progress. A capture-phase
|
|
32
|
+
* click on an anchor fires for user gestures and for nothing else.
|
|
33
|
+
*
|
|
34
|
+
* ── One instance per tab ─────────────────────────────────────────────────────
|
|
35
|
+
*
|
|
36
|
+
* The broadcast has to keep running whatever is mounted, so the whole thing is
|
|
37
|
+
* created ONCE inside a detached `effectScope` and every call site gets the
|
|
38
|
+
* same object. It used to require a single always-mounted caller; now the
|
|
39
|
+
* readers strip, the travellers chip and the hearth can all ask for it.
|
|
40
|
+
*/
|
|
41
|
+
import { type ComputedRef, type Ref } from 'vue';
|
|
42
|
+
/** Someone who is following ME. Deduplicated per person, not per tab. */
|
|
43
|
+
export interface JunFollower {
|
|
44
|
+
clientId: number;
|
|
45
|
+
name: string;
|
|
46
|
+
color: string;
|
|
47
|
+
publicKey: string;
|
|
48
|
+
}
|
|
49
|
+
export interface JunFollowApi {
|
|
50
|
+
/** Follow this session, or stop following it if it is already the leader. */
|
|
2
51
|
toggle: (clientId: number) => void;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
52
|
+
follow: (clientId: number) => void;
|
|
53
|
+
unfollow: (reason?: string) => void;
|
|
54
|
+
followingClientId: ComputedRef<number | null>;
|
|
55
|
+
followingPublicKey: ComputedRef<string | null>;
|
|
56
|
+
followingUser: ComputedRef<{
|
|
57
|
+
name?: string;
|
|
58
|
+
color?: string;
|
|
59
|
+
publicKey?: string;
|
|
9
60
|
} | null>;
|
|
10
|
-
isFollowing:
|
|
11
|
-
|
|
61
|
+
isFollowing: ComputedRef<boolean>;
|
|
62
|
+
/** Everyone travelling with ME. Empty for almost every visitor, almost always. */
|
|
63
|
+
followers: ComputedRef<JunFollower[]>;
|
|
64
|
+
/** A short, self-clearing line explaining why a follow just ended. */
|
|
65
|
+
notice: Ref<string | null>;
|
|
66
|
+
}
|
|
67
|
+
export declare function useJunFollow(): JunFollowApi;
|