@zh-keyboard/vue 1.0.0 → 1.1.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.
- package/dist/components/HandwritingInput.vue.d.ts +0 -1
- package/dist/components/ZhKeyboard.vue.d.ts +77 -10
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/zh-keyboard-vue.js +638 -603
- package/dist/zh-keyboard-vue.js.map +1 -1
- package/dist/zh-keyboard-vue.umd.cjs +1 -1
- package/dist/zh-keyboard-vue.umd.cjs.map +1 -1
- package/package.json +4 -4
package/dist/zh-keyboard-vue.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
var Pe = Object.defineProperty;
|
|
2
|
-
var _e = (e, o,
|
|
3
|
-
var
|
|
4
|
-
import { onMounted as Q, nextTick as
|
|
2
|
+
var _e = (e, o, i) => o in e ? Pe(e, o, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[o] = i;
|
|
3
|
+
var R = (e, o, i) => _e(e, typeof o != "symbol" ? o + "" : o, i);
|
|
4
|
+
import { onMounted as Q, nextTick as fe, watch as X, getCurrentScope as Ee, onScopeDispose as $e, getCurrentInstance as me, toValue as B, shallowRef as G, computed as S, watchEffect as q, unref as n, ref as $, onUnmounted as de, onBeforeUnmount as Se, defineComponent as I, createElementBlock as x, openBlock as b, Fragment as L, renderList as V, toDisplayString as D, createVNode as Le, createElementVNode as g, withModifiers as C, normalizeStyle as pe, normalizeClass as O, mergeModels as se, useModel as ke, createBlock as K, createCommentVNode as W, createTextVNode as ie, withDirectives as Te, vShow as Re } from "vue";
|
|
5
5
|
function ee(e) {
|
|
6
|
-
return
|
|
6
|
+
return Ee() ? ($e(e), !0) : !1;
|
|
7
7
|
}
|
|
8
8
|
const De = typeof window < "u" && typeof document < "u";
|
|
9
9
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
10
|
-
const
|
|
10
|
+
const Me = (e) => e != null, He = Object.prototype.toString, Ve = (e) => He.call(e) === "[object Object]", re = () => {
|
|
11
11
|
};
|
|
12
12
|
function Be(e, o) {
|
|
13
|
-
function
|
|
14
|
-
return new Promise((
|
|
15
|
-
Promise.resolve(e(() => o.apply(this, a), { fn: o, thisArg: this, args: a })).then(
|
|
13
|
+
function i(...a) {
|
|
14
|
+
return new Promise((r, s) => {
|
|
15
|
+
Promise.resolve(e(() => o.apply(this, a), { fn: o, thisArg: this, args: a })).then(r).catch(s);
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return i;
|
|
19
19
|
}
|
|
20
20
|
function Ie(e, o = {}) {
|
|
21
|
-
let
|
|
22
|
-
const
|
|
23
|
-
clearTimeout(
|
|
21
|
+
let i, a, r = re;
|
|
22
|
+
const s = (c) => {
|
|
23
|
+
clearTimeout(c), r(), r = re;
|
|
24
24
|
};
|
|
25
|
-
let
|
|
26
|
-
return (
|
|
27
|
-
const
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, h)),
|
|
32
|
-
a &&
|
|
33
|
-
},
|
|
25
|
+
let f;
|
|
26
|
+
return (c) => {
|
|
27
|
+
const y = B(e), h = B(o.maxWait);
|
|
28
|
+
return i && s(i), y <= 0 || h !== void 0 && h <= 0 ? (a && (s(a), a = null), Promise.resolve(c())) : new Promise((u, p) => {
|
|
29
|
+
r = o.rejectOnCancel ? p : u, f = c, h && !a && (a = setTimeout(() => {
|
|
30
|
+
i && s(i), a = null, u(f());
|
|
31
|
+
}, h)), i = setTimeout(() => {
|
|
32
|
+
a && s(a), a = null, u(c());
|
|
33
|
+
}, y);
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
}
|
|
@@ -38,70 +38,70 @@ function j(e) {
|
|
|
38
38
|
return Array.isArray(e) ? e : [e];
|
|
39
39
|
}
|
|
40
40
|
function Ae(e) {
|
|
41
|
-
return
|
|
41
|
+
return me();
|
|
42
42
|
}
|
|
43
|
-
function Ke(e, o = 200,
|
|
43
|
+
function Ke(e, o = 200, i = {}) {
|
|
44
44
|
return Be(
|
|
45
|
-
Ie(o,
|
|
45
|
+
Ie(o, i),
|
|
46
46
|
e
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
-
function We(e, o = !0,
|
|
50
|
-
Ae() ? Q(e,
|
|
49
|
+
function We(e, o = !0, i) {
|
|
50
|
+
Ae() ? Q(e, i) : o ? e() : fe(e);
|
|
51
51
|
}
|
|
52
|
-
function Oe(e, o,
|
|
53
|
-
return
|
|
52
|
+
function Oe(e, o, i) {
|
|
53
|
+
return X(
|
|
54
54
|
e,
|
|
55
55
|
o,
|
|
56
56
|
{
|
|
57
|
-
...
|
|
57
|
+
...i,
|
|
58
58
|
immediate: !0
|
|
59
59
|
}
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
function
|
|
62
|
+
const Y = De ? window : void 0;
|
|
63
|
+
function H(e) {
|
|
64
64
|
var o;
|
|
65
|
-
const
|
|
66
|
-
return (o =
|
|
65
|
+
const i = B(e);
|
|
66
|
+
return (o = i == null ? void 0 : i.$el) != null ? o : i;
|
|
67
67
|
}
|
|
68
68
|
function J(...e) {
|
|
69
|
-
const o = [],
|
|
70
|
-
o.forEach((
|
|
71
|
-
}, a = (
|
|
72
|
-
const
|
|
73
|
-
return
|
|
74
|
-
}),
|
|
69
|
+
const o = [], i = () => {
|
|
70
|
+
o.forEach((v) => v()), o.length = 0;
|
|
71
|
+
}, a = (v, c, y, h) => (v.addEventListener(c, y, h), () => v.removeEventListener(c, y, h)), r = S(() => {
|
|
72
|
+
const v = j(B(e[0])).filter((c) => c != null);
|
|
73
|
+
return v.every((c) => typeof c != "string") ? v : void 0;
|
|
74
|
+
}), s = Oe(
|
|
75
75
|
() => {
|
|
76
|
-
var
|
|
76
|
+
var v, c;
|
|
77
77
|
return [
|
|
78
|
-
(
|
|
79
|
-
j(B(
|
|
80
|
-
j(n(
|
|
78
|
+
(c = (v = r.value) == null ? void 0 : v.map((y) => H(y))) != null ? c : [Y].filter((y) => y != null),
|
|
79
|
+
j(B(r.value ? e[1] : e[0])),
|
|
80
|
+
j(n(r.value ? e[2] : e[1])),
|
|
81
81
|
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
82
|
-
B(
|
|
82
|
+
B(r.value ? e[3] : e[2])
|
|
83
83
|
];
|
|
84
84
|
},
|
|
85
|
-
([
|
|
86
|
-
if (
|
|
85
|
+
([v, c, y, h]) => {
|
|
86
|
+
if (i(), !(v != null && v.length) || !(c != null && c.length) || !(y != null && y.length))
|
|
87
87
|
return;
|
|
88
88
|
const u = Ve(h) ? { ...h } : h;
|
|
89
89
|
o.push(
|
|
90
|
-
...
|
|
91
|
-
(p) =>
|
|
92
|
-
(
|
|
90
|
+
...v.flatMap(
|
|
91
|
+
(p) => c.flatMap(
|
|
92
|
+
(d) => y.map((m) => a(p, d, m, u))
|
|
93
93
|
)
|
|
94
94
|
)
|
|
95
95
|
);
|
|
96
96
|
},
|
|
97
97
|
{ flush: "post" }
|
|
98
|
-
),
|
|
99
|
-
|
|
98
|
+
), f = () => {
|
|
99
|
+
s(), i();
|
|
100
100
|
};
|
|
101
|
-
return ee(
|
|
101
|
+
return ee(i), f;
|
|
102
102
|
}
|
|
103
103
|
function Ne() {
|
|
104
|
-
const e = G(!1), o =
|
|
104
|
+
const e = G(!1), o = me();
|
|
105
105
|
return o && Q(() => {
|
|
106
106
|
e.value = !0;
|
|
107
107
|
}, o), e;
|
|
@@ -110,45 +110,45 @@ function he(e) {
|
|
|
110
110
|
const o = Ne();
|
|
111
111
|
return S(() => (o.value, !!e()));
|
|
112
112
|
}
|
|
113
|
-
function Ue(e, o,
|
|
114
|
-
const { window: a =
|
|
115
|
-
let
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
const p = B(e),
|
|
120
|
-
return new Set(
|
|
121
|
-
}),
|
|
122
|
-
() =>
|
|
113
|
+
function Ue(e, o, i = {}) {
|
|
114
|
+
const { window: a = Y, ...r } = i;
|
|
115
|
+
let s;
|
|
116
|
+
const f = he(() => a && "MutationObserver" in a), v = () => {
|
|
117
|
+
s && (s.disconnect(), s = void 0);
|
|
118
|
+
}, c = S(() => {
|
|
119
|
+
const p = B(e), d = j(p).map(H).filter(Me);
|
|
120
|
+
return new Set(d);
|
|
121
|
+
}), y = X(
|
|
122
|
+
() => c.value,
|
|
123
123
|
(p) => {
|
|
124
|
-
|
|
124
|
+
v(), f.value && p.size && (s = new MutationObserver(o), p.forEach((d) => s.observe(d, r)));
|
|
125
125
|
},
|
|
126
126
|
{ immediate: !0, flush: "post" }
|
|
127
|
-
), h = () =>
|
|
128
|
-
|
|
127
|
+
), h = () => s == null ? void 0 : s.takeRecords(), u = () => {
|
|
128
|
+
y(), v();
|
|
129
129
|
};
|
|
130
130
|
return ee(u), {
|
|
131
|
-
isSupported:
|
|
131
|
+
isSupported: f,
|
|
132
132
|
stop: u,
|
|
133
133
|
takeRecords: h
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
-
function Fe(e, o,
|
|
136
|
+
function Fe(e, o, i = {}) {
|
|
137
137
|
const {
|
|
138
|
-
window: a =
|
|
139
|
-
document:
|
|
140
|
-
flush:
|
|
141
|
-
} =
|
|
142
|
-
if (!a || !
|
|
143
|
-
return
|
|
144
|
-
let
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
},
|
|
148
|
-
const h =
|
|
138
|
+
window: a = Y,
|
|
139
|
+
document: r = a == null ? void 0 : a.document,
|
|
140
|
+
flush: s = "sync"
|
|
141
|
+
} = i;
|
|
142
|
+
if (!a || !r)
|
|
143
|
+
return re;
|
|
144
|
+
let f;
|
|
145
|
+
const v = (h) => {
|
|
146
|
+
f == null || f(), f = h;
|
|
147
|
+
}, c = q(() => {
|
|
148
|
+
const h = H(e);
|
|
149
149
|
if (h) {
|
|
150
150
|
const { stop: u } = Ue(
|
|
151
|
-
|
|
151
|
+
r,
|
|
152
152
|
(p) => {
|
|
153
153
|
p.map((m) => [...m.removedNodes]).flat().some((m) => m === h || m.contains(h)) && o(p);
|
|
154
154
|
},
|
|
@@ -158,148 +158,148 @@ function Fe(e, o, s = {}) {
|
|
|
158
158
|
subtree: !0
|
|
159
159
|
}
|
|
160
160
|
);
|
|
161
|
-
|
|
161
|
+
v(u);
|
|
162
162
|
}
|
|
163
|
-
}, { flush:
|
|
164
|
-
|
|
163
|
+
}, { flush: s }), y = () => {
|
|
164
|
+
c(), v();
|
|
165
165
|
};
|
|
166
|
-
return ee(
|
|
166
|
+
return ee(y), y;
|
|
167
167
|
}
|
|
168
168
|
function Ze(e = {}) {
|
|
169
169
|
var o;
|
|
170
170
|
const {
|
|
171
|
-
window:
|
|
171
|
+
window: i = Y,
|
|
172
172
|
deep: a = !0,
|
|
173
|
-
triggerOnRemoval:
|
|
174
|
-
} = e,
|
|
175
|
-
var
|
|
176
|
-
let h =
|
|
173
|
+
triggerOnRemoval: r = !1
|
|
174
|
+
} = e, s = (o = e.document) != null ? o : i == null ? void 0 : i.document, f = () => {
|
|
175
|
+
var y;
|
|
176
|
+
let h = s == null ? void 0 : s.activeElement;
|
|
177
177
|
if (a)
|
|
178
178
|
for (; h != null && h.shadowRoot; )
|
|
179
|
-
h = (
|
|
179
|
+
h = (y = h == null ? void 0 : h.shadowRoot) == null ? void 0 : y.activeElement;
|
|
180
180
|
return h;
|
|
181
|
-
},
|
|
182
|
-
|
|
181
|
+
}, v = G(), c = () => {
|
|
182
|
+
v.value = f();
|
|
183
183
|
};
|
|
184
|
-
if (
|
|
185
|
-
const
|
|
184
|
+
if (i) {
|
|
185
|
+
const y = {
|
|
186
186
|
capture: !0,
|
|
187
187
|
passive: !0
|
|
188
188
|
};
|
|
189
189
|
J(
|
|
190
|
-
|
|
190
|
+
i,
|
|
191
191
|
"blur",
|
|
192
192
|
(h) => {
|
|
193
|
-
h.relatedTarget === null &&
|
|
193
|
+
h.relatedTarget === null && c();
|
|
194
194
|
},
|
|
195
|
-
|
|
195
|
+
y
|
|
196
196
|
), J(
|
|
197
|
-
|
|
197
|
+
i,
|
|
198
198
|
"focus",
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
c,
|
|
200
|
+
y
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
|
-
return
|
|
203
|
+
return r && Fe(v, c, { document: s }), c(), v;
|
|
204
204
|
}
|
|
205
|
-
function Xe(e, o,
|
|
206
|
-
const { window: a =
|
|
207
|
-
let
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
},
|
|
205
|
+
function Xe(e, o, i = {}) {
|
|
206
|
+
const { window: a = Y, ...r } = i;
|
|
207
|
+
let s;
|
|
208
|
+
const f = he(() => a && "ResizeObserver" in a), v = () => {
|
|
209
|
+
s && (s.disconnect(), s = void 0);
|
|
210
|
+
}, c = S(() => {
|
|
211
211
|
const u = B(e);
|
|
212
|
-
return Array.isArray(u) ? u.map((p) =>
|
|
213
|
-
}),
|
|
214
|
-
|
|
212
|
+
return Array.isArray(u) ? u.map((p) => H(p)) : [H(u)];
|
|
213
|
+
}), y = X(
|
|
214
|
+
c,
|
|
215
215
|
(u) => {
|
|
216
|
-
if (
|
|
217
|
-
|
|
216
|
+
if (v(), f.value && a) {
|
|
217
|
+
s = new ResizeObserver(o);
|
|
218
218
|
for (const p of u)
|
|
219
|
-
p &&
|
|
219
|
+
p && s.observe(p, r);
|
|
220
220
|
}
|
|
221
221
|
},
|
|
222
222
|
{ immediate: !0, flush: "post" }
|
|
223
223
|
), h = () => {
|
|
224
|
-
|
|
224
|
+
v(), y();
|
|
225
225
|
};
|
|
226
226
|
return ee(h), {
|
|
227
|
-
isSupported:
|
|
227
|
+
isSupported: f,
|
|
228
228
|
stop: h
|
|
229
229
|
};
|
|
230
230
|
}
|
|
231
|
-
function ge(e, o = { width: 0, height: 0 },
|
|
232
|
-
const { window: a =
|
|
231
|
+
function ge(e, o = { width: 0, height: 0 }, i = {}) {
|
|
232
|
+
const { window: a = Y, box: r = "content-box" } = i, s = S(() => {
|
|
233
233
|
var u, p;
|
|
234
|
-
return (p = (u =
|
|
235
|
-
}),
|
|
234
|
+
return (p = (u = H(e)) == null ? void 0 : u.namespaceURI) == null ? void 0 : p.includes("svg");
|
|
235
|
+
}), f = G(o.width), v = G(o.height), { stop: c } = Xe(
|
|
236
236
|
e,
|
|
237
237
|
([u]) => {
|
|
238
|
-
const p =
|
|
239
|
-
if (a &&
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
const m =
|
|
243
|
-
|
|
238
|
+
const p = r === "border-box" ? u.borderBoxSize : r === "content-box" ? u.contentBoxSize : u.devicePixelContentBoxSize;
|
|
239
|
+
if (a && s.value) {
|
|
240
|
+
const d = H(e);
|
|
241
|
+
if (d) {
|
|
242
|
+
const m = d.getBoundingClientRect();
|
|
243
|
+
f.value = m.width, v.value = m.height;
|
|
244
244
|
}
|
|
245
245
|
} else if (p) {
|
|
246
|
-
const
|
|
247
|
-
|
|
246
|
+
const d = j(p);
|
|
247
|
+
f.value = d.reduce((m, { inlineSize: P }) => m + P, 0), v.value = d.reduce((m, { blockSize: P }) => m + P, 0);
|
|
248
248
|
} else
|
|
249
|
-
|
|
249
|
+
f.value = u.contentRect.width, v.value = u.contentRect.height;
|
|
250
250
|
},
|
|
251
|
-
|
|
251
|
+
i
|
|
252
252
|
);
|
|
253
253
|
We(() => {
|
|
254
|
-
const u =
|
|
255
|
-
u && (
|
|
254
|
+
const u = H(e);
|
|
255
|
+
u && (f.value = "offsetWidth" in u ? u.offsetWidth : o.width, v.value = "offsetHeight" in u ? u.offsetHeight : o.height);
|
|
256
256
|
});
|
|
257
|
-
const
|
|
258
|
-
() =>
|
|
257
|
+
const y = X(
|
|
258
|
+
() => H(e),
|
|
259
259
|
(u) => {
|
|
260
|
-
|
|
260
|
+
f.value = u ? o.width : 0, v.value = u ? o.height : 0;
|
|
261
261
|
}
|
|
262
262
|
);
|
|
263
263
|
function h() {
|
|
264
|
-
|
|
264
|
+
c(), y();
|
|
265
265
|
}
|
|
266
266
|
return {
|
|
267
|
-
width:
|
|
268
|
-
height:
|
|
267
|
+
width: f,
|
|
268
|
+
height: v,
|
|
269
269
|
stop: h
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
var Ye = class {
|
|
273
273
|
constructor(e, o = {}) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
274
|
+
R(this, "canvas");
|
|
275
|
+
R(this, "ctx");
|
|
276
|
+
R(this, "lastX", 0);
|
|
277
|
+
R(this, "lastY", 0);
|
|
278
|
+
R(this, "strokeData", []);
|
|
279
|
+
R(this, "clearTimerId", null);
|
|
280
|
+
R(this, "isDrawing", !1);
|
|
281
|
+
R(this, "options");
|
|
282
|
+
R(this, "handleStart", (e) => {
|
|
283
283
|
e.preventDefault(), this.isDrawing = !0;
|
|
284
|
-
const { offsetX: o, offsetY:
|
|
285
|
-
this.startDrawing(o,
|
|
284
|
+
const { offsetX: o, offsetY: i } = this.getEventCoordinates(e);
|
|
285
|
+
this.startDrawing(o, i), this.resetClearTimer();
|
|
286
286
|
});
|
|
287
|
-
|
|
287
|
+
R(this, "handleMove", (e) => {
|
|
288
288
|
if (!this.isDrawing) return;
|
|
289
289
|
e.preventDefault();
|
|
290
|
-
const { offsetX: o, offsetY:
|
|
291
|
-
this.draw(o,
|
|
290
|
+
const { offsetX: o, offsetY: i } = this.getEventCoordinates(e);
|
|
291
|
+
this.draw(o, i), this.resetClearTimer();
|
|
292
292
|
});
|
|
293
|
-
|
|
293
|
+
R(this, "handleEnd", (e) => {
|
|
294
294
|
this.isDrawing && (e.preventDefault(), this.isDrawing = !1, this.endStroke(), this.startClearTimer(), this.options.onDrawEnd && this.options.onDrawEnd());
|
|
295
295
|
});
|
|
296
296
|
this.canvas = e, this.options = {
|
|
297
297
|
clearDelay: 1e3,
|
|
298
298
|
...o
|
|
299
299
|
};
|
|
300
|
-
const
|
|
301
|
-
if (!
|
|
302
|
-
this.ctx =
|
|
300
|
+
const i = this.canvas.getContext("2d");
|
|
301
|
+
if (!i) throw new Error("Failed to get 2D rendering context");
|
|
302
|
+
this.ctx = i, this.setupCanvas(), this.attachEvents();
|
|
303
303
|
}
|
|
304
304
|
setupCanvas() {
|
|
305
305
|
this.ctx.lineJoin = "round", this.ctx.lineCap = "round", this.ctx.lineWidth = 3, this.ctx.strokeStyle = "#000", this.clearCanvas(), this.drawGrid();
|
|
@@ -337,10 +337,10 @@ var Ye = class {
|
|
|
337
337
|
offsetY: e.offsetY
|
|
338
338
|
};
|
|
339
339
|
{
|
|
340
|
-
const o = e.touches[0] || e.changedTouches[0],
|
|
340
|
+
const o = e.touches[0] || e.changedTouches[0], i = e.target.getBoundingClientRect();
|
|
341
341
|
return {
|
|
342
|
-
offsetX: o.clientX -
|
|
343
|
-
offsetY: o.clientY -
|
|
342
|
+
offsetX: o.clientX - i.left,
|
|
343
|
+
offsetY: o.clientY - i.top
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
346
|
}
|
|
@@ -360,54 +360,54 @@ var Ye = class {
|
|
|
360
360
|
return this.ctx;
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
|
-
let
|
|
363
|
+
let le = {
|
|
364
364
|
defaultMode: "en",
|
|
365
365
|
enableHandwriting: !1,
|
|
366
366
|
position: "static",
|
|
367
367
|
disableWhenNoFocus: !0
|
|
368
|
-
},
|
|
369
|
-
function
|
|
370
|
-
return
|
|
368
|
+
}, ye = null, be = null;
|
|
369
|
+
function Z() {
|
|
370
|
+
return le;
|
|
371
371
|
}
|
|
372
|
-
function
|
|
373
|
-
|
|
374
|
-
...
|
|
372
|
+
function fn(e) {
|
|
373
|
+
le = {
|
|
374
|
+
...le,
|
|
375
375
|
...e
|
|
376
376
|
};
|
|
377
377
|
}
|
|
378
|
-
function fn(e) {
|
|
379
|
-
be = e;
|
|
380
|
-
}
|
|
381
|
-
function ue() {
|
|
382
|
-
return be;
|
|
383
|
-
}
|
|
384
378
|
function mn(e) {
|
|
385
379
|
ye = e;
|
|
386
380
|
}
|
|
387
|
-
function
|
|
381
|
+
function ae() {
|
|
388
382
|
return ye;
|
|
389
383
|
}
|
|
390
|
-
function
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
384
|
+
function pn(e) {
|
|
385
|
+
be = e;
|
|
386
|
+
}
|
|
387
|
+
function je() {
|
|
388
|
+
return be;
|
|
389
|
+
}
|
|
390
|
+
function Ge(e, o, i, a = 0) {
|
|
391
|
+
if (!e || !o || i === "static") return null;
|
|
392
|
+
let r, s;
|
|
393
|
+
if (i === "bottom")
|
|
394
|
+
r = window.innerHeight - o.offsetHeight, s = 0;
|
|
395
395
|
else {
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
|
|
396
|
+
const f = e.getBoundingClientRect(), v = o.offsetWidth;
|
|
397
|
+
r = f.bottom + window.scrollY + a, s = f.left + window.scrollX + f.width / 2 - v / 2;
|
|
398
|
+
const c = window.innerWidth;
|
|
399
|
+
s + v > c && (s = c - v - 10), s < 10 && (s = 10);
|
|
400
400
|
}
|
|
401
401
|
return {
|
|
402
|
-
top: `${
|
|
403
|
-
left: `${
|
|
402
|
+
top: `${r}px`,
|
|
403
|
+
left: `${s}px`
|
|
404
404
|
};
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function ue(e) {
|
|
407
407
|
if (!e) return !1;
|
|
408
408
|
if (e.tagName === "TEXTAREA") return !0;
|
|
409
409
|
if (e.tagName === "INPUT") {
|
|
410
|
-
const
|
|
410
|
+
const i = (e.type || "text").toLowerCase();
|
|
411
411
|
return ![
|
|
412
412
|
"checkbox",
|
|
413
413
|
"radio",
|
|
@@ -424,36 +424,36 @@ function de(e) {
|
|
|
424
424
|
"month",
|
|
425
425
|
"week",
|
|
426
426
|
"time"
|
|
427
|
-
].includes(
|
|
427
|
+
].includes(i);
|
|
428
428
|
}
|
|
429
429
|
return !1;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
432
|
-
if (document.activeElement &&
|
|
431
|
+
function kn() {
|
|
432
|
+
if (document.activeElement && ue(document.activeElement)) return document.activeElement;
|
|
433
433
|
throw new Error("输入框没有被激活");
|
|
434
434
|
}
|
|
435
|
-
function qe(e, o,
|
|
436
|
-
e.value = o, tt(e,
|
|
435
|
+
function qe(e, o, i) {
|
|
436
|
+
e.value = o, tt(e, i), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
437
437
|
}
|
|
438
|
-
function Je(e, o,
|
|
439
|
-
return e.slice(0, o) + a + e.slice(o +
|
|
438
|
+
function Je(e, o, i, a = "") {
|
|
439
|
+
return e.slice(0, o) + a + e.slice(o + i);
|
|
440
440
|
}
|
|
441
441
|
function we(e, o = "") {
|
|
442
|
-
const
|
|
442
|
+
const i = Number(e.getAttribute("maxlength"));
|
|
443
443
|
let a = e.selectionStart ?? 0;
|
|
444
|
-
const
|
|
445
|
-
let
|
|
446
|
-
if (o.length > 0)
|
|
444
|
+
const r = e.selectionEnd ?? a;
|
|
445
|
+
let s;
|
|
446
|
+
if (o.length > 0) s = r - a;
|
|
447
447
|
else {
|
|
448
|
-
const
|
|
449
|
-
if (
|
|
448
|
+
const c = r - a;
|
|
449
|
+
if (c > 0) s = c;
|
|
450
450
|
else if (a > 0)
|
|
451
|
-
|
|
451
|
+
s = 1, a--;
|
|
452
452
|
else return;
|
|
453
453
|
}
|
|
454
|
-
if (o.length > 0 &&
|
|
455
|
-
const
|
|
456
|
-
qe(e,
|
|
454
|
+
if (o.length > 0 && i && e.value.length - s + o.length > i) return;
|
|
455
|
+
const f = Je(e.value, a, s, o), v = a + o.length;
|
|
456
|
+
qe(e, f, v);
|
|
457
457
|
}
|
|
458
458
|
function Qe(e, o) {
|
|
459
459
|
we(e, o);
|
|
@@ -465,73 +465,73 @@ function tt(e, o) {
|
|
|
465
465
|
e.selectionStart = o, e.selectionEnd = o;
|
|
466
466
|
}
|
|
467
467
|
function nt(e = {}) {
|
|
468
|
-
const o = e.delay ?? 400,
|
|
469
|
-
let a,
|
|
470
|
-
function
|
|
471
|
-
a && (clearTimeout(a), a = void 0),
|
|
468
|
+
const o = e.delay ?? 400, i = e.interval ?? 60;
|
|
469
|
+
let a, r;
|
|
470
|
+
function s() {
|
|
471
|
+
a && (clearTimeout(a), a = void 0), r && (clearInterval(r), r = void 0);
|
|
472
472
|
}
|
|
473
|
-
function
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
},
|
|
473
|
+
function f(v) {
|
|
474
|
+
s(), v(), a = setTimeout(() => {
|
|
475
|
+
r = setInterval(() => {
|
|
476
|
+
v();
|
|
477
|
+
}, i);
|
|
478
478
|
}, o);
|
|
479
479
|
}
|
|
480
480
|
return {
|
|
481
|
-
start:
|
|
482
|
-
stop:
|
|
481
|
+
start: f,
|
|
482
|
+
stop: s
|
|
483
483
|
};
|
|
484
484
|
}
|
|
485
485
|
function ot(e = !1) {
|
|
486
|
-
const o =
|
|
486
|
+
const o = $(!1), i = $(0);
|
|
487
487
|
async function a() {
|
|
488
|
-
const
|
|
489
|
-
if (
|
|
488
|
+
const s = ae();
|
|
489
|
+
if (s)
|
|
490
490
|
try {
|
|
491
|
-
o.value = await
|
|
492
|
-
onProgress: (
|
|
493
|
-
|
|
491
|
+
o.value = await s.initialize({
|
|
492
|
+
onProgress: (f) => {
|
|
493
|
+
i.value = f;
|
|
494
494
|
}
|
|
495
495
|
});
|
|
496
|
-
} catch (
|
|
497
|
-
console.error("初始化手写识别服务失败:",
|
|
496
|
+
} catch (f) {
|
|
497
|
+
console.error("初始化手写识别服务失败:", f), o.value = !1;
|
|
498
498
|
}
|
|
499
499
|
else
|
|
500
500
|
console.warn("未注册手写识别服务"), o.value = !1;
|
|
501
501
|
}
|
|
502
|
-
async function
|
|
503
|
-
const
|
|
504
|
-
if (
|
|
502
|
+
async function r() {
|
|
503
|
+
const s = ae();
|
|
504
|
+
if (s && o.value)
|
|
505
505
|
try {
|
|
506
|
-
await
|
|
507
|
-
} catch (
|
|
508
|
-
console.error("关闭手写识别服务失败:",
|
|
506
|
+
await s.close(), o.value = !1;
|
|
507
|
+
} catch (f) {
|
|
508
|
+
console.error("关闭手写识别服务失败:", f);
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
511
|
return Q(() => {
|
|
512
512
|
e && a();
|
|
513
|
-
}),
|
|
514
|
-
|
|
513
|
+
}), de(() => {
|
|
514
|
+
r();
|
|
515
515
|
}), {
|
|
516
516
|
recognizerInitialized: o,
|
|
517
|
-
recognizerProgress:
|
|
517
|
+
recognizerProgress: i
|
|
518
518
|
};
|
|
519
519
|
}
|
|
520
|
-
const
|
|
520
|
+
const ce = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M21,11H6.83L10.41,7.41L9,6L3,12L9,18L10.41,16.58L6.83,13H21V11Z'%20/%3e%3c/svg%3e", ve = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M19,7V11H5.83L9.41,7.41L8,6L2,12L8,18L9.41,16.58L5.83,13H21V7H19Z'%20/%3e%3c/svg%3e";
|
|
521
521
|
function te() {
|
|
522
522
|
const e = nt();
|
|
523
|
-
function o(a,
|
|
524
|
-
var
|
|
525
|
-
a.preventDefault(), (
|
|
523
|
+
function o(a, r) {
|
|
524
|
+
var s, f;
|
|
525
|
+
a.preventDefault(), (f = (s = a.currentTarget) == null ? void 0 : s.setPointerCapture) == null || f.call(s, a.pointerId), e.start(r);
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function i() {
|
|
528
528
|
e.stop();
|
|
529
529
|
}
|
|
530
530
|
return Se(() => {
|
|
531
531
|
e.stop();
|
|
532
532
|
}), {
|
|
533
533
|
startRepeat: o,
|
|
534
|
-
stopRepeat:
|
|
534
|
+
stopRepeat: i
|
|
535
535
|
};
|
|
536
536
|
}
|
|
537
537
|
const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__ */ I({
|
|
@@ -541,19 +541,22 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
541
541
|
},
|
|
542
542
|
emits: ["select"],
|
|
543
543
|
setup(e, { emit: o }) {
|
|
544
|
-
const
|
|
545
|
-
function a(
|
|
546
|
-
|
|
544
|
+
const i = o;
|
|
545
|
+
function a(r) {
|
|
546
|
+
i("select", r);
|
|
547
547
|
}
|
|
548
|
-
return (
|
|
549
|
-
(
|
|
550
|
-
key: `candidate-${
|
|
548
|
+
return (r, s) => (b(), x("div", st, [
|
|
549
|
+
(b(!0), x(L, null, V(r.candidates, (f, v) => (b(), x("button", {
|
|
550
|
+
key: `candidate-${v}`,
|
|
551
551
|
class: "zhk-candidate-list__item",
|
|
552
|
-
onClick: (
|
|
553
|
-
}, D(
|
|
552
|
+
onClick: (c) => a(v)
|
|
553
|
+
}, D(f), 9, it))), 128))
|
|
554
554
|
]));
|
|
555
555
|
}
|
|
556
|
-
}), rt = { class: "handwriting-input" }, lt = { class: "handwriting-
|
|
556
|
+
}), rt = { class: "handwriting-input" }, lt = { class: "handwriting-content" }, at = { class: "handwriting-buttons" }, ut = { class: "handwriting-canvas-container" }, dt = {
|
|
557
|
+
key: 0,
|
|
558
|
+
class: "handwriting-loading"
|
|
559
|
+
}, ct = { class: "progress-bar" }, vt = { class: "progress-text" }, ft = { class: "handwriting-buttons" }, mt = /* @__PURE__ */ I({
|
|
557
560
|
__name: "HandwritingInput",
|
|
558
561
|
props: {
|
|
559
562
|
recognizerInitialized: { type: Boolean },
|
|
@@ -561,26 +564,26 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
561
564
|
},
|
|
562
565
|
emits: ["key", "exit"],
|
|
563
566
|
setup(e, { emit: o }) {
|
|
564
|
-
const
|
|
565
|
-
let
|
|
566
|
-
const f =
|
|
567
|
-
function
|
|
568
|
-
|
|
567
|
+
const i = e, a = o, r = $(null);
|
|
568
|
+
let s = null;
|
|
569
|
+
const f = $(!1), { width: v, height: c } = ge(r);
|
|
570
|
+
function y() {
|
|
571
|
+
s && s.clearCanvas();
|
|
569
572
|
}
|
|
570
573
|
function h() {
|
|
571
|
-
|
|
574
|
+
r.value && (s && s.destroy(), r.value.width = v.value, r.value.height = c.value, s = new Ye(r.value, {
|
|
572
575
|
onDrawEnd: m
|
|
573
576
|
}));
|
|
574
577
|
}
|
|
575
|
-
const u =
|
|
578
|
+
const u = $([]), { startRepeat: p, stopRepeat: d } = te();
|
|
576
579
|
async function m() {
|
|
577
|
-
if (!
|
|
580
|
+
if (!s || s.getStrokeData().length === 0 || f.value)
|
|
578
581
|
return;
|
|
579
|
-
const z =
|
|
582
|
+
const z = ae();
|
|
580
583
|
if (z) {
|
|
581
584
|
f.value = !0;
|
|
582
585
|
try {
|
|
583
|
-
const t = [...
|
|
586
|
+
const t = [...s.getStrokeData()], k = await z.recognize(t);
|
|
584
587
|
u.value = k;
|
|
585
588
|
} catch (t) {
|
|
586
589
|
console.error("识别笔迹失败:", t);
|
|
@@ -590,37 +593,33 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
590
593
|
} else
|
|
591
594
|
console.warn("手写识别服务不可用");
|
|
592
595
|
}
|
|
593
|
-
|
|
594
|
-
|
|
596
|
+
de(() => {
|
|
597
|
+
s && s.destroy();
|
|
595
598
|
}), q(() => {
|
|
596
|
-
|
|
599
|
+
r.value && (v.value || c.value) && i.recognizerInitialized && fe(() => {
|
|
597
600
|
h();
|
|
598
601
|
});
|
|
599
602
|
});
|
|
600
|
-
function
|
|
603
|
+
function P(z) {
|
|
601
604
|
const t = u.value[z];
|
|
602
|
-
t && (a("key", { key: t }), u.value = [],
|
|
605
|
+
t && (a("key", { key: t }), u.value = [], y());
|
|
603
606
|
}
|
|
604
|
-
return (z, t) => (
|
|
607
|
+
return (z, t) => (b(), x("div", rt, [
|
|
605
608
|
Le(xe, {
|
|
606
609
|
candidates: u.value,
|
|
607
|
-
onSelect:
|
|
610
|
+
onSelect: P
|
|
608
611
|
}, null, 8, ["candidates"]),
|
|
609
|
-
g("div",
|
|
610
|
-
|
|
611
|
-
ref: i,
|
|
612
|
-
class: "handwriting-content"
|
|
613
|
-
}, [
|
|
614
|
-
g("div", lt, [
|
|
612
|
+
g("div", lt, [
|
|
613
|
+
g("div", at, [
|
|
615
614
|
g("button", {
|
|
616
615
|
class: "handwriting-btn handwriting-btn--function",
|
|
617
616
|
onPointerdown: t[0] || (t[0] = (k) => n(p)(k, () => a("key", { key: "。" }))),
|
|
618
617
|
onPointerup: t[1] || (t[1] = //@ts-ignore
|
|
619
|
-
(...k) => n(
|
|
618
|
+
(...k) => n(d) && n(d)(...k)),
|
|
620
619
|
onPointerleave: t[2] || (t[2] = //@ts-ignore
|
|
621
|
-
(...k) => n(
|
|
620
|
+
(...k) => n(d) && n(d)(...k)),
|
|
622
621
|
onPointercancel: t[3] || (t[3] = //@ts-ignore
|
|
623
|
-
(...k) => n(
|
|
622
|
+
(...k) => n(d) && n(d)(...k)),
|
|
624
623
|
onContextmenu: t[4] || (t[4] = C(() => {
|
|
625
624
|
}, ["prevent"]))
|
|
626
625
|
}, " 。 ", 32),
|
|
@@ -628,11 +627,11 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
628
627
|
class: "handwriting-btn handwriting-btn--function",
|
|
629
628
|
onPointerdown: t[5] || (t[5] = (k) => n(p)(k, () => a("key", { key: "?" }))),
|
|
630
629
|
onPointerup: t[6] || (t[6] = //@ts-ignore
|
|
631
|
-
(...k) => n(
|
|
630
|
+
(...k) => n(d) && n(d)(...k)),
|
|
632
631
|
onPointerleave: t[7] || (t[7] = //@ts-ignore
|
|
633
|
-
(...k) => n(
|
|
632
|
+
(...k) => n(d) && n(d)(...k)),
|
|
634
633
|
onPointercancel: t[8] || (t[8] = //@ts-ignore
|
|
635
|
-
(...k) => n(
|
|
634
|
+
(...k) => n(d) && n(d)(...k)),
|
|
636
635
|
onContextmenu: t[9] || (t[9] = C(() => {
|
|
637
636
|
}, ["prevent"]))
|
|
638
637
|
}, " ? ", 32),
|
|
@@ -640,11 +639,11 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
640
639
|
class: "handwriting-btn handwriting-btn--function",
|
|
641
640
|
onPointerdown: t[10] || (t[10] = (k) => n(p)(k, () => a("key", { key: "!" }))),
|
|
642
641
|
onPointerup: t[11] || (t[11] = //@ts-ignore
|
|
643
|
-
(...k) => n(
|
|
642
|
+
(...k) => n(d) && n(d)(...k)),
|
|
644
643
|
onPointerleave: t[12] || (t[12] = //@ts-ignore
|
|
645
|
-
(...k) => n(
|
|
644
|
+
(...k) => n(d) && n(d)(...k)),
|
|
646
645
|
onPointercancel: t[13] || (t[13] = //@ts-ignore
|
|
647
|
-
(...k) => n(
|
|
646
|
+
(...k) => n(d) && n(d)(...k)),
|
|
648
647
|
onContextmenu: t[14] || (t[14] = C(() => {
|
|
649
648
|
}, ["prevent"]))
|
|
650
649
|
}, " ! ", 32),
|
|
@@ -652,53 +651,47 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
652
651
|
class: "handwriting-btn handwriting-btn--function",
|
|
653
652
|
onPointerdown: t[15] || (t[15] = (k) => n(p)(k, () => a("key", { key: "、" }))),
|
|
654
653
|
onPointerup: t[16] || (t[16] = //@ts-ignore
|
|
655
|
-
(...k) => n(
|
|
654
|
+
(...k) => n(d) && n(d)(...k)),
|
|
656
655
|
onPointerleave: t[17] || (t[17] = //@ts-ignore
|
|
657
|
-
(...k) => n(
|
|
656
|
+
(...k) => n(d) && n(d)(...k)),
|
|
658
657
|
onPointercancel: t[18] || (t[18] = //@ts-ignore
|
|
659
|
-
(...k) => n(
|
|
658
|
+
(...k) => n(d) && n(d)(...k)),
|
|
660
659
|
onContextmenu: t[19] || (t[19] = C(() => {
|
|
661
660
|
}, ["prevent"]))
|
|
662
661
|
}, " 、 ", 32)
|
|
663
662
|
]),
|
|
664
|
-
g("div",
|
|
665
|
-
z.recognizerInitialized ? (
|
|
663
|
+
g("div", ut, [
|
|
664
|
+
z.recognizerInitialized ? (b(), x("canvas", {
|
|
666
665
|
key: 1,
|
|
667
666
|
ref_key: "canvasRef",
|
|
668
|
-
ref:
|
|
669
|
-
class: "handwriting-canvas"
|
|
670
|
-
|
|
671
|
-
height: n(v)
|
|
672
|
-
}, null, 8, ct)) : (y(), x("div", {
|
|
673
|
-
key: 0,
|
|
674
|
-
class: "handwriting-loading",
|
|
675
|
-
style: se({ width: `${n(v)}px`, height: `${n(v)}px` })
|
|
676
|
-
}, [
|
|
667
|
+
ref: r,
|
|
668
|
+
class: "handwriting-canvas"
|
|
669
|
+
}, null, 512)) : (b(), x("div", dt, [
|
|
677
670
|
t[37] || (t[37] = g("div", { class: "loading-text" }, " 正在加载手写识别... ", -1)),
|
|
678
|
-
g("div",
|
|
671
|
+
g("div", ct, [
|
|
679
672
|
g("div", {
|
|
680
673
|
class: "progress-fill",
|
|
681
|
-
style:
|
|
674
|
+
style: pe({ width: `${z.recognizerProgress * 100}%` })
|
|
682
675
|
}, null, 4)
|
|
683
676
|
]),
|
|
684
|
-
g("div",
|
|
685
|
-
]
|
|
677
|
+
g("div", vt, D(Math.round(z.recognizerProgress * 100)) + "% ", 1)
|
|
678
|
+
]))
|
|
686
679
|
]),
|
|
687
|
-
g("div",
|
|
680
|
+
g("div", ft, [
|
|
688
681
|
g("button", {
|
|
689
682
|
class: "handwriting-btn handwriting-btn--function",
|
|
690
683
|
onPointerdown: t[20] || (t[20] = (k) => n(p)(k, () => a("key", { key: "delete", isControl: !0 }))),
|
|
691
684
|
onPointerup: t[21] || (t[21] = //@ts-ignore
|
|
692
|
-
(...k) => n(
|
|
685
|
+
(...k) => n(d) && n(d)(...k)),
|
|
693
686
|
onPointerleave: t[22] || (t[22] = //@ts-ignore
|
|
694
|
-
(...k) => n(
|
|
687
|
+
(...k) => n(d) && n(d)(...k)),
|
|
695
688
|
onPointercancel: t[23] || (t[23] = //@ts-ignore
|
|
696
|
-
(...k) => n(
|
|
689
|
+
(...k) => n(d) && n(d)(...k)),
|
|
697
690
|
onContextmenu: t[24] || (t[24] = C(() => {
|
|
698
691
|
}, ["prevent"]))
|
|
699
692
|
}, t[38] || (t[38] = [
|
|
700
693
|
g("img", {
|
|
701
|
-
src:
|
|
694
|
+
src: ce,
|
|
702
695
|
alt: "删除"
|
|
703
696
|
}, null, -1)
|
|
704
697
|
]), 32),
|
|
@@ -707,16 +700,16 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
707
700
|
onClick: t[25] || (t[25] = (k) => a("exit")),
|
|
708
701
|
onContextmenu: t[26] || (t[26] = C(() => {
|
|
709
702
|
}, ["prevent"]))
|
|
710
|
-
}, "
|
|
703
|
+
}, " 拼音 ", 32),
|
|
711
704
|
g("button", {
|
|
712
705
|
class: "handwriting-btn handwriting-btn--function",
|
|
713
706
|
onPointerdown: t[27] || (t[27] = (k) => n(p)(k, () => a("key", { key: "," }))),
|
|
714
707
|
onPointerup: t[28] || (t[28] = //@ts-ignore
|
|
715
|
-
(...k) => n(
|
|
708
|
+
(...k) => n(d) && n(d)(...k)),
|
|
716
709
|
onPointerleave: t[29] || (t[29] = //@ts-ignore
|
|
717
|
-
(...k) => n(
|
|
710
|
+
(...k) => n(d) && n(d)(...k)),
|
|
718
711
|
onPointercancel: t[30] || (t[30] = //@ts-ignore
|
|
719
|
-
(...k) => n(
|
|
712
|
+
(...k) => n(d) && n(d)(...k)),
|
|
720
713
|
onContextmenu: t[31] || (t[31] = C(() => {
|
|
721
714
|
}, ["prevent"]))
|
|
722
715
|
}, " , ", 32),
|
|
@@ -724,61 +717,61 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
724
717
|
class: "handwriting-btn handwriting-btn--function",
|
|
725
718
|
onPointerdown: t[32] || (t[32] = (k) => n(p)(k, () => a("key", { key: "enter", isControl: !0 }))),
|
|
726
719
|
onPointerup: t[33] || (t[33] = //@ts-ignore
|
|
727
|
-
(...k) => n(
|
|
720
|
+
(...k) => n(d) && n(d)(...k)),
|
|
728
721
|
onPointerleave: t[34] || (t[34] = //@ts-ignore
|
|
729
|
-
(...k) => n(
|
|
722
|
+
(...k) => n(d) && n(d)(...k)),
|
|
730
723
|
onPointercancel: t[35] || (t[35] = //@ts-ignore
|
|
731
|
-
(...k) => n(
|
|
724
|
+
(...k) => n(d) && n(d)(...k)),
|
|
732
725
|
onContextmenu: t[36] || (t[36] = C(() => {
|
|
733
726
|
}, ["prevent"]))
|
|
734
727
|
}, t[39] || (t[39] = [
|
|
735
728
|
g("img", {
|
|
736
|
-
src:
|
|
729
|
+
src: ve,
|
|
737
730
|
alt: "回车"
|
|
738
731
|
}, null, -1)
|
|
739
732
|
]), 32)
|
|
740
733
|
])
|
|
741
|
-
]
|
|
734
|
+
])
|
|
742
735
|
]));
|
|
743
736
|
}
|
|
744
|
-
}),
|
|
737
|
+
}), pt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M6,18H18V16H6M12,8.41L16.59,13L18,11.58L12,5.58L6,11.58L7.41,13L12,8.41Z'%20/%3e%3c/svg%3e", ze = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M3%2015H5V19H19V15H21V19C21%2020.1%2020.1%2021%2019%2021H5C3.9%2021%203%2020.1%203%2019V15Z'%20/%3e%3c/svg%3e", kt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z'%20/%3e%3c/svg%3e", ht = { class: "zhk-selection" }, gt = { class: "zhk-selection__list" }, yt = ["onClick"], bt = /* @__PURE__ */ I({
|
|
745
738
|
__name: "CandidateSelection",
|
|
746
739
|
props: {
|
|
747
740
|
candidates: {}
|
|
748
741
|
},
|
|
749
742
|
emits: ["select", "close"],
|
|
750
743
|
setup(e, { emit: o }) {
|
|
751
|
-
const
|
|
752
|
-
function a(
|
|
753
|
-
|
|
744
|
+
const i = o;
|
|
745
|
+
function a(f) {
|
|
746
|
+
i("select", f);
|
|
754
747
|
}
|
|
755
|
-
function
|
|
756
|
-
|
|
748
|
+
function r() {
|
|
749
|
+
i("close");
|
|
757
750
|
}
|
|
758
|
-
function
|
|
759
|
-
const
|
|
760
|
-
return
|
|
751
|
+
function s(f) {
|
|
752
|
+
const v = Array.from(f).length;
|
|
753
|
+
return v >= 2 && v <= 3 ? 2 : v >= 4 ? 3 : 1;
|
|
761
754
|
}
|
|
762
|
-
return (
|
|
763
|
-
g("div",
|
|
764
|
-
(
|
|
765
|
-
key:
|
|
766
|
-
class: O(["zhk-selection__text", [`zhk-selection__text--span-${
|
|
767
|
-
onClick: (h) => a(
|
|
768
|
-
}, D(
|
|
755
|
+
return (f, v) => (b(), x("div", ht, [
|
|
756
|
+
g("div", gt, [
|
|
757
|
+
(b(!0), x(L, null, V(f.candidates, (c, y) => (b(), x("div", {
|
|
758
|
+
key: y,
|
|
759
|
+
class: O(["zhk-selection__text", [`zhk-selection__text--span-${s(c)}`]]),
|
|
760
|
+
onClick: (h) => a(y)
|
|
761
|
+
}, D(c), 11, yt))), 128))
|
|
769
762
|
]),
|
|
770
763
|
g("div", { class: "zhk-selection__func" }, [
|
|
771
764
|
g("button", {
|
|
772
765
|
class: "zhk-selection__func-btn",
|
|
773
|
-
onClick:
|
|
766
|
+
onClick: r
|
|
774
767
|
}, " 返回 ")
|
|
775
768
|
])
|
|
776
769
|
]));
|
|
777
770
|
}
|
|
778
|
-
}),
|
|
771
|
+
}), wt = { class: "zhk-candidate" }, xt = { class: "zhk-candidate__container" }, zt = {
|
|
779
772
|
key: 0,
|
|
780
773
|
class: "zhk-candidate__pinyin"
|
|
781
|
-
},
|
|
774
|
+
}, Ct = { class: "zhk-candidate__bottom-container" }, Pt = /* @__PURE__ */ I({
|
|
782
775
|
__name: "CandidateBar",
|
|
783
776
|
props: {
|
|
784
777
|
modelValue: {
|
|
@@ -786,80 +779,82 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
786
779
|
},
|
|
787
780
|
modelModifiers: {}
|
|
788
781
|
},
|
|
789
|
-
emits: /* @__PURE__ */
|
|
790
|
-
setup(e, { expose: o, emit:
|
|
791
|
-
const a =
|
|
792
|
-
let
|
|
793
|
-
const
|
|
782
|
+
emits: /* @__PURE__ */ se(["key", "input"], ["update:modelValue"]),
|
|
783
|
+
setup(e, { expose: o, emit: i }) {
|
|
784
|
+
const a = i, r = ke(e, "modelValue");
|
|
785
|
+
let s = null;
|
|
786
|
+
const f = $(null), v = S(() => {
|
|
794
787
|
var u;
|
|
795
|
-
return ((u =
|
|
796
|
-
}),
|
|
788
|
+
return ((u = f.value) == null ? void 0 : u.candidates.map((p) => p.text)) ?? [];
|
|
789
|
+
}), c = $(!1);
|
|
797
790
|
Q(async () => {
|
|
798
|
-
if (
|
|
791
|
+
if (s = je(), !s)
|
|
799
792
|
throw new Error("未找到拼音引擎实例,请确保已正确注册引擎");
|
|
800
|
-
|
|
801
|
-
}),
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
793
|
+
r.value && (f.value = await s.processInput(r.value));
|
|
794
|
+
}), de(() => {
|
|
795
|
+
s == null || s.processInput("").catch(() => {
|
|
796
|
+
}), s = null;
|
|
797
|
+
}), X(r, async (u) => {
|
|
798
|
+
const p = s;
|
|
805
799
|
if (p) {
|
|
806
800
|
if (u === "") {
|
|
807
|
-
p.
|
|
801
|
+
p.processInput("").catch(() => {
|
|
802
|
+
}), f.value = null;
|
|
808
803
|
return;
|
|
809
804
|
}
|
|
810
|
-
|
|
805
|
+
f.value = await p.processInput(u);
|
|
811
806
|
}
|
|
812
807
|
});
|
|
813
|
-
async function
|
|
814
|
-
if (!
|
|
808
|
+
async function y(u) {
|
|
809
|
+
if (!s)
|
|
815
810
|
return;
|
|
816
|
-
const p = await
|
|
817
|
-
|
|
811
|
+
const p = await s.pickCandidate(u);
|
|
812
|
+
f.value = p, p.preeditBody || (a("input", p.committed || ""), r.value = "", f.value = null, c.value = !1);
|
|
818
813
|
}
|
|
819
814
|
o({
|
|
820
|
-
handleSelection:
|
|
815
|
+
handleSelection: y
|
|
821
816
|
});
|
|
822
817
|
const h = S(() => {
|
|
823
|
-
const u =
|
|
818
|
+
const u = f.value;
|
|
824
819
|
return u ? u.preeditHead + u.preeditBody : "";
|
|
825
820
|
});
|
|
826
|
-
return (u, p) => (
|
|
827
|
-
g("div",
|
|
828
|
-
h.value ? (
|
|
829
|
-
g("div",
|
|
830
|
-
|
|
821
|
+
return (u, p) => (b(), x("div", wt, [
|
|
822
|
+
g("div", xt, [
|
|
823
|
+
h.value ? (b(), x("div", zt, D(h.value), 1)) : W("", !0),
|
|
824
|
+
g("div", Ct, [
|
|
825
|
+
v.value.length > 0 ? (b(), K(xe, {
|
|
831
826
|
key: 0,
|
|
832
|
-
candidates:
|
|
833
|
-
onSelect:
|
|
827
|
+
candidates: v.value,
|
|
828
|
+
onSelect: y
|
|
834
829
|
}, null, 8, ["candidates"])) : W("", !0),
|
|
835
|
-
|
|
830
|
+
v.value.length > 0 ? (b(), x("button", {
|
|
836
831
|
key: 1,
|
|
837
832
|
class: "zhk-candidate__more",
|
|
838
|
-
onClick: p[0] || (p[0] = (
|
|
833
|
+
onClick: p[0] || (p[0] = (d) => c.value = !0)
|
|
839
834
|
}, p[2] || (p[2] = [
|
|
840
835
|
g("img", {
|
|
841
|
-
src:
|
|
836
|
+
src: kt,
|
|
842
837
|
alt: "更多"
|
|
843
838
|
}, null, -1)
|
|
844
839
|
]))) : W("", !0)
|
|
845
840
|
])
|
|
846
841
|
]),
|
|
847
|
-
|
|
842
|
+
c.value ? (b(), K(bt, {
|
|
848
843
|
key: 0,
|
|
849
|
-
candidates:
|
|
850
|
-
onSelect:
|
|
851
|
-
onClose: p[1] || (p[1] = (
|
|
844
|
+
candidates: v.value,
|
|
845
|
+
onSelect: y,
|
|
846
|
+
onClose: p[1] || (p[1] = (d) => c.value = !1)
|
|
852
847
|
}, null, 8, ["candidates"])) : W("", !0)
|
|
853
848
|
]));
|
|
854
849
|
}
|
|
855
|
-
}),
|
|
850
|
+
}), _t = { class: "zhk-base" }, Et = { class: "zhk-base__row" }, $t = ["onPointerdown"], St = ["disabled"], Lt = {
|
|
856
851
|
key: 1,
|
|
857
|
-
src:
|
|
852
|
+
src: pt,
|
|
858
853
|
class: "zhk-base__key-icon",
|
|
859
854
|
alt: "Shift"
|
|
860
|
-
},
|
|
855
|
+
}, Tt = ["onPointerdown"], Rt = { class: "zhk-base__row" }, Dt = { class: "zhk-base__toggle-main" }, Mt = { class: "zhk-base__toggle-sub" }, Ht = /* @__PURE__ */ I({
|
|
861
856
|
__name: "KeyboardBase",
|
|
862
|
-
props: /* @__PURE__ */
|
|
857
|
+
props: /* @__PURE__ */ se({
|
|
863
858
|
enableHandwriting: { type: Boolean }
|
|
864
859
|
}, {
|
|
865
860
|
modelValue: {
|
|
@@ -867,130 +862,130 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
867
862
|
},
|
|
868
863
|
modelModifiers: {}
|
|
869
864
|
}),
|
|
870
|
-
emits: /* @__PURE__ */
|
|
865
|
+
emits: /* @__PURE__ */ se(["key"], ["update:modelValue"]),
|
|
871
866
|
setup(e, { emit: o }) {
|
|
872
|
-
const
|
|
873
|
-
function
|
|
874
|
-
a("key", { key:
|
|
867
|
+
const i = e, a = o, r = ke(e, "modelValue"), s = S(() => r.value === "en_cap"), f = S(() => r.value === "zh"), v = S(() => f.value ? !0 : s.value);
|
|
868
|
+
function c(M, l = !1) {
|
|
869
|
+
a("key", { key: M, isControl: l });
|
|
875
870
|
}
|
|
876
|
-
function
|
|
877
|
-
|
|
871
|
+
function y() {
|
|
872
|
+
f.value ? r.value = "hand" : r.value = s.value ? "en" : "en_cap";
|
|
878
873
|
}
|
|
879
874
|
function h() {
|
|
880
|
-
|
|
875
|
+
r.value = "num";
|
|
881
876
|
}
|
|
882
877
|
function u() {
|
|
883
|
-
|
|
878
|
+
r.value = "symbol";
|
|
884
879
|
}
|
|
885
|
-
const p = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
|
|
880
|
+
const p = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"], d = [
|
|
886
881
|
["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
|
|
887
882
|
["a", "s", "d", "f", "g", "h", "j", "k", "l"],
|
|
888
883
|
["z", "x", "c", "v", "b", "n", "m"]
|
|
889
|
-
], m =
|
|
884
|
+
], m = $(""), P = $(null), { startRepeat: z, stopRepeat: t } = te();
|
|
890
885
|
function k() {
|
|
891
|
-
if (
|
|
886
|
+
if (r.value === "zh" && m.value) {
|
|
892
887
|
m.value = m.value.slice(0, -1);
|
|
893
888
|
return;
|
|
894
889
|
}
|
|
895
|
-
|
|
890
|
+
c("delete", !0);
|
|
896
891
|
}
|
|
897
892
|
function N() {
|
|
898
|
-
var
|
|
899
|
-
if (
|
|
900
|
-
(
|
|
893
|
+
var M;
|
|
894
|
+
if (r.value === "zh" && m.value) {
|
|
895
|
+
(M = P.value) == null || M.handleSelection(0);
|
|
901
896
|
return;
|
|
902
897
|
}
|
|
903
|
-
|
|
898
|
+
c(" ");
|
|
904
899
|
}
|
|
905
900
|
function ne() {
|
|
906
|
-
if (
|
|
907
|
-
|
|
901
|
+
if (r.value === "zh" && m.value) {
|
|
902
|
+
c(m.value), m.value = "";
|
|
908
903
|
return;
|
|
909
904
|
}
|
|
910
|
-
|
|
905
|
+
c("enter", !0);
|
|
911
906
|
}
|
|
912
|
-
function U(
|
|
913
|
-
if (
|
|
914
|
-
m.value +=
|
|
907
|
+
function U(M) {
|
|
908
|
+
if (r.value === "zh") {
|
|
909
|
+
m.value += M;
|
|
915
910
|
return;
|
|
916
911
|
}
|
|
917
|
-
const
|
|
918
|
-
|
|
912
|
+
const l = s.value ? M.toUpperCase() : M;
|
|
913
|
+
c(l);
|
|
919
914
|
}
|
|
920
915
|
function oe() {
|
|
921
|
-
|
|
916
|
+
r.value = r.value === "zh" ? "en" : "zh";
|
|
922
917
|
}
|
|
923
|
-
const
|
|
924
|
-
return (
|
|
925
|
-
g("div",
|
|
926
|
-
|
|
918
|
+
const E = S(() => i.enableHandwriting ? "手写" : "-"), T = S(() => !i.enableHandwriting);
|
|
919
|
+
return (M, l) => (b(), x("div", _t, [
|
|
920
|
+
g("div", Et, [
|
|
921
|
+
r.value === "zh" ? (b(), K(Pt, {
|
|
927
922
|
key: 0,
|
|
928
923
|
ref_key: "candidateBarRef",
|
|
929
|
-
ref:
|
|
924
|
+
ref: P,
|
|
930
925
|
modelValue: m.value,
|
|
931
|
-
"onUpdate:modelValue":
|
|
932
|
-
onInput:
|
|
933
|
-
}, null, 8, ["modelValue"])) : (
|
|
926
|
+
"onUpdate:modelValue": l[0] || (l[0] = (w) => m.value = w),
|
|
927
|
+
onInput: l[1] || (l[1] = (w) => c(w, !1))
|
|
928
|
+
}, null, 8, ["modelValue"])) : (b(), x(L, { key: 1 }, V(p, (w, F) => g("button", {
|
|
934
929
|
key: `number-${F}`,
|
|
935
930
|
class: "zhk-base__key zhk-base__key--letter",
|
|
936
|
-
onPointerdown: (
|
|
937
|
-
onPointerup:
|
|
938
|
-
(
|
|
939
|
-
onPointerleave:
|
|
940
|
-
(
|
|
941
|
-
onPointercancel:
|
|
942
|
-
(
|
|
943
|
-
onContextmenu:
|
|
931
|
+
onPointerdown: (_) => n(z)(_, () => U(w)),
|
|
932
|
+
onPointerup: l[2] || (l[2] = //@ts-ignore
|
|
933
|
+
(..._) => n(t) && n(t)(..._)),
|
|
934
|
+
onPointerleave: l[3] || (l[3] = //@ts-ignore
|
|
935
|
+
(..._) => n(t) && n(t)(..._)),
|
|
936
|
+
onPointercancel: l[4] || (l[4] = //@ts-ignore
|
|
937
|
+
(..._) => n(t) && n(t)(..._)),
|
|
938
|
+
onContextmenu: l[5] || (l[5] = C(() => {
|
|
944
939
|
}, ["prevent"]))
|
|
945
940
|
}, D(w), 41, $t)), 64))
|
|
946
941
|
]),
|
|
947
|
-
(
|
|
942
|
+
(b(), x(L, null, V(d, (w, F) => g("div", {
|
|
948
943
|
key: `row-${F}`,
|
|
949
944
|
class: "zhk-base__row"
|
|
950
945
|
}, [
|
|
951
|
-
F === 2 ? (
|
|
946
|
+
F === 2 ? (b(), x("button", {
|
|
952
947
|
key: 0,
|
|
953
948
|
class: O(["zhk-base__key zhk-base__key--function zhk-base__key--shift", {
|
|
954
|
-
"zhk-base__key--active": !
|
|
955
|
-
"zhk-base__key--disabled":
|
|
949
|
+
"zhk-base__key--active": !f.value && s.value,
|
|
950
|
+
"zhk-base__key--disabled": f.value && T.value
|
|
956
951
|
}]),
|
|
957
|
-
disabled:
|
|
958
|
-
onClick:
|
|
959
|
-
onContextmenu:
|
|
952
|
+
disabled: f.value && T.value,
|
|
953
|
+
onClick: y,
|
|
954
|
+
onContextmenu: l[6] || (l[6] = C(() => {
|
|
960
955
|
}, ["prevent"]))
|
|
961
956
|
}, [
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
], 64)) : (
|
|
965
|
-
], 42,
|
|
966
|
-
(
|
|
957
|
+
f.value ? (b(), x(L, { key: 0 }, [
|
|
958
|
+
ie(D(E.value), 1)
|
|
959
|
+
], 64)) : (b(), x("img", Lt))
|
|
960
|
+
], 42, St)) : W("", !0),
|
|
961
|
+
(b(!0), x(L, null, V(w, (_, Ce) => (b(), x("button", {
|
|
967
962
|
key: `key-${F}-${Ce}`,
|
|
968
963
|
class: "zhk-base__key zhk-base__key--letter",
|
|
969
|
-
onPointerdown: (A) => n(z)(A, () => U(
|
|
970
|
-
onPointerup:
|
|
964
|
+
onPointerdown: (A) => n(z)(A, () => U(_)),
|
|
965
|
+
onPointerup: l[7] || (l[7] = //@ts-ignore
|
|
971
966
|
(...A) => n(t) && n(t)(...A)),
|
|
972
|
-
onPointerleave:
|
|
967
|
+
onPointerleave: l[8] || (l[8] = //@ts-ignore
|
|
973
968
|
(...A) => n(t) && n(t)(...A)),
|
|
974
|
-
onPointercancel:
|
|
969
|
+
onPointercancel: l[9] || (l[9] = //@ts-ignore
|
|
975
970
|
(...A) => n(t) && n(t)(...A)),
|
|
976
|
-
onContextmenu:
|
|
971
|
+
onContextmenu: l[10] || (l[10] = C(() => {
|
|
977
972
|
}, ["prevent"]))
|
|
978
|
-
}, D(
|
|
979
|
-
F === 2 ? (
|
|
973
|
+
}, D(v.value ? _.toUpperCase() : _), 41, Tt))), 128)),
|
|
974
|
+
F === 2 ? (b(), x("button", {
|
|
980
975
|
key: 1,
|
|
981
976
|
class: "zhk-base__key zhk-base__key--function zhk-base__key--delete",
|
|
982
|
-
onPointerdown:
|
|
983
|
-
onPointerup:
|
|
984
|
-
(
|
|
985
|
-
onPointerleave:
|
|
986
|
-
(
|
|
987
|
-
onPointercancel:
|
|
988
|
-
(
|
|
989
|
-
onContextmenu:
|
|
977
|
+
onPointerdown: l[11] || (l[11] = (_) => n(z)(_, () => k())),
|
|
978
|
+
onPointerup: l[12] || (l[12] = //@ts-ignore
|
|
979
|
+
(..._) => n(t) && n(t)(..._)),
|
|
980
|
+
onPointerleave: l[13] || (l[13] = //@ts-ignore
|
|
981
|
+
(..._) => n(t) && n(t)(..._)),
|
|
982
|
+
onPointercancel: l[14] || (l[14] = //@ts-ignore
|
|
983
|
+
(..._) => n(t) && n(t)(..._)),
|
|
984
|
+
onContextmenu: l[15] || (l[15] = C(() => {
|
|
990
985
|
}, ["prevent"]))
|
|
991
|
-
},
|
|
986
|
+
}, l[39] || (l[39] = [
|
|
992
987
|
g("img", {
|
|
993
|
-
src:
|
|
988
|
+
src: ce,
|
|
994
989
|
class: "zhk-base__key-icon",
|
|
995
990
|
alt: "Delete"
|
|
996
991
|
}, null, -1)
|
|
@@ -1000,39 +995,39 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1000
995
|
g("button", {
|
|
1001
996
|
class: "zhk-base__key zhk-base__key--function",
|
|
1002
997
|
onClick: u,
|
|
1003
|
-
onContextmenu:
|
|
998
|
+
onContextmenu: l[16] || (l[16] = C(() => {
|
|
1004
999
|
}, ["prevent"]))
|
|
1005
1000
|
}, " 符 ", 32),
|
|
1006
1001
|
g("button", {
|
|
1007
1002
|
class: "zhk-base__key zhk-base__key--function",
|
|
1008
1003
|
onClick: h,
|
|
1009
|
-
onContextmenu:
|
|
1004
|
+
onContextmenu: l[17] || (l[17] = C(() => {
|
|
1010
1005
|
}, ["prevent"]))
|
|
1011
1006
|
}, " 123 ", 32),
|
|
1012
1007
|
g("button", {
|
|
1013
1008
|
class: "zhk-base__key",
|
|
1014
|
-
onPointerdown:
|
|
1015
|
-
onPointerup:
|
|
1009
|
+
onPointerdown: l[18] || (l[18] = (w) => n(z)(w, () => c(","))),
|
|
1010
|
+
onPointerup: l[19] || (l[19] = //@ts-ignore
|
|
1016
1011
|
(...w) => n(t) && n(t)(...w)),
|
|
1017
|
-
onPointerleave:
|
|
1012
|
+
onPointerleave: l[20] || (l[20] = //@ts-ignore
|
|
1018
1013
|
(...w) => n(t) && n(t)(...w)),
|
|
1019
|
-
onPointercancel:
|
|
1014
|
+
onPointercancel: l[21] || (l[21] = //@ts-ignore
|
|
1020
1015
|
(...w) => n(t) && n(t)(...w)),
|
|
1021
|
-
onContextmenu:
|
|
1016
|
+
onContextmenu: l[22] || (l[22] = C(() => {
|
|
1022
1017
|
}, ["prevent"]))
|
|
1023
1018
|
}, " , ", 32),
|
|
1024
1019
|
g("button", {
|
|
1025
1020
|
class: "zhk-base__key zhk-base__key--space",
|
|
1026
|
-
onPointerdown:
|
|
1027
|
-
onPointerup:
|
|
1021
|
+
onPointerdown: l[23] || (l[23] = (w) => n(z)(w, () => N())),
|
|
1022
|
+
onPointerup: l[24] || (l[24] = //@ts-ignore
|
|
1028
1023
|
(...w) => n(t) && n(t)(...w)),
|
|
1029
|
-
onPointerleave:
|
|
1024
|
+
onPointerleave: l[25] || (l[25] = //@ts-ignore
|
|
1030
1025
|
(...w) => n(t) && n(t)(...w)),
|
|
1031
|
-
onPointercancel:
|
|
1026
|
+
onPointercancel: l[26] || (l[26] = //@ts-ignore
|
|
1032
1027
|
(...w) => n(t) && n(t)(...w)),
|
|
1033
|
-
onContextmenu:
|
|
1028
|
+
onContextmenu: l[27] || (l[27] = C(() => {
|
|
1034
1029
|
}, ["prevent"]))
|
|
1035
|
-
},
|
|
1030
|
+
}, l[40] || (l[40] = [
|
|
1036
1031
|
g("img", {
|
|
1037
1032
|
src: ze,
|
|
1038
1033
|
class: "zhk-base__key-icon",
|
|
@@ -1041,39 +1036,39 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1041
1036
|
]), 32),
|
|
1042
1037
|
g("button", {
|
|
1043
1038
|
class: "zhk-base__key",
|
|
1044
|
-
onPointerdown:
|
|
1045
|
-
onPointerup:
|
|
1039
|
+
onPointerdown: l[28] || (l[28] = (w) => n(z)(w, () => c("。"))),
|
|
1040
|
+
onPointerup: l[29] || (l[29] = //@ts-ignore
|
|
1046
1041
|
(...w) => n(t) && n(t)(...w)),
|
|
1047
|
-
onPointerleave:
|
|
1042
|
+
onPointerleave: l[30] || (l[30] = //@ts-ignore
|
|
1048
1043
|
(...w) => n(t) && n(t)(...w)),
|
|
1049
|
-
onPointercancel:
|
|
1044
|
+
onPointercancel: l[31] || (l[31] = //@ts-ignore
|
|
1050
1045
|
(...w) => n(t) && n(t)(...w)),
|
|
1051
|
-
onContextmenu:
|
|
1046
|
+
onContextmenu: l[32] || (l[32] = C(() => {
|
|
1052
1047
|
}, ["prevent"]))
|
|
1053
1048
|
}, " 。 ", 32),
|
|
1054
1049
|
g("button", {
|
|
1055
1050
|
class: "zhk-base__key zhk-base__key--function",
|
|
1056
1051
|
onClick: oe,
|
|
1057
|
-
onContextmenu:
|
|
1052
|
+
onContextmenu: l[33] || (l[33] = C(() => {
|
|
1058
1053
|
}, ["prevent"]))
|
|
1059
1054
|
}, [
|
|
1060
|
-
g("span",
|
|
1061
|
-
g("span",
|
|
1055
|
+
g("span", Dt, D(r.value === "zh" ? "中" : "英"), 1),
|
|
1056
|
+
g("span", Mt, "/" + D(r.value === "zh" ? "英" : "中"), 1)
|
|
1062
1057
|
], 32),
|
|
1063
1058
|
g("button", {
|
|
1064
1059
|
class: "zhk-base__key zhk-base__key--function",
|
|
1065
|
-
onPointerdown:
|
|
1066
|
-
onPointerup:
|
|
1060
|
+
onPointerdown: l[34] || (l[34] = (w) => n(z)(w, () => ne())),
|
|
1061
|
+
onPointerup: l[35] || (l[35] = //@ts-ignore
|
|
1067
1062
|
(...w) => n(t) && n(t)(...w)),
|
|
1068
|
-
onPointerleave:
|
|
1063
|
+
onPointerleave: l[36] || (l[36] = //@ts-ignore
|
|
1069
1064
|
(...w) => n(t) && n(t)(...w)),
|
|
1070
|
-
onPointercancel:
|
|
1065
|
+
onPointercancel: l[37] || (l[37] = //@ts-ignore
|
|
1071
1066
|
(...w) => n(t) && n(t)(...w)),
|
|
1072
|
-
onContextmenu:
|
|
1067
|
+
onContextmenu: l[38] || (l[38] = C(() => {
|
|
1073
1068
|
}, ["prevent"]))
|
|
1074
|
-
},
|
|
1069
|
+
}, l[41] || (l[41] = [
|
|
1075
1070
|
g("img", {
|
|
1076
|
-
src:
|
|
1071
|
+
src: ve,
|
|
1077
1072
|
class: "zhk-base__key-icon",
|
|
1078
1073
|
alt: "Enter"
|
|
1079
1074
|
}, null, -1)
|
|
@@ -1081,15 +1076,15 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1081
1076
|
])
|
|
1082
1077
|
]));
|
|
1083
1078
|
}
|
|
1084
|
-
}),
|
|
1079
|
+
}), Vt = { class: "num-keyboard" }, Bt = { class: "num-keyboard__container" }, It = { class: "num-keyboard__left" }, At = { class: "num-keyboard__rows" }, Kt = ["onClick", "onPointerdown"], Wt = {
|
|
1085
1080
|
key: 1,
|
|
1086
1081
|
src: ze,
|
|
1087
1082
|
class: "zhk-base__key-icon",
|
|
1088
1083
|
alt: "Space"
|
|
1089
|
-
},
|
|
1084
|
+
}, Ot = { class: "num-keyboard__right" }, Nt = ["onPointerdown"], Ut = ["src", "alt"], Ft = { key: 1 }, Zt = /* @__PURE__ */ I({
|
|
1090
1085
|
__name: "NumericKeyboard",
|
|
1091
1086
|
props: {
|
|
1092
|
-
keyboardRows: { default: () =>
|
|
1087
|
+
keyboardRows: { default: () => Z().numKeys || [
|
|
1093
1088
|
["1", "2", "3"],
|
|
1094
1089
|
["4", "5", "6"],
|
|
1095
1090
|
["7", "8", "9"],
|
|
@@ -1098,137 +1093,137 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1098
1093
|
},
|
|
1099
1094
|
emits: ["key", "exit"],
|
|
1100
1095
|
setup(e, { emit: o }) {
|
|
1101
|
-
const
|
|
1102
|
-
{ key: "delete", icon:
|
|
1096
|
+
const i = o, a = [
|
|
1097
|
+
{ key: "delete", icon: ce, text: "", alt: "Delete" },
|
|
1103
1098
|
{ key: ".", icon: "", text: ".", alt: "." },
|
|
1104
1099
|
{ key: "@", icon: "", text: "@", alt: "@" },
|
|
1105
|
-
{ key: "enter", icon:
|
|
1100
|
+
{ key: "enter", icon: ve, text: "", alt: "Enter" }
|
|
1106
1101
|
];
|
|
1107
|
-
function
|
|
1108
|
-
|
|
1102
|
+
function r(h) {
|
|
1103
|
+
i("key", { key: h });
|
|
1109
1104
|
}
|
|
1110
|
-
function
|
|
1111
|
-
|
|
1105
|
+
function s(h, u = !0) {
|
|
1106
|
+
i("key", { key: h, isControl: u });
|
|
1112
1107
|
}
|
|
1113
|
-
function
|
|
1114
|
-
|
|
1108
|
+
function f() {
|
|
1109
|
+
i("exit");
|
|
1115
1110
|
}
|
|
1116
|
-
const { startRepeat:
|
|
1117
|
-
function
|
|
1118
|
-
h === "back" || (h === "space" && (h = " "), h === "delete" || h === "enter" ?
|
|
1111
|
+
const { startRepeat: v, stopRepeat: c } = te();
|
|
1112
|
+
function y(h, u) {
|
|
1113
|
+
h === "back" || (h === "space" && (h = " "), h === "delete" || h === "enter" ? v(u, () => s(h)) : v(u, () => r(h)));
|
|
1119
1114
|
}
|
|
1120
|
-
return (h, u) => (
|
|
1121
|
-
g("div",
|
|
1122
|
-
g("div",
|
|
1123
|
-
g("div",
|
|
1124
|
-
(
|
|
1125
|
-
key: `row-${
|
|
1115
|
+
return (h, u) => (b(), x("div", Vt, [
|
|
1116
|
+
g("div", Bt, [
|
|
1117
|
+
g("div", It, [
|
|
1118
|
+
g("div", At, [
|
|
1119
|
+
(b(!0), x(L, null, V(h.keyboardRows, (p, d) => (b(), x("div", {
|
|
1120
|
+
key: `row-${d}`,
|
|
1126
1121
|
class: "num-keyboard__row"
|
|
1127
1122
|
}, [
|
|
1128
|
-
(
|
|
1129
|
-
key: `key-${
|
|
1123
|
+
(b(!0), x(L, null, V(p, (m, P) => (b(), x("button", {
|
|
1124
|
+
key: `key-${d}-${P}`,
|
|
1130
1125
|
class: O(["num-keyboard__key", {
|
|
1131
1126
|
"num-keyboard__key--back": m === "back",
|
|
1132
1127
|
"num-keyboard__key--space": m === "space"
|
|
1133
1128
|
}]),
|
|
1134
|
-
onClick: (z) => m === "back" &&
|
|
1135
|
-
onPointerdown: (z) =>
|
|
1129
|
+
onClick: (z) => m === "back" && f(),
|
|
1130
|
+
onPointerdown: (z) => y(m, z),
|
|
1136
1131
|
onPointerup: u[0] || (u[0] = //@ts-ignore
|
|
1137
|
-
(...z) => n(
|
|
1132
|
+
(...z) => n(c) && n(c)(...z)),
|
|
1138
1133
|
onPointerleave: u[1] || (u[1] = //@ts-ignore
|
|
1139
|
-
(...z) => n(
|
|
1134
|
+
(...z) => n(c) && n(c)(...z)),
|
|
1140
1135
|
onPointercancel: u[2] || (u[2] = //@ts-ignore
|
|
1141
|
-
(...z) => n(
|
|
1136
|
+
(...z) => n(c) && n(c)(...z)),
|
|
1142
1137
|
onContextmenu: u[3] || (u[3] = C(() => {
|
|
1143
1138
|
}, ["prevent"]))
|
|
1144
1139
|
}, [
|
|
1145
|
-
m === "back" ? (
|
|
1146
|
-
|
|
1147
|
-
], 64)) : m === "space" ? (
|
|
1148
|
-
|
|
1140
|
+
m === "back" ? (b(), x(L, { key: 0 }, [
|
|
1141
|
+
ie(" 返回 ")
|
|
1142
|
+
], 64)) : m === "space" ? (b(), x("img", Wt)) : (b(), x(L, { key: 2 }, [
|
|
1143
|
+
ie(D(m), 1)
|
|
1149
1144
|
], 64))
|
|
1150
|
-
], 42,
|
|
1145
|
+
], 42, Kt))), 128))
|
|
1151
1146
|
]))), 128))
|
|
1152
1147
|
])
|
|
1153
1148
|
]),
|
|
1154
|
-
g("div",
|
|
1155
|
-
(
|
|
1156
|
-
key: `func-${
|
|
1149
|
+
g("div", Ot, [
|
|
1150
|
+
(b(), x(L, null, V(a, (p, d) => g("button", {
|
|
1151
|
+
key: `func-${d}`,
|
|
1157
1152
|
class: "num-keyboard__key num-keyboard__key--function",
|
|
1158
|
-
onPointerdown: (m) =>
|
|
1153
|
+
onPointerdown: (m) => y(p.key, m),
|
|
1159
1154
|
onPointerup: u[4] || (u[4] = //@ts-ignore
|
|
1160
|
-
(...m) => n(
|
|
1155
|
+
(...m) => n(c) && n(c)(...m)),
|
|
1161
1156
|
onPointerleave: u[5] || (u[5] = //@ts-ignore
|
|
1162
|
-
(...m) => n(
|
|
1157
|
+
(...m) => n(c) && n(c)(...m)),
|
|
1163
1158
|
onPointercancel: u[6] || (u[6] = //@ts-ignore
|
|
1164
|
-
(...m) => n(
|
|
1159
|
+
(...m) => n(c) && n(c)(...m)),
|
|
1165
1160
|
onContextmenu: u[7] || (u[7] = C(() => {
|
|
1166
1161
|
}, ["prevent"]))
|
|
1167
1162
|
}, [
|
|
1168
|
-
p.icon ? (
|
|
1163
|
+
p.icon ? (b(), x("img", {
|
|
1169
1164
|
key: 0,
|
|
1170
1165
|
src: p.icon,
|
|
1171
1166
|
class: "num-keyboard__key-icon",
|
|
1172
1167
|
alt: p.alt
|
|
1173
|
-
}, null, 8,
|
|
1174
|
-
], 40,
|
|
1168
|
+
}, null, 8, Ut)) : (b(), x("span", Ft, D(p.text), 1))
|
|
1169
|
+
], 40, Nt)), 64))
|
|
1175
1170
|
])
|
|
1176
1171
|
])
|
|
1177
1172
|
]));
|
|
1178
1173
|
}
|
|
1179
|
-
}),
|
|
1174
|
+
}), Xt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M18,20V10H6V20H18M18,8A2,2%200%200,1%2020,10V20A2,2%200%200,1%2018,22H6C4.89,22%204,21.1%204,20V10A2,2%200%200,1%206,8H15V6A3,3%200%200,0%2012,3A3,3%200%200,0%209,6H7A5,5%200%200,1%2012,1A5,5%200%200,1%2017,6V8H18M12,17A2,2%200%200,1%2010,15A2,2%200%200,1%2012,13A2,2%200%200,1%2014,15A2,2%200%200,1%2012,17Z'%20/%3e%3c/svg%3e", Yt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M12,17C10.89,17%2010,16.1%2010,15C10,13.89%2010.89,13%2012,13A2,2%200%200,1%2014,15A2,2%200%200,1%2012,17M18,20V10H6V20H18M18,8A2,2%200%200,1%2020,10V20A2,2%200%200,1%2018,22H6C4.89,22%204,21.1%204,20V10C4,8.89%204.89,8%206,8H7V6A5,5%200%200,1%2012,1A5,5%200%200,1%2017,6V8H18M12,3A3,3%200%200,0%209,6V8H15V6A3,3%200%200,0%2012,3Z'%20/%3e%3c/svg%3e", jt = { class: "symbol-keyboard" }, Gt = { class: "symbol-keyboard__content" }, qt = { class: "symbol-keyboard__functions" }, Jt = { class: "symbol-keyboard__lang-selector" }, Qt = { class: "symbol-keyboard__control-group" }, en = ["src"], tn = ["src"], nn = { class: "symbol-keyboard__symbols-container" }, on = { class: "symbol-keyboard__symbols-grid" }, sn = ["onClick", "onPointerdown"], rn = "!@#$%^&*(){}[]<>/\\|:;\"',.?+-=_~`€£¥₹©®™°", ln = "!@#¥%…&*(){}[]<>/\|:;"',。?+-=_~·€£¥₹©®™°", an = /* @__PURE__ */ I({
|
|
1180
1175
|
__name: "SymbolKeyboard",
|
|
1181
1176
|
emits: ["key", "exit"],
|
|
1182
1177
|
setup(e, { emit: o }) {
|
|
1183
|
-
const
|
|
1184
|
-
function
|
|
1185
|
-
|
|
1178
|
+
const i = o, a = $("en"), r = S(() => a.value === "zh" ? ln : rn), s = $(!1), { startRepeat: f, stopRepeat: v } = te();
|
|
1179
|
+
function c(d, m) {
|
|
1180
|
+
s.value && f(m, () => y(d));
|
|
1186
1181
|
}
|
|
1187
|
-
function
|
|
1188
|
-
|
|
1182
|
+
function y(d) {
|
|
1183
|
+
i("key", { key: d }), s.value || i("exit");
|
|
1189
1184
|
}
|
|
1190
1185
|
function h() {
|
|
1191
|
-
|
|
1186
|
+
i("exit");
|
|
1192
1187
|
}
|
|
1193
|
-
function u(
|
|
1194
|
-
a.value =
|
|
1188
|
+
function u(d) {
|
|
1189
|
+
a.value = d;
|
|
1195
1190
|
}
|
|
1196
1191
|
function p() {
|
|
1197
|
-
|
|
1192
|
+
s.value = !s.value;
|
|
1198
1193
|
}
|
|
1199
|
-
return (
|
|
1200
|
-
g("div",
|
|
1201
|
-
g("div",
|
|
1202
|
-
g("div",
|
|
1194
|
+
return (d, m) => (b(), x("div", jt, [
|
|
1195
|
+
g("div", Gt, [
|
|
1196
|
+
g("div", qt, [
|
|
1197
|
+
g("div", Jt, [
|
|
1203
1198
|
g("button", {
|
|
1204
1199
|
class: O(["symbol-keyboard__lang-btn", { "symbol-keyboard__lang-btn--active": a.value === "zh" }]),
|
|
1205
|
-
onClick: m[0] || (m[0] = (
|
|
1200
|
+
onClick: m[0] || (m[0] = (P) => u("zh")),
|
|
1206
1201
|
onContextmenu: m[1] || (m[1] = C(() => {
|
|
1207
1202
|
}, ["prevent"]))
|
|
1208
1203
|
}, " 中文 ", 34),
|
|
1209
1204
|
g("button", {
|
|
1210
1205
|
class: O(["symbol-keyboard__lang-btn", { "symbol-keyboard__lang-btn--active": a.value === "en" }]),
|
|
1211
|
-
onClick: m[2] || (m[2] = (
|
|
1206
|
+
onClick: m[2] || (m[2] = (P) => u("en")),
|
|
1212
1207
|
onContextmenu: m[3] || (m[3] = C(() => {
|
|
1213
1208
|
}, ["prevent"]))
|
|
1214
1209
|
}, " 英文 ", 34)
|
|
1215
1210
|
]),
|
|
1216
|
-
g("div",
|
|
1211
|
+
g("div", Qt, [
|
|
1217
1212
|
g("button", {
|
|
1218
|
-
class: O(["symbol-keyboard__key symbol-keyboard__key--function symbol-keyboard__key--lock", { "symbol-keyboard__key--locked":
|
|
1213
|
+
class: O(["symbol-keyboard__key symbol-keyboard__key--function symbol-keyboard__key--lock", { "symbol-keyboard__key--locked": s.value }]),
|
|
1219
1214
|
onClick: p,
|
|
1220
1215
|
onContextmenu: m[4] || (m[4] = C(() => {
|
|
1221
1216
|
}, ["prevent"]))
|
|
1222
1217
|
}, [
|
|
1223
|
-
|
|
1218
|
+
s.value ? (b(), x("img", {
|
|
1224
1219
|
key: 1,
|
|
1225
|
-
src: n(
|
|
1220
|
+
src: n(Yt),
|
|
1226
1221
|
alt: "Lock closed"
|
|
1227
|
-
}, null, 8,
|
|
1222
|
+
}, null, 8, tn)) : (b(), x("img", {
|
|
1228
1223
|
key: 0,
|
|
1229
|
-
src: n(
|
|
1224
|
+
src: n(Xt),
|
|
1230
1225
|
alt: "Lock open"
|
|
1231
|
-
}, null, 8,
|
|
1226
|
+
}, null, 8, en))
|
|
1232
1227
|
], 34),
|
|
1233
1228
|
g("button", {
|
|
1234
1229
|
class: "symbol-keyboard__key symbol-keyboard__key--function symbol-keyboard__key--back",
|
|
@@ -1238,157 +1233,197 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1238
1233
|
}, " 返回 ", 32)
|
|
1239
1234
|
])
|
|
1240
1235
|
]),
|
|
1241
|
-
g("div",
|
|
1242
|
-
g("div",
|
|
1243
|
-
(
|
|
1236
|
+
g("div", nn, [
|
|
1237
|
+
g("div", on, [
|
|
1238
|
+
(b(!0), x(L, null, V(r.value, (P, z) => (b(), x("button", {
|
|
1244
1239
|
key: `key-${z}`,
|
|
1245
1240
|
class: "symbol-keyboard__key",
|
|
1246
|
-
onClick: (t) => !
|
|
1247
|
-
onPointerdown: (t) =>
|
|
1241
|
+
onClick: (t) => !s.value && y(P),
|
|
1242
|
+
onPointerdown: (t) => c(P, t),
|
|
1248
1243
|
onPointerup: m[6] || (m[6] = //@ts-ignore
|
|
1249
|
-
(...t) => n(
|
|
1244
|
+
(...t) => n(v) && n(v)(...t)),
|
|
1250
1245
|
onPointerleave: m[7] || (m[7] = //@ts-ignore
|
|
1251
|
-
(...t) => n(
|
|
1246
|
+
(...t) => n(v) && n(v)(...t)),
|
|
1252
1247
|
onPointercancel: m[8] || (m[8] = //@ts-ignore
|
|
1253
|
-
(...t) => n(
|
|
1248
|
+
(...t) => n(v) && n(v)(...t)),
|
|
1254
1249
|
onContextmenu: m[9] || (m[9] = C(() => {
|
|
1255
1250
|
}, ["prevent"]))
|
|
1256
|
-
}, D(
|
|
1251
|
+
}, D(P), 41, sn))), 128))
|
|
1257
1252
|
])
|
|
1258
1253
|
])
|
|
1259
1254
|
])
|
|
1260
1255
|
]));
|
|
1261
1256
|
}
|
|
1262
|
-
}),
|
|
1257
|
+
}), un = {
|
|
1263
1258
|
key: 0,
|
|
1264
1259
|
class: "zhk__disabled-overlay"
|
|
1265
|
-
},
|
|
1260
|
+
}, dn = /* @__PURE__ */ I({
|
|
1266
1261
|
__name: "ZhKeyboard",
|
|
1267
1262
|
props: {
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1263
|
+
/**
|
|
1264
|
+
* 默认的键盘模式
|
|
1265
|
+
*/
|
|
1266
|
+
defaultMode: {
|
|
1267
|
+
type: String,
|
|
1268
|
+
default: () => Z().defaultMode ?? "en"
|
|
1269
|
+
},
|
|
1270
|
+
/**
|
|
1271
|
+
* 是否启用手写输入
|
|
1272
|
+
*/
|
|
1273
|
+
enableHandwriting: {
|
|
1274
|
+
type: Boolean,
|
|
1275
|
+
default: () => Z().enableHandwriting ?? !1
|
|
1276
|
+
},
|
|
1277
|
+
/**
|
|
1278
|
+
* 键盘定位模式
|
|
1279
|
+
* @default 'static'
|
|
1280
|
+
*/
|
|
1281
|
+
position: {
|
|
1282
|
+
type: String,
|
|
1283
|
+
default: () => Z().position ?? "static"
|
|
1284
|
+
},
|
|
1285
|
+
/**
|
|
1286
|
+
* 浮动模式下键盘与输入框的距离
|
|
1287
|
+
* @default 10
|
|
1288
|
+
*/
|
|
1289
|
+
floatMarginTop: {
|
|
1290
|
+
type: Number,
|
|
1291
|
+
default: () => Z().floatMarginTop ?? 0
|
|
1292
|
+
},
|
|
1293
|
+
/**
|
|
1294
|
+
* 当没有input获得焦点时是否禁用键盘
|
|
1295
|
+
* @default true
|
|
1296
|
+
*/
|
|
1297
|
+
disableWhenNoFocus: {
|
|
1298
|
+
type: Boolean,
|
|
1299
|
+
default: () => Z().disableWhenNoFocus ?? !0
|
|
1300
|
+
},
|
|
1301
|
+
/**
|
|
1302
|
+
* 数字键盘的行配置
|
|
1303
|
+
*/
|
|
1304
|
+
numKeys: {
|
|
1305
|
+
type: Array || void 0
|
|
1306
|
+
}
|
|
1273
1307
|
},
|
|
1274
1308
|
emits: ["key"],
|
|
1275
1309
|
setup(e, { emit: o }) {
|
|
1276
|
-
const
|
|
1277
|
-
|
|
1278
|
-
|
|
1310
|
+
const i = e, a = o, r = $(i.defaultMode), s = $(i.defaultMode), f = $([]), v = $(!1), c = $(null), y = $(null), { recognizerInitialized: h, recognizerProgress: u } = ot(i.enableHandwriting);
|
|
1311
|
+
X(r, (E, T) => {
|
|
1312
|
+
E !== T && (s.value = T);
|
|
1279
1313
|
});
|
|
1280
|
-
const p = Ze(),
|
|
1314
|
+
const p = Ze(), d = S(() => p.value && ue(p.value) ? p.value : null), m = S(() => i.position === "static" || !!(p.value && ue(p.value))), { height: P } = ge(y);
|
|
1281
1315
|
q(() => {
|
|
1282
|
-
if (
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1316
|
+
if (d.value) {
|
|
1317
|
+
const E = d.value.dataset.inputmode;
|
|
1318
|
+
E && (r.value = E);
|
|
1285
1319
|
}
|
|
1286
1320
|
});
|
|
1287
|
-
const z = S(() =>
|
|
1321
|
+
const z = S(() => i.disableWhenNoFocus === !1 ? !1 : !d.value);
|
|
1288
1322
|
function t() {
|
|
1289
|
-
if (!
|
|
1323
|
+
if (!P.value)
|
|
1290
1324
|
return;
|
|
1291
|
-
const
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1325
|
+
const E = Ge(
|
|
1326
|
+
d.value,
|
|
1327
|
+
y.value,
|
|
1328
|
+
i.position,
|
|
1329
|
+
i.floatMarginTop
|
|
1295
1330
|
);
|
|
1296
|
-
|
|
1331
|
+
c.value = E;
|
|
1297
1332
|
}
|
|
1298
1333
|
q(t);
|
|
1299
1334
|
const k = Ke(t, 100);
|
|
1300
1335
|
J(window, "scroll", k, { passive: !0 }), J(window, "resize", k, { passive: !0 });
|
|
1301
|
-
function N(
|
|
1302
|
-
if (
|
|
1303
|
-
switch (
|
|
1336
|
+
function N(E) {
|
|
1337
|
+
if (E.isControl) {
|
|
1338
|
+
switch (E.key) {
|
|
1304
1339
|
case "delete":
|
|
1305
|
-
et(
|
|
1340
|
+
et(d.value);
|
|
1306
1341
|
break;
|
|
1307
1342
|
case "more":
|
|
1308
|
-
|
|
1343
|
+
v.value = !0;
|
|
1309
1344
|
break;
|
|
1310
1345
|
}
|
|
1311
1346
|
return;
|
|
1312
1347
|
} else
|
|
1313
|
-
ne(
|
|
1314
|
-
a("key",
|
|
1348
|
+
ne(E.key);
|
|
1349
|
+
a("key", E);
|
|
1315
1350
|
}
|
|
1316
|
-
function ne(
|
|
1317
|
-
Qe(
|
|
1351
|
+
function ne(E) {
|
|
1352
|
+
Qe(d.value, E);
|
|
1318
1353
|
}
|
|
1319
1354
|
function U() {
|
|
1320
|
-
|
|
1355
|
+
r.value === "hand" ? s.value = "zh" : ["num", "symbol"].includes(s.value) && (s.value = i.defaultMode), r.value = s.value;
|
|
1321
1356
|
}
|
|
1322
|
-
function oe(
|
|
1323
|
-
|
|
1357
|
+
function oe(E) {
|
|
1358
|
+
f.value = E;
|
|
1324
1359
|
}
|
|
1325
|
-
return (
|
|
1360
|
+
return (E, T) => Te((b(), x("div", {
|
|
1326
1361
|
ref_key: "keyboardRef",
|
|
1327
|
-
ref:
|
|
1362
|
+
ref: y,
|
|
1328
1363
|
class: O(["zhk", {
|
|
1329
|
-
"zhk--floating":
|
|
1330
|
-
"zhk--bottom":
|
|
1364
|
+
"zhk--floating": e.position === "float",
|
|
1365
|
+
"zhk--bottom": e.position === "bottom",
|
|
1331
1366
|
"zhk--disabled": z.value
|
|
1332
1367
|
}]),
|
|
1333
|
-
style:
|
|
1334
|
-
"--keyboard-height": `${n(
|
|
1335
|
-
...
|
|
1368
|
+
style: pe({
|
|
1369
|
+
"--keyboard-height": `${n(P)}px`,
|
|
1370
|
+
...c.value
|
|
1336
1371
|
}),
|
|
1337
|
-
onMousedown:
|
|
1372
|
+
onMousedown: T[1] || (T[1] = C(() => {
|
|
1338
1373
|
}, ["prevent"]))
|
|
1339
1374
|
}, [
|
|
1340
|
-
z.value || !m.value || !n(
|
|
1375
|
+
z.value || !m.value || !n(P) ? (b(), x("div", un, T[2] || (T[2] = [
|
|
1341
1376
|
g("span", null, "请选择输入框以启用键盘", -1)
|
|
1342
|
-
]))) : (
|
|
1343
|
-
|
|
1377
|
+
]))) : (b(), x(L, { key: 1 }, [
|
|
1378
|
+
r.value === "hand" ? (b(), K(mt, {
|
|
1344
1379
|
key: 0,
|
|
1345
1380
|
"recognizer-initialized": n(h),
|
|
1346
1381
|
"recognizer-progress": n(u),
|
|
1347
1382
|
onKey: N,
|
|
1348
1383
|
onExit: U,
|
|
1349
1384
|
onRecognize: oe
|
|
1350
|
-
}, null, 8, ["recognizer-initialized", "recognizer-progress"])) :
|
|
1385
|
+
}, null, 8, ["recognizer-initialized", "recognizer-progress"])) : r.value === "num" ? (b(), K(Zt, {
|
|
1351
1386
|
key: 1,
|
|
1352
|
-
"keyboard-rows":
|
|
1387
|
+
"keyboard-rows": e.numKeys,
|
|
1353
1388
|
onKey: N,
|
|
1354
1389
|
onExit: U
|
|
1355
|
-
}, null, 8, ["keyboard-rows"])) :
|
|
1390
|
+
}, null, 8, ["keyboard-rows"])) : r.value === "symbol" ? (b(), K(an, {
|
|
1356
1391
|
key: 2,
|
|
1357
1392
|
onKey: N,
|
|
1358
1393
|
onExit: U
|
|
1359
|
-
})) :
|
|
1394
|
+
})) : r.value === "en" || r.value === "en_cap" || r.value === "zh" ? (b(), K(Ht, {
|
|
1360
1395
|
key: 3,
|
|
1361
|
-
modelValue:
|
|
1362
|
-
"onUpdate:modelValue":
|
|
1363
|
-
"enable-handwriting":
|
|
1396
|
+
modelValue: r.value,
|
|
1397
|
+
"onUpdate:modelValue": T[0] || (T[0] = (M) => r.value = M),
|
|
1398
|
+
"enable-handwriting": e.enableHandwriting,
|
|
1364
1399
|
onKey: N
|
|
1365
1400
|
}, null, 8, ["modelValue", "enable-handwriting"])) : W("", !0)
|
|
1366
1401
|
], 64))
|
|
1367
1402
|
], 38)), [
|
|
1368
|
-
[
|
|
1403
|
+
[Re, m.value]
|
|
1369
1404
|
]);
|
|
1370
1405
|
}
|
|
1371
|
-
}),
|
|
1406
|
+
}), hn = {
|
|
1372
1407
|
install: (e) => {
|
|
1373
|
-
e.component("ZhKeyboard",
|
|
1408
|
+
e.component("ZhKeyboard", dn);
|
|
1374
1409
|
}
|
|
1375
1410
|
};
|
|
1376
1411
|
export {
|
|
1377
1412
|
Ye as CanvasDrawer,
|
|
1378
|
-
|
|
1413
|
+
dn as ZhKeyboard,
|
|
1379
1414
|
Ge as calculateKeyboardPosition,
|
|
1380
1415
|
nt as createKeyRepeater,
|
|
1381
|
-
|
|
1416
|
+
hn as default,
|
|
1382
1417
|
et as delToInputElement,
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1418
|
+
ae as getHandwritingRecognizer,
|
|
1419
|
+
kn as getInputElement,
|
|
1420
|
+
Z as getKeyboardConfig,
|
|
1386
1421
|
je as getPinyinEngine,
|
|
1387
|
-
|
|
1422
|
+
ue as isInputElement,
|
|
1388
1423
|
tt as moveCursor,
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1424
|
+
mn as registerHandwritingRecognizer,
|
|
1425
|
+
pn as registerPinyinEngine,
|
|
1426
|
+
fn as setKeyboardConfig,
|
|
1392
1427
|
Qe as writeToInputElement
|
|
1393
1428
|
};
|
|
1394
1429
|
//# sourceMappingURL=zh-keyboard-vue.js.map
|