@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.
Files changed (178) hide show
  1. package/dist/module.d.mts +17 -2
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +270 -22
  4. package/dist/runtime/assets/css/jun.css +1 -1
  5. package/dist/runtime/components/JunBlobBackdrop.client.vue +1 -1
  6. package/dist/runtime/components/JunCampfirePresence.client.vue +75 -10
  7. package/dist/runtime/components/JunCollectionIntro.d.vue.ts +11 -0
  8. package/dist/runtime/components/JunCollectionIntro.vue +45 -0
  9. package/dist/runtime/components/JunCollectionIntro.vue.d.ts +11 -0
  10. package/dist/runtime/components/JunConfigRow.d.vue.ts +43 -0
  11. package/dist/runtime/components/JunConfigRow.vue +34 -0
  12. package/dist/runtime/components/JunConfigRow.vue.d.ts +43 -0
  13. package/dist/runtime/components/JunFooter.vue +1 -1
  14. package/dist/runtime/components/JunHead.vue +37 -5
  15. package/dist/runtime/components/JunHorizontalTimeline.d.vue.ts +30 -0
  16. package/dist/runtime/components/JunHorizontalTimeline.vue.d.ts +30 -0
  17. package/dist/runtime/components/JunLinksRow.d.vue.ts +16 -1
  18. package/dist/runtime/components/JunLinksRow.vue +17 -7
  19. package/dist/runtime/components/JunLinksRow.vue.d.ts +16 -1
  20. package/dist/runtime/components/JunLogo.vue +10 -45
  21. package/dist/runtime/components/JunMedia.client.d.vue.ts +1 -1
  22. package/dist/runtime/components/JunMedia.client.vue.d.ts +1 -1
  23. package/dist/runtime/components/JunNavigation.vue +21 -4
  24. package/dist/runtime/components/JunNoteLinks.d.vue.ts +6 -0
  25. package/dist/runtime/components/JunNoteLinks.vue +57 -0
  26. package/dist/runtime/components/JunNoteLinks.vue.d.ts +6 -0
  27. package/dist/runtime/components/JunPageHero.d.vue.ts +8 -2
  28. package/dist/runtime/components/JunPageHero.vue +15 -3
  29. package/dist/runtime/components/JunPageHero.vue.d.ts +8 -2
  30. package/dist/runtime/components/JunPatternBackdrop.client.vue +1 -1
  31. package/dist/runtime/components/JunReaders.d.vue.ts +11 -0
  32. package/dist/runtime/components/JunReaders.vue +99 -0
  33. package/dist/runtime/components/JunReaders.vue.d.ts +11 -0
  34. package/dist/runtime/components/JunSearch.client.vue +2 -2
  35. package/dist/runtime/components/JunSectionPresence.client.d.vue.ts +17 -0
  36. package/dist/runtime/components/JunSectionPresence.client.vue +99 -0
  37. package/dist/runtime/components/JunSectionPresence.client.vue.d.ts +17 -0
  38. package/dist/runtime/components/JunShaderBackdrop.client.vue +1 -1
  39. package/dist/runtime/components/JunThreadComposer.d.vue.ts +37 -0
  40. package/dist/runtime/components/JunThreadComposer.vue +54 -0
  41. package/dist/runtime/components/JunThreadComposer.vue.d.ts +37 -0
  42. package/dist/runtime/components/JunTravellersChip.vue +35 -5
  43. package/dist/runtime/components/JunVideoEmbed.client.d.vue.ts +1 -1
  44. package/dist/runtime/components/JunVideoEmbed.client.vue.d.ts +1 -1
  45. package/dist/runtime/components/JunViewControl.d.vue.ts +29 -0
  46. package/dist/runtime/components/JunViewControl.vue +340 -0
  47. package/dist/runtime/components/JunViewControl.vue.d.ts +29 -0
  48. package/dist/runtime/components/JunViewControls.d.vue.ts +27 -0
  49. package/dist/runtime/components/JunViewControls.vue +94 -0
  50. package/dist/runtime/components/JunViewControls.vue.d.ts +27 -0
  51. package/dist/runtime/components/renderers/JunAppsRenderer.vue +45 -4
  52. package/dist/runtime/components/renderers/JunCinemaRenderer.vue +42 -4
  53. package/dist/runtime/components/renderers/JunConfigRenderer.vue +362 -239
  54. package/dist/runtime/components/renderers/JunCourseRenderer.d.vue.ts +10 -0
  55. package/dist/runtime/components/renderers/JunCourseRenderer.vue +229 -0
  56. package/dist/runtime/components/renderers/JunCourseRenderer.vue.d.ts +10 -0
  57. package/dist/runtime/components/renderers/JunCvRenderer.vue +44 -6
  58. package/dist/runtime/components/renderers/JunDeckRenderer.d.vue.ts +9 -0
  59. package/dist/runtime/components/renderers/JunDeckRenderer.vue +370 -0
  60. package/dist/runtime/components/renderers/JunDeckRenderer.vue.d.ts +9 -0
  61. package/dist/runtime/components/renderers/JunEntryRenderer.vue +157 -31
  62. package/dist/runtime/components/renderers/JunFestivalRenderer.vue +42 -5
  63. package/dist/runtime/components/renderers/JunGardenRenderer.d.vue.ts +10 -0
  64. package/dist/runtime/components/renderers/JunGardenRenderer.vue +280 -0
  65. package/dist/runtime/components/renderers/JunGardenRenderer.vue.d.ts +10 -0
  66. package/dist/runtime/components/renderers/JunGuestbookRenderer.vue +96 -14
  67. package/dist/runtime/components/renderers/JunHomeRenderer.vue +31 -132
  68. package/dist/runtime/components/renderers/JunItemRenderer.d.vue.ts +10 -0
  69. package/dist/runtime/components/renderers/JunItemRenderer.vue +398 -0
  70. package/dist/runtime/components/renderers/JunItemRenderer.vue.d.ts +10 -0
  71. package/dist/runtime/components/renderers/JunJournalRenderer.vue +141 -11
  72. package/dist/runtime/components/renderers/JunLibraryRenderer.vue +295 -12
  73. package/dist/runtime/components/renderers/JunLinksRenderer.vue +33 -1
  74. package/dist/runtime/components/renderers/JunLiveRenderer.vue +38 -2
  75. package/dist/runtime/components/renderers/JunMosaicRenderer.vue +3 -2
  76. package/dist/runtime/components/renderers/JunMovieRenderer.vue +32 -5
  77. package/dist/runtime/components/renderers/JunNowRenderer.vue +40 -7
  78. package/dist/runtime/components/renderers/JunPollRenderer.d.vue.ts +9 -0
  79. package/dist/runtime/components/renderers/JunPollRenderer.vue +231 -0
  80. package/dist/runtime/components/renderers/JunPollRenderer.vue.d.ts +9 -0
  81. package/dist/runtime/components/renderers/JunProjectRenderer.vue +74 -18
  82. package/dist/runtime/components/renderers/JunServicesRenderer.vue +40 -2
  83. package/dist/runtime/components/renderers/JunStatsRenderer.vue +37 -50
  84. package/dist/runtime/components/renderers/JunThreadRenderer.d.vue.ts +9 -0
  85. package/dist/runtime/components/renderers/JunThreadRenderer.vue +304 -0
  86. package/dist/runtime/components/renderers/JunThreadRenderer.vue.d.ts +9 -0
  87. package/dist/runtime/components/renderers/JunTrackRenderer.vue +32 -4
  88. package/dist/runtime/components/renderers/JunUsesRenderer.vue +57 -13
  89. package/dist/runtime/components/renderers/JunWallRenderer.vue +60 -5
  90. package/dist/runtime/composables/useJunDeck.d.ts +66 -0
  91. package/dist/runtime/composables/useJunDeck.js +61 -0
  92. package/dist/runtime/composables/useJunDocPage.d.ts +14 -11
  93. package/dist/runtime/composables/useJunDocPage.js +67 -3
  94. package/dist/runtime/composables/useJunFollow.d.ts +65 -9
  95. package/dist/runtime/composables/useJunFollow.js +237 -20
  96. package/dist/runtime/composables/useJunGarden.d.ts +67 -0
  97. package/dist/runtime/composables/useJunGarden.js +92 -0
  98. package/dist/runtime/composables/useJunOptions.d.ts +1 -0
  99. package/dist/runtime/composables/useJunPresence.d.ts +26 -0
  100. package/dist/runtime/composables/useJunPresence.js +9 -2
  101. package/dist/runtime/composables/useJunSections.d.ts +73 -0
  102. package/dist/runtime/composables/useJunSections.js +117 -0
  103. package/dist/runtime/composables/useJunSettings.d.ts +1 -1
  104. package/dist/runtime/composables/useJunSettings.js +5 -1
  105. package/dist/runtime/composables/useJunSiteConfig.d.ts +37 -0
  106. package/dist/runtime/composables/useJunTheme.js +49 -50
  107. package/dist/runtime/composables/useJunViewOptions.d.ts +85 -0
  108. package/dist/runtime/composables/useJunViewOptions.js +63 -0
  109. package/dist/runtime/pages/doc.vue +14 -8
  110. package/dist/runtime/plugins/jun-sw.client.d.ts +2 -0
  111. package/dist/runtime/plugins/jun-sw.client.js +36 -0
  112. package/dist/runtime/server/api/health.get.d.ts +19 -0
  113. package/dist/runtime/server/api/health.get.js +40 -0
  114. package/dist/runtime/server/api/links.get.d.ts +19 -0
  115. package/dist/runtime/server/api/links.get.js +37 -0
  116. package/dist/runtime/server/api/resolve/[...slug].get.d.ts +9 -0
  117. package/dist/runtime/server/api/resolve/[...slug].get.js +5 -0
  118. package/dist/runtime/server/api/stats.get.js +2 -1
  119. package/dist/runtime/server/janitor/junJanitorChores.js +8 -0
  120. package/dist/runtime/server/plugins/jun-bootstrap.js +103 -15
  121. package/dist/runtime/server/plugins/jun-doc-cache.js +42 -4
  122. package/dist/runtime/server/plugins/jun-janitor.js +9 -1
  123. package/dist/runtime/server/plugins/jun-rpc.js +293 -0
  124. package/dist/runtime/server/plugins/jun-watchdog.d.ts +2 -0
  125. package/dist/runtime/server/plugins/jun-watchdog.js +54 -0
  126. package/dist/runtime/server/routes/jun-icon.png.get.d.ts +2 -0
  127. package/dist/runtime/server/routes/jun-icon.png.get.js +25 -0
  128. package/dist/runtime/server/routes/jun-icon.svg.get.d.ts +2 -0
  129. package/dist/runtime/server/routes/jun-icon.svg.get.js +9 -0
  130. package/dist/runtime/server/routes/jun-splash.png.get.d.ts +2 -0
  131. package/dist/runtime/server/routes/jun-splash.png.get.js +37 -0
  132. package/dist/runtime/server/routes/jun-sw.js.get.d.ts +2 -0
  133. package/dist/runtime/server/routes/jun-sw.js.get.js +126 -0
  134. package/dist/runtime/server/routes/manifest.webmanifest.get.d.ts +24 -0
  135. package/dist/runtime/server/routes/manifest.webmanifest.get.js +51 -0
  136. package/dist/runtime/server/routes/sitemap.xml.get.js +2 -0
  137. package/dist/runtime/server/utils/junBoot.d.ts +1 -0
  138. package/dist/runtime/server/utils/junBoot.js +4 -0
  139. package/dist/runtime/server/utils/junBrand.d.ts +4 -0
  140. package/dist/runtime/server/utils/junBrand.js +9 -0
  141. package/dist/runtime/server/utils/junCache.d.ts +17 -0
  142. package/dist/runtime/server/utils/junCache.js +5 -0
  143. package/dist/runtime/server/utils/junIcon.d.ts +44 -0
  144. package/dist/runtime/server/utils/junIcon.js +374 -0
  145. package/dist/runtime/server/utils/junSeedGate.d.ts +68 -0
  146. package/dist/runtime/server/utils/junSeedGate.js +41 -0
  147. package/dist/runtime/types.d.ts +82 -3
  148. package/dist/runtime/utils/junCourse.d.ts +106 -0
  149. package/dist/runtime/utils/junCourse.js +65 -0
  150. package/dist/runtime/utils/junGarden.d.ts +193 -0
  151. package/dist/runtime/utils/junGarden.js +233 -0
  152. package/dist/runtime/utils/junIdentity.d.ts +121 -0
  153. package/dist/runtime/utils/junIdentity.js +115 -0
  154. package/dist/runtime/utils/junMark.d.ts +254 -0
  155. package/dist/runtime/utils/junMark.js +169 -0
  156. package/dist/runtime/utils/junMetaSchemas.js +8 -1
  157. package/dist/runtime/utils/junModeration.d.ts +67 -0
  158. package/dist/runtime/utils/junModeration.js +20 -0
  159. package/dist/runtime/utils/junMotion.d.ts +26 -0
  160. package/dist/runtime/utils/junMotion.js +31 -0
  161. package/dist/runtime/utils/junPeople.d.ts +43 -0
  162. package/dist/runtime/utils/junPeople.js +9 -0
  163. package/dist/runtime/utils/junPoll.d.ts +79 -0
  164. package/dist/runtime/utils/junPoll.js +82 -0
  165. package/dist/runtime/utils/junReadiness.d.ts +131 -0
  166. package/dist/runtime/utils/junReadiness.js +69 -0
  167. package/dist/runtime/utils/junSections.d.ts +115 -0
  168. package/dist/runtime/utils/junSections.js +45 -0
  169. package/dist/runtime/utils/junSlides.d.ts +66 -0
  170. package/dist/runtime/utils/junSlides.js +47 -0
  171. package/dist/runtime/utils/junThread.d.ts +81 -0
  172. package/dist/runtime/utils/junThread.js +75 -0
  173. package/dist/runtime/utils/junViewSpecs.d.ts +671 -0
  174. package/dist/runtime/utils/junViewSpecs.js +534 -0
  175. package/dist/runtime/utils/junViewValues.d.ts +125 -0
  176. package/dist/runtime/utils/junViewValues.js +104 -0
  177. package/dist/types.d.mts +1 -1
  178. package/package.json +5 -1
