@threadlabs/looma 0.43.1 → 0.44.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 (51) hide show
  1. package/components/ui-callout/ui-callout.html +4 -4
  2. package/components/ui-dialog/ui-dialog.html +0 -4
  3. package/components/ui-editor-footnote-editor/ui-editor-footnote-editor.html +4 -50
  4. package/components/ui-editor-footnote-editor/ui-editor-footnote-editor.js +10 -31
  5. package/components/ui-site-header/ui-site-header.html +1 -1
  6. package/dist/index.js +1 -1
  7. package/docs/README.md +19 -3
  8. package/docs/card.html +1 -1
  9. package/docs/catalog-view.js +11 -5
  10. package/docs/catalog-view.mjs +4 -3
  11. package/docs/catalog.json +76 -112
  12. package/docs/catalog.mjs +1 -1
  13. package/docs/customizer-render.mjs +9 -8
  14. package/docs/customizer.js +8 -8
  15. package/docs/documentation.css +2 -2
  16. package/docs/examples/ui-editor-footnote-editor/examples/01-note.behavior.js +9 -0
  17. package/docs/fonts.mjs +1 -1
  18. package/docs/index.mjs +1 -1
  19. package/docs/render.mjs +1 -1
  20. package/docs/site.mjs +14 -5
  21. package/docs/theme.mjs +96 -16
  22. package/editor/chunks/extensions.js +10 -0
  23. package/editor/extensions/footnote.d.ts +1 -0
  24. package/editor/footnote-editing.d.ts +16 -27
  25. package/package.json +2 -2
  26. package/styles/ui-callout.css +4 -4
  27. package/styles/ui-dialog.css +0 -8
  28. package/styles/ui-site-header.css +1 -1
  29. package/theme-dark.css +9 -9
  30. package/theme-high-contrast.css +4 -0
  31. package/theme-light.css +6 -6
  32. package/tokens.css +20 -18
  33. package/vanilla/UiEditorFootnoteEditor.d.ts +0 -5
  34. package/vanilla/UiEditorFootnoteEditor.js +20 -68
  35. package/vue/UiCallout.vue +4 -4
  36. package/vue/UiDialog.vue +0 -7
  37. package/vue/UiEditorFootnoteEditor.d.ts +11 -29
  38. package/vue/UiEditorFootnoteEditor.vue +21 -173
  39. package/vue/UiSiteHeader.vue +1 -1
  40. package/vue/chunks/UiCallout.js +1 -1
  41. package/vue/chunks/UiDialog.js +1 -1
  42. package/vue/chunks/UiEditorFootnoteEditor.js +34 -226
  43. package/vue/chunks/UiEditorImageToolbar.js +1 -1
  44. package/vue/chunks/UiEditorLinkForm.js +1 -1
  45. package/vue/chunks/UiSiteHeader.js +1 -1
  46. package/vue/chunks/compact.js +565 -0
  47. package/vue/components.css +321 -328
  48. package/vue/editor/LoomaEditor.d.ts +2 -2
  49. package/vue/editor/compact/index.js +1 -562
  50. package/vue/editor/index.js +173 -80
  51. package/vue/index.js +2 -2
@@ -145,6 +145,6 @@ var UiSiteHeader_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
145
145
  }]]);
146
146
  };
147
147
  }
148
- }), [["__scopeId", "data-v-a6fb8815"]]);
148
+ }), [["__scopeId", "data-v-db97d3bd"]]);
149
149
  //#endregion
150
150
  export { UiSiteHeader_default as t };
