@hankchen/canvas-editor-vue 0.6.0 → 0.7.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.
Files changed (37) hide show
  1. package/dist/{useDataSourceSchema-YV8g-lo0.js → DropdownMenu-CeUNKMDQ.js} +70 -78
  2. package/dist/ExpressionPathPicker-DchGsK70.js +739 -0
  3. package/dist/{canvas-CX1RdlFC.js → canvas-D3fFnBqG.js} +526 -527
  4. package/dist/canvas.js +1 -1
  5. package/dist/index.js +14 -15
  6. package/dist/layer-panel/TemplateTableForm.d.ts +1 -27
  7. package/dist/{layer-panel-Cd1e8xNB.js → layer-panel-BouAYiDq.js} +231 -257
  8. package/dist/layer-panel.js +1 -1
  9. package/dist/property-panel/PropertyField.d.ts +9 -2
  10. package/dist/property-panel/fieldSchema.d.ts +16 -10
  11. package/dist/property-panel/fields/RowsPathField.d.ts +17 -0
  12. package/dist/property-panel/fields/index.d.ts +1 -0
  13. package/dist/property-panel/usePropertyPanel.d.ts +11 -2
  14. package/dist/{property-panel-B32ZBQdf.js → property-panel-DJQJzioT.js} +403 -341
  15. package/dist/property-panel.js +2 -2
  16. package/dist/resourceTemplate-D-DKEo7Z.js +33 -0
  17. package/dist/shared/ExpressionPathPicker.d.ts +9 -2
  18. package/dist/shared/index.d.ts +13 -10
  19. package/dist/shared/pathPickerModel.d.ts +16 -3
  20. package/dist/shared/popupPosition.d.ts +2 -2
  21. package/dist/shared/rowsPathPickerSource.d.ts +15 -0
  22. package/dist/shared/useDataSourceSchema.d.ts +9 -1
  23. package/dist/shared/useExpressionDiagnostics.d.ts +11 -0
  24. package/dist/{shared-wuupBoZg.js → shared-CRDKDSpa.js} +22 -22
  25. package/dist/shared.js +9 -10
  26. package/dist/{status-bar-XMVbRLY9.js → status-bar-DBf5kIXY.js} +69 -67
  27. package/dist/status-bar.js +1 -1
  28. package/dist/style.css +1 -1
  29. package/dist/uploadFile-mXJVPEzm.js +653 -0
  30. package/dist/{useTransientFeedback-CTjmMmFF.js → useTransientFeedback-BN_O7V2w.js} +43 -28
  31. package/package.json +2 -2
  32. package/dist/popupPosition-Ck5Gsvjy.js +0 -526
  33. package/dist/resourceTemplate-cdcQtp9a.js +0 -246
  34. package/dist/shared/rowsPathCompletionSource.d.ts +0 -3
  35. package/dist/shared/usePathCompletion.d.ts +0 -18
  36. package/dist/uploadFile-D1RY-ji0.js +0 -516
  37. package/dist/usePathCompletion-Do17CQ6l.js +0 -220
@@ -1,11 +1,10 @@
1
1
  import { t as e } from "./createLucideIcon-SCvtEGVf.js";
2
2
  import { i as t, r as n, t as r } from "./layerPath-uy2ywyld.js";
