@hankchen/canvas-editor-vue 0.7.0 → 0.8.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.
@@ -169,6 +169,38 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
169
169
  }
170
170
  ]
171
171
  }, Ee = {
172
+ title: "文本",
173
+ fields: [
174
+ {
175
+ key: ["text"],
176
+ label: "内容",
177
+ control: "textarea",
178
+ data: !0
179
+ },
180
+ {
181
+ key: ["font"],
182
+ label: "字体",
183
+ control: "font"
184
+ },
185
+ {
186
+ key: ["fontSize"],
187
+ label: "字号",
188
+ control: "number",
189
+ integer: !0,
190
+ min: 1
191
+ },
192
+ {
193
+ key: ["fontColor"],
194
+ label: "字色",
195
+ control: "color"
196
+ },
197
+ {
198
+ key: ["autowrap"],
199
+ label: "自动换行",
200
+ control: "boolean"
201
+ }
202
+ ]
203
+ }, De = "cover", Oe = "contain", ke = {
172
204
  ImageLayer: [
173
205
  H,
174
206
  U,
@@ -181,6 +213,15 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
181
213
  control: "imageSrc",
182
214
  data: !0,
183
215
  resource: !0
216
+ }, {
217
+ key: ["fit"],
218
+ label: "适配",
219
+ control: "select",
220
+ domain: [De, Oe],
221
+ optionLabels: {
222
+ [De]: "铺满裁切",
223
+ [Oe]: "完整显示"
224
+ }
184
225
  }]
185
226
  }
186
227
  ],
@@ -188,39 +229,7 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
188
229
  H,
189
230
  U,
190
231
  W,
191
- {
192
- title: "文本",
193
- fields: [
194
- {
195
- key: ["text"],
196
- label: "内容",
197
- control: "textarea",
198
- data: !0
199
- },
200
- {
201
- key: ["font"],
202
- label: "字体",
203
- control: "font"
204
- },
205
- {
206
- key: ["fontSize"],
207
- label: "字号",
208
- control: "number",
209
- integer: !0,
210
- min: 1
211
- },
212
- {
213
- key: ["fontColor"],
214
- label: "字色",
215
- control: "color"
216
- },
217
- {
218
- key: ["autowrap"],
219
- label: "自动换行",
220
- control: "boolean"
221
- }
222
- ]
223
- }
232
+ Ee
224
233
  ],
225
234
  QrCodeLayer: [
226
235
  H,
@@ -276,15 +285,15 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
276
285
  }]
277
286
  }]
278
287
  };
