@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.
- package/dist/module.d.mts +17 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +253 -21
- package/dist/runtime/assets/css/jun.css +1 -1
- package/dist/runtime/components/JunCampfirePresence.client.vue +75 -10
- package/dist/runtime/components/JunCollectionIntro.d.vue.ts +11 -0
- package/dist/runtime/components/JunCollectionIntro.vue +45 -0
- package/dist/runtime/components/JunCollectionIntro.vue.d.ts +11 -0
- package/dist/runtime/components/JunConfigRow.d.vue.ts +43 -0
- package/dist/runtime/components/JunConfigRow.vue +34 -0
- package/dist/runtime/components/JunConfigRow.vue.d.ts +43 -0
- package/dist/runtime/components/JunDocSurface.vue +3 -0
- package/dist/runtime/components/JunFooter.vue +1 -1
- package/dist/runtime/components/JunHorizontalTimeline.d.vue.ts +30 -0
- package/dist/runtime/components/JunHorizontalTimeline.vue.d.ts +30 -0
- package/dist/runtime/components/JunLinksRow.d.vue.ts +16 -1
- package/dist/runtime/components/JunLinksRow.vue +17 -7
- package/dist/runtime/components/JunLinksRow.vue.d.ts +16 -1
- package/dist/runtime/components/JunMedia.client.d.vue.ts +1 -1
- package/dist/runtime/components/JunMedia.client.vue.d.ts +1 -1
- package/dist/runtime/components/JunNavigation.vue +21 -4
- package/dist/runtime/components/JunNoteLinks.d.vue.ts +6 -0
- package/dist/runtime/components/JunNoteLinks.vue +57 -0
- package/dist/runtime/components/JunNoteLinks.vue.d.ts +6 -0
- package/dist/runtime/components/JunPageHero.d.vue.ts +8 -2
- package/dist/runtime/components/JunPageHero.vue +15 -3
- package/dist/runtime/components/JunPageHero.vue.d.ts +8 -2
- package/dist/runtime/components/JunReaders.d.vue.ts +11 -0
- package/dist/runtime/components/JunReaders.vue +99 -0
- package/dist/runtime/components/JunReaders.vue.d.ts +11 -0
- package/dist/runtime/components/JunSearch.client.vue +2 -2
- package/dist/runtime/components/JunSectionPresence.d.vue.ts +17 -0
- package/dist/runtime/components/JunSectionPresence.vue +99 -0
- package/dist/runtime/components/JunSectionPresence.vue.d.ts +17 -0
- package/dist/runtime/components/JunThreadComposer.d.vue.ts +37 -0
- package/dist/runtime/components/JunThreadComposer.vue +54 -0
- package/dist/runtime/components/JunThreadComposer.vue.d.ts +37 -0
- package/dist/runtime/components/JunTravellersChip.vue +35 -5
- package/dist/runtime/components/JunVideoEmbed.client.d.vue.ts +1 -1
- package/dist/runtime/components/JunVideoEmbed.client.vue.d.ts +1 -1
- package/dist/runtime/components/JunViewControl.d.vue.ts +29 -0
- package/dist/runtime/components/JunViewControl.vue +340 -0
- package/dist/runtime/components/JunViewControl.vue.d.ts +29 -0
- package/dist/runtime/components/JunViewControls.d.vue.ts +27 -0
- package/dist/runtime/components/JunViewControls.vue +94 -0
- package/dist/runtime/components/JunViewControls.vue.d.ts +27 -0
- package/dist/runtime/components/renderers/JunAppsRenderer.vue +45 -4
- package/dist/runtime/components/renderers/JunCinemaRenderer.vue +42 -4
- package/dist/runtime/components/renderers/JunConfigRenderer.vue +348 -225
- package/dist/runtime/components/renderers/JunCourseRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunCourseRenderer.vue +229 -0
- package/dist/runtime/components/renderers/JunCourseRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunCvRenderer.vue +44 -6
- package/dist/runtime/components/renderers/JunDeckRenderer.d.vue.ts +9 -0
- package/dist/runtime/components/renderers/JunDeckRenderer.vue +370 -0
- package/dist/runtime/components/renderers/JunDeckRenderer.vue.d.ts +9 -0
- package/dist/runtime/components/renderers/JunEntryRenderer.vue +151 -23
- package/dist/runtime/components/renderers/JunFestivalRenderer.vue +41 -4
- package/dist/runtime/components/renderers/JunGardenRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunGardenRenderer.vue +280 -0
- package/dist/runtime/components/renderers/JunGardenRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunGlobeRenderer.vue +43 -26
- package/dist/runtime/components/renderers/JunGuestbookRenderer.vue +96 -14
- package/dist/runtime/components/renderers/JunHomeRenderer.vue +28 -129
- package/dist/runtime/components/renderers/JunItemRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunItemRenderer.vue +398 -0
- package/dist/runtime/components/renderers/JunItemRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunJournalRenderer.vue +141 -11
- package/dist/runtime/components/renderers/JunLibraryRenderer.vue +295 -12
- package/dist/runtime/components/renderers/JunLinksRenderer.vue +33 -1
- package/dist/runtime/components/renderers/JunLiveRenderer.vue +37 -1
- package/dist/runtime/components/renderers/JunMosaicRenderer.vue +3 -2
- package/dist/runtime/components/renderers/JunMovieRenderer.vue +32 -5
- package/dist/runtime/components/renderers/JunNowRenderer.vue +38 -5
- package/dist/runtime/components/renderers/JunPollRenderer.d.vue.ts +9 -0
- package/dist/runtime/components/renderers/JunPollRenderer.vue +231 -0
- package/dist/runtime/components/renderers/JunPollRenderer.vue.d.ts +9 -0
- package/dist/runtime/components/renderers/JunProjectRenderer.vue +74 -18
- package/dist/runtime/components/renderers/JunServicesRenderer.vue +40 -2
- package/dist/runtime/components/renderers/JunStatsRenderer.vue +37 -50
- package/dist/runtime/components/renderers/JunThreadRenderer.d.vue.ts +9 -0
- package/dist/runtime/components/renderers/JunThreadRenderer.vue +304 -0
- package/dist/runtime/components/renderers/JunThreadRenderer.vue.d.ts +9 -0
- package/dist/runtime/components/renderers/JunTrackRenderer.vue +32 -4
- package/dist/runtime/components/renderers/JunUsesRenderer.vue +51 -5
- package/dist/runtime/components/renderers/JunWallRenderer.vue +60 -5
- package/dist/runtime/composables/useJunDeck.d.ts +66 -0
- package/dist/runtime/composables/useJunDeck.js +61 -0
- package/dist/runtime/composables/useJunDocPage.d.ts +14 -11
- package/dist/runtime/composables/useJunDocPage.js +67 -3
- package/dist/runtime/composables/useJunFollow.d.ts +65 -9
- package/dist/runtime/composables/useJunFollow.js +237 -20
- package/dist/runtime/composables/useJunGarden.d.ts +67 -0
- package/dist/runtime/composables/useJunGarden.js +92 -0
- package/dist/runtime/composables/useJunPresence.d.ts +26 -0
- package/dist/runtime/composables/useJunPresence.js +9 -2
- package/dist/runtime/composables/useJunSections.d.ts +73 -0
- package/dist/runtime/composables/useJunSections.js +117 -0
- package/dist/runtime/composables/useJunSettings.d.ts +1 -1
- package/dist/runtime/composables/useJunSettings.js +5 -1
- package/dist/runtime/composables/useJunSiteConfig.d.ts +37 -0
- package/dist/runtime/composables/useJunTheme.js +40 -2
- package/dist/runtime/composables/useJunViewOptions.d.ts +85 -0
- package/dist/runtime/composables/useJunViewOptions.js +63 -0
- package/dist/runtime/pages/doc.vue +52 -42
- package/dist/runtime/pages/index.vue +61 -35
- package/dist/runtime/plugins/jun-doc-tree.d.ts +2 -0
- package/dist/runtime/plugins/jun-doc-tree.js +26 -0
- package/dist/runtime/server/api/health.get.d.ts +19 -0
- package/dist/runtime/server/api/health.get.js +40 -0
- package/dist/runtime/server/api/links.get.d.ts +19 -0
- package/dist/runtime/server/api/links.get.js +37 -0
- package/dist/runtime/server/api/resolve/[...slug].get.d.ts +9 -0
- package/dist/runtime/server/api/resolve/[...slug].get.js +7 -2
- package/dist/runtime/server/api/stats.get.js +2 -1
- package/dist/runtime/server/api/tree.get.d.ts +9 -0
- package/dist/runtime/server/api/tree.get.js +23 -0
- package/dist/runtime/server/janitor/junJanitorActor.d.ts +13 -0
- package/dist/runtime/server/janitor/junJanitorActor.js +36 -5
- package/dist/runtime/server/janitor/junJanitorChores.js +8 -0
- package/dist/runtime/server/plugins/jun-bootstrap.js +103 -15
- package/dist/runtime/server/plugins/jun-doc-cache.js +42 -4
- package/dist/runtime/server/plugins/jun-janitor.js +7 -0
- package/dist/runtime/server/plugins/jun-rpc.js +293 -0
- package/dist/runtime/server/plugins/jun-watchdog.d.ts +2 -0
- package/dist/runtime/server/plugins/jun-watchdog.js +54 -0
- package/dist/runtime/server/routes/sitemap.xml.get.js +2 -0
- package/dist/runtime/server/utils/junBoot.d.ts +1 -0
- package/dist/runtime/server/utils/junBoot.js +4 -0
- package/dist/runtime/server/utils/junCache.d.ts +17 -0
- package/dist/runtime/server/utils/junCache.js +5 -0
- package/dist/runtime/server/utils/junSeedGate.d.ts +68 -0
- package/dist/runtime/server/utils/junSeedGate.js +41 -0
- package/dist/runtime/types.d.ts +57 -1
- package/dist/runtime/utils/junCourse.d.ts +106 -0
- package/dist/runtime/utils/junCourse.js +65 -0
- package/dist/runtime/utils/junGarden.d.ts +193 -0
- package/dist/runtime/utils/junGarden.js +233 -0
- package/dist/runtime/utils/junMetaSchemas.js +8 -1
- package/dist/runtime/utils/junModeration.d.ts +67 -0
- package/dist/runtime/utils/junModeration.js +20 -0
- package/dist/runtime/utils/junMotion.d.ts +26 -0
- package/dist/runtime/utils/junMotion.js +31 -0
- package/dist/runtime/utils/junPeople.d.ts +43 -0
- package/dist/runtime/utils/junPeople.js +9 -0
- package/dist/runtime/utils/junPoll.d.ts +79 -0
- package/dist/runtime/utils/junPoll.js +82 -0
- package/dist/runtime/utils/junReadiness.d.ts +131 -0
- package/dist/runtime/utils/junReadiness.js +69 -0
- package/dist/runtime/utils/junSections.d.ts +115 -0
- package/dist/runtime/utils/junSections.js +45 -0
- package/dist/runtime/utils/junSlides.d.ts +66 -0
- package/dist/runtime/utils/junSlides.js +47 -0
- package/dist/runtime/utils/junThread.d.ts +81 -0
- package/dist/runtime/utils/junThread.js +75 -0
- package/dist/runtime/utils/junViewSpecs.d.ts +671 -0
- package/dist/runtime/utils/junViewSpecs.js +534 -0
- package/dist/runtime/utils/junViewValues.d.ts +125 -0
- package/dist/runtime/utils/junViewValues.js +104 -0
- package/dist/types.d.mts +1 -1
- package/package.json +5 -1
|
@@ -10,9 +10,11 @@ import {
|
|
|
10
10
|
useJunRename,
|
|
11
11
|
useJunStudio,
|
|
12
12
|
useJunViewingAccent,
|
|
13
|
+
useJunViewOptions,
|
|
13
14
|
useToast,
|
|
14
15
|
useTrash
|
|
15
16
|
} from "#imports";
|
|
17
|
+
import { junViewSpecFor } from "../../utils/junViewSpecs";
|
|
16
18
|
const props = defineProps({
|
|
17
19
|
docId: { type: String, required: true },
|
|
18
20
|
docLabel: { type: String, required: false },
|
|
@@ -26,6 +28,10 @@ const { getEntry } = useDocTree();
|
|
|
26
28
|
const { editing } = useJunStudio();
|
|
27
29
|
const { renameDoc } = useJunRename();
|
|
28
30
|
const { accentInsetStyle, accentTitle } = useJunViewingAccent();
|
|
31
|
+
const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
|
|
32
|
+
typeKey: "links",
|
|
33
|
+
options: junViewSpecFor("links")
|
|
34
|
+
}, () => props.docMeta);
|
|
29
35
|
const toast = useToast();
|
|
30
36
|
const { restoreFromTrash } = useTrash();
|
|
31
37
|
const pageTitle = computed(() => getEntry(props.docId)?.label ?? props.docLabel ?? "Links");
|
|
@@ -93,11 +99,33 @@ function deleteLink(entry) {
|
|
|
93
99
|
@drop="onContainerDrop"
|
|
94
100
|
>
|
|
95
101
|
<JunPageHero
|
|
102
|
+
:doc-id="docId"
|
|
96
103
|
:title="pageTitle"
|
|
97
104
|
:subtitle="subtitle"
|
|
98
105
|
:editable="editing"
|
|
99
106
|
@rename="renamePage"
|
|
100
107
|
@rename-subtitle="renameSubtitle"
|
|
108
|
+
>
|
|
109
|
+
<template #right>
|
|
110
|
+
<JunViewControls
|
|
111
|
+
v-if="editing"
|
|
112
|
+
:options="viewOptions"
|
|
113
|
+
:values="view"
|
|
114
|
+
:is-default="viewIsDefault"
|
|
115
|
+
@set="setView"
|
|
116
|
+
@reset="resetView"
|
|
117
|
+
/>
|
|
118
|
+
</template>
|
|
119
|
+
</JunPageHero>
|
|
120
|
+
|
|
121
|
+
<!-- The page's own prose, above its children. Collapses to nothing
|
|
122
|
+
when the document has no body, which is every site that has never
|
|
123
|
+
written one. -->
|
|
124
|
+
<JunCollectionIntro
|
|
125
|
+
:doc-id="docId"
|
|
126
|
+
:doc-label="pageTitle"
|
|
127
|
+
:doc-meta="docMeta"
|
|
128
|
+
placeholder="Why these links are here…"
|
|
101
129
|
/>
|
|
102
130
|
|
|
103
131
|
<div
|
|
@@ -131,7 +159,7 @@ function deleteLink(entry) {
|
|
|
131
159
|
v-else
|
|
132
160
|
tag="ul"
|
|
133
161
|
name="jun-links"
|
|
134
|
-
class="flex flex-col gap-3"
|
|
162
|
+
:class="view.variant === 'grid' ? 'grid grid-cols-1 gap-3 sm:grid-cols-2' : 'flex flex-col gap-3'"
|
|
135
163
|
>
|
|
136
164
|
<li
|
|
137
165
|
v-for="(entry, i) in orderedItems"
|
|
@@ -153,6 +181,10 @@ function deleteLink(entry) {
|
|
|
153
181
|
:accent="accentInsetStyle(entry.id)"
|
|
154
182
|
:accent-title="accentTitle(entry.id)"
|
|
155
183
|
:force-internal="editing"
|
|
184
|
+
:show-icon="!!view.icons"
|
|
185
|
+
:show-description="!!view.descriptions"
|
|
186
|
+
:show-host="!!view.hosts"
|
|
187
|
+
:compact="!!view.compact"
|
|
156
188
|
/>
|
|
157
189
|
<UButton
|
|
158
190
|
v-if="editing"
|
|
@@ -17,10 +17,12 @@ import {
|
|
|
17
17
|
useJunStudio,
|
|
18
18
|
useJunUpload,
|
|
19
19
|
useJunViewingAccent,
|
|
20
|
+
useJunViewOptions,
|
|
20
21
|
useToast,
|
|
21
22
|
useTrash
|
|
22
23
|
} from "#imports";
|
|
23
24
|
import { useJunImagePopup } from "../../composables/useJunImagePopup";
|
|
25
|
+
import { junViewSpecFor } from "../../utils/junViewSpecs";
|
|
24
26
|
const props = defineProps({
|
|
25
27
|
docId: { type: String, required: true },
|
|
26
28
|
docLabel: { type: String, required: false },
|
|
@@ -41,6 +43,14 @@ const { typeIdFor } = useJunPageType();
|
|
|
41
43
|
const { reverseGeocode } = useJunRouting();
|
|
42
44
|
const { openImagePopup } = useJunImagePopup();
|
|
43
45
|
const { accentStyle, accentTitle } = useJunViewingAccent();
|
|
46
|
+
const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
|
|
47
|
+
typeKey: "live",
|
|
48
|
+
options: junViewSpecFor("live")
|
|
49
|
+
}, () => props.docMeta);
|
|
50
|
+
const postClass = computed(() => [
|
|
51
|
+
view.value.variant === "timeline" ? "pl-12" : "",
|
|
52
|
+
view.value.spacing === "tight" ? "pb-4" : "pb-8"
|
|
53
|
+
]);
|
|
44
54
|
const toast = useToast();
|
|
45
55
|
const { restoreFromTrash } = useTrash();
|
|
46
56
|
const postType = computed(() => typeIdFor("now"));
|
|
@@ -286,11 +296,33 @@ function onFeedDrop(e) {
|
|
|
286
296
|
onContainerDrop($event)"
|
|
287
297
|
>
|
|
288
298
|
<JunPageHero
|
|
299
|
+
:doc-id="docId"
|
|
289
300
|
:title="pageTitle"
|
|
290
301
|
:subtitle="subtitle"
|
|
291
302
|
:editable="editing"
|
|
292
303
|
@rename="renamePage"
|
|
293
304
|
@rename-subtitle="renameSubtitle"
|
|
305
|
+
>
|
|
306
|
+
<template #right>
|
|
307
|
+
<JunViewControls
|
|
308
|
+
v-if="editing"
|
|
309
|
+
:options="viewOptions"
|
|
310
|
+
:values="view"
|
|
311
|
+
:is-default="viewIsDefault"
|
|
312
|
+
@set="setView"
|
|
313
|
+
@reset="resetView"
|
|
314
|
+
/>
|
|
315
|
+
</template>
|
|
316
|
+
</JunPageHero>
|
|
317
|
+
|
|
318
|
+
<!-- The page's own prose, above its children. Collapses to nothing
|
|
319
|
+
when the document has no body, which is every site that has never
|
|
320
|
+
written one. -->
|
|
321
|
+
<JunCollectionIntro
|
|
322
|
+
:doc-id="docId"
|
|
323
|
+
:doc-label="pageTitle"
|
|
324
|
+
:doc-meta="docMeta"
|
|
325
|
+
placeholder="What you post here…"
|
|
294
326
|
/>
|
|
295
327
|
|
|
296
328
|
<div
|
|
@@ -456,7 +488,9 @@ function onFeedDrop(e) {
|
|
|
456
488
|
v-else
|
|
457
489
|
class="relative"
|
|
458
490
|
>
|
|
491
|
+
<!-- The rail and the per-post dot ARE the timeline variant. -->
|
|
459
492
|
<div
|
|
493
|
+
v-if="view.variant === 'timeline'"
|
|
460
494
|
aria-hidden="true"
|
|
461
495
|
class="absolute top-2 bottom-2 left-[19px] w-px bg-linear-to-b from-transparent via-black/15 to-transparent dark:via-white/15"
|
|
462
496
|
/>
|
|
@@ -466,9 +500,11 @@ function onFeedDrop(e) {
|
|
|
466
500
|
:key="entry.id"
|
|
467
501
|
v-motion="junMotion(junStagger(Math.min(i, 6), { delayMs: 60, durationMs: 450, yPx: 18 }))"
|
|
468
502
|
:data-jun-anchor="`doc:${entry.id}`"
|
|
469
|
-
class="relative
|
|
503
|
+
class="relative last:pb-0"
|
|
504
|
+
:class="postClass"
|
|
470
505
|
>
|
|
471
506
|
<div
|
|
507
|
+
v-if="view.variant === 'timeline'"
|
|
472
508
|
aria-hidden="true"
|
|
473
509
|
class="absolute top-4 left-[13px] h-[13px] w-[13px] rounded-full bg-white ring-2 ring-black/25 dark:bg-neutral-900 dark:ring-white/30"
|
|
474
510
|
/>
|
|
@@ -32,7 +32,7 @@ const { editing } = useJunStudio();
|
|
|
32
32
|
const { renameDoc } = useJunRename();
|
|
33
33
|
const { accentInsetStyle, accentTitle } = useJunViewingAccent();
|
|
34
34
|
const iconFor = useJunDocIcon();
|
|
35
|
-
const {
|
|
35
|
+
const { people } = useJunTravellers();
|
|
36
36
|
const brand = useJunBrand();
|
|
37
37
|
const opts = useJunOptions();
|
|
38
38
|
const ROW_UNIT = 120;
|
|
@@ -323,12 +323,13 @@ onMounted(() => {
|
|
|
323
323
|
onBeforeUnmount(() => {
|
|
324
324
|
if (clockTimer) clearInterval(clockTimer);
|
|
325
325
|
});
|
|
326
|
-
const hereNow = computed(() =>
|
|
326
|
+
const hereNow = computed(() => people.value.filter((t) => !t.idle).length);
|
|
327
327
|
</script>
|
|
328
328
|
|
|
329
329
|
<template>
|
|
330
330
|
<div class="relative mx-auto w-full max-w-7xl px-4 pt-12 pb-16 sm:px-8">
|
|
331
331
|
<JunPageHero
|
|
332
|
+
:doc-id="docId"
|
|
332
333
|
:title="pageTitle"
|
|
333
334
|
:subtitle="subtitle"
|
|
334
335
|
:editable="editing"
|
|
@@ -16,8 +16,10 @@ import {
|
|
|
16
16
|
useJunOptions,
|
|
17
17
|
useJunRename,
|
|
18
18
|
useJunStudio,
|
|
19
|
-
useJunUpload
|
|
19
|
+
useJunUpload,
|
|
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 },
|
|
@@ -104,6 +106,10 @@ function addChapter() {
|
|
|
104
106
|
const id = tree.createChild(null, `Chapter at ${junFormatTime(at)}`, "doc");
|
|
105
107
|
tree.updateMeta(id, { t: at });
|
|
106
108
|
}
|
|
109
|
+
const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
|
|
110
|
+
typeKey: "movie",
|
|
111
|
+
options: junViewSpecFor("movie")
|
|
112
|
+
}, () => props.docMeta);
|
|
107
113
|
const lightsOut = ref(false);
|
|
108
114
|
const playerEl = ref(null);
|
|
109
115
|
async function toggleFullscreen() {
|
|
@@ -207,8 +213,11 @@ const factLine = computed(
|
|
|
207
213
|
it recedes without the player having to move. `fixed` is safe here —
|
|
208
214
|
no ancestor of this renderer carries a transform. -->
|
|
209
215
|
<Transition name="jun-lights">
|
|
216
|
+
<!-- `&& view.lights`: turning the setting off while the lights are out must
|
|
217
|
+
take the scrim with it, or the button disappears and leaves a
|
|
218
|
+
full-viewport black layer nothing can dismiss. -->
|
|
210
219
|
<div
|
|
211
|
-
v-if="lightsOut"
|
|
220
|
+
v-if="lightsOut && view.lights"
|
|
212
221
|
class="fixed inset-0 z-20 bg-black/85"
|
|
213
222
|
aria-hidden="true"
|
|
214
223
|
@click="lightsOut = false"
|
|
@@ -230,13 +239,14 @@ const factLine = computed(
|
|
|
230
239
|
|
|
231
240
|
<div class="mt-2 flex flex-wrap items-center gap-3">
|
|
232
241
|
<p
|
|
233
|
-
v-if="factLine"
|
|
242
|
+
v-if="factLine && view.facts"
|
|
234
243
|
class="text-sm text-muted"
|
|
244
|
+
data-jun-movie="facts"
|
|
235
245
|
>
|
|
236
246
|
{{ factLine }}
|
|
237
247
|
</p>
|
|
238
248
|
<span
|
|
239
|
-
v-if="meta.rating"
|
|
249
|
+
v-if="meta.rating && view.rating"
|
|
240
250
|
class="flex items-center gap-0.5"
|
|
241
251
|
>
|
|
242
252
|
<UIcon
|
|
@@ -247,6 +257,21 @@ const factLine = computed(
|
|
|
247
257
|
:class="star <= (meta.rating ?? 0) ? 'fill-current text-highlighted' : 'text-dimmed opacity-40'"
|
|
248
258
|
/>
|
|
249
259
|
</span>
|
|
260
|
+
<!-- Watching the same thing at the same time is the one presence
|
|
261
|
+
signal a cinema page owes its visitors. -->
|
|
262
|
+
<ClientOnly>
|
|
263
|
+
<JunReaders :doc-id="docId" />
|
|
264
|
+
<!-- No `<JunPageHero>` here either — the title is the player's own
|
|
265
|
+
header — so the panel sits with the presence row. -->
|
|
266
|
+
<JunViewControls
|
|
267
|
+
v-if="editing"
|
|
268
|
+
:options="viewOptions"
|
|
269
|
+
:values="view"
|
|
270
|
+
:is-default="viewIsDefault"
|
|
271
|
+
@set="setView"
|
|
272
|
+
@reset="resetView"
|
|
273
|
+
/>
|
|
274
|
+
</ClientOnly>
|
|
250
275
|
</div>
|
|
251
276
|
|
|
252
277
|
<div
|
|
@@ -369,6 +394,7 @@ const factLine = computed(
|
|
|
369
394
|
|
|
370
395
|
<div class="mt-3 flex flex-wrap items-center gap-2">
|
|
371
396
|
<UButton
|
|
397
|
+
v-if="view.lights"
|
|
372
398
|
:icon="lightsOut ? 'i-lucide-sun' : 'i-lucide-moon'"
|
|
373
399
|
size="xs"
|
|
374
400
|
color="neutral"
|
|
@@ -438,8 +464,9 @@ const factLine = computed(
|
|
|
438
464
|
|
|
439
465
|
<!-- ── Chapters ────────────────────────────────────────────────────── -->
|
|
440
466
|
<section
|
|
441
|
-
v-if="chapters.length || editing"
|
|
467
|
+
v-if="view.chapters && (chapters.length || editing)"
|
|
442
468
|
class="mt-8"
|
|
469
|
+
data-jun-movie="chapters"
|
|
443
470
|
>
|
|
444
471
|
<div class="mb-3 flex items-baseline gap-3">
|
|
445
472
|
<h2 class="text-xs font-medium tracking-[0.22em] text-dimmed uppercase">
|
|
@@ -10,8 +10,10 @@ import {
|
|
|
10
10
|
useJunBrand,
|
|
11
11
|
useJunRouting,
|
|
12
12
|
useJunStudio,
|
|
13
|
-
useJunUpload
|
|
13
|
+
useJunUpload,
|
|
14
|
+
useJunViewOptions
|
|
14
15
|
} from "#imports";
|
|
16
|
+
import { junViewSpecFor } from "../../utils/junViewSpecs";
|
|
15
17
|
import { useJunImagePopup } from "../../composables/useJunImagePopup";
|
|
16
18
|
const props = defineProps({
|
|
17
19
|
docId: { type: String, required: true },
|
|
@@ -36,6 +38,10 @@ const entry = computed(() => getEntry(props.docId));
|
|
|
36
38
|
const meta = computed(() => entry.value?.meta ?? props.docMeta ?? {});
|
|
37
39
|
const metaRecord = computed(() => meta.value);
|
|
38
40
|
const title = computed(() => entry.value?.label ?? props.docLabel ?? "Post");
|
|
41
|
+
const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
|
|
42
|
+
typeKey: "now",
|
|
43
|
+
options: junViewSpecFor("now")
|
|
44
|
+
}, () => props.docMeta);
|
|
39
45
|
function fmtFull(s) {
|
|
40
46
|
if (!s) return "";
|
|
41
47
|
const d = new Date(s);
|
|
@@ -49,6 +55,22 @@ function fmtFull(s) {
|
|
|
49
55
|
minute: "2-digit"
|
|
50
56
|
});
|
|
51
57
|
}
|
|
58
|
+
const rtf = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
|
|
59
|
+
function fmtRelative(s) {
|
|
60
|
+
if (!s) return "";
|
|
61
|
+
const then = new Date(s).getTime();
|
|
62
|
+
if (Number.isNaN(then)) return s;
|
|
63
|
+
const min = Math.round((then - Date.now()) / 6e4);
|
|
64
|
+
if (Math.abs(min) < 60) return rtf.format(min, "minute");
|
|
65
|
+
const hours = Math.round(min / 60);
|
|
66
|
+
if (Math.abs(hours) < 24) return rtf.format(hours, "hour");
|
|
67
|
+
const days = Math.round(hours / 24);
|
|
68
|
+
if (Math.abs(days) < 30) return rtf.format(days, "day");
|
|
69
|
+
return rtf.format(Math.round(days / 30), "month");
|
|
70
|
+
}
|
|
71
|
+
const stamp = computed(
|
|
72
|
+
() => view.value.dates === "relative" ? fmtRelative(meta.value.date) : fmtFull(meta.value.date)
|
|
73
|
+
);
|
|
52
74
|
function patchMeta(patch) {
|
|
53
75
|
tree.updateMeta(props.docId, patch);
|
|
54
76
|
}
|
|
@@ -178,17 +200,28 @@ function commitText(field, e) {
|
|
|
178
200
|
{{ brand.name }}
|
|
179
201
|
</p>
|
|
180
202
|
<p class="text-xs text-dimmed">
|
|
181
|
-
{{
|
|
203
|
+
<span data-jun-now="stamp">{{ stamp }}</span>
|
|
182
204
|
</p>
|
|
183
205
|
</div>
|
|
184
206
|
|
|
185
207
|
<ClientOnly>
|
|
186
|
-
<
|
|
208
|
+
<div class="flex flex-wrap items-center gap-x-3 gap-y-1">
|
|
209
|
+
<JunAppreciate :doc-id="docId" />
|
|
210
|
+
<JunReaders :doc-id="docId" />
|
|
211
|
+
<JunViewControls
|
|
212
|
+
v-if="editing"
|
|
213
|
+
:options="viewOptions"
|
|
214
|
+
:values="view"
|
|
215
|
+
:is-default="viewIsDefault"
|
|
216
|
+
@set="setView"
|
|
217
|
+
@reset="resetView"
|
|
218
|
+
/>
|
|
219
|
+
</div>
|
|
187
220
|
</ClientOnly>
|
|
188
221
|
</header>
|
|
189
222
|
|
|
190
223
|
<div
|
|
191
|
-
v-if="meta.location || meta.nowPlaying || editing"
|
|
224
|
+
v-if="view.chips && (meta.location || meta.nowPlaying) || editing"
|
|
192
225
|
class="mt-3 flex flex-wrap items-center gap-2"
|
|
193
226
|
>
|
|
194
227
|
<template v-if="editing">
|
|
@@ -279,7 +312,7 @@ function commitText(field, e) {
|
|
|
279
312
|
>{{ meta.body ?? title }}</p>
|
|
280
313
|
|
|
281
314
|
<section
|
|
282
|
-
v-if="uploads.length || legacyImages.length || editing"
|
|
315
|
+
v-if="view.photos && (uploads.length || legacyImages.length) || editing"
|
|
283
316
|
class="mt-5"
|
|
284
317
|
:class="mediaDropActive ? 'rounded-xl ring-2 ring-black/40 dark:ring-white/50' : ''"
|
|
285
318
|
@dragover="onMediaDragOver"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
docId: string;
|
|
3
|
+
docLabel?: string;
|
|
4
|
+
docMeta?: Record<string, unknown>;
|
|
5
|
+
editable?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
junMotion,
|
|
5
|
+
useAbracadabra,
|
|
6
|
+
useDocTree,
|
|
7
|
+
useJunRename,
|
|
8
|
+
useJunSelfId,
|
|
9
|
+
useJunStudio,
|
|
10
|
+
useJunViewOptions,
|
|
11
|
+
useToast
|
|
12
|
+
} from "#imports";
|
|
13
|
+
import { junViewSpecFor } from "../../utils/junViewSpecs";
|
|
14
|
+
import {
|
|
15
|
+
junMyBallot,
|
|
16
|
+
junPollBallots,
|
|
17
|
+
junPollChoices,
|
|
18
|
+
junTallyVotes
|
|
19
|
+
} from "../../utils/junPoll";
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
docId: { type: String, required: true },
|
|
22
|
+
docLabel: { type: String, required: false },
|
|
23
|
+
docMeta: { type: Object, required: false },
|
|
24
|
+
editable: { type: Boolean, required: false }
|
|
25
|
+
});
|
|
26
|
+
const abra = useAbracadabra();
|
|
27
|
+
const { getEntry } = useDocTree();
|
|
28
|
+
const { editing } = useJunStudio();
|
|
29
|
+
const { renameDoc } = useJunRename();
|
|
30
|
+
const selfId = useJunSelfId();
|
|
31
|
+
const toast = useToast();
|
|
32
|
+
const entry = computed(() => getEntry(props.docId));
|
|
33
|
+
const meta = computed(
|
|
34
|
+
() => entry.value?.meta ?? props.docMeta ?? {}
|
|
35
|
+
);
|
|
36
|
+
const question = computed(() => entry.value?.label ?? props.docLabel ?? "A question");
|
|
37
|
+
const blurb = computed(() => {
|
|
38
|
+
const ex = meta.value.excerpt;
|
|
39
|
+
return typeof ex === "string" && ex.trim() ? ex : void 0;
|
|
40
|
+
});
|
|
41
|
+
const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
|
|
42
|
+
typeKey: "poll",
|
|
43
|
+
options: junViewSpecFor("poll")
|
|
44
|
+
}, () => props.docMeta);
|
|
45
|
+
const choices = computed(() => junPollChoices(meta.value.pollOptions));
|
|
46
|
+
const ballots = computed(() => junPollBallots(meta.value.pollVotes, choices.value.length));
|
|
47
|
+
const tally = computed(() => junTallyVotes(ballots.value, choices.value.length));
|
|
48
|
+
const mine = computed(() => junMyBallot(ballots.value, selfId.value));
|
|
49
|
+
const hasVoted = computed(() => mine.value.length > 0);
|
|
50
|
+
const showResults = computed(() => !view.value.reveal || hasVoted.value || editing.value);
|
|
51
|
+
const multiple = computed(() => meta.value.pollMultiple === true);
|
|
52
|
+
const sending = ref(null);
|
|
53
|
+
async function vote(choice) {
|
|
54
|
+
if (sending.value !== null) return;
|
|
55
|
+
sending.value = choice;
|
|
56
|
+
try {
|
|
57
|
+
await abra.provider.value?.rpc?.call("jun.poll.vote@1", { docId: props.docId, choice });
|
|
58
|
+
} catch (error) {
|
|
59
|
+
const message = error?.message ?? "that did not land";
|
|
60
|
+
toast.add({ title: message, icon: "i-lucide-info", color: "neutral" });
|
|
61
|
+
} finally {
|
|
62
|
+
sending.value = null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const DOTS_MAX = 40;
|
|
66
|
+
function dotsFor(index) {
|
|
67
|
+
return Math.min(DOTS_MAX, tally.value.counts[index] ?? 0);
|
|
68
|
+
}
|
|
69
|
+
function barWidth(index) {
|
|
70
|
+
const leader = tally.value.leader;
|
|
71
|
+
if (!leader) return "0%";
|
|
72
|
+
return `${Math.round((tally.value.counts[index] ?? 0) / leader * 100)}%`;
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<template>
|
|
77
|
+
<div class="mx-auto w-full max-w-2xl px-4 pt-8 pb-20 sm:px-6">
|
|
78
|
+
<JunPageHero
|
|
79
|
+
:doc-id="docId"
|
|
80
|
+
:title="question"
|
|
81
|
+
:subtitle="blurb"
|
|
82
|
+
:editable="editing"
|
|
83
|
+
@rename="renameDoc(docId, $event)"
|
|
84
|
+
>
|
|
85
|
+
<template #right>
|
|
86
|
+
<JunViewControls
|
|
87
|
+
v-if="editing"
|
|
88
|
+
:options="viewOptions"
|
|
89
|
+
:values="view"
|
|
90
|
+
:is-default="viewIsDefault"
|
|
91
|
+
@set="setView"
|
|
92
|
+
@reset="resetView"
|
|
93
|
+
/>
|
|
94
|
+
</template>
|
|
95
|
+
</JunPageHero>
|
|
96
|
+
|
|
97
|
+
<!-- No choices yet. Says what to do rather than rendering an empty box —
|
|
98
|
+
the owner has just converted a page and needs to know where the words
|
|
99
|
+
go. -->
|
|
100
|
+
<p
|
|
101
|
+
v-if="!choices.length"
|
|
102
|
+
class="mt-8 text-sm text-muted"
|
|
103
|
+
>
|
|
104
|
+
{{ editing ? "Add the choices in the panel above \u2014 they are a list, so type them separated by commas." : "This poll has no choices yet." }}
|
|
105
|
+
</p>
|
|
106
|
+
|
|
107
|
+
<!-- The ballot. Buttons, not radios: a vote is an action and it is sent the
|
|
108
|
+
moment it is made, so a form with a submit would be a second step that
|
|
109
|
+
does nothing. -->
|
|
110
|
+
<ul
|
|
111
|
+
v-else
|
|
112
|
+
class="mt-8 flex flex-col gap-2"
|
|
113
|
+
data-jun-poll="choices"
|
|
114
|
+
>
|
|
115
|
+
<li
|
|
116
|
+
v-for="(choice, i) in choices"
|
|
117
|
+
:key="choice"
|
|
118
|
+
v-motion="junMotion({
|
|
119
|
+
initial: { opacity: 0, y: 8 },
|
|
120
|
+
enter: { opacity: 1, y: 0, transition: { delay: i * 40, duration: 320 } }
|
|
121
|
+
})"
|
|
122
|
+
>
|
|
123
|
+
<button
|
|
124
|
+
type="button"
|
|
125
|
+
class="jun-poll-row group relative w-full overflow-hidden rounded-xl px-4 py-3 text-left
|
|
126
|
+
ring-1 ring-black/5 transition-colors duration-200 dark:ring-white/10"
|
|
127
|
+
:class="[
|
|
128
|
+
mine.includes(i) ? 'bg-black/[0.06] dark:bg-white/[0.09]' : 'hover:bg-black/[0.03] dark:hover:bg-white/[0.05]',
|
|
129
|
+
sending === i ? 'opacity-60' : ''
|
|
130
|
+
]"
|
|
131
|
+
:aria-pressed="mine.includes(i)"
|
|
132
|
+
:data-jun-choice="i"
|
|
133
|
+
@click="vote(i)"
|
|
134
|
+
>
|
|
135
|
+
<!-- The bar sits BEHIND the label, so a long choice stays readable at
|
|
136
|
+
any share of the vote. -->
|
|
137
|
+
<span
|
|
138
|
+
v-if="showResults && view.results === 'bars'"
|
|
139
|
+
class="jun-poll-bar absolute inset-y-0 left-0 bg-black/[0.05] transition-[width] duration-500 dark:bg-white/[0.08]"
|
|
140
|
+
:style="{ width: barWidth(i) }"
|
|
141
|
+
aria-hidden="true"
|
|
142
|
+
/>
|
|
143
|
+
|
|
144
|
+
<span class="relative flex items-center gap-3">
|
|
145
|
+
<UIcon
|
|
146
|
+
:name="mine.includes(i) ? multiple ? 'i-lucide-check-square' : 'i-lucide-circle-dot' : multiple ? 'i-lucide-square' : 'i-lucide-circle'"
|
|
147
|
+
class="size-4 shrink-0 text-dimmed"
|
|
148
|
+
/>
|
|
149
|
+
<span class="min-w-0 flex-1 text-sm text-highlighted">{{ choice }}</span>
|
|
150
|
+
|
|
151
|
+
<template v-if="showResults">
|
|
152
|
+
<span
|
|
153
|
+
v-if="view.results === 'dots'"
|
|
154
|
+
class="flex max-w-40 flex-wrap justify-end gap-0.5"
|
|
155
|
+
:aria-label="`${tally.counts[i]} votes`"
|
|
156
|
+
>
|
|
157
|
+
<span
|
|
158
|
+
v-for="d in dotsFor(i)"
|
|
159
|
+
:key="d"
|
|
160
|
+
class="size-1.5 rounded-full bg-black/25 dark:bg-white/35"
|
|
161
|
+
/>
|
|
162
|
+
</span>
|
|
163
|
+
<span
|
|
164
|
+
v-else
|
|
165
|
+
class="shrink-0 text-xs text-muted tabular-nums"
|
|
166
|
+
:data-jun-count="i"
|
|
167
|
+
>
|
|
168
|
+
{{ view.results === "counts" ? tally.counts[i] : `${tally.percentages[i]}%` }}
|
|
169
|
+
</span>
|
|
170
|
+
</template>
|
|
171
|
+
</span>
|
|
172
|
+
</button>
|
|
173
|
+
</li>
|
|
174
|
+
</ul>
|
|
175
|
+
|
|
176
|
+
<!-- The footer line: how many people, and what you did. Both are facts the
|
|
177
|
+
page can state without a refresh, which is the whole point of it. -->
|
|
178
|
+
<p
|
|
179
|
+
v-if="choices.length"
|
|
180
|
+
class="mt-4 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-dimmed"
|
|
181
|
+
data-jun-poll="footer"
|
|
182
|
+
>
|
|
183
|
+
<span data-jun-poll="voters">
|
|
184
|
+
{{ tally.voters === 1 ? "1 person has voted" : `${tally.voters} people have voted` }}
|
|
185
|
+
</span>
|
|
186
|
+
<template v-if="hasVoted">
|
|
187
|
+
<span>·</span>
|
|
188
|
+
<span>you voted</span>
|
|
189
|
+
</template>
|
|
190
|
+
<template v-else-if="!showResults">
|
|
191
|
+
<span>·</span>
|
|
192
|
+
<span>results after you vote</span>
|
|
193
|
+
</template>
|
|
194
|
+
<template v-if="multiple">
|
|
195
|
+
<span>·</span>
|
|
196
|
+
<span>pick as many as you like</span>
|
|
197
|
+
</template>
|
|
198
|
+
</p>
|
|
199
|
+
|
|
200
|
+
<!-- Who else is here. A poll is a room, and the count above is only half of
|
|
201
|
+
who is in it. -->
|
|
202
|
+
<ClientOnly>
|
|
203
|
+
<div class="mt-4">
|
|
204
|
+
<JunReaders :doc-id="docId" />
|
|
205
|
+
</div>
|
|
206
|
+
</ClientOnly>
|
|
207
|
+
|
|
208
|
+
<hr class="my-8 border-default">
|
|
209
|
+
|
|
210
|
+
<!-- The poll's own prose: the question behind the question. Every page type
|
|
211
|
+
here renders its document's body, and a poll that could not explain
|
|
212
|
+
itself would be the only one that cannot. -->
|
|
213
|
+
<div class="jun-poll-body">
|
|
214
|
+
<AEditor
|
|
215
|
+
:doc-id="docId"
|
|
216
|
+
:doc-label="question"
|
|
217
|
+
:doc-meta="docMeta"
|
|
218
|
+
:editable="editing"
|
|
219
|
+
:show-toolbar="editing"
|
|
220
|
+
:show-suggestion-menu="editing"
|
|
221
|
+
:show-drag-handle="editing"
|
|
222
|
+
:show-breadcrumb="false"
|
|
223
|
+
placeholder="Why you are asking."
|
|
224
|
+
/>
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
</template>
|
|
228
|
+
|
|
229
|
+
<style scoped>
|
|
230
|
+
.jun-poll-body :deep(.document-header){display:none}.jun-poll-body :deep(.ProseMirror),.jun-poll-body :deep(.aeditor-canvas){padding:0}.jun-poll-body :deep([data-meta-key=pollOptions]),.jun-poll-body :deep([data-meta-key=pollVotes]){display:none}
|
|
231
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
docId: string;
|
|
3
|
+
docLabel?: string;
|
|
4
|
+
docMeta?: Record<string, unknown>;
|
|
5
|
+
editable?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|