3
- import { o as i, s as a, u as o } from "./popupPosition-Ck5Gsvjy.js";
4
- import { c as s, i as c, s as l, t as u } from "./useTransientFeedback-CTjmMmFF.js";
5
- import { n as d, t as f } from "./usePathCompletion-Do17CQ6l.js";
6
- import { n as p, t as m } from "./useDataSourceSchema-YV8g-lo0.js";
7
- import { Fragment as h, computed as g, createBlock as _, createCommentVNode as v, createElementBlock as y, createElementVNode as b, createVNode as x, defineComponent as S, nextTick as ee, normalizeClass as C, normalizeStyle as te, onScopeDispose as ne, openBlock as w, ref as T, renderList as re, shallowRef as E, toDisplayString as D, unref as O, vModelText as k, watch as ie, withCtx as A, withDirectives as j, withKeys as M, withModifiers as N } from "vue";
8
- var ae = e({
3
+ import { c as i, o as a, p as o, t as s } from "./ExpressionPathPicker-DchGsK70.js";
4
+ import { a as c, d as l, i as ee, s as u, t as d, u as f } from "./useTransientFeedback-BN_O7V2w.js";
5
+ import { t as te } from "./DropdownMenu-CeUNKMDQ.js";
6
+ import { Fragment as ne, computed as p, createBlock as re, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createVNode as _, defineComponent as v, nextTick as ie, normalizeClass as y, normalizeStyle as ae, onScopeDispose as b, openBlock as x, ref as S, renderList as oe, shallowRef as C, toDisplayString as w, unref as T, vModelText as se, watch as ce, withCtx as E, withDirectives as le, withKeys as D, withModifiers as O } from "vue";
7
+ var ue = e({
9
8
  name: "eye-off",
10
9
  size: 24,
11
10
  node: [
@@ -26,7 +25,7 @@ var ae = e({
26
25
  key: "1ooewy"
27
26
  }]
28
27
  ]
29
- }), oe = e({
28
+ }), de = e({
30
29
  name: "eye",
31
30
  size: 24,
32
31
  node: [["path", {
@@ -38,7 +37,7 @@ var ae = e({
38
37
  r: "3",
39
38
  key: "1v7zrd"
40
39
  }]]
41
- }), se = e({
40
+ }), fe = e({
42
41
  name: "grip-vertical",
43
42
  size: 24,
44
43
  node: [
@@ -79,7 +78,7 @@ var ae = e({
79
78
  key: "f4zoj3"
80
79
  }]
81
80
  ]
82
- }), ce = e({
81
+ }), pe = e({
83
82
  name: "lock-open",
84
83
  size: 24,
85
84
  node: [["rect", {
@@ -95,7 +94,7 @@ var ae = e({
95
94
  key: "1mm8w8"
96
95
  }]],
97
96
  aliases: ["unlock"]
98
- }), le = e({
97
+ }), me = e({
99
98
  name: "lock",
100
99
  size: 24,
101
100
  node: [["rect", {
@@ -110,7 +109,7 @@ var ae = e({
110
109
  d: "M7 11V7a5 5 0 0 1 10 0v4",
111
110
  key: "fwvmzm"
112
111
  }]]
113
- }), ue = e({
112
+ }), he = e({
114
113
  name: "pencil",
115
114
  size: 24,
116
115
  node: [["path", {
@@ -123,7 +122,7 @@ var ae = e({
123
122
  });
124
123
  //#endregion
125
124
  //#region ../canvas-editor/src/editing/layerPanel.ts
126
- function P(e) {
125
+ function k(e) {
127
126
  switch (e.type) {
128
127
  case "TableLayer": return e.template === null ? [{
129
128
  key: "rows",
@@ -149,7 +148,7 @@ function P(e) {
149
148
  }];
150
149
  }
151
150
  }
152
- function F(e) {
151
+ function A(e) {
153
152
  switch (e.type) {
154
153
  case "TextLayer":
155
154
  case "ImageLayer":
@@ -157,22 +156,22 @@ function F(e) {
157
156
  default: return null;
158
157
  }
159
158
  }
160
- var I = "{{…}}";
161
- function L(e) {
162
- let t = F(e);
159
+ var j = "{{…}}";
160
+ function M(e) {
161
+ let t = A(e);
163
162
  if (t === null) return "";
164
163
  let n = o(t).parts.flatMap((e) => e.kind === "fragment" && e.expr !== "" ? [e.expr] : []);
165
- return n.length === 0 ? I : n.map((e) => `{{${e}}}`).join(" ");
164
+ return n.length === 0 ? j : n.map((e) => `{{${e}}}`).join(" ");
166
165
  }
167
- function R(e, t, n, i) {
166
+ function N(e, t, n, i) {
168
167
  let a = [];
169
- for (let { key: n, layers: r } of P(e)) for (let e = 0; e < r.length; e += 1) {
168
+ for (let { key: n, layers: r } of k(e)) for (let e = 0; e < r.length; e += 1) {
170
169
  let o = n === "rows" ? "row" : n === "cells" ? "cell" : n === "template" ? "templateRow" : "content", s = n === "content" ? [...t, "content"] : n === "template" ? [...t, "template"] : [
171
170
  ...t,
172
171
  n,
173
172
  e
174
173
  ];
175
- a.push(R(r[e], s, o, i));
174
+ a.push(N(r[e], s, o, i));
176
175
  }
177
176
  return {
178
177
  type: e.type,
@@ -181,17 +180,17 @@ function R(e, t, n, i) {
181
180
  name: e.name,
182
181
  visible: e.visible,
183
182
  locked: r(t, i),
184
- expressionPrefix: L(e),
183
+ expressionPrefix: M(e),
185
184
  ...e.type === "TableLayer" ? { templated: e.template !== null } : null,
186
185
  children: a
187
186
  };
188
187
  }
189
- function z(e, t = []) {
188
+ function P(e, t = []) {
190
189
  let n = [];
191
- for (let r = e.layers.length - 1; r >= 0; --r) n.push(R(e.layers[r], ["layers", r], "root", t));
190
+ for (let r = e.layers.length - 1; r >= 0; --r) n.push(N(e.layers[r], ["layers", r], "root", t));
192
191
  return n;
193
192
  }
194
- var B = [
193
+ var F = [
195
194
  {
196
195
  id: "heading",
197
196
  fontSize: 40
@@ -204,7 +203,7 @@ var B = [
204
203
  id: "body",
205
204
  fontSize: 16
206
205
  }
207
- ], V = [
206
+ ], I = [
208
207
  {
209
208
  id: "free",
210
209
  ratio: null
@@ -244,7 +243,7 @@ var B = [
244
243
  h: 16
245
244
  }
246
245
  }
247
- ], H = [
246
+ ], L = [
248
247
  {
249
248
  kind: "layer",
250
249
  type: "TextLayer",
@@ -274,129 +273,100 @@ var B = [
274
273
  label: "模板表",
275
274
  title: "新增模板表(行模板 + 数据行展开)"
276
275
  }
277
- ], U = {
276
+ ], R = {
278
277
  heading: "标题",
279
278
  subheading: "副标题",
280
279
  body: "正文"
281
- }, W = B.map(({ id: e, fontSize: t }) => ({
280
+ }, z = F.map(({ id: e, fontSize: t }) => ({
282
281
  kind: "text-preset",
283
282
  preset: e,
284
- label: U[e],
283
+ label: R[e],
285
284
  shortcut: `${t}号`,
286
- title: `画拉建${U[e]}文本层(字号 ${t},点击后在画布拖拽定落位与尺寸,Esc 取消)`
285
+ title: `画拉建${R[e]}文本层(字号 ${t},点击后在画布拖拽定落位与尺寸,Esc 取消)`
287
286
  }));
288
- function G(e) {
287
+ function B(e) {
289
288
  return e === null ? "任意宽高" : e.w === e.h ? "正方形" : e.w > e.h ? "横向" : "纵向";
290
289
  }
291
- var K = V.flatMap(({ id: e, ratio: t }) => e === "free" ? [] : [{
290
+ var V = I.flatMap(({ id: e, ratio: t }) => e === "free" ? [] : [{
292
291
  kind: "ratio-preset",
293
292
  preset: e,
294
293
  label: e,
295
- shortcut: G(t),
296
- title: `画拉建 ${e} 图片层(${G(t)},画拉中按住 Shift 临时自由;点击后在画布拖拽定落位与尺寸,Esc 取消)`
297
- }]), q = H.map((e) => e.kind === "layer" ? e.type === "TextLayer" ? {
294
+ shortcut: B(t),
295
+ title: `画拉建 ${e} 图片层(${B(t)},画拉中按住 Shift 临时自由;点击后在画布拖拽定落位与尺寸,Esc 取消)`
296
+ }]), H = L.map((e) => e.kind === "layer" ? e.type === "TextLayer" ? {
298
297
  ...e,
299
- children: W
298
+ children: z
300
299
  } : e.type === "ImageLayer" ? {
301
300
  ...e,
302
- children: K
303
- } : e : e), J = H;
304
- function de(e, t) {
305
- return `画拉建${e}(${t}),${c}`;
301
+ children: V
302
+ } : e : e), U = L;
303
+ function ge(e, t) {
304
+ return `画拉建${e}(${t}),${u}`;
306
305
  }
307
306
  //#endregion
308
307
  //#region src/layer-panel/TemplateTableForm.vue?vue&type=script&setup=true&lang.ts
309
- var Y = {
310
- key: 0,
311
- class: "px-2 pb-1 text-[11px] text-cn-danger"
312
- }, X = { class: "flex gap-1 p-1" }, fe = /* @__PURE__ */ S({
308
+ var W = { class: "mx-1 my-1" }, G = { class: "flex gap-1 p-1" }, K = ["disabled"], q = /* @__PURE__ */ v({
313
309
  __name: "TemplateTableForm",
314
310
  props: { editor: {} },
315
311
  emits: ["confirm", "cancel"],
316
312
  setup(e, { emit: t }) {
317
- let n = e, r = t, a = T(""), o = T(!1);
318
- function s() {
319
- let e = a.value.trim();
320
- if (e === "") {
321
- o.value = !0;
322
- return;
323
- }
324
- r("confirm", e);
325
- }
326
- let c = m(n.editor), l = g(() => d(c.value)), u = T(null), p = T(null), { popup: h, accept: _ } = f({
327
- target: u,
328
- enabled: () => !0,
329
- resolve: (e) => l.value?.(e) ?? null,
330
- popupEl: g(() => p.value?.rootEl ?? null)
331
- });
332
- function S(e) {
333
- if (e.key === "Enter") {
334
- if (h.open && h.items.length > 0) return;
335
- e.preventDefault(), s();
336
- return;
337
- }
338
- e.key === "Escape" && (h.open ? e.stopPropagation() : r("cancel"));
339
- }
340
- return (e, t) => (w(), y("div", null, [
341
- t[3] ||= b("p", { class: "px-2 pt-1 text-[11px] leading-4 text-cn-muted" }, "模板行按数据行路径展开成表", -1),
342
- j(b("input", {
343
- ref_key: "rowsPathInputEl",
344
- ref: u,
345
- "onUpdate:modelValue": t[0] ||= (e) => a.value = e,
313
+ let n = e, r = t, i = S("");
314
+ function o() {
315
+ i.value !== "" && r("confirm", i.value);
316
+ }
317
+ let l = c(n.editor), ee = p(() => a(l.value));
318
+ return (e, t) => (x(), h("div", null, [
319
+ t[2] ||= g("p", { class: "px-2 pt-1 text-[11px] leading-4 text-cn-muted" }, "模板行按取行路径展开成表", -1),
320
+ g("div", W, [_(s, {
321
+ modelValue: i.value,
322
+ "onUpdate:modelValue": t[0] ||= (e) => i.value = e,
346
323
  "data-template-rows-path": "",
347
- type: "text",
348
- placeholder: "如 order.items",
349
- class: C(["mx-1 my-1 w-[calc(100%-8px)] rounded border bg-cn-field px-2 py-1 text-[12px] text-cn-fg outline-none focus:border-cn-accent/60", o.value ? "border-cn-danger" : "border-cn-field-line"]),
350
- onInput: t[1] ||= (e) => o.value = !1,
351
- onKeydown: S
352
- }, null, 34), [[k, a.value]]),
353
- o.value ? (w(), y("p", Y, "rowsPath 必填")) : v("", !0),
354
- b("div", X, [b("button", {
324
+ mode: "rowsPath",
325
+ source: ee.value,
326
+ "aria-label": "取行路径",
327
+ placeholder: "未选择行路径"
328
+ }, null, 8, ["modelValue", "source"])]),
329
+ g("div", G, [g("button", {
355
330
  type: "button",
356
331
  "data-template-confirm": "",
357
- class: "flex-1 rounded bg-cn-accent/20 px-2 py-1 text-[12px] text-cn-accent hover:bg-cn-accent/30",
358
- onClick: s
359
- }, " 创建 "), b("button", {
332
+ disabled: i.value === "",
333
+ class: "flex-1 rounded bg-cn-accent/20 px-2 py-1 text-[12px] text-cn-accent hover:bg-cn-accent/30 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-cn-accent/20",
334
+ onClick: o
335
+ }, " 创建 ", 8, K), g("button", {
360
336
  type: "button",
361
337
  "data-template-cancel": "",
362
338
  class: "flex-1 rounded px-2 py-1 text-[12px] text-cn-muted hover:text-cn-fg",
363
- onClick: t[2] ||= (e) => r("cancel")
364
- }, " 取消 ")]),
365
- x(i, {
366
- ref_key: "pathPopupRef",
367
- ref: p,
368
- state: O(h),
369
- onSelect: O(_)
370
- }, null, 8, ["state", "onSelect"])
339
+ onClick: t[1] ||= (e) => r("cancel")
340
+ }, " 取消 ")])
371
341
  ]));
372
342
  }
373
343
  });
374
344
  //#endregion
375
345
  //#region src/layer-panel/useLayerPanel.ts
376
- function pe(e) {
377
- let t = E(e.store.doc), n = E(e.store.ui.selection), r = E(e.store.ui.hovered), i = E(e.store.ui.renaming), a = E(e.store.ui.lockedPaths), o = e.subscribe((o) => {
346
+ function J(e) {
347
+ let t = C(e.store.doc), n = C(e.store.ui.selection), r = C(e.store.ui.hovered), i = C(e.store.ui.renaming), a = C(e.store.ui.lockedPaths), o = e.subscribe((o) => {
378
348
  o.scope === "doc" ? (t.value = e.store.doc, n.value = e.store.ui.selection, r.value = e.store.ui.hovered, i.value = e.store.ui.renaming, a.value = e.store.ui.lockedPaths) : o.branch === "selection" ? n.value = e.store.ui.selection : o.branch === "hovered" ? r.value = e.store.ui.hovered : o.branch === "renaming" ? i.value = e.store.ui.renaming : o.branch === "lockedPaths" && (a.value = e.store.ui.lockedPaths);
379
349
  });
380
- return ne(o, !0), {
381
- outline: g(() => t.value ? z(t.value, a.value) : []),
382
- selection: g(() => n.value),
383
- hovered: g(() => r.value),
384
- renaming: g(() => i.value)
350
+ return b(o, !0), {
351
+ outline: p(() => t.value ? P(t.value, a.value) : []),
352
+ selection: p(() => n.value),
353
+ hovered: p(() => r.value),
354
+ renaming: p(() => i.value)
385
355
  };
386
356
  }
387
- function me(e, t) {
357
+ function Y(e, t) {
388
358
  return t > 0 && e < t / 2;
389
359
  }
390
360
  //#endregion
391
361
  //#region src/layer-panel/LayerPanel.vue?vue&type=script&setup=true&lang.ts
392
- var he = { class: "cn-props flex w-[232px] 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)]" }, ge = { class: "sticky top-0 z-10 flex items-center justify-between border-b border-cn-line bg-cn-bg-elevated/95 px-3.5 py-2.5" }, _e = { class: "flex items-center gap-1" }, ve = [
362
+ var _e = { class: "cn-props flex w-[232px] 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)]" }, ve = { class: "sticky top-0 z-10 flex items-center justify-between border-b border-cn-line bg-cn-bg-elevated/95 px-3.5 py-2.5" }, ye = { class: "flex items-center gap-1" }, be = [
393
363
  "aria-expanded",
394
364
  "onClick",
395
365
  "onKeydown"
396
- ], ye = {
366
+ ], xe = {
397
367
  key: 0,
398
368
  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"
399
- }, be = [
369
+ }, Se = [
400
370
  "data-key",
401
371
  "draggable",
402
372
  "onClick",
@@ -404,38 +374,42 @@ var he = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
404
374
  "onDragstart",
405
375
  "onDragover",
406
376
  "onDrop"
407
- ], xe = ["onDragstart"], Se = ["title"], Ce = ["onDblclick"], we = [
377
+ ], Ce = ["onDragstart"], we = ["title"], Te = ["onDblclick"], Ee = [
408
378
  "title",
409
379
  "aria-pressed",
410
380
  "onClick"
411
- ], Te = [
381
+ ], De = [
412
382
  "title",
413
383
  "aria-pressed",
414
384
  "onClick"
415
- ], Ee = ["onClick"], De = [
385
+ ], Oe = ["onClick"], ke = [
416
386
  "disabled",
417
387
  "title",
418
388
  "onClick"
419
- ], Oe = ["onClick"], ke = ["onClick"], Ae = [
389
+ ], Ae = ["onClick"], je = ["onClick"], Me = [
420
390
  "disabled",
421
391
  "title",
422
392
  "onClick"
423
- ], je = /* @__PURE__ */ S({
393
+ ], X = /* @__PURE__ */ v({
424
394
  __name: "LayerPanel",
425
395
  props: { editor: {} },
426
396
  setup(e) {
427
- let r = e, i = `解锁图层(${s("toggleLayerLock", l())})`, o = `图层已锁定(${s("toggleLayerLock", l())} 解锁后可删除)`, d = pe(r.editor), f = T(!1), m = g(() => f.value ? [] : q.map((e) => {
428
- if (e.kind === "template-table") return {
429
- label: e.label,
430
- title: e.title,
431
- dataAttrs: { "data-add-layer": "template-table" },
432
- keepsOpen: !0,
433
- run: () => {
434
- f.value = !0;
435
- }
436
- };
397
+ let r = e, a = `解锁图层(${l("toggleLayerLock", f())})`, o = `图层已锁定(${l("toggleLayerLock", f())} 解锁后可删除)`, s = J(r.editor), v = c(r.editor), b = S(!1), C = p(() => b.value ? [] : H.map((e) => {
398
+ if (e.kind === "template-table") {
399
+ let t = v.value === null;
400
+ return {
401
+ label: e.label,
402
+ title: t ? ee : e.title,
403
+ disabled: t,
404
+ dataAttrs: { "data-add-layer": "template-table" },
405
+ keepsOpen: !0,
406
+ run: () => {
407
+ b.value = !0;
408
+ }
409
+ };
410
+ }
437
411
  let t = { "data-add-layer": e.type }, n = () => {
438
- r.editor.armLayerCreate(e.type), u().show(c);
412
+ r.editor.armLayerCreate(e.type), d().show(u);
439
413
  };
440
414
  return e.children === void 0 ? {
441
415
  label: e.label,
@@ -457,21 +431,21 @@ var he = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
457
431
  ...t.kind === "text-preset" ? { "data-text-preset": t.preset } : { "data-ratio-preset": t.preset }
458
432
  },
459
433
  run: () => {
460
- r.editor.armLayerCreate(e.type, t.preset), u().show(de(e.label, t.label));
434
+ r.editor.armLayerCreate(e.type, t.preset), d().show(ge(e.label, t.label));
461
435
  }
462
436
  }))
463
437
  };
464
438
  }));
465
- function S(e, t) {
466
- r.editor.armTemplateTableCreate(e), u().show(c), t();
439
+ function k(e, t) {
440
+ r.editor.armTemplateTableCreate(e), d().show(u), t();
467
441
  }
468
- function ne(e) {
469
- f.value = !1, e();
442
+ function A(e) {
443
+ b.value = !1, e();
470
444
  }
471
- function E() {
472
- f.value = !1;
445
+ function j() {
446
+ b.value = !1;
473
447
  }
474
- function P(e, t) {
448
+ function M(e, t) {
475
449
  switch (e.role) {
476
450
  case "root": return e.name === "" ? `${e.type} ${t}` : e.name;
477
451
  case "row": return `行 ${Number(e.path[e.path.length - 1]) + 1}`;
@@ -480,7 +454,7 @@ var he = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
480
454
  case "content": return e.type;
481
455
  }
482
456
  }
483
- let F = g(() => {
457
+ let N = p(() => {
484
458
  let e = [], t = /* @__PURE__ */ new Map();
485
459
  function r(i, a, o, s) {
486
460
  let c = i.role === "row" ? i.path.slice(0, -2) : i.role === "templateRow" ? i.path.slice(0, -1) : s, l = 0;
@@ -488,42 +462,42 @@ var he = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
488
462
  key: i.path.join("."),
489
463
  node: i,
490
464
  indentLevel: a,
491
- label: P(i, l),
465
+ label: M(i, l),
492
466
  indexInGroup: o,
493
467
  tablePath: c,
494
468
  inTemplate: n(i.path),
495
469
  draggable: i.role === "root" || i.role === "row" || i.role === "cell"
496
470
  }), i.children.forEach((e, t) => r(e, a + 1, t, c));
497
471
  }
498
- return d.outline.value.forEach((e, t) => r(e, 0, t, null)), e;
499
- }), I = g(() => F.value.length > 0);
500
- function L(e) {
472
+ return s.outline.value.forEach((e, t) => r(e, 0, t, null)), e;
473
+ }), P = p(() => N.value.length > 0);
474
+ function F(e) {
501
475
  r.editor.setSelection(e.node.path);
502
476
  }
503
- function R(e) {
477
+ function I(e) {
504
478
  r.editor.setHovered(e === null ? null : e.node.path);
505
479
  }
506
- function z(e) {
480
+ function L(e) {
507
481
  r.editor.addTableRow(e.node.path);
508
482
  }
509
- function B(e) {
483
+ function R(e) {
510
484
  r.editor.addTableCell(e.node.path);
511
485
  }
512
- function V(e) {
486
+ function z(e) {
513
487
  r.editor.addTemplateCell(e.node.path.slice(0, -1));
514
488
  }
515
- function H(e) {
489
+ function B(e) {
516
490
  r.editor.deleteLayer(e.node.path);
517
491
  }
518
- function U(e) {
492
+ function V(e) {
519
493
  r.editor.toggleLayerVisibility(e.node.path);
520
494
  }
521
- function W(e) {
495
+ function U(e) {
522
496
  r.editor.toggleLayerLock(e.node.path);
523
497
  }
524
- let G = T(null), K = T(null);
525
- function J(e) {
526
- let r = G.value;
498
+ let W = S(null), G = S(null);
499
+ function K(e) {
500
+ let r = W.value;
527
501
  if (!r) return !1;
528
502
  if (r.kind === "root") return e.node.role === "root";
529
503
  if (r.kind === "row") return e.node.role === "row";
@@ -531,11 +505,11 @@ var he = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
531
505
  let i = n(r.cellPath);
532
506
  return i === e.inTemplate ? !i || t(r.cellPath.slice(0, -2), e.node.path.slice(0, -2)) : !1;
533
507
  }
534
- function Y(e) {
508
+ function X(e) {
535
509
  return e.node.role === "root";
536
510
  }
537
- function X(e, t) {
538
- e.draggable && (G.value = e.node.role === "root" ? {
511
+ function Z(e, t) {
512
+ e.draggable && (W.value = e.node.role === "root" ? {
539
513
  kind: "root",
540
514
  from: e.indexInGroup
541
515
  } : e.node.role === "row" ? {
@@ -549,74 +523,74 @@ var he = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
549
523
  cellPath: e.node.path
550
524
  }, t.dataTransfer?.setData("text/plain", e.key), t.dataTransfer && (t.dataTransfer.effectAllowed = "move"));
551
525
  }
552
- function je(e, t) {
553
- Y(e) || X(e, t);
526
+ function Ne(e, t) {
527
+ X(e) || Z(e, t);
554
528
  }
555
- function Me(e) {
556
- if (!Y(e)) return e.draggable || void 0;
529
+ function Pe(e) {
530
+ if (!X(e)) return e.draggable || void 0;
557
531
  }
558
- function Ne(e, t) {
559
- if (!J(e)) return;
560
- let n = t.currentTarget.getBoundingClientRect(), r = me(t.clientY - n.top, n.height);
561
- t.preventDefault(), K.value = {
532
+ function Fe(e, t) {
533
+ if (!K(e)) return;
534
+ let n = t.currentTarget.getBoundingClientRect(), r = Y(t.clientY - n.top, n.height);
535
+ t.preventDefault(), G.value = {
562
536
  key: e.key,
563
537
  edge: r ? "before" : "after"
564
538
  };
565
539
  }
566
- function Pe(e, t) {
567
- if (!J(e)) return;
568
- let n = K.value, i = G.value;
540
+ function Ie(e, t) {
541
+ if (!K(e)) return;
542
+ let n = G.value, i = W.value;
569
543
  if (!i || !n || n.key !== e.key) return;
570
544
  t.preventDefault();
571
545
  let a = n.edge === "before" ? e.indexInGroup : e.indexInGroup + 1;
572
- i.kind === "root" ? r.editor.moveRootLayer(i.from, a) : i.kind === "row" ? e.tablePath !== null && e.tablePath.join(".") === i.tablePath.join(".") ? r.editor.moveTableRow(i.tablePath, i.from, a) : r.editor.moveTableRowToTable(i.rowPath, e.tablePath, a) : r.editor.moveTableCellToRow(i.cellPath, e.node.path.slice(0, -2), a), G.value = null, K.value = null;
573
- }
574
- function Fe() {
575
- G.value = null, K.value = null;
546
+ i.kind === "root" ? r.editor.moveRootLayer(i.from, a) : i.kind === "row" ? e.tablePath !== null && e.tablePath.join(".") === i.tablePath.join(".") ? r.editor.moveTableRow(i.tablePath, i.from, a) : r.editor.moveTableRowToTable(i.rowPath, e.tablePath, a) : r.editor.moveTableCellToRow(i.cellPath, e.node.path.slice(0, -2), a), W.value = null, G.value = null;
576
547
  }
577
- function Ie(e) {
578
- return t(d.selection.value, e.node.path);
548
+ function Le() {
549
+ W.value = null, G.value = null;
579
550
  }
580
- function Le(e) {
581
- return t(d.hovered.value, e.node.path);
551
+ function Re(e) {
552
+ return t(s.selection.value, e.node.path);
582
553
  }
583
- let Z = T(""), Q = null, Re = null;
584
554
  function ze(e) {
585
- Re = e instanceof HTMLInputElement ? e : null;
586
- }
587
- function Be(e) {
588
- return t(d.renaming.value, e.node.path);
555
+ return t(s.hovered.value, e.node.path);
589
556
  }
557
+ let Q = S(""), $ = null, Be = null;
590
558
  function Ve(e) {
591
- Y(e) && r.editor.beginRename(e.node.path);
559
+ Be = e instanceof HTMLInputElement ? e : null;
560
+ }
561
+ function He(e) {
562
+ return t(s.renaming.value, e.node.path);
563
+ }
564
+ function Ue(e) {
565
+ X(e) && r.editor.beginRename(e.node.path);
592
566
  }
593
- function $() {
594
- let e = Z.value.trim();
595
- if (Q !== null && e === Q.trim()) {
567
+ function We() {
568
+ let e = Q.value.trim();
569
+ if ($ !== null && e === $.trim()) {
596
570
  r.editor.cancelRename();
597
571
  return;
598
572
  }
599
573
  r.editor.commitRename(e);
600
574
  }
601
- function He() {
575
+ function Ge() {
602
576
  r.editor.cancelRename();
603
577
  }
604
- return ie(d.renaming, async (e) => {
578
+ return ce(s.renaming, async (e) => {
605
579
  if (e === null) {
606
- Q = null;
580
+ $ = null;
607
581
  return;
608
582
  }
609
- let n = F.value.find((n) => t(n.node.path, e));
610
- Z.value = n?.label ?? "", Q = Z.value, await ee();
611
- let r = Re;
583
+ let n = N.value.find((n) => t(n.node.path, e));
584
+ Q.value = n?.label ?? "", $ = Q.value, await ie();
585
+ let r = Be;
612
586
  r && (r.focus({ preventScroll: !0 }), r.select());
613
- }), (e, t) => (w(), y("aside", he, [
614
- b("header", ge, [t[7] ||= b("span", { class: "text-[12px] font-medium tracking-wide text-cn-fg/90" }, "图层", -1), b("div", _e, [x(p, {
587
+ }), (e, t) => (x(), h("aside", _e, [
588
+ g("header", ve, [t[7] ||= g("span", { class: "text-[12px] font-medium tracking-wide text-cn-fg/90" }, "图层", -1), g("div", ye, [_(te, {
615
589
  label: "新增图层",
616
- items: m.value,
617
- onClosed: E
590
+ items: C.value,
591
+ onClosed: j
618
592
  }, {
619
- trigger: A(({ open: e, toggle: t, triggerRef: n, onKeydown: r }) => [b("button", {
593
+ trigger: E(({ open: e, toggle: t, triggerRef: n, onKeydown: r }) => [g("button", {
620
594
  ref: n,
621
595
  type: "button",
622
596
  "data-add-menu": "",
@@ -626,151 +600,151 @@ var he = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
626
600
  class: "flex size-6 items-center justify-center rounded border border-cn-field-line bg-cn-field text-[13px] leading-none text-cn-fg/80 hover:border-cn-accent/40 hover:text-cn-accent",
627
601
  onClick: t,
628
602
  onKeydown: r
629
- }, " + ", 40, ve)]),
630
- body: A(({ closeMenu: e }) => [f.value ? (w(), _(fe, {
603
+ }, " + ", 40, be)]),
604
+ body: E(({ closeMenu: e }) => [b.value ? (x(), re(q, {
631
605
  key: 0,
632
606
  editor: r.editor,
633
- onConfirm: (t) => S(t, e),
634
- onCancel: (t) => ne(e)
607
+ onConfirm: (t) => k(t, e),
608
+ onCancel: (t) => A(e)
635
609
  }, null, 8, [
636
610
  "editor",
637
611
  "onConfirm",
638
612
  "onCancel"
639
- ])) : v("", !0)]),
613
+ ])) : m("", !0)]),
640
614
  _: 1
641
615
  }, 8, ["items"])])]),
642
- I.value ? v("", !0) : (w(), y("p", ye, " 画布还没有图层,用上方按钮新增 ")),
643
- b("ul", {
616
+ P.value ? m("", !0) : (x(), h("p", xe, " 画布还没有图层,用上方按钮新增 ")),
617
+ g("ul", {
644
618
  class: "cn-layers__tree flex flex-col gap-0.5 px-1.5 py-1",
645
- onDragend: Fe
646
- }, [(w(!0), y(h, null, re(F.value, (e) => (w(), y("li", {
619
+ onDragend: Le
620
+ }, [(x(!0), h(ne, null, oe(N.value, (e) => (x(), h("li", {
647
621
  key: e.key,
648
622
  "data-key": e.key,
649
- draggable: Me(e),
650
- class: C(["cn-layers__row group flex cursor-default select-none items-center gap-1 py-1 pr-1 text-[12px]", {
651
- "cn-layers__row--selected": Ie(e),
652
- "cn-layers__row--hovered": Le(e) && !Ie(e),
653
- "cn-layers__row--hidden": Y(e) && !e.node.visible,
623
+ draggable: Pe(e),
624
+ class: y(["cn-layers__row group flex cursor-default select-none items-center gap-1 py-1 pr-1 text-[12px]", {
625
+ "cn-layers__row--selected": Re(e),
626
+ "cn-layers__row--hovered": ze(e) && !Re(e),
627
+ "cn-layers__row--hidden": X(e) && !e.node.visible,
654
628
  "cn-layers__row--template": e.inTemplate,
655
- "cursor-grab": e.draggable && !Y(e),
656
- "cn-layers__row--drop-before": K.value?.key === e.key && K.value?.edge === "before",
657
- "cn-layers__row--drop-after": K.value?.key === e.key && K.value?.edge === "after"
629
+ "cursor-grab": e.draggable && !X(e),
630
+ "cn-layers__row--drop-before": G.value?.key === e.key && G.value?.edge === "before",
631
+ "cn-layers__row--drop-after": G.value?.key === e.key && G.value?.edge === "after"
658
632
  }]),
659
- style: te({ paddingLeft: `${4 + e.indentLevel * 14}px` }),
660
- onClick: (t) => L(e),
661
- onMouseenter: (t) => R(e),
662
- onMouseleave: t[6] ||= (e) => R(null),
663
- onDragstart: (t) => je(e, t),
664
- onDragover: (t) => Ne(e, t),
665
- onDrop: (t) => Pe(e, t)
633
+ style: ae({ paddingLeft: `${4 + e.indentLevel * 14}px` }),
634
+ onClick: (t) => F(e),
635
+ onMouseenter: (t) => I(e),
636
+ onMouseleave: t[6] ||= (e) => I(null),
637
+ onDragstart: (t) => Ne(e, t),
638
+ onDragover: (t) => Fe(e, t),
639
+ onDrop: (t) => Ie(e, t)
666
640
  }, [
667
- Y(e) ? (w(), y("span", {
641
+ X(e) ? (x(), h("span", {
668
642
  key: 0,
669
643
  "data-drag-handle": "",
670
644
  draggable: "true",
671
645
  title: "拖动排序",
672
646
  class: "cn-layers__handle shrink-0",
673
- onDragstart: (t) => X(e, t)
674
- }, [x(a, {
675
- icon: O(se),
647
+ onDragstart: (t) => Z(e, t)
648
+ }, [_(i, {
649
+ icon: T(fe),
676
650
  size: 12,
677
651
  "stroke-width": 2.5
678
- }, null, 8, ["icon"])], 40, xe)) : v("", !0),
679
- e.node.expressionPrefix === "" ? v("", !0) : (w(), y("span", {
652
+ }, null, 8, ["icon"])], 40, Ce)) : m("", !0),
653
+ e.node.expressionPrefix === "" ? m("", !0) : (x(), h("span", {
680
654
  key: 1,
681
655
  class: "cn-layers__prefix",
682
656
  title: e.node.expressionPrefix
683
- }, D(e.node.expressionPrefix), 9, Se)),
684
- Be(e) ? j((w(), y("input", {
657
+ }, w(e.node.expressionPrefix), 9, we)),
658
+ He(e) ? le((x(), h("input", {
685
659
  key: 2,
686
660
  ref_for: !0,
687
- ref: ze,
688
- "onUpdate:modelValue": t[0] ||= (e) => Z.value = e,
661
+ ref: Ve,
662
+ "onUpdate:modelValue": t[0] ||= (e) => Q.value = e,
689
663
  "data-rename-input": "",
690
664
  "aria-label": "图层重命名",
691
665
  class: "cn-layers__rename-input min-w-0 flex-1",
692
- onClick: t[1] ||= N(() => {}, ["stop"]),
693
- onDblclick: t[2] ||= N(() => {}, ["stop"]),
694
- onKeydown: [t[3] ||= M(N((e) => $(), ["prevent"]), ["enter"]), t[4] ||= M(N((e) => He(), ["prevent"]), ["esc"])],
695
- onBlur: t[5] ||= (e) => $()
696
- }, null, 544)), [[k, Z.value]]) : (w(), y("span", {
666
+ onClick: t[1] ||= O(() => {}, ["stop"]),
667
+ onDblclick: t[2] ||= O(() => {}, ["stop"]),
668
+ onKeydown: [t[3] ||= D(O((e) => We(), ["prevent"]), ["enter"]), t[4] ||= D(O((e) => Ge(), ["prevent"]), ["esc"])],
669
+ onBlur: t[5] ||= (e) => We()
670
+ }, null, 544)), [[se, Q.value]]) : (x(), h("span", {
697
671
  key: 3,
698
672
  class: "cn-layers__label min-w-0 flex-1 truncate font-mono text-[11px] leading-4",
699
- onDblclick: (t) => Ve(e)
700
- }, D(e.label), 41, Ce)),
701
- Y(e) ? (w(), y("button", {
673
+ onDblclick: (t) => Ue(e)
674
+ }, w(e.label), 41, Te)),
675
+ X(e) ? (x(), h("button", {
702
676
  key: 4,
703
677
  type: "button",
704
678
  "data-visibility": "",
705
- class: C(["cn-layers__eye size-5 shrink-0 items-center justify-center rounded text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent", e.node.visible ? "hidden group-hover:flex" : "flex"]),
679
+ class: y(["cn-layers__eye size-5 shrink-0 items-center justify-center rounded text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent", e.node.visible ? "hidden group-hover:flex" : "flex"]),
706
680
  title: e.node.visible ? "隐藏图层(最终输出不含该层)" : "显示图层",
707
681
  "aria-pressed": !e.node.visible,
708
- onClick: N((t) => U(e), ["stop"])
709
- }, [x(a, {
710
- icon: e.node.visible ? O(oe) : O(ae),
682
+ onClick: O((t) => V(e), ["stop"])
683
+ }, [_(i, {
684
+ icon: e.node.visible ? T(de) : T(ue),
711
685
  size: 11,
712
686
  "stroke-width": 2
713
- }, null, 8, ["icon"])], 10, we)) : v("", !0),
714
- Y(e) ? (w(), y("button", {
687
+ }, null, 8, ["icon"])], 10, Ee)) : m("", !0),
688
+ X(e) ? (x(), h("button", {
715
689
  key: 5,
716
690
  type: "button",
717
691
  "data-lock": "",
718
- class: C(["cn-layers__lock size-5 shrink-0 items-center justify-center rounded text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent", e.node.locked ? "flex" : "hidden group-hover:flex"]),
719
- title: e.node.locked ? i : "锁定图层(画布不可点选/拖动/删除,渲染照常)",
692
+ class: y(["cn-layers__lock size-5 shrink-0 items-center justify-center rounded text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent", e.node.locked ? "flex" : "hidden group-hover:flex"]),
693
+ title: e.node.locked ? a : "锁定图层(画布不可点选/拖动/删除,渲染照常)",
720
694
  "aria-pressed": e.node.locked,
721
- onClick: N((t) => W(e), ["stop"])
722
- }, [x(a, {
723
- icon: e.node.locked ? O(le) : O(ce),
695
+ onClick: O((t) => U(e), ["stop"])
696
+ }, [_(i, {
697
+ icon: e.node.locked ? T(me) : T(pe),
724
698
  size: 11,
725
699
  "stroke-width": 2
726
- }, null, 8, ["icon"])], 10, Te)) : v("", !0),
727
- Y(e) ? (w(), y("button", {
700
+ }, null, 8, ["icon"])], 10, De)) : m("", !0),
701
+ X(e) ? (x(), h("button", {
728
702
  key: 6,
729
703
  type: "button",
730
704
  "data-rename": "",
731
705
  class: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex",
732
706
  title: "重命名(双击名称或 F2)",
733
- onClick: N((t) => Ve(e), ["stop"])
734
- }, [x(a, {
735
- icon: O(ue),
707
+ onClick: O((t) => Ue(e), ["stop"])
708
+ }, [_(i, {
709
+ icon: T(he),
736
710
  size: 11,
737
711
  "stroke-width": 2
738
- }, null, 8, ["icon"])], 8, Ee)) : v("", !0),
739
- e.node.role === "root" && e.node.type === "TableLayer" ? (w(), y("button", {
712
+ }, null, 8, ["icon"])], 8, Oe)) : m("", !0),
713
+ e.node.role === "root" && e.node.type === "TableLayer" ? (x(), h("button", {
740
714
  key: 7,
741
715
  type: "button",
742
716
  "data-add-row": "",
743
717
  class: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-[10px] leading-none text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex disabled:cursor-not-allowed disabled:text-cn-muted/50 disabled:hover:bg-transparent",
744
718
  disabled: e.node.templated === !0,
745
719
  title: e.node.templated === !0 ? "模板态不可加行——行由数据展开" : "加行(缺省行 + 缺省格与文本,行宽=表宽)",
746
- onClick: N((t) => z(e), ["stop"])
747
- }, " +行 ", 8, De)) : v("", !0),
748
- e.node.role === "row" ? (w(), y("button", {
720
+ onClick: O((t) => L(e), ["stop"])
721
+ }, " +行 ", 8, ke)) : m("", !0),
722
+ e.node.role === "row" ? (x(), h("button", {
749
723
  key: 8,
750
724
  type: "button",
751
725
  "data-add-cell": "",
752
726
  class: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-[10px] leading-none text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex",
753
727
  title: "加格(缺省格 + 文本内容,行高取最高格)",
754
- onClick: N((t) => B(e), ["stop"])
755
- }, " +格 ", 8, Oe)) : v("", !0),
756
- e.node.role === "templateRow" ? (w(), y("button", {
728
+ onClick: O((t) => R(e), ["stop"])
729
+ }, " +格 ", 8, Ae)) : m("", !0),
730
+ e.node.role === "templateRow" ? (x(), h("button", {
757
731
  key: 9,
758
732
  type: "button",
759
733
  "data-add-template-cell": "",
760
734
  class: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-[10px] leading-none text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex",
761
735
  title: "加格(缺省格 + 文本内容,零高度耦合——行高由数据展开定稿)",
762
- onClick: N((t) => V(e), ["stop"])
763
- }, " +格 ", 8, ke)) : v("", !0),
764
- b("button", {
736
+ onClick: O((t) => z(e), ["stop"])
737
+ }, " +格 ", 8, je)) : m("", !0),
738
+ g("button", {
765
739
  type: "button",
766
740
  class: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-[10px] leading-none text-cn-muted hover:bg-cn-danger/15 hover:text-cn-danger group-hover:flex disabled:cursor-not-allowed disabled:text-cn-muted/50 disabled:hover:bg-transparent disabled:hover:text-cn-muted/50",
767
741
  disabled: e.node.role === "templateRow" || e.node.locked,
768
742
  title: e.node.role === "templateRow" ? "行模板由表持有——转换回普通表请用 V2 转换入口" : e.node.locked ? o : "删除(含子层)",
769
- onClick: N((t) => H(e), ["stop"])
770
- }, " ✕ ", 8, Ae)
771
- ], 46, be))), 128))], 32)
743
+ onClick: O((t) => B(e), ["stop"])
744
+ }, " ✕ ", 8, Me)
745
+ ], 46, Se))), 128))], 32)
772
746
  ]));
773
747
  }
774
748
  });
775
749
  //#endregion
776
- export { J as a, W as c, fe as i, q as l, me as n, H as o, pe as r, K as s, je as t };
750
+ export { U as a, z as c, q as i, H as l, Y as n, L as o, J as r, V as s, X as t };