279
- function De(e) {
280
- return Ee[e] ?? [];
288
+ function Ae(e) {
289
+ return ke[e] ?? [];
281
290
  }
282
- function Oe(e) {
291
+ function je(e) {
283
292
  if (e[e.length - 1] === "content") return h(e) ? "templateContent" : "content";
284
293
  let t = e[e.length - 2];
285
294
  return t === "rows" ? "row" : t === "cells" ? "cell" : "root";
286
295
  }
287
- var ke = {
296
+ var Me = {
288
297
  root: [],
289
298
  cell: [],
290
299
  row: ["shape.width", "shape.autoWidth"],
@@ -299,9 +308,9 @@ var ke = {
299
308
  function G(e, t) {
300
309
  return [...e.key, ...t.key];
301
310
  }
302
- function Ae(e, t) {
303
- let n = new Set(ke[Oe(e)]), r = [];
304
- for (let e of De(t.type)) {
311
+ function K(e, t) {
312
+ let n = new Set(Me[je(e)]), r = [];
313
+ for (let e of Ae(t.type)) {
305
314
  let i = [];
306
315
  for (let r of e.fields) {
307
316
  if (r.items) {
@@ -321,7 +330,7 @@ function Ae(e, t) {
321
330
  }
322
331
  return r;
323
332
  }
324
- var je = [{
333
+ var Ne = [{
325
334
  title: "画布",
326
335
  fields: [{
327
336
  key: ["width"],
@@ -349,16 +358,22 @@ var je = [{
349
358
  control: "imageSrc"
350
359
  }]
351
360
  }];
352
- function Me(e) {
361
+ function Pe(e) {
353
362
  return e === null ? null : e.background === null ? {
354
363
  ...e,
355
- background: K
364
+ background: Fe
356
365
  } : e;
357
366
  }
358
- var K = {
367
+ var Fe = {
359
368
  color: null,
360
369
  image: null
361
370
  };
371
+ function Ie(e) {
372
+ return e.type === "ImageLayer" && e.fit === void 0 ? {
373
+ ...e,
374
+ fit: "cover"
375
+ } : e;
376
+ }
362
377
  function q(e, t) {
363
378
  let n = e;
364
379
  for (let e = 0; e < t.length; e += 1) {
@@ -372,14 +387,14 @@ function q(e, t) {
372
387
  }
373
388
  //#endregion
374
389
  //#region src/property-panel/fields/AlignField.vue?vue&type=script&setup=true&lang.ts
375
- var Ne = ["aria-label"], Pe = [
390
+ var Le = ["aria-label"], Re = [
376
391
  "aria-pressed",
377
392
  "title",
378
393
  "onClick"
379
- ], Fe = {
394
+ ], ze = {
380
395
  key: 1,
381
396
  class: "truncate px-1 text-[10px] leading-none"
382
- }, Ie = /* @__PURE__ */ j({
397
+ }, Be = /* @__PURE__ */ j({
383
398
  __name: "AlignField",
384
399
  props: {
385
400
  field: {},
@@ -441,28 +456,28 @@ var Ne = ["aria-label"], Pe = [
441
456
  }, [t.icon ? (P(), E(g, {
442
457
  key: 0,
443
458
  icon: t.icon
444
- }, null, 8, ["icon"])) : (P(), O("span", Fe, R(t.value), 1))], 10, Pe))), 128))], 8, Ne));
459
+ }, null, 8, ["icon"])) : (P(), O("span", ze, R(t.value), 1))], 10, Re))), 128))], 8, Le));
445
460
  }
446
- }), Le = { class: "block" }, Re = ["aria-expanded", "title"], ze = { class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted" }, Be = { class: "flex shrink-0 items-center gap-1.5" }, Ve = {
461
+ }), Ve = { class: "block" }, He = ["aria-expanded", "title"], Ue = { class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted" }, We = { class: "flex shrink-0 items-center gap-1.5" }, Ge = {
447
462
  viewBox: "0 0 24 24",
448
463
  class: "size-3.5",
449
464
  "aria-hidden": "true"
450
- }, He = [
465
+ }, Ke = [
451
466
  "cx",
452
467
  "cy",
453
468
  "r"
454
- ], Ue = {
469
+ ], qe = {
455
470
  key: 0,
456
471
  class: "mt-2 flex justify-end"
457
- }, We = {
472
+ }, Je = {
458
473
  class: "cn-anchor grid w-[66px] shrink-0 grid-cols-3 gap-[3px]",
459
474
  role: "group",
460
475
  "aria-label": "九宫锚点"
461
- }, Ge = [
476
+ }, Ye = [
462
477
  "aria-pressed",
463
478
  "title",
464
479
  "onClick"
465
- ], Ke = /* @__PURE__ */ j({
480
+ ], Xe = /* @__PURE__ */ j({
466
481
  __name: "AnchorDisclosureField",
467
482
  props: {
468
483
  field: {},
@@ -482,31 +497,31 @@ var Ne = ["aria-label"], Pe = [
482
497
  function s(e) {
483
498
  r("change", e);
484
499
  }
485
- return (t, n) => (P(), O("span", Le, [k("button", {
500
+ return (t, n) => (P(), O("span", Ve, [k("button", {
486
501
  type: "button",
487
502
  class: "cn-anchor-disclosure__header flex w-full items-center justify-between gap-2",
488
503
  "aria-expanded": e.expanded,
489
504
  title: e.expanded ? "收起锚点" : `锚点:${e.modelValue}(点击展开调整)`,
490
505
  onClick: n[0] ||= (e) => r("toggle")
491
- }, [k("span", ze, R(e.field.label), 1), k("span", Be, [(P(), O("svg", Ve, [(P(!0), O(w, null, I(z(a), (e) => (P(), O("circle", {
506
+ }, [k("span", Ue, R(e.field.label), 1), k("span", We, [(P(), O("svg", Ge, [(P(!0), O(w, null, I(z(a), (e) => (P(), O("circle", {
492
507
  key: e.index,
493
508
  cx: e.cx,
494
509
  cy: e.cy,
495
510
  r: e.index === o.value ? 3.2 : 2.2,
496
511
  class: N(e.index === o.value ? "fill-cn-accent" : "fill-cn-muted/35")
497
- }, null, 10, He))), 128))])), A(g, {
512
+ }, null, 10, Ke))), 128))])), A(g, {
498
513
  icon: z(u),
499
514
  class: N(["text-cn-muted transition-transform duration-150", { "rotate-180": e.expanded }])
500
- }, null, 8, ["icon", "class"])])], 8, Re), e.expanded ? (P(), O("span", Ue, [k("span", We, [(P(!0), O(w, null, I(z(i), (t) => (P(), O("button", {
515
+ }, null, 8, ["icon", "class"])])], 8, He), e.expanded ? (P(), O("span", qe, [k("span", Je, [(P(!0), O(w, null, I(z(i), (t) => (P(), O("button", {
501
516
  key: t,
502
517
  type: "button",
503
518
  class: N(["cn-anchor__cell relative aspect-square min-w-0 rounded-[4px] border p-0 transition-colors duration-100", t === e.modelValue ? "cn-anchor__cell--active border-cn-accent bg-cn-accent shadow-[0_0_8px_rgba(56,189,248,0.35)]" : "border-cn-field-line bg-cn-field hover:border-cn-muted/50"]),
504
519
  "aria-pressed": t === e.modelValue,
505
520
  title: t,
506
521
  onClick: (e) => s(t)
507
- }, null, 10, Ge))), 128))])])) : D("", !0)]));
522
+ }, null, 10, Ye))), 128))])])) : D("", !0)]));
508
523
  }
509
- }), qe = { class: "cn-bool relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center" }, Je = ["checked"], Ye = /* @__PURE__ */ j({
524
+ }), Ze = { class: "cn-bool relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center" }, Qe = ["checked"], $e = /* @__PURE__ */ j({
510
525
  __name: "BooleanField",
511
526
  props: {
512
527
  field: {},
@@ -520,7 +535,7 @@ var Ne = ["aria-label"], Pe = [
520
535
  }
521
536
  return ve(() => {
522
537
  i.value && (i.value.checked = n.modelValue);
523
- }), (t, n) => (P(), O("label", qe, [
538
+ }), (t, n) => (P(), O("label", Ze, [
524
539
  k("input", {
525
540
  ref_key: "inputRef",
526
541
  ref: i,
@@ -528,12 +543,12 @@ var Ne = ["aria-label"], Pe = [
528
543
  type: "checkbox",
529
544
  checked: e.modelValue,
530
545
  onChange: a
531
- }, null, 40, Je),
546
+ }, null, 40, Qe),
532
547
  n[0] ||= k("span", { class: "absolute inset-0 rounded-full border border-cn-field-line bg-cn-field transition-colors duration-150 peer-checked:border-cn-accent/60 peer-checked:bg-cn-accent/30 peer-focus-visible:ring-[3px] peer-focus-visible:ring-cn-accent/20" }, null, -1),
533
548
  n[1] ||= k("span", { class: "relative mx-0.5 size-3 rounded-full bg-cn-muted shadow-sm transition-transform duration-150 peer-checked:translate-x-3 peer-checked:bg-cn-accent" }, null, -1)
534
549
  ]));
535
550
  }
536
- }), Xe = {
551
+ }), et = {
537
552
  1: [{
538
553
  label: "四边",
539
554
  rep: "top",
@@ -576,13 +591,13 @@ var Ne = ["aria-label"], Pe = [
576
591
  }
577
592
  ]
578
593
  };
579
- function Ze(e) {
594
+ function tt(e) {
580
595
  return e === 1 ? 2 : e === 2 ? 4 : 1;
581
596
  }
582
- function Qe(e) {
597
+ function nt(e) {
583
598
  return e.top === e.bottom && e.bottom === e.left && e.left === e.right ? 1 : e.top === e.bottom && e.left === e.right ? 2 : 4;
584
599
  }
585
- function $e(e, t) {
600
+ function rt(e, t) {
586
601
  if (t === 1) {
587
602
  let { top: t } = e;
588
603
  return {
@@ -603,17 +618,17 @@ function $e(e, t) {
603
618
  }
604
619
  return e;
605
620
  }
606
- function et(e, t) {
621
+ function it(e, t) {
607
622
  return e.top === t.top && e.bottom === t.bottom && e.left === t.left && e.right === t.right;
608
623
  }
609
624
  function J(e, t) {
610
625
  return e === null || t === null ? e === t : e.width === t.width && e.color === t.color;
611
626
  }
612
- function tt(e) {
627
+ function at(e) {
613
628
  let { top: t, bottom: n, left: r, right: i } = e;
614
629
  return t === null && n === null && r === null && i === null || t !== null && J(t, n) && J(t, r) && J(t, i) ? 1 : J(t, n) && J(r, i) ? 2 : 4;
615
630
  }
616
- function nt(e, t) {
631
+ function ot(e, t) {
617
632
  let n = (e) => e === null ? null : { ...e };
618
633
  if (t === 1) {
619
634
  let t = n(e.top);
@@ -635,18 +650,18 @@ function nt(e, t) {
635
650
  }
636
651
  return e;
637
652
  }
638
- function rt(e, t) {
653
+ function st(e, t) {
639
654
  return J(e.top, t.top) && J(e.bottom, t.bottom) && J(e.left, t.left) && J(e.right, t.right);
640
655
  }
641
656
  //#endregion
642
657
  //#region src/property-panel/useShorthandMode.ts
643
- function it(e, t) {
658
+ function ct(e, t) {
644
659
  let n = T(() => t(e())), r = F(null), i = T(() => r.value ?? n.value);
645
660
  B(e, () => {
646
661
  r.value = null;
647
662
  });
648
663
  function a() {
649
- let e = i.value, t = Ze(e);
664
+ let e = i.value, t = tt(e);
650
665
  return r.value = t, {
651
666
  from: e,
652
667
  to: t
@@ -659,7 +674,7 @@ function it(e, t) {
659
674
  }
660
675
  //#endregion
661
676
  //#region src/property-panel/controlStyles.ts
662
- var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-field text-[11.5px] leading-none text-cn-fg outline-none transition-[border-color,box-shadow,background-color] duration-100 placeholder:text-cn-muted/60 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-cn-field-line", X = `${Y} text-right font-mono tabular-nums`, at = Y, ot = "w-full flex-1 min-w-0 resize-y rounded-md border border-cn-field-line bg-cn-field px-2 py-1.5 text-[11.5px] leading-5 text-cn-fg outline-none transition-[border-color,box-shadow] duration-100 placeholder:text-cn-muted/60 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40", st = "size-7 shrink-0 cursor-pointer self-center rounded-md border border-cn-field-line bg-cn-field p-0.5 transition-colors hover:border-cn-muted/40 disabled:cursor-not-allowed disabled:opacity-40", ct = ["aria-label"], lt = /* @__PURE__ */ j({
677
+ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-field text-[11.5px] leading-none text-cn-fg outline-none transition-[border-color,box-shadow,background-color] duration-100 placeholder:text-cn-muted/60 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-cn-field-line", X = `${Y} text-right font-mono tabular-nums`, lt = Y, ut = "w-full flex-1 min-w-0 resize-y rounded-md border border-cn-field-line bg-cn-field px-2 py-1.5 text-[11.5px] leading-5 text-cn-fg outline-none transition-[border-color,box-shadow] duration-100 placeholder:text-cn-muted/60 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40", dt = "size-7 shrink-0 cursor-pointer self-center rounded-md border border-cn-field-line bg-cn-field p-0.5 transition-colors hover:border-cn-muted/40 disabled:cursor-not-allowed disabled:opacity-40", ft = ["aria-label"], pt = /* @__PURE__ */ j({
663
678
  __name: "BorderWidthInput",
664
679
  props: {
665
680
  value: {},
@@ -710,9 +725,9 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
710
725
  onFocus: n[1] ||= (e) => a.value = !0,
711
726
  onBlur: u,
712
727
  onChange: u
713
- }, null, 42, ct)), [[_e, i.value]]);
728
+ }, null, 42, ft)), [[_e, i.value]]);
714
729
  }
715
- }), ut = ["aria-label", "title"], dt = /* @__PURE__ */ j({
730
+ }), mt = ["aria-label", "title"], ht = /* @__PURE__ */ j({
716
731
  __name: "ShorthandModeButton",
717
732
  props: {
718
733
  mode: {},
@@ -743,14 +758,14 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
743
758
  }, [A(g, {
744
759
  icon: a.value.icon,
745
760
  size: 12
746
- }, null, 8, ["icon"])], 8, ut));
761
+ }, null, 8, ["icon"])], 8, mt));
747
762
  }
