@abraca/nuxt 2.51.0 → 2.53.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 (50) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/ADocRenderer.vue +9 -1
  3. package/dist/runtime/components/ADocSubPageList.vue +1 -0
  4. package/dist/runtime/components/ADocViewToggle.vue +10 -2
  5. package/dist/runtime/components/ADocumentTree.vue +93 -78
  6. package/dist/runtime/components/AEditor.d.vue.ts +10 -10
  7. package/dist/runtime/components/AEditor.vue +249 -232
  8. package/dist/runtime/components/AEditor.vue.d.ts +10 -10
  9. package/dist/runtime/components/ANodePanel.d.vue.ts +10 -0
  10. package/dist/runtime/components/ANodePanel.vue +40 -12
  11. package/dist/runtime/components/ANodePanel.vue.d.ts +10 -0
  12. package/dist/runtime/components/ANodeSettingsPanel.d.vue.ts +8 -0
  13. package/dist/runtime/components/ANodeSettingsPanel.vue +22 -8
  14. package/dist/runtime/components/ANodeSettingsPanel.vue.d.ts +8 -0
  15. package/dist/runtime/components/renderers/ACalendarRenderer.vue +1 -0
  16. package/dist/runtime/components/renderers/AChartRenderer.client.vue +1 -0
  17. package/dist/runtime/components/renderers/AChecklistRenderer.vue +1 -0
  18. package/dist/runtime/components/renderers/ADashboardRenderer.vue +1 -0
  19. package/dist/runtime/components/renderers/AGalleryRenderer.vue +1 -0
  20. package/dist/runtime/components/renderers/AGraphRenderer.vue +1 -0
  21. package/dist/runtime/components/renderers/AKanbanRenderer.vue +1 -0
  22. package/dist/runtime/components/renderers/AMapRenderer.vue +1 -0
  23. package/dist/runtime/components/renderers/AMediaRenderer.vue +3 -0
  24. package/dist/runtime/components/renderers/AOutlineRenderer.vue +1 -0
  25. package/dist/runtime/components/renderers/AOverviewRenderer.vue +1 -0
  26. package/dist/runtime/components/renderers/ASheetsRenderer.client.vue +1 -0
  27. package/dist/runtime/components/renderers/ASlidesRenderer.vue +1 -0
  28. package/dist/runtime/components/renderers/ATableRenderer.vue +1 -0
  29. package/dist/runtime/components/renderers/ATimelineRenderer.vue +1 -0
  30. package/dist/runtime/components/renderers/table/ATableColumnHeader.d.vue.ts +6 -0
  31. package/dist/runtime/components/renderers/table/ATableColumnHeader.vue +24 -19
  32. package/dist/runtime/components/renderers/table/ATableColumnHeader.vue.d.ts +6 -0
  33. package/dist/runtime/components/renderers/table/ATableFlatMode.vue +2 -0
  34. package/dist/runtime/components/renderers/table/ATableHierarchyMode.vue +2 -0
  35. package/dist/runtime/components/renderers/table/ATableToolbar.vue +18 -2
  36. package/dist/runtime/components/shell/ADocPanelSettings.d.vue.ts +8 -0
  37. package/dist/runtime/components/shell/ADocPanelSettings.vue +5 -2
  38. package/dist/runtime/components/shell/ADocPanelSettings.vue.d.ts +8 -0
  39. package/dist/runtime/composables/useDocSeo.js +11 -5
  40. package/dist/runtime/composables/useNodeContextMenu.d.ts +11 -0
  41. package/dist/runtime/composables/useNodeContextMenu.js +13 -3
  42. package/dist/runtime/composables/useNodePanel.d.ts +11 -4
  43. package/dist/runtime/composables/useNodePanel.js +2 -17
  44. package/dist/runtime/composables/useProviderRole.d.ts +17 -0
  45. package/dist/runtime/composables/useProviderRole.js +22 -0
  46. package/dist/runtime/extensions/views/DocLinkView.d.vue.ts +12 -0
  47. package/dist/runtime/extensions/views/DocLinkView.vue +140 -20
  48. package/dist/runtime/extensions/views/DocLinkView.vue.d.ts +12 -0
  49. package/dist/runtime/extensions/views/DocumentMetaView.vue +50 -0
  50. package/package.json +1 -1
