@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.
- 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/index36.js +1 -1
- package/dist/index37.js +41 -57
- package/dist/index38.js +64 -4
- package/dist/index39.js +4 -123
- package/dist/index4.js +10 -86
- package/dist/index40.js +111 -315
- package/dist/index41.js +321 -481
- package/dist/index42.js +481 -42
- package/dist/index43.js +143 -138
- package/dist/index44.js +1 -1
- package/dist/index45.js +1 -1
- package/dist/index46.js +1 -1
- package/dist/index48.js +3 -3
- package/dist/index49.js +158 -1458
- package/dist/index5.js +132 -10
- package/dist/index50.js +1561 -5
- package/dist/index51.js +1408 -1467
- package/dist/index52.js +704 -183
- package/dist/index53.js +5 -723
- package/dist/index6.js +48 -131
- package/dist/index61.js +1 -1
- package/dist/index62.js +1 -1
- package/dist/index65.js +1 -1
- 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/index21.js
CHANGED
|
@@ -1,72 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
67
|
-
|
|
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
|
-
|
|
71
|
-
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
|
159
|
-
|
|
160
|
-
|
|
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
|
|
163
|
-
const
|
|
164
|
-
if (!
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
|
186
|
-
|
|
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
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
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
|
};
|