@abraca/junis 2.102.0 → 2.103.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/module.mjs +54 -2
- package/dist/runtime/components/JunBreadcrumbs.vue +4 -2
- package/dist/runtime/components/JunCampfirePresence.client.vue +16 -13
- package/dist/runtime/components/JunCollectionIntro.vue +1 -1
- package/dist/runtime/components/JunEditor.d.ts +19 -0
- package/dist/runtime/components/JunEditor.js +9 -0
- package/dist/runtime/components/JunFooter.vue +5 -3
- package/dist/runtime/components/JunNavigation.vue +17 -12
- package/dist/runtime/components/JunNodePanel.client.vue +7 -1
- package/dist/runtime/components/JunSettings.client.vue +7 -1
- package/dist/runtime/components/renderers/JunCinemaRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunDeckRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunEntryRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunHomeRenderer.vue +5 -3
- package/dist/runtime/components/renderers/JunItemRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunJournalRenderer.vue +6 -2
- package/dist/runtime/components/renderers/JunLibraryRenderer.vue +3 -3
- package/dist/runtime/components/renderers/JunLiveRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunMosaicRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunMovieRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunNowRenderer.vue +2 -2
- package/dist/runtime/components/renderers/JunPollRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunProjectRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunServicesRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunStatsRenderer.vue +4 -2
- package/dist/runtime/components/renderers/JunThreadRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunTrackRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunUsesRenderer.vue +1 -1
- package/dist/runtime/composables/useJunChrome.js +105 -17
- package/dist/runtime/composables/useJunCurrentDoc.js +6 -5
- package/dist/runtime/composables/useJunNavItems.js +4 -4
- package/dist/runtime/composables/useJunNavSettings.js +4 -3
- package/dist/runtime/composables/useJunOffline.js +1 -1
- package/dist/runtime/composables/useJunRootId.d.ts +18 -0
- package/dist/runtime/composables/useJunRootId.js +7 -0
- package/dist/runtime/composables/useJunSiteConfig.d.ts +8 -1
- package/dist/runtime/composables/useJunSiteConfig.js +27 -15
- package/dist/runtime/lazy/junSdkBackground.d.ts +10 -0
- package/dist/runtime/lazy/junSdkBackground.js +1 -0
- package/dist/runtime/plugins/jun-doc-tree.js +8 -0
- package/dist/runtime/plugins/jun-editor-defer.client.d.ts +2 -0
- package/dist/runtime/plugins/jun-editor-defer.client.js +12 -0
- package/dist/runtime/plugins/jun-editor-defer.server.d.ts +2 -0
- package/dist/runtime/plugins/jun-editor-defer.server.js +10 -0
- package/dist/runtime/plugins/jun-fresh-server.client.js +46 -31
- package/dist/runtime/plugins/jun-site-config.js +8 -0
- package/dist/runtime/server/plugins/jun-bootstrap.js +7 -2
- package/dist/runtime/server/utils/junCache.js +25 -2
- package/dist/runtime/utils/junDate.js +6 -2
- package/dist/runtime/utils/junSsrMemo.d.ts +19 -0
- package/dist/runtime/utils/junSsrMemo.js +11 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
-
import {
|
|
2
|
+
import { relative } from 'node:path';
|
|
3
|
+
import { defineNuxtModule, createResolver, hasNuxtModule, installModule, addImportsDir, addComponentsDir, addPluginTemplate, addTemplate, addTypeTemplate, addPlugin, addLayout, extendPages, addServerImportsDir, addServerHandler, addServerPlugin, addServerTemplate } from '@nuxt/kit';
|
|
3
4
|
import { defu } from 'defu';
|
|
4
5
|
import { JUN_RUNTIME_BACKDROPS } from '../dist/runtime/types.js';
|
|
5
6
|
import { JUN_NEUTRALS } from '../dist/runtime/utils/junMark.js';
|
|
@@ -1077,7 +1078,13 @@ Switch them off with \`jun.pageTypes: { ${missing.map((e) => `${e.key}: false`).
|
|
|
1077
1078
|
// generated types are refreshed.
|
|
1078
1079
|
nuxt.options.runtimeConfig.jun,
|
|
1079
1080
|
{
|
|
1080
|
-
|
|
1081
|
+
// Only the switch — `NUXT_JUN_SEED_ENABLED=false` must keep working.
|
|
1082
|
+
// The TREE lives in the `#jun-seed` server template below: Nitro
|
|
1083
|
+
// deep-clones the whole runtime config and walks every key against
|
|
1084
|
+
// `process.env` on EVERY request (`useRuntimeConfig(event)`), and a
|
|
1085
|
+
// starter tree is ~90 KB / 1,150 keys that only the seeder reads,
|
|
1086
|
+
// once, at boot — measured at ~6 ms of each jun-is page render.
|
|
1087
|
+
seed: { enabled: options.seed?.enabled !== false },
|
|
1081
1088
|
janitor: resolveJanitor(options.janitor, runtime.features.janitor === true),
|
|
1082
1089
|
// Server-only, and it must stay that way: a token in the public block
|
|
1083
1090
|
// is a token published to every visitor. `NUXT_JUN_GITHUB_TOKEN`
|
|
@@ -1212,6 +1219,46 @@ Switch them off with \`jun.pageTypes: { ${missing.map((e) => `${e.key}: false`).
|
|
|
1212
1219
|
].join("\n");
|
|
1213
1220
|
}
|
|
1214
1221
|
});
|
|
1222
|
+
let aeditorPath;
|
|
1223
|
+
nuxt.hook("components:extend", (components) => {
|
|
1224
|
+
aeditorPath = components.find((c) => c.pascalName === "AEditor" && !c.island)?.filePath;
|
|
1225
|
+
});
|
|
1226
|
+
addTemplate({
|
|
1227
|
+
filename: "jun-editor.mjs",
|
|
1228
|
+
getContents: () => {
|
|
1229
|
+
if (!aeditorPath) {
|
|
1230
|
+
return [
|
|
1231
|
+
"// AUTO-GENERATED by @abraca/junis \u2014 AEditor was not found in the components registry.",
|
|
1232
|
+
"export const AEDITOR_SSR_ID = null",
|
|
1233
|
+
"/** @type {() => Promise<import('vue').Component>} */",
|
|
1234
|
+
"export const loadAEditor = () => Promise.reject(new Error('[@abraca/junis] <AEditor> is not registered \u2014 is @abraca/nuxt installed?'))",
|
|
1235
|
+
""
|
|
1236
|
+
].join("\n");
|
|
1237
|
+
}
|
|
1238
|
+
return [
|
|
1239
|
+
"// AUTO-GENERATED by @abraca/junis \u2014 see `<JunEditor>`.",
|
|
1240
|
+
`export const AEDITOR_SSR_ID = ${JSON.stringify(relative(nuxt.options.srcDir, aeditorPath))}`,
|
|
1241
|
+
// Annotated: an inferred type here names @abraca/nuxt's internal types,
|
|
1242
|
+
// which the module's declaration build rejects as non-portable.
|
|
1243
|
+
"/** @type {() => Promise<import('vue').Component>} */",
|
|
1244
|
+
`export const loadAEditor = () => import(${JSON.stringify(aeditorPath)}).then(m => m.default || m)`,
|
|
1245
|
+
""
|
|
1246
|
+
].join("\n");
|
|
1247
|
+
}
|
|
1248
|
+
});
|
|
1249
|
+
addTypeTemplate({
|
|
1250
|
+
filename: "types/jun-editor.d.ts",
|
|
1251
|
+
getContents: () => [
|
|
1252
|
+
"declare module '#build/jun-editor.mjs' {",
|
|
1253
|
+
" export const AEDITOR_SSR_ID: string | null",
|
|
1254
|
+
" export const loadAEditor: () => Promise<import('vue').Component>",
|
|
1255
|
+
"}",
|
|
1256
|
+
"export {}",
|
|
1257
|
+
""
|
|
1258
|
+
].join("\n")
|
|
1259
|
+
});
|
|
1260
|
+
addPlugin({ src: resolver.resolve("./runtime/plugins/jun-editor-defer.server"), mode: "server" });
|
|
1261
|
+
addPlugin({ src: resolver.resolve("./runtime/plugins/jun-editor-defer.client"), mode: "client" });
|
|
1215
1262
|
addPlugin({
|
|
1216
1263
|
src: resolver.resolve("./runtime/plugins/jun-drag-affordance.client"),
|
|
1217
1264
|
mode: "client"
|
|
@@ -1320,6 +1367,11 @@ Switch them off with \`jun.pageTypes: { ${missing.map((e) => `${e.key}: false`).
|
|
|
1320
1367
|
});
|
|
1321
1368
|
}
|
|
1322
1369
|
if (runtime.features.bootstrap && options.seed?.enabled !== false) {
|
|
1370
|
+
addServerTemplate({
|
|
1371
|
+
filename: "#jun-seed",
|
|
1372
|
+
getContents: () => `export default ${JSON.stringify(options.seed ?? {})}
|
|
1373
|
+
`
|
|
1374
|
+
});
|
|
1323
1375
|
addServerPlugin(resolver.resolve("./runtime/server/plugins/jun-bootstrap"));
|
|
1324
1376
|
}
|
|
1325
1377
|
if (runtime.features.janitor && options.janitor?.enabled !== false) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
-
import { useAbracadabra, useDocSlugs, useDocTree } from "#imports";
|
|
3
|
+
import { useAbracadabra, useDocSlugs, useDocTree, useDocTreeSnapshot } from "#imports";
|
|
4
4
|
import { useJunDocIcon } from "../composables/useJunOptions";
|
|
5
5
|
import { useJunDocLinkMenu } from "../composables/useJunDocLinkMenu";
|
|
6
6
|
const props = defineProps({
|
|
@@ -10,7 +10,9 @@ const props = defineProps({
|
|
|
10
10
|
});
|
|
11
11
|
const { getEntry } = useDocTree();
|
|
12
12
|
const { getDocUrl } = useDocSlugs();
|
|
13
|
-
const { spaceDocId } = useAbracadabra();
|
|
13
|
+
const { spaceDocId: liveSpaceDocId } = useAbracadabra();
|
|
14
|
+
const snapshot = useDocTreeSnapshot();
|
|
15
|
+
const spaceDocId = computed(() => liveSpaceDocId.value ?? snapshot.value?.rootId ?? null);
|
|
14
16
|
const docIcon = useJunDocIcon();
|
|
15
17
|
const items = computed(() => {
|
|
16
18
|
const chain = [];
|
|
@@ -230,8 +230,10 @@ const { peers: peerReactions, setLocal } = useAAEphemeral("campfire:react");
|
|
|
230
230
|
const EMBER_TTL = 1900;
|
|
231
231
|
const embers = [];
|
|
232
232
|
const floaters = ref([]);
|
|
233
|
+
let reactFrame = 0;
|
|
233
234
|
function pushEmber(emoji, color, id) {
|
|
234
235
|
embers.push({ id, emoji, color, dx: (Math.random() - 0.5) * 36, born: performance.now() });
|
|
236
|
+
if (!reactFrame) reactFrame = requestAnimationFrame(emberLoop);
|
|
235
237
|
}
|
|
236
238
|
let localN = 0;
|
|
237
239
|
function react(emoji) {
|
|
@@ -241,29 +243,30 @@ function react(emoji) {
|
|
|
241
243
|
pushEmber(emoji, "var(--ui-text-highlighted)", `local:${localN}:${Date.now()}`);
|
|
242
244
|
}
|
|
243
245
|
const lastSeenByPeer = /* @__PURE__ */ new Map();
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if (
|
|
251
|
-
|
|
252
|
-
pushEmber(p.value.emoji, p.user?.color ?? "#fbbf24", `${p.clientId}:${p.value.t}`);
|
|
253
|
-
}
|
|
254
|
-
lastSeenByPeer.set(p.clientId, p.value.t);
|
|
246
|
+
function collectPeerReactions() {
|
|
247
|
+
if (!settings.value.reactions) return;
|
|
248
|
+
for (const p of peerReactions.value) {
|
|
249
|
+
if (!p.value) continue;
|
|
250
|
+
const lastT = lastSeenByPeer.get(p.clientId) ?? 0;
|
|
251
|
+
if (p.value.t > lastT) {
|
|
252
|
+
if (lastT !== 0) {
|
|
253
|
+
pushEmber(p.value.emoji, p.user?.color ?? "#fbbf24", `${p.clientId}:${p.value.t}`);
|
|
255
254
|
}
|
|
255
|
+
lastSeenByPeer.set(p.clientId, p.value.t);
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
+
}
|
|
259
|
+
watch([peerReactions, () => settings.value.reactions], collectPeerReactions);
|
|
260
|
+
function emberLoop() {
|
|
258
261
|
const now = performance.now();
|
|
259
262
|
for (let i = embers.length - 1; i >= 0; i--) {
|
|
260
263
|
if (now - embers[i].born > EMBER_TTL) embers.splice(i, 1);
|
|
261
264
|
}
|
|
262
265
|
floaters.value = embers.slice();
|
|
263
|
-
reactFrame = requestAnimationFrame(
|
|
266
|
+
reactFrame = embers.length ? requestAnimationFrame(emberLoop) : 0;
|
|
264
267
|
}
|
|
265
268
|
onMounted(() => {
|
|
266
|
-
|
|
269
|
+
collectPeerReactions();
|
|
267
270
|
window.addEventListener("keydown", onKey);
|
|
268
271
|
});
|
|
269
272
|
onBeforeUnmount(() => {
|
|
@@ -21,7 +21,7 @@ const shown = computed(() => editing.value || hasProse.value);
|
|
|
21
21
|
class="jun-collection-intro"
|
|
22
22
|
:class="shown ? 'mb-8' : 'jun-collection-intro--empty'"
|
|
23
23
|
>
|
|
24
|
-
<
|
|
24
|
+
<JunEditor
|
|
25
25
|
ref="introEditor"
|
|
26
26
|
:doc-id="props.docId"
|
|
27
27
|
:doc-label="props.docLabel"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<JunEditor>` — `<JunEditor>`, hydrated when the page is idle instead of in
|
|
3
|
+
* front of first paint.
|
|
4
|
+
*
|
|
5
|
+
* Drop-in: same props, events, slots and template ref (`.editor` included —
|
|
6
|
+
* Vue forwards a ref through `defineAsyncComponent` to the resolved inner
|
|
7
|
+
* component, which is why this is two async components and not a wrapper
|
|
8
|
+
* SFC). On the server it renders exactly what `<JunEditor>` renders; in the
|
|
9
|
+
* browser that HTML stays put until `requestIdleCallback` (or the timeout)
|
|
10
|
+
* fires, then the editor chunk loads and hydrates in place. On a client-side
|
|
11
|
+
* navigation there is nothing to hydrate and it simply mounts.
|
|
12
|
+
*
|
|
13
|
+
* Why it exists, and why the SSR marking in `jun-editor-defer.server.ts` is
|
|
14
|
+
* half of it: see the block above `addTemplate({ filename: 'jun-editor.mjs' })`
|
|
15
|
+
* in `module.ts`.
|
|
16
|
+
*/
|
|
17
|
+
import { type Component } from 'vue';
|
|
18
|
+
declare const JunEditor: Component;
|
|
19
|
+
export default JunEditor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineAsyncComponent, hydrateOnIdle } from "vue";
|
|
2
|
+
import { loadAEditor } from "#build/jun-editor.mjs";
|
|
3
|
+
const IDLE_TIMEOUT_MS = 2e3;
|
|
4
|
+
const Inner = defineAsyncComponent(loadAEditor);
|
|
5
|
+
const JunEditor = defineAsyncComponent({
|
|
6
|
+
loader: () => Promise.resolve(Inner),
|
|
7
|
+
hydrate: hydrateOnIdle(IDLE_TIMEOUT_MS)
|
|
8
|
+
});
|
|
9
|
+
export default JunEditor;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, onMounted, onUnmounted, ref } from "vue";
|
|
3
3
|
import { useNuxtData } from "#app";
|
|
4
|
-
import { useAbracadabra, useDocTree, useRoute, useSlugRoute } from "#imports";
|
|
4
|
+
import { useAbracadabra, useDocTree, useDocTreeSnapshot, useRoute, useSlugRoute } from "#imports";
|
|
5
5
|
import { useJunLayoutPolicy, useJunPageType } from "../composables/useJunOptions";
|
|
6
6
|
import { useJunEffectiveConfig } from "../composables/useJunSiteConfig";
|
|
7
7
|
const { data: ssrCfg } = useNuxtData("jun-site-config");
|
|
@@ -21,10 +21,12 @@ const route = useRoute();
|
|
|
21
21
|
const { docId } = useSlugRoute();
|
|
22
22
|
const { entries, getEntry } = useDocTree();
|
|
23
23
|
const abra = useAbracadabra();
|
|
24
|
+
const rootSnapshot = useDocTreeSnapshot();
|
|
24
25
|
const docType = computed(() => {
|
|
25
26
|
if (docId.value) return getEntry(docId.value)?.type;
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const rootId = abra.spaceDocId.value ?? rootSnapshot.value?.rootId;
|
|
28
|
+
if (route.path === "/" && rootId) {
|
|
29
|
+
return getEntry(rootId)?.type ?? "doc";
|
|
28
30
|
}
|
|
29
31
|
return null;
|
|
30
32
|
});
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
useDocDragBus,
|
|
9
9
|
useDocSlugs,
|
|
10
10
|
useDocTree,
|
|
11
|
+
useDocTreeSnapshot,
|
|
11
12
|
useRoute,
|
|
12
13
|
useRouter,
|
|
13
14
|
useSlugRoute
|
|
@@ -17,6 +18,7 @@ import { useJunDocMenu } from "../composables/useJunDocMenu";
|
|
|
17
18
|
import { useJunDocLinkMenu } from "../composables/useJunDocLinkMenu";
|
|
18
19
|
import { useJunNavItems } from "../composables/useJunNavItems";
|
|
19
20
|
import { junAdoptedMeta } from "../utils/junAdopt";
|
|
21
|
+
import { junSsrMemo } from "../utils/junSsrMemo";
|
|
20
22
|
import { useJunMenuState } from "../composables/useJunMenuState";
|
|
21
23
|
import { useJunIntro } from "../composables/useJunIntro";
|
|
22
24
|
import { JUN_NAV_BREAKPOINT_PX, useJunNavSettings } from "../composables/useJunNavSettings";
|
|
@@ -141,6 +143,7 @@ const navNumberFor = (item) => navNumberById.value.get(item.id ?? item.href) ??
|
|
|
141
143
|
const showArrows = computed(() => nav.scrollArrows.value && !isTouch.value && (vertical.value || nav.overflow.value !== "wrap" && nav.overflow.value !== "more"));
|
|
142
144
|
const { editing, openLogin } = useJunStudio();
|
|
143
145
|
const abra = useAbracadabra();
|
|
146
|
+
const rootSnapshot = useDocTreeSnapshot();
|
|
144
147
|
const navTree = useChildTree(abra.doc, "jun-nav-reorder");
|
|
145
148
|
const { renameDoc } = useJunRename();
|
|
146
149
|
const dragBus = useDocDragBus();
|
|
@@ -360,10 +363,10 @@ function commitRename() {
|
|
|
360
363
|
function cancelRename() {
|
|
361
364
|
renamingId.value = null;
|
|
362
365
|
}
|
|
363
|
-
const
|
|
364
|
-
const siblings =
|
|
366
|
+
const menusOf = junSsrMemo((nav2, isEditing) => {
|
|
367
|
+
const siblings = nav2.map((n) => n.id).filter(Boolean);
|
|
365
368
|
const map = /* @__PURE__ */ new Map();
|
|
366
|
-
for (const item of
|
|
369
|
+
for (const item of nav2) {
|
|
367
370
|
if (!item.id) continue;
|
|
368
371
|
const entry = getEntry(item.id);
|
|
369
372
|
map.set(item.id, itemsFor(
|
|
@@ -373,7 +376,7 @@ const menuItemsById = computed(() => {
|
|
|
373
376
|
type: item.type ?? entry?.type,
|
|
374
377
|
meta: entry?.meta,
|
|
375
378
|
surface: "nav",
|
|
376
|
-
editing:
|
|
379
|
+
editing: isEditing
|
|
377
380
|
},
|
|
378
381
|
{
|
|
379
382
|
tree: navTree,
|
|
@@ -387,6 +390,7 @@ const menuItemsById = computed(() => {
|
|
|
387
390
|
}
|
|
388
391
|
return map;
|
|
389
392
|
});
|
|
393
|
+
const menuItemsById = computed(() => menusOf(orderedNav.value, editing.value));
|
|
390
394
|
const contextItemsFor = (item) => (item.id ? menuItemsById.value.get(item.id) : void 0) ?? [];
|
|
391
395
|
const childMenu = useJunDocLinkMenu({ surface: "nav", tree: navTree });
|
|
392
396
|
let logoClicks = 0;
|
|
@@ -410,8 +414,9 @@ function onLogoClick() {
|
|
|
410
414
|
const { docId } = useSlugRoute();
|
|
411
415
|
const navDocType = computed(() => {
|
|
412
416
|
if (docId.value) return getEntry(docId.value)?.type;
|
|
413
|
-
|
|
414
|
-
|
|
417
|
+
const rootId = abra.spaceDocId.value ?? rootSnapshot.value?.rootId;
|
|
418
|
+
if (route.path === "/" && rootId) {
|
|
419
|
+
return getEntry(rootId)?.type ?? "doc";
|
|
415
420
|
}
|
|
416
421
|
return null;
|
|
417
422
|
});
|
|
@@ -1062,10 +1067,10 @@ onMounted(() => {
|
|
|
1062
1067
|
};
|
|
1063
1068
|
updatePageScrollable();
|
|
1064
1069
|
useEventListener(window, "resize", schedulePageScrollable);
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1070
|
+
const ro = new ResizeObserver(schedulePageScrollable);
|
|
1071
|
+
ro.observe(document.body);
|
|
1067
1072
|
onUnmounted(() => {
|
|
1068
|
-
|
|
1073
|
+
ro.disconnect();
|
|
1069
1074
|
if (pageScrollableTimer) clearTimeout(pageScrollableTimer);
|
|
1070
1075
|
});
|
|
1071
1076
|
useEventListener(window, "mousemove", (e) => {
|
|
@@ -1107,12 +1112,12 @@ onMounted(() => {
|
|
|
1107
1112
|
scheduleMore();
|
|
1108
1113
|
});
|
|
1109
1114
|
scheduleMore();
|
|
1110
|
-
const
|
|
1115
|
+
const ro2 = new ResizeObserver(() => {
|
|
1111
1116
|
updateScrollIndicators();
|
|
1112
1117
|
scheduleMore();
|
|
1113
1118
|
});
|
|
1114
|
-
|
|
1115
|
-
onUnmounted(() =>
|
|
1119
|
+
ro2.observe(navScrollContainer.value);
|
|
1120
|
+
onUnmounted(() => ro2.disconnect());
|
|
1116
1121
|
}
|
|
1117
1122
|
});
|
|
1118
1123
|
watch(orderedNav, () => nextTick(() => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { ref, watch } from "vue";
|
|
2
3
|
import { useJunNodePanelHost } from "../composables/useJunNodePanel";
|
|
3
4
|
import { useJunStudio } from "../composables/useJunStudio";
|
|
4
5
|
const {
|
|
@@ -9,10 +10,15 @@ const {
|
|
|
9
10
|
closePanel
|
|
10
11
|
} = useJunNodePanelHost();
|
|
11
12
|
const { editing } = useJunStudio();
|
|
13
|
+
const everOpened = ref(false);
|
|
14
|
+
watch(openNodeId, (id) => {
|
|
15
|
+
if (id) everOpened.value = true;
|
|
16
|
+
}, { immediate: true });
|
|
12
17
|
</script>
|
|
13
18
|
|
|
14
19
|
<template>
|
|
15
|
-
<
|
|
20
|
+
<LazyANodePanel
|
|
21
|
+
v-if="everOpened"
|
|
16
22
|
:node-id="openNodeId"
|
|
17
23
|
:node-label="openNodeLabel"
|
|
18
24
|
:child-provider="openNodeProvider"
|
|
@@ -176,7 +176,13 @@ defineShortcuts({
|
|
|
176
176
|
name="jun-settings-swap"
|
|
177
177
|
mode="out-in"
|
|
178
178
|
>
|
|
179
|
-
|
|
179
|
+
<!-- `Lazy`: the settings page is 150 KB of source plus the colour
|
|
180
|
+
picker, sliders and selects it pulls in, and this modal is
|
|
181
|
+
mounted on EVERY page for the one person who will open it.
|
|
182
|
+
A static reference put all of it on each reader's critical
|
|
183
|
+
path; lazily it loads when the panel first renders a
|
|
184
|
+
section. -->
|
|
185
|
+
<LazyJunConfigRenderer
|
|
180
186
|
:key="section"
|
|
181
187
|
:doc-id="site.docId.value ?? ''"
|
|
182
188
|
:section="section"
|
|
@@ -356,7 +356,7 @@ function setRating(film, value) {
|
|
|
356
356
|
:data-dnd-id="film.id"
|
|
357
357
|
:draggable="editing ? true : void 0"
|
|
358
358
|
:class="[
|
|
359
|
-
'rounded-xl transition-[
|
|
359
|
+
'rounded-xl transition-[scale,box-shadow,opacity] duration-200',
|
|
360
360
|
editing ? dragId === film.id ? 'cursor-grabbing' : 'cursor-grab' : '',
|
|
361
361
|
dragId === film.id ? 'scale-[1.02] opacity-90 shadow-lg shadow-black/20' : ''
|
|
362
362
|
]"
|
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
useJunRename,
|
|
16
16
|
useJunStudio,
|
|
17
17
|
useJunViewingAccent,
|
|
18
|
-
useJunViewOptions
|
|
18
|
+
useJunViewOptions,
|
|
19
|
+
useJunRootId
|
|
19
20
|
} from "#imports";
|
|
20
21
|
import { useJunDocLinkMenu } from "../../composables/useJunDocLinkMenu";
|
|
21
22
|
import { JUN_HOME_SECTIONS, junViewSpecFor } from "../../utils/junViewSpecs";
|
|
@@ -81,7 +82,8 @@ function childrenOf(parentId) {
|
|
|
81
82
|
(e) => e.parentId === parentId && e.id !== parentId && !!e.label && e.meta?.hidden !== true
|
|
82
83
|
).sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
83
84
|
}
|
|
84
|
-
const
|
|
85
|
+
const rootId = useJunRootId();
|
|
86
|
+
const topLevel = computed(() => childrenOf(rootId.value));
|
|
85
87
|
function pageOfType(key) {
|
|
86
88
|
const type = typeIdFor(key);
|
|
87
89
|
if (!type) return null;
|
|
@@ -455,7 +457,7 @@ const titleOfSection = (id, fallback) => (id === "latest" ? journalPage.value?.l
|
|
|
455
457
|
v-else-if="id === 'prose'"
|
|
456
458
|
class="jun-home-body"
|
|
457
459
|
>
|
|
458
|
-
<
|
|
460
|
+
<JunEditor
|
|
459
461
|
:doc-id="props.docId"
|
|
460
462
|
:doc-label="pageTitle"
|
|
461
463
|
:doc-meta="pageMeta"
|
|
@@ -241,7 +241,7 @@ function corners(i) {
|
|
|
241
241
|
'group relative mb-8 block overflow-hidden',
|
|
242
242
|
'ring-1 ring-neutral-200/70 dark:ring-white/15',
|
|
243
243
|
'shadow-lg shadow-black/20',
|
|
244
|
-
'transition-
|
|
244
|
+
'transition-[scale,box-shadow,opacity] duration-300 hover:scale-[1.01] hover:shadow-xl',
|
|
245
245
|
dropTargetId === hero.id ? 'ring-2 ring-black/40 dark:ring-white/50' : '',
|
|
246
246
|
editing ? dragId === hero.id ? 'cursor-grabbing opacity-70' : 'cursor-grab' : ''
|
|
247
247
|
]"
|
|
@@ -369,7 +369,11 @@ function corners(i) {
|
|
|
369
369
|
:class="[
|
|
370
370
|
corners(i + 1),
|
|
371
371
|
'jun-card group relative block overflow-hidden',
|
|
372
|
-
|
|
372
|
+
// NOT `transition-all`: `v-motion` writes `opacity`/`transform`
|
|
373
|
+
// inline on every frame of the entrance, and a CSS transition on
|
|
374
|
+
// those restarts each frame — the two animations fight and the
|
|
375
|
+
// page drowns in `transitionrun`. Only what hover/drag change.
|
|
376
|
+
'transition-[scale,box-shadow,opacity] duration-300 hover:scale-[1.02] hover:shadow-xl',
|
|
373
377
|
dropTargetId === entry.id ? 'ring-2 ring-black/40 dark:ring-white/50' : '',
|
|
374
378
|
editing ? dragId === entry.id ? 'cursor-grabbing opacity-70' : 'cursor-grab' : ''
|
|
375
379
|
]"
|
|
@@ -252,7 +252,7 @@ async function onRowDrop(entry, e) {
|
|
|
252
252
|
:data-dnd-id="entry.id"
|
|
253
253
|
:draggable="editing ? true : void 0"
|
|
254
254
|
:class="[
|
|
255
|
-
'rounded-xl transition-[
|
|
255
|
+
'rounded-xl transition-[scale,box-shadow,opacity] duration-200',
|
|
256
256
|
editing ? dragId === entry.id ? 'cursor-grabbing' : 'cursor-grab' : '',
|
|
257
257
|
dragId === entry.id ? 'scale-[1.02] opacity-90 shadow-lg shadow-black/20' : ''
|
|
258
258
|
]"
|
|
@@ -422,7 +422,7 @@ async function onRowDrop(entry, e) {
|
|
|
422
422
|
:data-dnd-id="entry.id"
|
|
423
423
|
:draggable="editing ? true : void 0"
|
|
424
424
|
:class="[
|
|
425
|
-
'rounded-xl transition-[
|
|
425
|
+
'rounded-xl transition-[scale,box-shadow,opacity] duration-200',
|
|
426
426
|
editing ? dragId === entry.id ? 'cursor-grabbing' : 'cursor-grab' : '',
|
|
427
427
|
dragId === entry.id ? 'scale-[1.02] opacity-90 shadow-lg shadow-black/20' : ''
|
|
428
428
|
]"
|
|
@@ -548,7 +548,7 @@ async function onRowDrop(entry, e) {
|
|
|
548
548
|
:data-dnd-id="entry.id"
|
|
549
549
|
:draggable="editing ? true : void 0"
|
|
550
550
|
:class="[
|
|
551
|
-
'transition-[
|
|
551
|
+
'transition-[scale,opacity] duration-200',
|
|
552
552
|
editing ? dragId === entry.id ? 'cursor-grabbing' : 'cursor-grab' : '',
|
|
553
553
|
dragId === entry.id ? 'scale-[1.04] opacity-90' : ''
|
|
554
554
|
]"
|
|
@@ -438,7 +438,7 @@ const hereNow = computed(() => people.value.filter((t) => !t.idle).length);
|
|
|
438
438
|
:data-dnd-id="pane.entry.id"
|
|
439
439
|
:data-jun-anchor="pane.entry.id"
|
|
440
440
|
:draggable="editing && effectiveLayout !== 'freeform' ? true : void 0"
|
|
441
|
-
class="jun-card group relative overflow-hidden rounded-xl transition-[
|
|
441
|
+
class="jun-card group relative overflow-hidden rounded-xl transition-[scale,box-shadow,opacity] duration-200"
|
|
442
442
|
:class="[
|
|
443
443
|
effectiveLayout === 'masonry' ? 'mb-4 break-inside-avoid' : '',
|
|
444
444
|
editing && effectiveLayout !== 'freeform' ? dragId === pane.entry.id ? 'cursor-grabbing' : 'cursor-grab' : '',
|
|
@@ -286,7 +286,7 @@ function commitText(field, e) {
|
|
|
286
286
|
v-if="bodyIsMirror"
|
|
287
287
|
class="jun-now-body mt-4"
|
|
288
288
|
>
|
|
289
|
-
<
|
|
289
|
+
<JunEditor
|
|
290
290
|
ref="bodyEditor"
|
|
291
291
|
:doc-id="docId"
|
|
292
292
|
:doc-label="title"
|
|
@@ -399,7 +399,7 @@ function commitText(field, e) {
|
|
|
399
399
|
<template v-if="!bodyIsMirror">
|
|
400
400
|
<hr class="my-8 border-default">
|
|
401
401
|
<div class="jun-now-body">
|
|
402
|
-
<
|
|
402
|
+
<JunEditor
|
|
403
403
|
:doc-id="docId"
|
|
404
404
|
:doc-label="title"
|
|
405
405
|
:doc-meta="meta"
|
|
@@ -211,7 +211,7 @@ function barWidth(index) {
|
|
|
211
211
|
here renders its document's body, and a poll that could not explain
|
|
212
212
|
itself would be the only one that cannot. -->
|
|
213
213
|
<div class="jun-poll-body">
|
|
214
|
-
<
|
|
214
|
+
<JunEditor
|
|
215
215
|
:doc-id="docId"
|
|
216
216
|
:doc-label="question"
|
|
217
217
|
:doc-meta="docMeta"
|
|
@@ -230,7 +230,7 @@ const providerOptions = [...JUN_SERVICE_PROVIDERS];
|
|
|
230
230
|
:draggable="editing ? true : void 0"
|
|
231
231
|
class="relative"
|
|
232
232
|
:class="[
|
|
233
|
-
'rounded-xl transition-[
|
|
233
|
+
'rounded-xl transition-[scale,box-shadow,opacity] duration-200',
|
|
234
234
|
editing ? dragId === entry.id ? 'cursor-grabbing' : 'cursor-grab' : '',
|
|
235
235
|
dragId === entry.id ? 'scale-[1.02] opacity-90 shadow-lg shadow-black/20' : ''
|
|
236
236
|
]"
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
useJunRename,
|
|
12
12
|
useJunStudio,
|
|
13
13
|
useJunTravellers,
|
|
14
|
-
useJunViewOptions
|
|
14
|
+
useJunViewOptions,
|
|
15
|
+
useJunRootId
|
|
15
16
|
} from "#imports";
|
|
16
17
|
import { useFetch } from "#app";
|
|
17
18
|
import { junApiFetch } from "../../composables/useJunApiFetch";
|
|
@@ -24,6 +25,7 @@ const props = defineProps({
|
|
|
24
25
|
editable: { type: Boolean, required: false }
|
|
25
26
|
});
|
|
26
27
|
const abra = useAbracadabra();
|
|
28
|
+
const rootId = useJunRootId();
|
|
27
29
|
const tree = useChildTree(abra.doc, props.docId);
|
|
28
30
|
const opts = useJunOptions();
|
|
29
31
|
const { entries, getEntry } = useDocTree();
|
|
@@ -56,7 +58,7 @@ const liveEntries = computed(() => {
|
|
|
56
58
|
(e) => (
|
|
57
59
|
// Skip the root's SELF-DESCRIPTOR entry — its id IS the space id, and
|
|
58
60
|
// counting it would add a phantom page to every total.
|
|
59
|
-
e.id !==
|
|
61
|
+
e.id !== rootId.value && e.meta?.seedTest !== true && e.meta?.draft !== true
|
|
60
62
|
)
|
|
61
63
|
);
|
|
62
64
|
});
|
|
@@ -146,7 +146,7 @@ function togglePinned(post) {
|
|
|
146
146
|
<!-- The thread's own prose: what is being discussed. Every page type here
|
|
147
147
|
renders its document's body. -->
|
|
148
148
|
<div class="jun-thread-body mt-6">
|
|
149
|
-
<
|
|
149
|
+
<JunEditor
|
|
150
150
|
:doc-id="docId"
|
|
151
151
|
:doc-label="title"
|
|
152
152
|
:doc-meta="docMeta"
|
|
@@ -219,7 +219,7 @@ function addItem(category) {
|
|
|
219
219
|
:data-dnd-id="entry.id"
|
|
220
220
|
:draggable="editing ? true : void 0"
|
|
221
221
|
:class="[
|
|
222
|
-
'rounded-lg transition-[
|
|
222
|
+
'rounded-lg transition-[scale,box-shadow,opacity] duration-200',
|
|
223
223
|
editing ? dragId === entry.id ? 'cursor-grabbing' : 'cursor-grab' : '',
|
|
224
224
|
dragId === entry.id ? 'scale-[1.02] opacity-90 shadow-lg shadow-black/20' : ''
|
|
225
225
|
]"
|