@hankchen/canvas-editor-vue 0.8.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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-
|
|
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-ns-OHICS.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";
|
|
@@ -200,7 +200,7 @@ 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 = {
|
|
204
204
|
ImageLayer: [
|
|
205
205
|
H,
|
|
206
206
|
U,
|
|
@@ -217,10 +217,17 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
|
|
|
217
217
|
key: ["fit"],
|
|
218
218
|
label: "适配",
|
|
219
219
|
control: "select",
|
|
220
|
-
domain: [
|
|
220
|
+
domain: [
|
|
221
|
+
De,
|
|
222
|
+
Oe,
|
|
223
|
+
ke,
|
|
224
|
+
Ae
|
|
225
|
+
],
|
|
221
226
|
optionLabels: {
|
|
222
227
|
[De]: "铺满裁切",
|
|
223
|
-
[Oe]: "完整显示"
|
|
228
|
+
[Oe]: "完整显示",
|
|
229
|
+
[ke]: "拉伸铺满",
|
|
230
|
+
[Ae]: "平铺"
|
|
224
231
|
}
|
|
225
232
|
}]
|
|
226
233
|
}
|
|
@@ -285,15 +292,15 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
|
|
|
285
292
|
}]
|
|
286
293
|
}]
|
|
287
294
|
};
|
|
288
|
-
function
|
|
289
|
-
return
|
|
295
|
+
function Me(e) {
|
|
296
|
+
return je[e] ?? [];
|
|
290
297
|
}
|
|
291
|
-
function
|
|
298
|
+
function Ne(e) {
|
|
292
299
|
if (e[e.length - 1] === "content") return h(e) ? "templateContent" : "content";
|
|
293
300
|
let t = e[e.length - 2];
|
|
294
301
|
return t === "rows" ? "row" : t === "cells" ? "cell" : "root";
|
|
295
302
|
}
|
|
296
|
-
var
|
|
303
|
+
var Pe = {
|
|
297
304
|
root: [],
|
|
298
305
|
cell: [],
|
|
299
306
|
row: ["shape.width", "shape.autoWidth"],
|
|
@@ -308,9 +315,9 @@ var Me = {
|
|
|
308
315
|
function G(e, t) {
|
|
309
316
|
return [...e.key, ...t.key];
|
|
310
317
|
}
|
|
311
|
-
function
|
|
312
|
-
let n = new Set(
|
|
313
|
-
for (let e of
|
|
318
|
+
function Fe(e, t) {
|
|
319
|
+
let n = new Set(Pe[Ne(e)]), r = [];
|
|
320
|
+
for (let e of Me(t.type)) {
|
|
314
321
|
let i = [];
|
|
315
322
|
for (let r of e.fields) {
|
|
316
323
|
if (r.items) {
|
|
@@ -330,7 +337,7 @@ function K(e, t) {
|
|
|
330
337
|
}
|
|
331
338
|
return r;
|
|
332
339
|
}
|
|
333
|
-
var
|
|
340
|
+
var Ie = [{
|
|
334
341
|
title: "画布",
|
|
335
342
|
fields: [{
|
|
336
343
|
key: ["width"],
|
|
@@ -358,17 +365,17 @@ var Ne = [{
|
|
|
358
365
|
control: "imageSrc"
|
|
359
366
|
}]
|
|
360
367
|
}];
|
|
361
|
-
function
|
|
368
|
+
function Le(e) {
|
|
362
369
|
return e === null ? null : e.background === null ? {
|
|
363
370
|
...e,
|
|
364
|
-
background:
|
|
371
|
+
background: K
|
|
365
372
|
} : e;
|
|
366
373
|
}
|
|
367
|
-
var
|
|
374
|
+
var K = {
|
|
368
375
|
color: null,
|
|
369
376
|
image: null
|
|
370
377
|
};
|
|
371
|
-
function
|
|
378
|
+
function Re(e) {
|
|
372
379
|
return e.type === "ImageLayer" && e.fit === void 0 ? {
|
|
373
380
|
...e,
|
|
374
381
|
fit: "cover"
|
|
@@ -387,14 +394,14 @@ function q(e, t) {
|
|
|
387
394
|
}
|
|
388
395
|
//#endregion
|
|
389
396
|
//#region src/property-panel/fields/AlignField.vue?vue&type=script&setup=true&lang.ts
|
|
390
|
-
var
|
|
397
|
+
var ze = ["aria-label"], Be = [
|
|
391
398
|
"aria-pressed",
|
|
392
399
|
"title",
|
|
393
400
|
"onClick"
|
|
394
|
-
],
|
|
401
|
+
], Ve = {
|
|
395
402
|
key: 1,
|
|
396
403
|
class: "truncate px-1 text-[10px] leading-none"
|
|
397
|
-
},
|
|
404
|
+
}, He = /* @__PURE__ */ j({
|
|
398
405
|
__name: "AlignField",
|
|
399
406
|
props: {
|
|
400
407
|
field: {},
|
|
@@ -456,28 +463,28 @@ var Le = ["aria-label"], Re = [
|
|
|
456
463
|
}, [t.icon ? (P(), E(g, {
|
|
457
464
|
key: 0,
|
|
458
465
|
icon: t.icon
|
|
459
|
-
}, null, 8, ["icon"])) : (P(), O("span",
|
|
466
|
+
}, null, 8, ["icon"])) : (P(), O("span", Ve, R(t.value), 1))], 10, Be))), 128))], 8, ze));
|
|
460
467
|
}
|
|
461
|
-
}),
|
|
468
|
+
}), Ue = { class: "block" }, We = ["aria-expanded", "title"], Ge = { class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted" }, Ke = { class: "flex shrink-0 items-center gap-1.5" }, qe = {
|
|
462
469
|
viewBox: "0 0 24 24",
|
|
463
470
|
class: "size-3.5",
|
|
464
471
|
"aria-hidden": "true"
|
|
465
|
-
},
|
|
472
|
+
}, Je = [
|
|
466
473
|
"cx",
|
|
467
474
|
"cy",
|
|
468
475
|
"r"
|
|
469
|
-
],
|
|
476
|
+
], Ye = {
|
|
470
477
|
key: 0,
|
|
471
478
|
class: "mt-2 flex justify-end"
|
|
472
|
-
},
|
|
479
|
+
}, Xe = {
|
|
473
480
|
class: "cn-anchor grid w-[66px] shrink-0 grid-cols-3 gap-[3px]",
|
|
474
481
|
role: "group",
|
|
475
482
|
"aria-label": "九宫锚点"
|
|
476
|
-
},
|
|
483
|
+
}, Ze = [
|
|
477
484
|
"aria-pressed",
|
|
478
485
|
"title",
|
|
479
486
|
"onClick"
|
|
480
|
-
],
|
|
487
|
+
], Qe = /* @__PURE__ */ j({
|
|
481
488
|
__name: "AnchorDisclosureField",
|
|
482
489
|
props: {
|
|
483
490
|
field: {},
|
|
@@ -497,31 +504,31 @@ var Le = ["aria-label"], Re = [
|
|
|
497
504
|
function s(e) {
|
|
498
505
|
r("change", e);
|
|
499
506
|
}
|
|
500
|
-
return (t, n) => (P(), O("span",
|
|
507
|
+
return (t, n) => (P(), O("span", Ue, [k("button", {
|
|
501
508
|
type: "button",
|
|
502
509
|
class: "cn-anchor-disclosure__header flex w-full items-center justify-between gap-2",
|
|
503
510
|
"aria-expanded": e.expanded,
|
|
504
511
|
title: e.expanded ? "收起锚点" : `锚点:${e.modelValue}(点击展开调整)`,
|
|
505
512
|
onClick: n[0] ||= (e) => r("toggle")
|
|
506
|
-
}, [k("span",
|
|
513
|
+
}, [k("span", Ge, R(e.field.label), 1), k("span", Ke, [(P(), O("svg", qe, [(P(!0), O(w, null, I(z(a), (e) => (P(), O("circle", {
|
|
507
514
|
key: e.index,
|
|
508
515
|
cx: e.cx,
|
|
509
516
|
cy: e.cy,
|
|
510
517
|
r: e.index === o.value ? 3.2 : 2.2,
|
|
511
518
|
class: N(e.index === o.value ? "fill-cn-accent" : "fill-cn-muted/35")
|
|
512
|
-
}, null, 10,
|
|
519
|
+
}, null, 10, Je))), 128))])), A(g, {
|
|
513
520
|
icon: z(u),
|
|
514
521
|
class: N(["text-cn-muted transition-transform duration-150", { "rotate-180": e.expanded }])
|
|
515
|
-
}, null, 8, ["icon", "class"])])], 8,
|
|
522
|
+
}, null, 8, ["icon", "class"])])], 8, We), e.expanded ? (P(), O("span", Ye, [k("span", Xe, [(P(!0), O(w, null, I(z(i), (t) => (P(), O("button", {
|
|
516
523
|
key: t,
|
|
517
524
|
type: "button",
|
|
518
525
|
class: N(["cn-anchor__cell relative aspect-square min-w-0 rounded-[4px] border p-0 transition-colors duration-100", t === e.modelValue ? "cn-anchor__cell--active border-cn-accent bg-cn-accent shadow-[0_0_8px_rgba(56,189,248,0.35)]" : "border-cn-field-line bg-cn-field hover:border-cn-muted/50"]),
|
|
519
526
|
"aria-pressed": t === e.modelValue,
|
|
520
527
|
title: t,
|
|
521
528
|
onClick: (e) => s(t)
|
|
522
|
-
}, null, 10,
|
|
529
|
+
}, null, 10, Ze))), 128))])])) : D("", !0)]));
|
|
523
530
|
}
|
|
524
|
-
}),
|
|
531
|
+
}), $e = { class: "cn-bool relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center" }, et = ["checked"], tt = /* @__PURE__ */ j({
|
|
525
532
|
__name: "BooleanField",
|
|
526
533
|
props: {
|
|
527
534
|
field: {},
|
|
@@ -535,7 +542,7 @@ var Le = ["aria-label"], Re = [
|
|
|
535
542
|
}
|
|
536
543
|
return ve(() => {
|
|
537
544
|
i.value && (i.value.checked = n.modelValue);
|
|
538
|
-
}), (t, n) => (P(), O("label",
|
|
545
|
+
}), (t, n) => (P(), O("label", $e, [
|
|
539
546
|
k("input", {
|
|
540
547
|
ref_key: "inputRef",
|
|
541
548
|
ref: i,
|
|
@@ -543,12 +550,12 @@ var Le = ["aria-label"], Re = [
|
|
|
543
550
|
type: "checkbox",
|
|
544
551
|
checked: e.modelValue,
|
|
545
552
|
onChange: a
|
|
546
|
-
}, null, 40,
|
|
553
|
+
}, null, 40, et),
|
|
547
554
|
n[0] ||= k("span", { class: "absolute inset-0 rounded-full border border-cn-field-line bg-cn-field transition-colors duration-150 peer-checked:border-cn-accent/60 peer-checked:bg-cn-accent/30 peer-focus-visible:ring-[3px] peer-focus-visible:ring-cn-accent/20" }, null, -1),
|
|
548
555
|
n[1] ||= k("span", { class: "relative mx-0.5 size-3 rounded-full bg-cn-muted shadow-sm transition-transform duration-150 peer-checked:translate-x-3 peer-checked:bg-cn-accent" }, null, -1)
|
|
549
556
|
]));
|
|
550
557
|
}
|
|
551
|
-
}),
|
|
558
|
+
}), nt = {
|
|
552
559
|
1: [{
|
|
553
560
|
label: "四边",
|
|
554
561
|
rep: "top",
|
|
@@ -591,13 +598,13 @@ var Le = ["aria-label"], Re = [
|
|
|
591
598
|
}
|
|
592
599
|
]
|
|
593
600
|
};
|
|
594
|
-
function
|
|
601
|
+
function rt(e) {
|
|
595
602
|
return e === 1 ? 2 : e === 2 ? 4 : 1;
|
|
596
603
|
}
|
|
597
|
-
function
|
|
604
|
+
function it(e) {
|
|
598
605
|
return e.top === e.bottom && e.bottom === e.left && e.left === e.right ? 1 : e.top === e.bottom && e.left === e.right ? 2 : 4;
|
|
599
606
|
}
|
|
600
|
-
function
|
|
607
|
+
function at(e, t) {
|
|
601
608
|
if (t === 1) {
|
|
602
609
|
let { top: t } = e;
|
|
603
610
|
return {
|
|
@@ -618,17 +625,17 @@ function rt(e, t) {
|
|
|
618
625
|
}
|
|
619
626
|
return e;
|
|
620
627
|
}
|
|
621
|
-
function
|
|
628
|
+
function ot(e, t) {
|
|
622
629
|
return e.top === t.top && e.bottom === t.bottom && e.left === t.left && e.right === t.right;
|
|
623
630
|
}
|
|
624
631
|
function J(e, t) {
|
|
625
632
|
return e === null || t === null ? e === t : e.width === t.width && e.color === t.color;
|
|
626
633
|
}
|
|
627
|
-
function
|
|
634
|
+
function st(e) {
|
|
628
635
|
let { top: t, bottom: n, left: r, right: i } = e;
|
|
629
636
|
return t === null && n === null && r === null && i === null || t !== null && J(t, n) && J(t, r) && J(t, i) ? 1 : J(t, n) && J(r, i) ? 2 : 4;
|
|
630
637
|
}
|
|
631
|
-
function
|
|
638
|
+
function ct(e, t) {
|
|
632
639
|
let n = (e) => e === null ? null : { ...e };
|
|
633
640
|
if (t === 1) {
|
|
634
641
|
let t = n(e.top);
|
|
@@ -650,18 +657,18 @@ function ot(e, t) {
|
|
|
650
657
|
}
|
|
651
658
|
return e;
|
|
652
659
|
}
|
|
653
|
-
function
|
|
660
|
+
function lt(e, t) {
|
|
654
661
|
return J(e.top, t.top) && J(e.bottom, t.bottom) && J(e.left, t.left) && J(e.right, t.right);
|
|
655
662
|
}
|
|
656
663
|
//#endregion
|
|
657
664
|
//#region src/property-panel/useShorthandMode.ts
|
|
658
|
-
function
|
|
665
|
+
function ut(e, t) {
|
|
659
666
|
let n = T(() => t(e())), r = F(null), i = T(() => r.value ?? n.value);
|
|
660
667
|
B(e, () => {
|
|
661
668
|
r.value = null;
|
|
662
669
|
});
|
|
663
670
|
function a() {
|
|
664
|
-
let e = i.value, t =
|
|
671
|
+
let e = i.value, t = rt(e);
|
|
665
672
|
return r.value = t, {
|
|
666
673
|
from: e,
|
|
667
674
|
to: t
|
|
@@ -674,7 +681,7 @@ function ct(e, t) {
|
|
|
674
681
|
}
|
|
675
682
|
//#endregion
|
|
676
683
|
//#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`,
|
|
684
|
+
var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-field text-[11.5px] leading-none text-cn-fg outline-none transition-[border-color,box-shadow,background-color] duration-100 placeholder:text-cn-muted/60 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-cn-field-line", X = `${Y} text-right font-mono tabular-nums`, dt = Y, ft = "w-full flex-1 min-w-0 resize-y rounded-md border border-cn-field-line bg-cn-field px-2 py-1.5 text-[11.5px] leading-5 text-cn-fg outline-none transition-[border-color,box-shadow] duration-100 placeholder:text-cn-muted/60 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40", pt = "size-7 shrink-0 cursor-pointer self-center rounded-md border border-cn-field-line bg-cn-field p-0.5 transition-colors hover:border-cn-muted/40 disabled:cursor-not-allowed disabled:opacity-40", mt = ["aria-label"], ht = /* @__PURE__ */ j({
|
|
678
685
|
__name: "BorderWidthInput",
|
|
679
686
|
props: {
|
|
680
687
|
value: {},
|
|
@@ -725,9 +732,9 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
725
732
|
onFocus: n[1] ||= (e) => a.value = !0,
|
|
726
733
|
onBlur: u,
|
|
727
734
|
onChange: u
|
|
728
|
-
}, null, 42,
|
|
735
|
+
}, null, 42, mt)), [[_e, i.value]]);
|
|
729
736
|
}
|
|
730
|
-
}),
|
|
737
|
+
}), gt = ["aria-label", "title"], _t = /* @__PURE__ */ j({
|
|
731
738
|
__name: "ShorthandModeButton",
|
|
732
739
|
props: {
|
|
733
740
|
mode: {},
|
|
@@ -758,14 +765,14 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
758
765
|
}, [A(g, {
|
|
759
766
|
icon: a.value.icon,
|
|
760
767
|
size: 12
|
|
761
|
-
}, null, 8, ["icon"])], 8,
|
|
768
|
+
}, null, 8, ["icon"])], 8, gt));
|
|
762
769
|
}
|
|
763
|
-
}),
|
|
770
|
+
}), vt = { class: "cn-border flex w-full min-w-0 items-center gap-1" }, yt = { class: "grid min-w-0 flex-1 gap-1 grid-cols-1" }, bt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, xt = [
|
|
764
771
|
"value",
|
|
765
772
|
"disabled",
|
|
766
773
|
"onInput",
|
|
767
774
|
"onChange"
|
|
768
|
-
],
|
|
775
|
+
], St = "#000000", Ct = /* @__PURE__ */ j({
|
|
769
776
|
__name: "BorderField",
|
|
770
777
|
props: {
|
|
771
778
|
field: {},
|
|
@@ -773,12 +780,12 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
773
780
|
},
|
|
774
781
|
emits: ["input", "change"],
|
|
775
782
|
setup(e, { emit: t }) {
|
|
776
|
-
let n = e, r = t, { mode: i, cycle: a } =
|
|
783
|
+
let n = e, r = t, { mode: i, cycle: a } = ut(() => n.modelValue, st), o = T(() => nt[i.value]);
|
|
777
784
|
function s(e) {
|
|
778
785
|
return n.modelValue[e.rep]?.width ?? null;
|
|
779
786
|
}
|
|
780
787
|
function c(e) {
|
|
781
|
-
return n.modelValue[e.rep]?.color ??
|
|
788
|
+
return n.modelValue[e.rep]?.color ?? St;
|
|
782
789
|
}
|
|
783
790
|
function l(e, t, i) {
|
|
784
791
|
let a = { ...n.modelValue };
|
|
@@ -786,7 +793,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
786
793
|
r(i ? "change" : "input", a);
|
|
787
794
|
}
|
|
788
795
|
function u(e, t, r) {
|
|
789
|
-
let i = n.modelValue[e.rep]?.color ??
|
|
796
|
+
let i = n.modelValue[e.rep]?.color ?? St;
|
|
790
797
|
l(e, t <= 0 ? null : {
|
|
791
798
|
width: t,
|
|
792
799
|
color: i
|
|
@@ -804,20 +811,20 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
804
811
|
function f() {
|
|
805
812
|
let { from: e, to: t } = a();
|
|
806
813
|
if (t < e) {
|
|
807
|
-
let e =
|
|
808
|
-
|
|
814
|
+
let e = ct(n.modelValue, t);
|
|
815
|
+
lt(e, n.modelValue) || r("change", e);
|
|
809
816
|
}
|
|
810
817
|
}
|
|
811
|
-
return (t, n) => (P(), O("span",
|
|
818
|
+
return (t, n) => (P(), O("span", vt, [A(_t, {
|
|
812
819
|
mode: z(i),
|
|
813
820
|
label: "边框",
|
|
814
821
|
onCycle: f
|
|
815
|
-
}, null, 8, ["mode"]), k("span",
|
|
822
|
+
}, null, 8, ["mode"]), k("span", yt, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
|
|
816
823
|
key: t.rep,
|
|
817
824
|
class: "flex items-center gap-1.5"
|
|
818
825
|
}, [
|
|
819
|
-
k("span",
|
|
820
|
-
A(
|
|
826
|
+
k("span", bt, R(t.label), 1),
|
|
827
|
+
A(ht, {
|
|
821
828
|
class: "cn-border__width",
|
|
822
829
|
value: s(t),
|
|
823
830
|
label: t.label,
|
|
@@ -837,17 +844,17 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
837
844
|
disabled: e.modelValue[t.rep] === null,
|
|
838
845
|
onInput: (e) => d(t, e, !1),
|
|
839
846
|
onChange: (e) => d(t, e, !0)
|
|
840
|
-
}, null, 40,
|
|
847
|
+
}, null, 40, xt)
|
|
841
848
|
]))), 128))])]));
|
|
842
849
|
}
|
|
843
|
-
}),
|
|
850
|
+
}), wt = ["value"], Tt = {
|
|
844
851
|
key: 1,
|
|
845
852
|
class: "flex flex-1 items-center gap-1.5"
|
|
846
|
-
},
|
|
853
|
+
}, Et = ["value"], Dt = ["value"], Ot = [
|
|
847
854
|
"disabled",
|
|
848
855
|
"title",
|
|
849
856
|
"data-upload-error"
|
|
850
|
-
],
|
|
857
|
+
], kt = /* @__PURE__ */ j({
|
|
851
858
|
__name: "FontField",
|
|
852
859
|
props: {
|
|
853
860
|
field: {},
|
|
@@ -910,14 +917,14 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
910
917
|
}
|
|
911
918
|
return (t, n) => z(i) === null ? (P(), O("input", {
|
|
912
919
|
key: 0,
|
|
913
|
-
class: N(["cn-field", z(
|
|
920
|
+
class: N(["cn-field", z(dt)]),
|
|
914
921
|
type: "text",
|
|
915
922
|
value: e.modelValue,
|
|
916
923
|
onInput: l,
|
|
917
924
|
onCompositionstart: u,
|
|
918
925
|
onCompositionend: d,
|
|
919
926
|
onChange: f
|
|
920
|
-
}, null, 42,
|
|
927
|
+
}, null, 42, wt)) : (P(), O("div", Tt, [
|
|
921
928
|
k("select", {
|
|
922
929
|
class: N(["cn-field cn-select", z(Y)]),
|
|
923
930
|
value: e.modelValue,
|
|
@@ -925,7 +932,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
925
932
|
}, [(P(!0), O(w, null, I(a.value, (e) => (P(), O("option", {
|
|
926
933
|
key: e.value,
|
|
927
934
|
value: e.value
|
|
928
|
-
}, R(e.label), 9,
|
|
935
|
+
}, R(e.label), 9, Dt))), 128))], 42, Et),
|
|
929
936
|
k("input", {
|
|
930
937
|
ref_key: "fileInput",
|
|
931
938
|
ref: h,
|
|
@@ -942,10 +949,10 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
942
949
|
title: m.value ?? "上传本机字体(加入清单后可选)",
|
|
943
950
|
"data-upload-error": m.value ?? void 0,
|
|
944
951
|
onClick: g
|
|
945
|
-
}, R(p.value ? "…" : m.value ? "!" : "上传"), 9,
|
|
952
|
+
}, R(p.value ? "…" : m.value ? "!" : "上传"), 9, Ot)) : D("", !0)
|
|
946
953
|
]));
|
|
947
954
|
}
|
|
948
|
-
}),
|
|
955
|
+
}), At = { class: "cn-color flex min-w-0 flex-1 items-center gap-1.5" }, jt = ["checked"], Mt = ["value", "disabled"], Nt = ["value", "disabled"], Pt = "#000000", Ft = /* @__PURE__ */ j({
|
|
949
956
|
__name: "ColorField",
|
|
950
957
|
props: {
|
|
951
958
|
field: {},
|
|
@@ -958,7 +965,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
958
965
|
i.value = e !== null, i.value && (a.value = o(e));
|
|
959
966
|
});
|
|
960
967
|
function o(e) {
|
|
961
|
-
return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e :
|
|
968
|
+
return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e : Pt;
|
|
962
969
|
}
|
|
963
970
|
function s(e) {
|
|
964
971
|
let t = e.target.checked;
|
|
@@ -985,7 +992,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
985
992
|
}
|
|
986
993
|
a.value = o(t), r("change", t);
|
|
987
994
|
}
|
|
988
|
-
return (t, n) => (P(), O("span",
|
|
995
|
+
return (t, n) => (P(), O("span", At, [
|
|
989
996
|
e.field.nullable ? (P(), O("input", {
|
|
990
997
|
key: 0,
|
|
991
998
|
class: "cn-color__toggle size-3.5 shrink-0 cursor-pointer accent-cn-accent",
|
|
@@ -993,15 +1000,15 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
993
1000
|
title: "启用颜色",
|
|
994
1001
|
checked: i.value,
|
|
995
1002
|
onChange: s
|
|
996
|
-
}, null, 40,
|
|
1003
|
+
}, null, 40, jt)) : D("", !0),
|
|
997
1004
|
k("input", {
|
|
998
|
-
class: N(["cn-color__swatch", z(
|
|
1005
|
+
class: N(["cn-color__swatch", z(pt)]),
|
|
999
1006
|
type: "color",
|
|
1000
1007
|
value: a.value,
|
|
1001
1008
|
disabled: !i.value,
|
|
1002
1009
|
onInput: c,
|
|
1003
1010
|
onChange: l
|
|
1004
|
-
}, null, 42,
|
|
1011
|
+
}, null, 42, Mt),
|
|
1005
1012
|
k("input", {
|
|
1006
1013
|
class: N(["cn-color__text min-w-0 flex-1", z(Y)]),
|
|
1007
1014
|
type: "text",
|
|
@@ -1009,27 +1016,27 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
1009
1016
|
disabled: !i.value,
|
|
1010
1017
|
placeholder: "无",
|
|
1011
1018
|
onChange: u
|
|
1012
|
-
}, null, 42,
|
|
1019
|
+
}, null, 42, Nt)
|
|
1013
1020
|
]));
|
|
1014
1021
|
}
|
|
1015
1022
|
}), Z = Symbol("canvas-image-upload");
|
|
1016
|
-
function
|
|
1023
|
+
function It() {
|
|
1017
1024
|
return fe(Z, null);
|
|
1018
1025
|
}
|
|
1019
1026
|
//#endregion
|
|
1020
1027
|
//#region src/property-panel/fields/intrinsicSize.ts
|
|
1021
|
-
function
|
|
1028
|
+
function Lt(e, t) {
|
|
1022
1029
|
let n = e, r = t;
|
|
1023
1030
|
for (; r !== 0;) [n, r] = [r, n % r];
|
|
1024
1031
|
let i = e / n, a = t / n;
|
|
1025
1032
|
return Math.max(i, a) <= 32 ? `${i}:${a}` : `${Math.round(e / t * 100) / 100}:1`;
|
|
1026
1033
|
}
|
|
1027
|
-
function
|
|
1028
|
-
return !Number.isFinite(e) || !Number.isFinite(t) || e <= 0 || t <= 0 ? null : `${e}×${t} · ${
|
|
1034
|
+
function Rt(e, t) {
|
|
1035
|
+
return !Number.isFinite(e) || !Number.isFinite(t) || e <= 0 || t <= 0 ? null : `${e}×${t} · ${Lt(e, t)}`;
|
|
1029
1036
|
}
|
|
1030
1037
|
//#endregion
|
|
1031
1038
|
//#region src/property-panel/fields/TextField.vue?vue&type=script&setup=true&lang.ts
|
|
1032
|
-
var
|
|
1039
|
+
var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
1033
1040
|
__name: "TextField",
|
|
1034
1041
|
props: {
|
|
1035
1042
|
field: {},
|
|
@@ -1059,7 +1066,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1059
1066
|
o(t) || r("change", t);
|
|
1060
1067
|
}
|
|
1061
1068
|
return (t, n) => (P(), O("input", {
|
|
1062
|
-
class: N(["cn-field", [z(
|
|
1069
|
+
class: N(["cn-field", [z(dt), a.value ? "cn-field--invalid" : ""]]),
|
|
1063
1070
|
type: "text",
|
|
1064
1071
|
value: e.modelValue,
|
|
1065
1072
|
placeholder: e.field.placeholder,
|
|
@@ -1067,9 +1074,9 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1067
1074
|
onCompositionstart: c,
|
|
1068
1075
|
onCompositionend: l,
|
|
1069
1076
|
onChange: u
|
|
1070
|
-
}, null, 42,
|
|
1077
|
+
}, null, 42, zt));
|
|
1071
1078
|
}
|
|
1072
|
-
}),
|
|
1079
|
+
}), Bt = /* @__PURE__ */ j({
|
|
1073
1080
|
__name: "ResourceValueField",
|
|
1074
1081
|
props: {
|
|
1075
1082
|
field: {},
|
|
@@ -1116,20 +1123,20 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1116
1123
|
"disabled"
|
|
1117
1124
|
]));
|
|
1118
1125
|
}
|
|
1119
|
-
}),
|
|
1126
|
+
}), Vt = {
|
|
1120
1127
|
key: 0,
|
|
1121
1128
|
class: "flex flex-col gap-1.5"
|
|
1122
|
-
},
|
|
1129
|
+
}, Ht = [
|
|
1123
1130
|
"disabled",
|
|
1124
1131
|
"title",
|
|
1125
1132
|
"data-upload-error"
|
|
1126
|
-
],
|
|
1133
|
+
], Ut = ["src"], Wt = {
|
|
1127
1134
|
key: 2,
|
|
1128
1135
|
class: "relative"
|
|
1129
|
-
},
|
|
1136
|
+
}, Gt = { class: "flex items-center gap-1.5" }, Kt = {
|
|
1130
1137
|
key: 0,
|
|
1131
1138
|
class: "cn-imagesrc__intrinsic text-[11px] leading-4 text-cn-muted"
|
|
1132
|
-
},
|
|
1139
|
+
}, qt = /* @__PURE__ */ j({
|
|
1133
1140
|
__name: "ImageSrcField",
|
|
1134
1141
|
props: {
|
|
1135
1142
|
field: {},
|
|
@@ -1141,7 +1148,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1141
1148
|
},
|
|
1142
1149
|
emits: ["input", "change"],
|
|
1143
1150
|
setup(e, { emit: t }) {
|
|
1144
|
-
let n = e, r = t, i =
|
|
1151
|
+
let n = e, r = t, i = It(), a = T(() => i !== null && i.canUpload && n.dataMode !== "expression"), o = T(() => typeof n.modelValue == "string" && n.modelValue !== ""), s = T(() => n.resourceStatus === "pending" ? "装载中" : n.resourceStatus === "failed" ? "失败" : null), c = F(!1), l = F(null), u = F(null), d = F(null), f = T(() => d.value === null ? null : Rt(d.value.width, d.value.height));
|
|
1145
1152
|
function p(e) {
|
|
1146
1153
|
let t = e.target;
|
|
1147
1154
|
d.value = t.naturalWidth > 0 && t.naturalHeight > 0 ? {
|
|
@@ -1169,7 +1176,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1169
1176
|
}
|
|
1170
1177
|
}
|
|
1171
1178
|
}
|
|
1172
|
-
return (t, n) => a.value ? (P(), O("div",
|
|
1179
|
+
return (t, n) => a.value ? (P(), O("div", Vt, [
|
|
1173
1180
|
k("button", {
|
|
1174
1181
|
type: "button",
|
|
1175
1182
|
class: "cn-imagesrc__thumb relative flex h-16 w-full items-center justify-center overflow-hidden rounded-md border border-dashed border-cn-field-line bg-cn-field/40 text-[11px] leading-none text-cn-muted transition-colors duration-100 hover:border-cn-muted/40 disabled:cursor-not-allowed disabled:opacity-40",
|
|
@@ -1185,13 +1192,13 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1185
1192
|
alt: "",
|
|
1186
1193
|
onLoad: p,
|
|
1187
1194
|
onError: n[0] ||= (e) => d.value = null
|
|
1188
|
-
}, null, 40,
|
|
1195
|
+
}, null, 40, Ut)) : D("", !0),
|
|
1189
1196
|
s.value ? (P(), O("span", {
|
|
1190
1197
|
key: 1,
|
|
1191
1198
|
class: N(["cn-imagesrc__status absolute right-1 top-1 rounded bg-cn-bg-elevated/90 px-1 py-0.5 text-[10px] leading-none", e.resourceStatus === "failed" ? "text-red-400" : "text-cn-muted"])
|
|
1192
1199
|
}, R(s.value), 3)) : D("", !0),
|
|
1193
|
-
o.value ? D("", !0) : (P(), O("span",
|
|
1194
|
-
], 8,
|
|
1200
|
+
o.value ? D("", !0) : (P(), O("span", Wt, R(c.value ? "…" : l.value ? "!" : "点击上传图片"), 1))
|
|
1201
|
+
], 8, Ht),
|
|
1195
1202
|
k("input", {
|
|
1196
1203
|
ref_key: "fileInput",
|
|
1197
1204
|
ref: u,
|
|
@@ -1200,7 +1207,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1200
1207
|
accept: "image/*",
|
|
1201
1208
|
onChange: h
|
|
1202
1209
|
}, null, 544),
|
|
1203
|
-
k("div",
|
|
1210
|
+
k("div", Gt, [A(Q, {
|
|
1204
1211
|
class: "flex-1",
|
|
1205
1212
|
field: e.field,
|
|
1206
1213
|
"model-value": e.modelValue ?? "",
|
|
@@ -1218,8 +1225,8 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1218
1225
|
title: "清除图片(资源地址置空)",
|
|
1219
1226
|
onClick: n[3] ||= (e) => r("change", "")
|
|
1220
1227
|
}, "清除")) : D("", !0)]),
|
|
1221
|
-
f.value ? (P(), O("span",
|
|
1222
|
-
])) : e.dataMode === "expression" ? (P(), E(
|
|
1228
|
+
f.value ? (P(), O("span", Kt, "源图 " + R(f.value), 1)) : D("", !0)
|
|
1229
|
+
])) : e.dataMode === "expression" ? (P(), E(Bt, {
|
|
1223
1230
|
key: 1,
|
|
1224
1231
|
field: e.field,
|
|
1225
1232
|
"model-value": e.modelValue,
|
|
@@ -1246,7 +1253,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1246
1253
|
"aria-label"
|
|
1247
1254
|
]));
|
|
1248
1255
|
}
|
|
1249
|
-
}),
|
|
1256
|
+
}), Jt = [
|
|
1250
1257
|
"aria-label",
|
|
1251
1258
|
"min",
|
|
1252
1259
|
"max",
|
|
@@ -1299,9 +1306,9 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1299
1306
|
onFocus: n[1] ||= (e) => a.value = !0,
|
|
1300
1307
|
onBlur: l,
|
|
1301
1308
|
onChange: l
|
|
1302
|
-
}, null, 42,
|
|
1309
|
+
}, null, 42, Jt)), [[_e, i.value]]);
|
|
1303
1310
|
}
|
|
1304
|
-
}),
|
|
1311
|
+
}), Yt = { class: "cn-padding flex w-full min-w-0 items-center gap-1.5" }, Xt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, Zt = /* @__PURE__ */ j({
|
|
1305
1312
|
__name: "PaddingField",
|
|
1306
1313
|
props: {
|
|
1307
1314
|
field: {},
|
|
@@ -1309,7 +1316,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1309
1316
|
},
|
|
1310
1317
|
emits: ["input", "change"],
|
|
1311
1318
|
setup(e, { emit: t }) {
|
|
1312
|
-
let n = e, r = t, { mode: i, cycle: a } =
|
|
1319
|
+
let n = e, r = t, { mode: i, cycle: a } = ut(() => n.modelValue, it), o = T(() => nt[i.value]);
|
|
1313
1320
|
function s(e) {
|
|
1314
1321
|
return {
|
|
1315
1322
|
key: ["padding", e.rep],
|
|
@@ -1325,18 +1332,18 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1325
1332
|
function l() {
|
|
1326
1333
|
let { from: e, to: t } = a();
|
|
1327
1334
|
if (t < e) {
|
|
1328
|
-
let e =
|
|
1329
|
-
|
|
1335
|
+
let e = at(n.modelValue, t);
|
|
1336
|
+
ot(e, n.modelValue) || r("change", e);
|
|
1330
1337
|
}
|
|
1331
1338
|
}
|
|
1332
|
-
return (t, n) => (P(), O("span",
|
|
1339
|
+
return (t, n) => (P(), O("span", Yt, [A(_t, {
|
|
1333
1340
|
mode: z(i),
|
|
1334
1341
|
label: "内边距",
|
|
1335
1342
|
onCycle: l
|
|
1336
1343
|
}, null, 8, ["mode"]), k("span", { class: N(["grid min-w-0 flex-1 gap-1.5", z(i) === 1 ? "grid-cols-1" : "grid-cols-2"]) }, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
|
|
1337
1344
|
key: t.rep,
|
|
1338
1345
|
class: "flex min-w-0 items-center gap-1.5"
|
|
1339
|
-
}, [k("span",
|
|
1346
|
+
}, [k("span", Xt, R(t.label), 1), A($, {
|
|
1340
1347
|
class: "min-w-0 flex-1",
|
|
1341
1348
|
field: s(t),
|
|
1342
1349
|
"model-value": e.modelValue[t.rep],
|
|
@@ -1349,16 +1356,16 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1349
1356
|
"onChange"
|
|
1350
1357
|
])]))), 128))], 2)]));
|
|
1351
1358
|
}
|
|
1352
|
-
}),
|
|
1359
|
+
}), Qt = { class: "grid w-full min-w-0 grid-cols-2 gap-1" }, $t = ["title"], en = { class: "w-3.5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, tn = [
|
|
1353
1360
|
"aria-pressed",
|
|
1354
1361
|
"title",
|
|
1355
1362
|
"onClick"
|
|
1356
|
-
],
|
|
1363
|
+
], nn = [
|
|
1357
1364
|
"aria-label",
|
|
1358
1365
|
"value",
|
|
1359
1366
|
"placeholder",
|
|
1360
1367
|
"title"
|
|
1361
|
-
],
|
|
1368
|
+
], rn = /* @__PURE__ */ j({
|
|
1362
1369
|
__name: "PairField",
|
|
1363
1370
|
props: {
|
|
1364
1371
|
field: {},
|
|
@@ -1414,12 +1421,12 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1414
1421
|
let t = d(e);
|
|
1415
1422
|
return t?.preview ? "模板子树:预览盒尺寸(随行实例变化,非文档声明值)" : t === void 0 ? `${e.label}自适应:已开启` : `${e.label}自适应:布局解析值(与画布选择框同源)`;
|
|
1416
1423
|
}
|
|
1417
|
-
return (e, t) => (P(), O("span",
|
|
1424
|
+
return (e, t) => (P(), O("span", Qt, [(P(!0), O(w, null, I(i.value, (e) => (P(), O("label", {
|
|
1418
1425
|
key: e.key.join("."),
|
|
1419
1426
|
class: "flex min-w-0 items-center gap-1",
|
|
1420
1427
|
title: e.auto ? void 0 : e.label
|
|
1421
1428
|
}, [
|
|
1422
|
-
k("span",
|
|
1429
|
+
k("span", en, R(e.label), 1),
|
|
1423
1430
|
e.auto ? (P(), O("button", {
|
|
1424
1431
|
key: 0,
|
|
1425
1432
|
type: "button",
|
|
@@ -1427,7 +1434,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1427
1434
|
"aria-pressed": a(e),
|
|
1428
1435
|
title: p(e),
|
|
1429
1436
|
onClick: V((t) => l(e), ["prevent"])
|
|
1430
|
-
}, "自", 10,
|
|
1437
|
+
}, "自", 10, tn)) : D("", !0),
|
|
1431
1438
|
a(e) ? (P(), O("input", {
|
|
1432
1439
|
key: 2,
|
|
1433
1440
|
class: N(["cn-field cn-field--number min-w-0 flex-1", [z(X), d(e)?.preview ? "cn-field--preview" : ""]]),
|
|
@@ -1437,7 +1444,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1437
1444
|
value: f(e),
|
|
1438
1445
|
placeholder: e.auto?.placeholder ?? "",
|
|
1439
1446
|
title: m(e)
|
|
1440
|
-
}, null, 10,
|
|
1447
|
+
}, null, 10, nn)) : (P(), E($, {
|
|
1441
1448
|
key: 1,
|
|
1442
1449
|
class: "min-w-0 flex-1",
|
|
1443
1450
|
field: e,
|
|
@@ -1450,9 +1457,9 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1450
1457
|
"onInput",
|
|
1451
1458
|
"onChange"
|
|
1452
1459
|
]))
|
|
1453
|
-
], 8,
|
|
1460
|
+
], 8, $t))), 128))]));
|
|
1454
1461
|
}
|
|
1455
|
-
}),
|
|
1462
|
+
}), an = /* @__PURE__ */ j({
|
|
1456
1463
|
__name: "RowsPathField",
|
|
1457
1464
|
props: {
|
|
1458
1465
|
field: {},
|
|
@@ -1481,7 +1488,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1481
1488
|
"aria-label"
|
|
1482
1489
|
]));
|
|
1483
1490
|
}
|
|
1484
|
-
}),
|
|
1491
|
+
}), on = ["value"], sn = ["value"], cn = /* @__PURE__ */ j({
|
|
1485
1492
|
__name: "SelectField",
|
|
1486
1493
|
props: {
|
|
1487
1494
|
field: {},
|
|
@@ -1500,9 +1507,9 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1500
1507
|
}, [(P(!0), O(w, null, I(e.field.domain ?? [], (t) => (P(), O("option", {
|
|
1501
1508
|
key: t,
|
|
1502
1509
|
value: t
|
|
1503
|
-
}, R(e.field.optionLabels?.[t] ?? t), 9,
|
|
1510
|
+
}, R(e.field.optionLabels?.[t] ?? t), 9, sn))), 128))], 40, on));
|
|
1504
1511
|
}
|
|
1505
|
-
}),
|
|
1512
|
+
}), ln = ["value", "disabled"], un = /* @__PURE__ */ j({
|
|
1506
1513
|
__name: "TextareaField",
|
|
1507
1514
|
props: {
|
|
1508
1515
|
field: {},
|
|
@@ -1526,7 +1533,7 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1526
1533
|
r = !1, n("change", e.target.value);
|
|
1527
1534
|
}
|
|
1528
1535
|
return (t, n) => (P(), O("textarea", {
|
|
1529
|
-
class: N(["cn-field", z(
|
|
1536
|
+
class: N(["cn-field", z(ft)]),
|
|
1530
1537
|
rows: "3",
|
|
1531
1538
|
value: e.modelValue,
|
|
1532
1539
|
disabled: e.disabled,
|
|
@@ -1534,28 +1541,28 @@ var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1534
1541
|
onCompositionstart: a,
|
|
1535
1542
|
onCompositionend: o,
|
|
1536
1543
|
onChange: s
|
|
1537
|
-
}, null, 42,
|
|
1544
|
+
}, null, 42, ln));
|
|
1538
1545
|
}
|
|
1539
|
-
}),
|
|
1546
|
+
}), dn = {
|
|
1540
1547
|
number: M($),
|
|
1541
1548
|
text: M(Q),
|
|
1542
|
-
textarea: M(
|
|
1543
|
-
color: M(
|
|
1544
|
-
select: M(
|
|
1545
|
-
boolean: M(
|
|
1546
|
-
pair: M(
|
|
1547
|
-
anchor: M(
|
|
1548
|
-
align: M(
|
|
1549
|
-
padding: M(
|
|
1550
|
-
border: M(
|
|
1551
|
-
font: M(
|
|
1552
|
-
imageSrc: M(
|
|
1553
|
-
resourceValue: M(
|
|
1554
|
-
rowsPath: M(
|
|
1549
|
+
textarea: M(un),
|
|
1550
|
+
color: M(Ft),
|
|
1551
|
+
select: M(cn),
|
|
1552
|
+
boolean: M(tt),
|
|
1553
|
+
pair: M(rn),
|
|
1554
|
+
anchor: M(Qe),
|
|
1555
|
+
align: M(He),
|
|
1556
|
+
padding: M(Zt),
|
|
1557
|
+
border: M(Ct),
|
|
1558
|
+
font: M(kt),
|
|
1559
|
+
imageSrc: M(qt),
|
|
1560
|
+
resourceValue: M(Bt),
|
|
1561
|
+
rowsPath: M(an)
|
|
1555
1562
|
};
|
|
1556
1563
|
//#endregion
|
|
1557
1564
|
//#region src/property-panel/usePropertyPanel.ts
|
|
1558
|
-
function
|
|
1565
|
+
function fn(e) {
|
|
1559
1566
|
let t = L(e.store.doc), n = L(e.store.ui.selection), r = L(e.store.ui.anchorExpanded), i = L(e.store.ui.dataSourceSchema), a = L(e.store.ui.resourceStatuses), o = L(e.store.ui.editing), s = e.subscribe((s) => {
|
|
1560
1567
|
s.scope === "doc" ? (t.value = e.store.doc, n.value = e.store.ui.selection, a.value = e.store.ui.resourceStatuses, o.value = e.store.ui.editing) : s.scope === "ui" && (s.branch === "selection" ? (n.value = e.store.ui.selection, e.store.closeMerge()) : s.branch === "anchorExpanded" ? r.value = e.store.ui.anchorExpanded : s.branch === "dataSourceSchema" ? i.value = e.store.ui.dataSourceSchema : s.branch === "resourceStatuses" ? a.value = e.store.ui.resourceStatuses : s.branch === "editing" && (o.value = e.store.ui.editing));
|
|
1561
1568
|
});
|
|
@@ -1565,7 +1572,7 @@ function un(e) {
|
|
|
1565
1572
|
return e && r ? p(e, r) : null;
|
|
1566
1573
|
}), l = T(() => t.value), u = T(() => {
|
|
1567
1574
|
let e = c.value, r = n.value;
|
|
1568
|
-
return e && r ?
|
|
1575
|
+
return e && r ? Fe(r, e) : t.value ? Ie : [];
|
|
1569
1576
|
}), d = T(() => {
|
|
1570
1577
|
let r = n.value;
|
|
1571
1578
|
return r && t.value ? e.layerBoxAt(r) : null;
|
|
@@ -1624,7 +1631,7 @@ function un(e) {
|
|
|
1624
1631
|
function ae(t, n, r) {
|
|
1625
1632
|
let i = t.key[1];
|
|
1626
1633
|
if (i !== "color" && i !== "image") return;
|
|
1627
|
-
let a = l.value?.background ??
|
|
1634
|
+
let a = l.value?.background ?? K, o = typeof n == "string" && n !== "" ? n : null, s = {
|
|
1628
1635
|
...a,
|
|
1629
1636
|
[i]: o
|
|
1630
1637
|
}, c = `canvas:background.${i}`;
|
|
@@ -1652,14 +1659,14 @@ function un(e) {
|
|
|
1652
1659
|
}
|
|
1653
1660
|
//#endregion
|
|
1654
1661
|
//#region src/property-panel/fields/ValueTypeSegmented.vue?vue&type=script&setup=true&lang.ts
|
|
1655
|
-
var
|
|
1662
|
+
var pn = ["aria-disabled"], mn = [
|
|
1656
1663
|
"aria-pressed",
|
|
1657
1664
|
"title",
|
|
1658
1665
|
"data-mode-static",
|
|
1659
1666
|
"data-mode-expression",
|
|
1660
1667
|
"disabled",
|
|
1661
1668
|
"onClick"
|
|
1662
|
-
],
|
|
1669
|
+
], hn = /* @__PURE__ */ j({
|
|
1663
1670
|
__name: "ValueTypeSegmented",
|
|
1664
1671
|
props: {
|
|
1665
1672
|
mode: {},
|
|
@@ -1694,15 +1701,15 @@ var dn = ["aria-disabled"], fn = [
|
|
|
1694
1701
|
"data-mode-expression": t.value === "expression" || void 0,
|
|
1695
1702
|
disabled: e.disabled,
|
|
1696
1703
|
onClick: V((e) => a(t.value), ["prevent"])
|
|
1697
|
-
}, R(t.label), 11,
|
|
1704
|
+
}, R(t.label), 11, mn)), 64))], 10, pn));
|
|
1698
1705
|
}
|
|
1699
|
-
}),
|
|
1706
|
+
}), gn = ["title"], _n = {
|
|
1700
1707
|
key: 2,
|
|
1701
1708
|
class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
|
|
1702
|
-
},
|
|
1709
|
+
}, vn = ["title"], yn = {
|
|
1703
1710
|
key: 4,
|
|
1704
1711
|
class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
|
|
1705
|
-
},
|
|
1712
|
+
}, bn = /* @__PURE__ */ j({
|
|
1706
1713
|
__name: "PropertyField",
|
|
1707
1714
|
props: {
|
|
1708
1715
|
field: {},
|
|
@@ -1722,7 +1729,7 @@ var dn = ["aria-disabled"], fn = [
|
|
|
1722
1729
|
"sub-commit"
|
|
1723
1730
|
],
|
|
1724
1731
|
setup(e, { emit: t }) {
|
|
1725
|
-
let n = e, r = t, i = T(() =>
|
|
1732
|
+
let n = e, r = t, i = T(() => dn[n.field.control]), a = T(() => n.dataMode === "expression"), o = T(() => n.field.control === "pair" ? "cn-prop-field block" : "cn-prop-field grid grid-cols-[60px_minmax(0,1fr)] items-center gap-x-2 gap-y-1.5"), s = T(() => n.field.data === !0 ? "col-span-2" : ""), c = T(() => n.field.data === !0 && n.field.control === "textarea"), l = T(() => n.field.control === "rowsPath"), u = T(() => n.field.resource === !0 || l.value), d = F(null), f = T(() => n.field.data === !0 && a.value && typeof n.value == "string" ? n.field.resource === !0 ? n.value === "" ? [] : x(n.value) : c.value ? ne(n.value) : [] : []), p = T(() => f.value.length === 0 ? "" : n.field.resource === !0 ? le(n.completion != null) : se(f.value)), m = T(() => (n.field.resource === !0 ? a.value : l.value) && n.completion == null && f.value.length === 0 ? C : ""), h = T(() => f.value.length > 0 || l.value && n.drifted === !0), g = T(() => n.field.control === "textarea");
|
|
1726
1733
|
function _() {
|
|
1727
1734
|
let e = f.value[0], t = d.value?.$el;
|
|
1728
1735
|
e !== void 0 && (t instanceof HTMLTextAreaElement || t instanceof HTMLInputElement) && (t.focus(), t.setSelectionRange(e.at.start, e.at.end));
|
|
@@ -1747,8 +1754,8 @@ var dn = ["aria-disabled"], fn = [
|
|
|
1747
1754
|
key: 0,
|
|
1748
1755
|
class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted",
|
|
1749
1756
|
title: e.field.title
|
|
1750
|
-
}, R(e.field.label), 9,
|
|
1751
|
-
e.field.data ? (P(), E(
|
|
1757
|
+
}, R(e.field.label), 9, gn)),
|
|
1758
|
+
e.field.data ? (P(), E(hn, {
|
|
1752
1759
|
key: 1,
|
|
1753
1760
|
class: "justify-self-end",
|
|
1754
1761
|
mode: e.dataMode ?? "static",
|
|
@@ -1782,14 +1789,14 @@ var dn = ["aria-disabled"], fn = [
|
|
|
1782
1789
|
"source",
|
|
1783
1790
|
"resource-status"
|
|
1784
1791
|
])),
|
|
1785
|
-
e.hint ? (P(), O("span",
|
|
1792
|
+
e.hint ? (P(), O("span", _n, R(e.hint), 1)) : D("", !0),
|
|
1786
1793
|
p.value ? (P(), O("span", {
|
|
1787
1794
|
key: 3,
|
|
1788
1795
|
class: N(["cn-prop-field__hint cn-prop-field__hint--error col-span-2 block text-[11px] leading-4 text-cn-danger", { "cursor-pointer": g.value }]),
|
|
1789
1796
|
title: g.value ? "点击选中出错片段" : void 0,
|
|
1790
1797
|
onClick: _
|
|
1791
|
-
}, R(p.value), 11,
|
|
1792
|
-
m.value ? (P(), O("span",
|
|
1798
|
+
}, R(p.value), 11, vn)) : D("", !0),
|
|
1799
|
+
m.value ? (P(), O("span", yn, R(m.value), 1)) : D("", !0)
|
|
1793
1800
|
]),
|
|
1794
1801
|
_: 1
|
|
1795
1802
|
}, 8, ["class"])), c.value ? (P(), E(ae, {
|
|
@@ -1800,14 +1807,14 @@ var dn = ["aria-disabled"], fn = [
|
|
|
1800
1807
|
onSelect: z(S)
|
|
1801
1808
|
}, null, 8, ["state", "onSelect"])) : D("", !0)], 64));
|
|
1802
1809
|
}
|
|
1803
|
-
}),
|
|
1810
|
+
}), xn = { class: "cn-props flex w-[288px] shrink-0 flex-col overflow-y-auto rounded-xl border border-cn-line bg-cn-bg text-cn-fg shadow-[0_16px_40px_-12px_rgba(2,6,23,0.55)]" }, Sn = { class: "sticky top-0 z-10 border-b border-cn-line bg-cn-bg-elevated/95 px-3.5 py-2.5 backdrop-blur-sm" }, Cn = { class: "flex items-center gap-2" }, wn = { class: "inline-flex items-center gap-1.5 rounded border border-cn-accent/25 bg-cn-accent-soft px-1.5 py-0.5 font-mono text-[10px] leading-4 text-cn-accent" }, Tn = { class: "text-[12px] font-medium tracking-wide text-cn-fg/90" }, En = {
|
|
1804
1811
|
key: 0,
|
|
1805
1812
|
class: "mx-3.5 my-4 rounded-lg border border-dashed border-cn-line px-3 py-6 text-center text-[11px] leading-5 text-cn-muted"
|
|
1806
|
-
},
|
|
1813
|
+
}, Dn = { class: "cn-props__section-title mb-2 text-[10px] font-semibold uppercase tracking-[0.16em] text-cn-muted" }, On = { class: "flex flex-col gap-2" }, kn = "内容编辑中:请在画布编辑框内修改,退出后此处更新", An = /* @__PURE__ */ j({
|
|
1807
1814
|
__name: "PropertyPanel",
|
|
1808
1815
|
props: { editor: {} },
|
|
1809
1816
|
setup(e) {
|
|
1810
|
-
let t = e, n =
|
|
1817
|
+
let t = e, n = fn(t.editor);
|
|
1811
1818
|
he(Z, {
|
|
1812
1819
|
canUpload: t.editor.canUpload,
|
|
1813
1820
|
uploadImage: (e) => t.editor.uploadImage(e)
|
|
@@ -1819,7 +1826,7 @@ var dn = ["aria-disabled"], fn = [
|
|
|
1819
1826
|
let e = n.layer.value;
|
|
1820
1827
|
return e ? e.type : n.canvas.value ? "Canvas" : "—";
|
|
1821
1828
|
}), o = T(() => {
|
|
1822
|
-
let e = n.layer.value === null ? n.selection.value ? null :
|
|
1829
|
+
let e = n.layer.value === null ? n.selection.value ? null : Le(n.canvas.value) : Re(n.layer.value);
|
|
1823
1830
|
if (!e) return [];
|
|
1824
1831
|
let t = n.selection.value?.join(".") ?? "canvas", r = n.layer.value, i = n.resourceStatuses.value, a = [];
|
|
1825
1832
|
for (let o of n.sections.value) {
|
|
@@ -1834,7 +1841,7 @@ var dn = ["aria-disabled"], fn = [
|
|
|
1834
1841
|
value: o.value,
|
|
1835
1842
|
dataMode: a.data ? n.isDataMarked(a) ? "expression" : "static" : void 0,
|
|
1836
1843
|
locked: c,
|
|
1837
|
-
hint: c ?
|
|
1844
|
+
hint: c ? kn : a.hint && r ? a.hint(r, i) ?? void 0 : void 0,
|
|
1838
1845
|
resourceStatus: a.control === "imageSrc" && typeof o.value == "string" && o.value !== "" ? i[o.value] : void 0,
|
|
1839
1846
|
drifted: a.control === "rowsPath" ? n.rowsPathDrifted.value : void 0
|
|
1840
1847
|
});
|
|
@@ -1862,16 +1869,16 @@ var dn = ["aria-disabled"], fn = [
|
|
|
1862
1869
|
function c() {
|
|
1863
1870
|
n.setAnchorExpanded(!n.anchorExpanded.value);
|
|
1864
1871
|
}
|
|
1865
|
-
return (e, t) => (P(), O("aside",
|
|
1866
|
-
k("header",
|
|
1872
|
+
return (e, t) => (P(), O("aside", xn, [
|
|
1873
|
+
k("header", Sn, [k("div", Cn, [k("span", wn, [t[0] ||= k("i", {
|
|
1867
1874
|
class: "size-1.5 rounded-full bg-cn-accent",
|
|
1868
1875
|
"aria-hidden": "true"
|
|
1869
|
-
}, null, -1), de(" " + R(a.value), 1)]), k("span",
|
|
1870
|
-
o.value.length === 0 ? (P(), O("p",
|
|
1876
|
+
}, null, -1), de(" " + R(a.value), 1)]), k("span", Tn, R(i.value ? "图层属性" : "画布属性"), 1)])]),
|
|
1877
|
+
o.value.length === 0 ? (P(), O("p", En, " 打开文档后可编辑属性 ")) : D("", !0),
|
|
1871
1878
|
(P(!0), O(w, null, I(o.value, (e) => (P(), O("section", {
|
|
1872
1879
|
key: e.title,
|
|
1873
1880
|
class: "cn-props__section border-b border-cn-line/70 px-3.5 py-3 last:border-b-0"
|
|
1874
|
-
}, [k("h3",
|
|
1881
|
+
}, [k("h3", Dn, R(e.title), 1), k("div", On, [(P(!0), O(w, null, I(e.fields, (e) => (P(), O(w, { key: e.key }, [e.field.control === "anchor" ? (P(), E(Qe, {
|
|
1875
1882
|
key: 0,
|
|
1876
1883
|
field: e.field,
|
|
1877
1884
|
"model-value": e.value,
|
|
@@ -1883,7 +1890,7 @@ var dn = ["aria-disabled"], fn = [
|
|
|
1883
1890
|
"model-value",
|
|
1884
1891
|
"expanded",
|
|
1885
1892
|
"onChange"
|
|
1886
|
-
])) : (P(), E(
|
|
1893
|
+
])) : (P(), E(bn, {
|
|
1887
1894
|
key: 1,
|
|
1888
1895
|
field: e.field,
|
|
1889
1896
|
value: e.value,
|
|
@@ -1917,4 +1924,4 @@ var dn = ["aria-disabled"], fn = [
|
|
|
1917
1924
|
}
|
|
1918
1925
|
});
|
|
1919
1926
|
//#endregion
|
|
1920
|
-
export { Z as a,
|
|
1927
|
+
export { Z as a, je as c, Ne as d, q as f, dn as i, Fe as l, bn as n, It as o, fn as r, Ie as s, An as t, Me as u };
|
package/dist/property-panel.js
CHANGED
|
@@ -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-
|
|
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-ns-OHICS.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.
|
|
3
|
+
"version": "2.0.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.
|
|
61
|
+
"@hankchen/canvas-editor": "2.0.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"vue": "^3.5.0"
|