@abraca/junis 2.87.0 → 2.88.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 (89) hide show
  1. package/dist/module.d.mts +4 -2
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +64 -6
  4. package/dist/runtime/assets/css/jun.css +2 -2
  5. package/dist/runtime/components/JunDocSurface.d.vue.ts +20 -2
  6. package/dist/runtime/components/JunDocSurface.vue +27 -2
  7. package/dist/runtime/components/JunDocSurface.vue.d.ts +20 -2
  8. package/dist/runtime/components/JunHead.vue +16 -4
  9. package/dist/runtime/components/JunNavDock.d.vue.ts +15 -0
  10. package/dist/runtime/components/JunNavDock.vue +94 -0
  11. package/dist/runtime/components/JunNavDock.vue.d.ts +15 -0
  12. package/dist/runtime/components/JunNavMenu.client.d.vue.ts +15 -0
  13. package/dist/runtime/components/JunNavMenu.client.vue +478 -0
  14. package/dist/runtime/components/JunNavMenu.client.vue.d.ts +15 -0
  15. package/dist/runtime/components/JunNavPreview.d.vue.ts +17 -0
  16. package/dist/runtime/components/JunNavPreview.vue +169 -0
  17. package/dist/runtime/components/JunNavPreview.vue.d.ts +17 -0
  18. package/dist/runtime/components/JunNavigation.d.vue.ts +4 -11
  19. package/dist/runtime/components/JunNavigation.vue +813 -138
  20. package/dist/runtime/components/JunNavigation.vue.d.ts +4 -11
  21. package/dist/runtime/components/JunNoteLinks.vue +1 -1
  22. package/dist/runtime/components/JunPageHero.vue +3 -3
  23. package/dist/runtime/components/JunSectionBar.d.vue.ts +41 -0
  24. package/dist/runtime/components/JunSectionBar.vue +144 -0
  25. package/dist/runtime/components/JunSectionBar.vue.d.ts +41 -0
  26. package/dist/runtime/components/renderers/JunConfigRenderer.vue +486 -6
  27. package/dist/runtime/components/renderers/JunEntryRenderer.vue +48 -0
  28. package/dist/runtime/composables/useJunCreatePage.js +7 -1
  29. package/dist/runtime/composables/useJunDocPage.d.ts +28 -0
  30. package/dist/runtime/composables/useJunDocPage.js +111 -20
  31. package/dist/runtime/composables/useJunGarden.d.ts +1 -1
  32. package/dist/runtime/composables/useJunGarden.js +3 -2
  33. package/dist/runtime/composables/useJunGestures.d.ts +53 -0
  34. package/dist/runtime/composables/useJunGestures.js +89 -0
  35. package/dist/runtime/composables/useJunMenuState.d.ts +4 -0
  36. package/dist/runtime/composables/useJunMenuState.js +5 -0
  37. package/dist/runtime/composables/useJunNavItems.d.ts +50 -0
  38. package/dist/runtime/composables/useJunNavItems.js +188 -0
  39. package/dist/runtime/composables/useJunNavSettings.d.ts +58 -1
  40. package/dist/runtime/composables/useJunNavSettings.js +110 -8
  41. package/dist/runtime/composables/useJunOptions.d.ts +1 -0
  42. package/dist/runtime/composables/useJunSiblings.d.ts +30 -0
  43. package/dist/runtime/composables/useJunSiblings.js +38 -0
  44. package/dist/runtime/composables/useJunSiteConfig.d.ts +51 -3
  45. package/dist/runtime/composables/useJunTheme.js +4 -1
  46. package/dist/runtime/composables/useJunViewingAccent.js +10 -0
  47. package/dist/runtime/layouts/jun.vue +21 -1
  48. package/dist/runtime/pages/doc.vue +2 -0
  49. package/dist/runtime/pages/index.vue +2 -0
  50. package/dist/runtime/server/api/health.get.d.ts +15 -0
  51. package/dist/runtime/server/api/health.get.js +7 -2
  52. package/dist/runtime/server/api/links.get.js +27 -3
  53. package/dist/runtime/server/api/resolve/[...slug].get.d.ts +20 -0
  54. package/dist/runtime/server/api/resolve/[...slug].get.js +31 -0
  55. package/dist/runtime/server/api/search.get.d.ts +1 -1
  56. package/dist/runtime/server/api/search.get.js +42 -39
  57. package/dist/runtime/server/api/tree.get.js +3 -1
  58. package/dist/runtime/server/janitor/junJanitorChores.d.ts +14 -7
  59. package/dist/runtime/server/janitor/junJanitorChores.js +21 -3
  60. package/dist/runtime/server/janitor/junJanitorMachine.js +36 -4
  61. package/dist/runtime/server/janitor/junJanitorPerform.d.ts +15 -1
  62. package/dist/runtime/server/janitor/junJanitorPerform.js +13 -5
  63. package/dist/runtime/server/janitor/junJanitorYText.d.ts +40 -3
  64. package/dist/runtime/server/janitor/junJanitorYText.js +60 -14
  65. package/dist/runtime/server/plugins/jun-janitor.js +132 -81
  66. package/dist/runtime/server/routes/jun-card.png.get.d.ts +2 -0
  67. package/dist/runtime/server/routes/jun-card.png.get.js +40 -0
  68. package/dist/runtime/server/utils/junCard.d.ts +39 -0
  69. package/dist/runtime/server/utils/junCard.js +159 -0
  70. package/dist/runtime/server/utils/junIcon.d.ts +27 -2
  71. package/dist/runtime/server/utils/junIcon.js +5 -5
  72. package/dist/runtime/server/utils/junJanitorStatus.d.ts +59 -0
  73. package/dist/runtime/server/utils/junJanitorStatus.js +27 -0
  74. package/dist/runtime/types.d.ts +225 -0
  75. package/dist/runtime/utils/junAdopt.d.ts +43 -0
  76. package/dist/runtime/utils/junAdopt.js +7 -0
  77. package/dist/runtime/utils/junGesture.d.ts +84 -0
  78. package/dist/runtime/utils/junGesture.js +40 -0
  79. package/dist/runtime/utils/junLetters.d.ts +86 -0
  80. package/dist/runtime/utils/junLetters.js +173 -0
  81. package/dist/runtime/utils/junNavValue.d.ts +56 -0
  82. package/dist/runtime/utils/junNavValue.js +36 -0
  83. package/dist/runtime/utils/junSearchRank.d.ts +79 -0
  84. package/dist/runtime/utils/junSearchRank.js +73 -0
  85. package/dist/runtime/utils/junSocial.d.ts +59 -0
  86. package/dist/runtime/utils/junSocial.js +56 -0
  87. package/dist/runtime/utils/junViewSpecs.d.ts +38 -0
  88. package/dist/runtime/utils/junViewSpecs.js +92 -1
  89. package/package.json +10 -8
