@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.
Files changed (161) hide show
  1. package/dist/module.d.mts +17 -2
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +253 -21
  4. package/dist/runtime/assets/css/jun.css +1 -1
  5. package/dist/runtime/components/JunCampfirePresence.client.vue +75 -10
  6. package/dist/runtime/components/JunCollectionIntro.d.vue.ts +11 -0
  7. package/dist/runtime/components/JunCollectionIntro.vue +45 -0
  8. package/dist/runtime/components/JunCollectionIntro.vue.d.ts +11 -0
  9. package/dist/runtime/components/JunConfigRow.d.vue.ts +43 -0
  10. package/dist/runtime/components/JunConfigRow.vue +34 -0
  11. package/dist/runtime/components/JunConfigRow.vue.d.ts +43 -0
  12. package/dist/runtime/components/JunDocSurface.vue +3 -0
  13. package/dist/runtime/components/JunFooter.vue +1 -1
  14. package/dist/runtime/components/JunHorizontalTimeline.d.vue.ts +30 -0
  15. package/dist/runtime/components/JunHorizontalTimeline.vue.d.ts +30 -0
  16. package/dist/runtime/components/JunLinksRow.d.vue.ts +16 -1
  17. package/dist/runtime/components/JunLinksRow.vue +17 -7
  18. package/dist/runtime/components/JunLinksRow.vue.d.ts +16 -1
  19. package/dist/runtime/components/JunMedia.client.d.vue.ts +1 -1
  20. package/dist/runtime/components/JunMedia.client.vue.d.ts +1 -1
  21. package/dist/runtime/components/JunNavigation.vue +21 -4
  22. package/dist/runtime/components/JunNoteLinks.d.vue.ts +6 -0
  23. package/dist/runtime/components/JunNoteLinks.vue +57 -0
  24. package/dist/runtime/components/JunNoteLinks.vue.d.ts +6 -0
  25. package/dist/runtime/components/JunPageHero.d.vue.ts +8 -2
  26. package/dist/runtime/components/JunPageHero.vue +15 -3
  27. package/dist/runtime/components/JunPageHero.vue.d.ts +8 -2
  28. package/dist/runtime/components/JunReaders.d.vue.ts +11 -0
  29. package/dist/runtime/components/JunReaders.vue +99 -0
  30. package/dist/runtime/components/JunReaders.vue.d.ts +11 -0
  31. package/dist/runtime/components/JunSearch.client.vue +2 -2
  32. package/dist/runtime/components/JunSectionPresence.d.vue.ts +17 -0
  33. package/dist/runtime/components/JunSectionPresence.vue +99 -0
  34. package/dist/runtime/components/JunSectionPresence.vue.d.ts +17 -0
  35. package/dist/runtime/components/JunThreadComposer.d.vue.ts +37 -0
  36. package/dist/runtime/components/JunThreadComposer.vue +54 -0
  37. package/dist/runtime/components/JunThreadComposer.vue.d.ts +37 -0
  38. package/dist/runtime/components/JunTravellersChip.vue +35 -5
  39. package/dist/runtime/components/JunVideoEmbed.client.d.vue.ts +1 -1
  40. package/dist/runtime/components/JunVideoEmbed.client.vue.d.ts +1 -1
  41. package/dist/runtime/components/JunViewControl.d.vue.ts +29 -0
  42. package/dist/runtime/components/JunViewControl.vue +340 -0
  43. package/dist/runtime/components/JunViewControl.vue.d.ts +29 -0
  44. package/dist/runtime/components/JunViewControls.d.vue.ts +27 -0
  45. package/dist/runtime/components/JunViewControls.vue +94 -0
  46. package/dist/runtime/components/JunViewControls.vue.d.ts +27 -0
  47. package/dist/runtime/components/renderers/JunAppsRenderer.vue +45 -4
  48. package/dist/runtime/components/renderers/JunCinemaRenderer.vue +42 -4
  49. package/dist/runtime/components/renderers/JunConfigRenderer.vue +348 -225
  50. package/dist/runtime/components/renderers/JunCourseRenderer.d.vue.ts +10 -0
  51. package/dist/runtime/components/renderers/JunCourseRenderer.vue +229 -0
  52. package/dist/runtime/components/renderers/JunCourseRenderer.vue.d.ts +10 -0
  53. package/dist/runtime/components/renderers/JunCvRenderer.vue +44 -6
  54. package/dist/runtime/components/renderers/JunDeckRenderer.d.vue.ts +9 -0
  55. package/dist/runtime/components/renderers/JunDeckRenderer.vue +370 -0
  56. package/dist/runtime/components/renderers/JunDeckRenderer.vue.d.ts +9 -0
  57. package/dist/runtime/components/renderers/JunEntryRenderer.vue +151 -23
  58. package/dist/runtime/components/renderers/JunFestivalRenderer.vue +41 -4
  59. package/dist/runtime/components/renderers/JunGardenRenderer.d.vue.ts +10 -0
  60. package/dist/runtime/components/renderers/JunGardenRenderer.vue +280 -0
  61. package/dist/runtime/components/renderers/JunGardenRenderer.vue.d.ts +10 -0
  62. package/dist/runtime/components/renderers/JunGlobeRenderer.vue +43 -26
  63. package/dist/runtime/components/renderers/JunGuestbookRenderer.vue +96 -14
  64. package/dist/runtime/components/renderers/JunHomeRenderer.vue +28 -129
  65. package/dist/runtime/components/renderers/JunItemRenderer.d.vue.ts +10 -0
  66. package/dist/runtime/components/renderers/JunItemRenderer.vue +398 -0
  67. package/dist/runtime/components/renderers/JunItemRenderer.vue.d.ts +10 -0
  68. package/dist/runtime/components/renderers/JunJournalRenderer.vue +141 -11
  69. package/dist/runtime/components/renderers/JunLibraryRenderer.vue +295 -12
  70. package/dist/runtime/components/renderers/JunLinksRenderer.vue +33 -1
  71. package/dist/runtime/components/renderers/JunLiveRenderer.vue +37 -1
  72. package/dist/runtime/components/renderers/JunMosaicRenderer.vue +3 -2
  73. package/dist/runtime/components/renderers/JunMovieRenderer.vue +32 -5
  74. package/dist/runtime/components/renderers/JunNowRenderer.vue +38 -5
  75. package/dist/runtime/components/renderers/JunPollRenderer.d.vue.ts +9 -0
  76. package/dist/runtime/components/renderers/JunPollRenderer.vue +231 -0
  77. package/dist/runtime/components/renderers/JunPollRenderer.vue.d.ts +9 -0
  78. package/dist/runtime/components/renderers/JunProjectRenderer.vue +74 -18
  79. package/dist/runtime/components/renderers/JunServicesRenderer.vue +40 -2
  80. package/dist/runtime/components/renderers/JunStatsRenderer.vue +37 -50
  81. package/dist/runtime/components/renderers/JunThreadRenderer.d.vue.ts +9 -0
  82. package/dist/runtime/components/renderers/JunThreadRenderer.vue +304 -0
  83. package/dist/runtime/components/renderers/JunThreadRenderer.vue.d.ts +9 -0
  84. package/dist/runtime/components/renderers/JunTrackRenderer.vue +32 -4
  85. package/dist/runtime/components/renderers/JunUsesRenderer.vue +51 -5
  86. package/dist/runtime/components/renderers/JunWallRenderer.vue +60 -5
  87. package/dist/runtime/composables/useJunDeck.d.ts +66 -0
  88. package/dist/runtime/composables/useJunDeck.js +61 -0
  89. package/dist/runtime/composables/useJunDocPage.d.ts +14 -11
  90. package/dist/runtime/composables/useJunDocPage.js +67 -3
  91. package/dist/runtime/composables/useJunFollow.d.ts +65 -9
  92. package/dist/runtime/composables/useJunFollow.js +237 -20
  93. package/dist/runtime/composables/useJunGarden.d.ts +67 -0
  94. package/dist/runtime/composables/useJunGarden.js +92 -0
  95. package/dist/runtime/composables/useJunPresence.d.ts +26 -0
  96. package/dist/runtime/composables/useJunPresence.js +9 -2
  97. package/dist/runtime/composables/useJunSections.d.ts +73 -0
  98. package/dist/runtime/composables/useJunSections.js +117 -0
  99. package/dist/runtime/composables/useJunSettings.d.ts +1 -1
  100. package/dist/runtime/composables/useJunSettings.js +5 -1
  101. package/dist/runtime/composables/useJunSiteConfig.d.ts +37 -0
  102. package/dist/runtime/composables/useJunTheme.js +40 -2
  103. package/dist/runtime/composables/useJunViewOptions.d.ts +85 -0
  104. package/dist/runtime/composables/useJunViewOptions.js +63 -0
  105. package/dist/runtime/pages/doc.vue +52 -42
  106. package/dist/runtime/pages/index.vue +61 -35
  107. package/dist/runtime/plugins/jun-doc-tree.d.ts +2 -0
  108. package/dist/runtime/plugins/jun-doc-tree.js +26 -0
  109. package/dist/runtime/server/api/health.get.d.ts +19 -0
  110. package/dist/runtime/server/api/health.get.js +40 -0
  111. package/dist/runtime/server/api/links.get.d.ts +19 -0
  112. package/dist/runtime/server/api/links.get.js +37 -0
  113. package/dist/runtime/server/api/resolve/[...slug].get.d.ts +9 -0
  114. package/dist/runtime/server/api/resolve/[...slug].get.js +7 -2
  115. package/dist/runtime/server/api/stats.get.js +2 -1
  116. package/dist/runtime/server/api/tree.get.d.ts +9 -0
  117. package/dist/runtime/server/api/tree.get.js +23 -0
  118. package/dist/runtime/server/janitor/junJanitorActor.d.ts +13 -0
  119. package/dist/runtime/server/janitor/junJanitorActor.js +36 -5
  120. package/dist/runtime/server/janitor/junJanitorChores.js +8 -0
  121. package/dist/runtime/server/plugins/jun-bootstrap.js +103 -15
  122. package/dist/runtime/server/plugins/jun-doc-cache.js +42 -4
  123. package/dist/runtime/server/plugins/jun-janitor.js +7 -0
  124. package/dist/runtime/server/plugins/jun-rpc.js +293 -0
  125. package/dist/runtime/server/plugins/jun-watchdog.d.ts +2 -0
  126. package/dist/runtime/server/plugins/jun-watchdog.js +54 -0
  127. package/dist/runtime/server/routes/sitemap.xml.get.js +2 -0
  128. package/dist/runtime/server/utils/junBoot.d.ts +1 -0
  129. package/dist/runtime/server/utils/junBoot.js +4 -0
  130. package/dist/runtime/server/utils/junCache.d.ts +17 -0
  131. package/dist/runtime/server/utils/junCache.js +5 -0
  132. package/dist/runtime/server/utils/junSeedGate.d.ts +68 -0
  133. package/dist/runtime/server/utils/junSeedGate.js +41 -0
  134. package/dist/runtime/types.d.ts +57 -1
  135. package/dist/runtime/utils/junCourse.d.ts +106 -0
  136. package/dist/runtime/utils/junCourse.js +65 -0
  137. package/dist/runtime/utils/junGarden.d.ts +193 -0
  138. package/dist/runtime/utils/junGarden.js +233 -0
  139. package/dist/runtime/utils/junMetaSchemas.js +8 -1
  140. package/dist/runtime/utils/junModeration.d.ts +67 -0
  141. package/dist/runtime/utils/junModeration.js +20 -0
  142. package/dist/runtime/utils/junMotion.d.ts +26 -0
  143. package/dist/runtime/utils/junMotion.js +31 -0
  144. package/dist/runtime/utils/junPeople.d.ts +43 -0
  145. package/dist/runtime/utils/junPeople.js +9 -0
  146. package/dist/runtime/utils/junPoll.d.ts +79 -0
  147. package/dist/runtime/utils/junPoll.js +82 -0
  148. package/dist/runtime/utils/junReadiness.d.ts +131 -0
  149. package/dist/runtime/utils/junReadiness.js +69 -0
  150. package/dist/runtime/utils/junSections.d.ts +115 -0
  151. package/dist/runtime/utils/junSections.js +45 -0
  152. package/dist/runtime/utils/junSlides.d.ts +66 -0
  153. package/dist/runtime/utils/junSlides.js +47 -0
  154. package/dist/runtime/utils/junThread.d.ts +81 -0
  155. package/dist/runtime/utils/junThread.js +75 -0
  156. package/dist/runtime/utils/junViewSpecs.d.ts +671 -0
  157. package/dist/runtime/utils/junViewSpecs.js +534 -0
  158. package/dist/runtime/utils/junViewValues.d.ts +125 -0
  159. package/dist/runtime/utils/junViewValues.js +104 -0
  160. package/dist/types.d.mts +1 -1
  161. package/package.json +5 -1