@@ -30,7 +30,8 @@ const props = defineProps({
30
30
  publicAccessValue: { type: String, required: false, default: "inherit" },
31
31
  publicAccessOptions: { type: Array, required: false, default: () => [] },
32
32
  canEditPublicAccess: { type: Boolean, required: false, default: false },
33
- savingPublicAccess: { type: Boolean, required: false, default: false }
33
+ savingPublicAccess: { type: Boolean, required: false, default: false },
34
+ editable: { type: Boolean, required: false, default: true }
34
35
  });
35
36
  const emit = defineEmits(["grant-permission", "change-role", "revoke-permission", "set-public-access", "create-invite", "sync-doc", "open-encryption", "user-context-menu", "update-meta", "create-snapshot", "delete-snapshot", "restore-snapshot", "fork-snapshot", "preview-snapshot", "load-more-snapshots"]);
36
37
  const grantUserId = ref("");
@@ -145,6 +146,7 @@ function snapshotMenu(version) {
145
146
  onSelect: () => askSnapDelete(version)
146
147
  }
147
148
  ];
149
+ if (props.editable === false) return [view];
148
150
  return props.isOwner ? [view, manage, destructive] : [view, manage];
149
151
  }
150
152
  function triggerColor(trigger) {
@@ -194,6 +196,7 @@ function getMetaValue(key) {
194
196
  return props.docMeta?.[key] ?? void 0;
195
197
  }
196
198
  function patchMeta(key, value) {
199
+ if (props.editable === false) return;
197
200
  emit("update-meta", { [key]: value });
198
201
  }
199
202
  </script>
@@ -688,7 +691,7 @@ function patchMeta(key, value) {
688
691
  Snapshots
689
692
  </p>
690
693
  <UTooltip
691
- v-if="isOwner"
694
+ v-if="isOwner && editable !== false"
692
695
  text="Create snapshot"
693
696
  :content="{ side: 'bottom' }"
694
697
  >
@@ -75,6 +75,13 @@ type __VLS_Props = {
75
75
  canEditPublicAccess?: boolean;
76
76
  /** Whether a public-access change is currently in flight. */
77
77
  savingPublicAccess?: boolean;
78
+ /**
79
+ * Whether this surface may mutate the doc. Pass the host's role-folded
80
+ * editability; when false, snapshot restore/fork/delete and meta-field
81
+ * writes are withheld so viewer-scoped docs get a genuinely read-only
82
+ * settings panel.
83
+ */
84
+ editable?: boolean;
78
85
  };
79
86
  declare var __VLS_230: {}, __VLS_394: {};
80
87
  type __VLS_Slots = {} & {
@@ -125,6 +132,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
125
132
  }>, {
126
133
  snapshots: SnapshotMeta[];
127
134
  userName: string;
135
+ editable: boolean;
128
136
  docMeta: DocPageMeta | null;
129
137
  effectiveRole: string | null;
130
138
  userAvatarStyle: string;
@@ -22,24 +22,30 @@ export function useDocSeo(docId, options) {
22
22
  () => resolvedId.value ? `/api/_abracadabra/render/${resolvedId.value}` : "/api/_abracadabra/render/_none",
23
23
  { key: `seo-${resolvedId.value}`, server: true, lazy: true, immediate: !!resolvedId.value }
24
24
  );
25
- const title = computed(() => entry.value?.label ?? "Untitled");
25
+ const title = computed(
26
+ () => entry.value?.label || renderData.value?.title || options?.siteName || "Untitled"
27
+ );
26
28
  const description = computed(
27
- () => entry.value?.meta?.note ?? entry.value?.meta?.description ?? renderData.value?.description ?? extractFirstParagraph(renderData.value?.html) ?? options?.fallbackDescription ?? ""
29
+ () => entry.value?.meta?.note || entry.value?.meta?.description || renderData.value?.description || extractFirstParagraph(renderData.value?.html) || options?.fallbackDescription || options?.siteName || void 0
28
30
  );
29
31
  const ogImage = computed(
30
- () => entry.value?.meta?.coverImage ?? renderData.value?.ogImage ?? extractFirstImage(renderData.value?.html) ?? void 0
32
+ () => entry.value?.meta?.coverImage || renderData.value?.ogImage || extractFirstImage(renderData.value?.html) || void 0
31
33
  );
32
34
  useHead({
33
35
  title,
34
36
  ...options?.titleTemplate ? { titleTemplate: options.titleTemplate } : {}
35
37
  });
36
38
  useSeoMeta({
39
+ description,
37
40
  ogTitle: title,
38
41
  ogDescription: description,
39
- ...options?.siteName ? { ogSiteName: options.siteName } : {},
42
+ ogSiteName: () => options?.siteName,
40
43
  ogType: "article",
44
+ ogImage: () => ogImage.value,
41
45
  twitterCard: "summary",
42
- ...ogImage.value ? { ogImage } : {}
46
+ twitterTitle: title,
47
+ twitterDescription: description,
48
+ twitterImage: () => ogImage.value
43
49
  });
44
50
  return { title, description, ogImage };
45
51
  }
@@ -16,8 +16,19 @@ interface NodeContextMenuOptions {
16
16
  onChangeType?: (id: string, newType: string) => void;
17
17
  /** Open the doc — renders an "Open" item (e.g. navigate to the full page). */
18
18
  onOpen?: (id: string) => void;
19
+ /** Open the doc in a slide-over panel — renders "Open as slideover". */
20
+ onOpenOverlay?: (id: string) => void;
19
21
  /** Open the doc in a floating window — renders "Open as window". */
20
22
  onOpenInWindow?: (id: string) => void;
23
+ /**
24
+ * Whether the current user may mutate this doc. When false, every mutating
25
+ * group is dropped (rename / duplicate / change-type / add-child / move-to /
26
+ * edit-tags / color / move-to-trash), leaving only read-safe items: open /
27
+ * slideover / window, copy link, favorites, export. Defaults to true for
28
+ * back-compat — pass `useDocumentPermissions(effectiveRole).canWrite` (AND
29
+ * the host `editable` opt-in) so read-only viewers don't see dead actions.
30
+ */
31
+ canWrite?: boolean;
21
32
  /** Create a child page under this node — renders "Add child page". */
22
33
  onAddChild?: (parentId: string) => void;
23
34
  /** Reparent this node — renders "Move to…" (e.g. open an <ADocPickerModal>). */
@@ -2,6 +2,7 @@ import { getAvailableDocTypes } from "../utils/docTypes.js";
2
2
  import { UI_COLORS } from "../types.js";
3
3
  export function useNodeContextMenu(opts) {
4
4
  const { nodeId, label: _label, type, tree, registry } = opts;
5
+ const canWrite = opts.canWrite !== false;
5
6
  const docTypes = getAvailableDocTypes(registry);
6
7
  const openGroup = [];
7
8
  if (opts.onOpen) {
@@ -13,6 +14,15 @@ export function useNodeContextMenu(opts) {
13
14
  }
14
15
  });
15
16
  }
17
+ if (opts.onOpenOverlay) {
18
+ openGroup.push({
19
+ label: "Open as slideover",
20
+ icon: "i-lucide-panel-right",
21
+ onSelect() {
22
+ opts.onOpenOverlay(nodeId);
23
+ }
24
+ });
25
+ }
16
26
  if (opts.onOpenInWindow) {
17
27
  openGroup.push({
18
28
  label: "Open as window",
@@ -119,7 +129,7 @@ export function useNodeContextMenu(opts) {
119
129
  }
120
130
  });
121
131
  }
122
- if (opts.onEditTags) {
132
+ if (opts.onEditTags && canWrite) {
123
133
  actionsGroup.push({
124
134
  label: "Edit tags\u2026",
125
135
  icon: "i-lucide-tags",
@@ -150,8 +160,8 @@ export function useNodeContextMenu(opts) {
150
160
  ];
151
161
  const items = [];
152
162
  if (openGroup.length > 0) items.push(openGroup);
153
- items.push(editGroup, appearanceGroup);
163
+ if (canWrite) items.push(editGroup, appearanceGroup);
154
164
  if (actionsGroup.length > 0) items.push(actionsGroup);
155
- items.push(dangerGroup);
165
+ if (canWrite) items.push(dangerGroup);
156
166
  return { items };
157
167
  }
@@ -1,14 +1,21 @@
1
1
  import type { ShallowRef } from 'vue';
2
2
  export interface UseNodePanelOptions {
3
- /** Timeout in ms waiting for child provider sync (default: 8000) */
3
+ /**
4
+ * @deprecated No longer used — the panel opens on local hydration and
5
+ * streams server content through the live binding instead of blocking on
6
+ * network sync. Kept for call-site compatibility.
7
+ */
4
8
  syncTimeout?: number;
5
9
  }
6
10
  /**
7
11
  * Manages the state for opening a child document in a slide-over panel.
8
- * Loads the child provider, waits for sync, and primes the Y.XmlFragment
9
- * so TipTap can initialise without errors.
12
+ * Loads the child provider, awaits only local (IndexedDB) hydration, and
13
+ * primes the Y.XmlFragment so TipTap can initialise without errors. Server
14
+ * content streams into the live binding after open — blocking on network
15
+ * `synced` here is what made cold opens fail on slow or unreachable
16
+ * connections while cached docs appeared to work (matches ADocRenderer).
10
17
  */
11
- export declare function useNodePanel(parentProvider: ShallowRef<any>, options?: UseNodePanelOptions): {
18
+ export declare function useNodePanel(parentProvider: ShallowRef<any>, _options?: UseNodePanelOptions): {
12
19
  openNodeId: import("vue").Ref<string | null, string | null>;
13
20
  openNodeLabel: import("vue").Ref<string, string>;
14
21
  openNodeProvider: import("vue").Ref<any, any>;
@@ -1,6 +1,5 @@
1
1
  import { ref } from "vue";
2
- export function useNodePanel(parentProvider, options) {
3
- const syncTimeout = options?.syncTimeout ?? 8e3;
2
+ export function useNodePanel(parentProvider, _options) {
4
3
  const openNodeId = ref(null);
5
4
  const openNodeLabel = ref("");
6
5
  const openNodeProvider = ref(null);
@@ -22,21 +21,7 @@ export function useNodePanel(parentProvider, options) {
22
21
  try {
23
22
  const childProv = await parentProvider.value.loadChild(nodeId);
24
23
  if (_lastNodeId !== nodeId) return;
25
- if (!childProv.isSynced) {
26
- await new Promise((resolve, reject) => {
27
- const timer = setTimeout(() => {
28
- childProv.off("synced", onSynced);
29
- reject(new Error(`Sync timeout after ${syncTimeout}ms`));
30
- }, syncTimeout);
31
- function onSynced({ state }) {
32
- if (!state) return;
33
- clearTimeout(timer);
34
- childProv.off("synced", onSynced);
35
- resolve();
36
- }
37
- childProv.on("synced", onSynced);
38
- });
39
- }
24
+ if (childProv?.ready) await childProv.ready;
40
25
  if (_lastNodeId !== nodeId) return;
41
26
  const doc = childProv.document;
42
27
  const frag = doc.getXmlFragment("default");
@@ -0,0 +1,17 @@
1
+ import type { MaybeRefOrGetter, ShallowRef } from 'vue';
2
+ /**
3
+ * Reactive effective role of a provider instance — the PER-DOCUMENT scope the
4
+ * server granted when this provider's doc subscription authenticated.
5
+ *
6
+ * The global `useAbracadabra().effectiveRole` reflects the ENTRY doc's scope
7
+ * only; on servers with per-document access (e.g. a public landing space with
8
+ * `editor` access whose docs subtree is `viewer`) it is the wrong gate for any
9
+ * other doc. Each child provider carries its own authoritative
10
+ * `effectiveRole`, updated via the SDK's `roleChanged` event — this composable
11
+ * exposes it as a ref.
12
+ *
13
+ * Returns `null` while the role is unknown (no provider yet, offline restore,
14
+ * pre-auth) — callers should treat unknown as permissive so offline-first
15
+ * editing isn't broken, mirroring ADocRenderer's role fold.
16
+ */
17
+ export declare function useProviderRole(provider: MaybeRefOrGetter<any>): ShallowRef<string | null>;
@@ -0,0 +1,22 @@
1
+ import { shallowRef, watch, onScopeDispose, toValue } from "vue";
2
+ export function useProviderRole(provider) {
3
+ const role = shallowRef(null);
4
+ let attached = null;
5
+ const onRoleChanged = ({ role: next }) => {
6
+ role.value = next ?? null;
7
+ };
8
+ const detach = () => {
9
+ attached?.off?.("roleChanged", onRoleChanged);
10
+ attached = null;
11
+ };
12
+ watch(() => toValue(provider), (p) => {
13
+ detach();
14
+ role.value = p?.effectiveRole ?? null;
15
+ if (p?.on) {
16
+ attached = p;
17
+ p.on("roleChanged", onRoleChanged);
18
+ }
19
+ }, { immediate: true });
20
+ onScopeDispose(detach);
21
+ return role;
22
+ }
@@ -1,3 +1,15 @@
1
+ /**
2
+ * <DocLinkView> — NodeView for an inline link to another document.
3
+ *
4
+ * Renders a pill badge for the linked doc. Left-click opens it (plain →
5
+ * navigate to the full page, Cmd/Ctrl → slide-over panel, Alt → floating
6
+ * window). Right-click opens the same node context menu the breadcrumb and
7
+ * sidebar tree use (open / slideover / window / rename / duplicate / change
8
+ * type / copy link / favorite / trash), gated on write access so read-only
9
+ * viewers only see the read-safe items.
10
+ *
11
+ * Ported to match cou-sh/app/components/editor/DocLinkView.vue.
12
+ */
1
13
  import type { NodeViewProps } from '@tiptap/vue-3';
2
14
  declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
3
15
  declare const _default: typeof __VLS_export;
@@ -1,11 +1,19 @@
1
1
  <script setup>
2
2
  import { NodeViewWrapper } from "@tiptap/vue-3";
3
- import { computed } from "vue";
3
+ import { computed, ref, defineAsyncComponent } from "vue";
4
4
  import { navigateTo } from "#imports";
5
5
  import { useAbracadabra } from "../../composables/useAbracadabra";
6
- import { useSyncedMap } from "../../composables/useYDoc";
6
+ import { useChildTree } from "../../composables/useChildTree";
7
+ import { useFavorites } from "../../composables/useFavorites";
8
+ import { useWindowManager } from "../../composables/useWindowManager";
9
+ import { useNodePanel } from "../../composables/useNodePanel";
10
+ import { useNodeContextMenu } from "../../composables/useNodeContextMenu";
11
+ import { useNodeViewEditable } from "../../composables/useNodeView";
7
12
  import { useDocSlugs } from "../../composables/useDocSlugs";
8
13
  import { resolveDocType } from "../../utils/docTypes";
14
+ import ANodeContextMenu from "../../components/shell/ANodeContextMenu.vue";
15
+ import AModalShell from "../../components/AModalShell.vue";
16
+ const ANodePanel = defineAsyncComponent(() => import("../../components/ANodePanel.vue"));
9
17
  const props = defineProps({
10
18
  decorations: { type: Array, required: true },
11
19
  selected: { type: Boolean, required: true },
@@ -19,23 +27,90 @@ const props = defineProps({
19
27
  extension: { type: Object, required: true },
20
28
  HTMLAttributes: { type: Object, required: true }
21
29
  });
22
- const { doc: rootDoc } = useAbracadabra();
30
+ const { doc: rootDoc, provider, registry, isReady } = useAbracadabra();
23
31
  const { getDocUrl } = useDocSlugs();
24
- const treeMap = useSyncedMap(
25
- rootDoc,
26
- "doc-tree"
27
- );
28
32
  const docId = computed(() => props.node.attrs.docId);
33
+ const tree = useChildTree(rootDoc, docId.value);
34
+ const { treeMap } = tree;
35
+ const { isFavorite, toggleFavorite } = useFavorites(rootDoc);
36
+ const { floatWindowsAvailable } = useWindowManager();
37
+ const hostEditable = useNodeViewEditable(props);
38
+ const canWrite = hostEditable;
29
39
  const treeEntry = computed(() => treeMap.data[docId.value]);
30
40
  const exists = computed(() => !!treeEntry.value);
31
- const docType = computed(() => resolveDocType(treeEntry.value?.type));
41
+ const docType = computed(() => resolveDocType(treeEntry.value?.type, registry));
32
42
  const label = computed(() => treeEntry.value?.label || "Untitled");
33
- function navigate(e) {
43
+ const { openNodeId, openNodeLabel, openNodeProvider, openNode, closePanel } = useNodePanel(provider);
44
+ async function openAsWindow(id, title) {
45
+ const wm = useWindowManager();
46
+ if (wm.windows.has(id)) {
47
+ wm.focusWindow(id);
48
+ return;
49
+ }
50
+ const childProv = await provider.value?.loadChild(id);
51
+ if (!childProv) return;
52
+ if (!childProv.isSynced) {
53
+ await new Promise((resolve) => {
54
+ const done = () => {
55
+ childProv.off("synced", done);
56
+ resolve();
57
+ };
58
+ childProv.on("synced", done);
59
+ setTimeout(resolve, 6e3);
60
+ });
61
+ }
62
+ const entry = treeMap.get(id);
63
+ wm.openWindow({ id, title, docId: id, docType: entry?.type, provider: childProv, initialTab: "editor" });
64
+ }
65
+ function onClick(e) {
66
+ if (!docId.value) return;
34
67
  e.preventDefault();
35
68
  e.stopPropagation();
36
- if (!docId.value) return;
69
+ if (!e.shiftKey && (e.metaKey || e.ctrlKey)) {
70
+ openNode(docId.value, label.value);
71
+ return;
72
+ }
73
+ if (!e.shiftKey && e.altKey && floatWindowsAvailable.value) {
74
+ void openAsWindow(docId.value, label.value);
75
+ return;
76
+ }
37
77
  navigateTo(getDocUrl(docId.value));
38
78
  }
79
+ const renameOpen = ref(false);
80
+ const renameValue = ref("");
81
+ function startRename() {
82
+ renameValue.value = label.value;
83
+ renameOpen.value = true;
84
+ }
85
+ function commitRename() {
86
+ const next = renameValue.value.trim();
87
+ if (next) tree.renameEntry(docId.value, next);
88
+ renameOpen.value = false;
89
+ }
90
+ const menuItems = computed(() => useNodeContextMenu({
91
+ nodeId: docId.value,
92
+ label: label.value,
93
+ type: treeEntry.value?.type,
94
+ meta: treeEntry.value?.meta,
95
+ tree,
96
+ registry,
97
+ canWrite: canWrite.value,
98
+ favorites: { isFavorite, toggleFavorite },
99
+ onOpen: (id) => navigateTo(getDocUrl(id)),
100
+ onOpenOverlay: (id) => openNode(id, label.value),
101
+ onOpenInWindow: floatWindowsAvailable.value ? (id) => void openAsWindow(id, label.value) : void 0,
102
+ onRename: () => startRename(),
103
+ onAddChild: (parentId) => {
104
+ if (!isReady.value) return;
105
+ const id = tree.createChild(parentId, "Untitled", "doc");
106
+ navigateTo(getDocUrl(id));
107
+ },
108
+ onCopyLink: (id) => {
109
+ if (!import.meta.client || !navigator?.clipboard) return;
110
+ navigator.clipboard.writeText(new URL(getDocUrl(id), location.origin).href).catch(() => {
111
+ });
112
+ }
113
+ }).items);
39
114
  </script>
40
115
 
41
116
  <template>
@@ -43,18 +118,22 @@ function navigate(e) {
43
118
  as="span"
44
119
  class="inline-flex align-baseline"
45
120
  >
46
- <UBadge
121
+ <ANodeContextMenu
47
122
  v-if="exists"
48
- :icon="docType.icon"
49
- color="neutral"
50
- variant="subtle"
51
- size="sm"
52
- class="dl-badge rounded-full cursor-pointer"
53
- :class="{ 'dl-badge-selected': props.selected }"
54
- @click="navigate"
123
+ :items="menuItems"
55
124
  >
56
- {{ label }}
57
- </UBadge>
125
+ <UBadge
126
+ :icon="docType.icon"
127
+ color="neutral"
128
+ variant="subtle"
129
+ size="sm"
130
+ class="dl-badge rounded-full cursor-pointer"
131
+ :class="{ 'dl-badge-selected': props.selected }"
132
+ @click="onClick"
133
+ >
134
+ {{ label }}
135
+ </UBadge>
136
+ </ANodeContextMenu>
58
137
  <UBadge
59
138
  v-else
60
139
  icon="i-lucide-file-x"
@@ -65,6 +144,47 @@ function navigate(e) {
65
144
  >
66
145
  Missing document
67
146
  </UBadge>
147
+
148
+ <!-- Slide-over host: heavy panel mounts only while a link is open -->
149
+ <ANodePanel
150
+ v-if="openNodeId"
151
+ :node-id="openNodeId"
152
+ :node-label="openNodeLabel"
153
+ :child-provider="openNodeProvider"
154
+ :doc-type="treeMap.data[openNodeId]?.type"
155
+ :editable="hostEditable"
156
+ @close="closePanel"
157
+ />
158
+
159
+ <!-- Rename modal -->
160
+ <AModalShell
161
+ :open="renameOpen"
162
+ title="Rename document"
163
+ max-width="sm:max-w-sm"
164
+ @update:open="renameOpen = $event"
165
+ >
166
+ <UInput
167
+ v-model="renameValue"
168
+ autofocus
169
+ placeholder="Document name"
170
+ class="w-full"
171
+ @keydown.enter="commitRename"
172
+ />
173
+ <template #footer>
174
+ <div class="flex justify-end gap-2">
175
+ <UButton
176
+ label="Cancel"
177
+ color="neutral"
178
+ variant="ghost"
179
+ @click="renameOpen = false"
180
+ />
181
+ <UButton
182
+ label="Rename"
183
+ @click="commitRename"
184
+ />
185
+ </div>
186
+ </template>
187
+ </AModalShell>
68
188
  </NodeViewWrapper>
69
189
  </template>
70
190
 
@@ -1,3 +1,15 @@
1
+ /**
2
+ * <DocLinkView> — NodeView for an inline link to another document.
3
+ *
4
+ * Renders a pill badge for the linked doc. Left-click opens it (plain →
5
+ * navigate to the full page, Cmd/Ctrl → slide-over panel, Alt → floating
6
+ * window). Right-click opens the same node context menu the breadcrumb and
7
+ * sidebar tree use (open / slideover / window / rename / duplicate / change
8
+ * type / copy link / favorite / trash), gated on write access so read-only
9
+ * viewers only see the read-safe items.
10
+ *
11
+ * Ported to match cou-sh/app/components/editor/DocLinkView.vue.
12
+ */
1
13
  import type { NodeViewProps } from '@tiptap/vue-3';
2
14
  declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
3
15
  declare const _default: typeof __VLS_export;
@@ -21,6 +21,35 @@ const items = computed(() => {
21
21
  void props.node.content.size;
22
22
  return buildMetaMenuItems(props.editor);
23
23
  });
24
+ const pageMeta = computed(
25
+ () => props.editor.storage?.metaField?.pageMeta ?? null
26
+ );
27
+ const fallbackChips = computed(() => {
28
+ if (editable.value || props.node.childCount > 0) return [];
29
+ const m = pageMeta.value;
30
+ if (!m) return [];
31
+ const chips = [];
32
+ if (m.status && m.status !== "none") chips.push({ icon: "i-lucide-circle-dot", label: String(m.status) });
33
+ if (typeof m.priority === "number" && m.priority > 0) chips.push({ icon: "i-lucide-flag", label: `P${m.priority}` });
34
+ if (typeof m.rating === "number" && m.rating > 0) chips.push({ icon: "i-lucide-star", label: `${m.rating}/5` });
35
+ if (m.dateStart || m.dateEnd) chips.push({ icon: "i-lucide-calendar", label: [m.dateStart, m.dateEnd].filter(Boolean).join(" \u2192 ") });
36
+ if (Array.isArray(m.members)) {
37
+ for (const mem of m.members) {
38
+ if (mem?.label) chips.push({ icon: "i-lucide-user", label: mem.label });
39
+ }
40
+ }
41
+ if (Array.isArray(m.tags)) {
42
+ for (const t of m.tags) chips.push({ icon: "i-lucide-tag", label: t });
43
+ }
44
+ if (m.url) chips.push({ icon: "i-lucide-link", label: String(m.url) });
45
+ if (m.email) chips.push({ icon: "i-lucide-mail", label: String(m.email) });
46
+ if (m.phone) chips.push({ icon: "i-lucide-phone", label: String(m.phone) });
47
+ if (typeof m.number === "number") chips.push({ icon: "i-lucide-hash", label: `${m.number}${m.unit ? ` ${m.unit}` : ""}` });
48
+ return chips;
49
+ });
50
+ const hiddenWhenEmpty = computed(
51
+ () => !editable.value && props.node.childCount === 0 && fallbackChips.value.length === 0
52
+ );
24
53
  function placeCursorInMeta(event) {
25
54
  const target = event.target;
26
55
  if (!target) return;
@@ -56,6 +85,7 @@ function placeCursorInMeta(event) {
56
85
  as="div"
57
86
  data-type="document-meta"
58
87
  class="group/meta"
88
+ :class="{ 'meta-hidden': hiddenWhenEmpty }"
59
89
  draggable="false"
60
90
  @mousedown="placeCursorInMeta"
61
91
  @dragstart.prevent.stop
@@ -68,6 +98,22 @@ function placeCursorInMeta(event) {
68
98
  class="meta-content"
69
99
  style="display: contents"
70
100
  />
101
+ <!-- Read-only fallback: static chips from the doc-tree meta when no
102
+ metaField chips were ever materialized in the content. -->
103
+ <template v-if="!editable && props.node.childCount === 0">
104
+ <UBadge
105
+ v-for="(chip, i) in fallbackChips"
106
+ :key="`${chip.icon}-${chip.label}-${i}`"
107
+ :icon="chip.icon"
108
+ color="neutral"
109
+ variant="soft"
110
+ size="sm"
111
+ class="rounded-full"
112
+ contenteditable="false"
113
+ >
114
+ {{ chip.label }}
115
+ </UBadge>
116
+ </template>
71
117
  <span
72
118
  v-show="editable"
73
119
  contenteditable="false"
@@ -89,3 +135,7 @@ function placeCursorInMeta(event) {
89
135
  </span>
90
136
  </NodeViewWrapper>
91
137
  </template>
138
+
139
+ <style scoped>
140
+ .meta-hidden{display:none!important}
141
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/nuxt",
3
- "version": "2.51.0",
3
+ "version": "2.53.0",
4
4
  "description": "First-class Nuxt module for the Abracadabra CRDT collaboration platform",
5
5
  "repository": "abracadabra/abracadabra-nuxt",
6
6
  "license": "MIT",