@@ -1,19 +1,12 @@
1
- interface NavigationItem {
2
- id?: string;
3
- name: string;
4
- href: string;
5
- type?: string;
6
- icon?: string;
7
- current: boolean;
8
- }
1
+ import { type JunNavigationItem as NavigationItem } from '../composables/useJunNavItems.js';
9
2
  type __VLS_Props = {
10
3
  navigation: NavigationItem[];
11
4
  };
12
- declare var __VLS_9: {}, __VLS_83: {};
5
+ declare var __VLS_14: {}, __VLS_118: {};
13
6
  type __VLS_Slots = {} & {
14
- logo?: (props: typeof __VLS_9) => any;
7
+ logo?: (props: typeof __VLS_14) => any;
15
8
  } & {
16
- actions?: (props: typeof __VLS_83) => any;
9
+ actions?: (props: typeof __VLS_118) => any;
17
10
  };
18
11
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
12
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -6,7 +6,7 @@ const props = defineProps({
6
6
  });
7
7
  const { typeIdFor } = useJunPageType();
8
8
  const gardenOn = computed(() => !!typeIdFor("garden"));
9
- const { graph } = useJunLinkGraph();
9
+ const { graph } = useJunLinkGraph(props.docId);
10
10
  const { entries } = useDocTree();
