@hankchen/canvas-editor-vue 0.8.0 → 2.1.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.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g } from "./canvas-DuvO27sj.js";
2
2
  import { a as _, c as v, i as y, l as b, n as x, o as S, r as C, s as w, t as T } from "./layer-panel-BouAYiDq.js";
3
- import { a as E, c as D, d as O, f as k, i as A, l as j, n as M, o as N, r as P, s as F, t as I, u as L } from "./property-panel-BkfqRva4.js";
3
+ import { a as E, c as D, d as O, f as k, i as A, l as j, n as M, o as N, r as P, s as F, t as I, u as L } from "./property-panel-CwdTufiP.js";
4
4
  import { a as R, c as z, i as B, n as V, o as H, r as U, s as W, t as G } from "./ExpressionPathPicker-DchGsK70.js";
5
5
  import { n as K, t as q } from "./resourceTemplate-D-DKEo7Z.js";
6
6
  import { a as J, d as Y, i as X, n as Z, o as Q, s as $, t as ee, u as te } from "./useTransientFeedback-BN_O7V2w.js";
@@ -123,8 +123,10 @@ export declare const EMPTY_CANVAS_BACKGROUND: CanvasBackground;
123
123
  /**
124
124
  * 图层级读取视图(image-fit 工单 05,canvasFieldTarget 同门):ImageLayer 的 fit
125
125
  * 缺省态(wire 无键 = cover)投影为 cover——适配字段否则被 readField 的 ok:false
126
- * 过滤掉,选中任一未声明的图片层「适配」行即消失。已声明(含未知值)与非图片层
127
- * 原样透传(不拷贝不重整);投影只作用读侧,提交仍走 updateSpec 直写文档
126
+ * 过滤掉,选中任一未声明的图片层「适配」行即消失;裁剪形状同门(image-clip-shape
127
+ * 工票 05,ADR 0026):clip 缺省态(wire 无键 = rect)投影为 rect 回显。已声明
128
+ * (含未知值)与非图片层原样透传(不拷贝不重整);投影只作用读侧,提交仍走
129
+ * updateSpec 直写文档(显式 rect/cover 落领域值,wire 归一不落键归核心 encode)
128
130
  */
129
131
  export declare function layerFieldTarget(layer: Layer): Layer;
130
132
  export type FieldReadResult = {
@@ -200,29 +200,49 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
200
200
  control: "boolean"
201
201
  }
202
202
  ]
203
- }, De = "cover", Oe = "contain", ke = {
203
+ }, De = "cover", Oe = "contain", ke = "fill", Ae = "tile", je = "rect", Me = "circle", Ne = {
204
204
  ImageLayer: [
205
205
  H,
206
206
  U,
207
207
  W,
208
208
  {
209
209
  title: "图片",
210
- fields: [{
211
- key: ["src"],
212
- label: "资源地址",
213
- control: "imageSrc",
214
- data: !0,
215
- resource: !0
216
- }, {
217
- key: ["fit"],
218
- label: "适配",
219
- control: "select",
220
- domain: [De, Oe],
221
- optionLabels: {
222
- [De]: "铺满裁切",
223
- [Oe]: "完整显示"
210
+ fields: [
211
+ {
212
+ key: ["src"],
213
+ label: "资源地址",
214
+ control: "imageSrc",
215
+ data: !0,
216
+ resource: !0
217
+ },
218
+ {
219
+ key: ["fit"],
220
+ label: "适配",
221
+ control: "select",
222
+ domain: [
223
+ De,
224
+ Oe,
225
+ ke,
226
+ Ae
227
+ ],
228
+ optionLabels: {
229
+ [De]: "铺满裁切",
230
+ [Oe]: "完整显示",
231
+ [ke]: "拉伸铺满",
232
+ [Ae]: "平铺"
233
+ }
234
+ },
235
+ {
236
+ key: ["clip"],
237
+ label: "裁剪形状",
238
+ control: "select",
239
+ domain: [je, Me],
240
+ optionLabels: {
241
+ [je]: "矩形",
242
+ [Me]: "圆形"
243
+ }
224
244
  }
225
- }]
245
+ ]
226
246
  }
227
247
  ],
228
248
  TextLayer: [
@@ -285,15 +305,15 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
285
305
  }]
286
306
  }]
287
307
  };