748
- }), ft = { class: "cn-border flex w-full min-w-0 items-center gap-1" }, pt = { class: "grid min-w-0 flex-1 gap-1 grid-cols-1" }, mt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, ht = [
763
+ }), gt = { class: "cn-border flex w-full min-w-0 items-center gap-1" }, _t = { class: "grid min-w-0 flex-1 gap-1 grid-cols-1" }, vt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, yt = [
749
764
  "value",
750
765
  "disabled",
751
766
  "onInput",
752
767
  "onChange"
753
- ], gt = "#000000", _t = /* @__PURE__ */ j({
768
+ ], bt = "#000000", xt = /* @__PURE__ */ j({
754
769
  __name: "BorderField",
755
770
  props: {
756
771
  field: {},
@@ -758,12 +773,12 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
758
773
  },
759
774
  emits: ["input", "change"],
760
775
  setup(e, { emit: t }) {
761
- let n = e, r = t, { mode: i, cycle: a } = it(() => n.modelValue, tt), o = T(() => Xe[i.value]);
776
+ let n = e, r = t, { mode: i, cycle: a } = ct(() => n.modelValue, at), o = T(() => et[i.value]);
762
777
  function s(e) {
763
778
  return n.modelValue[e.rep]?.width ?? null;
764
779
  }
765
780
  function c(e) {
766
- return n.modelValue[e.rep]?.color ?? gt;
781
+ return n.modelValue[e.rep]?.color ?? bt;
767
782
  }
768
783
  function l(e, t, i) {
769
784
  let a = { ...n.modelValue };
@@ -771,7 +786,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
771
786
  r(i ? "change" : "input", a);
772
787
  }
773
788
  function u(e, t, r) {
774
- let i = n.modelValue[e.rep]?.color ?? gt;
789
+ let i = n.modelValue[e.rep]?.color ?? bt;
775
790
  l(e, t <= 0 ? null : {
776
791
  width: t,
777
792
  color: i
@@ -789,20 +804,20 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
789
804
  function f() {
790
805
  let { from: e, to: t } = a();
791
806
  if (t < e) {
792
- let e = nt(n.modelValue, t);
793
- rt(e, n.modelValue) || r("change", e);
807
+ let e = ot(n.modelValue, t);
808
+ st(e, n.modelValue) || r("change", e);
794
809
  }
795
810
  }
796
- return (t, n) => (P(), O("span", ft, [A(dt, {
811
+ return (t, n) => (P(), O("span", gt, [A(ht, {
797
812
  mode: z(i),
798
813
  label: "边框",
799
814
  onCycle: f
800
- }, null, 8, ["mode"]), k("span", pt, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
815
+ }, null, 8, ["mode"]), k("span", _t, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
801
816
  key: t.rep,
802
817
  class: "flex items-center gap-1.5"
803
818
  }, [
804
- k("span", mt, R(t.label), 1),
805
- A(lt, {
819
+ k("span", vt, R(t.label), 1),
820
+ A(pt, {
806
821
  class: "cn-border__width",
807
822
  value: s(t),
808
823
  label: t.label,
@@ -822,17 +837,17 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
822
837
  disabled: e.modelValue[t.rep] === null,
823
838
  onInput: (e) => d(t, e, !1),
824
839
  onChange: (e) => d(t, e, !0)
825
- }, null, 40, ht)
840
+ }, null, 40, yt)
826
841
  ]))), 128))])]));
827
842
  }
828
- }), vt = ["value"], yt = {
843
+ }), St = ["value"], Ct = {
829
844
  key: 1,
830
845
  class: "flex flex-1 items-center gap-1.5"
831
- }, bt = ["value"], xt = ["value"], St = [
846
+ }, wt = ["value"], Tt = ["value"], Et = [
832
847
  "disabled",
833
848
  "title",
834
849
  "data-upload-error"
835
- ], Ct = /* @__PURE__ */ j({
850
+ ], Dt = /* @__PURE__ */ j({
836
851
  __name: "FontField",
837
852
  props: {
838
853
  field: {},
@@ -895,14 +910,14 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
895
910
  }
896
911
  return (t, n) => z(i) === null ? (P(), O("input", {
897
912
  key: 0,
898
- class: N(["cn-field", z(at)]),
913
+ class: N(["cn-field", z(lt)]),
899
914
  type: "text",
900
915
  value: e.modelValue,
901
916
  onInput: l,
902
917
  onCompositionstart: u,
903
918
  onCompositionend: d,
904
919
  onChange: f
905
- }, null, 42, vt)) : (P(), O("div", yt, [
920
+ }, null, 42, St)) : (P(), O("div", Ct, [
906
921
  k("select", {
907
922
  class: N(["cn-field cn-select", z(Y)]),
908
923
  value: e.modelValue,
@@ -910,7 +925,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
910
925
  }, [(P(!0), O(w, null, I(a.value, (e) => (P(), O("option", {
911
926
  key: e.value,
912
927
  value: e.value
913
- }, R(e.label), 9, xt))), 128))], 42, bt),
928
+ }, R(e.label), 9, Tt))), 128))], 42, wt),
914
929
  k("input", {
915
930
  ref_key: "fileInput",
916
931
  ref: h,
@@ -927,10 +942,10 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
927
942
  title: m.value ?? "上传本机字体(加入清单后可选)",
928
943
  "data-upload-error": m.value ?? void 0,
929
944
  onClick: g
930
- }, R(p.value ? "…" : m.value ? "!" : "上传"), 9, St)) : D("", !0)
945
+ }, R(p.value ? "…" : m.value ? "!" : "上传"), 9, Et)) : D("", !0)
931
946
  ]));
932
947
  }
