@abraca/junis 2.85.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 (152) hide show
  1. package/dist/module.d.mts +17 -2
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +235 -19
  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/JunFooter.vue +1 -1
  13. package/dist/runtime/components/JunHorizontalTimeline.d.vue.ts +30 -0
  14. package/dist/runtime/components/JunHorizontalTimeline.vue.d.ts +30 -0
  15. package/dist/runtime/components/JunLinksRow.d.vue.ts +16 -1
  16. package/dist/runtime/components/JunLinksRow.vue +17 -7
  17. package/dist/runtime/components/JunLinksRow.vue.d.ts +16 -1
  18. package/dist/runtime/components/JunMedia.client.d.vue.ts +1 -1
  19. package/dist/runtime/components/JunMedia.client.vue.d.ts +1 -1
  20. package/dist/runtime/components/JunNavigation.vue +21 -4
  21. package/dist/runtime/components/JunNoteLinks.d.vue.ts +6 -0
  22. package/dist/runtime/components/JunNoteLinks.vue +57 -0
  23. package/dist/runtime/components/JunNoteLinks.vue.d.ts +6 -0
  24. package/dist/runtime/components/JunPageHero.d.vue.ts +8 -2
  25. package/dist/runtime/components/JunPageHero.vue +15 -3
  26. package/dist/runtime/components/JunPageHero.vue.d.ts +8 -2
  27. package/dist/runtime/components/JunReaders.d.vue.ts +11 -0
  28. package/dist/runtime/components/JunReaders.vue +99 -0
  29. package/dist/runtime/components/JunReaders.vue.d.ts +11 -0
  30. package/dist/runtime/components/JunSearch.client.vue +2 -2
  31. package/dist/runtime/components/JunSectionPresence.client.d.vue.ts +17 -0
  32. package/dist/runtime/components/JunSectionPresence.client.vue +99 -0
  33. package/dist/runtime/components/JunSectionPresence.client.vue.d.ts +17 -0
  34. package/dist/runtime/components/JunThreadComposer.d.vue.ts +37 -0
  35. package/dist/runtime/components/JunThreadComposer.vue +54 -0
  36. package/dist/runtime/components/JunThreadComposer.vue.d.ts +37 -0
  37. package/dist/runtime/components/JunTravellersChip.vue +35 -5
  38. package/dist/runtime/components/JunVideoEmbed.client.d.vue.ts +1 -1
  39. package/dist/runtime/components/JunVideoEmbed.client.vue.d.ts +1 -1
  40. package/dist/runtime/components/JunViewControl.d.vue.ts +29 -0
  41. package/dist/runtime/components/JunViewControl.vue +340 -0
  42. package/dist/runtime/components/JunViewControl.vue.d.ts +29 -0
  43. package/dist/runtime/components/JunViewControls.d.vue.ts +27 -0
  44. package/dist/runtime/components/JunViewControls.vue +94 -0
  45. package/dist/runtime/components/JunViewControls.vue.d.ts +27 -0
  46. package/dist/runtime/components/renderers/JunAppsRenderer.vue +45 -4
  47. package/dist/runtime/components/renderers/JunCinemaRenderer.vue +42 -4
  48. package/dist/runtime/components/renderers/JunConfigRenderer.vue +348 -225
  49. package/dist/runtime/components/renderers/JunCourseRenderer.d.vue.ts +10 -0
  50. package/dist/runtime/components/renderers/JunCourseRenderer.vue +229 -0
  51. package/dist/runtime/components/renderers/JunCourseRenderer.vue.d.ts +10 -0
  52. package/dist/runtime/components/renderers/JunCvRenderer.vue +44 -6
  53. package/dist/runtime/components/renderers/JunDeckRenderer.d.vue.ts +9 -0
  54. package/dist/runtime/components/renderers/JunDeckRenderer.vue +370 -0
  55. package/dist/runtime/components/renderers/JunDeckRenderer.vue.d.ts +9 -0
  56. package/dist/runtime/components/renderers/JunEntryRenderer.vue +151 -23
  57. package/dist/runtime/components/renderers/JunFestivalRenderer.vue +41 -4
  58. package/dist/runtime/components/renderers/JunGardenRenderer.d.vue.ts +10 -0
  59. package/dist/runtime/components/renderers/JunGardenRenderer.vue +280 -0
  60. package/dist/runtime/components/renderers/JunGardenRenderer.vue.d.ts +10 -0
  61. package/dist/runtime/components/renderers/JunGuestbookRenderer.vue +96 -14
  62. package/dist/runtime/components/renderers/JunHomeRenderer.vue +28 -129
  63. package/dist/runtime/components/renderers/JunItemRenderer.d.vue.ts +10 -0
  64. package/dist/runtime/components/renderers/JunItemRenderer.vue +398 -0
  65. package/dist/runtime/components/renderers/JunItemRenderer.vue.d.ts +10 -0
  66. package/dist/runtime/components/renderers/JunJournalRenderer.vue +141 -11
  67. package/dist/runtime/components/renderers/JunLibraryRenderer.vue +295 -12
  68. package/dist/runtime/components/renderers/JunLinksRenderer.vue +33 -1
  69. package/dist/runtime/components/renderers/JunLiveRenderer.vue +37 -1
  70. package/dist/runtime/components/renderers/JunMosaicRenderer.vue +3 -2
  71. package/dist/runtime/components/renderers/JunMovieRenderer.vue +32 -5
  72. package/dist/runtime/components/renderers/JunNowRenderer.vue +38 -5
  73. package/dist/runtime/components/renderers/JunPollRenderer.d.vue.ts +9 -0
  74. package/dist/runtime/components/renderers/JunPollRenderer.vue +231 -0
  75. package/dist/runtime/components/renderers/JunPollRenderer.vue.d.ts +9 -0
  76. package/dist/runtime/components/renderers/JunProjectRenderer.vue +74 -18
  77. package/dist/runtime/components/renderers/JunServicesRenderer.vue +40 -2
  78. package/dist/runtime/components/renderers/JunStatsRenderer.vue +37 -50
  79. package/dist/runtime/components/renderers/JunThreadRenderer.d.vue.ts +9 -0
  80. package/dist/runtime/components/renderers/JunThreadRenderer.vue +304 -0
  81. package/dist/runtime/components/renderers/JunThreadRenderer.vue.d.ts +9 -0
  82. package/dist/runtime/components/renderers/JunTrackRenderer.vue +32 -4
  83. package/dist/runtime/components/renderers/JunUsesRenderer.vue +51 -5
  84. package/dist/runtime/components/renderers/JunWallRenderer.vue +60 -5
  85. package/dist/runtime/composables/useJunDeck.d.ts +66 -0
  86. package/dist/runtime/composables/useJunDeck.js +61 -0
  87. package/dist/runtime/composables/useJunDocPage.d.ts +14 -11
  88. package/dist/runtime/composables/useJunDocPage.js +67 -3
  89. package/dist/runtime/composables/useJunFollow.d.ts +65 -9
  90. package/dist/runtime/composables/useJunFollow.js +237 -20
  91. package/dist/runtime/composables/useJunGarden.d.ts +67 -0
  92. package/dist/runtime/composables/useJunGarden.js +92 -0
  93. package/dist/runtime/composables/useJunPresence.d.ts +26 -0
  94. package/dist/runtime/composables/useJunPresence.js +9 -2
  95. package/dist/runtime/composables/useJunSections.d.ts +73 -0
  96. package/dist/runtime/composables/useJunSections.js +117 -0
  97. package/dist/runtime/composables/useJunSettings.d.ts +1 -1
  98. package/dist/runtime/composables/useJunSettings.js +5 -1
  99. package/dist/runtime/composables/useJunSiteConfig.d.ts +37 -0
  100. package/dist/runtime/composables/useJunTheme.js +40 -2
  101. package/dist/runtime/composables/useJunViewOptions.d.ts +85 -0
  102. package/dist/runtime/composables/useJunViewOptions.js +63 -0
  103. package/dist/runtime/pages/doc.vue +14 -8
  104. package/dist/runtime/server/api/health.get.d.ts +19 -0
  105. package/dist/runtime/server/api/health.get.js +40 -0
  106. package/dist/runtime/server/api/links.get.d.ts +19 -0
  107. package/dist/runtime/server/api/links.get.js +37 -0
  108. package/dist/runtime/server/api/resolve/[...slug].get.d.ts +9 -0
  109. package/dist/runtime/server/api/resolve/[...slug].get.js +5 -0
  110. package/dist/runtime/server/api/stats.get.js +2 -1
  111. package/dist/runtime/server/janitor/junJanitorChores.js +8 -0
  112. package/dist/runtime/server/plugins/jun-bootstrap.js +103 -15
  113. package/dist/runtime/server/plugins/jun-doc-cache.js +42 -4
  114. package/dist/runtime/server/plugins/jun-janitor.js +7 -0
  115. package/dist/runtime/server/plugins/jun-rpc.js +293 -0
  116. package/dist/runtime/server/plugins/jun-watchdog.d.ts +2 -0
  117. package/dist/runtime/server/plugins/jun-watchdog.js +54 -0
  118. package/dist/runtime/server/routes/sitemap.xml.get.js +2 -0
  119. package/dist/runtime/server/utils/junBoot.d.ts +1 -0
  120. package/dist/runtime/server/utils/junBoot.js +4 -0
  121. package/dist/runtime/server/utils/junCache.d.ts +17 -0
  122. package/dist/runtime/server/utils/junCache.js +5 -0
  123. package/dist/runtime/server/utils/junSeedGate.d.ts +68 -0
  124. package/dist/runtime/server/utils/junSeedGate.js +41 -0
  125. package/dist/runtime/types.d.ts +57 -1
  126. package/dist/runtime/utils/junCourse.d.ts +106 -0
  127. package/dist/runtime/utils/junCourse.js +65 -0
  128. package/dist/runtime/utils/junGarden.d.ts +193 -0
  129. package/dist/runtime/utils/junGarden.js +233 -0
  130. package/dist/runtime/utils/junMetaSchemas.js +8 -1
  131. package/dist/runtime/utils/junModeration.d.ts +67 -0
  132. package/dist/runtime/utils/junModeration.js +20 -0
  133. package/dist/runtime/utils/junMotion.d.ts +26 -0
  134. package/dist/runtime/utils/junMotion.js +31 -0
  135. package/dist/runtime/utils/junPeople.d.ts +43 -0
  136. package/dist/runtime/utils/junPeople.js +9 -0
  137. package/dist/runtime/utils/junPoll.d.ts +79 -0
  138. package/dist/runtime/utils/junPoll.js +82 -0
  139. package/dist/runtime/utils/junReadiness.d.ts +131 -0
  140. package/dist/runtime/utils/junReadiness.js +69 -0
  141. package/dist/runtime/utils/junSections.d.ts +115 -0
  142. package/dist/runtime/utils/junSections.js +45 -0
  143. package/dist/runtime/utils/junSlides.d.ts +66 -0
  144. package/dist/runtime/utils/junSlides.js +47 -0
  145. package/dist/runtime/utils/junThread.d.ts +81 -0
  146. package/dist/runtime/utils/junThread.js +75 -0
  147. package/dist/runtime/utils/junViewSpecs.d.ts +671 -0
  148. package/dist/runtime/utils/junViewSpecs.js +534 -0
  149. package/dist/runtime/utils/junViewValues.d.ts +125 -0
  150. package/dist/runtime/utils/junViewValues.js +104 -0
  151. package/dist/types.d.mts +1 -1
  152. package/package.json +5 -1
