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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) 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/index34.js +63 -16
  30. package/dist/index35.js +4 -58
  31. package/dist/index36.js +123 -15
  32. package/dist/index37.js +305 -42
  33. package/dist/index38.js +487 -4
  34. package/dist/index39.js +37 -112
  35. package/dist/index4.js +10 -86
  36. package/dist/index40.js +653 -301
  37. package/dist/index41.js +4 -487
  38. package/dist/index42.js +4 -48
  39. package/dist/index43.js +206 -642
  40. package/dist/index44.js +82 -4
  41. package/dist/index45.js +17 -4
  42. package/dist/index46.js +57 -237
  43. package/dist/index47.js +15 -82
  44. package/dist/index48.js +190 -274
  45. package/dist/index49.js +281 -1497
  46. package/dist/index5.js +132 -10
  47. package/dist/index50.js +1502 -5
  48. package/dist/index51.js +5 -1561
  49. package/dist/index52.js +1551 -192
  50. package/dist/index53.js +1 -1
  51. package/dist/index54.js +84 -21
  52. package/dist/index55.js +246 -10
  53. package/dist/index56.js +3 -7
  54. package/dist/index57.js +1231 -7
  55. package/dist/index58.js +731 -11
  56. package/dist/index59.js +21 -19
  57. package/dist/index6.js +48 -131
  58. package/dist/index60.js +10 -25
  59. package/dist/index61.js +6 -83
  60. package/dist/index62.js +7 -245
  61. package/dist/index63.js +11 -1229
  62. package/dist/index64.js +17 -732
  63. package/dist/index65.js +25 -3
  64. package/dist/index66.js +53 -1059
  65. package/dist/index67.js +1059 -53
  66. package/dist/index69.js +90 -3
  67. package/dist/index7.js +228 -409
  68. package/dist/index70.js +3 -90
  69. package/dist/index8.js +111 -45
  70. package/dist/index9.js +409 -228
  71. package/package.json +54 -80
package/dist/index19.js CHANGED
@@ -1,29 +1,360 @@
1
- import i from "./index44.js";
2
- import a from "./index45.js";
3
- function o(s = {}) {
4
- const { taskList: t = {}, taskItem: e = {} } = s;
1
+ import { renderVizelIcon as E } from "./index22.js";
2
+ import { VizelTable as G } from "./index33.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) {
5
19
  return [
6
- a.configure({
7
- HTMLAttributes: {
8
- class: "vizel-task-list",
9
- ...t.HTMLAttributes
10
- },
11
- itemTypeName: t.itemTypeName ?? "taskItem"
12
- }),
13
- i.configure({
14
- HTMLAttributes: {
15
- class: "vizel-task-item",
16
- ...e.HTMLAttributes
17
- },
18
- nested: e.nested ?? !0,
19
- ...e.onReadOnlyChecked !== void 0 && {
20
- onReadOnlyChecked: e.onReadOnlyChecked
21
- }
22
- })
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 }
23
40
  ];
24
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
+ }
148
+ }
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
+ }
157
+ }
158
+ function x(e, c) {
159
+ let l = typeof e == "function" ? e() : void 0;
160
+ return l === void 0 && (l = le(c)), l;
161
+ }
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);
184
+ }
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;
223
+ }
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
+ });
25
353
  export {
26
- i as TaskItem,
27
- a as TaskList,
28
- o as createVizelTaskListExtensions
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
29
360
  };
