@vizel/core 0.0.1-alpha.1 → 0.0.1-alpha.2

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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.ts +13 -13
  3. package/dist/index.js +141 -141
  4. package/dist/index10.js +70 -110
  5. package/dist/index11.js +135 -168
  6. package/dist/index12.js +83 -74
  7. package/dist/index13.js +13 -134
  8. package/dist/index14.js +13 -146
  9. package/dist/index15.js +303 -15
  10. package/dist/index16.js +69 -14
  11. package/dist/index17.js +26 -295
  12. package/dist/index18.js +2 -2
  13. package/dist/index19.js +355 -24
  14. package/dist/index20.js +25 -264
  15. package/dist/index21.js +85 -68
  16. package/dist/index22.js +97 -353
  17. package/dist/index23.js +66 -84
  18. package/dist/index24.js +12 -36
  19. package/dist/index25.js +53 -92
  20. package/dist/index26.js +132 -96
  21. package/dist/index27.js +59 -126
  22. package/dist/index28.js +37 -53
  23. package/dist/index29.js +19 -62
  24. package/dist/index3.js +165 -60
  25. package/dist/index30.js +9 -37
  26. package/dist/index31.js +143 -19
  27. package/dist/index32.js +264 -11
  28. package/dist/index33.js +92 -9
  29. package/dist/index36.js +1 -1
  30. package/dist/index37.js +41 -57
  31. package/dist/index38.js +64 -4
  32. package/dist/index39.js +4 -123
  33. package/dist/index4.js +10 -86
  34. package/dist/index40.js +111 -315
  35. package/dist/index41.js +321 -481
  36. package/dist/index42.js +481 -42
  37. package/dist/index43.js +143 -138
  38. package/dist/index44.js +1 -1
  39. package/dist/index45.js +1 -1
  40. package/dist/index46.js +1 -1
  41. package/dist/index48.js +3 -3
  42. package/dist/index49.js +158 -1458
  43. package/dist/index5.js +132 -10
  44. package/dist/index50.js +1561 -5
  45. package/dist/index51.js +1408 -1467
  46. package/dist/index52.js +704 -183
  47. package/dist/index53.js +5 -723
  48. package/dist/index6.js +48 -131
  49. package/dist/index61.js +1 -1
  50. package/dist/index62.js +1 -1
  51. package/dist/index65.js +1 -1
  52. package/dist/index66.js +53 -1059
  53. package/dist/index67.js +1059 -53
  54. package/dist/index69.js +90 -3
  55. package/dist/index7.js +228 -409
  56. package/dist/index70.js +3 -90
  57. package/dist/index8.js +111 -45
  58. package/dist/index9.js +409 -228
  59. package/package.json +54 -80