288
- function Ae(e) {
289
- return ke[e] ?? [];
308
+ function Pe(e) {
309
+ return Ne[e] ?? [];
290
310
  }
291
- function je(e) {
311
+ function Fe(e) {
292
312
  if (e[e.length - 1] === "content") return h(e) ? "templateContent" : "content";
293
313
  let t = e[e.length - 2];
294
314
  return t === "rows" ? "row" : t === "cells" ? "cell" : "root";
295
315
  }
296
- var Me = {
316
+ var Ie = {
297
317
  root: [],
298
318
  cell: [],
299
319
  row: ["shape.width", "shape.autoWidth"],
@@ -308,9 +328,9 @@ var Me = {
308
328
  function G(e, t) {
309
329
  return [...e.key, ...t.key];
310
330
  }
311
- function K(e, t) {
312
- let n = new Set(Me[je(e)]), r = [];
313
- for (let e of Ae(t.type)) {
331
+ function Le(e, t) {
332
+ let n = new Set(Ie[Fe(e)]), r = [];
333
+ for (let e of Pe(t.type)) {
314
334
  let i = [];
315
335
  for (let r of e.fields) {
316
336
  if (r.items) {
@@ -330,7 +350,7 @@ function K(e, t) {
330
350
  }
331
351
  return r;
332
352
  }
333
- var Ne = [{
353
+ var Re = [{
334
354
  title: "画布",
335
355
  fields: [{
336
356
  key: ["width"],
@@ -358,23 +378,24 @@ var Ne = [{
358
378
  control: "imageSrc"
359
379
  }]
360
380
  }];
361
- function Pe(e) {
381
+ function ze(e) {
362
382
  return e === null ? null : e.background === null ? {
363
383
  ...e,
364
- background: Fe
384
+ background: Be
365
385
  } : e;
366
386
  }
367
- var Fe = {
387
+ var Be = {
368
388
  color: null,
369
389
  image: null
370
390
  };
371
- function Ie(e) {
372
- return e.type === "ImageLayer" && e.fit === void 0 ? {
391
+ function Ve(e) {
392
+ return e.type === "ImageLayer" && (e.fit === void 0 || e.clip === void 0) ? {
373
393
  ...e,
374
- fit: "cover"
394
+ ...e.fit === void 0 ? { fit: "cover" } : {},
395
+ ...e.clip === void 0 ? { clip: "rect" } : {}
375
396
  } : e;
376
397
  }
377
- function q(e, t) {
398
+ function K(e, t) {
378
399
  let n = e;
379
400
  for (let e = 0; e < t.length; e += 1) {
380
401
  if (typeof n != "object" || !n) return { ok: !1 };
@@ -387,14 +408,14 @@ function q(e, t) {
387
408
  }
388
409
  //#endregion
389
410
  //#region src/property-panel/fields/AlignField.vue?vue&type=script&setup=true&lang.ts
390
- var Le = ["aria-label"], Re = [
411
+ var He = ["aria-label"], Ue = [
391
412
  "aria-pressed",
392
413
  "title",
393
414
  "onClick"
394
- ], ze = {
415
+ ], We = {
395
416
  key: 1,
396
417
  class: "truncate px-1 text-[10px] leading-none"
397
- }, Be = /* @__PURE__ */ j({
418
+ }, Ge = /* @__PURE__ */ j({
398
419
  __name: "AlignField",
399
420
  props: {
400
421
  field: {},
@@ -456,28 +477,28 @@ var Le = ["aria-label"], Re = [
456
477
  }, [t.icon ? (P(), E(g, {
457
478
  key: 0,
458
479
  icon: t.icon
459
- }, null, 8, ["icon"])) : (P(), O("span", ze, R(t.value), 1))], 10, Re))), 128))], 8, Le));
480
+ }, null, 8, ["icon"])) : (P(), O("span", We, R(t.value), 1))], 10, Ue))), 128))], 8, He));
460
481
  }
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 = {
482
+ }), Ke = { class: "block" }, qe = ["aria-expanded", "title"], Je = { class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted" }, Ye = { class: "flex shrink-0 items-center gap-1.5" }, Xe = {
462
483
  viewBox: "0 0 24 24",
463
484
  class: "size-3.5",
464
485
  "aria-hidden": "true"
465
- }, Ke = [
486
+ }, Ze = [
466
487
  "cx",
467
488
  "cy",
468
489
  "r"
469
- ], qe = {
490
+ ], Qe = {
470
491
  key: 0,
471
492
  class: "mt-2 flex justify-end"
472
- }, Je = {
493
+ }, $e = {
473
494
  class: "cn-anchor grid w-[66px] shrink-0 grid-cols-3 gap-[3px]",
474
495
  role: "group",
475
496
  "aria-label": "九宫锚点"
476
- }, Ye = [
497
+ }, et = [
477
498
  "aria-pressed",
478
499
  "title",
479
500
  "onClick"
480
- ], Xe = /* @__PURE__ */ j({
501
+ ], tt = /* @__PURE__ */ j({
481
502
  __name: "AnchorDisclosureField",
482
503
  props: {
483
504
  field: {},
@@ -497,31 +518,31 @@ var Le = ["aria-label"], Re = [
497
518
  function s(e) {
498
519
  r("change", e);
499
520
  }
500
- return (t, n) => (P(), O("span", Ve, [k("button", {
521
+ return (t, n) => (P(), O("span", Ke, [k("button", {
501
522
  type: "button",
502
523
  class: "cn-anchor-disclosure__header flex w-full items-center justify-between gap-2",
503
524
  "aria-expanded": e.expanded,
504
525
  title: e.expanded ? "收起锚点" : `锚点:${e.modelValue}(点击展开调整)`,
505
526
  onClick: n[0] ||= (e) => r("toggle")
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", {
527
+ }, [k("span", Je, R(e.field.label), 1), k("span", Ye, [(P(), O("svg", Xe, [(P(!0), O(w, null, I(z(a), (e) => (P(), O("circle", {
507
528
  key: e.index,
508
529
  cx: e.cx,
509
530
  cy: e.cy,
510
531
  r: e.index === o.value ? 3.2 : 2.2,
511
532
  class: N(e.index === o.value ? "fill-cn-accent" : "fill-cn-muted/35")
512
- }, null, 10, Ke))), 128))])), A(g, {
533
+ }, null, 10, Ze))), 128))])), A(g, {
513
534
  icon: z(u),
514
535
  class: N(["text-cn-muted transition-transform duration-150", { "rotate-180": e.expanded }])
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", {
536
+ }, null, 8, ["icon", "class"])])], 8, qe), e.expanded ? (P(), O("span", Qe, [k("span", $e, [(P(!0), O(w, null, I(z(i), (t) => (P(), O("button", {
516
537
  key: t,
517
538
  type: "button",
518
539
  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"]),
519
540
  "aria-pressed": t === e.modelValue,
520
541
  title: t,
521
542
  onClick: (e) => s(t)
522
- }, null, 10, Ye))), 128))])])) : D("", !0)]));
543
+ }, null, 10, et))), 128))])])) : D("", !0)]));
523
544
  }
524
- }), Ze = { class: "cn-bool relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center" }, Qe = ["checked"], $e = /* @__PURE__ */ j({
545
+ }), nt = { class: "cn-bool relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center" }, rt = ["checked"], it = /* @__PURE__ */ j({
525
546
  __name: "BooleanField",
526
547
  props: {
527
548
  field: {},
@@ -535,7 +556,7 @@ var Le = ["aria-label"], Re = [
535
556
  }
536
557
  return ve(() => {
537
558
  i.value && (i.value.checked = n.modelValue);
538
- }), (t, n) => (P(), O("label", Ze, [
559
+ }), (t, n) => (P(), O("label", nt, [
539
560
  k("input", {
540
561
  ref_key: "inputRef",
541
562
  ref: i,
@@ -543,12 +564,12 @@ var Le = ["aria-label"], Re = [
543
564
  type: "checkbox",
544
565
  checked: e.modelValue,
545
566
  onChange: a
546
- }, null, 40, Qe),
567
+ }, null, 40, rt),
547
568
  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),
548
569
  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)
549
570
  ]));
550
571
  }