933
- }), wt = { class: "cn-color flex min-w-0 flex-1 items-center gap-1.5" }, Tt = ["checked"], Et = ["value", "disabled"], Dt = ["value", "disabled"], Ot = "#000000", kt = /* @__PURE__ */ j({
948
+ }), Ot = { class: "cn-color flex min-w-0 flex-1 items-center gap-1.5" }, kt = ["checked"], At = ["value", "disabled"], jt = ["value", "disabled"], Mt = "#000000", Nt = /* @__PURE__ */ j({
934
949
  __name: "ColorField",
935
950
  props: {
936
951
  field: {},
@@ -943,7 +958,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
943
958
  i.value = e !== null, i.value && (a.value = o(e));
944
959
  });
945
960
  function o(e) {
946
- return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e : Ot;
961
+ return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e : Mt;
947
962
  }
948
963
  function s(e) {
949
964
  let t = e.target.checked;
@@ -970,7 +985,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
970
985
  }
971
986
  a.value = o(t), r("change", t);
972
987
  }
973
- return (t, n) => (P(), O("span", wt, [
988
+ return (t, n) => (P(), O("span", Ot, [
974
989
  e.field.nullable ? (P(), O("input", {
975
990
  key: 0,
976
991
  class: "cn-color__toggle size-3.5 shrink-0 cursor-pointer accent-cn-accent",
@@ -978,15 +993,15 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
978
993
  title: "启用颜色",
979
994
  checked: i.value,
980
995
  onChange: s
981
- }, null, 40, Tt)) : D("", !0),
996
+ }, null, 40, kt)) : D("", !0),
982
997
  k("input", {
983
- class: N(["cn-color__swatch", z(st)]),
998
+ class: N(["cn-color__swatch", z(dt)]),
984
999
  type: "color",
985
1000
  value: a.value,
986
1001
  disabled: !i.value,
987
1002
  onInput: c,
988
1003
  onChange: l
989
- }, null, 42, Et),
1004
+ }, null, 42, At),
990
1005
  k("input", {
991
1006
  class: N(["cn-color__text min-w-0 flex-1", z(Y)]),
992
1007
  type: "text",
@@ -994,16 +1009,27 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
994
1009
  disabled: !i.value,
995
1010
  placeholder: "无",
996
1011
  onChange: u
997
- }, null, 42, Dt)
1012
+ }, null, 42, jt)
998
1013
  ]));
999
1014
  }
1000
1015
  }), Z = Symbol("canvas-image-upload");
1001
- function At() {
1016
+ function Pt() {
1002
1017
  return fe(Z, null);
1003
1018
  }
1004
1019
  //#endregion
1020
+ //#region src/property-panel/fields/intrinsicSize.ts
1021
+ function Ft(e, t) {
1022
+ let n = e, r = t;
1023
+ for (; r !== 0;) [n, r] = [r, n % r];
1024
+ let i = e / n, a = t / n;
1025
+ return Math.max(i, a) <= 32 ? `${i}:${a}` : `${Math.round(e / t * 100) / 100}:1`;
1026
+ }
1027
+ function It(e, t) {
1028
+ return !Number.isFinite(e) || !Number.isFinite(t) || e <= 0 || t <= 0 ? null : `${e}×${t} · ${Ft(e, t)}`;
1029
+ }
1030
+ //#endregion
1005
1031
  //#region src/property-panel/fields/TextField.vue?vue&type=script&setup=true&lang.ts
1006
- var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1032
+ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1007
1033
  __name: "TextField",
1008
1034
  props: {
1009
1035
  field: {},
@@ -1033,7 +1059,7 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1033
1059
  o(t) || r("change", t);
1034
1060
  }
1035
1061
  return (t, n) => (P(), O("input", {
1036
- class: N(["cn-field", [z(at), a.value ? "cn-field--invalid" : ""]]),
1062
+ class: N(["cn-field", [z(lt), a.value ? "cn-field--invalid" : ""]]),
1037
1063
  type: "text",
1038
1064
  value: e.modelValue,
1039
1065
  placeholder: e.field.placeholder,
@@ -1041,9 +1067,9 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1041
1067
  onCompositionstart: c,
1042
1068
  onCompositionend: l,
1043
1069
  onChange: u
1044
- }, null, 42, jt));
1070
+ }, null, 42, Lt));
1045
1071
  }
1046
- }), Mt = /* @__PURE__ */ j({
1072
+ }), Rt = /* @__PURE__ */ j({
1047
1073
  __name: "ResourceValueField",
1048
1074
  props: {
1049
1075
  field: {},
@@ -1090,17 +1116,20 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1090
1116
  "disabled"
1091
1117
  ]));
1092
1118
  }
