@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.
Files changed (75) hide show
  1. package/dist/components.css +1 -1
  2. package/dist/components.css.map +1 -1
  3. package/dist/index.d.ts +230 -15
  4. package/dist/index.js +78 -75
  5. package/dist/index10.js +1 -1
  6. package/dist/index11.js +4 -4
  7. package/dist/index14.js +1 -1
  8. package/dist/index15.js +134 -127
  9. package/dist/index17.js +2 -2
  10. package/dist/index18.js +1 -1
  11. package/dist/index19.js +86 -86
  12. package/dist/index20.js +2 -2
  13. package/dist/index21.js +2 -2
  14. package/dist/index22.js +16 -13
  15. package/dist/index24.js +164 -11
  16. package/dist/index25.js +12 -53
  17. package/dist/index26.js +49 -136
  18. package/dist/index27.js +132 -59
  19. package/dist/index28.js +66 -32
  20. package/dist/index29.js +35 -21
  21. package/dist/index3.js +91 -90
  22. package/dist/index30.js +23 -9
  23. package/dist/index31.js +9 -147
  24. package/dist/index32.js +138 -256
  25. package/dist/index33.js +258 -85
  26. package/dist/index34.js +84 -55
  27. package/dist/index35.js +64 -4
  28. package/dist/index36.js +4 -123
  29. package/dist/index37.js +111 -315
  30. package/dist/index38.js +321 -481
  31. package/dist/index39.js +12 -47
  32. package/dist/index4.js +1 -1
  33. package/dist/index40.js +463 -655
  34. package/dist/index41.js +48 -4
  35. package/dist/index42.js +694 -4
  36. package/dist/index43.js +4 -238
  37. package/dist/index44.js +4 -82
  38. package/dist/index45.js +237 -16
  39. package/dist/index46.js +81 -57
  40. package/dist/index47.js +17 -15
  41. package/dist/index48.js +57 -285
  42. package/dist/index49.js +15 -202
  43. package/dist/index5.js +78 -68
  44. package/dist/index50.js +281 -1497
  45. package/dist/index51.js +202 -5
  46. package/dist/index52.js +1408 -1467
  47. package/dist/index53.js +5 -723
  48. package/dist/index54.js +1109 -81
  49. package/dist/index55.js +703 -226
  50. package/dist/index56.js +84 -3
  51. package/dist/index57.js +219 -1205
  52. package/dist/index58.js +3 -734
  53. package/dist/index59.js +1232 -21
  54. package/dist/index6.js +1 -1
  55. package/dist/index60.js +734 -10
  56. package/dist/index61.js +21 -7
  57. package/dist/index62.js +10 -8
  58. package/dist/index63.js +6 -13
  59. package/dist/index64.js +7 -18
  60. package/dist/index65.js +12 -23
  61. package/dist/index66.js +17 -53
  62. package/dist/index67.js +23 -1059
  63. package/dist/index68.js +54 -90
  64. package/dist/index69.js +1061 -98
  65. package/dist/index7.js +108 -96
  66. package/dist/index70.js +98 -4
  67. package/dist/index71.js +93 -0
  68. package/dist/index72.js +6 -0
  69. package/dist/index8.js +1 -1
  70. package/dist/index9.js +75 -65
  71. package/dist/mathematics.css +1 -0
  72. package/dist/mathematics.css.map +1 -0
  73. package/dist/styles.css +1 -1
  74. package/dist/styles.css.map +1 -1
  75. 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 G } from "./index33.js";
