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