1093
- }), Nt = {
1119
+ }), zt = {
1094
1120
  key: 0,
1095
1121
  class: "flex flex-col gap-1.5"
1096
- }, Pt = [
1122
+ }, Bt = [
1097
1123
  "disabled",
1098
1124
  "title",
1099
1125
  "data-upload-error"
1100
- ], Ft = ["src"], It = {
1126
+ ], Vt = ["src"], Ht = {
1101
1127
  key: 2,
1102
1128
  class: "relative"
1103
- }, Lt = { class: "flex items-center gap-1.5" }, Rt = /* @__PURE__ */ j({
1129
+ }, Ut = { class: "flex items-center gap-1.5" }, Wt = {
1130
+ key: 0,
1131
+ class: "cn-imagesrc__intrinsic text-[11px] leading-4 text-cn-muted"
1132
+ }, Gt = /* @__PURE__ */ j({
1104
1133
  __name: "ImageSrcField",
1105
1134
  props: {
1106
1135
  field: {},
@@ -1112,11 +1141,21 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1112
1141
  },
1113
1142
  emits: ["input", "change"],
1114
1143
  setup(e, { emit: t }) {
1115
- let n = e, r = t, i = At(), a = T(() => i !== null && i.canUpload && n.dataMode !== "expression"), o = T(() => typeof n.modelValue == "string" && n.modelValue !== ""), s = T(() => n.resourceStatus === "pending" ? "装载中" : n.resourceStatus === "failed" ? "失败" : null), c = F(!1), l = F(null), u = F(null);
1116
- function d() {
1144
+ let n = e, r = t, i = Pt(), a = T(() => i !== null && i.canUpload && n.dataMode !== "expression"), o = T(() => typeof n.modelValue == "string" && n.modelValue !== ""), s = T(() => n.resourceStatus === "pending" ? "装载中" : n.resourceStatus === "failed" ? "失败" : null), c = F(!1), l = F(null), u = F(null), d = F(null), f = T(() => d.value === null ? null : It(d.value.width, d.value.height));
1145
+ function p(e) {
1146
+ let t = e.target;
1147
+ d.value = t.naturalWidth > 0 && t.naturalHeight > 0 ? {
1148
+ width: t.naturalWidth,
1149
+ height: t.naturalHeight
1150
+ } : null;
1151
+ }
1152
+ B(() => n.modelValue, () => {
1153
+ d.value = null;
1154
+ });
1155
+ function m() {
1117
1156
  l.value = null, u.value?.click();
1118
1157
  }
1119
- async function f(e) {
1158
+ async function h(e) {
1120
1159
  let t = e.target, n = t.files?.[0];
1121
1160
  if (t.value = "", i !== null && n && !c.value) {
1122
1161
  c.value = !0;
@@ -1130,42 +1169,44 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1130
1169
  }
1131
1170
  }
1132
1171
  }
1133
- return (t, n) => a.value ? (P(), O("div", Nt, [
1172
+ return (t, n) => a.value ? (P(), O("div", zt, [
1134
1173
  k("button", {
1135
1174
  type: "button",
1136
1175
  class: "cn-imagesrc__thumb relative flex h-16 w-full items-center justify-center overflow-hidden rounded-md border border-dashed border-cn-field-line bg-cn-field/40 text-[11px] leading-none text-cn-muted transition-colors duration-100 hover:border-cn-muted/40 disabled:cursor-not-allowed disabled:opacity-40",
1137
1176
  disabled: c.value,
1138
1177
  title: l.value ?? (o.value ? "点击替换图片" : "点击上传图片"),
1139
1178
  "data-upload-error": l.value ?? void 0,
1140
- onClick: d
1179
+ onClick: m
1141
1180
  }, [
1142
1181
  o.value ? (P(), O("img", {
1143
1182
  key: 0,
1144
1183
  src: e.modelValue ?? void 0,
1145
1184
  class: "absolute inset-0 size-full object-cover",
1146
- alt: ""
1147
- }, null, 8, Ft)) : D("", !0),
1185
+ alt: "",
1186
+ onLoad: p,
1187
+ onError: n[0] ||= (e) => d.value = null
1188
+ }, null, 40, Vt)) : D("", !0),
1148
1189
  s.value ? (P(), O("span", {
1149
1190
  key: 1,
1150
1191
  class: N(["cn-imagesrc__status absolute right-1 top-1 rounded bg-cn-bg-elevated/90 px-1 py-0.5 text-[10px] leading-none", e.resourceStatus === "failed" ? "text-red-400" : "text-cn-muted"])
1151
1192
  }, R(s.value), 3)) : D("", !0),
1152
- o.value ? D("", !0) : (P(), O("span", It, R(c.value ? "…" : l.value ? "!" : "点击上传图片"), 1))
1153
- ], 8, Pt),
1193
+ o.value ? D("", !0) : (P(), O("span", Ht, R(c.value ? "…" : l.value ? "!" : "点击上传图片"), 1))
1194
+ ], 8, Bt),
1154
1195
  k("input", {
1155
1196
  ref_key: "fileInput",
1156
1197
  ref: u,
1157
1198
  type: "file",
1158
1199
  class: "hidden",
1159
1200
  accept: "image/*",
1160
- onChange: f
1201
+ onChange: h
1161
1202
  }, null, 544),
1162
- k("div", Lt, [A(Q, {
1203
+ k("div", Ut, [A(Q, {
1163
1204
  class: "flex-1",
1164
1205
  field: e.field,
1165
1206
  "model-value": e.modelValue ?? "",
1166
1207
  "aria-label": e.field.label,
1167
- onInput: n[0] ||= (e) => r("input", e),
1168
- onChange: n[1] ||= (e) => r("change", e)
1208
+ onInput: n[1] ||= (e) => r("input", e),
1209
+ onChange: n[2] ||= (e) => r("change", e)
1169
1210
  }, null, 8, [
1170
1211
  "field",
1171
1212
  "model-value",
@@ -1175,17 +1216,18 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1175
1216
  type: "button",
1176
1217
  class: "cn-imagesrc__clear h-7 shrink-0 rounded-md border border-cn-field-line bg-cn-field px-2 text-[11px] leading-none text-cn-fg transition-colors duration-100 hover:border-cn-muted/40",
1177
1218
  title: "清除图片(资源地址置空)",
1178
- onClick: n[2] ||= (e) => r("change", "")
1179
- }, "清除")) : D("", !0)])
1180
- ])) : e.dataMode === "expression" ? (P(), E(Mt, {
1219
+ onClick: n[3] ||= (e) => r("change", "")
1220
+ }, "清除")) : D("", !0)]),
1221
+ f.value ? (P(), O("span", Wt, "源图 " + R(f.value), 1)) : D("", !0)
1222
+ ])) : e.dataMode === "expression" ? (P(), E(Rt, {
1181
1223
  key: 1,
1182
1224
  field: e.field,
1183
1225
  "model-value": e.modelValue,
1184
1226
  "data-mode": "expression",
1185
1227
  source: e.source ?? null,
1186
1228
  disabled: e.disabled,
1187
- onInput: n[3] ||= (e) => r("input", e),
1188
- onChange: n[4] ||= (e) => r("change", e)
1229
+ onInput: n[4] ||= (e) => r("input", e),
1230
+ onChange: n[5] ||= (e) => r("change", e)
1189
1231
  }, null, 8, [
1190
1232
  "field",
1191
1233
  "model-value",
@@ -1196,15 +1238,15 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1196
1238
  field: e.field,
1197
1239
  "model-value": e.modelValue ?? "",
1198
1240
  "aria-label": e.field.label,
1199
- onInput: n[5] ||= (e) => r("input", e),
1200
- onChange: n[6] ||= (e) => r("change", e)
1241
+ onInput: n[6] ||= (e) => r("input", e),
1242
+ onChange: n[7] ||= (e) => r("change", e)
1201
1243
  }, null, 8, [
1202
1244
  "field",
1203
1245
  "model-value",
1204
1246
  "aria-label"
1205
1247
  ]));
1206
1248
  }
1207
- }), zt = [
1249
+ }), Kt = [
1208
1250
  "aria-label",
1209
1251
  "min",
1210
1252
  "max",
@@ -1257,9 +1299,9 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1257
1299
  onFocus: n[1] ||= (e) => a.value = !0,
1258
1300
  onBlur: l,
1259
1301
  onChange: l
1260
- }, null, 42, zt)), [[_e, i.value]]);
1302
+ }, null, 42, Kt)), [[_e, i.value]]);
1261
1303
  }