551
- }), et = {
572
+ }), at = {
552
573
  1: [{
553
574
  label: "四边",
554
575
  rep: "top",
@@ -591,13 +612,13 @@ var Le = ["aria-label"], Re = [
591
612
  }
592
613
  ]
593
614
  };
594
- function tt(e) {
615
+ function ot(e) {
595
616
  return e === 1 ? 2 : e === 2 ? 4 : 1;
596
617
  }
597
- function nt(e) {
618
+ function st(e) {
598
619
  return e.top === e.bottom && e.bottom === e.left && e.left === e.right ? 1 : e.top === e.bottom && e.left === e.right ? 2 : 4;
599
620
  }
600
- function rt(e, t) {
621
+ function ct(e, t) {
601
622
  if (t === 1) {
602
623
  let { top: t } = e;
603
624
  return {
@@ -618,17 +639,17 @@ function rt(e, t) {
618
639
  }
619
640
  return e;
620
641
  }
621
- function it(e, t) {
642
+ function lt(e, t) {
622
643
  return e.top === t.top && e.bottom === t.bottom && e.left === t.left && e.right === t.right;
623
644
  }
624
- function J(e, t) {
645
+ function q(e, t) {
625
646
  return e === null || t === null ? e === t : e.width === t.width && e.color === t.color;
626
647
  }
627
- function at(e) {
648
+ function ut(e) {
628
649
  let { top: t, bottom: n, left: r, right: i } = e;
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;
650
+ return t === null && n === null && r === null && i === null || t !== null && q(t, n) && q(t, r) && q(t, i) ? 1 : q(t, n) && q(r, i) ? 2 : 4;
630
651
  }
631
- function ot(e, t) {
652
+ function dt(e, t) {
632
653
  let n = (e) => e === null ? null : { ...e };
633
654
  if (t === 1) {
634
655
  let t = n(e.top);
@@ -650,18 +671,18 @@ function ot(e, t) {
650
671
  }
651
672
  return e;
652
673
  }
653
- function st(e, t) {
654
- return J(e.top, t.top) && J(e.bottom, t.bottom) && J(e.left, t.left) && J(e.right, t.right);
674
+ function ft(e, t) {
675
+ return q(e.top, t.top) && q(e.bottom, t.bottom) && q(e.left, t.left) && q(e.right, t.right);
655
676
  }
656
677
  //#endregion
657
678
  //#region src/property-panel/useShorthandMode.ts
658
- function ct(e, t) {
679
+ function pt(e, t) {
659
680
  let n = T(() => t(e())), r = F(null), i = T(() => r.value ?? n.value);
660
681
  B(e, () => {
661
682
  r.value = null;
662
683
  });
663
684
  function a() {
664
- let e = i.value, t = tt(e);
685
+ let e = i.value, t = ot(e);
665
686
  return r.value = t, {
666
687
  from: e,
667
688
  to: t
@@ -674,7 +695,7 @@ function ct(e, t) {
674
695
  }
675
696
  //#endregion
676
697
  //#region src/property-panel/controlStyles.ts
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({
698
+ var J = "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", Y = `${J} text-right font-mono tabular-nums`, mt = J, ht = "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", gt = "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", _t = ["aria-label"], vt = /* @__PURE__ */ j({
678
699
  __name: "BorderWidthInput",
679
700
  props: {
680
701
  value: {},
@@ -714,7 +735,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
714
735
  }
715
736
  return (t, n) => be((P(), O("input", {
716
737
  "onUpdate:modelValue": n[0] ||= (e) => i.value = e,
717
- class: N(["cn-field cn-field--number min-w-0 flex-1", z(X)]),
738
+ class: N(["cn-field cn-field--number min-w-0 flex-1", z(Y)]),
718
739
  type: "number",
719
740
  "aria-label": e.label,
720
741
  min: 0,
@@ -725,9 +746,9 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
725
746
  onFocus: n[1] ||= (e) => a.value = !0,
726
747
  onBlur: u,
727
748
  onChange: u
728
- }, null, 42, ft)), [[_e, i.value]]);
749
+ }, null, 42, _t)), [[_e, i.value]]);
729
750
  }
730
- }), mt = ["aria-label", "title"], ht = /* @__PURE__ */ j({
751
+ }), yt = ["aria-label", "title"], X = /* @__PURE__ */ j({
731
752
  __name: "ShorthandModeButton",
732
753
  props: {
733
754
  mode: {},
@@ -758,14 +779,14 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
758
779
  }, [A(g, {
759
780
  icon: a.value.icon,
760
781
  size: 12
761
- }, null, 8, ["icon"])], 8, mt));
782
+ }, null, 8, ["icon"])], 8, yt));
762
783
  }
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 = [
784
+ }), bt = { class: "cn-border flex w-full min-w-0 items-center gap-1" }, xt = { class: "grid min-w-0 flex-1 gap-1 grid-cols-1" }, St = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, Ct = [
764
785
  "value",
765
786
  "disabled",
766
787
  "onInput",
767
788
  "onChange"
768
- ], bt = "#000000", xt = /* @__PURE__ */ j({
789
+ ], wt = "#000000", Tt = /* @__PURE__ */ j({
769
790
  __name: "BorderField",
770
791
  props: {
771
792
  field: {},
@@ -773,12 +794,12 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
773
794
  },
774
795
  emits: ["input", "change"],
775
796
  setup(e, { emit: t }) {
776
- let n = e, r = t, { mode: i, cycle: a } = ct(() => n.modelValue, at), o = T(() => et[i.value]);
797
+ let n = e, r = t, { mode: i, cycle: a } = pt(() => n.modelValue, ut), o = T(() => at[i.value]);
777
798
  function s(e) {
778
799
  return n.modelValue[e.rep]?.width ?? null;
779
800
  }
780
801
  function c(e) {
781
- return n.modelValue[e.rep]?.color ?? bt;
802
+ return n.modelValue[e.rep]?.color ?? wt;
782
803
  }
783
804
  function l(e, t, i) {
784
805
  let a = { ...n.modelValue };
@@ -786,7 +807,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
786
807
  r(i ? "change" : "input", a);
787
808
  }
788
809
  function u(e, t, r) {
789
- let i = n.modelValue[e.rep]?.color ?? bt;
810
+ let i = n.modelValue[e.rep]?.color ?? wt;
790
811
  l(e, t <= 0 ? null : {
791
812
  width: t,
792
813
  color: i
@@ -804,20 +825,20 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
804
825
  function f() {
805
826
  let { from: e, to: t } = a();
806
827
  if (t < e) {
807
- let e = ot(n.modelValue, t);
808
- st(e, n.modelValue) || r("change", e);
828
+ let e = dt(n.modelValue, t);
829
+ ft(e, n.modelValue) || r("change", e);
809
830
  }
810
831
  }
811
- return (t, n) => (P(), O("span", gt, [A(ht, {
832
+ return (t, n) => (P(), O("span", bt, [A(X, {
812
833
  mode: z(i),
813
834
  label: "边框",
814
835
  onCycle: f
815
- }, null, 8, ["mode"]), k("span", _t, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
836
+ }, null, 8, ["mode"]), k("span", xt, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
816
837
  key: t.rep,
817
838
  class: "flex items-center gap-1.5"
818
839
  }, [
819
- k("span", vt, R(t.label), 1),
820
- A(pt, {
840
+ k("span", St, R(t.label), 1),
841
+ A(vt, {
821
842
  class: "cn-border__width",
822
843
  value: s(t),
823
844
  label: t.label,
@@ -837,17 +858,17 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
837
858
  disabled: e.modelValue[t.rep] === null,
838
859
  onInput: (e) => d(t, e, !1),
839
860
  onChange: (e) => d(t, e, !0)
840
- }, null, 40, yt)
861
+ }, null, 40, Ct)
841
862
  ]))), 128))])]));
842
863
  }
843
- }), St = ["value"], Ct = {
864
+ }), Et = ["value"], Dt = {
844
865
  key: 1,
845
866
  class: "flex flex-1 items-center gap-1.5"
846
- }, wt = ["value"], Tt = ["value"], Et = [
867
+ }, Ot = ["value"], kt = ["value"], At = [
847
868
  "disabled",
848
869
  "title",
849
870
  "data-upload-error"
850
- ], Dt = /* @__PURE__ */ j({
871
+ ], jt = /* @__PURE__ */ j({
851
872
  __name: "FontField",
852
873
  props: {
853
874
  field: {},
@@ -910,22 +931,22 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
910
931
  }
911
932
  return (t, n) => z(i) === null ? (P(), O("input", {
912
933
  key: 0,
913
- class: N(["cn-field", z(lt)]),
934
+ class: N(["cn-field", z(mt)]),
914
935
  type: "text",
915
936
  value: e.modelValue,
916
937
  onInput: l,
917
938
  onCompositionstart: u,
918
939
  onCompositionend: d,
919
940
  onChange: f
920
- }, null, 42, St)) : (P(), O("div", Ct, [
941
+ }, null, 42, Et)) : (P(), O("div", Dt, [
921
942
  k("select", {
922
- class: N(["cn-field cn-select", z(Y)]),
943
+ class: N(["cn-field cn-select", z(J)]),
923
944
  value: e.modelValue,
924
945
  onChange: s
925
946
  }, [(P(!0), O(w, null, I(a.value, (e) => (P(), O("option", {
926
947
  key: e.value,
927
948
  value: e.value
928
- }, R(e.label), 9, Tt))), 128))], 42, wt),
949
+ }, R(e.label), 9, kt))), 128))], 42, Ot),
929
950
  k("input", {
930
951
  ref_key: "fileInput",
931
952
  ref: h,
@@ -942,10 +963,10 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
942
963
  title: m.value ?? "上传本机字体(加入清单后可选)",
943
964
  "data-upload-error": m.value ?? void 0,
944
965
  onClick: g
945
- }, R(p.value ? "…" : m.value ? "!" : "上传"), 9, Et)) : D("", !0)
966
+ }, R(p.value ? "…" : m.value ? "!" : "上传"), 9, At)) : D("", !0)
946
967
  ]));
