@hankchen/canvas-editor-vue 0.1.1 → 0.1.3

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,123 +0,0 @@
1
- import { B as e, D as t, G as n, H as r, L as i, M as a, T as o, _ as s, b as c, d as l, f as u, g as d, h as f, k as p, m, p as h, u as g } from "./layerPath-BRZK9ka1.js";
2
- import { a as _, c as v, d as y, f as b, i as x, l as S, n as C, o as w, r as T, t as E, u as D } from "./useTransientFeedback-gS9Xa9GY.js";
3
- import { t as O } from "./useShortcutsHelp-DTC3yRil.js";
4
- //#region src/shared/HelpDialog.vue?vue&type=script&setup=true&lang.ts
5
- var k = {
6
- class: "cn-help__panel",
7
- role: "dialog",
8
- "aria-modal": "true",
9
- "aria-label": "快捷键帮助",
10
- "data-help-dialog": ""
11
- }, A = { class: "cn-help__header" }, j = { class: "cn-help__body" }, M = ["data-help-group"], N = { class: "cn-help__section-title" }, P = { class: "cn-help__list" }, F = { class: "cn-help__label" }, I = { class: "cn-help__keys" }, L = {
12
- class: "cn-help__section",
13
- "data-help-interactions": ""
14
- }, R = { class: "cn-help__list" }, z = { class: "cn-help__label" }, B = { class: "cn-help__keys" }, V = /*#__PURE__*/ S(/* @__PURE__ */ c({
15
- __name: "HelpDialog",
16
- props: {
17
- bindings: { default: () => y },
18
- platform: {}
19
- },
20
- setup(e) {
21
- let i = e, { open: c, close: y } = O(), b = h(() => i.platform ?? w()), S = h(() => _.map((e) => ({
22
- group: e,
23
- label: x[e],
24
- bindings: i.bindings.filter((t) => t.group === e)
25
- })).filter((e) => e.bindings.length > 0)), C = [
26
- {
27
- gesture: "Ctrl/⌘ + 滚轮",
28
- text: "缩放画布(以指针为中心,5%–800%)"
29
- },
30
- {
31
- gesture: "空格拖动",
32
- text: "平移画布(中键拖拽、左键拖空白同效)"
33
- },
34
- {
35
- gesture: "面板菜单 / T·G·Q·I",
36
- text: "画拉建层:点层型或按键武装 → 画布拖拽定落位与尺寸(位移小于死区 = 点击兜底缺省尺寸)→ 自动选中、文本直打;Esc 取消"
37
- },
38
- {
39
- gesture: "双击",
40
- text: "就地编辑文本"
41
- },
42
- {
43
- gesture: "Esc",
44
- text: "退出编辑 / 解除武装 / 关闭弹层 / 选择逐级升级(格→行→表)"
45
- },
46
- {
47
- gesture: "方向键",
48
- text: "微调选中图层 1px(按住 Shift 大步 10px)"
49
- },
50
- {
51
- gesture: "Tab / ⇧Tab",
52
- text: "在根图层间循环选层(跳过隐藏与锁定)"
53
- }
54
- ];
55
- function T(e) {
56
- e.key === "Escape" && y();
57
- }
58
- return a(c, (e) => {
59
- e ? window.addEventListener("keydown", T) : window.removeEventListener("keydown", T);
60
- }), o(() => window.removeEventListener("keydown", T)), (e, i) => (t(), f(u, { to: "body" }, [r(c) ? (t(), s("div", {
61
- key: 0,
62
- class: "cn-help",
63
- "data-help-overlay": "",
64
- onPointerdown: i[1] ||= g((...e) => r(y) && r(y)(...e), ["self"])
65
- }, [m("div", k, [m("header", A, [i[2] ||= m("h2", { class: "cn-help__title" }, "快捷键", -1), m("button", {
66
- type: "button",
67
- class: "cn-help__close",
68
- "data-help-close": "",
69
- "aria-label": "关闭快捷键帮助",
70
- onClick: i[0] ||= (...e) => r(y) && r(y)(...e)
71
- }, " ✕ ")]), m("div", j, [(t(!0), s(l, null, p(S.value, (e) => (t(), s("section", {
72
- key: e.group,
73
- class: "cn-help__section",
74
- "data-help-group": e.group
75
- }, [m("h3", N, n(e.label), 1), m("ul", P, [(t(!0), s(l, null, p(e.bindings, (e) => (t(), s("li", {
76
- key: `${e.action}:${e.combo.key}`,
77
- class: "cn-help__row",
78
- "data-help-shortcut": ""
79
- }, [m("span", F, n(e.label), 1), m("kbd", I, n(r(v)(e.combo, b.value)), 1)]))), 128))])], 8, M))), 128)), m("section", L, [i[3] ||= m("h3", { class: "cn-help__section-title" }, "内置交互", -1), m("ul", R, [(t(), s(l, null, p(C, (e) => m("li", {
80
- key: e.gesture,
81
- class: "cn-help__row",
82
- "data-help-interaction": ""
83
- }, [m("span", z, n(e.text), 1), m("kbd", B, n(e.gesture), 1)])), 64))])])])])], 32)) : d("", !0)]));
84
- }
85
- }), [["__scopeId", "data-v-486e5be3"]]);
86
- //#endregion
87
- //#region src/shared/useHistory.ts
88
- function H(t) {
89
- let n = e(t.store.canUndo), r = e(t.store.canRedo), a = t.subscribe((e) => {
90
- e.scope === "doc" && (n.value = t.store.canUndo, r.value = t.store.canRedo);
91
- });
92
- return i(a, !0), {
93
- canUndo: h(() => n.value),
94
- canRedo: h(() => r.value)
95
- };
96
- }
97
- //#endregion
98
- //#region src/shared/useShortcuts.ts
99
- var U = new Set(Object.keys(D));
100
- function W(e) {
101
- let t = O(), n = E(), r = (r) => {
102
- let i = b({
103
- key: r.key,
104
- mod: r.ctrlKey || r.metaKey,
105
- shift: r.shiftKey,
106
- alt: r.altKey,
107
- code: r.code,
108
- composing: r.isComposing || r.keyCode === 229,
109
- editing: e.store.ui.editing !== null,
110
- editableTarget: C(r.target)
111
- });
112
- if (i !== null) {
113
- if (r.preventDefault(), i === "helpShortcuts") {
114
- t.toggle();
115
- return;
116
- }
117
- e.executeShortcut(i), U.has(i) && n.show(T);
118
- }
119
- };
120
- window.addEventListener("keydown", r), i(() => window.removeEventListener("keydown", r), !0);
121
- }
122
- //#endregion
123
- export { H as n, V as r, W as t };