@hankchen/canvas-editor-vue 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
1
  import { t as e } from "./createLucideIcon-SCvtEGVf.js";
2
2
  import { c as t, d as n, f as r, l as i, n as a, o, p as s, r as c, s as l, u } from "./dist-DGtNmLwo.js";
3
- import { i as d, n as f, o as p } from "./layerPath-uy2ywyld.js";
4
- import { c as m, o as h, t as g } from "./ExpressionPathPicker-DchGsK70.js";
5
- import { a as _, d as v, i as y, n as b, p as x, r as S, t as C, u as w } from "./useTransientFeedback-BN_O7V2w.js";
6
- import { c as T, f as E, i as D, l as O, m as k, n as ee, o as A, p as j, t as M } from "./uploadFile-mXJVPEzm.js";
7
- import { n as N, t as P } from "./useViewport-D9Ipevzs.js";
8
- import { Fragment as F, computed as I, createBlock as L, createCommentVNode as R, createElementBlock as z, createElementVNode as B, createVNode as V, defineComponent as H, mergeProps as te, nextTick as ne, normalizeClass as U, normalizeStyle as W, onBeforeUnmount as re, onMounted as ie, onScopeDispose as G, openBlock as K, ref as q, renderList as J, shallowRef as Y, toDisplayString as X, unref as Z, vModelText as ae, vShow as oe, watch as Q, withDirectives as se, withModifiers as $ } from "vue";
9
- var ce = e({
3
+ import { c as d, i as f, n as p, o as m, t as h } from "./_plugin-vue_export-helper-CBNdHDnS.js";
4
+ import { n as g, s as _, t as v } from "./Tooltip-9lQOwB7r.js";
5
+ import { a as y, f as b, i as x, n as S, o as C, p as w, s as T, t as E } from "./useTransientFeedback-CI3j6r7y.js";
6
+ import { c as D, f as O, i as k, l as ee, m as te, n as A, o as j, p as M, t as ne } from "./uploadFile-DnW3L-8J.js";
7
+ import { n as re, t as N } from "./useViewport-D9Ipevzs.js";
8
+ import { Fragment as P, computed as F, createBlock as I, createCommentVNode as L, createElementBlock as R, createElementVNode as z, createTextVNode as ie, createVNode as B, defineComponent as V, mergeProps as ae, nextTick as oe, normalizeClass as H, normalizeStyle as U, onBeforeUnmount as W, onMounted as G, onScopeDispose as K, openBlock as q, ref as J, renderList as se, shallowRef as Y, toDisplayString as X, unref as Z, vModelText as ce, vShow as le, watch as ue, withCtx as Q, withDirectives as de, withModifiers as $ } from "vue";
9
+ var fe = e({
10
10
  name: "arrow-down-left",
11
11
  size: 24,
12
12
  node: [["path", {
@@ -16,7 +16,7 @@ var ce = e({
16
16
  d: "M17 17H7V7",
17
17
  key: "1org7z"
18
18
  }]]
19
- }), le = e({
19
+ }), pe = e({
20
20
  name: "arrow-down-right",
21
21
  size: 24,
22
22
  node: [["path", {
@@ -26,7 +26,7 @@ var ce = e({
26
26
  d: "M17 7v10H7",
27
27
  key: "6fjiku"
28
28
  }]]
29
- }), ue = e({
29
+ }), me = e({
30
30
  name: "arrow-up-left",
31
31
  size: 24,
32
32
  node: [["path", {
@@ -36,7 +36,7 @@ var ce = e({
36
36
  d: "M17 17 7 7",
37
37
  key: "2786uv"
38
38
  }]]
39
- }), de = e({
39
+ }), he = e({
40
40
  name: "arrow-up-right",
41
41
  size: 24,
42
42
  node: [["path", {
@@ -46,21 +46,21 @@ var ce = e({
46
46
  d: "M7 17 17 7",
47
47
  key: "1vkiza"
48
48
  }]]
49
- }), fe = e({
49
+ }), ge = e({
50
50
  name: "chevron-up",
51
51
  size: 24,
52
52
  node: [["path", {
53
53
  d: "m18 15-6-6-6 6",
54
54
  key: "153udz"
55
55
  }]]
56
- }), pe = e({
56
+ }), _e = e({
57
57
  name: "minus",
58
58
  size: 24,
59
59
  node: [["path", {
60
60
  d: "M5 12h14",
61
61
  key: "1ays0h"
62
62
  }]]
63
- }), me = e({
63
+ }), ve = e({
64
64
  name: "plus",
65
65
  size: 24,
66
66
  node: [["path", {
@@ -70,7 +70,7 @@ var ce = e({
70
70
  d: "M12 5v14",
71
71
  key: "s699le"
72
72
  }]]
73
- }), he = e({
73
+ }), ye = e({
74
74
  name: "text-wrap",
75
75
  size: 24,
76
76
  node: [
@@ -92,7 +92,7 @@ var ce = e({
92
92
  }]
93
93
  ],
94
94
  aliases: ["wrap-text"]
95
- }), ge = e({
95
+ }), be = e({
96
96
  name: "x",
97
97
  size: 24,
98
98
  node: [["path", {
@@ -105,7 +105,7 @@ var ce = e({
105
105
  });
106
106
  //#endregion
107
107
  //#region ../canvas-editor/src/spatial/camera.ts
108
- function _e(e, t) {
108
+ function xe(e, t) {
109
109
  if (!(t > 0)) return e;
110
110
  let n = e.zoom * t;
111
111
  return {
@@ -114,10 +114,10 @@ function _e(e, t) {
114
114
  zoom: e.zoom
115
115
  };
116
116
  }
117
- function ve(e) {
117
+ function Se(e) {
118
118
  return 6 / e;
119
119
  }
120
- function ye(e, t, n) {
120
+ function Ce(e, t, n) {
121
121
  let r = [];
122
122
  for (let i = 0; i < e.layers.length; i += 1) {
123
123
  if (t !== null && i === t) continue;
@@ -126,7 +126,7 @@ function ye(e, t, n) {
126
126
  }
127
127
  return r;
128
128
  }
129
- function be(e, t, n, r) {
129
+ function we(e, t, n, r) {
130
130
  let i = [];
131
131
  for (let e of n) i.push({
132
132
  orientation: "vertical",
@@ -169,7 +169,7 @@ function be(e, t, n, r) {
169
169
  });
170
170
  return i;
171
171
  }
172
- function xe(e, t, n, r) {
172
+ function Te(e, t, n, r) {
173
173
  let i = null;
174
174
  for (let a of t) if (a.orientation === n) for (let t of e) {
175
175
  let e = a.position - t, n = Math.abs(e);
@@ -180,16 +180,16 @@ function xe(e, t, n, r) {
180
180
  }
181
181
  return i;
182
182
  }
183
- function Se(e, t, n) {
184
- let r = xe(e.vertical, t, "vertical", n), i = xe(e.horizontal, t, "horizontal", n);
183
+ function Ee(e, t, n) {
184
+ let r = Te(e.vertical, t, "vertical", n), i = Te(e.horizontal, t, "horizontal", n);
185
185
  return {
186
186
  dx: r ? r.delta : 0,
187
187
  dy: i ? i.delta : 0,
188
188
  axes: [...r ? [r.axis] : [], ...i ? [i.axis] : []]
189
189
  };
190
190
  }
191
- function Ce(e, t, n) {
192
- return Se({
191
+ function De(e, t, n) {
192
+ return Ee({
193
193
  vertical: [
194
194
  e.x,
195
195
  e.x + e.width / 2,
@@ -204,7 +204,7 @@ function Ce(e, t, n) {
204
204
  }
205
205
  //#endregion
206
206
  //#region ../canvas-editor/src/spatial/resize.ts
207
- function we(e, t) {
207
+ function Oe(e, t) {
208
208
  let n = e.x + e.width, r = e.y + e.height;
209
209
  switch (t) {
210
210
  case "nw": return {
@@ -243,38 +243,38 @@ function we(e, t) {
243
243
  }
244
244
  //#endregion
245
245
  //#region ../canvas-editor/src/spatial/wheel.ts
246
- function Te(e) {
246
+ function ke(e) {
247
247
  return e.ctrlKey || e.metaKey ? "zoom" : e.shiftKey ? "pan-x" : "pan";
248
248
  }
249
249
  //#endregion
250
250
  //#region ../canvas-browser-renderer/src/fonts.ts
251
- function Ee(e) {
251
+ function Ae(e) {
252
252
  return e === "" || /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(e.trim());
253
253
  }
254
- function De(e) {
255
- return Ee(e) ? "sans-serif" : `${Oe(e)}, sans-serif`;
254
+ function je(e) {
255
+ return Ae(e) ? "sans-serif" : `${Me(e)}, sans-serif`;
256
256
  }
257
- function Oe(e) {
257
+ function Me(e) {
258
258
  let t = 2166136261;
259
259
  for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
260
260
  return `canvas-font-${(t >>> 0).toString(36)}`;
261
261
  }
262
262
  //#endregion
263
263
  //#region src/canvas/AlignFloatBar.vue?vue&type=script&setup=true&lang.ts
264
- var ke = ["aria-disabled"], Ae = {
264
+ var Ne = ["aria-disabled"], Pe = {
265
265
  key: 0,
266
266
  class: "cn-align-float__divider",
267
267
  "aria-hidden": "true"
268
- }, je = { class: "cn-align-float__group" }, Me = [
268
+ }, Fe = { class: "cn-align-float__group" }, Ie = [
269
269
  "disabled",
270
270
  "title",
271
271
  "aria-label",
272
272
  "onClick"
273
- ], Ne = /*#__PURE__*/ x(/* @__PURE__ */ H({
273
+ ], Le = /*#__PURE__*/ h(/* @__PURE__ */ V({
274
274
  __name: "AlignFloatBar",
275
275
  props: { editor: {} },
276
276
  setup(e) {
277
- let a = e, o = N(a.editor), c = I(() => o.value !== null), l = (e) => `贴${e}角(边距 40px)`, d = [
277
+ let a = e, o = re(a.editor), c = F(() => o.value !== null), l = (e) => `贴${e}角(边距 40px)`, d = [
278
278
  { keys: [{
279
279
  mode: "h-center",
280
280
  icon: r,
@@ -309,22 +309,22 @@ var ke = ["aria-disabled"], Ae = {
309
309
  { keys: [
310
310
  {
311
311
  mode: "corner-tl",
312
- icon: ue,
312
+ icon: me,
313
313
  title: l("左上")
314
314
  },
315
315
  {
316
316
  mode: "corner-tr",
317
- icon: de,
317
+ icon: he,
318
318
  title: l("右上")
319
319
  },
320
320
  {
321
321
  mode: "corner-bl",
322
- icon: ce,
322
+ icon: fe,
323
323
  title: l("左下")
324
324
  },
325
325
  {
326
326
  mode: "corner-br",
327
- icon: le,
327
+ icon: pe,
328
328
  title: l("右下")
329
329
  }
330
330
  ] }
@@ -332,60 +332,60 @@ var ke = ["aria-disabled"], Ae = {
332
332
  function f(e) {
333
333
  return { [`data-align-${e}`]: "" };
334
334
  }
335
- function p(e) {
335
+ function m(e) {
336
336
  let t = o.value;
337
337
  t && (e.startsWith("corner-") ? a.editor.alignToCanvas(t, e, { margin: 40 }) : a.editor.alignToCanvas(t, e));
338
338
  }
339
- return (e, t) => (K(), z("div", {
340
- class: U(["cn-align-float", { "cn-align-float--disabled": !c.value }]),
339
+ return (e, t) => (q(), R("div", {
340
+ class: H(["cn-align-float", { "cn-align-float--disabled": !c.value }]),
341
341
  role: "toolbar",
342
342
  "aria-label": "对齐画布",
343
343
  "data-align-float": "",
344
344
  "aria-disabled": c.value ? void 0 : "true"
345
- }, [(K(), z(F, null, J(d, (e, t) => (K(), z(F, { key: t }, [t > 0 ? (K(), z("span", Ae)) : R("", !0), B("span", je, [(K(!0), z(F, null, J(e.keys, (e) => (K(), z("button", te({
345
+ }, [(q(), R(P, null, se(d, (e, t) => (q(), R(P, { key: t }, [t > 0 ? (q(), R("span", Pe)) : L("", !0), z("span", Fe, [(q(!0), R(P, null, se(e.keys, (e) => (q(), R("button", ae({
346
346
  key: e.mode,
347
347
  type: "button",
348
348
  class: "cn-align-float__key",
349
349
  disabled: !c.value,
350
350
  title: e.title,
351
351
  "aria-label": e.title
352
- }, { ref_for: !0 }, f(e.mode), { onClick: (t) => p(e.mode) }), [V(m, { icon: e.icon }, null, 8, ["icon"])], 16, Me))), 128))])], 64))), 64))], 10, ke));
352
+ }, { ref_for: !0 }, f(e.mode), { onClick: (t) => m(e.mode) }), [B(p, { icon: e.icon }, null, 8, ["icon"])], 16, Ie))), 128))])], 64))), 64))], 10, Ne));
353
353
  }
354
- }), [["__scopeId", "data-v-9a761d37"]]), Pe = {
354
+ }), [["__scopeId", "data-v-3da2808e"]]), Re = {
355
355
  key: 0,
356
356
  class: "cn-context-menu__form"
357
- }, Fe = { class: "cn-context-menu__hint" }, Ie = { class: "cn-context-menu__form-actions" }, Le = ["disabled"], Re = [
357
+ }, ze = { class: "cn-context-menu__hint" }, Be = { class: "cn-context-menu__form-actions" }, Ve = ["disabled"], He = [
358
358
  "disabled",
359
359
  "title",
360
360
  "onClick"
361
- ], ze = /*#__PURE__*/ x(/* @__PURE__ */ H({
361
+ ], Ue = /*#__PURE__*/ h(/* @__PURE__ */ V({
362
362
  __name: "ContextMenu",
363
363
  props: { editor: {} },
364
364
  setup(e, { expose: t }) {
365
- let n = e, r = q(null), i = q(!1), a = q({
365
+ let n = e, r = J(null), i = J(!1), a = J({
366
366
  x: 0,
367
367
  y: 0
368
- }), o = w(), s = `先 ${v("copyStyle", o)} 复制样式`, c = `图层已锁定(${v("toggleLayerLock", o)} 解锁后可删除)`, l = N(n.editor), u = I(() => l.value !== null && f(l.value)), d = I(() => l.value !== null && n.editor.canCopySelection), m = I(() => (i.value, l.value !== null && n.editor.canCopyStyle)), b = I(() => (i.value, l.value !== null && n.editor.canPasteStyle)), x = I(() => {
368
+ }), o = b(), s = `先 ${w("copyStyle", o)} 复制样式`, c = `图层已锁定(${w("toggleLayerLock", o)} 解锁后可删除)`, l = re(n.editor), u = F(() => l.value !== null && f(l.value)), p = F(() => l.value !== null && n.editor.canCopySelection), m = F(() => (i.value, l.value !== null && n.editor.canCopyStyle)), h = F(() => (i.value, l.value !== null && n.editor.canPasteStyle)), v = F(() => {
369
369
  let e = l.value, t = n.editor.store.doc;
370
- return !e || !t || !f(e) ? !0 : p(t, e)?.visible ?? !0;
371
- }), S = I(() => {
370
+ return !e || !t || !f(e) ? !0 : d(t, e)?.visible ?? !0;
371
+ }), y = F(() => {
372
372
  let e = l.value, t = n.editor.store.doc;
373
- return !e || !t ? null : p(t, e);
373
+ return !e || !t ? null : d(t, e);
374
374
  });
375
- function C() {
375
+ function x() {
376
376
  let e = l.value;
377
377
  return !e || typeof e[1] != "number" ? null : ["layers", e[1]];
378
378
  }
379
- let T = I(() => S.value?.type === "TableLayer" && S.value.template !== null), E = I(() => l.value?.[l.value.length - 1] === "template"), D = I(() => l.value !== null && n.editor.isLocked(l.value)), O = I(() => {
380
- let e = S.value;
379
+ let S = F(() => y.value?.type === "TableLayer" && y.value.template !== null), E = F(() => l.value?.[l.value.length - 1] === "template"), D = F(() => l.value !== null && n.editor.isLocked(l.value)), O = F(() => {
380
+ let e = y.value;
381
381
  if (!e || e.type !== "TableLayer" || e.template !== null) return !1;
382
382
  let t = e.rows[e.rows.length - 1];
383
383
  return t !== void 0 && t.cells.length > 0;
384
- }), k = I(() => {
384
+ }), k = F(() => {
385
385
  i.value;
386
386
  let e = l.value;
387
- return e === null || S.value?.type !== "ImageLayer" ? null : n.editor.baseImageConversionBlock(e);
388
- }), ee = I(() => {
387
+ return e === null || y.value?.type !== "ImageLayer" ? null : n.editor.baseImageConversionBlock(e);
388
+ }), ee = F(() => {
389
389
  switch (k.value) {
390
390
  case "not-head-root": return "仅数组头的垫底图片图层可转换";
391
391
  case "not-image": return "仅图片图层可转换";
@@ -396,26 +396,26 @@ var ke = ["aria-disabled"], Ae = {
396
396
  case "locked": return "图层已锁定——解锁后可转换";
397
397
  default: return;
398
398
  }
399
- }), A = _(n.editor), j = I(() => h(A.value)), M = I(() => {
400
- let e = S.value;
399
+ }), te = T(n.editor), A = F(() => _(te.value)), j = F(() => {
400
+ let e = y.value;
401
401
  return !e || e.type !== "TableLayer" ? "" : `模板取自末行,其余 ${Math.max(e.rows.length - 1, 0)} 行将移除(可撤销)`;
402
- }), P = I(() => {
403
- if (A.value === null) return y;
404
- if (O.value) return M.value;
405
- let e = S.value;
402
+ }), M = F(() => {
403
+ if (te.value === null) return C;
404
+ if (O.value) return j.value;
405
+ let e = y.value;
406
406
  return e !== null && e.type === "TableLayer" && e.rows.length === 0 ? "空表无可转换行" : "末行为空——先为末行加格";
407
- }), L = q(!1), H = q("");
408
- function te() {
409
- L.value = !0, H.value = "";
407
+ }), ne = J(!1), N = J("");
408
+ function I() {
409
+ ne.value = !0, N.value = "";
410
410
  }
411
- function re() {
412
- let e = C();
413
- e && H.value !== "" && (n.editor.convertTableToTemplate(e, H.value), Y());
411
+ function ie() {
412
+ let e = x();
413
+ e && N.value !== "" && (n.editor.convertTableToTemplate(e, N.value), W());
414
414
  }
415
- let ie = I(() => [
415
+ let V = F(() => [
416
416
  {
417
417
  key: "visibility",
418
- label: x.value ? "隐藏" : "显示",
418
+ label: v.value ? "隐藏" : "显示",
419
419
  enabled: u.value,
420
420
  title: u.value ? void 0 : "显示/隐藏仅作用于根图层",
421
421
  run: () => {
@@ -426,8 +426,8 @@ var ke = ["aria-disabled"], Ae = {
426
426
  {
427
427
  key: "duplicate",
428
428
  label: "创建副本",
429
- enabled: d.value,
430
- title: d.value ? void 0 : "行/格/行模板是容器内结构,不可复制",
429
+ enabled: p.value,
430
+ title: p.value ? void 0 : "行/格/行模板是容器内结构,不可复制",
431
431
  run: () => n.editor.duplicateSelection()
432
432
  },
433
433
  {
@@ -443,8 +443,8 @@ var ke = ["aria-disabled"], Ae = {
443
443
  {
444
444
  key: "paste-style",
445
445
  label: "粘贴样式",
446
- enabled: b.value,
447
- title: b.value ? void 0 : s,
446
+ enabled: h.value,
447
+ title: h.value ? void 0 : s,
448
448
  run: () => {
449
449
  let e = l.value;
450
450
  e && n.editor.pasteStyle(e);
@@ -478,29 +478,29 @@ var ke = ["aria-disabled"], Ae = {
478
478
  title: u.value ? void 0 : "置顶/置底仅对根图层生效",
479
479
  run: () => n.editor.sendToBack()
480
480
  },
481
- ...S.value?.type === "ImageLayer" ? [{
481
+ ...y.value?.type === "ImageLayer" ? [{
482
482
  key: "to-background",
483
483
  label: "转为画布背景",
484
484
  enabled: k.value === null,
485
485
  title: ee.value,
486
486
  run: () => n.editor.convertSelectionToBackground()
487
487
  }] : [],
488
- ...T.value ? [{
488
+ ...S.value ? [{
489
489
  key: "to-rows",
490
490
  label: "转回普通表",
491
491
  enabled: !0,
492
492
  title: "行模板实例化为单行,恢复普通表格编辑",
493
493
  run: () => {
494
- let e = C();
494
+ let e = x();
495
495
  e && n.editor.convertTableToRows(e);
496
496
  }
497
- }] : S.value?.type === "TableLayer" ? [{
497
+ }] : y.value?.type === "TableLayer" ? [{
498
498
  key: "to-template",
499
499
  label: "转为模板表…",
500
- enabled: A.value !== null && O.value,
501
- title: P.value,
500
+ enabled: te.value !== null && O.value,
501
+ title: M.value,
502
502
  keepsOpen: !0,
503
- run: () => te()
503
+ run: () => I()
504
504
  }] : [],
505
505
  {
506
506
  key: "delete",
@@ -513,11 +513,11 @@ var ke = ["aria-disabled"], Ae = {
513
513
  }
514
514
  }
515
515
  ]);
516
- async function G(e, t) {
516
+ async function ae(e, t) {
517
517
  a.value = {
518
518
  x: e,
519
519
  y: t
520
- }, i.value = !0, await ne();
520
+ }, i.value = !0, await oe();
521
521
  let n = r.value, o = n?.parentElement;
522
522
  if (!n || !o) return;
523
523
  let s = n.getBoundingClientRect(), c = o.clientWidth - s.width - 2, l = o.clientHeight - s.height - 2;
@@ -526,70 +526,70 @@ var ke = ["aria-disabled"], Ae = {
526
526
  y: Math.max(2, Math.min(a.value.y, l))
527
527
  };
528
528
  }
529
- function Y() {
530
- i.value = !1, L.value = !1, H.value = "";
529
+ function W() {
530
+ i.value = !1, ne.value = !1, N.value = "";
531
531
  }
532
- function Z(e) {
533
- e.run(), e.keepsOpen !== !0 && Y();
532
+ function G(e) {
533
+ e.run(), e.keepsOpen !== !0 && W();
534
534
  }
535
535
  return t({
536
- openAt: G,
537
- close: Y
538
- }), (e, t) => i.value ? (K(), z("div", {
536
+ openAt: ae,
537
+ close: W
538
+ }), (e, t) => i.value ? (q(), R("div", {
539
539
  key: 0,
540
540
  ref_key: "rootRef",
541
541
  ref: r,
542
542
  class: "cn-context-menu",
543
543
  role: "menu",
544
544
  "aria-label": "图层操作菜单",
545
- style: W({
545
+ style: U({
546
546
  left: `${a.value.x}px`,
547
547
  top: `${a.value.y}px`
548
548
  }),
549
549
  onPointerdown: t[1] ||= $(() => {}, ["stop"]),
550
550
  onContextmenu: t[2] ||= $(() => {}, ["prevent"])
551
- }, [L.value ? (K(), z("div", Pe, [
552
- B("p", Fe, X(M.value), 1),
553
- V(g, {
554
- modelValue: H.value,
555
- "onUpdate:modelValue": t[0] ||= (e) => H.value = e,
551
+ }, [ne.value ? (q(), R("div", Re, [
552
+ z("p", ze, X(j.value), 1),
553
+ B(g, {
554
+ modelValue: N.value,
555
+ "onUpdate:modelValue": t[0] ||= (e) => N.value = e,
556
556
  "data-convert-rows-path": "",
557
557
  mode: "rowsPath",
558
- source: j.value,
558
+ source: A.value,
559
559
  "aria-label": "取行路径",
560
560
  placeholder: "未选择行路径"
561
561
  }, null, 8, ["modelValue", "source"]),
562
- B("div", Ie, [B("button", {
562
+ z("div", Be, [z("button", {
563
563
  type: "button",
564
564
  class: "cn-context-menu__item cn-context-menu__item--confirm",
565
- disabled: H.value === "",
566
- onClick: re
567
- }, " 确认转换 ", 8, Le), B("button", {
565
+ disabled: N.value === "",
566
+ onClick: ie
567
+ }, " 确认转换 ", 8, Ve), z("button", {
568
568
  type: "button",
569
569
  class: "cn-context-menu__item",
570
- onClick: Y
570
+ onClick: W
571
571
  }, "取消")])
572
- ])) : (K(!0), z(F, { key: 1 }, J(ie.value, (e) => (K(), z("button", {
572
+ ])) : (q(!0), R(P, { key: 1 }, se(V.value, (e) => (q(), R("button", {
573
573
  key: e.key,
574
574
  type: "button",
575
575
  role: "menuitem",
576
- class: U(["cn-context-menu__item", [`cn-context-menu__item--${e.key}`]]),
576
+ class: H(["cn-context-menu__item", [`cn-context-menu__item--${e.key}`]]),
577
577
  disabled: !e.enabled,
578
578
  title: e.title,
579
- onClick: (t) => Z(e)
580
- }, X(e.label), 11, Re))), 128))], 36)) : R("", !0);
579
+ onClick: (t) => G(e)
580
+ }, X(e.label), 11, He))), 128))], 36)) : L("", !0);
581
581
  }
582
- }), [["__scopeId", "data-v-99fabe20"]]);
582
+ }), [["__scopeId", "data-v-1cd94ec0"]]);
583
583
  //#endregion
584
584
  //#region src/canvas/useFindSession.ts
585
- function Be(e) {
585
+ function We(e) {
586
586
  let t = Y(e.store.ui.find.open), n = Y(e.store.ui.find.query), r = Y(e.store.ui.find.replacement), i = Y(e.listFindMatches()), a = Y(e.findCursor), o = () => {
587
587
  let o = e.store.ui.find;
588
588
  t.value = o.open, n.value = o.query, r.value = o.replacement, i.value = e.listFindMatches(), a.value = e.findCursor;
589
589
  }, s = e.subscribe((e) => {
590
590
  (e.scope === "doc" || e.scope === "ui" && e.branch === "find") && o();
591
591
  });
592
- return G(s, !0), {
592
+ return K(s, !0), {
593
593
  open: t,
594
594
  query: n,
595
595
  replacement: r,
@@ -599,21 +599,21 @@ function Be(e) {
599
599
  }
600
600
  //#endregion
601
601
  //#region src/canvas/FindBar.vue?vue&type=script&setup=true&lang.ts
602
- var Ve = ["value"], He = ["value"], Ue = {
602
+ var Ge = ["value"], Ke = ["value"], qe = {
603
603
  class: "cn-find-bar__count",
604
604
  "data-find-count": ""
605
- }, We = {
605
+ }, Je = {
606
606
  key: 0,
607
607
  class: "cn-find-bar__note",
608
608
  "data-find-note": ""
609
- }, Ge = ["disabled"], Ke = ["disabled"], qe = ["disabled"], Je = ["disabled"], Ye = /*#__PURE__*/ x(/* @__PURE__ */ H({
609
+ }, Ye = ["disabled"], Xe = ["disabled"], Ze = ["disabled"], Qe = ["disabled"], $e = /*#__PURE__*/ h(/* @__PURE__ */ V({
610
610
  __name: "FindBar",
611
611
  props: { editor: {} },
612
612
  setup(e, { expose: t }) {
613
- let n = e, { open: r, query: i, replacement: a, matches: o, cursor: s } = Be(n.editor), c = q(null), u = q(null), d = I(() => {
613
+ let n = e, { open: r, query: i, replacement: a, matches: o, cursor: s } = We(n.editor), c = J(null), u = J(null), d = F(() => {
614
614
  let e = o.value.length;
615
615
  return e === 0 ? i.value === "" ? "" : "无结果" : `第 ${s.value + 1}/${e} 处`;
616
- }), f = I(() => o.value.length > 0), p = I(() => f.value && s.value > 0), h = I(() => f.value && s.value < o.value.length - 1);
616
+ }), f = F(() => o.value.length > 0), m = F(() => f.value && s.value > 0), h = F(() => f.value && s.value < o.value.length - 1);
617
617
  function g(e) {
618
618
  let t = o.value[e];
619
619
  if (!t) return;
@@ -634,13 +634,13 @@ var Ve = ["value"], He = ["value"], Ue = {
634
634
  let e = n.editor.replaceAll();
635
635
  e !== 0 && (u.value = `已替换 ${e} 处`, g(s.value));
636
636
  }
637
- function x() {
637
+ function b() {
638
638
  n.editor.closeFind(), u.value = null;
639
639
  }
640
640
  function S(e) {
641
641
  if (!(e.isComposing || e.keyCode === 229)) {
642
642
  if (e.key === "Escape") {
643
- e.preventDefault(), x();
643
+ e.preventDefault(), b();
644
644
  return;
645
645
  }
646
646
  e.key === "Enter" && (e.preventDefault(), _(e.shiftKey ? -1 : 1));
@@ -652,18 +652,18 @@ var Ve = ["value"], He = ["value"], Ue = {
652
652
  function w(e) {
653
653
  n.editor.setFindReplacement(e.target.value);
654
654
  }
655
- Q(r, (e) => {
655
+ ue(r, (e) => {
656
656
  e && c.value?.focus({ preventScroll: !0 });
657
657
  }, {
658
658
  immediate: !0,
659
659
  flush: "post"
660
660
  });
661
661
  function T(e) {
662
- r.value && (e.key.toLowerCase() !== "f" || !(e.metaKey || e.ctrlKey) || e.shiftKey || e.altKey || b(e.target) || c.value?.focus({ preventScroll: !0 }));
662
+ r.value && (e.key.toLowerCase() !== "f" || !(e.metaKey || e.ctrlKey) || e.shiftKey || e.altKey || x(e.target) || c.value?.focus({ preventScroll: !0 }));
663
663
  }
664
- return window.addEventListener("keydown", T), re(() => window.removeEventListener("keydown", T)), Q(i, () => {
664
+ return window.addEventListener("keydown", T), W(() => window.removeEventListener("keydown", T)), ue(i, () => {
665
665
  u.value = null;
666
- }), t({ close: x }), (e, t) => Z(r) ? (K(), z("div", {
666
+ }), t({ close: b }), (e, t) => Z(r) ? (q(), R("div", {
667
667
  key: 0,
668
668
  class: "cn-find-bar",
669
669
  "data-find-bar": "",
@@ -671,7 +671,7 @@ var Ve = ["value"], He = ["value"], Ue = {
671
671
  "aria-label": "查找替换",
672
672
  onPointerdown: t[2] ||= $(() => {}, ["stop"])
673
673
  }, [
674
- B("input", {
674
+ z("input", {
675
675
  ref_key: "queryInput",
676
676
  ref: c,
677
677
  class: "cn-find-bar__input",
@@ -684,8 +684,8 @@ var Ve = ["value"], He = ["value"], Ue = {
684
684
  autocomplete: "off",
685
685
  onInput: C,
686
686
  onKeydown: S
687
- }, null, 40, Ve),
688
- B("input", {
687
+ }, null, 40, Ge),
688
+ z("input", {
689
689
  class: "cn-find-bar__input",
690
690
  "data-find-replace": "",
691
691
  type: "text",
@@ -696,19 +696,19 @@ var Ve = ["value"], He = ["value"], Ue = {
696
696
  autocomplete: "off",
697
697
  onInput: w,
698
698
  onKeydown: S
699
- }, null, 40, He),
700
- B("span", Ue, X(d.value), 1),
701
- u.value ? (K(), z("span", We, X(u.value), 1)) : R("", !0),
702
- B("button", {
699
+ }, null, 40, Ke),
700
+ z("span", qe, X(d.value), 1),
701
+ u.value ? (q(), R("span", Je, X(u.value), 1)) : L("", !0),
702
+ z("button", {
703
703
  type: "button",
704
704
  class: "cn-find-bar__key",
705
705
  "data-find-prev": "",
706
- disabled: !p.value,
706
+ disabled: !m.value,
707
707
  title: "上一处(Shift+Enter)",
708
708
  "aria-label": "上一处",
709
709
  onClick: t[0] ||= (e) => _(-1)
710
- }, [V(m, { icon: Z(fe) }, null, 8, ["icon"])], 8, Ge),
711
- B("button", {
710
+ }, [B(p, { icon: Z(ge) }, null, 8, ["icon"])], 8, Ye),
711
+ z("button", {
712
712
  type: "button",
713
713
  class: "cn-find-bar__key",
714
714
  "data-find-next": "",
@@ -716,34 +716,34 @@ var Ve = ["value"], He = ["value"], Ue = {
716
716
  title: "下一处(Enter)",
717
717
  "aria-label": "下一处",
718
718
  onClick: t[1] ||= (e) => _(1)
719
- }, [V(m, { icon: Z(l) }, null, 8, ["icon"])], 8, Ke),
720
- B("button", {
719
+ }, [B(p, { icon: Z(l) }, null, 8, ["icon"])], 8, Xe),
720
+ z("button", {
721
721
  type: "button",
722
722
  class: "cn-find-bar__action",
723
723
  "data-find-replace-one": "",
724
724
  disabled: !f.value,
725
725
  title: "替换当前处",
726
726
  onClick: v
727
- }, " 替换 ", 8, qe),
728
- B("button", {
727
+ }, " 替换 ", 8, Ze),
728
+ z("button", {
729
729
  type: "button",
730
730
  class: "cn-find-bar__action",
731
731
  "data-find-replace-all": "",
732
732
  disabled: !f.value,
733
733
  title: "全部替换",
734
734
  onClick: y
735
- }, " 全部替换 ", 8, Je),
736
- B("button", {
735
+ }, " 全部替换 ", 8, Qe),
736
+ z("button", {
737
737
  type: "button",
738
738
  class: "cn-find-bar__key",
739
739
  "data-find-close": "",
740
740
  title: "关闭(Esc)",
741
741
  "aria-label": "关闭查找替换",
742
- onClick: x
743
- }, [V(m, { icon: Z(ge) }, null, 8, ["icon"])])
744
- ], 32)) : R("", !0);
742
+ onClick: b
743
+ }, [B(p, { icon: Z(be) }, null, 8, ["icon"])])
744
+ ], 32)) : L("", !0);
745
745
  }
746
- }), [["__scopeId", "data-v-71f0a3ae"]]), Xe = {
746
+ }), [["__scopeId", "data-v-32c2bf8f"]]), et = {
747
747
  nw: "nwse-resize",
748
748
  se: "nwse-resize",
749
749
  ne: "nesw-resize",
@@ -752,41 +752,32 @@ var Ve = ["value"], He = ["value"], Ue = {
752
752
  s: "ns-resize",
753
753
  e: "ew-resize",
754
754
  w: "ew-resize"
755
- }, Ze = {
755
+ }, tt = {
756
756
  class: "cn-edit-toolbar__segment",
757
757
  role: "group",
758
758
  "aria-label": "内容类型",
759
759
  "data-content-pill": ""
760
- }, Qe = [
761
- "aria-pressed",
762
- "data-pill-static",
763
- "data-pill-expression",
764
- "onClick"
765
- ], $e = { class: "cn-edit-toolbar__segment" }, et = ["value"], tt = ["value"], nt = {
760
+ }, nt = [
761
+ "aria-expanded",
762
+ "onClick",
763
+ "onKeydown"
764
+ ], rt = { class: "cn-edit-toolbar__segment" }, it = ["value"], at = ["value"], ot = {
766
765
  class: "cn-edit-toolbar__segment",
767
766
  role: "group",
768
767
  "aria-label": "字号"
769
- }, rt = { class: "cn-edit-toolbar__segment" }, it = ["value"], at = {
770
- class: "cn-edit-toolbar__segment",
768
+ }, st = { class: "cn-edit-toolbar__segment" }, ct = ["value"], lt = {
769
+ class: "cn-edit-toolbar__segment cn-edit-toolbar__align-group",
771
770
  role: "group",
772
- "aria-label": "水平对齐",
773
- "data-toolbar-align-horizontal": ""
774
- }, ot = [
775
- "aria-pressed",
776
- "title",
777
- "data-align-h",
778
- "onClick"
779
- ], st = {
780
- class: "cn-edit-toolbar__segment",
781
- role: "group",
782
- "aria-label": "垂直对齐",
783
- "data-toolbar-align-vertical": ""
784
- }, ct = [
785
- "aria-pressed",
786
- "title",
787
- "data-align-v",
788
- "onClick"
789
- ], lt = { class: "cn-edit-toolbar__segment" }, ut = ["aria-pressed"], dt = 1, ft = /*#__PURE__*/ x(/* @__PURE__ */ H({
771
+ "aria-label": "对齐"
772
+ }, ut = [
773
+ "aria-expanded",
774
+ "onClick",
775
+ "onKeydown"
776
+ ], dt = [
777
+ "aria-expanded",
778
+ "onClick",
779
+ "onKeydown"
780
+ ], ft = { class: "cn-edit-toolbar__segment" }, pt = ["aria-pressed"], mt = 1, ht = /*#__PURE__*/ h(/* @__PURE__ */ V({
790
781
  __name: "EditOverlayToolbar",
791
782
  props: {
792
783
  mode: {},
@@ -799,8 +790,8 @@ var Ve = ["value"], He = ["value"], Ue = {
799
790
  },
800
791
  emits: ["change", "styleWrite"],
801
792
  setup(e, { expose: o, emit: l }) {
802
- let d = e, f = l, p = q(null);
803
- o({ rootEl: p });
793
+ let d = e, f = l, m = J(null);
794
+ o({ rootEl: m });
804
795
  function h(e, t, n) {
805
796
  f("styleWrite", {
806
797
  key: e,
@@ -814,264 +805,333 @@ var Ve = ["value"], He = ["value"], Ue = {
814
805
  }, {
815
806
  value: "expression",
816
807
  label: "表达式"
817
- }];
818
- function _(e) {
808
+ }], _ = F(() => g.find((e) => e.value === d.mode)?.label ?? d.mode), y = F(() => g.map((e) => ({
809
+ label: e.label,
810
+ checked: e.value === d.mode,
811
+ dataAttrs: { [`data-pill-${e.value}`]: "true" },
812
+ run: () => b(e.value)
813
+ })));
814
+ function b(e) {
819
815
  e !== d.mode && f("change", e);
820
816
  }
821
- let v = D(), y = I(() => {
817
+ let x = k(), C = F(() => {
822
818
  let e = [{
823
819
  label: "内置默认字体",
824
820
  value: ""
825
821
  }];
826
- if (v !== null) for (let t of v.entries.value) t.ref !== "" && e.push({
822
+ if (x !== null) for (let t of x.entries.value) t.ref !== "" && e.push({
827
823
  label: t.label,
828
824
  value: t.ref
829
825
  });
830
826
  let t = d.font;
831
827
  return t !== "" && !e.some((e) => e.value === t) && e.push({
832
- label: b(t),
828
+ label: w(t),
833
829
  value: t
834
830
  }), e;
835
831
  });
836
- function b(e) {
832
+ function w(e) {
837
833
  return e.startsWith("data:") ? "自定义字体(内联)" : e.split("/").pop() || e;
838
834
  }
839
- function x(e) {
835
+ function T(e) {
840
836
  h(["font"], e.target.value, !0);
841
837
  }
842
- let S = q(String(d.fontSize)), C = q(!1);
843
- Q(() => d.fontSize, (e) => {
844
- C.value || (S.value = String(e));
838
+ let E = J(String(d.fontSize)), D = J(!1);
839
+ ue(() => d.fontSize, (e) => {
840
+ D.value || (E.value = String(e));
845
841
  });
846
- function w(e) {
847
- return Math.max(dt, Math.trunc(e));
842
+ function O(e) {
843
+ return Math.max(mt, Math.trunc(e));
848
844
  }
849
- function T(e) {
845
+ function ee(e) {
850
846
  if (e.value.trim() === "") return null;
851
847
  let t = Number(e.value);
852
848
  return Number.isFinite(t) ? t : null;
853
849
  }
854
- function E(e) {
850
+ function te(e) {
855
851
  let t = e.target;
856
- S.value = t.value;
857
- let n = T(t);
858
- n !== null && h(["fontSize"], w(n), !1);
852
+ E.value = t.value;
853
+ let n = ee(t);
854
+ n !== null && h(["fontSize"], O(n), !1);
859
855
  }
860
- function O(e) {
861
- let t = e.target, n = T(t);
856
+ function A(e) {
857
+ let t = e.target, n = ee(t);
862
858
  if (n === null) {
863
- S.value = String(d.fontSize);
859
+ E.value = String(d.fontSize);
864
860
  return;
865
861
  }
866
- let r = w(n);
867
- S.value = String(r), h(["fontSize"], r, !0);
862
+ let r = O(n);
863
+ E.value = String(r), h(["fontSize"], r, !0);
868
864
  }
869
- function k(e) {
870
- let t = w(d.fontSize + e);
871
- S.value = String(t), h(["fontSize"], t, !1);
865
+ function j(e) {
866
+ let t = O(d.fontSize + e);
867
+ E.value = String(t), h(["fontSize"], t, !1);
872
868
  }
873
- let ee = I(() => /^#[0-9a-fA-F]{6}$/.test(d.fontColor) ? d.fontColor : "#000000");
874
- function A(e) {
869
+ let M = F(() => /^#[0-9a-fA-F]{6}$/.test(d.fontColor) ? d.fontColor : "#000000");
870
+ function ne(e) {
875
871
  h(["fontColor"], e.target.value, !1);
876
872
  }
877
- function j(e) {
873
+ function re(e) {
878
874
  h(["fontColor"], e.target.value, !0);
879
875
  }
880
- let M = {
876
+ let N = {
881
877
  left: {
882
878
  icon: t,
883
- title: "左对齐"
879
+ label: "左对齐"
884
880
  },
885
881
  center: {
886
882
  icon: r,
887
- title: "居中对齐"
883
+ label: "居中对齐"
888
884
  },
889
885
  right: {
890
886
  icon: u,
891
- title: "右对齐"
887
+ label: "右对齐"
892
888
  }
893
- }, N = {
889
+ }, I = {
894
890
  top: {
895
891
  icon: i,
896
- title: "顶对齐"
892
+ label: "顶对齐"
897
893
  },
898
894
  center: {
899
895
  icon: s,
900
- title: "居中对齐"
896
+ label: "居中对齐"
901
897
  },
902
898
  bottom: {
903
899
  icon: n,
904
- title: "底对齐"
900
+ label: "底对齐"
905
901
  }
906
- }, P = a.map((e) => ({
907
- value: e,
908
- ...M[e]
909
- })), L = c.map((e) => ({
910
- value: e,
911
- ...N[e]
912
- }));
913
- function R(e, t) {
902
+ }, L = F(() => a.map((e) => ({
903
+ label: N[e].label,
904
+ icon: N[e].icon,
905
+ checked: e === d.horizontalAlign,
906
+ dataAttrs: { "data-align-h": e },
907
+ run: () => U("horizontal", e)
908
+ }))), V = F(() => c.map((e) => ({
909
+ label: I[e].label,
910
+ icon: I[e].icon,
911
+ checked: e === d.verticalAlign,
912
+ dataAttrs: { "data-align-v": e },
913
+ run: () => U("vertical", e)
914
+ }))), ae = F(() => N[d.horizontalAlign].icon), oe = F(() => I[d.verticalAlign].icon);
915
+ function U(e, t) {
914
916
  t !== (e === "horizontal" ? d.horizontalAlign : d.verticalAlign) && h(e === "horizontal" ? ["align", "horizontal"] : ["align", "vertical"], t, !0);
915
917
  }
916
- function H() {
918
+ function W() {
917
919
  h(["autowrap"], !d.autowrap, !0);
918
920
  }
919
- return (t, n) => (K(), z("div", {
921
+ return (t, n) => (q(), R("div", {
920
922
  ref_key: "rootRef",
921
- ref: p,
923
+ ref: m,
922
924
  class: "cn-edit-toolbar",
923
925
  role: "toolbar",
924
926
  "aria-label": "文本编辑",
925
927
  "data-edit-toolbar": "",
926
- onPointerdown: n[7] ||= $(() => {}, ["prevent"])
928
+ onPointerdown: n[10] ||= $(() => {}, ["prevent"])
927
929
  }, [
928
- B("span", Ze, [(K(), z(F, null, J(g, (t) => B("button", {
929
- key: t.value,
930
- type: "button",
931
- class: U(["cn-edit-toolbar__item", { "cn-edit-toolbar__item--active": t.value === e.mode }]),
932
- "aria-pressed": t.value === e.mode,
933
- "data-pill-static": t.value === "static" || void 0,
934
- "data-pill-expression": t.value === "expression" || void 0,
935
- onClick: (e) => _(t.value)
936
- }, X(t.label), 11, Qe)), 64))]),
937
- B("span", $e, [B("select", {
938
- class: "cn-edit-toolbar__font",
939
- "data-toolbar-font": "",
940
- value: e.font,
941
- title: "字体",
942
- onPointerdown: n[0] ||= $(() => {}, ["stop"]),
943
- onChange: x
944
- }, [(K(!0), z(F, null, J(y.value, (e) => (K(), z("option", {
945
- key: e.value,
946
- value: e.value
947
- }, X(e.label), 9, tt))), 128))], 40, et)]),
948
- B("span", nt, [
949
- B("button", {
950
- type: "button",
951
- class: "cn-edit-toolbar__mini",
952
- "data-toolbar-font-size-dec": "",
953
- title: "字号减 1",
954
- onClick: n[1] ||= (e) => k(-1)
955
- }, [V(m, {
956
- icon: Z(pe),
957
- size: 11
958
- }, null, 8, ["icon"])]),
959
- se(B("input", {
960
- "onUpdate:modelValue": n[2] ||= (e) => S.value = e,
961
- class: "cn-edit-toolbar__size",
962
- "data-toolbar-font-size": "",
963
- type: "number",
964
- min: dt,
965
- step: 1,
966
- "aria-label": "字号(场景像素)",
967
- title: "字号(场景像素)",
968
- onPointerdown: n[3] ||= $(() => {}, ["stop"]),
969
- onInput: E,
970
- onChange: O,
971
- onBlur: O,
972
- onFocus: n[4] ||= (e) => C.value = !0
973
- }, null, 544), [[ae, S.value]]),
974
- B("button", {
975
- type: "button",
976
- class: "cn-edit-toolbar__mini",
977
- "data-toolbar-font-size-inc": "",
978
- title: "字号加 1",
979
- onClick: n[5] ||= (e) => k(1)
980
- }, [V(m, {
981
- icon: Z(me),
982
- size: 11
983
- }, null, 8, ["icon"])])
930
+ z("span", tt, [B(S, {
931
+ label: "内容类型",
932
+ items: y.value
933
+ }, {
934
+ trigger: Q(({ open: e, toggle: t, triggerRef: r, onKeydown: i }) => [B(v, { label: "内容类型" }, {
935
+ default: Q(() => [z("button", {
936
+ ref: r,
937
+ type: "button",
938
+ class: "cn-edit-toolbar__item cn-edit-toolbar__menu-trigger",
939
+ "aria-haspopup": "menu",
940
+ "aria-expanded": e,
941
+ onPointerdown: n[0] ||= $(() => {}, ["stop"]),
942
+ onClick: t,
943
+ onKeydown: i
944
+ }, [ie(X(_.value) + " ", 1), n[11] ||= z("span", {
945
+ class: "cn-edit-toolbar__caret",
946
+ "aria-hidden": "true"
947
+ }, "▾", -1)], 40, nt)]),
948
+ _: 2
949
+ }, 1024)]),
950
+ _: 1
951
+ }, 8, ["items"])]),
952
+ z("span", rt, [B(v, { label: "字体" }, {
953
+ default: Q(() => [z("select", {
954
+ class: "cn-edit-toolbar__font",
955
+ "data-toolbar-font": "",
956
+ value: e.font,
957
+ "aria-label": "字体",
958
+ onPointerdown: n[1] ||= $(() => {}, ["stop"]),
959
+ onChange: T
960
+ }, [(q(!0), R(P, null, se(C.value, (e) => (q(), R("option", {
961
+ key: e.value,
962
+ value: e.value
963
+ }, X(e.label), 9, at))), 128))], 40, it)]),
964
+ _: 1
965
+ })]),
966
+ z("span", ot, [
967
+ B(v, { label: "字号减 1" }, {
968
+ default: Q(() => [z("button", {
969
+ type: "button",
970
+ class: "cn-edit-toolbar__mini",
971
+ "data-toolbar-font-size-dec": "",
972
+ "aria-label": "字号减 1",
973
+ onClick: n[2] ||= (e) => j(-1)
974
+ }, [B(p, {
975
+ icon: Z(_e),
976
+ size: 11
977
+ }, null, 8, ["icon"])])]),
978
+ _: 1
979
+ }),
980
+ B(v, { label: "字号(场景像素)" }, {
981
+ default: Q(() => [de(z("input", {
982
+ "onUpdate:modelValue": n[3] ||= (e) => E.value = e,
983
+ class: "cn-edit-toolbar__size",
984
+ "data-toolbar-font-size": "",
985
+ type: "number",
986
+ min: mt,
987
+ step: 1,
988
+ "aria-label": "字号(场景像素)",
989
+ onPointerdown: n[4] ||= $(() => {}, ["stop"]),
990
+ onInput: te,
991
+ onChange: A,
992
+ onBlur: A,
993
+ onFocus: n[5] ||= (e) => D.value = !0
994
+ }, null, 544), [[ce, E.value]])]),
995
+ _: 1
996
+ }),
997
+ B(v, { label: "字号加 1" }, {
998
+ default: Q(() => [z("button", {
999
+ type: "button",
1000
+ class: "cn-edit-toolbar__mini",
1001
+ "data-toolbar-font-size-inc": "",
1002
+ "aria-label": "字号加 1",
1003
+ onClick: n[6] ||= (e) => j(1)
1004
+ }, [B(p, {
1005
+ icon: Z(ve),
1006
+ size: 11
1007
+ }, null, 8, ["icon"])])]),
1008
+ _: 1
1009
+ })
984
1010
  ]),
985
- B("span", rt, [B("input", {
986
- class: "cn-edit-toolbar__color",
987
- "data-toolbar-font-color": "",
988
- type: "color",
989
- value: ee.value,
990
- "aria-label": "字色",
991
- title: "字色",
992
- onPointerdown: n[6] ||= $(() => {}, ["stop"]),
993
- onInput: A,
994
- onChange: j
995
- }, null, 40, it)]),
996
- B("span", at, [(K(!0), z(F, null, J(Z(P), (t) => (K(), z("button", {
997
- key: t.value,
998
- type: "button",
999
- class: U(["cn-edit-toolbar__item cn-edit-toolbar__icon-item", { "cn-edit-toolbar__item--active": t.value === e.horizontalAlign }]),
1000
- "aria-pressed": t.value === e.horizontalAlign,
1001
- title: `水平对齐:${t.title}`,
1002
- "data-align-h": t.value,
1003
- onClick: (e) => R("horizontal", t.value)
1004
- }, [V(m, {
1005
- icon: t.icon,
1006
- size: 12
1007
- }, null, 8, ["icon"])], 10, ot))), 128))]),
1008
- B("span", st, [(K(!0), z(F, null, J(Z(L), (t) => (K(), z("button", {
1009
- key: t.value,
1010
- type: "button",
1011
- class: U(["cn-edit-toolbar__item cn-edit-toolbar__icon-item", { "cn-edit-toolbar__item--active": t.value === e.verticalAlign }]),
1012
- "aria-pressed": t.value === e.verticalAlign,
1013
- title: `垂直对齐:${t.title}`,
1014
- "data-align-v": t.value,
1015
- onClick: (e) => R("vertical", t.value)
1016
- }, [V(m, {
1017
- icon: t.icon,
1018
- size: 12
1019
- }, null, 8, ["icon"])], 10, ct))), 128))]),
1020
- B("span", lt, [B("button", {
1021
- type: "button",
1022
- class: U(["cn-edit-toolbar__item cn-edit-toolbar__icon-item", { "cn-edit-toolbar__item--active": e.autowrap }]),
1023
- "aria-pressed": e.autowrap,
1024
- "data-toolbar-autowrap": "",
1025
- title: "自动换行",
1026
- onClick: H
1027
- }, [V(m, {
1028
- icon: Z(he),
1029
- size: 12
1030
- }, null, 8, ["icon"])], 10, ut)])
1011
+ z("span", st, [B(v, { label: "字色" }, {
1012
+ default: Q(() => [z("input", {
1013
+ class: "cn-edit-toolbar__color",
1014
+ "data-toolbar-font-color": "",
1015
+ type: "color",
1016
+ value: M.value,
1017
+ "aria-label": "字色",
1018
+ onPointerdown: n[7] ||= $(() => {}, ["stop"]),
1019
+ onInput: ne,
1020
+ onChange: re
1021
+ }, null, 40, ct)]),
1022
+ _: 1
1023
+ })]),
1024
+ z("span", lt, [B(S, {
1025
+ label: "水平对齐",
1026
+ items: L.value
1027
+ }, {
1028
+ trigger: Q(({ open: e, toggle: t, triggerRef: r, onKeydown: i }) => [B(v, { label: "水平对齐" }, {
1029
+ default: Q(() => [z("button", {
1030
+ ref: r,
1031
+ type: "button",
1032
+ class: "cn-edit-toolbar__item cn-edit-toolbar__icon-item cn-edit-toolbar__menu-trigger",
1033
+ "data-toolbar-align-horizontal": "",
1034
+ "aria-label": "水平对齐",
1035
+ "aria-haspopup": "menu",
1036
+ "aria-expanded": e,
1037
+ onPointerdown: n[8] ||= $(() => {}, ["stop"]),
1038
+ onClick: t,
1039
+ onKeydown: i
1040
+ }, [B(p, {
1041
+ icon: ae.value,
1042
+ size: 12
1043
+ }, null, 8, ["icon"]), n[12] ||= z("span", {
1044
+ class: "cn-edit-toolbar__caret",
1045
+ "aria-hidden": "true"
1046
+ }, "▾", -1)], 40, ut)]),
1047
+ _: 2
1048
+ }, 1024)]),
1049
+ _: 1
1050
+ }, 8, ["items"]), B(S, {
1051
+ label: "垂直对齐",
1052
+ items: V.value
1053
+ }, {
1054
+ trigger: Q(({ open: e, toggle: t, triggerRef: r, onKeydown: i }) => [B(v, { label: "垂直对齐" }, {
1055
+ default: Q(() => [z("button", {
1056
+ ref: r,
1057
+ type: "button",
1058
+ class: "cn-edit-toolbar__item cn-edit-toolbar__icon-item cn-edit-toolbar__menu-trigger",
1059
+ "data-toolbar-align-vertical": "",
1060
+ "aria-label": "垂直对齐",
1061
+ "aria-haspopup": "menu",
1062
+ "aria-expanded": e,
1063
+ onPointerdown: n[9] ||= $(() => {}, ["stop"]),
1064
+ onClick: t,
1065
+ onKeydown: i
1066
+ }, [B(p, {
1067
+ icon: oe.value,
1068
+ size: 12
1069
+ }, null, 8, ["icon"]), n[13] ||= z("span", {
1070
+ class: "cn-edit-toolbar__caret",
1071
+ "aria-hidden": "true"
1072
+ }, "▾", -1)], 40, dt)]),
1073
+ _: 2
1074
+ }, 1024)]),
1075
+ _: 1
1076
+ }, 8, ["items"])]),
1077
+ z("span", ft, [B(v, { label: "自动换行" }, {
1078
+ default: Q(() => [z("button", {
1079
+ type: "button",
1080
+ class: H(["cn-edit-toolbar__item cn-edit-toolbar__icon-item", { "cn-edit-toolbar__item--active": e.autowrap }]),
1081
+ "aria-pressed": e.autowrap,
1082
+ "data-toolbar-autowrap": "",
1083
+ "aria-label": "自动换行",
1084
+ onClick: W
1085
+ }, [B(p, {
1086
+ icon: Z(ye),
1087
+ size: 12
1088
+ }, null, 8, ["icon"])], 10, pt)]),
1089
+ _: 1
1090
+ })])
1031
1091
  ], 544));
1032
1092
  }
1033
- }), [["__scopeId", "data-v-dcead501"]]);
1093
+ }), [["__scopeId", "data-v-c5e0bf39"]]);
1034
1094
  //#endregion
1035
1095
  //#region src/canvas/useDpr.ts
1036
- function pt(e) {
1096
+ function gt(e) {
1037
1097
  let t = null, n = () => {
1038
1098
  t?.removeEventListener("change", n), e(window.devicePixelRatio || 1), t = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`), t.addEventListener("change", n);
1039
1099
  };
1040
1100
  return n(), () => t?.removeEventListener("change", n);
1041
1101
  }
1042
- function mt() {
1043
- let e = Y(window.devicePixelRatio || 1), t = pt((t) => {
1102
+ function _t() {
1103
+ let e = Y(window.devicePixelRatio || 1), t = gt((t) => {
1044
1104
  e.value = t;
1045
1105
  });
1046
- return G(t, !0), e;
1106
+ return K(t, !0), e;
1047
1107
  }
1048
1108
  //#endregion
1049
1109
  //#region src/canvas/useTextEditing.ts
1050
- var ht = /* @__PURE__ */ new Map();
1051
- function gt(e, t) {
1052
- let n = `${e}|${t}`, r = ht.get(n);
1110
+ var vt = /* @__PURE__ */ new Map();
1111
+ function yt(e, t) {
1112
+ let n = `${e}|${t}`, r = vt.get(n);
1053
1113
  if (r !== void 0) return r;
1054
1114
  let i = t * 1.2;
1055
1115
  try {
1056
1116
  let n = document.createElement("canvas").getContext("2d");
1057
1117
  if (n) {
1058
- n.font = `${t}px ${De(e)}`;
1118
+ n.font = `${t}px ${je(e)}`;
1059
1119
  let r = n.measureText("字"), a = (r.fontBoundingBoxAscent ?? r.actualBoundingBoxAscent) + (r.fontBoundingBoxDescent ?? r.actualBoundingBoxDescent);
1060
1120
  a > 0 && (i = a);
1061
1121
  }
1062
1122
  } catch {}
1063
- return ht.set(n, i), i;
1123
+ return vt.set(n, i), i;
1064
1124
  }
1065
- function _t(e, t) {
1125
+ function bt(e, t) {
1066
1126
  let n = Y(e.store.ui.editing), r = Y(0), i = e.subscribe((t) => {
1067
1127
  t.scope === "doc" ? (r.value += 1, n.value = e.store.ui.editing) : t.scope === "ui" && t.branch === "editing" && (n.value = e.store.ui.editing);
1068
1128
  });
1069
- G(i, !0);
1070
- let a = I(() => n.value?.path ?? null), o = mt(), s = P(e), c = I(() => {
1129
+ K(i, !0);
1130
+ let a = F(() => n.value?.path ?? null), o = _t(), s = N(e), c = F(() => {
1071
1131
  r.value;
1072
1132
  let t = n.value;
1073
1133
  return t ? e.textEditLayout(t.path) : null;
1074
- }), l = I(() => _e(s.value, o.value));
1134
+ }), l = F(() => xe(s.value, o.value));
1075
1135
  function u(e, t) {
1076
1136
  let { x: n, y: r, zoom: i } = l.value;
1077
1137
  return {
@@ -1080,7 +1140,7 @@ function _t(e, t) {
1080
1140
  zoom: i
1081
1141
  };
1082
1142
  }
1083
- let d = I(() => {
1143
+ let d = F(() => {
1084
1144
  let e = c.value;
1085
1145
  if (!e) return null;
1086
1146
  let { left: t, top: n, zoom: r } = u(e.box.x, e.box.y);
@@ -1090,7 +1150,7 @@ function _t(e, t) {
1090
1150
  width: `${e.box.width}px`,
1091
1151
  height: `${e.box.height}px`,
1092
1152
  color: e.fontColor,
1093
- fontFamily: De(e.font),
1153
+ fontFamily: je(e.font),
1094
1154
  fontSize: `${e.fontSize}px`,
1095
1155
  lineHeight: `${e.lineHeightPx}px`,
1096
1156
  ...x(e),
@@ -1119,15 +1179,15 @@ function _t(e, t) {
1119
1179
  height: e.offsetHeight
1120
1180
  };
1121
1181
  };
1122
- Q(a, (e) => {
1182
+ ue(a, (e) => {
1123
1183
  e !== null && m();
1124
1184
  }, { flush: "post" });
1125
1185
  let g = null;
1126
- Q(() => t.getToolbar?.() ?? null, (e) => {
1186
+ ue(() => t.getToolbar?.() ?? null, (e) => {
1127
1187
  g?.disconnect(), g = null, e !== null && (h(), typeof ResizeObserver == "function" && (g = new ResizeObserver(h), g.observe(e)));
1128
1188
  }, { flush: "post" });
1129
1189
  let _ = null;
1130
- ie(() => {
1190
+ G(() => {
1131
1191
  let e = t.getHost();
1132
1192
  e !== null && typeof ResizeObserver == "function" && (_ = new ResizeObserver(() => {
1133
1193
  f.value = {
@@ -1135,10 +1195,10 @@ function _t(e, t) {
1135
1195
  height: e.clientHeight
1136
1196
  };
1137
1197
  }), _.observe(e));
1138
- }), G(() => {
1198
+ }), K(() => {
1139
1199
  _?.disconnect(), g?.disconnect();
1140
1200
  }, !0);
1141
- let v = I(() => {
1201
+ let v = F(() => {
1142
1202
  let e = c.value;
1143
1203
  if (!e) return null;
1144
1204
  let { width: t, height: n } = p.value, r = u(e.box.x + e.box.width / 2, e.box.y), i = u(e.box.x + e.box.width / 2, e.box.y + e.box.height), a = r.top - 4 - n < 0, o = a ? i.top + 4 : r.top - 4 - n;
@@ -1148,13 +1208,13 @@ function _t(e, t) {
1148
1208
  height: n,
1149
1209
  flipped: a
1150
1210
  };
1151
- }), y = I(() => {
1211
+ }), y = F(() => {
1152
1212
  let e = v.value;
1153
1213
  return e ? {
1154
1214
  left: `${e.left}px`,
1155
1215
  top: `${e.top}px`
1156
1216
  } : null;
1157
- }), b = I(() => {
1217
+ }), b = F(() => {
1158
1218
  let e = v.value;
1159
1219
  return e ? e.flipped ? {
1160
1220
  left: `${e.left}px`,
@@ -1166,7 +1226,7 @@ function _t(e, t) {
1166
1226
  } : null;
1167
1227
  });
1168
1228
  function x(e) {
1169
- let t = e.padding.top + e.verticalAnchorY, n = e.lineHeightPx, r = gt(e.font, e.fontSize), i;
1229
+ let t = e.padding.top + e.verticalAnchorY, n = e.lineHeightPx, r = yt(e.font, e.fontSize), i;
1170
1230
  return i = e.verticalAlign === "center" ? t - n / 2 : e.verticalAlign === "bottom" ? t - (n + r) / 2 : t - (n - r) / 2, {
1171
1231
  paddingTop: `${Math.max(0, i)}px`,
1172
1232
  paddingRight: `${e.padding.right}px`,
@@ -1186,23 +1246,23 @@ function _t(e, t) {
1186
1246
  }, T = (t, n, r) => {
1187
1247
  let i = e.store.ui.editing?.path;
1188
1248
  if (!i) return;
1189
- let a = ee(i, t);
1249
+ let a = A(i, t);
1190
1250
  e.updateSpec(i, t, n, { mergeKey: a }), r && e.store.closeMerge(a);
1191
1251
  }, E = null, D = !1, O = !1, k = () => {
1192
1252
  e.commitTextEdit(t.getTextarea()?.value ?? "");
1193
- }, A = () => {
1253
+ }, ee = () => {
1194
1254
  E !== null && clearTimeout(E), E = null;
1195
- }, j = () => {
1196
- if (A(), M.value) {
1255
+ }, te = () => {
1256
+ if (ee(), j.value) {
1197
1257
  O = !0;
1198
1258
  return;
1199
1259
  }
1200
1260
  k();
1201
- }, M = Y(!1), N = (e) => {
1202
- M.value = e, !e && O && (O = !1, a.value !== null && k());
1203
- }, F = () => {
1261
+ }, j = Y(!1), M = (e) => {
1262
+ j.value = e, !e && O && (O = !1, a.value !== null && k());
1263
+ }, ne = () => {
1204
1264
  if (a.value !== null) {
1205
- if (A(), D) {
1265
+ if (ee(), D) {
1206
1266
  D = !1;
1207
1267
  return;
1208
1268
  }
@@ -1210,7 +1270,7 @@ function _t(e, t) {
1210
1270
  E = null;
1211
1271
  let e = t.getTextarea();
1212
1272
  if (e === null || document.activeElement !== e) {
1213
- if (M.value) {
1273
+ if (j.value) {
1214
1274
  O = !0;
1215
1275
  return;
1216
1276
  }
@@ -1218,86 +1278,86 @@ function _t(e, t) {
1218
1278
  }
1219
1279
  }, 0);
1220
1280
  }
1221
- }, L = (e) => {
1281
+ }, re = (e) => {
1222
1282
  if (!(e instanceof Node)) return !1;
1223
1283
  let n = t.getToolbar?.() ?? null;
1224
1284
  if (n !== null && n.contains(e)) return !0;
1225
1285
  let r = t.getTextarea();
1226
1286
  return r !== null && r.contains(e);
1227
- }, R = (e) => {
1287
+ }, P = (e) => {
1228
1288
  if (a.value === null) return;
1229
1289
  let n = t.getToolbar?.() ?? null;
1230
1290
  if (n !== null && e.target instanceof Node && n.contains(e.target)) {
1231
1291
  D = !0;
1232
1292
  return;
1233
1293
  }
1234
- if (L(e.target)) return;
1294
+ if (re(e.target)) return;
1235
1295
  let r = t.getHost();
1236
1296
  r !== null && r.contains(e.target) || (D = !0);
1237
- }, z = () => {
1297
+ }, I = () => {
1238
1298
  D = !1;
1239
1299
  };
1240
- return window.addEventListener("pointerdown", R, !0), window.addEventListener("pointerup", z, !0), G(() => {
1241
- window.removeEventListener("pointerdown", R, !0), window.removeEventListener("pointerup", z, !0), A();
1300
+ return window.addEventListener("pointerdown", P, !0), window.addEventListener("pointerup", I, !0), K(() => {
1301
+ window.removeEventListener("pointerdown", P, !0), window.removeEventListener("pointerup", I, !0), ee();
1242
1302
  }, !0), {
1243
1303
  editing: a,
1244
1304
  layout: c,
1245
- draftSeq: I(() => n.value?.draftSeq),
1305
+ draftSeq: F(() => n.value?.draftSeq),
1246
1306
  style: d,
1247
1307
  toolbarStyle: y,
1248
1308
  toolbarTagStyle: b,
1249
- scale: I(() => l.value.zoom),
1250
- composing: I(() => M.value),
1251
- setComposing: N,
1309
+ scale: F(() => l.value.zoom),
1310
+ composing: F(() => j.value),
1311
+ setComposing: M,
1252
1312
  beginAt: S,
1253
1313
  beginTextEdit: C,
1254
- commitNow: j,
1314
+ commitNow: te,
1255
1315
  setExpressionMode: w,
1256
1316
  updateStyleField: T,
1257
- armBlurCommit: F,
1258
- ownsEventTarget: L
1317
+ armBlurCommit: ne,
1318
+ ownsEventTarget: re
1259
1319
  };
1260
1320
  }
1261
1321
  //#endregion
1262
1322
  //#region src/canvas/TextEditingOverlay.vue?vue&type=script&setup=true&lang.ts
1263
- var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1323
+ var xt = ["wrap"], St = /*#__PURE__*/ h(/* @__PURE__ */ V({
1264
1324
  __name: "TextEditingOverlay",
1265
1325
  props: { editor: {} },
1266
1326
  setup(e, { expose: t }) {
1267
- let n = e, r = q(null), i = q(null), a = q(null), o = q(null), s = _t(n.editor, {
1327
+ let n = e, r = J(null), i = J(null), a = J(null), o = J(null), s = bt(n.editor, {
1268
1328
  getTextarea: () => i.value,
1269
1329
  getHost: () => r.value?.parentElement ?? null,
1270
1330
  getToolbar: () => a.value?.rootEl ?? null
1271
- }), { editing: c, style: l, composing: u, toolbarStyle: d, toolbarTagStyle: f } = s, p = s.layout, m = I(() => p.value?.expressionMode === !0), { diagnostics: h, refresh: g } = T({
1331
+ }), { editing: c, style: l, composing: u, toolbarStyle: d, toolbarTagStyle: f } = s, p = s.layout, m = F(() => p.value?.expressionMode === !0), { diagnostics: h, refresh: g } = D({
1272
1332
  target: i,
1273
1333
  enabled: m
1274
- }), _ = I(() => m.value ? A(h.value) : ""), { popup: v, accept: y } = O({
1334
+ }), _ = F(() => m.value ? j(h.value) : ""), { popup: v, accept: y } = ee({
1275
1335
  target: i,
1276
1336
  enabled: m,
1277
1337
  resolve: (e) => {
1278
1338
  let t = n.editor.store.ui.dataSourceSchema, r = c.value;
1279
1339
  if (t === null || r === null) return null;
1280
- let i = E(t, j(t, n.editor.store.doc, r));
1340
+ let i = O(t, M(t, n.editor.store.doc, r));
1281
1341
  return i === null ? null : i(e);
1282
1342
  },
1283
1343
  popupEl: () => o.value?.rootEl ?? null,
1284
1344
  scale: s.scale
1285
1345
  });
1286
- Q(c, async (e) => {
1346
+ ue(c, async (e) => {
1287
1347
  if (!e) return;
1288
- await ne();
1348
+ await oe();
1289
1349
  let t = i.value, n = s.layout.value;
1290
1350
  t && n && (t.value = n.text, g(), t.focus({ preventScroll: !0 }), t.select());
1291
- }), Q(s.draftSeq, async () => {
1292
- await ne();
1351
+ }), ue(s.draftSeq, async () => {
1352
+ await oe();
1293
1353
  let e = i.value, t = s.layout.value;
1294
1354
  e && t && (e.value = t.text, g());
1295
- }), Q(l, async (e, t) => {
1355
+ }), ue(l, async (e, t) => {
1296
1356
  if (!t || !e) return;
1297
1357
  let n = i.value;
1298
1358
  if (!n || u.value) return;
1299
1359
  let r = n.selectionStart, a = n.selectionEnd;
1300
- await ne(), i.value === n && (n.selectionStart !== r || n.selectionEnd !== a) && n.setSelectionRange(r, a);
1360
+ await oe(), i.value === n && (n.selectionStart !== r || n.selectionEnd !== a) && n.setSelectionRange(r, a);
1301
1361
  }, { flush: "post" });
1302
1362
  let b = (e) => {
1303
1363
  e.isComposing || e.keyCode === 229 || (e.key === "Escape" || e.key === "Enter" && (e.ctrlKey || e.metaKey)) && (e.key === "Escape" && v.open || (e.preventDefault(), s.commitNow()));
@@ -1308,17 +1368,17 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1308
1368
  commitEditing: () => s.commitNow(),
1309
1369
  isEditing: () => c.value !== null,
1310
1370
  ownsEventTarget: (e) => s.ownsEventTarget(e)
1311
- }), (e, t) => (K(), z("div", {
1371
+ }), (e, t) => (q(), R("div", {
1312
1372
  ref_key: "rootRef",
1313
1373
  ref: r,
1314
1374
  class: "cn-text-overlay"
1315
1375
  }, [
1316
- Z(c) && Z(l) ? (K(), z("textarea", {
1376
+ Z(c) && Z(l) ? (q(), R("textarea", {
1317
1377
  key: Z(c).join(""),
1318
1378
  ref_key: "textareaRef",
1319
1379
  ref: i,
1320
1380
  class: "cn-text-overlay__textarea",
1321
- style: W(Z(l)),
1381
+ style: U(Z(l)),
1322
1382
  wrap: Z(l).whiteSpace === "pre" ? "off" : "soft",
1323
1383
  spellcheck: "false",
1324
1384
  autocomplete: "off",
@@ -1326,12 +1386,12 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1326
1386
  onBlur: x,
1327
1387
  onCompositionstart: t[0] ||= (e) => Z(s).setComposing(!0),
1328
1388
  onCompositionend: t[1] ||= (e) => Z(s).setComposing(!1)
1329
- }, null, 44, vt)) : R("", !0),
1330
- Z(c) && Z(d) ? (K(), L(ft, {
1389
+ }, null, 44, xt)) : L("", !0),
1390
+ Z(c) && Z(d) ? (q(), I(ht, {
1331
1391
  key: 1,
1332
1392
  ref_key: "toolbarRef",
1333
1393
  ref: a,
1334
- style: W(Z(d)),
1394
+ style: U(Z(d)),
1335
1395
  mode: m.value ? "expression" : "static",
1336
1396
  font: Z(p)?.font ?? "",
1337
1397
  "font-size": Z(p)?.fontSize ?? 16,
@@ -1350,13 +1410,13 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1350
1410
  "horizontal-align",
1351
1411
  "vertical-align",
1352
1412
  "autowrap"
1353
- ])) : R("", !0),
1354
- Z(c) && _.value ? (K(), z("span", {
1413
+ ])) : L("", !0),
1414
+ Z(c) && _.value ? (q(), R("span", {
1355
1415
  key: 2,
1356
1416
  class: "cn-text-overlay__diagnostic",
1357
- style: W(Z(f))
1358
- }, X(_.value), 5)) : R("", !0),
1359
- V(k, {
1417
+ style: U(Z(f))
1418
+ }, X(_.value), 5)) : L("", !0),
1419
+ B(te, {
1360
1420
  ref_key: "popupRef",
1361
1421
  ref: o,
1362
1422
  state: Z(v),
@@ -1364,22 +1424,22 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1364
1424
  }, null, 8, ["state", "onSelect"])
1365
1425
  ], 512));
1366
1426
  }
1367
- }), [["__scopeId", "data-v-9e96d660"]]), bt = {
1427
+ }), [["__scopeId", "data-v-50f44544"]]), Ct = {
1368
1428
  key: 0,
1369
1429
  class: "cn-surface__drop-hint",
1370
1430
  "data-drop-hint": ""
1371
- }, xt = 16, St = /*#__PURE__*/ x(/* @__PURE__ */ H({
1431
+ }, wt = 16, Tt = /*#__PURE__*/ h(/* @__PURE__ */ V({
1372
1432
  __name: "CanvasSurface",
1373
1433
  props: { editor: {} },
1374
1434
  emits: ["ready"],
1375
1435
  setup(e, { emit: t }) {
1376
- let n = e, r = t, i = q(null), a = q(null), o = q(null), s = q(null), c = q(null), l = q(null), u = q(!1), d = q(!1), f = q(null), p = q(null), m = q(n.editor.store.ui.armedCreate), h = q(!1), g = I(() => d.value ? "cn-surface--panning" : u.value ? "cn-surface--pannable" : ""), _ = I(() => {
1436
+ let n = e, r = t, i = J(null), a = J(null), o = J(null), s = J(null), c = J(null), l = J(null), u = J(!1), d = J(!1), f = J(null), p = J(null), m = J(n.editor.store.ui.armedCreate), h = J(!1), g = F(() => d.value ? "cn-surface--panning" : u.value ? "cn-surface--pannable" : ""), _ = F(() => {
1377
1437
  if (d.value) return;
1378
1438
  if (m.value !== null || h.value) return u.value ? void 0 : { cursor: "crosshair" };
1379
1439
  let e = p.value ?? f.value;
1380
- return e === null ? void 0 : { cursor: Xe[e] };
1381
- }), v = q(!1), y = C();
1382
- function x(e) {
1440
+ return e === null ? void 0 : { cursor: et[e] };
1441
+ }), v = J(!1), b = E();
1442
+ function S(e) {
1383
1443
  return new Promise((t, n) => {
1384
1444
  let r = URL.createObjectURL(e), i = new Image();
1385
1445
  i.onload = () => {
@@ -1392,53 +1452,53 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1392
1452
  }, i.src = r;
1393
1453
  });
1394
1454
  }
1395
- let w = [];
1396
- return ie(() => {
1455
+ let C = [];
1456
+ return G(() => {
1397
1457
  let e = i.value, t = a.value, g = o.value;
1398
1458
  if (!e || !t || !g) return;
1399
- let _ = n.editor, C = () => {
1459
+ let _ = n.editor, w = () => {
1400
1460
  let n = window.devicePixelRatio, r = Math.max(1, Math.round(e.clientWidth * n)), i = Math.max(1, Math.round(e.clientHeight * n));
1401
1461
  for (let e of [t, g]) e.width !== r && (e.width = r), e.height !== i && (e.height = i);
1402
1462
  _.flushPendingFrames();
1403
1463
  }, T = () => {
1404
- _.setSurfaceSize(e.clientWidth, e.clientHeight), C();
1464
+ _.setSurfaceSize(e.clientWidth, e.clientHeight), w();
1405
1465
  };
1406
1466
  _.setDevicePixelRatio(window.devicePixelRatio), T();
1407
1467
  let E = _.subscribe((e) => {
1408
1468
  (e.scope === "doc" || e.scope === "ui" && e.branch === "armedCreate") && (m.value = _.store.ui.armedCreate);
1409
1469
  });
1410
- w.push(E);
1470
+ C.push(E);
1411
1471
  let D = new ResizeObserver(T);
1412
- D.observe(e), w.push(() => D.disconnect());
1413
- let O = pt(() => {
1414
- _.setDevicePixelRatio(window.devicePixelRatio), C();
1472
+ D.observe(e), C.push(() => D.disconnect());
1473
+ let O = gt(() => {
1474
+ _.setDevicePixelRatio(window.devicePixelRatio), w();
1415
1475
  });
1416
- w.push(O);
1476
+ C.push(O);
1417
1477
  let k = (t) => {
1418
1478
  let n = e.getBoundingClientRect();
1419
1479
  return {
1420
1480
  x: t.clientX - n.left,
1421
1481
  y: t.clientY - n.top
1422
1482
  };
1423
- }, ee = (e) => e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? 100 : 1, A = (e) => {
1483
+ }, ee = (e) => e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? 100 : 1, te = (e) => {
1424
1484
  e.preventDefault();
1425
- let t = ee(e), n = k(e), r = Te(e);
1485
+ let t = ee(e), n = k(e), r = ke(e);
1426
1486
  r === "zoom" ? _.zoomByWheel(n.x, n.y, e.deltaY * t) : r === "pan-x" ? _.panBy(-(e.deltaY || e.deltaX) * t, 0) : _.panBy(-e.deltaX * t, -e.deltaY * t);
1427
1487
  };
1428
- e.addEventListener("wheel", A, { passive: !1 }), w.push(() => e.removeEventListener("wheel", A));
1429
- let j = null, N = {
1488
+ e.addEventListener("wheel", te, { passive: !1 }), C.push(() => e.removeEventListener("wheel", te));
1489
+ let A = null, j = {
1430
1490
  x: 0,
1431
1491
  y: 0
1432
- }, P = (e) => {
1492
+ }, M = (e) => {
1433
1493
  let t = k(e);
1434
1494
  return _.toScenePoint(t.x, t.y);
1435
- }, F = (t) => {
1436
- if (c.value?.close(), j !== null) return;
1495
+ }, re = (t) => {
1496
+ if (c.value?.close(), A !== null) return;
1437
1497
  if (t.button === 1 || t.button === 0 && u.value) {
1438
- t.preventDefault(), j = {
1498
+ t.preventDefault(), A = {
1439
1499
  id: t.pointerId,
1440
1500
  mode: "pan"
1441
- }, N = {
1501
+ }, j = {
1442
1502
  x: t.clientX,
1443
1503
  y: t.clientY
1444
1504
  }, d.value = !0, e.setPointerCapture(t.pointerId);
@@ -1450,9 +1510,9 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1450
1510
  s.value.commitEditing();
1451
1511
  }
1452
1512
  t.preventDefault();
1453
- let n = P(t);
1513
+ let n = M(t);
1454
1514
  if (_.beginLayerCreate(n.x, n.y)) {
1455
- j = {
1515
+ A = {
1456
1516
  id: t.pointerId,
1457
1517
  mode: "create"
1458
1518
  }, h.value = !0, f.value = null, e.setPointerCapture(t.pointerId);
@@ -1460,69 +1520,69 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1460
1520
  }
1461
1521
  let r = _.resizeHandleAt(n.x, n.y);
1462
1522
  if (r !== null && _.beginResize(_.store.ui.selection, r, n.x, n.y)) {
1463
- j = {
1523
+ A = {
1464
1524
  id: t.pointerId,
1465
1525
  mode: "resize"
1466
1526
  }, p.value = r, f.value = null, e.setPointerCapture(t.pointerId);
1467
1527
  return;
1468
1528
  }
1469
- let i = P(t), a = _.selectAt(i.x, i.y);
1529
+ let i = M(t), a = _.selectAt(i.x, i.y);
1470
1530
  if (a && _.beginDrag(a, i.x, i.y, { copy: t.altKey && _.canCopyLayerAt(a) })) {
1471
- j = {
1531
+ A = {
1472
1532
  id: t.pointerId,
1473
1533
  mode: "drag"
1474
1534
  }, e.setPointerCapture(t.pointerId);
1475
1535
  return;
1476
1536
  }
1477
- a === null && (j = {
1537
+ a === null && (A = {
1478
1538
  id: t.pointerId,
1479
1539
  mode: "pan"
1480
- }, N = {
1540
+ }, j = {
1481
1541
  x: t.clientX,
1482
1542
  y: t.clientY
1483
1543
  }, d.value = !0, e.setPointerCapture(t.pointerId));
1484
- }, I = (e) => {
1485
- if (j !== null) {
1486
- if (e.pointerId !== j.id) return;
1487
- if (j.mode === "pan") _.panBy(e.clientX - N.x, e.clientY - N.y), N = {
1544
+ }, N = (e) => {
1545
+ if (A !== null) {
1546
+ if (e.pointerId !== A.id) return;
1547
+ if (A.mode === "pan") _.panBy(e.clientX - j.x, e.clientY - j.y), j = {
1488
1548
  x: e.clientX,
1489
1549
  y: e.clientY
1490
1550
  };
1491
- else if (j.mode === "resize") {
1492
- let t = P(e);
1551
+ else if (A.mode === "resize") {
1552
+ let t = M(e);
1493
1553
  _.resizeTo(t.x, t.y, e.shiftKey);
1494
- } else if (j.mode === "create") {
1495
- let t = P(e);
1554
+ } else if (A.mode === "create") {
1555
+ let t = M(e);
1496
1556
  _.createTo(t.x, t.y, e.shiftKey);
1497
1557
  } else {
1498
- let t = P(e);
1558
+ let t = M(e);
1499
1559
  _.dragTo(t.x, t.y);
1500
1560
  }
1501
1561
  return;
1502
1562
  }
1503
- let t = P(e), n = _.resizeHandleAt(t.x, t.y);
1563
+ let t = M(e), n = _.resizeHandleAt(t.x, t.y);
1504
1564
  if (f.value = n, n !== null) {
1505
1565
  _.setHovered(null);
1506
1566
  return;
1507
1567
  }
1508
1568
  _.hoverAt(t.x, t.y);
1509
- }, L = (t) => {
1510
- if (j !== null && t.pointerId === j.id) {
1511
- if (j.mode === "drag") _.endDrag();
1512
- else if (j.mode === "resize") _.endResize(), p.value = null;
1513
- else if (j.mode === "create") {
1569
+ }, P = (t) => {
1570
+ if (A !== null && t.pointerId === A.id) {
1571
+ if (A.mode === "drag") _.endDrag();
1572
+ else if (A.mode === "resize") _.endResize(), p.value = null;
1573
+ else if (A.mode === "create") {
1514
1574
  h.value = !1;
1515
1575
  let e = _.endCreate();
1516
1576
  e !== null && s.value?.beginTextEdit(e);
1517
1577
  } else d.value = !1;
1518
- j = null, e.hasPointerCapture(t.pointerId) && e.releasePointerCapture(t.pointerId);
1578
+ A = null, e.hasPointerCapture(t.pointerId) && e.releasePointerCapture(t.pointerId);
1519
1579
  }
1520
- }, R = (e) => {
1580
+ }, F = (e) => {
1521
1581
  e.button === 1 && e.preventDefault();
1522
- }, z = (e) => {
1582
+ }, I = (e) => {
1523
1583
  let t = k(e), n = _.toScenePoint(t.x, t.y);
1524
1584
  s.value?.beginAt(n.x, n.y);
1525
- }, B = (e) => {
1585
+ }, L = (e) => {
1526
1586
  if (s.value?.isEditing()) {
1527
1587
  if (s.value.ownsEventTarget(e.target)) return;
1528
1588
  s.value.commitEditing();
@@ -1534,18 +1594,18 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1534
1594
  return;
1535
1595
  }
1536
1596
  c.value?.openAt(t.x, t.y);
1537
- }, V = () => {
1538
- j === null && (_.setHovered(null), f.value = null);
1597
+ }, R = () => {
1598
+ A === null && (_.setHovered(null), f.value = null);
1539
1599
  };
1540
- e.addEventListener("pointerdown", F), e.addEventListener("pointermove", I), e.addEventListener("pointerup", L), e.addEventListener("pointercancel", L), e.addEventListener("pointerleave", V), e.addEventListener("mousedown", R), e.addEventListener("dblclick", z), w.push(() => {
1541
- e.removeEventListener("pointerdown", F), e.removeEventListener("pointermove", I), e.removeEventListener("pointerup", L), e.removeEventListener("pointercancel", L), e.removeEventListener("pointerleave", V), e.removeEventListener("mousedown", R), e.removeEventListener("dblclick", z);
1600
+ e.addEventListener("pointerdown", re), e.addEventListener("pointermove", N), e.addEventListener("pointerup", P), e.addEventListener("pointercancel", P), e.addEventListener("pointerleave", R), e.addEventListener("mousedown", F), e.addEventListener("dblclick", I), C.push(() => {
1601
+ e.removeEventListener("pointerdown", re), e.removeEventListener("pointermove", N), e.removeEventListener("pointerup", P), e.removeEventListener("pointercancel", P), e.removeEventListener("pointerleave", R), e.removeEventListener("mousedown", F), e.removeEventListener("dblclick", I);
1542
1602
  });
1543
- let H = b, te = (e) => {
1544
- e.code !== "Space" || e.repeat || H(e.target) || (e.preventDefault(), u.value = !0);
1545
- }, ne = (e) => {
1603
+ let z = x, ie = (e) => {
1604
+ e.code !== "Space" || e.repeat || z(e.target) || (e.preventDefault(), u.value = !0);
1605
+ }, B = (e) => {
1546
1606
  e.code === "Space" && (u.value = !1);
1547
- }, U = (e) => {
1548
- if (!(e.key !== "Escape" || S(e.target))) {
1607
+ }, V = (e) => {
1608
+ if (!(e.key !== "Escape" || y(e.target))) {
1549
1609
  if (_.store.ui.armedCreate !== null || _.store.ui.create !== null) {
1550
1610
  _.cancelCreate();
1551
1611
  return;
@@ -1553,10 +1613,10 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1553
1613
  c.value?.close(), l.value?.close(), _.escapeSelection();
1554
1614
  }
1555
1615
  };
1556
- window.addEventListener("keydown", te), window.addEventListener("keyup", ne), window.addEventListener("keydown", U), w.push(() => {
1557
- window.removeEventListener("keydown", te), window.removeEventListener("keyup", ne), window.removeEventListener("keydown", U);
1558
- }), e.addEventListener("contextmenu", B), w.push(() => e.removeEventListener("contextmenu", B));
1559
- let W = (e) => {
1616
+ window.addEventListener("keydown", ie), window.addEventListener("keyup", B), window.addEventListener("keydown", V), C.push(() => {
1617
+ window.removeEventListener("keydown", ie), window.removeEventListener("keyup", B), window.removeEventListener("keydown", V);
1618
+ }), e.addEventListener("contextmenu", L), C.push(() => e.removeEventListener("contextmenu", L));
1619
+ let ae = (e) => {
1560
1620
  let t = e.dataTransfer?.items;
1561
1621
  if (!t) return !1;
1562
1622
  for (let e = 0; e < t.length; e += 1) {
@@ -1564,11 +1624,11 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1564
1624
  if (n !== void 0 && n.kind === "file" && n.type.startsWith("image/")) return !0;
1565
1625
  }
1566
1626
  return !1;
1567
- }, re = (e) => {
1568
- W(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"), v.value = !0);
1569
- }, ie = (t) => {
1627
+ }, oe = (e) => {
1628
+ ae(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"), v.value = !0);
1629
+ }, H = (t) => {
1570
1630
  t.relatedTarget !== null && e.contains(t.relatedTarget) || (v.value = !1);
1571
- }, G = (e) => {
1631
+ }, U = (e) => {
1572
1632
  e.preventDefault(), v.value = !1;
1573
1633
  let t = [], n = e.dataTransfer?.files;
1574
1634
  for (let e = 0; n !== void 0 && e < n.length; e += 1) {
@@ -1577,114 +1637,114 @@ var vt = ["wrap"], yt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1577
1637
  }
1578
1638
  if (t.length !== 0) {
1579
1639
  if (!_.canUpload) {
1580
- y.show("上传不可用:未接入上传实现,图片未添加");
1640
+ b.show("上传不可用:未接入上传实现,图片未添加");
1581
1641
  return;
1582
1642
  }
1583
- s.value?.isEditing() && s.value.commitEditing(), K(t, k(e));
1643
+ s.value?.isEditing() && s.value.commitEditing(), W(t, k(e));
1584
1644
  }
1585
- }, K = async (e, t) => {
1645
+ }, W = async (e, t) => {
1586
1646
  let n = _.toScenePoint(t.x, t.y);
1587
1647
  for (let t = 0; t < e.length; t += 1) {
1588
1648
  let r = e[t];
1589
1649
  if (r) try {
1590
- let e = await x(r);
1591
- await _.uploadImageAsLayer(await M(r), {
1650
+ let e = await S(r);
1651
+ await _.uploadImageAsLayer(await ne(r), {
1592
1652
  at: {
1593
- x: n.x + t * xt,
1594
- y: n.y + t * xt
1653
+ x: n.x + t * wt,
1654
+ y: n.y + t * wt
1595
1655
  },
1596
1656
  size: e
1597
1657
  });
1598
1658
  } catch (e) {
1599
- y.show(`上传失败:${e instanceof Error ? e.message : String(e)}`);
1659
+ b.show(`上传失败:${e instanceof Error ? e.message : String(e)}`);
1600
1660
  return;
1601
1661
  }
1602
1662
  }
1603
1663
  };
1604
- e.addEventListener("dragover", re), e.addEventListener("dragleave", ie), e.addEventListener("drop", G), w.push(() => {
1605
- e.removeEventListener("dragover", re), e.removeEventListener("dragleave", ie), e.removeEventListener("drop", G);
1664
+ e.addEventListener("dragover", oe), e.addEventListener("dragleave", H), e.addEventListener("drop", U), C.push(() => {
1665
+ e.removeEventListener("dragover", oe), e.removeEventListener("dragleave", H), e.removeEventListener("drop", U);
1606
1666
  });
1607
- let q = () => _.invalidate("both"), J = (e) => e.preventDefault();
1608
- t.addEventListener("contextlost", J), t.addEventListener("contextrestored", q), g.addEventListener("contextlost", J), g.addEventListener("contextrestored", q), w.push(() => {
1609
- t.removeEventListener("contextlost", J), t.removeEventListener("contextrestored", q), g.removeEventListener("contextlost", J), g.removeEventListener("contextrestored", q);
1667
+ let G = () => _.invalidate("both"), K = (e) => e.preventDefault();
1668
+ t.addEventListener("contextlost", K), t.addEventListener("contextrestored", G), g.addEventListener("contextlost", K), g.addEventListener("contextrestored", G), C.push(() => {
1669
+ t.removeEventListener("contextlost", K), t.removeEventListener("contextrestored", G), g.removeEventListener("contextlost", K), g.removeEventListener("contextrestored", G);
1610
1670
  }), r("ready", {
1611
1671
  contentCanvas: t,
1612
1672
  overlayCanvas: g
1613
1673
  });
1614
- }), re(() => {
1615
- w.forEach((e) => e()), w.length = 0, n.editor.detachSurfaces();
1616
- }), (t, n) => (K(), z("div", {
1674
+ }), W(() => {
1675
+ C.forEach((e) => e()), C.length = 0, n.editor.detachSurfaces();
1676
+ }), (t, n) => (q(), R("div", {
1617
1677
  ref_key: "hostRef",
1618
1678
  ref: i,
1619
- class: U(["cn-surface", g.value]),
1620
- style: W(_.value)
1679
+ class: H(["cn-surface", g.value]),
1680
+ style: U(_.value)
1621
1681
  }, [
1622
- B("canvas", {
1682
+ z("canvas", {
1623
1683
  ref_key: "contentRef",
1624
1684
  ref: a,
1625
1685
  class: "cn-surface__canvas"
1626
1686
  }, null, 512),
1627
- B("canvas", {
1687
+ z("canvas", {
1628
1688
  ref_key: "overlayRef",
1629
1689
  ref: o,
1630
1690
  class: "cn-surface__canvas cn-surface__canvas--overlay"
1631
1691
  }, null, 512),
1632
- V(yt, {
1692
+ B(St, {
1633
1693
  ref_key: "textEditRef",
1634
1694
  ref: s,
1635
1695
  editor: e.editor
1636
1696
  }, null, 8, ["editor"]),
1637
- V(ze, {
1697
+ B(Ue, {
1638
1698
  ref_key: "contextMenuRef",
1639
1699
  ref: c,
1640
1700
  editor: e.editor
1641
1701
  }, null, 8, ["editor"]),
1642
- V(Ye, {
1702
+ B($e, {
1643
1703
  ref_key: "findBarRef",
1644
1704
  ref: l,
1645
1705
  editor: e.editor
1646
1706
  }, null, 8, ["editor"]),
1647
- v.value ? (K(), z("div", bt, [...n[0] ||= [B("span", { class: "cn-surface__drop-hint-text" }, "松开以上传图片", -1)]])) : R("", !0)
1707
+ v.value ? (q(), R("div", Ct, [...n[0] ||= [z("span", { class: "cn-surface__drop-hint-text" }, "松开以上传图片", -1)]])) : L("", !0)
1648
1708
  ], 6));
1649
1709
  }
1650
- }), [["__scopeId", "data-v-e1d8373e"]]);
1710
+ }), [["__scopeId", "data-v-cf2b3fd9"]]);
1651
1711
  //#endregion
1652
1712
  //#region src/canvas/guideSnap.ts
1653
- function Ct(e, t, n, r) {
1713
+ function Et(e, t, n, r) {
1654
1714
  let i = e.store.doc;
1655
1715
  if (!i) return n;
1656
- let a = r === void 0 ? e.listGuides() : e.listGuides().filter((e) => e.id !== r), o = Ce({
1716
+ let a = r === void 0 ? e.listGuides() : e.listGuides().filter((e) => e.id !== r), o = De({
1657
1717
  x: n,
1658
1718
  y: n,
1659
1719
  width: 0,
1660
1720
  height: 0
1661
- }, be(i.width, i.height, ye(i, -1, e.textPolicies), a), ve(e.store.ui.viewport.zoom));
1721
+ }, we(i.width, i.height, Ce(i, -1, e.textPolicies), a), Se(e.store.ui.viewport.zoom));
1662
1722
  return t === "vertical" ? n + o.dx : n + o.dy;
1663
1723
  }
1664
1724
  //#endregion
1665
1725
  //#region src/canvas/GuidesOverlay.vue?vue&type=script&setup=true&lang.ts
1666
- var wt = [
1726
+ var Dt = [
1667
1727
  "data-snap-orientation",
1668
1728
  "data-snap-position",
1669
1729
  "data-snap-source"
1670
- ], Tt = [
1730
+ ], Ot = [
1671
1731
  "data-guide-line",
1672
1732
  "data-guide-orientation",
1673
1733
  "data-guide-position",
1674
1734
  "data-guide-dragging",
1675
1735
  "onPointerdown"
1676
- ], Et = ["data-guide-orientation", "data-guide-position"], Dt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1736
+ ], kt = ["data-guide-orientation", "data-guide-position"], At = /*#__PURE__*/ h(/* @__PURE__ */ V({
1677
1737
  __name: "GuidesOverlay",
1678
1738
  props: { editor: {} },
1679
1739
  setup(e, { expose: t }) {
1680
- let n = e, r = P(n.editor), i = Y(n.editor.store.doc), a = Y(n.editor.listGuides()), o = Y(n.editor.listSnapAxes()), s = n.editor.subscribe((e) => {
1740
+ let n = e, r = N(n.editor), i = Y(n.editor.store.doc), a = Y(n.editor.listGuides()), o = Y(n.editor.listSnapAxes()), s = n.editor.subscribe((e) => {
1681
1741
  if (e.scope === "doc") {
1682
1742
  i.value = n.editor.store.doc, a.value = n.editor.listGuides(), o.value = n.editor.listSnapAxes();
1683
1743
  return;
1684
1744
  }
1685
1745
  e.branch === "guides" ? a.value = n.editor.listGuides() : e.branch === "snapAxes" && (o.value = n.editor.listSnapAxes());
1686
1746
  });
1687
- G(s, !0);
1747
+ K(s, !0);
1688
1748
  function c(e, t) {
1689
1749
  let n = i.value, a = r.value;
1690
1750
  return n ? e === "vertical" ? {
@@ -1700,11 +1760,11 @@ var wt = [
1700
1760
  function l(e) {
1701
1761
  return String(Math.round(e * 100) / 100);
1702
1762
  }
1703
- let u = q(null);
1763
+ let u = J(null);
1704
1764
  function d(e) {
1705
1765
  return {
1706
1766
  orientation: e.orientation,
1707
- position: Ct(n.editor, e.orientation, e.position)
1767
+ position: Et(n.editor, e.orientation, e.position)
1708
1768
  };
1709
1769
  }
1710
1770
  function f(e) {
@@ -1731,7 +1791,7 @@ var wt = [
1731
1791
  endGuideDrag: m,
1732
1792
  cancelGuideDrag: h
1733
1793
  });
1734
- let g = q(null), _ = I(() => a.value.map((e) => {
1794
+ let g = J(null), _ = F(() => a.value.map((e) => {
1735
1795
  let t = g.value;
1736
1796
  return t !== null && t.id === e.id ? {
1737
1797
  id: e.id,
@@ -1746,7 +1806,7 @@ var wt = [
1746
1806
  dragging: !1,
1747
1807
  overRuler: !1
1748
1808
  };
1749
- })), v = q(null);
1809
+ })), v = J(null);
1750
1810
  function y(e, t) {
1751
1811
  let n = v.value?.getBoundingClientRect(), i = r.value, a = n?.left ?? 0, o = n?.top ?? 0;
1752
1812
  return t === "vertical" ? i.x + (e.clientX - a) / i.zoom : i.y + (e.clientY - o) / i.zoom;
@@ -1778,7 +1838,7 @@ var wt = [
1778
1838
  let t = g.value;
1779
1839
  t !== null && e.pointerId === t.pointerId && (g.value = {
1780
1840
  ...t,
1781
- current: Ct(n.editor, t.orientation, y(e, t.orientation), t.id),
1841
+ current: Et(n.editor, t.orientation, y(e, t.orientation), t.id),
1782
1842
  overRuler: b(e.clientX, e.clientY)
1783
1843
  });
1784
1844
  }
@@ -1796,24 +1856,24 @@ var wt = [
1796
1856
  let t = g.value;
1797
1857
  t !== null && e.pointerId === t.pointerId && (g.value = null, S(e));
1798
1858
  }
1799
- return (e, t) => (K(), z("div", {
1859
+ return (e, t) => (q(), R("div", {
1800
1860
  ref_key: "rootRef",
1801
1861
  ref: v,
1802
1862
  class: "cn-guides",
1803
1863
  "data-guide-overlay": ""
1804
1864
  }, [
1805
- (K(!0), z(F, null, J(o.value, (e, t) => (K(), z("div", {
1865
+ (q(!0), R(P, null, se(o.value, (e, t) => (q(), R("div", {
1806
1866
  key: `${e.orientation}-${e.position}-${t}`,
1807
- class: U(["cn-guides__snap", `cn-guides__snap--${e.orientation}`]),
1867
+ class: H(["cn-guides__snap", `cn-guides__snap--${e.orientation}`]),
1808
1868
  "data-snap-line": "",
1809
1869
  "data-snap-orientation": e.orientation,
1810
1870
  "data-snap-position": l(e.position),
1811
1871
  "data-snap-source": e.source,
1812
- style: W(c(e.orientation, e.position))
1813
- }, null, 14, wt))), 128)),
1814
- (K(!0), z(F, null, J(_.value, (e) => (K(), z("div", {
1872
+ style: U(c(e.orientation, e.position))
1873
+ }, null, 14, Dt))), 128)),
1874
+ (q(!0), R(P, null, se(_.value, (e) => (q(), R("div", {
1815
1875
  key: e.id,
1816
- class: U(["cn-guides__guide", [`cn-guides__guide--${e.orientation}`, {
1876
+ class: H(["cn-guides__guide", [`cn-guides__guide--${e.orientation}`, {
1817
1877
  "cn-guides__guide--grabbed": e.dragging,
1818
1878
  "cn-guides__guide--will-delete": e.overRuler
1819
1879
  }]]),
@@ -1821,32 +1881,32 @@ var wt = [
1821
1881
  "data-guide-orientation": e.orientation,
1822
1882
  "data-guide-position": l(e.position),
1823
1883
  "data-guide-dragging": e.dragging ? "" : void 0,
1824
- style: W(c(e.orientation, e.position)),
1884
+ style: U(c(e.orientation, e.position)),
1825
1885
  onPointerdown: (t) => C(t, e),
1826
1886
  onPointermove: w,
1827
1887
  onPointerup: T,
1828
1888
  onPointercancel: E
1829
- }, null, 46, Tt))), 128)),
1830
- u.value ? (K(), z("div", {
1889
+ }, null, 46, Ot))), 128)),
1890
+ u.value ? (q(), R("div", {
1831
1891
  key: 0,
1832
- class: U(["cn-guides__guide cn-guides__guide--preview", `cn-guides__guide--${u.value.orientation}`]),
1892
+ class: H(["cn-guides__guide cn-guides__guide--preview", `cn-guides__guide--${u.value.orientation}`]),
1833
1893
  "data-guide-preview": "",
1834
1894
  "data-guide-orientation": u.value.orientation,
1835
1895
  "data-guide-position": l(u.value.position),
1836
- style: W(c(u.value.orientation, u.value.position))
1837
- }, null, 14, Et)) : R("", !0)
1896
+ style: U(c(u.value.orientation, u.value.position))
1897
+ }, null, 14, kt)) : L("", !0)
1838
1898
  ], 512));
1839
1899
  }
1840
- }), [["__scopeId", "data-v-61872121"]]), Ot = {
1900
+ }), [["__scopeId", "data-v-c6afe7d5"]]), jt = {
1841
1901
  class: "cn-ruler",
1842
1902
  "data-ruler": ""
1843
- }, kt = {
1903
+ }, Mt = {
1844
1904
  key: 0,
1845
1905
  class: "cn-ruler__label"
1846
- }, At = {
1906
+ }, Nt = {
1847
1907
  key: 0,
1848
1908
  class: "cn-ruler__label"
1849
- }, jt = 10, Mt = 5, Nt = /*#__PURE__*/ x(/* @__PURE__ */ H({
1909
+ }, Pt = 10, Ft = 5, It = /*#__PURE__*/ h(/* @__PURE__ */ V({
1850
1910
  __name: "Ruler",
1851
1911
  props: { editor: {} },
1852
1912
  emits: [
@@ -1856,10 +1916,10 @@ var wt = [
1856
1916
  "guide-drag-cancel"
1857
1917
  ],
1858
1918
  setup(e, { emit: t }) {
1859
- let n = e, r = t, i = P(n.editor), a = Y(n.editor.store.ui.rulersVisible), o = n.editor.subscribe((e) => {
1919
+ let n = e, r = t, i = N(n.editor), a = Y(n.editor.store.ui.rulersVisible), o = n.editor.subscribe((e) => {
1860
1920
  e.scope === "ui" && e.branch === "rulersVisible" && (a.value = n.editor.store.ui.rulersVisible);
1861
1921
  });
1862
- G(o, !0);
1922
+ K(o, !0);
1863
1923
  let s = [
1864
1924
  1,
1865
1925
  2,
@@ -1878,11 +1938,11 @@ var wt = [
1878
1938
  function c(e, t, n) {
1879
1939
  if (!(t > 0) || !(n > 0) || !Number.isFinite(e)) return [];
1880
1940
  let r = s[s.length - 1];
1881
- for (let e of s) if (e * n >= jt) {
1941
+ for (let e of s) if (e * n >= Pt) {
1882
1942
  r = e;
1883
1943
  break;
1884
1944
  }
1885
- let i = r * Mt, a = Math.floor(e / r) * r, o = [];
1945
+ let i = r * Ft, a = Math.floor(e / r) * r, o = [];
1886
1946
  for (let s = 0;; s++) {
1887
1947
  let c = a + s * r, l = (c - e) * n;
1888
1948
  if (l > t) break;
@@ -1897,13 +1957,13 @@ var wt = [
1897
1957
  }
1898
1958
  return o;
1899
1959
  }
1900
- let l = q(null), u = q(null), d = q(0), f = q(0), p = () => {
1960
+ let l = J(null), u = J(null), d = J(0), f = J(0), p = () => {
1901
1961
  d.value = l.value?.clientWidth ?? 0, f.value = u.value?.clientHeight ?? 0;
1902
1962
  }, m = null;
1903
- ie(() => {
1963
+ G(() => {
1904
1964
  p(), m = new ResizeObserver(() => p()), l.value && m.observe(l.value), u.value && m.observe(u.value);
1905
- }), re(() => m?.disconnect());
1906
- let h = I(() => c(i.value.x, d.value, i.value.zoom)), g = I(() => c(i.value.y, f.value, i.value.zoom)), _ = q(null);
1965
+ }), W(() => m?.disconnect());
1966
+ let h = F(() => c(i.value.x, d.value, i.value.zoom)), g = F(() => c(i.value.y, f.value, i.value.zoom)), _ = J(null);
1907
1967
  function v(e, t, n) {
1908
1968
  let r = e.getBoundingClientRect(), a = i.value;
1909
1969
  return {
@@ -1938,8 +1998,8 @@ var wt = [
1938
1998
  let a = v(n, i.orientation, e);
1939
1999
  r(t === "guide-drag-end" ? "guide-drag-end" : "guide-drag-cancel", a);
1940
2000
  }
1941
- return (e, t) => se((K(), z("div", Ot, [
1942
- B("div", {
2001
+ return (e, t) => de((q(), R("div", jt, [
2002
+ z("div", {
1943
2003
  ref_key: "topRef",
1944
2004
  ref: l,
1945
2005
  class: "cn-ruler__bar cn-ruler__bar--top",
@@ -1951,12 +2011,12 @@ var wt = [
1951
2011
  onPointermove: t[1] ||= (e) => b(e),
1952
2012
  onPointerup: t[2] ||= (e) => x(e, "guide-drag-end"),
1953
2013
  onPointercancel: t[3] ||= (e) => x(e, "guide-drag-cancel")
1954
- }, [(K(!0), z(F, null, J(h.value, (e) => (K(), z("span", {
2014
+ }, [(q(!0), R(P, null, se(h.value, (e) => (q(), R("span", {
1955
2015
  key: e.scene,
1956
- class: U(["cn-ruler__tick", { "cn-ruler__tick--major": e.label !== null }]),
1957
- style: W({ left: `${e.position}px` })
1958
- }, [e.label === null ? R("", !0) : (K(), z("span", kt, X(e.label), 1))], 6))), 128))], 544),
1959
- B("div", {
2016
+ class: H(["cn-ruler__tick", { "cn-ruler__tick--major": e.label !== null }]),
2017
+ style: U({ left: `${e.position}px` })
2018
+ }, [e.label === null ? L("", !0) : (q(), R("span", Mt, X(e.label), 1))], 6))), 128))], 544),
2019
+ z("div", {
1960
2020
  ref_key: "leftRef",
1961
2021
  ref: u,
1962
2022
  class: "cn-ruler__bar cn-ruler__bar--left",
@@ -1968,43 +2028,43 @@ var wt = [
1968
2028
  onPointermove: t[5] ||= (e) => b(e),
1969
2029
  onPointerup: t[6] ||= (e) => x(e, "guide-drag-end"),
1970
2030
  onPointercancel: t[7] ||= (e) => x(e, "guide-drag-cancel")
1971
- }, [(K(!0), z(F, null, J(g.value, (e) => (K(), z("span", {
2031
+ }, [(q(!0), R(P, null, se(g.value, (e) => (q(), R("span", {
1972
2032
  key: e.scene,
1973
- class: U(["cn-ruler__tick", { "cn-ruler__tick--major": e.label !== null }]),
1974
- style: W({ top: `${e.position}px` })
1975
- }, [e.label === null ? R("", !0) : (K(), z("span", At, X(e.label), 1))], 6))), 128))], 544),
1976
- t[8] ||= B("div", {
2033
+ class: H(["cn-ruler__tick", { "cn-ruler__tick--major": e.label !== null }]),
2034
+ style: U({ top: `${e.position}px` })
2035
+ }, [e.label === null ? L("", !0) : (q(), R("span", Nt, X(e.label), 1))], 6))), 128))], 544),
2036
+ t[8] ||= z("div", {
1977
2037
  class: "cn-ruler__corner",
1978
2038
  "data-ruler-corner": "",
1979
2039
  "aria-hidden": "true"
1980
2040
  }, null, -1)
1981
- ], 512)), [[oe, a.value]]);
2041
+ ], 512)), [[le, a.value]]);
1982
2042
  }
1983
- }), [["__scopeId", "data-v-5bd7248c"]]), Pt = "#2563eb", Ft = "rgba(37, 99, 235, 0.08)", It = [4, 3], Lt = 1, Rt = "rgba(11, 18, 32, 0.9)", zt = "#ffffff", Bt = 11, Vt = 6, Ht = 3, Ut = 3, Wt = 6;
1984
- function Gt(e, t, n) {
2043
+ }), [["__scopeId", "data-v-b1bf0f7b"]]), Lt = "#2563eb", Rt = "rgba(37, 99, 235, 0.08)", zt = [4, 3], Bt = 1, Vt = "rgba(11, 18, 32, 0.9)", Ht = "#ffffff", Ut = 11, Wt = 6, Gt = 3, Kt = 3, qt = 6;
2044
+ function Jt(e, t, n) {
1985
2045
  let r = t.store.ui.create;
1986
2046
  if (!r) return;
1987
2047
  let { x: i, y: a, width: o, height: s } = r.rect;
1988
2048
  if (o === 0 && s === 0) return;
1989
2049
  let c = n.viewport.zoom;
1990
- e.fillStyle = Ft, e.fillRect(i, a, o, s), e.strokeStyle = Pt, e.lineWidth = Lt / c, e.setLineDash(It.map((e) => e / c)), e.strokeRect(i, a, o, s), e.setLineDash([]);
1991
- let l = Bt / c, u = Vt / c, d = Ht / c;
2050
+ e.fillStyle = Rt, e.fillRect(i, a, o, s), e.strokeStyle = Lt, e.lineWidth = Bt / c, e.setLineDash(zt.map((e) => e / c)), e.strokeRect(i, a, o, s), e.setLineDash([]);
2051
+ let l = Ut / c, u = Wt / c, d = Gt / c;
1992
2052
  e.font = `${l}px system-ui, sans-serif`;
1993
- let f = `${Math.round(o)} × ${Math.round(s)}`, p = e.measureText(f).width + u * 2, m = l + d * 2, h = i + o + Wt / c, g = a + s + Wt / c;
1994
- e.fillStyle = Rt, e.beginPath(), e.roundRect(h, g, p, m, Ut / c), e.fill(), e.fillStyle = zt, e.textBaseline = "middle", e.fillText(f, h + u, g + m / 2);
2053
+ let f = `${Math.round(o)} × ${Math.round(s)}`, p = e.measureText(f).width + u * 2, m = l + d * 2, h = i + o + qt / c, g = a + s + qt / c;
2054
+ e.fillStyle = Vt, e.beginPath(), e.roundRect(h, g, p, m, Kt / c), e.fill(), e.fillStyle = Ht, e.textBaseline = "middle", e.fillText(f, h + u, g + m / 2);
1995
2055
  }
1996
2056
  //#endregion
1997
2057
  //#region src/canvas/findHighlight.ts
1998
- var Kt = {
2058
+ var Yt = {
1999
2059
  matchColor: "#f59e0b",
2000
2060
  currentColor: "#38bdf8",
2001
2061
  currentFill: "rgba(56, 189, 248, 0.12)",
2002
2062
  lineWidth: 2
2003
2063
  };
2004
- function qt(e, t, n, r) {
2064
+ function Xt(e, t, n, r) {
2005
2065
  if (!n.doc || !t.store.ui.find.open) return;
2006
2066
  let i = {
2007
- ...Kt,
2067
+ ...Yt,
2008
2068
  ...r
2009
2069
  }, a = t.listFindMatches();
2010
2070
  if (a.length === 0) return;
@@ -2018,57 +2078,57 @@ function qt(e, t, n, r) {
2018
2078
  }
2019
2079
  //#endregion
2020
2080
  //#region src/canvas/gizmo.ts
2021
- var Jt = {
2081
+ var Zt = {
2022
2082
  selectionColor: "#2563eb",
2023
2083
  hoverColor: "rgba(37, 99, 235, 0.55)",
2024
2084
  selectionWidth: 2,
2025
2085
  handleSize: 8,
2026
2086
  handleFill: "#ffffff"
2027
2087
  };
2028
- function Yt(e, t) {
2029
- return p(e, t)?.visible === !1;
2088
+ function Qt(e, t) {
2089
+ return d(e, t)?.visible === !1;
2030
2090
  }
2031
- function Xt(e, t, n, r) {
2091
+ function $t(e, t, n, r) {
2032
2092
  let i = {
2033
- ...Jt,
2093
+ ...Zt,
2034
2094
  ...r
2035
2095
  }, { selection: a, hovered: o } = t.store.ui, s = n.doc;
2036
2096
  if (s) {
2037
- if (o && !d(o, a) && !Yt(s, o) && !t.isLocked(o)) {
2097
+ if (o && !m(o, a) && !Qt(s, o) && !t.isLocked(o)) {
2038
2098
  let r = t.layerBoxAt(o);
2039
2099
  r && (e.strokeStyle = i.hoverColor, e.lineWidth = i.selectionWidth / 2 / n.viewport.zoom, e.strokeRect(r.x, r.y, r.width, r.height));
2040
2100
  }
2041
- if (a && !Yt(s, a)) {
2101
+ if (a && !Qt(s, a)) {
2042
2102
  let r = t.layerBoxAt(a);
2043
- r && (e.strokeStyle = i.selectionColor, e.lineWidth = i.selectionWidth / n.viewport.zoom, e.strokeRect(r.x, r.y, r.width, r.height), Zt(e, t, a, r, n.viewport.zoom, i));
2103
+ r && (e.strokeStyle = i.selectionColor, e.lineWidth = i.selectionWidth / n.viewport.zoom, e.strokeRect(r.x, r.y, r.width, r.height), en(e, t, a, r, n.viewport.zoom, i));
2044
2104
  }
2045
2105
  }
2046
2106
  }
2047
- function Zt(e, t, n, r, i, a) {
2107
+ function en(e, t, n, r, i, a) {
2048
2108
  let o = t.resizeHandlesAt(n);
2049
2109
  if (o.length === 0) return;
2050
2110
  let s = a.handleSize / i, c = s / 2;
2051
2111
  e.fillStyle = a.handleFill, e.strokeStyle = a.selectionColor, e.lineWidth = a.selectionWidth / i;
2052
2112
  for (let t of o) {
2053
- let n = we(r, t);
2113
+ let n = Oe(r, t);
2054
2114
  e.fillRect(n.x - c, n.y - c, s, s), e.strokeRect(n.x - c, n.y - c, s, s);
2055
2115
  }
2056
2116
  }
2057
- function Qt(e, t, n) {
2117
+ function tn(e, t, n) {
2058
2118
  return (r) => {
2059
2119
  if (!t) return;
2060
2120
  t.setTransform(1, 0, 0, 1, 0, 0), t.clearRect(0, 0, t.canvas.width, t.canvas.height);
2061
2121
  let i = r.dpr * r.viewport.zoom;
2062
- t.setTransform(i, 0, 0, i, -r.viewport.x * i, -r.viewport.y * i), Xt(t, e, r, n);
2122
+ t.setTransform(i, 0, 0, i, -r.viewport.x * i, -r.viewport.y * i), $t(t, e, r, n);
2063
2123
  };
2064
2124
  }
2065
2125
  //#endregion
2066
2126
  //#region src/canvas/scheduler.ts
2067
- function $t() {
2127
+ function nn() {
2068
2128
  return (e) => {
2069
2129
  let t = window.requestAnimationFrame(() => e());
2070
2130
  return () => window.cancelAnimationFrame(t);
2071
2131
  };
2072
2132
  }
2073
2133
  //#endregion
2074
- export { Ne as _, Gt as a, St as c, mt as d, pt as f, ze as g, Be as h, qt as i, yt as l, Ye as m, Qt as n, Nt as o, ft as p, Xt as r, Dt as s, $t as t, _t as u };
2134
+ export { Le as _, Jt as a, Tt as c, _t as d, gt as f, Ue as g, We as h, Xt as i, St as l, $e as m, tn as n, It as o, ht as p, $t as r, At as s, nn as t, bt as u };