947
968
  }
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({
969
+ }), Mt = { class: "cn-color flex min-w-0 flex-1 items-center gap-1.5" }, Nt = ["checked"], Pt = ["value", "disabled"], Ft = ["value", "disabled"], It = "#000000", Lt = /* @__PURE__ */ j({
949
970
  __name: "ColorField",
950
971
  props: {
951
972
  field: {},
@@ -958,7 +979,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
958
979
  i.value = e !== null, i.value && (a.value = o(e));
959
980
  });
960
981
  function o(e) {
961
- return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e : Mt;
982
+ return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e : It;
962
983
  }
963
984
  function s(e) {
964
985
  let t = e.target.checked;
@@ -985,7 +1006,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
985
1006
  }
986
1007
  a.value = o(t), r("change", t);
987
1008
  }
988
- return (t, n) => (P(), O("span", Ot, [
1009
+ return (t, n) => (P(), O("span", Mt, [
989
1010
  e.field.nullable ? (P(), O("input", {
990
1011
  key: 0,
991
1012
  class: "cn-color__toggle size-3.5 shrink-0 cursor-pointer accent-cn-accent",
@@ -993,43 +1014,43 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
993
1014
  title: "启用颜色",
994
1015
  checked: i.value,
995
1016
  onChange: s
996
- }, null, 40, kt)) : D("", !0),
1017
+ }, null, 40, Nt)) : D("", !0),
997
1018
  k("input", {
998
- class: N(["cn-color__swatch", z(dt)]),
1019
+ class: N(["cn-color__swatch", z(gt)]),
999
1020
  type: "color",
1000
1021
  value: a.value,
1001
1022
  disabled: !i.value,
1002
1023
  onInput: c,
1003
1024
  onChange: l
1004
- }, null, 42, At),
1025
+ }, null, 42, Pt),
1005
1026
  k("input", {
1006
- class: N(["cn-color__text min-w-0 flex-1", z(Y)]),
1027
+ class: N(["cn-color__text min-w-0 flex-1", z(J)]),
1007
1028
  type: "text",
1008
1029
  value: e.modelValue ?? "",
1009
1030
  disabled: !i.value,
1010
1031
  placeholder: "无",
1011
1032
  onChange: u
1012
- }, null, 42, jt)
1033
+ }, null, 42, Ft)
1013
1034
  ]));
1014
1035
  }
1015
1036
  }), Z = Symbol("canvas-image-upload");
1016
- function Pt() {
1037
+ function Rt() {
1017
1038
  return fe(Z, null);
1018
1039
  }
1019
1040
  //#endregion
1020
1041
  //#region src/property-panel/fields/intrinsicSize.ts
1021
- function Ft(e, t) {
1042
+ function zt(e, t) {
1022
1043
  let n = e, r = t;
1023
1044
  for (; r !== 0;) [n, r] = [r, n % r];
1024
1045
  let i = e / n, a = t / n;
1025
1046
  return Math.max(i, a) <= 32 ? `${i}:${a}` : `${Math.round(e / t * 100) / 100}:1`;
1026
1047
  }
1027
- function It(e, t) {
1028
- return !Number.isFinite(e) || !Number.isFinite(t) || e <= 0 || t <= 0 ? null : `${e}×${t} · ${Ft(e, t)}`;
1048
+ function Bt(e, t) {
1049
+ return !Number.isFinite(e) || !Number.isFinite(t) || e <= 0 || t <= 0 ? null : `${e}×${t} · ${zt(e, t)}`;
1029
1050
  }
1030
1051
  //#endregion
1031
1052
  //#region src/property-panel/fields/TextField.vue?vue&type=script&setup=true&lang.ts
1032
- var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1053
+ var Vt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1033
1054
  __name: "TextField",
1034
1055
  props: {
1035
1056
  field: {},
@@ -1059,7 +1080,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1059
1080
  o(t) || r("change", t);
1060
1081
  }
1061
1082
  return (t, n) => (P(), O("input", {
1062
- class: N(["cn-field", [z(lt), a.value ? "cn-field--invalid" : ""]]),
1083
+ class: N(["cn-field", [z(mt), a.value ? "cn-field--invalid" : ""]]),
1063
1084
  type: "text",
1064
1085
  value: e.modelValue,
1065
1086
  placeholder: e.field.placeholder,
@@ -1067,9 +1088,9 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1067
1088
  onCompositionstart: c,
1068
1089
  onCompositionend: l,
1069
1090
  onChange: u
1070
- }, null, 42, Lt));
1091
+ }, null, 42, Vt));
1071
1092
  }