@@ -16,8 +16,10 @@ import {
16
16
  useJunRename,
17
17
  useJunStudio,
18
18
  useJunUpload,
19
- useJunViewingAccent
19
+ useJunViewingAccent,
20
+ useJunViewOptions
20
21
  } from "#imports";
22
+ import { junViewSpecFor } from "../../utils/junViewSpecs";
21
23
  const props = defineProps({
22
24
  docId: { type: String, required: true },
23
25
  docLabel: { type: String, required: false },
@@ -36,6 +38,19 @@ const { uploadTo, imageFiles } = useJunUpload();
36
38
  const { typeIdFor } = useJunPageType();
37
39
  const { accentInsetStyle, accentTitle } = useJunViewingAccent();
38
40
  const entryType = computed(() => typeIdFor("entry"));
41
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
42
+ typeKey: "journal",
43
+ options: junViewSpecFor("journal")
44
+ }, () => props.docMeta);
45
+ const GRID_CLASS = {
46
+ 1: "grid-cols-1",
47
+ 2: "grid-cols-1 sm:grid-cols-2",
48
+ 3: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
49
+ 4: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4"
50
+ };
51
+ const gridClass = computed(
52
+ () => GRID_CLASS[Number(view.value.columns)] ?? GRID_CLASS[3]
53
+ );
39
54
  const pageTitle = computed(() => getEntry(props.docId)?.label ?? props.docLabel ?? "Journal");
