@hankchen/canvas-editor-vue 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,11 @@
1
- import { B as e, D as t, F as n, G as r, H as i, I as a, L as o, M as s, N as c, O as l, P as u, S as d, U as f, _ as p, a as m, b as h, d as g, g as _, h as v, j as y, k as b, m as x, p as S, r as C, s as w, u as T, v as E, w as D, y as O, z as k } from "./layerPath-BRZK9ka1.js";
2
- import { t as A } from "./createLucideIcon-CMq8ZKo2.js";
3
- import { a as j, c as ee, d as te, f as ne, i as re, l as ie, n as M, p as ae, r as N, s as oe, t as se, u as ce } from "./dist-DuXLYZZ9.js";
4
- import { i as P, r as le } from "./completionAnchor-4lhR2kJz.js";
5
- import { i as ue, n as de, r as fe, t as F } from "./uploadFile-CutE_xI-.js";
6
- import { n as pe, r as me, t as he } from "./usePathCompletion-DkHoGla4.js";
7
- var ge = A({
1
+ import { t as e } from "./createLucideIcon-SCvtEGVf.js";
2
+ import { a as t, c as n, d as r, f as i, i as a, l as o, n as s, p as c, r as l, s as u, t as d, u as f } from "./dist-DGtNmLwo.js";
3
+ import { a as p, r as m } from "./layerPath-uy2ywyld.js";
4
+ import { i as h, r as g } from "./completionAnchor-CDR5YZhu.js";
5
+ import { i as _, n as ee, r as te, t as v } from "./uploadFile-BOfv8aLG.js";
6
+ import { n as y, r as ne, t as re } from "./usePathCompletion-uJ5c_gQ0.js";
7
+ import { Fragment as b, computed as x, createBlock as S, createCommentVNode as C, createElementBlock as w, createElementVNode as T, createTextVNode as ie, createVNode as E, defineComponent as D, inject as ae, markRaw as O, nextTick as oe, normalizeClass as k, onScopeDispose as se, openBlock as A, provide as ce, ref as j, renderList as M, resolveDynamicComponent as le, shallowRef as N, toDisplayString as P, unref as F, vModelText as I, watch as L, watchEffect as ue, withCtx as de, withDirectives as fe, withModifiers as R } from "vue";
8
+ var pe = e({
8
9
  name: "grid-2x2",
9
10
  size: 24,
10
11
  node: [
@@ -26,7 +27,7 @@ var ge = A({
26
27
  }]
27
28
  ],
28
29
  aliases: ["grid-2-x-2"]
29
- }), _e = A({
30
+ }), me = e({
30
31
  name: "square-split-vertical",
31
32
  size: 24,
32
33
  node: [
@@ -44,7 +45,7 @@ var ge = A({
44
45
  }]
45
46
  ],
46
47
  aliases: ["split-square-vertical"]
47
- }), ve = A({
48
+ }), he = e({
48
49
  name: "square",
49
50
  size: 24,
50
51
  node: [["rect", {
@@ -58,18 +59,18 @@ var ge = A({
58
59
  });
59
60
  //#endregion
60
61
  //#region ../canvas-editor/src/shared/resourceStatus.ts
61
- function ye(e, t) {
62
+ function ge(e, n) {
62
63
  if (e.type !== "ImageLayer") return !1;
63
- if (e.expression !== null || e.src === null || j(e) <= 0 || re(e) <= 0) return !0;
64
- if (t !== void 0) {
65
- let n = t[e.src];
66
- if (n !== void 0 && n !== "done") return !0;
64
+ if (e.expression !== null || e.src === null || t(e) <= 0 || a(e) <= 0) return !0;
65
+ if (n !== void 0) {
66
+ let t = n[e.src];
67
+ if (t !== void 0 && t !== "done") return !0;
67
68
  }
68
69
  return !1;
69
70
  }
70
71
  //#endregion
71
72
  //#region src/property-panel/fieldSchema.ts
72
- var be = "当前层内容未绘制,padding 不影响预览", I = {
73
+ var _e = "当前层内容未绘制,padding 不影响预览", z = {
73
74
  title: "位置与尺寸",
74
75
  fields: [
75
76
  {
@@ -124,20 +125,20 @@ var be = "当前层内容未绘制,padding 不影响预览", I = {
124
125
  control: "anchor"
125
126
  }
126
127
  ]
127
- }, L = {
128
+ }, B = {
128
129
  title: "对齐",
129
130
  fields: [{
130
131
  key: ["align", "horizontal"],
131
132
  label: "水平",
132
133
  control: "align",
133
- domain: M
134
+ domain: s
134
135
  }, {
135
136
  key: ["align", "vertical"],
136
137
  label: "垂直",
137
138
  control: "align",
138
- domain: N
139
+ domain: l
139
140
  }]
140
- }, R = {
141
+ }, V = {
141
142
  title: "形状",
142
143
  fields: [
143
144
  {
@@ -159,7 +160,7 @@ var be = "当前层内容未绘制,padding 不影响预览", I = {
159
160
  label: "内边距",
160
161
  control: "padding",
161
162
  title: "内边距作用于内容盒,不改变图层尺寸",
162
- hint: (e, t) => ye(e, t) ? be : null
163
+ hint: (e, t) => ge(e, t) ? _e : null
163
164
  },
164
165
  {
165
166
  key: ["shape", "border"],
@@ -167,11 +168,11 @@ var be = "当前层内容未绘制,padding 不影响预览", I = {
167
168
  control: "border"
168
169
  }
169
170
  ]
170
- }, xe = {
171
+ }, ve = {
171
172
  ImageLayer: [
172
- I,
173
- L,
174
- R,
173
+ z,
174
+ B,
175
+ V,
175
176
  {
176
177
  title: "图片",
177
178
  fields: [{
@@ -183,9 +184,9 @@ var be = "当前层内容未绘制,padding 不影响预览", I = {
183
184
  }
184
185
  ],
185
186
  TextLayer: [
186
- I,
187
- L,
188
- R,
187
+ z,
188
+ B,
189
+ V,
189
190
  {
190
191
  title: "文本",
191
192
  fields: [
@@ -221,9 +222,9 @@ var be = "当前层内容未绘制,padding 不影响预览", I = {
221
222
  }
222
223
  ],
223
224
  QrCodeLayer: [
224
- I,
225
- L,
226
- R,
225
+ z,
226
+ B,
227
+ V,
227
228
  {
228
229
  title: "二维码",
229
230
  fields: [{
@@ -235,9 +236,9 @@ var be = "当前层内容未绘制,padding 不影响预览", I = {
235
236
  }
236
237
  ],
237
238
  TableLayer: [
238
- I,
239
- L,
240
- R,
239
+ z,
240
+ B,
241
+ V,
241
242
  {
242
243
  title: "数据",
243
244
  fields: [{
@@ -252,14 +253,14 @@ var be = "当前层内容未绘制,padding 不影响预览", I = {
252
253
  }
253
254
  ],
254
255
  TableRowLayer: [
255
- I,
256
- L,
257
- R
256
+ z,
257
+ B,
258
+ V
258
259
  ],
259
260
  TableCellLayer: [
260
- I,
261
- L,
262
- R
261
+ z,
262
+ B,
263
+ V
263
264
  ],
264
265
  TableRowTemplate: [{
265
266
  title: "行模板(行宽由表宽同步)",
@@ -276,15 +277,15 @@ var be = "当前层内容未绘制,padding 不影响预览", I = {
276
277
  }]
277
278
  }]
278
279
  };
279
- function Se(e) {
280
- return xe[e] ?? [];
280
+ function ye(e) {
281
+ return ve[e] ?? [];
281
282
  }
282
- function Ce(e) {
283
- if (e[e.length - 1] === "content") return C(e) ? "templateContent" : "content";
283
+ function H(e) {
284
+ if (e[e.length - 1] === "content") return m(e) ? "templateContent" : "content";
284
285
  let t = e[e.length - 2];
285
286
  return t === "rows" ? "row" : t === "cells" ? "cell" : "root";
286
287
  }
287
- var we = {
288
+ var be = {
288
289
  root: [],
289
290
  cell: [],
290
291
  row: ["shape.width", "shape.autoWidth"],
@@ -296,16 +297,16 @@ var we = {
296
297
  ],
297
298
  templateContent: ["shape.width", "shape.autoWidth"]
298
299
  };
299
- function z(e, t) {
300
+ function U(e, t) {
300
301
  return [...e.key, ...t.key];
301
302
  }
302
- function Te(e, t) {
303
- let n = new Set(we[Ce(e)]), r = [];
304
- for (let e of Se(t.type)) {
303
+ function W(e, t) {
304
+ let n = new Set(be[H(e)]), r = [];
305
+ for (let e of ye(t.type)) {
305
306
  let i = [];
306
307
  for (let r of e.fields) {
307
308
  if (r.items) {
308
- let e = r.items.filter((e) => !n.has(z(r, e).join(".")) && (!e.visibleWhen || e.visibleWhen(t)));
309
+ let e = r.items.filter((e) => !n.has(U(r, e).join(".")) && (!e.visibleWhen || e.visibleWhen(t)));
309
310
  e.length > 0 && i.push({
310
311
  ...r,
311
312
  items: e
@@ -321,7 +322,7 @@ function Te(e, t) {
321
322
  }
322
323
  return r;
323
324
  }
324
- var B = [{
325
+ var G = [{
325
326
  title: "画布",
326
327
  fields: [{
327
328
  key: ["width"],
@@ -337,7 +338,7 @@ var B = [{
337
338
  min: 1
338
339
  }]
339
340
  }];
340
- function V(e, t) {
341
+ function K(e, t) {
341
342
  let n = e;
342
343
  for (let e = 0; e < t.length; e += 1) {
343
344
  if (typeof n != "object" || !n) return { ok: !1 };
@@ -350,97 +351,97 @@ function V(e, t) {
350
351
  }
351
352
  //#endregion
352
353
  //#region src/property-panel/fields/AlignField.vue?vue&type=script&setup=true&lang.ts
353
- var Ee = ["aria-label"], De = [
354
+ var xe = ["aria-label"], Se = [
354
355
  "aria-pressed",
355
356
  "title",
356
357
  "onClick"
357
- ], Oe = {
358
+ ], Ce = {
358
359
  key: 1,
359
360
  class: "truncate px-1 text-[10px] leading-none"
360
- }, ke = /* @__PURE__ */ h({
361
+ }, we = /* @__PURE__ */ D({
361
362
  __name: "AlignField",
362
363
  props: {
363
364
  field: {},
364
365
  modelValue: {}
365
366
  },
366
367
  emits: ["change"],
367
- setup(e, { emit: n }) {
368
- let i = e, a = n, o = {
369
- [M.join(".")]: {
368
+ setup(e, { emit: t }) {
369
+ let a = e, u = t, d = {
370
+ [s.join(".")]: {
370
371
  left: {
371
- icon: ee,
372
+ icon: n,
372
373
  title: "左对齐"
373
374
  },
374
375
  center: {
375
- icon: ne,
376
+ icon: i,
376
377
  title: "居中对齐"
377
378
  },
378
379
  right: {
379
- icon: ce,
380
+ icon: f,
380
381
  title: "右对齐"
381
382
  }
382
383
  },
383
- [N.join(".")]: {
384
+ [l.join(".")]: {
384
385
  top: {
385
- icon: ie,
386
+ icon: o,
386
387
  title: "顶对齐"
387
388
  },
388
389
  center: {
389
- icon: ae,
390
+ icon: c,
390
391
  title: "居中对齐"
391
392
  },
392
393
  bottom: {
393
- icon: te,
394
+ icon: r,
394
395
  title: "底对齐"
395
396
  }
396
397
  }
397
- }, s = S(() => {
398
- let e = i.field.domain ?? [], t = o[e.join(".")];
398
+ }, p = x(() => {
399
+ let e = a.field.domain ?? [], t = d[e.join(".")];
399
400
  return e.map((e) => ({
400
401
  value: e,
401
402
  icon: t?.[e]?.icon,
402
- title: t?.[e] ? `${i.field.label}:${t[e].title}` : `${i.field.label}:${e}`
403
+ title: t?.[e] ? `${a.field.label}:${t[e].title}` : `${a.field.label}:${e}`
403
404
  }));
404
405
  });
405
- function c(e) {
406
- e !== i.modelValue && a("change", e);
406
+ function m(e) {
407
+ e !== a.modelValue && u("change", e);
407
408
  }
408
- return (n, i) => (t(), p("span", {
409
+ return (t, n) => (A(), w("span", {
409
410
  class: "cn-align flex h-7 min-w-0 flex-1 overflow-hidden rounded-md border border-cn-field-line bg-cn-field",
410
411
  role: "group",
411
412
  "aria-label": e.field.label
412
- }, [(t(!0), p(g, null, b(s.value, (n, i) => (t(), p("button", {
413
- key: n.value,
413
+ }, [(A(!0), w(b, null, M(p.value, (t, n) => (A(), w("button", {
414
+ key: t.value,
414
415
  type: "button",
415
- class: f(["cn-align__option flex min-w-0 flex-1 items-center justify-center p-0 transition-colors duration-100 focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cn-accent/40", [i > 0 ? "border-l border-cn-field-line" : "", n.value === e.modelValue ? "cn-align__option--active bg-cn-accent-soft text-cn-accent" : "text-cn-muted hover:text-cn-fg"]]),
416
- "aria-pressed": n.value === e.modelValue,
417
- title: n.title,
418
- onClick: T((e) => c(n.value), ["prevent"])
419
- }, [n.icon ? (t(), v(P, {
416
+ class: k(["cn-align__option flex min-w-0 flex-1 items-center justify-center p-0 transition-colors duration-100 focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cn-accent/40", [n > 0 ? "border-l border-cn-field-line" : "", t.value === e.modelValue ? "cn-align__option--active bg-cn-accent-soft text-cn-accent" : "text-cn-muted hover:text-cn-fg"]]),
417
+ "aria-pressed": t.value === e.modelValue,
418
+ title: t.title,
419
+ onClick: R((e) => m(t.value), ["prevent"])
420
+ }, [t.icon ? (A(), S(h, {
420
421
  key: 0,
421
- icon: n.icon
422
- }, null, 8, ["icon"])) : (t(), p("span", Oe, r(n.value), 1))], 10, De))), 128))], 8, Ee));
422
+ icon: t.icon
423
+ }, null, 8, ["icon"])) : (A(), w("span", Ce, P(t.value), 1))], 10, Se))), 128))], 8, xe));
423
424
  }
424
- }), Ae = { class: "block" }, je = ["aria-expanded", "title"], Me = { class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted" }, Ne = { class: "flex shrink-0 items-center gap-1.5" }, Pe = {
425
+ }), Te = { class: "block" }, Ee = ["aria-expanded", "title"], De = { class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted" }, Oe = { class: "flex shrink-0 items-center gap-1.5" }, ke = {
425
426
  viewBox: "0 0 24 24",
426
427
  class: "size-3.5",
427
428
  "aria-hidden": "true"
428
- }, Fe = [
429
+ }, Ae = [
429
430
  "cx",
430
431
  "cy",
431
432
  "r"
432
- ], Ie = {
433
+ ], je = {
433
434
  key: 0,
434
435
  class: "mt-2 flex justify-end"
435
- }, Le = {
436
+ }, Me = {
436
437
  class: "cn-anchor grid w-[66px] shrink-0 grid-cols-3 gap-[3px]",
437
438
  role: "group",
438
439
  "aria-label": "九宫锚点"
439
- }, Re = [
440
+ }, Ne = [
440
441
  "aria-pressed",
441
442
  "title",
442
443
  "onClick"
443
- ], H = /* @__PURE__ */ h({
444
+ ], Pe = /* @__PURE__ */ D({
444
445
  __name: "AnchorDisclosureField",
445
446
  props: {
446
447
  field: {},
@@ -448,70 +449,70 @@ var Ee = ["aria-label"], De = [
448
449
  expanded: { type: Boolean }
449
450
  },
450
451
  emits: ["change", "toggle"],
451
- setup(e, { emit: n }) {
452
- let o = e, s = n, c = a(se), l = Array.from({ length: 9 }, (e, t) => ({
452
+ setup(e, { emit: t }) {
453
+ let n = e, r = t, i = O(d), a = Array.from({ length: 9 }, (e, t) => ({
453
454
  index: t,
454
455
  cx: 4 + t % 3 * 8,
455
456
  cy: 4 + Math.floor(t / 3) * 8
456
- })), u = S(() => {
457
- let e = o.modelValue.includes("top") ? 0 : o.modelValue.includes("bottom") ? 2 : 1, t = o.modelValue.includes("left") ? 0 : o.modelValue.includes("right") ? 2 : 1;
457
+ })), o = x(() => {
458
+ let e = n.modelValue.includes("top") ? 0 : n.modelValue.includes("bottom") ? 2 : 1, t = n.modelValue.includes("left") ? 0 : n.modelValue.includes("right") ? 2 : 1;
458
459
  return e * 3 + t;
459
460
  });
460
- function d(e) {
461
- s("change", e);
461
+ function s(e) {
462
+ r("change", e);
462
463
  }
463
- return (n, a) => (t(), p("span", Ae, [x("button", {
464
+ return (t, n) => (A(), w("span", Te, [T("button", {
464
465
  type: "button",
465
466
  class: "cn-anchor-disclosure__header flex w-full items-center justify-between gap-2",
466
467
  "aria-expanded": e.expanded,
467
468
  title: e.expanded ? "收起锚点" : `锚点:${e.modelValue}(点击展开调整)`,
468
- onClick: a[0] ||= (e) => s("toggle")
469
- }, [x("span", Me, r(e.field.label), 1), x("span", Ne, [(t(), p("svg", Pe, [(t(!0), p(g, null, b(i(l), (e) => (t(), p("circle", {
469
+ onClick: n[0] ||= (e) => r("toggle")
470
+ }, [T("span", De, P(e.field.label), 1), T("span", Oe, [(A(), w("svg", ke, [(A(!0), w(b, null, M(F(a), (e) => (A(), w("circle", {
470
471
  key: e.index,
471
472
  cx: e.cx,
472
473
  cy: e.cy,
473
- r: e.index === u.value ? 3.2 : 2.2,
474
- class: f(e.index === u.value ? "fill-cn-accent" : "fill-cn-muted/35")
475
- }, null, 10, Fe))), 128))])), O(P, {
476
- icon: i(oe),
477
- class: f(["text-cn-muted transition-transform duration-150", { "rotate-180": e.expanded }])
478
- }, null, 8, ["icon", "class"])])], 8, je), e.expanded ? (t(), p("span", Ie, [x("span", Le, [(t(!0), p(g, null, b(i(c), (n) => (t(), p("button", {
479
- key: n,
474
+ r: e.index === o.value ? 3.2 : 2.2,
475
+ class: k(e.index === o.value ? "fill-cn-accent" : "fill-cn-muted/35")
476
+ }, null, 10, Ae))), 128))])), E(h, {
477
+ icon: F(u),
478
+ class: k(["text-cn-muted transition-transform duration-150", { "rotate-180": e.expanded }])
479
+ }, null, 8, ["icon", "class"])])], 8, Ee), e.expanded ? (A(), w("span", je, [T("span", Me, [(A(!0), w(b, null, M(F(i), (t) => (A(), w("button", {
480
+ key: t,
480
481
  type: "button",
481
- class: f(["cn-anchor__cell relative aspect-square min-w-0 rounded-[4px] border p-0 transition-colors duration-100", n === 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"]),
482
- "aria-pressed": n === e.modelValue,
483
- title: n,
484
- onClick: (e) => d(n)
485
- }, null, 10, Re))), 128))])])) : _("", !0)]));
482
+ class: k(["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"]),
483
+ "aria-pressed": t === e.modelValue,
484
+ title: t,
485
+ onClick: (e) => s(t)
486
+ }, null, 10, Ne))), 128))])])) : C("", !0)]));
486
487
  }
487
- }), ze = { class: "cn-bool relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center" }, Be = ["checked"], Ve = /* @__PURE__ */ h({
488
+ }), Fe = { class: "cn-bool relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center" }, Ie = ["checked"], Le = /* @__PURE__ */ D({
488
489
  __name: "BooleanField",
489
490
  props: {
490
491
  field: {},
491
492
  modelValue: { type: Boolean }
492
493
  },
493
494
  emits: ["change"],
494
- setup(e, { emit: n }) {
495
- let r = e, i = n, a = k(null);
496
- async function o(e) {
497
- i("change", e.target.checked), await D(), a.value && (a.value.checked = r.modelValue);
498
- }
499
- return c(() => {
500
- a.value && (a.value.checked = r.modelValue);
501
- }), (n, r) => (t(), p("label", ze, [
502
- x("input", {
495
+ setup(e, { emit: t }) {
496
+ let n = e, r = t, i = j(null);
497
+ async function a(e) {
498
+ r("change", e.target.checked), await oe(), i.value && (i.value.checked = n.modelValue);
499
+ }
500
+ return ue(() => {
501
+ i.value && (i.value.checked = n.modelValue);
502
+ }), (t, n) => (A(), w("label", Fe, [
503
+ T("input", {
503
504
  ref_key: "inputRef",
504
- ref: a,
505
+ ref: i,
505
506
  class: "cn-bool__input peer sr-only",
506
507
  type: "checkbox",
507
508
  checked: e.modelValue,
508
- onChange: o
509
- }, null, 40, Be),
510
- r[0] ||= x("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),
511
- r[1] ||= x("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)
509
+ onChange: a
510
+ }, null, 40, Ie),
511
+ n[0] ||= T("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),
512
+ n[1] ||= T("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)
512
513
  ]));
513
514
  }
514
- }), U = {
515
+ }), Re = {
515
516
  1: [{
516
517
  label: "四边",
517
518
  rep: "top",
@@ -554,13 +555,13 @@ var Ee = ["aria-label"], De = [
554
555
  }
555
556
  ]
556
557
  };
557
- function He(e) {
558
+ function ze(e) {
558
559
  return e === 1 ? 2 : e === 2 ? 4 : 1;
559
560
  }
560
- function Ue(e) {
561
+ function Be(e) {
561
562
  return e.top === e.bottom && e.bottom === e.left && e.left === e.right ? 1 : e.top === e.bottom && e.left === e.right ? 2 : 4;
562
563
  }
563
- function We(e, t) {
564
+ function Ve(e, t) {
564
565
  if (t === 1) {
565
566
  let { top: t } = e;
566
567
  return {
@@ -581,17 +582,17 @@ function We(e, t) {
581
582
  }
582
583
  return e;
583
584
  }
584
- function Ge(e, t) {
585
+ function He(e, t) {
585
586
  return e.top === t.top && e.bottom === t.bottom && e.left === t.left && e.right === t.right;
586
587
  }
587
- function W(e, t) {
588
+ function q(e, t) {
588
589
  return e === null || t === null ? e === t : e.width === t.width && e.color === t.color;
589
590
  }
590
- function Ke(e) {
591
+ function Ue(e) {
591
592
  let { top: t, bottom: n, left: r, right: i } = e;
592
- return t === null && n === null && r === null && i === null || t !== null && W(t, n) && W(t, r) && W(t, i) ? 1 : W(t, n) && W(r, i) ? 2 : 4;
593
+ 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;
593
594
  }
594
- function qe(e, t) {
595
+ function We(e, t) {
595
596
  let n = (e) => e === null ? null : { ...e };
596
597
  if (t === 1) {
597
598
  let t = n(e.top);
@@ -613,18 +614,18 @@ function qe(e, t) {
613
614
  }
614
615
  return e;
615
616
  }
616
- function Je(e, t) {
617
- return W(e.top, t.top) && W(e.bottom, t.bottom) && W(e.left, t.left) && W(e.right, t.right);
617
+ function Ge(e, t) {
618
+ return q(e.top, t.top) && q(e.bottom, t.bottom) && q(e.left, t.left) && q(e.right, t.right);
618
619
  }
619
620
  //#endregion
620
621
  //#region src/property-panel/useShorthandMode.ts
621
- function G(e, t) {
622
- let n = S(() => t(e())), r = k(null), i = S(() => r.value ?? n.value);
623
- s(e, () => {
622
+ function Ke(e, t) {
623
+ let n = x(() => t(e())), r = j(null), i = x(() => r.value ?? n.value);
624
+ L(e, () => {
624
625
  r.value = null;
625
626
  });
626
627
  function a() {
627
- let e = i.value, t = He(e);
628
+ let e = i.value, t = ze(e);
628
629
  return r.value = t, {
629
630
  from: e,
630
631
  to: t
@@ -637,175 +638,175 @@ function G(e, t) {
637
638
  }
638
639
  //#endregion
639
640
  //#region src/property-panel/controlStyles.ts
640
- var K = "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", q = `${K} text-right font-mono tabular-nums`, J = K, Ye = "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", Xe = "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", Ze = ["aria-label"], Qe = /* @__PURE__ */ h({
641
+ 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`, qe = J, Je = "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", Ye = "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", Xe = ["aria-label"], Ze = /* @__PURE__ */ D({
641
642
  __name: "BorderWidthInput",
642
643
  props: {
643
644
  value: {},
644
645
  label: {}
645
646
  },
646
647
  emits: ["input", "change"],
647
- setup(e, { emit: r }) {
648
- let a = e, o = r, c = k(a.value === null ? "" : String(a.value)), l = k(!1);
649
- s(() => a.value, (e) => {
650
- l.value || (c.value = e === null ? "" : String(e));
648
+ setup(e, { emit: t }) {
649
+ let n = e, r = t, i = j(n.value === null ? "" : String(n.value)), a = j(!1);
650
+ L(() => n.value, (e) => {
651
+ a.value || (i.value = e === null ? "" : String(e));
651
652
  });
652
- function u(e) {
653
+ function o(e) {
653
654
  return Math.max(0, Math.trunc(e));
654
655
  }
655
- function d(e) {
656
+ function s(e) {
656
657
  if (e.value.trim() === "") return null;
657
658
  let t = Number(e.value);
658
659
  return Number.isFinite(t) ? t : null;
659
660
  }
660
- function m(e) {
661
+ function c(e) {
661
662
  return e === null ? "" : String(e);
662
663
  }
663
- function h(e) {
664
+ function l(e) {
664
665
  let t = e.target;
665
- c.value = t.value;
666
- let n = d(t);
667
- n !== null && o("input", u(n));
666
+ i.value = t.value;
667
+ let n = s(t);
668
+ n !== null && r("input", o(n));
668
669
  }
669
- function g(e) {
670
- let t = d(e.target);
670
+ function u(e) {
671
+ let t = s(e.target);
671
672
  if (t === null) {
672
- c.value = m(a.value);
673
+ i.value = c(n.value);
673
674
  return;
674
675
  }
675
- let n = u(t);
676
- c.value = n === 0 ? "" : String(n), o("change", n);
676
+ let a = o(t);
677
+ i.value = a === 0 ? "" : String(a), r("change", a);
677
678
  }
678
- return (r, a) => n((t(), p("input", {
679
- "onUpdate:modelValue": a[0] ||= (e) => c.value = e,
680
- class: f(["cn-field cn-field--number min-w-0 flex-1", i(q)]),
679
+ return (t, n) => fe((A(), w("input", {
680
+ "onUpdate:modelValue": n[0] ||= (e) => i.value = e,
681
+ class: k(["cn-field cn-field--number min-w-0 flex-1", F(Y)]),
681
682
  type: "number",
682
683
  "aria-label": e.label,
683
684
  min: 0,
684
685
  step: "1",
685
686
  placeholder: "无边框",
686
687
  title: "宽度归 0 即关闭该边",
687
- onInput: h,
688
- onFocus: a[1] ||= (e) => l.value = !0,
689
- onBlur: g,
690
- onChange: g
691
- }, null, 42, Ze)), [[w, c.value]]);
688
+ onInput: l,
689
+ onFocus: n[1] ||= (e) => a.value = !0,
690
+ onBlur: u,
691
+ onChange: u
692
+ }, null, 42, Xe)), [[I, i.value]]);
692
693
  }
693
- }), $e = ["aria-label", "title"], Y = /* @__PURE__ */ h({
694
+ }), Qe = ["aria-label", "title"], $e = /* @__PURE__ */ D({
694
695
  __name: "ShorthandModeButton",
695
696
  props: {
696
697
  mode: {},
697
698
  label: {}
698
699
  },
699
700
  emits: ["cycle"],
700
- setup(e, { emit: n }) {
701
- let r = e, i = n, a = {
701
+ setup(e, { emit: t }) {
702
+ let n = e, r = t, i = {
702
703
  1: {
703
- icon: ve,
704
+ icon: he,
704
705
  title: "统一值"
705
706
  },
706
707
  2: {
707
- icon: _e,
708
+ icon: me,
708
709
  title: "上下/左右"
709
710
  },
710
711
  4: {
711
- icon: ge,
712
+ icon: pe,
712
713
  title: "四边独立"
713
714
  }
714
- }, o = S(() => a[r.mode]), s = S(() => `${r.label}:${o.value.title}(点击切换值模式)`);
715
- return (e, n) => (t(), p("button", {
715
+ }, a = x(() => i[n.mode]), o = x(() => `${n.label}:${a.value.title}(点击切换值模式)`);
716
+ return (e, t) => (A(), w("button", {
716
717
  type: "button",
717
718
  class: "cn-props__mode-toggle shrink-0",
718
- "aria-label": s.value,
719
- title: s.value,
720
- onClick: n[0] ||= T((e) => i("cycle"), ["prevent"])
721
- }, [O(P, {
722
- icon: o.value.icon,
719
+ "aria-label": o.value,
720
+ title: o.value,
721
+ onClick: t[0] ||= R((e) => r("cycle"), ["prevent"])
722
+ }, [E(h, {
723
+ icon: a.value.icon,
723
724
  size: 12
724
- }, null, 8, ["icon"])], 8, $e));
725
+ }, null, 8, ["icon"])], 8, Qe));
725
726
  }
726
727
  }), et = { class: "cn-border flex w-full min-w-0 items-center gap-1" }, tt = { class: "grid min-w-0 flex-1 gap-1 grid-cols-1" }, nt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, rt = [
727
728
  "value",
728
729
  "disabled",
729
730
  "onInput",
730
731
  "onChange"
731
- ], it = "#000000", at = /* @__PURE__ */ h({
732
+ ], it = "#000000", at = /* @__PURE__ */ D({
732
733
  __name: "BorderField",
733
734
  props: {
734
735
  field: {},
735
736
  modelValue: {}
736
737
  },
737
738
  emits: ["input", "change"],
738
- setup(e, { emit: n }) {
739
- let a = e, o = n, { mode: s, cycle: c } = G(() => a.modelValue, Ke), l = S(() => U[s.value]);
740
- function u(e) {
741
- return a.modelValue[e.rep]?.width ?? null;
739
+ setup(e, { emit: t }) {
740
+ let n = e, r = t, { mode: i, cycle: a } = Ke(() => n.modelValue, Ue), o = x(() => Re[i.value]);
741
+ function s(e) {
742
+ return n.modelValue[e.rep]?.width ?? null;
742
743
  }
743
- function d(e) {
744
- return a.modelValue[e.rep]?.color ?? it;
744
+ function c(e) {
745
+ return n.modelValue[e.rep]?.color ?? it;
745
746
  }
746
- function f(e, t, n) {
747
- let r = { ...a.modelValue };
748
- for (let n of e.sides) r[n] = t === null ? null : { ...t };
749
- o(n ? "change" : "input", r);
747
+ function l(e, t, i) {
748
+ let a = { ...n.modelValue };
749
+ for (let n of e.sides) a[n] = t === null ? null : { ...t };
750
+ r(i ? "change" : "input", a);
750
751
  }
751
- function m(e, t, n) {
752
- let r = a.modelValue[e.rep]?.color ?? it;
753
- f(e, t <= 0 ? null : {
752
+ function u(e, t, r) {
753
+ let i = n.modelValue[e.rep]?.color ?? it;
754
+ l(e, t <= 0 ? null : {
754
755
  width: t,
755
- color: r
756
- }, n);
757
- }
758
- function h(e, t, n) {
759
- let r = a.modelValue[e.rep];
760
- if (!r) return;
761
- let i = t.target.value.trim();
762
- i !== "" && f(e, {
763
- width: r.width,
764
756
  color: i
765
- }, n);
766
- }
767
- function _() {
768
- let { from: e, to: t } = c();
757
+ }, r);
758
+ }
759
+ function d(e, t, r) {
760
+ let i = n.modelValue[e.rep];
761
+ if (!i) return;
762
+ let a = t.target.value.trim();
763
+ a !== "" && l(e, {
764
+ width: i.width,
765
+ color: a
766
+ }, r);
767
+ }
768
+ function f() {
769
+ let { from: e, to: t } = a();
769
770
  if (t < e) {
770
- let e = qe(a.modelValue, t);
771
- Je(e, a.modelValue) || o("change", e);
771
+ let e = We(n.modelValue, t);
772
+ Ge(e, n.modelValue) || r("change", e);
772
773
  }
773
774
  }
774
- return (n, a) => (t(), p("span", et, [O(Y, {
775
- mode: i(s),
775
+ return (t, n) => (A(), w("span", et, [E($e, {
776
+ mode: F(i),
776
777
  label: "边框",
777
- onCycle: _
778
- }, null, 8, ["mode"]), x("span", tt, [(t(!0), p(g, null, b(l.value, (n) => (t(), p("label", {
779
- key: n.rep,
778
+ onCycle: f
779
+ }, null, 8, ["mode"]), T("span", tt, [(A(!0), w(b, null, M(o.value, (t) => (A(), w("label", {
780
+ key: t.rep,
780
781
  class: "flex items-center gap-1.5"
781
782
  }, [
782
- x("span", nt, r(n.label), 1),
783
- O(Qe, {
783
+ T("span", nt, P(t.label), 1),
784
+ E(Ze, {
784
785
  class: "cn-border__width",
785
- value: u(n),
786
- label: n.label,
787
- onInput: (e) => m(n, e, !1),
788
- onChange: (e) => m(n, e, !0)
786
+ value: s(t),
787
+ label: t.label,
788
+ onInput: (e) => u(t, e, !1),
789
+ onChange: (e) => u(t, e, !0)
789
790
  }, null, 8, [
790
791
  "value",
791
792
  "label",
792
793
  "onInput",
793
794
  "onChange"
794
795
  ]),
795
- x("input", {
796
+ T("input", {
796
797
  class: "cn-border__color size-6 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",
797
798
  type: "color",
798
799
  title: "边框颜色",
799
- value: d(n),
800
- disabled: e.modelValue[n.rep] === null,
801
- onInput: (e) => h(n, e, !1),
802
- onChange: (e) => h(n, e, !0)
800
+ value: c(t),
801
+ disabled: e.modelValue[t.rep] === null,
802
+ onInput: (e) => d(t, e, !1),
803
+ onChange: (e) => d(t, e, !0)
803
804
  }, null, 40, rt)
804
805
  ]))), 128))])]));
805
806
  }
806
807
  }), ot = Symbol("canvas-font-picker");
807
808
  function st() {
808
- return d(ot, null);
809
+ return ae(ot, null);
809
810
  }
810
811
  //#endregion
811
812
  //#region src/property-panel/fields/FontField.vue?vue&type=script&setup=true&lang.ts
@@ -816,215 +817,215 @@ var ct = ["value"], lt = {
816
817
  "disabled",
817
818
  "title",
818
819
  "data-upload-error"
819
- ], pt = /* @__PURE__ */ h({
820
+ ], pt = /* @__PURE__ */ D({
820
821
  __name: "FontField",
821
822
  props: {
822
823
  field: {},
823
824
  modelValue: {}
824
825
  },
825
826
  emits: ["input", "change"],
826
- setup(e, { emit: n }) {
827
- let a = e, o = n, s = st(), c = S(() => {
828
- if (s === null) return [];
827
+ setup(e, { emit: t }) {
828
+ let n = e, r = t, i = st(), a = x(() => {
829
+ if (i === null) return [];
829
830
  let e = [{
830
831
  label: "内置默认字体",
831
832
  value: ""
832
833
  }];
833
- for (let t of s.entries.value) t.ref !== "" && e.push({
834
+ for (let t of i.entries.value) t.ref !== "" && e.push({
834
835
  label: t.label,
835
836
  value: t.ref
836
837
  });
837
- let t = a.modelValue;
838
+ let t = n.modelValue;
838
839
  return t !== "" && !e.some((e) => e.value === t) && e.push({
839
- label: `${l(t)}(清单外引用)`,
840
+ label: `${o(t)}(清单外引用)`,
840
841
  value: t
841
842
  }), e;
842
843
  });
843
- function l(e) {
844
+ function o(e) {
844
845
  return e.startsWith("data:") ? "自定义字体(内联)" : e.split("/").pop() || e;
845
846
  }
846
- function u(e) {
847
- o("change", e.target.value);
847
+ function s(e) {
848
+ r("change", e.target.value);
848
849
  }
849
- let d = !1;
850
- function m(e) {
851
- d || e.isComposing || o("input", e.target.value);
850
+ let c = !1;
851
+ function l(e) {
852
+ c || e.isComposing || r("input", e.target.value);
852
853
  }
853
- function h() {
854
- d = !0;
854
+ function u() {
855
+ c = !0;
855
856
  }
856
- function v(e) {
857
- d = !1, o("input", e.target.value);
857
+ function d(e) {
858
+ c = !1, r("input", e.target.value);
858
859
  }
859
- function y(e) {
860
- d = !1, o("change", e.target.value);
860
+ function f(e) {
861
+ c = !1, r("change", e.target.value);
861
862
  }
862
- let C = k(!1), w = k(null), T = k(null);
863
- function E() {
864
- w.value = null, T.value?.click();
863
+ let p = j(!1), m = j(null), h = j(null);
864
+ function g() {
865
+ m.value = null, h.value?.click();
865
866
  }
866
- async function D(e) {
867
+ async function _(e) {
867
868
  let t = e.target, n = t.files?.[0];
868
- if (t.value = "", s !== null && n && !C.value) {
869
- C.value = !0;
869
+ if (t.value = "", i !== null && n && !p.value) {
870
+ p.value = !0;
870
871
  try {
871
- let e = await s.uploadFont(await F(n));
872
- o("change", e);
872
+ let e = await i.uploadFont(await v(n));
873
+ r("change", e);
873
874
  } catch (e) {
874
- w.value = e instanceof Error ? e.message : String(e);
875
+ m.value = e instanceof Error ? e.message : String(e);
875
876
  } finally {
876
- C.value = !1;
877
+ p.value = !1;
877
878
  }
878
879
  }
879
880
  }
880
- return (n, a) => i(s) === null ? (t(), p("input", {
881
+ return (t, n) => F(i) === null ? (A(), w("input", {
881
882
  key: 0,
882
- class: f(["cn-field", i(J)]),
883
+ class: k(["cn-field", F(qe)]),
883
884
  type: "text",
884
885
  value: e.modelValue,
885
- onInput: m,
886
- onCompositionstart: h,
887
- onCompositionend: v,
888
- onChange: y
889
- }, null, 42, ct)) : (t(), p("div", lt, [
890
- x("select", {
891
- class: f(["cn-field cn-select", i(K)]),
886
+ onInput: l,
887
+ onCompositionstart: u,
888
+ onCompositionend: d,
889
+ onChange: f
890
+ }, null, 42, ct)) : (A(), w("div", lt, [
891
+ T("select", {
892
+ class: k(["cn-field cn-select", F(J)]),
892
893
  value: e.modelValue,
893
- onChange: u
894
- }, [(t(!0), p(g, null, b(c.value, (e) => (t(), p("option", {
894
+ onChange: s
895
+ }, [(A(!0), w(b, null, M(a.value, (e) => (A(), w("option", {
895
896
  key: e.value,
896
897
  value: e.value
897
- }, r(e.label), 9, dt))), 128))], 42, ut),
898
- x("input", {
898
+ }, P(e.label), 9, dt))), 128))], 42, ut),
899
+ T("input", {
899
900
  ref_key: "fileInput",
900
- ref: T,
901
+ ref: h,
901
902
  type: "file",
902
903
  class: "hidden",
903
904
  accept: ".ttf,.otf,.woff,.woff2,font/ttf,font/otf,font/woff,font/woff2",
904
- onChange: D
905
+ onChange: _
905
906
  }, null, 544),
906
- i(s).canUpload ? (t(), p("button", {
907
+ F(i).canUpload ? (A(), w("button", {
907
908
  key: 0,
908
909
  type: "button",
909
910
  class: "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 disabled:cursor-not-allowed disabled:opacity-40",
910
- disabled: C.value,
911
- title: w.value ?? "上传本机字体(加入清单后可选)",
912
- "data-upload-error": w.value ?? void 0,
913
- onClick: E
914
- }, r(C.value ? "…" : w.value ? "!" : "上传"), 9, ft)) : _("", !0)
911
+ disabled: p.value,
912
+ title: m.value ?? "上传本机字体(加入清单后可选)",
913
+ "data-upload-error": m.value ?? void 0,
914
+ onClick: g
915
+ }, P(p.value ? "…" : m.value ? "!" : "上传"), 9, ft)) : C("", !0)
915
916
  ]));
916
917
  }
917
- }), mt = { class: "cn-color flex min-w-0 flex-1 items-center gap-1.5" }, ht = ["checked"], gt = ["value", "disabled"], _t = ["value", "disabled"], vt = "#000000", yt = /* @__PURE__ */ h({
918
+ }), mt = { class: "cn-color flex min-w-0 flex-1 items-center gap-1.5" }, ht = ["checked"], gt = ["value", "disabled"], _t = ["value", "disabled"], vt = "#000000", yt = /* @__PURE__ */ D({
918
919
  __name: "ColorField",
919
920
  props: {
920
921
  field: {},
921
922
  modelValue: {}
922
923
  },
923
924
  emits: ["input", "change"],
924
- setup(e, { emit: n }) {
925
- let r = e, a = n, o = k(r.modelValue !== null), c = k(l(r.modelValue));
926
- s(() => r.modelValue, (e) => {
927
- o.value = e !== null, o.value && (c.value = l(e));
925
+ setup(e, { emit: t }) {
926
+ let n = e, r = t, i = j(n.modelValue !== null), a = j(o(n.modelValue));
927
+ L(() => n.modelValue, (e) => {
928
+ i.value = e !== null, i.value && (a.value = o(e));
928
929
  });
929
- function l(e) {
930
+ function o(e) {
930
931
  return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e : vt;
931
932
  }
932
- function u(e) {
933
+ function s(e) {
933
934
  let t = e.target.checked;
934
- if (o.value = t, !t) {
935
- a("change", null);
935
+ if (i.value = t, !t) {
936
+ r("change", null);
936
937
  return;
937
938
  }
938
- let n = c.value;
939
- a("change", n);
939
+ let n = a.value;
940
+ r("change", n);
940
941
  }
941
- function d(e) {
942
+ function c(e) {
942
943
  let t = e.target.value;
943
- c.value = t, a("input", t);
944
+ a.value = t, r("input", t);
944
945
  }
945
- function m(e) {
946
+ function l(e) {
946
947
  let t = e.target.value;
947
- c.value = t, a("change", t);
948
+ a.value = t, r("change", t);
948
949
  }
949
- function h(e) {
950
+ function u(e) {
950
951
  let t = e.target.value.trim();
951
952
  if (t === "") {
952
- r.field.nullable && a("change", null);
953
+ n.field.nullable && r("change", null);
953
954
  return;
954
955
  }
955
- c.value = l(t), a("change", t);
956
+ a.value = o(t), r("change", t);
956
957
  }
957
- return (n, r) => (t(), p("span", mt, [
958
- e.field.nullable ? (t(), p("input", {
958
+ return (t, n) => (A(), w("span", mt, [
959
+ e.field.nullable ? (A(), w("input", {
959
960
  key: 0,
960
961
  class: "cn-color__toggle size-3.5 shrink-0 cursor-pointer accent-cn-accent",
961
962
  type: "checkbox",
962
963
  title: "启用颜色",
963
- checked: o.value,
964
- onChange: u
965
- }, null, 40, ht)) : _("", !0),
966
- x("input", {
967
- class: f(["cn-color__swatch", i(Xe)]),
964
+ checked: i.value,
965
+ onChange: s
966
+ }, null, 40, ht)) : C("", !0),
967
+ T("input", {
968
+ class: k(["cn-color__swatch", F(Ye)]),
968
969
  type: "color",
969
- value: c.value,
970
- disabled: !o.value,
971
- onInput: d,
972
- onChange: m
970
+ value: a.value,
971
+ disabled: !i.value,
972
+ onInput: c,
973
+ onChange: l
973
974
  }, null, 42, gt),
974
- x("input", {
975
- class: f(["cn-color__text min-w-0 flex-1", i(K)]),
975
+ T("input", {
976
+ class: k(["cn-color__text min-w-0 flex-1", F(J)]),
976
977
  type: "text",
977
978
  value: e.modelValue ?? "",
978
- disabled: !o.value,
979
+ disabled: !i.value,
979
980
  placeholder: "无",
980
- onChange: h
981
+ onChange: u
981
982
  }, null, 42, _t)
982
983
  ]));
983
984
  }
984
985
  }), X = Symbol("canvas-image-upload");
985
986
  function bt() {
986
- return d(X, null);
987
+ return ae(X, null);
987
988
  }
988
989
  //#endregion
989
990
  //#region src/property-panel/fields/TextField.vue?vue&type=script&setup=true&lang.ts
990
- var xt = ["value", "placeholder"], Z = /* @__PURE__ */ h({
991
+ var xt = ["value", "placeholder"], Z = /* @__PURE__ */ D({
991
992
  __name: "TextField",
992
993
  props: {
993
994
  field: {},
994
995
  modelValue: {}
995
996
  },
996
997
  emits: ["input", "change"],
997
- setup(e, { emit: n }) {
998
- let r = e, a = n, o = !1, s = k(!1);
999
- function c(e) {
1000
- return r.field.nonEmpty === !0 ? e.trim() === "" ? (s.value = !0, !0) : (s.value = !1, !1) : !1;
998
+ setup(e, { emit: t }) {
999
+ let n = e, r = t, i = !1, a = j(!1);
1000
+ function o(e) {
1001
+ return n.field.nonEmpty === !0 ? e.trim() === "" ? (a.value = !0, !0) : (a.value = !1, !1) : !1;
1001
1002
  }
1002
- function l(e) {
1003
+ function s(e) {
1003
1004
  let t = e.target.value;
1004
- o || e.isComposing || c(t) || a("input", t);
1005
+ i || e.isComposing || o(t) || r("input", t);
1005
1006
  }
1006
- function u() {
1007
- o = !0;
1007
+ function c() {
1008
+ i = !0;
1008
1009
  }
1009
- function d(e) {
1010
- o = !1;
1010
+ function l(e) {
1011
+ i = !1;
1011
1012
  let t = e.target.value;
1012
- c(t) || a("input", t);
1013
+ o(t) || r("input", t);
1013
1014
  }
1014
- function m(e) {
1015
- o = !1;
1015
+ function u(e) {
1016
+ i = !1;
1016
1017
  let t = e.target.value;
1017
- c(t) || a("change", t);
1018
+ o(t) || r("change", t);
1018
1019
  }
1019
- return (n, r) => (t(), p("input", {
1020
- class: f(["cn-field", [i(J), s.value ? "cn-field--invalid" : ""]]),
1020
+ return (t, n) => (A(), w("input", {
1021
+ class: k(["cn-field", [F(qe), a.value ? "cn-field--invalid" : ""]]),
1021
1022
  type: "text",
1022
1023
  value: e.modelValue,
1023
1024
  placeholder: e.field.placeholder,
1024
- onInput: l,
1025
- onCompositionstart: u,
1026
- onCompositionend: d,
1027
- onChange: m
1025
+ onInput: s,
1026
+ onCompositionstart: c,
1027
+ onCompositionend: l,
1028
+ onChange: u
1028
1029
  }, null, 42, xt));
1029
1030
  }
1030
1031
  }), St = {
@@ -1037,7 +1038,7 @@ var xt = ["value", "placeholder"], Z = /* @__PURE__ */ h({
1037
1038
  ], wt = ["src"], Tt = {
1038
1039
  key: 2,
1039
1040
  class: "relative"
1040
- }, Et = { class: "flex items-center gap-1.5" }, Dt = /* @__PURE__ */ h({
1041
+ }, Et = { class: "flex items-center gap-1.5" }, Dt = /* @__PURE__ */ D({
1041
1042
  __name: "ImageSrcField",
1042
1043
  props: {
1043
1044
  field: {},
@@ -1046,79 +1047,79 @@ var xt = ["value", "placeholder"], Z = /* @__PURE__ */ h({
1046
1047
  resourceStatus: {}
1047
1048
  },
1048
1049
  emits: ["input", "change"],
1049
- setup(e, { emit: n }) {
1050
- let i = e, a = n, o = bt(), s = S(() => o !== null && o.canUpload && i.dataMode !== "expression"), c = S(() => typeof i.modelValue == "string" && i.modelValue !== ""), l = S(() => i.resourceStatus === "pending" ? "装载中" : i.resourceStatus === "failed" ? "失败" : null), u = k(!1), d = k(null), m = k(null);
1051
- function h() {
1052
- d.value = null, m.value?.click();
1050
+ setup(e, { emit: t }) {
1051
+ let n = e, r = t, i = bt(), a = x(() => i !== null && i.canUpload && n.dataMode !== "expression"), o = x(() => typeof n.modelValue == "string" && n.modelValue !== ""), s = x(() => n.resourceStatus === "pending" ? "装载中" : n.resourceStatus === "failed" ? "失败" : null), c = j(!1), l = j(null), u = j(null);
1052
+ function d() {
1053
+ l.value = null, u.value?.click();
1053
1054
  }
1054
- async function g(e) {
1055
+ async function f(e) {
1055
1056
  let t = e.target, n = t.files?.[0];
1056
- if (t.value = "", o !== null && n && !u.value) {
1057
- u.value = !0;
1057
+ if (t.value = "", i !== null && n && !c.value) {
1058
+ c.value = !0;
1058
1059
  try {
1059
- let e = await o.uploadImage(await F(n));
1060
- e !== null && a("change", e);
1060
+ let e = await i.uploadImage(await v(n));
1061
+ e !== null && r("change", e);
1061
1062
  } catch (e) {
1062
- d.value = e instanceof Error ? e.message : String(e);
1063
+ l.value = e instanceof Error ? e.message : String(e);
1063
1064
  } finally {
1064
- u.value = !1;
1065
+ c.value = !1;
1065
1066
  }
1066
1067
  }
1067
1068
  }
1068
- return (n, i) => s.value ? (t(), p("div", St, [
1069
- x("button", {
1069
+ return (t, n) => a.value ? (A(), w("div", St, [
1070
+ T("button", {
1070
1071
  type: "button",
1071
1072
  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",
1072
- disabled: u.value,
1073
- title: d.value ?? (c.value ? "点击替换图片" : "点击上传图片"),
1074
- "data-upload-error": d.value ?? void 0,
1075
- onClick: h
1073
+ disabled: c.value,
1074
+ title: l.value ?? (o.value ? "点击替换图片" : "点击上传图片"),
1075
+ "data-upload-error": l.value ?? void 0,
1076
+ onClick: d
1076
1077
  }, [
1077
- c.value ? (t(), p("img", {
1078
+ o.value ? (A(), w("img", {
1078
1079
  key: 0,
1079
1080
  src: e.modelValue ?? void 0,
1080
1081
  class: "absolute inset-0 size-full object-cover",
1081
1082
  alt: ""
1082
- }, null, 8, wt)) : _("", !0),
1083
- l.value ? (t(), p("span", {
1083
+ }, null, 8, wt)) : C("", !0),
1084
+ s.value ? (A(), w("span", {
1084
1085
  key: 1,
1085
- class: f(["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"])
1086
- }, r(l.value), 3)) : _("", !0),
1087
- c.value ? _("", !0) : (t(), p("span", Tt, r(u.value ? "…" : d.value ? "!" : "点击上传图片"), 1))
1086
+ class: k(["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"])
1087
+ }, P(s.value), 3)) : C("", !0),
1088
+ o.value ? C("", !0) : (A(), w("span", Tt, P(c.value ? "…" : l.value ? "!" : "点击上传图片"), 1))
1088
1089
  ], 8, Ct),
1089
- x("input", {
1090
+ T("input", {
1090
1091
  ref_key: "fileInput",
1091
- ref: m,
1092
+ ref: u,
1092
1093
  type: "file",
1093
1094
  class: "hidden",
1094
1095
  accept: "image/*",
1095
- onChange: g
1096
+ onChange: f
1096
1097
  }, null, 544),
1097
- x("div", Et, [O(Z, {
1098
+ T("div", Et, [E(Z, {
1098
1099
  class: "flex-1",
1099
1100
  field: e.field,
1100
1101
  "model-value": e.modelValue ?? "",
1101
1102
  "aria-label": e.field.label,
1102
- onInput: i[0] ||= (e) => a("input", e),
1103
- onChange: i[1] ||= (e) => a("change", e)
1103
+ onInput: n[0] ||= (e) => r("input", e),
1104
+ onChange: n[1] ||= (e) => r("change", e)
1104
1105
  }, null, 8, [
1105
1106
  "field",
1106
1107
  "model-value",
1107
1108
  "aria-label"
1108
- ]), c.value ? (t(), p("button", {
1109
+ ]), o.value ? (A(), w("button", {
1109
1110
  key: 0,
1110
1111
  type: "button",
1111
1112
  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",
1112
1113
  title: "清除图片(资源地址置空)",
1113
- onClick: i[2] ||= (e) => a("change", "")
1114
- }, "清除")) : _("", !0)])
1115
- ])) : (t(), v(Z, {
1114
+ onClick: n[2] ||= (e) => r("change", "")
1115
+ }, "清除")) : C("", !0)])
1116
+ ])) : (A(), S(Z, {
1116
1117
  key: 1,
1117
1118
  field: e.field,
1118
1119
  "model-value": e.modelValue ?? "",
1119
1120
  "aria-label": e.field.label,
1120
- onInput: i[3] ||= (e) => a("input", e),
1121
- onChange: i[4] ||= (e) => a("change", e)
1121
+ onInput: n[3] ||= (e) => r("input", e),
1122
+ onChange: n[4] ||= (e) => r("change", e)
1122
1123
  }, null, 8, [
1123
1124
  "field",
1124
1125
  "model-value",
@@ -1130,97 +1131,97 @@ var xt = ["value", "placeholder"], Z = /* @__PURE__ */ h({
1130
1131
  "min",
1131
1132
  "max",
1132
1133
  "step"
1133
- ], Q = /* @__PURE__ */ h({
1134
+ ], Q = /* @__PURE__ */ D({
1134
1135
  __name: "NumberField",
1135
1136
  props: {
1136
1137
  field: {},
1137
1138
  modelValue: {}
1138
1139
  },
1139
1140
  emits: ["input", "change"],
1140
- setup(e, { emit: r }) {
1141
- let a = e, o = r, c = k(String(a.modelValue)), l = k(!1);
1142
- s(() => a.modelValue, (e) => {
1143
- l.value || (c.value = String(e));
1141
+ setup(e, { emit: t }) {
1142
+ let n = e, r = t, i = j(String(n.modelValue)), a = j(!1);
1143
+ L(() => n.modelValue, (e) => {
1144
+ a.value || (i.value = String(e));
1144
1145
  });
1145
- function u(e) {
1146
- let t = a.field.integer ? Math.trunc(e) : e;
1147
- return a.field.min !== void 0 && (t = Math.max(a.field.min, t)), a.field.max !== void 0 && (t = Math.min(a.field.max, t)), t;
1146
+ function o(e) {
1147
+ let t = n.field.integer ? Math.trunc(e) : e;
1148
+ return n.field.min !== void 0 && (t = Math.max(n.field.min, t)), n.field.max !== void 0 && (t = Math.min(n.field.max, t)), t;
1148
1149
  }
1149
- function d(e) {
1150
+ function s(e) {
1150
1151
  if (e.value.trim() === "") return null;
1151
1152
  let t = Number(e.value);
1152
1153
  return Number.isFinite(t) ? t : null;
1153
1154
  }
1154
- function m(e) {
1155
+ function c(e) {
1155
1156
  let t = e.target;
1156
- c.value = t.value;
1157
- let n = d(t);
1158
- n !== null && o("input", u(n));
1157
+ i.value = t.value;
1158
+ let n = s(t);
1159
+ n !== null && r("input", o(n));
1159
1160
  }
1160
- function h(e) {
1161
- let t = d(e.target);
1161
+ function l(e) {
1162
+ let t = s(e.target);
1162
1163
  if (t === null) {
1163
- c.value = String(a.modelValue);
1164
+ i.value = String(n.modelValue);
1164
1165
  return;
1165
1166
  }
1166
- let n = u(t);
1167
- c.value = String(n), o("change", n);
1167
+ let a = o(t);
1168
+ i.value = String(a), r("change", a);
1168
1169
  }
1169
- return (r, a) => n((t(), p("input", {
1170
- "onUpdate:modelValue": a[0] ||= (e) => c.value = e,
1171
- class: f(["cn-field cn-field--number", i(q)]),
1170
+ return (t, n) => fe((A(), w("input", {
1171
+ "onUpdate:modelValue": n[0] ||= (e) => i.value = e,
1172
+ class: k(["cn-field cn-field--number", F(Y)]),
1172
1173
  type: "number",
1173
1174
  "aria-label": e.field.label,
1174
1175
  min: e.field.min,
1175
1176
  max: e.field.max,
1176
1177
  step: e.field.step ?? (e.field.integer ? 1 : .1),
1177
- onInput: m,
1178
- onFocus: a[1] ||= (e) => l.value = !0,
1179
- onBlur: h,
1180
- onChange: h
1181
- }, null, 42, Ot)), [[w, c.value]]);
1178
+ onInput: c,
1179
+ onFocus: n[1] ||= (e) => a.value = !0,
1180
+ onBlur: l,
1181
+ onChange: l
1182
+ }, null, 42, Ot)), [[I, i.value]]);
1182
1183
  }
1183
- }), kt = { class: "cn-padding flex w-full min-w-0 items-center gap-1.5" }, At = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, jt = /* @__PURE__ */ h({
1184
+ }), kt = { class: "cn-padding flex w-full min-w-0 items-center gap-1.5" }, At = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, jt = /* @__PURE__ */ D({
1184
1185
  __name: "PaddingField",
1185
1186
  props: {
1186
1187
  field: {},
1187
1188
  modelValue: {}
1188
1189
  },
1189
1190
  emits: ["input", "change"],
1190
- setup(e, { emit: n }) {
1191
- let a = e, o = n, { mode: s, cycle: c } = G(() => a.modelValue, Ue), l = S(() => U[s.value]);
1192
- function u(e) {
1191
+ setup(e, { emit: t }) {
1192
+ let n = e, r = t, { mode: i, cycle: a } = Ke(() => n.modelValue, Be), o = x(() => Re[i.value]);
1193
+ function s(e) {
1193
1194
  return {
1194
1195
  key: ["padding", e.rep],
1195
1196
  label: e.label,
1196
1197
  control: "number"
1197
1198
  };
1198
1199
  }
1199
- function d(e, t, n) {
1200
- let r = { ...a.modelValue };
1201
- for (let n of e.sides) r[n] = t;
1202
- o(n ? "change" : "input", r);
1200
+ function c(e, t, i) {
1201
+ let a = { ...n.modelValue };
1202
+ for (let n of e.sides) a[n] = t;
1203
+ r(i ? "change" : "input", a);
1203
1204
  }
1204
- function m() {
1205
- let { from: e, to: t } = c();
1205
+ function l() {
1206
+ let { from: e, to: t } = a();
1206
1207
  if (t < e) {
1207
- let e = We(a.modelValue, t);
1208
- Ge(e, a.modelValue) || o("change", e);
1208
+ let e = Ve(n.modelValue, t);
1209
+ He(e, n.modelValue) || r("change", e);
1209
1210
  }
1210
1211
  }
1211
- return (n, a) => (t(), p("span", kt, [O(Y, {
1212
- mode: i(s),
1212
+ return (t, n) => (A(), w("span", kt, [E($e, {
1213
+ mode: F(i),
1213
1214
  label: "内边距",
1214
- onCycle: m
1215
- }, null, 8, ["mode"]), x("span", { class: f(["grid min-w-0 flex-1 gap-1.5", i(s) === 1 ? "grid-cols-1" : "grid-cols-2"]) }, [(t(!0), p(g, null, b(l.value, (n) => (t(), p("label", {
1216
- key: n.rep,
1215
+ onCycle: l
1216
+ }, null, 8, ["mode"]), T("span", { class: k(["grid min-w-0 flex-1 gap-1.5", F(i) === 1 ? "grid-cols-1" : "grid-cols-2"]) }, [(A(!0), w(b, null, M(o.value, (t) => (A(), w("label", {
1217
+ key: t.rep,
1217
1218
  class: "flex min-w-0 items-center gap-1.5"
1218
- }, [x("span", At, r(n.label), 1), O(Q, {
1219
+ }, [T("span", At, P(t.label), 1), E(Q, {
1219
1220
  class: "min-w-0 flex-1",
1220
- field: u(n),
1221
- "model-value": e.modelValue[n.rep],
1222
- onInput: (e) => d(n, e, !1),
1223
- onChange: (e) => d(n, e, !0)
1221
+ field: s(t),
1222
+ "model-value": e.modelValue[t.rep],
1223
+ onInput: (e) => c(t, e, !1),
1224
+ onChange: (e) => c(t, e, !0)
1224
1225
  }, null, 8, [
1225
1226
  "field",
1226
1227
  "model-value",
@@ -1237,7 +1238,7 @@ var xt = ["value", "placeholder"], Z = /* @__PURE__ */ h({
1237
1238
  "value",
1238
1239
  "placeholder",
1239
1240
  "title"
1240
- ], Lt = /* @__PURE__ */ h({
1241
+ ], Lt = /* @__PURE__ */ D({
1241
1242
  __name: "PairField",
1242
1243
  props: {
1243
1244
  field: {},
@@ -1249,80 +1250,80 @@ var xt = ["value", "placeholder"], Z = /* @__PURE__ */ h({
1249
1250
  "change",
1250
1251
  "sub-commit"
1251
1252
  ],
1252
- setup(e, { emit: n }) {
1253
- let a = e, o = n, s = S(() => a.field.items ?? []);
1254
- function c(e) {
1253
+ setup(e, { emit: t }) {
1254
+ let n = e, r = t, i = x(() => n.field.items ?? []);
1255
+ function a(e) {
1255
1256
  if (!e.auto) return !1;
1256
- let t = V(a.modelValue, e.auto.key);
1257
+ let t = K(n.modelValue, e.auto.key);
1257
1258
  return t.ok && t.value === !0;
1258
1259
  }
1259
- function l(e) {
1260
+ function o(e) {
1260
1261
  return {
1261
1262
  ...e,
1262
- key: z(a.field, e)
1263
+ key: U(n.field, e)
1263
1264
  };
1264
1265
  }
1265
- function u(e) {
1266
+ function s(e) {
1266
1267
  return {
1267
- key: [...a.field.key, ...e.auto?.key ?? []],
1268
+ key: [...n.field.key, ...e.auto?.key ?? []],
1268
1269
  label: `${e.label}自适应`,
1269
1270
  control: "boolean"
1270
1271
  };
1271
1272
  }
1272
- function d(e, t, n) {
1273
- o("sub-commit", l(e), t, n);
1273
+ function c(e, t, n) {
1274
+ r("sub-commit", o(e), t, n);
1274
1275
  }
1275
- function m(e) {
1276
- o("sub-commit", u(e), !c(e), !0);
1276
+ function l(e) {
1277
+ r("sub-commit", s(e), !a(e), !0);
1277
1278
  }
1278
- function h(e) {
1279
- let t = V(a.modelValue, e.key);
1279
+ function u(e) {
1280
+ let t = K(n.modelValue, e.key);
1280
1281
  return t.ok && typeof t.value == "number" ? t.value : 0;
1281
1282
  }
1282
- function y(e) {
1283
- return a.displays?.[z(a.field, e).join(".")];
1283
+ function d(e) {
1284
+ return n.displays?.[U(n.field, e).join(".")];
1284
1285
  }
1285
- function C(e) {
1286
- let t = y(e);
1286
+ function f(e) {
1287
+ let t = d(e);
1287
1288
  return t === void 0 ? "" : String(t.value);
1288
1289
  }
1289
- function w(e) {
1290
- return c(e) ? `${e.label}自适应:已开启(输入框禁用)` : `${e.label}自适应:开启后由内容决定,输入框禁用`;
1290
+ function p(e) {
1291
+ return a(e) ? `${e.label}自适应:已开启(输入框禁用)` : `${e.label}自适应:开启后由内容决定,输入框禁用`;
1291
1292
  }
1292
- function E(e) {
1293
- let t = y(e);
1293
+ function m(e) {
1294
+ let t = d(e);
1294
1295
  return t?.preview ? "模板子树:预览盒尺寸(随行实例变化,非文档声明值)" : t === void 0 ? `${e.label}自适应:已开启` : `${e.label}自适应:布局解析值(与画布选择框同源)`;
1295
1296
  }
1296
- return (e, n) => (t(), p("span", Mt, [(t(!0), p(g, null, b(s.value, (e) => (t(), p("label", {
1297
+ return (e, t) => (A(), w("span", Mt, [(A(!0), w(b, null, M(i.value, (e) => (A(), w("label", {
1297
1298
  key: e.key.join("."),
1298
1299
  class: "flex min-w-0 items-center gap-1",
1299
1300
  title: e.auto ? void 0 : e.label
1300
1301
  }, [
1301
- x("span", Pt, r(e.label), 1),
1302
- e.auto ? (t(), p("button", {
1302
+ T("span", Pt, P(e.label), 1),
1303
+ e.auto ? (A(), w("button", {
1303
1304
  key: 0,
1304
1305
  type: "button",
1305
- class: f(["cn-props__auto-toggle shrink-0", { "cn-props__auto-toggle--active": c(e) }]),
1306
- "aria-pressed": c(e),
1307
- title: w(e),
1308
- onClick: T((t) => m(e), ["prevent"])
1309
- }, "自", 10, Ft)) : _("", !0),
1310
- c(e) ? (t(), p("input", {
1306
+ class: k(["cn-props__auto-toggle shrink-0", { "cn-props__auto-toggle--active": a(e) }]),
1307
+ "aria-pressed": a(e),
1308
+ title: p(e),
1309
+ onClick: R((t) => l(e), ["prevent"])
1310
+ }, "自", 10, Ft)) : C("", !0),
1311
+ a(e) ? (A(), w("input", {
1311
1312
  key: 2,
1312
- class: f(["cn-field cn-field--number min-w-0 flex-1", [i(q), y(e)?.preview ? "cn-field--preview" : ""]]),
1313
+ class: k(["cn-field cn-field--number min-w-0 flex-1", [F(Y), d(e)?.preview ? "cn-field--preview" : ""]]),
1313
1314
  type: "number",
1314
1315
  disabled: "",
1315
1316
  "aria-label": e.label,
1316
- value: C(e),
1317
+ value: f(e),
1317
1318
  placeholder: e.auto?.placeholder ?? "",
1318
- title: E(e)
1319
- }, null, 10, It)) : (t(), v(Q, {
1319
+ title: m(e)
1320
+ }, null, 10, It)) : (A(), S(Q, {
1320
1321
  key: 1,
1321
1322
  class: "min-w-0 flex-1",
1322
1323
  field: e,
1323
- "model-value": h(e),
1324
- onInput: (t) => d(e, t, !1),
1325
- onChange: (t) => d(e, t, !0)
1324
+ "model-value": u(e),
1325
+ onInput: (t) => c(e, t, !1),
1326
+ onChange: (t) => c(e, t, !0)
1326
1327
  }, null, 8, [
1327
1328
  "field",
1328
1329
  "model-value",
@@ -1331,149 +1332,149 @@ var xt = ["value", "placeholder"], Z = /* @__PURE__ */ h({
1331
1332
  ]))
1332
1333
  ], 8, Nt))), 128))]));
1333
1334
  }
1334
- }), Rt = ["value"], zt = ["value"], Bt = /* @__PURE__ */ h({
1335
+ }), Rt = ["value"], zt = ["value"], Bt = /* @__PURE__ */ D({
1335
1336
  __name: "SelectField",
1336
1337
  props: {
1337
1338
  field: {},
1338
1339
  modelValue: {}
1339
1340
  },
1340
1341
  emits: ["change"],
1341
- setup(e, { emit: n }) {
1342
- let i = n;
1343
- function a(e) {
1344
- i("change", e.target.value);
1342
+ setup(e, { emit: t }) {
1343
+ let n = t;
1344
+ function r(e) {
1345
+ n("change", e.target.value);
1345
1346
  }
1346
- return (n, i) => (t(), p("select", {
1347
+ return (t, n) => (A(), w("select", {
1347
1348
  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",
1348
1349
  value: e.modelValue,
1349
- onChange: a
1350
- }, [(t(!0), p(g, null, b(e.field.domain ?? [], (e) => (t(), p("option", {
1350
+ onChange: r
1351
+ }, [(A(!0), w(b, null, M(e.field.domain ?? [], (e) => (A(), w("option", {
1351
1352
  key: e,
1352
1353
  value: e
1353
- }, r(e), 9, zt))), 128))], 40, Rt));
1354
+ }, P(e), 9, zt))), 128))], 40, Rt));
1354
1355
  }
1355
- }), Vt = ["value"], Ht = /* @__PURE__ */ h({
1356
+ }), Vt = ["value"], Ht = /* @__PURE__ */ D({
1356
1357
  __name: "TextareaField",
1357
1358
  props: {
1358
1359
  field: {},
1359
1360
  modelValue: {}
1360
1361
  },
1361
1362
  emits: ["input", "change"],
1362
- setup(e, { emit: n }) {
1363
- let r = n, a = !1;
1364
- function o(e) {
1363
+ setup(e, { emit: t }) {
1364
+ let n = t, r = !1;
1365
+ function i(e) {
1365
1366
  let t = e.target.value;
1366
- a || e.isComposing || r("input", t);
1367
+ r || e.isComposing || n("input", t);
1367
1368
  }
1368
- function s() {
1369
- a = !0;
1369
+ function a() {
1370
+ r = !0;
1370
1371
  }
1371
- function c(e) {
1372
- a = !1, r("input", e.target.value);
1372
+ function o(e) {
1373
+ r = !1, n("input", e.target.value);
1373
1374
  }
1374
- function l(e) {
1375
- a = !1, r("change", e.target.value);
1375
+ function s(e) {
1376
+ r = !1, n("change", e.target.value);
1376
1377
  }
1377
- return (n, r) => (t(), p("textarea", {
1378
- class: f(["cn-field", i(Ye)]),
1378
+ return (t, n) => (A(), w("textarea", {
1379
+ class: k(["cn-field", F(Je)]),
1379
1380
  rows: "3",
1380
1381
  value: e.modelValue,
1381
- onInput: o,
1382
- onCompositionstart: s,
1383
- onCompositionend: c,
1384
- onChange: l
1382
+ onInput: i,
1383
+ onCompositionstart: a,
1384
+ onCompositionend: o,
1385
+ onChange: s
1385
1386
  }, null, 42, Vt));
1386
1387
  }
1387
- }), Ut = {
1388
- number: a(Q),
1389
- text: a(Z),
1390
- textarea: a(Ht),
1391
- color: a(yt),
1392
- select: a(Bt),
1393
- boolean: a(Ve),
1394
- pair: a(Lt),
1395
- anchor: a(H),
1396
- align: a(ke),
1397
- padding: a(jt),
1398
- border: a(at),
1399
- font: a(pt),
1400
- imageSrc: a(Dt)
1388
+ }), $ = {
1389
+ number: O(Q),
1390
+ text: O(Z),
1391
+ textarea: O(Ht),
1392
+ color: O(yt),
1393
+ select: O(Bt),
1394
+ boolean: O(Le),
1395
+ pair: O(Lt),
1396
+ anchor: O(Pe),
1397
+ align: O(we),
1398
+ padding: O(jt),
1399
+ border: O(at),
1400
+ font: O(pt),
1401
+ imageSrc: O(Dt)
1401
1402
  };
1402
1403
  //#endregion
1403
1404
  //#region src/property-panel/usePropertyPanel.ts
1404
- function $(t) {
1405
- let n = e(t.store.doc), r = e(t.store.ui.selection), i = e(t.store.ui.anchorExpanded), a = e(t.store.ui.dataSourceSchema), s = e(t.store.ui.resourceStatuses), c = t.subscribe((e) => {
1406
- e.scope === "doc" ? (n.value = t.store.doc, r.value = t.store.ui.selection, s.value = t.store.ui.resourceStatuses) : e.scope === "ui" && (e.branch === "selection" ? (r.value = t.store.ui.selection, t.store.closeMerge()) : e.branch === "anchorExpanded" ? i.value = t.store.ui.anchorExpanded : e.branch === "dataSourceSchema" ? a.value = t.store.ui.dataSourceSchema : e.branch === "resourceStatuses" && (s.value = t.store.ui.resourceStatuses));
1405
+ function Ut(e) {
1406
+ let t = N(e.store.doc), n = N(e.store.ui.selection), r = N(e.store.ui.anchorExpanded), i = N(e.store.ui.dataSourceSchema), a = N(e.store.ui.resourceStatuses), o = e.subscribe((o) => {
1407
+ o.scope === "doc" ? (t.value = e.store.doc, n.value = e.store.ui.selection, a.value = e.store.ui.resourceStatuses) : o.scope === "ui" && (o.branch === "selection" ? (n.value = e.store.ui.selection, e.store.closeMerge()) : o.branch === "anchorExpanded" ? r.value = e.store.ui.anchorExpanded : o.branch === "dataSourceSchema" ? i.value = e.store.ui.dataSourceSchema : o.branch === "resourceStatuses" && (a.value = e.store.ui.resourceStatuses));
1407
1408
  });
1408
- o(c, !0);
1409
- let l = S(() => {
1410
- let e = n.value, t = r.value;
1411
- return e && t ? m(e, t) : null;
1412
- }), u = S(() => n.value), d = S(() => {
1413
- let e = l.value, t = r.value;
1414
- return e && t ? Te(t, e) : n.value ? B : [];
1415
- }), f = S(() => {
1416
- let e = r.value;
1417
- return e && n.value ? t.layerBoxAt(e) : null;
1418
- }), p = S(() => {
1419
- let e = a.value;
1420
- return e === null ? null : fe(e, ue(e, n.value, r.value));
1421
- }), h = S(() => pe(me(n.value, r.value, a.value))), g = S(() => r.value?.includes("template") ?? !1);
1422
- function _(e) {
1423
- t.store.setAnchorExpanded(e);
1409
+ se(o, !0);
1410
+ let s = x(() => {
1411
+ let e = t.value, r = n.value;
1412
+ return e && r ? p(e, r) : null;
1413
+ }), c = x(() => t.value), l = x(() => {
1414
+ let e = s.value, r = n.value;
1415
+ return e && r ? W(r, e) : t.value ? G : [];
1416
+ }), u = x(() => {
1417
+ let r = n.value;
1418
+ return r && t.value ? e.layerBoxAt(r) : null;
1419
+ }), d = x(() => {
1420
+ let e = i.value;
1421
+ return e === null ? null : te(e, _(e, t.value, n.value));
1422
+ }), f = x(() => y(ne(t.value, n.value, i.value))), m = x(() => n.value?.includes("template") ?? !1);
1423
+ function h(t) {
1424
+ e.store.setAnchorExpanded(t);
1424
1425
  }
1425
- function v(e) {
1426
+ function g(e) {
1426
1427
  if (!e.data) return !1;
1427
- let t = l.value;
1428
+ let t = s.value;
1428
1429
  return t !== null && "expression" in t && t.expression !== null;
1429
1430
  }
1430
- function y(e, i, a) {
1431
- if (!n.value) return;
1432
- let o = r.value;
1431
+ function ee(r, i, a) {
1432
+ if (!t.value) return;
1433
+ let o = n.value;
1433
1434
  if (!o) {
1434
- x(e, i, a);
1435
+ re(r, i, a);
1435
1436
  return;
1436
1437
  }
1437
- let s = `sel:${o.join(".")}:${e.key.join(".")}`;
1438
- if (e.data) {
1439
- if (v(e)) {
1440
- let e = `sel:${o.join(".")}:data.expression`;
1441
- t.updateDataExpression(o, i, { mergeKey: e }), a && t.store.closeMerge(e);
1438
+ let s = `sel:${o.join(".")}:${r.key.join(".")}`;
1439
+ if (r.data) {
1440
+ if (g(r)) {
1441
+ let t = `sel:${o.join(".")}:data.expression`;
1442
+ e.updateDataExpression(o, i, { mergeKey: t }), a && e.store.closeMerge(t);
1442
1443
  return;
1443
1444
  }
1444
- t.updateData(o, i, { mergeKey: s }), a && t.store.closeMerge(s);
1445
+ e.updateData(o, i, { mergeKey: s }), a && e.store.closeMerge(s);
1445
1446
  return;
1446
1447
  }
1447
- t.updateSpec(o, e.key, i, { mergeKey: s }), a && t.store.closeMerge(s);
1448
+ e.updateSpec(o, r.key, i, { mergeKey: s }), a && e.store.closeMerge(s);
1448
1449
  }
1449
- function b(e) {
1450
- let n = l.value, i = r.value;
1451
- if (!n || !i || !e.data) return;
1452
- let a = V(n, e.key);
1450
+ function v(t) {
1451
+ let r = s.value, i = n.value;
1452
+ if (!r || !i || !t.data) return;
1453
+ let a = K(r, t.key);
1453
1454
  if (!a.ok) return;
1454
1455
  let o = typeof a.value == "string" ? a.value : "";
1455
- v(e) ? t.updateData(i, o) : t.updateDataExpression(i, o);
1456
+ g(t) ? e.updateData(i, o) : e.updateDataExpression(i, o);
1456
1457
  }
1457
- function x(e, n, r) {
1458
- let i = e.key[0];
1458
+ function re(t, n, r) {
1459
+ let i = t.key[0];
1459
1460
  if (i !== "width" && i !== "height" || typeof n != "number") return;
1460
1461
  let a = `canvas:${i}`;
1461
- t.updateCanvasProp(i, n, { mergeKey: a }), r && t.store.closeMerge(a);
1462
+ e.updateCanvasProp(i, n, { mergeKey: a }), r && e.store.closeMerge(a);
1462
1463
  }
1463
1464
  return {
1464
- selection: S(() => r.value),
1465
- layer: l,
1466
- canvas: u,
1467
- sections: d,
1468
- layerBox: f,
1469
- isPreviewBox: g,
1470
- completionSource: p,
1471
- rowsPathSource: h,
1472
- resourceStatuses: S(() => s.value),
1473
- anchorExpanded: S(() => i.value),
1474
- commit: y,
1475
- toggleDataMode: b,
1476
- setAnchorExpanded: _
1465
+ selection: x(() => n.value),
1466
+ layer: s,
1467
+ canvas: c,
1468
+ sections: l,
1469
+ layerBox: u,
1470
+ isPreviewBox: m,
1471
+ completionSource: d,
1472
+ rowsPathSource: f,
1473
+ resourceStatuses: x(() => a.value),
1474
+ anchorExpanded: x(() => r.value),
1475
+ commit: ee,
1476
+ toggleDataMode: v,
1477
+ setAnchorExpanded: h
1477
1478
  };
1478
1479
  }
1479
1480
  //#endregion
@@ -1486,12 +1487,12 @@ var Wt = {
1486
1487
  "aria-pressed",
1487
1488
  "title",
1488
1489
  "onClick"
1489
- ], Kt = /* @__PURE__ */ h({
1490
+ ], Kt = /* @__PURE__ */ D({
1490
1491
  __name: "ValueTypeSegmented",
1491
1492
  props: { mode: {} },
1492
1493
  emits: ["change"],
1493
- setup(e, { emit: n }) {
1494
- let i = e, a = n, o = [{
1494
+ setup(e, { emit: t }) {
1495
+ let n = e, r = t, i = [{
1495
1496
  value: "static",
1496
1497
  label: "静态",
1497
1498
  title: "静态值:输入的字面内容直接显示在画布上"
@@ -1500,22 +1501,22 @@ var Wt = {
1500
1501
  label: "表达式",
1501
1502
  title: "表达式值:内容为插值原文,画布显示解析镜像({{路径}} / {{$index}} / {{$root.*}})"
1502
1503
  }];
1503
- function s(e) {
1504
- e !== i.mode && a("change", e);
1504
+ function a(e) {
1505
+ e !== n.mode && r("change", e);
1505
1506
  }
1506
- return (n, i) => (t(), p("span", Wt, [(t(), p(g, null, b(o, (t, n) => x("button", {
1507
+ return (t, n) => (A(), w("span", Wt, [(A(), w(b, null, M(i, (t, n) => T("button", {
1507
1508
  key: t.value,
1508
1509
  type: "button",
1509
- class: f(["cn-valuetype__option flex items-center justify-center p-0 px-1.5 text-[10px] leading-none transition-colors duration-100 focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cn-accent/40", [n > 0 ? "border-l border-cn-field-line" : "", t.value === e.mode ? "cn-valuetype__option--active bg-cn-accent-soft text-cn-accent" : "text-cn-muted hover:text-cn-fg"]]),
1510
+ class: k(["cn-valuetype__option flex items-center justify-center p-0 px-1.5 text-[10px] leading-none transition-colors duration-100 focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cn-accent/40", [n > 0 ? "border-l border-cn-field-line" : "", t.value === e.mode ? "cn-valuetype__option--active bg-cn-accent-soft text-cn-accent" : "text-cn-muted hover:text-cn-fg"]]),
1510
1511
  "aria-pressed": t.value === e.mode,
1511
1512
  title: t.value === e.mode ? t.title : `${t.title};点击切换`,
1512
- onClick: T((e) => s(t.value), ["prevent"])
1513
- }, r(t.label), 11, Gt)), 64))]));
1513
+ onClick: R((e) => a(t.value), ["prevent"])
1514
+ }, P(t.label), 11, Gt)), 64))]));
1514
1515
  }
1515
1516
  }), qt = ["title"], Jt = {
1516
1517
  key: 2,
1517
1518
  class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
1518
- }, Yt = /* @__PURE__ */ h({
1519
+ }, Yt = /* @__PURE__ */ D({
1519
1520
  __name: "PropertyField",
1520
1521
  props: {
1521
1522
  field: {},
@@ -1532,51 +1533,51 @@ var Wt = {
1532
1533
  "toggle-mode",
1533
1534
  "sub-commit"
1534
1535
  ],
1535
- setup(e, { emit: n }) {
1536
- let a = e, o = n, s = S(() => Ut[a.field.control]), c = S(() => a.dataMode === "expression"), l = S(() => a.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"), d = S(() => a.field.data === !0 ? "col-span-2" : ""), m = S(() => a.field.data === !0 && (a.field.control === "textarea" || a.field.control === "text" || a.field.control === "imageSrc")), h = S(() => a.field.completion === "rowsPath"), b = S(() => m.value || h.value), x = k(null), C = S(() => {
1537
- if (!b.value) return null;
1538
- let e = x.value?.$el;
1536
+ setup(e, { emit: t }) {
1537
+ let n = e, r = t, i = x(() => $[n.field.control]), a = x(() => n.dataMode === "expression"), o = x(() => 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 = x(() => n.field.data === !0 ? "col-span-2" : ""), c = x(() => n.field.data === !0 && (n.field.control === "textarea" || n.field.control === "text" || n.field.control === "imageSrc")), l = x(() => n.field.completion === "rowsPath"), u = x(() => c.value || l.value), d = j(null), f = x(() => {
1538
+ if (!u.value) return null;
1539
+ let e = d.value?.$el;
1539
1540
  return e instanceof HTMLTextAreaElement || e instanceof HTMLInputElement ? e : null;
1540
- }), w = k(null), T = S(() => w.value?.rootEl ?? null), { popup: E, accept: D } = de({
1541
- target: C,
1542
- enabled: () => m.value && c.value && a.completion != null,
1543
- pairing: () => m.value && c.value,
1544
- resolve: (e) => a.completion?.(e) ?? null,
1545
- popupEl: T
1546
- }), { popup: O, accept: A } = he({
1547
- target: C,
1548
- enabled: () => h.value && a.completion != null,
1549
- resolve: (e) => a.completion?.(e) ?? null,
1550
- popupEl: T
1541
+ }), p = j(null), m = x(() => p.value?.rootEl ?? null), { popup: h, accept: _ } = ee({
1542
+ target: f,
1543
+ enabled: () => c.value && a.value && n.completion != null,
1544
+ pairing: () => c.value && a.value,
1545
+ resolve: (e) => n.completion?.(e) ?? null,
1546
+ popupEl: m
1547
+ }), { popup: te, accept: v } = re({
1548
+ target: f,
1549
+ enabled: () => l.value && n.completion != null,
1550
+ resolve: (e) => n.completion?.(e) ?? null,
1551
+ popupEl: m
1551
1552
  });
1552
- function j(e, t, n) {
1553
- o("sub-commit", e, t, n);
1553
+ function y(e, t, n) {
1554
+ r("sub-commit", e, t, n);
1554
1555
  }
1555
- return (n, a) => (t(), p(g, null, [(t(), v(y(e.field.control === "pair" || e.field.control === "imageSrc" ? "div" : "label"), { class: f(l.value) }, {
1556
- default: u(() => [
1557
- e.field.control === "pair" ? _("", !0) : (t(), p("span", {
1556
+ return (t, n) => (A(), w(b, null, [(A(), S(le(e.field.control === "pair" || e.field.control === "imageSrc" ? "div" : "label"), { class: k(o.value) }, {
1557
+ default: de(() => [
1558
+ e.field.control === "pair" ? C("", !0) : (A(), w("span", {
1558
1559
  key: 0,
1559
1560
  class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted",
1560
1561
  title: e.field.title
1561
- }, r(e.field.label), 9, qt)),
1562
- e.field.data ? (t(), v(Kt, {
1562
+ }, P(e.field.label), 9, qt)),
1563
+ e.field.data ? (A(), S(Kt, {
1563
1564
  key: 1,
1564
1565
  class: "justify-self-end",
1565
1566
  mode: e.dataMode ?? "static",
1566
- onChange: a[0] ||= (e) => o("toggle-mode")
1567
- }, null, 8, ["mode"])) : _("", !0),
1568
- (t(), v(y(s.value), {
1567
+ onChange: n[0] ||= (e) => r("toggle-mode")
1568
+ }, null, 8, ["mode"])) : C("", !0),
1569
+ (A(), S(le(i.value), {
1569
1570
  ref_key: "controlRef",
1570
- ref: x,
1571
- class: f(["cn-prop-field__control", [d.value, { "cn-field--expression": c.value }]]),
1571
+ ref: d,
1572
+ class: k(["cn-prop-field__control", [s.value, { "cn-field--expression": a.value }]]),
1572
1573
  field: e.field,
1573
1574
  "model-value": e.value,
1574
1575
  displays: e.field.control === "pair" ? e.displays : void 0,
1575
1576
  "data-mode": e.field.control === "imageSrc" ? e.dataMode : void 0,
1576
1577
  "resource-status": e.field.control === "imageSrc" ? e.resourceStatus : void 0,
1577
- onInput: a[1] ||= (e) => o("input", e),
1578
- onChange: a[2] ||= (e) => o("change", e),
1579
- onSubCommit: j
1578
+ onInput: n[1] ||= (e) => r("input", e),
1579
+ onChange: n[2] ||= (e) => r("change", e),
1580
+ onSubCommit: y
1580
1581
  }, null, 40, [
1581
1582
  "class",
1582
1583
  "field",
@@ -1585,120 +1586,120 @@ var Wt = {
1585
1586
  "data-mode",
1586
1587
  "resource-status"
1587
1588
  ])),
1588
- e.hint ? (t(), p("span", Jt, r(e.hint), 1)) : _("", !0)
1589
+ e.hint ? (A(), w("span", Jt, P(e.hint), 1)) : C("", !0)
1589
1590
  ]),
1590
1591
  _: 1
1591
- }, 8, ["class"])), m.value ? (t(), v(le, {
1592
+ }, 8, ["class"])), c.value ? (A(), S(g, {
1592
1593
  key: 0,
1593
1594
  ref_key: "popupRef",
1594
- ref: w,
1595
- state: i(E),
1596
- onSelect: i(D)
1597
- }, null, 8, ["state", "onSelect"])) : h.value ? (t(), v(le, {
1595
+ ref: p,
1596
+ state: F(h),
1597
+ onSelect: F(_)
1598
+ }, null, 8, ["state", "onSelect"])) : l.value ? (A(), S(g, {
1598
1599
  key: 1,
1599
1600
  ref_key: "popupRef",
1600
- ref: w,
1601
- state: i(O),
1602
- onSelect: i(A)
1603
- }, null, 8, ["state", "onSelect"])) : _("", !0)], 64));
1601
+ ref: p,
1602
+ state: F(te),
1603
+ onSelect: F(v)
1604
+ }, null, 8, ["state", "onSelect"])) : C("", !0)], 64));
1604
1605
  }
1605
1606
  }), Xt = { 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)]" }, Zt = { 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" }, Qt = { class: "flex items-center gap-2" }, $t = { 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" }, en = { class: "text-[12px] font-medium tracking-wide text-cn-fg/90" }, tn = {
1606
1607
  key: 0,
1607
1608
  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"
1608
- }, nn = { class: "cn-props__section-title mb-2 text-[10px] font-semibold uppercase tracking-[0.16em] text-cn-muted" }, rn = { class: "flex flex-col gap-2" }, an = /* @__PURE__ */ h({
1609
+ }, nn = { class: "cn-props__section-title mb-2 text-[10px] font-semibold uppercase tracking-[0.16em] text-cn-muted" }, rn = { class: "flex flex-col gap-2" }, an = /* @__PURE__ */ D({
1609
1610
  __name: "PropertyPanel",
1610
1611
  props: { editor: {} },
1611
1612
  setup(e) {
1612
- let n = e, a = $(n.editor);
1613
- l(X, {
1614
- canUpload: n.editor.canUpload,
1615
- uploadImage: (e) => n.editor.uploadImage(e)
1613
+ let t = e, n = Ut(t.editor);
1614
+ ce(X, {
1615
+ canUpload: t.editor.canUpload,
1616
+ uploadImage: (e) => t.editor.uploadImage(e)
1616
1617
  });
1617
- function o(e) {
1618
- return e.completion === "rowsPath" ? a.rowsPathSource.value : a.completionSource.value;
1618
+ function r(e) {
1619
+ return e.completion === "rowsPath" ? n.rowsPathSource.value : n.completionSource.value;
1619
1620
  }
1620
- let s = S(() => a.layer.value !== null), c = S(() => {
1621
- let e = a.layer.value;
1622
- return e ? e.type : a.canvas.value ? "Canvas" : "—";
1621
+ let i = x(() => n.layer.value !== null), a = x(() => {
1622
+ let e = n.layer.value;
1623
+ return e ? e.type : n.canvas.value ? "Canvas" : "—";
1623
1624
  });
1624
- function u(e) {
1625
- let t = V(e, ["expression"]);
1625
+ function o(e) {
1626
+ let t = K(e, ["expression"]);
1626
1627
  return t.ok && t.value !== null ? "expression" : "static";
1627
1628
  }
1628
- let d = S(() => {
1629
- let e = a.layer.value ?? (a.selection.value ? null : a.canvas.value);
1629
+ let s = x(() => {
1630
+ let e = n.layer.value ?? (n.selection.value ? null : n.canvas.value);
1630
1631
  if (!e) return [];
1631
- let t = a.selection.value?.join(".") ?? "canvas", n = a.layer.value, r = a.resourceStatuses.value, i = [];
1632
- for (let o of a.sections.value) {
1633
- let a = [];
1634
- for (let i of o.fields) {
1635
- let o = V(e, i.key);
1636
- o.ok && a.push({
1637
- key: `${t}:${i.key.join(".")}`,
1638
- field: i,
1639
- value: o.value,
1640
- dataMode: i.data ? u(e) : void 0,
1641
- hint: i.hint && n ? i.hint(n, r) ?? void 0 : void 0,
1642
- resourceStatus: i.control === "imageSrc" && typeof o.value == "string" && o.value !== "" ? r[o.value] : void 0
1632
+ let t = n.selection.value?.join(".") ?? "canvas", r = n.layer.value, i = n.resourceStatuses.value, a = [];
1633
+ for (let s of n.sections.value) {
1634
+ let n = [];
1635
+ for (let a of s.fields) {
1636
+ let s = K(e, a.key);
1637
+ s.ok && n.push({
1638
+ key: `${t}:${a.key.join(".")}`,
1639
+ field: a,
1640
+ value: s.value,
1641
+ dataMode: a.data ? o(e) : void 0,
1642
+ hint: a.hint && r ? a.hint(r, i) ?? void 0 : void 0,
1643
+ resourceStatus: a.control === "imageSrc" && typeof s.value == "string" && s.value !== "" ? i[s.value] : void 0
1643
1644
  });
1644
1645
  }
1645
- a.length > 0 && i.push({
1646
- title: o.title,
1647
- fields: a
1646
+ n.length > 0 && a.push({
1647
+ title: s.title,
1648
+ fields: n
1648
1649
  });
1649
1650
  }
1650
- return i;
1651
- }), f = S(() => {
1652
- let e = {}, t = a.layerBox.value, n = a.layer.value;
1653
- if (!t || !n) return e;
1654
- let r = /* @__PURE__ */ new Map();
1655
- if (n.shape.autoWidth && r.set("autoWidth", Math.round(t.width * 100) / 100), n.shape.autoHeight && r.set("autoHeight", Math.round(t.height * 100) / 100), r.size === 0) return e;
1656
- for (let t of a.sections.value) for (let n of t.fields) for (let t of n.items ?? []) {
1657
- let i = t.auto ? r.get(t.auto.key.join(".")) : void 0;
1658
- i !== void 0 && (e[z(n, t).join(".")] = {
1659
- value: i,
1660
- preview: a.isPreviewBox.value
1651
+ return a;
1652
+ }), c = x(() => {
1653
+ let e = {}, t = n.layerBox.value, r = n.layer.value;
1654
+ if (!t || !r) return e;
1655
+ let i = /* @__PURE__ */ new Map();
1656
+ if (r.shape.autoWidth && i.set("autoWidth", Math.round(t.width * 100) / 100), r.shape.autoHeight && i.set("autoHeight", Math.round(t.height * 100) / 100), i.size === 0) return e;
1657
+ for (let t of n.sections.value) for (let r of t.fields) for (let t of r.items ?? []) {
1658
+ let a = t.auto ? i.get(t.auto.key.join(".")) : void 0;
1659
+ a !== void 0 && (e[U(r, t).join(".")] = {
1660
+ value: a,
1661
+ preview: n.isPreviewBox.value
1661
1662
  });
1662
1663
  }
1663
1664
  return e;
1664
1665
  });
1665
- function m() {
1666
- a.setAnchorExpanded(!a.anchorExpanded.value);
1666
+ function l() {
1667
+ n.setAnchorExpanded(!n.anchorExpanded.value);
1667
1668
  }
1668
- return (e, n) => (t(), p("aside", Xt, [
1669
- x("header", Zt, [x("div", Qt, [x("span", $t, [n[0] ||= x("i", {
1669
+ return (e, t) => (A(), w("aside", Xt, [
1670
+ T("header", Zt, [T("div", Qt, [T("span", $t, [t[0] ||= T("i", {
1670
1671
  class: "size-1.5 rounded-full bg-cn-accent",
1671
1672
  "aria-hidden": "true"
1672
- }, null, -1), E(" " + r(c.value), 1)]), x("span", en, r(s.value ? "图层属性" : "画布属性"), 1)])]),
1673
- d.value.length === 0 ? (t(), p("p", tn, " 打开文档后可编辑属性 ")) : _("", !0),
1674
- (t(!0), p(g, null, b(d.value, (e) => (t(), p("section", {
1673
+ }, null, -1), ie(" " + P(a.value), 1)]), T("span", en, P(i.value ? "图层属性" : "画布属性"), 1)])]),
1674
+ s.value.length === 0 ? (A(), w("p", tn, " 打开文档后可编辑属性 ")) : C("", !0),
1675
+ (A(!0), w(b, null, M(s.value, (e) => (A(), w("section", {
1675
1676
  key: e.title,
1676
1677
  class: "cn-props__section border-b border-cn-line/70 px-3.5 py-3 last:border-b-0"
1677
- }, [x("h3", nn, r(e.title), 1), x("div", rn, [(t(!0), p(g, null, b(e.fields, (e) => (t(), p(g, { key: e.key }, [e.field.control === "anchor" ? (t(), v(H, {
1678
+ }, [T("h3", nn, P(e.title), 1), T("div", rn, [(A(!0), w(b, null, M(e.fields, (e) => (A(), w(b, { key: e.key }, [e.field.control === "anchor" ? (A(), S(Pe, {
1678
1679
  key: 0,
1679
1680
  field: e.field,
1680
1681
  "model-value": e.value,
1681
- expanded: i(a).anchorExpanded.value,
1682
- onChange: (t) => i(a).commit(e.field, t, !0),
1683
- onToggle: m
1682
+ expanded: F(n).anchorExpanded.value,
1683
+ onChange: (t) => F(n).commit(e.field, t, !0),
1684
+ onToggle: l
1684
1685
  }, null, 8, [
1685
1686
  "field",
1686
1687
  "model-value",
1687
1688
  "expanded",
1688
1689
  "onChange"
1689
- ])) : (t(), v(Yt, {
1690
+ ])) : (A(), S(Yt, {
1690
1691
  key: 1,
1691
1692
  field: e.field,
1692
1693
  value: e.value,
1693
1694
  "data-mode": e.dataMode,
1694
1695
  hint: e.hint,
1695
- completion: o(e.field),
1696
- displays: f.value,
1696
+ completion: r(e.field),
1697
+ displays: c.value,
1697
1698
  "resource-status": e.resourceStatus,
1698
- onInput: (t) => i(a).commit(e.field, t, !1),
1699
- onChange: (t) => i(a).commit(e.field, t, !0),
1700
- onToggleMode: (t) => i(a).toggleDataMode(e.field),
1701
- onSubCommit: i(a).commit
1699
+ onInput: (t) => F(n).commit(e.field, t, !1),
1700
+ onChange: (t) => F(n).commit(e.field, t, !0),
1701
+ onToggleMode: (t) => F(n).toggleDataMode(e.field),
1702
+ onSubCommit: F(n).commit
1702
1703
  }, null, 8, [
1703
1704
  "field",
1704
1705
  "value",
@@ -1716,4 +1717,4 @@ var Wt = {
1716
1717
  }
1717
1718
  });
1718
1719
  //#endregion
1719
- export { X as a, st as c, Te as d, Se as f, Ut as i, B as l, V as m, Yt as n, bt as o, Ce as p, $ as r, ot as s, an as t, xe as u };
1720
+ export { X as a, st as c, W as d, ye as f, $ as i, G as l, K as m, Yt as n, bt as o, H as p, Ut as r, ot as s, an as t, ve as u };