1262
- }), Bt = { class: "cn-padding flex w-full min-w-0 items-center gap-1.5" }, Vt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, Ht = /* @__PURE__ */ j({
1304
+ }), qt = { class: "cn-padding flex w-full min-w-0 items-center gap-1.5" }, Jt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, Yt = /* @__PURE__ */ j({
1263
1305
  __name: "PaddingField",
1264
1306
  props: {
1265
1307
  field: {},
@@ -1267,7 +1309,7 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1267
1309
  },
1268
1310
  emits: ["input", "change"],
1269
1311
  setup(e, { emit: t }) {
1270
- let n = e, r = t, { mode: i, cycle: a } = it(() => n.modelValue, Qe), o = T(() => Xe[i.value]);
1312
+ let n = e, r = t, { mode: i, cycle: a } = ct(() => n.modelValue, nt), o = T(() => et[i.value]);
1271
1313
  function s(e) {
1272
1314
  return {
1273
1315
  key: ["padding", e.rep],
@@ -1283,18 +1325,18 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1283
1325
  function l() {
1284
1326
  let { from: e, to: t } = a();
1285
1327
  if (t < e) {
1286
- let e = $e(n.modelValue, t);
1287
- et(e, n.modelValue) || r("change", e);
1328
+ let e = rt(n.modelValue, t);
1329
+ it(e, n.modelValue) || r("change", e);
1288
1330
  }
1289
1331
  }
1290
- return (t, n) => (P(), O("span", Bt, [A(dt, {
1332
+ return (t, n) => (P(), O("span", qt, [A(ht, {
1291
1333
  mode: z(i),
1292
1334
  label: "内边距",
1293
1335
  onCycle: l
1294
1336
  }, null, 8, ["mode"]), k("span", { class: N(["grid min-w-0 flex-1 gap-1.5", z(i) === 1 ? "grid-cols-1" : "grid-cols-2"]) }, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
1295
1337
  key: t.rep,
1296
1338
  class: "flex min-w-0 items-center gap-1.5"
1297
- }, [k("span", Vt, R(t.label), 1), A($, {
1339
+ }, [k("span", Jt, R(t.label), 1), A($, {
1298
1340
  class: "min-w-0 flex-1",
1299
1341
  field: s(t),
1300
1342
  "model-value": e.modelValue[t.rep],
@@ -1307,16 +1349,16 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1307
1349
  "onChange"
1308
1350
  ])]))), 128))], 2)]));
1309
1351
  }
1310
- }), Ut = { class: "grid w-full min-w-0 grid-cols-2 gap-1" }, Wt = ["title"], Gt = { class: "w-3.5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, Kt = [
1352
+ }), Xt = { class: "grid w-full min-w-0 grid-cols-2 gap-1" }, Zt = ["title"], Qt = { class: "w-3.5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, $t = [
1311
1353
  "aria-pressed",
1312
1354
  "title",
1313
1355
  "onClick"
1314
- ], qt = [
1356
+ ], en = [
1315
1357
  "aria-label",
1316
1358
  "value",
1317
1359
  "placeholder",
1318
1360
  "title"
1319
- ], Jt = /* @__PURE__ */ j({
1361
+ ], tn = /* @__PURE__ */ j({
1320
1362
  __name: "PairField",
1321
1363
  props: {
1322
1364
  field: {},
@@ -1372,12 +1414,12 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1372
1414
  let t = d(e);
1373
1415
  return t?.preview ? "模板子树:预览盒尺寸(随行实例变化,非文档声明值)" : t === void 0 ? `${e.label}自适应:已开启` : `${e.label}自适应:布局解析值(与画布选择框同源)`;
1374
1416
  }
1375
- return (e, t) => (P(), O("span", Ut, [(P(!0), O(w, null, I(i.value, (e) => (P(), O("label", {
1417
+ return (e, t) => (P(), O("span", Xt, [(P(!0), O(w, null, I(i.value, (e) => (P(), O("label", {
1376
1418
  key: e.key.join("."),
1377
1419
  class: "flex min-w-0 items-center gap-1",
1378
1420
  title: e.auto ? void 0 : e.label
1379
1421
  }, [
1380
- k("span", Gt, R(e.label), 1),
1422
+ k("span", Qt, R(e.label), 1),
1381
1423
  e.auto ? (P(), O("button", {
1382
1424
  key: 0,
1383
1425
  type: "button",
@@ -1385,7 +1427,7 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1385
1427
  "aria-pressed": a(e),
1386
1428
  title: p(e),
1387
1429
  onClick: V((t) => l(e), ["prevent"])
1388
- }, "自", 10, Kt)) : D("", !0),
1430
+ }, "自", 10, $t)) : D("", !0),
1389
1431
  a(e) ? (P(), O("input", {
1390
1432
  key: 2,
1391
1433
  class: N(["cn-field cn-field--number min-w-0 flex-1", [z(X), d(e)?.preview ? "cn-field--preview" : ""]]),
@@ -1395,7 +1437,7 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1395
1437
  value: f(e),
1396
1438
  placeholder: e.auto?.placeholder ?? "",
1397
1439
  title: m(e)
1398
- }, null, 10, qt)) : (P(), E($, {
1440
+ }, null, 10, en)) : (P(), E($, {
1399
1441
  key: 1,
1400
1442
  class: "min-w-0 flex-1",
1401
1443
  field: e,
@@ -1408,9 +1450,9 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1408
1450
  "onInput",
1409
1451
  "onChange"
1410
1452
  ]))
1411
- ], 8, Wt))), 128))]));
1453
+ ], 8, Zt))), 128))]));
1412
1454
  }
1413
- }), Yt = /* @__PURE__ */ j({
1455
+ }), nn = /* @__PURE__ */ j({
1414
1456
  __name: "RowsPathField",
1415
1457
  props: {
1416
1458
  field: {},
@@ -1439,7 +1481,7 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1439
1481
  "aria-label"
1440
1482
  ]));
1441
1483
  }
1442
- }), Xt = ["value"], Zt = ["value"], Qt = /* @__PURE__ */ j({
1484
+ }), rn = ["value"], an = ["value"], on = /* @__PURE__ */ j({
1443
1485
  __name: "SelectField",
1444
1486
  props: {
1445
1487
  field: {},
@@ -1455,12 +1497,12 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1455
1497
  class: "cn-select h-7 w-full min-w-0 flex-1 cursor-pointer appearance-none rounded-md border border-cn-field-line bg-cn-field py-0 pl-2 pr-6 text-[11px] leading-none text-cn-fg outline-none transition-[border-color,box-shadow] duration-100 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40",
1456
1498
  value: e.modelValue,
1457
1499
  onChange: r
1458
- }, [(P(!0), O(w, null, I(e.field.domain ?? [], (e) => (P(), O("option", {
1459
- key: e,
1460
- value: e
1461
- }, R(e), 9, Zt))), 128))], 40, Xt));
1500
+ }, [(P(!0), O(w, null, I(e.field.domain ?? [], (t) => (P(), O("option", {
1501
+ key: t,
1502
+ value: t
1503
+ }, R(e.field.optionLabels?.[t] ?? t), 9, an))), 128))], 40, rn));
1462
1504
  }
1463
- }), $t = ["value", "disabled"], en = /* @__PURE__ */ j({
1505
+ }), sn = ["value", "disabled"], cn = /* @__PURE__ */ j({
1464
1506
  __name: "TextareaField",
1465
1507
  props: {
1466
1508
  field: {},
@@ -1484,7 +1526,7 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1484
1526
  r = !1, n("change", e.target.value);
1485
1527
  }
1486
1528
  return (t, n) => (P(), O("textarea", {
1487
- class: N(["cn-field", z(ot)]),
1529
+ class: N(["cn-field", z(ut)]),
1488
1530
  rows: "3",
1489
1531
  value: e.modelValue,
1490
1532
  disabled: e.disabled,
@@ -1492,28 +1534,28 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1492
1534
  onCompositionstart: a,
1493
1535
  onCompositionend: o,
1494
1536
  onChange: s
1495
- }, null, 42, $t));
1537
+ }, null, 42, sn));
1496
1538
  }
1497
- }), tn = {
1539
+ }), ln = {
1498
1540
  number: M($),
1499
1541
  text: M(Q),
1500
- textarea: M(en),
1501
- color: M(kt),
1502
- select: M(Qt),
1503
- boolean: M(Ye),
1504
- pair: M(Jt),
1505
- anchor: M(Ke),
1506
- align: M(Ie),
1507
- padding: M(Ht),
1508
- border: M(_t),
1509
- font: M(Ct),
1510
- imageSrc: M(Rt),
1511
- resourceValue: M(Mt),
1512
- rowsPath: M(Yt)
1542
+ textarea: M(cn),
1543
+ color: M(Nt),
1544
+ select: M(on),
1545
+ boolean: M($e),
1546
+ pair: M(tn),
1547
+ anchor: M(Xe),
1548
+ align: M(Be),
1549
+ padding: M(Yt),
1550
+ border: M(xt),
1551
+ font: M(Dt),
1552
+ imageSrc: M(Gt),
1553
+ resourceValue: M(Rt),
1554
+ rowsPath: M(nn)
1513
1555
  };
1514
1556
  //#endregion
1515
1557
  //#region src/property-panel/usePropertyPanel.ts
