@abraca/nuxt 2.65.0 → 2.66.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.65.0",
7
+ "version": "2.66.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
12
12
  awareness: boolean;
13
13
  tag: "video" | "audio";
14
14
  live: boolean;
15
- controls: boolean;
16
15
  total: boolean;
16
+ controls: boolean;
17
17
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
18
  declare const _default: typeof __VLS_export;
19
19
  export default _default;
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
12
12
  awareness: boolean;
13
13
  tag: "video" | "audio";
14
14
  live: boolean;
15
- controls: boolean;
16
15
  total: boolean;
16
+ controls: boolean;
17
17
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
18
  declare const _default: typeof __VLS_export;
19
19
  export default _default;
@@ -14,13 +14,13 @@ type __VLS_Props = {
14
14
  extraItems?: DropdownMenuItem[][];
15
15
  };
16
16
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
- logout: () => any;
18
17
  "open-settings": () => any;
19
18
  "open-account": () => any;
19
+ logout: () => any;
20
20
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
- onLogout?: (() => any) | undefined;
22
21
  "onOpen-settings"?: (() => any) | undefined;
23
22
  "onOpen-account"?: (() => any) | undefined;
23
+ onLogout?: (() => any) | undefined;
24
24
  }>, {
25
25
  color: string;
26
26
  collapsed: boolean;
@@ -14,13 +14,13 @@ type __VLS_Props = {
14
14
  extraItems?: DropdownMenuItem[][];
15
15
  };
16
16
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
- logout: () => any;
18
17
  "open-settings": () => any;
19
18
  "open-account": () => any;
19
+ logout: () => any;
20
20
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
- onLogout?: (() => any) | undefined;
22
21
  "onOpen-settings"?: (() => any) | undefined;
23
22
  "onOpen-account"?: (() => any) | undefined;
23
+ onLogout?: (() => any) | undefined;
24
24
  }>, {
25
25
  color: string;
26
26
  collapsed: boolean;
@@ -2,12 +2,20 @@ import { ref } from "vue";
2
2
  import * as Y from "yjs";
3
3
  import { useToast, useAbracadabra, useOfflineUploadQueue, useDocSlugs, navigateTo } from "#imports";
4
4
  import { populateYDocFromMarkdown, filenameToLabel, parseFrontmatter } from "../utils/markdownToYjs.js";
5
+ import { extractFileMetadata } from "../utils/extractFileMetadata.js";
5
6
  const TEXT_EXTENSIONS = ["md", "mdx", "txt", "html", "htm"];
6
7
  export function useDocImport() {
7
8
  const toast = useToast();
8
- const { provider, client, isReady } = useAbracadabra();
9
+ const { provider, client, isReady, spaceDocId } = useAbracadabra();
9
10
  const { enqueue } = useOfflineUploadQueue();
10
11
  const { getDocUrl } = useDocSlugs();
12
+ function registerImportedDoc(id, parentId, label) {
13
+ const c = client.value;
14
+ const parent = parentId ?? spaceDocId.value;
15
+ if (import.meta.server || !c?.createChild || !parent) return;
16
+ c.createChild(parent, { child_id: id, label, doc_type: "doc" }).catch(() => {
17
+ });
18
+ }
11
19
  const externalDragActive = ref(false);
12
20
  let externalDragCounter = 0;
13
21
  function getTreeMap() {
@@ -154,6 +162,7 @@ export function useDocImport() {
154
162
  type: docType,
155
163
  ...Object.keys(meta).length ? { meta } : {}
156
164
  });
165
+ registerImportedDoc(id, parentId, label);
157
166
  const childProv = await provider.value.loadChild(id);
158
167
  const fragment = childProv.document.getXmlFragment("default");
159
168
  if (ext === "html" || ext === "htm") {
@@ -169,6 +178,7 @@ export function useDocImport() {
169
178
  const label = filenameToLabel(file.name);
170
179
  const mimeType = file.type || "application/octet-stream";
171
180
  getTreeMap()?.set(id, { label, parentId, order: Date.now(), type: "doc" });
181
+ registerImportedDoc(id, parentId, label);
172
182
  let uploadId;
173
183
  let uploadDocId;
174
184
  try {
@@ -195,8 +205,42 @@ export function useDocImport() {
195
205
  el.setAttribute("docId", uploadDocId);
196
206
  el.setAttribute("filename", file.name);
197
207
  el.setAttribute("mimeType", mimeType);
208
+ el.setAttribute("fileSize", String(file.size));
198
209
  fragment.insert(0, [el]);
199
210
  });
211
+ const treeMap = getTreeMap();
212
+ if (mimeType.startsWith("image/")) {
213
+ const entry = treeMap?.get(id);
214
+ if (entry) {
215
+ treeMap.set(id, {
216
+ ...entry,
217
+ meta: {
218
+ ...entry.meta ?? {},
219
+ coverUploadId: uploadId,
220
+ coverDocId: uploadDocId,
221
+ coverMimeType: mimeType
222
+ },
223
+ updatedAt: Date.now()
224
+ });
225
+ }
226
+ }
227
+ try {
228
+ const fileMeta = await extractFileMetadata(file);
229
+ if (fileMeta && Object.keys(fileMeta).length) {
230
+ const entry = treeMap?.get(id);
231
+ if (entry) {
232
+ const title = fileMeta._extractedTitle;
233
+ delete fileMeta._extractedTitle;
234
+ treeMap.set(id, {
235
+ ...entry,
236
+ ...title ? { label: title } : {},
237
+ meta: { ...entry.meta ?? {}, ...fileMeta },
238
+ updatedAt: Date.now()
239
+ });
240
+ }
241
+ }
242
+ } catch {
243
+ }
200
244
  return id;
201
245
  }
202
246
  function readDirEntries(dir) {
@@ -20,6 +20,15 @@ const OPTIONAL_BUILTIN_EXTENSIONS = /* @__PURE__ */ new Set([
20
20
  "timeline",
21
21
  "timelineItem"
22
22
  ]);
23
+ function tolerant(load, name) {
24
+ return load().catch((e) => {
25
+ console.warn(
26
+ `[abracadabra:core] extension chunk "${name}" failed to load \u2014 continuing without it. If this is ERR_BLOCKED_BY_CLIENT, an ad blocker matched the chunk URL. Underlying error:`,
27
+ e
28
+ );
29
+ return {};
30
+ });
31
+ }
23
32
  async function loadClientExtensions() {
24
33
  const [
25
34
  { default: TaskList },
@@ -93,46 +102,48 @@ async function loadClientExtensions() {
93
102
  import("@tiptap/extension-subscript"),
94
103
  import("@tiptap/extension-code-block-lowlight"),
95
104
  import("lowlight"),
96
- import("../extensions/document.js"),
97
- import("../extensions/document-header.js"),
98
- import("../extensions/document-meta.js"),
99
- import("../extensions/file-drop.js"),
100
- import("../extensions/search-highlight.js"),
101
- import("../extensions/callout.js"),
102
- import("../extensions/collapsible.js"),
103
- import("../extensions/accordion.js"),
104
- import("../extensions/tabs.js"),
105
- import("../extensions/card.js"),
106
- import("../extensions/steps.js"),
107
- import("../extensions/code-collapse.js"),
108
- import("../extensions/code-group.js"),
109
- import("../extensions/badge.js"),
110
- import("../extensions/kbd.js"),
111
- import("../extensions/prose-icon.js"),
112
- import("../extensions/file-block.js"),
113
- import("../extensions/meta-field.js"),
114
- import("../extensions/doc-embed.js"),
115
- import("../extensions/doc-link.js"),
116
- import("../extensions/doc-link-drop.js"),
117
- import("../extensions/mention-drop.js"),
118
- import("../extensions/selection-drag.js"),
119
- import("../extensions/field.js"),
120
- import("../extensions/code-preview.js"),
121
- import("../extensions/code-tree.js"),
122
- import("../extensions/divider.js"),
123
- import("../extensions/quote.js"),
124
- import("../extensions/figure.js"),
125
- import("../extensions/embed.js"),
126
- import("../extensions/video.js"),
127
- import("../extensions/stat.js"),
128
- import("../extensions/button.js"),
129
- import("../extensions/progress.js"),
130
- import("../extensions/spoiler.js"),
131
- import("../extensions/color-swatch.js"),
132
- import("../extensions/math.js"),
133
- import("../extensions/diff.js"),
134
- import("../extensions/svg-embed.js"),
135
- import("../extensions/timeline.js")
105
+ tolerant(() => import("../extensions/document"), "document"),
106
+ tolerant(() => import("../extensions/document-header"), "document-header"),
107
+ tolerant(() => import("../extensions/document-meta"), "document-meta"),
108
+ tolerant(() => import("../extensions/file-drop"), "file-drop"),
109
+ tolerant(() => import("../extensions/search-highlight"), "search-highlight"),
110
+ tolerant(() => import("../extensions/callout"), "callout"),
111
+ tolerant(() => import("../extensions/collapsible"), "collapsible"),
112
+ tolerant(() => import("../extensions/accordion"), "accordion"),
113
+ tolerant(() => import("../extensions/tabs"), "tabs"),
114
+ tolerant(() => import("../extensions/card"), "card"),
115
+ tolerant(() => import("../extensions/steps"), "steps"),
116
+ tolerant(() => import("../extensions/code-collapse"), "code-collapse"),
117
+ tolerant(() => import("../extensions/code-group"), "code-group"),
118
+ tolerant(() => import("../extensions/badge"), "badge"),
119
+ tolerant(() => import("../extensions/kbd"), "kbd"),
120
+ tolerant(() => import("../extensions/prose-icon"), "prose-icon"),
121
+ tolerant(() => import("../extensions/file-block"), "file-block"),
122
+ tolerant(() => import("../extensions/meta-field"), "meta-field"),
123
+ tolerant(() => import("../extensions/doc-embed"), "doc-embed"),
124
+ tolerant(() => import("../extensions/doc-link"), "doc-link"),
125
+ tolerant(() => import("../extensions/doc-link-drop"), "doc-link-drop"),
126
+ tolerant(() => import("../extensions/mention-drop"), "mention-drop"),
127
+ tolerant(() => import("../extensions/selection-drag"), "selection-drag"),
128
+ tolerant(() => import("../extensions/field"), "field"),
129
+ tolerant(() => import("../extensions/code-preview"), "code-preview"),
130
+ tolerant(() => import("../extensions/code-tree"), "code-tree"),
131
+ tolerant(() => import("../extensions/divider"), "divider"),
132
+ tolerant(() => import("../extensions/quote"), "quote"),
133
+ tolerant(() => import("../extensions/figure"), "figure"),
134
+ tolerant(() => import("../extensions/embed"), "embed"),
135
+ tolerant(() => import("../extensions/video"), "video"),
136
+ // NOTE: file is stat-block.ts, NOT stat.ts — EasyPrivacy's generic
137
+ // "/stat.js" filter blocked the old chunk name for ad-block users.
138
+ tolerant(() => import("../extensions/stat-block"), "stat-block"),
139
+ tolerant(() => import("../extensions/button"), "button"),
140
+ tolerant(() => import("../extensions/progress"), "progress"),
141
+ tolerant(() => import("../extensions/spoiler"), "spoiler"),
142
+ tolerant(() => import("../extensions/color-swatch"), "color-swatch"),
143
+ tolerant(() => import("../extensions/math"), "math"),
144
+ tolerant(() => import("../extensions/diff"), "diff"),
145
+ tolerant(() => import("../extensions/svg-embed"), "svg-embed"),
146
+ tolerant(() => import("../extensions/timeline"), "timeline")
136
147
  ]);
137
148
  const lowlight = createLowlight(common);
138
149
  const extensions = [
@@ -219,7 +230,7 @@ async function loadClientExtensions() {
219
230
  if (Emoji) extensions.push(Emoji);
220
231
  } catch {
221
232
  }
222
- return extensions;
233
+ return extensions.filter(Boolean);
223
234
  }
224
235
  async function loadServerExtensions() {
225
236
  const [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/nuxt",
3
- "version": "2.65.0",
3
+ "version": "2.66.0",
4
4
  "description": "First-class Nuxt module for the Abracadabra CRDT collaboration platform",
5
5
  "repository": "abracadabra/abracadabra-nuxt",
6
6
  "license": "MIT",