@abraca/junis 2.96.0 → 2.97.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.json +1 -1
- package/dist/runtime/components/JunBreadcrumbs.vue +40 -4
- package/dist/runtime/components/JunCampfireRoster.vue +4 -0
- package/dist/runtime/components/JunDocMenuHost.d.vue.ts +3 -0
- package/dist/runtime/components/JunDocMenuHost.vue +39 -0
- package/dist/runtime/components/JunDocMenuHost.vue.d.ts +3 -0
- package/dist/runtime/components/JunHorizontalTimeline.vue +5 -0
- package/dist/runtime/components/JunItemMenu.vue +51 -2
- package/dist/runtime/components/JunMosaicPane.client.d.vue.ts +11 -0
- package/dist/runtime/components/JunMosaicPane.client.vue +14 -2
- package/dist/runtime/components/JunMosaicPane.client.vue.d.ts +11 -0
- package/dist/runtime/components/JunNavDock.vue +3 -0
- package/dist/runtime/components/JunNavMenu.client.vue +4 -0
- package/dist/runtime/components/JunNavigation.vue +10 -0
- package/dist/runtime/components/JunNotFound.vue +4 -0
- package/dist/runtime/components/JunNoteLinks.vue +3 -0
- package/dist/runtime/components/JunSearch.client.vue +8 -0
- package/dist/runtime/components/JunSectionBar.vue +4 -0
- package/dist/runtime/components/JunTravellersChip.vue +3 -0
- package/dist/runtime/components/renderers/JunCourseRenderer.vue +8 -0
- package/dist/runtime/components/renderers/JunEntryRenderer.vue +4 -0
- package/dist/runtime/components/renderers/JunGardenRenderer.vue +94 -36
- package/dist/runtime/components/renderers/JunHomeRenderer.vue +4 -0
- package/dist/runtime/components/renderers/JunItemRenderer.vue +4 -0
- package/dist/runtime/components/renderers/JunMosaicRenderer.vue +1 -0
- package/dist/runtime/components/renderers/JunTrackRenderer.vue +3 -0
- package/dist/runtime/composables/useJunChrome.d.ts +14 -0
- package/dist/runtime/composables/useJunChrome.js +17 -0
- package/dist/runtime/composables/useJunDocLinkMenu.d.ts +69 -0
- package/dist/runtime/composables/useJunDocLinkMenu.js +99 -0
- package/dist/runtime/composables/useJunDocMenuHost.d.ts +18 -0
- package/dist/runtime/composables/useJunDocMenuHost.js +26 -0
- package/dist/runtime/composables/useJunSurface.d.ts +13 -0
- package/dist/runtime/composables/useJunSurface.js +4 -0
- package/dist/runtime/layouts/jun.vue +7 -0
- package/dist/runtime/server/plugins/jun-bootstrap.js +46 -2
- package/dist/runtime/server/utils/junServiceFetch.js +22 -10
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from "#imports";
|
|
18
18
|
import { junViewSpecFor } from "../../utils/junViewSpecs";
|
|
19
19
|
import { useJunSiblings } from "../../composables/useJunSiblings";
|
|
20
|
+
import { useJunDocLinkMenu } from "../../composables/useJunDocLinkMenu";
|
|
20
21
|
import { useJunSectionScan } from "../../composables/useJunSections";
|
|
21
22
|
const props = defineProps({
|
|
22
23
|
docId: { type: String, required: true },
|
|
@@ -41,6 +42,7 @@ function patchMeta(p) {
|
|
|
41
42
|
tree.updateMeta(props.docId, p);
|
|
42
43
|
}
|
|
43
44
|
const { neighbours } = useJunSiblings(computed(() => props.docId));
|
|
45
|
+
const neighbourMenu = useJunDocLinkMenu({ surface: "card" });
|
|
44
46
|
const titleEl = ref(null);
|
|
45
47
|
function commitTitle() {
|
|
46
48
|
const t = titleEl.value?.textContent?.trim();
|
|
@@ -561,6 +563,7 @@ function removeCover() {
|
|
|
561
563
|
v-if="neighbours.prev"
|
|
562
564
|
:to="getDocUrl(neighbours.prev.id)"
|
|
563
565
|
class="group flex flex-col gap-1 rounded-xl border border-default px-4 py-3 transition-colors hover:bg-black/5 dark:hover:bg-white/5"
|
|
566
|
+
v-bind="neighbourMenu.bindForId(neighbours.prev.id, neighbours.prev.label)"
|
|
564
567
|
>
|
|
565
568
|
<span class="flex items-center gap-1.5 text-[10px] font-medium tracking-[0.22em] text-dimmed uppercase">
|
|
566
569
|
<UIcon
|
|
@@ -579,6 +582,7 @@ function removeCover() {
|
|
|
579
582
|
v-if="neighbours.next"
|
|
580
583
|
:to="getDocUrl(neighbours.next.id)"
|
|
581
584
|
class="group flex flex-col gap-1 rounded-xl border border-default px-4 py-3 text-right transition-colors hover:bg-black/5 sm:col-start-2 dark:hover:bg-white/5"
|
|
585
|
+
v-bind="neighbourMenu.bindForId(neighbours.next.id, neighbours.next.label)"
|
|
582
586
|
>
|
|
583
587
|
<span class="flex items-center justify-end gap-1.5 text-[10px] font-medium tracking-[0.22em] text-dimmed uppercase">
|
|
584
588
|
Older
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
useJunViewOptions
|
|
9
9
|
} from "#imports";
|
|
10
10
|
import { junViewSpecFor } from "../../utils/junViewSpecs";
|
|
11
|
+
import { useJunDocLinkMenu } from "../../composables/useJunDocLinkMenu";
|
|
11
12
|
import {
|
|
12
13
|
JUN_MATURITIES,
|
|
13
14
|
junGardenLayout
|
|
@@ -22,6 +23,7 @@ const props = defineProps({
|
|
|
22
23
|
const { editing } = useJunStudio();
|
|
23
24
|
const { renameDoc } = useJunRename();
|
|
24
25
|
const { getDocUrl } = useDocSlugs();
|
|
26
|
+
const focusId = ref(null);
|
|
25
27
|
const { view, set: setView, reset: resetView, isDefault: viewIsDefault, options: viewOptions } = useJunViewOptions(props.docId, {
|
|
26
28
|
typeKey: "garden",
|
|
27
29
|
options: junViewSpecFor("garden")
|
|
@@ -51,11 +53,41 @@ const points = computed(() => junGardenLayout(
|
|
|
51
53
|
}
|
|
52
54
|
));
|
|
53
55
|
const pointById = computed(() => new Map(points.value.map((p) => [p.id, p])));
|
|
56
|
+
const neighboursOf = computed(() => {
|
|
57
|
+
const map = /* @__PURE__ */ new Map();
|
|
58
|
+
const add = (a, b) => {
|
|
59
|
+
if (!map.has(a)) map.set(a, /* @__PURE__ */ new Set());
|
|
60
|
+
map.get(a).add(b);
|
|
61
|
+
};
|
|
62
|
+
for (const edge of edges.value) {
|
|
63
|
+
add(edge.source, edge.target);
|
|
64
|
+
add(edge.target, edge.source);
|
|
65
|
+
}
|
|
66
|
+
return map;
|
|
67
|
+
});
|
|
68
|
+
function isDimmed(id) {
|
|
69
|
+
const at = focusId.value;
|
|
70
|
+
if (!at || at === id) return false;
|
|
71
|
+
return !neighboursOf.value.get(at)?.has(id);
|
|
72
|
+
}
|
|
73
|
+
function edgeIsLit(source, target) {
|
|
74
|
+
const at = focusId.value;
|
|
75
|
+
return !!at && (source === at || target === at);
|
|
76
|
+
}
|
|
54
77
|
const lines = computed(() => edges.value.flatMap((edge) => {
|
|
55
78
|
const a = pointById.value.get(edge.source);
|
|
56
79
|
const b = pointById.value.get(edge.target);
|
|
57
80
|
if (!a || !b) return [];
|
|
58
|
-
return [{
|
|
81
|
+
return [{
|
|
82
|
+
key: `${edge.source}-${edge.target}`,
|
|
83
|
+
source: edge.source,
|
|
84
|
+
target: edge.target,
|
|
85
|
+
x1: a.x,
|
|
86
|
+
y1: a.y,
|
|
87
|
+
x2: b.x,
|
|
88
|
+
y2: b.y,
|
|
89
|
+
weight: edge.weight
|
|
90
|
+
}];
|
|
59
91
|
}));
|
|
60
92
|
function radiusOf(note) {
|
|
61
93
|
return Math.min(16, 5 + note.inbound.length * 2.5);
|
|
@@ -91,6 +123,7 @@ const MATURITY_CLASS = {
|
|
|
91
123
|
function renamePage(t) {
|
|
92
124
|
renameDoc(props.docId, t);
|
|
93
125
|
}
|
|
126
|
+
const noteMenu = useJunDocLinkMenu({ surface: "card" });
|
|
94
127
|
</script>
|
|
95
128
|
|
|
96
129
|
<template>
|
|
@@ -164,47 +197,69 @@ function renamePage(t) {
|
|
|
164
197
|
:x2="line.x2"
|
|
165
198
|
:y2="line.y2"
|
|
166
199
|
:stroke-width="Math.min(line.weight, 3)"
|
|
167
|
-
:stroke-opacity="0.14 + Math.min(line.weight, 4) * 0.04"
|
|
200
|
+
:stroke-opacity="focusId ? edgeIsLit(line.source, line.target) ? 0.55 : 0.05 : 0.14 + Math.min(line.weight, 4) * 0.04"
|
|
201
|
+
class="jun-garden-edge"
|
|
168
202
|
/>
|
|
169
203
|
</g>
|
|
170
204
|
<g
|
|
171
205
|
v-for="note in notes"
|
|
172
206
|
:key="note.id"
|
|
207
|
+
class="jun-garden-node"
|
|
208
|
+
:class="isDimmed(note.id) ? 'is-dimmed' : ''"
|
|
173
209
|
>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
210
|
+
<!-- `<NuxtLink custom>`, not a bare `<a :href>`. The anchor keeps a
|
|
211
|
+
real href — a crawler, a middle-click and "copy link address" all
|
|
212
|
+
need one — and a plain left click routes in place instead of
|
|
213
|
+
reloading the entire application, which is what this graph did
|
|
214
|
+
for every note it drew. -->
|
|
215
|
+
<NuxtLink
|
|
216
|
+
:to="note.href ?? getDocUrl(note.id)"
|
|
217
|
+
custom
|
|
177
218
|
>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
219
|
+
<template #default="{ href, navigate }">
|
|
220
|
+
<a
|
|
221
|
+
:href="href"
|
|
222
|
+
:data-jun-node="note.id"
|
|
223
|
+
:aria-label="note.label"
|
|
224
|
+
v-bind="noteMenu.bindForId(note.id, note.label)"
|
|
225
|
+
@click="navigate"
|
|
226
|
+
@pointerenter="focusId = note.id"
|
|
227
|
+
@pointerleave="focusId = null"
|
|
228
|
+
@focus="focusId = note.id"
|
|
229
|
+
@blur="focusId = null"
|
|
230
|
+
>
|
|
231
|
+
<!-- The finger's target, and it is invisible. A note's disc is
|
|
232
|
+
5–16 user units, which on a phone is a handful of screen
|
|
233
|
+
pixels — `.jun-tap`'s pseudo-element cannot help here (an
|
|
234
|
+
SVG node takes no `position: relative`), so this is the SVG
|
|
235
|
+
spelling of the same idea: a transparent circle sized in CSS
|
|
236
|
+
from the drawn scale, so it is ~22 CSS px across whatever
|
|
237
|
+
the graph is squeezed to. `fill="transparent"` rather than
|
|
238
|
+
`none` — a `none` fill is not hit-tested at all. -->
|
|
239
|
+
<circle
|
|
240
|
+
class="jun-garden-hit"
|
|
241
|
+
:cx="pointById.get(note.id)?.x ?? 0"
|
|
242
|
+
:cy="pointById.get(note.id)?.y ?? 0"
|
|
243
|
+
fill="transparent"
|
|
244
|
+
/>
|
|
245
|
+
<circle
|
|
246
|
+
:cx="pointById.get(note.id)?.x ?? 0"
|
|
247
|
+
:cy="pointById.get(note.id)?.y ?? 0"
|
|
248
|
+
:r="radiusOf(note)"
|
|
249
|
+
fill="currentColor"
|
|
250
|
+
:fill-opacity="note.inbound.length ? 0.65 : 0.28"
|
|
251
|
+
/>
|
|
252
|
+
<text
|
|
253
|
+
v-if="view.labels"
|
|
254
|
+
class="jun-garden-label fill-current"
|
|
255
|
+
:x="labelsLeft(note) ? (pointById.get(note.id)?.x ?? 0) - radiusOf(note) - 6 : (pointById.get(note.id)?.x ?? 0) + radiusOf(note) + 6"
|
|
256
|
+
:y="(pointById.get(note.id)?.y ?? 0) + 4"
|
|
257
|
+
:text-anchor="labelsLeft(note) ? 'end' : 'start'"
|
|
258
|
+
fill-opacity="0.75"
|
|
259
|
+
>{{ note.label }}</text>
|
|
260
|
+
</a>
|
|
261
|
+
</template>
|
|
262
|
+
</NuxtLink>
|
|
208
263
|
</g>
|
|
209
264
|
</svg>
|
|
210
265
|
</div>
|
|
@@ -221,6 +276,7 @@ function renamePage(t) {
|
|
|
221
276
|
:key="note.id"
|
|
222
277
|
class="jun-card rounded-2xl p-4 sm:p-5"
|
|
223
278
|
:data-jun-note="note.id"
|
|
279
|
+
v-bind="noteMenu.bindForId(note.id, note.label)"
|
|
224
280
|
>
|
|
225
281
|
<div class="flex flex-wrap items-baseline gap-x-3 gap-y-1">
|
|
226
282
|
<NuxtLink
|
|
@@ -258,6 +314,7 @@ function renamePage(t) {
|
|
|
258
314
|
:key="from.id"
|
|
259
315
|
:to="from.href ?? getDocUrl(from.id)"
|
|
260
316
|
class="underline-offset-4 hover:underline"
|
|
317
|
+
v-bind="noteMenu.bindForId(from.id, from.label)"
|
|
261
318
|
>{{ from.label }}</NuxtLink>
|
|
262
319
|
</p>
|
|
263
320
|
<p
|
|
@@ -287,6 +344,7 @@ function renamePage(t) {
|
|
|
287
344
|
<NuxtLink
|
|
288
345
|
:to="note.href ?? getDocUrl(note.id)"
|
|
289
346
|
class="text-sm text-muted underline-offset-4 hover:underline"
|
|
347
|
+
v-bind="noteMenu.bindForId(note.id, note.label)"
|
|
290
348
|
>
|
|
291
349
|
{{ note.label }}
|
|
292
350
|
</NuxtLink>
|
|
@@ -313,5 +371,5 @@ function renamePage(t) {
|
|
|
313
371
|
</template>
|
|
314
372
|
|
|
315
373
|
<style scoped>
|
|
316
|
-
.jun-garden-graph{overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain}.jun-garden-graph svg{min-width:32rem}.jun-garden-label{font-size:calc(12px*var(--jun-garden-k, 1))}.jun-garden-hit{r:calc(13px*var(--jun-garden-k, 1))}
|
|
374
|
+
.jun-garden-graph{overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain}.jun-garden-graph svg{min-width:32rem}.jun-garden-label{font-size:calc(12px*var(--jun-garden-k, 1))}.jun-garden-hit{r:calc(13px*var(--jun-garden-k, 1))}.jun-garden-node{transition:opacity .18s ease}.jun-garden-node.is-dimmed{opacity:.25}.jun-garden-edge{transition:stroke-opacity .18s ease}.jun-garden-node a:focus-visible{border-radius:2px;outline:2px solid var(--ui-primary);outline-offset:2px}@media (prefers-reduced-motion:reduce){.jun-garden-edge,.jun-garden-node{transition:none}}
|
|
317
375
|
</style>
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
useJunViewingAccent,
|
|
18
18
|
useJunViewOptions
|
|
19
19
|
} from "#imports";
|
|
20
|
+
import { useJunDocLinkMenu } from "../../composables/useJunDocLinkMenu";
|
|
20
21
|
import { JUN_HOME_SECTIONS, junViewSpecFor } from "../../utils/junViewSpecs";
|
|
21
22
|
const props = defineProps({
|
|
22
23
|
docId: { type: String, required: true },
|
|
@@ -34,6 +35,7 @@ const { renameDoc } = useJunRename();
|
|
|
34
35
|
const { typeIdFor, resolveType } = useJunPageType();
|
|
35
36
|
const { brand } = useJunOptions();
|
|
36
37
|
const docIcon = useJunDocIcon();
|
|
38
|
+
const sectionMenu = useJunDocLinkMenu({ surface: "card" });
|
|
37
39
|
const { onActivate } = useJunOpenDoc();
|
|
38
40
|
const { accentInsetStyle, accentTitle } = useJunViewingAccent();
|
|
39
41
|
const pageMeta = computed(
|
|
@@ -229,6 +231,7 @@ const titleOfSection = (id, fallback) => (id === "latest" ? journalPage.value?.l
|
|
|
229
231
|
v-if="journalPage"
|
|
230
232
|
:to="hrefOf(journalPage)"
|
|
231
233
|
class="jun-tap text-xs text-muted transition-colors hover:text-default"
|
|
234
|
+
v-bind="sectionMenu.bindForId(journalPage.id, journalPage.label)"
|
|
232
235
|
>All →</NuxtLink>
|
|
233
236
|
</div>
|
|
234
237
|
<ul :class="layout === 'magazine' ? 'grid grid-cols-1 gap-3 sm:grid-cols-2' : 'flex flex-col gap-3'">
|
|
@@ -287,6 +290,7 @@ const titleOfSection = (id, fallback) => (id === "latest" ? journalPage.value?.l
|
|
|
287
290
|
v-if="appsPage"
|
|
288
291
|
:to="hrefOf(appsPage)"
|
|
289
292
|
class="jun-tap text-xs text-muted transition-colors hover:text-default"
|
|
293
|
+
v-bind="sectionMenu.bindForId(appsPage.id, appsPage.label)"
|
|
290
294
|
>All →</NuxtLink>
|
|
291
295
|
</div>
|
|
292
296
|
<div class="grid grid-cols-3 gap-3 sm:grid-cols-4 sm:gap-4">
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
useJunViewOptions
|
|
19
19
|
} from "#imports";
|
|
20
20
|
import { junViewSpecFor } from "../../utils/junViewSpecs";
|
|
21
|
+
import { useJunDocLinkMenu } from "../../composables/useJunDocLinkMenu";
|
|
21
22
|
const props = defineProps({
|
|
22
23
|
docId: { type: String, required: true },
|
|
23
24
|
docLabel: { type: String, required: false },
|
|
@@ -34,6 +35,7 @@ const { editing } = useJunStudio();
|
|
|
34
35
|
const { renameDoc } = useJunRename();
|
|
35
36
|
const { uploadTo, imageFiles } = useJunUpload();
|
|
36
37
|
const docIcon = useJunDocIcon();
|
|
38
|
+
const linkMenu = useJunDocLinkMenu({ surface: "list" });
|
|
37
39
|
const entry = computed(() => getEntry(props.docId));
|
|
38
40
|
const title = computed(() => entry.value?.label ?? props.docLabel ?? "Untitled");
|
|
39
41
|
const meta = computed(
|
|
@@ -196,6 +198,7 @@ async function onDrop(e) {
|
|
|
196
198
|
v-if="parentId && parent"
|
|
197
199
|
:to="getDocUrl(parentId)"
|
|
198
200
|
class="group mb-6 inline-flex items-center gap-1.5 text-xs tracking-wide text-dimmed transition-colors hover:text-default"
|
|
201
|
+
v-bind="linkMenu.bindForId(parentId, parent.label)"
|
|
199
202
|
>
|
|
200
203
|
<UIcon
|
|
201
204
|
name="i-lucide-arrow-left"
|
|
@@ -366,6 +369,7 @@ async function onDrop(e) {
|
|
|
366
369
|
:to="getDocUrl(sib.id)"
|
|
367
370
|
class="group relative flex items-center gap-2 rounded-lg px-2 py-1.5 text-sm text-muted transition-colors hover:bg-black/5 hover:text-default dark:hover:bg-white/5"
|
|
368
371
|
:title="accentTitle(sib.id)"
|
|
372
|
+
v-bind="linkMenu.bindForId(sib.id, sib.label)"
|
|
369
373
|
>
|
|
370
374
|
<span
|
|
371
375
|
v-if="accentInsetStyle(sib.id)"
|
|
@@ -515,6 +515,7 @@ const hereNow = computed(() => people.value.filter((t) => !t.idle).length);
|
|
|
515
515
|
:live="pane.live"
|
|
516
516
|
:no-scroll="pane.noScroll"
|
|
517
517
|
:to="!pane.interactive && !editing ? getDocUrl(pane.targetId) : null"
|
|
518
|
+
:link-doc-id="pane.targetId"
|
|
518
519
|
:fallback-note="editing ? pane.note : ''"
|
|
519
520
|
/>
|
|
520
521
|
</template>
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
useJunUpload,
|
|
17
17
|
useJunViewOptions
|
|
18
18
|
} from "#imports";
|
|
19
|
+
import { useJunDocLinkMenu } from "../../composables/useJunDocLinkMenu";
|
|
19
20
|
import { junViewSpecFor } from "../../utils/junViewSpecs";
|
|
20
21
|
const props = defineProps({
|
|
21
22
|
docId: { type: String, required: true },
|
|
@@ -28,6 +29,7 @@ const abra = useAbracadabra();
|
|
|
28
29
|
const tree = useChildTree(abra.doc, props.docId);
|
|
29
30
|
const { entries, getEntry } = useDocTree();
|
|
30
31
|
const { getDocUrl } = useDocSlugs();
|
|
32
|
+
const siblingMenu = useJunDocLinkMenu({ surface: "list" });
|
|
31
33
|
const otherChildren = computed(
|
|
32
34
|
() => (tree.childrenOf(null) ?? []).filter((e) => !!e.label)
|
|
33
35
|
);
|
|
@@ -374,6 +376,7 @@ const factLine = computed(
|
|
|
374
376
|
<NuxtLink
|
|
375
377
|
:to="t.href"
|
|
376
378
|
class="flex items-center gap-3 rounded-lg px-2 py-2 transition-colors hover:bg-black/5 dark:hover:bg-white/5"
|
|
379
|
+
v-bind="siblingMenu.bindForId(t.id, t.label)"
|
|
377
380
|
>
|
|
378
381
|
<span class="w-5 text-center text-xs tabular-nums text-dimmed">{{ i + 1 }}</span>
|
|
379
382
|
<span class="min-w-0 flex-1">
|
|
@@ -20,6 +20,14 @@
|
|
|
20
20
|
* two bars sharing a corner stack instead of overlapping. They fall back to
|
|
21
21
|
* `0px`, which is exactly right for the visitor who has no studio bar.
|
|
22
22
|
*
|
|
23
|
+
* **A renderer's own furniture declares itself.** The navbar, the player and a
|
|
24
|
+
* panel renderer's toolbar are found by class here because they are known
|
|
25
|
+
* surfaces. Anything else that docks to a viewport edge — the globe's timeline
|
|
26
|
+
* is the first — carries `data-jun-chrome-edge="top"` or `="bottom"` and is
|
|
27
|
+
* measured with them. Without that contract the timeline was invisible to this
|
|
28
|
+
* module and sat directly on top of the studio bar and the user center on every
|
|
29
|
+
* viewport narrower than its own width cap.
|
|
30
|
+
*
|
|
23
31
|
* CSS variables rather than reactive numbers, deliberately: the bars then get a
|
|
24
32
|
* transition on `bottom`/`left` for free, so a navbar that moves is answered by
|
|
25
33
|
* bars that GLIDE out of its way rather than teleporting. It also means nothing
|
|
@@ -51,6 +59,12 @@ export declare function junMirrorCorner(corner: JunCorner, placement: string): J
|
|
|
51
59
|
* whether the layout remembered to call it. The navbar itself never has to
|
|
52
60
|
* know anyone is listening.
|
|
53
61
|
*/
|
|
62
|
+
/**
|
|
63
|
+
* Tell the chrome geometry that a surface claiming an edge has appeared,
|
|
64
|
+
* changed size or gone away. Safe to call at any time, on either side: it
|
|
65
|
+
* no-ops when nothing is measuring.
|
|
66
|
+
*/
|
|
67
|
+
export declare function junChromeNudge(): void;
|
|
54
68
|
export declare function useJunChromeInsets(): {
|
|
55
69
|
navPlacement: Ref<string, string>;
|
|
56
70
|
};
|
|
@@ -86,6 +86,20 @@ function measure() {
|
|
|
86
86
|
else out.edges.bottom = Math.max(out.edges.bottom, vh - pr.top);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
for (const el of document.querySelectorAll("[data-jun-chrome-edge]")) {
|
|
90
|
+
const edge = el.dataset.junChromeEdge;
|
|
91
|
+
if (edge !== "top" && edge !== "bottom") continue;
|
|
92
|
+
const r = el.getBoundingClientRect();
|
|
93
|
+
if (r.width <= 0 || r.height <= 0) continue;
|
|
94
|
+
const EDGE_SLACK = 2;
|
|
95
|
+
if (edge === "bottom") {
|
|
96
|
+
if (r.bottom < vh - EDGE_SLACK) continue;
|
|
97
|
+
out.edges.bottom = Math.max(out.edges.bottom, vh - r.top);
|
|
98
|
+
} else {
|
|
99
|
+
if (r.top > EDGE_SLACK) continue;
|
|
100
|
+
out.edges.top = Math.max(out.edges.top, r.bottom);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
89
103
|
const panel = document.querySelector(".jun-panel-page");
|
|
90
104
|
if (panel) {
|
|
91
105
|
const pr = panel.getBoundingClientRect();
|
|
@@ -182,6 +196,9 @@ function detach() {
|
|
|
182
196
|
if (raf) cancelAnimationFrame(raf);
|
|
183
197
|
raf = 0;
|
|
184
198
|
}
|
|
199
|
+
export function junChromeNudge() {
|
|
200
|
+
if (import.meta.client) nudge();
|
|
201
|
+
}
|
|
185
202
|
export function useJunChromeInsets() {
|
|
186
203
|
const route = useRoute();
|
|
187
204
|
if (import.meta.client) {
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type JunMenuGroups, type JunMenuSurface, type JunMenuTree } from './useJunDocMenu.js';
|
|
2
|
+
/** The minimum a surface has to know about a document to offer its menu. */
|
|
3
|
+
export interface JunLinkEntry {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
meta?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface JunPressMenuBind {
|
|
10
|
+
onContextmenu: (e: MouseEvent) => void;
|
|
11
|
+
onPointerdown: (e: PointerEvent) => void;
|
|
12
|
+
onPointermove: (e: PointerEvent) => void;
|
|
13
|
+
onPointerup: () => void;
|
|
14
|
+
onPointercancel: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* BOTH phases, and both are needed.
|
|
17
|
+
*
|
|
18
|
+
* When the bind sits on the link itself, the capture listener runs before
|
|
19
|
+
* vue-router's own handler and `preventDefault()` is what stops it —
|
|
20
|
+
* `guardEvent` returns early on a defaultPrevented event, which is also how
|
|
21
|
+
* `⌘`-click has always opened a new tab instead of navigating.
|
|
22
|
+
*
|
|
23
|
+
* When the bind sits INSIDE the link — a `<UBreadcrumb>` `#item` slot lives
|
|
24
|
+
* inside `<ULinkBase>`, which handles click on itself in the bubble phase —
|
|
25
|
+
* capture on the inner element is too late to matter and the bubble listener
|
|
26
|
+
* is what gets there first.
|
|
27
|
+
*/
|
|
28
|
+
onClick: (e: MouseEvent) => void;
|
|
29
|
+
onClickCapture: (e: MouseEvent) => void;
|
|
30
|
+
}
|
|
31
|
+
export interface JunDocLinkMenuOptions {
|
|
32
|
+
/** Which surface this is, so a contributed builder can branch on it. */
|
|
33
|
+
surface?: JunMenuSurface;
|
|
34
|
+
/**
|
|
35
|
+
* The container's `useChildTree(...)` when the surface has one. Omitted, the
|
|
36
|
+
* SITE tree is used — see `useJunMenuTree` — so a breadcrumb or a graph node
|
|
37
|
+
* still offers the owner vocabulary rather than a read-only stub.
|
|
38
|
+
*/
|
|
39
|
+
tree?: JunMenuTree;
|
|
40
|
+
/** Sibling ids in display order — enables "Pin to top". */
|
|
41
|
+
siblings?: () => string[];
|
|
42
|
+
/** Hide "Open": the element already navigates there. Defaults to TRUE. */
|
|
43
|
+
noOpen?: boolean;
|
|
44
|
+
/** One-off groups, appended after the built ones. */
|
|
45
|
+
extra?: (entry: JunLinkEntry) => JunMenuGroups | undefined;
|
|
46
|
+
/** The surface's own rename affordance. Omit and "Rename" is hidden. */
|
|
47
|
+
onRename?: (entry: JunLinkEntry) => void;
|
|
48
|
+
/** Called after the document moves to trash. */
|
|
49
|
+
onDeleted?: (id: string) => void;
|
|
50
|
+
/** Which way the panel should prefer to open. */
|
|
51
|
+
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
52
|
+
}
|
|
53
|
+
export interface JunDocLinkMenuApi {
|
|
54
|
+
/** Listeners for one document's link. */
|
|
55
|
+
bindFor: (entry: JunLinkEntry) => JunPressMenuBind;
|
|
56
|
+
/**
|
|
57
|
+
* The same, from an id alone — the label, type and meta are read out of the
|
|
58
|
+
* live tree. This is the form nearly every surface wants: a "read next" link,
|
|
59
|
+
* a graph node and a citation all know an id and a display string, and
|
|
60
|
+
* spelling out `type:` and `meta:` at each of them is the boilerplate that
|
|
61
|
+
* keeps a menu from being added.
|
|
62
|
+
*/
|
|
63
|
+
bindForId: (id: string, fallbackLabel?: string) => JunPressMenuBind;
|
|
64
|
+
/** The built groups for one document — for a surface that renders its own. */
|
|
65
|
+
itemsFor: (entry: JunLinkEntry) => JunMenuGroups;
|
|
66
|
+
/** Open one by hand, e.g. from a dedicated `⋯` button. */
|
|
67
|
+
openFor: (entry: JunLinkEntry, x: number, y: number) => void;
|
|
68
|
+
}
|
|
69
|
+
export declare function useJunDocLinkMenu(options?: JunDocLinkMenuOptions): JunDocLinkMenuApi;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { onBeforeUnmount } from "vue";
|
|
2
|
+
import { useDocTree } from "#imports";
|
|
3
|
+
import {
|
|
4
|
+
useJunDocMenu
|
|
5
|
+
} from "./useJunDocMenu.js";
|
|
6
|
+
import { useJunDocMenuHost, useJunMenuTree } from "./useJunDocMenuHost.js";
|
|
7
|
+
import { useJunStudio } from "./useJunStudio.js";
|
|
8
|
+
const PRESS_SLOP_PX = 8;
|
|
9
|
+
const PRESS_MS = 500;
|
|
10
|
+
const CLICK_GUARD_MS = 700;
|
|
11
|
+
export function useJunDocLinkMenu(options = {}) {
|
|
12
|
+
const { show, hide } = useJunDocMenuHost();
|
|
13
|
+
const { itemsFor: build } = useJunDocMenu();
|
|
14
|
+
const { editing } = useJunStudio();
|
|
15
|
+
const siteTree = useJunMenuTree();
|
|
16
|
+
const { getEntry } = useDocTree();
|
|
17
|
+
let timer = null;
|
|
18
|
+
let start = null;
|
|
19
|
+
let suppressClickUntil = 0;
|
|
20
|
+
function cancel() {
|
|
21
|
+
if (timer) clearTimeout(timer);
|
|
22
|
+
timer = null;
|
|
23
|
+
start = null;
|
|
24
|
+
}
|
|
25
|
+
function itemsFor(entry) {
|
|
26
|
+
if (!entry?.id) return [];
|
|
27
|
+
return build(
|
|
28
|
+
{
|
|
29
|
+
docId: entry.id,
|
|
30
|
+
label: entry.label || "Untitled",
|
|
31
|
+
type: entry.type,
|
|
32
|
+
meta: entry.meta,
|
|
33
|
+
surface: options.surface ?? "list",
|
|
34
|
+
editing: editing.value
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
tree: options.tree ?? siteTree(),
|
|
38
|
+
noOpen: options.noOpen ?? true,
|
|
39
|
+
siblings: options.siblings?.(),
|
|
40
|
+
extra: options.extra?.(entry),
|
|
41
|
+
onRename: options.onRename ? () => options.onRename(entry) : void 0,
|
|
42
|
+
onDeleted: options.onDeleted
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function suppressClick(e) {
|
|
47
|
+
if (performance.now() >= suppressClickUntil) return;
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
}
|
|
51
|
+
function openFor(entry, x, y) {
|
|
52
|
+
show(itemsFor(entry), x, y, options.side);
|
|
53
|
+
}
|
|
54
|
+
function bindFor(entry) {
|
|
55
|
+
return {
|
|
56
|
+
onContextmenu(e) {
|
|
57
|
+
const built = itemsFor(entry);
|
|
58
|
+
if (!built.length) return;
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
show(built, e.clientX, e.clientY, options.side);
|
|
62
|
+
},
|
|
63
|
+
onPointerdown(e) {
|
|
64
|
+
if (e.pointerType === "mouse") return;
|
|
65
|
+
cancel();
|
|
66
|
+
start = { x: e.clientX, y: e.clientY };
|
|
67
|
+
const at = { x: e.clientX, y: e.clientY };
|
|
68
|
+
timer = setTimeout(() => {
|
|
69
|
+
timer = null;
|
|
70
|
+
const built = itemsFor(entry);
|
|
71
|
+
if (!built.length) return;
|
|
72
|
+
suppressClickUntil = performance.now() + CLICK_GUARD_MS;
|
|
73
|
+
show(built, at.x, at.y, options.side);
|
|
74
|
+
}, PRESS_MS);
|
|
75
|
+
},
|
|
76
|
+
onPointermove(e) {
|
|
77
|
+
if (!start) return;
|
|
78
|
+
if (Math.hypot(e.clientX - start.x, e.clientY - start.y) <= PRESS_SLOP_PX) return;
|
|
79
|
+
cancel();
|
|
80
|
+
hide();
|
|
81
|
+
},
|
|
82
|
+
onPointerup: cancel,
|
|
83
|
+
onPointercancel: cancel,
|
|
84
|
+
onClick: suppressClick,
|
|
85
|
+
onClickCapture: suppressClick
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function bindForId(id, fallbackLabel) {
|
|
89
|
+
const entry = getEntry(id);
|
|
90
|
+
return bindFor({
|
|
91
|
+
id,
|
|
92
|
+
label: entry?.label || fallbackLabel || "Untitled",
|
|
93
|
+
type: entry?.type,
|
|
94
|
+
meta: entry?.meta
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
onBeforeUnmount(cancel);
|
|
98
|
+
return { bindFor, bindForId, itemsFor, openFor };
|
|
99
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { JunMenuGroups, JunMenuTree } from './useJunDocMenu.js';
|
|
3
|
+
export interface JunDocMenuAt {
|
|
4
|
+
items: JunMenuGroups;
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
/** Which way the panel should prefer to open. */
|
|
8
|
+
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
9
|
+
}
|
|
10
|
+
export declare function useJunDocMenuHost(): {
|
|
11
|
+
at: Ref<JunDocMenuAt | null>;
|
|
12
|
+
show: (items: JunMenuGroups, x: number, y: number, side?: JunDocMenuAt['side']) => void;
|
|
13
|
+
hide: () => void;
|
|
14
|
+
};
|
|
15
|
+
/** Called by `<JunDocMenuHost>`. Not part of the public surface. */
|
|
16
|
+
export declare function provideJunMenuTree(tree: JunMenuTree): void;
|
|
17
|
+
/** The site tree, or `undefined` before the host has mounted. */
|
|
18
|
+
export declare function useJunMenuTree(): () => JunMenuTree | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useState } from "#app";
|
|
2
|
+
export function useJunDocMenuHost() {
|
|
3
|
+
const at = useState("jun-doc-menu-at", () => null);
|
|
4
|
+
return {
|
|
5
|
+
at,
|
|
6
|
+
/**
|
|
7
|
+
* An EMPTY menu must not open. A site with `contextMenu.visitor = false`
|
|
8
|
+
* builds no items for a visitor, and a blank popover is worse than the
|
|
9
|
+
* browser's own menu — which is what not opening hands back.
|
|
10
|
+
*/
|
|
11
|
+
show(items, x, y, side) {
|
|
12
|
+
if (!items.length) return;
|
|
13
|
+
at.value = { items, x, y, side };
|
|
14
|
+
},
|
|
15
|
+
hide() {
|
|
16
|
+
at.value = null;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
let sharedTree;
|
|
21
|
+
export function provideJunMenuTree(tree) {
|
|
22
|
+
if (import.meta.client) sharedTree = tree;
|
|
23
|
+
}
|
|
24
|
+
export function useJunMenuTree() {
|
|
25
|
+
return () => sharedTree;
|
|
26
|
+
}
|
|
@@ -17,3 +17,16 @@ import { type ComputedRef } from 'vue';
|
|
|
17
17
|
export declare function useJunSurface(): {
|
|
18
18
|
isEmbedded: ComputedRef<boolean>;
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Declare that every renderer mounted below this component is on a bounded
|
|
22
|
+
* PANEL surface rather than owning the viewport.
|
|
23
|
+
*
|
|
24
|
+
* The mirror of `useJunSurface()`, and guarded the same way for the same
|
|
25
|
+
* reason: an auto-import that never resolved compiles to a FREE IDENTIFIER,
|
|
26
|
+
* which throws a `ReferenceError` on call and takes the whole component down
|
|
27
|
+
* with it. `provideRendererSurface` landed upstream in 2.62 and this module's
|
|
28
|
+
* floor is well past that, so the guard is belt and braces — but a component
|
|
29
|
+
* that silently does not declare its surface is a much smaller failure than one
|
|
30
|
+
* that does not render, and this is the only way to choose which.
|
|
31
|
+
*/
|
|
32
|
+
export declare function provideJunPanelSurface(): void;
|
|
@@ -207,6 +207,13 @@ if (import.meta.client && contextMenu.suppressNative) {
|
|
|
207
207
|
<JunNodePanel />
|
|
208
208
|
</ClientOnly>
|
|
209
209
|
|
|
210
|
+
<!-- The document menu, for every surface that links to a document and has
|
|
211
|
+
nowhere to put a wrapper: breadcrumbs, "read next", a garden's graph
|
|
212
|
+
nodes, the nav's sub-page flyout, a course's steps. Mounted once, here,
|
|
213
|
+
so it survives the navigation its own items trigger — and it renders
|
|
214
|
+
nothing at all until something is pressed. See `useJunDocMenuHost`. -->
|
|
215
|
+
<JunDocMenuHost />
|
|
216
|
+
|
|
210
217
|
<!-- The owner studio: login modal and edit-mode dock. Invisible to visitors. -->
|
|
211
218
|
<template v-if="features.studio">
|
|
212
219
|
<JunStudioLogin />
|