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