@@ -0,0 +1,370 @@
1
+ <script setup>
2
+ import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
3
+ import {
4
+ useDocTree,
5
+ useJunRename,
6
+ useJunStudio,
7
+ useJunViewOptions
8
+ } from "#imports";
9
+ import { junViewSpecFor } from "../../utils/junViewSpecs";
10
+ import { junClampSlide, junSlideProgress, junSplitSlides, junStepSlide } from "../../utils/junSlides";
11
+ import { useJunDeckPresence } from "../../composables/useJunDeck";
12
+ const props = defineProps({
13
+ docId: { type: String, required: true },
14
+ docLabel: { type: String, required: false },
15
+ docMeta: { type: Object, required: false },
16
+ editable: { type: Boolean, required: false }
17
+ });
18
+ const { getEntry } = useDocTree();
19
+ const { editing } = useJunStudio();
20
+ const { renameDoc } = useJunRename();
21
+ const docIdRef = computed(() => props.docId);
22
+ const {
23
+ presenters,
24
+ audience,
25
+ watchingClientId,
26
+ watchedSlide,
27
+ toggleWatch,
28
+ stopWatching,
29
+ announce,
30
+ leave
31
+ } = useJunDeckPresence(docIdRef);
32
+ const title = computed(() => getEntry(props.docId)?.label ?? props.docLabel ?? "Deck");
33
+ const subtitle = computed(() => {
34
+ const meta = getEntry(props.docId)?.meta ?? props.docMeta;
35
+ const ex = meta?.excerpt;
36
+ return typeof ex === "string" && ex.trim() ? ex : void 0;
37
+ });
38
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
39
+ typeKey: "deck",
40
+ options: junViewSpecFor("deck")
41
+ }, () => props.docMeta);
42
+ const prose = ref(null);
43
+ const html = ref("");
44
+ const slides = computed(() => junSplitSlides(html.value));
45
+ const count = computed(() => slides.value.length);
46
+ let observer = null;
47
+ let frame = null;
48
+ function readProse() {
49
+ if (frame != null) return;
50
+ frame = requestAnimationFrame(() => {
51
+ frame = null;
52
+ const root = prose.value?.querySelector(".ProseMirror") ?? prose.value;
53
+ html.value = root?.innerHTML ?? "";
54
+ });
55
+ }
56
+ onMounted(() => {
57
+ readProse();
58
+ if (!prose.value) return;
59
+ observer = new MutationObserver(readProse);
60
+ observer.observe(prose.value, { childList: true, subtree: true, characterData: true });
61
+ });
62
+ onBeforeUnmount(() => {
63
+ if (frame != null) cancelAnimationFrame(frame);
64
+ observer?.disconnect();
65
+ });
66
+ const mounted = ref(false);
67
+ onMounted(() => mounted.value = true);
68
+ const open = ref(false);
69
+ const index = ref(0);
70
+ const presenting = ref(false);
71
+ const current = computed(() => slides.value[junClampSlide(index.value, count.value)]);
72
+ const progress = computed(() => junSlideProgress(index.value, count.value));
73
+ function openAt(at, drive) {
74
+ index.value = junClampSlide(at, count.value);
75
+ presenting.value = drive;
76
+ open.value = true;
77
+ }
78
+ function close() {
79
+ open.value = false;
80
+ presenting.value = false;
81
+ stopWatching();
82
+ leave();
83
+ }
84
+ function step(delta) {
85
+ if (watchingClientId.value != null) stopWatching();
86
+ index.value = junStepSlide(index.value, delta, count.value);
87
+ }
88
+ watch(watchedSlide, (slide) => {
89
+ if (slide == null || !open.value) return;
90
+ index.value = junClampSlide(slide, count.value);
91
+ });
92
+ watch([open, index, presenting, () => props.docId], () => {
93
+ if (!open.value) return;
94
+ announce(index.value, presenting.value);
95
+ }, { immediate: true });
96
+ watch(open, (isOpen) => {
97
+ if (!isOpen) leave();
98
+ });
99
+ let timer = null;
100
+ watch([open, () => view.value.autoAdvance, presenting, watchingClientId], () => {
101
+ if (timer) clearInterval(timer);
102
+ timer = null;
103
+ const every = Number(view.value.autoAdvance) || 0;
104
+ if (!open.value || presenting.value || watchingClientId.value != null || every <= 0) return;
105
+ timer = setInterval(() => {
106
+ index.value = index.value + 1 >= count.value ? 0 : index.value + 1;
107
+ }, every * 1e3);
108
+ });
109
+ onBeforeUnmount(() => {
110
+ if (timer) clearInterval(timer);
111
+ });
112
+ function onKey(event) {
113
+ if (!open.value) return;
114
+ if (event.key === "Escape") {
115
+ close();
116
+ return;
117
+ }
118
+ if (event.key === "ArrowRight" || event.key === "PageDown" || event.key === " ") {
119
+ event.preventDefault();
120
+ step(1);
121
+ } else if (event.key === "ArrowLeft" || event.key === "PageUp") {
122
+ event.preventDefault();
123
+ step(-1);
124
+ }
125
+ }
126
+ onMounted(() => window.addEventListener("keydown", onKey));
127
+ onBeforeUnmount(() => window.removeEventListener("keydown", onKey));
128
+ const RATIO_CLASS = {
129
+ "16:9": "aspect-video",
130
+ "4:3": "aspect-4/3",
131
+ "free": "h-full"
132
+ };
133
+ const TRANSITION_NAME = {
134
+ fade: "jun-slide-fade",
135
+ slide: "jun-slide-move",
136
+ none: "jun-slide-none"
137
+ };
138
+ const ratioClass = computed(() => RATIO_CLASS[String(view.value.ratio)] ?? "aspect-video");
139
+ const transitionName = computed(() => TRANSITION_NAME[String(view.value.transition)] ?? "jun-slide-fade");
140
+ const accentStyle = computed(() => {
141
+ const accent = String(view.value.accent ?? "auto");
142
+ return accent === "auto" ? {} : { "--jun-deck-accent": accent };
143
+ });
144
+ const watchingName = computed(() => presenters.value.find((p) => p.clientId === watchingClientId.value)?.name);
145
+ </script>
146
+
147
+ <template>
148
+ <div class="mx-auto w-full max-w-3xl px-4 pt-8 pb-20 sm:px-6">
149
+ <JunPageHero
150
+ :doc-id="docId"
151
+ :title="title"
152
+ :subtitle="subtitle"
153
+ :editable="editing"
154
+ @rename="renameDoc(docId, $event)"
155
+ >
156
+ <template #right>
157
+ <div class="flex items-center gap-1.5">
158
+ <span
159
+ v-if="mounted && count"
160
+ class="text-[11px] text-dimmed tabular-nums"
161
+ >{{ count }} slide{{ count === 1 ? "" : "s" }}</span>
162
+ <JunViewControls
163
+ v-if="editing"
164
+ :options="viewOptions"
165
+ :values="view"
166
+ :is-default="viewIsDefault"
167
+ @set="setView"
168
+ @reset="resetView"
169
+ />
170
+ </div>
171
+ </template>
172
+ </JunPageHero>
173
+
174
+ <!-- The two ways in. `mounted`, because both depend on awareness and on a
175
+ slide count read out of the DOM — neither exists on the server. -->
176
+ <div
177
+ v-if="mounted"
178
+ class="mt-6 flex flex-wrap items-center gap-2"
179
+ data-jun-follow-ui
180
+ >
181
+ <!-- Opening the deck is NOT presenting. Two acts, deliberately: reading a
182
+ talk as slides is something anybody may do at any time, and claiming
183
+ the room's attention is a second, explicit step taken from the stage.
184
+ Tying it to edit mode instead — the first shape of this — conflated
185
+ authoring a talk with giving one, and meant a co-presenter with no
186
+ write access could not speak. -->
187
+ <UButton
188
+ v-if="count"
189
+ icon="i-lucide-play"
190
+ size="sm"
191
+ color="neutral"
192
+ variant="soft"
193
+ label="View as slides"
194
+ data-jun-deck="present"
195
+ @click="openAt(0, false)"
196
+ />
197
+
198
+ <!-- Somebody is presenting THIS deck, right now. The one control on this
199
+ page that a static site could not offer. -->
200
+ <UButton
201
+ v-for="p in presenters"
202
+ :key="p.clientId"
203
+ size="sm"
204
+ color="neutral"
205
+ :variant="watchingClientId === p.clientId ? 'solid' : 'outline'"
206
+ icon="i-lucide-radio"
207
+ data-jun-deck="watch"
208
+ :label="watchingClientId === p.clientId ? `Watching ${p.name}` : `${p.name} is presenting \u2014 watch`"
209
+ @click="openAt(p.slide, false);
210
+ toggleWatch(p.clientId)"
211
+ />
212
+
213
+ <span
214
+ v-if="audience.length"
215
+ class="text-[11px] text-dimmed"
216
+ >{{ audience.length }} in the room</span>
217
+ </div>
218
+
219
+ <hr class="my-8 border-default">
220
+
221
+ <!-- The prose. The deck is BUILT from this, and this is what a crawler, a
222
+ reader and a JS-less visitor get — a written talk, in order. -->
223
+ <div
224
+ ref="prose"
225
+ class="jun-deck-body"
226
+ >
227
+ <JunSectionPresence :doc-id="docId">
228
+ <AEditor
229
+ :doc-id="docId"
230
+ :doc-label="title"
231
+ :doc-meta="docMeta"
232
+ :editable="editing"
233
+ :show-toolbar="editing"
234
+ :show-suggestion-menu="editing"
235
+ :show-drag-handle="editing"
236
+ :show-breadcrumb="false"
237
+ placeholder="Write the talk. A heading starts a slide."
238
+ />
239
+ </JunSectionPresence>
240
+ </div>
241
+
242
+ <!-- ── The presentation ────────────────────────────────────────────────
243
+ This component's OWN markup, built from the prose's HTML. Nothing here
244
+ reaches into the editor's DOM. -->
245
+ <Teleport
246
+ v-if="open"
247
+ to="body"
248
+ >
249
+ <div
250
+ class="jun-deck-stage fixed inset-0 z-50 flex flex-col bg-default"
251
+ :style="accentStyle"
252
+ role="dialog"
253
+ aria-label="Slides"
254
+ data-jun-deck="stage"
255
+ >
256
+ <div class="flex flex-1 items-center justify-center overflow-hidden p-4 sm:p-10">
257
+ <div
258
+ class="relative w-full max-w-5xl"
259
+ :class="ratioClass"
260
+ >
261
+ <Transition :name="transitionName">
262
+ <article
263
+ :key="index"
264
+ class="jun-deck-slide absolute inset-0 flex flex-col justify-center gap-4 overflow-auto"
265
+ :data-jun-slide="index"
266
+ >
267
+ <h2
268
+ v-if="current?.title"
269
+ class="jun-deck-title text-2xl font-semibold tracking-tight text-highlighted sm:text-4xl"
270
+ >
271
+ {{ current.title }}
272
+ </h2>
273
+ <!-- The site's own prose, already rendered by the editor —
274
+ the same trust `JunDocSurface` renders the SSR body cache
275
+ under. It never leaves this component. -->
276
+ <!-- eslint-disable vue/no-v-html -->
277
+ <div
278
+ class="prose dark:prose-invert max-w-none sm:prose-lg"
279
+ v-html="current?.html ?? ''"
280
+ />
281
+ <!-- eslint-enable vue/no-v-html -->
282
+ </article>
283
+ </Transition>
284
+ </div>
285
+ </div>
286
+
287
+ <!-- Chrome. Deliberately quiet: a bar that competes with the slide is a
288
+ bar in front of the talk. -->
289
+ <div class="flex items-center gap-3 border-t border-default px-4 py-2 sm:px-6">
290
+ <UButton
291
+ icon="i-lucide-chevron-left"
292
+ size="xs"
293
+ color="neutral"
294
+ variant="ghost"
295
+ aria-label="Previous slide"
296
+ :disabled="index === 0"
297
+ @click="step(-1)"
298
+ />
299
+ <UButton
300
+ icon="i-lucide-chevron-right"
301
+ size="xs"
302
+ color="neutral"
303
+ variant="ghost"
304
+ aria-label="Next slide"
305
+ :disabled="index >= count - 1"
306
+ @click="step(1)"
307
+ />
308
+
309
+ <span
310
+ v-if="view.numbers"
311
+ class="text-[11px] text-muted tabular-nums"
312
+ data-jun-deck="counter"
313
+ >{{ index + 1 }} / {{ count }}</span>
314
+
315
+ <div
316
+ v-if="view.progress"
317
+ class="h-0.5 flex-1 overflow-hidden rounded-full bg-black/10 dark:bg-white/15"
318
+ >
319
+ <div
320
+ class="jun-deck-progress h-full rounded-full transition-[width] duration-300"
321
+ :style="{ width: `${Math.round(progress * 100)}%` }"
322
+ />
323
+ </div>
324
+ <span
325
+ v-else
326
+ class="flex-1"
327
+ />
328
+
329
+ <!-- Who is here, from the stage. A speaker wants to know the room has
330
+ kept up; a viewer wants to know they are not alone. -->
331
+ <span
332
+ v-if="presenting && audience.length"
333
+ class="text-[11px] text-dimmed"
334
+ data-jun-deck="room"
335
+ >{{ audience.length }} watching</span>
336
+ <span
337
+ v-else-if="watchingName"
338
+ class="text-[11px] text-dimmed"
339
+ data-jun-deck="watching"
340
+ >following {{ watchingName }}</span>
341
+
342
+ <!-- The act itself. Available to anyone in the deck, because the
343
+ other side of it is opt-in: nobody sees your slides unless they
344
+ press Watch. -->
345
+ <UButton
346
+ size="xs"
347
+ color="neutral"
348
+ :variant="presenting ? 'solid' : 'soft'"
349
+ :icon="presenting ? 'i-lucide-radio' : 'i-lucide-users'"
350
+ :label="presenting ? 'Stop presenting' : 'Present to the room'"
351
+ data-jun-deck="present-toggle"
352
+ @click="presenting = !presenting"
353
+ />
354
+ <UButton
355
+ icon="i-lucide-x"
356
+ size="xs"
357
+ color="neutral"
358
+ variant="ghost"
359
+ aria-label="Close the slides"
360
+ @click="close"
361
+ />
362
+ </div>
363
+ </div>
364
+ </Teleport>
365
+ </div>
366
+ </template>
367
+
368
+ <style scoped>
369
+ .jun-deck-body :deep(.document-header){display:none}.jun-deck-body :deep(.ProseMirror),.jun-deck-body :deep(.aeditor-canvas){padding:0}.jun-deck-stage{--jun-deck-accent:var(--ui-primary)}.jun-deck-progress{background:var(--jun-deck-accent)}.jun-deck-title{border-left:3px solid var(--jun-deck-accent);padding-left:.75rem}.jun-slide-fade-enter-active,.jun-slide-fade-leave-active{transition:opacity .22s ease}.jun-slide-fade-enter-from,.jun-slide-fade-leave-to{opacity:0}.jun-slide-move-enter-active,.jun-slide-move-leave-active{transition:opacity .26s ease,transform .26s cubic-bezier(.22,1,.36,1)}.jun-slide-move-enter-from{opacity:0;transform:translateX(3%)}.jun-slide-move-leave-to{opacity:0;transform:translateX(-3%)}@media (prefers-reduced-motion:reduce){.jun-slide-fade-enter-active,.jun-slide-fade-leave-active,.jun-slide-move-enter-active,.jun-slide-move-leave-active{transition:none}}
370
+ </style>
@@ -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;
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { computed, onUnmounted, ref, watch } from "vue";
2
+ import { computed, onBeforeUnmount, onMounted, onUnmounted, ref, watch } from "vue";
3
3
  import {
4
4
  junDateIso,
5
5
  junDateLong,
@@ -11,8 +11,11 @@ import {
11
11
  useJunImagePopup,
12
12
  useJunRename,
13
13
  useJunStudio,
14
- useJunUpload
14
+ useJunUpload,
15
+ useJunViewOptions
15
16
  } from "#imports";
17
+ import { junViewSpecFor } from "../../utils/junViewSpecs";
18
+ import { useJunSectionScan } from "../../composables/useJunSections";
16
19
  const props = defineProps({
17
20
  docId: { type: String, required: true },
18
21
  docLabel: { type: String, required: false },
@@ -114,6 +117,54 @@ const scheduleLabel = computed(() => {
114
117
  if (h < 48) return `in ${h}h`;
115
118
  return `on ${new Date(publishAtMs.value).toLocaleDateString()}`;
116
119
  });
120
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
121
+ typeKey: "entry",
122
+ options: junViewSpecFor("entry")
123
+ }, () => props.docMeta);
124
+ const MEASURE_CLASS = {
125
+ narrow: "max-w-[34rem]",
126
+ normal: "",
127
+ wide: "max-w-none"
128
+ };
129
+ const measureClass = computed(() => MEASURE_CLASS[String(view.value.measure)] ?? "");
130
+ const bodyBox = ref(null);
131
+ const { headings } = useJunSectionScan(bodyBox);
132
+ const tocPlacement = computed(() => String(view.value.toc));
133
+ const showToc = computed(() => tocPlacement.value !== "off" && headings.value.length > 1);
134
+ function goToHeading(index) {
135
+ const box = bodyBox.value;
136
+ const heading = headings.value[index];
137
+ if (!box || !heading) return;
138
+ const top = box.getBoundingClientRect().top + window.scrollY + heading.offset;
139
+ window.scrollTo({ top: top - 80, behavior: "smooth" });
140
+ }
141
+ const readProgress = ref(0);
142
+ let progressFrame = null;
143
+ function measureProgress() {
144
+ if (progressFrame != null) return;
145
+ progressFrame = requestAnimationFrame(() => {
146
+ progressFrame = null;
147
+ const box = bodyBox.value;
148
+ if (!box) return;
149
+ const rect = box.getBoundingClientRect();
150
+ const height = rect.height - window.innerHeight * 0.6;
151
+ if (height <= 0) {
152
+ readProgress.value = rect.bottom < window.innerHeight ? 1 : 0;
153
+ return;
154
+ }
155
+ readProgress.value = Math.min(1, Math.max(0, -rect.top / height));
156
+ });
157
+ }
158
+ onMounted(() => {
159
+ measureProgress();
160
+ window.addEventListener("scroll", measureProgress, { passive: true });
161
+ window.addEventListener("resize", measureProgress, { passive: true });
162
+ });
163
+ onBeforeUnmount(() => {
164
+ if (progressFrame != null) cancelAnimationFrame(progressFrame);
165
+ window.removeEventListener("scroll", measureProgress);
166
+ window.removeEventListener("resize", measureProgress);
167
+ });
117
168
  const bodyEditor = ref(null);
118
169
  const readingMin = ref(0);
119
170
  function recalcReadingTime() {
@@ -268,14 +319,14 @@ function removeCover() {
268
319
  </template>
269
320
  </div>
270
321
  <p
271
- v-else-if="meta.date || readingMin"
322
+ v-else-if="meta.date || readingMin && view.readingTime"
272
323
  class="mb-3 text-[10px] font-medium tracking-[0.22em] text-dimmed uppercase"
273
324
  >
274
325
  <time
275
326
  v-if="meta.date"
276
327
  :datetime="junDateIso(meta.date)"
277
328
  >{{ junDateLong(meta.date) }}</time>
278
- <template v-if="readingMin">
329
+ <template v-if="readingMin && view.readingTime">
279
330
  <span v-if="meta.date"> · </span>{{ readingMin }} min read
280
331
  </template>
281
332
  </p>
@@ -307,7 +358,7 @@ function removeCover() {
307
358
  >{{ meta.excerpt ?? EXCERPT_PLACEHOLDER }}</p>
308
359
 
309
360
  <div
310
- v-if="meta.tags?.length"
361
+ v-if="meta.tags?.length && view.tags"
311
362
  class="mt-4 flex flex-wrap items-center gap-1.5"
312
363
  >
313
364
  <span
@@ -317,10 +368,24 @@ function removeCover() {
317
368
  >{{ t }}</span>
318
369
  </div>
319
370
 
320
- <!-- Appreciate — one per visitor, written by the RPC runner. -->
371
+ <!-- Appreciate — one per visitor, written by the RPC runner — and who
372
+ else is reading this, which is the same kind of fact and belongs on
373
+ the same line. A long read is exactly where two people being on the
374
+ same page is worth saying, and until this existed no page that was
375
+ not a list said it at all. -->
321
376
  <ClientOnly>
322
- <div class="mt-4 -ml-2.5">
377
+ <div class="mt-4 -ml-2.5 flex flex-wrap items-center gap-x-3 gap-y-1">
323
378
  <JunAppreciate :doc-id="docId" />
379
+ <JunReaders :doc-id="docId" />
380
+ <span class="flex-1" />
381
+ <JunViewControls
382
+ v-if="editing"
383
+ :options="viewOptions"
384
+ :values="view"
385
+ :is-default="viewIsDefault"
386
+ @set="setView"
387
+ @reset="resetView"
388
+ />
324
389
  </div>
325
390
  </ClientOnly>
326
391
  </header>
@@ -401,24 +466,87 @@ function removeCover() {
401
466
 
402
467
  <hr class="my-8 border-default">
403
468
 
469
+ <!-- ── Contents ──────────────────────────────────────────────────────────
470
+ Built from the headings the presence scan already measured, and it
471
+ SCROLLS by measurement rather than linking to an anchor: giving a
472
+ heading an `id` would mean writing into ProseMirror's DOM, which is the
473
+ one thing this module may never do. -->
474
+ <ClientOnly>
475
+ <nav
476
+ v-if="showToc"
477
+ class="jun-entry-toc mt-8"
478
+ :class="tocPlacement === 'aside' ? 'lg:absolute lg:top-8 lg:-ml-56 lg:w-48 lg:sticky lg:float-left' : 'rounded-xl bg-black/[0.02] p-4 dark:bg-white/[0.03]'"
479
+ aria-label="Contents"
480
+ >
481
+ <p class="mb-1.5 text-[10px] font-medium tracking-[0.22em] text-dimmed uppercase">
482
+ Contents
483
+ </p>
484
+ <ol class="flex flex-col gap-0.5">
485
+ <li
486
+ v-for="h in headings"
487
+ :key="h.index"
488
+ >
489
+ <button
490
+ type="button"
491
+ class="w-full truncate text-left text-xs text-muted transition-colors hover:text-highlighted"
492
+ :class="h.level >= 3 ? 'pl-3 text-[11px]' : ''"
493
+ @click="goToHeading(h.index)"
494
+ >
495
+ {{ h.text }}
496
+ </button>
497
+ </li>
498
+ </ol>
499
+ </nav>
500
+ </ClientOnly>
501
+
502
+ <!-- Reading progress, measured against the PROSE rather than the page: the
503
+ hero and the comments are not the article, and a bar that counts them
504
+ reads as finished before the last paragraph. -->
505
+ <ClientOnly>
506
+ <div
507
+ v-if="view.progress"
508
+ class="jun-entry-progress fixed inset-x-0 top-0 z-30 h-0.5 bg-transparent"
509
+ aria-hidden="true"
510
+ >
511
+ <div
512
+ class="h-full bg-black/40 transition-[width] duration-150 dark:bg-white/50"
513
+ :style="{ width: `${Math.round(readProgress * 100)}%` }"
514
+ />
515
+ </div>
516
+ </ClientOnly>
517
+
404
518
  <!-- The entry's own prose. Read-only for visitors; the owner gets the full
405
- editor — toolbar, slash menu, drag handles — while editing. -->
406
- <div class="jun-entry-body">
407
- <AEditor
408
- ref="bodyEditor"
409
- :doc-id="docId"
410
- :doc-label="title"
411
- :doc-meta="meta"
412
- :editable="editing"
413
- :show-toolbar="editing"
414
- :show-suggestion-menu="editing"
415
- :show-drag-handle="editing"
416
- :show-breadcrumb="false"
417
- placeholder="Nothing written yet."
418
- @ready="recalcReadingTime"
419
- @update="recalcReadingTime"
420
- />
519
+ editor — toolbar, slash menu, drag handles — while editing.
520
+
521
+ Wrapped in `<JunSectionPresence>`: on a page this long, "somebody is
522
+ here" is a coarse answer, and the wrapper turns it into which heading
523
+ they are at. It only reads the rendered prose — see its header. -->
524
+ <div
525
+ ref="bodyBox"
526
+ class="jun-entry-body"
527
+ :class="measureClass"
528
+ >
529
+ <JunSectionPresence :doc-id="docId">
530
+ <AEditor
531
+ ref="bodyEditor"
532
+ :doc-id="docId"
533
+ :doc-label="title"
534
+ :doc-meta="meta"
535
+ :editable="editing"
536
+ :show-toolbar="editing"
537
+ :show-suggestion-menu="editing"
538
+ :show-drag-handle="editing"
539
+ :show-breadcrumb="false"
540
+ placeholder="Nothing written yet."
541
+ @ready="recalcReadingTime"
542
+ @update="recalcReadingTime"
543
+ />
544
+ </JunSectionPresence>
421
545
  </div>
546
+
547
+ <!-- What links here. Renders nothing on a site with no garden, and nothing on
548
+ a page nobody has cited — see the component's header. -->
549
+ <JunNoteLinks :doc-id="docId" />
422
550
  </article>
423
551
  </template>
424
552