1516
- function nn(e) {
1558
+ function un(e) {
1517
1559
  let t = L(e.store.doc), n = L(e.store.ui.selection), r = L(e.store.ui.anchorExpanded), i = L(e.store.ui.dataSourceSchema), a = L(e.store.ui.resourceStatuses), o = L(e.store.ui.editing), s = e.subscribe((s) => {
1518
1560
  s.scope === "doc" ? (t.value = e.store.doc, n.value = e.store.ui.selection, a.value = e.store.ui.resourceStatuses, o.value = e.store.ui.editing) : s.scope === "ui" && (s.branch === "selection" ? (n.value = e.store.ui.selection, e.store.closeMerge()) : s.branch === "anchorExpanded" ? r.value = e.store.ui.anchorExpanded : s.branch === "dataSourceSchema" ? i.value = e.store.ui.dataSourceSchema : s.branch === "resourceStatuses" ? a.value = e.store.ui.resourceStatuses : s.branch === "editing" && (o.value = e.store.ui.editing));
1519
1561
  });
@@ -1523,7 +1565,7 @@ function nn(e) {
1523
1565
  return e && r ? p(e, r) : null;
1524
1566
  }), l = T(() => t.value), u = T(() => {
1525
1567
  let e = c.value, r = n.value;
1526
- return e && r ? Ae(r, e) : t.value ? je : [];
1568
+ return e && r ? K(r, e) : t.value ? Ne : [];
1527
1569
  }), d = T(() => {
1528
1570
  let r = n.value;
1529
1571
  return r && t.value ? e.layerBoxAt(r) : null;
@@ -1582,7 +1624,7 @@ function nn(e) {
1582
1624
  function ae(t, n, r) {
1583
1625
  let i = t.key[1];
1584
1626
  if (i !== "color" && i !== "image") return;
1585
- let a = l.value?.background ?? K, o = typeof n == "string" && n !== "" ? n : null, s = {
1627
+ let a = l.value?.background ?? Fe, o = typeof n == "string" && n !== "" ? n : null, s = {
1586
1628
  ...a,
1587
1629
  [i]: o
1588
1630
  }, c = `canvas:background.${i}`;
@@ -1610,14 +1652,14 @@ function nn(e) {
1610
1652
  }
1611
1653
  //#endregion
1612
1654
  //#region src/property-panel/fields/ValueTypeSegmented.vue?vue&type=script&setup=true&lang.ts
1613
- var rn = ["aria-disabled"], an = [
1655
+ var dn = ["aria-disabled"], fn = [
1614
1656
  "aria-pressed",
1615
1657
  "title",
1616
1658
  "data-mode-static",
1617
1659
  "data-mode-expression",
1618
1660
  "disabled",
1619
1661
  "onClick"
1620
- ], on = /* @__PURE__ */ j({
1662
+ ], pn = /* @__PURE__ */ j({
1621
1663
  __name: "ValueTypeSegmented",
1622
1664
  props: {
1623
1665
  mode: {},
@@ -1652,15 +1694,15 @@ var rn = ["aria-disabled"], an = [
1652
1694
  "data-mode-expression": t.value === "expression" || void 0,
1653
1695
  disabled: e.disabled,
1654
1696
  onClick: V((e) => a(t.value), ["prevent"])
1655
- }, R(t.label), 11, an)), 64))], 10, rn));
1697
+ }, R(t.label), 11, fn)), 64))], 10, dn));
1656
1698
  }
1657
- }), sn = ["title"], cn = {
1699
+ }), mn = ["title"], hn = {
1658
1700
  key: 2,
1659
1701
  class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
1660
- }, ln = ["title"], un = {
1702
+ }, gn = ["title"], _n = {
1661
1703
  key: 4,
1662
1704
  class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
1663
- }, dn = /* @__PURE__ */ j({
1705
+ }, vn = /* @__PURE__ */ j({
1664
1706
  __name: "PropertyField",
1665
1707
  props: {
1666
1708
  field: {},
@@ -1680,7 +1722,7 @@ var rn = ["aria-disabled"], an = [
1680
1722
  "sub-commit"
1681
1723
  ],
1682
1724
  setup(e, { emit: t }) {
1683
- let n = e, r = t, i = T(() => tn[n.field.control]), a = T(() => n.dataMode === "expression"), o = T(() => n.field.control === "pair" ? "cn-prop-field block" : "cn-prop-field grid grid-cols-[60px_minmax(0,1fr)] items-center gap-x-2 gap-y-1.5"), s = T(() => n.field.data === !0 ? "col-span-2" : ""), c = T(() => n.field.data === !0 && n.field.control === "textarea"), l = T(() => n.field.control === "rowsPath"), u = T(() => n.field.resource === !0 || l.value), d = F(null), f = T(() => n.field.data === !0 && a.value && typeof n.value == "string" ? n.field.resource === !0 ? n.value === "" ? [] : x(n.value) : c.value ? ne(n.value) : [] : []), p = T(() => f.value.length === 0 ? "" : n.field.resource === !0 ? le(n.completion != null) : se(f.value)), m = T(() => (n.field.resource === !0 ? a.value : l.value) && n.completion == null && f.value.length === 0 ? C : ""), h = T(() => f.value.length > 0 || l.value && n.drifted === !0), g = T(() => n.field.control === "textarea");
1725
+ let n = e, r = t, i = T(() => ln[n.field.control]), a = T(() => n.dataMode === "expression"), o = T(() => n.field.control === "pair" ? "cn-prop-field block" : "cn-prop-field grid grid-cols-[60px_minmax(0,1fr)] items-center gap-x-2 gap-y-1.5"), s = T(() => n.field.data === !0 ? "col-span-2" : ""), c = T(() => n.field.data === !0 && n.field.control === "textarea"), l = T(() => n.field.control === "rowsPath"), u = T(() => n.field.resource === !0 || l.value), d = F(null), f = T(() => n.field.data === !0 && a.value && typeof n.value == "string" ? n.field.resource === !0 ? n.value === "" ? [] : x(n.value) : c.value ? ne(n.value) : [] : []), p = T(() => f.value.length === 0 ? "" : n.field.resource === !0 ? le(n.completion != null) : se(f.value)), m = T(() => (n.field.resource === !0 ? a.value : l.value) && n.completion == null && f.value.length === 0 ? C : ""), h = T(() => f.value.length > 0 || l.value && n.drifted === !0), g = T(() => n.field.control === "textarea");
1684
1726
  function _() {
1685
1727
  let e = f.value[0], t = d.value?.$el;
1686
1728
  e !== void 0 && (t instanceof HTMLTextAreaElement || t instanceof HTMLInputElement) && (t.focus(), t.setSelectionRange(e.at.start, e.at.end));
@@ -1705,8 +1747,8 @@ var rn = ["aria-disabled"], an = [
1705
1747
  key: 0,
1706
1748
  class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted",
1707
1749
  title: e.field.title
1708
- }, R(e.field.label), 9, sn)),
1709
- e.field.data ? (P(), E(on, {
1750
+ }, R(e.field.label), 9, mn)),
1751
+ e.field.data ? (P(), E(pn, {
1710
1752
  key: 1,
1711
1753
  class: "justify-self-end",
1712
1754
  mode: e.dataMode ?? "static",
@@ -1740,14 +1782,14 @@ var rn = ["aria-disabled"], an = [
1740
1782
  "source",
1741
1783
  "resource-status"
1742
1784
  ])),
1743
- e.hint ? (P(), O("span", cn, R(e.hint), 1)) : D("", !0),
1785
+ e.hint ? (P(), O("span", hn, R(e.hint), 1)) : D("", !0),
1744
1786
  p.value ? (P(), O("span", {
1745
1787
  key: 3,
1746
1788
  class: N(["cn-prop-field__hint cn-prop-field__hint--error col-span-2 block text-[11px] leading-4 text-cn-danger", { "cursor-pointer": g.value }]),
1747
1789
  title: g.value ? "点击选中出错片段" : void 0,
1748
1790
  onClick: _
1749
- }, R(p.value), 11, ln)) : D("", !0),
1750
- m.value ? (P(), O("span", un, R(m.value), 1)) : D("", !0)
1791
+ }, R(p.value), 11, gn)) : D("", !0),
1792
+ m.value ? (P(), O("span", _n, R(m.value), 1)) : D("", !0)
1751
1793
  ]),
