@hankchen/canvas-editor-vue 0.7.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 = "fill", Ae = "tile", je = {
172
204
  ImageLayer: [
173
205
  H,
174
206
  U,
@@ -181,6 +213,22 @@ 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: [
221
+ De,
222
+ Oe,
223
+ ke,
224
+ Ae
225
+ ],
226
+ optionLabels: {
227
+ [De]: "铺满裁切",
228
+ [Oe]: "完整显示",
229
+ [ke]: "拉伸铺满",
230
+ [Ae]: "平铺"
231
+ }
184
232
  }]
185
233
  }
186
234
  ],
@@ -188,39 +236,7 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
188
236
  H,
189
237
  U,
190
238
  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
- }
239
+ Ee
224
240
  ],
225
241
  QrCodeLayer: [
226
242
  H,
@@ -276,15 +292,15 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
276
292
  }]
277
293
  }]
278
294
  };
279
- function De(e) {
280
- return Ee[e] ?? [];
295
+ function Me(e) {
296
+ return je[e] ?? [];
281
297
  }
282
- function Oe(e) {
298
+ function Ne(e) {
283
299
  if (e[e.length - 1] === "content") return h(e) ? "templateContent" : "content";
284
300
  let t = e[e.length - 2];
285
301
  return t === "rows" ? "row" : t === "cells" ? "cell" : "root";
286
302
  }
287
- var ke = {
303
+ var Pe = {
288
304
  root: [],
289
305
  cell: [],
290
306
  row: ["shape.width", "shape.autoWidth"],
@@ -299,9 +315,9 @@ var ke = {
299
315
  function G(e, t) {
300
316
  return [...e.key, ...t.key];
301
317
  }
302
- function Ae(e, t) {
303
- let n = new Set(ke[Oe(e)]), r = [];
304
- for (let e of De(t.type)) {
318
+ function Fe(e, t) {
319
+ let n = new Set(Pe[Ne(e)]), r = [];
320
+ for (let e of Me(t.type)) {
305
321
  let i = [];
306
322
  for (let r of e.fields) {
307
323
  if (r.items) {
@@ -321,7 +337,7 @@ function Ae(e, t) {
321
337
  }
322
338
  return r;
323
339
  }
324
- var je = [{
340
+ var Ie = [{
325
341
  title: "画布",
326
342
  fields: [{
327
343
  key: ["width"],
@@ -349,7 +365,7 @@ var je = [{
349
365
  control: "imageSrc"
350
366
  }]
351
367
  }];
352
- function Me(e) {
368
+ function Le(e) {
353
369
  return e === null ? null : e.background === null ? {
354
370
  ...e,
355
371
  background: K
@@ -359,6 +375,12 @@ var K = {
359
375
  color: null,
360
376
  image: null
361
377
  };
378
+ function Re(e) {
379
+ return e.type === "ImageLayer" && e.fit === void 0 ? {
380
+ ...e,
381
+ fit: "cover"
382
+ } : e;
383
+ }
362
384
  function q(e, t) {
363
385
  let n = e;
364
386
  for (let e = 0; e < t.length; e += 1) {
@@ -372,14 +394,14 @@ function q(e, t) {
372
394
  }
373
395
  //#endregion
374
396
  //#region src/property-panel/fields/AlignField.vue?vue&type=script&setup=true&lang.ts
375
- var Ne = ["aria-label"], Pe = [
397
+ var ze = ["aria-label"], Be = [
376
398
  "aria-pressed",
377
399
  "title",
378
400
  "onClick"
379
- ], Fe = {
401
+ ], Ve = {
380
402
  key: 1,
381
403
  class: "truncate px-1 text-[10px] leading-none"
382
- }, Ie = /* @__PURE__ */ j({
404
+ }, He = /* @__PURE__ */ j({
383
405
  __name: "AlignField",
384
406
  props: {
385
407
  field: {},
@@ -441,28 +463,28 @@ var Ne = ["aria-label"], Pe = [
441
463
  }, [t.icon ? (P(), E(g, {
442
464
  key: 0,
443
465
  icon: t.icon
444
- }, null, 8, ["icon"])) : (P(), O("span", Fe, R(t.value), 1))], 10, Pe))), 128))], 8, Ne));
466
+ }, null, 8, ["icon"])) : (P(), O("span", Ve, R(t.value), 1))], 10, Be))), 128))], 8, ze));
445
467
  }
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 = {
468
+ }), Ue = { class: "block" }, We = ["aria-expanded", "title"], Ge = { class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted" }, Ke = { class: "flex shrink-0 items-center gap-1.5" }, qe = {
447
469
  viewBox: "0 0 24 24",
448
470
  class: "size-3.5",
449
471
  "aria-hidden": "true"
450
- }, He = [
472
+ }, Je = [
451
473
  "cx",
452
474
  "cy",
453
475
  "r"
454
- ], Ue = {
476
+ ], Ye = {
455
477
  key: 0,
456
478
  class: "mt-2 flex justify-end"
457
- }, We = {
479
+ }, Xe = {
458
480
  class: "cn-anchor grid w-[66px] shrink-0 grid-cols-3 gap-[3px]",
459
481
  role: "group",
460
482
  "aria-label": "九宫锚点"
461
- }, Ge = [
483
+ }, Ze = [
462
484
  "aria-pressed",
463
485
  "title",
464
486
  "onClick"
465
- ], Ke = /* @__PURE__ */ j({
487
+ ], Qe = /* @__PURE__ */ j({
466
488
  __name: "AnchorDisclosureField",
467
489
  props: {
468
490
  field: {},
@@ -482,31 +504,31 @@ var Ne = ["aria-label"], Pe = [
482
504
  function s(e) {
483
505
  r("change", e);
484
506
  }
485
- return (t, n) => (P(), O("span", Le, [k("button", {
507
+ return (t, n) => (P(), O("span", Ue, [k("button", {
486
508
  type: "button",
487
509
  class: "cn-anchor-disclosure__header flex w-full items-center justify-between gap-2",
488
510
  "aria-expanded": e.expanded,
489
511
  title: e.expanded ? "收起锚点" : `锚点:${e.modelValue}(点击展开调整)`,
490
512
  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", {
513
+ }, [k("span", Ge, R(e.field.label), 1), k("span", Ke, [(P(), O("svg", qe, [(P(!0), O(w, null, I(z(a), (e) => (P(), O("circle", {
492
514
  key: e.index,
493
515
  cx: e.cx,
494
516
  cy: e.cy,
495
517
  r: e.index === o.value ? 3.2 : 2.2,
496
518
  class: N(e.index === o.value ? "fill-cn-accent" : "fill-cn-muted/35")
497
- }, null, 10, He))), 128))])), A(g, {
519
+ }, null, 10, Je))), 128))])), A(g, {
498
520
  icon: z(u),
499
521
  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", {
522
+ }, null, 8, ["icon", "class"])])], 8, We), e.expanded ? (P(), O("span", Ye, [k("span", Xe, [(P(!0), O(w, null, I(z(i), (t) => (P(), O("button", {
501
523
  key: t,
502
524
  type: "button",
503
525
  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
526
  "aria-pressed": t === e.modelValue,
505
527
  title: t,
506
528
  onClick: (e) => s(t)
507
- }, null, 10, Ge))), 128))])])) : D("", !0)]));
529
+ }, null, 10, Ze))), 128))])])) : D("", !0)]));
508
530
  }
