@hankchen/canvas-editor-vue 0.1.4 → 0.3.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.
@@ -1,9 +1,9 @@
1
1
  import { t as e } from "./createLucideIcon-SCvtEGVf.js";
2
2
  import { c as t, d as n, f as r, l as i, o as a, p as o, s, u as c } from "./dist-DGtNmLwo.js";
3
3
  import { i as l, n as u, o as d } from "./layerPath-uy2ywyld.js";
4
- import { i as f, r as p } from "./completionAnchor-CDR5YZhu.js";
4
+ import { i as f, r as p } from "./completionAnchor-Da8VhzMQ.js";
5
5
  import { c as m, n as h, r as g, s as _, t as v, u as y } from "./useTransientFeedback-CTjmMmFF.js";
6
- import { i as b, n as x, r as S, t as C } from "./uploadFile-BOfv8aLG.js";
6
+ import { i as b, n as x, r as S, t as C } from "./uploadFile-DXAEX9kG.js";
7
7
  import { n as w, t as T } from "./useViewport-D9Ipevzs.js";
8
8
  import { Fragment as E, computed as D, createBlock as O, createCommentVNode as k, createElementBlock as A, createElementVNode as j, createVNode as M, defineComponent as N, mergeProps as P, nextTick as F, normalizeClass as I, normalizeStyle as L, onBeforeUnmount as R, onMounted as z, onScopeDispose as B, openBlock as V, ref as H, renderList as U, shallowRef as W, toDisplayString as G, unref as K, vModelText as ee, vShow as q, watch as J, withDirectives as Y, withKeys as X, withModifiers as Z } from "vue";
9
9
  var Q = e({
package/dist/canvas.js CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g } from "./canvas-C70NSsoF.js";
1
+ import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g } from "./canvas-ZMyaouKe.js";
2
2
  export { e as AlignFloatBar, n as CanvasSurface, f as ContentTypePill, a as ContextMenu, l as FindBar, m as GuidesOverlay, d as Ruler, c as TextEditingOverlay, u as createGizmoOverlayPainter, h as createRafScheduler, t as drawCreateRubberBand, s as drawFindMatches, p as drawSelectionGizmo, r as useDpr, o as useFindSession, g as useTextEditing, i as watchDprChanges };
