@hankchen/canvas-editor-react 0.0.0-stage → 1.0.1

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 (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +157 -2
  3. package/dist/DropdownMenu-CCvv55NI.js +967 -0
  4. package/dist/PanelIcon-cQ-hx-Ky.js +87 -0
  5. package/dist/Tooltip-BAFJN0xP.js +815 -0
  6. package/dist/canvas/AlignFloatBar.d.ts +6 -0
  7. package/dist/canvas/CanvasSurface.d.ts +13 -0
  8. package/dist/canvas/ContextMenu.d.ts +14 -0
  9. package/dist/canvas/EditOverlayToolbar.d.ts +30 -0
  10. package/dist/canvas/FindBar.d.ts +13 -0
  11. package/dist/canvas/GuidesOverlay.d.ts +19 -0
  12. package/dist/canvas/Ruler.d.ts +32 -0
  13. package/dist/canvas/TextEditingOverlay.d.ts +22 -0
  14. package/dist/canvas/createBand.d.ts +6 -0
  15. package/dist/canvas/findHighlight.d.ts +12 -0
  16. package/dist/canvas/gizmo.d.ts +24 -0
  17. package/dist/canvas/guideSnap.d.ts +5 -0
  18. package/dist/canvas/index.d.ts +24 -0
  19. package/dist/canvas/resizeHandles.d.ts +3 -0
  20. package/dist/canvas/scheduler.d.ts +2 -0
  21. package/dist/canvas/useDpr.d.ts +9 -0
  22. package/dist/canvas/useFindSession.d.ts +12 -0
  23. package/dist/canvas/useTextEditing.d.ts +90 -0
  24. package/dist/canvas-jJ7OaUvZ.js +2171 -0
  25. package/dist/canvas.js +2 -0
  26. package/dist/chevron-down-D0_YGxvV.js +359 -0
  27. package/dist/createLucideIcon-CLd1sc0f.js +140 -0
  28. package/dist/index.d.ts +19 -0
  29. package/dist/index.js +16 -0
  30. package/dist/layer-panel/LayerPanel.d.ts +6 -0
  31. package/dist/layer-panel/TemplateTableForm.d.ts +10 -0
  32. package/dist/layer-panel/addMenu.d.ts +68 -0
  33. package/dist/layer-panel/index.d.ts +11 -0
  34. package/dist/layer-panel/useLayerPanel.d.ts +12 -0
  35. package/dist/layer-panel-DIfOb40N.js +779 -0
  36. package/dist/layer-panel.js +2 -0
  37. package/dist/mergeKey--xr8gdWl.js +694 -0
  38. package/dist/property-panel/PropertyField.d.ts +39 -0
  39. package/dist/property-panel/PropertyPanel.d.ts +5 -0
  40. package/dist/property-panel/controlStyles.d.ts +17 -0
  41. package/dist/property-panel/controls.d.ts +42 -0
  42. package/dist/property-panel/fieldSchema.d.ts +142 -0
  43. package/dist/property-panel/fields/AlignField.d.ts +3 -0
  44. package/dist/property-panel/fields/AnchorDisclosureField.d.ts +3 -0
  45. package/dist/property-panel/fields/BooleanField.d.ts +3 -0
  46. package/dist/property-panel/fields/BorderField.d.ts +3 -0
  47. package/dist/property-panel/fields/BorderWidthInput.d.ts +9 -0
  48. package/dist/property-panel/fields/ColorField.d.ts +3 -0
  49. package/dist/property-panel/fields/FontField.d.ts +3 -0
  50. package/dist/property-panel/fields/ImageSrcField.d.ts +3 -0
  51. package/dist/property-panel/fields/NumberField.d.ts +3 -0
  52. package/dist/property-panel/fields/PaddingField.d.ts +3 -0
  53. package/dist/property-panel/fields/PairField.d.ts +3 -0
  54. package/dist/property-panel/fields/ResourceValueField.d.ts +3 -0
  55. package/dist/property-panel/fields/RowsPathField.d.ts +3 -0
  56. package/dist/property-panel/fields/SelectField.d.ts +3 -0
  57. package/dist/property-panel/fields/ShorthandModeButton.d.ts +7 -0
  58. package/dist/property-panel/fields/TextField.d.ts +3 -0
  59. package/dist/property-panel/fields/TextareaField.d.ts +3 -0
  60. package/dist/property-panel/fields/ValueTypeSegmented.d.ts +8 -0
  61. package/dist/property-panel/fields/index.d.ts +18 -0
  62. package/dist/property-panel/fields/intrinsicSize.d.ts +9 -0
  63. package/dist/property-panel/imageUpload.d.ts +11 -0
  64. package/dist/property-panel/index.d.ts +14 -0
  65. package/dist/property-panel/shorthand.d.ts +28 -0
  66. package/dist/property-panel/usePropertyPanel.d.ts +67 -0
  67. package/dist/property-panel/useShorthandMode.d.ts +17 -0
  68. package/dist/property-panel-DD45Myee.js +1861 -0
  69. package/dist/property-panel.js +3 -0
  70. package/dist/resourceTemplate-B4QRWGq7.js +33 -0
  71. package/dist/shared/DropdownMenu.d.ts +18 -0
  72. package/dist/shared/ExpressionCompletionPopup.d.ts +11 -0
  73. package/dist/shared/ExpressionPathPicker.d.ts +23 -0
  74. package/dist/shared/HelpDialog.d.ts +10 -0
  75. package/dist/shared/PanelIcon.d.ts +11 -0
  76. package/dist/shared/Tooltip.d.ts +11 -0
  77. package/dist/shared/completion.d.ts +73 -0
  78. package/dist/shared/completionAnchor.d.ts +28 -0
  79. package/dist/shared/editableTarget.d.ts +14 -0
  80. package/dist/shared/expressionContext.d.ts +22 -0
  81. package/dist/shared/fontPicker.d.ts +13 -0
  82. package/dist/shared/index.d.ts +42 -0
  83. package/dist/shared/mergeKey.d.ts +2 -0
  84. package/dist/shared/pathPickerModel.d.ts +24 -0
  85. package/dist/shared/popupPosition.d.ts +41 -0
  86. package/dist/shared/resourceTemplate.d.ts +7 -0
  87. package/dist/shared/rowsPathPickerSource.d.ts +15 -0
  88. package/dist/shared/shortcutsHelp.d.ts +30 -0
  89. package/dist/shared/uploadFile.d.ts +2 -0
  90. package/dist/shared/useCnTheme.d.ts +11 -0
  91. package/dist/shared/useDataSourceSchema.d.ts +10 -0
  92. package/dist/shared/useDoc.d.ts +2 -0
  93. package/dist/shared/useDocumentExchange.d.ts +21 -0
  94. package/dist/shared/useDropdownMenu.d.ts +163 -0
  95. package/dist/shared/useExpressionCompletion.d.ts +35 -0
  96. package/dist/shared/useExpressionDiagnostics.d.ts +29 -0
  97. package/dist/shared/useHistory.d.ts +6 -0
  98. package/dist/shared/useSelection.d.ts +2 -0
  99. package/dist/shared/useShortcuts.d.ts +2 -0
  100. package/dist/shared/useShortcutsHelp.d.ts +8 -0
  101. package/dist/shared/useTransientFeedback.d.ts +9 -0
  102. package/dist/shared/useViewport.d.ts +2 -0
  103. package/dist/shared-QI04Xk-a.js +236 -0
  104. package/dist/shared.js +9 -0
  105. package/dist/status-bar/StatusBar.d.ts +14 -0
  106. package/dist/status-bar/index.d.ts +9 -0
  107. package/dist/status-bar/layerGeometryLabel.d.ts +13 -0
  108. package/dist/status-bar/layerPathLabel.d.ts +2 -0
  109. package/dist/status-bar-Bt3TonDm.js +181 -0
  110. package/dist/status-bar.js +2 -0
  111. package/dist/style.css +2 -0
  112. package/dist/theme.css +420 -0
  113. package/dist/useDoc-B2LXNJV7.js +32 -0
  114. package/dist/useViewport-DXtOHYgJ.js +18 -0
  115. package/package.json +83 -3
package/dist/canvas.js ADDED
@@ -0,0 +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-jJ7OaUvZ.js";
2
+ export { n as AlignFloatBar, c as CanvasSurface, e as ContextMenu, l as EditOverlayToolbar, o as FindBar, m as GuidesOverlay, d as Ruler, g as TextEditingOverlay, u as createGizmoOverlayPainter, h as createRafScheduler, t as drawCreateRubberBand, s as drawFindMatches, p as drawSelectionGizmo, i as useDpr, a as useFindSession, r as useTextEditing, f as watchDprChanges };
@@ -0,0 +1,359 @@
1
+ import { t as e } from "./createLucideIcon-CLd1sc0f.js";
2
+ //#region ../../node_modules/.pnpm/@hankchen+canvas@2.2.0/node_modules/@hankchen/canvas/dist/index.js
3
+ var t = [
4
+ "top-left",
5
+ "top",
6
+ "top-right",
7
+ "left",
8
+ "center",
9
+ "right",
10
+ "bottom-left",
11
+ "bottom",
12
+ "bottom-right"
13
+ ], n = [
14
+ "left",
15
+ "center",
16
+ "right"
17
+ ], r = [
18
+ "top",
19
+ "center",
20
+ "bottom"
21
+ ], i = /* @__PURE__ */ ",(。(、(;(:(!(?(」(』()(】(》(〉(…(—(~(·(!(?(%(,(.(;(:()(](}".split("("), a = [
22
+ "「",
23
+ "『",
24
+ "(",
25
+ "【",
26
+ "《",
27
+ "〈",
28
+ "“",
29
+ "‘",
30
+ "(",
31
+ "[",
32
+ "{"
33
+ ], o = new Intl.Segmenter(void 0, { granularity: "grapheme" });
34
+ function s(e) {
35
+ return e === "" ? [] : Array.from(o.segment(e), (e) => e.segment);
36
+ }
37
+ var c = .55;
38
+ function l(e) {
39
+ return e.length === 1 && e >= " " && e <= "~";
40
+ }
41
+ function u(e) {
42
+ return { measure(t) {
43
+ let n = 0;
44
+ for (let e of t) n += l(e) ? c : 1;
45
+ return n * e;
46
+ } };
47
+ }
48
+ var d = (e, t) => u(t);
49
+ function f(e) {
50
+ return e.join("");
51
+ }
52
+ function p(e) {
53
+ return e === " " || e === " ";
54
+ }
55
+ function m(e) {
56
+ return i.includes(e);
57
+ }
58
+ function h(e) {
59
+ return a.includes(e);
60
+ }
61
+ function g() {
62
+ return (e, t, n) => {
63
+ if (e === "") return [];
64
+ let r = [];
65
+ for (let i of e.split("\n")) {
66
+ let e = s(i);
67
+ if (e.length === 0) {
68
+ r.push("");
69
+ continue;
70
+ }
71
+ let a = [];
72
+ for (let i of e) {
73
+ if (a.length === 0 || n.measure(f(a) + i) <= t) {
74
+ a.push(i);
75
+ continue;
76
+ }
77
+ let e = _(a, i);
78
+ e.line.length > 0 && r.push(f(e.line)), a = e.rest;
79
+ }
80
+ a.length > 0 && r.push(f(a));
81
+ }
82
+ return r;
83
+ };
84
+ }
85
+ function _(e, t) {
86
+ let n = e, r = [t], i = v(e);
87
+ if (i !== -1) {
88
+ let a = +(e[i] === "-"), o = e.slice(0, i + a), s = e.slice(i + 1);
89
+ o.length > 0 && (n = o, r = [...s, t]);
90
+ }
91
+ return n = b(n), r = x(r), y(n, r);
92
+ }
93
+ function v(e) {
94
+ for (let t = e.length - 1; t > 0; t--) {
95
+ let n = e[t];
96
+ if (n === " " || n === "-") return t;
97
+ }
98
+ return -1;
99
+ }
100
+ function y(e, t) {
101
+ for (; t.length > 0 && m(t[0]);) e = [...e, t[0]], t = t.slice(1);
102
+ for (; e.length > 0 && h(e[e.length - 1]);) t = [e[e.length - 1], ...t], e = e.slice(0, -1);
103
+ return {
104
+ line: e,
105
+ rest: t
106
+ };
107
+ }
108
+ function b(e) {
109
+ for (; e.length > 0 && p(e[e.length - 1]);) e = e.slice(0, -1);
110
+ return e;
111
+ }
112
+ function x(e) {
113
+ for (; e.length > 0 && p(e[0]);) e = e.slice(1);
114
+ return e;
115
+ }
116
+ var S = g();
117
+ function C(e) {
118
+ return {
119
+ lineBreaker: e?.lineBreaker ?? S,
120
+ measurerFactory: e?.measurerFactory ?? d
121
+ };
122
+ }
123
+ function w(e) {
124
+ return e === 0 ? 0 : e;
125
+ }
126
+ function T(e) {
127
+ return w(Math.trunc(e));
128
+ }
129
+ function E(e, t) {
130
+ switch (e.type) {
131
+ case "TextLayer": {
132
+ if (!e.shape.autoWidth) return e.shape.width;
133
+ let { measurerFactory: n } = C(t), r = n(e.font, e.fontSize), i = 0;
134
+ for (let t of e.text.split("\n")) i = Math.max(i, r.measure(t));
135
+ return T(Math.ceil(i)) + T(e.shape.padding.left + e.shape.padding.right);
136
+ }
137
+ default: return e.shape.width;
138
+ }
139
+ }
140
+ function D(e) {
141
+ return Math.ceil(e.fontSize * e.shape.lineHeight);
142
+ }
143
+ function O(e, t) {
144
+ if (!e.autowrap) return [e.text];
145
+ let { lineBreaker: n, measurerFactory: r } = C(t);
146
+ return n(e.text, A(e, t), r(e.font, e.fontSize));
147
+ }
148
+ function k(e, t) {
149
+ switch (e.type) {
150
+ case "TextLayer": {
151
+ if (!e.shape.autoHeight) return e.shape.height;
152
+ let n = T(e.shape.padding.top + e.shape.padding.bottom);
153
+ return e.autowrap ? D(e) * O(e, t).length + n : e.text === "" ? n : D(e) + n;
154
+ }
155
+ case "QrCodeLayer": return !e.shape.autoHeight && e.shape.height > 0 ? e.shape.height : E(e, t);
156
+ default: return e.shape.height;
157
+ }
158
+ }
159
+ function A(e, t) {
160
+ return T(E(e, t) - e.shape.padding.left - e.shape.padding.right);
161
+ }
162
+ function j(e, t) {
163
+ return T(k(e, t) - e.shape.padding.top - e.shape.padding.bottom);
164
+ }
165
+ function M(e, t, n, r, i) {
166
+ return {
167
+ x: e === "top-right" || e === "right" || e === "bottom-right" ? t - r : e === "top" || e === "center" || e === "bottom" ? T((t - r) / 2) : 0,
168
+ y: e === "bottom-left" || e === "bottom" || e === "bottom-right" ? n - i : e === "left" || e === "center" || e === "right" ? T((n - i) / 2) : 0
169
+ };
170
+ }
171
+ function N(e, t, n, r, i, a) {
172
+ let o = E(e, a), s = k(e, a), c = M(e.position.anchor, r, i, o, s), l = t + c.x + e.position.x, u = n + c.y + e.position.y;
173
+ return {
174
+ x: l,
175
+ y: u,
176
+ width: o,
177
+ height: s,
178
+ contentX: l + e.shape.padding.left,
179
+ contentY: u + e.shape.padding.top,
180
+ contentWidth: A(e, a),
181
+ contentHeight: j(e, a)
182
+ };
183
+ }
184
+ //#endregion
185
+ //#region ../../node_modules/.pnpm/lucide-react@1.84.0_@types+react@19.3.3_react@19.3.1/node_modules/lucide-react/dist/esm/icons/align-center-horizontal.mjs
186
+ var P = {
187
+ name: "align-center-horizontal",
188
+ size: 24,
189
+ node: [
190
+ ["path", {
191
+ d: "M2 12h20",
192
+ key: "9i4pu4"
193
+ }],
194
+ ["path", {
195
+ d: "M10 16v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4",
196
+ key: "11f1s0"
197
+ }],
198
+ ["path", {
199
+ d: "M10 8V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4",
200
+ key: "t14dx9"
201
+ }],
202
+ ["path", {
203
+ d: "M20 16v1a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-1",
204
+ key: "1w07xs"
205
+ }],
206
+ ["path", {
207
+ d: "M14 8V7c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v1",
208
+ key: "1apec2"
209
+ }]
210
+ ]
211
+ };
212
+ P.node;
213
+ var F = e(P), I = {
214
+ name: "align-center-vertical",
215
+ size: 24,
216
+ node: [
217
+ ["path", {
218
+ d: "M12 2v20",
219
+ key: "t6zp3m"
220
+ }],
221
+ ["path", {
222
+ d: "M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4",
223
+ key: "14d6g8"
224
+ }],
225
+ ["path", {
226
+ d: "M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4",
227
+ key: "1e2lrw"
228
+ }],
229
+ ["path", {
230
+ d: "M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1",
231
+ key: "1fkdwx"
232
+ }],
233
+ ["path", {
234
+ d: "M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1",
235
+ key: "1euafb"
236
+ }]
237
+ ]
238
+ };
239
+ I.node;
240
+ var L = e(I), R = {
241
+ name: "align-end-horizontal",
242
+ size: 24,
243
+ node: [
244
+ ["rect", {
245
+ width: "6",
246
+ height: "16",
247
+ x: "4",
248
+ y: "2",
249
+ rx: "2",
250
+ key: "z5wdxg"
251
+ }],
252
+ ["rect", {
253
+ width: "6",
254
+ height: "9",
255
+ x: "14",
256
+ y: "9",
257
+ rx: "2",
258
+ key: "um7a8w"
259
+ }],
260
+ ["path", {
261
+ d: "M22 22H2",
262
+ key: "19qnx5"
263
+ }]
264
+ ]
265
+ };
266
+ R.node;
267
+ var z = e(R), B = {
268
+ name: "align-end-vertical",
269
+ size: 24,
270
+ node: [
271
+ ["rect", {
272
+ width: "16",
273
+ height: "6",
274
+ x: "2",
275
+ y: "4",
276
+ rx: "2",
277
+ key: "10wcwx"
278
+ }],
279
+ ["rect", {
280
+ width: "9",
281
+ height: "6",
282
+ x: "9",
283
+ y: "14",
284
+ rx: "2",
285
+ key: "4p5bwg"
286
+ }],
287
+ ["path", {
288
+ d: "M22 22V2",
289
+ key: "12ipfv"
290
+ }]
291
+ ]
292
+ };
293
+ B.node;
294
+ var V = e(B), H = {
295
+ name: "align-start-horizontal",
296
+ size: 24,
297
+ node: [
298
+ ["rect", {
299
+ width: "6",
300
+ height: "16",
301
+ x: "4",
302
+ y: "6",
303
+ rx: "2",
304
+ key: "1n4dg1"
305
+ }],
306
+ ["rect", {
307
+ width: "6",
308
+ height: "9",
309
+ x: "14",
310
+ y: "6",
311
+ rx: "2",
312
+ key: "17khns"
313
+ }],
314
+ ["path", {
315
+ d: "M22 2H2",
316
+ key: "fhrpnj"
317
+ }]
318
+ ]
319
+ };
320
+ H.node;
321
+ var U = e(H), W = {
322
+ name: "align-start-vertical",
323
+ size: 24,
324
+ node: [
325
+ ["rect", {
326
+ width: "9",
327
+ height: "6",
328
+ x: "6",
329
+ y: "14",
330
+ rx: "2",
331
+ key: "lpm2y7"
332
+ }],
333
+ ["rect", {
334
+ width: "16",
335
+ height: "6",
336
+ x: "6",
337
+ y: "4",
338
+ rx: "2",
339
+ key: "rdj6ps"
340
+ }],
341
+ ["path", {
342
+ d: "M2 2v20",
343
+ key: "1ivd8o"
344
+ }]
345
+ ]
346
+ };
347
+ W.node;
348
+ var G = e(W), K = {
349
+ name: "chevron-down",
350
+ size: 24,
351
+ node: [["path", {
352
+ d: "m6 9 6 6 6-6",
353
+ key: "qrunsl"
354
+ }]]
355
+ };
356
+ K.node;
357
+ var q = e(K);
358
+ //#endregion
359
+ export { z as a, t as c, j as d, A as f, V as i, n as l, G as n, L as o, N as p, U as r, F as s, q as t, r as u };
@@ -0,0 +1,140 @@
1
+ import { createContext as e, createElement as t, forwardRef as n, useContext as r } from "react";
2
+ //#region ../../node_modules/.pnpm/lucide-react@1.84.0_@types+react@19.3.3_react@19.3.1/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs
3
+ var i = (e) => (e.match(/\d+[xX]\d+|[A-Z]?[a-z]+|[A-Z]|\d+/g) ?? []).join("-").toLowerCase();
4
+ //#endregion
5
+ //#region ../../node_modules/.pnpm/lucide-react@1.84.0_@types+react@19.3.3_react@19.3.1/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.mjs
6
+ function a(e, t, n = []) {
7
+ if (t == null) throw Error("[lucide]: iconNode is required when icon name is used");
8
+ return {
9
+ name: i(e),
10
+ size: 24,
11
+ node: t,
12
+ ...n.length > 0 ? { aliases: n } : {}
13
+ };
14
+ }
15
+ //#endregion
16
+ //#region ../../node_modules/.pnpm/lucide-react@1.84.0_@types+react@19.3.3_react@19.3.1/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs
17
+ var o = (e) => {
18
+ let t = "", n = !1;
19
+ for (let r of e) {
20
+ if (r === "-" || r === "_" || r <= " ") {
21
+ n = t.length > 0;
22
+ continue;
23
+ }
24
+ t.length === 0 ? t += r.toLowerCase() : t += n ? r.toUpperCase() : r, n = !1;
25
+ }
26
+ return t;
27
+ }, s = (e) => {
28
+ let t = o(e);
29
+ return t.charAt(0).toUpperCase() + t.slice(1);
30
+ }, c = (...e) => {
31
+ let t = /* @__PURE__ */ new Set();
32
+ for (let n of e) if (typeof n == "string") for (let e of n.split(/\s+/)) e && t.add(e);
33
+ return [...t].join(" ");
34
+ }, l = {
35
+ xmlns: "http://www.w3.org/2000/svg",
36
+ width: 24,
37
+ height: 24,
38
+ viewBox: "0 0 24 24",
39
+ fill: "none",
40
+ stroke: "currentColor",
41
+ "stroke-width": 2,
42
+ "stroke-linecap": "round",
43
+ "stroke-linejoin": "round"
44
+ };
45
+ //#endregion
46
+ //#region ../../node_modules/.pnpm/lucide-react@1.84.0_@types+react@19.3.3_react@19.3.1/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.mjs
47
+ function u(e) {
48
+ return e != null;
49
+ }
50
+ function d(e, t = {}) {
51
+ let n = t.attributeNames ?? {}, r = (e) => n[e] ?? e, i = e.size ?? e.width ?? l.width, a = e.size ?? e.height ?? l.height, o = e.aliases?.filter((e) => typeof e == "string" && e.trim() !== "").map((e) => `lucide-${e}`) ?? [], s = [...e.name ? [`lucide-${e.name}`] : [], ...o], d = t.className?.split(" ").filter(Boolean) ?? [], f = t.includeDefaultClasses === !1 ? c(...d) : c("lucide", ...s, ...d), p = t.strokeWidth ?? l["stroke-width"];
52
+ if (t.absoluteStrokeWidth) {
53
+ let n = Number(p) * Number(e.size ?? e.width ?? l.width) / Number(t.size ?? t.width ?? l.width);
54
+ Number.isFinite(n) && (p = n);
55
+ }
56
+ return [
57
+ "svg",
58
+ {
59
+ ...Object.entries(l).reduce((e, [t, n]) => (e[r(t)] = n, e), {}),
60
+ ..."color" in t && t.color && { [r("stroke")]: t.color },
61
+ ..."size" in t && u(t.size) && {
62
+ [r("width")]: t.size,
63
+ [r("height")]: t.size
64
+ },
65
+ ..."width" in t && u(t.width) && { [r("width")]: t.width },
66
+ ..."height" in t && u(t.height) && { [r("height")]: t.height },
67
+ [r("stroke-width")]: p,
68
+ ...f && { [r("class")]: f },
69
+ [r("viewBox")]: `0 0 ${i} ${a}`,
70
+ ...t.hasA11yProp === !1 ? { [r("aria-hidden")]: "true" } : {},
71
+ ..."attributes" in t && t.attributes
72
+ },
73
+ e.node.map((e) => {
74
+ let [n, i, a] = e, o = t.nonScalingStroke ? {
75
+ [r("vector-effect")]: "non-scaling-stroke",
76
+ ...i
77
+ } : i;
78
+ return a ? [
79
+ n,
80
+ o,
81
+ a
82
+ ] : [n, o];
83
+ })
84
+ ];
85
+ }
86
+ //#endregion
87
+ //#region ../../node_modules/.pnpm/lucide-react@1.84.0_@types+react@19.3.3_react@19.3.1/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.mjs
88
+ function f(e, t = {}) {
89
+ return d(e, {
90
+ ...t,
91
+ attributeNames: {
92
+ ...t.attributeNames,
93
+ class: "className",
94
+ "stroke-width": "strokeWidth",
95
+ "stroke-linecap": "strokeLinecap",
96
+ "stroke-linejoin": "strokeLinejoin",
97
+ "vector-effect": "vectorEffect"
98
+ }
99
+ });
100
+ }
101
+ //#endregion
102
+ //#region ../../node_modules/.pnpm/lucide-react@1.84.0_@types+react@19.3.3_react@19.3.1/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs
103
+ var p = (e) => {
104
+ if (typeof e != "object" || !e) return !1;
105
+ for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && (t.startsWith("aria-") || t === "role" || t === "title") && e[t] != null) return !0;
106
+ return !1;
107
+ }, m = e({}), h = () => r(m), g = n(({ color: e, size: n, width: r, height: i, strokeWidth: a, absoluteStrokeWidth: o, nonScalingStroke: s, className: l = "", children: u, iconNode: d = [], icon: m = {
108
+ node: d,
109
+ aliases: [],
110
+ size: 24
111
+ }, ...g }, _) => {
112
+ let { size: v = 24, strokeWidth: y = 2, absoluteStrokeWidth: b = !1, nonScalingStroke: x = !1, color: S = "currentColor", className: C = "" } = h() ?? {}, w = !!u || p(g), [T, E, D = []] = f(m, {
113
+ color: e ?? S,
114
+ width: r ?? n ?? v,
115
+ height: i ?? n ?? v,
116
+ strokeWidth: a ?? y,
117
+ absoluteStrokeWidth: o ?? b,
118
+ nonScalingStroke: s ?? x,
119
+ className: c(C, l),
120
+ hasA11yProp: w,
121
+ attributes: g
122
+ });
123
+ return t(T, {
124
+ ref: _,
125
+ ...E
126
+ }, [...D.map(([e, n]) => t(e, n)), ...Array.isArray(u) ? u : [u]]);
127
+ });
128
+ //#endregion
129
+ //#region ../../node_modules/.pnpm/lucide-react@1.84.0_@types+react@19.3.3_react@19.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.mjs
130
+ function _(e, r = [], i = []) {
131
+ let o = typeof e == "string" ? a(e, r, i) : e, c = n(({ className: e, ...n }, r) => t(g, {
132
+ ref: r,
133
+ icon: o,
134
+ className: e,
135
+ ...n
136
+ }));
137
+ return o.name && (c.displayName = s(o.name)), c;
138
+ }
139
+ //#endregion
140
+ export { _ as t };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @hankchen/canvas-editor-react React 19 薄绑定公共出口。
3
+ *
4
+ * src 按领域分域组织:canvas(画布表面及其覆盖画笔/调度/DPR 桥)、
5
+ * property-panel(schema 驱动属性面板)、layer-panel(图层面板)、
6
+ * status-bar(状态栏)、shared(跨域切片桥)。域之间禁止
7
+ * 横向 import,跨域消费一律收口 shared——
8
+ * 由 dependency-cruiser 域隔离规则(editor-react-*-isolation)锁定。
9
+ * 宿主可从包根取全量符号,也可按域子路径细粒度引用
10
+ * (@hankchen/canvas-editor-react/canvas 等,见 package.json exports)。
11
+ * 红线:只依赖 editor 内核,不得绕过内核直接 import canvas、
12
+ * browser-renderer 或 editor-vue(spec 20261201-d840 逻辑自持镜像)。
13
+ */
14
+ export declare const PACKAGE_NAME: "@hankchen/canvas-editor-react";
15
+ export * from './canvas/index.js';
16
+ export * from './property-panel/index.js';
17
+ export * from './layer-panel/index.js';
18
+ export * from './status-bar/index.js';
19
+ export * from './shared/index.js';
package/dist/index.js ADDED
@@ -0,0 +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-jJ7OaUvZ.js";
2
+ import { t as _ } from "./PanelIcon-cQ-hx-Ky.js";
3
+ import { a as v, c as y, i as b, n as x, o as S, r as C, s as w, t as T } from "./Tooltip-BAFJN0xP.js";
4
+ import { n as E, t as D } from "./resourceTemplate-B4QRWGq7.js";
5
+ import { a as O, c as k, i as A, l as j, n as M, o as N, r as P, s as F, t as I } from "./layer-panel-DIfOb40N.js";
6
+ import { a as L, f as R, i as z, l as B, n as V, o as H, p as U, r as W, t as G, u as K } from "./DropdownMenu-CCvv55NI.js";
7
+ import { a as q, c as J, d as Y, f as X, l as Z, m as Q, n as $, p as ee, r as te, s as ne, t as re, u as ie } from "./mergeKey--xr8gdWl.js";
8
+ import { a as ae, c as oe, d as se, f as ce, i as le, l as ue, n as de, o as fe, r as pe, s as me, t as he, u as ge } from "./property-panel-DD45Myee.js";
9
+ import { n as _e, t as ve } from "./useViewport-DXtOHYgJ.js";
10
+ import { n as ye, r as be, t as xe } from "./status-bar-Bt3TonDm.js";
11
+ import { n as Se } from "./useDoc-B2LXNJV7.js";
12
+ import { a as Ce, i as we, n as Te, r as Ee, t as De } from "./shared-QI04Xk-a.js";
13
+ //#region src/index.ts
14
+ var Oe = "@hankchen/canvas-editor-react";
15
+ //#endregion
16
+ export { O as ADD_LAYER_MENU, N as ADD_MENU, F as ADD_RATIO_PRESET_MENU, k as ADD_TEXT_PRESET_MENU, H as ARM_LAYER_CREATE_HINT, n as AlignFloatBar, me as CANVAS_FIELD_SECTIONS, c as CanvasSurface, e as ContextMenu, W as DATA_SOURCE_GATE_HINT, G as DropdownMenu, l as EditOverlayToolbar, ee as ExpressionCompletionPopup, x as ExpressionPathPicker, oe as FIELD_SECTIONS_BY_TYPE, $ as FONT_PICKER_KEY, o as FindBar, m as GuidesOverlay, Ce as HelpDialog, ae as IMAGE_UPLOAD_KEY, I as LayerPanel, Oe as PACKAGE_NAME, j as PANEL_ADD_MENU, C as POPUP_GAP, b as POPUP_MARGIN, _ as PanelIcon, de as PropertyField, he as PropertyPanel, d as Ruler, xe as StatusBar, A as TemplateTableForm, g as TextEditingOverlay, T as Tooltip, ie as applyCompletion, D as attachResourceTemplate, le as controlRegistry, u as createGizmoOverlayPainter, h as createRafScheduler, B as detectShortcutPlatform, t as drawCreateRubberBand, s as drawFindMatches, p as drawSelectionGizmo, Y as expressionCompletionSource, q as expressionDiagnosticHint, X as expressionFieldContext, ue as fieldSectionsForPath, ge as fieldSectionsForType, ye as formatLayerGeometry, be as formatLayerPath, te as injectFontPicker, fe as injectImageUpload, U as isEditableEventTarget, M as isUpperHalf, se as layerRoleAt, Z as measureCursorAnchor, S as pathPickerEntries, v as placePopupInViewport, ce as readField, w as rowsPathPickerSource, y as rowsPathValueDrifts, re as selectionFieldMergeKey, K as shortcutActionLabel, E as stripResourceTemplate, Q as uploadFileFromDom, Te as useCnTheme, z as useDataSourceSchema, L as useDataSourceSchemaRejection, we as useDocumentExchange, i as useDpr, V as useDropdownMenu, J as useExpressionCompletion, ne as useExpressionDiagnostics, a as useFindSession, Ee as useHistory, P as useLayerPanel, pe as usePropertyPanel, _e as useSelection, De as useShortcuts, Se as useShortcutsHelp, r as useTextEditing, R as useTransientFeedback, ve as useViewport, f as watchDprChanges };
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ import { EditorSession } from '@hankchen/canvas-editor';
3
+ export interface LayerPanelProps {
4
+ editor: EditorSession;
5
+ }
6
+ export declare function LayerPanel({ editor }: LayerPanelProps): ReactNode;
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { EditorSession } from '@hankchen/canvas-editor';
3
+ export interface TemplateTableFormProps {
4
+ editor: EditorSession;
5
+ /** 确认(选中数组才可达):载荷 = 所选行数组路径,武装与否归宿主 */
6
+ onConfirm: (rowsPath: string) => void;
7
+ /** 取消:零副作用(草稿/错误态随实例收挂即弃) */
8
+ onCancel: () => void;
9
+ }
10
+ export declare function TemplateTableForm({ editor, onConfirm, onCancel }: TemplateTableFormProps): ReactNode;
@@ -0,0 +1,68 @@
1
+ import { LayerType, RatioPresetId, TextPresetId } from '@hankchen/canvas-editor';
2
+ /** 新增菜单项:四类图层武装画拉;模板表带 rowsPath 必填表单。层型项不带
3
+ * children——工具栏派生视图 ADD_LAYER_MENU 的类型面天然平铺(预设只属面板二级) */
4
+ export type AddMenuKind = {
5
+ kind: 'layer';
6
+ type: LayerType;
7
+ label: string;
8
+ title: string;
9
+ } | {
10
+ kind: 'template-table';
11
+ label: string;
12
+ title: string;
13
+ };
14
+ /** 文本预设子项:「文本层」二级条目数据面——档位说明灰字后缀走底座 shortcut 槽
15
+ * (字号「40号」式),分发(armLayerCreate 带 preset)归消费面 */
16
+ export type AddTextPresetKind = {
17
+ kind: 'text-preset';
18
+ preset: TextPresetId;
19
+ label: string;
20
+ /** 档位说明灰字后缀(底座 DropdownMenuItem.shortcut 同缝) */
21
+ shortcut: string;
22
+ title: string;
23
+ };
24
+ /** 比例预设子项:「图片层」二级条目数据面——形状说明灰字后缀(正方形/横向/
25
+ * 纵向),free 档不入清单(ADR 0021「自由不经预设进入」) */
26
+ export type AddRatioPresetKind = {
27
+ kind: 'ratio-preset';
28
+ preset: RatioPresetId;
29
+ label: string;
30
+ /** 档位说明灰字后缀(底座 DropdownMenuItem.shortcut 同缝) */
31
+ shortcut: string;
32
+ title: string;
33
+ };
34
+ /** 面板树形条目:层型项可携预设二级 children(文本/图片两行),模板表沿
35
+ * AddMenuKind 原形态(表单入口非预设宿主) */
36
+ export type PanelAddMenuEntry = (Extract<AddMenuKind, {
37
+ kind: 'layer';
38
+ }> & {
39
+ children?: readonly (AddTextPresetKind | AddRatioPresetKind)[];
40
+ }) | Extract<AddMenuKind, {
41
+ kind: 'template-table';
42
+ }>;
43
+ export declare const ADD_MENU: readonly AddMenuKind[];
44
+ /** 文本预设三档:从内核 TEXT_PRESETS 派生(字号单一事实源,内核改档位文案自动
45
+ * 跟随),v1 只定字号——字体缺口由新层样式槽补;后缀 = 档位字号(40号/28号/
46
+ * 16号,同源自派生不抄写) */
47
+ export declare const ADD_TEXT_PRESET_MENU: readonly AddTextPresetKind[];
48
+ /** 比例预设五档:具名档从内核 RATIO_PRESETS 派生(比例与顺序单一事实源)——
49
+ * free 档不入清单(「自由」不经预设进入,一级图片层本体即自由);档位 id 即
50
+ * 上屏文案,后缀 = 形状说明(同源自派生)。title 带比例说明与画拉提示;Shift
51
+ * 手势瞬时反转随档位给反向提示(具名档按 Shift 临时自由) */
52
+ export declare const ADD_RATIO_PRESET_MENU: readonly AddRatioPresetKind[];
53
+ /** 面板「+」树形序:ADD_MENU 恒等派生基座上映射 children——文本层挂文本预设
54
+ * 三档、图片层挂比例具名五档,其余行原样(无二级);一级与工具栏「+插入▾」
55
+ * 同构。工具栏派生视图 ADD_LAYER_MENU = ADD_MENU 平铺不变(预设只属面板二级) */
56
+ export declare const PANEL_ADD_MENU: readonly PanelAddMenuEntry[];
57
+ /** 层型项视图(工具栏「+插入▾」消费):ADD_MENU 的四类图层项 + 模板表项收尾
58
+ * ——视图 = ADD_MENU 全量恒等派生,工具栏与面板一级同序同文案;分发差异(模板
59
+ * 表项弹层表单、四图层项直接武装)归消费面 */
60
+ export declare const ADD_LAYER_MENU: readonly AddMenuKind[];
61
+ /**
62
+ * 武装建层瞬时提示·带档变体:面板预设二级子项分发专用——「画拉建{层型}({档名})」
63
+ * 句式带档名让用户确认本次画拉吃的是哪一档(层型名与档名在分发点均已知,取自
64
+ * 本模块菜单常量);操作指引尾沿现句、复用 shared 的 ARM_LAYER_CREATE_HINT 常量
65
+ * (文案单点仍在 shared,改句两处自动跟随)。消费面仅 LayerPanel 分发点(单域),
66
+ * 按包落位规则不进 shared 出口。
67
+ */
68
+ export declare function armLayerCreatePresetHint(layerLabel: string, presetLabel: string): string;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 图层面板域出口(vue 包 layer-panel/index.ts 同源镜像):图层面板组件、共享模板
3
+ * 行路径表单(TemplateTableForm——面板菜单与工具栏弹层共用)、订阅切片桥
4
+ * (useLayerPanel + dragover 落点纯函数)与新增菜单数据面(ADD_MENU/ADD_LAYER_MENU
5
+ * ——工具栏「+插入▾」同源消费;面板树形 PANEL_ADD_MENU 挂预设二级,两族预设清单
6
+ * 面板专用且只入二级)。
7
+ */
8
+ export { LayerPanel } from './LayerPanel';
9
+ export { TemplateTableForm } from './TemplateTableForm';
10
+ export { isUpperHalf, useLayerPanel, type LayerPanelBinding } from './useLayerPanel';
11
+ export { ADD_LAYER_MENU, ADD_MENU, ADD_RATIO_PRESET_MENU, ADD_TEXT_PRESET_MENU, PANEL_ADD_MENU, type AddMenuKind, type AddRatioPresetKind, type AddTextPresetKind, type PanelAddMenuEntry, } from './addMenu';
@@ -0,0 +1,12 @@
1
+ import { EditorSession, LayerOutlineNode, LayerPath } from '@hankchen/canvas-editor';
2
+ export interface LayerPanelBinding {
3
+ readonly outline: readonly LayerOutlineNode[];
4
+ readonly selection: LayerPath | null;
5
+ readonly hovered: LayerPath | null;
6
+ /** 重命名会话:正在行内改名的根层路径;null = 非编辑态 */
7
+ readonly renaming: LayerPath | null;
8
+ }
9
+ export declare function useLayerPanel(editor: EditorSession): LayerPanelBinding;
10
+ /** dragover 落点判定:指针纵移落在目标行上半吗(行高退化时视为下半——jsdom/
11
+ * 隐藏行兜底) */
12
+ export declare function isUpperHalf(offsetY: number, rowHeight: number): boolean;