@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
@@ -17,8 +17,10 @@ import {
17
17
  useJunRename,
18
18
  useJunStudio,
19
19
  useJunUpload,
20
- useJunViewingAccent
20
+ useJunViewingAccent,
21
+ useJunViewOptions
21
22
  } from "#imports";
23
+ import { junViewSpecFor } from "../../utils/junViewSpecs";
22
24
  const props = defineProps({
23
25
  docId: { type: String, required: true },
24
26
  docLabel: { type: String, required: false },
@@ -35,6 +37,10 @@ const { renameDoc } = useJunRename();
35
37
  const { uploadTo, imageFiles } = useJunUpload();
36
38
  const { importMedia, audioFiles } = useJunMediaImport();
37
39
  const { accentInsetStyle, accentTitle } = useJunViewingAccent();
40
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
41
+ typeKey: "festival",
42
+ options: junViewSpecFor("festival")
43
+ }, () => props.docMeta);
38
44
  const { peers } = useAwarenessPeers();
39
45
  const player = useJunPlayer();
40
46
  const { typeIdFor } = useJunPageType();
@@ -202,7 +208,7 @@ function onPageDrop(e) {
202
208
  function addStage() {
203
209
  const existing = declaredStages.value;
204
210
  const name = `Stage ${existing.length + 1}`;
205
- tree.updateMeta(props.docId, { stages: [...existing, name].join(", ") });
211
+ tree.updateMeta(props.docId, { stages: [...existing, name] });
206
212
  }
207
213
  const artDropId = ref(null);
208
214
  function onRowDragOver(entry, e) {
@@ -255,11 +261,33 @@ const totalPlayable = computed(() => items.value.filter(playable).length);
255
261
  @drop="onPageDrop"
256
262
  >
257
263
  <JunPageHero
264
+ :doc-id="docId"
258
265
  :title="pageTitle"
259
266
  :subtitle="subtitle"
260
267
  :editable="editing"
261
268
  @rename="renamePage"
262
269
  @rename-subtitle="renameSubtitle"
270
+ >
271
+ <template #right>
272
+ <JunViewControls
273
+ v-if="editing"
274
+ :options="viewOptions"
275
+ :values="view"
276
+ :is-default="viewIsDefault"
277
+ @set="setView"
278
+ @reset="resetView"
279
+ />
280
+ </template>
281
+ </JunPageHero>
282
+
283
+ <!-- The page's own prose, above its children. Collapses to nothing
284
+ when the document has no body, which is every site that has never
285
+ written one. -->
286
+ <JunCollectionIntro
287
+ :doc-id="docId"
288
+ :doc-label="pageTitle"
289
+ :doc-meta="docMeta"
290
+ placeholder="What is playing here…"
263
291
  />
264
292
 
265
293
  <div class="mb-6 flex flex-wrap items-center gap-2">
@@ -481,7 +509,10 @@ const totalPlayable = computed(() => items.value.filter(playable).length);
481
509
  </button>
482
510
  </span>
483
511
 
484
- <span class="relative flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-md bg-black/5 ring-1 ring-black/5 dark:bg-white/10 dark:ring-white/10">
512
+ <span
513
+ v-if="view.artwork"
514
+ class="relative flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-md bg-black/5 ring-1 ring-black/5 dark:bg-white/10 dark:ring-white/10"
515
+ >
485
516
  <JunMedia
486
517
  v-if="entry.meta?.coverUploadId"
487
518
  :doc-id="entry.id"
@@ -513,7 +544,10 @@ const totalPlayable = computed(() => items.value.filter(playable).length);
513
544
  </span>
514
545
  </NuxtLink>
515
546
 
516
- <span class="hidden min-w-0 flex-1 truncate text-xs text-muted sm:block">
547
+ <span
548
+ v-if="view.albums"
549
+ class="hidden min-w-0 flex-1 truncate text-xs text-muted sm:block"
550
+ >
517
551
  {{ entry.meta?.mediaAlbum || "" }}
518
552
  </span>
519
553
 
@@ -532,7 +566,10 @@ const totalPlayable = computed(() => items.value.filter(playable).length);
532
566
  />
533
567
  </a>
534
568
 
535
- <span class="w-10 shrink-0 text-right text-xs tabular-nums text-dimmed">
569
+ <span
570
+ v-if="view.durations"
571
+ class="w-10 shrink-0 text-right text-xs tabular-nums text-dimmed"
572
+ >
536
573
  {{ entry.meta?.mediaDuration ? junFormatTime(entry.meta.mediaDuration) : "\u2014" }}
537
574
  </span>
538
575
  </div>
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ docId: string;
3
+ docLabel?: string;
4
+ docMeta?: Record<string, unknown>;
5
+ childProvider?: unknown;
6
+ editable?: boolean;
7
+ };
8
+ 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,280 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import {
4
+ useDocSlugs,
5
+ useJunGarden,
6
+ useJunRename,
7
+ useJunStudio,
8
+ useJunViewOptions
9
+ } from "#imports";
10
+ import { junViewSpecFor } from "../../utils/junViewSpecs";
11
+ import {
12
+ JUN_MATURITIES,
13
+ junGardenLayout
14
+ } from "../../utils/junGarden";
15
+ const props = defineProps({
16
+ docId: { type: String, required: true },
17
+ docLabel: { type: String, required: false },
18
+ docMeta: { type: Object, required: false },
19
+ childProvider: { type: null, required: false },
20
+ editable: { type: Boolean, required: false }
21
+ });
22
+ const { editing } = useJunStudio();
23
+ const { renameDoc } = useJunRename();
24
+ const { getDocUrl } = useDocSlugs();
25
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
26
+ typeKey: "garden",
27
+ options: junViewSpecFor("garden")
28
+ }, () => props.docMeta);
29
+ const pageTitle = computed(() => props.docLabel ?? "Garden");
30
+ const subtitle = computed(() => {
31
+ const ex = props.docMeta?.excerpt;
32
+ return typeof ex === "string" && ex.trim() ? ex : void 0;
33
+ });
34
+ const { notes, orphans, counts, edges, ready } = useJunGarden(
35
+ props.docId,
36
+ () => view.value.sort ?? "links"
37
+ );
38
+ const showGraph = computed(() => view.value.variant === "graph" || view.value.variant === "both");
39
+ const showList = computed(() => view.value.variant !== "graph");
40
+ const WIDTH = 1e3;
41
+ const HEIGHT = 560;
42
+ const points = computed(() => junGardenLayout(
43
+ notes.value.map((n) => n.id),
44
+ edges.value,
45
+ {
46
+ width: WIDTH,
47
+ height: HEIGHT,
48
+ // The slider is a whole number so the control has sane steps; the layout
49
+ // wants a multiplier.
50
+ spread: (Number(view.value.spread) || 10) / 10
51
+ }
52
+ ));
53
+ const pointById = computed(() => new Map(points.value.map((p) => [p.id, p])));
54
+ const lines = computed(() => edges.value.flatMap((edge) => {
55
+ const a = pointById.value.get(edge.source);
56
+ const b = pointById.value.get(edge.target);
57
+ if (!a || !b) return [];
58
+ return [{ key: `${edge.source}-${edge.target}`, x1: a.x, y1: a.y, x2: b.x, y2: b.y, weight: edge.weight }];
59
+ }));
60
+ function radiusOf(note) {
61
+ return Math.min(16, 5 + note.inbound.length * 2.5);
62
+ }
63
+ const MATURITY_LABEL = Object.fromEntries(
64
+ JUN_MATURITIES.map((m) => [m.value, m.label])
65
+ );
66
+ const MATURITY_ICON = Object.fromEntries(
67
+ JUN_MATURITIES.map((m) => [m.value, m.icon])
68
+ );
69
+ const MATURITY_CLASS = {
70
+ seedling: "text-emerald-600/80 dark:text-emerald-400/80",
71
+ budding: "text-sky-600/80 dark:text-sky-400/80",
72
+ evergreen: "text-teal-700/80 dark:text-teal-300/80"
73
+ };
74
+ function renamePage(t) {
75
+ renameDoc(props.docId, t);
76
+ }
77
+ </script>
78
+
79
+ <template>
80
+ <div class="mx-auto w-full max-w-4xl px-4 pt-12 pb-16 sm:px-8">
81
+ <JunPageHero
82
+ :doc-id="docId"
83
+ :title="pageTitle"
84
+ :subtitle="subtitle"
85
+ :editable="editing"
86
+ @rename="renamePage"
87
+ >
88
+ <template #right>
89
+ <JunViewControls
90
+ v-if="editing"
91
+ :options="viewOptions"
92
+ :values="view"
93
+ :is-default="viewIsDefault"
94
+ @set="setView"
95
+ @reset="resetView"
96
+ />
97
+ </template>
98
+ </JunPageHero>
99
+
100
+ <JunCollectionIntro
101
+ :doc-id="docId"
102
+ :doc-label="pageTitle"
103
+ :doc-meta="docMeta"
104
+ placeholder="What grows here…"
105
+ />
106
+
107
+ <ClientOnly>
108
+ <div class="mb-6">
109
+ <JunReaders :doc-id="docId" />
110
+ </div>
111
+ </ClientOnly>
112
+
113
+ <!-- What the garden IS, in four numbers. Rendered server-side, so this is
114
+ also the assertion surface for the link index. -->
115
+ <p
116
+ class="mb-6 flex flex-wrap items-center gap-x-4 gap-y-1 text-[12px] text-dimmed tabular-nums"
117
+ data-jun-garden="counts"
118
+ >
119
+ <span data-jun-garden="notes">{{ counts.notes }} notes</span>
120
+ <span data-jun-garden="links">{{ counts.links }} links</span>
121
+ <!-- `orphan-count`, not `orphans`: the section below is `orphans`, and one
122
+ key on two elements is ambiguous to anything selecting by it. -->
123
+ <span data-jun-garden="orphan-count">{{ counts.orphans }} unlinked</span>
124
+ <span v-if="counts.evergreen">{{ counts.evergreen }} evergreen</span>
125
+ </p>
126
+
127
+ <!-- The graph. Plain SVG geometry from a deterministic layout, so the server
128
+ and the client draw the same picture. -->
129
+ <div
130
+ v-if="showGraph && notes.length"
131
+ class="jun-card mb-8 overflow-hidden rounded-2xl"
132
+ data-jun-garden="graph"
133
+ >
134
+ <svg
135
+ :viewBox="`0 0 ${WIDTH} ${HEIGHT}`"
136
+ class="block h-auto w-full"
137
+ role="img"
138
+ :aria-label="`${counts.notes} notes and ${counts.links} links between them`"
139
+ >
140
+ <g stroke="currentColor">
141
+ <line
142
+ v-for="line in lines"
143
+ :key="line.key"
144
+ :x1="line.x1"
145
+ :y1="line.y1"
146
+ :x2="line.x2"
147
+ :y2="line.y2"
148
+ :stroke-width="Math.min(line.weight, 3)"
149
+ :stroke-opacity="0.14 + Math.min(line.weight, 4) * 0.04"
150
+ />
151
+ </g>
152
+ <g
153
+ v-for="note in notes"
154
+ :key="note.id"
155
+ >
156
+ <a
157
+ :href="note.href ?? getDocUrl(note.id)"
158
+ :data-jun-node="note.id"
159
+ >
160
+ <circle
161
+ :cx="pointById.get(note.id)?.x ?? 0"
162
+ :cy="pointById.get(note.id)?.y ?? 0"
163
+ :r="radiusOf(note)"
164
+ fill="currentColor"
165
+ :fill-opacity="note.inbound.length ? 0.65 : 0.28"
166
+ />
167
+ <text
168
+ v-if="view.labels"
169
+ :x="(pointById.get(note.id)?.x ?? 0) + radiusOf(note) + 6"
170
+ :y="(pointById.get(note.id)?.y ?? 0) + 4"
171
+ class="fill-current text-[13px]"
172
+ fill-opacity="0.75"
173
+ >{{ note.label }}</text>
174
+ </a>
175
+ </g>
176
+ </svg>
177
+ </div>
178
+
179
+ <!-- The list. What links where, in words — and the only half a screen reader
180
+ or a text browser can use, which is why it is the default. -->
181
+ <ul
182
+ v-if="showList && notes.length"
183
+ class="flex flex-col gap-3"
184
+ data-jun-garden="notes-list"
185
+ >
186
+ <li
187
+ v-for="note in notes"
188
+ :key="note.id"
189
+ class="jun-card rounded-2xl p-4 sm:p-5"
190
+ :data-jun-note="note.id"
191
+ >
192
+ <div class="flex flex-wrap items-baseline gap-x-3 gap-y-1">
193
+ <NuxtLink
194
+ :to="note.href ?? getDocUrl(note.id)"
195
+ class="text-[15px] font-medium underline-offset-4 hover:underline"
196
+ >
197
+ {{ note.label }}
198
+ </NuxtLink>
199
+ <span
200
+ v-if="view.maturity && note.maturity"
201
+ class="inline-flex items-center gap-1 text-[11px]"
202
+ :class="MATURITY_CLASS[note.maturity]"
203
+ :data-jun-maturity="note.maturity"
204
+ >
205
+ <UIcon
206
+ :name="MATURITY_ICON[note.maturity] ?? 'i-lucide-sprout'"
207
+ class="size-3.5"
208
+ />
209
+ {{ MATURITY_LABEL[note.maturity] }}
210
+ </span>
211
+ <span class="ml-auto text-[11px] text-dimmed tabular-nums">
212
+ <span :data-jun-inbound="note.id">{{ note.inbound.length }}</span> in ·
213
+ {{ note.outbound.length }} out
214
+ </span>
215
+ </div>
216
+
217
+ <!-- What links HERE, by name. The reason this page exists. -->
218
+ <p
219
+ v-if="note.inbound.length"
220
+ class="mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-[12px] text-muted"
221
+ >
222
+ <span class="text-dimmed">linked from</span>
223
+ <NuxtLink
224
+ v-for="ref in note.inbound"
225
+ :key="ref.id"
226
+ :to="ref.href ?? getDocUrl(ref.id)"
227
+ class="underline-offset-4 hover:underline"
228
+ >{{ ref.label }}</NuxtLink>
229
+ </p>
230
+ <p
231
+ v-else
232
+ class="mt-2 text-[12px] text-dimmed"
233
+ >
234
+ Nothing links here yet.
235
+ </p>
236
+ </li>
237
+ </ul>
238
+
239
+ <!-- Orphans, listed separately even though they are in the list above: a
240
+ garden owner comes to this page to find exactly these. -->
241
+ <section
242
+ v-if="view.orphans && orphans.length"
243
+ class="mt-10"
244
+ data-jun-garden="orphans"
245
+ >
246
+ <h2 class="mb-2 text-[11px] tracking-wider text-dimmed uppercase">
247
+ Nothing links to these
248
+ </h2>
249
+ <ul class="flex flex-wrap gap-x-3 gap-y-1.5">
250
+ <li
251
+ v-for="note in orphans"
252
+ :key="note.id"
253
+ >
254
+ <NuxtLink
255
+ :to="note.href ?? getDocUrl(note.id)"
256
+ class="text-sm text-muted underline-offset-4 hover:underline"
257
+ >
258
+ {{ note.label }}
259
+ </NuxtLink>
260
+ </li>
261
+ </ul>
262
+ </section>
263
+
264
+ <div
265
+ v-if="!notes.length"
266
+ class="py-16 text-center"
267
+ >
268
+ <UIcon
269
+ name="i-lucide-sprout"
270
+ class="mb-3 size-10 text-dimmed"
271
+ />
272
+ <p class="text-sm text-muted">
273
+ <!-- "Not warm yet" and "no notes" are different states, and a garden
274
+ owner who has just written three notes must not be told they have
275
+ none because the cache has not swept. -->
276
+ {{ ready ? "Nothing planted here yet \u2014 add a page under this one." : "Reading the garden\u2026" }}
277
+ </p>
278
+ </div>
279
+ </div>
280
+ </template>
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ docId: string;
3
+ docLabel?: string;
4
+ docMeta?: Record<string, unknown>;
5
+ childProvider?: unknown;
6
+ editable?: boolean;
7
+ };
8
+ 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -11,9 +11,12 @@ import {
11
11
  useJunSelfId,
12
12
  useJunSiteConfig,
13
13
  useJunStudio,
14
+ useJunViewOptions,
14
15
  useToast,
15
16
  useTrash
16
17
  } from "#imports";