@@ -0,0 +1,470 @@
1
+ import { Fragment as e, Teleport as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, mergeProps as s, nextTick as c, normalizeClass as l, normalizeStyle as u, openBlock as d, ref as f, renderList as p, resolveDynamicComponent as m, toDisplayString as h, watch as g, withModifiers as _ } from "vue";
2
+ //#region ../canvas-editor/src/shared/expressionSchema.ts
3
+ function v(e) {
4
+ let t = e;
5
+ for (; t !== void 0;) {
6
+ if (t.properties !== void 0) return t.properties;
7
+ t = t.items;
8
+ }
9
+ return null;
10
+ }
11
+ function y(e, t) {
12
+ let n = e;
13
+ for (let e of t) {
14
+ let t = v(n)?.get(e);
15
+ if (t === void 0) return null;
16
+ n = t;
17
+ }
18
+ return n;
19
+ }
20
+ function b(e) {
21
+ if (e.type === "array" || e.items !== void 0) return { entries: [] };
22
+ let t = e.properties === void 0 ? [] : [...e.properties].map(([e, t]) => ({
23
+ key: e,
24
+ node: t
25
+ }));
26
+ return e.open === !0 ? {
27
+ entries: t,
28
+ open: !0
29
+ } : { entries: t };
30
+ }
31
+ function x(e, t) {
32
+ let n = t.split(".");
33
+ return t === "" || n.includes("") ? null : y(e, n)?.items ?? null;
34
+ }
35
+ //#endregion
36
+ //#region ../canvas-editor/src/shared/expressionPath.ts
37
+ function S(e) {
38
+ if (e === "") return {
39
+ ok: !1,
40
+ error: "expression_syntax_error"
41
+ };
42
+ let t = e.split(".");
43
+ if (t.includes("")) return {
44
+ ok: !1,
45
+ error: "expression_syntax_error"
46
+ };
47
+ let n = t[0], r = t.slice(1);
48
+ return n === "row" ? {
49
+ ok: !0,
50
+ head: { kind: "row" },
51
+ rest: r
52
+ } : n === "$root" ? {
53
+ ok: !0,
54
+ head: { kind: "root" },
55
+ rest: r
56
+ } : {
57
+ ok: !0,
58
+ head: {
59
+ kind: "bare",
60
+ name: n
61
+ },
62
+ rest: r
63
+ };
64
+ }
65
+ //#endregion
66
+ //#region ../canvas-editor/src/shared/expressionCall.ts
67
+ var C = " \n\r\0\v", w = " \n\r", T = `()',.${C}`;
68
+ function E(e) {
69
+ let t = 0, n = e.length;
70
+ for (; t < n && C.includes(e[t]);) t += 1;
71
+ for (; n > t && C.includes(e[n - 1]);) --n;
72
+ return e.slice(t, n);
73
+ }
74
+ function D(e, t) {
75
+ for (; t < e.length && w.includes(e[t]);) t += 1;
76
+ return t;
77
+ }
78
+ function O(e) {
79
+ let t = 0;
80
+ for (; t < e.length && !T.includes(e[t]);) t += 1;
81
+ if (t === 0) return !1;
82
+ let n = t;
83
+ for (; n < e.length && C.includes(e[n]);) n += 1;
84
+ return e[n] === "(";
85
+ }
86
+ function k(e) {
87
+ let t = 0;
88
+ for (; t < e.length && !T.includes(e[t]);) t += 1;
89
+ if (t === 0) return {
90
+ ok: !1,
91
+ error: "expression_syntax_error"
92
+ };
93
+ let n = e.slice(0, t), r = D(e, t);
94
+ if (r >= e.length || e[r] !== "(") return {
95
+ ok: !1,
96
+ error: "expression_syntax_error"
97
+ };
98
+ r = D(e, r + 1);
99
+ let i = [];
100
+ if (r < e.length && e[r] === ")") r += 1;
101
+ else for (;;) {
102
+ if (r >= e.length) return {
103
+ ok: !1,
104
+ error: "expression_syntax_error"
105
+ };
106
+ let t = A(e, r);
107
+ if (!t.ok) return t;
108
+ if (i.push(t.value), r = D(e, t.end), r >= e.length) return {
109
+ ok: !1,
110
+ error: "expression_syntax_error"
111
+ };
112
+ if (e[r] === ",") {
113
+ if (r = D(e, r + 1), r < e.length && e[r] === ")") return {
114
+ ok: !1,
115
+ error: "expression_syntax_error"
116
+ };
117
+ continue;
118
+ }
119
+ if (e[r] === ")") {
120
+ r += 1;
121
+ break;
122
+ }
123
+ return {
124
+ ok: !1,
125
+ error: "expression_syntax_error"
126
+ };
127
+ }
128
+ if (D(e, r) !== e.length || i[0] !== void 0 && i[0].type !== "path") return {
129
+ ok: !1,
130
+ error: "expression_syntax_error"
131
+ };
132
+ for (let e of i) if (e.type === "path" && !S(e.value).ok) return {
133
+ ok: !1,
134
+ error: "expression_syntax_error"
135
+ };
136
+ return {
137
+ ok: !0,
138
+ name: n,
139
+ args: i
140
+ };
141
+ }
142
+ function A(e, t) {
143
+ let n = e.length, r = e[t];
144
+ if (r === "'") {
145
+ let r = t + 1, i = "";
146
+ for (;;) {
147
+ if (r >= n) return {
148
+ ok: !1,
149
+ error: "expression_syntax_error"
150
+ };
151
+ if (e[r] === "'") {
152
+ if (r + 1 < n && e[r + 1] === "'") {
153
+ i += "'", r += 2;
154
+ continue;
155
+ }
156
+ r += 1;
157
+ break;
158
+ }
159
+ i += e[r], r += 1;
160
+ }
161
+ return {
162
+ ok: !0,
163
+ value: {
164
+ type: "string",
165
+ value: i
166
+ },
167
+ end: r
168
+ };
169
+ }
170
+ if (r >= "0" && r <= "9") {
171
+ let r = t, i = (t) => {
172
+ let n = e[t];
173
+ return n !== void 0 && n >= "0" && n <= "9";
174
+ };
175
+ for (; i(t);) t += 1;
176
+ if (t < n && e[t] === "." && i(t + 1)) for (t += 1; i(t);) t += 1;
177
+ return {
178
+ ok: !0,
179
+ value: {
180
+ type: "number",
181
+ value: e.slice(r, t)
182
+ },
183
+ end: t
184
+ };
185
+ }
186
+ let i = t;
187
+ for (; t < n && e[t] !== "," && e[t] !== ")";) t += 1;
188
+ let a = E(e.slice(i, t));
189
+ return a === "" ? {
190
+ ok: !1,
191
+ error: "expression_syntax_error"
192
+ } : {
193
+ ok: !0,
194
+ value: {
195
+ type: "path",
196
+ value: a
197
+ },
198
+ end: t
199
+ };
200
+ }
201
+ function j(e) {
202
+ let t = 0;
203
+ for (; t < e.length && !T.includes(e[t]);) t += 1;
204
+ if (t === 0) return null;
205
+ let n = D(e, t);
206
+ if (n >= e.length || e[n] !== "(") return null;
207
+ n = D(e, n + 1);
208
+ let r = 0;
209
+ for (;;) {
210
+ if (n >= e.length) return {
211
+ name: e.slice(0, t),
212
+ index: r,
213
+ text: "",
214
+ stringSlot: !1
215
+ };
216
+ let i = e[n];
217
+ if (i === "'") {
218
+ let i = n + 1;
219
+ for (;;) {
220
+ if (i >= e.length) return {
221
+ name: e.slice(0, t),
222
+ index: r,
223
+ text: e.slice(n + 1),
224
+ stringSlot: !0
225
+ };
226
+ if (e[i] === "'") {
227
+ if (i + 1 < e.length && e[i + 1] === "'") {
228
+ i += 2;
229
+ continue;
230
+ }
231
+ i += 1;
232
+ break;
233
+ }
234
+ i += 1;
235
+ }
236
+ n = i;
237
+ } else if (i !== "," && i !== ")") {
238
+ let i = n;
239
+ for (; n < e.length && e[n] !== "," && e[n] !== ")";) n += 1;
240
+ if (n >= e.length) return {
241
+ name: e.slice(0, t),
242
+ index: r,
243
+ text: E(e.slice(i)),
244
+ stringSlot: !1
245
+ };
246
+ }
247
+ if (n >= e.length) return {
248
+ name: e.slice(0, t),
249
+ index: r + 1,
250
+ text: "",
251
+ stringSlot: !1
252
+ };
253
+ if (e[n] === ")") return null;
254
+ r += 1, n = D(e, n + 1);
255
+ }
256
+ }
257
+ function M(e) {
258
+ let t = 0, n = e.length;
259
+ for (; t < n && " \n\r\0\v".includes(e[t]);) t += 1;
260
+ for (; n > t && " \n\r\0\v".includes(e[n - 1]);) --n;
261
+ return e.slice(t, n);
262
+ }
263
+ function N(e) {
264
+ return e === "" ? "expression_syntax_error" : O(e) ? k(e).ok ? null : "expression_syntax_error" : S(e).ok ? null : "expression_syntax_error";
265
+ }
266
+ function P(e) {
267
+ let t = [], n = 0, r = e.indexOf("{{");
268
+ for (; r !== -1;) {
269
+ let i = e.indexOf("}}", r + 2);
270
+ if (i === -1) {
271
+ r > n && t.push({
272
+ kind: "literal",
273
+ start: n,
274
+ end: r,
275
+ text: e.slice(n, r)
276
+ });
277
+ let i = e.slice(r);
278
+ return t.push({
279
+ kind: "open",
280
+ start: r,
281
+ end: e.length,
282
+ text: i,
283
+ expr: M(i.slice(2))
284
+ }), {
285
+ template: e,
286
+ parts: t
287
+ };
288
+ }
289
+ r > n && t.push({
290
+ kind: "literal",
291
+ start: n,
292
+ end: r,
293
+ text: e.slice(n, r)
294
+ });
295
+ let a = e.slice(r + 2, i), o = M(a), s = N(o);
296
+ t.push({
297
+ kind: "fragment",
298
+ start: r,
299
+ end: i + 2,
300
+ raw: a,
301
+ expr: o,
302
+ error: s
303
+ }), n = i + 2, r = e.indexOf("{{", n);
304
+ }
305
+ return n < e.length && t.push({
306
+ kind: "literal",
307
+ start: n,
308
+ end: e.length,
309
+ text: e.slice(n)
310
+ }), {
311
+ template: e,
312
+ parts: t
313
+ };
314
+ }
315
+ function F(e, t) {
316
+ for (let n of e.parts) if (n.kind !== "literal" && (n.kind === "open" ? t > n.start && t <= n.end : t > n.start && t < n.end)) return n;
317
+ return null;
318
+ }
319
+ //#endregion
320
+ //#region src/shared/PanelIcon.vue
321
+ var I = /* @__PURE__ */ o({
322
+ inheritAttrs: !1,
323
+ __name: "PanelIcon",
324
+ props: {
325
+ icon: {},
326
+ size: { default: 14 },
327
+ strokeWidth: { default: 2 }
328
+ },
329
+ setup(e) {
330
+ return (t, r) => (d(), n(m(e.icon), s({
331
+ size: e.size,
332
+ "stroke-width": e.strokeWidth
333
+ }, t.$attrs), null, 16, ["size", "stroke-width"]));
334
+ }
335
+ }), L = {
336
+ role: "listbox",
337
+ "aria-label": "表达式路径候选"
338
+ }, R = [
339
+ "aria-selected",
340
+ "title",
341
+ "onClick"
342
+ ], z = { class: "cn-completion__segment font-mono text-cn-fg" }, B = {
343
+ key: 0,
344
+ class: "shrink-0 rounded-sm bg-cn-field px-1 py-0.5 text-[9px] leading-none text-cn-muted"
345
+ }, V = {
346
+ key: 1,
347
+ class: "truncate text-[10px] leading-none text-cn-muted"
348
+ }, H = {
349
+ key: 0,
350
+ class: "cn-completion__hint px-2 py-1.5 text-[10px] leading-none text-cn-muted"
351
+ }, U = /* @__PURE__ */ o({
352
+ __name: "ExpressionCompletionPopup",
353
+ props: { state: {} },
354
+ emits: ["select"],
355
+ setup(o, { expose: s, emit: m }) {
356
+ let v = o, y = m, b = f(null);
357
+ return s({ rootEl: b }), g(() => v.state.activeIndex, async () => {
358
+ await c(), b.value?.querySelector(".cn-completion__option--active")?.scrollIntoView?.({ block: "nearest" });
359
+ }), (s, c) => (d(), n(t, { to: "body" }, [o.state.open ? (d(), i("div", {
360
+ key: 0,
361
+ ref_key: "rootRef",
362
+ ref: b,
363
+ class: "cn-props cn-completion fixed z-50 max-h-[200px] min-w-[140px] max-w-[280px] overflow-y-auto rounded-md border border-cn-field-line py-1 text-[11px] leading-none",
364
+ style: u({
365
+ top: `${o.state.top}px`,
366
+ left: `${o.state.left}px`
367
+ }),
368
+ onMousedown: c[0] ||= _(() => {}, ["prevent", "stop"]),
369
+ onPointerdown: c[1] ||= _(() => {}, ["stop"])
370
+ }, [a("div", L, [(d(!0), i(e, null, p(o.state.items, (e, t) => (d(), i("button", {
371
+ key: `${t}:${e.segment}`,
372
+ type: "button",
373
+ role: "option",
374
+ class: l(["cn-completion__option flex w-full items-center gap-1.5 px-2 py-1.5 text-left", t === o.state.activeIndex ? "cn-completion__option--active" : ""]),
375
+ "aria-selected": t === o.state.activeIndex,
376
+ title: e.path ?? e.segment,
377
+ onClick: (e) => y("select", t)
378
+ }, [
379
+ a("span", z, h(e.segment), 1),
380
+ e.type ? (d(), i("span", B, h(e.type), 1)) : r("", !0),
381
+ e.description ?? e.title ? (d(), i("span", V, h(e.description ?? e.title), 1)) : r("", !0)
382
+ ], 10, R))), 128))]), o.state.openMapping ? (d(), i("div", H, " 动态字段,键由模板定义 ")) : r("", !0)], 36)) : r("", !0)]));
383
+ }
384
+ });
385
+ //#endregion
386
+ //#region src/shared/completion.ts
387
+ function W(e, t, n, r, i) {
388
+ let a = t.start + 2, o = t.kind === "open" ? t.end : t.end - 2, s = Math.min(n, o), c = 0;
389
+ for (; s - c > a && " \n\r\0\v".includes(e[s - 1 - c]);) c += 1;
390
+ let l = s - c, u = l - (i.replaceLen ?? r.length);
391
+ if (u < a || i.replaceLen === void 0 && e.slice(u, l) !== r) return null;
392
+ let d = i.cursorBack ?? 0;
393
+ return d > i.segment.length ? null : {
394
+ value: e.slice(0, u) + i.segment + e.slice(l),
395
+ cursor: u + i.segment.length - d
396
+ };
397
+ }
398
+ //#endregion
399
+ //#region src/shared/completionAnchor.ts
400
+ function G(e, t) {
401
+ return parseFloat(e.getPropertyValue(t)) || 0;
402
+ }
403
+ function K(e, t, n) {
404
+ for (let r of n) {
405
+ let n = e.getPropertyValue(r);
406
+ n && t.setProperty(r, n);
407
+ }
408
+ }
409
+ var q = [
410
+ "font-family",
411
+ "font-size",
412
+ "font-weight",
413
+ "font-style",
414
+ "font-stretch",
415
+ "letter-spacing",
416
+ "word-spacing",
417
+ "line-height",
418
+ "text-transform",
419
+ "text-indent",
420
+ "tab-size"
421
+ ];
422
+ function J(e) {
423
+ return G(e, "line-height") || G(e, "font-size") * 1.4;
424
+ }
425
+ function Y(e) {
426
+ let t = document.createElement("div"), n = t.style;
427
+ return n.position = "fixed", n.top = "0", n.left = "0", n.visibility = "hidden", e(t, n), document.body.appendChild(t), t;
428
+ }
429
+ function X(e, t) {
430
+ let n = e.selectionStart ?? e.value.length, r = e.getBoundingClientRect(), i = getComputedStyle(e), a = G(i, "padding-left"), o = G(i, "padding-top"), s = null, c = Y((t, r) => {
431
+ r.whiteSpace = i.whiteSpace || "pre-wrap", r.boxSizing = "content-box", r.width = `${Math.max(0, e.clientWidth - a - G(i, "padding-right"))}px`, K(i, r, [
432
+ "padding-left",
433
+ "padding-right",
434
+ "padding-top",
435
+ "padding-bottom",
436
+ "word-break",
437
+ "overflow-wrap"
438
+ ]), K(i, r, q), s = document.createElement("span"), s.textContent = "​", t.append(document.createTextNode(e.value.slice(0, n)), s);
439
+ });
440
+ try {
441
+ let n = r.left + G(i, "border-left-width") + a + s.offsetLeft * t - e.scrollLeft, c = r.top + G(i, "border-top-width") + o + s.offsetTop * t - e.scrollTop;
442
+ return {
443
+ left: n,
444
+ top: c,
445
+ bottom: c + J(i) * t
446
+ };
447
+ } finally {
448
+ c.remove();
449
+ }
450
+ }
451
+ function Z(e, t) {
452
+ let n = e.selectionStart ?? e.value.length, r = e.getBoundingClientRect(), i = getComputedStyle(e), a = Y((t, r) => {
453
+ r.display = "inline-block", r.whiteSpace = "pre", K(i, r, q), t.textContent = e.value.slice(0, n);
454
+ });
455
+ try {
456
+ let n = a.getBoundingClientRect().width || a.offsetWidth;
457
+ return {
458
+ left: r.left + G(i, "border-left-width") + G(i, "padding-left") + n * t - e.scrollLeft,
459
+ top: r.top + G(i, "border-top-width"),
460
+ bottom: r.bottom - G(i, "border-bottom-width")
461
+ };
462
+ } finally {
463
+ a.remove();
464
+ }
465
+ }
466
+ function Q(e, t = 1) {
467
+ return e instanceof HTMLTextAreaElement ? X(e, t) : Z(e, t);
468
+ }
469
+ //#endregion
470
+ export { F as a, j as c, x as d, b as f, I as i, O as l, W as n, M as o, y as p, U as r, P as s, Q as t, S as u };
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g } from "./canvas-C70NSsoF.js";
2
- import { a as _, i as v, n as y, r as b, t as x } from "./layer-panel-GiVy_B4A.js";
3
- import { a as S, c as C, d as w, f as T, i as E, l as D, m as O, n as k, o as A, p as j, r as M, s as N, t as P, u as F } from "./property-panel-C2etsIhF.js";
4
- import { i as I, n as L, r as R, t as z } from "./completionAnchor-CDR5YZhu.js";
5
- import { c as B, i as V, n as H, s as U, t as W } from "./useTransientFeedback-CTjmMmFF.js";
6
- import { i as G, n as K, r as q, t as J } from "./uploadFile-BOfv8aLG.js";
7
- import { n as Y, t as X } from "./usePathCompletion-uJ5c_gQ0.js";
8
- import { n as Z, t as Q } from "./useViewport-D9Ipevzs.js";
9
- import { n as $, r as ee, t as te } from "./useDataSourceSchema-CGbldbUj.js";
10
- import { n as ne, r as re, t as ie } from "./status-bar-_PvEXyq8.js";
11
- import { t as ae } from "./useShortcutsHelp-CsyarO2P.js";
12
- import { n as oe, r as se, t as ce } from "./shared-wuupBoZg.js";
1
+ import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g } from "./canvas-ZMyaouKe.js";
2
+ import { a as _, i as v, n as y, o as b, r as x, s as S, t as C } from "./layer-panel-CEyB57XM.js";
3
+ import { a as w, c as T, d as E, f as D, i as O, l as k, m as A, n as j, o as M, p as N, r as P, s as F, t as I, u as L } from "./property-panel-DmSf_GPu.js";
4
+ import { i as R, n as z, r as B, t as V } from "./completionAnchor-Da8VhzMQ.js";
5
+ import { c as H, i as U, n as W, s as G, t as K } from "./useTransientFeedback-CTjmMmFF.js";
6
+ import { i as q, n as J, r as Y, t as X } from "./uploadFile-DXAEX9kG.js";
7
+ import { n as Z, t as Q } from "./usePathCompletion-C52F4phW.js";
8
+ import { n as $, t as ee } from "./useViewport-D9Ipevzs.js";
9
+ import { n as te, r as ne, t as re } from "./useDataSourceSchema-CGbldbUj.js";
10
+ import { n as ie, r as ae, t as oe } from "./status-bar-_PvEXyq8.js";
11
+ import { t as se } from "./useShortcutsHelp-CsyarO2P.js";
12
+ import { n as ce, r as le, t as ue } from "./shared-wuupBoZg.js";
13
13
  //#region src/index.ts