1752
1794
  _: 1
1753
1795
  }, 8, ["class"])), c.value ? (P(), E(ae, {
@@ -1758,14 +1800,14 @@ var rn = ["aria-disabled"], an = [
1758
1800
  onSelect: z(S)
1759
1801
  }, null, 8, ["state", "onSelect"])) : D("", !0)], 64));
1760
1802
  }
1761
- }), fn = { class: "cn-props flex w-[288px] shrink-0 flex-col overflow-y-auto rounded-xl border border-cn-line bg-cn-bg text-cn-fg shadow-[0_16px_40px_-12px_rgba(2,6,23,0.55)]" }, pn = { class: "sticky top-0 z-10 border-b border-cn-line bg-cn-bg-elevated/95 px-3.5 py-2.5 backdrop-blur-sm" }, mn = { class: "flex items-center gap-2" }, hn = { class: "inline-flex items-center gap-1.5 rounded border border-cn-accent/25 bg-cn-accent-soft px-1.5 py-0.5 font-mono text-[10px] leading-4 text-cn-accent" }, gn = { class: "text-[12px] font-medium tracking-wide text-cn-fg/90" }, _n = {
1803
+ }), yn = { class: "cn-props flex w-[288px] shrink-0 flex-col overflow-y-auto rounded-xl border border-cn-line bg-cn-bg text-cn-fg shadow-[0_16px_40px_-12px_rgba(2,6,23,0.55)]" }, bn = { class: "sticky top-0 z-10 border-b border-cn-line bg-cn-bg-elevated/95 px-3.5 py-2.5 backdrop-blur-sm" }, xn = { class: "flex items-center gap-2" }, Sn = { class: "inline-flex items-center gap-1.5 rounded border border-cn-accent/25 bg-cn-accent-soft px-1.5 py-0.5 font-mono text-[10px] leading-4 text-cn-accent" }, Cn = { class: "text-[12px] font-medium tracking-wide text-cn-fg/90" }, wn = {
1762
1804
  key: 0,
1763
1805
  class: "mx-3.5 my-4 rounded-lg border border-dashed border-cn-line px-3 py-6 text-center text-[11px] leading-5 text-cn-muted"
1764
- }, vn = { class: "cn-props__section-title mb-2 text-[10px] font-semibold uppercase tracking-[0.16em] text-cn-muted" }, yn = { class: "flex flex-col gap-2" }, bn = "内容编辑中:请在画布编辑框内修改,退出后此处更新", xn = /* @__PURE__ */ j({
1806
+ }, Tn = { class: "cn-props__section-title mb-2 text-[10px] font-semibold uppercase tracking-[0.16em] text-cn-muted" }, En = { class: "flex flex-col gap-2" }, Dn = "内容编辑中:请在画布编辑框内修改,退出后此处更新", On = /* @__PURE__ */ j({
1765
1807
  __name: "PropertyPanel",
1766
1808
  props: { editor: {} },
1767
1809
  setup(e) {
1768
- let t = e, n = nn(t.editor);
1810
+ let t = e, n = un(t.editor);
1769
1811
  he(Z, {
1770
1812
  canUpload: t.editor.canUpload,
1771
1813
  uploadImage: (e) => t.editor.uploadImage(e)
@@ -1777,7 +1819,7 @@ var rn = ["aria-disabled"], an = [
1777
1819
  let e = n.layer.value;
1778
1820
  return e ? e.type : n.canvas.value ? "Canvas" : "—";
1779
1821
  }), o = T(() => {
1780
- let e = n.layer.value ?? (n.selection.value ? null : Me(n.canvas.value));
1822
+ let e = n.layer.value === null ? n.selection.value ? null : Pe(n.canvas.value) : Ie(n.layer.value);
1781
1823
  if (!e) return [];
1782
1824
  let t = n.selection.value?.join(".") ?? "canvas", r = n.layer.value, i = n.resourceStatuses.value, a = [];
1783
1825
  for (let o of n.sections.value) {
@@ -1792,7 +1834,7 @@ var rn = ["aria-disabled"], an = [
1792
1834
  value: o.value,
1793
1835
  dataMode: a.data ? n.isDataMarked(a) ? "expression" : "static" : void 0,
1794
1836
  locked: c,
1795
- hint: c ? bn : a.hint && r ? a.hint(r, i) ?? void 0 : void 0,
1837
+ hint: c ? Dn : a.hint && r ? a.hint(r, i) ?? void 0 : void 0,
1796
1838
  resourceStatus: a.control === "imageSrc" && typeof o.value == "string" && o.value !== "" ? i[o.value] : void 0,
1797
1839
  drifted: a.control === "rowsPath" ? n.rowsPathDrifted.value : void 0
1798
1840
  });
@@ -1820,16 +1862,16 @@ var rn = ["aria-disabled"], an = [
1820
1862
  function c() {
1821
1863
  n.setAnchorExpanded(!n.anchorExpanded.value);
1822
1864
  }
1823
- return (e, t) => (P(), O("aside", fn, [
1824
- k("header", pn, [k("div", mn, [k("span", hn, [t[0] ||= k("i", {
1865
+ return (e, t) => (P(), O("aside", yn, [
1866
+ k("header", bn, [k("div", xn, [k("span", Sn, [t[0] ||= k("i", {
1825
1867
  class: "size-1.5 rounded-full bg-cn-accent",
1826
1868
  "aria-hidden": "true"
1827
- }, null, -1), de(" " + R(a.value), 1)]), k("span", gn, R(i.value ? "图层属性" : "画布属性"), 1)])]),
1828
- o.value.length === 0 ? (P(), O("p", _n, " 打开文档后可编辑属性 ")) : D("", !0),
1869
+ }, null, -1), de(" " + R(a.value), 1)]), k("span", Cn, R(i.value ? "图层属性" : "画布属性"), 1)])]),
1870
+ o.value.length === 0 ? (P(), O("p", wn, " 打开文档后可编辑属性 ")) : D("", !0),
1829
1871
  (P(!0), O(w, null, I(o.value, (e) => (P(), O("section", {
1830
1872
  key: e.title,
1831
1873
  class: "cn-props__section border-b border-cn-line/70 px-3.5 py-3 last:border-b-0"
1832
- }, [k("h3", vn, R(e.title), 1), k("div", yn, [(P(!0), O(w, null, I(e.fields, (e) => (P(), O(w, { key: e.key }, [e.field.control === "anchor" ? (P(), E(Ke, {
1874
+ }, [k("h3", Tn, R(e.title), 1), k("div", En, [(P(!0), O(w, null, I(e.fields, (e) => (P(), O(w, { key: e.key }, [e.field.control === "anchor" ? (P(), E(Xe, {
1833
1875
  key: 0,
1834
1876
  field: e.field,
1835
1877
  "model-value": e.value,
@@ -1841,7 +1883,7 @@ var rn = ["aria-disabled"], an = [
1841
1883
  "model-value",
1842
1884
  "expanded",
1843
1885
  "onChange"
1844
- ])) : (P(), E(dn, {
1886
+ ])) : (P(), E(vn, {
1845
1887
  key: 1,
1846
1888
  field: e.field,
1847
1889
  value: e.value,
@@ -1875,4 +1917,4 @@ var rn = ["aria-disabled"], an = [
1875
1917
  }
1876
1918
  });
1877
1919
  //#endregion
1878
- export { Z as a, Ee as c, Oe as d, q as f, tn as i, Ae as l, dn as n, At as o, nn as r, je as s, xn as t, De as u };
1920
+ export { Z as a, ke as c, je as d, q as f, ln as i, K as l, vn as n, Pt as o, un as r, Ne as s, On as t, Ae as u };