@hankchen/canvas-editor-vue 2.0.0 → 2.2.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,498 +0,0 @@
1
- import { computed as e, onScopeDispose as t, ref as n, shallowRef as r } from "vue";
2
- //#region ../canvas-editor/src/session/shortcuts.ts
3
- var i = {
4
- armCreateText: "TextLayer",
5
- armCreateTable: "TableLayer",
6
- armCreateQrCode: "QrCodeLayer",
7
- armCreateImage: "ImageLayer"
8
- }, a = [
9
- {
10
- combo: {
11
- key: "z",
12
- mod: !0,
13
- shift: !1
14
- },
15
- action: "undo",
16
- label: "撤销",
17
- group: "history"
18
- },
19
- {
20
- combo: {
21
- key: "z",
22
- mod: !0,
23
- shift: !0
24
- },
25
- action: "redo",
26
- label: "重做",
27
- group: "history"
28
- },
29
- {
30
- combo: {
31
- key: "y",
32
- mod: !0,
33
- shift: !1
34
- },
35
- action: "redo",
36
- label: "重做",
37
- group: "history"
38
- },
39
- {
40
- combo: {
41
- key: "c",
42
- mod: !0,
43
- shift: !1
44
- },
45
- action: "copy",
46
- label: "复制",
47
- group: "clipboard"
48
- },
49
- {
50
- combo: {
51
- key: "v",
52
- mod: !0,
53
- shift: !1
54
- },
55
- action: "paste",
56
- label: "粘贴",
57
- group: "clipboard"
58
- },
59
- {
60
- combo: {
61
- key: "d",
62
- mod: !0,
63
- shift: !1
64
- },
65
- action: "duplicate",
66
- label: "创建副本",
67
- group: "clipboard"
68
- },
69
- {
70
- combo: {
71
- key: "c",
72
- mod: !0,
73
- shift: !1,
74
- alt: !0,
75
- code: "KeyC"
76
- },
77
- action: "copyStyle",
78
- label: "复制样式",
79
- group: "clipboard"
80
- },
81
- {
82
- combo: {
83
- key: "v",
84
- mod: !0,
85
- shift: !1,
86
- alt: !0,
87
- code: "KeyV"
88
- },
89
- action: "pasteStyle",
90
- label: "粘贴样式",
91
- group: "clipboard"
92
- },
93
- {
94
- combo: {
95
- key: "delete",
96
- mod: !1,
97
- shift: !1
98
- },
99
- action: "delete",
100
- label: "删除图层",
101
- group: "layer"
102
- },
103
- {
104
- combo: {
105
- key: "backspace",
106
- mod: !1,
107
- shift: !1
108
- },
109
- action: "delete",
110
- label: "删除图层",
111
- group: "layer"
112
- },
113
- {
114
- combo: {
115
- key: "f2",
116
- mod: !1,
117
- shift: !1
118
- },
119
- action: "rename",
120
- label: "重命名图层",
121
- group: "layer"
122
- },
123
- {
124
- combo: {
125
- key: "f",
126
- mod: !0,
127
- shift: !1
128
- },
129
- action: "findReplace",
130
- label: "查找替换",
131
- group: "text"
132
- },
133
- {
134
- combo: {
135
- key: "r",
136
- mod: !1,
137
- shift: !0
138
- },
139
- action: "toggleRulers",
140
- label: "标尺显隐",
141
- group: "view"
142
- },
143
- {
144
- combo: {
145
- key: "l",
146
- mod: !0,
147
- shift: !0
148
- },
149
- action: "toggleLayerLock",
150
- label: "锁定/解锁图层",
151
- group: "layer"
152
- },
153
- {
154
- combo: {
155
- key: "h",
156
- mod: !0,
157
- shift: !0
158
- },
159
- action: "toggleLayerVisibility",
160
- label: "显示/隐藏图层",
161
- group: "layer"
162
- },
163
- {
164
- combo: {
165
- key: "]",
166
- mod: !0,
167
- shift: !1
168
- },
169
- action: "bringForward",
170
- label: "前移一层",
171
- group: "layer"
172
- },
173
- {
174
- combo: {
175
- key: "[",
176
- mod: !0,
177
- shift: !1
178
- },
179
- action: "sendBackward",
180
- label: "后移一层",
181
- group: "layer"
182
- },
183
- {
184
- combo: {
185
- key: "]",
186
- mod: !0,
187
- shift: !1,
188
- alt: !0,
189
- code: "BracketRight"
190
- },
191
- action: "bringToFront",
192
- label: "置顶",
193
- group: "layer"
194
- },
195
- {
196
- combo: {
197
- key: "[",
198
- mod: !0,
199
- shift: !1,
200
- alt: !0,
201
- code: "BracketLeft"
202
- },
203
- action: "sendToBack",
204
- label: "置底",
205
- group: "layer"
206
- },
207
- {
208
- combo: {
209
- key: "arrowup",
210
- mod: !1,
211
- shift: !1
212
- },
213
- action: "nudgeUp",
214
- label: "微调上移",
215
- group: "layer"
216
- },
217
- {
218
- combo: {
219
- key: "arrowdown",
220
- mod: !1,
221
- shift: !1
222
- },
223
- action: "nudgeDown",
224
- label: "微调下移",
225
- group: "layer"
226
- },
227
- {
228
- combo: {
229
- key: "arrowleft",
230
- mod: !1,
231
- shift: !1
232
- },
233
- action: "nudgeLeft",
234
- label: "微调左移",
235
- group: "layer"
236
- },
237
- {
238
- combo: {
239
- key: "arrowright",
240
- mod: !1,
241
- shift: !1
242
- },
243
- action: "nudgeRight",
244
- label: "微调右移",
245
- group: "layer"
246
- },
247
- {
248
- combo: {
249
- key: "arrowup",
250
- mod: !1,
251
- shift: !0
252
- },
253
- action: "nudgeUpCoarse",
254
- label: "大步上移",
255
- group: "layer"
256
- },
257
- {
258
- combo: {
259
- key: "arrowdown",
260
- mod: !1,
261
- shift: !0
262
- },
263
- action: "nudgeDownCoarse",
264
- label: "大步下移",
265
- group: "layer"
266
- },
267
- {
268
- combo: {
269
- key: "arrowleft",
270
- mod: !1,
271
- shift: !0
272
- },
273
- action: "nudgeLeftCoarse",
274
- label: "大步左移",
275
- group: "layer"
276
- },
277
- {
278
- combo: {
279
- key: "arrowright",
280
- mod: !1,
281
- shift: !0
282
- },
283
- action: "nudgeRightCoarse",
284
- label: "大步右移",
285
- group: "layer"
286
- },
287
- {
288
- combo: {
289
- key: "tab",
290
- mod: !1,
291
- shift: !1
292
- },
293
- action: "selectNextLayer",
294
- label: "循环选下一层",
295
- group: "layer"
296
- },
297
- {
298
- combo: {
299
- key: "tab",
300
- mod: !1,
301
- shift: !0
302
- },
303
- action: "selectPrevLayer",
304
- label: "循环选上一层",
305
- group: "layer"
306
- },
307
- {
308
- combo: {
309
- key: "t",
310
- mod: !1,
311
- shift: !1,
312
- code: "KeyT"
313
- },
314
- action: "armCreateText",
315
- label: "画拉建文本层",
316
- group: "layer"
317
- },
318
- {
319
- combo: {
320
- key: "g",
321
- mod: !1,
322
- shift: !1,
323
- code: "KeyG"
324
- },
325
- action: "armCreateTable",
326
- label: "画拉建表格",
327
- group: "layer"
328
- },
329
- {
330
- combo: {
331
- key: "q",
332
- mod: !1,
333
- shift: !1,
334
- code: "KeyQ"
335
- },
336
- action: "armCreateQrCode",
337
- label: "画拉建二维码",
338
- group: "layer"
339
- },
340
- {
341
- combo: {
342
- key: "i",
343
- mod: !1,
344
- shift: !1,
345
- code: "KeyI"
346
- },
347
- action: "armCreateImage",
348
- label: "画拉建图片",
349
- group: "layer"
350
- },
351
- {
352
- combo: {
353
- key: "0",
354
- mod: !0,
355
- shift: !1
356
- },
357
- action: "zoomReset",
358
- label: "缩放复位 100%",
359
- group: "view"
360
- },
361
- {
362
- combo: {
363
- key: "1",
364
- mod: !1,
365
- shift: !0,
366
- code: "Digit1"
367
- },
368
- action: "fitToSurface",
369
- label: "适应画布",
370
- group: "view"
371
- },
372
- {
373
- combo: {
374
- key: "2",
375
- mod: !1,
376
- shift: !0,
377
- code: "Digit2"
378
- },
379
- action: "fitToSelection",
380
- label: "适应选区",
381
- group: "view"
382
- },
383
- {
384
- combo: {
385
- key: "/",
386
- mod: !0,
387
- shift: !1
388
- },
389
- action: "helpShortcuts",
390
- label: "快捷键帮助",
391
- group: "help"
392
- }
393
- ];
394
- function o(e, t = a) {
395
- if (e.composing || e.editing || e.editableTarget) return null;
396
- let n = e.key.toLowerCase(), r = e.alt ?? !1;
397
- for (let i of t) if ((i.combo.code === void 0 ? i.combo.key === n : i.combo.code === e.code) && i.combo.mod === e.mod && i.combo.shift === e.shift && (i.combo.alt ?? !1) === r) return i.action;
398
- return null;
399
- }
400
- //#endregion
401
- //#region \0plugin-vue:export-helper
402
- var s = (e, t) => {
403
- let n = e.__vccOpts || e;
404
- for (let [e, r] of t) n[e] = r;
405
- return n;
406
- }, c = [
407
- "history",
408
- "clipboard",
409
- "layer",
410
- "text",
411
- "view",
412
- "help"
413
- ], l = {
414
- history: "历史",
415
- clipboard: "剪贴板",
416
- layer: "图层",
417
- text: "文本",
418
- view: "视图",
419
- help: "帮助"
420
- }, u = {
421
- arrowup: "↑",
422
- arrowdown: "↓",
423
- arrowleft: "←",
424
- arrowright: "→",
425
- backspace: "⌫",
426
- delete: "Del",
427
- escape: "Esc",
428
- tab: "Tab",
429
- f2: "F2"
430
- };
431
- function d(e, t) {
432
- let n = e.key, r = /^[a-z]$/.test(n) ? n.toUpperCase() : u[n] ?? n;
433
- if (t === "mac") {
434
- let t = "";
435
- return e.alt && (t += "⌥"), e.shift && (t += "⇧"), e.mod && (t += "⌘"), t + r;
436
- }
437
- let i = [];
438
- return e.mod && i.push("Ctrl"), e.shift && i.push("Shift"), e.alt && i.push("Alt"), i.push(r), i.join("+");
439
- }
440
- function f(e, t) {
441
- let n = a.find((t) => t.action === e);
442
- return n ? d(n.combo, t) : "";
443
- }
444
- var p = "画拉或点击落层,Esc 取消";
445
- function m() {
446
- let e = globalThis.navigator;
447
- return /mac/i.test(`${e?.userAgentData?.platform ?? ""} ${e?.platform ?? ""} ${e?.userAgent ?? ""}`) ? "mac" : "win";
448
- }
449
- //#endregion
450
- //#region src/shared/useDataSourceSchema.ts
451
- var h = "先绑定数据源";
452
- function g(n) {
453
- let i = r(n.store.ui.dataSourceSchema), a = n.subscribe((e) => {
454
- e.scope === "ui" && e.branch === "dataSourceSchema" && (i.value = n.store.ui.dataSourceSchema);
455
- });
456
- return t(a, !0), e(() => i.value);
457
- }
458
- function _(n) {
459
- let i = r(n.store.ui.dataSourceSchemaRejection), a = n.subscribe((e) => {
460
- e.scope === "ui" && e.branch === "dataSourceSchema" && (i.value = n.store.ui.dataSourceSchemaRejection);
461
- });
462
- return t(a, !0), e(() => i.value);
463
- }
464
- //#endregion
465
- //#region src/shared/editableTarget.ts
466
- function v(e) {
467
- if (!(e instanceof HTMLElement)) return !1;
468
- if (e.isContentEditable) return !0;
469
- let t = e.tagName;
470
- return t === "INPUT" || t === "TEXTAREA" || t === "SELECT" || t === "BUTTON";
471
- }
472
- function y(e) {
473
- if (!(e instanceof HTMLElement)) return !1;
474
- if (e.isContentEditable) return !0;
475
- let t = e.tagName;
476
- return t === "INPUT" || t === "TEXTAREA" || t === "SELECT";
477
- }
478
- //#endregion
479
- //#region src/shared/useTransientFeedback.ts
480
- var b = 4e3, x = n(""), S = null;
481
- function C() {
482
- let e = () => {
483
- S !== null && (clearTimeout(S), S = null);
484
- };
485
- return {
486
- message: x,
487
- show: (t) => {
488
- e(), x.value = t, S = setTimeout(() => {
489
- x.value = "", S = null;
490
- }, b);
491
- },
492
- clear: () => {
493
- e(), x.value = "";
494
- }
495
- };
496
- }
497
- //#endregion
498
- export { g as a, l as c, f as d, d as f, o as g, a as h, h as i, c as l, i as m, v as n, _ as o, s as p, y as r, p as s, C as t, m as u };