@markweave/vue2 0.3.1 → 0.3.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.
package/dist/index.js CHANGED
@@ -31,31 +31,31 @@ import { isMermaidInlinePreviewTransaction as Tt, setMarkweaveMermaidTheme as Et
31
31
  import { getMermaidPreviewState as kt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
32
32
  import { filterSlashCommands as At, isExecutableSlashCommand as jt } from "markweave/internal/plugins/slash-command/command-spec";
33
33
  import { getSlashCommandKeyboardAction as Mt } from "markweave/internal/plugins/slash-command/slash-keyboard";
34
- import { executeSlashCommand as Nt, getNextSlashCommandState as Pt, getSlashCommandAnchoredMenuPosition as Ft, getSlashCommandContext as It } from "markweave/internal/plugins/slash-command/slash-runtime";
35
- import { initialSlashCommandState as Lt, reduceSlashCommandState as Rt } from "markweave/internal/plugins/slash-command/slash-state";
36
- import { setMarkweaveTableMenuAxisTarget as zt } from "markweave/internal/plugins/table/table-clipboard";
37
- import { getFirstTableDebugSnapshot as Bt } from "markweave/internal/plugins/table/table-debug-snapshot";
38
- import { focusFirstTableBodyCell as Vt } from "markweave/internal/plugins/table/table-focus-position";
39
- import { getTableFocusState as Ht } from "markweave/internal/plugins/table/table-focus-state";
40
- import { getTableSelectionOverlayState as Ut, initialTableInteractionState as Wt, tableInteractionPluginKey as Gt } from "markweave/internal/plugins/table/table-interaction-layer";
41
- import { calculateAnchoredTableMenuPosition as Kt, calculateTableEdgeHandlePosition as qt, canRunTableCommand as Jt, executeTableMenuCommand as Yt, formatTableCopyFeedback as Xt, getActiveTableElement as Zt, getAvailableCellMenuCommandSpecs as Qt, getTableAxisTargetRect as $t, getTableControlAxisSelectionModel as en, getTableEditWithAiRequest as tn, getTableMenuItemGroup as nn, getTableMenuItemLabel as rn, getTableMenuItems as an, getTableSelectionTargetRect as on, measureTableSelectionOverlay as sn, selectTableAxisFromCell as cn, tableCopyFeedbackTimeoutMs as ln, tableMenuLabel as un } from "markweave/internal/plugins/table/table-ui-model";
34
+ import { areSlashCommandMenuPositionsEquivalent as Nt, executeSlashCommand as Pt, getNextSlashCommandState as Ft, getSlashCommandAnchoredMenuPosition as It, getSlashCommandContext as Lt, isSlashCommandAnchorVisible as Rt } from "markweave/internal/plugins/slash-command/slash-runtime";
35
+ import { initialSlashCommandState as zt, reduceSlashCommandState as Bt } from "markweave/internal/plugins/slash-command/slash-state";
36
+ import { setMarkweaveTableMenuAxisTarget as Vt } from "markweave/internal/plugins/table/table-clipboard";
37
+ import { getFirstTableDebugSnapshot as Ht } from "markweave/internal/plugins/table/table-debug-snapshot";
38
+ import { focusFirstTableBodyCell as Ut } from "markweave/internal/plugins/table/table-focus-position";
39
+ import { getTableFocusState as Wt } from "markweave/internal/plugins/table/table-focus-state";
40
+ import { getTableSelectionOverlayState as Gt, initialTableInteractionState as Kt, tableInteractionPluginKey as qt } from "markweave/internal/plugins/table/table-interaction-layer";
41
+ import { applyTableAxisAlignment as Jt, applyTableAxisBackgroundColor as Yt, applyTableAxisTextColor as Xt, calculateAnchoredTableMenuPosition as Zt, calculateTableAxisHandleLayout as Qt, calculateTableExtendButtonLayout as $t, canRunTableCommand as en, executeTableMenuCommand as tn, formatTableCopyFeedback as nn, getActiveTableElement as rn, getAvailableCellMenuCommandSpecs as an, getTableAxisDropIndexAtPoint as on, getTableAxisFormattingState as sn, getTableAxisTargetRect as cn, getTableControlAxisSelectionModel as ln, getTableEditWithAiRequest as un, getTableMenuItemGroup as dn, getTableMenuItemLabel as fn, getTableMenuItems as pn, getTableSelectionTargetRect as mn, measureTableSelectionOverlay as hn, moveTargetedTableAxis as gn, selectTableAxisFromCell as _n, tableColorOptions as vn, tableCopyFeedbackTimeoutMs as yn, tableHorizontalAlignmentOptions as bn, tableMenuLabel as xn, tableVerticalAlignmentOptions as Sn, targetTableAxisFromCell as Cn } from "markweave/internal/plugins/table/table-ui-model";
42
42
  //#region src/vue2-compat.ts
43
- var dn = l.default ?? l, fn = null, pn = null, mn = null;
44
- function hn(e) {
43
+ var wn = l.default ?? l, Tn = null, En = null, Dn = null;
44
+ function On(e) {
45
45
  return !!(e && typeof e == "object" && "value" in e);
46
46
  }
47
- function gn(e) {
47
+ function kn(e) {
48
48
  let t = e.slice(2);
49
49
  return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
50
50
  }
51
- function _n(e) {
51
+ function An(e) {
52
52
  let t = {}, n = {}, r = {}, i = {}, a = {};
53
53
  for (let [o, s] of Object.entries(e)) if (s !== void 0) {
54
54
  if (o === "class" || o === "style" || o === "key") {
55
55
  t[o] = s;
56
56
  continue;
57
57
  }
58
- if (o === "ref" && hn(s)) {
58
+ if (o === "ref" && On(s)) {
59
59
  a.insert = (e) => {
60
60
  s.value = e.elm;
61
61
  }, a.destroy = () => {
@@ -64,7 +64,7 @@ function _n(e) {
64
64
  continue;
65
65
  }
66
66
  if (/^on[A-Z]/.test(o)) {
67
- i[gn(o)] = s;
67
+ i[kn(o)] = s;
68
68
  continue;
69
69
  }
70
70
  if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
@@ -75,14 +75,14 @@ function _n(e) {
75
75
  }
76
76
  return Object.keys(n).length && (t.attrs = n), Object.keys(r).length && (t.domProps = r), Object.keys(i).length && (t.on = i), Object.keys(a).length && (t.hook = a), t;
77
77
  }
78
- function vn(e) {
78
+ function jn(e) {
79
79
  let t = {}, n = {}, r = {}, i = {};
80
80
  for (let [a, o] of Object.entries(e)) if (o !== void 0) {
81
81
  if (a === "class" || a === "style" || a === "key") {
82
82
  t[a] = o;
83
83
  continue;
84
84
  }
85
- if (a === "ref" && hn(o)) {
85
+ if (a === "ref" && On(o)) {
86
86
  i.insert = (e) => {
87
87
  o.value = e.componentInstance ?? e.elm;
88
88
  }, i.destroy = () => {
@@ -98,25 +98,25 @@ function vn(e) {
98
98
  }
99
99
  return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
100
100
  }
101
- function yn(e) {
101
+ function Mn(e) {
102
102
  return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
103
103
  }
104
- function bn(e) {
104
+ function Nn(e) {
105
105
  return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
106
106
  }
107
- function xn(e) {
107
+ function Pn(e) {
108
108
  return e == null || Array.isArray(e) ? e : [e];
109
109
  }
110
- function Sn(e) {
111
- return typeof e == "function" ? xn(e()) : yn(e) ? xn(e.default()) : bn(e) ? [e] : e;
110
+ function Fn(e) {
111
+ return typeof e == "function" ? Pn(e()) : Mn(e) ? Pn(e.default()) : Nn(e) ? [e] : e;
112
112
  }
113
113
  function H(e, t, n) {
114
- if (!mn) throw Error("Vue 2 render context is not available.");
115
- let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? _n(r) : vn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : Sn(n);
116
- return mn(e, i, a);
114
+ if (!Dn) throw Error("Vue 2 render context is not available.");
115
+ let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? An(r) : jn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : Fn(n);
116
+ return Dn(e, i, a);
117
117
  }
118
118
  function U(e) {
119
- return dn.observable({ value: e });
119
+ return wn.observable({ value: e });
120
120
  }
121
121
  var W = U;
122
122
  function G(e) {
@@ -126,19 +126,19 @@ function G(e) {
126
126
  }
127
127
  function K(e, t, n) {
128
128
  let r = typeof e == "function" ? e : () => e.value;
129
- return fn?.$watch ? fn.$watch(r, t, n) : () => void 0;
129
+ return Tn?.$watch ? Tn.$watch(r, t, n) : () => void 0;
130
130
  }
131
- function Cn(e) {
132
- pn?.mounted.push(e);
131
+ function In(e) {
132
+ En?.mounted.push(e);
133
133
  }
134
134
  function q(e) {
135
- pn?.beforeUnmount.push(e);
135
+ En?.beforeUnmount.push(e);
136
136
  }
137
137
  function J(e) {
138
- return dn.nextTick(e);
138
+ return wn.nextTick(e);
139
139
  }
140
140
  function Y(e) {
141
- return dn.extend({
141
+ return wn.extend({
142
142
  name: e.name,
143
143
  props: e.props,
144
144
  created() {
@@ -146,12 +146,12 @@ function Y(e) {
146
146
  mounted: [],
147
147
  beforeUnmount: []
148
148
  };
149
- fn = this, pn = t;
149
+ Tn = this, En = t;
150
150
  try {
151
151
  let n = e.setup?.(this.$props ?? this) ?? null;
152
152
  this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
153
153
  } finally {
154
- fn = null, pn = null;
154
+ Tn = null, En = null;
155
155
  }
156
156
  },
157
157
  mounted() {
@@ -161,19 +161,413 @@ function Y(e) {
161
161
  this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
162
162
  },
163
163
  render(t) {
164
- mn = t;
164
+ Dn = t;
165
165
  try {
166
166
  let n = this.__markweaveVue2Render;
167
167
  return n ? n() : e.render?.(t) ?? null;
168
168
  } finally {
169
- mn = null;
169
+ Dn = null;
170
170
  }
171
171
  }
172
172
  });
173
173
  }
174
174
  //#endregion
175
175
  //#region src/vue2-icons.ts
176
- var wn = {
176
+ var Ln = {
177
+ AlignVerticalJustifyCenter: {
178
+ iconName: "align-vertical-justify-center",
179
+ node: [
180
+ ["rect", {
181
+ width: "14",
182
+ height: "6",
183
+ x: "5",
184
+ y: "16",
185
+ rx: "2",
186
+ key: "1i8z2d"
187
+ }],
188
+ ["rect", {
189
+ width: "10",
190
+ height: "6",
191
+ x: "7",
192
+ y: "2",
193
+ rx: "2",
194
+ key: "ypihtt"
195
+ }],
196
+ ["path", {
197
+ d: "M2 12h20",
198
+ key: "9i4pu4"
199
+ }]
200
+ ]
201
+ },
202
+ AlignVerticalJustifyEnd: {
203
+ iconName: "align-vertical-justify-end",
204
+ node: [
205
+ ["rect", {
206
+ width: "14",
207
+ height: "6",
208
+ x: "5",
209
+ y: "12",
210
+ rx: "2",
211
+ key: "4l4tp2"
212
+ }],
213
+ ["rect", {
214
+ width: "10",
215
+ height: "6",
216
+ x: "7",
217
+ y: "2",
218
+ rx: "2",
219
+ key: "ypihtt"
220
+ }],
221
+ ["path", {
222
+ d: "M2 22h20",
223
+ key: "272qi7"
224
+ }]
225
+ ]
226
+ },
227
+ AlignVerticalJustifyStart: {
228
+ iconName: "align-vertical-justify-start",
229
+ node: [
230
+ ["rect", {
231
+ width: "14",
232
+ height: "6",
233
+ x: "5",
234
+ y: "16",
235
+ rx: "2",
236
+ key: "1i8z2d"
237
+ }],
238
+ ["rect", {
239
+ width: "10",
240
+ height: "6",
241
+ x: "7",
242
+ y: "6",
243
+ rx: "2",
244
+ key: "13squh"
245
+ }],
246
+ ["path", {
247
+ d: "M2 2h20",
248
+ key: "1ennik"
249
+ }]
250
+ ]
251
+ },
252
+ ArrowDown: {
253
+ iconName: "arrow-down",
254
+ node: [["path", {
255
+ d: "M12 5v14",
256
+ key: "s699le"
257
+ }], ["path", {
258
+ d: "m19 12-7 7-7-7",
259
+ key: "1idqje"
260
+ }]]
261
+ },
262
+ ArrowDownAZ: {
263
+ iconName: "arrow-down-a-z",
264
+ node: [
265
+ ["path", {
266
+ d: "m3 16 4 4 4-4",
267
+ key: "1co6wj"
268
+ }],
269
+ ["path", {
270
+ d: "M7 20V4",
271
+ key: "1yoxec"
272
+ }],
273
+ ["path", {
274
+ d: "M20 8h-5",
275
+ key: "1vsyxs"
276
+ }],
277
+ ["path", {
278
+ d: "M15 10V6.5a2.5 2.5 0 0 1 5 0V10",
279
+ key: "ag13bf"
280
+ }],
281
+ ["path", {
282
+ d: "M15 14h5l-5 6h5",
283
+ key: "ur5jdg"
284
+ }]
285
+ ]
286
+ },
287
+ ArrowLeft: {
288
+ iconName: "arrow-left",
289
+ node: [["path", {
290
+ d: "m12 19-7-7 7-7",
291
+ key: "1l729n"
292
+ }], ["path", {
293
+ d: "M19 12H5",
294
+ key: "x3x0zl"
295
+ }]]
296
+ },
297
+ ArrowRight: {
298
+ iconName: "arrow-right",
299
+ node: [["path", {
300
+ d: "M5 12h14",
301
+ key: "1ays0h"
302
+ }], ["path", {
303
+ d: "m12 5 7 7-7 7",
304
+ key: "xquz4c"
305
+ }]]
306
+ },
307
+ ArrowUp: {
308
+ iconName: "arrow-up",
309
+ node: [["path", {
310
+ d: "m5 12 7-7 7 7",
311
+ key: "hav0vg"
312
+ }], ["path", {
313
+ d: "M12 19V5",
314
+ key: "x0mq9r"
315
+ }]]
316
+ },
317
+ ArrowUpZA: {
318
+ iconName: "arrow-up-z-a",
319
+ node: [
320
+ ["path", {
321
+ d: "m3 8 4-4 4 4",
322
+ key: "11wl7u"
323
+ }],
324
+ ["path", {
325
+ d: "M7 4v16",
326
+ key: "1glfcx"
327
+ }],
328
+ ["path", {
329
+ d: "M15 4h5l-5 6h5",
330
+ key: "8asdl1"
331
+ }],
332
+ ["path", {
333
+ d: "M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",
334
+ key: "r6l5cz"
335
+ }],
336
+ ["path", {
337
+ d: "M20 18h-5",
338
+ key: "18j1r2"
339
+ }]
340
+ ]
341
+ },
342
+ BetweenHorizontalEnd: {
343
+ iconName: "between-horizontal-end",
344
+ node: [
345
+ ["rect", {
346
+ width: "13",
347
+ height: "7",
348
+ x: "3",
349
+ y: "3",
350
+ rx: "1",
351
+ key: "11xb64"
352
+ }],
353
+ ["path", {
354
+ d: "m22 15-3-3 3-3",
355
+ key: "26chmm"
356
+ }],
357
+ ["rect", {
358
+ width: "13",
359
+ height: "7",
360
+ x: "3",
361
+ y: "14",
362
+ rx: "1",
363
+ key: "k6ky7n"
364
+ }]
365
+ ]
366
+ },
367
+ BetweenHorizontalStart: {
368
+ iconName: "between-horizontal-start",
369
+ node: [
370
+ ["rect", {
371
+ width: "13",
372
+ height: "7",
373
+ x: "8",
374
+ y: "3",
375
+ rx: "1",
376
+ key: "pkso9a"
377
+ }],
378
+ ["path", {
379
+ d: "m2 9 3 3-3 3",
380
+ key: "1agib5"
381
+ }],
382
+ ["rect", {
383
+ width: "13",
384
+ height: "7",
385
+ x: "8",
386
+ y: "14",
387
+ rx: "1",
388
+ key: "1q5fc1"
389
+ }]
390
+ ]
391
+ },
392
+ BetweenVerticalEnd: {
393
+ iconName: "between-vertical-end",
394
+ node: [
395
+ ["rect", {
396
+ width: "7",
397
+ height: "13",
398
+ x: "3",
399
+ y: "3",
400
+ rx: "1",
401
+ key: "1fdu0f"
402
+ }],
403
+ ["path", {
404
+ d: "m9 22 3-3 3 3",
405
+ key: "17z65a"
406
+ }],
407
+ ["rect", {
408
+ width: "7",
409
+ height: "13",
410
+ x: "14",
411
+ y: "3",
412
+ rx: "1",
413
+ key: "1squn4"
414
+ }]
415
+ ]
416
+ },
417
+ BetweenVerticalStart: {
418
+ iconName: "between-vertical-start",
419
+ node: [
420
+ ["rect", {
421
+ width: "7",
422
+ height: "13",
423
+ x: "3",
424
+ y: "8",
425
+ rx: "1",
426
+ key: "1fjrkv"
427
+ }],
428
+ ["path", {
429
+ d: "m15 2-3 3-3-3",
430
+ key: "1uh6eb"
431
+ }],
432
+ ["rect", {
433
+ width: "7",
434
+ height: "13",
435
+ x: "14",
436
+ y: "8",
437
+ rx: "1",
438
+ key: "w3fjg8"
439
+ }]
440
+ ]
441
+ },
442
+ ChevronRight: {
443
+ iconName: "chevron-right",
444
+ node: [["path", {
445
+ d: "m9 18 6-6-6-6",
446
+ key: "mthhwq"
447
+ }]]
448
+ },
449
+ Copy: {
450
+ iconName: "copy",
451
+ node: [["rect", {
452
+ width: "14",
453
+ height: "14",
454
+ x: "8",
455
+ y: "8",
456
+ rx: "2",
457
+ ry: "2",
458
+ key: "17jyea"
459
+ }], ["path", {
460
+ d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",
461
+ key: "zix9uf"
462
+ }]]
463
+ },
464
+ PaintBucket: {
465
+ iconName: "paint-bucket",
466
+ node: [
467
+ ["path", {
468
+ d: "m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",
469
+ key: "irua1i"
470
+ }],
471
+ ["path", {
472
+ d: "m5 2 5 5",
473
+ key: "1lls2c"
474
+ }],
475
+ ["path", {
476
+ d: "M2 13h15",
477
+ key: "1hkzvu"
478
+ }],
479
+ ["path", {
480
+ d: "M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",
481
+ key: "xk76lq"
482
+ }]
483
+ ]
484
+ },
485
+ Plus: {
486
+ iconName: "plus",
487
+ node: [["path", {
488
+ d: "M5 12h14",
489
+ key: "1ays0h"
490
+ }], ["path", {
491
+ d: "M12 5v14",
492
+ key: "s699le"
493
+ }]]
494
+ },
495
+ SquareX: {
496
+ iconName: "square-x",
497
+ node: [
498
+ ["rect", {
499
+ width: "18",
500
+ height: "18",
501
+ x: "3",
502
+ y: "3",
503
+ rx: "2",
504
+ ry: "2",
505
+ key: "1m3agn"
506
+ }],
507
+ ["path", {
508
+ d: "m15 9-6 6",
509
+ key: "1uzhvr"
510
+ }],
511
+ ["path", {
512
+ d: "m9 9 6 6",
513
+ key: "z0biqf"
514
+ }]
515
+ ]
516
+ },
517
+ TableCellsMerge: {
518
+ iconName: "table-cells-merge",
519
+ node: [
520
+ ["path", {
521
+ d: "M12 21v-6",
522
+ key: "lihzve"
523
+ }],
524
+ ["path", {
525
+ d: "M12 9V3",
526
+ key: "da5inc"
527
+ }],
528
+ ["path", {
529
+ d: "M3 15h18",
530
+ key: "5xshup"
531
+ }],
532
+ ["path", {
533
+ d: "M3 9h18",
534
+ key: "1pudct"
535
+ }],
536
+ ["rect", {
537
+ width: "18",
538
+ height: "18",
539
+ x: "3",
540
+ y: "3",
541
+ rx: "2",
542
+ key: "afitv7"
543
+ }]
544
+ ]
545
+ },
546
+ TableCellsSplit: {
547
+ iconName: "table-cells-split",
548
+ node: [
549
+ ["path", {
550
+ d: "M12 15V9",
551
+ key: "8c7uyn"
552
+ }],
553
+ ["path", {
554
+ d: "M3 15h18",
555
+ key: "5xshup"
556
+ }],
557
+ ["path", {
558
+ d: "M3 9h18",
559
+ key: "1pudct"
560
+ }],
561
+ ["rect", {
562
+ width: "18",
563
+ height: "18",
564
+ x: "3",
565
+ y: "3",
566
+ rx: "2",
567
+ key: "afitv7"
568
+ }]
569
+ ]
570
+ },
177
571
  AlignCenter: {
178
572
  iconName: "text-align-center",
179
573
  node: [
@@ -1038,7 +1432,7 @@ var wn = {
1038
1432
  }]]
1039
1433
  }
1040
1434
  };
1041
- function Tn(e) {
1435
+ function Rn(e) {
1042
1436
  return e.map(([e, t]) => H(e, t));
1043
1437
  }
1044
1438
  function X(e) {
@@ -1059,7 +1453,7 @@ function X(e) {
1059
1453
  }
1060
1454
  },
1061
1455
  setup(t) {
1062
- let n = wn[e];
1456
+ let n = Ln[e];
1063
1457
  return () => H("svg", {
1064
1458
  class: `lucide lucide-${n.iconName}`,
1065
1459
  viewBox: "0 0 24 24",
@@ -1072,12 +1466,12 @@ function X(e) {
1072
1466
  "stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
1073
1467
  "aria-hidden": "true",
1074
1468
  focusable: "false"
1075
- }, Tn(n.node));
1469
+ }, Rn(n.node));
1076
1470
  }
1077
1471
  });
1078
1472
  }
1079
- var En = X("AlignCenter"), Dn = X("AlignJustify"), On = X("AlignLeft"), kn = X("AlignRight"), An = X("AlertTriangle"), jn = X("Bold"), Mn = X("Braces"), Nn = X("Captions"), Pn = X("CheckCircle2"), Fn = X("ChevronDown"), In = X("ChevronUp"), Ln = X("CircleX"), Rn = X("Code2"), zn = X("CornerDownLeft"), Bn = X("Download"), Vn = X("Eye"), Hn = X("ExternalLink"), Un = X("Heading1"), Wn = X("Heading2"), Gn = X("Heading3"), Kn = X("Image"), qn = X("ImageUp"), Jn = X("IndentDecrease"), Yn = X("IndentIncrease"), Xn = X("Info"), Zn = X("Italic"), Qn = X("Lightbulb"), $n = X("Link2"), er = X("List"), tr = X("ListChecks"), nr = X("ListOrdered"), rr = X("Minus"), ir = X("MoreVertical"), ar = X("Paperclip"), or = X("PencilLine"), sr = X("Quote"), cr = X("Replace"), lr = X("Sigma"), ur = X("SmilePlus"), dr = X("Strikethrough"), fr = X("Subscript"), pr = X("Superscript"), mr = X("Table2"), hr = X("Text"), gr = X("Trash2"), _r = X("Type"), vr = X("Underline"), yr = X("Upload"), br = X("Video"), xr = N;
1080
- function Sr(e) {
1473
+ var zn = X("AlignCenter"), Bn = X("AlignJustify"), Vn = X("AlignLeft"), Hn = X("AlignRight"), Un = X("AlignVerticalJustifyCenter"), Wn = X("AlignVerticalJustifyEnd"), Gn = X("AlignVerticalJustifyStart"), Kn = X("AlertTriangle"), qn = X("ArrowDown"), Jn = X("ArrowDownAZ"), Yn = X("ArrowLeft"), Xn = X("ArrowRight"), Zn = X("ArrowUp"), Qn = X("ArrowUpZA"), $n = X("BetweenHorizontalEnd"), er = X("BetweenHorizontalStart"), tr = X("BetweenVerticalEnd"), nr = X("BetweenVerticalStart"), rr = X("Bold"), ir = X("Braces"), ar = X("Captions"), or = X("CheckCircle2"), sr = X("ChevronDown"), cr = X("ChevronRight"), lr = X("ChevronUp"), ur = X("CircleX"), dr = X("Code2"), fr = X("CornerDownLeft"), pr = X("Copy"), mr = X("Download"), hr = X("Eye"), gr = X("ExternalLink"), _r = X("Heading1"), vr = X("Heading2"), yr = X("Heading3"), br = X("Image"), xr = X("ImageUp"), Sr = X("IndentDecrease"), Cr = X("IndentIncrease"), wr = X("Info"), Tr = X("Italic"), Er = X("Lightbulb"), Dr = X("Link2"), Or = X("List"), kr = X("ListChecks"), Ar = X("ListOrdered"), jr = X("Minus"), Mr = X("MoreVertical"), Nr = X("PaintBucket"), Pr = X("Paperclip"), Fr = X("PencilLine"), Ir = X("Plus"), Lr = X("Quote"), Rr = X("Replace"), zr = X("Sigma"), Br = X("SmilePlus"), Vr = X("SquareX"), Hr = X("Strikethrough"), Ur = X("Subscript"), Wr = X("Superscript"), Gr = X("Table2"), Kr = X("TableCellsMerge"), qr = X("TableCellsSplit"), Jr = X("Text"), Yr = X("Trash2"), Xr = X("Type"), Zr = X("Underline"), Qr = X("Upload"), $r = X("Video"), ei = N;
1474
+ function ti(e) {
1081
1475
  let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
1082
1476
  let n = t?.getAttribute("data-markweave-mode");
1083
1477
  return n === "view" ? {
@@ -1099,23 +1493,23 @@ function Sr(e) {
1099
1493
  i(), a?.disconnect();
1100
1494
  }), r;
1101
1495
  }
1102
- function Cr(e) {
1496
+ function ni(e) {
1103
1497
  return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
1104
1498
  }
1105
- function wr(e) {
1499
+ function ri(e) {
1106
1500
  return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
1107
1501
  }
1108
- function Tr(e) {
1502
+ function ii(e) {
1109
1503
  return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
1110
1504
  }
1111
- function Er(e, t) {
1505
+ function ai(e, t) {
1112
1506
  return H(e, {
1113
1507
  size: 18,
1114
1508
  strokeWidth: 1.8,
1115
1509
  "aria-hidden": "true"
1116
1510
  }, { default: () => t });
1117
1511
  }
1118
- function Dr(e) {
1512
+ function oi(e) {
1119
1513
  return H("button", {
1120
1514
  type: "button",
1121
1515
  "aria-label": e.label,
@@ -1124,12 +1518,12 @@ function Dr(e) {
1124
1518
  "data-active": e.active ? "true" : "false",
1125
1519
  onMousedown: (e) => e.preventDefault(),
1126
1520
  onClick: e.onClick
1127
- }, [Er(e.icon, e.label), H("span", {
1521
+ }, [ai(e.icon, e.label), H("span", {
1128
1522
  class: "markweave-image-tooltip",
1129
1523
  role: "tooltip"
1130
1524
  }, e.label)]);
1131
1525
  }
1132
- function Or(e) {
1526
+ function si(e) {
1133
1527
  let t = U(null), n = e.messages.image;
1134
1528
  return H("section", {
1135
1529
  class: "markweave-image-upload-placeholder",
@@ -1163,7 +1557,7 @@ function Or(e) {
1163
1557
  H("div", {
1164
1558
  class: "markweave-image-upload-icon",
1165
1559
  "aria-hidden": "true"
1166
- }, [H(qn, {
1560
+ }, [H(xr, {
1167
1561
  size: 46,
1168
1562
  strokeWidth: 1.6
1169
1563
  })]),
@@ -1188,7 +1582,7 @@ function Or(e) {
1188
1582
  "data-testid": "markweave-image-upload-submit",
1189
1583
  disabled: e.isSubmitting || !e.inputValue.trim(),
1190
1584
  onClick: e.onSubmit
1191
- }, [H(qn, {
1585
+ }, [H(xr, {
1192
1586
  size: 16,
1193
1587
  strokeWidth: 1.8
1194
1588
  }), e.messages.common.insert]),
@@ -1204,7 +1598,7 @@ function Or(e) {
1204
1598
  }, e.error) : null
1205
1599
  ]);
1206
1600
  }
1207
- function kr(e) {
1601
+ function ci(e) {
1208
1602
  let t = U(null), n = e.messages.video;
1209
1603
  return H("section", {
1210
1604
  class: "markweave-video-upload-placeholder",
@@ -1238,7 +1632,7 @@ function kr(e) {
1238
1632
  H("div", {
1239
1633
  class: "markweave-video-upload-icon",
1240
1634
  "aria-hidden": "true"
1241
- }, [H(br, {
1635
+ }, [H($r, {
1242
1636
  size: 46,
1243
1637
  strokeWidth: 1.6
1244
1638
  })]),
@@ -1263,7 +1657,7 @@ function kr(e) {
1263
1657
  "data-testid": "markweave-video-upload-submit",
1264
1658
  disabled: e.isSubmitting || !e.inputValue.trim(),
1265
1659
  onClick: e.onSubmit
1266
- }, [H(yr, {
1660
+ }, [H(Qr, {
1267
1661
  size: 16,
1268
1662
  strokeWidth: 1.8
1269
1663
  }), e.messages.common.insert]),
@@ -1279,7 +1673,7 @@ function kr(e) {
1279
1673
  }, e.error) : null
1280
1674
  ]);
1281
1675
  }
1282
- var Ar = Y({
1676
+ var li = Y({
1283
1677
  name: "MarkweaveVueImageNodeView",
1284
1678
  props: {
1285
1679
  editor: {
@@ -1312,7 +1706,7 @@ var Ar = Y({
1312
1706
  }
1313
1707
  },
1314
1708
  setup(e) {
1315
- let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!I(u.value.caption)), p = U(I(u.value.caption) ?? ""), m = Sr(e.editor), h = G(() => d(m.value)), g = G(() => e.extension.options?.messages ?? n("zh")), _ = G(() => g.value.image), v = G(() => I(u.value.src)), y = G(() => e.extension.options?.resolveMediaSource), x = U(null), C = null;
1709
+ let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!I(u.value.caption)), p = U(I(u.value.caption) ?? ""), m = ti(e.editor), h = G(() => d(m.value)), g = G(() => e.extension.options?.messages ?? n("zh")), _ = G(() => g.value.image), v = G(() => I(u.value.src)), y = G(() => e.extension.options?.resolveMediaSource), x = U(null), C = null;
1316
1710
  K(v, (t) => {
1317
1711
  if (C?.abort(), C = null, !t) {
1318
1712
  x.value = null;
@@ -1333,7 +1727,7 @@ var Ar = Y({
1333
1727
  r.signal.aborted || (x.value = e);
1334
1728
  });
1335
1729
  }, { immediate: !0 }), q(() => C?.abort());
1336
- let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() => xr(u.value.align)), D = G(() => F(u.value.width)), A = G(() => I(u.value.caption)), M = G(() => h.value && (!v.value || i.value)), N = () => {
1730
+ let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() => ei(u.value.align)), D = G(() => F(u.value.width)), A = G(() => I(u.value.caption)), M = G(() => h.value && (!v.value || i.value)), N = () => {
1337
1731
  w.value && b({
1338
1732
  src: w.value,
1339
1733
  alt: I(u.value.alt) ?? "",
@@ -1406,7 +1800,7 @@ var Ar = Y({
1406
1800
  "data-selected": "false",
1407
1801
  "data-hovered": "false",
1408
1802
  "data-empty": "true"
1409
- }, () => Or({
1803
+ }, () => si({
1410
1804
  messages: g.value,
1411
1805
  inputValue: o.value,
1412
1806
  error: c.value,
@@ -1436,7 +1830,7 @@ var Ar = Y({
1436
1830
  r.value = !1;
1437
1831
  },
1438
1832
  onMousedown: (e) => {
1439
- h.value && !Cr(e.target) && P();
1833
+ h.value && !ni(e.target) && P();
1440
1834
  }
1441
1835
  }, () => [
1442
1836
  h.value ? H("div", {
@@ -1445,24 +1839,24 @@ var Ar = Y({
1445
1839
  "data-markweave-image-ui": "true",
1446
1840
  "aria-label": _.value.toolsAriaLabel
1447
1841
  }, [
1448
- Dr({
1842
+ oi({
1449
1843
  testId: "markweave-image-align-left",
1450
1844
  label: _.value.alignLeft,
1451
- icon: On,
1845
+ icon: Vn,
1452
1846
  active: E.value === "left",
1453
1847
  onClick: () => e.updateAttributes({ align: "left" })
1454
1848
  }),
1455
- Dr({
1849
+ oi({
1456
1850
  testId: "markweave-image-align-center",
1457
1851
  label: _.value.alignCenter,
1458
- icon: En,
1852
+ icon: zn,
1459
1853
  active: E.value === "center",
1460
1854
  onClick: () => e.updateAttributes({ align: "center" })
1461
1855
  }),
1462
- Dr({
1856
+ oi({
1463
1857
  testId: "markweave-image-align-right",
1464
1858
  label: _.value.alignRight,
1465
- icon: kn,
1859
+ icon: Hn,
1466
1860
  active: E.value === "right",
1467
1861
  onClick: () => e.updateAttributes({ align: "right" })
1468
1862
  }),
@@ -1470,31 +1864,31 @@ var Ar = Y({
1470
1864
  class: "markweave-image-toolbar-divider",
1471
1865
  "aria-hidden": "true"
1472
1866
  }),
1473
- Dr({
1867
+ oi({
1474
1868
  testId: "markweave-image-caption",
1475
1869
  label: _.value.caption,
1476
- icon: Nn,
1870
+ icon: ar,
1477
1871
  active: f.value || !!A.value,
1478
1872
  onClick: B
1479
1873
  }),
1480
- Dr({
1874
+ oi({
1481
1875
  testId: "markweave-image-preview",
1482
1876
  label: _.value.preview,
1483
- icon: Vn,
1877
+ icon: hr,
1484
1878
  onClick: N
1485
1879
  }),
1486
- Dr({
1880
+ oi({
1487
1881
  testId: "markweave-image-download",
1488
1882
  label: _.value.download,
1489
- icon: Bn,
1883
+ icon: mr,
1490
1884
  onClick: () => {
1491
1885
  w.value && j(w.value);
1492
1886
  }
1493
1887
  }),
1494
- Dr({
1888
+ oi({
1495
1889
  testId: "markweave-image-replace",
1496
1890
  label: _.value.replace,
1497
- icon: cr,
1891
+ icon: Rr,
1498
1892
  onClick: () => {
1499
1893
  o.value = "", c.value = null, i.value = !0;
1500
1894
  }
@@ -1503,10 +1897,10 @@ var Ar = Y({
1503
1897
  class: "markweave-image-toolbar-divider",
1504
1898
  "aria-hidden": "true"
1505
1899
  }),
1506
- Dr({
1900
+ oi({
1507
1901
  testId: "markweave-image-delete",
1508
1902
  label: _.value.delete,
1509
- icon: gr,
1903
+ icon: Yr,
1510
1904
  onClick: () => e.deleteNode()
1511
1905
  })
1512
1906
  ]) : null,
@@ -1542,7 +1936,7 @@ var Ar = Y({
1542
1936
  title: _.value.preview,
1543
1937
  onMousedown: (e) => e.preventDefault(),
1544
1938
  onClick: N
1545
- }, [H(Vn, {
1939
+ }, [H(hr, {
1546
1940
  size: 16,
1547
1941
  strokeWidth: 1.8
1548
1942
  }), H("span", {
@@ -1587,7 +1981,7 @@ var Ar = Y({
1587
1981
  }, A.value) : null
1588
1982
  ]);
1589
1983
  }
1590
- }), jr = Y({
1984
+ }), ui = Y({
1591
1985
  name: "MarkweaveVueVideoNodeView",
1592
1986
  props: {
1593
1987
  editor: {
@@ -1620,7 +2014,7 @@ var Ar = Y({
1620
2014
  }
1621
2015
  },
1622
2016
  setup(e) {
1623
- let t = U(!1), r = U(""), i = U(null), a = U(!1), o = Sr(e.editor), c = G(() => d(o.value)), l = G(() => e.extension.options?.messages ?? n("zh")), u = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => I(f.value.src)), m = G(() => I(f.value.embedUrl)), h = G(() => I(f.value.provider)), g = G(() => m.value ? P(m.value, h.value) : null), _ = G(() => I(f.value.mimeType)), v = G(() => I(f.value.title)), y = () => {
2017
+ let t = U(!1), r = U(""), i = U(null), a = U(!1), o = ti(e.editor), c = G(() => d(o.value)), l = G(() => e.extension.options?.messages ?? n("zh")), u = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => I(f.value.src)), m = G(() => I(f.value.embedUrl)), h = G(() => I(f.value.provider)), g = G(() => m.value ? P(m.value, h.value) : null), _ = G(() => I(f.value.mimeType)), v = G(() => I(f.value.title)), y = () => {
1624
2018
  p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
1625
2019
  }, b = async (n) => {
1626
2020
  if (!c.value) return;
@@ -1661,7 +2055,7 @@ var Ar = Y({
1661
2055
  "data-testid": "markweave-video-node",
1662
2056
  "data-empty": "true",
1663
2057
  "data-selected": "false"
1664
- }, () => kr({
2058
+ }, () => ci({
1665
2059
  messages: l.value,
1666
2060
  inputValue: r.value,
1667
2061
  error: i.value,
@@ -1688,7 +2082,7 @@ var Ar = Y({
1688
2082
  onFocus: C,
1689
2083
  onKeydown: w,
1690
2084
  onMousedown: (e) => {
1691
- c.value && !wr(e.target) && (e.preventDefault(), C());
2085
+ c.value && !ri(e.target) && (e.preventDefault(), C());
1692
2086
  }
1693
2087
  }, () => [g.value ? H("div", { class: "markweave-video-embed" }, [H("iframe", {
1694
2088
  class: "markweave-video-iframe",
@@ -1726,7 +2120,7 @@ var Ar = Y({
1726
2120
  "aria-hidden": "true"
1727
2121
  })]);
1728
2122
  }
1729
- }), Mr = C.extend({
2123
+ }), di = C.extend({
1730
2124
  addOptions() {
1731
2125
  return {
1732
2126
  ...this.parent?.(),
@@ -1737,7 +2131,7 @@ var Ar = Y({
1737
2131
  },
1738
2132
  addNodeView() {
1739
2133
  if (typeof document > "u") return null;
1740
- let e = c(Ar, { stopEvent: ({ event: e }) => Cr(e.target) }), t = this.options.resolveMediaSource;
2134
+ let e = c(li, { stopEvent: ({ event: e }) => ni(e.target) }), t = this.options.resolveMediaSource;
1741
2135
  if (!t) return e;
1742
2136
  let r = x({
1743
2137
  messages: this.options.messages ?? n("zh"),
@@ -1746,7 +2140,7 @@ var Ar = Y({
1746
2140
  });
1747
2141
  return (t) => I(t.node.attrs.src) ? r(t) : e(t);
1748
2142
  }
1749
- }), Nr = w.extend({
2143
+ }), fi = w.extend({
1750
2144
  addOptions() {
1751
2145
  return {
1752
2146
  ...this.parent?.(),
@@ -1756,9 +2150,9 @@ var Ar = Y({
1756
2150
  };
1757
2151
  },
1758
2152
  addNodeView() {
1759
- return typeof document > "u" ? null : c(jr, { stopEvent: ({ event: e }) => wr(e.target) });
2153
+ return typeof document > "u" ? null : c(ui, { stopEvent: ({ event: e }) => ri(e.target) });
1760
2154
  }
1761
- }), Pr = Y({
2155
+ }), pi = Y({
1762
2156
  name: "MarkweaveVueLinkCardNodeView",
1763
2157
  props: {
1764
2158
  editor: {
@@ -1791,7 +2185,7 @@ var Ar = Y({
1791
2185
  }
1792
2186
  },
1793
2187
  setup(e) {
1794
- let t = e.extension.options, r = t.messages ?? n("zh"), i = Sr(e.editor), a = U(!1), o = U(!1), c = U(!1), l = G(() => _(e.node.attrs ?? {})), u = U(l.value?.title ?? ""), f = U(l.value?.href ?? "");
2188
+ let t = e.extension.options, r = t.messages ?? n("zh"), i = ti(e.editor), a = U(!1), o = U(!1), c = U(!1), l = G(() => _(e.node.attrs ?? {})), u = U(l.value?.title ?? ""), f = U(l.value?.href ?? "");
1795
2189
  K(l, (e) => {
1796
2190
  u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
1797
2191
  });
@@ -1826,7 +2220,7 @@ var Ar = Y({
1826
2220
  "data-testid": n,
1827
2221
  onMousedown: h,
1828
2222
  onClick: r
1829
- }, [Er(t, e), H("span", { role: "tooltip" }, e)]);
2223
+ }, [ai(t, e), H("span", { role: "tooltip" }, e)]);
1830
2224
  return () => {
1831
2225
  let n = l.value;
1832
2226
  if (!n) return null;
@@ -1862,10 +2256,10 @@ var Ar = Y({
1862
2256
  a.value = !1;
1863
2257
  },
1864
2258
  onMousedown: (e) => {
1865
- Tr(e.target) || e.preventDefault();
2259
+ ii(e.target) || e.preventDefault();
1866
2260
  },
1867
2261
  onClick: (e) => {
1868
- Tr(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
2262
+ ii(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
1869
2263
  }
1870
2264
  }, () => [
1871
2265
  H("a", {
@@ -1885,9 +2279,9 @@ var Ar = Y({
1885
2279
  "data-markweave-link-card-ui": "true",
1886
2280
  "aria-label": r.linkCard.toolsAriaLabel
1887
2281
  }, [
1888
- C(r.linkCard.convertToLink, $n, "markweave-link-card-convert", x),
1889
- C(r.linkCard.copyAddress, Bn, "markweave-link-card-copy", () => b(n.href)),
1890
- C(r.linkCard.edit, or, "markweave-link-card-edit", (i) => g({
2282
+ C(r.linkCard.convertToLink, Dr, "markweave-link-card-convert", x),
2283
+ C(r.linkCard.copyAddress, mr, "markweave-link-card-copy", () => b(n.href)),
2284
+ C(r.linkCard.edit, Fr, "markweave-link-card-edit", (i) => g({
1891
2285
  anchor: i.currentTarget,
1892
2286
  editor: e.editor,
1893
2287
  messages: r,
@@ -1897,7 +2291,7 @@ var Ar = Y({
1897
2291
  attrs: n
1898
2292
  }
1899
2293
  })),
1900
- C(r.linkCard.delete, gr, "markweave-link-card-delete", () => e.deleteNode())
2294
+ C(r.linkCard.delete, Yr, "markweave-link-card-delete", () => e.deleteNode())
1901
2295
  ]) : null,
1902
2296
  p.value && o.value ? H("form", {
1903
2297
  class: "markweave-link-card-editor",
@@ -1925,12 +2319,12 @@ var Ar = Y({
1925
2319
  type: "submit",
1926
2320
  disabled: !v(f.value),
1927
2321
  "aria-label": r.linkCard.edit
1928
- }, [Er($n, r.linkCard.edit)])
2322
+ }, [ai(Dr, r.linkCard.edit)])
1929
2323
  ]) : null
1930
2324
  ]);
1931
2325
  };
1932
2326
  }
1933
- }), Fr = h.extend({
2327
+ }), mi = h.extend({
1934
2328
  addOptions() {
1935
2329
  return {
1936
2330
  ...this.parent?.(),
@@ -1939,23 +2333,23 @@ var Ar = Y({
1939
2333
  };
1940
2334
  },
1941
2335
  addNodeView() {
1942
- return typeof document > "u" ? null : c(Pr, { stopEvent: ({ event: e }) => Tr(e.target) });
2336
+ return typeof document > "u" ? null : c(pi, { stopEvent: ({ event: e }) => ii(e.target) });
1943
2337
  }
1944
2338
  });
1945
2339
  //#endregion
1946
2340
  //#region src/create-editor-extensions.ts
1947
- function Ir(t = {}) {
2341
+ function hi(t = {}) {
1948
2342
  return e({
1949
2343
  lang: t.lang,
1950
2344
  onImageUpload: t.onImageUpload,
1951
- linkCardExtension: Fr.configure({
2345
+ linkCardExtension: mi.configure({
1952
2346
  lang: t.lang,
1953
2347
  messages: n(t.lang),
1954
2348
  resolver: t.linkCardResolver
1955
2349
  }),
1956
2350
  mediaExtensions: i({
1957
- image: Mr,
1958
- video: Nr,
2351
+ image: di,
2352
+ video: fi,
1959
2353
  lang: t.lang,
1960
2354
  onImageUpload: t.onImageUpload,
1961
2355
  onVideoUpload: t.onVideoUpload,
@@ -1965,7 +2359,7 @@ function Ir(t = {}) {
1965
2359
  }
1966
2360
  //#endregion
1967
2361
  //#region src/MarkweaveEditor.ts
1968
- var Lr = {
2362
+ var gi = {
1969
2363
  active: !1,
1970
2364
  mode: "outside",
1971
2365
  activeCellPos: null,
@@ -1973,17 +2367,17 @@ var Lr = {
1973
2367
  selectedCellCount: 0,
1974
2368
  selectionFrom: 0,
1975
2369
  selectionTo: 0
1976
- }, Rr = {
2370
+ }, _i = {
1977
2371
  active: !1,
1978
2372
  language: Fe.defaultLanguage,
1979
2373
  mermaidPreviewMode: "code",
1980
2374
  pos: null,
1981
2375
  text: ""
1982
2376
  };
1983
- function zr(e) {
1984
- return Gt.getState(e.state) ?? Wt;
2377
+ function vi(e) {
2378
+ return qt.getState(e.state) ?? Kt;
1985
2379
  }
1986
- function Br(e) {
2380
+ function yi(e) {
1987
2381
  if (!e || typeof window > "u") return null;
1988
2382
  let t = e.parentElement;
1989
2383
  for (; t;) {
@@ -2000,7 +2394,7 @@ function Z(e, t, n = 18, r = 1.8) {
2000
2394
  "aria-hidden": "true"
2001
2395
  }, { default: () => t });
2002
2396
  }
2003
- function Vr(e) {
2397
+ function bi(e) {
2004
2398
  return e === "clipboard" ? [H("path", { d: "M9 4.5h6a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 15 18.5H7A1.5 1.5 0 0 1 5.5 17V6A1.5 1.5 0 0 1 7 4.5h2" }), H("path", { d: "M8.5 5.5v-1A1.5 1.5 0 0 1 10 3h2a1.5 1.5 0 0 1 1.5 1.5v1h-5Z" })] : e === "search" ? [H("circle", {
2005
2399
  cx: "10",
2006
2400
  cy: "10",
@@ -2048,57 +2442,57 @@ function Q(e) {
2048
2442
  "stroke-linecap": "round",
2049
2443
  "stroke-linejoin": "round",
2050
2444
  "stroke-width": "1.8"
2051
- }, Vr(e)));
2445
+ }, bi(e)));
2052
2446
  }
2053
2447
  function $(e) {
2054
2448
  e.preventDefault();
2055
2449
  }
2056
- function Hr(e) {
2450
+ function xi(e) {
2057
2451
  let t = ft(e);
2058
2452
  return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
2059
2453
  }
2060
- var Ur = {
2061
- bold: jn,
2062
- italic: Zn,
2063
- underline: vr,
2064
- strike: dr,
2065
- "inline-code": Rn,
2066
- link: $n,
2067
- more: ir,
2068
- superscript: pr,
2069
- subscript: fr,
2070
- "inline-math": lr,
2071
- "align-left": On,
2072
- "align-center": En,
2073
- "align-right": kn,
2074
- "align-justify": Dn,
2075
- "decrease-indent": Jn,
2076
- "increase-indent": Yn
2077
- }, Wr = {
2078
- type: hr,
2079
- "heading-1": Un,
2080
- "heading-2": Wn,
2081
- "heading-3": Gn,
2082
- "bullet-list": er,
2083
- "ordered-list": nr,
2084
- "task-list": tr,
2085
- blockquote: sr,
2086
- "code-block": Mn,
2087
- info: Xn,
2088
- tip: Qn,
2089
- warning: An,
2090
- error: Ln,
2091
- success: Pn,
2092
- emoji: ur,
2093
- math: lr,
2094
- table: mr,
2095
- separator: rr,
2096
- image: Kn,
2097
- video: br,
2098
- attachment: ar
2454
+ var Si = {
2455
+ bold: rr,
2456
+ italic: Tr,
2457
+ underline: Zr,
2458
+ strike: Hr,
2459
+ "inline-code": dr,
2460
+ link: Dr,
2461
+ more: Mr,
2462
+ superscript: Wr,
2463
+ subscript: Ur,
2464
+ "inline-math": zr,
2465
+ "align-left": Vn,
2466
+ "align-center": zn,
2467
+ "align-right": Hn,
2468
+ "align-justify": Bn,
2469
+ "decrease-indent": Sr,
2470
+ "increase-indent": Cr
2471
+ }, Ci = {
2472
+ type: Jr,
2473
+ "heading-1": _r,
2474
+ "heading-2": vr,
2475
+ "heading-3": yr,
2476
+ "bullet-list": Or,
2477
+ "ordered-list": Ar,
2478
+ "task-list": kr,
2479
+ blockquote: Lr,
2480
+ "code-block": ir,
2481
+ info: wr,
2482
+ tip: Er,
2483
+ warning: Kn,
2484
+ error: ur,
2485
+ success: or,
2486
+ emoji: Br,
2487
+ math: zr,
2488
+ table: Gr,
2489
+ separator: jr,
2490
+ image: br,
2491
+ video: $r,
2492
+ attachment: Pr
2099
2493
  };
2100
- function Gr(e) {
2101
- let t = Wr[e];
2494
+ function wi(e) {
2495
+ let t = Ci[e];
2102
2496
  return H(t, {
2103
2497
  size: 18,
2104
2498
  strokeWidth: 1.6,
@@ -2106,21 +2500,21 @@ function Gr(e) {
2106
2500
  "aria-hidden": "true"
2107
2501
  });
2108
2502
  }
2109
- var Kr = {
2110
- paragraph: _r,
2111
- "heading-1": Un,
2112
- "heading-2": Wn,
2113
- "heading-3": Gn,
2114
- "bullet-list": er,
2115
- "numbered-list": nr,
2116
- "todo-list": tr,
2117
- quote: sr,
2118
- "code-block": Mn
2503
+ var Ti = {
2504
+ paragraph: Xr,
2505
+ "heading-1": _r,
2506
+ "heading-2": vr,
2507
+ "heading-3": yr,
2508
+ "bullet-list": Or,
2509
+ "numbered-list": Ar,
2510
+ "todo-list": kr,
2511
+ quote: Lr,
2512
+ "code-block": ir
2119
2513
  };
2120
- function qr(e, t) {
2514
+ function Ei(e, t) {
2121
2515
  return se(e, t).label;
2122
2516
  }
2123
- var Jr = Y({
2517
+ var Di = Y({
2124
2518
  name: "MarkweaveVueFloatingToolbar",
2125
2519
  props: {
2126
2520
  editor: {
@@ -2140,7 +2534,7 @@ var Jr = Y({
2140
2534
  let t = U(null), n = U(""), r = U(null), i = U(null), a = U("bottom"), o = U(null), s = U(null), c = U(null), l = G(() => ft(n.value.trim())), u = G(() => e.messages.floatingToolbar), d = G(() => de(e.messages).map((e) => [
2141
2535
  e.id,
2142
2536
  e.label,
2143
- Kr[e.id]
2537
+ Ti[e.id]
2144
2538
  ])), f = G(() => ue(e.messages).map((e) => [
2145
2539
  e.id,
2146
2540
  e.value,
@@ -2172,7 +2566,7 @@ var Jr = Y({
2172
2566
  });
2173
2567
  K(t, (e) => {
2174
2568
  e && J(v.schedule);
2175
- }), Cn(() => {
2569
+ }), In(() => {
2176
2570
  window.addEventListener("resize", v.schedule), window.addEventListener("scroll", v.schedule, !0);
2177
2571
  }), q(() => {
2178
2572
  v.cancel(), window.removeEventListener("resize", v.schedule), window.removeEventListener("scroll", v.schedule, !0);
@@ -2215,7 +2609,7 @@ var Jr = Y({
2215
2609
  onMouseenter: (e) => b(n, e.currentTarget),
2216
2610
  onMouseleave: () => b(null),
2217
2611
  onClick: o
2218
- }, n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, qr(e.editor, e.messages)), Z(t.value === "block-type" ? In : Fn, i)])] : n === "color" ? [H("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [H("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? In : Fn, i)])] : [Z(a, i)]), C = () => H("span", {
2612
+ }, n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, Ei(e.editor, e.messages)), Z(t.value === "block-type" ? lr : sr, i)])] : n === "color" ? [H("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [H("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? lr : sr, i)])] : [Z(a, i)]), C = () => H("span", {
2219
2613
  class: "markweave-floating-toolbar-divider",
2220
2614
  "aria-hidden": "true"
2221
2615
  }), w = (n, r, i) => H("section", {
@@ -2271,7 +2665,7 @@ var Jr = Y({
2271
2665
  "aria-label": u.value.applyLink,
2272
2666
  "data-testid": "markweave-floating-toolbar-link-apply",
2273
2667
  onMousedown: $
2274
- }, [Z(zn, u.value.applyLink)]),
2668
+ }, [Z(fr, u.value.applyLink)]),
2275
2669
  H("span", {
2276
2670
  class: "markweave-floating-toolbar-link-divider",
2277
2671
  "aria-hidden": "true"
@@ -2282,15 +2676,15 @@ var Jr = Y({
2282
2676
  "aria-label": u.value.openLink,
2283
2677
  "data-testid": "markweave-floating-toolbar-link-open",
2284
2678
  onMousedown: $,
2285
- onClick: () => Hr(n.value)
2286
- }, [Z(Hn, u.value.openLink)]),
2679
+ onClick: () => xi(n.value)
2680
+ }, [Z(gr, u.value.openLink)]),
2287
2681
  H("button", {
2288
2682
  type: "button",
2289
2683
  "aria-label": u.value.removeLink,
2290
2684
  "data-testid": "markweave-floating-toolbar-link-remove",
2291
2685
  onMousedown: $,
2292
2686
  onClick: g
2293
- }, [Z(gr, u.value.removeLink)])
2687
+ }, [Z(Yr, u.value.removeLink)])
2294
2688
  ])]) : t.value === "color" ? H("div", {
2295
2689
  ref: c,
2296
2690
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
@@ -2317,7 +2711,7 @@ var Jr = Y({
2317
2711
  onClick: () => {
2318
2712
  fe(e.editor, n), t.value = null;
2319
2713
  }
2320
- }, [Z(Ur[n], u.value.moreActions[n])]), r.value === n ? H("div", {
2714
+ }, [Z(Si[n], u.value.moreActions[n])]), r.value === n ? H("div", {
2321
2715
  class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
2322
2716
  role: "tooltip"
2323
2717
  }, u.value.moreActions[n]) : null]))) : null;
@@ -2335,23 +2729,23 @@ var Jr = Y({
2335
2729
  class: "markweave-floating-toolbar-content",
2336
2730
  "data-menu": t.value ?? "none"
2337
2731
  }, [
2338
- S("block-type", u.value.buttons["block-type"], _r, () => _("block-type"), t.value === "block-type"),
2732
+ S("block-type", u.value.buttons["block-type"], Xr, () => _("block-type"), t.value === "block-type"),
2339
2733
  C(),
2340
- S("bold", u.value.buttons.bold, jn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
2341
- S("italic", u.value.buttons.italic, Zn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
2342
- S("underline", u.value.buttons.underline, vr, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
2343
- S("strike", u.value.buttons.strike, dr, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
2344
- S("inline-code", u.value.buttons["inline-code"], Rn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
2734
+ S("bold", u.value.buttons.bold, rr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
2735
+ S("italic", u.value.buttons.italic, Tr, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
2736
+ S("underline", u.value.buttons.underline, Zr, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
2737
+ S("strike", u.value.buttons.strike, Hr, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
2738
+ S("inline-code", u.value.buttons["inline-code"], dr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
2345
2739
  C(),
2346
- S("link", u.value.buttons.link, $n, () => _("link"), e.editor.isActive("link")),
2347
- S("color", u.value.buttons.color, _r, () => _("color"), t.value === "color"),
2740
+ S("link", u.value.buttons.link, Dr, () => _("link"), e.editor.isActive("link")),
2741
+ S("color", u.value.buttons.color, Xr, () => _("color"), t.value === "color"),
2348
2742
  C(),
2349
- S("more", u.value.buttons.more, ir, () => _("more"), t.value === "more"),
2743
+ S("more", u.value.buttons.more, Mr, () => _("more"), t.value === "more"),
2350
2744
  T(),
2351
2745
  x()
2352
2746
  ])]) });
2353
2747
  }
2354
- }), Yr = Y({
2748
+ }), Oi = Y({
2355
2749
  name: "MarkweaveVueMathEditorPopover",
2356
2750
  props: {
2357
2751
  editor: {
@@ -2404,7 +2798,7 @@ var Jr = Y({
2404
2798
  };
2405
2799
  return K(() => [e.target.pos, e.target.latex], () => {
2406
2800
  t.value = e.target.latex, a.value = _t(e.editor, e.target), J(u);
2407
- }), Cn(() => {
2801
+ }), In(() => {
2408
2802
  St(e.editor, e.target, !0), u(), J(() => {
2409
2803
  i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
2410
2804
  }), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
@@ -2470,14 +2864,14 @@ var Jr = Y({
2470
2864
  }, [
2471
2865
  H("div", { class: "markweave-math-block-toolbar" }, [
2472
2866
  H("span", null, c.value.label),
2473
- Z(Rn, c.value.label, 15, 1.75),
2867
+ Z(dr, c.value.label, 15, 1.75),
2474
2868
  H("button", {
2475
2869
  type: "submit",
2476
2870
  title: c.value.apply,
2477
2871
  "aria-label": c.value.apply,
2478
2872
  disabled: !s.value,
2479
2873
  "data-testid": "markweave-math-editor-apply"
2480
- }, [Z(Pn, c.value.apply, 16, 2)])
2874
+ }, [Z(or, c.value.apply, 16, 2)])
2481
2875
  ]),
2482
2876
  H("label", {
2483
2877
  class: "markweave-math-block-source",
@@ -2500,7 +2894,7 @@ var Jr = Y({
2500
2894
  ]);
2501
2895
  };
2502
2896
  }
2503
- }), Xr = Y({
2897
+ }), ki = Y({
2504
2898
  name: "MarkweaveVueSlashCommandMenu",
2505
2899
  props: {
2506
2900
  commands: {
@@ -2709,7 +3103,7 @@ var Jr = Y({
2709
3103
  }
2710
3104
  }
2711
3105
  }, [
2712
- Gr(t.icon),
3106
+ wi(t.icon),
2713
3107
  H("span", null, t.label),
2714
3108
  t.disabledReason ? H("small", null, t.disabledReason) : null
2715
3109
  ]);
@@ -2720,7 +3114,33 @@ var Jr = Y({
2720
3114
  }, e.messages.slash.noResults)])]);
2721
3115
  };
2722
3116
  }
2723
- }), Zr = Y({
3117
+ }), Ai = {
3118
+ "move-left": Yn,
3119
+ "move-right": Xn,
3120
+ "move-up": Zn,
3121
+ "move-down": qn,
3122
+ "insert-left": nr,
3123
+ "insert-right": tr,
3124
+ "insert-above": er,
3125
+ "insert-below": $n,
3126
+ "sort-asc": Jn,
3127
+ "sort-desc": Qn,
3128
+ color: Nr,
3129
+ alignment: Vn,
3130
+ clear: Vr,
3131
+ duplicate: pr,
3132
+ copy: pr,
3133
+ merge: Kr,
3134
+ split: qr,
3135
+ delete: Yr
3136
+ }, ji = {
3137
+ left: Vn,
3138
+ center: zn,
3139
+ right: Hn,
3140
+ top: Gn,
3141
+ middle: Un,
3142
+ bottom: Wn
3143
+ }, Mi = Y({
2724
3144
  name: "MarkweaveVueTableControls",
2725
3145
  props: {
2726
3146
  editor: {
@@ -2753,221 +3173,422 @@ var Jr = Y({
2753
3173
  }
2754
3174
  },
2755
3175
  setup(e) {
2756
- let t = U(null), n = U("row-edge"), r = U(null), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U(null), u = U(null), d = U(null), f = U(null), p = null, m = G(() => e.active ? Ht(e.editor.state) : Lr), h = G(() => en(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = G(() => en(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = G(() => Qt(e.editor)), v = G(() => _.value.length > 0), y = G(() => t.value ? an(e.editor, t.value) : []), b = () => {
2757
- p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
2758
- }, x = (e) => {
2759
- b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
2760
- s.value = null, p = null;
2761
- }, ln));
2762
- }, S = () => {
3176
+ let t = U(null), n = U(null), r = U("row-edge"), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U(null), u = U(null), d = U(0), f = U(null), p = U(null), m = U(null), h = U(null), g = U(null), _ = null, v = null, y = null, b = G(() => e.active ? Wt(e.editor.state) : gi), x = G(() => ln(e.editor, e.interactionState, "row", b.value.activeCellPos)), S = G(() => ln(e.editor, e.interactionState, "column", b.value.activeCellPos)), C = G(() => an(e.editor)), w = G(() => (C.value, b.value.active)), T = G(() => t.value ? pn(e.editor, t.value) : []), E = () => {
3177
+ _ === null || typeof window > "u" || (window.clearTimeout(_), _ = null);
3178
+ }, D = (e) => {
3179
+ E(), u.value = e, !(!e || typeof window > "u") && (_ = window.setTimeout(() => {
3180
+ u.value = null, _ = null;
3181
+ }, yn));
3182
+ }, O = () => {
2763
3183
  if (!e.active) {
2764
- r.value = null, i.value = null, a.value = null, x(null);
3184
+ i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, D(null);
2765
3185
  return;
2766
3186
  }
2767
- let o = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement;
2768
- if (!o) {
2769
- r.value = null, i.value = null, a.value = null;
3187
+ let n = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement;
3188
+ if (!n) {
3189
+ i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
2770
3190
  return;
2771
3191
  }
2772
- let s = o.getBoundingClientRect(), c = h.value ? $t(e.editor, h.value) : null, l = g.value ? $t(e.editor, g.value) : null, u = v.value ? on(e.editor) : null;
2773
- c ? r.value = qt({
2774
- targetRect: c,
2775
- frameRect: s,
3192
+ let l = n.getBoundingClientRect(), u = x.value ? cn(e.editor, x.value) : null, d = S.value ? cn(e.editor, S.value) : null, f = w.value ? mn(e.editor) : null, p = rn(e.editor)?.getBoundingClientRect() ?? null;
3193
+ u ? i.value = Qt({
3194
+ targetRect: u,
3195
+ frameRect: l,
2776
3196
  kind: "row"
2777
- }) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = qt({
2778
- targetRect: l,
2779
- frameRect: s,
3197
+ }) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = Qt({
3198
+ targetRect: d,
3199
+ frameRect: l,
2780
3200
  kind: "column"
2781
- }) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = qt({
2782
- targetRect: u,
2783
- frameRect: s,
3201
+ }) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = Qt({
3202
+ targetRect: f,
3203
+ frameRect: l,
2784
3204
  kind: "selection"
2785
- }) : t.value === "selection" && n.value === "selection-edge" || (a.value = null);
2786
- }, C = () => {
3205
+ }) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
3206
+ let m = e.interactionState.hoverCellPos !== null && !!(x.value && x.value.index === x.value.visualHeight - 1), h = e.interactionState.hoverCellPos !== null && !!(S.value && S.value.index === S.value.visualWidth - 1);
3207
+ s.value = p && m ? $t({
3208
+ tableRect: p,
3209
+ frameRect: l,
3210
+ kind: "row"
3211
+ }) : null, c.value = p && h ? $t({
3212
+ tableRect: p,
3213
+ frameRect: l,
3214
+ kind: "column"
3215
+ }) : null;
3216
+ }, k = () => {
2787
3217
  if (!e.active || !t.value) {
2788
- o.value = null;
3218
+ l.value = null;
2789
3219
  return;
2790
3220
  }
2791
- let r = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement, i = n.value === "row-edge" ? l.value : n.value === "column-edge" ? u.value : d.value;
2792
- if (!r || !i || !f.value) {
2793
- o.value = null;
3221
+ let n = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement, i = r.value === "row-edge" ? p.value : r.value === "column-edge" ? m.value : h.value;
3222
+ if (!n || !i || !g.value) {
3223
+ l.value = null;
2794
3224
  return;
2795
3225
  }
2796
- let a = i.getBoundingClientRect(), s = t.value === "row" ? Zt(e.editor)?.getBoundingClientRect() : null, c = s ? {
3226
+ let a = i.getBoundingClientRect(), o = t.value === "row" ? rn(e.editor)?.getBoundingClientRect() : null, s = o ? {
2797
3227
  left: a.left,
2798
- top: s.top,
3228
+ top: o.top,
2799
3229
  width: a.width,
2800
3230
  height: a.height
2801
- } : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
2802
- o.value = Kt({
2803
- anchorRect: c,
2804
- frameRect: p,
3231
+ } : a, c = n.getBoundingClientRect(), u = g.value.getBoundingClientRect();
3232
+ l.value = Zt({
3233
+ anchorRect: s,
3234
+ frameRect: c,
2805
3235
  menuSize: {
2806
- width: m.width || 204,
2807
- height: m.height || 220
3236
+ width: u.width || 254,
3237
+ height: u.height || 410
2808
3238
  },
2809
3239
  kind: t.value
2810
3240
  });
2811
- }, w = () => {
2812
- S(), C();
2813
- }, T = () => {
2814
- J(w);
2815
- }, E = (e, r) => {
2816
- let i = t.value === e && n.value === r;
2817
- n.value = r, t.value = i ? null : e, T();
2818
- }, D = () => {
2819
- e.editor.view.dispatch(zt(e.editor.state.tr, null));
2820
- }, O = (t, n) => {
2821
- let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
2822
- r !== null && cn(e.editor, r, t, { visualIndex: i }), E(t, n);
2823
- }, k = () => {
2824
- D(), E("selection", "selection-edge");
2825
- }, A = (n = !1) => {
2826
- t.value = null, o.value = null, n && e.editor.view.focus();
2827
- }, j = async (n, r) => {
2828
- let i = await Yt({
3241
+ }, A = () => {
3242
+ O(), k();
3243
+ }, j = () => {
3244
+ J(A);
3245
+ }, M = (e, i) => {
3246
+ let a = t.value === e && r.value === i;
3247
+ r.value = i, t.value = a ? null : e, n.value = null, j();
3248
+ }, N = () => {
3249
+ e.editor.view.dispatch(Vt(e.editor.state.tr, null));
3250
+ }, P = (t, n) => {
3251
+ let r = e.interactionState.hoverCellPos ?? b.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
3252
+ r !== null && _n(e.editor, r, t, { visualIndex: i }), M(t, n);
3253
+ }, F = () => {
3254
+ N(), M("selection", "selection-edge");
3255
+ }, I = (r = !1) => {
3256
+ t.value = null, n.value = null, l.value = null, r && e.editor.view.focus();
3257
+ }, L = async (n, r) => {
3258
+ let i = await tn({
2829
3259
  editor: e.editor,
2830
3260
  commandId: n,
2831
3261
  menu: r ?? t.value ?? "selection",
2832
3262
  messages: e.messages
2833
3263
  });
2834
- return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
2835
- }, M = (t) => {
2836
- let n = tn(e.editor, t);
2837
- n && e.onEditWithAi?.(n), A(!0);
2838
- }, N = (e) => {
2839
- !t.value || e.key !== "Escape" || A(!0);
2840
- }, P = (e) => {
2841
- t.value && (e.target instanceof Node && c.value?.contains(e.target) || A());
3264
+ return i.copyFeedback ? (D(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : D(null), e.onCommandResult?.(i.commandResult), i.success;
3265
+ }, ee = (t) => {
3266
+ let n = un(e.editor, t);
3267
+ n && e.onEditWithAi?.(n), I(!0);
3268
+ }, R = (e) => {
3269
+ t.value !== "row" && t.value !== "column" || e(t.value) && (d.value += 1, j());
3270
+ }, z = (t) => {
3271
+ let n = t === "row" ? x.value : S.value, r = e.interactionState.hoverCellPos ?? b.value.activeCellPos;
3272
+ !n || r === null || Cn(e.editor, r, t, { visualIndex: n.index }) && L(t === "row" ? "add-row-after" : "add-column-after", t);
3273
+ }, te = (e, t, n) => {
3274
+ v = {
3275
+ axis: e,
3276
+ index: t
3277
+ }, y = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
3278
+ }, ne = (t) => {
3279
+ if (!v) return;
3280
+ let n = on(e.editor, v.axis, t.clientX, t.clientY);
3281
+ n !== null && (t.preventDefault(), y = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
3282
+ }, B = (t) => {
3283
+ let n = v;
3284
+ if (!n) return;
3285
+ let r = on(e.editor, n.axis, t.clientX, t.clientY) ?? y;
3286
+ t.preventDefault(), v = null, y = null, r !== null && gn(e.editor, n.axis, n.index, r);
3287
+ }, V = G(() => (d.value, t.value === "row" || t.value === "column" ? sn(e.editor, t.value) : null)), re = (e) => {
3288
+ if (!(!t.value || e.key !== "Escape")) {
3289
+ if (n.value) {
3290
+ n.value = null;
3291
+ return;
3292
+ }
3293
+ I(!0);
3294
+ }
3295
+ }, ie = (e) => {
3296
+ if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
3297
+ let t = e.currentTarget;
3298
+ if (!(t instanceof HTMLElement)) return;
3299
+ let n = Array.from(t.querySelectorAll(":scope > button[role=\"menuitem\"]:not(:disabled), :scope > button[role=\"menuitemradio\"]:not(:disabled)")), r = n.indexOf(document.activeElement), i = e.key === "ArrowDown" ? 1 : -1, a = r < 0 ? 0 : Math.min(n.length - 1, Math.max(0, r + i));
3300
+ e.preventDefault(), e.stopPropagation(), n[a]?.focus();
3301
+ }, ae = (e) => {
3302
+ t.value && (e.target instanceof Node && f.value?.contains(e.target) || I());
2842
3303
  };
2843
- Cn(() => {
2844
- w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown", N), document.addEventListener("mousedown", P);
3304
+ In(() => {
3305
+ A(), window.addEventListener("resize", A), window.addEventListener("scroll", A, !0), document.addEventListener("keydown", re), document.addEventListener("mousedown", ae), document.addEventListener("dragover", ne), document.addEventListener("drop", B);
2845
3306
  }), q(() => {
2846
- b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown", N), document.removeEventListener("mousedown", P);
3307
+ E(), window.removeEventListener("resize", A), window.removeEventListener("scroll", A, !0), document.removeEventListener("keydown", re), document.removeEventListener("mousedown", ae), document.removeEventListener("dragover", ne), document.removeEventListener("drop", B);
2847
3308
  }), K(() => [
2848
3309
  e.active,
2849
- m.value.activeCellPos,
2850
- m.value.selectionFrom,
2851
- m.value.selectionTo,
3310
+ b.value.activeCellPos,
3311
+ b.value.selectionFrom,
3312
+ b.value.selectionTo,
2852
3313
  e.interactionState.hoverCellPos,
2853
3314
  e.interactionState.hoverVisualColumnIndex,
2854
3315
  e.interactionState.hoverVisualRowIndex,
2855
3316
  t.value,
2856
- n.value
2857
- ], T, { flush: "post" });
2858
- let F = () => t.value ? H("div", {
2859
- ref: f,
2860
- class: "markweave-table-menu",
2861
- role: "menu",
2862
- "aria-label": un(t.value, e.messages),
2863
- "data-testid": "markweave-table-menu",
2864
- "data-positioned": o.value ? "true" : "false",
2865
- style: o.value ? {
2866
- left: `${o.value.left}px`,
2867
- top: `${o.value.top}px`
2868
- } : void 0
2869
- }, y.value.map((n, r) => {
2870
- let i = nn(n), a = r === 0 ? i : nn(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : Jt(e.editor, n.commandId), c = rn(n, e.messages);
2871
- return H("button", {
2872
- key: `${n.id}-${r}`,
2873
- type: "button",
2874
- role: "menuitem",
2875
- "aria-label": c,
2876
- "aria-disabled": !s,
2877
- disabled: !s,
2878
- "data-menu-group": i,
2879
- "data-starts-group": o ? "true" : "false",
2880
- "data-command-enabled": s ? "true" : "false",
2881
- "data-testid": n.commandId ? `markweave-table-menu-command-${n.commandId}` : "markweave-table-menu-command-edit-with-ai",
2882
- onMousedown: $,
2883
- onClick: () => {
2884
- if (s) {
2885
- if (n.commandId === null) {
2886
- M(t.value === "row" || t.value === "column" ? t.value : "selection");
2887
- return;
3317
+ r.value
3318
+ ], j, { flush: "post" });
3319
+ let oe = () => {
3320
+ if (!t.value) return null;
3321
+ let r = T.value.map((r, i) => {
3322
+ let a = dn(r), o = i === 0 ? a : dn(T.value[i - 1]), s = i > 0 && o !== a, c = r.submenuId ? !0 : r.commandId === null ? !!e.onEditWithAi : en(e.editor, r.commandId), l = fn(r, e.messages), u = Ai[r.icon];
3323
+ return H("button", {
3324
+ key: `${r.id}-${i}`,
3325
+ type: "button",
3326
+ role: "menuitem",
3327
+ "aria-label": l,
3328
+ "aria-disabled": !c,
3329
+ "aria-haspopup": r.submenuId ? "menu" : void 0,
3330
+ "aria-expanded": r.submenuId ? n.value === r.submenuId : void 0,
3331
+ disabled: !c,
3332
+ "data-menu-group": a,
3333
+ "data-starts-group": s ? "true" : "false",
3334
+ "data-command-enabled": c ? "true" : "false",
3335
+ "data-submenu-trigger": r.submenuId ?? void 0,
3336
+ "data-testid": r.commandId ? `markweave-table-menu-command-${r.commandId}` : r.submenuId ? `markweave-table-menu-submenu-${r.submenuId}` : "markweave-table-menu-command-edit-with-ai",
3337
+ onMousedown: $,
3338
+ onMouseenter: () => {
3339
+ n.value = r.submenuId;
3340
+ },
3341
+ onClick: () => {
3342
+ if (c) {
3343
+ if (r.submenuId) {
3344
+ n.value = r.submenuId;
3345
+ return;
3346
+ }
3347
+ if (r.commandId === null) {
3348
+ ee(t.value === "row" || t.value === "column" ? t.value : "selection");
3349
+ return;
3350
+ }
3351
+ L(r.commandId).finally(() => I());
2888
3352
  }
2889
- j(n.commandId).finally(() => A());
2890
3353
  }
2891
- }
2892
- }, c);
2893
- })) : null;
3354
+ }, [
3355
+ H("span", {
3356
+ class: "markweave-table-menu-item-icon",
3357
+ "aria-hidden": "true"
3358
+ }, [H(u, {
3359
+ size: 18,
3360
+ strokeWidth: 1.8
3361
+ })]),
3362
+ H("span", { class: "markweave-table-menu-item-label" }, l),
3363
+ r.submenuId ? H(cr, {
3364
+ class: "markweave-table-menu-chevron",
3365
+ size: 16,
3366
+ "aria-hidden": "true"
3367
+ }) : null
3368
+ ]);
3369
+ });
3370
+ if (n.value === "color" && (t.value === "row" || t.value === "column") && r.push(H("div", {
3371
+ class: "markweave-table-submenu markweave-table-color-menu",
3372
+ role: "menu",
3373
+ "aria-label": e.messages.table.submenus.color,
3374
+ "data-testid": "markweave-table-color-menu",
3375
+ onKeydown: ie
3376
+ }, [
3377
+ H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
3378
+ ...vn.map((t) => H("button", {
3379
+ key: `text-${t.id}`,
3380
+ type: "button",
3381
+ role: "menuitemradio",
3382
+ "aria-checked": V.value?.textColorId === t.id,
3383
+ "data-active": V.value?.textColorId === t.id ? "true" : "false",
3384
+ "data-testid": `markweave-table-text-color-${t.id}`,
3385
+ onMousedown: $,
3386
+ onClick: () => R((n) => Xt(e.editor, n, t.id))
3387
+ }, [H("span", {
3388
+ class: "markweave-table-color-swatch markweave-table-text-color-swatch",
3389
+ "aria-hidden": "true",
3390
+ style: { backgroundColor: t.textColor ?? "var(--markweave-text)" }
3391
+ }), H("span", null, e.messages.table.colors[t.id].text)])),
3392
+ H("div", { class: "markweave-table-submenu-separator" }),
3393
+ H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
3394
+ ...vn.map((t) => H("button", {
3395
+ key: `background-${t.id}`,
3396
+ type: "button",
3397
+ role: "menuitemradio",
3398
+ "aria-checked": V.value?.backgroundColorId === t.id,
3399
+ "data-active": V.value?.backgroundColorId === t.id ? "true" : "false",
3400
+ "data-testid": `markweave-table-background-color-${t.id}`,
3401
+ onMousedown: $,
3402
+ onClick: () => R((n) => Yt(e.editor, n, t.id))
3403
+ }, [H("span", {
3404
+ class: "markweave-table-color-swatch",
3405
+ "aria-hidden": "true",
3406
+ style: { backgroundColor: t.backgroundColor }
3407
+ }), H("span", null, e.messages.table.colors[t.id].background)]))
3408
+ ])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
3409
+ let t = (t, n) => {
3410
+ let r = ji[t];
3411
+ return H("button", {
3412
+ key: t,
3413
+ type: "button",
3414
+ role: "menuitemradio",
3415
+ "aria-checked": n,
3416
+ "data-active": n ? "true" : "false",
3417
+ "data-testid": `markweave-table-alignment-${t}`,
3418
+ onMousedown: $,
3419
+ onClick: () => R((n) => Jt(e.editor, n, t))
3420
+ }, [H(r, {
3421
+ size: 18,
3422
+ strokeWidth: 1.8,
3423
+ "aria-hidden": "true"
3424
+ }), H("span", null, e.messages.table.alignments[t])]);
3425
+ };
3426
+ r.push(H("div", {
3427
+ class: "markweave-table-submenu markweave-table-alignment-menu",
3428
+ role: "menu",
3429
+ "aria-label": e.messages.table.submenus.alignment,
3430
+ "data-testid": "markweave-table-alignment-menu",
3431
+ onKeydown: ie
3432
+ }, [
3433
+ ...bn.map((e) => t(e, V.value?.textAlign === e)),
3434
+ H("div", { class: "markweave-table-submenu-separator" }),
3435
+ ...Sn.map((e) => t(e, V.value?.verticalAlign === e))
3436
+ ]));
3437
+ }
3438
+ return H("div", {
3439
+ ref: g,
3440
+ class: "markweave-table-menu",
3441
+ role: "menu",
3442
+ "aria-label": xn(t.value, e.messages),
3443
+ "data-testid": "markweave-table-menu",
3444
+ "data-positioned": l.value ? "true" : "false",
3445
+ "data-submenu": n.value ?? "none",
3446
+ style: l.value ? {
3447
+ left: `${l.value.left}px`,
3448
+ top: `${l.value.top}px`
3449
+ } : void 0,
3450
+ onKeydown: ie
3451
+ }, r);
3452
+ };
2894
3453
  return () => e.active ? H("div", {
2895
- ref: c,
3454
+ ref: f,
2896
3455
  class: "markweave-table-controls",
2897
3456
  "data-testid": "markweave-table-controls",
2898
3457
  "aria-label": e.messages.table.controlsAriaLabel,
2899
3458
  "data-open-menu": t.value ?? "none",
2900
- "data-positioned": r.value || i.value || a.value ? "true" : "false"
3459
+ "data-positioned": i.value || a.value || o.value ? "true" : "false",
3460
+ onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(qt, { type: "clear-hover" }))
2901
3461
  }, [
2902
- s.value ? H("div", {
3462
+ u.value ? H("div", {
2903
3463
  class: "markweave-table-copy-feedback",
2904
3464
  role: "status",
2905
3465
  "aria-live": "polite",
2906
3466
  "data-testid": "markweave-table-copy-feedback",
2907
- "data-copy-kind": s.value.kind,
2908
- "data-text-length": s.value.textLength,
2909
- "data-html-length": s.value.htmlLength
2910
- }, Xt(s.value)) : null,
2911
- r.value ? H("button", {
2912
- ref: l,
3467
+ "data-copy-kind": u.value.kind,
3468
+ "data-text-length": u.value.textLength,
3469
+ "data-html-length": u.value.htmlLength
3470
+ }, nn(u.value)) : null,
3471
+ i.value ? H("button", {
3472
+ ref: p,
2913
3473
  type: "button",
3474
+ draggable: !0,
2914
3475
  class: "markweave-table-edge-handle markweave-table-edge-handle--row",
2915
3476
  "aria-label": e.messages.table.activeRowActions,
2916
- "aria-expanded": t.value === "row" && n.value === "row-edge",
3477
+ "aria-expanded": t.value === "row" && r.value === "row-edge",
2917
3478
  "aria-haspopup": "menu",
2918
3479
  title: e.messages.table.rowActions,
2919
3480
  "data-testid": "markweave-table-hover-row-handle",
2920
- "data-axis-index": h.value?.index ?? "",
2921
- "data-axis-selected-cells": h.value?.selectedCellCount ?? "",
2922
- "data-axis-visual-cells": h.value?.visualCellCount ?? "",
2923
- "data-axis-visual-size": h.value?.visualHeight ?? "",
3481
+ "data-axis-index": x.value?.index ?? "",
3482
+ "data-axis-selected-cells": x.value?.selectedCellCount ?? "",
3483
+ "data-axis-visual-cells": x.value?.visualCellCount ?? "",
3484
+ "data-axis-visual-size": x.value?.visualHeight ?? "",
2924
3485
  style: {
2925
- left: `${r.value.left}px`,
2926
- top: `${r.value.top}px`
3486
+ left: `${i.value.left}px`,
3487
+ top: `${i.value.top}px`,
3488
+ width: `${i.value.width}px`,
3489
+ height: `${i.value.height}px`
2927
3490
  },
2928
3491
  onMousedown: $,
2929
- onClick: () => O("row", "row-edge")
2930
- }, [H("span", { "aria-hidden": "true" }, "...")]) : null,
2931
- i.value ? H("button", {
2932
- ref: u,
3492
+ onClick: () => P("row", "row-edge"),
3493
+ onDragstart: (e) => te("row", x.value?.index ?? 0, e),
3494
+ onDragend: () => {
3495
+ v = null, y = null;
3496
+ }
3497
+ }, [H(Mr, {
3498
+ size: 14,
3499
+ "aria-hidden": "true"
3500
+ })]) : null,
3501
+ a.value ? H("button", {
3502
+ ref: m,
2933
3503
  type: "button",
3504
+ draggable: !0,
2934
3505
  class: "markweave-table-edge-handle markweave-table-edge-handle--column",
2935
3506
  "aria-label": e.messages.table.activeColumnActions,
2936
- "aria-expanded": t.value === "column" && n.value === "column-edge",
3507
+ "aria-expanded": t.value === "column" && r.value === "column-edge",
2937
3508
  "aria-haspopup": "menu",
2938
3509
  title: e.messages.table.columnActions,
2939
3510
  "data-testid": "markweave-table-hover-column-handle",
2940
- "data-axis-index": g.value?.index ?? "",
2941
- "data-axis-selected-cells": g.value?.selectedCellCount ?? "",
2942
- "data-axis-visual-cells": g.value?.visualCellCount ?? "",
2943
- "data-axis-visual-size": g.value?.visualWidth ?? "",
3511
+ "data-axis-index": S.value?.index ?? "",
3512
+ "data-axis-selected-cells": S.value?.selectedCellCount ?? "",
3513
+ "data-axis-visual-cells": S.value?.visualCellCount ?? "",
3514
+ "data-axis-visual-size": S.value?.visualWidth ?? "",
2944
3515
  style: {
2945
- left: `${i.value.left}px`,
2946
- top: `${i.value.top}px`
3516
+ left: `${a.value.left}px`,
3517
+ top: `${a.value.top}px`,
3518
+ width: `${a.value.width}px`,
3519
+ height: `${a.value.height}px`
2947
3520
  },
2948
3521
  onMousedown: $,
2949
- onClick: () => O("column", "column-edge")
2950
- }, [H("span", { "aria-hidden": "true" }, "...")]) : null,
2951
- v.value && a.value ? H("button", {
2952
- ref: d,
3522
+ onClick: () => P("column", "column-edge"),
3523
+ onDragstart: (e) => te("column", S.value?.index ?? 0, e),
3524
+ onDragend: () => {
3525
+ v = null, y = null;
3526
+ }
3527
+ }, [H(Mr, {
3528
+ size: 14,
3529
+ "aria-hidden": "true"
3530
+ })]) : null,
3531
+ w.value && o.value ? H("button", {
3532
+ ref: h,
2953
3533
  type: "button",
2954
3534
  class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
2955
3535
  "aria-label": e.messages.table.selectionActions,
2956
- "aria-expanded": t.value === "selection" && n.value === "selection-edge",
3536
+ "aria-expanded": t.value === "selection" && r.value === "selection-edge",
2957
3537
  "aria-haspopup": "menu",
2958
3538
  title: e.messages.table.selectionActions,
2959
3539
  "data-testid": "markweave-table-cell-handle",
2960
3540
  style: {
2961
- left: `${a.value.left}px`,
2962
- top: `${a.value.top}px`
3541
+ left: `${o.value.left}px`,
3542
+ top: `${o.value.top}px`,
3543
+ width: `${o.value.width}px`,
3544
+ height: `${o.value.height}px`
3545
+ },
3546
+ onMousedown: $,
3547
+ onClick: F
3548
+ }, [H(Mr, {
3549
+ size: 14,
3550
+ "aria-hidden": "true"
3551
+ })]) : null,
3552
+ s.value ? H("button", {
3553
+ type: "button",
3554
+ class: "markweave-table-extend-button markweave-table-extend-button--row",
3555
+ "aria-label": e.messages.table.addRow,
3556
+ title: e.messages.table.addRow,
3557
+ "data-testid": "markweave-table-add-row",
3558
+ style: {
3559
+ left: `${s.value.left}px`,
3560
+ top: `${s.value.top}px`,
3561
+ width: `${s.value.width}px`,
3562
+ height: `${s.value.height}px`
3563
+ },
3564
+ onMousedown: $,
3565
+ onClick: () => z("row")
3566
+ }, [H(Ir, {
3567
+ size: 14,
3568
+ "aria-hidden": "true"
3569
+ })]) : null,
3570
+ c.value ? H("button", {
3571
+ type: "button",
3572
+ class: "markweave-table-extend-button markweave-table-extend-button--column",
3573
+ "aria-label": e.messages.table.addColumn,
3574
+ title: e.messages.table.addColumn,
3575
+ "data-testid": "markweave-table-add-column",
3576
+ style: {
3577
+ left: `${c.value.left}px`,
3578
+ top: `${c.value.top}px`,
3579
+ width: `${c.value.width}px`,
3580
+ height: `${c.value.height}px`
2963
3581
  },
2964
3582
  onMousedown: $,
2965
- onClick: k
2966
- }, [H("span", { "aria-hidden": "true" }, "...")]) : null,
2967
- F()
3583
+ onClick: () => z("column")
3584
+ }, [H(Ir, {
3585
+ size: 14,
3586
+ "aria-hidden": "true"
3587
+ })]) : null,
3588
+ oe()
2968
3589
  ]) : null;
2969
3590
  }
2970
- }), Qr = Y({
3591
+ }), Ni = Y({
2971
3592
  name: "MarkweaveVueTableSelectionOverlay",
2972
3593
  props: {
2973
3594
  editor: {
@@ -2985,9 +3606,9 @@ var Jr = Y({
2985
3606
  t.value = null;
2986
3607
  return;
2987
3608
  }
2988
- t.value = sn(e.editor, Ut(e.editor.state));
3609
+ t.value = hn(e.editor, Gt(e.editor.state));
2989
3610
  };
2990
- return Cn(() => {
3611
+ return In(() => {
2991
3612
  n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
2992
3613
  }), q(() => {
2993
3614
  window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
@@ -3023,7 +3644,7 @@ var Jr = Y({
3023
3644
  }) : null;
3024
3645
  };
3025
3646
  }
3026
- }), $r = Y({
3647
+ }), Pi = Y({
3027
3648
  name: "MarkweaveVueCodeBlockControls",
3028
3649
  props: {
3029
3650
  editor: {
@@ -3235,7 +3856,7 @@ var Jr = Y({
3235
3856
  immediate: !0
3236
3857
  });
3237
3858
  let ve = null;
3238
- return Cn(() => {
3859
+ return In(() => {
3239
3860
  J(() => {
3240
3861
  let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
3241
3862
  if (n.target instanceof Node && t.value?.contains(n.target) || u.value) return;
@@ -3535,7 +4156,7 @@ var Jr = Y({
3535
4156
  ]);
3536
4157
  };
3537
4158
  }
3538
- }), ei = Y({
4159
+ }), Fi = Y({
3539
4160
  name: "MarkweaveVueInnerToc",
3540
4161
  props: {
3541
4162
  editor: {
@@ -3563,7 +4184,7 @@ var Jr = Y({
3563
4184
  let t = U(null), n, r = () => {
3564
4185
  n?.(), n = e.placement === "container" && t.value ? ke(t.value) : void 0;
3565
4186
  };
3566
- return Cn(r), q(() => n?.()), K(() => e.placement, r), () => e.state.items.length ? H("nav", {
4187
+ return In(r), q(() => n?.()), K(() => e.placement, r), () => e.state.items.length ? H("nav", {
3567
4188
  ref: t,
3568
4189
  class: "markweave-inner-toc",
3569
4190
  "data-testid": "markweave-inner-toc",
@@ -3591,8 +4212,8 @@ var Jr = Y({
3591
4212
  }, t.text)))])]) : null;
3592
4213
  }
3593
4214
  });
3594
- function ti(e = {}) {
3595
- let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Se(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(Lt), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(Wt), x = U(null), S = U(!1), C = W(null), w = oe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
4215
+ function Ii(e = {}) {
4216
+ let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Se(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(zt), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(Kt), x = U(null), S = U(!1), C = W(null), w = oe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
3596
4217
  function O() {
3597
4218
  D !== null && (window.clearTimeout(D), D = null), d.value += 1;
3598
4219
  }
@@ -3603,7 +4224,7 @@ function ti(e = {}) {
3603
4224
  }
3604
4225
  let A = e.onSlashCommandUpload, j = W(null);
3605
4226
  j.value = new a({
3606
- extensions: Ir({
4227
+ extensions: hi({
3607
4228
  lang: i,
3608
4229
  linkCardResolver: e.linkCardResolver,
3609
4230
  onImageUpload: (e) => A?.(e) ?? ee(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
@@ -3630,7 +4251,7 @@ function ti(e = {}) {
3630
4251
  return r ? (n.preventDefault(), n.stopPropagation(), N(), Ct(e, r, !0), wt(e, r), y.value = r, !0) : (y.value = null, !1);
3631
4252
  },
3632
4253
  handleDOMEvents: {
3633
- compositionstart: () => u.value ? (h.value = Rt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
4254
+ compositionstart: () => u.value ? (h.value = Bt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
3634
4255
  compositionend: (e) => (u.value && window.setTimeout(() => P(e), 0), !1),
3635
4256
  click: (e, t) => {
3636
4257
  if (!u.value) return me(t);
@@ -3644,7 +4265,7 @@ function ti(e = {}) {
3644
4265
  p(t, {
3645
4266
  mode: c.value,
3646
4267
  editable: u.value
3647
- }), Et(t, l.value), Dt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Vt(t), L(t), I(t), O();
4268
+ }), Et(t, l.value), Dt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Ut(t), L(t), I(t), O();
3648
4269
  },
3649
4270
  onTransaction: ({ editor: e, transaction: t }) => {
3650
4271
  if (L(e), (t.docChanged || Tt(t)) && k(), t.docChanged && y.value) {
@@ -3665,19 +4286,24 @@ function ti(e = {}) {
3665
4286
  });
3666
4287
  let M = G(() => j.value ?? null);
3667
4288
  function N() {
3668
- g.value = null, _.value = null, h.value = Lt;
4289
+ g.value = null, _.value = null, h.value = zt;
3669
4290
  }
3670
4291
  function P(e) {
3671
- let t = It(e.state);
4292
+ let t = Lt(e.state);
3672
4293
  if (!t) {
3673
- h.value = h.value.name === "idle" ? h.value : Lt, g.value = null, _.value = null;
4294
+ h.value = h.value.name === "idle" ? h.value : zt, g.value = null, _.value = null;
3674
4295
  return;
3675
4296
  }
3676
4297
  let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
3677
- g.value = Ft(n, {
4298
+ if (!Rt(r, { frameRect: i })) {
4299
+ N();
4300
+ return;
4301
+ }
4302
+ let a = It(n, {
3678
4303
  frameRect: i,
3679
4304
  triggerRect: r
3680
- }), h.value = Pt(h.value, t);
4305
+ });
4306
+ Nt(g.value, a) || (g.value = a), h.value = Ft(h.value, t);
3681
4307
  }
3682
4308
  function F(e) {
3683
4309
  P(e.view);
@@ -3691,66 +4317,66 @@ function ti(e = {}) {
3691
4317
  r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
3692
4318
  }
3693
4319
  function L(e) {
3694
- b.value = zr(e);
4320
+ b.value = vi(e);
3695
4321
  }
3696
- let R = G(() => M.value ? Ne(M.value) : Rr), z = G(() => M.value ? Ht(M.value.state) : Lr), ne = G(() => m.value?.currentNode === "codeBlock"), B = G(() => ne.value && R.value.language === "mermaid"), se = G(() => M.value ? kt({
3697
- active: B.value,
4322
+ let R = G(() => M.value ? Ne(M.value) : _i), z = G(() => M.value ? Wt(M.value.state) : gi), ne = G(() => m.value?.currentNode === "codeBlock"), se = G(() => ne.value && R.value.language === "mermaid"), ce = G(() => M.value ? kt({
4323
+ active: se.value,
3698
4324
  mode: v.value,
3699
4325
  source: R.value.text
3700
4326
  }) : kt({
3701
4327
  active: !1,
3702
4328
  mode: "code",
3703
4329
  source: ""
3704
- })), ce = G(() => M.value && e.onRuntimeStateChange ? Bt(M.value.state) : null), le = G(() => M.value ? Ee(M.value.state) : we.items), ue = G(() => De(le.value, x.value)), de = G(() => Ce(le.value, ue.value)), fe = G(() => At(h.value.query, s)), pe = G(() => he({
4330
+ })), le = G(() => M.value && e.onRuntimeStateChange ? Ht(M.value.state) : null), ue = G(() => M.value ? Ee(M.value.state) : we.items), de = G(() => De(ue.value, x.value)), fe = G(() => Ce(ue.value, de.value)), pe = G(() => At(h.value.query, s)), _e = G(() => he({
3705
4331
  revision: d.value,
3706
4332
  mode: c.value,
3707
4333
  editable: u.value,
3708
- toc: de.value,
4334
+ toc: fe.value,
3709
4335
  selection: m.value,
3710
4336
  slash: h.value,
3711
4337
  table: z.value,
3712
4338
  tableInteraction: b.value,
3713
4339
  codeBlock: R.value,
3714
- mermaid: se.value,
3715
- tableDebugSnapshot: ce.value
3716
- })), _e = {
4340
+ mermaid: ce.value,
4341
+ tableDebugSnapshot: le.value
4342
+ })), be = {
3717
4343
  closeSlashMenu: N,
3718
- focusFirstTableBodyCell: () => M.value ? Vt(M.value) : !1,
4344
+ focusFirstTableBodyCell: () => M.value ? Ut(M.value) : !1,
3719
4345
  setContent: (e, t = {}) => {
3720
4346
  if (!M.value) return !1;
3721
4347
  let n = oe(t.format);
3722
4348
  return M.value.commands.setContent(e, {
3723
4349
  contentType: re(n),
3724
4350
  emitUpdate: t.emitUpdate ?? !1
3725
- }), t.focusFirstTableBodyCell && Vt(M.value), I(M.value), u.value && F(M.value), L(M.value), O(), !0;
4351
+ }), t.focusFirstTableBodyCell && Ut(M.value), I(M.value), u.value && F(M.value), L(M.value), O(), !0;
3726
4352
  }
3727
4353
  };
3728
- function be(e, t) {
4354
+ function xe(e, t) {
3729
4355
  if (!(!M.value || !u.value || !jt(e))) {
3730
4356
  if (e.inputKind && !t?.emoji && !t?.uploadResult) {
3731
4357
  _.value = e;
3732
4358
  return;
3733
4359
  }
3734
- Nt(M.value, h.value, e, t), h.value = Rt(h.value, { type: "execute" }), N();
4360
+ Pt(M.value, h.value, e, t), h.value = Bt(h.value, { type: "execute" }), N();
3735
4361
  }
3736
4362
  }
3737
- function xe(e) {
4363
+ function Oe(e) {
3738
4364
  if (!M.value || _.value || !u.value) return;
3739
- let t = Mt(h.value, fe.value, e.key, { isComposing: e.isComposing || te(M.value.state) });
4365
+ let t = Mt(h.value, pe.value, e.key, { isComposing: e.isComposing || te(M.value.state) });
3740
4366
  if (t.type !== "ignore") {
3741
4367
  if (e.preventDefault(), t.type === "close") {
3742
- h.value = Rt(h.value, { type: "escape" }), N();
4368
+ h.value = Bt(h.value, { type: "escape" }), N();
3743
4369
  return;
3744
4370
  }
3745
4371
  if (t.type === "move-active") {
3746
- h.value = Rt(h.value, {
4372
+ h.value = Bt(h.value, {
3747
4373
  type: "move-active",
3748
4374
  delta: t.delta,
3749
4375
  optionCount: t.optionCount
3750
4376
  });
3751
4377
  return;
3752
4378
  }
3753
- be(t.command);
4379
+ xe(t.command);
3754
4380
  }
3755
4381
  }
3756
4382
  K(() => [e.mode, e.editable], () => {
@@ -3772,38 +4398,50 @@ function ti(e = {}) {
3772
4398
  emitUpdate: !1
3773
4399
  }), S.value = !1, I(M.value), u.value && F(M.value), L(M.value), O());
3774
4400
  }
3775
- }), K(pe, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(de, (t) => e.onTocChange?.(t), { immediate: !0 }), K(le, (e) => {
4401
+ }), K(_e, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(fe, (t) => e.onTocChange?.(t), { immediate: !0 }), K(ue, (e) => {
3776
4402
  let t = De(e, x.value);
3777
4403
  x.value !== t && (x.value = t);
3778
4404
  });
3779
- let Oe = null;
4405
+ let ke = B(() => {
4406
+ M.value && g.value && P(M.value.view);
4407
+ }), Ae = () => {
4408
+ g.value && ke.schedule();
4409
+ };
4410
+ K(g, (e) => {
4411
+ e ? Ae() : ke.cancel();
4412
+ }), In(() => {
4413
+ window.addEventListener("resize", Ae), window.addEventListener("scroll", Ae, !0);
4414
+ }), q(() => {
4415
+ ke.cancel(), window.removeEventListener("resize", Ae), window.removeEventListener("scroll", Ae, !0);
4416
+ });
4417
+ let je = null;
3780
4418
  return q(() => {
3781
4419
  D !== null && window.clearTimeout(D);
3782
- }), Cn(() => {
4420
+ }), In(() => {
3783
4421
  let e = () => {
3784
- if (!M.value || !le.value.length) {
4422
+ if (!M.value || !ue.value.length) {
3785
4423
  x.value = null;
3786
4424
  return;
3787
4425
  }
3788
4426
  let e = null;
3789
4427
  try {
3790
- e = Te(M.value, le.value);
4428
+ e = Te(M.value, ue.value);
3791
4429
  } catch {
3792
4430
  return;
3793
4431
  }
3794
4432
  x.value !== e && (x.value = e);
3795
- }, t = () => window.requestAnimationFrame(e), n = Br(M.value?.view.dom ?? null);
3796
- window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Oe = () => {
4433
+ }, t = () => window.requestAnimationFrame(e), n = yi(M.value?.view.dom ?? null);
4434
+ window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), je = () => {
3797
4435
  window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
3798
4436
  };
3799
4437
  }), q(() => {
3800
- Oe?.();
4438
+ je?.();
3801
4439
  let e = j.value;
3802
4440
  j.value = null, J(() => e?.destroy());
3803
4441
  }), {
3804
4442
  editor: M,
3805
- runtimeSnapshot: pe,
3806
- actions: _e,
4443
+ runtimeSnapshot: _e,
4444
+ actions: be,
3807
4445
  __render: {
3808
4446
  messages: o,
3809
4447
  effectiveEditable: u,
@@ -3816,20 +4454,20 @@ function ti(e = {}) {
3816
4454
  setMermaidMode: (e) => {
3817
4455
  v.value = e;
3818
4456
  },
3819
- tocState: de,
3820
- filteredSlashCommands: fe,
4457
+ tocState: fe,
4458
+ filteredSlashCommands: pe,
3821
4459
  slashState: h,
3822
4460
  slashMenuPosition: g,
3823
4461
  slashInputCommand: _,
3824
- runSlashCommand: be,
3825
- handleEditorKeyDown: xe,
4462
+ runSlashCommand: xe,
4463
+ handleEditorKeyDown: Oe,
3826
4464
  setSlashInputCommand: (e) => {
3827
4465
  _.value = e;
3828
4466
  }
3829
4467
  }
3830
4468
  };
3831
4469
  }
3832
- var ni = Y({
4470
+ var Li = Y({
3833
4471
  name: "MarkweaveEditor",
3834
4472
  props: {
3835
4473
  defaultContent: {
@@ -3938,7 +4576,7 @@ var ni = Y({
3938
4576
  }
3939
4577
  },
3940
4578
  setup(e) {
3941
- let t = ti(e);
4579
+ let t = Ii(e);
3942
4580
  return () => {
3943
4581
  let n = t.editor.value;
3944
4582
  if (!n) return null;
@@ -3956,11 +4594,11 @@ var ni = Y({
3956
4594
  "data-table-focus-mode": r.tableFocusState.value.mode,
3957
4595
  onKeydownCapture: r.handleEditorKeyDown
3958
4596
  }, [
3959
- r.effectiveEditable.value ? H(Jr, {
4597
+ r.effectiveEditable.value ? H(Di, {
3960
4598
  editor: n,
3961
4599
  messages: r.messages
3962
4600
  }) : null,
3963
- r.effectiveEditable.value ? H(Xr, {
4601
+ r.effectiveEditable.value ? H(ki, {
3964
4602
  commands: r.filteredSlashCommands.value,
3965
4603
  state: r.slashState.value,
3966
4604
  position: r.slashMenuPosition.value,
@@ -3970,7 +4608,7 @@ var ni = Y({
3970
4608
  onInputCommandChange: r.setSlashInputCommand,
3971
4609
  onUpload: e.onSlashCommandUpload
3972
4610
  }) : null,
3973
- r.effectiveEditable.value ? H(Zr, {
4611
+ r.effectiveEditable.value ? H(Mi, {
3974
4612
  editor: n,
3975
4613
  active: r.tableFocusState.value.active,
3976
4614
  interactionState: r.tableInteractionState.value,
@@ -3979,11 +4617,11 @@ var ni = Y({
3979
4617
  onCommandResult: e.onTableCommandResult,
3980
4618
  onEditWithAi: e.onEditWithAi
3981
4619
  }) : null,
3982
- r.effectiveEditable.value ? H(Qr, {
4620
+ r.effectiveEditable.value ? H(Ni, {
3983
4621
  editor: n,
3984
4622
  focusState: r.tableFocusState.value
3985
4623
  }) : null,
3986
- H($r, {
4624
+ H(Pi, {
3987
4625
  editor: n,
3988
4626
  state: r.codeBlockState.value,
3989
4627
  active: r.effectiveEditable.value && r.isCodeBlockActive.value,
@@ -3991,14 +4629,14 @@ var ni = Y({
3991
4629
  onMermaidModeChange: r.setMermaidMode,
3992
4630
  readOnly: !r.effectiveEditable.value
3993
4631
  }),
3994
- e.innerToc && r.tocState.value.items.length ? H(ei, {
4632
+ e.innerToc && r.tocState.value.items.length ? H(Fi, {
3995
4633
  editor: n,
3996
4634
  state: r.tocState.value,
3997
4635
  messages: r.messages,
3998
4636
  editable: r.effectiveEditable.value,
3999
4637
  placement: Oe(e.innerTocPlacement)
4000
4638
  }) : null,
4001
- r.effectiveEditable.value && r.mathTarget.value ? H(Yr, {
4639
+ r.effectiveEditable.value && r.mathTarget.value ? H(Oi, {
4002
4640
  editor: n,
4003
4641
  messages: r.messages,
4004
4642
  target: r.mathTarget.value,
@@ -4010,4 +4648,4 @@ var ni = Y({
4010
4648
  }
4011
4649
  });
4012
4650
  //#endregion
4013
- export { ni as MarkweaveEditor, Ir as createMarkweaveEditorExtensions, Ir as createMarkweaveVue2EditorExtensions, ti as useMarkweaveEditorController };
4651
+ export { Li as MarkweaveEditor, hi as createMarkweaveEditorExtensions, hi as createMarkweaveVue2EditorExtensions, Ii as useMarkweaveEditorController };