14
- var le = "@hankchen/canvas-editor-vue";
14
+ var de = "@hankchen/canvas-editor-vue";
15
15
  //#endregion
16
- export { v as ADD_LAYER_MENU, _ as ADD_MENU, V as ARM_LAYER_CREATE_HINT, e as AlignFloatBar, D as CANVAS_FIELD_SECTIONS, n as CanvasSurface, f as ContentTypePill, a as ContextMenu, $ as DropdownMenu, R as ExpressionCompletionPopup, F as FIELD_SECTIONS_BY_TYPE, N as FONT_PICKER_KEY, l as FindBar, m as GuidesOverlay, se as HelpDialog, S as IMAGE_UPLOAD_KEY, x as LayerPanel, le as PACKAGE_NAME, I as PanelIcon, k as PropertyField, P as PropertyPanel, d as Ruler, ie as StatusBar, c as TextEditingOverlay, L as applyCompletion, E as controlRegistry, u as createGizmoOverlayPainter, h as createRafScheduler, U as detectShortcutPlatform, t as drawCreateRubberBand, s as drawFindMatches, p as drawSelectionGizmo, q as expressionCompletionSource, G as expressionFieldContext, w as fieldSectionsForPath, T as fieldSectionsForType, ne as formatLayerGeometry, re as formatLayerPath, C as injectFontPicker, A as injectImageUpload, H as isEditableEventTarget, y as isUpperHalf, j as layerRoleAt, z as measureCursorAnchor, O as readField, Y as rowsPathCompletionSource, B as shortcutActionLabel, J as uploadFileFromDom, te as useDataSourceSchema, r as useDpr, ee as useDropdownMenu, K as useExpressionCompletion, o as useFindSession, oe as useHistory, b as useLayerPanel, X as usePathCompletion, M as usePropertyPanel, Z as useSelection, ce as useShortcuts, ae as useShortcutsHelp, g as useTextEditing, W as useTransientFeedback, Q as useViewport, i as watchDprChanges };
16
+ export { v as ADD_LAYER_MENU, _ as ADD_MENU, b as ADD_TEXT_PRESET_MENU, U as ARM_LAYER_CREATE_HINT, e as AlignFloatBar, k as CANVAS_FIELD_SECTIONS, n as CanvasSurface, f as ContentTypePill, a as ContextMenu, te as DropdownMenu, B as ExpressionCompletionPopup, L as FIELD_SECTIONS_BY_TYPE, F as FONT_PICKER_KEY, l as FindBar, m as GuidesOverlay, le as HelpDialog, w as IMAGE_UPLOAD_KEY, C as LayerPanel, de as PACKAGE_NAME, S as PANEL_ADD_MENU, R as PanelIcon, j as PropertyField, I as PropertyPanel, d as Ruler, oe as StatusBar, c as TextEditingOverlay, z as applyCompletion, O as controlRegistry, u as createGizmoOverlayPainter, h as createRafScheduler, G as detectShortcutPlatform, t as drawCreateRubberBand, s as drawFindMatches, p as drawSelectionGizmo, Y as expressionCompletionSource, q as expressionFieldContext, E as fieldSectionsForPath, D as fieldSectionsForType, ie as formatLayerGeometry, ae as formatLayerPath, T as injectFontPicker, M as injectImageUpload, W as isEditableEventTarget, y as isUpperHalf, N as layerRoleAt, V as measureCursorAnchor, A as readField, Z as rowsPathCompletionSource, H as shortcutActionLabel, X as uploadFileFromDom, re as useDataSourceSchema, r as useDpr, ne as useDropdownMenu, J as useExpressionCompletion, o as useFindSession, ce as useHistory, x as useLayerPanel, Q as usePathCompletion, P as usePropertyPanel, $ as useSelection, ue as useShortcuts, se as useShortcutsHelp, g as useTextEditing, K as useTransientFeedback, ee as useViewport, i as watchDprChanges };
@@ -1,4 +1,4 @@
1
- import { LayerType } from '@hankchen/canvas-editor';
1
+ import { LayerType, TextPresetId } from '@hankchen/canvas-editor';
2
2
  /** 新增菜单项(spec §2.1):四类图层武装画拉(drag-create 工单 03);模板表带 rowsPath 必填表单 */