1072
- }), Rt = /* @__PURE__ */ j({
1093
+ }), Ht = /* @__PURE__ */ j({
1073
1094
  __name: "ResourceValueField",
1074
1095
  props: {
1075
1096
  field: {},
@@ -1116,20 +1137,20 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1116
1137
  "disabled"
1117
1138
  ]));
1118
1139
  }
1119
- }), zt = {
1140
+ }), Ut = {
1120
1141
  key: 0,
1121
1142
  class: "flex flex-col gap-1.5"
1122
- }, Bt = [
1143
+ }, Wt = [
1123
1144
  "disabled",
1124
1145
  "title",
1125
1146
  "data-upload-error"
1126
- ], Vt = ["src"], Ht = {
1147
+ ], Gt = ["src"], Kt = {
1127
1148
  key: 2,
1128
1149
  class: "relative"
1129
- }, Ut = { class: "flex items-center gap-1.5" }, Wt = {
1150
+ }, qt = { class: "flex items-center gap-1.5" }, Jt = {
1130
1151
  key: 0,
1131
1152
  class: "cn-imagesrc__intrinsic text-[11px] leading-4 text-cn-muted"
1132
- }, Gt = /* @__PURE__ */ j({
1153
+ }, Yt = /* @__PURE__ */ j({
1133
1154
  __name: "ImageSrcField",
1134
1155
  props: {
1135
1156
  field: {},
@@ -1141,7 +1162,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1141
1162
  },
1142
1163
  emits: ["input", "change"],
1143
1164
  setup(e, { emit: t }) {
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));
1165
+ let n = e, r = t, i = Rt(), 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 : Bt(d.value.width, d.value.height));
1145
1166
  function p(e) {
1146
1167
  let t = e.target;
1147
1168
  d.value = t.naturalWidth > 0 && t.naturalHeight > 0 ? {
@@ -1169,7 +1190,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1169
1190
  }
1170
1191
  }
1171
1192
  }
1172
- return (t, n) => a.value ? (P(), O("div", zt, [
1193
+ return (t, n) => a.value ? (P(), O("div", Ut, [
1173
1194
  k("button", {
1174
1195
  type: "button",
1175
1196
  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",
@@ -1185,13 +1206,13 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1185
1206
  alt: "",
1186
1207
  onLoad: p,
1187
1208
  onError: n[0] ||= (e) => d.value = null
1188
- }, null, 40, Vt)) : D("", !0),
1209
+ }, null, 40, Gt)) : D("", !0),
1189
1210
  s.value ? (P(), O("span", {
1190
1211
  key: 1,
1191
1212
  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"])
1192
1213
  }, R(s.value), 3)) : D("", !0),
1193
- o.value ? D("", !0) : (P(), O("span", Ht, R(c.value ? "…" : l.value ? "!" : "点击上传图片"), 1))
1194
- ], 8, Bt),
1214
+ o.value ? D("", !0) : (P(), O("span", Kt, R(c.value ? "…" : l.value ? "!" : "点击上传图片"), 1))
1215
+ ], 8, Wt),
1195
1216
  k("input", {
1196
1217
  ref_key: "fileInput",
1197
1218
  ref: u,
@@ -1200,7 +1221,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1200
1221
  accept: "image/*",
1201
1222
  onChange: h
1202
1223
  }, null, 544),
1203
- k("div", Ut, [A(Q, {
1224
+ k("div", qt, [A(Q, {
1204
1225
  class: "flex-1",
1205
1226
  field: e.field,
1206
1227
  "model-value": e.modelValue ?? "",
@@ -1218,8 +1239,8 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1218
1239
  title: "清除图片(资源地址置空)",
1219
1240
  onClick: n[3] ||= (e) => r("change", "")
1220
1241
  }, "清除")) : D("", !0)]),
1221
- f.value ? (P(), O("span", Wt, "源图 " + R(f.value), 1)) : D("", !0)
1222
- ])) : e.dataMode === "expression" ? (P(), E(Rt, {
1242
+ f.value ? (P(), O("span", Jt, "源图 " + R(f.value), 1)) : D("", !0)
1243
+ ])) : e.dataMode === "expression" ? (P(), E(Ht, {
1223
1244
  key: 1,
1224
1245
  field: e.field,
1225
1246
  "model-value": e.modelValue,
@@ -1246,7 +1267,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1246
1267
  "aria-label"
1247
1268
  ]));
1248
1269
  }
1249
- }), Kt = [
1270
+ }), Xt = [
1250
1271
  "aria-label",
1251
1272
  "min",
1252
1273
  "max",
@@ -1289,7 +1310,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1289
1310
  }