18
+ import { junViewSpecFor } from "../../utils/junViewSpecs";
19
+ import { junIsModerated, junIsPinned, junModerateList, junToggleFlag } from "../../utils/junModeration";
17
20
  const props = defineProps({
18
21
  docId: { type: String, required: true },
19
22
  docLabel: { type: String, required: false },
@@ -26,6 +29,13 @@ const tree = useChildTree(abra.doc, props.docId);
26
29
  const { getDocUrl } = useDocSlugs();
27
30
  const { getEntry } = useDocTree();
28
31
  const { editing } = useJunStudio();
32
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
33
+ typeKey: "guestbook",
34
+ options: junViewSpecFor("guestbook")
35
+ }, () => props.docMeta);
36
+ const listClass = computed(
37
+ () => view.value.variant === "wall" ? "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3" : "flex flex-col gap-4"
38
+ );
29
39
  const { renameDoc } = useJunRename();
30
40
  const { config } = useJunSiteConfig();
31
41
  const toast = useToast();
@@ -43,9 +53,20 @@ function renameSubtitle(s) {
43
53
  tree.updateMeta(props.docId, { excerpt: s || void 0 });
44
54
  }
45
55
  const children = computed(() => tree.childrenOf(null) ?? []);
46
- const signatures = computed(
47
- () => children.value.filter((e) => typeof e.meta?.message === "string" && e.meta.message.trim()).sort((a, b) => (b.meta?.date ?? 0) - (a.meta?.date ?? 0))
48
- );
56
+ const signatures = computed(() => junModerateList(
57
+ children.value.filter((e) => typeof e.meta?.message === "string" && e.meta.message.trim()).sort((a, b) => (b.meta?.date ?? 0) - (a.meta?.date ?? 0)),
58
+ // The owner sees what they have removed; nobody else does. Never derived from
59
+ // anything but edit mode.
60
+ { includeHidden: editing.value }
61
+ ));
62
+ const isHidden = (e) => junIsModerated(e.meta);
63
+ const isPinned = (e) => junIsPinned(e.meta);
64
+ function togglePinned(e) {
65
+ tree.updateMeta(e.id, { pinned: junToggleFlag(isPinned(e)) });
66
+ }
67
+ function toggleModerated(e) {
68
+ tree.updateMeta(e.id, { moderated: junToggleFlag(isHidden(e)) });
69
+ }
49
70
  const foreign = computed(
50
71
  () => children.value.filter((e) => !(typeof e.meta?.message === "string" && e.meta.message.trim()))
51
72
  );