3
3
  export type AddMenuKind = {
4
4
  kind: 'layer';
@@ -10,7 +10,20 @@ export type AddMenuKind = {
10
10
  label: string;
11
11
  title: string;
12
12
  };
13
+ /** 文本预设项(text-defaults 工单 02,spec 决策 5):面板专用入口——应用即写新层样式槽 + 武装画拉 */
14
+ export type AddTextPresetKind = {
15
+ kind: 'text-preset';
16
+ preset: TextPresetId;
17
+ label: string;
18
+ title: string;
19
+ };
13
20
  export declare const ADD_MENU: readonly AddMenuKind[];
21
+ /** 文本预设三项(text-defaults 工单 02,spec 决策 4):从内核 TEXT_PRESETS 派生
22
+ * (字号单一事实源,内核改档位文案自动跟随),v1 只定字号——字体缺口由新层样式槽补 */
23
+ export declare const ADD_TEXT_PRESET_MENU: readonly AddTextPresetKind[];
24
+ /** 面板「+」完整序(text-defaults 工单 02,spec 决策 5):文本预设三项插在「文本层」之后;
25
+ * 工具栏派生视图 ADD_LAYER_MENU 不含预设(预设只属面板) */
26
+ export declare const PANEL_ADD_MENU: readonly (AddMenuKind | AddTextPresetKind)[];
14
27
  /** 层型项视图(工具栏「+插入▾」消费,editor-top-toolbar 工单 03):ADD_MENU 的
15
28
  * 四类图层项,模板表项不进工具栏 */
16
29
  export declare const ADD_LAYER_MENU: readonly Extract<AddMenuKind, {
@@ -4,4 +4,4 @@
4
4
  */
5
5
  export { default as LayerPanel } from './LayerPanel';
6
6
  export { isUpperHalf, useLayerPanel, type LayerPanelBinding } from './useLayerPanel';
7
- export { ADD_LAYER_MENU, ADD_MENU, type AddMenuKind } from './addMenu';
7
+ export { ADD_LAYER_MENU, ADD_MENU, ADD_TEXT_PRESET_MENU, PANEL_ADD_MENU, type AddMenuKind, type AddTextPresetKind, } from './addMenu';