@abraca/nuxt 2.0.11 → 2.3.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.d.mts +68 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +99 -4
- package/dist/runtime/components/ACodeEditor.d.vue.ts +26 -0
- package/dist/runtime/components/ACodeEditor.vue +268 -0
- package/dist/runtime/components/ACodeEditor.vue.d.ts +26 -0
- package/dist/runtime/components/ADocumentTree.vue +52 -20
- package/dist/runtime/components/AEditor.d.vue.ts +20 -13
- package/dist/runtime/components/AEditor.vue +55 -2
- package/dist/runtime/components/AEditor.vue.d.ts +20 -13
- package/dist/runtime/components/ANodePanel.vue +64 -60
- package/dist/runtime/components/ANotificationBell.d.vue.ts +1 -1
- package/dist/runtime/components/ANotificationBell.vue.d.ts +1 -1
- package/dist/runtime/components/ASpaceFormModal.d.vue.ts +2 -2
- package/dist/runtime/components/ASpaceFormModal.vue.d.ts +2 -2
- package/dist/runtime/components/aware/AMedia.d.vue.ts +1 -1
- package/dist/runtime/components/aware/AMedia.vue.d.ts +1 -1
- package/dist/runtime/components/aware/APresenceBlobs.d.vue.ts +29 -1
- package/dist/runtime/components/aware/APresenceBlobs.vue +54 -8
- package/dist/runtime/components/aware/APresenceBlobs.vue.d.ts +29 -1
- package/dist/runtime/components/aware/APresenceCursors.d.vue.ts +11 -0
- package/dist/runtime/components/aware/APresenceCursors.vue +74 -9
- package/dist/runtime/components/aware/APresenceCursors.vue.d.ts +11 -0
- package/dist/runtime/components/aware/AToggleGroup.d.vue.ts +28 -13
- package/dist/runtime/components/aware/AToggleGroup.vue +56 -20
- package/dist/runtime/components/aware/AToggleGroup.vue.d.ts +28 -13
- package/dist/runtime/components/docs/ADocsNavigation.d.vue.ts +1 -1
- package/dist/runtime/components/docs/ADocsNavigation.vue.d.ts +1 -1
- package/dist/runtime/components/docs/ADocsSearch.d.vue.ts +1 -1
- package/dist/runtime/components/docs/ADocsSearch.vue.d.ts +1 -1
- package/dist/runtime/components/docs/ADocsSearchButton.d.vue.ts +1 -1
- package/dist/runtime/components/docs/ADocsSearchButton.vue.d.ts +1 -1
- package/dist/runtime/components/docs/ADocsToc.d.vue.ts +2 -2
- package/dist/runtime/components/docs/ADocsToc.vue.d.ts +2 -2
- package/dist/runtime/components/editor/AEditorRedoButton.d.vue.ts +1 -1
- package/dist/runtime/components/editor/AEditorRedoButton.vue.d.ts +1 -1
- package/dist/runtime/components/editor/AEditorUndoButton.d.vue.ts +1 -1
- package/dist/runtime/components/editor/AEditorUndoButton.vue.d.ts +1 -1
- package/dist/runtime/components/editor/ANodeInlineLabel.d.vue.ts +1 -1
- package/dist/runtime/components/editor/ANodeInlineLabel.vue.d.ts +1 -1
- package/dist/runtime/components/registry/APluginBrowser.d.vue.ts +23 -0
- package/dist/runtime/components/registry/APluginBrowser.vue +155 -0
- package/dist/runtime/components/registry/APluginBrowser.vue.d.ts +23 -0
- package/dist/runtime/components/registry/APluginCapabilityDialog.d.vue.ts +17 -0
- package/dist/runtime/components/registry/APluginCapabilityDialog.vue +159 -0
- package/dist/runtime/components/registry/APluginCapabilityDialog.vue.d.ts +17 -0
- package/dist/runtime/components/registry/APluginCard.d.vue.ts +20 -0
- package/dist/runtime/components/registry/APluginCard.vue +91 -0
- package/dist/runtime/components/registry/APluginCard.vue.d.ts +20 -0
- package/dist/runtime/components/registry/APluginDetail.d.vue.ts +18 -0
- package/dist/runtime/components/registry/APluginDetail.vue +252 -0
- package/dist/runtime/components/registry/APluginDetail.vue.d.ts +18 -0
- package/dist/runtime/components/renderers/ACodeRenderer.d.vue.ts +15 -0
- package/dist/runtime/components/renderers/ACodeRenderer.vue +68 -0
- package/dist/runtime/components/renderers/ACodeRenderer.vue.d.ts +15 -0
- package/dist/runtime/components/renderers/AGraphRenderer.vue +416 -120
- package/dist/runtime/components/renderers/AProseRenderer.d.vue.ts +2 -2
- package/dist/runtime/components/renderers/AProseRenderer.vue.d.ts +2 -2
- package/dist/runtime/components/shell/ABreadcrumbForDoc.d.vue.ts +11 -0
- package/dist/runtime/components/shell/ABreadcrumbForDoc.vue +16 -0
- package/dist/runtime/components/shell/ABreadcrumbForDoc.vue.d.ts +11 -0
- package/dist/runtime/components/shell/ASettingsSection.d.vue.ts +35 -0
- package/dist/runtime/components/shell/ASettingsSection.vue +26 -0
- package/dist/runtime/components/shell/ASettingsSection.vue.d.ts +35 -0
- package/dist/runtime/components/shell/ASidebar.d.vue.ts +1 -1
- package/dist/runtime/components/shell/ASidebar.vue.d.ts +1 -1
- package/dist/runtime/components/shell/AUserMenu.d.vue.ts +5 -2
- package/dist/runtime/components/shell/AUserMenu.vue +4 -0
- package/dist/runtime/components/shell/AUserMenu.vue.d.ts +5 -2
- package/dist/runtime/composables/useAbracadabraSchema.d.ts +83 -0
- package/dist/runtime/composables/useAbracadabraSchema.js +52 -0
- package/dist/runtime/composables/useAggregatedPresence.d.ts +1 -6
- package/dist/runtime/composables/useCalendarView.d.ts +1 -1
- package/dist/runtime/composables/useChat.js +1 -0
- package/dist/runtime/composables/useDocBreadcrumb.d.ts +21 -0
- package/dist/runtime/composables/useDocBreadcrumb.js +33 -0
- package/dist/runtime/composables/useDocEntryTyped.d.ts +60 -0
- package/dist/runtime/composables/useDocEntryTyped.js +70 -0
- package/dist/runtime/composables/useEditorDragHandle.js +18 -0
- package/dist/runtime/composables/useEditorSuggestions.js +2 -1
- package/dist/runtime/composables/useInstalledPlugins.d.ts +3 -21
- package/dist/runtime/composables/useInstalledPlugins.js +2 -12
- package/dist/runtime/composables/useMetaMenuItems.d.ts +21 -0
- package/dist/runtime/composables/useMetaMenuItems.js +115 -0
- package/dist/runtime/composables/useMetaValidator.d.ts +27 -0
- package/dist/runtime/composables/useMetaValidator.js +10 -0
- package/dist/runtime/composables/usePluginCatalog.d.ts +161 -0
- package/dist/runtime/composables/usePluginCatalog.js +234 -0
- package/dist/runtime/composables/useQuery.d.ts +79 -0
- package/dist/runtime/composables/useQuery.js +97 -0
- package/dist/runtime/composables/useSpaces.js +4 -5
- package/dist/runtime/composables/useTableView.d.ts +3 -3
- package/dist/runtime/composables/useTypedDoc.d.ts +97 -0
- package/dist/runtime/composables/useTypedDoc.js +114 -0
- package/dist/runtime/composables/useWebRTC.js +44 -5
- package/dist/runtime/extensions/document-meta.js +5 -0
- package/dist/runtime/extensions/timeline.d.ts +11 -0
- package/dist/runtime/extensions/timeline.js +52 -0
- package/dist/runtime/extensions/views/DocumentMetaView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/DocumentMetaView.vue +63 -0
- package/dist/runtime/extensions/views/DocumentMetaView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/TimelineItemView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/TimelineItemView.vue +131 -0
- package/dist/runtime/extensions/views/TimelineItemView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/TimelineView.d.vue.ts +9 -0
- package/dist/runtime/extensions/views/TimelineView.vue +29 -0
- package/dist/runtime/extensions/views/TimelineView.vue.d.ts +9 -0
- package/dist/runtime/locale.d.ts +2 -0
- package/dist/runtime/locale.js +2 -0
- package/dist/runtime/plugin-abracadabra.client.js +107 -6
- package/dist/runtime/plugin-registry.d.ts +11 -30
- package/dist/runtime/plugin-registry.js +2 -82
- package/dist/runtime/plugins/core.plugin.js +10 -4
- package/dist/runtime/server/api/_abracadabra/spaces.get.d.ts +1 -1
- package/dist/runtime/server/plugins/abracadabra-service.js +28 -0
- package/dist/runtime/server/utils/docCache.js +24 -3
- package/dist/runtime/server/utils/schemaServerSupport.d.ts +52 -0
- package/dist/runtime/server/utils/schemaServerSupport.js +51 -0
- package/dist/runtime/types.d.ts +63 -46
- package/dist/runtime/utils/docTypes.d.ts +15 -0
- package/dist/runtime/utils/docTypes.js +20 -0
- package/dist/runtime/utils/loadCodeMirror.d.ts +32 -0
- package/dist/runtime/utils/loadCodeMirror.js +65 -0
- package/dist/runtime/utils/markdownToYjs.d.ts +1 -23
- package/dist/runtime/utils/markdownToYjs.js +5 -440
- package/dist/runtime/utils/schemaSupport.d.ts +60 -0
- package/dist/runtime/utils/schemaSupport.js +40 -0
- package/dist/runtime/utils/yjsConvert.d.ts +1 -14
- package/dist/runtime/utils/yjsConvert.js +5 -331
- package/package.json +84 -23
|
@@ -1,331 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
let text = op.insert;
|
|
7
|
-
const attrs = op.attributes ?? {};
|
|
8
|
-
if (attrs.code) {
|
|
9
|
-
result += `\`${text}\``;
|
|
10
|
-
continue;
|
|
11
|
-
}
|
|
12
|
-
if (attrs.bold) text = `**${text}**`;
|
|
13
|
-
if (attrs.italic) text = `*${text}*`;
|
|
14
|
-
if (attrs.strike) text = `~~${text}~~`;
|
|
15
|
-
if (attrs.link) {
|
|
16
|
-
const href = attrs.link.href ?? "";
|
|
17
|
-
text = `[${text}](${href})`;
|
|
18
|
-
}
|
|
19
|
-
result += text;
|
|
20
|
-
}
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
function serializeInline(el) {
|
|
24
|
-
const parts = [];
|
|
25
|
-
for (const child of el.toArray()) {
|
|
26
|
-
if (child instanceof Y.XmlText) {
|
|
27
|
-
parts.push(serializeDelta(child.toDelta()));
|
|
28
|
-
} else if (child instanceof Y.XmlElement) {
|
|
29
|
-
parts.push(serializeInline(child));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return parts.join("");
|
|
33
|
-
}
|
|
34
|
-
function serializeBlock(el, indent = "") {
|
|
35
|
-
if (el instanceof Y.XmlText) {
|
|
36
|
-
return serializeDelta(el.toDelta());
|
|
37
|
-
}
|
|
38
|
-
const name = el.nodeName;
|
|
39
|
-
switch (name) {
|
|
40
|
-
case "documentHeader":
|
|
41
|
-
case "documentMeta":
|
|
42
|
-
return "";
|
|
43
|
-
case "heading": {
|
|
44
|
-
const level = Number(el.getAttribute("level") ?? 2);
|
|
45
|
-
const hashes = "#".repeat(level);
|
|
46
|
-
return `${hashes} ${serializeInline(el)}`;
|
|
47
|
-
}
|
|
48
|
-
case "paragraph":
|
|
49
|
-
return serializeInline(el);
|
|
50
|
-
case "bulletList":
|
|
51
|
-
return serializeListItems(el, "bullet", indent);
|
|
52
|
-
case "orderedList":
|
|
53
|
-
return serializeListItems(el, "ordered", indent);
|
|
54
|
-
case "taskList":
|
|
55
|
-
return serializeTaskList(el, indent);
|
|
56
|
-
case "codeBlock": {
|
|
57
|
-
const lang = el.getAttribute("language") ?? "";
|
|
58
|
-
const code = getCodeBlockText(el);
|
|
59
|
-
return `\`\`\`${lang}
|
|
60
|
-
${code}
|
|
61
|
-
\`\`\``;
|
|
62
|
-
}
|
|
63
|
-
case "blockquote": {
|
|
64
|
-
const lines = [];
|
|
65
|
-
for (const child of el.toArray()) {
|
|
66
|
-
if (child instanceof Y.XmlElement) {
|
|
67
|
-
const text = serializeBlock(child);
|
|
68
|
-
for (const line of text.split("\n")) {
|
|
69
|
-
lines.push(`> ${line}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return lines.join("\n");
|
|
74
|
-
}
|
|
75
|
-
case "table":
|
|
76
|
-
return serializeTable(el);
|
|
77
|
-
case "horizontalRule":
|
|
78
|
-
return "---";
|
|
79
|
-
case "image": {
|
|
80
|
-
const src = el.getAttribute("src") ?? "";
|
|
81
|
-
const alt = el.getAttribute("alt") ?? "";
|
|
82
|
-
return ``;
|
|
83
|
-
}
|
|
84
|
-
case "fileBlock": {
|
|
85
|
-
const uploadId = el.getAttribute("uploadId") ?? "";
|
|
86
|
-
const filename = el.getAttribute("filename") ?? "file";
|
|
87
|
-
if (uploadId) return `<!--fileblock:${uploadId}:${filename}-->`;
|
|
88
|
-
return `<!-- file: ${filename} -->`;
|
|
89
|
-
}
|
|
90
|
-
default:
|
|
91
|
-
return serializeChildren(el);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function serializeChildren(el) {
|
|
95
|
-
const blocks = [];
|
|
96
|
-
for (const child of el.toArray()) {
|
|
97
|
-
if (child instanceof Y.XmlElement) {
|
|
98
|
-
const text = serializeBlock(child);
|
|
99
|
-
if (text) blocks.push(text);
|
|
100
|
-
} else if (child instanceof Y.XmlText) {
|
|
101
|
-
const text = serializeDelta(child.toDelta());
|
|
102
|
-
if (text) blocks.push(text);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return blocks.join("\n\n");
|
|
106
|
-
}
|
|
107
|
-
function serializeListItems(el, type, indent) {
|
|
108
|
-
const lines = [];
|
|
109
|
-
let counter = 1;
|
|
110
|
-
for (const child of el.toArray()) {
|
|
111
|
-
if (!(child instanceof Y.XmlElement) || child.nodeName !== "listItem") continue;
|
|
112
|
-
const prefix = type === "bullet" ? "- " : `${counter++}. `;
|
|
113
|
-
const subParts = [];
|
|
114
|
-
for (const sub of child.toArray()) {
|
|
115
|
-
if (!(sub instanceof Y.XmlElement)) continue;
|
|
116
|
-
if (sub.nodeName === "bulletList") {
|
|
117
|
-
subParts.push(serializeListItems(sub, "bullet", indent + " "));
|
|
118
|
-
} else if (sub.nodeName === "orderedList") {
|
|
119
|
-
subParts.push(serializeListItems(sub, "ordered", indent + " "));
|
|
120
|
-
} else {
|
|
121
|
-
subParts.push(serializeInline(sub));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (subParts.length <= 1) {
|
|
125
|
-
lines.push(`${indent}${prefix}${subParts[0] ?? ""}`);
|
|
126
|
-
} else {
|
|
127
|
-
lines.push(`${indent}${prefix}${subParts[0] ?? ""}`);
|
|
128
|
-
for (let i = 1; i < subParts.length; i++) {
|
|
129
|
-
lines.push(subParts[i]);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return lines.join("\n");
|
|
134
|
-
}
|
|
135
|
-
function serializeTaskList(el, indent) {
|
|
136
|
-
const lines = [];
|
|
137
|
-
for (const child of el.toArray()) {
|
|
138
|
-
if (!(child instanceof Y.XmlElement) || child.nodeName !== "taskItem") continue;
|
|
139
|
-
const checked = child.getAttribute("checked");
|
|
140
|
-
const marker = checked === true || checked === "true" ? "[x]" : "[ ]";
|
|
141
|
-
const text = child.toArray().filter((c) => c instanceof Y.XmlElement).map((c) => serializeInline(c)).join("");
|
|
142
|
-
lines.push(`${indent}- ${marker} ${text}`);
|
|
143
|
-
}
|
|
144
|
-
return lines.join("\n");
|
|
145
|
-
}
|
|
146
|
-
function getCodeBlockText(el) {
|
|
147
|
-
for (const child of el.toArray()) {
|
|
148
|
-
if (child instanceof Y.XmlText) {
|
|
149
|
-
return child.toString();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return "";
|
|
153
|
-
}
|
|
154
|
-
function serializeTable(el) {
|
|
155
|
-
const rows = el.toArray().filter((c) => c instanceof Y.XmlElement);
|
|
156
|
-
if (!rows.length) return "";
|
|
157
|
-
const serializedRows = [];
|
|
158
|
-
for (const row of rows) {
|
|
159
|
-
const cells = row.toArray().filter((c) => c instanceof Y.XmlElement).map((cell) => {
|
|
160
|
-
return cell.toArray().filter((c) => c instanceof Y.XmlElement).map((c) => serializeInline(c)).join(" ");
|
|
161
|
-
});
|
|
162
|
-
serializedRows.push(cells);
|
|
163
|
-
}
|
|
164
|
-
if (!serializedRows.length) return "";
|
|
165
|
-
const colCount = Math.max(...serializedRows.map((r) => r.length));
|
|
166
|
-
const headerRow = serializedRows[0];
|
|
167
|
-
const separator = Array(colCount).fill("---");
|
|
168
|
-
const dataRows = serializedRows.slice(1);
|
|
169
|
-
const formatRow = (cells) => {
|
|
170
|
-
const padded = Array(colCount).fill("").map((_, i) => cells[i] ?? "");
|
|
171
|
-
return `| ${padded.join(" | ")} |`;
|
|
172
|
-
};
|
|
173
|
-
const lines = [formatRow(headerRow), formatRow(separator), ...dataRows.map(formatRow)];
|
|
174
|
-
return lines.join("\n");
|
|
175
|
-
}
|
|
176
|
-
function generateFrontmatter(label, meta, type) {
|
|
177
|
-
const lines = [];
|
|
178
|
-
lines.push(`title: "${escapeYaml(label)}"`);
|
|
179
|
-
if (type && type !== "doc") lines.push(`type: ${type}`);
|
|
180
|
-
if (!meta) return `---
|
|
181
|
-
${lines.join("\n")}
|
|
182
|
-
---`;
|
|
183
|
-
if (meta.tags?.length) lines.push(`tags: [${meta.tags.join(", ")}]`);
|
|
184
|
-
if (meta.color) lines.push(`color: ${meta.color}`);
|
|
185
|
-
if (meta.icon) lines.push(`icon: ${meta.icon}`);
|
|
186
|
-
if (meta.status) lines.push(`status: ${meta.status}`);
|
|
187
|
-
if (meta.priority !== void 0 && meta.priority !== 0) {
|
|
188
|
-
const map = { 1: "low", 2: "medium", 3: "high", 4: "urgent" };
|
|
189
|
-
lines.push(`priority: ${map[meta.priority] ?? meta.priority}`);
|
|
190
|
-
}
|
|
191
|
-
if (meta.checked !== void 0) lines.push(`checked: ${meta.checked}`);
|
|
192
|
-
if (meta.dateStart) lines.push(`date: ${meta.dateStart}`);
|
|
193
|
-
if (meta.dateEnd) lines.push(`due: ${meta.dateEnd}`);
|
|
194
|
-
if (meta.subtitle) lines.push(`description: "${escapeYaml(meta.subtitle)}"`);
|
|
195
|
-
if (meta.url) lines.push(`url: ${meta.url}`);
|
|
196
|
-
if (meta.rating !== void 0 && meta.rating !== 0) lines.push(`rating: ${meta.rating}`);
|
|
197
|
-
return `---
|
|
198
|
-
${lines.join("\n")}
|
|
199
|
-
---`;
|
|
200
|
-
}
|
|
201
|
-
function escapeYaml(s) {
|
|
202
|
-
return s.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
203
|
-
}
|
|
204
|
-
function escapeHtml(s) {
|
|
205
|
-
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
206
|
-
}
|
|
207
|
-
function serializeDeltaToHtml(delta) {
|
|
208
|
-
let result = "";
|
|
209
|
-
for (const op of delta) {
|
|
210
|
-
if (typeof op.insert !== "string") continue;
|
|
211
|
-
let text = escapeHtml(op.insert);
|
|
212
|
-
const attrs = op.attributes ?? {};
|
|
213
|
-
if (attrs.code) text = `<code>${text}</code>`;
|
|
214
|
-
if (attrs.bold) text = `<strong>${text}</strong>`;
|
|
215
|
-
if (attrs.italic) text = `<em>${text}</em>`;
|
|
216
|
-
if (attrs.strike) text = `<s>${text}</s>`;
|
|
217
|
-
if (attrs.link) {
|
|
218
|
-
const href = escapeHtml(attrs.link.href ?? "");
|
|
219
|
-
text = `<a href="${href}">${text}</a>`;
|
|
220
|
-
}
|
|
221
|
-
result += text;
|
|
222
|
-
}
|
|
223
|
-
return result;
|
|
224
|
-
}
|
|
225
|
-
function serializeInlineHtml(el) {
|
|
226
|
-
const parts = [];
|
|
227
|
-
for (const child of el.toArray()) {
|
|
228
|
-
if (child instanceof Y.XmlText) {
|
|
229
|
-
parts.push(serializeDeltaToHtml(child.toDelta()));
|
|
230
|
-
} else if (child instanceof Y.XmlElement) {
|
|
231
|
-
parts.push(serializeInlineHtml(child));
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return parts.join("");
|
|
235
|
-
}
|
|
236
|
-
function serializeBlockToHtml(el) {
|
|
237
|
-
if (el instanceof Y.XmlText) {
|
|
238
|
-
return serializeDeltaToHtml(el.toDelta());
|
|
239
|
-
}
|
|
240
|
-
const name = el.nodeName;
|
|
241
|
-
switch (name) {
|
|
242
|
-
case "documentHeader":
|
|
243
|
-
case "documentMeta":
|
|
244
|
-
return "";
|
|
245
|
-
case "heading": {
|
|
246
|
-
const level = Number(el.getAttribute("level") ?? 2);
|
|
247
|
-
return `<h${level}>${serializeInlineHtml(el)}</h${level}>`;
|
|
248
|
-
}
|
|
249
|
-
case "paragraph":
|
|
250
|
-
return `<p>${serializeInlineHtml(el)}</p>`;
|
|
251
|
-
case "bulletList":
|
|
252
|
-
return `<ul>${el.toArray().filter((c) => c instanceof Y.XmlElement && c.nodeName === "listItem").map((li) => `<li>${li.toArray().filter((c) => c instanceof Y.XmlElement).map((c) => serializeBlockToHtml(c)).join("")}</li>`).join("\n")}</ul>`;
|
|
253
|
-
case "orderedList":
|
|
254
|
-
return `<ol>${el.toArray().filter((c) => c instanceof Y.XmlElement && c.nodeName === "listItem").map((li) => `<li>${li.toArray().filter((c) => c instanceof Y.XmlElement).map((c) => serializeBlockToHtml(c)).join("")}</li>`).join("\n")}</ol>`;
|
|
255
|
-
case "codeBlock": {
|
|
256
|
-
const lang = el.getAttribute("language") ?? "";
|
|
257
|
-
const code = escapeHtml(getCodeBlockText(el));
|
|
258
|
-
return lang ? `<pre><code class="language-${lang}">${code}</code></pre>` : `<pre><code>${code}</code></pre>`;
|
|
259
|
-
}
|
|
260
|
-
case "blockquote": {
|
|
261
|
-
const inner = el.toArray().filter((c) => c instanceof Y.XmlElement).map((c) => serializeBlockToHtml(c)).join("\n");
|
|
262
|
-
return `<blockquote>
|
|
263
|
-
${inner}
|
|
264
|
-
</blockquote>`;
|
|
265
|
-
}
|
|
266
|
-
case "table": {
|
|
267
|
-
const rows = el.toArray().filter((c) => c instanceof Y.XmlElement);
|
|
268
|
-
if (!rows.length) return "";
|
|
269
|
-
const htmlRows = rows.map((row, ri) => {
|
|
270
|
-
const tag = ri === 0 ? "th" : "td";
|
|
271
|
-
const cells = row.toArray().filter((c) => c instanceof Y.XmlElement).map((cell) => {
|
|
272
|
-
const inner = cell.toArray().filter((c) => c instanceof Y.XmlElement).map((c) => serializeInlineHtml(c)).join("");
|
|
273
|
-
return `<${tag}>${inner}</${tag}>`;
|
|
274
|
-
}).join("");
|
|
275
|
-
return `<tr>${cells}</tr>`;
|
|
276
|
-
});
|
|
277
|
-
return `<table>
|
|
278
|
-
${htmlRows.join("\n")}
|
|
279
|
-
</table>`;
|
|
280
|
-
}
|
|
281
|
-
case "horizontalRule":
|
|
282
|
-
return "<hr>";
|
|
283
|
-
case "image": {
|
|
284
|
-
const src = el.getAttribute("src") ?? "";
|
|
285
|
-
const alt = el.getAttribute("alt") ?? "";
|
|
286
|
-
return `<img src="${escapeHtml(src)}" alt="${escapeHtml(alt)}">`;
|
|
287
|
-
}
|
|
288
|
-
case "fileBlock": {
|
|
289
|
-
const uploadId = el.getAttribute("uploadId") ?? "";
|
|
290
|
-
const filename = el.getAttribute("filename") ?? "file";
|
|
291
|
-
if (uploadId) return `<!--fileblock:${uploadId}:${filename}-->`;
|
|
292
|
-
return `<!-- file: ${filename} -->`;
|
|
293
|
-
}
|
|
294
|
-
default: {
|
|
295
|
-
const inner = el.toArray().filter((c) => c instanceof Y.XmlElement || c instanceof Y.XmlText).map((c) => c instanceof Y.XmlElement ? serializeBlockToHtml(c) : serializeDeltaToHtml(c.toDelta())).join("\n");
|
|
296
|
-
return `<div data-type="${name}">
|
|
297
|
-
${inner}
|
|
298
|
-
</div>`;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
export function yjsToMarkdown(fragment, label, meta, type) {
|
|
303
|
-
const frontmatter = generateFrontmatter(label, meta, type);
|
|
304
|
-
const body = serializeChildren(fragment);
|
|
305
|
-
return `${frontmatter}
|
|
306
|
-
|
|
307
|
-
${body}
|
|
308
|
-
`;
|
|
309
|
-
}
|
|
310
|
-
export function yjsToHtml(fragment, label) {
|
|
311
|
-
const title = escapeHtml(label);
|
|
312
|
-
const bodyParts = [];
|
|
313
|
-
for (const child of fragment.toArray()) {
|
|
314
|
-
if (child instanceof Y.XmlElement) {
|
|
315
|
-
const html = serializeBlockToHtml(child);
|
|
316
|
-
if (html) bodyParts.push(html);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
return `<!DOCTYPE html>
|
|
320
|
-
<html>
|
|
321
|
-
<head><meta charset="utf-8"><title>${title}</title></head>
|
|
322
|
-
<body>
|
|
323
|
-
<h1>${title}</h1>
|
|
324
|
-
${bodyParts.join("\n")}
|
|
325
|
-
</body>
|
|
326
|
-
</html>
|
|
327
|
-
`;
|
|
328
|
-
}
|
|
329
|
-
export function yjsToPlainText(fragment) {
|
|
330
|
-
return serializeChildren(fragment);
|
|
331
|
-
}
|
|
1
|
+
export {
|
|
2
|
+
yjsToMarkdown,
|
|
3
|
+
yjsToHtml,
|
|
4
|
+
yjsToPlainText
|
|
5
|
+
} from "@abraca/convert";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abraca/nuxt",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "First-class Nuxt module for the Abracadabra CRDT collaboration platform",
|
|
5
5
|
"repository": "abracadabra/abracadabra-nuxt",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,22 +25,6 @@
|
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
|
-
"scripts": {
|
|
29
|
-
"prepack": "nuxt-module-build build",
|
|
30
|
-
"dev": "npm run dev:prepare && nuxt dev playground",
|
|
31
|
-
"dev:build": "nuxt build playground",
|
|
32
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
|
|
33
|
-
"release": "npm run lint && npm run prepack",
|
|
34
|
-
"lint": "eslint .",
|
|
35
|
-
"test": "vitest run",
|
|
36
|
-
"test:watch": "vitest watch",
|
|
37
|
-
"test:integration": "vitest run --config test/integration/vitest.config.ts --reporter=verbose",
|
|
38
|
-
"test:unit": "vitest run --config test/unit/vitest.config.ts",
|
|
39
|
-
"test:e2e": "playwright test",
|
|
40
|
-
"test:e2e:headed": "playwright test --headed",
|
|
41
|
-
"test:e2e:ui": "playwright test --ui",
|
|
42
|
-
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
43
|
-
},
|
|
44
28
|
"dependencies": {
|
|
45
29
|
"@nuxt/kit": "^4.4.4",
|
|
46
30
|
"@vueuse/core": "^14.3.0",
|
|
@@ -48,7 +32,17 @@
|
|
|
48
32
|
"nanoevents": "^9.1.0"
|
|
49
33
|
},
|
|
50
34
|
"peerDependencies": {
|
|
51
|
-
"@
|
|
35
|
+
"@codemirror/autocomplete": "^6.18.0",
|
|
36
|
+
"@codemirror/commands": "^6.7.0",
|
|
37
|
+
"@codemirror/lang-css": "^6.3.1",
|
|
38
|
+
"@codemirror/lang-javascript": "^6.2.5",
|
|
39
|
+
"@codemirror/lang-json": "^6.0.0",
|
|
40
|
+
"@codemirror/lang-vue": "^0.1.3",
|
|
41
|
+
"@codemirror/language": "^6.10.0",
|
|
42
|
+
"@codemirror/search": "^6.5.0",
|
|
43
|
+
"@codemirror/state": "^6.6.0",
|
|
44
|
+
"@codemirror/view": "^6.42.0",
|
|
45
|
+
"y-codemirror.next": "^0.3.5",
|
|
52
46
|
"@noble/ed25519": "^3.1.0",
|
|
53
47
|
"@noble/hashes": "^2.2.0",
|
|
54
48
|
"@nuxt/ui": "^3.0.0",
|
|
@@ -79,9 +73,49 @@
|
|
|
79
73
|
"mapbox-gl": "^3.0.0",
|
|
80
74
|
"nuxt": "^4.0.0",
|
|
81
75
|
"vue": "^3.4.0",
|
|
82
|
-
"yjs": "^13.0.0"
|
|
76
|
+
"yjs": "^13.0.0",
|
|
77
|
+
"@abraca/dabra": "2.3.0",
|
|
78
|
+
"@abraca/plugin": "2.3.0",
|
|
79
|
+
"@abraca/convert": "2.3.0",
|
|
80
|
+
"@abraca/schema": "2.3.0"
|
|
83
81
|
},
|
|
84
82
|
"peerDependenciesMeta": {
|
|
83
|
+
"@abraca/schema": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"@codemirror/autocomplete": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"@codemirror/commands": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"@codemirror/lang-css": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"@codemirror/lang-javascript": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
98
|
+
"@codemirror/lang-json": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"@codemirror/lang-vue": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"@codemirror/language": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
"@codemirror/search": {
|
|
108
|
+
"optional": true
|
|
109
|
+
},
|
|
110
|
+
"@codemirror/state": {
|
|
111
|
+
"optional": true
|
|
112
|
+
},
|
|
113
|
+
"@codemirror/view": {
|
|
114
|
+
"optional": true
|
|
115
|
+
},
|
|
116
|
+
"y-codemirror.next": {
|
|
117
|
+
"optional": true
|
|
118
|
+
},
|
|
85
119
|
"@tanstack/vue-virtual": {
|
|
86
120
|
"optional": true
|
|
87
121
|
},
|
|
@@ -99,7 +133,17 @@
|
|
|
99
133
|
}
|
|
100
134
|
},
|
|
101
135
|
"devDependencies": {
|
|
102
|
-
"@
|
|
136
|
+
"@codemirror/autocomplete": "^6.18.0",
|
|
137
|
+
"@codemirror/commands": "^6.7.0",
|
|
138
|
+
"@codemirror/lang-css": "^6.3.1",
|
|
139
|
+
"@codemirror/lang-javascript": "^6.2.5",
|
|
140
|
+
"@codemirror/lang-json": "^6.0.0",
|
|
141
|
+
"@codemirror/lang-vue": "^0.1.3",
|
|
142
|
+
"@codemirror/language": "^6.10.0",
|
|
143
|
+
"@codemirror/search": "^6.5.0",
|
|
144
|
+
"@codemirror/state": "^6.6.0",
|
|
145
|
+
"@codemirror/view": "^6.42.0",
|
|
146
|
+
"y-codemirror.next": "^0.3.5",
|
|
103
147
|
"@iconify-json/lucide": "^1.2.105",
|
|
104
148
|
"@noble/ed25519": "^3.1.0",
|
|
105
149
|
"@noble/hashes": "^2.2.0",
|
|
@@ -128,7 +172,24 @@
|
|
|
128
172
|
"vue": "^3.5.34",
|
|
129
173
|
"vue-tsc": "^3.2.8",
|
|
130
174
|
"ws": "^8.20.0",
|
|
131
|
-
"yjs": "^13.6.30"
|
|
175
|
+
"yjs": "^13.6.30",
|
|
176
|
+
"@abraca/dabra": "2.3.0",
|
|
177
|
+
"@abraca/plugin": "2.3.0",
|
|
178
|
+
"@abraca/convert": "2.3.0"
|
|
132
179
|
},
|
|
133
|
-
"
|
|
134
|
-
|
|
180
|
+
"scripts": {
|
|
181
|
+
"dev": "npm run dev:prepare && nuxt dev playground",
|
|
182
|
+
"dev:build": "nuxt build playground",
|
|
183
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
|
|
184
|
+
"release": "npm run lint && npm run prepack",
|
|
185
|
+
"lint": "eslint .",
|
|
186
|
+
"test": "vitest run",
|
|
187
|
+
"test:watch": "vitest watch",
|
|
188
|
+
"test:integration": "vitest run --config test/integration/vitest.config.ts --reporter=verbose",
|
|
189
|
+
"test:unit": "vitest run --config test/unit/vitest.config.ts",
|
|
190
|
+
"test:e2e": "playwright test",
|
|
191
|
+
"test:e2e:headed": "playwright test --headed",
|
|
192
|
+
"test:e2e:ui": "playwright test --ui",
|
|
193
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
194
|
+
}
|
|
195
|
+
}
|