509
- }), qe = { class: "cn-bool relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center" }, Je = ["checked"], Ye = /* @__PURE__ */ j({
531
+ }), $e = { class: "cn-bool relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center" }, et = ["checked"], tt = /* @__PURE__ */ j({
510
532
  __name: "BooleanField",
511
533
  props: {
512
534
  field: {},
@@ -520,7 +542,7 @@ var Ne = ["aria-label"], Pe = [
520
542
  }
521
543
  return ve(() => {
522
544
  i.value && (i.value.checked = n.modelValue);
523
- }), (t, n) => (P(), O("label", qe, [
545
+ }), (t, n) => (P(), O("label", $e, [
524
546
  k("input", {
525
547
  ref_key: "inputRef",
526
548
  ref: i,
@@ -528,12 +550,12 @@ var Ne = ["aria-label"], Pe = [
528
550
  type: "checkbox",
529
551
  checked: e.modelValue,
530
552
  onChange: a
531
- }, null, 40, Je),
553
+ }, null, 40, et),
532
554
  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
555
  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
556
  ]));
535
557
  }
536
- }), Xe = {
558
+ }), nt = {
537
559
  1: [{
538
560
  label: "四边",
539
561
  rep: "top",
@@ -576,13 +598,13 @@ var Ne = ["aria-label"], Pe = [
576
598
  }
577
599
  ]
578
600
  };
579
- function Ze(e) {
601
+ function rt(e) {
580
602
  return e === 1 ? 2 : e === 2 ? 4 : 1;
581
603
  }
582
- function Qe(e) {
604
+ function it(e) {
583
605
  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
606
  }
585
- function $e(e, t) {
607
+ function at(e, t) {
586
608
  if (t === 1) {
587
609
  let { top: t } = e;
588
610
  return {
@@ -603,17 +625,17 @@ function $e(e, t) {
603
625
  }
604
626
  return e;
605
627
  }
606
- function et(e, t) {
628
+ function ot(e, t) {
607
629
  return e.top === t.top && e.bottom === t.bottom && e.left === t.left && e.right === t.right;
608
630
  }
609
631
  function J(e, t) {
610
632
  return e === null || t === null ? e === t : e.width === t.width && e.color === t.color;
611
633
  }
612
- function tt(e) {
634
+ function st(e) {
613
635
  let { top: t, bottom: n, left: r, right: i } = e;
614
636
  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
637
  }
616
- function nt(e, t) {
638
+ function ct(e, t) {
617
639
  let n = (e) => e === null ? null : { ...e };
618
640
  if (t === 1) {
619
641
  let t = n(e.top);
@@ -635,18 +657,18 @@ function nt(e, t) {
635
657
  }
636
658
  return e;
637
659
  }
638
- function rt(e, t) {
660
+ function lt(e, t) {
639
661
  return J(e.top, t.top) && J(e.bottom, t.bottom) && J(e.left, t.left) && J(e.right, t.right);
640
662
  }
641
663
  //#endregion
642
664
  //#region src/property-panel/useShorthandMode.ts
643
- function it(e, t) {
665
+ function ut(e, t) {
644
666
  let n = T(() => t(e())), r = F(null), i = T(() => r.value ?? n.value);
645
667
  B(e, () => {
646
668
  r.value = null;
647
669
  });
648
670
  function a() {
649
- let e = i.value, t = Ze(e);
671
+ let e = i.value, t = rt(e);
650
672
  return r.value = t, {
651
673
  from: e,
652
674
  to: t
@@ -659,7 +681,7 @@ function it(e, t) {
659
681
  }
660
682
  //#endregion
661
683
  //#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({
684
+ 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`, dt = Y, ft = "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", pt = "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", mt = ["aria-label"], ht = /* @__PURE__ */ j({
663
685
  __name: "BorderWidthInput",
664
686
  props: {
665
687
  value: {},
@@ -710,9 +732,9 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
710
732
  onFocus: n[1] ||= (e) => a.value = !0,
711
733
  onBlur: u,
712
734
  onChange: u
713
- }, null, 42, ct)), [[_e, i.value]]);
735
+ }, null, 42, mt)), [[_e, i.value]]);
714
736
  }
715
- }), ut = ["aria-label", "title"], dt = /* @__PURE__ */ j({
737
+ }), gt = ["aria-label", "title"], _t = /* @__PURE__ */ j({
716
738
  __name: "ShorthandModeButton",
717
739
  props: {
718
740
  mode: {},
@@ -743,14 +765,14 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
743
765
  }, [A(g, {
744
766
  icon: a.value.icon,
745
767
  size: 12
746
- }, null, 8, ["icon"])], 8, ut));
768
+ }, null, 8, ["icon"])], 8, gt));
747
769
  }
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 = [
770
+ }), vt = { class: "cn-border flex w-full min-w-0 items-center gap-1" }, yt = { class: "grid min-w-0 flex-1 gap-1 grid-cols-1" }, bt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, xt = [
749
771
  "value",
750
772
  "disabled",
751
773
  "onInput",
752
774
  "onChange"
753
- ], gt = "#000000", _t = /* @__PURE__ */ j({
775
+ ], St = "#000000", Ct = /* @__PURE__ */ j({
754
776
  __name: "BorderField",
755
777
  props: {
756
778
  field: {},
@@ -758,12 +780,12 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
758
780
  },
759
781
  emits: ["input", "change"],
760
782
  setup(e, { emit: t }) {
761
- let n = e, r = t, { mode: i, cycle: a } = it(() => n.modelValue, tt), o = T(() => Xe[i.value]);
783
+ let n = e, r = t, { mode: i, cycle: a } = ut(() => n.modelValue, st), o = T(() => nt[i.value]);
762
784
  function s(e) {
763
785
  return n.modelValue[e.rep]?.width ?? null;
764
786
  }
765
787
  function c(e) {
766
- return n.modelValue[e.rep]?.color ?? gt;
788
+ return n.modelValue[e.rep]?.color ?? St;
767
789
  }
768
790
  function l(e, t, i) {
769
791
  let a = { ...n.modelValue };
@@ -771,7 +793,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
771
793
  r(i ? "change" : "input", a);
772
794
  }
773
795
  function u(e, t, r) {
774
- let i = n.modelValue[e.rep]?.color ?? gt;
796
+ let i = n.modelValue[e.rep]?.color ?? St;
775
797
  l(e, t <= 0 ? null : {
776
798
  width: t,
777
799
  color: i
@@ -789,20 +811,20 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
789
811
  function f() {
790
812
  let { from: e, to: t } = a();
791
813
  if (t < e) {
792
- let e = nt(n.modelValue, t);
793
- rt(e, n.modelValue) || r("change", e);
814
+ let e = ct(n.modelValue, t);
815
+ lt(e, n.modelValue) || r("change", e);
794
816
  }
795
817
  }
796
- return (t, n) => (P(), O("span", ft, [A(dt, {
818
+ return (t, n) => (P(), O("span", vt, [A(_t, {
797
819
  mode: z(i),
798
820
  label: "边框",
799
821
  onCycle: f
800
- }, null, 8, ["mode"]), k("span", pt, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
822
+ }, null, 8, ["mode"]), k("span", yt, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
801
823
  key: t.rep,
802
824
  class: "flex items-center gap-1.5"
803
825
  }, [
804
- k("span", mt, R(t.label), 1),
805
- A(lt, {
826
+ k("span", bt, R(t.label), 1),
827
+ A(ht, {
806
828
  class: "cn-border__width",
807
829
  value: s(t),
808
830
  label: t.label,
@@ -822,17 +844,17 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
822
844
  disabled: e.modelValue[t.rep] === null,
823
845
  onInput: (e) => d(t, e, !1),
824
846
  onChange: (e) => d(t, e, !0)
825
- }, null, 40, ht)
847
+ }, null, 40, xt)
826
848
  ]))), 128))])]));
827
849
  }
828
- }), vt = ["value"], yt = {
850
+ }), wt = ["value"], Tt = {
829
851
  key: 1,
830
852
  class: "flex flex-1 items-center gap-1.5"
831
- }, bt = ["value"], xt = ["value"], St = [
853
+ }, Et = ["value"], Dt = ["value"], Ot = [
832
854
  "disabled",
833
855
  "title",
834
856
  "data-upload-error"
835
- ], Ct = /* @__PURE__ */ j({
857
+ ], kt = /* @__PURE__ */ j({
836
858
  __name: "FontField",
837
859
  props: {
838
860
  field: {},
@@ -895,14 +917,14 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
895
917
  }
896
918
  return (t, n) => z(i) === null ? (P(), O("input", {
897
919
  key: 0,
898
- class: N(["cn-field", z(at)]),
920
+ class: N(["cn-field", z(dt)]),
899
921
  type: "text",
900
922
  value: e.modelValue,
901
923
  onInput: l,
902
924
  onCompositionstart: u,
903
925
  onCompositionend: d,
904
926
  onChange: f
905
- }, null, 42, vt)) : (P(), O("div", yt, [
927
+ }, null, 42, wt)) : (P(), O("div", Tt, [
906
928
  k("select", {
907
929
  class: N(["cn-field cn-select", z(Y)]),
908
930
  value: e.modelValue,
@@ -910,7 +932,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
910
932
  }, [(P(!0), O(w, null, I(a.value, (e) => (P(), O("option", {
911
933
  key: e.value,
912
934
  value: e.value
913
- }, R(e.label), 9, xt))), 128))], 42, bt),
935
+ }, R(e.label), 9, Dt))), 128))], 42, Et),
914
936
  k("input", {
915
937
  ref_key: "fileInput",
916
938
  ref: h,
@@ -927,10 +949,10 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
927
949
  title: m.value ?? "上传本机字体(加入清单后可选)",
928
950
  "data-upload-error": m.value ?? void 0,
929
951
  onClick: g
930
- }, R(p.value ? "…" : m.value ? "!" : "上传"), 9, St)) : D("", !0)
952
+ }, R(p.value ? "…" : m.value ? "!" : "上传"), 9, Ot)) : D("", !0)
931
953
  ]));
932
954
  }
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({
955
+ }), At = { class: "cn-color flex min-w-0 flex-1 items-center gap-1.5" }, jt = ["checked"], Mt = ["value", "disabled"], Nt = ["value", "disabled"], Pt = "#000000", Ft = /* @__PURE__ */ j({
934
956
  __name: "ColorField",
935
957
  props: {
936
958
  field: {},
@@ -943,7 +965,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
943
965
  i.value = e !== null, i.value && (a.value = o(e));
944
966
  });
945
967
  function o(e) {
946
- return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e : Ot;
968
+ return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e : Pt;
947
969
  }
948
970
  function s(e) {
949
971
  let t = e.target.checked;
@@ -970,7 +992,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
970
992
  }
971
993
  a.value = o(t), r("change", t);
972
994
  }
973
- return (t, n) => (P(), O("span", wt, [
995
+ return (t, n) => (P(), O("span", At, [
974
996
  e.field.nullable ? (P(), O("input", {
975
997
  key: 0,
976
998
  class: "cn-color__toggle size-3.5 shrink-0 cursor-pointer accent-cn-accent",
@@ -978,15 +1000,15 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
978
1000
  title: "启用颜色",
979
1001
  checked: i.value,
980
1002
  onChange: s
981
- }, null, 40, Tt)) : D("", !0),
1003
+ }, null, 40, jt)) : D("", !0),
982
1004
  k("input", {
983
- class: N(["cn-color__swatch", z(st)]),
1005
+ class: N(["cn-color__swatch", z(pt)]),
984
1006
  type: "color",
985
1007
  value: a.value,
986
1008
  disabled: !i.value,
987
1009
  onInput: c,
988
1010
  onChange: l
989
- }, null, 42, Et),
1011
+ }, null, 42, Mt),
990
1012
  k("input", {
991
1013
  class: N(["cn-color__text min-w-0 flex-1", z(Y)]),
992
1014
  type: "text",
@@ -994,16 +1016,27 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
994
1016
  disabled: !i.value,
995
1017
  placeholder: "无",
996
1018
  onChange: u
997
- }, null, 42, Dt)
1019
+ }, null, 42, Nt)
998
1020
  ]));
999
1021
  }
1000
1022
  }), Z = Symbol("canvas-image-upload");
1001
- function At() {
1023
+ function It() {
1002
1024
  return fe(Z, null);
1003
1025
  }
1004
1026
  //#endregion
1027
+ //#region src/property-panel/fields/intrinsicSize.ts
1028
+ function Lt(e, t) {
1029
+ let n = e, r = t;
1030
+ for (; r !== 0;) [n, r] = [r, n % r];
1031
+ let i = e / n, a = t / n;
1032
+ return Math.max(i, a) <= 32 ? `${i}:${a}` : `${Math.round(e / t * 100) / 100}:1`;
1033
+ }
1034
+ function Rt(e, t) {
1035
+ return !Number.isFinite(e) || !Number.isFinite(t) || e <= 0 || t <= 0 ? null : `${e}×${t} · ${Lt(e, t)}`;
1036
+ }
1037
+ //#endregion
1005
1038
  //#region src/property-panel/fields/TextField.vue?vue&type=script&setup=true&lang.ts
1006
- var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1039
+ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1007
1040
  __name: "TextField",
1008
1041
  props: {
1009
1042
  field: {},
@@ -1033,7 +1066,7 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1033
1066
  o(t) || r("change", t);
1034
1067
  }
1035
1068
  return (t, n) => (P(), O("input", {
1036
- class: N(["cn-field", [z(at), a.value ? "cn-field--invalid" : ""]]),
1069
+ class: N(["cn-field", [z(dt), a.value ? "cn-field--invalid" : ""]]),
1037
1070
  type: "text",
1038
1071
  value: e.modelValue,
1039
1072
  placeholder: e.field.placeholder,
@@ -1041,9 +1074,9 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1041
1074
  onCompositionstart: c,
1042
1075
  onCompositionend: l,
1043
1076
  onChange: u
1044
- }, null, 42, jt));
1077
+ }, null, 42, zt));
1045
1078
  }
1046
- }), Mt = /* @__PURE__ */ j({
1079
+ }), Bt = /* @__PURE__ */ j({
1047
1080
  __name: "ResourceValueField",
1048
1081
  props: {
1049
1082
  field: {},
@@ -1090,17 +1123,20 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1090
1123
  "disabled"
1091
1124
  ]));
1092
1125
  }
1093
- }), Nt = {
1126
+ }), Vt = {
1094
1127
  key: 0,
1095
1128
  class: "flex flex-col gap-1.5"
1096
- }, Pt = [
1129
+ }, Ht = [
1097
1130
  "disabled",
1098
1131
  "title",
1099
1132
  "data-upload-error"
1100
- ], Ft = ["src"], It = {
1133
+ ], Ut = ["src"], Wt = {
1101
1134
  key: 2,
1102
1135
  class: "relative"
1103
- }, Lt = { class: "flex items-center gap-1.5" }, Rt = /* @__PURE__ */ j({
1136
+ }, Gt = { class: "flex items-center gap-1.5" }, Kt = {
1137
+ key: 0,
1138
+ class: "cn-imagesrc__intrinsic text-[11px] leading-4 text-cn-muted"
1139
+ }, qt = /* @__PURE__ */ j({
1104
1140
  __name: "ImageSrcField",
1105
1141
  props: {
1106
1142
  field: {},
@@ -1112,11 +1148,21 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1112
1148
  },
1113
1149
  emits: ["input", "change"],
1114
1150
  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() {
1151
+ let n = e, r = t, i = It(), 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 : Rt(d.value.width, d.value.height));
1152
+ function p(e) {
1153
+ let t = e.target;
1154
+ d.value = t.naturalWidth > 0 && t.naturalHeight > 0 ? {
1155
+ width: t.naturalWidth,
1156
+ height: t.naturalHeight
1157
+ } : null;
1158
+ }
1159
+ B(() => n.modelValue, () => {
1160
+ d.value = null;
1161
+ });
1162
+ function m() {
1117
1163
  l.value = null, u.value?.click();
1118
1164
  }
1119
- async function f(e) {
1165
+ async function h(e) {
1120
1166
  let t = e.target, n = t.files?.[0];
1121
1167
  if (t.value = "", i !== null && n && !c.value) {
1122
1168
  c.value = !0;
@@ -1130,42 +1176,44 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1130
1176
  }
1131
1177
  }
1132
1178
  }
1133
- return (t, n) => a.value ? (P(), O("div", Nt, [
1179
+ return (t, n) => a.value ? (P(), O("div", Vt, [
1134
1180
  k("button", {
1135
1181
  type: "button",
1136
1182
  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
1183
  disabled: c.value,
1138
1184
  title: l.value ?? (o.value ? "点击替换图片" : "点击上传图片"),
1139
1185
  "data-upload-error": l.value ?? void 0,
1140
- onClick: d
1186
+ onClick: m
1141
1187
  }, [
1142
1188
  o.value ? (P(), O("img", {
1143
1189
  key: 0,
1144
1190
  src: e.modelValue ?? void 0,
1145
1191
  class: "absolute inset-0 size-full object-cover",
1146
- alt: ""
1147
- }, null, 8, Ft)) : D("", !0),
1192
+ alt: "",
1193
+ onLoad: p,
1194
+ onError: n[0] ||= (e) => d.value = null
1195
+ }, null, 40, Ut)) : D("", !0),
1148
1196
  s.value ? (P(), O("span", {
1149
1197
  key: 1,
1150
1198
  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
1199
  }, R(s.value), 3)) : D("", !0),
1152
- o.value ? D("", !0) : (P(), O("span", It, R(c.value ? "…" : l.value ? "!" : "点击上传图片"), 1))
1153
- ], 8, Pt),
1200
+ o.value ? D("", !0) : (P(), O("span", Wt, R(c.value ? "…" : l.value ? "!" : "点击上传图片"), 1))
1201
+ ], 8, Ht),
1154
1202
  k("input", {
1155
1203
  ref_key: "fileInput",
1156
1204
  ref: u,
1157
1205
  type: "file",
1158
1206
  class: "hidden",
1159
1207
  accept: "image/*",
1160
- onChange: f
1208
+ onChange: h
1161
1209
  }, null, 544),
1162
- k("div", Lt, [A(Q, {
1210
+ k("div", Gt, [A(Q, {
1163
1211
  class: "flex-1",
1164
1212
  field: e.field,
1165
1213
  "model-value": e.modelValue ?? "",
1166
1214
  "aria-label": e.field.label,
1167
- onInput: n[0] ||= (e) => r("input", e),
1168
- onChange: n[1] ||= (e) => r("change", e)
1215
+ onInput: n[1] ||= (e) => r("input", e),
1216
+ onChange: n[2] ||= (e) => r("change", e)
1169
1217
  }, null, 8, [
1170
1218
  "field",
1171
1219
  "model-value",
@@ -1175,17 +1223,18 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1175
1223
  type: "button",
1176
1224
  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
1225
  title: "清除图片(资源地址置空)",
1178
- onClick: n[2] ||= (e) => r("change", "")
1179
- }, "清除")) : D("", !0)])
1180
- ])) : e.dataMode === "expression" ? (P(), E(Mt, {
1226
+ onClick: n[3] ||= (e) => r("change", "")
1227
+ }, "清除")) : D("", !0)]),
1228
+ f.value ? (P(), O("span", Kt, "源图 " + R(f.value), 1)) : D("", !0)
1229
+ ])) : e.dataMode === "expression" ? (P(), E(Bt, {
1181
1230
  key: 1,
1182
1231
  field: e.field,
1183
1232
  "model-value": e.modelValue,
1184
1233
  "data-mode": "expression",
1185
1234
  source: e.source ?? null,
1186
1235
  disabled: e.disabled,
1187
- onInput: n[3] ||= (e) => r("input", e),
1188
- onChange: n[4] ||= (e) => r("change", e)
1236
+ onInput: n[4] ||= (e) => r("input", e),
1237
+ onChange: n[5] ||= (e) => r("change", e)
1189
1238
  }, null, 8, [
1190
1239
  "field",
1191
1240
  "model-value",
@@ -1196,15 +1245,15 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1196
1245
  field: e.field,
1197
1246
  "model-value": e.modelValue ?? "",
1198
1247
  "aria-label": e.field.label,
1199
- onInput: n[5] ||= (e) => r("input", e),
1200
- onChange: n[6] ||= (e) => r("change", e)
1248
+ onInput: n[6] ||= (e) => r("input", e),
1249
+ onChange: n[7] ||= (e) => r("change", e)
1201
1250
  }, null, 8, [
1202
1251
  "field",
1203
1252
  "model-value",
1204
1253
  "aria-label"
1205
1254
  ]));
1206
1255
  }
1207
- }), zt = [
1256
+ }), Jt = [
1208
1257
  "aria-label",
1209
1258
  "min",
1210
1259
  "max",
@@ -1257,9 +1306,9 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1257
1306
  onFocus: n[1] ||= (e) => a.value = !0,
1258
1307
  onBlur: l,
1259
1308
  onChange: l
1260
- }, null, 42, zt)), [[_e, i.value]]);
1309
+ }, null, 42, Jt)), [[_e, i.value]]);
1261
1310
  }
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({
1311
+ }), Yt = { class: "cn-padding flex w-full min-w-0 items-center gap-1.5" }, Xt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, Zt = /* @__PURE__ */ j({
1263
1312
  __name: "PaddingField",
1264
1313
  props: {
1265
1314
  field: {},
@@ -1267,7 +1316,7 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1267
1316
  },
1268
1317
  emits: ["input", "change"],
1269
1318
  setup(e, { emit: t }) {
1270
- let n = e, r = t, { mode: i, cycle: a } = it(() => n.modelValue, Qe), o = T(() => Xe[i.value]);
1319
+ let n = e, r = t, { mode: i, cycle: a } = ut(() => n.modelValue, it), o = T(() => nt[i.value]);
1271
1320
  function s(e) {
1272
1321
  return {
1273
1322
  key: ["padding", e.rep],
@@ -1283,18 +1332,18 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1283
1332
  function l() {
1284
1333
  let { from: e, to: t } = a();
1285
1334
  if (t < e) {
1286
- let e = $e(n.modelValue, t);
1287
- et(e, n.modelValue) || r("change", e);
1335
+ let e = at(n.modelValue, t);
1336
+ ot(e, n.modelValue) || r("change", e);
1288
1337
  }
1289
1338
  }
1290
- return (t, n) => (P(), O("span", Bt, [A(dt, {
1339
+ return (t, n) => (P(), O("span", Yt, [A(_t, {
1291
1340
  mode: z(i),
1292
1341
  label: "内边距",
1293
1342
  onCycle: l
1294
1343
  }, 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
1344
  key: t.rep,
1296
1345
  class: "flex min-w-0 items-center gap-1.5"
1297
- }, [k("span", Vt, R(t.label), 1), A($, {
1346
+ }, [k("span", Xt, R(t.label), 1), A($, {
1298
1347
  class: "min-w-0 flex-1",
1299
1348
  field: s(t),
1300
1349
  "model-value": e.modelValue[t.rep],
@@ -1307,16 +1356,16 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1307
1356
  "onChange"
1308
1357
  ])]))), 128))], 2)]));
1309
1358
  }
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 = [
1359
+ }), Qt = { class: "grid w-full min-w-0 grid-cols-2 gap-1" }, $t = ["title"], en = { class: "w-3.5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, tn = [
1311
1360
  "aria-pressed",
1312
1361
  "title",
1313
1362
  "onClick"
1314
- ], qt = [
1363
+ ], nn = [
1315
1364
  "aria-label",
1316
1365
  "value",
1317
1366
  "placeholder",
1318
1367
  "title"
1319
- ], Jt = /* @__PURE__ */ j({
1368
+ ], rn = /* @__PURE__ */ j({
1320
1369
  __name: "PairField",
1321
1370
  props: {
1322
1371
  field: {},
@@ -1372,12 +1421,12 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1372
1421
  let t = d(e);
1373
1422
  return t?.preview ? "模板子树:预览盒尺寸(随行实例变化,非文档声明值)" : t === void 0 ? `${e.label}自适应:已开启` : `${e.label}自适应:布局解析值(与画布选择框同源)`;
1374
1423
  }
1375
- return (e, t) => (P(), O("span", Ut, [(P(!0), O(w, null, I(i.value, (e) => (P(), O("label", {
1424
+ return (e, t) => (P(), O("span", Qt, [(P(!0), O(w, null, I(i.value, (e) => (P(), O("label", {
1376
1425
  key: e.key.join("."),
1377
1426
  class: "flex min-w-0 items-center gap-1",
1378
1427
  title: e.auto ? void 0 : e.label
1379
1428
  }, [
1380
- k("span", Gt, R(e.label), 1),
1429
+ k("span", en, R(e.label), 1),
1381
1430
  e.auto ? (P(), O("button", {
1382
1431
  key: 0,
1383
1432
  type: "button",
@@ -1385,7 +1434,7 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1385
1434
  "aria-pressed": a(e),
1386
1435
  title: p(e),
1387
1436
  onClick: V((t) => l(e), ["prevent"])
1388
- }, "自", 10, Kt)) : D("", !0),
1437
+ }, "自", 10, tn)) : D("", !0),
1389
1438
  a(e) ? (P(), O("input", {
1390
1439
  key: 2,
1391
1440
  class: N(["cn-field cn-field--number min-w-0 flex-1", [z(X), d(e)?.preview ? "cn-field--preview" : ""]]),
@@ -1395,7 +1444,7 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1395
1444
  value: f(e),
1396
1445
  placeholder: e.auto?.placeholder ?? "",
1397
1446
  title: m(e)
1398
- }, null, 10, qt)) : (P(), E($, {
1447
+ }, null, 10, nn)) : (P(), E($, {
1399
1448
  key: 1,
1400
1449
  class: "min-w-0 flex-1",
1401
1450
  field: e,
@@ -1408,9 +1457,9 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1408
1457
  "onInput",
1409
1458
  "onChange"
1410
1459
  ]))
1411
- ], 8, Wt))), 128))]));
1460
+ ], 8, $t))), 128))]));
1412
1461
  }
1413
- }), Yt = /* @__PURE__ */ j({
1462
+ }), an = /* @__PURE__ */ j({
1414
1463
  __name: "RowsPathField",
1415
1464
  props: {
1416
1465
  field: {},
@@ -1439,7 +1488,7 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1439
1488
  "aria-label"
1440
1489
  ]));
1441
1490
  }
1442
- }), Xt = ["value"], Zt = ["value"], Qt = /* @__PURE__ */ j({
1491
+ }), on = ["value"], sn = ["value"], cn = /* @__PURE__ */ j({
1443
1492
  __name: "SelectField",
1444
1493
  props: {
1445
1494
  field: {},
@@ -1455,12 +1504,12 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1455
1504
  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
1505
  value: e.modelValue,
1457
1506
  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));
1507
+ }, [(P(!0), O(w, null, I(e.field.domain ?? [], (t) => (P(), O("option", {
1508
+ key: t,
1509
+ value: t
1510
+ }, R(e.field.optionLabels?.[t] ?? t), 9, sn))), 128))], 40, on));
1462
1511
  }
1463
- }), $t = ["value", "disabled"], en = /* @__PURE__ */ j({
1512
+ }), ln = ["value", "disabled"], un = /* @__PURE__ */ j({
1464
1513
  __name: "TextareaField",
1465
1514
  props: {
1466
1515
  field: {},
@@ -1484,7 +1533,7 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1484
1533
  r = !1, n("change", e.target.value);
1485
1534
  }
1486
1535
  return (t, n) => (P(), O("textarea", {
1487
- class: N(["cn-field", z(ot)]),
1536
+ class: N(["cn-field", z(ft)]),
1488
1537
  rows: "3",
1489
1538
  value: e.modelValue,
1490
1539
  disabled: e.disabled,
@@ -1492,28 +1541,28 @@ var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1492
1541
  onCompositionstart: a,
1493
1542
  onCompositionend: o,
1494
1543
  onChange: s
1495
- }, null, 42, $t));
1544
+ }, null, 42, ln));
1496
1545
  }
1497
- }), tn = {
1546
+ }), dn = {
1498
1547
  number: M($),
1499
1548
  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)
1549
+ textarea: M(un),
1550
+ color: M(Ft),
1551
+ select: M(cn),
1552
+ boolean: M(tt),
1553
+ pair: M(rn),
1554
+ anchor: M(Qe),
1555
+ align: M(He),
1556
+ padding: M(Zt),
1557
+ border: M(Ct),
1558
+ font: M(kt),
1559
+ imageSrc: M(qt),
1560
+ resourceValue: M(Bt),
1561
+ rowsPath: M(an)
1513
1562
  };
1514
1563
  //#endregion
1515
1564
  //#region src/property-panel/usePropertyPanel.ts
1516
- function nn(e) {
1565
+ function fn(e) {
1517
1566
  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
1567
  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
1568
  });
@@ -1523,7 +1572,7 @@ function nn(e) {
1523
1572
  return e && r ? p(e, r) : null;
1524
1573
  }), l = T(() => t.value), u = T(() => {
1525
1574
  let e = c.value, r = n.value;
1526
- return e && r ? Ae(r, e) : t.value ? je : [];
1575
+ return e && r ? Fe(r, e) : t.value ? Ie : [];
1527
1576
  }), d = T(() => {
1528
1577
  let r = n.value;
1529
1578
  return r && t.value ? e.layerBoxAt(r) : null;
@@ -1610,14 +1659,14 @@ function nn(e) {
1610
1659
  }
1611
1660
  //#endregion
1612
1661
  //#region src/property-panel/fields/ValueTypeSegmented.vue?vue&type=script&setup=true&lang.ts
1613
- var rn = ["aria-disabled"], an = [
1662
+ var pn = ["aria-disabled"], mn = [
1614
1663
  "aria-pressed",
1615
1664
  "title",
1616
1665
  "data-mode-static",
1617
1666
  "data-mode-expression",
1618
1667
  "disabled",
1619
1668
  "onClick"
1620
- ], on = /* @__PURE__ */ j({
1669
+ ], hn = /* @__PURE__ */ j({
1621
1670
  __name: "ValueTypeSegmented",
1622
1671
  props: {
1623
1672
  mode: {},
@@ -1652,15 +1701,15 @@ var rn = ["aria-disabled"], an = [
1652
1701
  "data-mode-expression": t.value === "expression" || void 0,
1653
1702
  disabled: e.disabled,
1654
1703
  onClick: V((e) => a(t.value), ["prevent"])
1655
- }, R(t.label), 11, an)), 64))], 10, rn));
1704
+ }, R(t.label), 11, mn)), 64))], 10, pn));
1656
1705
  }
1657
- }), sn = ["title"], cn = {
1706
+ }), gn = ["title"], _n = {
1658
1707
  key: 2,
1659
1708
  class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
1660
- }, ln = ["title"], un = {
1709
+ }, vn = ["title"], yn = {
1661
1710
  key: 4,
1662
1711
  class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
1663
- }, dn = /* @__PURE__ */ j({
1712
+ }, bn = /* @__PURE__ */ j({
1664
1713
  __name: "PropertyField",
1665
1714
  props: {
1666
1715
  field: {},
@@ -1680,7 +1729,7 @@ var rn = ["aria-disabled"], an = [
1680
1729
  "sub-commit"
1681
1730
  ],
1682
1731
  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");
1732
+ let n = e, r = t, i = T(() => dn[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
1733
  function _() {
1685
1734
  let e = f.value[0], t = d.value?.$el;
1686
1735
  e !== void 0 && (t instanceof HTMLTextAreaElement || t instanceof HTMLInputElement) && (t.focus(), t.setSelectionRange(e.at.start, e.at.end));
@@ -1705,8 +1754,8 @@ var rn = ["aria-disabled"], an = [
1705
1754
  key: 0,
1706
1755
  class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted",
1707
1756
  title: e.field.title
1708
- }, R(e.field.label), 9, sn)),
1709
- e.field.data ? (P(), E(on, {
1757
+ }, R(e.field.label), 9, gn)),
1758
+ e.field.data ? (P(), E(hn, {
1710
1759
  key: 1,
1711
1760
  class: "justify-self-end",
1712
1761
  mode: e.dataMode ?? "static",
@@ -1740,14 +1789,14 @@ var rn = ["aria-disabled"], an = [
1740
1789
  "source",
1741
1790
  "resource-status"
1742
1791
  ])),
1743
- e.hint ? (P(), O("span", cn, R(e.hint), 1)) : D("", !0),
1792
+ e.hint ? (P(), O("span", _n, R(e.hint), 1)) : D("", !0),
1744
1793
  p.value ? (P(), O("span", {
1745
1794
  key: 3,
1746
1795
  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
1796
  title: g.value ? "点击选中出错片段" : void 0,
1748
1797
  onClick: _
1749
- }, R(p.value), 11, ln)) : D("", !0),
1750
- m.value ? (P(), O("span", un, R(m.value), 1)) : D("", !0)
1798
+ }, R(p.value), 11, vn)) : D("", !0),
1799
+ m.value ? (P(), O("span", yn, R(m.value), 1)) : D("", !0)
1751
1800
  ]),
1752
1801
  _: 1
1753
1802
  }, 8, ["class"])), c.value ? (P(), E(ae, {
@@ -1758,14 +1807,14 @@ var rn = ["aria-disabled"], an = [
1758
1807
  onSelect: z(S)
1759
1808
  }, null, 8, ["state", "onSelect"])) : D("", !0)], 64));
1760
1809
  }
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 = {
1810
+ }), xn = { 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)]" }, Sn = { 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" }, Cn = { class: "flex items-center gap-2" }, wn = { 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" }, Tn = { class: "text-[12px] font-medium tracking-wide text-cn-fg/90" }, En = {
1762
1811
  key: 0,
1763
1812
  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({
1813
+ }, Dn = { class: "cn-props__section-title mb-2 text-[10px] font-semibold uppercase tracking-[0.16em] text-cn-muted" }, On = { class: "flex flex-col gap-2" }, kn = "内容编辑中:请在画布编辑框内修改,退出后此处更新", An = /* @__PURE__ */ j({
1765
1814
  __name: "PropertyPanel",
1766
1815
  props: { editor: {} },
1767
1816
  setup(e) {
1768
- let t = e, n = nn(t.editor);
1817
+ let t = e, n = fn(t.editor);
1769
1818
  he(Z, {
1770
1819
  canUpload: t.editor.canUpload,
1771
1820
  uploadImage: (e) => t.editor.uploadImage(e)
@@ -1777,7 +1826,7 @@ var rn = ["aria-disabled"], an = [
1777
1826
  let e = n.layer.value;
1778
1827
  return e ? e.type : n.canvas.value ? "Canvas" : "—";
1779
1828
  }), o = T(() => {
1780
- let e = n.layer.value ?? (n.selection.value ? null : Me(n.canvas.value));
1829
+ let e = n.layer.value === null ? n.selection.value ? null : Le(n.canvas.value) : Re(n.layer.value);
1781
1830
  if (!e) return [];
1782
1831
  let t = n.selection.value?.join(".") ?? "canvas", r = n.layer.value, i = n.resourceStatuses.value, a = [];
1783
1832
  for (let o of n.sections.value) {
@@ -1792,7 +1841,7 @@ var rn = ["aria-disabled"], an = [
1792
1841
  value: o.value,
1793
1842
  dataMode: a.data ? n.isDataMarked(a) ? "expression" : "static" : void 0,
1794
1843
  locked: c,
1795
- hint: c ? bn : a.hint && r ? a.hint(r, i) ?? void 0 : void 0,
1844
+ hint: c ? kn : a.hint && r ? a.hint(r, i) ?? void 0 : void 0,
1796
1845
  resourceStatus: a.control === "imageSrc" && typeof o.value == "string" && o.value !== "" ? i[o.value] : void 0,
1797
1846
  drifted: a.control === "rowsPath" ? n.rowsPathDrifted.value : void 0
1798
1847
  });
@@ -1820,16 +1869,16 @@ var rn = ["aria-disabled"], an = [
1820
1869
  function c() {
1821
1870
  n.setAnchorExpanded(!n.anchorExpanded.value);
1822
1871
  }
1823
- return (e, t) => (P(), O("aside", fn, [
1824
- k("header", pn, [k("div", mn, [k("span", hn, [t[0] ||= k("i", {
1872
+ return (e, t) => (P(), O("aside", xn, [
1873
+ k("header", Sn, [k("div", Cn, [k("span", wn, [t[0] ||= k("i", {
1825
1874
  class: "size-1.5 rounded-full bg-cn-accent",
1826
1875
  "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),
1876
+ }, null, -1), de(" " + R(a.value), 1)]), k("span", Tn, R(i.value ? "图层属性" : "画布属性"), 1)])]),
1877
+ o.value.length === 0 ? (P(), O("p", En, " 打开文档后可编辑属性 ")) : D("", !0),
1829
1878
  (P(!0), O(w, null, I(o.value, (e) => (P(), O("section", {
1830
1879
  key: e.title,
1831
1880
  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, {
1881
+ }, [k("h3", Dn, R(e.title), 1), k("div", On, [(P(!0), O(w, null, I(e.fields, (e) => (P(), O(w, { key: e.key }, [e.field.control === "anchor" ? (P(), E(Qe, {
1833
1882
  key: 0,
1834
1883
  field: e.field,
1835
1884
  "model-value": e.value,
@@ -1841,7 +1890,7 @@ var rn = ["aria-disabled"], an = [
1841
1890
  "model-value",
1842
1891
  "expanded",
1843
1892
  "onChange"
1844
- ])) : (P(), E(dn, {
1893
+ ])) : (P(), E(bn, {
1845
1894
  key: 1,
1846
1895
  field: e.field,
1847
1896
  value: e.value,
@@ -1875,4 +1924,4 @@ var rn = ["aria-disabled"], an = [
1875
1924
  }
1876
1925
  });
1877
1926
  //#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 };
1927
+ export { Z as a, je as c, Ne as d, q as f, dn as i, Fe as l, bn as n, It as o, fn as r, Ie as s, An as t, Me as u };