@abraca/nuxt 2.60.0 → 2.62.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 CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=4.0.0"
6
6
  },
7
- "version": "2.60.0",
7
+ "version": "2.62.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -34,6 +34,13 @@ type __VLS_Props = {
34
34
  label?: string;
35
35
  meta?: Record<string, unknown>;
36
36
  } | null;
37
+ /**
38
+ * Forward to editor-type renderers (`doc`/`prose` → <AEditor>): show the
39
+ * built-in sub-page list (<ADocSubPageList>) below the body. Default: true.
40
+ * Set false to render a plain document with no child-page section. Ignored by
41
+ * structured renderers (kanban/table/…) which have no sub-page list.
42
+ */
43
+ showSubPages?: boolean;
37
44
  };
38
45
  declare var __VLS_1: {}, __VLS_23: {
39
46
  error: string;
@@ -46,6 +53,7 @@ type __VLS_Slots = {} & {
46
53
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
47
54
  editable: boolean;
48
55
  breadcrumbMenu: boolean;
56
+ showSubPages: boolean;
49
57
  canvasClass: string;
50
58
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
51
59
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -14,7 +14,8 @@ const props = defineProps({
14
14
  editorClass: { type: String, required: false },
15
15
  rendererClass: { type: String, required: false },
16
16
  canvasClass: { type: String, required: false, default: "flex flex-col w-full h-[70vh] min-h-[420px]" },
17
- entry: { type: [Object, null], required: false }
17
+ entry: { type: [Object, null], required: false },
18
+ showSubPages: { type: Boolean, required: false, default: true }
18
19
  });
19
20
  const abra = useAbracadabra();
20
21
  const { resolveEntry, findDocSpaceId, getProviderForDoc, connectSpace, connections } = useSpaceConnections();
@@ -122,6 +123,7 @@ const wrapperClass = computed(
122
123
  :child-provider="childProvider"
123
124
  :editable="effectiveEditable"
124
125
  :breadcrumb-menu="breadcrumbMenu"
126
+ :show-sub-pages="docTypeDef.hasEditor ? showSubPages : void 0"
125
127
  :class="resolvedClass"
126
128
  />
127
129
  </div>
@@ -34,6 +34,13 @@ type __VLS_Props = {
34
34
  label?: string;
35
35
  meta?: Record<string, unknown>;
36
36
  } | null;
37
+ /**
38
+ * Forward to editor-type renderers (`doc`/`prose` → <AEditor>): show the
39
+ * built-in sub-page list (<ADocSubPageList>) below the body. Default: true.
40
+ * Set false to render a plain document with no child-page section. Ignored by
41
+ * structured renderers (kanban/table/…) which have no sub-page list.
42
+ */
43
+ showSubPages?: boolean;
37
44
  };
38
45
  declare var __VLS_1: {}, __VLS_23: {
39
46
  error: string;
@@ -46,6 +53,7 @@ type __VLS_Slots = {} & {
46
53
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
47
54
  editable: boolean;
48
55
  breadcrumbMenu: boolean;
56
+ showSubPages: boolean;
49
57
  canvasClass: string;
50
58
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
51
59
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -25,6 +25,8 @@ import { useProviderRole } from "../composables/useProviderRole";
25
25
  import { DOC_DRAG_MIME, isDocDrag, parseDocDragPayload, isDescendantInMap } from "../utils/docDragDrop";
26
26
  import { useEditorToolbar } from "../composables/useEditorToolbar";
27
27
  import { useEditorSuggestions } from "../composables/useEditorSuggestions";
28
+ import { useOfflineUploadQueue } from "../composables/useOfflineUploadQueue";
29
+ import { useFileBlobStore } from "../composables/useFileBlobStore";
28
30
  import { useEditorDragHandle } from "../composables/useEditorDragHandle";
29
31
  import { useEditorEmojis } from "../composables/useEditorEmojis";
30
32
  import { useEditorMentions } from "../composables/useEditorMentions";
@@ -54,7 +56,7 @@ const props = defineProps({
54
56
  const viewMode = ref("rich");
55
57
  const emit = defineEmits(["ready", "update", "rename", "updateMeta"]);
56
58
  const model = defineModel({ type: null });
57
- const { doc, provider, registry, effectiveRole } = useNuxtApp().$abracadabra;
59
+ const { doc, provider, registry, effectiveRole, client } = useNuxtApp().$abracadabra;
58
60
  const { connections, getProviderForDoc, getDocForDoc } = useSpaceConnections();
59
61
  const ownerProvider = computed(() => getProviderForDoc(props.docId) ?? provider.value);
60
62
  const ownerDoc = shallowRef(getDocForDoc(props.docId) ?? doc.value);
@@ -173,6 +175,14 @@ watchEffect(() => {
173
175
  avatar: u.color ? { alt: u.name, style: { borderColor: u.color, borderWidth: "2px", borderStyle: "solid" } } : { alt: u.name }
174
176
  }));
175
177
  });
178
+ watchEffect(() => {
179
+ const isReady = ready.value;
180
+ const editorInstance = editorRef.value;
181
+ if (!isReady || !editorInstance) return;
182
+ const fileDropStore = editorInstance.editor?.storage?.fileDrop;
183
+ if (!fileDropStore) return;
184
+ fileDropStore.onFiles = effectiveEditable.value ? uploadAndInsertFiles : null;
185
+ });
176
186
  let metaInitDone = false;
177
187
  function handleMetaUpdate(patch) {
178
188
  writeTreeMeta(patch);
@@ -504,6 +514,63 @@ function insertNode(editor, type, attrs, content) {
504
514
  return editor.chain().focus().insertContent(node);
505
515
  }
506
516
  const { pickDoc } = useDocLinkPick();
517
+ const { enqueue: enqueueUpload } = useOfflineUploadQueue();
518
+ const { putBlob: cacheBlobLocally } = useFileBlobStore();
519
+ async function uploadOne(file) {
520
+ try {
521
+ const meta = await client.value?.upload(props.docId, file, file.name);
522
+ if (meta?.id) {
523
+ try {
524
+ await cacheBlobLocally(props.docId, meta.id, file, file.name);
525
+ } catch {
526
+ }
527
+ return meta.id;
528
+ }
529
+ } catch (e) {
530
+ if (import.meta.dev) console.warn("[AEditor] upload failed, queueing offline:", e);
531
+ }
532
+ try {
533
+ const queued = await enqueueUpload(props.docId, file);
534
+ return queued.id;
535
+ } catch {
536
+ return null;
537
+ }
538
+ }
539
+ async function uploadAndInsertFiles(files, pos) {
540
+ const ed = editorRef.value?.editor;
541
+ if (!ed || !effectiveEditable.value || !files.length) return;
542
+ let at = typeof pos === "number" ? pos : ed.state.selection.to;
543
+ for (const file of files) {
544
+ const uploadId = await uploadOne(file);
545
+ if (!uploadId) continue;
546
+ const attrs = { uploadId, docId: props.docId, filename: file.name, mimeType: file.type };
547
+ const sizeBefore = ed.state.doc.content.size;
548
+ const target = Math.max(0, Math.min(at, ed.state.doc.content.size));
549
+ try {
550
+ ed.chain().insertContentAt(target, { type: "fileBlock", attrs }).run();
551
+ } catch {
552
+ }
553
+ if (ed.state.doc.content.size === sizeBefore) {
554
+ try {
555
+ ed.chain().insertContentAt(ed.state.doc.content.size, { type: "fileBlock", attrs }).run();
556
+ } catch {
557
+ }
558
+ }
559
+ at = ed.state.selection.to;
560
+ }
561
+ ed.commands.focus();
562
+ }
563
+ function pickFiles(accept) {
564
+ return new Promise((resolve) => {
565
+ if (!import.meta.client) return resolve([]);
566
+ const input = document.createElement("input");
567
+ input.type = "file";
568
+ input.multiple = true;
569
+ if (accept) input.accept = accept;
570
+ input.addEventListener("change", () => resolve(Array.from(input.files ?? [])), { once: true });
571
+ input.click();
572
+ });
573
+ }
507
574
  const editorHandlers = {
508
575
  // Slash → pick a document → embed it as a block. `execute` returns a chain
509
576
  // synchronously (the dispatcher .run()s it); the actual insert happens async
@@ -536,6 +603,29 @@ const editorHandlers = {
536
603
  execute: (editor, item) => editor.chain().focus().insertMetaField(item.attrs),
537
604
  isActive: () => false
538
605
  },
606
+ // Slash → native file picker → upload → fileBlock. Like docEmbed, `execute`
607
+ // returns a chain synchronously (the dispatcher .run()s it) while the picker
608
+ // + upload resolve async and do the real insert via uploadAndInsertFiles.
609
+ imageUpload: {
610
+ canExecute: () => true,
611
+ execute: (editor) => {
612
+ pickFiles("image/*").then((files) => {
613
+ if (files.length) uploadAndInsertFiles(files);
614
+ });
615
+ return editor.chain().focus();
616
+ },
617
+ isActive: () => false
618
+ },
619
+ fileUpload: {
620
+ canExecute: () => true,
621
+ execute: (editor) => {
622
+ pickFiles().then((files) => {
623
+ if (files.length) uploadAndInsertFiles(files);
624
+ });
625
+ return editor.chain().focus();
626
+ },
627
+ isActive: () => false
628
+ },
539
629
  divider: {
540
630
  canExecute: () => true,
541
631
  execute: (editor) => insertNode(editor, "divider", { label: "" }),
@@ -35,6 +35,14 @@ type __VLS_Props = {
35
35
  * meta/type patches all follow `panelEditable`.
36
36
  */
37
37
  editable?: boolean;
38
+ /**
39
+ * Whether the Chat tab requires write access on the doc. Default `true`.
40
+ *
41
+ * The server gates `messages:send` on `role.can_write()` (Editor and above),
42
+ * so a viewer/observer offered a chat tab gets a compose box whose every send
43
+ * is rejected. Set `false` to keep chat visible read-only for such roles.
44
+ */
45
+ chatRequiresWrite?: boolean;
38
46
  };
39
47
  declare var __VLS_11: {
40
48
  nodeId: string | null;
@@ -54,6 +62,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
54
62
  }>, {
55
63
  initialTab: "editor" | "properties" | "chat" | "settings" | "serverSettings" | string;
56
64
  editable: boolean;
65
+ chatRequiresWrite: boolean;
57
66
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
58
67
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
59
68
  declare const _default: typeof __VLS_export;
@@ -7,6 +7,7 @@ import { useChildTree } from "../composables/useChildTree";
7
7
  import { useSpaceConnections } from "../composables/useSpaceConnections";
8
8
  import { useDocumentPermissions } from "../composables/useDocumentPermissions";
9
9
  import { useProviderRole } from "../composables/useProviderRole";
10
+ import { provideRendererSurface } from "../composables/useRendererSurface";
10
11
  import { useAbraLocale } from "../composables/useAbraLocale";
11
12
  import { useDocSlugs } from "../composables/useDocSlugs";
12
13
  import { useResizableWidth } from "../composables/useResizableWidth";
@@ -28,7 +29,8 @@ const props = defineProps({
28
29
  initialTab: { type: String, required: false, default: "editor" },
29
30
  tabs: { type: Array, required: false },
30
31
  docHref: { type: Function, required: false },
31
- editable: { type: Boolean, required: false, default: true }
32
+ editable: { type: Boolean, required: false, default: true },
33
+ chatRequiresWrite: { type: Boolean, required: false, default: true }
32
34
  });
33
35
  const emit = defineEmits(["close"]);
34
36
  const open = computed({
@@ -78,6 +80,7 @@ const { canWrite: roleCanWrite } = useDocumentPermissions(providerRole);
78
80
  const panelEditable = computed(
79
81
  () => props.editable !== false && (!providerRole.value || roleCanWrite.value)
80
82
  );
83
+ provideRendererSurface("panel");
81
84
  const resolvedLabel = computed(() => entry.value?.label || props.nodeLabel || "");
82
85
  const currentType = computed(() => entry.value?.type ?? "doc");
83
86
  const { getDocUrl } = useDocSlugs();
@@ -141,7 +144,14 @@ const _runtimeFeatures = computed(() => {
141
144
  });
142
145
  const showChatTab = computed(() => {
143
146
  if (props.tabs && !props.tabs.includes("chat")) return false;
144
- return !!_runtimeFeatures.value?.chat;
147
+ if (!_runtimeFeatures.value?.chat) return false;
148
+ if (props.chatRequiresWrite && providerRole.value && !roleCanWrite.value) return false;
149
+ return true;
150
+ });
151
+ watch(showChatTab, (visible) => {
152
+ if (!visible && activeTab.value === "chat") {
153
+ activeTab.value = usesPageRenderer.value ? "pageType" : "editor";
154
+ }
145
155
  });
146
156
  const showEditorTab = computed(() => !props.tabs || props.tabs.includes("editor"));
147
157
  const showPropertiesTab = computed(() => !!props.tabs && props.tabs.includes("properties"));
@@ -387,9 +397,11 @@ const addFieldMenuItems = computed(
387
397
  <!-- Page-type tab — the registered renderer for non-'doc' types
388
398
  (kanban / table / calendar / …). Now its own slot, so the editor
389
399
  tab below always exposes the underlying prose. -->
400
+ <!-- `relative`: the anchor a full-bleed renderer pins itself to when
401
+ it reads `useRendererSurface()` and sees it is embedded. -->
390
402
  <div
391
403
  v-show="activeTab === 'pageType'"
392
- class="flex flex-col flex-1 min-h-0"
404
+ class="relative flex flex-col flex-1 min-h-0"
393
405
  >
394
406
  <component
395
407
  :is="docTypeDef.component"
@@ -35,6 +35,14 @@ type __VLS_Props = {
35
35
  * meta/type patches all follow `panelEditable`.
36
36
  */
37
37
  editable?: boolean;
38
+ /**
39
+ * Whether the Chat tab requires write access on the doc. Default `true`.
40
+ *
41
+ * The server gates `messages:send` on `role.can_write()` (Editor and above),
42
+ * so a viewer/observer offered a chat tab gets a compose box whose every send
43
+ * is rejected. Set `false` to keep chat visible read-only for such roles.
44
+ */
45
+ chatRequiresWrite?: boolean;
38
46
  };
39
47
  declare var __VLS_11: {
40
48
  nodeId: string | null;
@@ -54,6 +62,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
54
62
  }>, {
55
63
  initialTab: "editor" | "properties" | "chat" | "settings" | "serverSettings" | string;
56
64
  editable: boolean;
65
+ chatRequiresWrite: boolean;
57
66
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
58
67
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
59
68
  declare const _default: typeof __VLS_export;
@@ -614,14 +614,16 @@ defineExpose({ connectedUsers });
614
614
  tag="div"
615
615
  class="space-y-0.5"
616
616
  >
617
- <UContextMenu
617
+ <!-- Wrapper element is the TransitionGroup child (UContextMenu renders a
618
+ fragment root that Vue can't FLIP-animate). -->
619
+ <div
618
620
  v-for="item in visibleItems"
619
621
  :key="item.id"
620
- :items="itemMenuItems(item)"
621
622
  >
622
- <div
623
- :ref="(el) => rowRefs[item.id] = el"
624
- tabindex="-1"
623
+ <UContextMenu :items="itemMenuItems(item)">
624
+ <div
625
+ :ref="(el) => rowRefs[item.id] = el"
626
+ tabindex="-1"
625
627
  class="group flex items-center gap-1.5 py-1 pr-1 rounded-(--ui-radius) hover:bg-(--ui-bg-elevated) relative focus:outline-none"
626
628
  :class="{
627
629
  'border-t-2 border-(--ui-primary)': dragOverId === item.id,
@@ -798,7 +800,8 @@ defineExpose({ connectedUsers });
798
800
  </UTooltip>
799
801
  </div>
800
802
  </div>
801
- </UContextMenu>
803
+ </UContextMenu>
804
+ </div>
802
805
  </TransitionGroup>
803
806
  </div>
804
807
  </div>
@@ -283,50 +283,54 @@ defineExpose({ connectedUsers });
283
283
  :class="galleryColumns ? '' : gridClass"
284
284
  :style="gridStyle"
285
285
  >
286
- <UContextMenu
286
+ <!-- Wrapper element is the TransitionGroup child (UContextMenu renders a
287
+ non-element/fragment root that Vue can't FLIP-animate — the wrapper
288
+ gives each item a single real element to move). -->
289
+ <div
287
290
  v-for="item in items"
288
291
  :key="item.id"
289
- :items="editable ? itemMenuItems(item) : []"
290
292
  >
291
- <AGalleryItemCard
292
- :item="item"
293
- :gallery-aspect="galleryAspect"
294
- :card-style="cardStyle"
295
- :show-labels="showLabels"
296
- :is-dragging="dragId === item.id"
297
- :is-drag-over="dragOverId === item.id"
298
- :focusers="itemFocusers(item.id)"
299
- :can-write="editable"
300
- :rename-id="renameId"
301
- :rename-value="renameValue"
302
- :data-drag-id="item.id"
303
- @update:rename-value="renameValue = $event"
304
- @commit-rename="commitRename"
305
- @cancel-rename="renameId = null"
306
- @pointerdown="editable && handlePointerDown($event, item.id)"
307
- @pointerenter="onItemPointerEnter(item.id)"
308
- @pointerleave="onItemPointerLeave"
309
- @click="openLightbox(item)"
310
- @dblclick.stop="editable && startRename(item.id, item.label)"
311
- >
312
- <template #actions>
313
- <UDropdownMenu
314
- v-if="editable"
315
- :items="itemMenuItems(item)"
316
- :content="{ align: 'start' }"
317
- >
318
- <UButton
319
- icon="i-lucide-ellipsis"
320
- size="xs"
321
- variant="ghost"
322
- color="neutral"
323
- class="opacity-0 group-hover:opacity-100 shrink-0"
324
- @click.stop
325
- />
326
- </UDropdownMenu>
327
- </template>
328
- </AGalleryItemCard>
329
- </UContextMenu>
293
+ <UContextMenu :items="editable ? itemMenuItems(item) : []">
294
+ <AGalleryItemCard
295
+ :item="item"
296
+ :gallery-aspect="galleryAspect"
297
+ :card-style="cardStyle"
298
+ :show-labels="showLabels"
299
+ :is-dragging="dragId === item.id"
300
+ :is-drag-over="dragOverId === item.id"
301
+ :focusers="itemFocusers(item.id)"
302
+ :can-write="editable"
303
+ :rename-id="renameId"
304
+ :rename-value="renameValue"
305
+ :data-drag-id="item.id"
306
+ @update:rename-value="renameValue = $event"
307
+ @commit-rename="commitRename"
308
+ @cancel-rename="renameId = null"
309
+ @pointerdown="editable && handlePointerDown($event, item.id)"
310
+ @pointerenter="onItemPointerEnter(item.id)"
311
+ @pointerleave="onItemPointerLeave"
312
+ @click="openLightbox(item)"
313
+ @dblclick.stop="editable && startRename(item.id, item.label)"
314
+ >
315
+ <template #actions>
316
+ <UDropdownMenu
317
+ v-if="editable"
318
+ :items="itemMenuItems(item)"
319
+ :content="{ align: 'start' }"
320
+ >
321
+ <UButton
322
+ icon="i-lucide-ellipsis"
323
+ size="xs"
324
+ variant="ghost"
325
+ color="neutral"
326
+ class="opacity-0 group-hover:opacity-100 shrink-0"
327
+ @click.stop
328
+ />
329
+ </UDropdownMenu>
330
+ </template>
331
+ </AGalleryItemCard>
332
+ </UContextMenu>
333
+ </div>
330
334
  </TransitionGroup>
331
335
  </div>
332
336
 
@@ -750,6 +750,7 @@ const batchedEdgePaths = computed(() => {
750
750
  });
751
751
  let savePosTimer = null;
752
752
  function savePositionsDebounced() {
753
+ if (!canWrite.value) return;
753
754
  if (savePosTimer) clearTimeout(savePosTimer);
754
755
  savePosTimer = setTimeout(() => {
755
756
  savePosTimer = null;
@@ -825,14 +825,18 @@ defineExpose({ connectedUsers });
825
825
  tag="div"
826
826
  class="p-2 space-y-1.5 min-h-16"
827
827
  >
828
- <UContextMenu
828
+ <!-- Wrapper element is the TransitionGroup child + FLIP target
829
+ (UContextMenu renders a fragment root Vue can't animate). It
830
+ carries data-drag-id so the self-contained FLIP animates and
831
+ the [data-flipping] suppression targets the transition child. -->
832
+ <div
829
833
  v-for="card in tree.childrenOf(col.id)"
830
834
  :key="card.id"
831
- :items="canWrite ? cardMenuItems(card, col.id) : []"
835
+ :data-drag-id="card.id"
832
836
  >
833
- <div
834
- :data-drag-id="card.id"
835
- class="group bg-(--ui-bg) rounded border text-sm cursor-pointer hover:border-(--ui-primary) transition-colors relative overflow-hidden"
837
+ <UContextMenu :items="canWrite ? cardMenuItems(card, col.id) : []">
838
+ <div
839
+ class="group bg-(--ui-bg) rounded border text-sm cursor-pointer hover:border-(--ui-primary) transition-colors relative overflow-hidden"
836
840
  :class="{
837
841
  'opacity-30': dragCardId === card.id,
838
842
  'border-t-2 border-t-(--ui-primary)': dragOverCardId === card.id,
@@ -966,7 +970,8 @@ defineExpose({ connectedUsers });
966
970
  </UBadge>
967
971
  </div>
968
972
  </div>
969
- </UContextMenu>
973
+ </UContextMenu>
974
+ </div>
970
975
  </TransitionGroup>
971
976
 
972
977
  <!-- Add card -->
@@ -413,15 +413,17 @@ defineExpose({ connectedUsers });
413
413
  tag="div"
414
414
  class="space-y-0.5"
415
415
  >
416
- <UContextMenu
416
+ <!-- Wrapper element is the TransitionGroup child (UContextMenu renders a
417
+ fragment root that Vue can't FLIP-animate). -->
418
+ <div
417
419
  v-for="item in flatItems"
418
420
  :key="item.id"
419
- :items="editable ? itemMenuItems(item) : []"
420
421
  >
421
- <div
422
- :ref="(el) => rowRefs[item.id] = el"
423
- tabindex="-1"
424
- class="group flex items-center gap-1.5 py-1 rounded-(--ui-radius) hover:bg-(--ui-bg-elevated) relative focus:outline-none"
422
+ <UContextMenu :items="editable ? itemMenuItems(item) : []">
423
+ <div
424
+ :ref="(el) => rowRefs[item.id] = el"
425
+ tabindex="-1"
426
+ class="group flex items-center gap-1.5 py-1 rounded-(--ui-radius) hover:bg-(--ui-bg-elevated) relative focus:outline-none"
425
427
  :class="{
426
428
  'border-t-2 border-(--ui-primary)': dragOverId === item.id,
427
429
  'opacity-30': dragId === item.id,
@@ -540,7 +542,8 @@ defineExpose({ connectedUsers });
540
542
  </UTooltip>
541
543
  </div>
542
544
  </div>
543
- </UContextMenu>
545
+ </UContextMenu>
546
+ </div>
544
547
  </TransitionGroup>
545
548
  </div>
546
549
  </div>
@@ -7,6 +7,8 @@ type __VLS_Props = {
7
7
  parentType?: string;
8
8
  metaSchema?: MetaField[];
9
9
  editable?: boolean;
10
+ /** Forwarded to <AEditor> — show the built-in sub-page list. Default: true. */
11
+ showSubPages?: boolean;
10
12
  };
11
13
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, Record<PropertyKey, unknown>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
14
  rename: (label: string) => any;
@@ -7,7 +7,8 @@ const props = defineProps({
7
7
  docMeta: { type: Object, required: false },
8
8
  parentType: { type: String, required: false },
9
9
  metaSchema: { type: Array, required: false },
10
- editable: { type: Boolean, required: false }
10
+ editable: { type: Boolean, required: false },
11
+ showSubPages: { type: Boolean, required: false }
11
12
  });
12
13
  const emit = defineEmits(["ready", "update", "rename", "updateMeta"]);
13
14
  const editorRef = ref(null);
@@ -7,6 +7,8 @@ type __VLS_Props = {
7
7
  parentType?: string;
8
8
  metaSchema?: MetaField[];
9
9
  editable?: boolean;
10
+ /** Forwarded to <AEditor> — show the built-in sub-page list. Default: true. */
11
+ showSubPages?: boolean;
10
12
  };
11
13
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, Record<PropertyKey, unknown>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
14
  rename: (label: string) => any;
@@ -20,7 +20,7 @@ const DEFAULT_LABELS = {
20
20
  roleViewer: "Viewer",
21
21
  roleObserver: "Observer"
22
22
  };
23
- const ROLE_RANK = { observer: 0, viewer: 1, editor: 2, owner: 3 };
23
+ const ROLE_RANK = { observer: 0, viewer: 1, editor: 2, owner: 3, admin: 4, service: 5 };
24
24
  export function roleMax(a, b) {
25
25
  return (ROLE_RANK[a] ?? -1) >= (ROLE_RANK[b] ?? -1) ? a : b;
26
26
  }
@@ -54,13 +54,14 @@ export function useDocPermissions(docId, options) {
54
54
  const pub = docAccess.value?.public_access ?? docAccess.value?.effective_public_access;
55
55
  const publicFloor = pub && pub !== "none" ? pub : null;
56
56
  const def = serverDefaultRole.value || null;
57
- if (explicit && publicFloor) return roleMax(explicit, publicFloor);
58
- if (explicit) return explicit;
59
- if (publicFloor && def) return roleMax(publicFloor, def);
60
- if (publicFloor) return publicFloor;
61
- return def ?? providerRole.value ?? null;
57
+ const cascaded = explicit && publicFloor ? roleMax(explicit, publicFloor) : explicit ?? (publicFloor && def ? roleMax(publicFloor, def) : publicFloor ?? def ?? null);
58
+ const provider = providerRole.value;
59
+ if (cascaded && provider) return roleMax(cascaded, provider);
60
+ return cascaded ?? provider ?? null;
62
61
  });
63
- const isOwner = computed(() => effectiveRole.value === "owner");
62
+ const isOwner = computed(
63
+ () => (ROLE_RANK[effectiveRole.value ?? ""] ?? -1) >= ROLE_RANK.owner
64
+ );
64
65
  const directPermissions = computed(() => permissions.value.filter((p) => p.source === "direct"));
65
66
  const inheritedPermissions = computed(() => permissions.value.filter((p) => p.source === "inherited"));
66
67
  const hasInheritedPermissions = computed(() => inheritedPermissions.value.length > 0);
@@ -1,10 +1,12 @@
1
1
  import { computed, toValue } from "vue";
2
2
  const ROLE_HIERARCHY = {
3
+ service: 6,
3
4
  owner: 5,
4
5
  admin: 4,
5
6
  member: 3,
6
7
  editor: 2,
7
- viewer: 1
8
+ viewer: 1,
9
+ observer: 0
8
10
  };
9
11
  export function useDocumentPermissions(role) {
10
12
  const level = computed(() => ROLE_HIERARCHY[toValue(role) ?? ""] ?? 0);
@@ -0,0 +1,38 @@
1
+ import type { ComputedRef, MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * Where a page-type renderer is currently mounted.
4
+ *
5
+ * - `page` — the renderer IS the route. It may fill the viewport.
6
+ * - `panel` — inside a slideover (`<ANodePanel>`) or any bounded container.
7
+ * - `window` — inside a floating/tiled window managed by the host app.
8
+ */
9
+ export type RendererSurface = 'page' | 'panel' | 'window';
10
+ /**
11
+ * Declare the surface every renderer mounted below this component lives on.
12
+ * `<ANodePanel>` calls this with `'panel'`; a host that mounts renderers in
13
+ * floating windows should call it with `'window'`.
14
+ */
15
+ export declare function provideRendererSurface(surface: MaybeRefOrGetter<RendererSurface>): void;
16
+ /**
17
+ * Read the surface the current renderer is mounted on. Defaults to `'page'`,
18
+ * so a renderer that never sees a provider behaves exactly as it always has.
19
+ *
20
+ * A renderer that fills the VIEWPORT (`position: fixed`, `100dvh`, a global
21
+ * scroll lock, a full-bleed canvas) must not do so when it is embedded — a
22
+ * fixed root escapes its container and takes over the screen from inside a
23
+ * slideover. Branch on `isEmbedded` and pin to the container instead:
24
+ *
25
+ * ```vue
26
+ * const { isEmbedded } = useRendererSurface()
27
+ * <div :class="isEmbedded ? 'absolute inset-0 [contain:layout_paint]' : 'fixed inset-0'">
28
+ * ```
29
+ *
30
+ * Paint containment on the embedded root makes it the containing block for its
31
+ * own `position: fixed` descendants too, so nested overlays (toolbars, docks,
32
+ * popovers) stay inside the panel without touching their own styles.
33
+ */
34
+ export declare function useRendererSurface(): {
35
+ surface: ComputedRef<RendererSurface>;
36
+ isPage: ComputedRef<boolean>;
37
+ isEmbedded: ComputedRef<boolean>;
38
+ };
@@ -0,0 +1,14 @@
1
+ import { computed, inject, provide, toRef } from "vue";
2
+ const RENDERER_SURFACE_KEY = Symbol("abracadabra:renderer-surface");
3
+ export function provideRendererSurface(surface) {
4
+ provide(RENDERER_SURFACE_KEY, toRef(surface));
5
+ }
6
+ export function useRendererSurface() {
7
+ const injected = inject(RENDERER_SURFACE_KEY, null);
8
+ const surface = computed(() => injected?.value ?? "page");
9
+ return {
10
+ surface,
11
+ isPage: computed(() => surface.value === "page"),
12
+ isEmbedded: computed(() => surface.value !== "page")
13
+ };
14
+ }
@@ -1,6 +1,21 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
  export interface FileDropOptions {
3
- onFiles: (files: File[], pos?: number) => void;
3
+ /**
4
+ * Fallback handler for dropped/pasted files. A per-editor handler set on
5
+ * `editor.storage.fileDrop.onFiles` takes precedence (that is how <AEditor>
6
+ * wires uploads with the doc's own id + client). When NEITHER is set the
7
+ * extension leaves the drop/paste alone (no preventDefault) so it isn't
8
+ * silently swallowed.
9
+ */
10
+ onFiles?: (files: File[], pos?: number) => void;
4
11
  }
5
- export declare const FileDrop: Extension<FileDropOptions, any>;
12
+ export interface FileDropStorage {
13
+ /**
14
+ * Per-editor file handler. Set imperatively by the host (e.g. <AEditor>)
15
+ * once the editor exists; cleared (null) for read-only docs so drops aren't
16
+ * captured there. Wins over the static `onFiles` option.
17
+ */
18
+ onFiles: ((files: File[], pos?: number) => void) | null;
19
+ }
20
+ export declare const FileDrop: Extension<FileDropOptions, FileDropStorage>;
6
21
  export default FileDrop;
@@ -6,12 +6,16 @@ function hasDraggedFiles(event) {
6
6
  export const FileDrop = Extension.create({
7
7
  name: "fileDrop",
8
8
  addOptions() {
9
- return { onFiles: () => {
10
- } };
9
+ return { onFiles: void 0 };
10
+ },
11
+ addStorage() {
12
+ return { onFiles: null };
11
13
  },
12
14
  addProseMirrorPlugins() {
15
+ const editor = this.editor;
13
16
  const options = this.options;
14
17
  let dragCounter = 0;
18
+ const resolveHandler = () => editor.storage.fileDrop?.onFiles ?? options.onFiles ?? null;
15
19
  return [
16
20
  new Plugin({
17
21
  key: new PluginKey("fileDrop"),
@@ -19,6 +23,7 @@ export const FileDrop = Extension.create({
19
23
  handleDOMEvents: {
20
24
  dragenter(view, event) {
21
25
  if (!hasDraggedFiles(event)) return false;
26
+ if (!resolveHandler()) return false;
22
27
  dragCounter++;
23
28
  view.dom.classList.add("file-drop-active");
24
29
  return false;
@@ -32,19 +37,22 @@ export const FileDrop = Extension.create({
32
37
  },
33
38
  dragover(_view, event) {
34
39
  if (!hasDraggedFiles(event)) return false;
40
+ if (!resolveHandler()) return false;
35
41
  event.preventDefault();
36
42
  event.dataTransfer.dropEffect = "copy";
37
43
  return false;
38
44
  },
39
45
  drop(view, event) {
40
- dragCounter = 0;
41
- view.dom.classList.remove("file-drop-active");
42
46
  const de = event;
43
47
  const files = Array.from(de.dataTransfer?.files ?? []);
44
48
  if (!files.length) return false;
49
+ const onFiles = resolveHandler();
50
+ if (!onFiles) return false;
51
+ dragCounter = 0;
52
+ view.dom.classList.remove("file-drop-active");
45
53
  event.preventDefault();
46
54
  const dropPos = view.posAtCoords({ left: de.clientX, top: de.clientY })?.pos;
47
- options.onFiles(files, dropPos);
55
+ onFiles(files, dropPos);
48
56
  return true;
49
57
  },
50
58
  paste(_view, event) {
@@ -52,8 +60,10 @@ export const FileDrop = Extension.create({
52
60
  const items = Array.from(ce.clipboardData?.items ?? []);
53
61
  const files = items.filter((item) => item.kind === "file").map((item) => item.getAsFile()).filter((f) => f !== null);
54
62
  if (!files.length) return false;
63
+ const onFiles = resolveHandler();
64
+ if (!onFiles) return false;
55
65
  event.preventDefault();
56
- options.onFiles(files);
66
+ onFiles(files);
57
67
  return true;
58
68
  }
59
69
  }
@@ -1447,6 +1447,7 @@ export default defineNuxtPlugin({
1447
1447
  } catch {
1448
1448
  }
1449
1449
  try {
1450
+ if (!_provider.canWrite) throw new Error("read-only session");
1450
1451
  const trashMap = _doc.getMap("doc-trash");
1451
1452
  const settings = (() => {
1452
1453
  try {
@@ -1479,8 +1480,12 @@ export default defineNuxtPlugin({
1479
1480
  authFailureCount = 0;
1480
1481
  },
1481
1482
  onAuthenticationFailed({ reason }) {
1482
- authFailureCount++;
1483
1483
  const msg = reason || "Authentication failed";
1484
+ if (/write permission denied|not subscribed/i.test(msg)) {
1485
+ addLog(`Write dropped (read-only session): ${msg}`, "auth");
1486
+ return;
1487
+ }
1488
+ authFailureCount++;
1484
1489
  const isPermanent = /disabled|not allowed|forbidden|revoked/i.test(msg);
1485
1490
  if (isPermanent || authFailureCount >= AUTH_FAILURE_LIMIT) {
1486
1491
  _identityStateBeforeBlock = identityState.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/nuxt",
3
- "version": "2.60.0",
3
+ "version": "2.62.0",
4
4
  "description": "First-class Nuxt module for the Abracadabra CRDT collaboration platform",
5
5
  "repository": "abracadabra/abracadabra-nuxt",
6
6
  "license": "MIT",