@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
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { computed, ref } from "vue";
2
+ import { computed } from "vue";
3
3
  import {
4
4
  junDateShort,
5
5
  junMotion,
@@ -14,8 +14,10 @@ import {
14
14
  useJunPageType,
15
15
  useJunRename,
16
16
  useJunStudio,
17
- useJunViewingAccent
17
+ useJunViewingAccent,
18
+ useJunViewOptions
18
19
  } from "#imports";
20
+ import { JUN_HOME_SECTIONS, junViewSpecFor } from "../../utils/junViewSpecs";
19
21
  const props = defineProps({
20
22
  docId: { type: String, required: true },
21
23
  docLabel: { type: String, required: false },
@@ -48,50 +50,17 @@ function renamePage(t) {
48
50
  function renameTagline(s) {
49
51
  tree.updateMeta(props.docId, { excerpt: s || void 0 });
50
52
  }
51
- const SECTION_META = {
52
- hero: { label: "Hero", icon: "i-lucide-user-round" },
53
- latest: { label: "Latest writing", icon: "i-lucide-feather" },
54
- projects: { label: "Projects", icon: "i-lucide-box" },
55
- now: { label: "Now", icon: "i-lucide-radio" },
56
- links: { label: "Links", icon: "i-lucide-link" },
57
- pages: { label: "Pages", icon: "i-lucide-layout-grid" },
58
- prose: { label: "Page content", icon: "i-lucide-text" }
59
- };
60
- const DEFAULT_SECTIONS = ["hero", "latest", "projects", "pages"];
61
- const ALL_SECTIONS = Object.keys(SECTION_META);
62
- const sections = computed(() => {
63
- const stored = pageMeta.value.homeSections;
64
- if (!Array.isArray(stored)) return DEFAULT_SECTIONS;
65
- const valid = stored.filter((s) => ALL_SECTIONS.includes(s));
66
- return valid.length ? valid : DEFAULT_SECTIONS;
67
- });
68
- function toggleSection(id) {
69
- const current = sections.value;
70
- tree.updateMeta(props.docId, {
71
- homeSections: current.includes(id) ? current.filter((s) => s !== id) : [...current, id]
72
- });
73
- }
74
- function moveSection(id, delta) {
75
- const current = [...sections.value];
76
- const i = current.indexOf(id);
77
- const j = i + delta;
78
- if (i < 0 || j < 0 || j >= current.length) return;
79
- [current[i], current[j]] = [current[j], current[i]];
80
- tree.updateMeta(props.docId, { homeSections: current });
81
- }
82
- const LAYOUTS = [
83
- { value: "stack", label: "Stack", icon: "i-lucide-rows-3", hint: "One column, generous" },
84
- { value: "split", label: "Split", icon: "i-lucide-columns-2", hint: "Hero beside the rest" },
85
- { value: "magazine", label: "Magazine", icon: "i-lucide-layout-panel-top", hint: "Wide, denser sections" },
86
- { value: "minimal", label: "Minimal", icon: "i-lucide-minus", hint: "Centred hero, little else" }
87
- ];
88
- const layout = computed(() => {
89
- const l = pageMeta.value.homeLayout;
90
- return l === "split" || l === "magazine" || l === "minimal" ? l : "stack";
91
- });
92
- function setLayout(l) {
93
- tree.updateMeta(props.docId, { homeLayout: l === "stack" ? void 0 : l });
94
- }
53
+ const ALL_SECTIONS = JUN_HOME_SECTIONS.map((s) => s.id);
54
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
55
+ typeKey: "home",
56
+ options: junViewSpecFor("home")
57
+ }, () => props.docMeta);
58
+ const layout = computed(() => view.value.layout);
59
+ const sections = computed(
60
+ () => view.value.sections.filter(
61
+ (s) => ALL_SECTIONS.includes(s)
62
+ )
63
+ );
95
64
  const shellClass = computed(() => {
96
65
  switch (layout.value) {
97
66
  case "magazine":
@@ -165,96 +134,25 @@ const dateTextOf = (e) => {
165
134
  };
166
135
  const hrefOf = (e) => getDocUrl(e.id);
167
136
  const titleOfSection = (id, fallback) => (id === "latest" ? journalPage.value?.label : id === "projects" ? appsPage.value?.label : null) ?? fallback;
168
- const studioOpen = ref(false);
169
137
  </script>
170
138
 
171
139
  <template>
172
140
  <div :class="['relative mx-auto w-full px-4 pt-12 pb-16 sm:px-8', shellClass]">
173
- <!-- Owner controls. A compact bar rather than a settings page: the home
174
- page is the one document whose layout you want to judge while you
175
- change it. -->
141
+ <!-- The composition controls sit ABOVE the page, not in the hero's slot
142
+ where every other renderer puts them. The hero is itself one of the
143
+ sections this panel switches off — put the panel inside it and an owner
144
+ who hides the hero has no way left to bring it back. -->
176
145
  <div
177
146
  v-if="editing"
178
- class="jun-card mb-8 rounded-xl p-3"
147
+ class="mb-6 flex justify-end"
179
148
  >
180
- <div class="flex flex-wrap items-center gap-2">
181
- <UButton
182
- :icon="studioOpen ? 'i-lucide-chevron-down' : 'i-lucide-chevron-right'"
183
- size="xs"
184
- color="neutral"
185
- variant="ghost"
186
- label="Home layout"
187
- @click="studioOpen = !studioOpen"
188
- />
189
- <span class="text-xs text-dimmed">
190
- {{ LAYOUTS.find((l2) => l2.value === layout)?.label }} · {{ visibleSections.length }} section(s)
191
- </span>
192
- </div>
193
-
194
- <div
195
- v-if="studioOpen"
196
- class="mt-3 space-y-3"
197
- >
198
- <div class="flex flex-wrap gap-2">
199
- <button
200
- v-for="l in LAYOUTS"
201
- :key="l.value"
202
- type="button"
203
- :title="l.hint"
204
- class="flex cursor-pointer items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs ring-1 transition-all"
205
- :class="layout === l.value ? 'ring-2 ring-black bg-black/[0.04] dark:ring-white dark:bg-white/[0.06]' : 'ring-black/10 hover:ring-black/25 dark:ring-white/10 dark:hover:ring-white/25'"
206
- @click="setLayout(l.value)"
207
- >
208
- <UIcon
209
- :name="l.icon"
210
- class="size-4 opacity-80"
211
- />
212
- {{ l.label }}
213
- </button>
214
- </div>
215
-
216
- <ul class="flex flex-col gap-1">
217
- <li
218
- v-for="id in ALL_SECTIONS"
219
- :key="id"
220
- class="flex items-center gap-2 rounded-md px-2 py-1 text-xs hover:bg-black/[0.03] dark:hover:bg-white/[0.04]"
221
- >
222
- <UIcon
223
- :name="SECTION_META[id].icon"
224
- class="size-3.5 opacity-70"
225
- />
226
- <span class="flex-1">{{ SECTION_META[id].label }}</span>
227
- <span
228
- v-if="sections.includes(id) && !hasContent(id)"
229
- class="text-[10px] text-dimmed italic"
230
- >nothing to show yet</span>
231
- <template v-if="sections.includes(id)">
232
- <UButton
233
- icon="i-lucide-chevron-up"
234
- size="xs"
235
- color="neutral"
236
- variant="ghost"
237
- aria-label="Move up"
238
- @click="moveSection(id, -1)"
239
- />
240
- <UButton
241
- icon="i-lucide-chevron-down"
242
- size="xs"
243
- color="neutral"
244
- variant="ghost"
245
- aria-label="Move down"
246
- @click="moveSection(id, 1)"
247
- />
248
- </template>
249
- <USwitch
250
- :model-value="sections.includes(id)"
251
- size="xs"
252
- color="neutral"
253
- @update:model-value="toggleSection(id)"
254
- />
255
- </li>
256
- </ul>
257
- </div>
149
+ <JunViewControls
150
+ :options="viewOptions"
151
+ :values="view"
152
+ :is-default="viewIsDefault"
153
+ @set="setView"
154
+ @reset="resetView"
155
+ />
258
156
  </div>
259
157
 
260
158
  <div :class="layout === 'split' ? 'grid grid-cols-1 gap-12 lg:grid-cols-[minmax(0,19rem)_minmax(0,1fr)]' : ''">
@@ -275,6 +173,7 @@ const studioOpen = ref(false);
275
173
  :class="layout === 'minimal' ? 'mx-auto' : ''"
276
174
  />
277
175
  <JunPageHero
176
+ :doc-id="docId"
278
177
  :title="pageTitle"
279
178
  :subtitle="tagline"
280
179
  :editable="editing"
@@ -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,398 @@
1
+ <script setup>
2
+ import { computed, ref } from "vue";
3
+ import {
4
+ junDateLong,
5
+ junMetaSchema,
6
+ junMotion,
7
+ junStagger,
8
+ useAbracadabra,
9
+ useChildTree,
10
+ useDocSlugs,
11
+ useDocTree,
12
+ useJunDocIcon,
13
+ useJunOptions,
14
+ useJunRename,
15
+ useJunStudio,
16
+ useJunUpload,
17
+ useJunViewingAccent,
18
+ useJunViewOptions
19
+ } from "#imports";
20
+ import { junViewSpecFor } from "../../utils/junViewSpecs";
21
+ const props = defineProps({
22
+ docId: { type: String, required: true },
23
+ docLabel: { type: String, required: false },
24
+ docMeta: { type: Object, required: false },
25
+ childProvider: { type: null, required: false },
26
+ editable: { type: Boolean, required: false }
27
+ });
28
+ const opts = useJunOptions();
29
+ const abra = useAbracadabra();
30
+ const tree = useChildTree(abra.doc, props.docId);
31
+ const { entries, getEntry } = useDocTree();
32
+ const { getDocUrl } = useDocSlugs();
33
+ const { editing } = useJunStudio();
34
+ const { renameDoc } = useJunRename();
35
+ const { uploadTo, imageFiles } = useJunUpload();
36
+ const docIcon = useJunDocIcon();
37
+ const entry = computed(() => getEntry(props.docId));
38
+ const title = computed(() => entry.value?.label ?? props.docLabel ?? "Untitled");
39
+ const meta = computed(
40
+ () => entry.value?.meta ?? props.docMeta ?? {}
41
+ );
42
+ const parentId = computed(() => entry.value?.parentId ?? null);
43
+ const parent = computed(() => parentId.value ? getEntry(parentId.value) : void 0);
44
+ const parentType = computed(() => parent.value?.type ?? "");
45
+ const presentation = computed(() => opts.itemParents[parentType.value]);
46
+ const parentKey = computed(() => {
47
+ const t = parentType.value;
48
+ if (!t) return void 0;
49
+ const hit = Object.entries(opts.typeIds).find(([, id]) => id === t);
50
+ return hit?.[0];
51
+ });
52
+ const icon = computed(() => {
53
+ const own = meta.value.icon;
54
+ if (typeof own === "string" && own) return docIcon(null, own);
55
+ return presentation.value?.icon ?? "i-lucide-file-text";
56
+ });
57
+ const facts = computed(() => {
58
+ const schema = parentKey.value ? junMetaSchema(parentKey.value) : void 0;
59
+ const m = meta.value;
60
+ const out = [];
61
+ const seen = /* @__PURE__ */ new Set();
62
+ const push = (key, label, raw, type) => {
63
+ if (raw === void 0 || raw === null || raw === "" || seen.has(key)) return;
64
+ seen.add(key);
65
+ if (type === "rating") {
66
+ const n = Number(raw);
67
+ if (Number.isFinite(n) && n > 0) out.push({ key, label, value: "", rating: n });
68
+ return;
69
+ }
70
+ const value = Array.isArray(raw) ? raw.join(", ") : String(raw);
71
+ if (!value.trim()) return;
72
+ out.push({ key, label, value, url: type === "url" ? value : void 0 });
73
+ };
74
+ for (const f of schema ?? []) {
75
+ const field = f;
76
+ if (typeof field.startKey === "string") {
77
+ const start = m[field.startKey];
78
+ const end = typeof field.endKey === "string" ? m[field.endKey] : void 0;
79
+ if (start || end) {
80
+ seen.add(field.startKey);
81
+ if (typeof field.endKey === "string") seen.add(field.endKey);
82
+ out.push({
83
+ key: field.startKey,
84
+ label: String(field.label ?? "Period"),
85
+ // An open end reads as "now", the same way the timeline draws it.
86
+ value: `${start ?? "?"} \u2013 ${end ?? "now"}`
87
+ });
88
+ }
89
+ continue;
90
+ }
91
+ if (typeof field.key !== "string") continue;
92
+ if (field.key === "description" || field.key === "excerpt") {
93
+ seen.add(field.key);
94
+ continue;
95
+ }
96
+ if (field.type === "icon" || field.key === "icon") {
97
+ seen.add(field.key);
98
+ continue;
99
+ }
100
+ push(field.key, String(field.label ?? field.key), m[field.key], String(field.type ?? ""));
101
+ }
102
+ for (const key of ["date", "dateTaken"]) {
103
+ const raw = m[key];
104
+ if (typeof raw !== "string" || seen.has(key)) continue;
105
+ const long = junDateLong(raw);
106
+ if (long) push(key, key === "dateTaken" ? "Taken" : "Date", long);
107
+ }
108
+ return out;
109
+ });
110
+ const summary = computed(() => {
111
+ const m = meta.value;
112
+ const v = m.description ?? m.excerpt;
113
+ return typeof v === "string" && v.trim() ? v.trim() : void 0;
114
+ });
115
+ const linkUrl = computed(() => {
116
+ const v = meta.value.url;
117
+ return typeof v === "string" && /^https?:\/\//i.test(v) ? v : void 0;
118
+ });
119
+ const linkHost = computed(() => {
120
+ try {
121
+ return linkUrl.value ? new URL(linkUrl.value).hostname.replace(/^www\./, "") : void 0;
122
+ } catch {
123
+ return void 0;
124
+ }
125
+ });
126
+ const coverUploadId = computed(
127
+ () => typeof meta.value.coverUploadId === "string" ? meta.value.coverUploadId : void 0
128
+ );
129
+ const coverMimeType = computed(
130
+ () => typeof meta.value.coverMimeType === "string" ? meta.value.coverMimeType : "image/jpeg"
131
+ );
132
+ const { accentInsetStyle, accentTitle } = useJunViewingAccent();
133
+ const siblings = computed(() => {
134
+ const p = parentId.value;
135
+ if (!p) return [];
136
+ return entries.value.filter((e) => e.parentId === p && e.id !== p && !!e.label).sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
137
+ });
138
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
139
+ typeKey: "item",
140
+ options: junViewSpecFor("item")
141
+ }, () => props.docMeta);
142
+ const COVER_CLASS = {
143
+ poster: "aspect-2/3",
144
+ square: "aspect-square",
145
+ wide: "aspect-video",
146
+ none: "hidden"
147
+ };
148
+ const MEASURE_CLASS = {
149
+ narrow: "max-w-[34rem]",
150
+ normal: "",
151
+ wide: "max-w-none"
152
+ };
153
+ const coverClass = computed(() => COVER_CLASS[String(view.value.cover)] ?? "aspect-2/3");
154
+ const measureClass = computed(() => MEASURE_CLASS[String(view.value.measure)] ?? "");
155
+ const neighbours = computed(() => {
156
+ const list = siblings.value;
157
+ const at = list.findIndex((s) => s.id === props.docId);
158
+ if (at < 0) return list.slice(0, 4);
159
+ const before = list.slice(Math.max(0, at - 2), at);
160
+ const after = list.slice(at + 1, at + 3);
161
+ return [...before, ...after];
162
+ });
163
+ function renameSelf(t) {
164
+ renameDoc(props.docId, t);
165
+ }
166
+ const coverDropActive = ref(false);
167
+ function onDragOver(e) {
168
+ if (!editing.value || !e.dataTransfer?.types.includes("Files")) return;
169
+ e.preventDefault();
170
+ e.dataTransfer.dropEffect = "copy";
171
+ coverDropActive.value = true;
172
+ }
173
+ async function onDrop(e) {
174
+ if (!editing.value) return;
175
+ const img = imageFiles(e.dataTransfer)[0];
176
+ if (!img) return;
177
+ e.preventDefault();
178
+ coverDropActive.value = false;
179
+ const res = await uploadTo(props.docId, img);
180
+ if (!res) return;
181
+ tree.updateMeta(props.docId, { coverUploadId: res.id, coverMimeType: res.mimeType });
182
+ }
183
+ </script>
184
+
185
+ <template>
186
+ <article
187
+ class="mx-auto w-full max-w-3xl px-4 pt-8 pb-20 sm:px-6"
188
+ :class="coverDropActive ? 'rounded-xl ring-2 ring-inset ring-black/20 dark:ring-white/25' : ''"
189
+ @dragover="onDragOver"
190
+ @dragleave="coverDropActive = false"
191
+ @drop="onDrop"
192
+ >
193
+ <!-- Back to the shelf. First, because the single most useful thing on a
194
+ page reached from a list is the way back to the list. -->
195
+ <NuxtLink
196
+ v-if="parentId && parent"
197
+ :to="getDocUrl(parentId)"
198
+ class="group mb-6 inline-flex items-center gap-1.5 text-xs tracking-wide text-dimmed transition-colors hover:text-default"
199
+ >
200
+ <UIcon
201
+ name="i-lucide-arrow-left"
202
+ class="size-3.5 transition-transform duration-300 group-hover:-translate-x-0.5"
203
+ />
204
+ <span>{{ parent.label }}</span>
205
+ </NuxtLink>
206
+
207
+ <header
208
+ v-motion="junMotion({
209
+ initial: { opacity: 0, y: 16 },
210
+ enter: { opacity: 1, y: 0, transition: { duration: 500 } }
211
+ })"
212
+ class="flex gap-5"
213
+ >
214
+ <!-- The cover's SHAPE is a setting: a poster suits a film, a square suits
215
+ a record, and a wide crop suits a place. One aspect for all of them was
216
+ the previous answer, and it was wrong twice out of three. -->
217
+ <div
218
+ v-if="coverUploadId && view.cover !== 'none'"
219
+ class="relative hidden w-28 shrink-0 overflow-hidden rounded-lg bg-black/5 ring-1 ring-black/5 sm:block dark:bg-white/10 dark:ring-white/10"
220
+ :class="coverClass"
221
+ >
222
+ <JunMedia
223
+ :doc-id="docId"
224
+ :upload-id="coverUploadId"
225
+ :mime-type="coverMimeType"
226
+ :alt="title"
227
+ :size="512"
228
+ media-class="h-full w-full object-cover"
229
+ />
230
+ </div>
231
+
232
+ <div class="min-w-0 flex-1">
233
+ <p
234
+ v-if="presentation"
235
+ class="mb-2 flex items-center gap-1.5 text-[0.7rem] font-medium tracking-[0.22em] text-dimmed uppercase"
236
+ >
237
+ <UIcon
238
+ :name="icon"
239
+ class="size-3.5"
240
+ />
241
+ {{ presentation.label }}
242
+ </p>
243
+
244
+ <JunPageHero
245
+ :doc-id="docId"
246
+ :title="title"
247
+ :subtitle="summary"
248
+ :editable="editing"
249
+ @rename="renameSelf"
250
+ />
251
+
252
+ <a
253
+ v-if="linkUrl"
254
+ :href="linkUrl"
255
+ target="_blank"
256
+ rel="noopener noreferrer"
257
+ class="group mt-1 inline-flex items-center gap-1.5 text-sm text-muted transition-colors hover:text-default"
258
+ >
259
+ <span>{{ linkHost }}</span>
260
+ <UIcon
261
+ name="i-lucide-arrow-up-right"
262
+ class="size-3.5 transition-transform duration-300 group-hover:-translate-y-0.5"
263
+ />
264
+ </a>
265
+ </div>
266
+ </header>
267
+
268
+ <!-- Who else is reading this, and — for an owner — how this page looks.
269
+ Client-only: both come from state the server does not have. -->
270
+ <ClientOnly>
271
+ <div class="mt-4 flex flex-wrap items-center gap-x-3 gap-y-1">
272
+ <JunReaders :doc-id="docId" />
273
+ <span class="flex-1" />
274
+ <JunViewControls
275
+ v-if="editing"
276
+ :options="viewOptions"
277
+ :values="view"
278
+ :is-default="viewIsDefault"
279
+ @set="setView"
280
+ @reset="resetView"
281
+ />
282
+ </div>
283
+ </ClientOnly>
284
+
285
+ <!-- The facts the collection declared, and only the ones this document
286
+ has. Filled from the chips in the prose below — one editing surface,
287
+ not two. -->
288
+ <dl
289
+ v-if="facts.length && view.facts"
290
+ class="mt-8 grid grid-cols-[auto_1fr] gap-x-6 gap-y-2 border-t border-default pt-6 text-sm"
291
+ >
292
+ <template
293
+ v-for="(fact, i) in facts"
294
+ :key="fact.key"
295
+ >
296
+ <dt
297
+ v-motion="junMotion(junStagger(Math.min(i, 6), { delayMs: 40 }))"
298
+ class="text-xs tracking-[0.18em] text-dimmed uppercase"
299
+ >
300
+ {{ fact.label }}
301
+ </dt>
302
+ <dd class="min-w-0 text-highlighted">
303
+ <span
304
+ v-if="fact.rating"
305
+ class="flex items-center gap-0.5"
306
+ :aria-label="`${fact.rating} out of 5`"
307
+ >
308
+ <UIcon
309
+ v-for="star in 5"
310
+ :key="star"
311
+ name="i-lucide-star"
312
+ class="size-3.5"
313
+ :class="star <= fact.rating ? 'fill-current text-highlighted' : 'text-dimmed opacity-40'"
314
+ />
315
+ </span>
316
+ <a
317
+ v-else-if="fact.url"
318
+ :href="fact.url"
319
+ target="_blank"
320
+ rel="noopener noreferrer"
321
+ class="break-all underline decoration-dotted underline-offset-4 hover:decoration-solid"
322
+ >{{ fact.value }}</a>
323
+ <span v-else>{{ fact.value }}</span>
324
+ </dd>
325
+ </template>
326
+ </dl>
327
+
328
+ <hr class="my-8 border-default">
329
+
330
+ <!-- The document's own prose. Read-only for visitors; the owner gets the
331
+ full editor, and its meta chips are where the facts above are set. -->
332
+ <div
333
+ class="jun-item-body"
334
+ :class="measureClass"
335
+ >
336
+ <JunSectionPresence :doc-id="docId">
337
+ <AEditor
338
+ :doc-id="docId"
339
+ :doc-label="title"
340
+ :doc-meta="meta"
341
+ :editable="editing"
342
+ :show-toolbar="editing"
343
+ :show-suggestion-menu="editing"
344
+ :show-drag-handle="editing"
345
+ :show-breadcrumb="false"
346
+ placeholder="Nothing written yet."
347
+ />
348
+ </JunSectionPresence>
349
+ </div>
350
+
351
+ <!-- The rest of the shelf. -->
352
+ <nav
353
+ v-if="neighbours.length && view.neighbours"
354
+ class="mt-12 border-t border-default pt-6"
355
+ >
356
+ <h2 class="mb-3 text-xs font-medium tracking-[0.22em] text-dimmed uppercase">
357
+ More from {{ parent?.label ?? "here" }}
358
+ </h2>
359
+ <ul class="flex flex-col gap-1.5">
360
+ <li
361
+ v-for="(sib, i) in neighbours"
362
+ :key="sib.id"
363
+ v-motion="junMotion(junStagger(Math.min(i, 4), { delayMs: 50 }))"
364
+ >
365
+ <NuxtLink
366
+ :to="getDocUrl(sib.id)"
367
+ class="group relative flex items-center gap-2 rounded-lg px-2 py-1.5 text-sm text-muted transition-colors hover:bg-black/5 hover:text-default dark:hover:bg-white/5"
368
+ :title="accentTitle(sib.id)"
369
+ >
370
+ <span
371
+ v-if="accentInsetStyle(sib.id)"
372
+ aria-hidden="true"
373
+ class="pointer-events-none absolute inset-0 rounded-[inherit]"
374
+ :style="accentInsetStyle(sib.id)"
375
+ />
376
+ <UIcon
377
+ :name="presentation?.icon ?? 'i-lucide-file-text'"
378
+ class="size-3.5 shrink-0 text-dimmed"
379
+ />
380
+ <span class="truncate">{{ sib.label }}</span>
381
+ <UIcon
382
+ name="i-lucide-arrow-right"
383
+ class="ml-auto size-3.5 shrink-0 opacity-0 transition-all duration-300 group-hover:translate-x-0.5 group-hover:opacity-60"
384
+ />
385
+ </NuxtLink>
386
+ </li>
387
+ </ul>
388
+ </nav>
389
+
390
+ <!-- What links here — the garden's half of a note page. Silent on a site with
391
+ no garden, and on a page nobody has cited. -->
392
+ <JunNoteLinks :doc-id="docId" />
393
+ </article>
394
+ </template>
395
+
396
+ <style scoped>
397
+ .jun-item-body :deep(.document-header){display:none}.jun-item-body :deep([data-meta-key=description]),.jun-item-body :deep([data-meta-key=excerpt]){display:none}.jun-item-body :deep(.ProseMirror),.jun-item-body :deep(.aeditor-canvas){padding:0}
398
+ </style>
@@ -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;