package/dist/index20.js CHANGED
@@ -1,268 +1,29 @@
1
- import l from "fuse.js";
2
- const h = [
3
- // Text group
4
- {
5
- title: "Heading 1",
6
- description: "Large section heading",
7
- icon: "heading1",
8
- group: "Text",
9
- keywords: ["h1", "title", "header", "big"],
10
- shortcut: "⌘⌥1",
11
- command: ({ editor: e, range: t }) => {
12
- e.chain().focus().deleteRange(t).setNode("heading", { level: 1 }).run();
13
- }
14
- },
15
- {
16
- title: "Heading 2",
17
- description: "Medium section heading",
18
- icon: "heading2",
19
- group: "Text",
20
- keywords: ["h2", "subtitle", "header"],
21
- shortcut: "⌘⌥2",
22
- command: ({ editor: e, range: t }) => {
23
- e.chain().focus().deleteRange(t).setNode("heading", { level: 2 }).run();
24
- }
25
- },
26
- {
27
- title: "Heading 3",
28
- description: "Small section heading",
29
- icon: "heading3",
30
- group: "Text",
31
- keywords: ["h3", "header", "section"],
32
- shortcut: "⌘⌥3",
33
- command: ({ editor: e, range: t }) => {
34
- e.chain().focus().deleteRange(t).setNode("heading", { level: 3 }).run();
35
- }
36
- },
37
- // Lists group
38
- {
39
- title: "Bullet List",
40
- description: "Create a simple bullet list",
41
- icon: "bulletList",
42
- group: "Lists",
43
- keywords: ["ul", "unordered", "bullets", "points"],
44
- shortcut: "⌘⇧8",
45
- command: ({ editor: e, range: t }) => {
46
- e.chain().focus().deleteRange(t).toggleBulletList().run();
47
- }
48
- },
49
- {
50
- title: "Numbered List",
51
- description: "Create a numbered list",
52
- icon: "orderedList",
53
- group: "Lists",
54
- keywords: ["ol", "ordered", "numbers", "steps"],
55
- shortcut: "⌘⇧7",
56
- command: ({ editor: e, range: t }) => {
57
- e.chain().focus().deleteRange(t).toggleOrderedList().run();
58
- }
59
- },
60
- {
61
- title: "Task List",
62
- description: "Create a task list with checkboxes",
63
- icon: "taskList",
64
- group: "Lists",
65
- keywords: ["todo", "checkbox", "checklist", "tasks"],
66
- command: ({ editor: e, range: t }) => {
67
- e.chain().focus().deleteRange(t).toggleTaskList().run();
68
- }
69
- },
70
- // Blocks group
71
- {
72
- title: "Quote",
73
- description: "Capture a quote",
74
- icon: "blockquote",
75
- group: "Blocks",
76
- keywords: ["blockquote", "citation", "cite"],
77
- shortcut: "⌘⇧B",
78
- command: ({ editor: e, range: t }) => {
79
- e.chain().focus().deleteRange(t).toggleBlockquote().run();
80
- }
81
- },
82
- {
83
- title: "Divider",
84
- description: "Insert a horizontal divider",
85
- icon: "horizontalRule",
86
- group: "Blocks",
87
- keywords: ["hr", "horizontal", "line", "separator", "break"],
88
- command: ({ editor: e, range: t }) => {
89
- e.chain().focus().deleteRange(t).setHorizontalRule().run();
90
- }
91
- },
92
- {
93
- title: "Details",
94
- description: "Collapsible content block",
95
- icon: "details",
96
- group: "Blocks",
97
- keywords: ["accordion", "toggle", "collapse", "expand", "summary", "details"],
98
- command: ({ editor: e, range: t }) => {
99
- e.can().setDetails?.() && e.chain().focus().deleteRange(t).setDetails().run();
100
- }
101
- },
102
- {
103
- title: "Code Block",
104
- description: "Insert a code snippet",
105
- icon: "codeBlock",
106
- group: "Blocks",
107
- keywords: ["pre", "code", "programming", "syntax", "snippet"],
108
- shortcut: "⌘⌥C",
109
- command: ({ editor: e, range: t }) => {
110
- e.chain().focus().deleteRange(t).toggleCodeBlock().run();
111
- }
112
- },
113
- {
114
- title: "Table",
115
- description: "Insert a table",
116
- icon: "table",
117
- group: "Blocks",
118
- keywords: ["grid", "spreadsheet", "columns", "rows"],
119
- command: ({ editor: e, range: t }) => {
120
- e.chain().focus().deleteRange(t).insertTable({ rows: 3, cols: 3, withHeaderRow: !0 }).run();
121
- }
122
- },
123
- // Media group
124
- {
125
- title: "Image",
126
- description: "Insert an image from URL",
127
- icon: "image",
128
- group: "Media",
129
- keywords: ["picture", "photo", "img", "url"],
130
- command: ({ editor: e, range: t }) => {
131
- const o = window.prompt("Enter image URL:");
132
- o && e.chain().focus().deleteRange(t).setImage({ src: o }).run();
133
- }
134
- },
135
- {
136
- title: "Upload Image",
137
- description: "Upload an image from your device",
138
- icon: "imageUpload",
139
- group: "Media",
140
- keywords: ["picture", "photo", "upload", "file"],
141
- command: ({ editor: e, range: t }) => {
142
- try {
143
- e.chain().focus().deleteRange(t).run();
144
- } catch {
1
+ import i from "./index41.js";
2
+ import a from "./index42.js";
3
+ function o(s = {}) {
4
+ const { taskList: t = {}, taskItem: e = {} } = s;
5
+ return [
6
+ a.configure({
7
+ HTMLAttributes: {
8
+ class: "vizel-task-list",
9
+ ...t.HTMLAttributes
10
+ },
11
+ itemTypeName: t.itemTypeName ?? "taskItem"
12
+ }),
13
+ i.configure({
14
+ HTMLAttributes: {
15
+ class: "vizel-task-item",
16
+ ...e.HTMLAttributes
17
+ },
18
+ nested: e.nested ?? !0,
19
+ ...e.onReadOnlyChecked !== void 0 && {
20
+ onReadOnlyChecked: e.onReadOnlyChecked
145
21
  }
146
- const o = document.createElement("input");
147
- o.type = "file", o.accept = "image/*", o.onchange = () => {
148
- const i = o.files?.[0];
149
- if (i) {
150
- const n = new CustomEvent("vizel:upload-image", {
151
- detail: { file: i, editor: e }
152
- });
153
- document.dispatchEvent(n);
154
- }
155
- }, o.click();
156
- }
157
- },
158
- {
159
- title: "Embed",
160
- description: "Embed a URL (YouTube, Twitter, etc.)",
161
- icon: "embed",
162
- group: "Media",
163
- keywords: ["link", "url", "youtube", "video", "twitter", "embed", "iframe", "oembed"],
164
- command: ({ editor: e, range: t }) => {
165
- if (!(typeof e.commands.setEmbed == "function")) {
166
- const n = window.prompt("Enter URL:");
167
- n && e.chain().focus().deleteRange(t).setLink({ href: n }).run();
168
- return;
169
- }
170
- const i = window.prompt("Enter URL to embed:");
171
- i && e.chain().focus().deleteRange(t).setEmbed({ url: i }).run();
172
- }
173
- },
174
- // Advanced group
175
- {
176
- title: "Math Equation",
177
- description: "Insert a mathematical expression",
178
- icon: "mathBlock",
179
- group: "Advanced",
180
- keywords: ["latex", "formula", "equation", "katex", "math"],
181
- command: ({ editor: e, range: t }) => {
182
- e.can().insertMathBlock?.({ latex: "" }) && e.chain().focus().deleteRange(t).insertMathBlock({ latex: "" }).run();
183
- }
184
- },
185
- {
186
- title: "Inline Math",
187
- description: "Insert an inline math expression",
188
- icon: "mathInline",
189
- group: "Advanced",
190
- keywords: ["latex", "formula", "inline", "katex", "math"],
191
- command: ({ editor: e, range: t }) => {
192
- e.can().insertMath?.({ latex: "" }) && e.chain().focus().deleteRange(t).insertMath({ latex: "" }).run();
193
- }
194
- },
195
- {
196
- title: "Mermaid Diagram",
197
- description: "Insert a Mermaid diagram",
198
- icon: "mermaid",
199
- group: "Advanced",
200
- keywords: ["diagram", "chart", "flowchart", "mermaid", "sequence", "graph", "uml"],
201
- command: ({ editor: e, range: t }) => {
202
- e.can().insertDiagram?.({ code: "" }) && e.chain().focus().deleteRange(t).insertDiagram({ code: "", type: "mermaid" }).run();
203
- }
204
- },
205
- {
206
- title: "GraphViz Diagram",
207
- description: "Insert a GraphViz (DOT) diagram",
208
- icon: "graphviz",
209
- group: "Advanced",
210
- keywords: ["diagram", "graphviz", "dot", "graph", "network", "nodes", "edges"],
211
- command: ({ editor: e, range: t }) => {
212
- e.can().insertDiagram?.({ code: "" }) && e.chain().focus().deleteRange(t).insertDiagram({ code: "", type: "graphviz" }).run();
213
- }
214
- }
215
- ], u = ["Text", "Lists", "Blocks", "Media", "Advanced"], m = {
216
- keys: [
217
- { name: "title", weight: 0.4 },
218
- { name: "description", weight: 0.2 },
219
- { name: "keywords", weight: 0.4 }
220
- ],
221
- threshold: 0.4,
222
- includeScore: !0,
223
- includeMatches: !0,
224
- minMatchCharLength: 1
225
- }, s = /* @__PURE__ */ new WeakMap();
226
- function c(e) {
227
- let t = s.get(e);
228
- return t || (t = new l(e, m), s.set(e, t)), t;
229
- }
230
- function p(e, t) {
231
- return t.trim() ? c(e).search(t).map((n) => n.item) : e;
232
- }
233
- function f(e, t) {
234
- return t.trim() ? c(e).search(t).map((n) => {
235
- const r = n.matches?.find((d) => d.key === "title")?.indices;
236
- return {
237
- item: n.item,
238
- score: n.score ?? 0,
239
- titleMatches: r
240
- };
241
- }) : e.map((n) => ({ item: n, score: 0 }));
242
- }
243
- function k(e, t = u) {
244
- const o = /* @__PURE__ */ new Map();
245
- for (const n of e) {
246
- const a = n.group ?? "Other", r = o.get(a) ?? [];
247
- r.push(n), o.set(a, r);
248
- }
249
- const i = [];
250
- for (const n of t) {
251
- const a = o.get(n);
252
- a && a.length > 0 && (i.push({ name: n, items: a }), o.delete(n));
253
- }
254
- for (const [n, a] of o)
255
- a.length > 0 && i.push({ name: n, items: a });
256
- return i;
257
- }
258
- function w(e) {
259
- return e.flatMap((t) => t.items);
22
+ })
23
+ ];
260
24
  }
261
25
  export {
262
- u as defaultGroupOrder,
263
- h as defaultSlashCommands,
264
- p as filterSlashCommands,
265
- w as flattenSlashCommandGroups,
266
- k as groupSlashCommands,
267
- f as searchSlashCommands
26
+ i as TaskItem,
27
+ a as TaskList,
28
+ o as createVizelTaskListExtensions
268
29
  };