@vizel/core 0.0.1-alpha.5 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.css +1 -1
- package/dist/components.css.map +1 -1
- package/dist/index.d.ts +230 -15
- package/dist/index.js +78 -75
- package/dist/index10.js +1 -1
- package/dist/index11.js +4 -4
- package/dist/index14.js +1 -1
- package/dist/index15.js +134 -127
- package/dist/index17.js +2 -2
- package/dist/index18.js +1 -1
- package/dist/index19.js +86 -86
- package/dist/index20.js +2 -2
- package/dist/index21.js +2 -2
- package/dist/index22.js +16 -13
- package/dist/index24.js +164 -11
- package/dist/index25.js +12 -53
- package/dist/index26.js +49 -136
- package/dist/index27.js +132 -59
- package/dist/index28.js +66 -32
- package/dist/index29.js +35 -21
- package/dist/index3.js +91 -90
- package/dist/index30.js +23 -9
- package/dist/index31.js +9 -147
- package/dist/index32.js +138 -256
- package/dist/index33.js +258 -85
- package/dist/index34.js +84 -55
- package/dist/index35.js +64 -4
- package/dist/index36.js +4 -123
- package/dist/index37.js +111 -315
- package/dist/index38.js +321 -481
- package/dist/index39.js +12 -47
- package/dist/index4.js +1 -1
- package/dist/index40.js +463 -655
- package/dist/index41.js +48 -4
- package/dist/index42.js +694 -4
- package/dist/index43.js +4 -238
- package/dist/index44.js +4 -82
- package/dist/index45.js +237 -16
- package/dist/index46.js +81 -57
- package/dist/index47.js +17 -15
- package/dist/index48.js +57 -285
- package/dist/index49.js +15 -202
- package/dist/index5.js +78 -68
- package/dist/index50.js +281 -1497
- package/dist/index51.js +202 -5
- package/dist/index52.js +1408 -1467
- package/dist/index53.js +5 -723
- package/dist/index54.js +1109 -81
- package/dist/index55.js +703 -226
- package/dist/index56.js +84 -3
- package/dist/index57.js +219 -1205
- package/dist/index58.js +3 -734
- package/dist/index59.js +1232 -21
- package/dist/index6.js +1 -1
- package/dist/index60.js +734 -10
- package/dist/index61.js +21 -7
- package/dist/index62.js +10 -8
- package/dist/index63.js +6 -13
- package/dist/index64.js +7 -18
- package/dist/index65.js +12 -23
- package/dist/index66.js +17 -53
- package/dist/index67.js +23 -1059
- package/dist/index68.js +54 -90
- package/dist/index69.js +1061 -98
- package/dist/index7.js +108 -96
- package/dist/index70.js +98 -4
- package/dist/index71.js +93 -0
- package/dist/index72.js +6 -0
- package/dist/index8.js +1 -1
- package/dist/index9.js +75 -65
- package/dist/mathematics.css +1 -0
- package/dist/mathematics.css.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +90 -52
package/dist/index19.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { renderVizelIcon as E } from "./index22.js";
|
|
2
|
-
import { VizelTable as
|
|
3
|
-
const
|
|
2
|
+
import { VizelTable as Q } from "./index34.js";
|
|
3
|
+
const U = [
|
|
4
4
|
{ label: "Add row above", icon: "arrowUp", command: "addRowBefore" },
|
|
5
5
|
{ label: "Add row below", icon: "arrowDown", command: "addRowAfter" },
|
|
6
6
|
{ label: "Delete row", command: "deleteRow", destructive: !0 },
|
|
@@ -8,51 +8,51 @@ const P = [
|
|
|
8
8
|
{ label: "Toggle header row", command: "toggleHeaderRow" },
|
|
9
9
|
{ divider: !0, label: "", command: "" },
|
|
10
10
|
{ label: "Delete table", command: "deleteTable", destructive: !0 }
|
|
11
|
-
],
|
|
11
|
+
], q = [
|
|
12
12
|
{ label: "Add column left", icon: "arrowLeft", command: "addColumnBefore" },
|
|
13
13
|
{ label: "Add column right", icon: "arrowRight", command: "addColumnAfter" },
|
|
14
14
|
{ label: "Delete column", command: "deleteColumn", destructive: !0 },
|
|
15
15
|
{ divider: !0, label: "", command: "" },
|
|
16
16
|
{ label: "Toggle header column", command: "toggleHeaderColumn" }
|
|
17
17
|
];
|
|
18
|
-
function
|
|
18
|
+
function ee(e, c) {
|
|
19
19
|
return [
|
|
20
|
-
...
|
|
20
|
+
...q,
|
|
21
21
|
{ divider: !0, label: "", command: "" },
|
|
22
22
|
// Column-wide alignment (Markdown compatible)
|
|
23
23
|
{
|
|
24
24
|
label: "Align left",
|
|
25
25
|
icon: "alignLeft",
|
|
26
|
-
command: (l) =>
|
|
26
|
+
command: (l) => I(l, e, c, "left")
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
label: "Align center",
|
|
30
30
|
icon: "alignCenter",
|
|
31
|
-
command: (l) =>
|
|
31
|
+
command: (l) => I(l, e, c, "center")
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
label: "Align right",
|
|
35
35
|
icon: "alignRight",
|
|
36
|
-
command: (l) =>
|
|
36
|
+
command: (l) => I(l, e, c, "right")
|
|
37
37
|
},
|
|
38
38
|
{ divider: !0, label: "", command: "" },
|
|
39
39
|
{ label: "Delete table", command: "deleteTable", destructive: !0 }
|
|
40
40
|
];
|
|
41
41
|
}
|
|
42
|
-
const
|
|
42
|
+
const V = [
|
|
43
43
|
// Cell operations only (alignment is now column-based for Markdown compatibility)
|
|
44
44
|
{ label: "Merge cells", command: "mergeCells" },
|
|
45
45
|
{ label: "Split cell", command: "splitCell" }
|
|
46
|
-
],
|
|
47
|
-
...
|
|
46
|
+
], W = 20, x = 20, A = 24, te = [
|
|
47
|
+
...U.slice(0, 3),
|
|
48
48
|
{ divider: !0, label: "", command: "" },
|
|
49
|
-
...
|
|
49
|
+
...q.slice(0, 3),
|
|
50
50
|
{ divider: !0, label: "", command: "" },
|
|
51
|
-
...
|
|
51
|
+
...V,
|
|
52
52
|
{ divider: !0, label: "", command: "" },
|
|
53
53
|
{ label: "Delete table", command: "deleteTable", destructive: !0 }
|
|
54
54
|
];
|
|
55
|
-
function
|
|
55
|
+
function ne(e, c, l) {
|
|
56
56
|
const r = e.querySelector("tr");
|
|
57
57
|
if (!r) return null;
|
|
58
58
|
const d = r.querySelectorAll("td, th");
|
|
@@ -71,9 +71,9 @@ function ee(e, c, l) {
|
|
|
71
71
|
const v = Math.abs(m - h.position);
|
|
72
72
|
v < p && (p = v, u = h);
|
|
73
73
|
}
|
|
74
|
-
return p <=
|
|
74
|
+
return p <= W ? u : null;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function oe(e, c, l) {
|
|
77
77
|
const r = e.querySelectorAll("tr");
|
|
78
78
|
if (r.length === 0) return null;
|
|
79
79
|
const d = [], t = r[0];
|
|
@@ -90,9 +90,9 @@ function te(e, c, l) {
|
|
|
90
90
|
const h = Math.abs(s - p.position);
|
|
91
91
|
h < u && (u = h, a = p);
|
|
92
92
|
}
|
|
93
|
-
return u <=
|
|
93
|
+
return u <= W ? a : null;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function le(e, c) {
|
|
96
96
|
const l = e.querySelectorAll("tr");
|
|
97
97
|
for (let r = 0; r < l.length; r++) {
|
|
98
98
|
const d = l[r], t = d.getBoundingClientRect();
|
|
@@ -101,7 +101,7 @@ function ne(e, c) {
|
|
|
101
101
|
}
|
|
102
102
|
return null;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function ie(e, c, l) {
|
|
105
105
|
const r = e.querySelector("tr");
|
|
106
106
|
if (!r) return null;
|
|
107
107
|
const d = r.querySelectorAll("td, th");
|
|
@@ -115,7 +115,7 @@ function oe(e, c, l) {
|
|
|
115
115
|
}
|
|
116
116
|
return null;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function O(e, c, l) {
|
|
119
119
|
const { state: r } = e, d = r.doc.nodeAt(c);
|
|
120
120
|
if (!d) return;
|
|
121
121
|
let t = c + 1;
|
|
@@ -129,7 +129,7 @@ function X(e, c, l) {
|
|
|
129
129
|
t += s.nodeSize;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Y(e, c, l) {
|
|
133
133
|
const { state: r } = e, d = r.doc.nodeAt(c);
|
|
134
134
|
if (!d || d.childCount === 0) return;
|
|
135
135
|
const t = d.child(0);
|
|
@@ -146,7 +146,7 @@ function O(e, c, l) {
|
|
|
146
146
|
e.chain().focus().setTextSelection(s).run();
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function ce(e) {
|
|
150
150
|
try {
|
|
151
151
|
const { selection: c } = e.state, l = c.$from;
|
|
152
152
|
for (let r = l.depth; r > 0; r--)
|
|
@@ -155,11 +155,11 @@ function le(e) {
|
|
|
155
155
|
} catch {
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function L(e, c) {
|
|
159
159
|
let l = typeof e == "function" ? e() : void 0;
|
|
160
|
-
return l === void 0 && (l =
|
|
160
|
+
return l === void 0 && (l = ce(c)), l;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function I(e, c, l, r) {
|
|
163
163
|
const { state: d, view: t } = e, o = d.doc.nodeAt(c);
|
|
164
164
|
if (!o) return;
|
|
165
165
|
const { tr: s } = d;
|
|
@@ -182,7 +182,7 @@ function T(e, c, l, r) {
|
|
|
182
182
|
}
|
|
183
183
|
t.dispatch(s);
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function B(e, c, l = te) {
|
|
186
186
|
const r = document.createElement("div");
|
|
187
187
|
r.className = "vizel-table-menu", r.setAttribute("data-vizel-table-menu", "");
|
|
188
188
|
for (const o of l) {
|
|
@@ -221,7 +221,7 @@ function A(e, c, l = Q) {
|
|
|
221
221
|
};
|
|
222
222
|
return document.addEventListener("keydown", t), r;
|
|
223
223
|
}
|
|
224
|
-
const
|
|
224
|
+
const ae = Q.extend({
|
|
225
225
|
name: "table",
|
|
226
226
|
addOptions() {
|
|
227
227
|
return {
|
|
@@ -240,100 +240,100 @@ const re = G.extend({
|
|
|
240
240
|
const s = document.createElement("tbody");
|
|
241
241
|
o.appendChild(s);
|
|
242
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:
|
|
243
|
+
m.className = "vizel-table-insert-button vizel-table-column-insert", m.type = "button", m.innerHTML = E("plusSmall", { width: 10, height: 10 }), m.setAttribute("aria-label", "Insert column"), m.title = "Insert column", m.style.left = `${A}px`, m.style.top = "0px";
|
|
244
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:
|
|
245
|
+
a.className = "vizel-table-insert-button vizel-table-row-insert", a.type = "button", a.innerHTML = E("plusSmall", { width: 10, height: 10 }), a.setAttribute("aria-label", "Insert row"), a.title = "Insert row", a.style.left = "0px", a.style.top = `${x}px`;
|
|
246
246
|
const u = document.createElement("button");
|
|
247
|
-
u.className = "vizel-table-row-handle", u.type = "button", u.innerHTML = E("grip", { width:
|
|
247
|
+
u.className = "vizel-table-row-handle", u.type = "button", u.innerHTML = E("grip", { width: 10, height: 10 }), u.setAttribute("aria-label", "Table row options"), u.title = "Row options (delete, align, etc.)", u.style.left = "2px", u.style.top = `${x + 12}px`;
|
|
248
248
|
const p = document.createElement("button");
|
|
249
|
-
p.className = "vizel-table-column-handle", p.type = "button", p.innerHTML = E("gripHorizontal", { width:
|
|
250
|
-
let h = null, v = null, g = null,
|
|
249
|
+
p.className = "vizel-table-column-handle", p.type = "button", p.innerHTML = E("gripHorizontal", { width: 10, height: 10 }), p.setAttribute("aria-label", "Table column options"), p.title = "Column options (delete, align, etc.)", p.style.left = "64px", p.style.top = "0px";
|
|
250
|
+
let h = null, v = null, g = null, M = null, T = null;
|
|
251
251
|
const C = () => {
|
|
252
252
|
h && (h.remove(), h = null);
|
|
253
|
-
},
|
|
253
|
+
}, D = (n) => {
|
|
254
254
|
if (n.preventDefault(), n.stopPropagation(), !e.isEditable || v == null) return;
|
|
255
|
-
const f =
|
|
256
|
-
f != null && (
|
|
255
|
+
const f = L(c, e);
|
|
256
|
+
f != null && (Y(e, f, Math.max(0, v.index - 1)), v.index === 0 ? e.chain().focus().addColumnBefore().run() : e.chain().focus().addColumnAfter().run());
|
|
257
257
|
};
|
|
258
|
-
m.addEventListener("mousedown",
|
|
259
|
-
const
|
|
258
|
+
m.addEventListener("mousedown", D);
|
|
259
|
+
const S = (n) => {
|
|
260
260
|
if (n.preventDefault(), n.stopPropagation(), !e.isEditable || g == null) return;
|
|
261
|
-
const f =
|
|
262
|
-
f != null && (
|
|
261
|
+
const f = L(c, e);
|
|
262
|
+
f != null && (O(e, f, Math.max(0, g.index - 1)), g.index === 0 ? e.chain().focus().addRowBefore().run() : e.chain().focus().addRowAfter().run());
|
|
263
263
|
};
|
|
264
|
-
a.addEventListener("mousedown",
|
|
265
|
-
const
|
|
264
|
+
a.addEventListener("mousedown", S);
|
|
265
|
+
const z = (n) => {
|
|
266
266
|
n.preventDefault(), n.stopPropagation();
|
|
267
|
-
const f =
|
|
267
|
+
const f = M;
|
|
268
268
|
if (!e.isEditable || f == null) return;
|
|
269
|
-
const i =
|
|
269
|
+
const i = L(c, e);
|
|
270
270
|
if (i == null) return;
|
|
271
|
-
|
|
272
|
-
const b =
|
|
271
|
+
O(e, i, f.index), C();
|
|
272
|
+
const b = B(e, C, U), w = u.getBoundingClientRect();
|
|
273
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
|
-
},
|
|
274
|
+
}, H = (n) => {
|
|
275
275
|
h && (n.preventDefault(), n.stopPropagation());
|
|
276
276
|
};
|
|
277
|
-
u.addEventListener("mousedown",
|
|
278
|
-
const
|
|
277
|
+
u.addEventListener("mousedown", z), u.addEventListener("click", H);
|
|
278
|
+
const N = (n) => {
|
|
279
279
|
n.preventDefault(), n.stopPropagation();
|
|
280
|
-
const f =
|
|
280
|
+
const f = T;
|
|
281
281
|
if (!e.isEditable || f == null) return;
|
|
282
|
-
const i =
|
|
282
|
+
const i = L(c, e);
|
|
283
283
|
if (i == null) return;
|
|
284
|
-
|
|
285
|
-
const b =
|
|
284
|
+
Y(e, i, f.index), C();
|
|
285
|
+
const b = ee(i, f.index), w = B(e, C, b), R = p.getBoundingClientRect();
|
|
286
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
|
-
},
|
|
287
|
+
}, k = (n) => {
|
|
288
288
|
h && (n.preventDefault(), n.stopPropagation());
|
|
289
289
|
};
|
|
290
|
-
p.addEventListener("mousedown",
|
|
291
|
-
let
|
|
292
|
-
const
|
|
293
|
-
const i =
|
|
294
|
-
i ? (v = i, m.style.left = `${i.position +
|
|
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 });
|
|
290
|
+
p.addEventListener("mousedown", N), p.addEventListener("click", k);
|
|
291
|
+
let _ = 0;
|
|
292
|
+
const F = 16, G = (n, f) => {
|
|
293
|
+
const i = ne(o, n, f);
|
|
294
|
+
i ? (v = i, m.style.left = `${i.position + A}px`, m.style.top = "0px") : v || (v = { index: 0, position: 0 });
|
|
298
295
|
}, K = (n, f) => {
|
|
299
|
-
const i =
|
|
296
|
+
const i = oe(o, n, f);
|
|
297
|
+
i ? (g = i, a.style.left = "0px", a.style.top = `${i.position + x}px`) : g || (g = { index: 0, position: 0 });
|
|
298
|
+
}, Z = (n, f) => {
|
|
299
|
+
const i = le(o, n);
|
|
300
300
|
if (i) {
|
|
301
|
-
|
|
301
|
+
M = i;
|
|
302
302
|
const b = i.element.getBoundingClientRect();
|
|
303
|
-
u.style.left = "
|
|
303
|
+
u.style.left = "2px", u.style.top = `${b.top - f.top + x + (b.height - 20) / 2}px`;
|
|
304
304
|
}
|
|
305
|
-
},
|
|
306
|
-
const i =
|
|
307
|
-
i && (
|
|
308
|
-
},
|
|
305
|
+
}, j = (n, f) => {
|
|
306
|
+
const i = ie(o, n, f);
|
|
307
|
+
i && (T = i, p.style.left = `${i.centerX + A}px`, p.style.top = "0px");
|
|
308
|
+
}, $ = (n) => {
|
|
309
309
|
if (!e.isEditable) return;
|
|
310
310
|
const f = Date.now();
|
|
311
|
-
if (f -
|
|
312
|
-
|
|
311
|
+
if (f - _ < F) return;
|
|
312
|
+
_ = f;
|
|
313
313
|
const i = o.getBoundingClientRect(), b = n.clientX >= i.left && n.clientX <= i.right && n.clientY >= i.top && n.clientY <= i.bottom;
|
|
314
|
-
l &&
|
|
315
|
-
},
|
|
314
|
+
l && G(n.clientX, i), r && K(n.clientY, i), d && b && (Z(n.clientY, i), j(n.clientX, i));
|
|
315
|
+
}, P = () => {
|
|
316
316
|
setTimeout(() => {
|
|
317
|
-
t.matches(":hover") || h || (v = null, g = null,
|
|
317
|
+
t.matches(":hover") || h || (v = null, g = null, M = null, T = null);
|
|
318
318
|
}, 100);
|
|
319
319
|
};
|
|
320
|
-
t.addEventListener("mousemove",
|
|
321
|
-
const
|
|
320
|
+
t.addEventListener("mousemove", $), t.addEventListener("mouseleave", P);
|
|
321
|
+
const X = (n) => {
|
|
322
322
|
const i = n.target.closest("td, th");
|
|
323
323
|
if (!(i && e.isEditable)) return;
|
|
324
324
|
n.preventDefault(), n.stopPropagation();
|
|
325
|
-
const b = i.getBoundingClientRect(), w = b.left + b.width / 2, R = b.top + b.height / 2,
|
|
325
|
+
const b = i.getBoundingClientRect(), w = b.left + b.width / 2, R = b.top + b.height / 2, J = new MouseEvent("click", {
|
|
326
326
|
bubbles: !0,
|
|
327
327
|
cancelable: !0,
|
|
328
328
|
clientX: w,
|
|
329
329
|
clientY: R,
|
|
330
330
|
view: window
|
|
331
331
|
});
|
|
332
|
-
i.dispatchEvent(
|
|
333
|
-
const y =
|
|
332
|
+
i.dispatchEvent(J), C();
|
|
333
|
+
const y = B(e, C, V);
|
|
334
334
|
y.style.position = "fixed", y.style.left = `${n.clientX}px`, y.style.top = `${n.clientY}px`, document.body.appendChild(y), h = y;
|
|
335
335
|
};
|
|
336
|
-
return o.addEventListener("contextmenu",
|
|
336
|
+
return o.addEventListener("contextmenu", X), t.appendChild(m), t.appendChild(a), t.appendChild(u), t.appendChild(p), t.appendChild(o), {
|
|
337
337
|
dom: t,
|
|
338
338
|
contentDOM: s,
|
|
339
339
|
update: (n) => n.type.name === "table",
|
|
@@ -344,17 +344,17 @@ const re = G.extend({
|
|
|
344
344
|
return !!(i && !b);
|
|
345
345
|
},
|
|
346
346
|
destroy: () => {
|
|
347
|
-
t.removeEventListener("mousemove",
|
|
347
|
+
t.removeEventListener("mousemove", $), t.removeEventListener("mouseleave", P), o.removeEventListener("contextmenu", X), m.removeEventListener("mousedown", D), a.removeEventListener("mousedown", S), u.removeEventListener("mousedown", z), u.removeEventListener("click", H), p.removeEventListener("mousedown", N), p.removeEventListener("click", k), C();
|
|
348
348
|
}
|
|
349
349
|
};
|
|
350
350
|
};
|
|
351
351
|
}
|
|
352
352
|
});
|
|
353
353
|
export {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
354
|
+
V as CELL_MENU_ITEMS,
|
|
355
|
+
q as COLUMN_MENU_ITEMS_BASE,
|
|
356
|
+
U as ROW_MENU_ITEMS,
|
|
357
|
+
te as VIZEL_TABLE_MENU_ITEMS,
|
|
358
|
+
ae as VizelTableWithControls,
|
|
359
|
+
ee as createColumnMenuItems
|
|
360
360
|
};
|
package/dist/index20.js
CHANGED
package/dist/index21.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TextStyle as t, Color as l } from "./
|
|
2
|
-
import { Highlight as i } from "./
|
|
1
|
+
import { TextStyle as t, Color as l } from "./index45.js";
|
|
2
|
+
import { Highlight as i } from "./index46.js";
|
|
3
3
|
const h = [
|
|
4
4
|
// Row 1: Grayscale
|
|
5
5
|
{ name: "Default", color: "inherit" },
|
package/dist/index22.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getIconData as g } from "./
|
|
2
|
-
import { iconToSVG as h } from "./
|
|
3
|
-
import s from "./
|
|
1
|
+
import { getIconData as g } from "./index47.js";
|
|
2
|
+
import { iconToSVG as h } from "./index48.js";
|
|
3
|
+
import s from "./index49.js";
|
|
4
4
|
const u = {
|
|
5
5
|
// Text/Headings
|
|
6
6
|
heading1: "lucide:heading-1",
|
|
@@ -44,6 +44,9 @@ const u = {
|
|
|
44
44
|
warning: "lucide:alert-triangle",
|
|
45
45
|
chevronDown: "lucide:chevron-down",
|
|
46
46
|
x: "lucide:x",
|
|
47
|
+
// Toolbar
|
|
48
|
+
undo: "lucide:undo-2",
|
|
49
|
+
redo: "lucide:redo-2",
|
|
47
50
|
// BubbleMenu toolbar
|
|
48
51
|
bold: "lucide:bold",
|
|
49
52
|
italic: "lucide:italic",
|
|
@@ -61,35 +64,35 @@ const u = {
|
|
|
61
64
|
function k(e, i) {
|
|
62
65
|
return i?.[e] ?? u[e];
|
|
63
66
|
}
|
|
64
|
-
let
|
|
67
|
+
let c = null;
|
|
65
68
|
function w(e) {
|
|
66
|
-
|
|
69
|
+
c = e;
|
|
67
70
|
}
|
|
68
71
|
function z(e, i) {
|
|
69
|
-
return
|
|
72
|
+
return c ? c(e, i) : (process.env.NODE_ENV === "development" && console.warn(
|
|
70
73
|
"[Vizel] Icon renderer not set. Call setVizelIconRenderer() from your framework package (@vizel/react, @vizel/vue, or @vizel/svelte)."
|
|
71
74
|
), "");
|
|
72
75
|
}
|
|
73
76
|
function p(e, i) {
|
|
74
|
-
const
|
|
75
|
-
if (!
|
|
76
|
-
const [, d] =
|
|
77
|
+
const t = u[e];
|
|
78
|
+
if (!t) return "";
|
|
79
|
+
const [, d] = t.split(":");
|
|
77
80
|
if (!d) return "";
|
|
78
81
|
const l = g(s, d);
|
|
79
82
|
if (!l) return "";
|
|
80
83
|
const r = h(l, {
|
|
81
84
|
height: i?.height ?? 24,
|
|
82
85
|
width: i?.width ?? 24
|
|
83
|
-
}),
|
|
86
|
+
}), o = [
|
|
84
87
|
'xmlns="http://www.w3.org/2000/svg"',
|
|
85
88
|
`width="${i?.width ?? 24}"`,
|
|
86
89
|
`height="${i?.height ?? 24}"`,
|
|
87
90
|
`viewBox="0 0 ${l.width ?? 24} ${l.height ?? 24}"`
|
|
88
91
|
];
|
|
89
92
|
if (r.attributes)
|
|
90
|
-
for (const [
|
|
91
|
-
["width", "height", "viewBox"].includes(
|
|
92
|
-
return `<svg ${
|
|
93
|
+
for (const [n, a] of Object.entries(r.attributes))
|
|
94
|
+
["width", "height", "viewBox"].includes(n) || o.push(`${n}="${a}"`);
|
|
95
|
+
return `<svg ${o.join(" ")}>${r.body}</svg>`;
|
|
93
96
|
}
|
|
94
97
|
function I() {
|
|
95
98
|
w(p);
|
package/dist/index24.js
CHANGED
|
@@ -1,15 +1,168 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const t = [
|
|
2
|
+
// History
|
|
3
|
+
{
|
|
4
|
+
id: "undo",
|
|
5
|
+
label: "Undo",
|
|
6
|
+
icon: "undo",
|
|
7
|
+
group: "history",
|
|
8
|
+
isActive: () => !1,
|
|
9
|
+
isEnabled: (e) => e.can().undo(),
|
|
10
|
+
run: (e) => e.chain().focus().undo().run(),
|
|
11
|
+
shortcut: "Mod+Z"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: "redo",
|
|
15
|
+
label: "Redo",
|
|
16
|
+
icon: "redo",
|
|
17
|
+
group: "history",
|
|
18
|
+
isActive: () => !1,
|
|
19
|
+
isEnabled: (e) => e.can().redo(),
|
|
20
|
+
run: (e) => e.chain().focus().redo().run(),
|
|
21
|
+
shortcut: "Mod+Shift+Z"
|
|
22
|
+
},
|
|
23
|
+
// Inline formatting
|
|
24
|
+
{
|
|
25
|
+
id: "bold",
|
|
26
|
+
label: "Bold",
|
|
27
|
+
icon: "bold",
|
|
28
|
+
group: "format",
|
|
29
|
+
isActive: (e) => e.isActive("bold"),
|
|
30
|
+
isEnabled: (e) => e.can().toggleBold(),
|
|
31
|
+
run: (e) => e.chain().focus().toggleBold().run(),
|
|
32
|
+
shortcut: "Mod+B"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "italic",
|
|
36
|
+
label: "Italic",
|
|
37
|
+
icon: "italic",
|
|
38
|
+
group: "format",
|
|
39
|
+
isActive: (e) => e.isActive("italic"),
|
|
40
|
+
isEnabled: (e) => e.can().toggleItalic(),
|
|
41
|
+
run: (e) => e.chain().focus().toggleItalic().run(),
|
|
42
|
+
shortcut: "Mod+I"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "strike",
|
|
46
|
+
label: "Strikethrough",
|
|
47
|
+
icon: "strikethrough",
|
|
48
|
+
group: "format",
|
|
49
|
+
isActive: (e) => e.isActive("strike"),
|
|
50
|
+
isEnabled: (e) => e.can().toggleStrike(),
|
|
51
|
+
run: (e) => e.chain().focus().toggleStrike().run()
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "underline",
|
|
55
|
+
label: "Underline",
|
|
56
|
+
icon: "underline",
|
|
57
|
+
group: "format",
|
|
58
|
+
isActive: (e) => e.isActive("underline"),
|
|
59
|
+
isEnabled: (e) => e.can().toggleUnderline(),
|
|
60
|
+
run: (e) => e.chain().focus().toggleUnderline().run(),
|
|
61
|
+
shortcut: "Mod+U"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "code",
|
|
65
|
+
label: "Code",
|
|
66
|
+
icon: "code",
|
|
67
|
+
group: "format",
|
|
68
|
+
isActive: (e) => e.isActive("code"),
|
|
69
|
+
isEnabled: (e) => e.can().toggleCode(),
|
|
70
|
+
run: (e) => e.chain().focus().toggleCode().run(),
|
|
71
|
+
shortcut: "Mod+E"
|
|
72
|
+
},
|
|
73
|
+
// Headings
|
|
74
|
+
{
|
|
75
|
+
id: "heading1",
|
|
76
|
+
label: "Heading 1",
|
|
77
|
+
icon: "heading1",
|
|
78
|
+
group: "heading",
|
|
79
|
+
isActive: (e) => e.isActive("heading", { level: 1 }),
|
|
80
|
+
isEnabled: (e) => e.can().toggleHeading({ level: 1 }),
|
|
81
|
+
run: (e) => e.chain().focus().toggleHeading({ level: 1 }).run()
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "heading2",
|
|
85
|
+
label: "Heading 2",
|
|
86
|
+
icon: "heading2",
|
|
87
|
+
group: "heading",
|
|
88
|
+
isActive: (e) => e.isActive("heading", { level: 2 }),
|
|
89
|
+
isEnabled: (e) => e.can().toggleHeading({ level: 2 }),
|
|
90
|
+
run: (e) => e.chain().focus().toggleHeading({ level: 2 }).run()
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "heading3",
|
|
94
|
+
label: "Heading 3",
|
|
95
|
+
icon: "heading3",
|
|
96
|
+
group: "heading",
|
|
97
|
+
isActive: (e) => e.isActive("heading", { level: 3 }),
|
|
98
|
+
isEnabled: (e) => e.can().toggleHeading({ level: 3 }),
|
|
99
|
+
run: (e) => e.chain().focus().toggleHeading({ level: 3 }).run()
|
|
100
|
+
},
|
|
101
|
+
// Lists
|
|
102
|
+
{
|
|
103
|
+
id: "bulletList",
|
|
104
|
+
label: "Bullet List",
|
|
105
|
+
icon: "bulletList",
|
|
106
|
+
group: "list",
|
|
107
|
+
isActive: (e) => e.isActive("bulletList"),
|
|
108
|
+
isEnabled: (e) => e.can().toggleBulletList(),
|
|
109
|
+
run: (e) => e.chain().focus().toggleBulletList().run()
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "orderedList",
|
|
113
|
+
label: "Numbered List",
|
|
114
|
+
icon: "orderedList",
|
|
115
|
+
group: "list",
|
|
116
|
+
isActive: (e) => e.isActive("orderedList"),
|
|
117
|
+
isEnabled: (e) => e.can().toggleOrderedList(),
|
|
118
|
+
run: (e) => e.chain().focus().toggleOrderedList().run()
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: "taskList",
|
|
122
|
+
label: "Task List",
|
|
123
|
+
icon: "taskList",
|
|
124
|
+
group: "list",
|
|
125
|
+
isActive: (e) => e.isActive("taskList"),
|
|
126
|
+
isEnabled: (e) => e.can().toggleTaskList(),
|
|
127
|
+
run: (e) => e.chain().focus().toggleTaskList().run()
|
|
128
|
+
},
|
|
129
|
+
// Blocks
|
|
130
|
+
{
|
|
131
|
+
id: "blockquote",
|
|
132
|
+
label: "Quote",
|
|
133
|
+
icon: "blockquote",
|
|
134
|
+
group: "block",
|
|
135
|
+
isActive: (e) => e.isActive("blockquote"),
|
|
136
|
+
isEnabled: (e) => e.can().toggleBlockquote(),
|
|
137
|
+
run: (e) => e.chain().focus().toggleBlockquote().run()
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "codeBlock",
|
|
141
|
+
label: "Code Block",
|
|
142
|
+
icon: "codeBlock",
|
|
143
|
+
group: "block",
|
|
144
|
+
isActive: (e) => e.isActive("codeBlock"),
|
|
145
|
+
isEnabled: (e) => e.can().toggleCodeBlock(),
|
|
146
|
+
run: (e) => e.chain().focus().toggleCodeBlock().run()
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: "horizontalRule",
|
|
150
|
+
label: "Horizontal Rule",
|
|
151
|
+
icon: "horizontalRule",
|
|
152
|
+
group: "block",
|
|
153
|
+
isActive: () => !1,
|
|
154
|
+
isEnabled: (e) => e.can().setHorizontalRule(),
|
|
155
|
+
run: (e) => e.chain().focus().setHorizontalRule().run()
|
|
9
156
|
}
|
|
10
|
-
|
|
157
|
+
];
|
|
158
|
+
function c(e = t) {
|
|
159
|
+
const o = [];
|
|
160
|
+
let n = null, i = [];
|
|
161
|
+
for (const l of e)
|
|
162
|
+
l.group !== n && (i.length > 0 && o.push(i), n = l.group, i = []), i.push(l);
|
|
163
|
+
return i.length > 0 && o.push(i), o;
|
|
11
164
|
}
|
|
12
165
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
166
|
+
c as groupVizelToolbarActions,
|
|
167
|
+
t as vizelDefaultToolbarActions
|
|
15
168
|
};
|