@@ -9,8 +9,10 @@ import {
9
9
  useJunImagePopup,
10
10
  useJunRename,
11
11
  useJunStudio,
12
- useJunUpload
12
+ useJunUpload,
13
+ useJunViewOptions
13
14
  } from "#imports";
15
+ import { junViewSpecFor } from "../../utils/junViewSpecs";
14
16
  const props = defineProps({
15
17
  docId: { type: String, required: true },
16
18
  docLabel: { type: String, required: false },
@@ -30,6 +32,27 @@ const meta = computed(() => entry.value?.meta ?? props.docMeta ?? {});
30
32
  const metaRecord = computed(() => meta.value);
31
33
  const title = computed(() => entry.value?.label ?? props.docLabel ?? "Project");
32
34
  const statusOptions = [...JUN_APP_STATUSES];
35
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
36
+ typeKey: "project",
37
+ options: junViewSpecFor("project")
38
+ }, () => props.docMeta);
39
+ const MEASURE_CLASS = {
40
+ narrow: "max-w-[60ch]",
41
+ normal: "",
42
+ wide: "max-w-none"
43
+ };
44
+ const SHOTS_CLASS = {
45
+ 1: "grid-cols-1",
46
+ 2: "grid-cols-2",
47
+ 3: "grid-cols-2 sm:grid-cols-3",
48
+ 4: "grid-cols-2 sm:grid-cols-4"
49
+ };
50
+ const measureClass = computed(() => MEASURE_CLASS[String(view.value.measure)] ?? "");
51
+ const shotsClass = computed(() => SHOTS_CLASS[Number(view.value.shots) || 3] ?? SHOTS_CLASS[3]);
52
+ const tags = computed(() => {
53
+ const raw = meta.value.tags;
54
+ return Array.isArray(raw) ? raw.filter((t) => typeof t === "string" && !!t.trim()) : [];
55
+ });
33
56
  function patchMeta(p) {
34
57
  tree.updateMeta(props.docId, p);
35
58
  }
