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