1290
1311
  return (t, n) => be((P(), O("input", {
1291
1312
  "onUpdate:modelValue": n[0] ||= (e) => i.value = e,
1292
- class: N(["cn-field cn-field--number", z(X)]),
1313
+ class: N(["cn-field cn-field--number", z(Y)]),
1293
1314
  type: "number",
1294
1315
  "aria-label": e.field.label,
1295
1316
  min: e.field.min,
@@ -1299,9 +1320,9 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1299
1320
  onFocus: n[1] ||= (e) => a.value = !0,
1300
1321
  onBlur: l,
1301
1322
  onChange: l
1302
- }, null, 42, Kt)), [[_e, i.value]]);
1323
+ }, null, 42, Xt)), [[_e, i.value]]);
1303
1324
  }
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({
1325
+ }), Zt = { class: "cn-padding flex w-full min-w-0 items-center gap-1.5" }, Qt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, $t = /* @__PURE__ */ j({
1305
1326
  __name: "PaddingField",
1306
1327
  props: {
1307
1328
  field: {},
@@ -1309,7 +1330,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1309
1330
  },
1310
1331
  emits: ["input", "change"],
1311
1332
  setup(e, { emit: t }) {
1312
- let n = e, r = t, { mode: i, cycle: a } = ct(() => n.modelValue, nt), o = T(() => et[i.value]);
1333
+ let n = e, r = t, { mode: i, cycle: a } = pt(() => n.modelValue, st), o = T(() => at[i.value]);
1313
1334
  function s(e) {
1314
1335
  return {
1315
1336
  key: ["padding", e.rep],
@@ -1325,18 +1346,18 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1325
1346
  function l() {
1326
1347
  let { from: e, to: t } = a();
1327
1348
  if (t < e) {
1328
- let e = rt(n.modelValue, t);
1329
- it(e, n.modelValue) || r("change", e);
1349
+ let e = ct(n.modelValue, t);
1350
+ lt(e, n.modelValue) || r("change", e);
1330
1351
  }
1331
1352
  }
1332
- return (t, n) => (P(), O("span", qt, [A(ht, {
1353
+ return (t, n) => (P(), O("span", Zt, [A(X, {
1333
1354
  mode: z(i),
1334
1355
  label: "内边距",
1335
1356
  onCycle: l
1336
1357
  }, 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", {
1337
1358
  key: t.rep,
1338
1359
  class: "flex min-w-0 items-center gap-1.5"
1339
- }, [k("span", Jt, R(t.label), 1), A($, {
1360
+ }, [k("span", Qt, R(t.label), 1), A($, {
1340
1361
  class: "min-w-0 flex-1",
1341
1362
  field: s(t),
1342
1363
  "model-value": e.modelValue[t.rep],
@@ -1349,16 +1370,16 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1349
1370
  "onChange"
1350
1371
  ])]))), 128))], 2)]));
1351
1372
  }
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 = [
1373
+ }), en = { class: "grid w-full min-w-0 grid-cols-2 gap-1" }, tn = ["title"], nn = { class: "w-3.5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, rn = [
1353
1374
  "aria-pressed",
1354
1375
  "title",
1355
1376
  "onClick"
1356
- ], en = [
1377
+ ], an = [
1357
1378
  "aria-label",
1358
1379
  "value",
1359
1380
  "placeholder",
1360
1381
  "title"
1361
- ], tn = /* @__PURE__ */ j({
1382
+ ], on = /* @__PURE__ */ j({
1362
1383
  __name: "PairField",
1363
1384
  props: {
1364
1385
  field: {},
@@ -1374,7 +1395,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1374
1395
  let n = e, r = t, i = T(() => n.field.items ?? []);
1375
1396
  function a(e) {
1376
1397
  if (!e.auto) return !1;
1377
- let t = q(n.modelValue, e.auto.key);
1398
+ let t = K(n.modelValue, e.auto.key);
1378
1399
  return t.ok && t.value === !0;
1379
1400
  }
1380
1401
  function o(e) {
@@ -1397,7 +1418,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1397
1418
  r("sub-commit", s(e), !a(e), !0);
1398
1419
  }
1399
1420
  function u(e) {
1400
- let t = q(n.modelValue, e.key);
1421
+ let t = K(n.modelValue, e.key);
1401
1422
  return t.ok && typeof t.value == "number" ? t.value : 0;
1402
1423
  }
1403
1424
  function d(e) {
@@ -1414,12 +1435,12 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1414
1435
  let t = d(e);
1415
1436
  return t?.preview ? "模板子树:预览盒尺寸(随行实例变化,非文档声明值)" : t === void 0 ? `${e.label}自适应:已开启` : `${e.label}自适应:布局解析值(与画布选择框同源)`;
1416
1437
  }
1417
- return (e, t) => (P(), O("span", Xt, [(P(!0), O(w, null, I(i.value, (e) => (P(), O("label", {
1438
+ return (e, t) => (P(), O("span", en, [(P(!0), O(w, null, I(i.value, (e) => (P(), O("label", {
1418
1439
  key: e.key.join("."),
1419
1440
  class: "flex min-w-0 items-center gap-1",
1420
1441
  title: e.auto ? void 0 : e.label
1421
1442
  }, [
1422
- k("span", Qt, R(e.label), 1),
1443
+ k("span", nn, R(e.label), 1),
1423
1444
  e.auto ? (P(), O("button", {
1424
1445
  key: 0,
1425
1446
  type: "button",
@@ -1427,17 +1448,17 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1427
1448
  "aria-pressed": a(e),
1428
1449
  title: p(e),
1429
1450
  onClick: V((t) => l(e), ["prevent"])
1430
- }, "自", 10, $t)) : D("", !0),
1451
+ }, "自", 10, rn)) : D("", !0),
1431
1452
  a(e) ? (P(), O("input", {
1432
1453
  key: 2,
1433
- class: N(["cn-field cn-field--number min-w-0 flex-1", [z(X), d(e)?.preview ? "cn-field--preview" : ""]]),
1454
+ class: N(["cn-field cn-field--number min-w-0 flex-1", [z(Y), d(e)?.preview ? "cn-field--preview" : ""]]),
1434
1455
  type: "number",
1435
1456
  disabled: "",
1436
1457
  "aria-label": e.label,
1437
1458
  value: f(e),
1438
1459
  placeholder: e.auto?.placeholder ?? "",
1439
1460
  title: m(e)
1440
- }, null, 10, en)) : (P(), E($, {
1461
+ }, null, 10, an)) : (P(), E($, {
1441
1462
  key: 1,
1442
1463
  class: "min-w-0 flex-1",
1443
1464
  field: e,
@@ -1450,9 +1471,9 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1450
1471
  "onInput",
1451
1472
  "onChange"
1452
1473
  ]))
1453
- ], 8, Zt))), 128))]));
1474
+ ], 8, tn))), 128))]));
1454
1475
  }
1455
- }), nn = /* @__PURE__ */ j({
1476
+ }), sn = /* @__PURE__ */ j({
1456
1477
  __name: "RowsPathField",
1457
1478
  props: {
1458
1479
  field: {},
@@ -1481,7 +1502,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1481
1502
  "aria-label"
1482
1503
  ]));
1483
1504
  }
1484
- }), rn = ["value"], an = ["value"], on = /* @__PURE__ */ j({
1505
+ }), cn = ["value"], ln = ["value"], un = /* @__PURE__ */ j({
1485
1506
  __name: "SelectField",
1486
1507
  props: {
1487
1508
  field: {},
@@ -1500,9 +1521,9 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1500
1521
  }, [(P(!0), O(w, null, I(e.field.domain ?? [], (t) => (P(), O("option", {
1501
1522
  key: t,
1502
1523
  value: t
1503
- }, R(e.field.optionLabels?.[t] ?? t), 9, an))), 128))], 40, rn));
1524
+ }, R(e.field.optionLabels?.[t] ?? t), 9, ln))), 128))], 40, cn));
1504
1525
  }