@@ -270,18 +293,18 @@ function openShot(index, e) {
270
293
  />
271
294
  </div>
272
295
  <div
273
- v-else-if="meta.status || location"
296
+ v-else-if="meta.status && view.status || location && view.place"
274
297
  class="mt-2 flex flex-wrap items-center gap-2"
275
298
  >
276
299
  <UBadge
277
- v-if="meta.status"
300
+ v-if="meta.status && view.status"
278
301
  :label="String(meta.status)"
279
302
  color="neutral"
280
303
  variant="subtle"
281
304
  size="sm"
282
305
  />
283
306
  <UBadge
284
- v-if="location"
307
+ v-if="location && view.place"
285
308
  color="neutral"
286
309
  variant="subtle"
287
310
  size="sm"
@@ -302,6 +325,22 @@ function openShot(index, e) {
302
325
  {{ meta.description }}
303
326
  </p>
304
327
 
328
+ <!-- The stack. `meta.tags` has always been on these documents and no
329
+ renderer showed it — the measured gap this round set out to close. -->
330
+ <ul
331
+ v-if="view.tags && tags.length"
332
+ class="mt-3 flex flex-wrap gap-1.5"
333
+ data-jun-project="tags"
334
+ >
335
+ <li
336
+ v-for="tag in tags"
337
+ :key="tag"
338
+ class="rounded-full bg-black/5 px-2 py-0.5 text-[11px] text-muted dark:bg-white/10"
339
+ >
340
+ {{ tag }}
341
+ </li>
342
+ </ul>
343
+
305
344
  <div
306
345
  v-if="visitUrl"
307
346
  class="mt-4"
@@ -320,8 +359,19 @@ function openShot(index, e) {
320
359
  </div>
321
360
 
322
361
  <ClientOnly>
323
- <div class="mt-4 -ml-2.5">
362
+ <div class="mt-4 -ml-2.5 flex flex-wrap items-center gap-x-3 gap-y-1">
324
363
  <JunAppreciate :doc-id="docId" />
364
+ <JunReaders :doc-id="docId" />
365
+ <!-- This page has no `<JunPageHero>` (its header is the icon lockup),
366
+ so the view panel lives beside the presence row. -->
367
+ <JunViewControls
368
+ v-if="editing"
369
+ :options="viewOptions"
370
+ :values="view"
371
+ :is-default="viewIsDefault"
372
+ @set="setView"
373
+ @reset="resetView"
374
+ />
325
375
  </div>
326
376
  </ClientOnly>
327
377
  </div>
@@ -337,7 +387,8 @@ function openShot(index, e) {
337
387
  >
338
388
  <div
339
389
  v-if="gallery.length"
340
- class="grid grid-cols-2 gap-2 sm:grid-cols-3"
390
+ class="grid gap-2"
391
+ :class="shotsClass"
341
392
  >
342
393
  <div
343
394
  v-for="(shot, i) in gallery"
@@ -392,18 +443,23 @@ function openShot(index, e) {
392
443
 
393
444
  <hr class="my-8 border-default">
394
445
 
395
- <div class="jun-project-body">
396
- <AEditor
397
- :doc-id="docId"
398
- :doc-label="title"
399
- :doc-meta="meta"
400
- :editable="editing"
401
- :show-toolbar="editing"
402
- :show-suggestion-menu="editing"
403
- :show-drag-handle="editing"
404
- :show-breadcrumb="false"
405
- placeholder="No write-up yet."
406
- />
446
+ <div
447
+ class="jun-project-body"
448
+ :class="measureClass"
449
+ >
450
+ <JunSectionPresence :doc-id="docId">
451
+ <AEditor
452
+ :doc-id="docId"
453
+ :doc-label="title"
454
+ :doc-meta="meta"
455
+ :editable="editing"
456
+ :show-toolbar="editing"
457
+ :show-suggestion-menu="editing"
458
+ :show-drag-handle="editing"
459
+ :show-breadcrumb="false"
460
+ placeholder="No write-up yet."
461
+ />
462
+ </JunSectionPresence>
407
463
  </div>
408
464
  </div>
409
465
  </template>
@@ -12,8 +12,10 @@ import {
12
12
  useJunGroupedDnD,
13
13
  useJunRename,
14
14
  useJunStudio,
15
- useJunViewingAccent
15
+ useJunViewingAccent,
16
+ useJunViewOptions
16
17
  } from "#imports";
18
+ import { junViewSpecFor } from "../../utils/junViewSpecs";
17
19
  const props = defineProps({
18
20
  docId: { type: String, required: true },
19
21
  docLabel: { type: String, required: false },
@@ -28,6 +30,19 @@ const { getDocUrl } = useDocSlugs();
28
30
  const { editing } = useJunStudio();
29
31
  const { renameDoc } = useJunRename();
30
32
  const { accentInsetStyle, accentTitle } = useJunViewingAccent();
33
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
34
+ typeKey: "services",
35
+ options: junViewSpecFor("services")
36
+ }, () => props.docMeta);
37
+ const GRID_CLASS = {
38
+ 1: "grid-cols-1",
39
+ 2: "grid-cols-1 sm:grid-cols-2",
40
+ 3: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
41
+ 4: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",
42
+ 5: "grid-cols-2 sm:grid-cols-3 md:grid-cols-5",
43
+ 6: "grid-cols-2 sm:grid-cols-4 md:grid-cols-6"
44
+ };
45
+ const gridClass = computed(() => GRID_CLASS[Number(view.value.columns)] ?? GRID_CLASS[3]);
31
46
  const pageTitle = computed(() => getEntry(props.docId)?.label ?? props.docLabel ?? "Signals");
32
47
  const subtitle = computed(() => {
33
48
  const meta = getEntry(props.docId)?.meta;
@@ -112,11 +127,33 @@ const providerOptions = [...JUN_SERVICE_PROVIDERS];
112
127
  <template>
113
128
  <div class="relative mx-auto w-full max-w-6xl px-4 pt-12 pb-16 sm:px-8">
114
129
  <JunPageHero
130
+ :doc-id="docId"
115
131
  :title="pageTitle"
116
132
  :subtitle="subtitle"
117
133
  :editable="editing"
118
134
  @rename="renamePage"
119
135
  @rename-subtitle="renameSubtitle"
136
+ >
137
+ <template #right>
138
+ <JunViewControls
139
+ v-if="editing"
140
+ :options="viewOptions"
141
+ :values="view"
142
+ :is-default="viewIsDefault"
143
+ @set="setView"
144
+ @reset="resetView"
145
+ />
146
+ </template>
147
+ </JunPageHero>
148
+
149
+ <!-- The page's own prose, above its children. Collapses to nothing
150
+ when the document has no body, which is every site that has never
151
+ written one. -->
152
+ <JunCollectionIntro
153
+ :doc-id="docId"
154
+ :doc-label="pageTitle"
155
+ :doc-meta="docMeta"
156
+ placeholder="What these figures are, and where they come from…"
120
157
  />
121
158
 
122
159
  <div
@@ -182,7 +219,8 @@ const providerOptions = [...JUN_SERVICE_PROVIDERS];
182
219
  <TransitionGroup
183
220
  tag="ul"
184
221
  name="jun-services"
185
- class="grid grid-cols-1 gap-3 px-1 sm:grid-cols-2 lg:grid-cols-3"
222
+ class="grid gap-3 px-1"
223
+ :class="gridClass"
186
224
  >
187
225
  <li
188
226
  v-for="(entry, i) in section.items"
@@ -10,9 +10,11 @@ import {
10
10
  useJunPageType,
11
11
  useJunRename,
12
12
  useJunStudio,
13
- useJunTravellers
13
+ useJunTravellers,
14
+ useJunViewOptions
14
15
  } from "#imports";
15
16
  import { useFetch } from "#app";
17
+ import { junIsVisibleMessage } from "../../utils/junModeration";
16
18
  const props = defineProps({
17
19
  docId: { type: String, required: true },
18
20
  docLabel: { type: String, required: false },
@@ -26,7 +28,7 @@ const opts = useJunOptions();
26
28
  const { entries, getEntry } = useDocTree();
27
29
  const { editing } = useJunStudio();
28
30
  const { renameDoc } = useJunRename();
29
- const { travellers } = useJunTravellers();
31
+ const { people } = useJunTravellers();
30
32
  const { labelForType } = useJunPageType();
31
33
  const types = computed(() => opts.typeIds);
32
34
  const pageTitle = computed(() => getEntry(props.docId)?.label ?? props.docLabel ?? "Pulse");
@@ -80,7 +82,7 @@ const live = computed(() => {
80
82
  if (e.type) byType[e.type] = (byType[e.type] ?? 0) + 1;
81
83
  const parent = e.parentId ? byId.value.get(e.parentId) : void 0;
82
84
  if (t.wall && parent?.type === t.wall && e.meta?.coverUploadId) photos++;
83
- if (t.guestbook && parent?.type === t.guestbook && typeof e.meta?.message === "string") {
85
+ if (t.guestbook && parent?.type === t.guestbook && junIsVisibleMessage(e.meta)) {
84
86
  signatures++;
85
87
  }
86
88
  if (Array.isArray(e.meta?.appreciatedBy)) appreciations += e.meta.appreciatedBy.length;
@@ -114,7 +116,7 @@ const stats = computed(() => ({
114
116
  oldestPage: live.value?.oldestPage ?? ssrStats.value?.oldestPage ?? 0,
115
117
  pagesThisWeek: live.value?.pagesThisWeek ?? 0
116
118
  }));
117
- const readingNow = computed(() => travellers.value.length + 1);
119
+ const readingNow = computed(() => people.value.length + 1);
118
120
  const now = ref(Date.now());
119
121
  let tick = null;
120
122
  onMounted(() => {
@@ -218,51 +220,28 @@ const allTiles = computed(() => {
218
220
  out.push({ key: "age", label: "Site age", value: ageLabel.value, icon: "i-lucide-calendar-days" });
219
221
  return out;
220
222
  });
221
- const chosenKeys = computed(() => {
222
- const raw = pageMeta.value.statsTiles;
223
- if (!Array.isArray(raw)) return null;
224
- const keys = raw.filter((k) => typeof k === "string");
225
- return keys.length ? keys : [];
226
- });
223
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
224
+ typeKey: "stats",
225
+ options: () => [{
226
+ key: "tiles",
227
+ kind: "order",
228
+ label: "Tiles",
229
+ metaKey: "statsTiles",
230
+ default: allTiles.value.map((t) => t.key),
231
+ choices: allTiles.value.map((t) => ({ value: t.key, label: t.label, icon: t.icon }))
232
+ }]
233
+ }, () => props.docMeta);
227
234
  const tiles = computed(() => {
228
- const chosen = chosenKeys.value;
229
- if (!chosen) return allTiles.value;
235
+ const chosen = view.value.tiles;
230
236
  const byKey = new Map(allTiles.value.map((t) => [t.key, t]));
231
237
  return chosen.map((k) => byKey.get(k)).filter((t) => !!t);
232
238
  });
233
- function toggleTile(key) {
234
- const current = chosenKeys.value ?? allTiles.value.map((t) => t.key);
235
- const next = current.includes(key) ? current.filter((k) => k !== key) : [...current, key];
236
- tree.updateMeta(props.docId, { statsTiles: next });
237
- }
238
- function resetTiles() {
239
- tree.updateMeta(props.docId, { statsTiles: void 0 });
240
- }
241
- const tileMenuItems = computed(() => {
242
- const shown = new Set(tiles.value.map((t) => t.key));
243
- return [
244
- allTiles.value.map((t) => ({
245
- label: t.label,
246
- icon: t.icon,
247
- type: "checkbox",
248
- checked: shown.has(t.key),
249
- onSelect: (e) => {
250
- e.preventDefault();
251
- toggleTile(t.key);
252
- }
253
- })),
254
- [{
255
- label: "Show all",
256
- icon: "i-lucide-rotate-ccw",
257
- onSelect: () => resetTiles()
258
- }]
259
- ];
260
- });
261
239
  </script>
262
240
 
263
241
  <template>
264
242
  <div class="relative mx-auto w-full max-w-3xl px-4 pt-12 pb-16 sm:px-8">
265
243
  <JunPageHero
244
+ :doc-id="docId"
266
245
  :title="pageTitle"
267
246
  :subtitle="subtitle"
268
247
  :editable="editing"
@@ -270,6 +249,16 @@ const tileMenuItems = computed(() => {
270
249
  @rename-subtitle="renameSubtitle"
271
250
  />
272
251
 
252
+ <!-- The page's own prose, above its children. Collapses to nothing
253
+ when the document has no body, which is every site that has never
254
+ written one. -->
255
+ <JunCollectionIntro
256
+ :doc-id="docId"
257
+ :doc-label="pageTitle"
258
+ :doc-meta="docMeta"
259
+ placeholder="What these numbers count…"
260
+ />
261
+
273
262
  <div
274
263
  data-jun-anchor="stat:summary"
275
264
  class="jun-card mb-6 flex items-center gap-3 rounded-2xl px-5 py-4"
@@ -290,20 +279,18 @@ const tileMenuItems = computed(() => {
290
279
  >(that's you)</span>
291
280
  </p>
292
281
 
293
- <UDropdownMenu
282
+ <div
294
283
  v-if="editing"
295
- :items="tileMenuItems"
296
- :content="{ align: 'end' }"
297
284
  class="ml-auto"
298
285
  >
299
- <UButton
300
- icon="i-lucide-layout-grid"
301
- color="neutral"
302
- variant="ghost"
303
- size="xs"
304
- label="Tiles"
286
+ <JunViewControls
287
+ :options="viewOptions"
288
+ :values="view"
289
+ :is-default="viewIsDefault"
290
+ @set="setView"
291
+ @reset="resetView"
305
292
  />
306
- </UDropdownMenu>
293
+ </div>
307
294
  </div>
308
295
 
309
296
  <div class="grid grid-cols-2 gap-3 sm:grid-cols-4">
@@ -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;
@@ -0,0 +1,304 @@
1
+ <script setup>
2
+ import { computed, ref } from "vue";
3
+ import {
4
+ junDateLong,
5
+ junMotion,
6
+ useAbracadabra,
7
+ useChildTree,
8
+ useDocTree,
9
+ useJunRename,
10
+ useJunSelfId,
11
+ useJunStudio,
12
+ useJunViewOptions,
13
+ useToast
14
+ } from "#imports";
15
+ import { junViewSpecFor } from "../../utils/junViewSpecs";
16
+ import { junThreadCount, junThreadTree } from "../../utils/junThread";
17
+ const props = defineProps({
18
+ docId: { type: String, required: true },
19
+ docLabel: { type: String, required: false },
20
+ docMeta: { type: Object, required: false },
21
+ editable: { type: Boolean, required: false }
22
+ });
23
+ const abra = useAbracadabra();
24
+ const tree = useChildTree(abra.doc, props.docId);
25
+ const { entries, getEntry } = useDocTree();
26
+ const { editing } = useJunStudio();
27
+ const { renameDoc } = useJunRename();
28
+ const selfId = useJunSelfId();
29
+ const toast = useToast();
30
+ const entry = computed(() => getEntry(props.docId));
31
+ const meta = computed(
32
+ () => entry.value?.meta ?? props.docMeta ?? {}
33
+ );
34
+ const title = computed(() => entry.value?.label ?? props.docLabel ?? "Conversation");
35
+ const blurb = computed(() => {
36
+ const ex = meta.value.excerpt;
37
+ return typeof ex === "string" && ex.trim() ? ex : void 0;
38
+ });
39
+ const closed = computed(() => meta.value.threadClosed === true);
40
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
41
+ typeKey: "thread",
42
+ options: junViewSpecFor("thread")
43
+ }, () => props.docMeta);
44
+ const posts = computed(() => junThreadTree(
45
+ entries.value.map((e) => ({
46
+ id: e.id,
47
+ label: e.label,
48
+ parentId: e.parentId,
49
+ trashed: e.trashed,
50
+ meta: e.meta
51
+ })),
52
+ {
53
+ threadId: props.docId,
54
+ newest: view.value.order === "newest",
55
+ depthMax: Number(view.value.depth) || 3,
56
+ // The owner sees what they have hidden; nobody else does.
57
+ includeHidden: editing.value
58
+ }
59
+ ));
60
+ const total = computed(() => junThreadCount(posts.value));
61
+ const INDENT = {
62
+ 0: "",
63
+ 1: "ml-4 sm:ml-8",
64
+ 2: "ml-8 sm:ml-16",
65
+ 3: "ml-12 sm:ml-24",
66
+ 4: "ml-16 sm:ml-32",
67
+ 5: "ml-20 sm:ml-40",
68
+ 6: "ml-24 sm:ml-48"
69
+ };
70
+ function flatten(list, out = []) {
71
+ for (const post of list) {
72
+ out.push({ post, indent: INDENT[post.depth] ?? "" });
73
+ flatten(post.replies, out);
74
+ }
75
+ return out;
76
+ }
77
+ const rows = computed(() => flatten(posts.value));
78
+ const draft = ref("");
79
+ const handle = ref("");
80
+ const replyTo = ref(null);
81
+ const sending = ref(false);
82
+ const storedHandle = computed(() => {
83
+ if (handle.value.trim()) return handle.value.trim();
84
+ if (import.meta.client) return localStorage.getItem("abracadabra_username") ?? "";
85
+ return "";
86
+ });
87
+ async function send() {
88
+ const message = draft.value.trim();
89
+ if (!message || sending.value) return;
90
+ sending.value = true;
91
+ try {
92
+ await abra.provider.value?.rpc?.call("jun.thread.post@1", {
93
+ docId: props.docId,
94
+ message,
95
+ handle: storedHandle.value || "Traveller",
96
+ replyTo: replyTo.value
97
+ });
98
+ draft.value = "";
99
+ replyTo.value = null;
100
+ } catch (error) {
101
+ const text = error?.message ?? "that did not land";
102
+ toast.add({ title: text, icon: "i-lucide-info", color: "neutral" });
103
+ } finally {
104
+ sending.value = false;
105
+ }
106
+ }
107
+ function startReply(id) {
108
+ replyTo.value = replyTo.value === id ? null : id;
109
+ }
110
+ function toggleModerated(post) {
111
+ tree.updateMeta(post.id, { moderated: post.hidden ? void 0 : true });
112
+ }
113
+ function togglePinned(post) {
114
+ tree.updateMeta(post.id, { pinned: post.pinned ? void 0 : true });
115
+ }
116
+ </script>
117
+
118
+ <template>
119
+ <div class="mx-auto w-full max-w-2xl px-4 pt-8 pb-20 sm:px-6">
120
+ <JunPageHero
121
+ :doc-id="docId"
122
+ :title="title"
123
+ :subtitle="blurb"
124
+ :editable="editing"
125
+ @rename="renameDoc(docId, $event)"
126
+ >
127
+ <template #right>
128
+ <div class="flex items-center gap-1.5">
129
+ <span
130
+ v-if="total"
131
+ class="text-[11px] text-dimmed tabular-nums"
132
+ data-jun-thread="count"
133
+ >{{ total }}</span>
134
+ <JunViewControls
135
+ v-if="editing"
136
+ :options="viewOptions"
137
+ :values="view"
138
+ :is-default="viewIsDefault"
139
+ @set="setView"
140
+ @reset="resetView"
141
+ />
142
+ </div>
143
+ </template>
144
+ </JunPageHero>
145
+
146
+ <!-- The thread's own prose: what is being discussed. Every page type here
147
+ renders its document's body. -->
148
+ <div class="jun-thread-body mt-6">
149
+ <AEditor
150
+ :doc-id="docId"
151
+ :doc-label="title"
152
+ :doc-meta="docMeta"
153
+ :editable="editing"
154
+ :show-toolbar="editing"
155
+ :show-suggestion-menu="editing"
156
+ :show-drag-handle="editing"
157
+ :show-breadcrumb="false"
158
+ placeholder="What is this conversation about?"
159
+ />
160
+ </div>
161
+
162
+ <ClientOnly>
163
+ <div class="mt-4">
164
+ <JunReaders :doc-id="docId" />
165
+ </div>
166
+ </ClientOnly>
167
+
168
+ <hr class="my-8 border-default">
169
+
170
+ <!-- The composer. Above the posts when newest-first, below when in order —
171
+ it belongs where the next thing to be read is. -->
172
+ <div
173
+ v-if="!closed && view.order === 'newest'"
174
+ class="mb-6"
175
+ >
176
+ <ClientOnly>
177
+ <JunThreadComposer
178
+ v-model="draft"
179
+ :reply-to="replyTo"
180
+ :sending="sending"
181
+ @send="send"
182
+ @cancel-reply="replyTo = null"
183
+ />
184
+ </ClientOnly>
185
+ </div>
186
+
187
+ <p
188
+ v-if="!rows.length"
189
+ class="text-sm text-muted"
190
+ >
191
+ {{ closed ? "This conversation is closed." : "Nothing said yet. Say the first thing." }}
192
+ </p>
193
+
194
+ <ul
195
+ v-else
196
+ class="flex flex-col gap-3"
197
+ data-jun-thread="posts"
198
+ >
199
+ <li
200
+ v-for="(row, i) in rows"
201
+ :key="row.post.id"
202
+ v-motion="junMotion({
203
+ initial: { opacity: 0, y: 6 },
204
+ enter: { opacity: 1, y: 0, transition: { delay: Math.min(i, 8) * 30, duration: 280 } }
205
+ })"
206
+ :class="row.indent"
207
+ :data-jun-post="row.post.id"
208
+ :data-jun-depth="row.post.depth"
209
+ >
210
+ <article
211
+ class="rounded-xl px-3.5 py-2.5 ring-1 ring-black/5 dark:ring-white/10"
212
+ :class="[
213
+ row.post.hidden ? 'opacity-45' : '',
214
+ row.post.pinned ? 'bg-black/[0.04] dark:bg-white/[0.06]' : ''
215
+ ]"
216
+ >
217
+ <header class="flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-[11px] text-dimmed">
218
+ <span class="font-medium text-muted">{{ row.post.handle }}</span>
219
+ <span v-if="row.post.signerId && row.post.signerId === selfId">· you</span>
220
+ <time v-if="row.post.date">· {{ junDateLong(new Date(row.post.date).toISOString()) }}</time>
221
+ <span
222
+ v-if="row.post.pinned"
223
+ class="inline-flex items-center gap-1"
224
+ >· <UIcon
225
+ name="i-lucide-pin"
226
+ class="size-3"
227
+ /></span>
228
+ <span v-if="row.post.hidden">· removed</span>
229
+
230
+ <span class="flex-1" />
231
+
232
+ <button
233
+ v-if="!closed"
234
+ type="button"
235
+ class="text-[11px] text-dimmed transition-colors hover:text-default"
236
+ :data-jun-reply="row.post.id"
237
+ @click="startReply(row.post.id)"
238
+ >
239
+ {{ replyTo === row.post.id ? "cancel" : "reply" }}
240
+ </button>
241
+ <!-- Owner moderation. Hidden is not deleted: the post stays a
242
+ document, out of the conversation rather than destroyed. -->
243
+ <template v-if="editing">
244
+ <button
245
+ type="button"
246
+ class="text-[11px] text-dimmed transition-colors hover:text-default"
247
+ @click="togglePinned(row.post)"
248
+ >
249
+ {{ row.post.pinned ? "unpin" : "pin" }}
250
+ </button>
251
+ <button
252
+ type="button"
253
+ class="text-[11px] text-dimmed transition-colors hover:text-default"
254
+ @click="toggleModerated(row.post)"
255
+ >
256
+ {{ row.post.hidden ? "restore" : "remove" }}
257
+ </button>
258
+ </template>
259
+ </header>
260
+
261
+ <p class="mt-1 text-sm whitespace-pre-line text-default">
262
+ {{ row.post.message }}
263
+ </p>
264
+
265
+ <!-- The composer moves to whichever post is being answered, so a reply
266
+ is written where it will appear. -->
267
+ <ClientOnly>
268
+ <div
269
+ v-if="replyTo === row.post.id && !closed"
270
+ class="mt-2"
271
+ >
272
+ <JunThreadComposer
273
+ v-model="draft"
274
+ :reply-to="replyTo"
275
+ :sending="sending"
276
+ @send="send"
277
+ @cancel-reply="replyTo = null"
278
+ />
279
+ </div>
280
+ </ClientOnly>
281
+ </article>
282
+ </li>
283
+ </ul>
284
+
285
+ <div
286
+ v-if="!closed && view.order !== 'newest' && !replyTo"
287
+ class="mt-6"
288
+ >
289
+ <ClientOnly>
290
+ <JunThreadComposer
291
+ v-model="draft"
292
+ :reply-to="null"
293
+ :sending="sending"
294
+ @send="send"
295
+ @cancel-reply="replyTo = null"
296
+ />
297
+ </ClientOnly>
298
+ </div>
299
+ </div>
300
+ </template>
301
+
302
+ <style scoped>
303
+ .jun-thread-body :deep(.document-header){display:none}.jun-thread-body :deep(.ProseMirror),.jun-thread-body :deep(.aeditor-canvas){padding:0}
304
+ </style>