3
- const P = [
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
- ], Y = [
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 J(e, c) {
18
+ function ee(e, c) {
19
19
  return [
20
- ...Y,
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) => T(l, e, c, "left")
26
+ command: (l) => I(l, e, c, "left")
27
27
  },
28
28
  {
29
29
  label: "Align center",
30
30
  icon: "alignCenter",
31
- command: (l) => T(l, e, c, "center")
31
+ command: (l) => I(l, e, c, "center")
32
32
  },
33
33
  {
34
34
  label: "Align right",
35
35
  icon: "alignRight",
36
- command: (l) => T(l, e, c, "right")
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 U = [
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
- ], q = 20, Q = [
47
- ...P.slice(0, 3),
46
+ ], W = 20, x = 20, A = 24, te = [
47
+ ...U.slice(0, 3),
48
48
  { divider: !0, label: "", command: "" },
49
- ...Y.slice(0, 3),
49
+ ...q.slice(0, 3),
50
50
  { divider: !0, label: "", command: "" },
51
- ...U,
51
+ ...V,
52
52
  { divider: !0, label: "", command: "" },
53
53
  { label: "Delete table", command: "deleteTable", destructive: !0 }
54
54
  ];
55
- function ee(e, c, l) {
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 <= q ? u : null;
74
+ return p <= W ? u : null;
75
75
  }
76
- function te(e, c, l) {
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 <= q ? a : null;
93
+ return u <= W ? a : null;
94
94
  }
95
- function ne(e, c) {
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 oe(e, c, l) {
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 X(e, c, l) {
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 O(e, c, l) {
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 le(e) {
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 x(e, c) {
158
+ function L(e, c) {
159
159
  let l = typeof e == "function" ? e() : void 0;
160
- return l === void 0 && (l = le(c)), l;
160
+ return l === void 0 && (l = ce(c)), l;
161
161
  }
162
- function T(e, c, l, r) {
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 A(e, c, l = Q) {
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 re = G.extend({
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: 12, height: 12 }), m.setAttribute("aria-label", "Insert column"), m.title = "Insert column", m.style.left = "32px", m.style.top = "6px";
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: 12, height: 12 }), a.setAttribute("aria-label", "Insert row"), a.title = "Insert row", a.style.left = "6px", a.style.top = "32px";
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: 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";
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: 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;
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
- }, B = (n) => {
253
+ }, D = (n) => {
254
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());
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", B);
259
- const I = (n) => {
258
+ m.addEventListener("mousedown", D);
259
+ const S = (n) => {
260
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());
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", I);
265
- const S = (n) => {
264
+ a.addEventListener("mousedown", S);
265
+ const z = (n) => {
266
266
  n.preventDefault(), n.stopPropagation();
267
- const f = L;
267
+ const f = M;
268
268
  if (!e.isEditable || f == null) return;
269
- const i = x(c, e);
269
+ const i = L(c, e);
270
270
  if (i == null) return;
271
- X(e, i, f.index), C();
272
- const b = A(e, C, P), w = u.getBoundingClientRect();
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
- }, z = (n) => {
274
+ }, H = (n) => {
275
275
  h && (n.preventDefault(), n.stopPropagation());
276
276
  };
277
- u.addEventListener("mousedown", S), u.addEventListener("click", z);
278
- const H = (n) => {
277
+ u.addEventListener("mousedown", z), u.addEventListener("click", H);
278
+ const N = (n) => {
279
279
  n.preventDefault(), n.stopPropagation();
280
- const f = M;
280
+ const f = T;
281
281
  if (!e.isEditable || f == null) return;
282
- const i = x(c, e);
282
+ const i = L(c, e);
283
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();
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
- }, D = (n) => {
287
+ }, k = (n) => {
288
288
  h && (n.preventDefault(), n.stopPropagation());
289
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 });
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 = ne(o, n);
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
- L = i;
301
+ M = i;
302
302
  const b = i.element.getBoundingClientRect();
303
- u.style.left = "4px", u.style.top = `${b.top - f.top + 32 + (b.height - 24) / 2}px`;
303
+ u.style.left = "2px", u.style.top = `${b.top - f.top + x + (b.height - 20) / 2}px`;
304
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) => {
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 - k < V) return;
312
- k = f;
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 && W(n.clientX, i), r && F(n.clientY, i), d && b && (K(n.clientY, i), Z(n.clientX, i));
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, L = null, M = null);
317
+ t.matches(":hover") || h || (v = null, g = null, M = null, T = null);
318
318
  }, 100);
319
319
  };
320
- t.addEventListener("mousemove", N), t.addEventListener("mouseleave", _);
321
- const $ = (n) => {
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, j = new MouseEvent("click", {
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(j), C();
333
- const y = A(e, C, U);
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", $), t.appendChild(m), t.appendChild(a), t.appendChild(u), t.appendChild(p), t.appendChild(o), {
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", 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();
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
- 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
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
@@ -1,5 +1,5 @@
1
- import i from "./index41.js";
2
- import a from "./index42.js";
1
+ import i from "./index43.js";
2
+ import a from "./index44.js";
3
3
  function o(s = {}) {
4
4
  const { taskList: t = {}, taskItem: e = {} } = s;
5
5
  return [
package/dist/index21.js CHANGED
@@ -1,5 +1,5 @@
1
- import { TextStyle as t, Color as l } from "./index43.js";
2
- import { Highlight as i } from "./index44.js";
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 "./index45.js";
2
- import { iconToSVG as h } from "./index46.js";
3
- import s from "./index47.js";
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 t = null;
67
+ let c = null;
65
68
  function w(e) {
66
- t = e;
69
+ c = e;
67
70
  }
68
71
  function z(e, i) {
69
- return t ? t(e, i) : (process.env.NODE_ENV === "development" && console.warn(
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 c = u[e];
75
- if (!c) return "";
76
- const [, d] = c.split(":");
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
- }), n = [
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 [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>`;
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
- function s(t) {
2
- return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t);
3
- }
4
- function a(t) {
5
- const e = t.trim(), r = e.startsWith("#") ? e : `#${e}`;
6
- if (r.length === 4) {
7
- const [, o, i, n] = r;
8
- return `#${o}${o}${i}${i}${n}${n}`.toUpperCase();
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
- return r.toUpperCase();
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
- s as isVizelValidHexColor,
14
- a as normalizeVizelHexColor
166
+ c as groupVizelToolbarActions,
167
+ t as vizelDefaultToolbarActions
15
168
  };