11
11
  const { getDocUrl } = useDocSlugs();
12
12
  const labelOf = computed(() => {
@@ -50,14 +50,14 @@ const editableRing = "cursor-text rounded-md px-1 -mx-1 transition-shadow hover:
50
50
  initial: { opacity: 0, y: 12 },
51
51
  enter: { opacity: 1, y: 0, transition: { duration: 700 } }
52
52
  })"
53
- class="mb-8 flex items-end justify-between gap-4 sm:mb-10 sm:gap-6"
53
+ class="jun-page-hero mb-8 flex items-end justify-between gap-4 sm:mb-10 sm:gap-6"
54
54
  >
55
- <div class="min-w-0">
55
+ <div class="jun-hero-lines min-w-0">
56
56
  <h1
57
57
  ref="h1El"
58
58
  :contenteditable="editable ? 'plaintext-only' : void 0"
59
59
  spellcheck="false"
60
- class="text-3xl leading-[1.05] font-semibold tracking-tight text-highlighted
60
+ class="jun-hero-title text-3xl leading-[1.05] font-semibold tracking-tight text-highlighted
61
61
  outline-none sm:text-4xl lg:text-5xl"
62
62
  :class="editable ? editableRing : ''"
63
63
  @blur="editable && commit()"
@@ -0,0 +1,41 @@
1
+ /** One entry, in the shape the resolve endpoint sends. */
2
+ export interface JunSectionItem {
3
+ id: string;
4
+ title: string;
5
+ slug: string | null;
6
+ icon?: string;
7
+ }
8
+ type __VLS_Props = {
9
+ docId: string;
10
+ /**
11
+ * A column for the bar to sit in.
12
+ *
13
+ * The surface only constrains the page for types that do NOT pad themselves;
14
+ * a journal entry and every feed page carry their own column, so the wrapper
15
+ * around them is full width and a bar inside it would run edge to edge while
16
+ * the prose sat in the middle. The page passes the column when it is the one
17
+ * that knows there isn't one.
18
+ */
19
+ column?: string;
20
+ /**
21
+ * The SSR trail, so the marking is in the SERVED HTML too.
22
+ *
23
+ * On a deep page the item that lights up is an ANCESTOR rather than the page,
24
+ * and the live tree cannot say which one until it has synced.
25
+ */
26
+ ssrTrail?: {
27
+ id: string;
28
+ title: string;
29
+ slug: string | null;
30
+ }[];
31
+ /** The SSR payload's section, used until the live tree has synced. */
32
+ ssrSection?: {
33
+ parentId: string;
34
+ parentTitle: string;
35
+ parentSlug: string | null;
36
+ items: JunSectionItem[];
37
+ } | null;
38
+ };
39
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
40
+ declare const _default: typeof __VLS_export;
41
+ export default _default;
@@ -0,0 +1,144 @@
1
+ <script setup>
2
+ import { computed, onMounted, ref } from "vue";
3
+ import { useDocSlugs, useDocTree, useJunDocIcon, useRoute } from "#imports";
4
+ import { useJunNavSettings } from "../composables/useJunNavSettings";
5
+ const props = defineProps({
6
+ docId: { type: String, required: true },
7
+ column: { type: String, required: false },
8
+ ssrTrail: { type: Array, required: false },
9
+ ssrSection: { type: [Object, null], required: false }
10
+ });
11
+ const SECTION_MAX = 40;
12
+ const mounted = ref(false);
13
+ onMounted(() => {
14
+ mounted.value = true;
15
+ });
16
+ const route = useRoute();
17
+ const nav = useJunNavSettings();
18
+ const { entries, getEntry } = useDocTree();
19
+ const { getDocUrl } = useDocSlugs();
20
+ const docIcon = useJunDocIcon();
21
+ const branchId = computed(() => {
22
+ const live = mounted.value ? getEntry(props.docId) : void 0;
23
+ if (!live) return props.ssrSection?.parentId ?? null;
24
+ const seen = /* @__PURE__ */ new Set();
25
+ let cursor = props.docId;
26
+ let last = null;
27
+ while (cursor && !seen.has(cursor)) {
28
+ seen.add(cursor);
29
+ const entry = getEntry(cursor);
30
+ if (!entry) break;
31
+ const parent = entry.parentId ?? null;
32
+ if (!parent || !getEntry(parent)) return last ?? cursor;
33
+ last = cursor;
34
+ cursor = parent;
35
+ }
36
+ return last;
37
+ });
38
+ const items = computed(() => {
39
+ const branch = branchId.value;
40
+ if (!branch) return [];
41
+ if (!mounted.value) return props.ssrSection?.items ?? [];
42
+ const live = entries.value.filter(
43
+ (entry) => entry.parentId === branch && entry.id !== branch && !entry.trashed && !!entry.label && entry.meta?.hidden !== true && entry.meta?.draft !== true && entry.meta?.ownerOnly !== true && !entry.meta?.signerId && entry.meta?.replyTo == null && entry.meta?.t == null
44
+ );
45
+ if (!live.length) return props.ssrSection?.items ?? [];
46
+ return [...live].sort((a, b) => (a.order ?? 0) - (b.order ?? 0)).slice(0, SECTION_MAX).map((entry) => ({
47
+ id: entry.id,
48
+ title: entry.label ?? "",
49
+ slug: null,
50
+ icon: docIcon(entry.type, entry.meta?.icon)
51
+ }));
52
+ });
53
+ const branchTitle = computed(() => {
54
+ const branch = mounted.value ? branchId.value : null;
55
+ return (branch ? getEntry(branch)?.label : null) ?? props.ssrSection?.parentTitle ?? "";
56
+ });
57
+ const branchHref = computed(() => {
58
+ const branch = branchId.value;
59
+ if (!branch) return null;
60
+ return getDocUrl(branch) ?? (props.ssrSection?.parentSlug ? `/${props.ssrSection.parentSlug}` : null);
61
+ });
62
+ function hrefFor(item) {
63
+ if (!mounted.value) return item.slug ? `/${item.slug}` : `/${item.id}`;
64
+ return getDocUrl(item.id) ?? (item.slug ? `/${item.slug}` : `/${item.id}`);
65
+ }
66
+ const mode = computed(() => nav.section.value);
67
+ const show = computed(() => mode.value !== "off" && items.value.length > 1);
68
+ const activeIds = computed(() => {
69
+ const ids = /* @__PURE__ */ new Set([props.docId]);
70
+ const seen = /* @__PURE__ */ new Set();
71
+ let cursor = mounted.value ? props.docId : null;
72
+ while (cursor && !seen.has(cursor)) {
73
+ seen.add(cursor);
74
+ ids.add(cursor);
75
+ cursor = getEntry(cursor)?.parentId ?? null;
76
+ }
77
+ for (const step of props.ssrTrail ?? []) ids.add(step.id);
78
+ return ids;
79
+ });
80
+ const isCurrent = (item) => hrefFor(item) === route.path || item.id === props.docId;
81
+ const isAncestor = (item) => !isCurrent(item) && activeIds.value.has(item.id);
82
+ const ITEM_CLASS = {
83
+ row: {
84
+ base: "rounded-lg px-2.5 py-1.5 text-sm transition-colors",
85
+ on: "bg-black/5 font-medium text-highlighted dark:bg-white/10",
86
+ off: "text-muted hover:bg-black/5 hover:text-default dark:hover:bg-white/5"
87
+ },
88
+ segmented: {
89
+ base: "rounded-full px-3 py-1.5 text-sm transition-colors",
90
+ on: "bg-black/8 font-medium text-highlighted dark:bg-white/15",
91
+ off: "text-muted hover:bg-black/5 hover:text-default dark:hover:bg-white/5"
92
+ },
93
+ tabs: {
94
+ base: "border-b-2 px-1.5 pb-2 pt-1 text-sm transition-colors",
95
+ on: "border-current font-medium text-highlighted",
96
+ off: "border-transparent text-muted hover:text-default"
97
+ }
98
+ };
99
+ const itemClass = computed(() => ITEM_CLASS[mode.value] ?? ITEM_CLASS.row);
100
+ </script>
101
+
102
+ <template>
103
+ <nav
104
+ v-if="show"
105
+ class="jun-section-bar jun-blur sticky z-20 mb-4 flex items-center gap-1 overflow-x-auto py-2"
106
+ :class="[
107
+ props.column,
108
+ mode === 'segmented' ? 'gap-1.5' : mode === 'tabs' ? 'gap-4 border-b border-default' : ''
109
+ ]"
110
+ :aria-label="branchTitle ? `${branchTitle} section` : 'Section'"
111
+ data-swipe-ignore
112
+ >
113
+ <NuxtLink
114
+ v-if="branchHref && mode !== 'segmented'"
115
+ :to="branchHref"
116
+ class="mr-1 flex-none truncate text-[11px] font-medium tracking-[0.18em] text-dimmed uppercase transition-colors hover:text-muted"
117
+ >
118
+ {{ branchTitle }}
119
+ </NuxtLink>
120
+ <NuxtLink
121
+ v-for="item in items"
122
+ :key="item.id"
123
+ :to="hrefFor(item)"
124
+ class="flex flex-none items-center gap-1.5 whitespace-nowrap"
125
+ :class="[
126
+ itemClass.base,
127
+ isCurrent(item) || isAncestor(item) ? itemClass.on : itemClass.off,
128
+ isAncestor(item) ? 'opacity-80' : ''
129
+ ]"
130
+ :aria-current="isCurrent(item) ? 'page' : isAncestor(item) ? 'true' : void 0"
131
+ >
132
+ <UIcon
133
+ v-if="item.icon && mode !== 'tabs'"
134
+ :name="item.icon"
135
+ class="size-3.5 flex-none opacity-70"
136
+ />
137
+ {{ item.title }}
138
+ </NuxtLink>
139
+ </nav>
140
+ </template>
141
+
142
+ <style scoped>
143
+ .jun-section-bar{top:calc(var(--jun-nav-offset, 0px) + .25rem)}html[data-jun-nav=bottom] .jun-section-bar,html[data-jun-nav^=rail] .jun-section-bar{top:.5rem}.jun-section-bar{-webkit-mask-image:linear-gradient(180deg,#000 0,#000 82%,transparent);mask-image:linear-gradient(180deg,#000 0,#000 82%,transparent);overscroll-behavior-x:contain;padding-bottom:.35rem;scrollbar-width:none;touch-action:pan-x pan-y}.jun-section-bar::-webkit-scrollbar{display:none}
144
+ </style>
@@ -0,0 +1,41 @@
1
+ /** One entry, in the shape the resolve endpoint sends. */
2
+ export interface JunSectionItem {
3
+ id: string;
4
+ title: string;
5
+ slug: string | null;
6
+ icon?: string;
7
+ }
8
+ type __VLS_Props = {
9
+ docId: string;
10
+ /**
11
+ * A column for the bar to sit in.
12
+ *
13
+ * The surface only constrains the page for types that do NOT pad themselves;
14
+ * a journal entry and every feed page carry their own column, so the wrapper
15
+ * around them is full width and a bar inside it would run edge to edge while
16
+ * the prose sat in the middle. The page passes the column when it is the one
17
+ * that knows there isn't one.
18
+ */
19
+ column?: string;
20
+ /**
21
+ * The SSR trail, so the marking is in the SERVED HTML too.
22
+ *
23
+ * On a deep page the item that lights up is an ANCESTOR rather than the page,
24
+ * and the live tree cannot say which one until it has synced.
25
+ */
26
+ ssrTrail?: {
27
+ id: string;
28
+ title: string;
29
+ slug: string | null;
30
+ }[];
31
+ /** The SSR payload's section, used until the live tree has synced. */
32
+ ssrSection?: {
33
+ parentId: string;
34
+ parentTitle: string;
35
+ parentSlug: string | null;
36
+ items: JunSectionItem[];
37
+ } | null;
38
+ };
39
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
40
+ declare const _default: typeof __VLS_export;
41
+ export default _default;