@hankchen/canvas-editor-vue 0.6.1 → 0.8.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/{useDataSourceSchema-CG9EGzwc.js → DropdownMenu-CeUNKMDQ.js} +70 -84
- package/dist/ExpressionPathPicker-DchGsK70.js +739 -0
- package/dist/{canvas-CptBzpwT.js → canvas-DuvO27sj.js} +506 -485
- package/dist/canvas.js +1 -1
- package/dist/index.js +14 -15
- package/dist/layer-panel/TemplateTableForm.d.ts +1 -27
- package/dist/{layer-panel-Cz-tmbJJ.js → layer-panel-BouAYiDq.js} +231 -257
- package/dist/layer-panel.js +1 -1
- package/dist/property-panel/PropertyField.d.ts +9 -2
- package/dist/property-panel/fieldSchema.d.ts +28 -10
- package/dist/property-panel/fields/RowsPathField.d.ts +17 -0
- package/dist/property-panel/fields/index.d.ts +1 -0
- package/dist/property-panel/fields/intrinsicSize.d.ts +9 -0
- package/dist/property-panel/usePropertyPanel.d.ts +11 -2
- package/dist/{property-panel-OBqd6D8W.js → property-panel-BkfqRva4.js} +371 -271
- package/dist/property-panel.js +2 -2
- package/dist/resourceTemplate-D-DKEo7Z.js +33 -0
- package/dist/shared/ExpressionPathPicker.d.ts +9 -2
- package/dist/shared/index.d.ts +13 -10
- package/dist/shared/pathPickerModel.d.ts +16 -3
- package/dist/shared/popupPosition.d.ts +2 -2
- package/dist/shared/rowsPathPickerSource.d.ts +15 -0
- package/dist/shared/useDataSourceSchema.d.ts +6 -0
- package/dist/{shared-wuupBoZg.js → shared-CRDKDSpa.js} +22 -22
- package/dist/shared.js +9 -10
- package/dist/{status-bar-DCuK2R88.js → status-bar-DBf5kIXY.js} +6 -6
- package/dist/status-bar.js +1 -1
- package/dist/style.css +1 -1
- package/dist/uploadFile-mXJVPEzm.js +653 -0
- package/dist/{useTransientFeedback-CTjmMmFF.js → useTransientFeedback-BN_O7V2w.js} +43 -28
- package/package.json +2 -2
- package/dist/popupPosition-Ck5Gsvjy.js +0 -526
- package/dist/resourceTemplate-cdcQtp9a.js +0 -246
- package/dist/shared/rowsPathCompletionSource.d.ts +0 -3
- package/dist/shared/usePathCompletion.d.ts +0 -18
- package/dist/uploadFile-DbB-KhII.js +0 -520
- package/dist/usePathCompletion-Do17CQ6l.js +0 -220
|
@@ -1,10 +1,9 @@
|
|
|
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
3
|
import { a as p, i as m, r as h } from "./layerPath-uy2ywyld.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { a as
|
|
7
|
-
import { n as ce, r as le, t as ue } from "./usePathCompletion-Do17CQ6l.js";
|
|
4
|
+
import { c as g, l as _, o as ee, s as v, t as y } from "./ExpressionPathPicker-DchGsK70.js";
|
|
5
|
+
import { n as b, r as x, t as S } from "./resourceTemplate-D-DKEo7Z.js";
|
|
6
|
+
import { a as C, f as te, h as ne, i as re, l as ie, m as ae, n as oe, o as se, p as ce, s as le, t as ue } from "./uploadFile-mXJVPEzm.js";
|
|
8
7
|
import { Fragment as w, computed as T, createBlock as E, createCommentVNode as D, createElementBlock as O, createElementVNode as k, createTextVNode as de, createVNode as A, defineComponent as j, inject as fe, markRaw as M, nextTick as pe, normalizeClass as N, onScopeDispose as me, openBlock as P, provide as he, ref as F, renderList as I, resolveDynamicComponent as ge, shallowRef as L, toDisplayString as R, unref as z, vModelText as _e, watch as B, watchEffect as ve, withCtx as ye, withDirectives as be, withModifiers as V } from "vue";
|
|
9
8
|
var xe = e({
|
|
10
9
|
name: "grid-2x2",
|
|
@@ -170,6 +169,38 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
|
|
|
170
169
|
}
|
|
171
170
|
]
|
|
172
171
|
}, Ee = {
|
|
172
|
+
title: "文本",
|
|
173
|
+
fields: [
|
|
174
|
+
{
|
|
175
|
+
key: ["text"],
|
|
176
|
+
label: "内容",
|
|
177
|
+
control: "textarea",
|
|
178
|
+
data: !0
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
key: ["font"],
|
|
182
|
+
label: "字体",
|
|
183
|
+
control: "font"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
key: ["fontSize"],
|
|
187
|
+
label: "字号",
|
|
188
|
+
control: "number",
|
|
189
|
+
integer: !0,
|
|
190
|
+
min: 1
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
key: ["fontColor"],
|
|
194
|
+
label: "字色",
|
|
195
|
+
control: "color"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
key: ["autowrap"],
|
|
199
|
+
label: "自动换行",
|
|
200
|
+
control: "boolean"
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
}, De = "cover", Oe = "contain", ke = {
|
|
173
204
|
ImageLayer: [
|
|
174
205
|
H,
|
|
175
206
|
U,
|
|
@@ -182,6 +213,15 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
|
|
|
182
213
|
control: "imageSrc",
|
|
183
214
|
data: !0,
|
|
184
215
|
resource: !0
|
|
216
|
+
}, {
|
|
217
|
+
key: ["fit"],
|
|
218
|
+
label: "适配",
|
|
219
|
+
control: "select",
|
|
220
|
+
domain: [De, Oe],
|
|
221
|
+
optionLabels: {
|
|
222
|
+
[De]: "铺满裁切",
|
|
223
|
+
[Oe]: "完整显示"
|
|
224
|
+
}
|
|
185
225
|
}]
|
|
186
226
|
}
|
|
187
227
|
],
|
|
@@ -189,39 +229,7 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
|
|
|
189
229
|
H,
|
|
190
230
|
U,
|
|
191
231
|
W,
|
|
192
|
-
|
|
193
|
-
title: "文本",
|
|
194
|
-
fields: [
|
|
195
|
-
{
|
|
196
|
-
key: ["text"],
|
|
197
|
-
label: "内容",
|
|
198
|
-
control: "textarea",
|
|
199
|
-
data: !0
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
key: ["font"],
|
|
203
|
-
label: "字体",
|
|
204
|
-
control: "font"
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
key: ["fontSize"],
|
|
208
|
-
label: "字号",
|
|
209
|
-
control: "number",
|
|
210
|
-
integer: !0,
|
|
211
|
-
min: 1
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
key: ["fontColor"],
|
|
215
|
-
label: "字色",
|
|
216
|
-
control: "color"
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
key: ["autowrap"],
|
|
220
|
-
label: "自动换行",
|
|
221
|
-
control: "boolean"
|
|
222
|
-
}
|
|
223
|
-
]
|
|
224
|
-
}
|
|
232
|
+
Ee
|
|
225
233
|
],
|
|
226
234
|
QrCodeLayer: [
|
|
227
235
|
H,
|
|
@@ -246,11 +254,8 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
|
|
|
246
254
|
title: "数据",
|
|
247
255
|
fields: [{
|
|
248
256
|
key: ["rowsPath"],
|
|
249
|
-
label: "
|
|
250
|
-
control: "
|
|
251
|
-
placeholder: "如 order.items",
|
|
252
|
-
nonEmpty: !0,
|
|
253
|
-
completion: "rowsPath",
|
|
257
|
+
label: "取行路径",
|
|
258
|
+
control: "rowsPath",
|
|
254
259
|
visibleWhen: (e) => e.type === "TableLayer" && e.template !== null
|
|
255
260
|
}]
|
|
256
261
|
}
|
|
@@ -280,15 +285,15 @@ var Te = "当前层内容未绘制,padding 不影响预览", H = {
|
|
|
280
285
|
}]
|
|
281
286
|
}]
|
|
282
287
|
};
|
|
283
|
-
function
|
|
284
|
-
return
|
|
288
|
+
function Ae(e) {
|
|
289
|
+
return ke[e] ?? [];
|
|
285
290
|
}
|
|
286
|
-
function
|
|
291
|
+
function je(e) {
|
|
287
292
|
if (e[e.length - 1] === "content") return h(e) ? "templateContent" : "content";
|
|
288
293
|
let t = e[e.length - 2];
|
|
289
294
|
return t === "rows" ? "row" : t === "cells" ? "cell" : "root";
|
|
290
295
|
}
|
|
291
|
-
var
|
|
296
|
+
var Me = {
|
|
292
297
|
root: [],
|
|
293
298
|
cell: [],
|
|
294
299
|
row: ["shape.width", "shape.autoWidth"],
|
|
@@ -303,9 +308,9 @@ var ke = {
|
|
|
303
308
|
function G(e, t) {
|
|
304
309
|
return [...e.key, ...t.key];
|
|
305
310
|
}
|
|
306
|
-
function
|
|
307
|
-
let n = new Set(
|
|
308
|
-
for (let e of
|
|
311
|
+
function K(e, t) {
|
|
312
|
+
let n = new Set(Me[je(e)]), r = [];
|
|
313
|
+
for (let e of Ae(t.type)) {
|
|
309
314
|
let i = [];
|
|
310
315
|
for (let r of e.fields) {
|
|
311
316
|
if (r.items) {
|
|
@@ -325,7 +330,7 @@ function Ae(e, t) {
|
|
|
325
330
|
}
|
|
326
331
|
return r;
|
|
327
332
|
}
|
|
328
|
-
var
|
|
333
|
+
var Ne = [{
|
|
329
334
|
title: "画布",
|
|
330
335
|
fields: [{
|
|
331
336
|
key: ["width"],
|
|
@@ -340,8 +345,36 @@ var je = [{
|
|
|
340
345
|
integer: !0,
|
|
341
346
|
min: 1
|
|
342
347
|
}]
|
|
348
|
+
}, {
|
|
349
|
+
title: "背景",
|
|
350
|
+
fields: [{
|
|
351
|
+
key: ["background", "color"],
|
|
352
|
+
label: "背景色",
|
|
353
|
+
control: "color",
|
|
354
|
+
nullable: !0
|
|
355
|
+
}, {
|
|
356
|
+
key: ["background", "image"],
|
|
357
|
+
label: "背景图",
|
|
358
|
+
control: "imageSrc"
|
|
359
|
+
}]
|
|
343
360
|
}];
|
|
344
|
-
function
|
|
361
|
+
function Pe(e) {
|
|
362
|
+
return e === null ? null : e.background === null ? {
|
|
363
|
+
...e,
|
|
364
|
+
background: Fe
|
|
365
|
+
} : e;
|
|
366
|
+
}
|
|
367
|
+
var Fe = {
|
|
368
|
+
color: null,
|
|
369
|
+
image: null
|
|
370
|
+
};
|
|
371
|
+
function Ie(e) {
|
|
372
|
+
return e.type === "ImageLayer" && e.fit === void 0 ? {
|
|
373
|
+
...e,
|
|
374
|
+
fit: "cover"
|
|
375
|
+
} : e;
|
|
376
|
+
}
|
|
377
|
+
function q(e, t) {
|
|
345
378
|
let n = e;
|
|
346
379
|
for (let e = 0; e < t.length; e += 1) {
|
|
347
380
|
if (typeof n != "object" || !n) return { ok: !1 };
|
|
@@ -354,14 +387,14 @@ function K(e, t) {
|
|
|
354
387
|
}
|
|
355
388
|
//#endregion
|
|
356
389
|
//#region src/property-panel/fields/AlignField.vue?vue&type=script&setup=true&lang.ts
|
|
357
|
-
var
|
|
390
|
+
var Le = ["aria-label"], Re = [
|
|
358
391
|
"aria-pressed",
|
|
359
392
|
"title",
|
|
360
393
|
"onClick"
|
|
361
|
-
],
|
|
394
|
+
], ze = {
|
|
362
395
|
key: 1,
|
|
363
396
|
class: "truncate px-1 text-[10px] leading-none"
|
|
364
|
-
},
|
|
397
|
+
}, Be = /* @__PURE__ */ j({
|
|
365
398
|
__name: "AlignField",
|
|
366
399
|
props: {
|
|
367
400
|
field: {},
|
|
@@ -420,31 +453,31 @@ var Me = ["aria-label"], Ne = [
|
|
|
420
453
|
"aria-pressed": t.value === e.modelValue,
|
|
421
454
|
title: t.title,
|
|
422
455
|
onClick: V((e) => m(t.value), ["prevent"])
|
|
423
|
-
}, [t.icon ? (P(), E(
|
|
456
|
+
}, [t.icon ? (P(), E(g, {
|
|
424
457
|
key: 0,
|
|
425
458
|
icon: t.icon
|
|
426
|
-
}, null, 8, ["icon"])) : (P(), O("span",
|
|
459
|
+
}, null, 8, ["icon"])) : (P(), O("span", ze, R(t.value), 1))], 10, Re))), 128))], 8, Le));
|
|
427
460
|
}
|
|
428
|
-
}),
|
|
461
|
+
}), Ve = { class: "block" }, He = ["aria-expanded", "title"], Ue = { class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted" }, We = { class: "flex shrink-0 items-center gap-1.5" }, Ge = {
|
|
429
462
|
viewBox: "0 0 24 24",
|
|
430
463
|
class: "size-3.5",
|
|
431
464
|
"aria-hidden": "true"
|
|
432
|
-
},
|
|
465
|
+
}, Ke = [
|
|
433
466
|
"cx",
|
|
434
467
|
"cy",
|
|
435
468
|
"r"
|
|
436
|
-
],
|
|
469
|
+
], qe = {
|
|
437
470
|
key: 0,
|
|
438
471
|
class: "mt-2 flex justify-end"
|
|
439
|
-
},
|
|
472
|
+
}, Je = {
|
|
440
473
|
class: "cn-anchor grid w-[66px] shrink-0 grid-cols-3 gap-[3px]",
|
|
441
474
|
role: "group",
|
|
442
475
|
"aria-label": "九宫锚点"
|
|
443
|
-
},
|
|
476
|
+
}, Ye = [
|
|
444
477
|
"aria-pressed",
|
|
445
478
|
"title",
|
|
446
479
|
"onClick"
|
|
447
|
-
],
|
|
480
|
+
], Xe = /* @__PURE__ */ j({
|
|
448
481
|
__name: "AnchorDisclosureField",
|
|
449
482
|
props: {
|
|
450
483
|
field: {},
|
|
@@ -464,31 +497,31 @@ var Me = ["aria-label"], Ne = [
|
|
|
464
497
|
function s(e) {
|
|
465
498
|
r("change", e);
|
|
466
499
|
}
|
|
467
|
-
return (t, n) => (P(), O("span",
|
|
500
|
+
return (t, n) => (P(), O("span", Ve, [k("button", {
|
|
468
501
|
type: "button",
|
|
469
502
|
class: "cn-anchor-disclosure__header flex w-full items-center justify-between gap-2",
|
|
470
503
|
"aria-expanded": e.expanded,
|
|
471
504
|
title: e.expanded ? "收起锚点" : `锚点:${e.modelValue}(点击展开调整)`,
|
|
472
505
|
onClick: n[0] ||= (e) => r("toggle")
|
|
473
|
-
}, [k("span",
|
|
506
|
+
}, [k("span", Ue, R(e.field.label), 1), k("span", We, [(P(), O("svg", Ge, [(P(!0), O(w, null, I(z(a), (e) => (P(), O("circle", {
|
|
474
507
|
key: e.index,
|
|
475
508
|
cx: e.cx,
|
|
476
509
|
cy: e.cy,
|
|
477
510
|
r: e.index === o.value ? 3.2 : 2.2,
|
|
478
511
|
class: N(e.index === o.value ? "fill-cn-accent" : "fill-cn-muted/35")
|
|
479
|
-
}, null, 10,
|
|
512
|
+
}, null, 10, Ke))), 128))])), A(g, {
|
|
480
513
|
icon: z(u),
|
|
481
514
|
class: N(["text-cn-muted transition-transform duration-150", { "rotate-180": e.expanded }])
|
|
482
|
-
}, null, 8, ["icon", "class"])])], 8,
|
|
515
|
+
}, null, 8, ["icon", "class"])])], 8, He), e.expanded ? (P(), O("span", qe, [k("span", Je, [(P(!0), O(w, null, I(z(i), (t) => (P(), O("button", {
|
|
483
516
|
key: t,
|
|
484
517
|
type: "button",
|
|
485
518
|
class: N(["cn-anchor__cell relative aspect-square min-w-0 rounded-[4px] border p-0 transition-colors duration-100", t === e.modelValue ? "cn-anchor__cell--active border-cn-accent bg-cn-accent shadow-[0_0_8px_rgba(56,189,248,0.35)]" : "border-cn-field-line bg-cn-field hover:border-cn-muted/50"]),
|
|
486
519
|
"aria-pressed": t === e.modelValue,
|
|
487
520
|
title: t,
|
|
488
521
|
onClick: (e) => s(t)
|
|
489
|
-
}, null, 10,
|
|
522
|
+
}, null, 10, Ye))), 128))])])) : D("", !0)]));
|
|
490
523
|
}
|
|
491
|
-
}),
|
|
524
|
+
}), Ze = { class: "cn-bool relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center" }, Qe = ["checked"], $e = /* @__PURE__ */ j({
|
|
492
525
|
__name: "BooleanField",
|
|
493
526
|
props: {
|
|
494
527
|
field: {},
|
|
@@ -502,7 +535,7 @@ var Me = ["aria-label"], Ne = [
|
|
|
502
535
|
}
|
|
503
536
|
return ve(() => {
|
|
504
537
|
i.value && (i.value.checked = n.modelValue);
|
|
505
|
-
}), (t, n) => (P(), O("label",
|
|
538
|
+
}), (t, n) => (P(), O("label", Ze, [
|
|
506
539
|
k("input", {
|
|
507
540
|
ref_key: "inputRef",
|
|
508
541
|
ref: i,
|
|
@@ -510,12 +543,12 @@ var Me = ["aria-label"], Ne = [
|
|
|
510
543
|
type: "checkbox",
|
|
511
544
|
checked: e.modelValue,
|
|
512
545
|
onChange: a
|
|
513
|
-
}, null, 40,
|
|
546
|
+
}, null, 40, Qe),
|
|
514
547
|
n[0] ||= k("span", { class: "absolute inset-0 rounded-full border border-cn-field-line bg-cn-field transition-colors duration-150 peer-checked:border-cn-accent/60 peer-checked:bg-cn-accent/30 peer-focus-visible:ring-[3px] peer-focus-visible:ring-cn-accent/20" }, null, -1),
|
|
515
548
|
n[1] ||= k("span", { class: "relative mx-0.5 size-3 rounded-full bg-cn-muted shadow-sm transition-transform duration-150 peer-checked:translate-x-3 peer-checked:bg-cn-accent" }, null, -1)
|
|
516
549
|
]));
|
|
517
550
|
}
|
|
518
|
-
}),
|
|
551
|
+
}), et = {
|
|
519
552
|
1: [{
|
|
520
553
|
label: "四边",
|
|
521
554
|
rep: "top",
|
|
@@ -558,13 +591,13 @@ var Me = ["aria-label"], Ne = [
|
|
|
558
591
|
}
|
|
559
592
|
]
|
|
560
593
|
};
|
|
561
|
-
function
|
|
594
|
+
function tt(e) {
|
|
562
595
|
return e === 1 ? 2 : e === 2 ? 4 : 1;
|
|
563
596
|
}
|
|
564
|
-
function
|
|
597
|
+
function nt(e) {
|
|
565
598
|
return e.top === e.bottom && e.bottom === e.left && e.left === e.right ? 1 : e.top === e.bottom && e.left === e.right ? 2 : 4;
|
|
566
599
|
}
|
|
567
|
-
function
|
|
600
|
+
function rt(e, t) {
|
|
568
601
|
if (t === 1) {
|
|
569
602
|
let { top: t } = e;
|
|
570
603
|
return {
|
|
@@ -585,17 +618,17 @@ function Qe(e, t) {
|
|
|
585
618
|
}
|
|
586
619
|
return e;
|
|
587
620
|
}
|
|
588
|
-
function
|
|
621
|
+
function it(e, t) {
|
|
589
622
|
return e.top === t.top && e.bottom === t.bottom && e.left === t.left && e.right === t.right;
|
|
590
623
|
}
|
|
591
|
-
function
|
|
624
|
+
function J(e, t) {
|
|
592
625
|
return e === null || t === null ? e === t : e.width === t.width && e.color === t.color;
|
|
593
626
|
}
|
|
594
|
-
function
|
|
627
|
+
function at(e) {
|
|
595
628
|
let { top: t, bottom: n, left: r, right: i } = e;
|
|
596
|
-
return t === null && n === null && r === null && i === null || t !== null &&
|
|
629
|
+
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;
|
|
597
630
|
}
|
|
598
|
-
function
|
|
631
|
+
function ot(e, t) {
|
|
599
632
|
let n = (e) => e === null ? null : { ...e };
|
|
600
633
|
if (t === 1) {
|
|
601
634
|
let t = n(e.top);
|
|
@@ -617,18 +650,18 @@ function tt(e, t) {
|
|
|
617
650
|
}
|
|
618
651
|
return e;
|
|
619
652
|
}
|
|
620
|
-
function
|
|
621
|
-
return
|
|
653
|
+
function st(e, t) {
|
|
654
|
+
return J(e.top, t.top) && J(e.bottom, t.bottom) && J(e.left, t.left) && J(e.right, t.right);
|
|
622
655
|
}
|
|
623
656
|
//#endregion
|
|
624
657
|
//#region src/property-panel/useShorthandMode.ts
|
|
625
|
-
function
|
|
658
|
+
function ct(e, t) {
|
|
626
659
|
let n = T(() => t(e())), r = F(null), i = T(() => r.value ?? n.value);
|
|
627
660
|
B(e, () => {
|
|
628
661
|
r.value = null;
|
|
629
662
|
});
|
|
630
663
|
function a() {
|
|
631
|
-
let e = i.value, t =
|
|
664
|
+
let e = i.value, t = tt(e);
|
|
632
665
|
return r.value = t, {
|
|
633
666
|
from: e,
|
|
634
667
|
to: t
|
|
@@ -641,7 +674,7 @@ function rt(e, t) {
|
|
|
641
674
|
}
|
|
642
675
|
//#endregion
|
|
643
676
|
//#region src/property-panel/controlStyles.ts
|
|
644
|
-
var
|
|
677
|
+
var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-field text-[11.5px] leading-none text-cn-fg outline-none transition-[border-color,box-shadow,background-color] duration-100 placeholder:text-cn-muted/60 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-cn-field-line", X = `${Y} text-right font-mono tabular-nums`, lt = Y, ut = "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", dt = "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", ft = ["aria-label"], pt = /* @__PURE__ */ j({
|
|
645
678
|
__name: "BorderWidthInput",
|
|
646
679
|
props: {
|
|
647
680
|
value: {},
|
|
@@ -681,7 +714,7 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
681
714
|
}
|
|
682
715
|
return (t, n) => be((P(), O("input", {
|
|
683
716
|
"onUpdate:modelValue": n[0] ||= (e) => i.value = e,
|
|
684
|
-
class: N(["cn-field cn-field--number min-w-0 flex-1", z(
|
|
717
|
+
class: N(["cn-field cn-field--number min-w-0 flex-1", z(X)]),
|
|
685
718
|
type: "number",
|
|
686
719
|
"aria-label": e.label,
|
|
687
720
|
min: 0,
|
|
@@ -692,9 +725,9 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
692
725
|
onFocus: n[1] ||= (e) => a.value = !0,
|
|
693
726
|
onBlur: u,
|
|
694
727
|
onChange: u
|
|
695
|
-
}, null, 42,
|
|
728
|
+
}, null, 42, ft)), [[_e, i.value]]);
|
|
696
729
|
}
|
|
697
|
-
}),
|
|
730
|
+
}), mt = ["aria-label", "title"], ht = /* @__PURE__ */ j({
|
|
698
731
|
__name: "ShorthandModeButton",
|
|
699
732
|
props: {
|
|
700
733
|
mode: {},
|
|
@@ -722,17 +755,17 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
722
755
|
"aria-label": o.value,
|
|
723
756
|
title: o.value,
|
|
724
757
|
onClick: t[0] ||= V((e) => r("cycle"), ["prevent"])
|
|
725
|
-
}, [A(
|
|
758
|
+
}, [A(g, {
|
|
726
759
|
icon: a.value.icon,
|
|
727
760
|
size: 12
|
|
728
|
-
}, null, 8, ["icon"])], 8,
|
|
761
|
+
}, null, 8, ["icon"])], 8, mt));
|
|
729
762
|
}
|
|
730
|
-
}),
|
|
763
|
+
}), gt = { class: "cn-border flex w-full min-w-0 items-center gap-1" }, _t = { class: "grid min-w-0 flex-1 gap-1 grid-cols-1" }, vt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, yt = [
|
|
731
764
|
"value",
|
|
732
765
|
"disabled",
|
|
733
766
|
"onInput",
|
|
734
767
|
"onChange"
|
|
735
|
-
],
|
|
768
|
+
], bt = "#000000", xt = /* @__PURE__ */ j({
|
|
736
769
|
__name: "BorderField",
|
|
737
770
|
props: {
|
|
738
771
|
field: {},
|
|
@@ -740,12 +773,12 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
740
773
|
},
|
|
741
774
|
emits: ["input", "change"],
|
|
742
775
|
setup(e, { emit: t }) {
|
|
743
|
-
let n = e, r = t, { mode: i, cycle: a } =
|
|
776
|
+
let n = e, r = t, { mode: i, cycle: a } = ct(() => n.modelValue, at), o = T(() => et[i.value]);
|
|
744
777
|
function s(e) {
|
|
745
778
|
return n.modelValue[e.rep]?.width ?? null;
|
|
746
779
|
}
|
|
747
780
|
function c(e) {
|
|
748
|
-
return n.modelValue[e.rep]?.color ??
|
|
781
|
+
return n.modelValue[e.rep]?.color ?? bt;
|
|
749
782
|
}
|
|
750
783
|
function l(e, t, i) {
|
|
751
784
|
let a = { ...n.modelValue };
|
|
@@ -753,7 +786,7 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
753
786
|
r(i ? "change" : "input", a);
|
|
754
787
|
}
|
|
755
788
|
function u(e, t, r) {
|
|
756
|
-
let i = n.modelValue[e.rep]?.color ??
|
|
789
|
+
let i = n.modelValue[e.rep]?.color ?? bt;
|
|
757
790
|
l(e, t <= 0 ? null : {
|
|
758
791
|
width: t,
|
|
759
792
|
color: i
|
|
@@ -771,20 +804,20 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
771
804
|
function f() {
|
|
772
805
|
let { from: e, to: t } = a();
|
|
773
806
|
if (t < e) {
|
|
774
|
-
let e =
|
|
775
|
-
|
|
807
|
+
let e = ot(n.modelValue, t);
|
|
808
|
+
st(e, n.modelValue) || r("change", e);
|
|
776
809
|
}
|
|
777
810
|
}
|
|
778
|
-
return (t, n) => (P(), O("span",
|
|
811
|
+
return (t, n) => (P(), O("span", gt, [A(ht, {
|
|
779
812
|
mode: z(i),
|
|
780
813
|
label: "边框",
|
|
781
814
|
onCycle: f
|
|
782
|
-
}, null, 8, ["mode"]), k("span",
|
|
815
|
+
}, null, 8, ["mode"]), k("span", _t, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
|
|
783
816
|
key: t.rep,
|
|
784
817
|
class: "flex items-center gap-1.5"
|
|
785
818
|
}, [
|
|
786
|
-
k("span",
|
|
787
|
-
A(
|
|
819
|
+
k("span", vt, R(t.label), 1),
|
|
820
|
+
A(pt, {
|
|
788
821
|
class: "cn-border__width",
|
|
789
822
|
value: s(t),
|
|
790
823
|
label: t.label,
|
|
@@ -804,17 +837,17 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
804
837
|
disabled: e.modelValue[t.rep] === null,
|
|
805
838
|
onInput: (e) => d(t, e, !1),
|
|
806
839
|
onChange: (e) => d(t, e, !0)
|
|
807
|
-
}, null, 40,
|
|
840
|
+
}, null, 40, yt)
|
|
808
841
|
]))), 128))])]));
|
|
809
842
|
}
|
|
810
|
-
}),
|
|
843
|
+
}), St = ["value"], Ct = {
|
|
811
844
|
key: 1,
|
|
812
845
|
class: "flex flex-1 items-center gap-1.5"
|
|
813
|
-
},
|
|
846
|
+
}, wt = ["value"], Tt = ["value"], Et = [
|
|
814
847
|
"disabled",
|
|
815
848
|
"title",
|
|
816
849
|
"data-upload-error"
|
|
817
|
-
],
|
|
850
|
+
], Dt = /* @__PURE__ */ j({
|
|
818
851
|
__name: "FontField",
|
|
819
852
|
props: {
|
|
820
853
|
field: {},
|
|
@@ -866,7 +899,7 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
866
899
|
if (t.value = "", i !== null && n && !p.value) {
|
|
867
900
|
p.value = !0;
|
|
868
901
|
try {
|
|
869
|
-
let e = await i.uploadFont(await
|
|
902
|
+
let e = await i.uploadFont(await ue(n));
|
|
870
903
|
r("change", e);
|
|
871
904
|
} catch (e) {
|
|
872
905
|
m.value = e instanceof Error ? e.message : String(e);
|
|
@@ -877,22 +910,22 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
877
910
|
}
|
|
878
911
|
return (t, n) => z(i) === null ? (P(), O("input", {
|
|
879
912
|
key: 0,
|
|
880
|
-
class: N(["cn-field", z(
|
|
913
|
+
class: N(["cn-field", z(lt)]),
|
|
881
914
|
type: "text",
|
|
882
915
|
value: e.modelValue,
|
|
883
916
|
onInput: l,
|
|
884
917
|
onCompositionstart: u,
|
|
885
918
|
onCompositionend: d,
|
|
886
919
|
onChange: f
|
|
887
|
-
}, null, 42,
|
|
920
|
+
}, null, 42, St)) : (P(), O("div", Ct, [
|
|
888
921
|
k("select", {
|
|
889
|
-
class: N(["cn-field cn-select", z(
|
|
922
|
+
class: N(["cn-field cn-select", z(Y)]),
|
|
890
923
|
value: e.modelValue,
|
|
891
924
|
onChange: s
|
|
892
925
|
}, [(P(!0), O(w, null, I(a.value, (e) => (P(), O("option", {
|
|
893
926
|
key: e.value,
|
|
894
927
|
value: e.value
|
|
895
|
-
}, R(e.label), 9,
|
|
928
|
+
}, R(e.label), 9, Tt))), 128))], 42, wt),
|
|
896
929
|
k("input", {
|
|
897
930
|
ref_key: "fileInput",
|
|
898
931
|
ref: h,
|
|
@@ -909,10 +942,10 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
909
942
|
title: m.value ?? "上传本机字体(加入清单后可选)",
|
|
910
943
|
"data-upload-error": m.value ?? void 0,
|
|
911
944
|
onClick: g
|
|
912
|
-
}, R(p.value ? "…" : m.value ? "!" : "上传"), 9,
|
|
945
|
+
}, R(p.value ? "…" : m.value ? "!" : "上传"), 9, Et)) : D("", !0)
|
|
913
946
|
]));
|
|
914
947
|
}
|
|
915
|
-
}),
|
|
948
|
+
}), Ot = { class: "cn-color flex min-w-0 flex-1 items-center gap-1.5" }, kt = ["checked"], At = ["value", "disabled"], jt = ["value", "disabled"], Mt = "#000000", Nt = /* @__PURE__ */ j({
|
|
916
949
|
__name: "ColorField",
|
|
917
950
|
props: {
|
|
918
951
|
field: {},
|
|
@@ -925,7 +958,7 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
925
958
|
i.value = e !== null, i.value && (a.value = o(e));
|
|
926
959
|
});
|
|
927
960
|
function o(e) {
|
|
928
|
-
return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e :
|
|
961
|
+
return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e : Mt;
|
|
929
962
|
}
|
|
930
963
|
function s(e) {
|
|
931
964
|
let t = e.target.checked;
|
|
@@ -952,7 +985,7 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
952
985
|
}
|
|
953
986
|
a.value = o(t), r("change", t);
|
|
954
987
|
}
|
|
955
|
-
return (t, n) => (P(), O("span",
|
|
988
|
+
return (t, n) => (P(), O("span", Ot, [
|
|
956
989
|
e.field.nullable ? (P(), O("input", {
|
|
957
990
|
key: 0,
|
|
958
991
|
class: "cn-color__toggle size-3.5 shrink-0 cursor-pointer accent-cn-accent",
|
|
@@ -960,32 +993,43 @@ var J = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
960
993
|
title: "启用颜色",
|
|
961
994
|
checked: i.value,
|
|
962
995
|
onChange: s
|
|
963
|
-
}, null, 40,
|
|
996
|
+
}, null, 40, kt)) : D("", !0),
|
|
964
997
|
k("input", {
|
|
965
|
-
class: N(["cn-color__swatch", z(
|
|
998
|
+
class: N(["cn-color__swatch", z(dt)]),
|
|
966
999
|
type: "color",
|
|
967
1000
|
value: a.value,
|
|
968
1001
|
disabled: !i.value,
|
|
969
1002
|
onInput: c,
|
|
970
1003
|
onChange: l
|
|
971
|
-
}, null, 42,
|
|
1004
|
+
}, null, 42, At),
|
|
972
1005
|
k("input", {
|
|
973
|
-
class: N(["cn-color__text min-w-0 flex-1", z(
|
|
1006
|
+
class: N(["cn-color__text min-w-0 flex-1", z(Y)]),
|
|
974
1007
|
type: "text",
|
|
975
1008
|
value: e.modelValue ?? "",
|
|
976
1009
|
disabled: !i.value,
|
|
977
1010
|
placeholder: "无",
|
|
978
1011
|
onChange: u
|
|
979
|
-
}, null, 42,
|
|
1012
|
+
}, null, 42, jt)
|
|
980
1013
|
]));
|
|
981
1014
|
}
|
|
982
1015
|
}), Z = Symbol("canvas-image-upload");
|
|
983
|
-
function
|
|
1016
|
+
function Pt() {
|
|
984
1017
|
return fe(Z, null);
|
|
985
1018
|
}
|
|
986
1019
|
//#endregion
|
|
1020
|
+
//#region src/property-panel/fields/intrinsicSize.ts
|
|
1021
|
+
function Ft(e, t) {
|
|
1022
|
+
let n = e, r = t;
|
|
1023
|
+
for (; r !== 0;) [n, r] = [r, n % r];
|
|
1024
|
+
let i = e / n, a = t / n;
|
|
1025
|
+
return Math.max(i, a) <= 32 ? `${i}:${a}` : `${Math.round(e / t * 100) / 100}:1`;
|
|
1026
|
+
}
|
|
1027
|
+
function It(e, t) {
|
|
1028
|
+
return !Number.isFinite(e) || !Number.isFinite(t) || e <= 0 || t <= 0 ? null : `${e}×${t} · ${Ft(e, t)}`;
|
|
1029
|
+
}
|
|
1030
|
+
//#endregion
|
|
987
1031
|
//#region src/property-panel/fields/TextField.vue?vue&type=script&setup=true&lang.ts
|
|
988
|
-
var
|
|
1032
|
+
var Lt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
989
1033
|
__name: "TextField",
|
|
990
1034
|
props: {
|
|
991
1035
|
field: {},
|
|
@@ -1015,7 +1059,7 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1015
1059
|
o(t) || r("change", t);
|
|
1016
1060
|
}
|
|
1017
1061
|
return (t, n) => (P(), O("input", {
|
|
1018
|
-
class: N(["cn-field", [z(
|
|
1062
|
+
class: N(["cn-field", [z(lt), a.value ? "cn-field--invalid" : ""]]),
|
|
1019
1063
|
type: "text",
|
|
1020
1064
|
value: e.modelValue,
|
|
1021
1065
|
placeholder: e.field.placeholder,
|
|
@@ -1023,9 +1067,9 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1023
1067
|
onCompositionstart: c,
|
|
1024
1068
|
onCompositionend: l,
|
|
1025
1069
|
onChange: u
|
|
1026
|
-
}, null, 42,
|
|
1070
|
+
}, null, 42, Lt));
|
|
1027
1071
|
}
|
|
1028
|
-
}),
|
|
1072
|
+
}), Rt = /* @__PURE__ */ j({
|
|
1029
1073
|
__name: "ResourceValueField",
|
|
1030
1074
|
props: {
|
|
1031
1075
|
field: {},
|
|
@@ -1038,10 +1082,10 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1038
1082
|
setup(e, { emit: t }) {
|
|
1039
1083
|
let n = e, r = t, i = T(() => n.dataMode === "expression"), a = T(() => {
|
|
1040
1084
|
let e = n.modelValue ?? "";
|
|
1041
|
-
return i.value ?
|
|
1085
|
+
return i.value ? b(e) ?? e : "";
|
|
1042
1086
|
});
|
|
1043
1087
|
function o(e) {
|
|
1044
|
-
let t =
|
|
1088
|
+
let t = S(e);
|
|
1045
1089
|
r("input", t), r("change", t);
|
|
1046
1090
|
}
|
|
1047
1091
|
return (t, n) => i.value ? (P(), E(y, {
|
|
@@ -1072,17 +1116,20 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1072
1116
|
"disabled"
|
|
1073
1117
|
]));
|
|
1074
1118
|
}
|
|
1075
|
-
}),
|
|
1119
|
+
}), zt = {
|
|
1076
1120
|
key: 0,
|
|
1077
1121
|
class: "flex flex-col gap-1.5"
|
|
1078
|
-
},
|
|
1122
|
+
}, Bt = [
|
|
1079
1123
|
"disabled",
|
|
1080
1124
|
"title",
|
|
1081
1125
|
"data-upload-error"
|
|
1082
|
-
],
|
|
1126
|
+
], Vt = ["src"], Ht = {
|
|
1083
1127
|
key: 2,
|
|
1084
1128
|
class: "relative"
|
|
1085
|
-
},
|
|
1129
|
+
}, Ut = { class: "flex items-center gap-1.5" }, Wt = {
|
|
1130
|
+
key: 0,
|
|
1131
|
+
class: "cn-imagesrc__intrinsic text-[11px] leading-4 text-cn-muted"
|
|
1132
|
+
}, Gt = /* @__PURE__ */ j({
|
|
1086
1133
|
__name: "ImageSrcField",
|
|
1087
1134
|
props: {
|
|
1088
1135
|
field: {},
|
|
@@ -1094,16 +1141,26 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1094
1141
|
},
|
|
1095
1142
|
emits: ["input", "change"],
|
|
1096
1143
|
setup(e, { emit: t }) {
|
|
1097
|
-
let n = e, r = t, i =
|
|
1098
|
-
function
|
|
1144
|
+
let n = e, r = t, i = Pt(), a = T(() => i !== null && i.canUpload && n.dataMode !== "expression"), o = T(() => typeof n.modelValue == "string" && n.modelValue !== ""), s = T(() => n.resourceStatus === "pending" ? "装载中" : n.resourceStatus === "failed" ? "失败" : null), c = F(!1), l = F(null), u = F(null), d = F(null), f = T(() => d.value === null ? null : It(d.value.width, d.value.height));
|
|
1145
|
+
function p(e) {
|
|
1146
|
+
let t = e.target;
|
|
1147
|
+
d.value = t.naturalWidth > 0 && t.naturalHeight > 0 ? {
|
|
1148
|
+
width: t.naturalWidth,
|
|
1149
|
+
height: t.naturalHeight
|
|
1150
|
+
} : null;
|
|
1151
|
+
}
|
|
1152
|
+
B(() => n.modelValue, () => {
|
|
1153
|
+
d.value = null;
|
|
1154
|
+
});
|
|
1155
|
+
function m() {
|
|
1099
1156
|
l.value = null, u.value?.click();
|
|
1100
1157
|
}
|
|
1101
|
-
async function
|
|
1158
|
+
async function h(e) {
|
|
1102
1159
|
let t = e.target, n = t.files?.[0];
|
|
1103
1160
|
if (t.value = "", i !== null && n && !c.value) {
|
|
1104
1161
|
c.value = !0;
|
|
1105
1162
|
try {
|
|
1106
|
-
let e = await i.uploadImage(await
|
|
1163
|
+
let e = await i.uploadImage(await ue(n));
|
|
1107
1164
|
e !== null && r("change", e);
|
|
1108
1165
|
} catch (e) {
|
|
1109
1166
|
l.value = e instanceof Error ? e.message : String(e);
|
|
@@ -1112,42 +1169,44 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1112
1169
|
}
|
|
1113
1170
|
}
|
|
1114
1171
|
}
|
|
1115
|
-
return (t, n) => a.value ? (P(), O("div",
|
|
1172
|
+
return (t, n) => a.value ? (P(), O("div", zt, [
|
|
1116
1173
|
k("button", {
|
|
1117
1174
|
type: "button",
|
|
1118
1175
|
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",
|
|
1119
1176
|
disabled: c.value,
|
|
1120
1177
|
title: l.value ?? (o.value ? "点击替换图片" : "点击上传图片"),
|
|
1121
1178
|
"data-upload-error": l.value ?? void 0,
|
|
1122
|
-
onClick:
|
|
1179
|
+
onClick: m
|
|
1123
1180
|
}, [
|
|
1124
1181
|
o.value ? (P(), O("img", {
|
|
1125
1182
|
key: 0,
|
|
1126
1183
|
src: e.modelValue ?? void 0,
|
|
1127
1184
|
class: "absolute inset-0 size-full object-cover",
|
|
1128
|
-
alt: ""
|
|
1129
|
-
|
|
1185
|
+
alt: "",
|
|
1186
|
+
onLoad: p,
|
|
1187
|
+
onError: n[0] ||= (e) => d.value = null
|
|
1188
|
+
}, null, 40, Vt)) : D("", !0),
|
|
1130
1189
|
s.value ? (P(), O("span", {
|
|
1131
1190
|
key: 1,
|
|
1132
1191
|
class: N(["cn-imagesrc__status absolute right-1 top-1 rounded bg-cn-bg-elevated/90 px-1 py-0.5 text-[10px] leading-none", e.resourceStatus === "failed" ? "text-red-400" : "text-cn-muted"])
|
|
1133
1192
|
}, R(s.value), 3)) : D("", !0),
|
|
1134
|
-
o.value ? D("", !0) : (P(), O("span",
|
|
1135
|
-
], 8,
|
|
1193
|
+
o.value ? D("", !0) : (P(), O("span", Ht, R(c.value ? "…" : l.value ? "!" : "点击上传图片"), 1))
|
|
1194
|
+
], 8, Bt),
|
|
1136
1195
|
k("input", {
|
|
1137
1196
|
ref_key: "fileInput",
|
|
1138
1197
|
ref: u,
|
|
1139
1198
|
type: "file",
|
|
1140
1199
|
class: "hidden",
|
|
1141
1200
|
accept: "image/*",
|
|
1142
|
-
onChange:
|
|
1201
|
+
onChange: h
|
|
1143
1202
|
}, null, 544),
|
|
1144
|
-
k("div",
|
|
1203
|
+
k("div", Ut, [A(Q, {
|
|
1145
1204
|
class: "flex-1",
|
|
1146
1205
|
field: e.field,
|
|
1147
1206
|
"model-value": e.modelValue ?? "",
|
|
1148
1207
|
"aria-label": e.field.label,
|
|
1149
|
-
onInput: n[
|
|
1150
|
-
onChange: n[
|
|
1208
|
+
onInput: n[1] ||= (e) => r("input", e),
|
|
1209
|
+
onChange: n[2] ||= (e) => r("change", e)
|
|
1151
1210
|
}, null, 8, [
|
|
1152
1211
|
"field",
|
|
1153
1212
|
"model-value",
|
|
@@ -1157,17 +1216,18 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1157
1216
|
type: "button",
|
|
1158
1217
|
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",
|
|
1159
1218
|
title: "清除图片(资源地址置空)",
|
|
1160
|
-
onClick: n[
|
|
1161
|
-
}, "清除")) : D("", !0)])
|
|
1162
|
-
|
|
1219
|
+
onClick: n[3] ||= (e) => r("change", "")
|
|
1220
|
+
}, "清除")) : D("", !0)]),
|
|
1221
|
+
f.value ? (P(), O("span", Wt, "源图 " + R(f.value), 1)) : D("", !0)
|
|
1222
|
+
])) : e.dataMode === "expression" ? (P(), E(Rt, {
|
|
1163
1223
|
key: 1,
|
|
1164
1224
|
field: e.field,
|
|
1165
1225
|
"model-value": e.modelValue,
|
|
1166
1226
|
"data-mode": "expression",
|
|
1167
1227
|
source: e.source ?? null,
|
|
1168
1228
|
disabled: e.disabled,
|
|
1169
|
-
onInput: n[
|
|
1170
|
-
onChange: n[
|
|
1229
|
+
onInput: n[4] ||= (e) => r("input", e),
|
|
1230
|
+
onChange: n[5] ||= (e) => r("change", e)
|
|
1171
1231
|
}, null, 8, [
|
|
1172
1232
|
"field",
|
|
1173
1233
|
"model-value",
|
|
@@ -1178,15 +1238,15 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1178
1238
|
field: e.field,
|
|
1179
1239
|
"model-value": e.modelValue ?? "",
|
|
1180
1240
|
"aria-label": e.field.label,
|
|
1181
|
-
onInput: n[
|
|
1182
|
-
onChange: n[
|
|
1241
|
+
onInput: n[6] ||= (e) => r("input", e),
|
|
1242
|
+
onChange: n[7] ||= (e) => r("change", e)
|
|
1183
1243
|
}, null, 8, [
|
|
1184
1244
|
"field",
|
|
1185
1245
|
"model-value",
|
|
1186
1246
|
"aria-label"
|
|
1187
1247
|
]));
|
|
1188
1248
|
}
|
|
1189
|
-
}),
|
|
1249
|
+
}), Kt = [
|
|
1190
1250
|
"aria-label",
|
|
1191
1251
|
"min",
|
|
1192
1252
|
"max",
|
|
@@ -1229,7 +1289,7 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1229
1289
|
}
|
|
1230
1290
|
return (t, n) => be((P(), O("input", {
|
|
1231
1291
|
"onUpdate:modelValue": n[0] ||= (e) => i.value = e,
|
|
1232
|
-
class: N(["cn-field cn-field--number", z(
|
|
1292
|
+
class: N(["cn-field cn-field--number", z(X)]),
|
|
1233
1293
|
type: "number",
|
|
1234
1294
|
"aria-label": e.field.label,
|
|
1235
1295
|
min: e.field.min,
|
|
@@ -1239,9 +1299,9 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1239
1299
|
onFocus: n[1] ||= (e) => a.value = !0,
|
|
1240
1300
|
onBlur: l,
|
|
1241
1301
|
onChange: l
|
|
1242
|
-
}, null, 42,
|
|
1302
|
+
}, null, 42, Kt)), [[_e, i.value]]);
|
|
1243
1303
|
}
|
|
1244
|
-
}),
|
|
1304
|
+
}), qt = { class: "cn-padding flex w-full min-w-0 items-center gap-1.5" }, Jt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, Yt = /* @__PURE__ */ j({
|
|
1245
1305
|
__name: "PaddingField",
|
|
1246
1306
|
props: {
|
|
1247
1307
|
field: {},
|
|
@@ -1249,7 +1309,7 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1249
1309
|
},
|
|
1250
1310
|
emits: ["input", "change"],
|
|
1251
1311
|
setup(e, { emit: t }) {
|
|
1252
|
-
let n = e, r = t, { mode: i, cycle: a } =
|
|
1312
|
+
let n = e, r = t, { mode: i, cycle: a } = ct(() => n.modelValue, nt), o = T(() => et[i.value]);
|
|
1253
1313
|
function s(e) {
|
|
1254
1314
|
return {
|
|
1255
1315
|
key: ["padding", e.rep],
|
|
@@ -1265,18 +1325,18 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1265
1325
|
function l() {
|
|
1266
1326
|
let { from: e, to: t } = a();
|
|
1267
1327
|
if (t < e) {
|
|
1268
|
-
let e =
|
|
1269
|
-
|
|
1328
|
+
let e = rt(n.modelValue, t);
|
|
1329
|
+
it(e, n.modelValue) || r("change", e);
|
|
1270
1330
|
}
|
|
1271
1331
|
}
|
|
1272
|
-
return (t, n) => (P(), O("span",
|
|
1332
|
+
return (t, n) => (P(), O("span", qt, [A(ht, {
|
|
1273
1333
|
mode: z(i),
|
|
1274
1334
|
label: "内边距",
|
|
1275
1335
|
onCycle: l
|
|
1276
1336
|
}, null, 8, ["mode"]), k("span", { class: N(["grid min-w-0 flex-1 gap-1.5", z(i) === 1 ? "grid-cols-1" : "grid-cols-2"]) }, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
|
|
1277
1337
|
key: t.rep,
|
|
1278
1338
|
class: "flex min-w-0 items-center gap-1.5"
|
|
1279
|
-
}, [k("span",
|
|
1339
|
+
}, [k("span", Jt, R(t.label), 1), A($, {
|
|
1280
1340
|
class: "min-w-0 flex-1",
|
|
1281
1341
|
field: s(t),
|
|
1282
1342
|
"model-value": e.modelValue[t.rep],
|
|
@@ -1289,16 +1349,16 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1289
1349
|
"onChange"
|
|
1290
1350
|
])]))), 128))], 2)]));
|
|
1291
1351
|
}
|
|
1292
|
-
}),
|
|
1352
|
+
}), Xt = { class: "grid w-full min-w-0 grid-cols-2 gap-1" }, Zt = ["title"], Qt = { class: "w-3.5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, $t = [
|
|
1293
1353
|
"aria-pressed",
|
|
1294
1354
|
"title",
|
|
1295
1355
|
"onClick"
|
|
1296
|
-
],
|
|
1356
|
+
], en = [
|
|
1297
1357
|
"aria-label",
|
|
1298
1358
|
"value",
|
|
1299
1359
|
"placeholder",
|
|
1300
1360
|
"title"
|
|
1301
|
-
],
|
|
1361
|
+
], tn = /* @__PURE__ */ j({
|
|
1302
1362
|
__name: "PairField",
|
|
1303
1363
|
props: {
|
|
1304
1364
|
field: {},
|
|
@@ -1314,7 +1374,7 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1314
1374
|
let n = e, r = t, i = T(() => n.field.items ?? []);
|
|
1315
1375
|
function a(e) {
|
|
1316
1376
|
if (!e.auto) return !1;
|
|
1317
|
-
let t =
|
|
1377
|
+
let t = q(n.modelValue, e.auto.key);
|
|
1318
1378
|
return t.ok && t.value === !0;
|
|
1319
1379
|
}
|
|
1320
1380
|
function o(e) {
|
|
@@ -1337,7 +1397,7 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1337
1397
|
r("sub-commit", s(e), !a(e), !0);
|
|
1338
1398
|
}
|
|
1339
1399
|
function u(e) {
|
|
1340
|
-
let t =
|
|
1400
|
+
let t = q(n.modelValue, e.key);
|
|
1341
1401
|
return t.ok && typeof t.value == "number" ? t.value : 0;
|
|
1342
1402
|
}
|
|
1343
1403
|
function d(e) {
|
|
@@ -1354,12 +1414,12 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1354
1414
|
let t = d(e);
|
|
1355
1415
|
return t?.preview ? "模板子树:预览盒尺寸(随行实例变化,非文档声明值)" : t === void 0 ? `${e.label}自适应:已开启` : `${e.label}自适应:布局解析值(与画布选择框同源)`;
|
|
1356
1416
|
}
|
|
1357
|
-
return (e, t) => (P(), O("span",
|
|
1417
|
+
return (e, t) => (P(), O("span", Xt, [(P(!0), O(w, null, I(i.value, (e) => (P(), O("label", {
|
|
1358
1418
|
key: e.key.join("."),
|
|
1359
1419
|
class: "flex min-w-0 items-center gap-1",
|
|
1360
1420
|
title: e.auto ? void 0 : e.label
|
|
1361
1421
|
}, [
|
|
1362
|
-
k("span",
|
|
1422
|
+
k("span", Qt, R(e.label), 1),
|
|
1363
1423
|
e.auto ? (P(), O("button", {
|
|
1364
1424
|
key: 0,
|
|
1365
1425
|
type: "button",
|
|
@@ -1367,17 +1427,17 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1367
1427
|
"aria-pressed": a(e),
|
|
1368
1428
|
title: p(e),
|
|
1369
1429
|
onClick: V((t) => l(e), ["prevent"])
|
|
1370
|
-
}, "自", 10,
|
|
1430
|
+
}, "自", 10, $t)) : D("", !0),
|
|
1371
1431
|
a(e) ? (P(), O("input", {
|
|
1372
1432
|
key: 2,
|
|
1373
|
-
class: N(["cn-field cn-field--number min-w-0 flex-1", [z(
|
|
1433
|
+
class: N(["cn-field cn-field--number min-w-0 flex-1", [z(X), d(e)?.preview ? "cn-field--preview" : ""]]),
|
|
1374
1434
|
type: "number",
|
|
1375
1435
|
disabled: "",
|
|
1376
1436
|
"aria-label": e.label,
|
|
1377
1437
|
value: f(e),
|
|
1378
1438
|
placeholder: e.auto?.placeholder ?? "",
|
|
1379
1439
|
title: m(e)
|
|
1380
|
-
}, null, 10,
|
|
1440
|
+
}, null, 10, en)) : (P(), E($, {
|
|
1381
1441
|
key: 1,
|
|
1382
1442
|
class: "min-w-0 flex-1",
|
|
1383
1443
|
field: e,
|
|
@@ -1390,9 +1450,38 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1390
1450
|
"onInput",
|
|
1391
1451
|
"onChange"
|
|
1392
1452
|
]))
|
|
1393
|
-
], 8,
|
|
1453
|
+
], 8, Zt))), 128))]));
|
|
1394
1454
|
}
|
|
1395
|
-
}),
|
|
1455
|
+
}), nn = /* @__PURE__ */ j({
|
|
1456
|
+
__name: "RowsPathField",
|
|
1457
|
+
props: {
|
|
1458
|
+
field: {},
|
|
1459
|
+
modelValue: {},
|
|
1460
|
+
source: { type: [Function, null] },
|
|
1461
|
+
disabled: { type: Boolean }
|
|
1462
|
+
},
|
|
1463
|
+
emits: ["input", "change"],
|
|
1464
|
+
setup(e, { emit: t }) {
|
|
1465
|
+
let n = t;
|
|
1466
|
+
function r(e) {
|
|
1467
|
+
n("input", e), n("change", e);
|
|
1468
|
+
}
|
|
1469
|
+
return (t, n) => (P(), E(y, {
|
|
1470
|
+
mode: "rowsPath",
|
|
1471
|
+
"model-value": e.modelValue,
|
|
1472
|
+
source: e.source ?? null,
|
|
1473
|
+
disabled: e.disabled,
|
|
1474
|
+
"aria-label": e.field.label,
|
|
1475
|
+
placeholder: "未选择行路径",
|
|
1476
|
+
"onUpdate:modelValue": r
|
|
1477
|
+
}, null, 8, [
|
|
1478
|
+
"model-value",
|
|
1479
|
+
"source",
|
|
1480
|
+
"disabled",
|
|
1481
|
+
"aria-label"
|
|
1482
|
+
]));
|
|
1483
|
+
}
|
|
1484
|
+
}), rn = ["value"], an = ["value"], on = /* @__PURE__ */ j({
|
|
1396
1485
|
__name: "SelectField",
|
|
1397
1486
|
props: {
|
|
1398
1487
|
field: {},
|
|
@@ -1408,12 +1497,12 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1408
1497
|
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",
|
|
1409
1498
|
value: e.modelValue,
|
|
1410
1499
|
onChange: r
|
|
1411
|
-
}, [(P(!0), O(w, null, I(e.field.domain ?? [], (
|
|
1412
|
-
key:
|
|
1413
|
-
value:
|
|
1414
|
-
}, R(e), 9,
|
|
1500
|
+
}, [(P(!0), O(w, null, I(e.field.domain ?? [], (t) => (P(), O("option", {
|
|
1501
|
+
key: t,
|
|
1502
|
+
value: t
|
|
1503
|
+
}, R(e.field.optionLabels?.[t] ?? t), 9, an))), 128))], 40, rn));
|
|
1415
1504
|
}
|
|
1416
|
-
}),
|
|
1505
|
+
}), sn = ["value", "disabled"], cn = /* @__PURE__ */ j({
|
|
1417
1506
|
__name: "TextareaField",
|
|
1418
1507
|
props: {
|
|
1419
1508
|
field: {},
|
|
@@ -1437,7 +1526,7 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1437
1526
|
r = !1, n("change", e.target.value);
|
|
1438
1527
|
}
|
|
1439
1528
|
return (t, n) => (P(), O("textarea", {
|
|
1440
|
-
class: N(["cn-field", z(
|
|
1529
|
+
class: N(["cn-field", z(ut)]),
|
|
1441
1530
|
rows: "3",
|
|
1442
1531
|
value: e.modelValue,
|
|
1443
1532
|
disabled: e.disabled,
|
|
@@ -1445,27 +1534,28 @@ var kt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
|
1445
1534
|
onCompositionstart: a,
|
|
1446
1535
|
onCompositionend: o,
|
|
1447
1536
|
onChange: s
|
|
1448
|
-
}, null, 42,
|
|
1537
|
+
}, null, 42, sn));
|
|
1449
1538
|
}
|
|
1450
|
-
}),
|
|
1539
|
+
}), ln = {
|
|
1451
1540
|
number: M($),
|
|
1452
1541
|
text: M(Q),
|
|
1453
|
-
textarea: M(
|
|
1454
|
-
color: M(
|
|
1455
|
-
select: M(
|
|
1456
|
-
boolean: M(
|
|
1457
|
-
pair: M(
|
|
1458
|
-
anchor: M(
|
|
1459
|
-
align: M(
|
|
1460
|
-
padding: M(
|
|
1461
|
-
border: M(
|
|
1462
|
-
font: M(
|
|
1463
|
-
imageSrc: M(
|
|
1464
|
-
resourceValue: M(
|
|
1542
|
+
textarea: M(cn),
|
|
1543
|
+
color: M(Nt),
|
|
1544
|
+
select: M(on),
|
|
1545
|
+
boolean: M($e),
|
|
1546
|
+
pair: M(tn),
|
|
1547
|
+
anchor: M(Xe),
|
|
1548
|
+
align: M(Be),
|
|
1549
|
+
padding: M(Yt),
|
|
1550
|
+
border: M(xt),
|
|
1551
|
+
font: M(Dt),
|
|
1552
|
+
imageSrc: M(Gt),
|
|
1553
|
+
resourceValue: M(Rt),
|
|
1554
|
+
rowsPath: M(nn)
|
|
1465
1555
|
};
|
|
1466
1556
|
//#endregion
|
|
1467
1557
|
//#region src/property-panel/usePropertyPanel.ts
|
|
1468
|
-
function
|
|
1558
|
+
function un(e) {
|
|
1469
1559
|
let t = L(e.store.doc), n = L(e.store.ui.selection), r = L(e.store.ui.anchorExpanded), i = L(e.store.ui.dataSourceSchema), a = L(e.store.ui.resourceStatuses), o = L(e.store.ui.editing), s = e.subscribe((s) => {
|
|
1470
1560
|
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));
|
|
1471
1561
|
});
|
|
@@ -1475,37 +1565,40 @@ function $t(e) {
|
|
|
1475
1565
|
return e && r ? p(e, r) : null;
|
|
1476
1566
|
}), l = T(() => t.value), u = T(() => {
|
|
1477
1567
|
let e = c.value, r = n.value;
|
|
1478
|
-
return e && r ?
|
|
1568
|
+
return e && r ? K(r, e) : t.value ? Ne : [];
|
|
1479
1569
|
}), d = T(() => {
|
|
1480
1570
|
let r = n.value;
|
|
1481
1571
|
return r && t.value ? e.layerBoxAt(r) : null;
|
|
1482
1572
|
}), f = T(() => {
|
|
1483
1573
|
let e = i.value;
|
|
1484
|
-
return e === null ? null :
|
|
1485
|
-
}), h = T(() =>
|
|
1574
|
+
return e === null ? null : te(e, ce(e, t.value, n.value));
|
|
1575
|
+
}), h = T(() => _(t.value, n.value, i.value)), g = T(() => ee(h.value)), y = T(() => {
|
|
1576
|
+
let e = c.value;
|
|
1577
|
+
return e === null || e.type !== "TableLayer" || e.template === null ? !1 : v(h.value, e.rowsPath);
|
|
1578
|
+
}), b = T(() => n.value?.includes("template") ?? !1), x = T(() => {
|
|
1486
1579
|
let e = o.value, t = n.value;
|
|
1487
1580
|
return e !== null && t !== null && m(e.path, t);
|
|
1488
1581
|
});
|
|
1489
|
-
function
|
|
1582
|
+
function S(t) {
|
|
1490
1583
|
e.store.setAnchorExpanded(t);
|
|
1491
1584
|
}
|
|
1492
|
-
function
|
|
1585
|
+
function C(e) {
|
|
1493
1586
|
if (!e.data) return !1;
|
|
1494
|
-
if (
|
|
1587
|
+
if (x.value) return o.value?.expression === !0;
|
|
1495
1588
|
let t = c.value;
|
|
1496
1589
|
return t !== null && "expression" in t && t.expression !== null;
|
|
1497
1590
|
}
|
|
1498
|
-
function
|
|
1591
|
+
function ne(r, i, a) {
|
|
1499
1592
|
if (!t.value) return;
|
|
1500
1593
|
let o = n.value;
|
|
1501
1594
|
if (!o) {
|
|
1502
|
-
|
|
1595
|
+
ie(r, i, a);
|
|
1503
1596
|
return;
|
|
1504
1597
|
}
|
|
1505
|
-
let s =
|
|
1598
|
+
let s = oe(o, r.key);
|
|
1506
1599
|
if (r.data) {
|
|
1507
|
-
if (
|
|
1508
|
-
let t =
|
|
1600
|
+
if (C(r)) {
|
|
1601
|
+
let t = oe(o, ["data", "expression"]);
|
|
1509
1602
|
e.updateDataExpression(o, i, { mergeKey: t }), a && e.store.closeMerge(t);
|
|
1510
1603
|
return;
|
|
1511
1604
|
}
|
|
@@ -1514,45 +1607,59 @@ function $t(e) {
|
|
|
1514
1607
|
}
|
|
1515
1608
|
e.updateSpec(o, r.key, i, { mergeKey: s }), a && e.store.closeMerge(s);
|
|
1516
1609
|
}
|
|
1517
|
-
function
|
|
1610
|
+
function re(t) {
|
|
1518
1611
|
let r = n.value;
|
|
1519
1612
|
r && t.data && e.toggleDataMode(r);
|
|
1520
1613
|
}
|
|
1521
|
-
function
|
|
1614
|
+
function ie(t, n, r) {
|
|
1522
1615
|
let i = t.key[0];
|
|
1616
|
+
if (i === "background") {
|
|
1617
|
+
ae(t, n, r);
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1523
1620
|
if (i !== "width" && i !== "height" || typeof n != "number") return;
|
|
1524
1621
|
let a = `canvas:${i}`;
|
|
1525
1622
|
e.updateCanvasProp(i, n, { mergeKey: a }), r && e.store.closeMerge(a);
|
|
1526
1623
|
}
|
|
1624
|
+
function ae(t, n, r) {
|
|
1625
|
+
let i = t.key[1];
|
|
1626
|
+
if (i !== "color" && i !== "image") return;
|
|
1627
|
+
let a = l.value?.background ?? Fe, o = typeof n == "string" && n !== "" ? n : null, s = {
|
|
1628
|
+
...a,
|
|
1629
|
+
[i]: o
|
|
1630
|
+
}, c = `canvas:background.${i}`;
|
|
1631
|
+
e.updateCanvasProp("background", s, { mergeKey: c }), r && e.store.closeMerge(c);
|
|
1632
|
+
}
|
|
1527
1633
|
return {
|
|
1528
1634
|
selection: T(() => n.value),
|
|
1529
1635
|
layer: c,
|
|
1530
1636
|
canvas: l,
|
|
1531
1637
|
sections: u,
|
|
1532
1638
|
layerBox: d,
|
|
1533
|
-
isPreviewBox:
|
|
1639
|
+
isPreviewBox: b,
|
|
1534
1640
|
completionSource: f,
|
|
1535
|
-
rowsPathSource:
|
|
1641
|
+
rowsPathSource: g,
|
|
1642
|
+
rowsPathDrifted: y,
|
|
1536
1643
|
resourceStatuses: T(() => a.value),
|
|
1537
1644
|
anchorExpanded: T(() => r.value),
|
|
1538
|
-
contentLocked:
|
|
1645
|
+
contentLocked: x,
|
|
1539
1646
|
editingSession: T(() => o.value),
|
|
1540
|
-
isDataMarked:
|
|
1541
|
-
commit:
|
|
1542
|
-
toggleDataMode:
|
|
1543
|
-
setAnchorExpanded:
|
|
1647
|
+
isDataMarked: C,
|
|
1648
|
+
commit: ne,
|
|
1649
|
+
toggleDataMode: re,
|
|
1650
|
+
setAnchorExpanded: S
|
|
1544
1651
|
};
|
|
1545
1652
|
}
|
|
1546
1653
|
//#endregion
|
|
1547
1654
|
//#region src/property-panel/fields/ValueTypeSegmented.vue?vue&type=script&setup=true&lang.ts
|
|
1548
|
-
var
|
|
1655
|
+
var dn = ["aria-disabled"], fn = [
|
|
1549
1656
|
"aria-pressed",
|
|
1550
1657
|
"title",
|
|
1551
1658
|
"data-mode-static",
|
|
1552
1659
|
"data-mode-expression",
|
|
1553
1660
|
"disabled",
|
|
1554
1661
|
"onClick"
|
|
1555
|
-
],
|
|
1662
|
+
], pn = /* @__PURE__ */ j({
|
|
1556
1663
|
__name: "ValueTypeSegmented",
|
|
1557
1664
|
props: {
|
|
1558
1665
|
mode: {},
|
|
@@ -1587,15 +1694,15 @@ var en = ["aria-disabled"], tn = [
|
|
|
1587
1694
|
"data-mode-expression": t.value === "expression" || void 0,
|
|
1588
1695
|
disabled: e.disabled,
|
|
1589
1696
|
onClick: V((e) => a(t.value), ["prevent"])
|
|
1590
|
-
}, R(t.label), 11,
|
|
1697
|
+
}, R(t.label), 11, fn)), 64))], 10, dn));
|
|
1591
1698
|
}
|
|
1592
|
-
}),
|
|
1699
|
+
}), mn = ["title"], hn = {
|
|
1593
1700
|
key: 2,
|
|
1594
1701
|
class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
|
|
1595
|
-
},
|
|
1702
|
+
}, gn = ["title"], _n = {
|
|
1596
1703
|
key: 4,
|
|
1597
1704
|
class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
|
|
1598
|
-
},
|
|
1705
|
+
}, vn = /* @__PURE__ */ j({
|
|
1599
1706
|
__name: "PropertyField",
|
|
1600
1707
|
props: {
|
|
1601
1708
|
field: {},
|
|
@@ -1605,7 +1712,8 @@ var en = ["aria-disabled"], tn = [
|
|
|
1605
1712
|
completion: { type: [Function, null] },
|
|
1606
1713
|
displays: {},
|
|
1607
1714
|
hint: {},
|
|
1608
|
-
resourceStatus: {}
|
|
1715
|
+
resourceStatus: {},
|
|
1716
|
+
drifted: { type: Boolean }
|
|
1609
1717
|
},
|
|
1610
1718
|
emits: [
|
|
1611
1719
|
"input",
|
|
@@ -1614,28 +1722,23 @@ var en = ["aria-disabled"], tn = [
|
|
|
1614
1722
|
"sub-commit"
|
|
1615
1723
|
],
|
|
1616
1724
|
setup(e, { emit: t }) {
|
|
1617
|
-
let n = e, r = t, i = T(() =>
|
|
1618
|
-
function
|
|
1619
|
-
let e =
|
|
1725
|
+
let n = e, r = t, i = T(() => ln[n.field.control]), a = T(() => n.dataMode === "expression"), o = T(() => n.field.control === "pair" ? "cn-prop-field block" : "cn-prop-field grid grid-cols-[60px_minmax(0,1fr)] items-center gap-x-2 gap-y-1.5"), s = T(() => n.field.data === !0 ? "col-span-2" : ""), c = T(() => n.field.data === !0 && n.field.control === "textarea"), l = T(() => n.field.control === "rowsPath"), u = T(() => n.field.resource === !0 || l.value), d = F(null), f = T(() => n.field.data === !0 && a.value && typeof n.value == "string" ? n.field.resource === !0 ? n.value === "" ? [] : x(n.value) : c.value ? ne(n.value) : [] : []), p = T(() => f.value.length === 0 ? "" : n.field.resource === !0 ? le(n.completion != null) : se(f.value)), m = T(() => (n.field.resource === !0 ? a.value : l.value) && n.completion == null && f.value.length === 0 ? C : ""), h = T(() => f.value.length > 0 || l.value && n.drifted === !0), g = T(() => n.field.control === "textarea");
|
|
1726
|
+
function _() {
|
|
1727
|
+
let e = f.value[0], t = d.value?.$el;
|
|
1620
1728
|
e !== void 0 && (t instanceof HTMLTextAreaElement || t instanceof HTMLInputElement) && (t.focus(), t.setSelectionRange(e.at.start, e.at.end));
|
|
1621
1729
|
}
|
|
1622
|
-
let
|
|
1623
|
-
if (!
|
|
1624
|
-
let e =
|
|
1730
|
+
let ee = T(() => {
|
|
1731
|
+
if (!c.value) return null;
|
|
1732
|
+
let e = d.value?.$el;
|
|
1625
1733
|
return e instanceof HTMLTextAreaElement || e instanceof HTMLInputElement ? e : null;
|
|
1626
|
-
}),
|
|
1627
|
-
target:
|
|
1734
|
+
}), v = F(null), y = T(() => v.value?.rootEl ?? null), { popup: b, accept: S } = ie({
|
|
1735
|
+
target: ee,
|
|
1628
1736
|
enabled: () => c.value && a.value && n.completion != null,
|
|
1629
1737
|
pairing: () => c.value && a.value,
|
|
1630
1738
|
resolve: (e) => n.completion?.(e) ?? null,
|
|
1631
|
-
popupEl:
|
|
1632
|
-
}), { popup: C, accept: se } = ue({
|
|
1633
|
-
target: y,
|
|
1634
|
-
enabled: () => l.value && n.completion != null,
|
|
1635
|
-
resolve: (e) => n.completion?.(e) ?? null,
|
|
1636
|
-
popupEl: x
|
|
1739
|
+
popupEl: y
|
|
1637
1740
|
});
|
|
1638
|
-
function
|
|
1741
|
+
function te(e, t, n) {
|
|
1639
1742
|
r("sub-commit", e, t, n);
|
|
1640
1743
|
}
|
|
1641
1744
|
return (t, n) => (P(), O(w, null, [(P(), E(ge(e.field.control === "pair" || e.field.control === "imageSrc" ? "div" : "label"), { class: N(o.value) }, {
|
|
@@ -1644,8 +1747,8 @@ var en = ["aria-disabled"], tn = [
|
|
|
1644
1747
|
key: 0,
|
|
1645
1748
|
class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted",
|
|
1646
1749
|
title: e.field.title
|
|
1647
|
-
}, R(e.field.label), 9,
|
|
1648
|
-
e.field.data ? (P(), E(
|
|
1750
|
+
}, R(e.field.label), 9, mn)),
|
|
1751
|
+
e.field.data ? (P(), E(pn, {
|
|
1649
1752
|
key: 1,
|
|
1650
1753
|
class: "justify-self-end",
|
|
1651
1754
|
mode: e.dataMode ?? "static",
|
|
@@ -1654,21 +1757,21 @@ var en = ["aria-disabled"], tn = [
|
|
|
1654
1757
|
}, null, 8, ["mode", "disabled"])) : D("", !0),
|
|
1655
1758
|
(P(), E(ge(i.value), {
|
|
1656
1759
|
ref_key: "controlRef",
|
|
1657
|
-
ref:
|
|
1760
|
+
ref: d,
|
|
1658
1761
|
class: N(["cn-prop-field__control", [s.value, {
|
|
1659
1762
|
"cn-field--expression": a.value,
|
|
1660
|
-
"cn-field--invalid":
|
|
1763
|
+
"cn-field--invalid": h.value
|
|
1661
1764
|
}]]),
|
|
1662
1765
|
field: e.field,
|
|
1663
1766
|
"model-value": e.value,
|
|
1664
1767
|
disabled: e.locked,
|
|
1665
1768
|
displays: e.field.control === "pair" ? e.displays : void 0,
|
|
1666
1769
|
"data-mode": e.field.control === "imageSrc" || e.field.control === "resourceValue" ? e.dataMode : void 0,
|
|
1667
|
-
source:
|
|
1770
|
+
source: u.value ? e.completion : void 0,
|
|
1668
1771
|
"resource-status": e.field.control === "imageSrc" ? e.resourceStatus : void 0,
|
|
1669
1772
|
onInput: n[1] ||= (e) => r("input", e),
|
|
1670
1773
|
onChange: n[2] ||= (e) => r("change", e),
|
|
1671
|
-
onSubCommit:
|
|
1774
|
+
onSubCommit: te
|
|
1672
1775
|
}, null, 40, [
|
|
1673
1776
|
"class",
|
|
1674
1777
|
"field",
|
|
@@ -1679,56 +1782,50 @@ var en = ["aria-disabled"], tn = [
|
|
|
1679
1782
|
"source",
|
|
1680
1783
|
"resource-status"
|
|
1681
1784
|
])),
|
|
1682
|
-
e.hint ? (P(), O("span",
|
|
1683
|
-
|
|
1785
|
+
e.hint ? (P(), O("span", hn, R(e.hint), 1)) : D("", !0),
|
|
1786
|
+
p.value ? (P(), O("span", {
|
|
1684
1787
|
key: 3,
|
|
1685
|
-
class: N(["cn-prop-field__hint cn-prop-field__hint--error col-span-2 block text-[11px] leading-4 text-cn-danger", { "cursor-pointer":
|
|
1686
|
-
title:
|
|
1687
|
-
onClick:
|
|
1688
|
-
}, R(
|
|
1689
|
-
|
|
1788
|
+
class: N(["cn-prop-field__hint cn-prop-field__hint--error col-span-2 block text-[11px] leading-4 text-cn-danger", { "cursor-pointer": g.value }]),
|
|
1789
|
+
title: g.value ? "点击选中出错片段" : void 0,
|
|
1790
|
+
onClick: _
|
|
1791
|
+
}, R(p.value), 11, gn)) : D("", !0),
|
|
1792
|
+
m.value ? (P(), O("span", _n, R(m.value), 1)) : D("", !0)
|
|
1690
1793
|
]),
|
|
1691
1794
|
_: 1
|
|
1692
|
-
}, 8, ["class"])), c.value ? (P(), E(
|
|
1795
|
+
}, 8, ["class"])), c.value ? (P(), E(ae, {
|
|
1693
1796
|
key: 0,
|
|
1694
1797
|
ref_key: "popupRef",
|
|
1695
|
-
ref:
|
|
1696
|
-
state: z(
|
|
1798
|
+
ref: v,
|
|
1799
|
+
state: z(b),
|
|
1697
1800
|
onSelect: z(S)
|
|
1698
|
-
}, null, 8, ["state", "onSelect"])) : l.value ? (P(), E(g, {
|
|
1699
|
-
key: 1,
|
|
1700
|
-
ref_key: "popupRef",
|
|
1701
|
-
ref: b,
|
|
1702
|
-
state: z(C),
|
|
1703
|
-
onSelect: z(se)
|
|
1704
1801
|
}, null, 8, ["state", "onSelect"])) : D("", !0)], 64));
|
|
1705
1802
|
}
|
|
1706
|
-
}),
|
|
1803
|
+
}), yn = { 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)]" }, bn = { 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" }, xn = { class: "flex items-center gap-2" }, Sn = { 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" }, Cn = { class: "text-[12px] font-medium tracking-wide text-cn-fg/90" }, wn = {
|
|
1707
1804
|
key: 0,
|
|
1708
1805
|
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"
|
|
1709
|
-
},
|
|
1806
|
+
}, Tn = { class: "cn-props__section-title mb-2 text-[10px] font-semibold uppercase tracking-[0.16em] text-cn-muted" }, En = { class: "flex flex-col gap-2" }, Dn = "内容编辑中:请在画布编辑框内修改,退出后此处更新", On = /* @__PURE__ */ j({
|
|
1710
1807
|
__name: "PropertyPanel",
|
|
1711
1808
|
props: { editor: {} },
|
|
1712
1809
|
setup(e) {
|
|
1713
|
-
let t = e, n =
|
|
1810
|
+
let t = e, n = un(t.editor);
|
|
1714
1811
|
he(Z, {
|
|
1715
1812
|
canUpload: t.editor.canUpload,
|
|
1716
1813
|
uploadImage: (e) => t.editor.uploadImage(e)
|
|
1717
1814
|
});
|
|
1718
1815
|
function r(e) {
|
|
1719
|
-
return e.
|
|
1816
|
+
return e.control === "rowsPath" ? n.rowsPathSource.value : n.completionSource.value;
|
|
1720
1817
|
}
|
|
1721
1818
|
let i = T(() => n.layer.value !== null), a = T(() => {
|
|
1722
1819
|
let e = n.layer.value;
|
|
1723
1820
|
return e ? e.type : n.canvas.value ? "Canvas" : "—";
|
|
1724
1821
|
}), o = T(() => {
|
|
1725
|
-
let e = n.layer.value
|
|
1822
|
+
let e = n.layer.value === null ? n.selection.value ? null : Pe(n.canvas.value) : Ie(n.layer.value);
|
|
1726
1823
|
if (!e) return [];
|
|
1727
1824
|
let t = n.selection.value?.join(".") ?? "canvas", r = n.layer.value, i = n.resourceStatuses.value, a = [];
|
|
1728
1825
|
for (let o of n.sections.value) {
|
|
1729
1826
|
let s = [];
|
|
1730
1827
|
for (let a of o.fields) {
|
|
1731
|
-
let o =
|
|
1828
|
+
let o = q(e, a.key);
|
|
1732
1829
|
if (!o.ok) continue;
|
|
1733
1830
|
let c = n.contentLocked.value && a.data === !0;
|
|
1734
1831
|
s.push({
|
|
@@ -1737,8 +1834,9 @@ var en = ["aria-disabled"], tn = [
|
|
|
1737
1834
|
value: o.value,
|
|
1738
1835
|
dataMode: a.data ? n.isDataMarked(a) ? "expression" : "static" : void 0,
|
|
1739
1836
|
locked: c,
|
|
1740
|
-
hint: c ?
|
|
1741
|
-
resourceStatus: a.control === "imageSrc" && typeof o.value == "string" && o.value !== "" ? i[o.value] : void 0
|
|
1837
|
+
hint: c ? Dn : a.hint && r ? a.hint(r, i) ?? void 0 : void 0,
|
|
1838
|
+
resourceStatus: a.control === "imageSrc" && typeof o.value == "string" && o.value !== "" ? i[o.value] : void 0,
|
|
1839
|
+
drifted: a.control === "rowsPath" ? n.rowsPathDrifted.value : void 0
|
|
1742
1840
|
});
|
|
1743
1841
|
}
|
|
1744
1842
|
s.length > 0 && a.push({
|
|
@@ -1764,16 +1862,16 @@ var en = ["aria-disabled"], tn = [
|
|
|
1764
1862
|
function c() {
|
|
1765
1863
|
n.setAnchorExpanded(!n.anchorExpanded.value);
|
|
1766
1864
|
}
|
|
1767
|
-
return (e, t) => (P(), O("aside",
|
|
1768
|
-
k("header",
|
|
1865
|
+
return (e, t) => (P(), O("aside", yn, [
|
|
1866
|
+
k("header", bn, [k("div", xn, [k("span", Sn, [t[0] ||= k("i", {
|
|
1769
1867
|
class: "size-1.5 rounded-full bg-cn-accent",
|
|
1770
1868
|
"aria-hidden": "true"
|
|
1771
|
-
}, null, -1), de(" " + R(a.value), 1)]), k("span",
|
|
1772
|
-
o.value.length === 0 ? (P(), O("p",
|
|
1869
|
+
}, null, -1), de(" " + R(a.value), 1)]), k("span", Cn, R(i.value ? "图层属性" : "画布属性"), 1)])]),
|
|
1870
|
+
o.value.length === 0 ? (P(), O("p", wn, " 打开文档后可编辑属性 ")) : D("", !0),
|
|
1773
1871
|
(P(!0), O(w, null, I(o.value, (e) => (P(), O("section", {
|
|
1774
1872
|
key: e.title,
|
|
1775
1873
|
class: "cn-props__section border-b border-cn-line/70 px-3.5 py-3 last:border-b-0"
|
|
1776
|
-
}, [k("h3",
|
|
1874
|
+
}, [k("h3", Tn, R(e.title), 1), k("div", En, [(P(!0), O(w, null, I(e.fields, (e) => (P(), O(w, { key: e.key }, [e.field.control === "anchor" ? (P(), E(Xe, {
|
|
1777
1875
|
key: 0,
|
|
1778
1876
|
field: e.field,
|
|
1779
1877
|
"model-value": e.value,
|
|
@@ -1785,7 +1883,7 @@ var en = ["aria-disabled"], tn = [
|
|
|
1785
1883
|
"model-value",
|
|
1786
1884
|
"expanded",
|
|
1787
1885
|
"onChange"
|
|
1788
|
-
])) : (P(), E(
|
|
1886
|
+
])) : (P(), E(vn, {
|
|
1789
1887
|
key: 1,
|
|
1790
1888
|
field: e.field,
|
|
1791
1889
|
value: e.value,
|
|
@@ -1795,6 +1893,7 @@ var en = ["aria-disabled"], tn = [
|
|
|
1795
1893
|
completion: r(e.field),
|
|
1796
1894
|
displays: s.value,
|
|
1797
1895
|
"resource-status": e.resourceStatus,
|
|
1896
|
+
drifted: e.drifted,
|
|
1798
1897
|
onInput: (t) => z(n).commit(e.field, t, !1),
|
|
1799
1898
|
onChange: (t) => z(n).commit(e.field, t, !0),
|
|
1800
1899
|
onToggleMode: (t) => z(n).toggleDataMode(e.field),
|
|
@@ -1808,6 +1907,7 @@ var en = ["aria-disabled"], tn = [
|
|
|
1808
1907
|
"completion",
|
|
1809
1908
|
"displays",
|
|
1810
1909
|
"resource-status",
|
|
1910
|
+
"drifted",
|
|
1811
1911
|
"onInput",
|
|
1812
1912
|
"onChange",
|
|
1813
1913
|
"onToggleMode",
|
|
@@ -1817,4 +1917,4 @@ var en = ["aria-disabled"], tn = [
|
|
|
1817
1917
|
}
|
|
1818
1918
|
});
|
|
1819
1919
|
//#endregion
|
|
1820
|
-
export { Z as a,
|
|
1920
|
+
export { Z as a, ke as c, je as d, q as f, ln as i, K as l, vn as n, Pt as o, un as r, Ne as s, On as t, Ae as u };
|