1505
- }), sn = ["value", "disabled"], cn = /* @__PURE__ */ j({
1526
+ }), dn = ["value", "disabled"], fn = /* @__PURE__ */ j({
1506
1527
  __name: "TextareaField",
1507
1528
  props: {
1508
1529
  field: {},
@@ -1526,7 +1547,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1526
1547
  r = !1, n("change", e.target.value);
1527
1548
  }
1528
1549
  return (t, n) => (P(), O("textarea", {
1529
- class: N(["cn-field", z(ut)]),
1550
+ class: N(["cn-field", z(ht)]),
1530
1551
  rows: "3",
1531
1552
  value: e.modelValue,
1532
1553
  disabled: e.disabled,
@@ -1534,28 +1555,28 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
1534
1555
  onCompositionstart: a,
1535
1556
  onCompositionend: o,
1536
1557
  onChange: s
1537
- }, null, 42, sn));
1558
+ }, null, 42, dn));
1538
1559
  }
1539
- }), ln = {
1560
+ }), pn = {
1540
1561
  number: M($),
1541
1562
  text: M(Q),
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)
1563
+ textarea: M(fn),
1564
+ color: M(Lt),
1565
+ select: M(un),
1566
+ boolean: M(it),
1567
+ pair: M(on),
1568
+ anchor: M(tt),
1569
+ align: M(Ge),
1570
+ padding: M($t),
1571
+ border: M(Tt),
1572
+ font: M(jt),
1573
+ imageSrc: M(Yt),
1574
+ resourceValue: M(Ht),
1575
+ rowsPath: M(sn)
1555
1576
  };
1556
1577
  //#endregion
1557
1578
  //#region src/property-panel/usePropertyPanel.ts
1558
- function un(e) {
1579
+ function mn(e) {
1559
1580
  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) => {
1560
1581
  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));
1561
1582
  });
@@ -1565,7 +1586,7 @@ function un(e) {
1565
1586
  return e && r ? p(e, r) : null;
1566
1587
  }), l = T(() => t.value), u = T(() => {
1567
1588
  let e = c.value, r = n.value;
1568
- return e && r ? K(r, e) : t.value ? Ne : [];
1589
+ return e && r ? Le(r, e) : t.value ? Re : [];
1569
1590
  }), d = T(() => {
1570
1591
  let r = n.value;
1571
1592
  return r && t.value ? e.layerBoxAt(r) : null;
@@ -1624,7 +1645,7 @@ function un(e) {
1624
1645
  function ae(t, n, r) {
1625
1646
  let i = t.key[1];
1626
1647
  if (i !== "color" && i !== "image") return;
1627
- let a = l.value?.background ?? Fe, o = typeof n == "string" && n !== "" ? n : null, s = {
1648
+ let a = l.value?.background ?? Be, o = typeof n == "string" && n !== "" ? n : null, s = {
1628
1649
  ...a,
1629
1650
  [i]: o
1630
1651
  }, c = `canvas:background.${i}`;
@@ -1652,14 +1673,14 @@ function un(e) {
1652
1673
  }
1653
1674
  //#endregion
1654
1675
  //#region src/property-panel/fields/ValueTypeSegmented.vue?vue&type=script&setup=true&lang.ts
1655
- var dn = ["aria-disabled"], fn = [
1676
+ var hn = ["aria-disabled"], gn = [
1656
1677
  "aria-pressed",
1657
1678
  "title",
1658
1679
  "data-mode-static",
1659
1680
  "data-mode-expression",
1660
1681
  "disabled",
1661
1682
  "onClick"
1662
- ], pn = /* @__PURE__ */ j({
1683
+ ], _n = /* @__PURE__ */ j({
1663
1684
  __name: "ValueTypeSegmented",
1664
1685
  props: {
1665
1686
  mode: {},
@@ -1694,15 +1715,15 @@ var dn = ["aria-disabled"], fn = [
1694
1715
  "data-mode-expression": t.value === "expression" || void 0,
1695
1716
  disabled: e.disabled,
1696
1717
  onClick: V((e) => a(t.value), ["prevent"])
1697
- }, R(t.label), 11, fn)), 64))], 10, dn));
1718
+ }, R(t.label), 11, gn)), 64))], 10, hn));
1698
1719
  }
1699
- }), mn = ["title"], hn = {
1720
+ }), vn = ["title"], yn = {
1700
1721
  key: 2,
1701
1722
  class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
1702
- }, gn = ["title"], _n = {
1723
+ }, bn = ["title"], xn = {
1703
1724
  key: 4,
1704
1725
  class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
1705
- }, vn = /* @__PURE__ */ j({
1726
+ }, Sn = /* @__PURE__ */ j({
1706
1727
  __name: "PropertyField",
1707
1728
  props: {
1708
1729
  field: {},
@@ -1722,7 +1743,7 @@ var dn = ["aria-disabled"], fn = [
1722
1743
  "sub-commit"
1723
1744
  ],
1724
1745
  setup(e, { emit: t }) {
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");
1746
+ let n = e, r = t, i = T(() => pn[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");
1726
1747
  function _() {
1727
1748
  let e = f.value[0], t = d.value?.$el;
1728
1749
  e !== void 0 && (t instanceof HTMLTextAreaElement || t instanceof HTMLInputElement) && (t.focus(), t.setSelectionRange(e.at.start, e.at.end));
@@ -1747,8 +1768,8 @@ var dn = ["aria-disabled"], fn = [
1747
1768
  key: 0,
1748
1769
  class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted",
1749
1770
  title: e.field.title
1750
- }, R(e.field.label), 9, mn)),
1751
- e.field.data ? (P(), E(pn, {
1771
+ }, R(e.field.label), 9, vn)),
1772
+ e.field.data ? (P(), E(_n, {
1752
1773
  key: 1,
1753
1774
  class: "justify-self-end",
1754
1775
  mode: e.dataMode ?? "static",
@@ -1782,14 +1803,14 @@ var dn = ["aria-disabled"], fn = [
1782
1803
  "source",
1783
1804
  "resource-status"
1784
1805
  ])),
1785
- e.hint ? (P(), O("span", hn, R(e.hint), 1)) : D("", !0),
1806
+ e.hint ? (P(), O("span", yn, R(e.hint), 1)) : D("", !0),
1786
1807
  p.value ? (P(), O("span", {
1787
1808
  key: 3,
1788
1809
  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 }]),
1789
1810
  title: g.value ? "点击选中出错片段" : void 0,
1790
1811
  onClick: _
1791
- }, R(p.value), 11, gn)) : D("", !0),
1792
- m.value ? (P(), O("span", _n, R(m.value), 1)) : D("", !0)
1812
+ }, R(p.value), 11, bn)) : D("", !0),
1813
+ m.value ? (P(), O("span", xn, R(m.value), 1)) : D("", !0)
1793
1814
  ]),
1794
1815
  _: 1
