@abraca/nuxt 2.59.0 → 2.60.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.59.0",
7
+ "version": "2.60.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
- total: boolean;
16
15
  controls: boolean;
16
+ total: 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
- total: boolean;
16
15
  controls: boolean;
16
+ total: boolean;
17
17
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
18
  declare const _default: typeof __VLS_export;
19
19
  export default _default;
@@ -2,11 +2,12 @@ import { computed, unref } from "vue";
2
2
  import { useAbracadabra, useSyncedMap, useFetch, useHead, useSeoMeta } from "#imports";
3
3
  function extractFirstParagraph(html) {
4
4
  if (!html) return void 0;
5
- const pMatch = html.match(/<p[^>]*>(.*?)<\/p>/is);
6
- const raw = pMatch?.[1] ?? html;
7
- const text = raw.replace(/<[^>]+>/g, "").replace(/&[a-z]+;/gi, " ").trim();
8
- if (!text) return void 0;
9
- return text.length > 160 ? text.slice(0, 157) + "..." : text;
5
+ const strip = (raw) => raw.replace(/<[^>]+>/g, "").replace(/&[a-z]+;/gi, " ").trim();
6
+ for (const m of html.matchAll(/<p[^>]*>(.*?)<\/p>/gis)) {
7
+ const text = strip(m[1] ?? "");
8
+ if (text) return text.length > 160 ? text.slice(0, 157) + "..." : text;
9
+ }
10
+ return void 0;
10
11
  }
11
12
  function extractFirstImage(html) {
12
13
  if (!html) return void 0;
@@ -52,14 +52,11 @@ export async function renderDocToHTML(ydoc) {
52
52
  }
53
53
  async function renderDocToJSON(ydoc) {
54
54
  try {
55
- const Y = await import("yjs");
56
55
  const result = {};
57
56
  ydoc.share.forEach((type, key) => {
58
- if (type instanceof Y.Map) {
59
- result[key] = type.toJSON();
60
- } else if (type instanceof Y.Array) {
61
- result[key] = type.toJSON();
62
- }
57
+ if (typeof type?.toJSON !== "function") return;
58
+ const json = type.toJSON();
59
+ if (json !== null && typeof json === "object") result[key] = json;
63
60
  });
64
61
  return result;
65
62
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/nuxt",
3
- "version": "2.59.0",
3
+ "version": "2.60.0",
4
4
  "description": "First-class Nuxt module for the Abracadabra CRDT collaboration platform",
5
5
  "repository": "abracadabra/abracadabra-nuxt",
6
6
  "license": "MIT",