@@ -142,11 +163,33 @@ function deleteSignature(entry) {
142
163
  <template>
143
164
  <div class="relative mx-auto w-full max-w-3xl px-4 pt-12 pb-16 sm:px-8">
144
165
  <JunPageHero
166
+ :doc-id="docId"
145
167
  :title="pageTitle"
146
168
  :subtitle="subtitle"
147
169
  :editable="editing"
148
170
  @rename="renamePage"
149
171
  @rename-subtitle="renameSubtitle"
172
+ >
173
+ <template #right>
174
+ <JunViewControls
175
+ v-if="editing"
176
+ :options="viewOptions"
177
+ :values="view"
178
+ :is-default="viewIsDefault"
179
+ @set="setView"
180
+ @reset="resetView"
181
+ />
182
+ </template>
183
+ </JunPageHero>
184
+
185
+ <!-- The page's own prose, above its children. Collapses to nothing
186
+ when the document has no body, which is every site that has never
187
+ written one. -->
188
+ <JunCollectionIntro
189
+ :doc-id="docId"
190
+ :doc-label="pageTitle"
191
+ :doc-meta="docMeta"
192
+ placeholder="Say what you would like people to leave…"
150
193
  />
151
194
 
152
195
  <!-- Client-only: signing needs the live provider for the RPC call. -->
@@ -231,7 +274,7 @@ function deleteSignature(entry) {
231
274
  v-else
232
275
  tag="ul"
233
276
  name="jun-guest"
234
- class="flex flex-col gap-4"
277
+ :class="listClass"
235
278
  >
236
279
  <li
237
280
  v-for="(entry, i) in signatures"
@@ -245,8 +288,13 @@ function deleteSignature(entry) {
245
288
  >
246
289
  <div
247
290
  class="group/sig jun-card relative rounded-2xl p-4 sm:p-5"
248
- :class="isMine(entry) ? 'ring-1 ring-inset ring-black/15 dark:ring-white/20' : ''"
291
+ :class="[
292
+ isMine(entry) ? 'ring-1 ring-inset ring-black/15 dark:ring-white/20' : '',
293
+ isHidden(entry) ? 'opacity-45' : '',
294
+ isPinned(entry) ? 'bg-black/[0.04] dark:bg-white/[0.06]' : ''
295
+ ]"
249
296
  :style="tintStyle(entry)"
297
+ :data-jun-signature="entry.id"
250
298
  >
251
299
  <span
252
300
  class="absolute top-4 bottom-4 left-0 w-[3px] rounded-full"
@@ -268,6 +316,16 @@ function deleteSignature(entry) {
268
316
  v-if="isMine(entry)"
269
317
  class="text-[10px] tracking-wider text-dimmed uppercase"
270
318
  >you</span>
319
+ <UIcon
320
+ v-if="isPinned(entry)"
321
+ name="i-lucide-pin"
322
+ class="size-3 shrink-0 text-dimmed"
323
+ aria-label="Pinned"
324
+ />
325
+ <span
326
+ v-if="isHidden(entry)"
327
+ class="text-[10px] tracking-wider text-dimmed uppercase"
328
+ >removed</span>
271
329
  <span
272
330
  class="ml-auto flex-none text-[11px] text-dimmed"
273
331
  :title="entry.meta?.date ? new Date(entry.meta.date).toLocaleString() : void 0"
@@ -279,16 +337,40 @@ function deleteSignature(entry) {
279
337
  {{ entry.meta?.message }}
280
338
  </p>
281
339
 
282
- <UButton
340
+ <!-- Pin, remove, trash — in that order, weakest act first. Removing
341
+ keeps the document; the bin is what destroys words. -->
342
+ <div
283
343
  v-if="editing"
284
- icon="i-lucide-trash-2"
285
- color="neutral"
286
- variant="ghost"
287
- size="xs"
288
- class="absolute top-3 right-3 opacity-0 transition-opacity group-hover/sig:opacity-100"
289
- aria-label="Delete signature"
290
- @click.stop.prevent="deleteSignature(entry)"
291
- />
344
+ class="absolute top-3 right-3 flex items-center gap-0.5 opacity-0 transition-opacity group-hover/sig:opacity-100"
345
+ >
346
+ <UButton
347
+ :icon="isPinned(entry) ? 'i-lucide-pin-off' : 'i-lucide-pin'"
348
+ color="neutral"
349
+ variant="ghost"
350
+ size="xs"
351
+ :aria-label="isPinned(entry) ? 'Unpin signature' : 'Pin signature'"
352
+ :data-jun-signature-action="isPinned(entry) ? 'unpin' : 'pin'"
353
+ @click.stop.prevent="togglePinned(entry)"
354
+ />
355
+ <UButton
356
+ :icon="isHidden(entry) ? 'i-lucide-eye' : 'i-lucide-eye-off'"
357
+ color="neutral"
358
+ variant="ghost"
359
+ size="xs"
360
+ :aria-label="isHidden(entry) ? 'Restore signature' : 'Remove signature'"
361
+ :data-jun-signature-action="isHidden(entry) ? 'restore' : 'remove'"
362
+ @click.stop.prevent="toggleModerated(entry)"
363
+ />
364
+ <UButton
365
+ icon="i-lucide-trash-2"
366
+ color="neutral"
367
+ variant="ghost"
368
+ size="xs"
369
+ aria-label="Delete signature"
370
+ data-jun-signature-action="trash"
371
+ @click.stop.prevent="deleteSignature(entry)"
372
+ />
373
+ </div>
292
374
  </div>
293
375
  </JunItemMenu>
294
376
  </li>