@vizel/core 0.0.1-alpha.1 → 0.0.1-alpha.3
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/LICENSE +21 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.js +141 -141
- package/dist/index10.js +70 -110
- package/dist/index11.js +135 -168
- package/dist/index12.js +83 -74
- package/dist/index13.js +13 -134
- package/dist/index14.js +13 -146
- package/dist/index15.js +303 -15
- package/dist/index16.js +69 -14
- package/dist/index17.js +26 -295
- package/dist/index18.js +2 -2
- package/dist/index19.js +355 -24
- package/dist/index20.js +25 -264
- package/dist/index21.js +85 -68
- package/dist/index22.js +97 -353
- package/dist/index23.js +66 -84
- package/dist/index24.js +12 -36
- package/dist/index25.js +53 -92
- package/dist/index26.js +132 -96
- package/dist/index27.js +59 -126
- package/dist/index28.js +37 -53
- package/dist/index29.js +19 -62
- package/dist/index3.js +165 -60
- package/dist/index30.js +9 -37
- package/dist/index31.js +143 -19
- package/dist/index32.js +264 -11
- package/dist/index33.js +92 -9
- package/dist/index34.js +63 -16
- package/dist/index35.js +4 -58
- package/dist/index36.js +123 -15
- package/dist/index37.js +305 -42
- package/dist/index38.js +487 -4
- package/dist/index39.js +37 -112
- package/dist/index4.js +10 -86
- package/dist/index40.js +653 -301
- package/dist/index41.js +4 -487
- package/dist/index42.js +4 -48
- package/dist/index43.js +206 -642
- package/dist/index44.js +82 -4
- package/dist/index45.js +17 -4
- package/dist/index46.js +57 -237
- package/dist/index47.js +15 -82
- package/dist/index48.js +190 -274
- package/dist/index49.js +281 -1497
- package/dist/index5.js +132 -10
- package/dist/index50.js +1502 -5
- package/dist/index51.js +5 -1561
- package/dist/index52.js +1551 -192
- package/dist/index53.js +1 -1
- package/dist/index54.js +84 -21
- package/dist/index55.js +246 -10
- package/dist/index56.js +3 -7
- package/dist/index57.js +1231 -7
- package/dist/index58.js +731 -11
- package/dist/index59.js +21 -19
- package/dist/index6.js +48 -131
- package/dist/index60.js +10 -25
- package/dist/index61.js +6 -83
- package/dist/index62.js +7 -245
- package/dist/index63.js +11 -1229
- package/dist/index64.js +17 -732
- package/dist/index65.js +25 -3
- package/dist/index66.js +53 -1059
- package/dist/index67.js +1059 -53
- package/dist/index69.js +90 -3
- package/dist/index7.js +228 -409
- package/dist/index70.js +3 -90
- package/dist/index8.js +111 -45
- package/dist/index9.js +409 -228
- package/package.json +54 -80
package/dist/index31.js
CHANGED
|
@@ -1,26 +1,150 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { PluginKey as S, Plugin as A } from "./index38.js";
|
|
2
|
+
import { DecorationSet as E, Decoration as M } from "./index50.js";
|
|
3
|
+
import { VIZEL_DEFAULT_IMAGE_MAX_FILE_SIZE as _, VIZEL_DEFAULT_FILE_MIME_TYPES as P } from "./index10.js";
|
|
4
|
+
const d = new S("vizel-image-upload"), U = (e) => typeof e == "object" && e !== null && "type" in e && (e.type === "add" || e.type === "remove");
|
|
5
|
+
function T(e) {
|
|
6
|
+
const { placeholderClass: o = "vizel-image-placeholder", imageClass: r = "vizel-image-uploading" } = e;
|
|
7
|
+
return new A({
|
|
8
|
+
key: d,
|
|
9
|
+
state: {
|
|
10
|
+
init() {
|
|
11
|
+
return E.empty;
|
|
12
|
+
},
|
|
13
|
+
apply(t, i) {
|
|
14
|
+
let a = i.map(t.mapping, t.doc);
|
|
15
|
+
const s = t.getMeta(d), n = U(s) ? s : void 0;
|
|
16
|
+
if (n?.type === "add") {
|
|
17
|
+
const { id: l, pos: g, previewSrc: p } = n, c = document.createElement("div");
|
|
18
|
+
c.setAttribute("class", o);
|
|
19
|
+
const u = document.createElement("img");
|
|
20
|
+
u.setAttribute("class", r), u.src = p, c.appendChild(u);
|
|
21
|
+
const m = document.createElement("div");
|
|
22
|
+
m.setAttribute("class", "vizel-image-spinner"), c.appendChild(m);
|
|
23
|
+
const f = M.widget(g, c, { id: l });
|
|
24
|
+
a = a.add(t.doc, [f]);
|
|
25
|
+
} else n?.type === "remove" && (a = a.remove(
|
|
26
|
+
a.find(void 0, void 0, (l) => l.id === n.id)
|
|
27
|
+
));
|
|
28
|
+
return a;
|
|
29
|
+
}
|
|
13
30
|
},
|
|
14
|
-
|
|
15
|
-
|
|
31
|
+
props: {
|
|
32
|
+
decorations(t) {
|
|
33
|
+
return d.getState(t) ?? E.empty;
|
|
34
|
+
}
|
|
16
35
|
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function F(e, o) {
|
|
39
|
+
const r = d.getState(e);
|
|
40
|
+
if (!r)
|
|
41
|
+
return null;
|
|
42
|
+
const t = r.find(void 0, void 0, (i) => i.id === o);
|
|
43
|
+
return t.length > 0 ? t[0]?.from ?? null : null;
|
|
44
|
+
}
|
|
45
|
+
function x(e, o) {
|
|
46
|
+
const r = o.maxFileSize ?? _, t = o.allowedTypes ?? P;
|
|
47
|
+
if (!t.includes(e.type))
|
|
48
|
+
return {
|
|
49
|
+
type: "invalid_type",
|
|
50
|
+
message: `File type "${e.type}" is not allowed. Allowed types: ${t.join(", ")}`,
|
|
51
|
+
file: e
|
|
52
|
+
};
|
|
53
|
+
if (e.size > r) {
|
|
54
|
+
const i = (r / 1048576).toFixed(1);
|
|
55
|
+
return {
|
|
56
|
+
type: "file_too_large",
|
|
57
|
+
message: `File size (${(e.size / (1024 * 1024)).toFixed(1)}MB) exceeds maximum allowed size (${i}MB)`,
|
|
58
|
+
file: e
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
function v(e) {
|
|
64
|
+
const { onUpload: o, maxFileSize: r, allowedTypes: t, onValidationError: i, onUploadError: a } = e;
|
|
65
|
+
return (s, n, l) => {
|
|
66
|
+
const g = x(s, {
|
|
67
|
+
...r !== void 0 && { maxFileSize: r },
|
|
68
|
+
...t !== void 0 && { allowedTypes: t }
|
|
69
|
+
});
|
|
70
|
+
if (g) {
|
|
71
|
+
i?.(g);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const p = {}, c = new FileReader();
|
|
75
|
+
c.readAsDataURL(s), c.onload = () => {
|
|
76
|
+
if (typeof c.result != "string") return;
|
|
77
|
+
const u = c.result, m = n.state.tr;
|
|
78
|
+
m.selection.empty || m.deleteSelection(), m.setMeta(d, {
|
|
79
|
+
type: "add",
|
|
80
|
+
id: p,
|
|
81
|
+
pos: l,
|
|
82
|
+
previewSrc: u
|
|
83
|
+
}), n.dispatch(m), o(s).then((f) => {
|
|
84
|
+
const y = F(n.state, p);
|
|
85
|
+
if (y === null)
|
|
86
|
+
return;
|
|
87
|
+
const { schema: h } = n.state, z = h.nodes.image?.create({ src: f });
|
|
88
|
+
if (!z) {
|
|
89
|
+
console.warn("Image node type not found in schema");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const I = n.state.tr.replaceWith(y, y, z).setMeta(d, {
|
|
93
|
+
type: "remove",
|
|
94
|
+
id: p
|
|
95
|
+
});
|
|
96
|
+
n.dispatch(I);
|
|
97
|
+
}).catch((f) => {
|
|
98
|
+
if (a?.(f, s), F(n.state, p) !== null) {
|
|
99
|
+
const h = n.state.tr.setMeta(d, {
|
|
100
|
+
type: "remove",
|
|
101
|
+
id: p
|
|
102
|
+
});
|
|
103
|
+
n.dispatch(h);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
};
|
|
17
107
|
};
|
|
18
108
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
109
|
+
function b(e, o, r) {
|
|
110
|
+
const t = o.clipboardData?.files;
|
|
111
|
+
if (!t || t.length === 0)
|
|
112
|
+
return !1;
|
|
113
|
+
const i = Array.from(t).filter((s) => s.type.startsWith("image/"));
|
|
114
|
+
if (i.length === 0)
|
|
115
|
+
return !1;
|
|
116
|
+
o.preventDefault();
|
|
117
|
+
const a = e.state.selection.from;
|
|
118
|
+
for (const s of i)
|
|
119
|
+
r(s, e, a);
|
|
120
|
+
return !0;
|
|
121
|
+
}
|
|
122
|
+
function B(e, o, r, t) {
|
|
123
|
+
if (r)
|
|
124
|
+
return !1;
|
|
125
|
+
const i = o.dataTransfer?.files;
|
|
126
|
+
if (!i || i.length === 0)
|
|
127
|
+
return !1;
|
|
128
|
+
const a = Array.from(i).filter((l) => l.type.startsWith("image/"));
|
|
129
|
+
if (a.length === 0)
|
|
130
|
+
return !1;
|
|
131
|
+
o.preventDefault();
|
|
132
|
+
const n = e.posAtCoords({
|
|
133
|
+
left: o.clientX,
|
|
134
|
+
top: o.clientY
|
|
135
|
+
})?.pos ?? e.state.selection.from;
|
|
136
|
+
for (const l of a)
|
|
137
|
+
t(l, e, n);
|
|
138
|
+
return !0;
|
|
139
|
+
}
|
|
140
|
+
function C() {
|
|
141
|
+
return d;
|
|
21
142
|
}
|
|
22
143
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
144
|
+
T as createVizelImageUploadPlugin,
|
|
145
|
+
v as createVizelImageUploader,
|
|
146
|
+
C as getVizelImageUploadPluginKey,
|
|
147
|
+
B as handleVizelImageDrop,
|
|
148
|
+
b as handleVizelImagePaste,
|
|
149
|
+
x as validateVizelImageFile
|
|
26
150
|
};
|
package/dist/index32.js
CHANGED
|
@@ -1,15 +1,268 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import l from "fuse.js";
|
|
2
|
+
const h = [
|
|
3
|
+
// Text group
|
|
4
|
+
{
|
|
5
|
+
title: "Heading 1",
|
|
6
|
+
description: "Large section heading",
|
|
7
|
+
icon: "heading1",
|
|
8
|
+
group: "Text",
|
|
9
|
+
keywords: ["h1", "title", "header", "big"],
|
|
10
|
+
shortcut: "⌘⌥1",
|
|
11
|
+
command: ({ editor: e, range: t }) => {
|
|
12
|
+
e.chain().focus().deleteRange(t).setNode("heading", { level: 1 }).run();
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
title: "Heading 2",
|
|
17
|
+
description: "Medium section heading",
|
|
18
|
+
icon: "heading2",
|
|
19
|
+
group: "Text",
|
|
20
|
+
keywords: ["h2", "subtitle", "header"],
|
|
21
|
+
shortcut: "⌘⌥2",
|
|
22
|
+
command: ({ editor: e, range: t }) => {
|
|
23
|
+
e.chain().focus().deleteRange(t).setNode("heading", { level: 2 }).run();
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
title: "Heading 3",
|
|
28
|
+
description: "Small section heading",
|
|
29
|
+
icon: "heading3",
|
|
30
|
+
group: "Text",
|
|
31
|
+
keywords: ["h3", "header", "section"],
|
|
32
|
+
shortcut: "⌘⌥3",
|
|
33
|
+
command: ({ editor: e, range: t }) => {
|
|
34
|
+
e.chain().focus().deleteRange(t).setNode("heading", { level: 3 }).run();
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
// Lists group
|
|
38
|
+
{
|
|
39
|
+
title: "Bullet List",
|
|
40
|
+
description: "Create a simple bullet list",
|
|
41
|
+
icon: "bulletList",
|
|
42
|
+
group: "Lists",
|
|
43
|
+
keywords: ["ul", "unordered", "bullets", "points"],
|
|
44
|
+
shortcut: "⌘⇧8",
|
|
45
|
+
command: ({ editor: e, range: t }) => {
|
|
46
|
+
e.chain().focus().deleteRange(t).toggleBulletList().run();
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: "Numbered List",
|
|
51
|
+
description: "Create a numbered list",
|
|
52
|
+
icon: "orderedList",
|
|
53
|
+
group: "Lists",
|
|
54
|
+
keywords: ["ol", "ordered", "numbers", "steps"],
|
|
55
|
+
shortcut: "⌘⇧7",
|
|
56
|
+
command: ({ editor: e, range: t }) => {
|
|
57
|
+
e.chain().focus().deleteRange(t).toggleOrderedList().run();
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
title: "Task List",
|
|
62
|
+
description: "Create a task list with checkboxes",
|
|
63
|
+
icon: "taskList",
|
|
64
|
+
group: "Lists",
|
|
65
|
+
keywords: ["todo", "checkbox", "checklist", "tasks"],
|
|
66
|
+
command: ({ editor: e, range: t }) => {
|
|
67
|
+
e.chain().focus().deleteRange(t).toggleTaskList().run();
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
// Blocks group
|
|
71
|
+
{
|
|
72
|
+
title: "Quote",
|
|
73
|
+
description: "Capture a quote",
|
|
74
|
+
icon: "blockquote",
|
|
75
|
+
group: "Blocks",
|
|
76
|
+
keywords: ["blockquote", "citation", "cite"],
|
|
77
|
+
shortcut: "⌘⇧B",
|
|
78
|
+
command: ({ editor: e, range: t }) => {
|
|
79
|
+
e.chain().focus().deleteRange(t).toggleBlockquote().run();
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
title: "Divider",
|
|
84
|
+
description: "Insert a horizontal divider",
|
|
85
|
+
icon: "horizontalRule",
|
|
86
|
+
group: "Blocks",
|
|
87
|
+
keywords: ["hr", "horizontal", "line", "separator", "break"],
|
|
88
|
+
command: ({ editor: e, range: t }) => {
|
|
89
|
+
e.chain().focus().deleteRange(t).setHorizontalRule().run();
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
title: "Details",
|
|
94
|
+
description: "Collapsible content block",
|
|
95
|
+
icon: "details",
|
|
96
|
+
group: "Blocks",
|
|
97
|
+
keywords: ["accordion", "toggle", "collapse", "expand", "summary", "details"],
|
|
98
|
+
command: ({ editor: e, range: t }) => {
|
|
99
|
+
e.can().setDetails?.() && e.chain().focus().deleteRange(t).setDetails().run();
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
title: "Code Block",
|
|
104
|
+
description: "Insert a code snippet",
|
|
105
|
+
icon: "codeBlock",
|
|
106
|
+
group: "Blocks",
|
|
107
|
+
keywords: ["pre", "code", "programming", "syntax", "snippet"],
|
|
108
|
+
shortcut: "⌘⌥C",
|
|
109
|
+
command: ({ editor: e, range: t }) => {
|
|
110
|
+
e.chain().focus().deleteRange(t).toggleCodeBlock().run();
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
title: "Table",
|
|
115
|
+
description: "Insert a table",
|
|
116
|
+
icon: "table",
|
|
117
|
+
group: "Blocks",
|
|
118
|
+
keywords: ["grid", "spreadsheet", "columns", "rows"],
|
|
119
|
+
command: ({ editor: e, range: t }) => {
|
|
120
|
+
e.chain().focus().deleteRange(t).insertTable({ rows: 3, cols: 3, withHeaderRow: !0 }).run();
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
// Media group
|
|
124
|
+
{
|
|
125
|
+
title: "Image",
|
|
126
|
+
description: "Insert an image from URL",
|
|
127
|
+
icon: "image",
|
|
128
|
+
group: "Media",
|
|
129
|
+
keywords: ["picture", "photo", "img", "url"],
|
|
130
|
+
command: ({ editor: e, range: t }) => {
|
|
131
|
+
const o = window.prompt("Enter image URL:");
|
|
132
|
+
o && e.chain().focus().deleteRange(t).setImage({ src: o }).run();
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
title: "Upload Image",
|
|
137
|
+
description: "Upload an image from your device",
|
|
138
|
+
icon: "imageUpload",
|
|
139
|
+
group: "Media",
|
|
140
|
+
keywords: ["picture", "photo", "upload", "file"],
|
|
141
|
+
command: ({ editor: e, range: t }) => {
|
|
142
|
+
try {
|
|
143
|
+
e.chain().focus().deleteRange(t).run();
|
|
144
|
+
} catch {
|
|
145
|
+
}
|
|
146
|
+
const o = document.createElement("input");
|
|
147
|
+
o.type = "file", o.accept = "image/*", o.onchange = () => {
|
|
148
|
+
const i = o.files?.[0];
|
|
149
|
+
if (i) {
|
|
150
|
+
const n = new CustomEvent("vizel:upload-image", {
|
|
151
|
+
detail: { file: i, editor: e }
|
|
152
|
+
});
|
|
153
|
+
document.dispatchEvent(n);
|
|
154
|
+
}
|
|
155
|
+
}, o.click();
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
title: "Embed",
|
|
160
|
+
description: "Embed a URL (YouTube, Twitter, etc.)",
|
|
161
|
+
icon: "embed",
|
|
162
|
+
group: "Media",
|
|
163
|
+
keywords: ["link", "url", "youtube", "video", "twitter", "embed", "iframe", "oembed"],
|
|
164
|
+
command: ({ editor: e, range: t }) => {
|
|
165
|
+
if (!(typeof e.commands.setEmbed == "function")) {
|
|
166
|
+
const n = window.prompt("Enter URL:");
|
|
167
|
+
n && e.chain().focus().deleteRange(t).setLink({ href: n }).run();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const i = window.prompt("Enter URL to embed:");
|
|
171
|
+
i && e.chain().focus().deleteRange(t).setEmbed({ url: i }).run();
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
// Advanced group
|
|
175
|
+
{
|
|
176
|
+
title: "Math Equation",
|
|
177
|
+
description: "Insert a mathematical expression",
|
|
178
|
+
icon: "mathBlock",
|
|
179
|
+
group: "Advanced",
|
|
180
|
+
keywords: ["latex", "formula", "equation", "katex", "math"],
|
|
181
|
+
command: ({ editor: e, range: t }) => {
|
|
182
|
+
e.can().insertMathBlock?.({ latex: "" }) && e.chain().focus().deleteRange(t).insertMathBlock({ latex: "" }).run();
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
title: "Inline Math",
|
|
187
|
+
description: "Insert an inline math expression",
|
|
188
|
+
icon: "mathInline",
|
|
189
|
+
group: "Advanced",
|
|
190
|
+
keywords: ["latex", "formula", "inline", "katex", "math"],
|
|
191
|
+
command: ({ editor: e, range: t }) => {
|
|
192
|
+
e.can().insertMath?.({ latex: "" }) && e.chain().focus().deleteRange(t).insertMath({ latex: "" }).run();
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
title: "Mermaid Diagram",
|
|
197
|
+
description: "Insert a Mermaid diagram",
|
|
198
|
+
icon: "mermaid",
|
|
199
|
+
group: "Advanced",
|
|
200
|
+
keywords: ["diagram", "chart", "flowchart", "mermaid", "sequence", "graph", "uml"],
|
|
201
|
+
command: ({ editor: e, range: t }) => {
|
|
202
|
+
e.can().insertDiagram?.({ code: "" }) && e.chain().focus().deleteRange(t).insertDiagram({ code: "", type: "mermaid" }).run();
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
title: "GraphViz Diagram",
|
|
207
|
+
description: "Insert a GraphViz (DOT) diagram",
|
|
208
|
+
icon: "graphviz",
|
|
209
|
+
group: "Advanced",
|
|
210
|
+
keywords: ["diagram", "graphviz", "dot", "graph", "network", "nodes", "edges"],
|
|
211
|
+
command: ({ editor: e, range: t }) => {
|
|
212
|
+
e.can().insertDiagram?.({ code: "" }) && e.chain().focus().deleteRange(t).insertDiagram({ code: "", type: "graphviz" }).run();
|
|
213
|
+
}
|
|
9
214
|
}
|
|
10
|
-
|
|
215
|
+
], u = ["Text", "Lists", "Blocks", "Media", "Advanced"], m = {
|
|
216
|
+
keys: [
|
|
217
|
+
{ name: "title", weight: 0.4 },
|
|
218
|
+
{ name: "description", weight: 0.2 },
|
|
219
|
+
{ name: "keywords", weight: 0.4 }
|
|
220
|
+
],
|
|
221
|
+
threshold: 0.4,
|
|
222
|
+
includeScore: !0,
|
|
223
|
+
includeMatches: !0,
|
|
224
|
+
minMatchCharLength: 1
|
|
225
|
+
}, s = /* @__PURE__ */ new WeakMap();
|
|
226
|
+
function c(e) {
|
|
227
|
+
let t = s.get(e);
|
|
228
|
+
return t || (t = new l(e, m), s.set(e, t)), t;
|
|
229
|
+
}
|
|
230
|
+
function p(e, t) {
|
|
231
|
+
return t.trim() ? c(e).search(t).map((n) => n.item) : e;
|
|
232
|
+
}
|
|
233
|
+
function f(e, t) {
|
|
234
|
+
return t.trim() ? c(e).search(t).map((n) => {
|
|
235
|
+
const r = n.matches?.find((d) => d.key === "title")?.indices;
|
|
236
|
+
return {
|
|
237
|
+
item: n.item,
|
|
238
|
+
score: n.score ?? 0,
|
|
239
|
+
titleMatches: r
|
|
240
|
+
};
|
|
241
|
+
}) : e.map((n) => ({ item: n, score: 0 }));
|
|
242
|
+
}
|
|
243
|
+
function k(e, t = u) {
|
|
244
|
+
const o = /* @__PURE__ */ new Map();
|
|
245
|
+
for (const n of e) {
|
|
246
|
+
const a = n.group ?? "Other", r = o.get(a) ?? [];
|
|
247
|
+
r.push(n), o.set(a, r);
|
|
248
|
+
}
|
|
249
|
+
const i = [];
|
|
250
|
+
for (const n of t) {
|
|
251
|
+
const a = o.get(n);
|
|
252
|
+
a && a.length > 0 && (i.push({ name: n, items: a }), o.delete(n));
|
|
253
|
+
}
|
|
254
|
+
for (const [n, a] of o)
|
|
255
|
+
a.length > 0 && i.push({ name: n, items: a });
|
|
256
|
+
return i;
|
|
257
|
+
}
|
|
258
|
+
function w(e) {
|
|
259
|
+
return e.flatMap((t) => t.items);
|
|
11
260
|
}
|
|
12
261
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
262
|
+
u as defaultGroupOrder,
|
|
263
|
+
h as defaultSlashCommands,
|
|
264
|
+
p as filterSlashCommands,
|
|
265
|
+
w as flattenSlashCommandGroups,
|
|
266
|
+
k as groupSlashCommands,
|
|
267
|
+
f as searchSlashCommands
|
|
15
268
|
};
|
package/dist/index33.js
CHANGED
|
@@ -1,12 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const t = [];
|
|
5
|
-
let l = 0;
|
|
6
|
-
for (const [h, s] of e)
|
|
7
|
-
h > l && t.push({ text: i.slice(l, h), highlight: !1 }), t.push({ text: i.slice(h, s + 1), highlight: !0 }), l = s + 1;
|
|
8
|
-
return l < i.length && t.push({ text: i.slice(l), highlight: !1 }), t;
|
|
1
|
+
import { Table as w, TableCell as A, TableHeader as T } from "@tiptap/extension-table";
|
|
2
|
+
function g(t, e) {
|
|
3
|
+
return t.tokens ? e.parseInline(t.tokens) : t.text ? [e.createTextNode(t.text)] : [];
|
|
9
4
|
}
|
|
5
|
+
function f(t, e) {
|
|
6
|
+
return t.length > 0 ? [e.createNode("paragraph", void 0, t)] : [e.createNode("paragraph")];
|
|
7
|
+
}
|
|
8
|
+
function x(t, e) {
|
|
9
|
+
const { header: l, align: r, rows: s } = t, a = l.map((n, i) => {
|
|
10
|
+
const o = g(n, e), c = r[i] ? { textAlign: r[i] } : void 0;
|
|
11
|
+
return e.createNode("tableHeader", c, f(o, e));
|
|
12
|
+
}), d = e.createNode("tableRow", void 0, a), u = s.map((n) => {
|
|
13
|
+
const i = n.map((o, c) => {
|
|
14
|
+
const m = g(o, e), p = r[c] ? { textAlign: r[c] } : void 0;
|
|
15
|
+
return e.createNode("tableCell", p, f(m, e));
|
|
16
|
+
});
|
|
17
|
+
return e.createNode("tableRow", void 0, i);
|
|
18
|
+
});
|
|
19
|
+
return e.createNode("table", void 0, [d, ...u]);
|
|
20
|
+
}
|
|
21
|
+
function b(t, e) {
|
|
22
|
+
if (!t.content || t.content.length === 0)
|
|
23
|
+
return "";
|
|
24
|
+
const l = t.content, r = l[0];
|
|
25
|
+
if (!r?.content)
|
|
26
|
+
return "";
|
|
27
|
+
const s = r.content.map(
|
|
28
|
+
(n) => n.attrs?.textAlign || null
|
|
29
|
+
), a = l.map((n) => n.content ? `| ${n.content.map((o) => (o.content ? e.renderChildren(o.content, "") : "").replace(/\n/g, " ").trim()).join(" | ")} |` : "|"), u = `| ${s.map((n) => {
|
|
30
|
+
switch (n) {
|
|
31
|
+
case "left":
|
|
32
|
+
return ":---";
|
|
33
|
+
case "center":
|
|
34
|
+
return ":---:";
|
|
35
|
+
case "right":
|
|
36
|
+
return "---:";
|
|
37
|
+
default:
|
|
38
|
+
return "---";
|
|
39
|
+
}
|
|
40
|
+
}).join(" | ")} |`;
|
|
41
|
+
return a.length > 0 ? [a[0], u, ...a.slice(1)].join(`
|
|
42
|
+
`) : a.join(`
|
|
43
|
+
`);
|
|
44
|
+
}
|
|
45
|
+
const C = w.extend({
|
|
46
|
+
// Register markdown name for token matching
|
|
47
|
+
name: "table",
|
|
48
|
+
addStorage() {
|
|
49
|
+
return {
|
|
50
|
+
...this.parent?.(),
|
|
51
|
+
// Mark this extension as markdown-aware
|
|
52
|
+
markdown: {
|
|
53
|
+
parse: x,
|
|
54
|
+
serialize: b
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
// Add markdown parsing support
|
|
59
|
+
// @ts-expect-error - parseMarkdown is a @tiptap/markdown extension point
|
|
60
|
+
parseMarkdown(t, e) {
|
|
61
|
+
return t.type !== "table" ? null : x(t, e);
|
|
62
|
+
},
|
|
63
|
+
// Add markdown rendering support
|
|
64
|
+
// @ts-expect-error - renderMarkdown is a @tiptap/markdown extension point
|
|
65
|
+
renderMarkdown(t, e, l) {
|
|
66
|
+
return b(t, e);
|
|
67
|
+
}
|
|
68
|
+
}), M = A.extend({
|
|
69
|
+
addAttributes() {
|
|
70
|
+
return {
|
|
71
|
+
...this.parent?.(),
|
|
72
|
+
textAlign: {
|
|
73
|
+
default: null,
|
|
74
|
+
parseHTML: (t) => t.style.textAlign || null,
|
|
75
|
+
renderHTML: (t) => t.textAlign ? { style: `text-align: ${t.textAlign}` } : {}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}), N = T.extend({
|
|
80
|
+
addAttributes() {
|
|
81
|
+
return {
|
|
82
|
+
...this.parent?.(),
|
|
83
|
+
textAlign: {
|
|
84
|
+
default: null,
|
|
85
|
+
parseHTML: (t) => t.style.textAlign || null,
|
|
86
|
+
renderHTML: (t) => t.textAlign ? { style: `text-align: ${t.textAlign}` } : {}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
10
91
|
export {
|
|
11
|
-
|
|
92
|
+
C as VizelTable,
|
|
93
|
+
M as VizelTableCell,
|
|
94
|
+
N as VizelTableHeader
|
|
12
95
|
};
|
package/dist/index34.js
CHANGED
|
@@ -1,19 +1,66 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Mark as d, mergeAttributes as a } from "@tiptap/core";
|
|
2
|
+
var s = d.create({
|
|
3
|
+
name: "underline",
|
|
4
|
+
addOptions() {
|
|
5
|
+
return {
|
|
6
|
+
HTMLAttributes: {}
|
|
7
|
+
};
|
|
8
|
+
},
|
|
9
|
+
parseHTML() {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
tag: "u"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
style: "text-decoration",
|
|
16
|
+
consuming: !1,
|
|
17
|
+
getAttrs: (e) => e.includes("underline") ? {} : !1
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
},
|
|
21
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
22
|
+
return ["u", a(this.options.HTMLAttributes, e), 0];
|
|
23
|
+
},
|
|
24
|
+
parseMarkdown(e, n) {
|
|
25
|
+
return n.applyMark(this.name || "underline", n.parseInline(e.tokens || []));
|
|
26
|
+
},
|
|
27
|
+
renderMarkdown(e, n) {
|
|
28
|
+
return `++${n.renderChildren(e)}++`;
|
|
29
|
+
},
|
|
30
|
+
markdownTokenizer: {
|
|
31
|
+
name: "underline",
|
|
32
|
+
level: "inline",
|
|
33
|
+
start(e) {
|
|
34
|
+
return e.indexOf("++");
|
|
35
|
+
},
|
|
36
|
+
tokenize(e, n, i) {
|
|
37
|
+
const r = /^(\+\+)([\s\S]+?)(\+\+)/.exec(e);
|
|
38
|
+
if (!r)
|
|
39
|
+
return;
|
|
40
|
+
const t = r[2].trim();
|
|
41
|
+
return {
|
|
42
|
+
type: "underline",
|
|
43
|
+
raw: r[0],
|
|
44
|
+
text: t,
|
|
45
|
+
tokens: i.inlineTokens(t)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
addCommands() {
|
|
50
|
+
return {
|
|
51
|
+
setUnderline: () => ({ commands: e }) => e.setMark(this.name),
|
|
52
|
+
toggleUnderline: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
53
|
+
unsetUnderline: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
addKeyboardShortcuts() {
|
|
57
|
+
return {
|
|
58
|
+
"Mod-u": () => this.editor.commands.toggleUnderline(),
|
|
59
|
+
"Mod-U": () => this.editor.commands.toggleUnderline()
|
|
60
|
+
};
|
|
8
61
|
}
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
function g(r, o) {
|
|
12
|
-
if (r.icons[o]) return i(r, o, []);
|
|
13
|
-
const n = f(r, [o])[o];
|
|
14
|
-
return n ? i(r, o, n) : null;
|
|
15
|
-
}
|
|
62
|
+
}), l = s;
|
|
16
63
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
64
|
+
s as Underline,
|
|
65
|
+
l as default
|
|
19
66
|
};
|