package/dist/index21.js CHANGED
@@ -1,72 +1,89 @@
1
- const a = [
2
- {
3
- name: "paragraph",
4
- label: "Text",
5
- icon: "paragraph",
6
- isActive: (e) => e.isActive("paragraph") && !e.isActive("bulletList") && !e.isActive("orderedList") && !e.isActive("taskList"),
7
- command: (e) => e.chain().focus().setParagraph().run()
8
- },
9
- {
10
- name: "heading1",
11
- label: "Heading 1",
12
- icon: "heading1",
13
- isActive: (e) => e.isActive("heading", { level: 1 }),
14
- command: (e) => e.chain().focus().setHeading({ level: 1 }).run()
15
- },
16
- {
17
- name: "heading2",
18
- label: "Heading 2",
19
- icon: "heading2",
20
- isActive: (e) => e.isActive("heading", { level: 2 }),
21
- command: (e) => e.chain().focus().setHeading({ level: 2 }).run()
22
- },
23
- {
24
- name: "heading3",
25
- label: "Heading 3",
26
- icon: "heading3",
27
- isActive: (e) => e.isActive("heading", { level: 3 }),
28
- command: (e) => e.chain().focus().setHeading({ level: 3 }).run()
29
- },
30
- {
31
- name: "bulletList",
32
- label: "Bullet List",
33
- icon: "bulletList",
34
- isActive: (e) => e.isActive("bulletList"),
35
- command: (e) => e.chain().focus().toggleBulletList().run()
36
- },
37
- {
38
- name: "orderedList",
39
- label: "Numbered List",
40
- icon: "orderedList",
41
- isActive: (e) => e.isActive("orderedList"),
42
- command: (e) => e.chain().focus().toggleOrderedList().run()
43
- },
44
- {
45
- name: "taskList",
46
- label: "Task List",
47
- icon: "taskList",
48
- isActive: (e) => e.isActive("taskList"),
49
- command: (e) => e.chain().focus().toggleTaskList().run()
50
- },
51
- {
52
- name: "blockquote",
53
- label: "Quote",
54
- icon: "blockquote",
55
- isActive: (e) => e.isActive("blockquote"),
56
- command: (e) => e.chain().focus().toggleBlockquote().run()
57
- },
58
- {
59
- name: "codeBlock",
60
- label: "Code",
61
- icon: "codeBlock",
62
- isActive: (e) => e.isActive("codeBlock"),
63
- command: (e) => e.chain().focus().toggleCodeBlock().run()
1
+ import { TextStyle as t, Color as l } from "./index46.js";
2
+ import { Highlight as i } from "./index47.js";
3
+ const h = [
4
+ // Row 1: Grayscale
5
+ { name: "Default", color: "inherit" },
6
+ { name: "Dark Gray", color: "#374151" },
7
+ { name: "Gray", color: "#6b7280" },
8
+ { name: "Light Gray", color: "#9ca3af" },
9
+ // Row 2: Warm colors
10
+ { name: "Dark Red", color: "#b91c1c" },
11
+ { name: "Red", color: "#ef4444" },
12
+ { name: "Orange", color: "#f97316" },
13
+ { name: "Amber", color: "#f59e0b" },
14
+ // Row 3: Cool colors
15
+ { name: "Yellow", color: "#eab308" },
16
+ { name: "Lime", color: "#84cc16" },
17
+ { name: "Green", color: "#22c55e" },
18
+ { name: "Emerald", color: "#10b981" },
19
+ // Row 4: Blue spectrum
20
+ { name: "Teal", color: "#14b8a6" },
21
+ { name: "Cyan", color: "#06b6d4" },
22
+ { name: "Blue", color: "#3b82f6" },
23
+ { name: "Indigo", color: "#6366f1" },
24
+ // Row 5: Purple/Pink spectrum
25
+ { name: "Violet", color: "#8b5cf6" },
26
+ { name: "Purple", color: "#a855f7" },
27
+ { name: "Fuchsia", color: "#d946ef" },
28
+ { name: "Pink", color: "#ec4899" }
29
+ ], s = [
30
+ // Row 1: Basics
31
+ { name: "None", color: "transparent" },
32
+ { name: "Light Gray", color: "#e5e7eb" },
33
+ { name: "Warm Gray", color: "#e7e5e4" },
34
+ { name: "Cool Gray", color: "#e2e8f0" },
35
+ // Row 2: Warm highlights
36
+ { name: "Light Red", color: "#fecaca" },
37
+ { name: "Light Orange", color: "#fed7aa" },
38
+ { name: "Light Amber", color: "#fde68a" },
39
+ { name: "Yellow", color: "#fef08a" },
40
+ // Row 3: Green highlights
41
+ { name: "Light Lime", color: "#d9f99d" },
42
+ { name: "Light Green", color: "#bbf7d0" },
43
+ { name: "Light Emerald", color: "#a7f3d0" },
44
+ { name: "Light Teal", color: "#99f6e4" },
45
+ // Row 4: Blue highlights
46
+ { name: "Light Cyan", color: "#a5f3fc" },
47
+ { name: "Light Blue", color: "#bfdbfe" },
48
+ { name: "Light Indigo", color: "#c7d2fe" },
49
+ { name: "Light Violet", color: "#ddd6fe" },
50
+ // Row 5: Purple/Pink highlights
51
+ { name: "Light Purple", color: "#e9d5ff" },
52
+ { name: "Light Fuchsia", color: "#f5d0fe" },
53
+ { name: "Light Pink", color: "#fbcfe8" },
54
+ { name: "Light Rose", color: "#fecdd3" }
55
+ ], r = "vizel-recent-colors", m = 8;
56
+ function f(o) {
57
+ if (typeof window > "u") return [];
58
+ try {
59
+ const e = localStorage.getItem(`${r}-${o}`);
60
+ return e ? JSON.parse(e) : [];
61
+ } catch {
62
+ return [];
64
63
  }
65
- ];
66
- function t(e, i = a) {
67
- return i.find((c) => c.isActive(e));
64
+ }
65
+ function u(o, e) {
66
+ if (!(typeof window > "u") && !(e === "inherit" || e === "transparent"))
67
+ try {
68
+ const n = f(o).filter((c) => c !== e), a = [e, ...n].slice(0, m);
69
+ localStorage.setItem(`${r}-${o}`, JSON.stringify(a));
70
+ } catch {
71
+ }
72
+ }
73
+ function b(o = {}) {
74
+ const { multicolor: e = !0 } = o;
75
+ return [
76
+ t,
77
+ l,
78
+ i.configure({
79
+ multicolor: e
80
+ })
81
+ ];
68
82
  }
69
83
  export {
70
- t as getVizelActiveNodeType,
71
- a as vizelDefaultNodeTypes
84
+ s as VIZEL_HIGHLIGHT_COLORS,
85
+ h as VIZEL_TEXT_COLORS,
86
+ u as addVizelRecentColor,
87
+ b as createVizelTextColorExtensions,
88
+ f as getVizelRecentColors
72
89
  };
package/dist/index22.js CHANGED
@@ -1,360 +1,104 @@
1
- import { renderVizelIcon as E } from "./index26.js";
2
- import { VizelTable as G } from "./index25.js";
3
- const P = [
4
- { label: "Add row above", icon: "arrowUp", command: "addRowBefore" },
5
- { label: "Add row below", icon: "arrowDown", command: "addRowAfter" },
6
- { label: "Delete row", command: "deleteRow", destructive: !0 },
7
- { divider: !0, label: "", command: "" },
8
- { label: "Toggle header row", command: "toggleHeaderRow" },
9
- { divider: !0, label: "", command: "" },
10
- { label: "Delete table", command: "deleteTable", destructive: !0 }
11
- ], Y = [
12
- { label: "Add column left", icon: "arrowLeft", command: "addColumnBefore" },
13
- { label: "Add column right", icon: "arrowRight", command: "addColumnAfter" },
14
- { label: "Delete column", command: "deleteColumn", destructive: !0 },
15
- { divider: !0, label: "", command: "" },
16
- { label: "Toggle header column", command: "toggleHeaderColumn" }
17
- ];
18
- function J(e, c) {
19
- return [
20
- ...Y,
21
- { divider: !0, label: "", command: "" },
22
- // Column-wide alignment (Markdown compatible)
23
- {
24
- label: "Align left",
25
- icon: "alignLeft",
26
- command: (l) => T(l, e, c, "left")
27
- },
28
- {
29
- label: "Align center",
30
- icon: "alignCenter",
31
- command: (l) => T(l, e, c, "center")
32
- },
33
- {
34
- label: "Align right",
35
- icon: "alignRight",
36
- command: (l) => T(l, e, c, "right")
37
- },
38
- { divider: !0, label: "", command: "" },
39
- { label: "Delete table", command: "deleteTable", destructive: !0 }
40
- ];
41
- }
42
- const U = [
43
- // Cell operations only (alignment is now column-based for Markdown compatibility)
44
- { label: "Merge cells", command: "mergeCells" },
45
- { label: "Split cell", command: "splitCell" }
46
- ], q = 20, Q = [
47
- ...P.slice(0, 3),
48
- { divider: !0, label: "", command: "" },
49
- ...Y.slice(0, 3),
50
- { divider: !0, label: "", command: "" },
51
- ...U,
52
- { divider: !0, label: "", command: "" },
53
- { label: "Delete table", command: "deleteTable", destructive: !0 }
54
- ];
55
- function ee(e, c, l) {
56
- const r = e.querySelector("tr");
57
- if (!r) return null;
58
- const d = r.querySelectorAll("td, th");
59
- if (d.length === 0) return null;
60
- const t = [], o = d[0];
61
- if (!o) return null;
62
- const s = o.getBoundingClientRect();
63
- t.push({ index: 0, position: s.left - l.left }), d.forEach((h, v) => {
64
- const g = h.getBoundingClientRect();
65
- t.push({ index: v + 1, position: g.right - l.left });
66
- });
67
- const m = c - l.left, a = t[0];
68
- if (!a) return null;
69
- let u = a, p = Math.abs(m - u.position);
70
- for (const h of t) {
71
- const v = Math.abs(m - h.position);
72
- v < p && (p = v, u = h);
73
- }
74
- return p <= q ? u : null;
75
- }
76
- function te(e, c, l) {
77
- const r = e.querySelectorAll("tr");
78
- if (r.length === 0) return null;
79
- const d = [], t = r[0];
80
- if (!t) return null;
81
- const o = t.getBoundingClientRect();
82
- d.push({ index: 0, position: o.top - l.top }), r.forEach((p, h) => {
83
- const v = p.getBoundingClientRect();
84
- d.push({ index: h + 1, position: v.bottom - l.top });
85
- });
86
- const s = c - l.top, m = d[0];
87
- if (!m) return null;
88
- let a = m, u = Math.abs(s - a.position);
89
- for (const p of d) {
90
- const h = Math.abs(s - p.position);
91
- h < u && (u = h, a = p);
92
- }
93
- return u <= q ? a : null;
94
- }
95
- function ne(e, c) {
96
- const l = e.querySelectorAll("tr");
97
- for (let r = 0; r < l.length; r++) {
98
- const d = l[r], t = d.getBoundingClientRect();
99
- if (c >= t.top && c <= t.bottom)
100
- return { index: r, element: d };
101
- }
102
- return null;
103
- }
104
- function oe(e, c, l) {
105
- const r = e.querySelector("tr");
106
- if (!r) return null;
107
- const d = r.querySelectorAll("td, th");
108
- if (d.length === 0) return null;
109
- for (let t = 0; t < d.length; t++) {
110
- const s = d[t].getBoundingClientRect();
111
- if (c >= s.left && c <= s.right) {
112
- const m = s.left + s.width / 2 - l.left;
113
- return { index: t, centerX: m };
114
- }
115
- }
116
- return null;
117
- }
118
- function X(e, c, l) {
119
- const { state: r } = e, d = r.doc.nodeAt(c);
120
- if (!d) return;
121
- let t = c + 1;
122
- for (let o = 0; o < d.childCount; o++) {
123
- const s = d.child(o);
124
- if (o === l) {
125
- const m = t + 1;
126
- e.chain().focus().setTextSelection(m + 1).run();
127
- return;
128
- }
129
- t += s.nodeSize;
130
- }
131
- }
132
- function O(e, c, l) {
133
- const { state: r } = e, d = r.doc.nodeAt(c);
134
- if (!d || d.childCount === 0) return;
135
- const t = d.child(0);
136
- let o = c + 2;
137
- for (let s = 0; s < t.childCount; s++) {
138
- if (s === l || l > t.childCount && s === t.childCount - 1) {
139
- e.chain().focus().setTextSelection(o + 1).run();
140
- return;
141
- }
142
- o += t.child(s).nodeSize;
143
- }
144
- if (l === 0 && t.childCount > 0) {
145
- const s = c + 3;
146
- e.chain().focus().setTextSelection(s).run();
147
- }
1
+ import { getIconData as g } from "./index34.js";
2
+ import { iconToSVG as h } from "./index35.js";
3
+ import s from "./index36.js";
4
+ const u = {
5
+ // Text/Headings
6
+ heading1: "lucide:heading-1",
7
+ heading2: "lucide:heading-2",
8
+ heading3: "lucide:heading-3",
9
+ // Lists
10
+ bulletList: "lucide:list",
11
+ orderedList: "lucide:list-ordered",
12
+ taskList: "lucide:list-checks",
13
+ // Blocks
14
+ paragraph: "lucide:pilcrow",
15
+ blockquote: "lucide:quote",
16
+ horizontalRule: "lucide:minus",
17
+ details: "lucide:chevron-right",
18
+ codeBlock: "lucide:code",
19
+ table: "lucide:table",
20
+ // Media
21
+ image: "lucide:image",
22
+ imageUpload: "lucide:image-up",
23
+ embed: "lucide:link",
24
+ // Advanced
25
+ mathBlock: "lucide:sigma",
26
+ mathInline: "lucide:superscript",
27
+ mermaid: "lucide:git-graph",
28
+ graphviz: "lucide:workflow",
29
+ // Table controls
30
+ arrowUp: "lucide:arrow-up",
31
+ arrowDown: "lucide:arrow-down",
32
+ arrowLeft: "lucide:arrow-left",
33
+ arrowRight: "lucide:arrow-right",
34
+ alignLeft: "lucide:align-left",
35
+ alignCenter: "lucide:align-center",
36
+ alignRight: "lucide:align-right",
37
+ plus: "lucide:plus",
38
+ gripVertical: "lucide:grip-vertical",
39
+ gripHorizontal: "lucide:grip-horizontal",
40
+ // UI
41
+ check: "lucide:check",
42
+ loader: "lucide:loader-2",
43
+ circle: "lucide:circle",
44
+ warning: "lucide:alert-triangle",
45
+ chevronDown: "lucide:chevron-down",
46
+ x: "lucide:x",
47
+ // BubbleMenu toolbar
48
+ bold: "lucide:bold",
49
+ italic: "lucide:italic",
50
+ strikethrough: "lucide:strikethrough",
51
+ underline: "lucide:underline",
52
+ code: "lucide:code",
53
+ link: "lucide:link",
54
+ textColor: "lucide:baseline",
55
+ highlighter: "lucide:highlighter",
56
+ // Internal (NodeView rendering)
57
+ grip: "lucide:grip-vertical",
58
+ plusSmall: "lucide:plus",
59
+ listOrdered: "lucide:list-ordered"
60
+ };
61
+ function k(e, i) {
62
+ return i?.[e] ?? u[e];
148
63
  }
149
- function le(e) {
150
- try {
151
- const { selection: c } = e.state, l = c.$from;
152
- for (let r = l.depth; r > 0; r--)
153
- if (l.node(r).type.name === "table")
154
- return l.before(r);
155
- } catch {
156
- }
64
+ let t = null;
65
+ function w(e) {
66
+ t = e;
157
67
  }
158
- function x(e, c) {
159
- let l = typeof e == "function" ? e() : void 0;
160
- return l === void 0 && (l = le(c)), l;
68
+ function z(e, i) {
69
+ return t ? t(e, i) : (process.env.NODE_ENV === "development" && console.warn(
70
+ "[Vizel] Icon renderer not set. Call setVizelIconRenderer() from your framework package (@vizel/react, @vizel/vue, or @vizel/svelte)."
71
+ ), "");
161
72
  }
162
- function T(e, c, l, r) {
163
- const { state: d, view: t } = e, o = d.doc.nodeAt(c);
164
- if (!o) return;
165
- const { tr: s } = d;
166
- let m = c + 1;
167
- for (let a = 0; a < o.childCount; a++) {
168
- const u = o.child(a);
169
- let p = m + 1;
170
- for (let h = 0; h < u.childCount; h++) {
171
- const v = u.child(h);
172
- if (h === l) {
173
- s.setNodeMarkup(p, void 0, {
174
- ...v.attrs,
175
- textAlign: r
176
- });
177
- break;
178
- }
179
- p += v.nodeSize;
180
- }
181
- m += u.nodeSize;
182
- }
183
- t.dispatch(s);
73
+ function p(e, i) {
74
+ const c = u[e];
75
+ if (!c) return "";
76
+ const [, d] = c.split(":");
77
+ if (!d) return "";
78
+ const l = g(s, d);
79
+ if (!l) return "";
80
+ const r = h(l, {
81
+ height: i?.height ?? 24,
82
+ width: i?.width ?? 24
83
+ }), n = [
84
+ 'xmlns="http://www.w3.org/2000/svg"',
85
+ `width="${i?.width ?? 24}"`,
86
+ `height="${i?.height ?? 24}"`,
87
+ `viewBox="0 0 ${l.width ?? 24} ${l.height ?? 24}"`
88
+ ];
89
+ if (r.attributes)
90
+ for (const [o, a] of Object.entries(r.attributes))
91
+ ["width", "height", "viewBox"].includes(o) || n.push(`${o}="${a}"`);
92
+ return `<svg ${n.join(" ")}>${r.body}</svg>`;
184
93
  }
185
- function A(e, c, l = Q) {
186
- const r = document.createElement("div");
187
- r.className = "vizel-table-menu", r.setAttribute("data-vizel-table-menu", "");
188
- for (const o of l) {
189
- if (o.divider) {
190
- const a = document.createElement("div");
191
- a.className = "vizel-table-menu-divider", r.appendChild(a);
192
- continue;
193
- }
194
- const s = document.createElement("button");
195
- if (s.className = "vizel-table-menu-item", o.destructive && s.classList.add("is-destructive"), s.type = "button", o.icon) {
196
- const a = document.createElement("span");
197
- a.className = "vizel-table-menu-item-icon", a.innerHTML = E(o.icon, {
198
- width: 16,
199
- height: 16
200
- }), s.appendChild(a);
201
- }
202
- const m = document.createElement("span");
203
- m.className = "vizel-table-menu-item-label", m.textContent = o.label, s.appendChild(m), s.addEventListener("click", (a) => {
204
- if (a.preventDefault(), a.stopPropagation(), typeof o.command == "function")
205
- o.command(e);
206
- else {
207
- const u = e.commands[o.command];
208
- typeof u == "function" && u();
209
- }
210
- c();
211
- }), r.appendChild(s);
212
- }
213
- const d = (o) => {
214
- r.contains(o.target) || (c(), document.removeEventListener("click", d));
215
- };
216
- setTimeout(() => {
217
- document.addEventListener("click", d);
218
- }, 0);
219
- const t = (o) => {
220
- o.key === "Escape" && (c(), document.removeEventListener("keydown", t));
221
- };
222
- return document.addEventListener("keydown", t), r;
94
+ function I() {
95
+ w(p);
223
96
  }
224
- const re = G.extend({
225
- name: "table",
226
- addOptions() {
227
- return {
228
- ...this.parent?.(),
229
- showColumnInsert: !0,
230
- showRowInsert: !0,
231
- showRowHandle: !0
232
- };
233
- },
234
- addNodeView() {
235
- return ({ editor: e, getPos: c }) => {
236
- const { showColumnInsert: l = !0, showRowInsert: r = !0, showRowHandle: d = !0 } = this.options, t = document.createElement("div");
237
- t.className = "vizel-table-controls-wrapper", t.setAttribute("data-vizel-table-controls", "");
238
- const o = document.createElement("table");
239
- o.className = "vizel-table";
240
- const s = document.createElement("tbody");
241
- o.appendChild(s);
242
- const m = document.createElement("button");
243
- m.className = "vizel-table-insert-button vizel-table-column-insert", m.type = "button", m.innerHTML = E("plusSmall", { width: 12, height: 12 }), m.setAttribute("aria-label", "Insert column"), m.title = "Insert column", m.style.left = "32px", m.style.top = "6px";
244
- const a = document.createElement("button");
245
- a.className = "vizel-table-insert-button vizel-table-row-insert", a.type = "button", a.innerHTML = E("plusSmall", { width: 12, height: 12 }), a.setAttribute("aria-label", "Insert row"), a.title = "Insert row", a.style.left = "6px", a.style.top = "32px";
246
- const u = document.createElement("button");
247
- u.className = "vizel-table-row-handle", u.type = "button", u.innerHTML = E("grip", { width: 12, height: 12 }), u.setAttribute("aria-label", "Table row options"), u.title = "Row options (delete, align, etc.)", u.style.left = "4px", u.style.top = "44px";
248
- const p = document.createElement("button");
249
- p.className = "vizel-table-column-handle", p.type = "button", p.innerHTML = E("gripHorizontal", { width: 12, height: 12 }), p.setAttribute("aria-label", "Table column options"), p.title = "Column options (delete, align, etc.)", p.style.left = "80px", p.style.top = "4px";
250
- let h = null, v = null, g = null, L = null, M = null;
251
- const C = () => {
252
- h && (h.remove(), h = null);
253
- }, B = (n) => {
254
- if (n.preventDefault(), n.stopPropagation(), !e.isEditable || v == null) return;
255
- const f = x(c, e);
256
- f != null && (O(e, f, Math.max(0, v.index - 1)), v.index === 0 ? e.chain().focus().addColumnBefore().run() : e.chain().focus().addColumnAfter().run());
257
- };
258
- m.addEventListener("mousedown", B);
259
- const I = (n) => {
260
- if (n.preventDefault(), n.stopPropagation(), !e.isEditable || g == null) return;
261
- const f = x(c, e);
262
- f != null && (X(e, f, Math.max(0, g.index - 1)), g.index === 0 ? e.chain().focus().addRowBefore().run() : e.chain().focus().addRowAfter().run());
263
- };
264
- a.addEventListener("mousedown", I);
265
- const S = (n) => {
266
- n.preventDefault(), n.stopPropagation();
267
- const f = L;
268
- if (!e.isEditable || f == null) return;
269
- const i = x(c, e);
270
- if (i == null) return;
271
- X(e, i, f.index), C();
272
- const b = A(e, C, P), w = u.getBoundingClientRect();
273
- b.style.position = "fixed", b.style.left = `${w.right + 4}px`, b.style.top = `${w.top}px`, document.body.appendChild(b), h = b;
274
- }, z = (n) => {
275
- h && (n.preventDefault(), n.stopPropagation());
276
- };
277
- u.addEventListener("mousedown", S), u.addEventListener("click", z);
278
- const H = (n) => {
279
- n.preventDefault(), n.stopPropagation();
280
- const f = M;
281
- if (!e.isEditable || f == null) return;
282
- const i = x(c, e);
283
- if (i == null) return;
284
- O(e, i, f.index), C();
285
- const b = J(i, f.index), w = A(e, C, b), R = p.getBoundingClientRect();
286
- w.style.position = "fixed", w.style.left = `${R.left}px`, w.style.top = `${R.bottom + 4}px`, document.body.appendChild(w), h = w;
287
- }, D = (n) => {
288
- h && (n.preventDefault(), n.stopPropagation());
289
- };
290
- p.addEventListener("mousedown", H), p.addEventListener("click", D);
291
- let k = 0;
292
- const V = 16, W = (n, f) => {
293
- const i = ee(o, n, f);
294
- i ? (v = i, m.style.left = `${i.position + 32}px`, m.style.top = "6px") : v || (v = { index: 0, position: 0 });
295
- }, F = (n, f) => {
296
- const i = te(o, n, f);
297
- i ? (g = i, a.style.left = "6px", a.style.top = `${i.position + 32}px`) : g || (g = { index: 0, position: 0 });
298
- }, K = (n, f) => {
299
- const i = ne(o, n);
300
- if (i) {
301
- L = i;
302
- const b = i.element.getBoundingClientRect();
303
- u.style.left = "4px", u.style.top = `${b.top - f.top + 32 + (b.height - 24) / 2}px`;
304
- }
305
- }, Z = (n, f) => {
306
- const i = oe(o, n, f);
307
- i && (M = i, p.style.left = `${i.centerX + 32}px`, p.style.top = "4px");
308
- }, N = (n) => {
309
- if (!e.isEditable) return;
310
- const f = Date.now();
311
- if (f - k < V) return;
312
- k = f;
313
- const i = o.getBoundingClientRect(), b = n.clientX >= i.left && n.clientX <= i.right && n.clientY >= i.top && n.clientY <= i.bottom;
314
- l && W(n.clientX, i), r && F(n.clientY, i), d && b && (K(n.clientY, i), Z(n.clientX, i));
315
- }, _ = () => {
316
- setTimeout(() => {
317
- t.matches(":hover") || h || (v = null, g = null, L = null, M = null);
318
- }, 100);
319
- };
320
- t.addEventListener("mousemove", N), t.addEventListener("mouseleave", _);
321
- const $ = (n) => {
322
- const i = n.target.closest("td, th");
323
- if (!(i && e.isEditable)) return;
324
- n.preventDefault(), n.stopPropagation();
325
- const b = i.getBoundingClientRect(), w = b.left + b.width / 2, R = b.top + b.height / 2, j = new MouseEvent("click", {
326
- bubbles: !0,
327
- cancelable: !0,
328
- clientX: w,
329
- clientY: R,
330
- view: window
331
- });
332
- i.dispatchEvent(j), C();
333
- const y = A(e, C, U);
334
- y.style.position = "fixed", y.style.left = `${n.clientX}px`, y.style.top = `${n.clientY}px`, document.body.appendChild(y), h = y;
335
- };
336
- return o.addEventListener("contextmenu", $), t.appendChild(m), t.appendChild(a), t.appendChild(u), t.appendChild(p), t.appendChild(o), {
337
- dom: t,
338
- contentDOM: s,
339
- update: (n) => n.type.name === "table",
340
- // Ignore mutations in the wrapper that are not in the content area (tbody)
341
- // This prevents ProseMirror from re-rendering when buttons are manipulated
342
- ignoreMutation: (n) => {
343
- const f = n.target, i = t.contains(f), b = s.contains(f);
344
- return !!(i && !b);
345
- },
346
- destroy: () => {
347
- t.removeEventListener("mousemove", N), t.removeEventListener("mouseleave", _), o.removeEventListener("contextmenu", $), m.removeEventListener("mousedown", B), a.removeEventListener("mousedown", I), u.removeEventListener("mousedown", S), u.removeEventListener("click", z), p.removeEventListener("mousedown", H), p.removeEventListener("click", D), C();
348
- }
349
- };
350
- };
351
- }
352
- });
353
97
  export {
354
- U as CELL_MENU_ITEMS,
355
- Y as COLUMN_MENU_ITEMS_BASE,
356
- P as ROW_MENU_ITEMS,
357
- Q as VIZEL_TABLE_MENU_ITEMS,
358
- re as VizelTableWithControls,
359
- J as createColumnMenuItems
98
+ k as getVizelIconId,
99
+ I as initVizelIconRenderer,
100
+ z as renderVizelIcon,
101
+ p as renderVizelIconSvg,
102
+ w as setVizelIconRenderer,
103
+ u as vizelDefaultIconIds
360
104
  };