1795
1816
  }, 8, ["class"])), c.value ? (P(), E(ae, {
@@ -1800,14 +1821,14 @@ var dn = ["aria-disabled"], fn = [
1800
1821
  onSelect: z(S)
1801
1822
  }, null, 8, ["state", "onSelect"])) : D("", !0)], 64));
1802
1823
  }
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 = {
1824
+ }), Cn = { 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)]" }, wn = { 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" }, Tn = { class: "flex items-center gap-2" }, En = { 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" }, Dn = { class: "text-[12px] font-medium tracking-wide text-cn-fg/90" }, On = {
1804
1825
  key: 0,
1805
1826
  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"
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({
1827
+ }, kn = { class: "cn-props__section-title mb-2 text-[10px] font-semibold uppercase tracking-[0.16em] text-cn-muted" }, An = { class: "flex flex-col gap-2" }, jn = "内容编辑中:请在画布编辑框内修改,退出后此处更新", Mn = /* @__PURE__ */ j({
1807
1828
  __name: "PropertyPanel",
1808
1829
  props: { editor: {} },
1809
1830
  setup(e) {
1810
- let t = e, n = un(t.editor);
1831
+ let t = e, n = mn(t.editor);
1811
1832
  he(Z, {
1812
1833
  canUpload: t.editor.canUpload,
1813
1834
  uploadImage: (e) => t.editor.uploadImage(e)
@@ -1819,13 +1840,13 @@ var dn = ["aria-disabled"], fn = [
1819
1840
  let e = n.layer.value;
1820
1841
  return e ? e.type : n.canvas.value ? "Canvas" : "—";
1821
1842
  }), o = T(() => {
1822
- let e = n.layer.value === null ? n.selection.value ? null : Pe(n.canvas.value) : Ie(n.layer.value);
1843
+ let e = n.layer.value === null ? n.selection.value ? null : ze(n.canvas.value) : Ve(n.layer.value);
1823
1844
  if (!e) return [];
1824
1845
  let t = n.selection.value?.join(".") ?? "canvas", r = n.layer.value, i = n.resourceStatuses.value, a = [];
1825
1846
  for (let o of n.sections.value) {
1826
1847
  let s = [];
1827
1848
  for (let a of o.fields) {
1828
- let o = q(e, a.key);
1849
+ let o = K(e, a.key);
1829
1850
  if (!o.ok) continue;
1830
1851
  let c = n.contentLocked.value && a.data === !0;
1831
1852
  s.push({
@@ -1834,7 +1855,7 @@ var dn = ["aria-disabled"], fn = [
1834
1855
  value: o.value,
1835
1856
  dataMode: a.data ? n.isDataMarked(a) ? "expression" : "static" : void 0,
1836
1857
  locked: c,
1837
- hint: c ? Dn : a.hint && r ? a.hint(r, i) ?? void 0 : void 0,
1858
+ hint: c ? jn : a.hint && r ? a.hint(r, i) ?? void 0 : void 0,
1838
1859
  resourceStatus: a.control === "imageSrc" && typeof o.value == "string" && o.value !== "" ? i[o.value] : void 0,
1839
1860
  drifted: a.control === "rowsPath" ? n.rowsPathDrifted.value : void 0
1840
1861
  });
@@ -1862,16 +1883,16 @@ var dn = ["aria-disabled"], fn = [
1862
1883
  function c() {
1863
1884
  n.setAnchorExpanded(!n.anchorExpanded.value);
1864
1885
  }
1865
- return (e, t) => (P(), O("aside", yn, [
1866
- k("header", bn, [k("div", xn, [k("span", Sn, [t[0] ||= k("i", {
1886
+ return (e, t) => (P(), O("aside", Cn, [
1887
+ k("header", wn, [k("div", Tn, [k("span", En, [t[0] ||= k("i", {
1867
1888
  class: "size-1.5 rounded-full bg-cn-accent",
1868
1889
  "aria-hidden": "true"
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),
1890
+ }, null, -1), de(" " + R(a.value), 1)]), k("span", Dn, R(i.value ? "图层属性" : "画布属性"), 1)])]),
1891
+ o.value.length === 0 ? (P(), O("p", On, " 打开文档后可编辑属性 ")) : D("", !0),
1871
1892
  (P(!0), O(w, null, I(o.value, (e) => (P(), O("section", {
1872
1893
  key: e.title,
1873
1894
  class: "cn-props__section border-b border-cn-line/70 px-3.5 py-3 last:border-b-0"
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, {
1895
+ }, [k("h3", kn, R(e.title), 1), k("div", An, [(P(!0), O(w, null, I(e.fields, (e) => (P(), O(w, { key: e.key }, [e.field.control === "anchor" ? (P(), E(tt, {
1875
1896
  key: 0,
1876
1897
  field: e.field,
1877
1898
  "model-value": e.value,
@@ -1883,7 +1904,7 @@ var dn = ["aria-disabled"], fn = [
1883
1904
  "model-value",
1884
1905
  "expanded",
1885
1906
  "onChange"
1886
- ])) : (P(), E(vn, {
1907
+ ])) : (P(), E(Sn, {
1887
1908
  key: 1,
1888
1909
  field: e.field,
1889
1910
  value: e.value,
@@ -1917,4 +1938,4 @@ var dn = ["aria-disabled"], fn = [
1917
1938
  }
1918
1939
  });
1919
1940
  //#endregion
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 };
1941
+ export { Z as a, Ne as c, Fe as d, K as f, pn as i, Le as l, Sn as n, Rt as o, mn as r, Re as s, Mn as t, Pe as u };
@@ -1,3 +1,3 @@
1
- import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./property-panel-BkfqRva4.js";
1
+ import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./property-panel-CwdTufiP.js";
2
2
  import { i as f, r as p } from "./uploadFile-mXJVPEzm.js";
3
3
  export { l as CANVAS_FIELD_SECTIONS, t as FIELD_SECTIONS_BY_TYPE, p as FONT_PICKER_KEY, e as IMAGE_UPLOAD_KEY, o as PropertyField, u as PropertyPanel, i as controlRegistry, a as fieldSectionsForPath, d as fieldSectionsForType, f as injectFontPicker, s as injectImageUpload, n as layerRoleAt, r as readField, c as usePropertyPanel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hankchen/canvas-editor-vue",
3
- "version": "0.8.0",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "description": "Vue 3 薄绑定:响应式桥、composables、画布表面组件、textarea 文本编辑 overlay、schema 驱动属性面板注册表",
6
6
  "type": "module",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@lucide/vue": "^1.48.0",
61
- "@hankchen/canvas-editor": "0.9.0"
61
+ "@hankchen/canvas-editor": "2.1.0"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "vue": "^3.5.0"