@hankchen/canvas-editor-vue 2.0.0 → 2.2.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/README.md +43 -2
- package/dist/{ExpressionPathPicker-DchGsK70.js → Tooltip-9lQOwB7r.js} +260 -195
- package/dist/_plugin-vue_export-helper-CBNdHDnS.js +98 -0
- package/dist/canvas/EditOverlayToolbar.d.ts +1 -1
- package/dist/{canvas-DuvO27sj.js → canvas-DIcS64ZV.js} +614 -554
- package/dist/canvas.js +1 -1
- package/dist/index.js +14 -14
- package/dist/{layer-panel-BouAYiDq.js → layer-panel-DPhB8OJp.js} +246 -240
- package/dist/layer-panel.js +1 -1
- package/dist/panel-theme.css +6 -276
- package/dist/property-panel/fieldSchema.d.ts +4 -2
- package/dist/{property-panel-ns-OHICS.js → property-panel-BzpaxWLB.js} +268 -253
- package/dist/property-panel.js +2 -2
- package/dist/{resourceTemplate-D-DKEo7Z.js → resourceTemplate-DLEZMwZl.js} +1 -1
- package/dist/shared/Tooltip.d.ts +24 -0
- package/dist/shared/index.d.ts +8 -1
- package/dist/shared/useCnTheme.d.ts +12 -0
- package/dist/shared/useDropdownMenu.d.ts +13 -1
- package/dist/{shared-CRDKDSpa.js → shared-5EY0LNSa.js} +76 -31
- package/dist/shared.js +9 -9
- package/dist/{status-bar-DBf5kIXY.js → status-bar-CJJSr9Ua.js} +9 -10
- package/dist/status-bar.js +1 -1
- package/dist/style.css +1 -1
- package/dist/theme.css +428 -0
- package/dist/{uploadFile-mXJVPEzm.js → uploadFile-DnW3L-8J.js} +33 -33
- package/dist/useTransientFeedback-CI3j6r7y.js +956 -0
- package/package.json +4 -3
- package/dist/DropdownMenu-CeUNKMDQ.js +0 -450
- package/dist/layerPath-uy2ywyld.js +0 -76
- package/dist/useTransientFeedback-BN_O7V2w.js +0 -498
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as e } from "./createLucideIcon-SCvtEGVf.js";
|
|
2
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,
|
|
4
|
-
import { c as
|
|
5
|
-
import { n as b, r as
|
|
6
|
-
import { a as
|
|
7
|
-
import { Fragment as w, computed as T, createBlock as E, createCommentVNode as D, createElementBlock as O, createElementVNode as k, createTextVNode as
|
|
8
|
-
var
|
|
3
|
+
import { a as p, n as m, o as h, s as g } from "./_plugin-vue_export-helper-CBNdHDnS.js";
|
|
4
|
+
import { c as _, l as ee, n as v, s as te, t as y } from "./Tooltip-9lQOwB7r.js";
|
|
5
|
+
import { n as b, r as ne, t as x } from "./resourceTemplate-DLEZMwZl.js";
|
|
6
|
+
import { a as S, f as re, h as C, i as ie, l as ae, m as oe, n as se, o as ce, p as le, s as ue, t as de } from "./uploadFile-DnW3L-8J.js";
|
|
7
|
+
import { Fragment as w, computed as T, createBlock as E, createCommentVNode as D, createElementBlock as O, createElementVNode as k, createTextVNode as fe, createVNode as A, defineComponent as j, inject as pe, markRaw as M, nextTick as me, normalizeClass as N, onScopeDispose as he, openBlock as P, provide as ge, ref as F, renderList as I, resolveDynamicComponent as _e, shallowRef as L, toDisplayString as R, unref as z, vModelText as ve, watch as B, watchEffect as ye, withCtx as be, withDirectives as xe, withModifiers as V } from "vue";
|
|
8
|
+
var Se = e({
|
|
9
9
|
name: "grid-2x2",
|
|
10
10
|
size: 24,
|
|
11
11
|
node: [
|
|
@@ -27,7 +27,7 @@ var xe = e({
|
|
|
27
27
|
}]
|
|
28
28
|
],
|
|
29
29
|
aliases: ["grid-2-x-2"]
|
|
30
|
-
}),
|
|
30
|
+
}), Ce = e({
|
|
31
31
|
name: "square-split-vertical",
|
|
32
32
|
size: 24,
|
|
33
33
|
node: [
|
|
@@ -45,7 +45,7 @@ var xe = e({
|
|
|
45
45
|
}]
|
|
46
46
|
],
|
|
47
47
|
aliases: ["split-square-vertical"]
|
|
48
|
-
}),
|
|
48
|
+
}), we = e({
|
|
49
49
|
name: "square",
|
|
50
50
|
size: 24,
|
|
51
51
|
node: [["rect", {
|
|
@@ -59,7 +59,7 @@ var xe = e({
|
|
|
59
59
|
});
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region ../canvas-editor/src/shared/resourceStatus.ts
|
|
62
|
-
function
|
|
62
|
+
function Te(e, n) {
|
|
63
63
|
if (e.type !== "ImageLayer") return !1;
|
|
64
64
|
if (e.expression !== null || e.src === null || t(e) <= 0 || a(e) <= 0) return !0;
|
|
65
65
|
if (n !== void 0) {
|
|
@@ -70,7 +70,7 @@ function we(e, n) {
|
|
|
70
70
|
}
|
|
71
71
|
//#endregion
|
|
72
72
|
//#region src/property-panel/fieldSchema.ts
|
|
73
|
-
var
|
|
73
|
+
var Ee = "当前层内容未绘制,padding 不影响预览", H = {
|
|
74
74
|
title: "位置与尺寸",
|
|
75
75
|
fields: [
|
|
76
76
|
{
|
|
@@ -160,7 +160,7 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
|
|
|
160
160
|
label: "内边距",
|
|
161
161
|
control: "padding",
|
|
162
162
|
title: "内边距作用于内容盒,不改变图层尺寸",
|
|
163
|
-
hint: (e, t) =>
|
|
163
|
+
hint: (e, t) => Te(e, t) ? Ee : null
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
166
|
key: ["shape", "border"],
|
|
@@ -168,7 +168,7 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
|
|
|
168
168
|
control: "border"
|
|
169
169
|
}
|
|
170
170
|
]
|
|
171
|
-
},
|
|
171
|
+
}, De = {
|
|
172
172
|
title: "文本",
|
|
173
173
|
fields: [
|
|
174
174
|
{
|
|
@@ -200,43 +200,56 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
|
|
|
200
200
|
control: "boolean"
|
|
201
201
|
}
|
|
202
202
|
]
|
|
203
|
-
},
|
|
203
|
+
}, Oe = "cover", ke = "contain", Ae = "fill", je = "tile", Me = "rect", Ne = "circle", Pe = {
|
|
204
204
|
ImageLayer: [
|
|
205
205
|
H,
|
|
206
206
|
U,
|
|
207
207
|
W,
|
|
208
208
|
{
|
|
209
209
|
title: "图片",
|
|
210
|
-
fields: [
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
210
|
+
fields: [
|
|
211
|
+
{
|
|
212
|
+
key: ["src"],
|
|
213
|
+
label: "资源地址",
|
|
214
|
+
control: "imageSrc",
|
|
215
|
+
data: !0,
|
|
216
|
+
resource: !0
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
key: ["fit"],
|
|
220
|
+
label: "适配",
|
|
221
|
+
control: "select",
|
|
222
|
+
domain: [
|
|
223
|
+
Oe,
|
|
224
|
+
ke,
|
|
225
|
+
Ae,
|
|
226
|
+
je
|
|
227
|
+
],
|
|
228
|
+
optionLabels: {
|
|
229
|
+
[Oe]: "铺满裁切",
|
|
230
|
+
[ke]: "完整显示",
|
|
231
|
+
[Ae]: "拉伸铺满",
|
|
232
|
+
[je]: "平铺"
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
key: ["clip"],
|
|
237
|
+
label: "裁剪形状",
|
|
238
|
+
control: "select",
|
|
239
|
+
domain: [Me, Ne],
|
|
240
|
+
optionLabels: {
|
|
241
|
+
[Me]: "矩形",
|
|
242
|
+
[Ne]: "圆形"
|
|
243
|
+
}
|
|
231
244
|
}
|
|
232
|
-
|
|
245
|
+
]
|
|
233
246
|
}
|
|
234
247
|
],
|
|
235
248
|
TextLayer: [
|
|
236
249
|
H,
|
|
237
250
|
U,
|
|
238
251
|
W,
|
|
239
|
-
|
|
252
|
+
De
|
|
240
253
|
],
|
|
241
254
|
QrCodeLayer: [
|
|
242
255
|
H,
|
|
@@ -292,15 +305,15 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
|
|
|
292
305
|
}]
|
|
293
306
|
}]
|
|
294
307
|
};
|
|
295
|
-
function
|
|
296
|
-
return
|
|
308
|
+
function Fe(e) {
|
|
309
|
+
return Pe[e] ?? [];
|
|
297
310
|
}
|
|
298
|
-
function
|
|
299
|
-
if (e[e.length - 1] === "content") return
|
|
311
|
+
function Ie(e) {
|
|
312
|
+
if (e[e.length - 1] === "content") return p(e) ? "templateContent" : "content";
|
|
300
313
|
let t = e[e.length - 2];
|
|
301
314
|
return t === "rows" ? "row" : t === "cells" ? "cell" : "root";
|
|
302
315
|
}
|
|
303
|
-
var
|
|
316
|
+
var Le = {
|
|
304
317
|
root: [],
|
|
305
318
|
cell: [],
|
|
306
319
|
row: ["shape.width", "shape.autoWidth"],
|
|
@@ -315,9 +328,9 @@ var Pe = {
|
|
|
315
328
|
function G(e, t) {
|
|
316
329
|
return [...e.key, ...t.key];
|
|
317
330
|
}
|
|
318
|
-
function
|
|
319
|
-
let n = new Set(
|
|
320
|
-
for (let e of
|
|
331
|
+
function Re(e, t) {
|
|
332
|
+
let n = new Set(Le[Ie(e)]), r = [];
|
|
333
|
+
for (let e of Fe(t.type)) {
|
|
321
334
|
let i = [];
|
|
322
335
|
for (let r of e.fields) {
|
|
323
336
|
if (r.items) {
|
|
@@ -337,7 +350,7 @@ function Fe(e, t) {
|
|
|
337
350
|
}
|
|
338
351
|
return r;
|
|
339
352
|
}
|
|
340
|
-
var
|
|
353
|
+
var ze = [{
|
|
341
354
|
title: "画布",
|
|
342
355
|
fields: [{
|
|
343
356
|
key: ["width"],
|
|
@@ -365,7 +378,7 @@ var Ie = [{
|
|
|
365
378
|
control: "imageSrc"
|
|
366
379
|
}]
|
|
367
380
|
}];
|
|
368
|
-
function
|
|
381
|
+
function Be(e) {
|
|
369
382
|
return e === null ? null : e.background === null ? {
|
|
370
383
|
...e,
|
|
371
384
|
background: K
|
|
@@ -375,10 +388,11 @@ var K = {
|
|
|
375
388
|
color: null,
|
|
376
389
|
image: null
|
|
377
390
|
};
|
|
378
|
-
function
|
|
379
|
-
return e.type === "ImageLayer" && e.fit === void 0 ? {
|
|
391
|
+
function Ve(e) {
|
|
392
|
+
return e.type === "ImageLayer" && (e.fit === void 0 || e.clip === void 0) ? {
|
|
380
393
|
...e,
|
|
381
|
-
fit: "cover"
|
|
394
|
+
...e.fit === void 0 ? { fit: "cover" } : {},
|
|
395
|
+
...e.clip === void 0 ? { clip: "rect" } : {}
|
|
382
396
|
} : e;
|
|
383
397
|
}
|
|
384
398
|
function q(e, t) {
|
|
@@ -394,14 +408,10 @@ function q(e, t) {
|
|
|
394
408
|
}
|
|
395
409
|
//#endregion
|
|
396
410
|
//#region src/property-panel/fields/AlignField.vue?vue&type=script&setup=true&lang.ts
|
|
397
|
-
var
|
|
398
|
-
"aria-pressed",
|
|
399
|
-
"title",
|
|
400
|
-
"onClick"
|
|
401
|
-
], Ve = {
|
|
411
|
+
var He = ["aria-label"], Ue = ["aria-pressed", "onClick"], We = {
|
|
402
412
|
key: 1,
|
|
403
413
|
class: "truncate px-1 text-[10px] leading-none"
|
|
404
|
-
},
|
|
414
|
+
}, Ge = /* @__PURE__ */ j({
|
|
405
415
|
__name: "AlignField",
|
|
406
416
|
props: {
|
|
407
417
|
field: {},
|
|
@@ -446,45 +456,50 @@ var ze = ["aria-label"], Be = [
|
|
|
446
456
|
title: t?.[e] ? `${a.field.label}:${t[e].title}` : `${a.field.label}:${e}`
|
|
447
457
|
}));
|
|
448
458
|
});
|
|
449
|
-
function
|
|
459
|
+
function h(e) {
|
|
450
460
|
e !== a.modelValue && u("change", e);
|
|
451
461
|
}
|
|
452
462
|
return (t, n) => (P(), O("span", {
|
|
453
463
|
class: "cn-align flex h-7 min-w-0 flex-1 overflow-hidden rounded-md border border-cn-field-line bg-cn-field",
|
|
454
464
|
role: "group",
|
|
455
465
|
"aria-label": e.field.label
|
|
456
|
-
}, [(P(!0), O(w, null, I(p.value, (t, n) => (P(),
|
|
466
|
+
}, [(P(!0), O(w, null, I(p.value, (t, n) => (P(), E(y, {
|
|
457
467
|
key: t.value,
|
|
458
|
-
|
|
459
|
-
class:
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
468
|
+
label: t.title,
|
|
469
|
+
class: "min-w-0 flex-1"
|
|
470
|
+
}, {
|
|
471
|
+
default: be(() => [k("button", {
|
|
472
|
+
type: "button",
|
|
473
|
+
class: N(["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"]]),
|
|
474
|
+
"aria-pressed": t.value === e.modelValue,
|
|
475
|
+
onClick: V((e) => h(t.value), ["prevent"])
|
|
476
|
+
}, [t.icon ? (P(), E(m, {
|
|
477
|
+
key: 0,
|
|
478
|
+
icon: t.icon
|
|
479
|
+
}, null, 8, ["icon"])) : (P(), O("span", We, R(t.value), 1))], 10, Ue)]),
|
|
480
|
+
_: 2
|
|
481
|
+
}, 1032, ["label"]))), 128))], 8, He));
|
|
467
482
|
}
|
|
468
|
-
}),
|
|
483
|
+
}), Ke = { class: "block" }, qe = ["aria-expanded", "title"], Je = { class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted" }, Ye = { class: "flex shrink-0 items-center gap-1.5" }, Xe = {
|
|
469
484
|
viewBox: "0 0 24 24",
|
|
470
485
|
class: "size-3.5",
|
|
471
486
|
"aria-hidden": "true"
|
|
472
|
-
},
|
|
487
|
+
}, Ze = [
|
|
473
488
|
"cx",
|
|
474
489
|
"cy",
|
|
475
490
|
"r"
|
|
476
|
-
],
|
|
491
|
+
], Qe = {
|
|
477
492
|
key: 0,
|
|
478
493
|
class: "mt-2 flex justify-end"
|
|
479
|
-
},
|
|
494
|
+
}, $e = {
|
|
480
495
|
class: "cn-anchor grid w-[66px] shrink-0 grid-cols-3 gap-[3px]",
|
|
481
496
|
role: "group",
|
|
482
497
|
"aria-label": "九宫锚点"
|
|
483
|
-
},
|
|
498
|
+
}, et = [
|
|
484
499
|
"aria-pressed",
|
|
485
500
|
"title",
|
|
486
501
|
"onClick"
|
|
487
|
-
],
|
|
502
|
+
], tt = /* @__PURE__ */ j({
|
|
488
503
|
__name: "AnchorDisclosureField",
|
|
489
504
|
props: {
|
|
490
505
|
field: {},
|
|
@@ -504,31 +519,31 @@ var ze = ["aria-label"], Be = [
|
|
|
504
519
|
function s(e) {
|
|
505
520
|
r("change", e);
|
|
506
521
|
}
|
|
507
|
-
return (t, n) => (P(), O("span",
|
|
522
|
+
return (t, n) => (P(), O("span", Ke, [k("button", {
|
|
508
523
|
type: "button",
|
|
509
524
|
class: "cn-anchor-disclosure__header flex w-full items-center justify-between gap-2",
|
|
510
525
|
"aria-expanded": e.expanded,
|
|
511
526
|
title: e.expanded ? "收起锚点" : `锚点:${e.modelValue}(点击展开调整)`,
|
|
512
527
|
onClick: n[0] ||= (e) => r("toggle")
|
|
513
|
-
}, [k("span",
|
|
528
|
+
}, [k("span", Je, R(e.field.label), 1), k("span", Ye, [(P(), O("svg", Xe, [(P(!0), O(w, null, I(z(a), (e) => (P(), O("circle", {
|
|
514
529
|
key: e.index,
|
|
515
530
|
cx: e.cx,
|
|
516
531
|
cy: e.cy,
|
|
517
532
|
r: e.index === o.value ? 3.2 : 2.2,
|
|
518
533
|
class: N(e.index === o.value ? "fill-cn-accent" : "fill-cn-muted/35")
|
|
519
|
-
}, null, 10,
|
|
534
|
+
}, null, 10, Ze))), 128))])), A(m, {
|
|
520
535
|
icon: z(u),
|
|
521
536
|
class: N(["text-cn-muted transition-transform duration-150", { "rotate-180": e.expanded }])
|
|
522
|
-
}, null, 8, ["icon", "class"])])], 8,
|
|
537
|
+
}, null, 8, ["icon", "class"])])], 8, qe), e.expanded ? (P(), O("span", Qe, [k("span", $e, [(P(!0), O(w, null, I(z(i), (t) => (P(), O("button", {
|
|
523
538
|
key: t,
|
|
524
539
|
type: "button",
|
|
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-
|
|
540
|
+
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-(--cn-accent-glow)" : "border-cn-field-line bg-cn-field hover:border-cn-muted/50"]),
|
|
526
541
|
"aria-pressed": t === e.modelValue,
|
|
527
542
|
title: t,
|
|
528
543
|
onClick: (e) => s(t)
|
|
529
|
-
}, null, 10,
|
|
544
|
+
}, null, 10, et))), 128))])])) : D("", !0)]));
|
|
530
545
|
}
|
|
531
|
-
}),
|
|
546
|
+
}), nt = { class: "cn-bool relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center" }, rt = ["checked"], it = /* @__PURE__ */ j({
|
|
532
547
|
__name: "BooleanField",
|
|
533
548
|
props: {
|
|
534
549
|
field: {},
|
|
@@ -538,11 +553,11 @@ var ze = ["aria-label"], Be = [
|
|
|
538
553
|
setup(e, { emit: t }) {
|
|
539
554
|
let n = e, r = t, i = F(null);
|
|
540
555
|
async function a(e) {
|
|
541
|
-
r("change", e.target.checked), await
|
|
556
|
+
r("change", e.target.checked), await me(), i.value && (i.value.checked = n.modelValue);
|
|
542
557
|
}
|
|
543
|
-
return
|
|
558
|
+
return ye(() => {
|
|
544
559
|
i.value && (i.value.checked = n.modelValue);
|
|
545
|
-
}), (t, n) => (P(), O("label",
|
|
560
|
+
}), (t, n) => (P(), O("label", nt, [
|
|
546
561
|
k("input", {
|
|
547
562
|
ref_key: "inputRef",
|
|
548
563
|
ref: i,
|
|
@@ -550,12 +565,12 @@ var ze = ["aria-label"], Be = [
|
|
|
550
565
|
type: "checkbox",
|
|
551
566
|
checked: e.modelValue,
|
|
552
567
|
onChange: a
|
|
553
|
-
}, null, 40,
|
|
568
|
+
}, null, 40, rt),
|
|
554
569
|
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),
|
|
555
570
|
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)
|
|
556
571
|
]));
|
|
557
572
|
}
|
|
558
|
-
}),
|
|
573
|
+
}), at = {
|
|
559
574
|
1: [{
|
|
560
575
|
label: "四边",
|
|
561
576
|
rep: "top",
|
|
@@ -598,13 +613,13 @@ var ze = ["aria-label"], Be = [
|
|
|
598
613
|
}
|
|
599
614
|
]
|
|
600
615
|
};
|
|
601
|
-
function
|
|
616
|
+
function ot(e) {
|
|
602
617
|
return e === 1 ? 2 : e === 2 ? 4 : 1;
|
|
603
618
|
}
|
|
604
|
-
function
|
|
619
|
+
function st(e) {
|
|
605
620
|
return e.top === e.bottom && e.bottom === e.left && e.left === e.right ? 1 : e.top === e.bottom && e.left === e.right ? 2 : 4;
|
|
606
621
|
}
|
|
607
|
-
function
|
|
622
|
+
function ct(e, t) {
|
|
608
623
|
if (t === 1) {
|
|
609
624
|
let { top: t } = e;
|
|
610
625
|
return {
|
|
@@ -625,17 +640,17 @@ function at(e, t) {
|
|
|
625
640
|
}
|
|
626
641
|
return e;
|
|
627
642
|
}
|
|
628
|
-
function
|
|
643
|
+
function lt(e, t) {
|
|
629
644
|
return e.top === t.top && e.bottom === t.bottom && e.left === t.left && e.right === t.right;
|
|
630
645
|
}
|
|
631
646
|
function J(e, t) {
|
|
632
647
|
return e === null || t === null ? e === t : e.width === t.width && e.color === t.color;
|
|
633
648
|
}
|
|
634
|
-
function
|
|
649
|
+
function ut(e) {
|
|
635
650
|
let { top: t, bottom: n, left: r, right: i } = e;
|
|
636
651
|
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;
|
|
637
652
|
}
|
|
638
|
-
function
|
|
653
|
+
function dt(e, t) {
|
|
639
654
|
let n = (e) => e === null ? null : { ...e };
|
|
640
655
|
if (t === 1) {
|
|
641
656
|
let t = n(e.top);
|
|
@@ -657,18 +672,18 @@ function ct(e, t) {
|
|
|
657
672
|
}
|
|
658
673
|
return e;
|
|
659
674
|
}
|
|
660
|
-
function
|
|
675
|
+
function ft(e, t) {
|
|
661
676
|
return J(e.top, t.top) && J(e.bottom, t.bottom) && J(e.left, t.left) && J(e.right, t.right);
|
|
662
677
|
}
|
|
663
678
|
//#endregion
|
|
664
679
|
//#region src/property-panel/useShorthandMode.ts
|
|
665
|
-
function
|
|
680
|
+
function pt(e, t) {
|
|
666
681
|
let n = T(() => t(e())), r = F(null), i = T(() => r.value ?? n.value);
|
|
667
682
|
B(e, () => {
|
|
668
683
|
r.value = null;
|
|
669
684
|
});
|
|
670
685
|
function a() {
|
|
671
|
-
let e = i.value, t =
|
|
686
|
+
let e = i.value, t = ot(e);
|
|
672
687
|
return r.value = t, {
|
|
673
688
|
from: e,
|
|
674
689
|
to: t
|
|
@@ -681,7 +696,7 @@ function ut(e, t) {
|
|
|
681
696
|
}
|
|
682
697
|
//#endregion
|
|
683
698
|
//#region src/property-panel/controlStyles.ts
|
|
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`,
|
|
699
|
+
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`, mt = Y, ht = "w-full flex-1 min-w-0 resize-y rounded-md border border-cn-field-line bg-cn-field px-2 py-1.5 text-[11.5px] leading-5 text-cn-fg outline-none transition-[border-color,box-shadow] duration-100 placeholder:text-cn-muted/60 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40", gt = "size-7 shrink-0 cursor-pointer self-center rounded-md border border-cn-field-line bg-cn-field p-0.5 transition-colors hover:border-cn-muted/40 disabled:cursor-not-allowed disabled:opacity-40", _t = ["aria-label"], vt = /* @__PURE__ */ j({
|
|
685
700
|
__name: "BorderWidthInput",
|
|
686
701
|
props: {
|
|
687
702
|
value: {},
|
|
@@ -719,7 +734,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
719
734
|
let a = o(t);
|
|
720
735
|
i.value = a === 0 ? "" : String(a), r("change", a);
|
|
721
736
|
}
|
|
722
|
-
return (t, n) =>
|
|
737
|
+
return (t, n) => xe((P(), O("input", {
|
|
723
738
|
"onUpdate:modelValue": n[0] ||= (e) => i.value = e,
|
|
724
739
|
class: N(["cn-field cn-field--number min-w-0 flex-1", z(X)]),
|
|
725
740
|
type: "number",
|
|
@@ -732,9 +747,9 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
732
747
|
onFocus: n[1] ||= (e) => a.value = !0,
|
|
733
748
|
onBlur: u,
|
|
734
749
|
onChange: u
|
|
735
|
-
}, null, 42,
|
|
750
|
+
}, null, 42, _t)), [[ve, i.value]]);
|
|
736
751
|
}
|
|
737
|
-
}),
|
|
752
|
+
}), yt = ["aria-label", "title"], bt = /* @__PURE__ */ j({
|
|
738
753
|
__name: "ShorthandModeButton",
|
|
739
754
|
props: {
|
|
740
755
|
mode: {},
|
|
@@ -744,15 +759,15 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
744
759
|
setup(e, { emit: t }) {
|
|
745
760
|
let n = e, r = t, i = {
|
|
746
761
|
1: {
|
|
747
|
-
icon:
|
|
762
|
+
icon: we,
|
|
748
763
|
title: "统一值"
|
|
749
764
|
},
|
|
750
765
|
2: {
|
|
751
|
-
icon:
|
|
766
|
+
icon: Ce,
|
|
752
767
|
title: "上下/左右"
|
|
753
768
|
},
|
|
754
769
|
4: {
|
|
755
|
-
icon:
|
|
770
|
+
icon: Se,
|
|
756
771
|
title: "四边独立"
|
|
757
772
|
}
|
|
758
773
|
}, a = T(() => i[n.mode]), o = T(() => `${n.label}:${a.value.title}(点击切换值模式)`);
|
|
@@ -762,17 +777,17 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
762
777
|
"aria-label": o.value,
|
|
763
778
|
title: o.value,
|
|
764
779
|
onClick: t[0] ||= V((e) => r("cycle"), ["prevent"])
|
|
765
|
-
}, [A(
|
|
780
|
+
}, [A(m, {
|
|
766
781
|
icon: a.value.icon,
|
|
767
782
|
size: 12
|
|
768
|
-
}, null, 8, ["icon"])], 8,
|
|
783
|
+
}, null, 8, ["icon"])], 8, yt));
|
|
769
784
|
}
|
|
770
|
-
}),
|
|
785
|
+
}), xt = { class: "cn-border flex w-full min-w-0 items-center gap-1" }, St = { class: "grid min-w-0 flex-1 gap-1 grid-cols-1" }, Ct = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, wt = [
|
|
771
786
|
"value",
|
|
772
787
|
"disabled",
|
|
773
788
|
"onInput",
|
|
774
789
|
"onChange"
|
|
775
|
-
],
|
|
790
|
+
], Tt = "#000000", Et = /* @__PURE__ */ j({
|
|
776
791
|
__name: "BorderField",
|
|
777
792
|
props: {
|
|
778
793
|
field: {},
|
|
@@ -780,12 +795,12 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
780
795
|
},
|
|
781
796
|
emits: ["input", "change"],
|
|
782
797
|
setup(e, { emit: t }) {
|
|
783
|
-
let n = e, r = t, { mode: i, cycle: a } =
|
|
798
|
+
let n = e, r = t, { mode: i, cycle: a } = pt(() => n.modelValue, ut), o = T(() => at[i.value]);
|
|
784
799
|
function s(e) {
|
|
785
800
|
return n.modelValue[e.rep]?.width ?? null;
|
|
786
801
|
}
|
|
787
802
|
function c(e) {
|
|
788
|
-
return n.modelValue[e.rep]?.color ??
|
|
803
|
+
return n.modelValue[e.rep]?.color ?? Tt;
|
|
789
804
|
}
|
|
790
805
|
function l(e, t, i) {
|
|
791
806
|
let a = { ...n.modelValue };
|
|
@@ -793,7 +808,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
793
808
|
r(i ? "change" : "input", a);
|
|
794
809
|
}
|
|
795
810
|
function u(e, t, r) {
|
|
796
|
-
let i = n.modelValue[e.rep]?.color ??
|
|
811
|
+
let i = n.modelValue[e.rep]?.color ?? Tt;
|
|
797
812
|
l(e, t <= 0 ? null : {
|
|
798
813
|
width: t,
|
|
799
814
|
color: i
|
|
@@ -811,20 +826,20 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
811
826
|
function f() {
|
|
812
827
|
let { from: e, to: t } = a();
|
|
813
828
|
if (t < e) {
|
|
814
|
-
let e =
|
|
815
|
-
|
|
829
|
+
let e = dt(n.modelValue, t);
|
|
830
|
+
ft(e, n.modelValue) || r("change", e);
|
|
816
831
|
}
|
|
817
832
|
}
|
|
818
|
-
return (t, n) => (P(), O("span",
|
|
833
|
+
return (t, n) => (P(), O("span", xt, [A(bt, {
|
|
819
834
|
mode: z(i),
|
|
820
835
|
label: "边框",
|
|
821
836
|
onCycle: f
|
|
822
|
-
}, null, 8, ["mode"]), k("span",
|
|
837
|
+
}, null, 8, ["mode"]), k("span", St, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
|
|
823
838
|
key: t.rep,
|
|
824
839
|
class: "flex items-center gap-1.5"
|
|
825
840
|
}, [
|
|
826
|
-
k("span",
|
|
827
|
-
A(
|
|
841
|
+
k("span", Ct, R(t.label), 1),
|
|
842
|
+
A(vt, {
|
|
828
843
|
class: "cn-border__width",
|
|
829
844
|
value: s(t),
|
|
830
845
|
label: t.label,
|
|
@@ -844,17 +859,17 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
844
859
|
disabled: e.modelValue[t.rep] === null,
|
|
845
860
|
onInput: (e) => d(t, e, !1),
|
|
846
861
|
onChange: (e) => d(t, e, !0)
|
|
847
|
-
}, null, 40,
|
|
862
|
+
}, null, 40, wt)
|
|
848
863
|
]))), 128))])]));
|
|
849
864
|
}
|
|
850
|
-
}),
|
|
865
|
+
}), Dt = ["value"], Ot = {
|
|
851
866
|
key: 1,
|
|
852
867
|
class: "flex flex-1 items-center gap-1.5"
|
|
853
|
-
},
|
|
868
|
+
}, kt = ["value"], At = ["value"], jt = [
|
|
854
869
|
"disabled",
|
|
855
870
|
"title",
|
|
856
871
|
"data-upload-error"
|
|
857
|
-
],
|
|
872
|
+
], Mt = /* @__PURE__ */ j({
|
|
858
873
|
__name: "FontField",
|
|
859
874
|
props: {
|
|
860
875
|
field: {},
|
|
@@ -862,7 +877,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
862
877
|
},
|
|
863
878
|
emits: ["input", "change"],
|
|
864
879
|
setup(e, { emit: t }) {
|
|
865
|
-
let n = e, r = t, i =
|
|
880
|
+
let n = e, r = t, i = ie(), a = T(() => {
|
|
866
881
|
if (i === null) return [];
|
|
867
882
|
let e = [{
|
|
868
883
|
label: "内置默认字体",
|
|
@@ -906,7 +921,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
906
921
|
if (t.value = "", i !== null && n && !p.value) {
|
|
907
922
|
p.value = !0;
|
|
908
923
|
try {
|
|
909
|
-
let e = await i.uploadFont(await
|
|
924
|
+
let e = await i.uploadFont(await de(n));
|
|
910
925
|
r("change", e);
|
|
911
926
|
} catch (e) {
|
|
912
927
|
m.value = e instanceof Error ? e.message : String(e);
|
|
@@ -917,14 +932,14 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
917
932
|
}
|
|
918
933
|
return (t, n) => z(i) === null ? (P(), O("input", {
|
|
919
934
|
key: 0,
|
|
920
|
-
class: N(["cn-field", z(
|
|
935
|
+
class: N(["cn-field", z(mt)]),
|
|
921
936
|
type: "text",
|
|
922
937
|
value: e.modelValue,
|
|
923
938
|
onInput: l,
|
|
924
939
|
onCompositionstart: u,
|
|
925
940
|
onCompositionend: d,
|
|
926
941
|
onChange: f
|
|
927
|
-
}, null, 42,
|
|
942
|
+
}, null, 42, Dt)) : (P(), O("div", Ot, [
|
|
928
943
|
k("select", {
|
|
929
944
|
class: N(["cn-field cn-select", z(Y)]),
|
|
930
945
|
value: e.modelValue,
|
|
@@ -932,7 +947,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
932
947
|
}, [(P(!0), O(w, null, I(a.value, (e) => (P(), O("option", {
|
|
933
948
|
key: e.value,
|
|
934
949
|
value: e.value
|
|
935
|
-
}, R(e.label), 9,
|
|
950
|
+
}, R(e.label), 9, At))), 128))], 42, kt),
|
|
936
951
|
k("input", {
|
|
937
952
|
ref_key: "fileInput",
|
|
938
953
|
ref: h,
|
|
@@ -949,10 +964,10 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
949
964
|
title: m.value ?? "上传本机字体(加入清单后可选)",
|
|
950
965
|
"data-upload-error": m.value ?? void 0,
|
|
951
966
|
onClick: g
|
|
952
|
-
}, R(p.value ? "…" : m.value ? "!" : "上传"), 9,
|
|
967
|
+
}, R(p.value ? "…" : m.value ? "!" : "上传"), 9, jt)) : D("", !0)
|
|
953
968
|
]));
|
|
954
969
|
}
|
|
955
|
-
}),
|
|
970
|
+
}), Nt = { class: "cn-color flex min-w-0 flex-1 items-center gap-1.5" }, Pt = ["checked"], Ft = ["value", "disabled"], It = ["value", "disabled"], Lt = "#000000", Rt = /* @__PURE__ */ j({
|
|
956
971
|
__name: "ColorField",
|
|
957
972
|
props: {
|
|
958
973
|
field: {},
|
|
@@ -965,7 +980,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
965
980
|
i.value = e !== null, i.value && (a.value = o(e));
|
|
966
981
|
});
|
|
967
982
|
function o(e) {
|
|
968
|
-
return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e :
|
|
983
|
+
return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e : Lt;
|
|
969
984
|
}
|
|
970
985
|
function s(e) {
|
|
971
986
|
let t = e.target.checked;
|
|
@@ -992,7 +1007,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
992
1007
|
}
|
|
993
1008
|
a.value = o(t), r("change", t);
|
|
994
1009
|
}
|
|
995
|
-
return (t, n) => (P(), O("span",
|
|
1010
|
+
return (t, n) => (P(), O("span", Nt, [
|
|
996
1011
|
e.field.nullable ? (P(), O("input", {
|
|
997
1012
|
key: 0,
|
|
998
1013
|
class: "cn-color__toggle size-3.5 shrink-0 cursor-pointer accent-cn-accent",
|
|
@@ -1000,15 +1015,15 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
1000
1015
|
title: "启用颜色",
|
|
1001
1016
|
checked: i.value,
|
|
1002
1017
|
onChange: s
|
|
1003
|
-
}, null, 40,
|
|
1018
|
+
}, null, 40, Pt)) : D("", !0),
|
|
1004
1019
|
k("input", {
|
|
1005
|
-
class: N(["cn-color__swatch", z(
|
|
1020
|
+
class: N(["cn-color__swatch", z(gt)]),
|
|
1006
1021
|
type: "color",
|
|
1007
1022
|
value: a.value,
|
|
1008
1023
|
disabled: !i.value,
|
|
1009
1024
|
onInput: c,
|
|
1010
1025
|
onChange: l
|
|
1011
|
-
}, null, 42,
|
|
1026
|
+
}, null, 42, Ft),
|
|
1012
1027
|
k("input", {
|
|
1013
1028
|
class: N(["cn-color__text min-w-0 flex-1", z(Y)]),
|
|
1014
1029
|
type: "text",
|
|
@@ -1016,27 +1031,27 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
1016
1031
|
disabled: !i.value,
|
|
1017
1032
|
placeholder: "无",
|
|
1018
1033
|
onChange: u
|
|
1019
|
-
}, null, 42,
|
|
1034
|
+
}, null, 42, It)
|
|
1020
1035
|
]));
|
|
1021
1036
|
}
|
|
1022
1037
|
}), Z = Symbol("canvas-image-upload");
|
|
1023
|
-
function
|
|
1024
|
-
return
|
|
1038
|
+
function zt() {
|
|
1039
|
+
return pe(Z, null);
|
|
1025
1040
|
}
|
|
1026
1041
|
//#endregion
|
|
1027
1042
|
//#region src/property-panel/fields/intrinsicSize.ts
|
|
1028
|
-
function
|
|
1043
|
+
function Bt(e, t) {
|
|
1029
1044
|
let n = e, r = t;
|
|
1030
1045
|
for (; r !== 0;) [n, r] = [r, n % r];
|
|
1031
1046
|
let i = e / n, a = t / n;
|
|
1032
1047
|
return Math.max(i, a) <= 32 ? `${i}:${a}` : `${Math.round(e / t * 100) / 100}:1`;
|
|
1033
1048
|
}
|
|
1034
|
-
function
|
|
1035
|
-
return !Number.isFinite(e) || !Number.isFinite(t) || e <= 0 || t <= 0 ? null : `${e}×${t} · ${
|
|
1049
|
+
function Vt(e, t) {
|
|
1050
|
+
return !Number.isFinite(e) || !Number.isFinite(t) || e <= 0 || t <= 0 ? null : `${e}×${t} · ${Bt(e, t)}`;
|
|
1036
1051
|
}
|
|
1037
1052
|
//#endregion
|
|
1038
1053
|
//#region src/property-panel/fields/TextField.vue?vue&type=script&setup=true&lang.ts
|
|
1039
|
-
var
|
|
1054
|
+
var Ht = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
1040
1055
|
__name: "TextField",
|
|
1041
1056
|
props: {
|
|
1042
1057
|
field: {},
|
|
@@ -1066,7 +1081,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1066
1081
|
o(t) || r("change", t);
|
|
1067
1082
|
}
|
|
1068
1083
|
return (t, n) => (P(), O("input", {
|
|
1069
|
-
class: N(["cn-field", [z(
|
|
1084
|
+
class: N(["cn-field", [z(mt), a.value ? "cn-field--invalid" : ""]]),
|
|
1070
1085
|
type: "text",
|
|
1071
1086
|
value: e.modelValue,
|
|
1072
1087
|
placeholder: e.field.placeholder,
|
|
@@ -1074,9 +1089,9 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1074
1089
|
onCompositionstart: c,
|
|
1075
1090
|
onCompositionend: l,
|
|
1076
1091
|
onChange: u
|
|
1077
|
-
}, null, 42,
|
|
1092
|
+
}, null, 42, Ht));
|
|
1078
1093
|
}
|
|
1079
|
-
}),
|
|
1094
|
+
}), Ut = /* @__PURE__ */ j({
|
|
1080
1095
|
__name: "ResourceValueField",
|
|
1081
1096
|
props: {
|
|
1082
1097
|
field: {},
|
|
@@ -1092,10 +1107,10 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1092
1107
|
return i.value ? b(e) ?? e : "";
|
|
1093
1108
|
});
|
|
1094
1109
|
function o(e) {
|
|
1095
|
-
let t =
|
|
1110
|
+
let t = x(e);
|
|
1096
1111
|
r("input", t), r("change", t);
|
|
1097
1112
|
}
|
|
1098
|
-
return (t, n) => i.value ? (P(), E(
|
|
1113
|
+
return (t, n) => i.value ? (P(), E(v, {
|
|
1099
1114
|
key: 0,
|
|
1100
1115
|
"model-value": a.value,
|
|
1101
1116
|
source: e.source ?? null,
|
|
@@ -1123,20 +1138,20 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1123
1138
|
"disabled"
|
|
1124
1139
|
]));
|
|
1125
1140
|
}
|
|
1126
|
-
}),
|
|
1141
|
+
}), Wt = {
|
|
1127
1142
|
key: 0,
|
|
1128
1143
|
class: "flex flex-col gap-1.5"
|
|
1129
|
-
},
|
|
1144
|
+
}, Gt = [
|
|
1130
1145
|
"disabled",
|
|
1131
1146
|
"title",
|
|
1132
1147
|
"data-upload-error"
|
|
1133
|
-
],
|
|
1148
|
+
], Kt = ["src"], qt = {
|
|
1134
1149
|
key: 2,
|
|
1135
1150
|
class: "relative"
|
|
1136
|
-
},
|
|
1151
|
+
}, Jt = { class: "flex items-center gap-1.5" }, Yt = {
|
|
1137
1152
|
key: 0,
|
|
1138
1153
|
class: "cn-imagesrc__intrinsic text-[11px] leading-4 text-cn-muted"
|
|
1139
|
-
},
|
|
1154
|
+
}, Xt = /* @__PURE__ */ j({
|
|
1140
1155
|
__name: "ImageSrcField",
|
|
1141
1156
|
props: {
|
|
1142
1157
|
field: {},
|
|
@@ -1148,7 +1163,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1148
1163
|
},
|
|
1149
1164
|
emits: ["input", "change"],
|
|
1150
1165
|
setup(e, { emit: t }) {
|
|
1151
|
-
let n = e, r = t, i =
|
|
1166
|
+
let n = e, r = t, i = zt(), 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 : Vt(d.value.width, d.value.height));
|
|
1152
1167
|
function p(e) {
|
|
1153
1168
|
let t = e.target;
|
|
1154
1169
|
d.value = t.naturalWidth > 0 && t.naturalHeight > 0 ? {
|
|
@@ -1167,7 +1182,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1167
1182
|
if (t.value = "", i !== null && n && !c.value) {
|
|
1168
1183
|
c.value = !0;
|
|
1169
1184
|
try {
|
|
1170
|
-
let e = await i.uploadImage(await
|
|
1185
|
+
let e = await i.uploadImage(await de(n));
|
|
1171
1186
|
e !== null && r("change", e);
|
|
1172
1187
|
} catch (e) {
|
|
1173
1188
|
l.value = e instanceof Error ? e.message : String(e);
|
|
@@ -1176,7 +1191,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1176
1191
|
}
|
|
1177
1192
|
}
|
|
1178
1193
|
}
|
|
1179
|
-
return (t, n) => a.value ? (P(), O("div",
|
|
1194
|
+
return (t, n) => a.value ? (P(), O("div", Wt, [
|
|
1180
1195
|
k("button", {
|
|
1181
1196
|
type: "button",
|
|
1182
1197
|
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",
|
|
@@ -1192,13 +1207,13 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1192
1207
|
alt: "",
|
|
1193
1208
|
onLoad: p,
|
|
1194
1209
|
onError: n[0] ||= (e) => d.value = null
|
|
1195
|
-
}, null, 40,
|
|
1210
|
+
}, null, 40, Kt)) : D("", !0),
|
|
1196
1211
|
s.value ? (P(), O("span", {
|
|
1197
1212
|
key: 1,
|
|
1198
1213
|
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"])
|
|
1199
1214
|
}, R(s.value), 3)) : D("", !0),
|
|
1200
|
-
o.value ? D("", !0) : (P(), O("span",
|
|
1201
|
-
], 8,
|
|
1215
|
+
o.value ? D("", !0) : (P(), O("span", qt, R(c.value ? "…" : l.value ? "!" : "点击上传图片"), 1))
|
|
1216
|
+
], 8, Gt),
|
|
1202
1217
|
k("input", {
|
|
1203
1218
|
ref_key: "fileInput",
|
|
1204
1219
|
ref: u,
|
|
@@ -1207,7 +1222,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1207
1222
|
accept: "image/*",
|
|
1208
1223
|
onChange: h
|
|
1209
1224
|
}, null, 544),
|
|
1210
|
-
k("div",
|
|
1225
|
+
k("div", Jt, [A(Q, {
|
|
1211
1226
|
class: "flex-1",
|
|
1212
1227
|
field: e.field,
|
|
1213
1228
|
"model-value": e.modelValue ?? "",
|
|
@@ -1225,8 +1240,8 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1225
1240
|
title: "清除图片(资源地址置空)",
|
|
1226
1241
|
onClick: n[3] ||= (e) => r("change", "")
|
|
1227
1242
|
}, "清除")) : D("", !0)]),
|
|
1228
|
-
f.value ? (P(), O("span",
|
|
1229
|
-
])) : e.dataMode === "expression" ? (P(), E(
|
|
1243
|
+
f.value ? (P(), O("span", Yt, "源图 " + R(f.value), 1)) : D("", !0)
|
|
1244
|
+
])) : e.dataMode === "expression" ? (P(), E(Ut, {
|
|
1230
1245
|
key: 1,
|
|
1231
1246
|
field: e.field,
|
|
1232
1247
|
"model-value": e.modelValue,
|
|
@@ -1253,7 +1268,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1253
1268
|
"aria-label"
|
|
1254
1269
|
]));
|
|
1255
1270
|
}
|
|
1256
|
-
}),
|
|
1271
|
+
}), Zt = [
|
|
1257
1272
|
"aria-label",
|
|
1258
1273
|
"min",
|
|
1259
1274
|
"max",
|
|
@@ -1294,7 +1309,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1294
1309
|
let a = o(t);
|
|
1295
1310
|
i.value = String(a), r("change", a);
|
|
1296
1311
|
}
|
|
1297
|
-
return (t, n) =>
|
|
1312
|
+
return (t, n) => xe((P(), O("input", {
|
|
1298
1313
|
"onUpdate:modelValue": n[0] ||= (e) => i.value = e,
|
|
1299
1314
|
class: N(["cn-field cn-field--number", z(X)]),
|
|
1300
1315
|
type: "number",
|
|
@@ -1306,9 +1321,9 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1306
1321
|
onFocus: n[1] ||= (e) => a.value = !0,
|
|
1307
1322
|
onBlur: l,
|
|
1308
1323
|
onChange: l
|
|
1309
|
-
}, null, 42,
|
|
1324
|
+
}, null, 42, Zt)), [[ve, i.value]]);
|
|
1310
1325
|
}
|
|
1311
|
-
}),
|
|
1326
|
+
}), Qt = { class: "cn-padding flex w-full min-w-0 items-center gap-1.5" }, $t = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, en = /* @__PURE__ */ j({
|
|
1312
1327
|
__name: "PaddingField",
|
|
1313
1328
|
props: {
|
|
1314
1329
|
field: {},
|
|
@@ -1316,7 +1331,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1316
1331
|
},
|
|
1317
1332
|
emits: ["input", "change"],
|
|
1318
1333
|
setup(e, { emit: t }) {
|
|
1319
|
-
let n = e, r = t, { mode: i, cycle: a } =
|
|
1334
|
+
let n = e, r = t, { mode: i, cycle: a } = pt(() => n.modelValue, st), o = T(() => at[i.value]);
|
|
1320
1335
|
function s(e) {
|
|
1321
1336
|
return {
|
|
1322
1337
|
key: ["padding", e.rep],
|
|
@@ -1332,18 +1347,18 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1332
1347
|
function l() {
|
|
1333
1348
|
let { from: e, to: t } = a();
|
|
1334
1349
|
if (t < e) {
|
|
1335
|
-
let e =
|
|
1336
|
-
|
|
1350
|
+
let e = ct(n.modelValue, t);
|
|
1351
|
+
lt(e, n.modelValue) || r("change", e);
|
|
1337
1352
|
}
|
|
1338
1353
|
}
|
|
1339
|
-
return (t, n) => (P(), O("span",
|
|
1354
|
+
return (t, n) => (P(), O("span", Qt, [A(bt, {
|
|
1340
1355
|
mode: z(i),
|
|
1341
1356
|
label: "内边距",
|
|
1342
1357
|
onCycle: l
|
|
1343
1358
|
}, 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", {
|
|
1344
1359
|
key: t.rep,
|
|
1345
1360
|
class: "flex min-w-0 items-center gap-1.5"
|
|
1346
|
-
}, [k("span",
|
|
1361
|
+
}, [k("span", $t, R(t.label), 1), A($, {
|
|
1347
1362
|
class: "min-w-0 flex-1",
|
|
1348
1363
|
field: s(t),
|
|
1349
1364
|
"model-value": e.modelValue[t.rep],
|
|
@@ -1356,16 +1371,16 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1356
1371
|
"onChange"
|
|
1357
1372
|
])]))), 128))], 2)]));
|
|
1358
1373
|
}
|
|
1359
|
-
}),
|
|
1374
|
+
}), tn = { class: "grid w-full min-w-0 grid-cols-2 gap-1" }, nn = ["title"], rn = { class: "w-3.5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, an = [
|
|
1360
1375
|
"aria-pressed",
|
|
1361
1376
|
"title",
|
|
1362
1377
|
"onClick"
|
|
1363
|
-
],
|
|
1378
|
+
], on = [
|
|
1364
1379
|
"aria-label",
|
|
1365
1380
|
"value",
|
|
1366
1381
|
"placeholder",
|
|
1367
1382
|
"title"
|
|
1368
|
-
],
|
|
1383
|
+
], sn = /* @__PURE__ */ j({
|
|
1369
1384
|
__name: "PairField",
|
|
1370
1385
|
props: {
|
|
1371
1386
|
field: {},
|
|
@@ -1421,12 +1436,12 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1421
1436
|
let t = d(e);
|
|
1422
1437
|
return t?.preview ? "模板子树:预览盒尺寸(随行实例变化,非文档声明值)" : t === void 0 ? `${e.label}自适应:已开启` : `${e.label}自适应:布局解析值(与画布选择框同源)`;
|
|
1423
1438
|
}
|
|
1424
|
-
return (e, t) => (P(), O("span",
|
|
1439
|
+
return (e, t) => (P(), O("span", tn, [(P(!0), O(w, null, I(i.value, (e) => (P(), O("label", {
|
|
1425
1440
|
key: e.key.join("."),
|
|
1426
1441
|
class: "flex min-w-0 items-center gap-1",
|
|
1427
1442
|
title: e.auto ? void 0 : e.label
|
|
1428
1443
|
}, [
|
|
1429
|
-
k("span",
|
|
1444
|
+
k("span", rn, R(e.label), 1),
|
|
1430
1445
|
e.auto ? (P(), O("button", {
|
|
1431
1446
|
key: 0,
|
|
1432
1447
|
type: "button",
|
|
@@ -1434,7 +1449,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1434
1449
|
"aria-pressed": a(e),
|
|
1435
1450
|
title: p(e),
|
|
1436
1451
|
onClick: V((t) => l(e), ["prevent"])
|
|
1437
|
-
}, "自", 10,
|
|
1452
|
+
}, "自", 10, an)) : D("", !0),
|
|
1438
1453
|
a(e) ? (P(), O("input", {
|
|
1439
1454
|
key: 2,
|
|
1440
1455
|
class: N(["cn-field cn-field--number min-w-0 flex-1", [z(X), d(e)?.preview ? "cn-field--preview" : ""]]),
|
|
@@ -1444,7 +1459,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1444
1459
|
value: f(e),
|
|
1445
1460
|
placeholder: e.auto?.placeholder ?? "",
|
|
1446
1461
|
title: m(e)
|
|
1447
|
-
}, null, 10,
|
|
1462
|
+
}, null, 10, on)) : (P(), E($, {
|
|
1448
1463
|
key: 1,
|
|
1449
1464
|
class: "min-w-0 flex-1",
|
|
1450
1465
|
field: e,
|
|
@@ -1457,9 +1472,9 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1457
1472
|
"onInput",
|
|
1458
1473
|
"onChange"
|
|
1459
1474
|
]))
|
|
1460
|
-
], 8,
|
|
1475
|
+
], 8, nn))), 128))]));
|
|
1461
1476
|
}
|
|
1462
|
-
}),
|
|
1477
|
+
}), cn = /* @__PURE__ */ j({
|
|
1463
1478
|
__name: "RowsPathField",
|
|
1464
1479
|
props: {
|
|
1465
1480
|
field: {},
|
|
@@ -1473,7 +1488,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1473
1488
|
function r(e) {
|
|
1474
1489
|
n("input", e), n("change", e);
|
|
1475
1490
|
}
|
|
1476
|
-
return (t, n) => (P(), E(
|
|
1491
|
+
return (t, n) => (P(), E(v, {
|
|
1477
1492
|
mode: "rowsPath",
|
|
1478
1493
|
"model-value": e.modelValue,
|
|
1479
1494
|
source: e.source ?? null,
|
|
@@ -1488,7 +1503,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1488
1503
|
"aria-label"
|
|
1489
1504
|
]));
|
|
1490
1505
|
}
|
|
1491
|
-
}),
|
|
1506
|
+
}), ln = ["value"], un = ["value"], dn = /* @__PURE__ */ j({
|
|
1492
1507
|
__name: "SelectField",
|
|
1493
1508
|
props: {
|
|
1494
1509
|
field: {},
|
|
@@ -1507,9 +1522,9 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1507
1522
|
}, [(P(!0), O(w, null, I(e.field.domain ?? [], (t) => (P(), O("option", {
|
|
1508
1523
|
key: t,
|
|
1509
1524
|
value: t
|
|
1510
|
-
}, R(e.field.optionLabels?.[t] ?? t), 9,
|
|
1525
|
+
}, R(e.field.optionLabels?.[t] ?? t), 9, un))), 128))], 40, ln));
|
|
1511
1526
|
}
|
|
1512
|
-
}),
|
|
1527
|
+
}), fn = ["value", "disabled"], pn = /* @__PURE__ */ j({
|
|
1513
1528
|
__name: "TextareaField",
|
|
1514
1529
|
props: {
|
|
1515
1530
|
field: {},
|
|
@@ -1533,7 +1548,7 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1533
1548
|
r = !1, n("change", e.target.value);
|
|
1534
1549
|
}
|
|
1535
1550
|
return (t, n) => (P(), O("textarea", {
|
|
1536
|
-
class: N(["cn-field", z(
|
|
1551
|
+
class: N(["cn-field", z(ht)]),
|
|
1537
1552
|
rows: "3",
|
|
1538
1553
|
value: e.modelValue,
|
|
1539
1554
|
disabled: e.disabled,
|
|
@@ -1541,71 +1556,71 @@ var zt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1541
1556
|
onCompositionstart: a,
|
|
1542
1557
|
onCompositionend: o,
|
|
1543
1558
|
onChange: s
|
|
1544
|
-
}, null, 42,
|
|
1559
|
+
}, null, 42, fn));
|
|
1545
1560
|
}
|
|
1546
|
-
}),
|
|
1561
|
+
}), mn = {
|
|
1547
1562
|
number: M($),
|
|
1548
1563
|
text: M(Q),
|
|
1549
|
-
textarea: M(
|
|
1550
|
-
color: M(
|
|
1551
|
-
select: M(
|
|
1552
|
-
boolean: M(
|
|
1553
|
-
pair: M(
|
|
1554
|
-
anchor: M(
|
|
1555
|
-
align: M(
|
|
1556
|
-
padding: M(
|
|
1557
|
-
border: M(
|
|
1558
|
-
font: M(
|
|
1559
|
-
imageSrc: M(
|
|
1560
|
-
resourceValue: M(
|
|
1561
|
-
rowsPath: M(
|
|
1564
|
+
textarea: M(pn),
|
|
1565
|
+
color: M(Rt),
|
|
1566
|
+
select: M(dn),
|
|
1567
|
+
boolean: M(it),
|
|
1568
|
+
pair: M(sn),
|
|
1569
|
+
anchor: M(tt),
|
|
1570
|
+
align: M(Ge),
|
|
1571
|
+
padding: M(en),
|
|
1572
|
+
border: M(Et),
|
|
1573
|
+
font: M(Mt),
|
|
1574
|
+
imageSrc: M(Xt),
|
|
1575
|
+
resourceValue: M(Ut),
|
|
1576
|
+
rowsPath: M(cn)
|
|
1562
1577
|
};
|
|
1563
1578
|
//#endregion
|
|
1564
1579
|
//#region src/property-panel/usePropertyPanel.ts
|
|
1565
|
-
function
|
|
1580
|
+
function hn(e) {
|
|
1566
1581
|
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) => {
|
|
1567
1582
|
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));
|
|
1568
1583
|
});
|
|
1569
|
-
|
|
1584
|
+
he(s, !0);
|
|
1570
1585
|
let c = T(() => {
|
|
1571
1586
|
let e = t.value, r = n.value;
|
|
1572
|
-
return e && r ?
|
|
1587
|
+
return e && r ? g(e, r) : null;
|
|
1573
1588
|
}), l = T(() => t.value), u = T(() => {
|
|
1574
1589
|
let e = c.value, r = n.value;
|
|
1575
|
-
return e && r ?
|
|
1590
|
+
return e && r ? Re(r, e) : t.value ? ze : [];
|
|
1576
1591
|
}), d = T(() => {
|
|
1577
1592
|
let r = n.value;
|
|
1578
1593
|
return r && t.value ? e.layerBoxAt(r) : null;
|
|
1579
1594
|
}), f = T(() => {
|
|
1580
1595
|
let e = i.value;
|
|
1581
|
-
return e === null ? null :
|
|
1582
|
-
}),
|
|
1596
|
+
return e === null ? null : re(e, le(e, t.value, n.value));
|
|
1597
|
+
}), p = T(() => ee(t.value, n.value, i.value)), m = T(() => te(p.value)), v = T(() => {
|
|
1583
1598
|
let e = c.value;
|
|
1584
|
-
return e === null || e.type !== "TableLayer" || e.template === null ? !1 :
|
|
1585
|
-
}),
|
|
1599
|
+
return e === null || e.type !== "TableLayer" || e.template === null ? !1 : _(p.value, e.rowsPath);
|
|
1600
|
+
}), y = T(() => n.value?.includes("template") ?? !1), b = T(() => {
|
|
1586
1601
|
let e = o.value, t = n.value;
|
|
1587
|
-
return e !== null && t !== null &&
|
|
1602
|
+
return e !== null && t !== null && h(e.path, t);
|
|
1588
1603
|
});
|
|
1589
|
-
function
|
|
1604
|
+
function ne(t) {
|
|
1590
1605
|
e.store.setAnchorExpanded(t);
|
|
1591
1606
|
}
|
|
1592
|
-
function
|
|
1607
|
+
function x(e) {
|
|
1593
1608
|
if (!e.data) return !1;
|
|
1594
|
-
if (
|
|
1609
|
+
if (b.value) return o.value?.expression === !0;
|
|
1595
1610
|
let t = c.value;
|
|
1596
1611
|
return t !== null && "expression" in t && t.expression !== null;
|
|
1597
1612
|
}
|
|
1598
|
-
function
|
|
1613
|
+
function S(r, i, a) {
|
|
1599
1614
|
if (!t.value) return;
|
|
1600
1615
|
let o = n.value;
|
|
1601
1616
|
if (!o) {
|
|
1602
1617
|
ie(r, i, a);
|
|
1603
1618
|
return;
|
|
1604
1619
|
}
|
|
1605
|
-
let s =
|
|
1620
|
+
let s = se(o, r.key);
|
|
1606
1621
|
if (r.data) {
|
|
1607
|
-
if (
|
|
1608
|
-
let t =
|
|
1622
|
+
if (x(r)) {
|
|
1623
|
+
let t = se(o, ["data", "expression"]);
|
|
1609
1624
|
e.updateDataExpression(o, i, { mergeKey: t }), a && e.store.closeMerge(t);
|
|
1610
1625
|
return;
|
|
1611
1626
|
}
|
|
@@ -1614,7 +1629,7 @@ function fn(e) {
|
|
|
1614
1629
|
}
|
|
1615
1630
|
e.updateSpec(o, r.key, i, { mergeKey: s }), a && e.store.closeMerge(s);
|
|
1616
1631
|
}
|
|
1617
|
-
function
|
|
1632
|
+
function C(t) {
|
|
1618
1633
|
let r = n.value;
|
|
1619
1634
|
r && t.data && e.toggleDataMode(r);
|
|
1620
1635
|
}
|
|
@@ -1643,30 +1658,30 @@ function fn(e) {
|
|
|
1643
1658
|
canvas: l,
|
|
1644
1659
|
sections: u,
|
|
1645
1660
|
layerBox: d,
|
|
1646
|
-
isPreviewBox:
|
|
1661
|
+
isPreviewBox: y,
|
|
1647
1662
|
completionSource: f,
|
|
1648
|
-
rowsPathSource:
|
|
1649
|
-
rowsPathDrifted:
|
|
1663
|
+
rowsPathSource: m,
|
|
1664
|
+
rowsPathDrifted: v,
|
|
1650
1665
|
resourceStatuses: T(() => a.value),
|
|
1651
1666
|
anchorExpanded: T(() => r.value),
|
|
1652
|
-
contentLocked:
|
|
1667
|
+
contentLocked: b,
|
|
1653
1668
|
editingSession: T(() => o.value),
|
|
1654
|
-
isDataMarked:
|
|
1655
|
-
commit:
|
|
1656
|
-
toggleDataMode:
|
|
1657
|
-
setAnchorExpanded:
|
|
1669
|
+
isDataMarked: x,
|
|
1670
|
+
commit: S,
|
|
1671
|
+
toggleDataMode: C,
|
|
1672
|
+
setAnchorExpanded: ne
|
|
1658
1673
|
};
|
|
1659
1674
|
}
|
|
1660
1675
|
//#endregion
|
|
1661
1676
|
//#region src/property-panel/fields/ValueTypeSegmented.vue?vue&type=script&setup=true&lang.ts
|
|
1662
|
-
var
|
|
1677
|
+
var gn = ["aria-disabled"], _n = [
|
|
1663
1678
|
"aria-pressed",
|
|
1664
1679
|
"title",
|
|
1665
1680
|
"data-mode-static",
|
|
1666
1681
|
"data-mode-expression",
|
|
1667
1682
|
"disabled",
|
|
1668
1683
|
"onClick"
|
|
1669
|
-
],
|
|
1684
|
+
], vn = /* @__PURE__ */ j({
|
|
1670
1685
|
__name: "ValueTypeSegmented",
|
|
1671
1686
|
props: {
|
|
1672
1687
|
mode: {},
|
|
@@ -1701,15 +1716,15 @@ var pn = ["aria-disabled"], mn = [
|
|
|
1701
1716
|
"data-mode-expression": t.value === "expression" || void 0,
|
|
1702
1717
|
disabled: e.disabled,
|
|
1703
1718
|
onClick: V((e) => a(t.value), ["prevent"])
|
|
1704
|
-
}, R(t.label), 11,
|
|
1719
|
+
}, R(t.label), 11, _n)), 64))], 10, gn));
|
|
1705
1720
|
}
|
|
1706
|
-
}),
|
|
1721
|
+
}), yn = ["title"], bn = {
|
|
1707
1722
|
key: 2,
|
|
1708
1723
|
class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
|
|
1709
|
-
},
|
|
1724
|
+
}, xn = ["title"], Sn = {
|
|
1710
1725
|
key: 4,
|
|
1711
1726
|
class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
|
|
1712
|
-
},
|
|
1727
|
+
}, Cn = /* @__PURE__ */ j({
|
|
1713
1728
|
__name: "PropertyField",
|
|
1714
1729
|
props: {
|
|
1715
1730
|
field: {},
|
|
@@ -1729,7 +1744,7 @@ var pn = ["aria-disabled"], mn = [
|
|
|
1729
1744
|
"sub-commit"
|
|
1730
1745
|
],
|
|
1731
1746
|
setup(e, { emit: t }) {
|
|
1732
|
-
let n = e, r = t, i = T(() =>
|
|
1747
|
+
let n = e, r = t, i = T(() => mn[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 === "" ? [] : ne(n.value) : c.value ? C(n.value) : [] : []), p = T(() => f.value.length === 0 ? "" : n.field.resource === !0 ? ue(n.completion != null) : ce(f.value)), m = T(() => (n.field.resource === !0 ? a.value : l.value) && n.completion == null && f.value.length === 0 ? S : ""), h = T(() => f.value.length > 0 || l.value && n.drifted === !0), g = T(() => n.field.control === "textarea");
|
|
1733
1748
|
function _() {
|
|
1734
1749
|
let e = f.value[0], t = d.value?.$el;
|
|
1735
1750
|
e !== void 0 && (t instanceof HTMLTextAreaElement || t instanceof HTMLInputElement) && (t.focus(), t.setSelectionRange(e.at.start, e.at.end));
|
|
@@ -1738,31 +1753,31 @@ var pn = ["aria-disabled"], mn = [
|
|
|
1738
1753
|
if (!c.value) return null;
|
|
1739
1754
|
let e = d.value?.$el;
|
|
1740
1755
|
return e instanceof HTMLTextAreaElement || e instanceof HTMLInputElement ? e : null;
|
|
1741
|
-
}), v = F(null),
|
|
1756
|
+
}), v = F(null), te = T(() => v.value?.rootEl ?? null), { popup: y, accept: b } = ae({
|
|
1742
1757
|
target: ee,
|
|
1743
1758
|
enabled: () => c.value && a.value && n.completion != null,
|
|
1744
1759
|
pairing: () => c.value && a.value,
|
|
1745
1760
|
resolve: (e) => n.completion?.(e) ?? null,
|
|
1746
|
-
popupEl:
|
|
1761
|
+
popupEl: te
|
|
1747
1762
|
});
|
|
1748
|
-
function
|
|
1763
|
+
function x(e, t, n) {
|
|
1749
1764
|
r("sub-commit", e, t, n);
|
|
1750
1765
|
}
|
|
1751
|
-
return (t, n) => (P(), O(w, null, [(P(), E(
|
|
1752
|
-
default:
|
|
1766
|
+
return (t, n) => (P(), O(w, null, [(P(), E(_e(e.field.control === "pair" || e.field.control === "imageSrc" ? "div" : "label"), { class: N(o.value) }, {
|
|
1767
|
+
default: be(() => [
|
|
1753
1768
|
e.field.control === "pair" ? D("", !0) : (P(), O("span", {
|
|
1754
1769
|
key: 0,
|
|
1755
1770
|
class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted",
|
|
1756
1771
|
title: e.field.title
|
|
1757
|
-
}, R(e.field.label), 9,
|
|
1758
|
-
e.field.data ? (P(), E(
|
|
1772
|
+
}, R(e.field.label), 9, yn)),
|
|
1773
|
+
e.field.data ? (P(), E(vn, {
|
|
1759
1774
|
key: 1,
|
|
1760
1775
|
class: "justify-self-end",
|
|
1761
1776
|
mode: e.dataMode ?? "static",
|
|
1762
1777
|
disabled: e.locked,
|
|
1763
1778
|
onChange: n[0] ||= (e) => r("toggle-mode")
|
|
1764
1779
|
}, null, 8, ["mode", "disabled"])) : D("", !0),
|
|
1765
|
-
(P(), E(
|
|
1780
|
+
(P(), E(_e(i.value), {
|
|
1766
1781
|
ref_key: "controlRef",
|
|
1767
1782
|
ref: d,
|
|
1768
1783
|
class: N(["cn-prop-field__control", [s.value, {
|
|
@@ -1778,7 +1793,7 @@ var pn = ["aria-disabled"], mn = [
|
|
|
1778
1793
|
"resource-status": e.field.control === "imageSrc" ? e.resourceStatus : void 0,
|
|
1779
1794
|
onInput: n[1] ||= (e) => r("input", e),
|
|
1780
1795
|
onChange: n[2] ||= (e) => r("change", e),
|
|
1781
|
-
onSubCommit:
|
|
1796
|
+
onSubCommit: x
|
|
1782
1797
|
}, null, 40, [
|
|
1783
1798
|
"class",
|
|
1784
1799
|
"field",
|
|
@@ -1789,33 +1804,33 @@ var pn = ["aria-disabled"], mn = [
|
|
|
1789
1804
|
"source",
|
|
1790
1805
|
"resource-status"
|
|
1791
1806
|
])),
|
|
1792
|
-
e.hint ? (P(), O("span",
|
|
1807
|
+
e.hint ? (P(), O("span", bn, R(e.hint), 1)) : D("", !0),
|
|
1793
1808
|
p.value ? (P(), O("span", {
|
|
1794
1809
|
key: 3,
|
|
1795
1810
|
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 }]),
|
|
1796
1811
|
title: g.value ? "点击选中出错片段" : void 0,
|
|
1797
1812
|
onClick: _
|
|
1798
|
-
}, R(p.value), 11,
|
|
1799
|
-
m.value ? (P(), O("span",
|
|
1813
|
+
}, R(p.value), 11, xn)) : D("", !0),
|
|
1814
|
+
m.value ? (P(), O("span", Sn, R(m.value), 1)) : D("", !0)
|
|
1800
1815
|
]),
|
|
1801
1816
|
_: 1
|
|
1802
|
-
}, 8, ["class"])), c.value ? (P(), E(
|
|
1817
|
+
}, 8, ["class"])), c.value ? (P(), E(oe, {
|
|
1803
1818
|
key: 0,
|
|
1804
1819
|
ref_key: "popupRef",
|
|
1805
1820
|
ref: v,
|
|
1806
|
-
state: z(
|
|
1807
|
-
onSelect: z(
|
|
1821
|
+
state: z(y),
|
|
1822
|
+
onSelect: z(b)
|
|
1808
1823
|
}, null, 8, ["state", "onSelect"])) : D("", !0)], 64));
|
|
1809
1824
|
}
|
|
1810
|
-
}),
|
|
1825
|
+
}), wn = { 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-(--cn-shadow-md)" }, Tn = { 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" }, En = { class: "flex items-center gap-2" }, Dn = { 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" }, On = { class: "text-[12px] font-medium tracking-wide text-cn-fg/90" }, kn = {
|
|
1811
1826
|
key: 0,
|
|
1812
1827
|
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"
|
|
1813
|
-
},
|
|
1828
|
+
}, An = { class: "cn-props__section-title mb-2 text-[10px] font-semibold uppercase tracking-[0.16em] text-cn-muted" }, jn = { class: "flex flex-col gap-2" }, Mn = "内容编辑中:请在画布编辑框内修改,退出后此处更新", Nn = /* @__PURE__ */ j({
|
|
1814
1829
|
__name: "PropertyPanel",
|
|
1815
1830
|
props: { editor: {} },
|
|
1816
1831
|
setup(e) {
|
|
1817
|
-
let t = e, n =
|
|
1818
|
-
|
|
1832
|
+
let t = e, n = hn(t.editor);
|
|
1833
|
+
ge(Z, {
|
|
1819
1834
|
canUpload: t.editor.canUpload,
|
|
1820
1835
|
uploadImage: (e) => t.editor.uploadImage(e)
|
|
1821
1836
|
});
|
|
@@ -1826,7 +1841,7 @@ var pn = ["aria-disabled"], mn = [
|
|
|
1826
1841
|
let e = n.layer.value;
|
|
1827
1842
|
return e ? e.type : n.canvas.value ? "Canvas" : "—";
|
|
1828
1843
|
}), o = T(() => {
|
|
1829
|
-
let e = n.layer.value === null ? n.selection.value ? null :
|
|
1844
|
+
let e = n.layer.value === null ? n.selection.value ? null : Be(n.canvas.value) : Ve(n.layer.value);
|
|
1830
1845
|
if (!e) return [];
|
|
1831
1846
|
let t = n.selection.value?.join(".") ?? "canvas", r = n.layer.value, i = n.resourceStatuses.value, a = [];
|
|
1832
1847
|
for (let o of n.sections.value) {
|
|
@@ -1841,7 +1856,7 @@ var pn = ["aria-disabled"], mn = [
|
|
|
1841
1856
|
value: o.value,
|
|
1842
1857
|
dataMode: a.data ? n.isDataMarked(a) ? "expression" : "static" : void 0,
|
|
1843
1858
|
locked: c,
|
|
1844
|
-
hint: c ?
|
|
1859
|
+
hint: c ? Mn : a.hint && r ? a.hint(r, i) ?? void 0 : void 0,
|
|
1845
1860
|
resourceStatus: a.control === "imageSrc" && typeof o.value == "string" && o.value !== "" ? i[o.value] : void 0,
|
|
1846
1861
|
drifted: a.control === "rowsPath" ? n.rowsPathDrifted.value : void 0
|
|
1847
1862
|
});
|
|
@@ -1869,16 +1884,16 @@ var pn = ["aria-disabled"], mn = [
|
|
|
1869
1884
|
function c() {
|
|
1870
1885
|
n.setAnchorExpanded(!n.anchorExpanded.value);
|
|
1871
1886
|
}
|
|
1872
|
-
return (e, t) => (P(), O("aside",
|
|
1873
|
-
k("header",
|
|
1887
|
+
return (e, t) => (P(), O("aside", wn, [
|
|
1888
|
+
k("header", Tn, [k("div", En, [k("span", Dn, [t[0] ||= k("i", {
|
|
1874
1889
|
class: "size-1.5 rounded-full bg-cn-accent",
|
|
1875
1890
|
"aria-hidden": "true"
|
|
1876
|
-
}, null, -1),
|
|
1877
|
-
o.value.length === 0 ? (P(), O("p",
|
|
1891
|
+
}, null, -1), fe(" " + R(a.value), 1)]), k("span", On, R(i.value ? "图层属性" : "画布属性"), 1)])]),
|
|
1892
|
+
o.value.length === 0 ? (P(), O("p", kn, " 打开文档后可编辑属性 ")) : D("", !0),
|
|
1878
1893
|
(P(!0), O(w, null, I(o.value, (e) => (P(), O("section", {
|
|
1879
1894
|
key: e.title,
|
|
1880
1895
|
class: "cn-props__section border-b border-cn-line/70 px-3.5 py-3 last:border-b-0"
|
|
1881
|
-
}, [k("h3",
|
|
1896
|
+
}, [k("h3", An, R(e.title), 1), k("div", jn, [(P(!0), O(w, null, I(e.fields, (e) => (P(), O(w, { key: e.key }, [e.field.control === "anchor" ? (P(), E(tt, {
|
|
1882
1897
|
key: 0,
|
|
1883
1898
|
field: e.field,
|
|
1884
1899
|
"model-value": e.value,
|
|
@@ -1890,7 +1905,7 @@ var pn = ["aria-disabled"], mn = [
|
|
|
1890
1905
|
"model-value",
|
|
1891
1906
|
"expanded",
|
|
1892
1907
|
"onChange"
|
|
1893
|
-
])) : (P(), E(
|
|
1908
|
+
])) : (P(), E(Cn, {
|
|
1894
1909
|
key: 1,
|
|
1895
1910
|
field: e.field,
|
|
1896
1911
|
value: e.value,
|
|
@@ -1924,4 +1939,4 @@ var pn = ["aria-disabled"], mn = [
|
|
|
1924
1939
|
}
|
|
1925
1940
|
});
|
|
1926
1941
|
//#endregion
|
|
1927
|
-
export { Z as a,
|
|
1942
|
+
export { Z as a, Pe as c, Ie as d, q as f, mn as i, Re as l, Cn as n, zt as o, hn as r, ze as s, Nn as t, Fe as u };
|