40
55
  const pageSubtitle = computed(() => {
41
56
  const meta = getEntry(props.docId)?.meta;
@@ -54,8 +69,11 @@ const sorted = computed(() => {
54
69
  });
55
70
  const published = computed(() => sorted.value.filter((e) => !e.meta?.draft));
56
71
  const drafts = computed(() => editing.value ? sorted.value.filter((e) => !!e.meta?.draft) : []);
57
- const hero = computed(() => published.value[0] ?? null);
58
- const rest = computed(() => [...drafts.value, ...published.value.slice(1)]);
72
+ const featured = computed(() => view.value.featured && view.value.variant === "cards");
73
+ const hero = computed(() => featured.value ? published.value[0] ?? null : null);
74
+ const rest = computed(
75
+ () => featured.value ? [...drafts.value, ...published.value.slice(1)] : [...drafts.value, ...published.value]
76
+ );
59
77
  function createEntry() {
60
78
  if (!entryType.value) return;
61
79
  const id = tree.createChild(null, "New entry", entryType.value);
@@ -147,11 +165,33 @@ function corners(i) {
147
165
  onContainerDrop($event)"
148
166
  >
149
167
  <JunPageHero
168
+ :doc-id="docId"
150
169
  :title="pageTitle"
151
170
  :subtitle="pageSubtitle"
152
171
  :editable="editing"
153
172
  @rename="renamePage"
154
173
  @rename-subtitle="renameSubtitle"
174
+ >
175
+ <template #right>
176
+ <JunViewControls
177
+ v-if="editing"
178
+ :options="viewOptions"
179
+ :values="view"
180
+ :is-default="viewIsDefault"
181
+ @set="setView"
182
+ @reset="resetView"
183
+ />
184
+ </template>
185
+ </JunPageHero>
186
+
187
+ <!-- The page's own prose, above its children. Collapses to nothing
188
+ when the document has no body, which is every site that has never
189
+ written one. -->
190
+ <JunCollectionIntro
191
+ :doc-id="docId"
192
+ :doc-label="pageTitle"
193
+ :doc-meta="docMeta"
194
+ placeholder="What this journal is about…"
155
195
  />
156
196
 
157
197
  <div
@@ -220,7 +260,10 @@ function corners(i) {
220
260
  :style="accentInsetStyle(hero.id)"
221
261
  />
222
262
 
223
- <div class="relative h-48 overflow-hidden sm:h-56 md:h-64">
263
+ <div
264
+ v-if="view.covers"
265
+ class="relative h-48 overflow-hidden sm:h-56 md:h-64"
266
+ >
224
267
  <NuxtImg
225
268
  v-if="hero.meta?.coverUrl"
226
269
  :src="hero.meta.coverUrl"
@@ -247,7 +290,7 @@ function corners(i) {
247
290
  <div class="absolute inset-0 bg-linear-to-t from-black/70 via-black/10 to-transparent" />
248
291
 
249
292
  <div
250
- v-if="hero.meta?.tags?.length"
293
+ v-if="hero.meta?.tags?.length && view.tags"
251
294
  class="absolute top-3 left-3 flex flex-wrap gap-1"
252
295
  >
253
296
  <span
@@ -289,7 +332,7 @@ function corners(i) {
289
332
  {{ hero.label }}
290
333
  </h2>
291
334
  <p
292
- v-if="hero.meta?.excerpt"
335
+ v-if="hero.meta?.excerpt && view.excerpts"
293
336
  class="mt-3 line-clamp-3 max-w-prose text-base text-muted italic sm:text-lg"
294
337
  >
295
338
  {{ hero.meta.excerpt }}
@@ -309,8 +352,9 @@ function corners(i) {
309
352
 
310
353
  <!-- The rest. Owner drafts lead, badged. -->
311
354
  <section
312
- v-if="rest.length"
313
- class="grid grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-5 lg:grid-cols-3"
355
+ v-if="rest.length && view.variant === 'cards'"
356
+ class="grid gap-4 sm:gap-5"
357
+ :class="gridClass"
314
358
  >
315
359
  <JunItemMenu
316
360
  v-for="(entry, i) in rest"
@@ -344,7 +388,10 @@ function corners(i) {
344
388
  :style="accentInsetStyle(entry.id)"
345
389
  />
346
390
 
347
- <div class="relative h-36 overflow-hidden">
391
+ <div
392
+ v-if="view.covers"
393
+ class="relative h-36 overflow-hidden"
394
+ >
348
395
  <NuxtImg
349
396
  v-if="entry.meta?.coverUrl"
350
397
  :src="entry.meta.coverUrl"
@@ -370,7 +417,10 @@ function corners(i) {
370
417
  </div>
371
418
  </div>
372
419
 
373
- <div class="border-t border-default px-4 py-3.5">
420
+ <div
421
+ class="px-4 py-3.5"
422
+ :class="view.covers ? 'border-t border-default' : ''"
423
+ >
374
424
  <div
375
425
  v-if="editing"
376
426
  class="mb-1.5"
@@ -395,11 +445,24 @@ function corners(i) {
395
445
  {{ entry.label }}
396
446
  </h3>
397
447
  <p
398
- v-if="entry.meta?.excerpt"
448
+ v-if="entry.meta?.excerpt && view.excerpts"
399
449
  class="mt-1.5 line-clamp-2 text-xs text-muted"
400
450
  >
401
451
  {{ entry.meta.excerpt }}
402
452
  </p>
453
+ <!-- With covers off there is no image to overlay the tags on, so
454
+ they come inline. A card that shows nothing but a date and a
455
+ title is a list item that has forgotten it is a card. -->
456
+ <div
457
+ v-if="!view.covers && view.tags && entry.meta?.tags?.length"
458
+ class="mt-2 flex flex-wrap gap-1"
459
+ >
460
+ <span
461
+ v-for="t in entry.meta.tags.slice(0, 4)"
462
+ :key="t"
463
+ class="rounded bg-black/5 px-1.5 py-0.5 text-[10px] tracking-widest text-muted uppercase dark:bg-white/10"
464
+ >{{ t }}</span>
465
+ </div>
403
466
  </div>
404
467
 
405
468
  <span
@@ -415,6 +478,73 @@ function corners(i) {
415
478
  </NuxtLink>
416
479
  </JunItemMenu>
417
480
  </section>
481
+
482
+ <!-- INDEX — dated lines. For a journal with a hundred entries, where a
483
+ grid of covers is a scroll and a list is a page. Everything a card
484
+ carries except the picture: the date, the title, the excerpt, the
485
+ tags, the draft badge and the reading halo. -->
486
+ <ol
487
+ v-else-if="rest.length"
488
+ class="divide-y divide-black/8 dark:divide-white/8"
489
+ >
490
+ <JunItemMenu
491
+ v-for="(entry, i) in rest"
492
+ :key="entry.id"
493
+ :entry="entry"
494
+ :tree="tree"
495
+ no-open
496
+ >
497
+ <li>
498
+ <NuxtLink
499
+ v-motion="junMotion(junStagger(Math.min(i, 10), { delayMs: 40 }))"
500
+ :to="getDocUrl(entry.id)"
501
+ class="group relative -mx-3 flex items-baseline gap-4 rounded-lg px-3 py-3 transition-colors duration-200 hover:bg-black/[0.025] dark:hover:bg-white/[0.04]"
502
+ :class="editing ? dragId === entry.id ? 'cursor-grabbing opacity-70' : 'cursor-grab' : ''"
503
+ :title="accentTitle(entry.id)"
504
+ :draggable="editing ? true : void 0"
505
+ @dragstart="onItemDragStart(entry, $event)"
506
+ @dragend="onItemDragEnd($event)"
507
+ >
508
+ <span
509
+ v-if="accentInsetStyle(entry.id)"
510
+ aria-hidden="true"
511
+ class="pointer-events-none absolute inset-0 rounded-[inherit]"
512
+ :style="accentInsetStyle(entry.id)"
513
+ />
514
+ <time
515
+ class="w-20 shrink-0 text-[10px] font-medium tracking-[0.18em] text-dimmed uppercase tabular-nums"
516
+ >{{ junDateShort(entry.meta?.date) }}</time>
517
+ <span class="min-w-0 flex-1">
518
+ <span class="flex items-baseline gap-2">
519
+ <span class="truncate text-base font-medium tracking-tight text-highlighted">
520
+ {{ entry.label }}
521
+ </span>
522
+ <UIcon
523
+ v-if="entry.meta?.draft"
524
+ name="i-lucide-file-pen-line"
525
+ class="size-3 shrink-0 text-dimmed"
526
+ aria-label="Draft"
527
+ />
528
+ </span>
529
+ <span
530
+ v-if="entry.meta?.excerpt && view.excerpts"
531
+ class="mt-0.5 block truncate text-xs text-muted"
532
+ >{{ entry.meta.excerpt }}</span>
533
+ </span>
534
+ <span
535
+ v-if="view.tags && entry.meta?.tags?.length"
536
+ class="hidden shrink-0 gap-1 sm:flex"
537
+ >
538
+ <span
539
+ v-for="t in entry.meta.tags.slice(0, 2)"
540
+ :key="t"
541
+ class="rounded bg-black/5 px-1.5 py-0.5 text-[10px] tracking-widest text-muted uppercase dark:bg-white/10"
542
+ >{{ t }}</span>
543
+ </span>
544
+ </NuxtLink>
545
+ </li>
546
+ </JunItemMenu>
547
+ </ol>
418
548
  </template>
419
549
  </div>
420
550
  </template>
@@ -12,8 +12,10 @@ import {
12
12
  useJunRename,
13
13
  useJunStudio,
14
14
  useJunUpload,
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 },
@@ -44,6 +46,10 @@ function renameSubtitle(s) {
44
46
  const items = computed(
45
47
  () => (tree.childrenOf(null) ?? []).filter((e) => !!e.label)
46
48
  );
49
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
50
+ typeKey: "library",
51
+ options: junViewSpecFor("library")
52
+ }, () => props.docMeta);
47
53
  const SECTION_ORDER = [
48
54
  { status: "reading", title: "Reading now" },
49
55
  { status: "want", title: "Up next" },
@@ -71,15 +77,35 @@ const {
71
77
  groupValueFor: (section) => section === "unsorted" ? void 0 : section,
72
78
  ghostIconFor: () => "i-lucide-book"
73
79
  });
80
+ function arrange(list) {
81
+ const sort = view.value.sort;
82
+ if (sort === "manual") return list;
83
+ const out = [...list];
84
+ if (sort === "title") out.sort((a, b) => a.label.localeCompare(b.label));
85
+ else if (sort === "author") {
86
+ out.sort((a, b) => {
87
+ const x = a.meta?.author ?? "";
88
+ const y = b.meta?.author ?? "";
89
+ if (!x !== !y) return x ? -1 : 1;
90
+ return x.localeCompare(y);
91
+ });
92
+ } else if (sort === "rating") {
93
+ out.sort((a, b) => (b.meta?.rating ?? -1) - (a.meta?.rating ?? -1));
94
+ }
95
+ return out;
96
+ }
74
97
  const sections = computed(() => {
75
98
  const all = orderedItems.value;
99
+ if (view.value.group === "none") {
100
+ return [{ status: "all", title: "", items: arrange(all) }];
101
+ }
76
102
  const out = SECTION_ORDER.map((s) => ({
77
103
  ...s,
78
104
  // An entry with no status is "up next" — the state a book starts in.
79
- items: all.filter((e) => (e.meta?.status ?? "want") === s.status)
105
+ items: arrange(all.filter((e) => (e.meta?.status ?? "want") === s.status))
80
106
  })).filter((s) => s.items.length || editing.value);
81
107
  const known = new Set(SECTION_ORDER.map((s) => s.status));
82
- const unsorted = all.filter((e) => !known.has(e.meta?.status ?? "want"));
108
+ const unsorted = arrange(all.filter((e) => !known.has(e.meta?.status ?? "want")));
83
109
  if (unsorted.length) out.push({ status: "unsorted", title: "Unsorted", items: unsorted });
84
110
  return out;
85
111
  });
@@ -88,6 +114,17 @@ function addEntry(status) {
88
114
  tree.updateMeta(id, { status });
89
115
  }
90
116
  const statusOptions = [...JUN_LIBRARY_STATUSES];
117
+ function spineHeight(id) {
118
+ return 128 + idHash(id) % 7 * 8;
119
+ }
120
+ function blankShade(id) {
121
+ return 3 + idHash(id) % 5 * 2;
122
+ }
123
+ function idHash(id) {
124
+ let hash = 0;
125
+ for (let i = 0; i < id.length; i++) hash = hash * 31 + id.charCodeAt(i) | 0;
126
+ return Math.abs(hash);
127
+ }
91
128
  function setRating(entry, value) {
92
129
  const next = (entry.meta?.rating ?? 0) === value ? void 0 : value;
93
130
  tree.updateMeta(entry.id, { rating: next });
@@ -111,13 +148,40 @@ async function onRowDrop(entry, e) {
111
148
  </script>
112
149
 
113
150
  <template>
114
- <div class="relative mx-auto w-full max-w-3xl px-4 pt-12 pb-16 sm:px-8">
151
+ <!-- A cover grid needs more room than a list of rows, so the reading column
152
+ follows the variant. `max-w-3xl` is what this page always was. -->
153
+ <div
154
+ class="relative mx-auto w-full px-4 pt-12 pb-16 sm:px-8"
155
+ :class="view.variant === 'grid' ? 'max-w-5xl' : 'max-w-3xl'"
156
+ >
115
157
  <JunPageHero
158
+ :doc-id="docId"
116
159
  :title="pageTitle"
117
160
  :subtitle="subtitle"
118
161
  :editable="editing"
119
162
  @rename="renamePage"
120
163
  @rename-subtitle="renameSubtitle"
164
+ >
165
+ <template #right>
166
+ <JunViewControls
167
+ v-if="editing"
168
+ :options="viewOptions"
169
+ :values="view"
170
+ :is-default="viewIsDefault"
171
+ @set="setView"
172
+ @reset="resetView"
173
+ />
174
+ </template>
175
+ </JunPageHero>
176
+
177
+ <!-- The page's own prose, above its children. Collapses to nothing
178
+ when the document has no body, which is every site that has never
179
+ written one. -->
180
+ <JunCollectionIntro
181
+ :doc-id="docId"
182
+ :doc-label="pageTitle"
183
+ :doc-meta="docMeta"
184
+ placeholder="What these shelves are for…"
121
185
  />
122
186
 
123
187
  <div
@@ -143,11 +207,27 @@ async function onRowDrop(entry, e) {
143
207
  @dragleave="onGroupDragLeave($event)"
144
208
  @drop="onGroupDrop(section.status, $event)"
145
209
  >
146
- <div class="mb-3 flex items-baseline gap-3 px-1">
147
- <h2 class="text-xs font-medium tracking-[0.22em] text-dimmed uppercase">
210
+ <!-- Ungrouped, the only shelf has no name, so the rule and the heading
211
+ go with it — and the row survives for the owner, because the add
212
+ button lives in it. -->
213
+ <div
214
+ v-if="section.title || editing"
215
+ class="mb-3 flex items-baseline gap-3 px-1"
216
+ >
217
+ <h2
218
+ v-if="section.title"
219
+ class="text-xs font-medium tracking-[0.22em] text-dimmed uppercase"
220
+ >
148
221
  {{ section.title }}
149
222
  </h2>
150
- <div class="h-px flex-1 bg-black/10 dark:bg-white/10" />
223
+ <div
224
+ v-if="section.title"
225
+ class="h-px flex-1 bg-black/10 dark:bg-white/10"
226
+ />
227
+ <div
228
+ v-else
229
+ class="flex-1"
230
+ />
151
231
  <UButton
152
232
  v-if="editing && section.status !== 'unsorted'"
153
233
  icon="i-lucide-plus"
@@ -155,11 +235,12 @@ async function onRowDrop(entry, e) {
155
235
  color="neutral"
156
236
  variant="ghost"
157
237
  aria-label="Add entry"
158
- @click="addEntry(section.status)"
238
+ @click="addEntry(section.status === 'all' ? 'want' : section.status)"
159
239
  />
160
240
  </div>
161
241
 
162
242
  <TransitionGroup
243
+ v-if="view.variant === 'rows'"
163
244
  tag="ul"
164
245
  name="jun-library"
165
246
  class="flex flex-col gap-3 px-1"
@@ -201,6 +282,7 @@ async function onRowDrop(entry, e) {
201
282
  />
202
283
 
203
284
  <span
285
+ v-if="view.covers"
204
286
  class="relative flex h-14 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md bg-black/5 text-black/50 ring-1 ring-black/5 dark:bg-white/10 dark:text-white/60 dark:ring-white/10"
205
287
  >
206
288
  <JunMedia
@@ -224,15 +306,21 @@ async function onRowDrop(entry, e) {
224
306
  {{ entry.label }}
225
307
  </span>
226
308
  <span
227
- v-if="entry.meta?.author"
309
+ v-if="entry.meta?.author && view.authors"
228
310
  class="block truncate text-xs text-muted sm:text-sm"
229
311
  >
230
312
  {{ entry.meta.author }}
231
313
  </span>
314
+ <span
315
+ v-if="entry.meta?.description"
316
+ class="mt-0.5 block truncate text-xs text-dimmed"
317
+ >
318
+ {{ entry.meta.description }}
319
+ </span>
232
320
  </span>
233
321
 
234
322
  <span
235
- v-if="entry.meta?.rating || editing"
323
+ v-if="view.ratings && (entry.meta?.rating || editing)"
236
324
  class="flex shrink-0 items-center gap-0.5"
237
325
  @click.stop.prevent
238
326
  >
@@ -273,7 +361,8 @@ async function onRowDrop(entry, e) {
273
361
 
274
362
  <div
275
363
  v-if="editing"
276
- class="mt-1.5 flex flex-wrap gap-1.5 pr-2 pl-14"
364
+ class="mt-1.5 flex flex-wrap gap-1.5 pr-2"
365
+ :class="view.covers ? 'pl-14' : 'pl-4'"
277
366
  >
278
367
  <AMetaChip
279
368
  field-type="select"
@@ -299,10 +388,204 @@ async function onRowDrop(entry, e) {
299
388
  meta-key="url"
300
389
  @patch="tree.updateMeta(entry.id, $event)"
301
390
  />
391
+ <AMetaChip
392
+ field-type="text"
393
+ label="Description"
394
+ icon="i-lucide-text"
395
+ :meta="entry.meta ?? {}"
396
+ meta-key="description"
397
+ @patch="tree.updateMeta(entry.id, $event)"
398
+ />
302
399
  </div>
303
400
  </li>
304
401
  </TransitionGroup>
305
402
 
403
+ <!-- COVERS — cover-forward, for a shelf whose books have artwork.
404
+ `grid-cols-2` is stated rather than implied: a `grid` with no base
405
+ column count gets ONE implicit `max-content` column, which overflows
406
+ the viewport on a phone (see CLAUDE.md).
407
+
408
+ The meta chips are deliberately absent here and on the shelf. They
409
+ are a row of four editors per book — three lines of chrome under a
410
+ piece of artwork — and every one of them is reachable on the book's
411
+ own page and from its context menu. -->
412
+ <TransitionGroup
413
+ v-else-if="view.variant === 'grid'"
414
+ tag="ul"
415
+ name="jun-library"
416
+ class="grid grid-cols-2 gap-4 px-1 sm:grid-cols-3 lg:grid-cols-4"
417
+ >
418
+ <li
419
+ v-for="(entry, i) in section.items"
420
+ :key="entry.id"
421
+ v-motion="junMotion(junStagger(Math.min(si * 2 + i, 8), { delayMs: 50 }))"
422
+ :data-dnd-id="entry.id"
423
+ :draggable="editing ? true : void 0"
424
+ :class="[
425
+ 'rounded-xl transition-[transform,box-shadow,opacity] duration-200',
426
+ editing ? dragId === entry.id ? 'cursor-grabbing' : 'cursor-grab' : '',
427
+ dragId === entry.id ? 'scale-[1.02] opacity-90 shadow-lg shadow-black/20' : ''
428
+ ]"
429
+ @dragstart="onItemDragStart(entry, $event)"
430
+ @dragend="onItemDragEnd($event)"
431
+ >
432
+ <JunItemMenu
433
+ :entry="entry"
434
+ :tree="tree"
435
+ :siblings="section.items.map((e) => e.id)"
436
+ no-open
437
+ >
438
+ <NuxtLink
439
+ :to="getDocUrl(entry.id)"
440
+ class="jun-card group relative block overflow-hidden rounded-xl transition-all duration-300 hover:scale-[1.02] hover:shadow-xl"
441
+ :class="coverDropId === entry.id ? 'ring-2 ring-black/40 dark:ring-white/50' : ''"
442
+ :title="accentTitle(entry.id)"
443
+ @dragover="onRowDragOver(entry, $event)"
444
+ @dragleave="coverDropId === entry.id && (coverDropId = null)"
445
+ @drop="onRowDrop(entry, $event)"
446
+ >
447
+ <span
448
+ v-if="accentInsetStyle(entry.id)"
449
+ aria-hidden="true"
450
+ class="pointer-events-none absolute inset-0 z-10 rounded-[inherit]"
451
+ :style="accentInsetStyle(entry.id)"
452
+ />
453
+
454
+ <span
455
+ v-if="view.covers"
456
+ class="relative flex aspect-2/3 w-full items-center justify-center overflow-hidden bg-black/5 text-black/40 dark:bg-white/10 dark:text-white/50"
457
+ >
458
+ <JunMedia
459
+ v-if="entry.meta?.coverUploadId"
460
+ :doc-id="entry.id"
461
+ :upload-id="entry.meta.coverUploadId"
462
+ :mime-type="entry.meta.coverMimeType || 'image/jpeg'"
463
+ :alt="entry.label"
464
+ :size="512"
465
+ media-class="h-full w-full object-cover transition-transform duration-500 group-hover:scale-[1.04]"
466
+ />
467
+ <!-- No artwork: SET the title rather than showing an icon in
468
+ the middle of an empty 2:3 rectangle. A grid of grey
469
+ blocks with one small glyph each is what this variant
470
+ looked like on the demo site, where no book has a cover —
471
+ which is every site until somebody uploads one, so the
472
+ empty case is the common case and has to be composed
473
+ rather than merely handled.
474
+
475
+ Neutral, and shaded from the id: colour enters this site
476
+ through the backdrop and presence only. -->
477
+ <span
478
+ v-else
479
+ class="jun-book-blank flex h-full w-full flex-col justify-between p-3 text-left"
480
+ :style="{ '--jun-book-shade': `${blankShade(entry.id)}%` }"
481
+ >
482
+ <span class="text-[13px] leading-snug font-medium text-highlighted/85">
483
+ {{ entry.label }}
484
+ </span>
485
+ <span
486
+ v-if="entry.meta?.author"
487
+ class="text-[10px] tracking-wide text-muted uppercase"
488
+ >{{ entry.meta.author }}</span>
489
+ </span>
490
+ </span>
491
+
492
+ <!-- The caption does NOT repeat what a generated cover already
493
+ says. With artwork it carries the title and the author,
494
+ because the picture cannot; without it, the cover IS the
495
+ title set in type, and printing it again underneath read as
496
+ a bug rather than as a caption. -->
497
+ <span
498
+ v-if="entry.meta?.coverUploadId || !view.covers || view.ratings && entry.meta?.rating"
499
+ class="block px-3 py-2.5"
500
+ >
501
+ <span
502
+ v-if="entry.meta?.coverUploadId || !view.covers"
503
+ class="block truncate text-sm font-medium tracking-wide text-highlighted"
504
+ >
505
+ {{ entry.label }}
506
+ </span>
507
+ <span
508
+ v-if="entry.meta?.author && view.authors && (entry.meta?.coverUploadId || !view.covers)"
509
+ class="block truncate text-xs text-muted"
510
+ >
511
+ {{ entry.meta.author }}
512
+ </span>
513
+ <span
514
+ v-if="view.ratings && entry.meta?.rating"
515
+ class="flex items-center gap-0.5"
516
+ >
517
+ <UIcon
518
+ v-for="star in 5"
519
+ :key="star"
520
+ name="i-lucide-star"
521
+ class="size-3"
522
+ :class="star <= (entry.meta?.rating ?? 0) ? 'fill-current text-highlighted' : 'text-dimmed opacity-30'"
523
+ />
524
+ </span>
525
+ </span>
526
+ </NuxtLink>
527
+ </JunItemMenu>
528
+ </li>
529
+ </TransitionGroup>
530
+
531
+ <!-- SHELF — spines, standing on a rule. The most compact way to show a
532
+ hundred books, and the only one that reads as a bookshelf.
533
+
534
+ Heights vary from a hash of the id: a row of identical rectangles
535
+ reads as a chart, and a shelf of real books does not have one
536
+ height. It is derived rather than random so a book keeps its own
537
+ height across renders, reloads and peers. -->
538
+ <TransitionGroup
539
+ v-else
540
+ tag="ul"
541
+ name="jun-library"
542
+ class="flex flex-wrap items-end gap-1.5 border-b border-black/10 px-1 pb-1 dark:border-white/10"
543
+ >
544
+ <li
545
+ v-for="(entry, i) in section.items"
546
+ :key="entry.id"
547
+ v-motion="junMotion(junStagger(Math.min(si * 2 + i, 10), { delayMs: 40 }))"
548
+ :data-dnd-id="entry.id"
549
+ :draggable="editing ? true : void 0"
550
+ :class="[
551
+ 'transition-[transform,opacity] duration-200',
552
+ editing ? dragId === entry.id ? 'cursor-grabbing' : 'cursor-grab' : '',
553
+ dragId === entry.id ? 'scale-[1.04] opacity-90' : ''
554
+ ]"
555
+ @dragstart="onItemDragStart(entry, $event)"
556
+ @dragend="onItemDragEnd($event)"
557
+ >
558
+ <JunItemMenu
559
+ :entry="entry"
560
+ :tree="tree"
561
+ :siblings="section.items.map((e) => e.id)"
562
+ no-open
563
+ >
564
+ <NuxtLink
565
+ :to="getDocUrl(entry.id)"
566
+ class="jun-spine jun-card group relative flex flex-col items-center justify-between gap-1 rounded-sm px-1.5 py-2 transition-all duration-300 hover:-translate-y-1 hover:shadow-xl"
567
+ :style="{ height: `${spineHeight(entry.id)}px` }"
568
+ :title="accentTitle(entry.id) ?? `${entry.label}${entry.meta?.author ? ` \u2014 ${entry.meta.author}` : ''}`"
569
+ >
570
+ <span
571
+ v-if="accentInsetStyle(entry.id)"
572
+ aria-hidden="true"
573
+ class="pointer-events-none absolute inset-0 rounded-[inherit]"
574
+ :style="accentInsetStyle(entry.id)"
575
+ />
576
+ <span class="jun-spine-text min-h-0 flex-1 text-[11px] font-medium tracking-wide text-highlighted">
577
+ {{ entry.label }}
578
+ </span>
579
+ <UIcon
580
+ v-if="view.ratings && entry.meta?.rating"
581
+ name="i-lucide-star"
582
+ class="size-2.5 shrink-0 fill-current text-dimmed"
583
+ />
584
+ </NuxtLink>
585
+ </JunItemMenu>
586
+ </li>
587
+ </TransitionGroup>
588
+
306
589
  <p
307
590
  v-if="editing && !section.items.length"
308
591
  class="px-1 text-xs text-dimmed italic"
@@ -315,5 +598,5 @@ async function onRowDrop(entry, e) {
315
598
  </template>
316
599
 
317
600
  <style scoped>
318
- .jun-library-move{transition:transform .32s cubic-bezier(.22,1,.36,1)}.jun-library-enter-active{transition:opacity .3s ease,transform .3s cubic-bezier(.22,1,.36,1)}.jun-library-leave-active{position:absolute;transition:opacity .2s ease}.jun-library-enter-from,.jun-library-leave-to{opacity:0;transform:translateY(-6px)}@media (prefers-reduced-motion:reduce){.jun-library-enter-active,.jun-library-leave-active,.jun-library-move{transition:none}}
601
+ .jun-spine{width:2.25rem}.jun-book-blank{background:linear-gradient(160deg,color-mix(in srgb,currentColor var(--jun-book-shade,5%),transparent),transparent 70%);box-shadow:inset 1px 0 0 color-mix(in srgb,currentColor 8%,transparent)}.jun-spine-text{overflow:hidden;text-orientation:mixed;text-overflow:ellipsis;white-space:nowrap;writing-mode:vertical-rl}.jun-library-move{transition:transform .32s cubic-bezier(.22,1,.36,1)}.jun-library-enter-active{transition:opacity .3s ease,transform .3s cubic-bezier(.22,1,.36,1)}.jun-library-leave-active{position:absolute;transition:opacity .2s ease}.jun-library-enter-from,.jun-library-leave-to{opacity:0;transform:translateY(-6px)}@media (prefers-reduced-motion:reduce){.jun-library-enter-active,.jun-library-leave-active,.jun-library-move{transition:none}}
319
602
  </style>