@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
@@ -0,0 +1,29 @@
1
+ /**
2
+ * JunViewControl — ONE display setting, rendered as whatever kind it is.
3
+ *
4
+ * Ten kinds: `variant`, `select`, `order`, `number`, `range`, `color`, `text`,
5
+ * `tags`, `doc`, `toggle`. A renderer gains a control by adding a line to its
6
+ * spec in `utils/junViewSpecs.ts`; nothing here is per-renderer.
7
+ *
8
+ * Split out of `<JunViewControls>` when the settings modal needed the same
9
+ * controls WITHOUT a popover around them, to set the site-wide default for the
10
+ * same options. One implementation, two surfaces — the alternative was ten kinds
11
+ * written twice, which is the duplication the panel was extracted to end.
12
+ *
13
+ * Writes nothing itself: it emits, and `useJunViewOptions` owns the
14
+ * default-clearing rule that keeps a stored default from pinning a site's
15
+ * house style forever.
16
+ */
17
+ import type { JunViewOption, JunViewValue } from '../composables/useJunViewOptions.js';
18
+ type __VLS_Props = {
19
+ option: JunViewOption;
20
+ /** Every resolved value, so a control can read its own by key. */
21
+ values: Record<string, JunViewValue>;
22
+ };
23
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
+ set: (key: string, value: JunViewValue) => any;
25
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
26
+ onSet?: ((key: string, value: JunViewValue) => any) | undefined;
27
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
@@ -0,0 +1,340 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ option: { type: Object, required: true },
4
+ values: { type: Object, required: true }
5
+ });
6
+ const emit = defineEmits(["set"]);
7
+ function rows(option) {
8
+ const current = props.values[option.key];
9
+ const on = Array.isArray(current) ? current : [];
10
+ const choices = option.choices ?? [];
11
+ const byValue = new Map(choices.map((c) => [c.value, c]));
12
+ const out = on.map((v) => byValue.get(v)).filter((c) => !!c).map((c) => ({ ...c, on: true }));
13
+ for (const c of choices) if (!on.includes(c.value)) out.push({ ...c, on: false });
14
+ return out;
15
+ }
16
+ function toggleOrder(option, value) {
17
+ const current = props.values[option.key];
18
+ const on = Array.isArray(current) ? [...current] : [];
19
+ const i = on.indexOf(value);
20
+ if (i >= 0) on.splice(i, 1);
21
+ else on.push(value);
22
+ emit("set", option.key, on);
23
+ }
24
+ function moveOrder(option, value, delta) {
25
+ const current = props.values[option.key];
26
+ const on = Array.isArray(current) ? [...current] : [];
27
+ const i = on.indexOf(value);
28
+ const j = i + delta;
29
+ if (i < 0 || j < 0 || j >= on.length) return;
30
+ [on[i], on[j]] = [on[j], on[i]];
31
+ emit("set", option.key, on);
32
+ }
33
+ function tagsOf(option) {
34
+ const current = props.values[option.key];
35
+ return Array.isArray(current) ? current : [];
36
+ }
37
+ function removeTag(option, tag) {
38
+ emit("set", option.key, tagsOf(option).filter((t) => t !== tag));
39
+ }
40
+ function addTags(option, event) {
41
+ const el = event.target;
42
+ const parts = el.value.split(",").map((t) => t.trim()).filter(Boolean);
43
+ if (!parts.length) return;
44
+ emit("set", option.key, [...tagsOf(option), ...parts]);
45
+ el.value = "";
46
+ }
47
+ function hexOf(option) {
48
+ const v = props.values[option.key];
49
+ if (typeof v === "string" && /^#[0-9a-f]{6}$/i.test(v)) return v;
50
+ return "#808080";
51
+ }
52
+ function step(option, delta) {
53
+ const current = Number(props.values[option.key] ?? option.default);
54
+ const next = current + delta * (option.step ?? 1);
55
+ const min = option.min ?? Number.NEGATIVE_INFINITY;
56
+ const max = option.max ?? Number.POSITIVE_INFINITY;
57
+ if (next < min || next > max) return;
58
+ emit("set", option.key, next);
59
+ }
60
+ </script>
61
+
62
+ <template>
63
+ <!-- A VARIANT is the page's shape, so it gets the most room: a
64
+ segmented row of icons, labelled, wrapping rather than
65
+ scrolling. -->
66
+ <div v-if="props.option.kind === 'variant'">
67
+ <p class="mb-1.5 text-[11px] text-muted">
68
+ {{ props.option.label }}
69
+ </p>
70
+ <div class="flex flex-wrap gap-1">
71
+ <button
72
+ v-for="choice in props.option.choices"
73
+ :key="choice.value"
74
+ type="button"
75
+ class="flex flex-1 basis-20 flex-col items-center gap-1 rounded-lg px-2 py-2
76
+ text-[11px] transition-colors duration-200"
77
+ :class="values[props.option.key] === choice.value ? 'bg-black/[0.07] text-highlighted dark:bg-white/[0.10]' : 'text-muted hover:bg-black/[0.035] dark:hover:bg-white/[0.05]'"
78
+ :title="choice.hint"
79
+ :aria-pressed="values[props.option.key] === choice.value"
80
+ @click="emit('set', props.option.key, choice.value)"
81
+ >
82
+ <UIcon
83
+ v-if="choice.icon"
84
+ :name="choice.icon"
85
+ class="size-4"
86
+ />
87
+ {{ choice.label }}
88
+ </button>
89
+ </div>
90
+ </div>
91
+
92
+ <!-- A SELECT is a value among several, not a shape — a chip row. -->
93
+ <div v-else-if="props.option.kind === 'select'">
94
+ <p class="mb-1.5 text-[11px] text-muted">
95
+ {{ props.option.label }}
96
+ </p>
97
+ <div class="flex flex-wrap gap-1">
98
+ <button
99
+ v-for="choice in props.option.choices"
100
+ :key="choice.value"
101
+ type="button"
102
+ class="rounded-full px-2.5 py-1 text-[11px] transition-colors duration-200"
103
+ :class="values[props.option.key] === choice.value ? 'bg-black/[0.07] text-highlighted dark:bg-white/[0.10]' : 'text-muted hover:bg-black/[0.035] dark:hover:bg-white/[0.05]'"
104
+ :title="choice.hint"
105
+ :aria-pressed="values[props.option.key] === choice.value"
106
+ @click="emit('set', props.option.key, choice.value)"
107
+ >
108
+ {{ choice.label }}
109
+ </button>
110
+ </div>
111
+ </div>
112
+
113
+ <!-- An ORDER is a list the owner both reorders and switches off, so
114
+ it is the one control that needs its own rows. The move buttons
115
+ are only offered on rows that are ON — reordering something
116
+ hidden is a promise about a position nobody can see. -->
117
+ <div v-else-if="props.option.kind === 'order'">
118
+ <p class="mb-1.5 text-[11px] text-muted">
119
+ {{ props.option.label }}
120
+ </p>
121
+ <ul class="flex flex-col gap-0.5">
122
+ <li
123
+ v-for="(row, i) in rows(props.option)"
124
+ :key="row.value"
125
+ class="flex items-center gap-1.5 rounded-md px-1.5 py-1 text-[11px] transition-colors hover:bg-black/[0.03] dark:hover:bg-white/[0.04]"
126
+ :class="row.on ? 'text-highlighted' : 'text-dimmed'"
127
+ >
128
+ <UIcon
129
+ v-if="row.icon"
130
+ :name="row.icon"
131
+ class="size-3.5 shrink-0 opacity-70"
132
+ />
133
+ <span
134
+ class="flex-1 truncate"
135
+ :title="row.hint"
136
+ >{{ row.label }}</span>
137
+ <template v-if="row.on">
138
+ <UButton
139
+ icon="i-lucide-chevron-up"
140
+ size="xs"
141
+ color="neutral"
142
+ variant="ghost"
143
+ :aria-label="`Move ${row.label} up`"
144
+ :disabled="i === 0"
145
+ @click="moveOrder(props.option, row.value, -1)"
146
+ />
147
+ <UButton
148
+ icon="i-lucide-chevron-down"
149
+ size="xs"
150
+ color="neutral"
151
+ variant="ghost"
152
+ :aria-label="`Move ${row.label} down`"
153
+ @click="moveOrder(props.option, row.value, 1)"
154
+ />
155
+ </template>
156
+ <USwitch
157
+ :model-value="row.on"
158
+ size="xs"
159
+ color="neutral"
160
+ :aria-label="row.label"
161
+ @update:model-value="toggleOrder(props.option, row.value)"
162
+ />
163
+ </li>
164
+ </ul>
165
+ </div>
166
+
167
+ <div
168
+ v-else-if="props.option.kind === 'number'"
169
+ class="flex items-center gap-2"
170
+ >
171
+ <UIcon
172
+ v-if="props.option.icon"
173
+ :name="props.option.icon"
174
+ class="size-3.5 shrink-0 text-dimmed"
175
+ />
176
+ <span class="flex-1 text-[11px] text-muted">{{ props.option.label }}</span>
177
+ <UButton
178
+ icon="i-lucide-minus"
179
+ size="xs"
180
+ color="neutral"
181
+ variant="ghost"
182
+ :aria-label="`Fewer \u2014 ${props.option.label}`"
183
+ :disabled="Number(values[props.option.key]) <= (props.option.min ?? -Infinity)"
184
+ @click="step(props.option, -1)"
185
+ />
186
+ <span class="w-5 text-center text-xs tabular-nums text-highlighted">
187
+ {{ values[props.option.key] }}
188
+ </span>
189
+ <UButton
190
+ icon="i-lucide-plus"
191
+ size="xs"
192
+ color="neutral"
193
+ variant="ghost"
194
+ :aria-label="`More \u2014 ${props.option.label}`"
195
+ :disabled="Number(values[props.option.key]) >= (props.option.max ?? Infinity)"
196
+ @click="step(props.option, 1)"
197
+ />
198
+ </div>
199
+
200
+ <!-- A RANGE is a number you sweep rather than nudge. A density
201
+ between 0 and 1 in steps of 0.05 is absurd to click twenty
202
+ times, which is the only reason this is not a stepper. -->
203
+ <div
204
+ v-else-if="props.option.kind === 'range'"
205
+ class="flex items-center gap-2"
206
+ >
207
+ <UIcon
208
+ v-if="props.option.icon"
209
+ :name="props.option.icon"
210
+ class="size-3.5 shrink-0 text-dimmed"
211
+ />
212
+ <span class="flex-1 text-[11px] text-muted">{{ props.option.label }}</span>
213
+ <input
214
+ type="range"
215
+ class="jun-view-range w-24"
216
+ :min="props.option.min ?? 0"
217
+ :max="props.option.max ?? 1"
218
+ :step="props.option.step ?? 0.05"
219
+ :value="Number(values[props.option.key])"
220
+ :aria-label="props.option.label"
221
+ @input="emit('set', props.option.key, Number($event.target.value))"
222
+ >
223
+ <span class="w-7 text-right text-[11px] tabular-nums text-highlighted">
224
+ {{ values[props.option.key] }}
225
+ </span>
226
+ </div>
227
+
228
+ <!-- A COLOUR: the offered swatches, plus a picker. The swatches are a
229
+ suggestion — a brand colour that is not on the ramp is still a
230
+ brand colour — and the picker is what makes that true. -->
231
+ <div v-else-if="props.option.kind === 'color'">
232
+ <p class="mb-1.5 text-[11px] text-muted">
233
+ {{ props.option.label }}
234
+ </p>
235
+ <div class="flex flex-wrap items-center gap-1">
236
+ <button
237
+ v-for="choice in props.option.choices"
238
+ :key="choice.value"
239
+ type="button"
240
+ class="flex items-center gap-1.5 rounded-full px-2 py-1 text-[11px] transition-colors duration-200"
241
+ :class="values[props.option.key] === choice.value ? 'bg-black/[0.07] text-highlighted dark:bg-white/[0.10]' : 'text-muted hover:bg-black/[0.035] dark:hover:bg-white/[0.05]'"
242
+ :aria-pressed="values[props.option.key] === choice.value"
243
+ @click="emit('set', props.option.key, choice.value)"
244
+ >
245
+ <span
246
+ v-if="choice.value.startsWith('#')"
247
+ class="size-2.5 rounded-full ring-1 ring-black/10 dark:ring-white/15"
248
+ :style="{ background: choice.value }"
249
+ />
250
+ {{ choice.label }}
251
+ </button>
252
+ <input
253
+ type="color"
254
+ class="jun-view-swatch size-6 shrink-0 cursor-pointer rounded-full"
255
+ :value="hexOf(props.option)"
256
+ :aria-label="`${props.option.label} \u2014 pick a colour`"
257
+ @input="emit('set', props.option.key, $event.target.value)"
258
+ >
259
+ </div>
260
+ </div>
261
+
262
+ <!-- TEXT. Committed on blur and on Enter, never per keystroke: every
263
+ character would otherwise be a CRDT meta write, and every peer
264
+ would watch the label being typed one letter at a time. -->
265
+ <div v-else-if="props.option.kind === 'text'">
266
+ <p class="mb-1.5 text-[11px] text-muted">
267
+ {{ props.option.label }}
268
+ </p>
269
+ <input
270
+ type="text"
271
+ class="w-full rounded-md bg-black/[0.04] px-2 py-1 text-xs text-highlighted
272
+ outline-none placeholder:text-dimmed dark:bg-white/[0.06]"
273
+ :value="String(values[props.option.key] ?? '')"
274
+ :maxlength="props.option.maxLength ?? 120"
275
+ :placeholder="props.option.placeholder"
276
+ :aria-label="props.option.label"
277
+ spellcheck="false"
278
+ @change="emit('set', props.option.key, $event.target.value)"
279
+ @keydown.enter="$event.target.blur()"
280
+ >
281
+ </div>
282
+
283
+ <!-- TAGS. The chips are the value; the field only adds. Removing is
284
+ one press on the chip, which is where a person looks for it. -->
285
+ <div v-else-if="props.option.kind === 'tags'">
286
+ <p class="mb-1.5 text-[11px] text-muted">
287
+ {{ props.option.label }}
288
+ </p>
289
+ <div class="flex flex-wrap gap-1">
290
+ <button
291
+ v-for="tag in tagsOf(props.option)"
292
+ :key="tag"
293
+ type="button"
294
+ class="group/tag flex items-center gap-1 rounded-full bg-black/[0.06] px-2 py-0.5
295
+ text-[11px] text-muted transition-colors hover:text-highlighted dark:bg-white/[0.08]"
296
+ :aria-label="`Remove ${tag}`"
297
+ @click="removeTag(props.option, tag)"
298
+ >
299
+ {{ tag }}
300
+ <UIcon
301
+ name="i-lucide-x"
302
+ class="size-2.5 opacity-40 group-hover/tag:opacity-90"
303
+ />
304
+ </button>
305
+ </div>
306
+ <input
307
+ type="text"
308
+ class="mt-1 w-full rounded-md bg-black/[0.04] px-2 py-1 text-xs text-highlighted
309
+ outline-none placeholder:text-dimmed dark:bg-white/[0.06]"
310
+ placeholder="add, separated by commas"
311
+ :aria-label="`Add to ${props.option.label}`"
312
+ spellcheck="false"
313
+ @change="addTags(props.option, $event)"
314
+ @keydown.enter.prevent="addTags(props.option, $event)"
315
+ >
316
+ </div>
317
+
318
+ <div
319
+ v-else
320
+ class="flex items-center gap-2"
321
+ >
322
+ <UIcon
323
+ v-if="props.option.icon"
324
+ :name="props.option.icon"
325
+ class="size-3.5 shrink-0 text-dimmed"
326
+ />
327
+ <span class="flex-1 text-[11px] text-muted">{{ props.option.label }}</span>
328
+ <USwitch
329
+ :model-value="values[props.option.key] === true"
330
+ size="xs"
331
+ color="neutral"
332
+ :aria-label="props.option.label"
333
+ @update:model-value="emit('set', props.option.key, $event)"
334
+ />
335
+ </div>
336
+ </template>
337
+
338
+ <style scoped>
339
+ .jun-view-range{accent-color:currentColor;height:1rem}.jun-view-swatch{background:transparent;border:none;padding:0}.jun-view-swatch::-webkit-color-swatch-wrapper{padding:0}.jun-view-swatch::-webkit-color-swatch{border:1px solid color-mix(in srgb,currentColor 20%,transparent);border-radius:9999px}
340
+ </style>
@@ -0,0 +1,29 @@
1
+ /**
2
+ * JunViewControl — ONE display setting, rendered as whatever kind it is.
3
+ *
4
+ * Ten kinds: `variant`, `select`, `order`, `number`, `range`, `color`, `text`,
5
+ * `tags`, `doc`, `toggle`. A renderer gains a control by adding a line to its
6
+ * spec in `utils/junViewSpecs.ts`; nothing here is per-renderer.
7
+ *
8
+ * Split out of `<JunViewControls>` when the settings modal needed the same
9
+ * controls WITHOUT a popover around them, to set the site-wide default for the
10
+ * same options. One implementation, two surfaces — the alternative was ten kinds
11
+ * written twice, which is the duplication the panel was extracted to end.
12
+ *
13
+ * Writes nothing itself: it emits, and `useJunViewOptions` owns the
14
+ * default-clearing rule that keeps a stored default from pinning a site's
15
+ * house style forever.
16
+ */
17
+ import type { JunViewOption, JunViewValue } from '../composables/useJunViewOptions.js';
18
+ type __VLS_Props = {
19
+ option: JunViewOption;
20
+ /** Every resolved value, so a control can read its own by key. */
21
+ values: Record<string, JunViewValue>;
22
+ };
23
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
+ set: (key: string, value: JunViewValue) => any;
25
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
26
+ onSet?: ((key: string, value: JunViewValue) => any) | undefined;
27
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
@@ -0,0 +1,27 @@
1
+ import type { JunViewOption, JunViewValue } from '../composables/useJunViewOptions.js';
2
+ type __VLS_Props = {
3
+ options: JunViewOption[];
4
+ values: Record<string, JunViewValue>;
5
+ /** Nothing stored on the document: the page follows the site's own defaults. */
6
+ isDefault?: boolean;
7
+ /**
8
+ * Render WITHOUT the popover — no trigger, no card.
9
+ *
10
+ * For the settings modal's *Renderers* section, which is already a panel: a
11
+ * popover inside a modal is a card inside a card.
12
+ */
13
+ inline?: boolean;
14
+ /** Inline only: the heading over the controls. */
15
+ title?: string;
16
+ /** Inline only: what Reset says, since "Reset" alone is ambiguous there. */
17
+ resetLabel?: string;
18
+ };
19
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ set: (key: string, value: JunViewValue) => any;
21
+ reset: () => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
23
+ onSet?: ((key: string, value: JunViewValue) => any) | undefined;
24
+ onReset?: (() => any) | undefined;
25
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
+ declare const _default: typeof __VLS_export;
27
+ export default _default;
@@ -0,0 +1,94 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ const props = defineProps({
4
+ options: { type: Array, required: true },
5
+ values: { type: Object, required: true },
6
+ isDefault: { type: Boolean, required: false },
7
+ inline: { type: Boolean, required: false },
8
+ title: { type: String, required: false },
9
+ resetLabel: { type: String, required: false }
10
+ });
11
+ const emit = defineEmits(["set", "reset"]);
12
+ const summary = computed(() => {
13
+ const variant = props.options.find((o) => o.kind === "variant");
14
+ if (!variant) return void 0;
15
+ const value = props.values[variant.key];
16
+ return variant.choices?.find((c) => c.value === value)?.label;
17
+ });
18
+ </script>
19
+
20
+ <template>
21
+ <div
22
+ v-if="inline"
23
+ class="jun-view-inline"
24
+ >
25
+ <div class="mb-2.5 flex items-baseline gap-2">
26
+ <p class="flex-1 text-[10px] font-medium tracking-[0.22em] text-dimmed uppercase">
27
+ {{ title ?? "How this page looks" }}
28
+ </p>
29
+ <UButton
30
+ v-if="!isDefault"
31
+ :label="resetLabel ?? 'Reset'"
32
+ size="xs"
33
+ color="neutral"
34
+ variant="ghost"
35
+ @click="emit('reset')"
36
+ />
37
+ </div>
38
+
39
+ <div class="flex flex-col gap-3">
40
+ <JunViewControl
41
+ v-for="option in options"
42
+ :key="option.key"
43
+ :option="option"
44
+ :values="values"
45
+ @set="(k, v) => emit('set', k, v)"
46
+ />
47
+ </div>
48
+ </div>
49
+
50
+ <UPopover
51
+ v-else
52
+ :content="{ side: 'bottom', align: 'end', sideOffset: 8 }"
53
+ :ui="{ content: 'jun-chrome rounded-xl p-0 ring-0 border-0' }"
54
+ >
55
+ <UButton
56
+ icon="i-lucide-sliders-horizontal"
57
+ size="xs"
58
+ color="neutral"
59
+ variant="ghost"
60
+ :label="summary"
61
+ :aria-label="`How this page looks${summary ? ` \u2014 ${summary}` : ''}`"
62
+ />
63
+
64
+ <template #content>
65
+ <div class="w-72 p-3">
66
+ <div class="mb-2.5 flex items-baseline gap-2">
67
+ <p class="flex-1 text-[10px] font-medium tracking-[0.22em] text-dimmed uppercase">
68
+ How this page looks
69
+ </p>
70
+ <!-- Only offered when there IS something stored. "Reset" on a page that
71
+ has never been changed promises an action that does nothing. -->
72
+ <UButton
73
+ v-if="!isDefault"
74
+ label="Reset"
75
+ size="xs"
76
+ color="neutral"
77
+ variant="ghost"
78
+ @click="emit('reset')"
79
+ />
80
+ </div>
81
+
82
+ <div class="flex flex-col gap-3">
83
+ <JunViewControl
84
+ v-for="option in options"
85
+ :key="option.key"
86
+ :option="option"
87
+ :values="values"
88
+ @set="(k, v) => emit('set', k, v)"
89
+ />
90
+ </div>
91
+ </div>
92
+ </template>
93
+ </UPopover>
94
+ </template>
@@ -0,0 +1,27 @@
1
+ import type { JunViewOption, JunViewValue } from '../composables/useJunViewOptions.js';
2
+ type __VLS_Props = {
3
+ options: JunViewOption[];
4
+ values: Record<string, JunViewValue>;
5
+ /** Nothing stored on the document: the page follows the site's own defaults. */
6
+ isDefault?: boolean;
7
+ /**
8
+ * Render WITHOUT the popover — no trigger, no card.
9
+ *
10
+ * For the settings modal's *Renderers* section, which is already a panel: a
11
+ * popover inside a modal is a card inside a card.
12
+ */
13
+ inline?: boolean;
14
+ /** Inline only: the heading over the controls. */
15
+ title?: string;
16
+ /** Inline only: what Reset says, since "Reset" alone is ambiguous there. */
17
+ resetLabel?: string;
18
+ };
19
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ set: (key: string, value: JunViewValue) => any;
21
+ reset: () => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
23
+ onSet?: ((key: string, value: JunViewValue) => any) | undefined;
24
+ onReset?: (() => any) | undefined;
25
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
+ declare const _default: typeof __VLS_export;
27
+ export default _default;
@@ -14,8 +14,10 @@ import {
14
14
  useJunRename,
15
15
  useJunStudio,
16
16
  useJunUpload,
17
- useJunViewingAccent
17
+ useJunViewingAccent,
18
+ useJunViewOptions
18
19
  } from "#imports";
20
+ import { junViewSpecFor } from "../../utils/junViewSpecs";
19
21
  const props = defineProps({
20
22
  docId: { type: String, required: true },
21
23
  docLabel: { type: String, required: false },
@@ -34,6 +36,19 @@ const { uploadTo, imageFiles } = useJunUpload();
34
36
  const { typeIdFor } = useJunPageType();
35
37
  const { open: openDoc } = useJunOpenDoc();
36
38
  const { accentStyle, accentTitle } = useJunViewingAccent();
39
+ const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
40
+ typeKey: "apps",
41
+ options: junViewSpecFor("apps")
42
+ }, () => props.docMeta);
43
+ const GRID_CLASS = {
44
+ 1: "grid-cols-1",
45
+ 2: "grid-cols-2",
46
+ 3: "grid-cols-2 sm:grid-cols-3",
47
+ 4: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4",
48
+ 5: "grid-cols-2 sm:grid-cols-3 md:grid-cols-5",
49
+ 6: "grid-cols-2 sm:grid-cols-4 md:grid-cols-6"
50
+ };
51
+ const gridClass = computed(() => GRID_CLASS[Number(view.value.columns)] ?? GRID_CLASS[3]);
37
52
  const appType = computed(() => typeIdFor("app"));
38
53
  const pageTitle = computed(() => getEntry(props.docId)?.label ?? props.docLabel ?? "Apps");
39
54
  const pageSubtitle = computed(() => {
@@ -110,11 +125,33 @@ async function onTileFileDrop(item, e) {
110
125
  <template>
111
126
  <div class="relative mx-auto w-full max-w-5xl px-4 pt-12 pb-16 sm:px-8">
112
127
  <JunPageHero
128
+ :doc-id="docId"
113
129
  :title="pageTitle"
114
130
  :subtitle="pageSubtitle"
115
131
  :editable="editing"
116
132
  @rename="renamePage"
117
133
  @rename-subtitle="renameSubtitle"
134
+ >
135
+ <template #right>
136
+ <JunViewControls
137
+ v-if="editing"
138
+ :options="viewOptions"
139
+ :values="view"
140
+ :is-default="viewIsDefault"
141
+ @set="setView"
142
+ @reset="resetView"
143
+ />
144
+ </template>
145
+ </JunPageHero>
146
+
147
+ <!-- The page's own prose, above its children. Collapses to nothing
148
+ when the document has no body, which is every site that has never
149
+ written one. -->
150
+ <JunCollectionIntro
151
+ :doc-id="docId"
152
+ :doc-label="pageTitle"
153
+ :doc-meta="docMeta"
154
+ placeholder="What you are looking at…"
118
155
  />
119
156
 
120
157
  <section
@@ -128,7 +165,8 @@ async function onTileFileDrop(item, e) {
128
165
  <TransitionGroup
129
166
  tag="div"
130
167
  name="jun-apps"
131
- class="grid grid-cols-2 gap-3 sm:grid-cols-3 sm:gap-4 md:grid-cols-4 lg:gap-5"
168
+ class="grid gap-3 sm:gap-4 lg:gap-5"
169
+ :class="gridClass"
132
170
  >
133
171
  <!-- This wrapper is the TransitionGroup child on purpose: the context
134
172
  menu renders a non-element root, which Vue cannot FLIP-animate.
@@ -206,14 +244,17 @@ async function onTileFileDrop(item, e) {
206
244
  />
207
245
  </div>
208
246
 
209
- <div class="mt-2 flex items-center justify-center sm:mt-3">
247
+ <div
248
+ v-if="view.labels"
249
+ class="mt-2 flex items-center justify-center sm:mt-3"
250
+ >
210
251
  <span
211
252
  class="inline-block max-w-full truncate rounded-md px-2 py-0.5 text-sm font-semibold text-highlighted transition-all duration-300 group-hover:bg-neutral-900 group-hover:text-white sm:text-base dark:group-hover:bg-neutral-100 dark:group-hover:text-neutral-900"
212
253
  >{{ app.label }}</span>
213
254
  </div>
214
255
 
215
256
  <div
216
- v-if="app.meta?.status"
257
+ v-if="app.meta?.status && view.status"
217
258
  class="mt-1 flex justify-center"
218
259
  >
219
260
  <UBadge