@@ -0,0 +1,565 @@
1
+ import { defineComponent, h, nextTick, onBeforeUnmount, onMounted, shallowRef, watch } from "vue";
2
+ import { Extension, Mark, Node, markInputRule, markPasteRule, mergeAttributes } from "@tiptap/core";
3
+ import { Editor as Editor$1, EditorContent } from "@tiptap/vue-3";
4
+ import { Plugin } from "@tiptap/pm/state";
5
+ import { closeHistory, history, redo, undo } from "@tiptap/pm/history";
6
+ //#region ../../node_modules/.pnpm/@tiptap+extension-document@2.27.2_@tiptap+core@2.27.2_@tiptap+pm@2.27.2_/node_modules/@tiptap/extension-document/dist/index.js
7
+ /**
8
+ * The default document node which represents the top level node of the editor.
9
+ * @see https://tiptap.dev/api/nodes/document
10
+ */
11
+ var Document = Node.create({
12
+ name: "doc",
13
+ topNode: true,
14
+ content: "block+"
15
+ });
16
+ //#endregion
17
+ //#region ../../node_modules/.pnpm/@tiptap+extension-paragraph@2.27.2_@tiptap+core@2.27.2_@tiptap+pm@2.27.2_/node_modules/@tiptap/extension-paragraph/dist/index.js
18
+ /**
19
+ * This extension allows you to create paragraphs.
20
+ * @see https://www.tiptap.dev/api/nodes/paragraph
21
+ */
22
+ var Paragraph = Node.create({
23
+ name: "paragraph",
24
+ priority: 1e3,
25
+ addOptions() {
26
+ return { HTMLAttributes: {} };
27
+ },
28
+ group: "block",
29
+ content: "inline*",
30
+ parseHTML() {
31
+ return [{ tag: "p" }];
32
+ },
33
+ renderHTML({ HTMLAttributes }) {
34
+ return [
35
+ "p",
36
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
37
+ 0
38
+ ];
39
+ },
40
+ addCommands() {
41
+ return { setParagraph: () => ({ commands }) => {
42
+ return commands.setNode(this.name);
43
+ } };
44
+ },
45
+ addKeyboardShortcuts() {
46
+ return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
47
+ }
48
+ });
49
+ //#endregion
50
+ //#region ../../node_modules/.pnpm/@tiptap+extension-text@2.27.2_@tiptap+core@2.27.2_@tiptap+pm@2.27.2_/node_modules/@tiptap/extension-text/dist/index.js
51
+ /**
52
+ * This extension allows you to create text nodes.
53
+ * @see https://www.tiptap.dev/api/nodes/text
54
+ */
55
+ var Text = Node.create({
56
+ name: "text",
57
+ group: "inline"
58
+ });
59
+ //#endregion
60
+ //#region ../../node_modules/.pnpm/@tiptap+extension-bold@2.27.2_@tiptap+core@2.27.2_@tiptap+pm@2.27.2_/node_modules/@tiptap/extension-bold/dist/index.js
61
+ /**
62
+ * Matches bold text via `**` as input.
63
+ */
64
+ var starInputRegex$1 = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
65
+ /**
66
+ * Matches bold text via `**` while pasting.
67
+ */
68
+ var starPasteRegex$1 = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
69
+ /**
70
+ * Matches bold text via `__` as input.
71
+ */
72
+ var underscoreInputRegex$1 = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
73
+ /**
74
+ * Matches bold text via `__` while pasting.
75
+ */
76
+ var underscorePasteRegex$1 = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
77
+ /**
78
+ * This extension allows you to mark text as bold.
79
+ * @see https://tiptap.dev/api/marks/bold
80
+ */
81
+ var Bold = Mark.create({
82
+ name: "bold",
83
+ addOptions() {
84
+ return { HTMLAttributes: {} };
85
+ },
86
+ parseHTML() {
87
+ return [
88
+ { tag: "strong" },
89
+ {
90
+ tag: "b",
91
+ getAttrs: (node) => node.style.fontWeight !== "normal" && null
92
+ },
93
+ {
94
+ style: "font-weight=400",
95
+ clearMark: (mark) => mark.type.name === this.name
96
+ },
97
+ {
98
+ style: "font-weight",
99
+ getAttrs: (value) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null
100
+ }
101
+ ];
102
+ },
103
+ renderHTML({ HTMLAttributes }) {
104
+ return [
105
+ "strong",
106
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
107
+ 0
108
+ ];
109
+ },
110
+ addCommands() {
111
+ return {
112
+ setBold: () => ({ commands }) => {
113
+ return commands.setMark(this.name);
114
+ },
115
+ toggleBold: () => ({ commands }) => {
116
+ return commands.toggleMark(this.name);
117
+ },
118
+ unsetBold: () => ({ commands }) => {
119
+ return commands.unsetMark(this.name);
120
+ }
121
+ };
122
+ },
123
+ addKeyboardShortcuts() {
124
+ return {
125
+ "Mod-b": () => this.editor.commands.toggleBold(),
126
+ "Mod-B": () => this.editor.commands.toggleBold()
127
+ };
128
+ },
129
+ addInputRules() {
130
+ return [markInputRule({
131
+ find: starInputRegex$1,
132
+ type: this.type
133
+ }), markInputRule({
134
+ find: underscoreInputRegex$1,
135
+ type: this.type
136
+ })];
137
+ },
138
+ addPasteRules() {
139
+ return [markPasteRule({
140
+ find: starPasteRegex$1,
141
+ type: this.type
142
+ }), markPasteRule({
143
+ find: underscorePasteRegex$1,
144
+ type: this.type
145
+ })];
146
+ }
147
+ });
148
+ //#endregion
149
+ //#region ../../node_modules/.pnpm/@tiptap+extension-italic@2.27.2_@tiptap+core@2.27.2_@tiptap+pm@2.27.2_/node_modules/@tiptap/extension-italic/dist/index.js
150
+ /**
151
+ * Matches an italic to a *italic* on input.
152
+ */
153
+ var starInputRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/;
154
+ /**
155
+ * Matches an italic to a *italic* on paste.
156
+ */
157
+ var starPasteRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g;
158
+ /**
159
+ * Matches an italic to a _italic_ on input.
160
+ */
161
+ var underscoreInputRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/;
162
+ /**
163
+ * Matches an italic to a _italic_ on paste.
164
+ */
165
+ var underscorePasteRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g;
166
+ /**
167
+ * This extension allows you to create italic text.
168
+ * @see https://www.tiptap.dev/api/marks/italic
169
+ */
170
+ var Italic = Mark.create({
171
+ name: "italic",
172
+ addOptions() {
173
+ return { HTMLAttributes: {} };
174
+ },
175
+ parseHTML() {
176
+ return [
177
+ { tag: "em" },
178
+ {
179
+ tag: "i",
180
+ getAttrs: (node) => node.style.fontStyle !== "normal" && null
181
+ },
182
+ {
183
+ style: "font-style=normal",
184
+ clearMark: (mark) => mark.type.name === this.name
185
+ },
186
+ { style: "font-style=italic" }
187
+ ];
188
+ },
189
+ renderHTML({ HTMLAttributes }) {
190
+ return [
191
+ "em",
192
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
193
+ 0
194
+ ];
195
+ },
196
+ addCommands() {
197
+ return {
198
+ setItalic: () => ({ commands }) => {
199
+ return commands.setMark(this.name);
200
+ },
201
+ toggleItalic: () => ({ commands }) => {
202
+ return commands.toggleMark(this.name);
203
+ },
204
+ unsetItalic: () => ({ commands }) => {
205
+ return commands.unsetMark(this.name);
206
+ }
207
+ };
208
+ },
209
+ addKeyboardShortcuts() {
210
+ return {
211
+ "Mod-i": () => this.editor.commands.toggleItalic(),
212
+ "Mod-I": () => this.editor.commands.toggleItalic()
213
+ };
214
+ },
215
+ addInputRules() {
216
+ return [markInputRule({
217
+ find: starInputRegex,
218
+ type: this.type
219
+ }), markInputRule({
220
+ find: underscoreInputRegex,
221
+ type: this.type
222
+ })];
223
+ },
224
+ addPasteRules() {
225
+ return [markPasteRule({
226
+ find: starPasteRegex,
227
+ type: this.type
228
+ }), markPasteRule({
229
+ find: underscorePasteRegex,
230
+ type: this.type
231
+ })];
232
+ }
233
+ });
234
+ //#endregion
235
+ //#region ../../node_modules/.pnpm/@tiptap+extension-code@2.27.2_@tiptap+core@2.27.2_@tiptap+pm@2.27.2_/node_modules/@tiptap/extension-code/dist/index.js
236
+ /**
237
+ * Regular expressions to match inline code blocks enclosed in backticks.
238
+ * It matches:
239
+ * - An opening backtick, followed by
240
+ * - Any text that doesn't include a backtick (captured for marking), followed by
241
+ * - A closing backtick.
242
+ * This ensures that any text between backticks is formatted as code,
243
+ * regardless of the surrounding characters (exception being another backtick).
244
+ */
245
+ var inputRegex = /(^|[^`])`([^`]+)`(?!`)/;
246
+ /**
247
+ * Matches inline code while pasting.
248
+ */
249
+ var pasteRegex = /(^|[^`])`([^`]+)`(?!`)/g;
250
+ /**
251
+ * This extension allows you to mark text as inline code.
252
+ * @see https://tiptap.dev/api/marks/code
253
+ */
254
+ var Code = Mark.create({
255
+ name: "code",
256
+ addOptions() {
257
+ return { HTMLAttributes: {} };
258
+ },
259
+ excludes: "_",
260
+ code: true,
261
+ exitable: true,
262
+ parseHTML() {
263
+ return [{ tag: "code" }];
264
+ },
265
+ renderHTML({ HTMLAttributes }) {
266
+ return [
267
+ "code",
268
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
269
+ 0
270
+ ];
271
+ },
272
+ addCommands() {
273
+ return {
274
+ setCode: () => ({ commands }) => {
275
+ return commands.setMark(this.name);
276
+ },
277
+ toggleCode: () => ({ commands }) => {
278
+ return commands.toggleMark(this.name);
279
+ },
280
+ unsetCode: () => ({ commands }) => {
281
+ return commands.unsetMark(this.name);
282
+ }
283
+ };
284
+ },
285
+ addKeyboardShortcuts() {
286
+ return { "Mod-e": () => this.editor.commands.toggleCode() };
287
+ },
288
+ addInputRules() {
289
+ return [markInputRule({
290
+ find: inputRegex,
291
+ type: this.type
292
+ })];
293
+ },
294
+ addPasteRules() {
295
+ return [markPasteRule({
296
+ find: pasteRegex,
297
+ type: this.type
298
+ })];
299
+ }
300
+ });
301
+ //#endregion
302
+ //#region ../../node_modules/.pnpm/@tiptap+extension-hard-break@2.27.2_@tiptap+core@2.27.2_@tiptap+pm@2.27.2_/node_modules/@tiptap/extension-hard-break/dist/index.js
303
+ /**
304
+ * This extension allows you to insert hard breaks.
305
+ * @see https://www.tiptap.dev/api/nodes/hard-break
306
+ */
307
+ var HardBreak = Node.create({
308
+ name: "hardBreak",
309
+ addOptions() {
310
+ return {
311
+ keepMarks: true,
312
+ HTMLAttributes: {}
313
+ };
314
+ },
315
+ inline: true,
316
+ group: "inline",
317
+ selectable: false,
318
+ linebreakReplacement: true,
319
+ parseHTML() {
320
+ return [{ tag: "br" }];
321
+ },
322
+ renderHTML({ HTMLAttributes }) {
323
+ return ["br", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
324
+ },
325
+ renderText() {
326
+ return "\n";
327
+ },
328
+ addCommands() {
329
+ return { setHardBreak: () => ({ commands, chain, state, editor }) => {
330
+ return commands.first([() => commands.exitCode(), () => commands.command(() => {
331
+ const { selection, storedMarks } = state;
332
+ if (selection.$from.parent.type.spec.isolating) return false;
333
+ const { keepMarks } = this.options;
334
+ const { splittableMarks } = editor.extensionManager;
335
+ const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
336
+ return chain().insertContent({ type: this.name }).command(({ tr, dispatch }) => {
337
+ if (dispatch && marks && keepMarks) {
338
+ const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
339
+ tr.ensureMarks(filteredMarks);
340
+ }
341
+ return true;
342
+ }).run();
343
+ })]);
344
+ } };
345
+ },
346
+ addKeyboardShortcuts() {
347
+ return {
348
+ "Mod-Enter": () => this.editor.commands.setHardBreak(),
349
+ "Shift-Enter": () => this.editor.commands.setHardBreak()
350
+ };
351
+ }
352
+ });
353
+ //#endregion
354
+ //#region ../../node_modules/.pnpm/@tiptap+extension-history@2.27.2_@tiptap+core@2.27.2_@tiptap+pm@2.27.2__@tiptap+pm@2.27.2/node_modules/@tiptap/extension-history/dist/index.js
355
+ /**
356
+ * This extension allows you to undo and redo recent changes.
357
+ * @see https://www.tiptap.dev/api/extensions/history
358
+ *
359
+ * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove
360
+ * the `history` extension, as it is not compatible with the `collaboration` extension.
361
+ *
362
+ * `@tiptap/extension-collaboration` uses its own history implementation.
363
+ */
364
+ var History = Extension.create({
365
+ name: "history",
366
+ addOptions() {
367
+ return {
368
+ depth: 100,
369
+ newGroupDelay: 500
370
+ };
371
+ },
372
+ addCommands() {
373
+ return {
374
+ undo: () => ({ state, dispatch }) => {
375
+ return undo(state, dispatch);
376
+ },
377
+ redo: () => ({ state, dispatch }) => {
378
+ return redo(state, dispatch);
379
+ }
380
+ };
381
+ },
382
+ addProseMirrorPlugins() {
383
+ return [history(this.options)];
384
+ },
385
+ addKeyboardShortcuts() {
386
+ return {
387
+ "Mod-z": () => this.editor.commands.undo(),
388
+ "Shift-Mod-z": () => this.editor.commands.redo(),
389
+ "Mod-y": () => this.editor.commands.redo(),
390
+ "Mod-я": () => this.editor.commands.undo(),
391
+ "Shift-Mod-я": () => this.editor.commands.redo()
392
+ };
393
+ }
394
+ });
395
+ //#endregion
396
+ //#region src/editor/extensions/input-rule-history.ts
397
+ /**
398
+ * Keep the literal trigger in typing history before converting it. Tiptap's
399
+ * usual input rule consumes the final character, so simply closing history
400
+ * would restore an incomplete Markdown delimiter on Undo.
401
+ * @invariant Conversion and subsequent typing are separate history events.
402
+ * @lifecycle Tiptap clears its undoable input rule on typing or caret movement.
403
+ */
404
+ var LoomaInputRuleHistory = Extension.create({
405
+ name: "loomaInputRuleHistory",
406
+ priority: 50,
407
+ onBeforeCreate() {
408
+ const props = this.editor.options.editorProps;
409
+ this.editor.setOptions({ editorProps: {
410
+ ...props,
411
+ handleTextInput(view, from, to, text, defaultTransaction) {
412
+ if (props.handleTextInput?.call(props, view, from, to, text, defaultTransaction)) return true;
413
+ if (view.composing) return false;
414
+ const rules = view.state.plugins.find((plugin) => plugin.spec.isInputRules);
415
+ if (!rules?.props.handleTextInput) return false;
416
+ view.dispatch((defaultTransaction?.() ?? view.state.tr.insertText(text, from, to)).scrollIntoView());
417
+ const position = view.state.selection.from;
418
+ rules.props.handleTextInput.call(rules, view, position, position, "", defaultTransaction);
419
+ return true;
420
+ }
421
+ } });
422
+ },
423
+ addKeyboardShortcuts() {
424
+ return { Escape: () => this.editor.commands.undoInputRule() };
425
+ },
426
+ addProseMirrorPlugins() {
427
+ return [new Plugin({
428
+ filterTransaction(tr, state) {
429
+ if (state.plugins.some((plugin) => plugin.spec.isInputRules && tr.getMeta(plugin))) closeHistory(tr);
430
+ return true;
431
+ },
432
+ appendTransaction(transactions, _old, state) {
433
+ if (transactions.some((tr) => state.plugins.some((plugin) => plugin.spec.isInputRules && tr.getMeta(plugin)))) return closeHistory(state.tr);
434
+ return null;
435
+ }
436
+ })];
437
+ }
438
+ });
439
+ //#endregion
440
+ //#region src/vue/editor/compact/extensions.ts
441
+ /** Minimal short-form schema; additional consumer extensions are opt-in. */
442
+ function getCompactEditorExtensions() {
443
+ return [
444
+ Document,
445
+ Paragraph,
446
+ Text,
447
+ Bold,
448
+ Italic,
449
+ Code,
450
+ HardBreak,
451
+ History,
452
+ LoomaInputRuleHistory
453
+ ];
454
+ }
455
+ //#endregion
456
+ //#region src/vue/editor/compact/index.ts
457
+ var emptyDocument = () => ({
458
+ type: "doc",
459
+ content: [{ type: "paragraph" }]
460
+ });
461
+ /**
462
+ * Toolbar-free editing for short rich text. Owns editor lifecycle and standard
463
+ * formatting/history shortcuts; the host owns persistence and optional extensions.
464
+ * Importing this entry is SSR-safe and does not load the full document editor.
465
+ * @ownership The component owns the editor; callers own content and extensions.
466
+ * @lifecycle Mount creates one editor; unmount destroys it and prop watchers.
467
+ * @failure Persistence failures are host-owned; the controlled document can restore input.
468
+ */
469
+ var LoomaCompactEditor = defineComponent({
470
+ name: "LoomaCompactEditor",
471
+ inheritAttrs: false,
472
+ props: {
473
+ modelValue: {
474
+ type: Object,
475
+ default: emptyDocument
476
+ },
477
+ label: {
478
+ type: String,
479
+ default: "Message"
480
+ },
481
+ id: {
482
+ type: String,
483
+ default: ""
484
+ },
485
+ editable: {
486
+ type: Boolean,
487
+ default: true
488
+ },
489
+ extensions: {
490
+ type: Array,
491
+ default: () => []
492
+ }
493
+ },
494
+ emits: {
495
+ "update:modelValue": (_value) => true,
496
+ ready: (_editor) => true
497
+ },
498
+ setup(props, { attrs, emit, expose }) {
499
+ const editor = shallowRef();
500
+ onMounted(() => {
501
+ editor.value = new Editor$1({
502
+ extensions: [...getCompactEditorExtensions().filter((extension) => !props.extensions.some((supplied) => supplied.name === extension.name)), ...props.extensions],
503
+ content: props.modelValue,
504
+ editable: props.editable,
505
+ editorProps: { attributes: () => ({
506
+ role: "textbox",
507
+ "aria-multiline": "true",
508
+ "aria-label": props.label,
509
+ "aria-readonly": String(!props.editable),
510
+ id: props.id
511
+ }) },
512
+ onUpdate: ({ editor }) => emit("update:modelValue", editor.getJSON())
513
+ });
514
+ nextTick().then(() => nextTick()).then(() => {
515
+ if (editor.value && !editor.value.isDestroyed) emit("ready", editor.value);
516
+ });
517
+ });
518
+ watch(() => props.modelValue, (value) => {
519
+ if (editor.value && JSON.stringify(value) !== JSON.stringify(editor.value.getJSON())) editor.value.commands.setContent(value, false);
520
+ }, { deep: true });
521
+ watch(() => [
522
+ props.id,
523
+ props.label,
524
+ props.editable
525
+ ], () => editor.value?.setEditable(props.editable, false));
526
+ onBeforeUnmount(() => editor.value?.destroy());
527
+ expose({
528
+ focus: () => editor.value?.commands.focus(),
529
+ getEditor: () => editor.value
530
+ });
531
+ return () => h("div", {
532
+ ...attrs,
533
+ id: void 0,
534
+ class: ["looma-compact-editor", attrs.class]
535
+ }, [editor.value ? h(EditorContent, { editor: editor.value }) : null]);
536
+ }
537
+ });
538
+ function renderNode(node) {
539
+ if (node.type === "hardBreak") return h("br");
540
+ if (node.type === "text") {
541
+ let text = node.text ?? "";
542
+ for (const mark of node.marks ?? []) {
543
+ const tag = {
544
+ bold: "strong",
545
+ italic: "em",
546
+ code: "code"
547
+ }[mark.type];
548
+ if (tag) text = h(tag, {}, [text]);
549
+ }
550
+ return text;
551
+ }
552
+ const children = (node.content ?? []).map(renderNode);
553
+ return node.type === "paragraph" ? h("p", {}, children) : children;
554
+ }
555
+ /** Renders basic compact JSON as escaped Vue nodes, including during SSR. */
556
+ var LoomaCompactContent = defineComponent({
557
+ name: "LoomaCompactContent",
558
+ props: { content: {
559
+ type: Object,
560
+ required: true
561
+ } },
562
+ setup: (props) => () => h("div", { class: "looma-compact-content" }, [renderNode(props.content)])
563
+ });
564
+ //#endregion
565
+ export { LoomaCompactEditor as n, getCompactEditorExtensions as r, LoomaCompactContent as t };