@zh-keyboard/vue 1.0.0 → 1.1.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.
package/dist/zh-keyboard-vue.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var Pe = Object.defineProperty;
|
|
2
2
|
var _e = (e, o, s) => o in e ? Pe(e, o, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[o] = s;
|
|
3
3
|
var T = (e, o, s) => _e(e, typeof o != "symbol" ? o + "" : o, s);
|
|
4
|
-
import { onMounted as Q, nextTick as me, watch as
|
|
4
|
+
import { onMounted as Q, nextTick as me, watch as X, getCurrentScope as $e, onScopeDispose as Ee, getCurrentInstance as pe, toValue as B, shallowRef as G, computed as S, watchEffect as q, unref as n, ref as E, onUnmounted as ce, 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 h, withModifiers as C, normalizeStyle as se, normalizeClass as O, mergeModels as ie, useModel as ke, createBlock as K, createCommentVNode as W, createTextVNode as re, withDirectives as Re, vShow as Te } from "vue";
|
|
5
5
|
function ee(e) {
|
|
6
6
|
return $e() ? (Ee(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]", le = () => {
|
|
11
11
|
};
|
|
12
12
|
function Be(e, o) {
|
|
13
13
|
function s(...a) {
|
|
@@ -19,18 +19,18 @@ function Be(e, o) {
|
|
|
19
19
|
}
|
|
20
20
|
function Ie(e, o = {}) {
|
|
21
21
|
let s, a, l = le;
|
|
22
|
-
const i = (
|
|
23
|
-
clearTimeout(
|
|
22
|
+
const i = (c) => {
|
|
23
|
+
clearTimeout(c), l(), l = le;
|
|
24
24
|
};
|
|
25
25
|
let d;
|
|
26
|
-
return (
|
|
27
|
-
const
|
|
28
|
-
return s && i(s),
|
|
29
|
-
l = o.rejectOnCancel ? p : u, d =
|
|
26
|
+
return (c) => {
|
|
27
|
+
const y = B(e), g = B(o.maxWait);
|
|
28
|
+
return s && i(s), y <= 0 || g !== void 0 && g <= 0 ? (a && (i(a), a = null), Promise.resolve(c())) : new Promise((u, p) => {
|
|
29
|
+
l = o.rejectOnCancel ? p : u, d = c, g && !a && (a = setTimeout(() => {
|
|
30
30
|
s && i(s), a = null, u(d());
|
|
31
|
-
},
|
|
32
|
-
a && i(a), a = null, u(
|
|
33
|
-
},
|
|
31
|
+
}, g)), s = setTimeout(() => {
|
|
32
|
+
a && i(a), a = null, u(c());
|
|
33
|
+
}, y);
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
}
|
|
@@ -50,7 +50,7 @@ function We(e, o = !0, s) {
|
|
|
50
50
|
Ae() ? Q(e, s) : o ? e() : me(e);
|
|
51
51
|
}
|
|
52
52
|
function Oe(e, o, s) {
|
|
53
|
-
return
|
|
53
|
+
return X(
|
|
54
54
|
e,
|
|
55
55
|
o,
|
|
56
56
|
{
|
|
@@ -59,8 +59,8 @@ function Oe(e, o, s) {
|
|
|
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
65
|
const s = B(e);
|
|
66
66
|
return (o = s == null ? void 0 : s.$el) != null ? o : s;
|
|
@@ -68,28 +68,28 @@ function M(e) {
|
|
|
68
68
|
function J(...e) {
|
|
69
69
|
const o = [], s = () => {
|
|
70
70
|
o.forEach((f) => f()), o.length = 0;
|
|
71
|
-
}, a = (f,
|
|
72
|
-
const f = j(B(e[0])).filter((
|
|
73
|
-
return f.every((
|
|
71
|
+
}, a = (f, c, y, g) => (f.addEventListener(c, y, g), () => f.removeEventListener(c, y, g)), l = S(() => {
|
|
72
|
+
const f = j(B(e[0])).filter((c) => c != null);
|
|
73
|
+
return f.every((c) => typeof c != "string") ? f : void 0;
|
|
74
74
|
}), i = Oe(
|
|
75
75
|
() => {
|
|
76
|
-
var f,
|
|
76
|
+
var f, c;
|
|
77
77
|
return [
|
|
78
|
-
(
|
|
78
|
+
(c = (f = l.value) == null ? void 0 : f.map((y) => H(y))) != null ? c : [Y].filter((y) => y != null),
|
|
79
79
|
j(B(l.value ? e[1] : e[0])),
|
|
80
80
|
j(n(l.value ? e[2] : e[1])),
|
|
81
81
|
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
82
82
|
B(l.value ? e[3] : e[2])
|
|
83
83
|
];
|
|
84
84
|
},
|
|
85
|
-
([f,
|
|
86
|
-
if (s(), !(f != null && f.length) || !(
|
|
85
|
+
([f, c, y, g]) => {
|
|
86
|
+
if (s(), !(f != null && f.length) || !(c != null && c.length) || !(y != null && y.length))
|
|
87
87
|
return;
|
|
88
|
-
const u = Ve(
|
|
88
|
+
const u = Ve(g) ? { ...g } : g;
|
|
89
89
|
o.push(
|
|
90
90
|
...f.flatMap(
|
|
91
|
-
(p) =>
|
|
92
|
-
(
|
|
91
|
+
(p) => c.flatMap(
|
|
92
|
+
(v) => y.map((m) => a(p, v, m, u))
|
|
93
93
|
)
|
|
94
94
|
)
|
|
95
95
|
);
|
|
@@ -106,51 +106,51 @@ function Ne() {
|
|
|
106
106
|
e.value = !0;
|
|
107
107
|
}, o), e;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function ge(e) {
|
|
110
110
|
const o = Ne();
|
|
111
111
|
return S(() => (o.value, !!e()));
|
|
112
112
|
}
|
|
113
113
|
function Ue(e, o, s = {}) {
|
|
114
|
-
const { window: a =
|
|
114
|
+
const { window: a = Y, ...l } = s;
|
|
115
115
|
let i;
|
|
116
|
-
const d =
|
|
116
|
+
const d = ge(() => a && "MutationObserver" in a), f = () => {
|
|
117
117
|
i && (i.disconnect(), i = void 0);
|
|
118
|
-
},
|
|
119
|
-
const p = B(e),
|
|
120
|
-
return new Set(
|
|
121
|
-
}),
|
|
122
|
-
() =>
|
|
118
|
+
}, c = S(() => {
|
|
119
|
+
const p = B(e), v = j(p).map(H).filter(Me);
|
|
120
|
+
return new Set(v);
|
|
121
|
+
}), y = X(
|
|
122
|
+
() => c.value,
|
|
123
123
|
(p) => {
|
|
124
|
-
f(), d.value && p.size && (i = new MutationObserver(o), p.forEach((
|
|
124
|
+
f(), d.value && p.size && (i = new MutationObserver(o), p.forEach((v) => i.observe(v, l)));
|
|
125
125
|
},
|
|
126
126
|
{ immediate: !0, flush: "post" }
|
|
127
|
-
),
|
|
128
|
-
|
|
127
|
+
), g = () => i == null ? void 0 : i.takeRecords(), u = () => {
|
|
128
|
+
y(), f();
|
|
129
129
|
};
|
|
130
130
|
return ee(u), {
|
|
131
131
|
isSupported: d,
|
|
132
132
|
stop: u,
|
|
133
|
-
takeRecords:
|
|
133
|
+
takeRecords: g
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
function Fe(e, o, s = {}) {
|
|
137
137
|
const {
|
|
138
|
-
window: a =
|
|
138
|
+
window: a = Y,
|
|
139
139
|
document: l = a == null ? void 0 : a.document,
|
|
140
140
|
flush: i = "sync"
|
|
141
141
|
} = s;
|
|
142
142
|
if (!a || !l)
|
|
143
143
|
return le;
|
|
144
144
|
let d;
|
|
145
|
-
const f = (
|
|
146
|
-
d == null || d(), d =
|
|
147
|
-
},
|
|
148
|
-
const
|
|
149
|
-
if (
|
|
145
|
+
const f = (g) => {
|
|
146
|
+
d == null || d(), d = g;
|
|
147
|
+
}, c = q(() => {
|
|
148
|
+
const g = H(e);
|
|
149
|
+
if (g) {
|
|
150
150
|
const { stop: u } = Ue(
|
|
151
151
|
l,
|
|
152
152
|
(p) => {
|
|
153
|
-
p.map((m) => [...m.removedNodes]).flat().some((m) => m ===
|
|
153
|
+
p.map((m) => [...m.removedNodes]).flat().some((m) => m === g || m.contains(g)) && o(p);
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
156
|
window: a,
|
|
@@ -160,58 +160,58 @@ function Fe(e, o, s = {}) {
|
|
|
160
160
|
);
|
|
161
161
|
f(u);
|
|
162
162
|
}
|
|
163
|
-
}, { flush: i }),
|
|
164
|
-
|
|
163
|
+
}, { flush: i }), y = () => {
|
|
164
|
+
c(), f();
|
|
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: s =
|
|
171
|
+
window: s = Y,
|
|
172
172
|
deep: a = !0,
|
|
173
173
|
triggerOnRemoval: l = !1
|
|
174
174
|
} = e, i = (o = e.document) != null ? o : s == null ? void 0 : s.document, d = () => {
|
|
175
|
-
var
|
|
176
|
-
let
|
|
175
|
+
var y;
|
|
176
|
+
let g = i == null ? void 0 : i.activeElement;
|
|
177
177
|
if (a)
|
|
178
|
-
for (;
|
|
179
|
-
|
|
180
|
-
return
|
|
181
|
-
}, f = G(),
|
|
178
|
+
for (; g != null && g.shadowRoot; )
|
|
179
|
+
g = (y = g == null ? void 0 : g.shadowRoot) == null ? void 0 : y.activeElement;
|
|
180
|
+
return g;
|
|
181
|
+
}, f = G(), c = () => {
|
|
182
182
|
f.value = d();
|
|
183
183
|
};
|
|
184
184
|
if (s) {
|
|
185
|
-
const
|
|
185
|
+
const y = {
|
|
186
186
|
capture: !0,
|
|
187
187
|
passive: !0
|
|
188
188
|
};
|
|
189
189
|
J(
|
|
190
190
|
s,
|
|
191
191
|
"blur",
|
|
192
|
-
(
|
|
193
|
-
|
|
192
|
+
(g) => {
|
|
193
|
+
g.relatedTarget === null && c();
|
|
194
194
|
},
|
|
195
|
-
|
|
195
|
+
y
|
|
196
196
|
), J(
|
|
197
197
|
s,
|
|
198
198
|
"focus",
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
c,
|
|
200
|
+
y
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
|
-
return l && Fe(f,
|
|
203
|
+
return l && Fe(f, c, { document: i }), c(), f;
|
|
204
204
|
}
|
|
205
205
|
function Xe(e, o, s = {}) {
|
|
206
|
-
const { window: a =
|
|
206
|
+
const { window: a = Y, ...l } = s;
|
|
207
207
|
let i;
|
|
208
|
-
const d =
|
|
208
|
+
const d = ge(() => a && "ResizeObserver" in a), f = () => {
|
|
209
209
|
i && (i.disconnect(), i = void 0);
|
|
210
|
-
},
|
|
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
216
|
if (f(), d.value && a) {
|
|
217
217
|
i = new ResizeObserver(o);
|
|
@@ -220,53 +220,53 @@ function Xe(e, o, s = {}) {
|
|
|
220
220
|
}
|
|
221
221
|
},
|
|
222
222
|
{ immediate: !0, flush: "post" }
|
|
223
|
-
),
|
|
224
|
-
f(),
|
|
223
|
+
), g = () => {
|
|
224
|
+
f(), y();
|
|
225
225
|
};
|
|
226
|
-
return ee(
|
|
226
|
+
return ee(g), {
|
|
227
227
|
isSupported: d,
|
|
228
|
-
stop:
|
|
228
|
+
stop: g
|
|
229
229
|
};
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
const { window: a =
|
|
231
|
+
function he(e, o = { width: 0, height: 0 }, s = {}) {
|
|
232
|
+
const { window: a = Y, box: l = "content-box" } = s, i = S(() => {
|
|
233
233
|
var u, p;
|
|
234
|
-
return (p = (u =
|
|
235
|
-
}), d = G(o.width), f = G(o.height), { stop:
|
|
234
|
+
return (p = (u = H(e)) == null ? void 0 : u.namespaceURI) == null ? void 0 : p.includes("svg");
|
|
235
|
+
}), d = G(o.width), f = G(o.height), { stop: c } = Xe(
|
|
236
236
|
e,
|
|
237
237
|
([u]) => {
|
|
238
238
|
const p = l === "border-box" ? u.borderBoxSize : l === "content-box" ? u.contentBoxSize : u.devicePixelContentBoxSize;
|
|
239
239
|
if (a && i.value) {
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
const m =
|
|
240
|
+
const v = H(e);
|
|
241
|
+
if (v) {
|
|
242
|
+
const m = v.getBoundingClientRect();
|
|
243
243
|
d.value = m.width, f.value = m.height;
|
|
244
244
|
}
|
|
245
245
|
} else if (p) {
|
|
246
|
-
const
|
|
247
|
-
d.value =
|
|
246
|
+
const v = j(p);
|
|
247
|
+
d.value = v.reduce((m, { inlineSize: P }) => m + P, 0), f.value = v.reduce((m, { blockSize: P }) => m + P, 0);
|
|
248
248
|
} else
|
|
249
249
|
d.value = u.contentRect.width, f.value = u.contentRect.height;
|
|
250
250
|
},
|
|
251
251
|
s
|
|
252
252
|
);
|
|
253
253
|
We(() => {
|
|
254
|
-
const u =
|
|
254
|
+
const u = H(e);
|
|
255
255
|
u && (d.value = "offsetWidth" in u ? u.offsetWidth : o.width, f.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
|
d.value = u ? o.width : 0, f.value = u ? o.height : 0;
|
|
261
261
|
}
|
|
262
262
|
);
|
|
263
|
-
function
|
|
264
|
-
|
|
263
|
+
function g() {
|
|
264
|
+
c(), y();
|
|
265
265
|
}
|
|
266
266
|
return {
|
|
267
267
|
width: d,
|
|
268
268
|
height: f,
|
|
269
|
-
stop:
|
|
269
|
+
stop: g
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
var Ye = class {
|
|
@@ -365,8 +365,8 @@ let ae = {
|
|
|
365
365
|
enableHandwriting: !1,
|
|
366
366
|
position: "static",
|
|
367
367
|
disableWhenNoFocus: !0
|
|
368
|
-
},
|
|
369
|
-
function
|
|
368
|
+
}, ye = null, be = null;
|
|
369
|
+
function Z() {
|
|
370
370
|
return ae;
|
|
371
371
|
}
|
|
372
372
|
function vn(e) {
|
|
@@ -376,31 +376,31 @@ function vn(e) {
|
|
|
376
376
|
};
|
|
377
377
|
}
|
|
378
378
|
function fn(e) {
|
|
379
|
-
|
|
379
|
+
ye = e;
|
|
380
380
|
}
|
|
381
381
|
function ue() {
|
|
382
|
-
return
|
|
382
|
+
return ye;
|
|
383
383
|
}
|
|
384
384
|
function mn(e) {
|
|
385
|
-
|
|
385
|
+
be = e;
|
|
386
386
|
}
|
|
387
387
|
function je() {
|
|
388
|
-
return
|
|
388
|
+
return be;
|
|
389
389
|
}
|
|
390
|
-
function Ge(e, o, s) {
|
|
390
|
+
function Ge(e, o, s, a = 0) {
|
|
391
391
|
if (!e || !o || s === "static") return null;
|
|
392
|
-
let
|
|
392
|
+
let l, i;
|
|
393
393
|
if (s === "bottom")
|
|
394
|
-
|
|
394
|
+
l = window.innerHeight - o.offsetHeight, i = 0;
|
|
395
395
|
else {
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
|
|
396
|
+
const d = e.getBoundingClientRect(), f = o.offsetWidth;
|
|
397
|
+
l = d.bottom + window.scrollY + a, i = d.left + window.scrollX + d.width / 2 - f / 2;
|
|
398
|
+
const c = window.innerWidth;
|
|
399
|
+
i + f > c && (i = c - f - 10), i < 10 && (i = 10);
|
|
400
400
|
}
|
|
401
401
|
return {
|
|
402
|
-
top: `${
|
|
403
|
-
left: `${
|
|
402
|
+
top: `${l}px`,
|
|
403
|
+
left: `${i}px`
|
|
404
404
|
};
|
|
405
405
|
}
|
|
406
406
|
function de(e) {
|
|
@@ -445,8 +445,8 @@ function we(e, o = "") {
|
|
|
445
445
|
let i;
|
|
446
446
|
if (o.length > 0) i = l - a;
|
|
447
447
|
else {
|
|
448
|
-
const
|
|
449
|
-
if (
|
|
448
|
+
const c = l - a;
|
|
449
|
+
if (c > 0) i = c;
|
|
450
450
|
else if (a > 0)
|
|
451
451
|
i = 1, a--;
|
|
452
452
|
else return;
|
|
@@ -545,11 +545,11 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
545
545
|
function a(l) {
|
|
546
546
|
s("select", l);
|
|
547
547
|
}
|
|
548
|
-
return (l, i) => (
|
|
549
|
-
(
|
|
548
|
+
return (l, i) => (b(), x("div", st, [
|
|
549
|
+
(b(!0), x(L, null, V(l.candidates, (d, f) => (b(), x("button", {
|
|
550
550
|
key: `candidate-${f}`,
|
|
551
551
|
class: "zhk-candidate-list__item",
|
|
552
|
-
onClick: (
|
|
552
|
+
onClick: (c) => a(f)
|
|
553
553
|
}, D(d), 9, it))), 128))
|
|
554
554
|
]));
|
|
555
555
|
}
|
|
@@ -563,16 +563,16 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
563
563
|
setup(e, { emit: o }) {
|
|
564
564
|
const s = e, a = o, l = E(null), i = E(null);
|
|
565
565
|
let d = null;
|
|
566
|
-
const f = E(!1), { height:
|
|
567
|
-
function
|
|
566
|
+
const f = E(!1), { height: c } = he(i);
|
|
567
|
+
function y() {
|
|
568
568
|
d && d.clearCanvas();
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function g() {
|
|
571
571
|
l.value && (d && d.destroy(), d = new Ye(l.value, {
|
|
572
572
|
onDrawEnd: m
|
|
573
573
|
}));
|
|
574
574
|
}
|
|
575
|
-
const u = E([]), { startRepeat: p, stopRepeat:
|
|
575
|
+
const u = E([]), { startRepeat: p, stopRepeat: v } = te();
|
|
576
576
|
async function m() {
|
|
577
577
|
if (!d || d.getStrokeData().length === 0 || f.value)
|
|
578
578
|
return;
|
|
@@ -593,146 +593,146 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
593
593
|
ce(() => {
|
|
594
594
|
d && d.destroy();
|
|
595
595
|
}), q(() => {
|
|
596
|
-
l.value &&
|
|
597
|
-
|
|
596
|
+
l.value && c.value && s.recognizerInitialized && me(() => {
|
|
597
|
+
g();
|
|
598
598
|
});
|
|
599
599
|
});
|
|
600
|
-
function
|
|
600
|
+
function P(z) {
|
|
601
601
|
const t = u.value[z];
|
|
602
|
-
t && (a("key", { key: t }), u.value = [],
|
|
602
|
+
t && (a("key", { key: t }), u.value = [], y());
|
|
603
603
|
}
|
|
604
|
-
return (z, t) => (
|
|
604
|
+
return (z, t) => (b(), x("div", rt, [
|
|
605
605
|
Le(xe, {
|
|
606
606
|
candidates: u.value,
|
|
607
|
-
onSelect:
|
|
607
|
+
onSelect: P
|
|
608
608
|
}, null, 8, ["candidates"]),
|
|
609
|
-
|
|
609
|
+
h("div", {
|
|
610
610
|
ref_key: "containerRef",
|
|
611
611
|
ref: i,
|
|
612
612
|
class: "handwriting-content"
|
|
613
613
|
}, [
|
|
614
|
-
|
|
615
|
-
|
|
614
|
+
h("div", lt, [
|
|
615
|
+
h("button", {
|
|
616
616
|
class: "handwriting-btn handwriting-btn--function",
|
|
617
617
|
onPointerdown: t[0] || (t[0] = (k) => n(p)(k, () => a("key", { key: "。" }))),
|
|
618
618
|
onPointerup: t[1] || (t[1] = //@ts-ignore
|
|
619
|
-
(...k) => n(
|
|
619
|
+
(...k) => n(v) && n(v)(...k)),
|
|
620
620
|
onPointerleave: t[2] || (t[2] = //@ts-ignore
|
|
621
|
-
(...k) => n(
|
|
621
|
+
(...k) => n(v) && n(v)(...k)),
|
|
622
622
|
onPointercancel: t[3] || (t[3] = //@ts-ignore
|
|
623
|
-
(...k) => n(
|
|
623
|
+
(...k) => n(v) && n(v)(...k)),
|
|
624
624
|
onContextmenu: t[4] || (t[4] = C(() => {
|
|
625
625
|
}, ["prevent"]))
|
|
626
626
|
}, " 。 ", 32),
|
|
627
|
-
|
|
627
|
+
h("button", {
|
|
628
628
|
class: "handwriting-btn handwriting-btn--function",
|
|
629
629
|
onPointerdown: t[5] || (t[5] = (k) => n(p)(k, () => a("key", { key: "?" }))),
|
|
630
630
|
onPointerup: t[6] || (t[6] = //@ts-ignore
|
|
631
|
-
(...k) => n(
|
|
631
|
+
(...k) => n(v) && n(v)(...k)),
|
|
632
632
|
onPointerleave: t[7] || (t[7] = //@ts-ignore
|
|
633
|
-
(...k) => n(
|
|
633
|
+
(...k) => n(v) && n(v)(...k)),
|
|
634
634
|
onPointercancel: t[8] || (t[8] = //@ts-ignore
|
|
635
|
-
(...k) => n(
|
|
635
|
+
(...k) => n(v) && n(v)(...k)),
|
|
636
636
|
onContextmenu: t[9] || (t[9] = C(() => {
|
|
637
637
|
}, ["prevent"]))
|
|
638
638
|
}, " ? ", 32),
|
|
639
|
-
|
|
639
|
+
h("button", {
|
|
640
640
|
class: "handwriting-btn handwriting-btn--function",
|
|
641
641
|
onPointerdown: t[10] || (t[10] = (k) => n(p)(k, () => a("key", { key: "!" }))),
|
|
642
642
|
onPointerup: t[11] || (t[11] = //@ts-ignore
|
|
643
|
-
(...k) => n(
|
|
643
|
+
(...k) => n(v) && n(v)(...k)),
|
|
644
644
|
onPointerleave: t[12] || (t[12] = //@ts-ignore
|
|
645
|
-
(...k) => n(
|
|
645
|
+
(...k) => n(v) && n(v)(...k)),
|
|
646
646
|
onPointercancel: t[13] || (t[13] = //@ts-ignore
|
|
647
|
-
(...k) => n(
|
|
647
|
+
(...k) => n(v) && n(v)(...k)),
|
|
648
648
|
onContextmenu: t[14] || (t[14] = C(() => {
|
|
649
649
|
}, ["prevent"]))
|
|
650
650
|
}, " ! ", 32),
|
|
651
|
-
|
|
651
|
+
h("button", {
|
|
652
652
|
class: "handwriting-btn handwriting-btn--function",
|
|
653
653
|
onPointerdown: t[15] || (t[15] = (k) => n(p)(k, () => a("key", { key: "、" }))),
|
|
654
654
|
onPointerup: t[16] || (t[16] = //@ts-ignore
|
|
655
|
-
(...k) => n(
|
|
655
|
+
(...k) => n(v) && n(v)(...k)),
|
|
656
656
|
onPointerleave: t[17] || (t[17] = //@ts-ignore
|
|
657
|
-
(...k) => n(
|
|
657
|
+
(...k) => n(v) && n(v)(...k)),
|
|
658
658
|
onPointercancel: t[18] || (t[18] = //@ts-ignore
|
|
659
|
-
(...k) => n(
|
|
659
|
+
(...k) => n(v) && n(v)(...k)),
|
|
660
660
|
onContextmenu: t[19] || (t[19] = C(() => {
|
|
661
661
|
}, ["prevent"]))
|
|
662
662
|
}, " 、 ", 32)
|
|
663
663
|
]),
|
|
664
|
-
|
|
665
|
-
z.recognizerInitialized ? (
|
|
664
|
+
h("div", at, [
|
|
665
|
+
z.recognizerInitialized ? (b(), x("canvas", {
|
|
666
666
|
key: 1,
|
|
667
667
|
ref_key: "canvasRef",
|
|
668
668
|
ref: l,
|
|
669
669
|
class: "handwriting-canvas",
|
|
670
|
-
width: n(
|
|
671
|
-
height: n(
|
|
672
|
-
}, null, 8, ct)) : (
|
|
670
|
+
width: n(c),
|
|
671
|
+
height: n(c)
|
|
672
|
+
}, null, 8, ct)) : (b(), x("div", {
|
|
673
673
|
key: 0,
|
|
674
674
|
class: "handwriting-loading",
|
|
675
|
-
style: se({ width: `${n(
|
|
675
|
+
style: se({ width: `${n(c)}px`, height: `${n(c)}px` })
|
|
676
676
|
}, [
|
|
677
|
-
t[37] || (t[37] =
|
|
678
|
-
|
|
679
|
-
|
|
677
|
+
t[37] || (t[37] = h("div", { class: "loading-text" }, " 正在加载手写识别... ", -1)),
|
|
678
|
+
h("div", ut, [
|
|
679
|
+
h("div", {
|
|
680
680
|
class: "progress-fill",
|
|
681
681
|
style: se({ width: `${z.recognizerProgress * 100}%` })
|
|
682
682
|
}, null, 4)
|
|
683
683
|
]),
|
|
684
|
-
|
|
684
|
+
h("div", dt, D(Math.round(z.recognizerProgress * 100)) + "% ", 1)
|
|
685
685
|
], 4))
|
|
686
686
|
]),
|
|
687
|
-
|
|
688
|
-
|
|
687
|
+
h("div", vt, [
|
|
688
|
+
h("button", {
|
|
689
689
|
class: "handwriting-btn handwriting-btn--function",
|
|
690
690
|
onPointerdown: t[20] || (t[20] = (k) => n(p)(k, () => a("key", { key: "delete", isControl: !0 }))),
|
|
691
691
|
onPointerup: t[21] || (t[21] = //@ts-ignore
|
|
692
|
-
(...k) => n(
|
|
692
|
+
(...k) => n(v) && n(v)(...k)),
|
|
693
693
|
onPointerleave: t[22] || (t[22] = //@ts-ignore
|
|
694
|
-
(...k) => n(
|
|
694
|
+
(...k) => n(v) && n(v)(...k)),
|
|
695
695
|
onPointercancel: t[23] || (t[23] = //@ts-ignore
|
|
696
|
-
(...k) => n(
|
|
696
|
+
(...k) => n(v) && n(v)(...k)),
|
|
697
697
|
onContextmenu: t[24] || (t[24] = C(() => {
|
|
698
698
|
}, ["prevent"]))
|
|
699
699
|
}, t[38] || (t[38] = [
|
|
700
|
-
|
|
700
|
+
h("img", {
|
|
701
701
|
src: ve,
|
|
702
702
|
alt: "删除"
|
|
703
703
|
}, null, -1)
|
|
704
704
|
]), 32),
|
|
705
|
-
|
|
705
|
+
h("button", {
|
|
706
706
|
class: "handwriting-btn handwriting-btn--function",
|
|
707
707
|
onClick: t[25] || (t[25] = (k) => a("exit")),
|
|
708
708
|
onContextmenu: t[26] || (t[26] = C(() => {
|
|
709
709
|
}, ["prevent"]))
|
|
710
|
-
}, "
|
|
711
|
-
|
|
710
|
+
}, " 拼音 ", 32),
|
|
711
|
+
h("button", {
|
|
712
712
|
class: "handwriting-btn handwriting-btn--function",
|
|
713
713
|
onPointerdown: t[27] || (t[27] = (k) => n(p)(k, () => a("key", { key: "," }))),
|
|
714
714
|
onPointerup: t[28] || (t[28] = //@ts-ignore
|
|
715
|
-
(...k) => n(
|
|
715
|
+
(...k) => n(v) && n(v)(...k)),
|
|
716
716
|
onPointerleave: t[29] || (t[29] = //@ts-ignore
|
|
717
|
-
(...k) => n(
|
|
717
|
+
(...k) => n(v) && n(v)(...k)),
|
|
718
718
|
onPointercancel: t[30] || (t[30] = //@ts-ignore
|
|
719
|
-
(...k) => n(
|
|
719
|
+
(...k) => n(v) && n(v)(...k)),
|
|
720
720
|
onContextmenu: t[31] || (t[31] = C(() => {
|
|
721
721
|
}, ["prevent"]))
|
|
722
722
|
}, " , ", 32),
|
|
723
|
-
|
|
723
|
+
h("button", {
|
|
724
724
|
class: "handwriting-btn handwriting-btn--function",
|
|
725
725
|
onPointerdown: t[32] || (t[32] = (k) => n(p)(k, () => a("key", { key: "enter", isControl: !0 }))),
|
|
726
726
|
onPointerup: t[33] || (t[33] = //@ts-ignore
|
|
727
|
-
(...k) => n(
|
|
727
|
+
(...k) => n(v) && n(v)(...k)),
|
|
728
728
|
onPointerleave: t[34] || (t[34] = //@ts-ignore
|
|
729
|
-
(...k) => n(
|
|
729
|
+
(...k) => n(v) && n(v)(...k)),
|
|
730
730
|
onPointercancel: t[35] || (t[35] = //@ts-ignore
|
|
731
|
-
(...k) => n(
|
|
731
|
+
(...k) => n(v) && n(v)(...k)),
|
|
732
732
|
onContextmenu: t[36] || (t[36] = C(() => {
|
|
733
733
|
}, ["prevent"]))
|
|
734
734
|
}, t[39] || (t[39] = [
|
|
735
|
-
|
|
735
|
+
h("img", {
|
|
736
736
|
src: fe,
|
|
737
737
|
alt: "回车"
|
|
738
738
|
}, null, -1)
|
|
@@ -741,7 +741,7 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
741
741
|
], 512)
|
|
742
742
|
]));
|
|
743
743
|
}
|
|
744
|
-
}), mt = "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", pt = "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", kt = { class: "zhk-selection" },
|
|
744
|
+
}), mt = "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", pt = "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", kt = { class: "zhk-selection" }, gt = { class: "zhk-selection__list" }, ht = ["onClick"], yt = /* @__PURE__ */ I({
|
|
745
745
|
__name: "CandidateSelection",
|
|
746
746
|
props: {
|
|
747
747
|
candidates: {}
|
|
@@ -759,23 +759,23 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
759
759
|
const f = Array.from(d).length;
|
|
760
760
|
return f >= 2 && f <= 3 ? 2 : f >= 4 ? 3 : 1;
|
|
761
761
|
}
|
|
762
|
-
return (d, f) => (
|
|
763
|
-
|
|
764
|
-
(
|
|
765
|
-
key:
|
|
766
|
-
class: O(["zhk-selection__text", [`zhk-selection__text--span-${i(
|
|
767
|
-
onClick: (
|
|
768
|
-
}, D(
|
|
762
|
+
return (d, f) => (b(), x("div", kt, [
|
|
763
|
+
h("div", gt, [
|
|
764
|
+
(b(!0), x(L, null, V(d.candidates, (c, y) => (b(), x("div", {
|
|
765
|
+
key: y,
|
|
766
|
+
class: O(["zhk-selection__text", [`zhk-selection__text--span-${i(c)}`]]),
|
|
767
|
+
onClick: (g) => a(y)
|
|
768
|
+
}, D(c), 11, ht))), 128))
|
|
769
769
|
]),
|
|
770
|
-
|
|
771
|
-
|
|
770
|
+
h("div", { class: "zhk-selection__func" }, [
|
|
771
|
+
h("button", {
|
|
772
772
|
class: "zhk-selection__func-btn",
|
|
773
773
|
onClick: l
|
|
774
774
|
}, " 返回 ")
|
|
775
775
|
])
|
|
776
776
|
]));
|
|
777
777
|
}
|
|
778
|
-
}),
|
|
778
|
+
}), bt = { class: "zhk-candidate" }, wt = { class: "zhk-candidate__container" }, xt = {
|
|
779
779
|
key: 0,
|
|
780
780
|
class: "zhk-candidate__pinyin"
|
|
781
781
|
}, zt = { class: "zhk-candidate__bottom-container" }, Ct = /* @__PURE__ */ I({
|
|
@@ -793,14 +793,14 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
793
793
|
const d = E(null), f = S(() => {
|
|
794
794
|
var u;
|
|
795
795
|
return ((u = d.value) == null ? void 0 : u.candidates.map((p) => p.text)) ?? [];
|
|
796
|
-
}),
|
|
796
|
+
}), c = E(!1);
|
|
797
797
|
Q(async () => {
|
|
798
798
|
if (i = je(), !i)
|
|
799
799
|
throw new Error("未找到拼音引擎实例,请确保已正确注册引擎");
|
|
800
800
|
l.value && (d.value = await i.processInput(l.value));
|
|
801
801
|
}), ce(() => {
|
|
802
802
|
i == null || i.clearInput(), i = null;
|
|
803
|
-
}),
|
|
803
|
+
}), X(l, async (u) => {
|
|
804
804
|
const p = i;
|
|
805
805
|
if (p) {
|
|
806
806
|
if (u === "") {
|
|
@@ -810,45 +810,45 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
810
810
|
d.value = await p.processInput(u);
|
|
811
811
|
}
|
|
812
812
|
});
|
|
813
|
-
async function
|
|
813
|
+
async function y(u) {
|
|
814
814
|
if (!i)
|
|
815
815
|
return;
|
|
816
816
|
const p = await i.pickCandidate(u);
|
|
817
|
-
d.value = p, p.preeditBody || (a("input", p.committed || ""), l.value = "", d.value = null,
|
|
817
|
+
d.value = p, p.preeditBody || (a("input", p.committed || ""), l.value = "", d.value = null, c.value = !1);
|
|
818
818
|
}
|
|
819
819
|
o({
|
|
820
|
-
handleSelection:
|
|
820
|
+
handleSelection: y
|
|
821
821
|
});
|
|
822
|
-
const
|
|
822
|
+
const g = S(() => {
|
|
823
823
|
const u = d.value;
|
|
824
824
|
return u ? u.preeditHead + u.preeditBody : "";
|
|
825
825
|
});
|
|
826
|
-
return (u, p) => (
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
f.value.length > 0 ? (
|
|
826
|
+
return (u, p) => (b(), x("div", bt, [
|
|
827
|
+
h("div", wt, [
|
|
828
|
+
g.value ? (b(), x("div", xt, D(g.value), 1)) : W("", !0),
|
|
829
|
+
h("div", zt, [
|
|
830
|
+
f.value.length > 0 ? (b(), K(xe, {
|
|
831
831
|
key: 0,
|
|
832
832
|
candidates: f.value,
|
|
833
|
-
onSelect:
|
|
833
|
+
onSelect: y
|
|
834
834
|
}, null, 8, ["candidates"])) : W("", !0),
|
|
835
|
-
f.value.length > 0 ? (
|
|
835
|
+
f.value.length > 0 ? (b(), x("button", {
|
|
836
836
|
key: 1,
|
|
837
837
|
class: "zhk-candidate__more",
|
|
838
|
-
onClick: p[0] || (p[0] = (
|
|
838
|
+
onClick: p[0] || (p[0] = (v) => c.value = !0)
|
|
839
839
|
}, p[2] || (p[2] = [
|
|
840
|
-
|
|
840
|
+
h("img", {
|
|
841
841
|
src: pt,
|
|
842
842
|
alt: "更多"
|
|
843
843
|
}, null, -1)
|
|
844
844
|
]))) : W("", !0)
|
|
845
845
|
])
|
|
846
846
|
]),
|
|
847
|
-
|
|
847
|
+
c.value ? (b(), K(yt, {
|
|
848
848
|
key: 0,
|
|
849
849
|
candidates: f.value,
|
|
850
|
-
onSelect:
|
|
851
|
-
onClose: p[1] || (p[1] = (
|
|
850
|
+
onSelect: y,
|
|
851
|
+
onClose: p[1] || (p[1] = (v) => c.value = !1)
|
|
852
852
|
}, null, 8, ["candidates"])) : W("", !0)
|
|
853
853
|
]));
|
|
854
854
|
}
|
|
@@ -857,7 +857,7 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
857
857
|
src: mt,
|
|
858
858
|
class: "zhk-base__key-icon",
|
|
859
859
|
alt: "Shift"
|
|
860
|
-
}, Lt = ["onPointerdown"], Rt = { class: "zhk-base__row" }, Tt = { class: "zhk-base__toggle-main" }, Dt = { class: "zhk-base__toggle-sub" },
|
|
860
|
+
}, Lt = ["onPointerdown"], Rt = { class: "zhk-base__row" }, Tt = { class: "zhk-base__toggle-main" }, Dt = { class: "zhk-base__toggle-sub" }, Mt = /* @__PURE__ */ I({
|
|
861
861
|
__name: "KeyboardBase",
|
|
862
862
|
props: /* @__PURE__ */ ie({
|
|
863
863
|
enableHandwriting: { type: Boolean }
|
|
@@ -869,104 +869,104 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
869
869
|
}),
|
|
870
870
|
emits: /* @__PURE__ */ ie(["key"], ["update:modelValue"]),
|
|
871
871
|
setup(e, { emit: o }) {
|
|
872
|
-
const s = e, a = o, l = ke(e, "modelValue"), i =
|
|
873
|
-
function
|
|
874
|
-
a("key", { key:
|
|
872
|
+
const s = e, a = o, l = ke(e, "modelValue"), i = S(() => l.value === "en_cap"), d = S(() => l.value === "zh"), f = S(() => d.value ? !0 : i.value);
|
|
873
|
+
function c(M, r = !1) {
|
|
874
|
+
a("key", { key: M, isControl: r });
|
|
875
875
|
}
|
|
876
|
-
function
|
|
877
|
-
d.value ? l.value = "hand" :
|
|
876
|
+
function y() {
|
|
877
|
+
d.value ? l.value = "hand" : l.value = i.value ? "en" : "en_cap";
|
|
878
878
|
}
|
|
879
|
-
function
|
|
879
|
+
function g() {
|
|
880
880
|
l.value = "num";
|
|
881
881
|
}
|
|
882
882
|
function u() {
|
|
883
883
|
l.value = "symbol";
|
|
884
884
|
}
|
|
885
|
-
const p = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
|
|
885
|
+
const p = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"], v = [
|
|
886
886
|
["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
|
|
887
887
|
["a", "s", "d", "f", "g", "h", "j", "k", "l"],
|
|
888
888
|
["z", "x", "c", "v", "b", "n", "m"]
|
|
889
|
-
], m = E(""),
|
|
889
|
+
], m = E(""), P = E(null), { startRepeat: z, stopRepeat: t } = te();
|
|
890
890
|
function k() {
|
|
891
891
|
if (l.value === "zh" && m.value) {
|
|
892
892
|
m.value = m.value.slice(0, -1);
|
|
893
893
|
return;
|
|
894
894
|
}
|
|
895
|
-
|
|
895
|
+
c("delete", !0);
|
|
896
896
|
}
|
|
897
897
|
function N() {
|
|
898
|
-
var
|
|
898
|
+
var M;
|
|
899
899
|
if (l.value === "zh" && m.value) {
|
|
900
|
-
(
|
|
900
|
+
(M = P.value) == null || M.handleSelection(0);
|
|
901
901
|
return;
|
|
902
902
|
}
|
|
903
|
-
|
|
903
|
+
c(" ");
|
|
904
904
|
}
|
|
905
905
|
function ne() {
|
|
906
906
|
if (l.value === "zh" && m.value) {
|
|
907
|
-
|
|
907
|
+
c(m.value), m.value = "";
|
|
908
908
|
return;
|
|
909
909
|
}
|
|
910
|
-
|
|
910
|
+
c("enter", !0);
|
|
911
911
|
}
|
|
912
|
-
function U(
|
|
912
|
+
function U(M) {
|
|
913
913
|
if (l.value === "zh") {
|
|
914
|
-
m.value +=
|
|
914
|
+
m.value += M;
|
|
915
915
|
return;
|
|
916
916
|
}
|
|
917
|
-
const r = i.value ?
|
|
918
|
-
|
|
917
|
+
const r = i.value ? M.toUpperCase() : M;
|
|
918
|
+
c(r);
|
|
919
919
|
}
|
|
920
920
|
function oe() {
|
|
921
921
|
l.value = l.value === "zh" ? "en" : "zh";
|
|
922
922
|
}
|
|
923
|
-
const
|
|
924
|
-
return (
|
|
925
|
-
|
|
926
|
-
l.value === "zh" ? (
|
|
923
|
+
const $ = S(() => s.enableHandwriting ? "手写" : "-"), R = S(() => !s.enableHandwriting);
|
|
924
|
+
return (M, r) => (b(), x("div", Pt, [
|
|
925
|
+
h("div", _t, [
|
|
926
|
+
l.value === "zh" ? (b(), K(Ct, {
|
|
927
927
|
key: 0,
|
|
928
928
|
ref_key: "candidateBarRef",
|
|
929
|
-
ref:
|
|
929
|
+
ref: P,
|
|
930
930
|
modelValue: m.value,
|
|
931
931
|
"onUpdate:modelValue": r[0] || (r[0] = (w) => m.value = w),
|
|
932
|
-
onInput: r[1] || (r[1] = (w) =>
|
|
933
|
-
}, null, 8, ["modelValue"])) : (
|
|
932
|
+
onInput: r[1] || (r[1] = (w) => c(w, !1))
|
|
933
|
+
}, null, 8, ["modelValue"])) : (b(), x(L, { key: 1 }, V(p, (w, F) => h("button", {
|
|
934
934
|
key: `number-${F}`,
|
|
935
935
|
class: "zhk-base__key zhk-base__key--letter",
|
|
936
|
-
onPointerdown: (
|
|
936
|
+
onPointerdown: (_) => n(z)(_, () => U(w)),
|
|
937
937
|
onPointerup: r[2] || (r[2] = //@ts-ignore
|
|
938
|
-
(
|
|
938
|
+
(..._) => n(t) && n(t)(..._)),
|
|
939
939
|
onPointerleave: r[3] || (r[3] = //@ts-ignore
|
|
940
|
-
(
|
|
940
|
+
(..._) => n(t) && n(t)(..._)),
|
|
941
941
|
onPointercancel: r[4] || (r[4] = //@ts-ignore
|
|
942
|
-
(
|
|
942
|
+
(..._) => n(t) && n(t)(..._)),
|
|
943
943
|
onContextmenu: r[5] || (r[5] = C(() => {
|
|
944
944
|
}, ["prevent"]))
|
|
945
945
|
}, D(w), 41, $t)), 64))
|
|
946
946
|
]),
|
|
947
|
-
(
|
|
947
|
+
(b(), x(L, null, V(v, (w, F) => h("div", {
|
|
948
948
|
key: `row-${F}`,
|
|
949
949
|
class: "zhk-base__row"
|
|
950
950
|
}, [
|
|
951
|
-
F === 2 ? (
|
|
951
|
+
F === 2 ? (b(), x("button", {
|
|
952
952
|
key: 0,
|
|
953
953
|
class: O(["zhk-base__key zhk-base__key--function zhk-base__key--shift", {
|
|
954
954
|
"zhk-base__key--active": !d.value && i.value,
|
|
955
955
|
"zhk-base__key--disabled": d.value && R.value
|
|
956
956
|
}]),
|
|
957
957
|
disabled: d.value && R.value,
|
|
958
|
-
onClick:
|
|
958
|
+
onClick: y,
|
|
959
959
|
onContextmenu: r[6] || (r[6] = C(() => {
|
|
960
960
|
}, ["prevent"]))
|
|
961
961
|
}, [
|
|
962
|
-
d.value ? (
|
|
963
|
-
re(D(
|
|
964
|
-
], 64)) : (
|
|
962
|
+
d.value ? (b(), x(L, { key: 0 }, [
|
|
963
|
+
re(D($.value), 1)
|
|
964
|
+
], 64)) : (b(), x("img", St))
|
|
965
965
|
], 42, Et)) : W("", !0),
|
|
966
|
-
(
|
|
966
|
+
(b(!0), x(L, null, V(w, (_, Ce) => (b(), x("button", {
|
|
967
967
|
key: `key-${F}-${Ce}`,
|
|
968
968
|
class: "zhk-base__key zhk-base__key--letter",
|
|
969
|
-
onPointerdown: (A) => n(z)(A, () => U(
|
|
969
|
+
onPointerdown: (A) => n(z)(A, () => U(_)),
|
|
970
970
|
onPointerup: r[7] || (r[7] = //@ts-ignore
|
|
971
971
|
(...A) => n(t) && n(t)(...A)),
|
|
972
972
|
onPointerleave: r[8] || (r[8] = //@ts-ignore
|
|
@@ -975,43 +975,43 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
975
975
|
(...A) => n(t) && n(t)(...A)),
|
|
976
976
|
onContextmenu: r[10] || (r[10] = C(() => {
|
|
977
977
|
}, ["prevent"]))
|
|
978
|
-
}, D(f.value ?
|
|
979
|
-
F === 2 ? (
|
|
978
|
+
}, D(f.value ? _.toUpperCase() : _), 41, Lt))), 128)),
|
|
979
|
+
F === 2 ? (b(), x("button", {
|
|
980
980
|
key: 1,
|
|
981
981
|
class: "zhk-base__key zhk-base__key--function zhk-base__key--delete",
|
|
982
|
-
onPointerdown: r[11] || (r[11] = (
|
|
982
|
+
onPointerdown: r[11] || (r[11] = (_) => n(z)(_, () => k())),
|
|
983
983
|
onPointerup: r[12] || (r[12] = //@ts-ignore
|
|
984
|
-
(
|
|
984
|
+
(..._) => n(t) && n(t)(..._)),
|
|
985
985
|
onPointerleave: r[13] || (r[13] = //@ts-ignore
|
|
986
|
-
(
|
|
986
|
+
(..._) => n(t) && n(t)(..._)),
|
|
987
987
|
onPointercancel: r[14] || (r[14] = //@ts-ignore
|
|
988
|
-
(
|
|
988
|
+
(..._) => n(t) && n(t)(..._)),
|
|
989
989
|
onContextmenu: r[15] || (r[15] = C(() => {
|
|
990
990
|
}, ["prevent"]))
|
|
991
991
|
}, r[39] || (r[39] = [
|
|
992
|
-
|
|
992
|
+
h("img", {
|
|
993
993
|
src: ve,
|
|
994
994
|
class: "zhk-base__key-icon",
|
|
995
995
|
alt: "Delete"
|
|
996
996
|
}, null, -1)
|
|
997
997
|
]), 32)) : W("", !0)
|
|
998
998
|
])), 64)),
|
|
999
|
-
|
|
1000
|
-
|
|
999
|
+
h("div", Rt, [
|
|
1000
|
+
h("button", {
|
|
1001
1001
|
class: "zhk-base__key zhk-base__key--function",
|
|
1002
1002
|
onClick: u,
|
|
1003
1003
|
onContextmenu: r[16] || (r[16] = C(() => {
|
|
1004
1004
|
}, ["prevent"]))
|
|
1005
1005
|
}, " 符 ", 32),
|
|
1006
|
-
|
|
1006
|
+
h("button", {
|
|
1007
1007
|
class: "zhk-base__key zhk-base__key--function",
|
|
1008
|
-
onClick:
|
|
1008
|
+
onClick: g,
|
|
1009
1009
|
onContextmenu: r[17] || (r[17] = C(() => {
|
|
1010
1010
|
}, ["prevent"]))
|
|
1011
1011
|
}, " 123 ", 32),
|
|
1012
|
-
|
|
1012
|
+
h("button", {
|
|
1013
1013
|
class: "zhk-base__key",
|
|
1014
|
-
onPointerdown: r[18] || (r[18] = (w) => n(z)(w, () =>
|
|
1014
|
+
onPointerdown: r[18] || (r[18] = (w) => n(z)(w, () => c(","))),
|
|
1015
1015
|
onPointerup: r[19] || (r[19] = //@ts-ignore
|
|
1016
1016
|
(...w) => n(t) && n(t)(...w)),
|
|
1017
1017
|
onPointerleave: r[20] || (r[20] = //@ts-ignore
|
|
@@ -1021,7 +1021,7 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1021
1021
|
onContextmenu: r[22] || (r[22] = C(() => {
|
|
1022
1022
|
}, ["prevent"]))
|
|
1023
1023
|
}, " , ", 32),
|
|
1024
|
-
|
|
1024
|
+
h("button", {
|
|
1025
1025
|
class: "zhk-base__key zhk-base__key--space",
|
|
1026
1026
|
onPointerdown: r[23] || (r[23] = (w) => n(z)(w, () => N())),
|
|
1027
1027
|
onPointerup: r[24] || (r[24] = //@ts-ignore
|
|
@@ -1033,15 +1033,15 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1033
1033
|
onContextmenu: r[27] || (r[27] = C(() => {
|
|
1034
1034
|
}, ["prevent"]))
|
|
1035
1035
|
}, r[40] || (r[40] = [
|
|
1036
|
-
|
|
1036
|
+
h("img", {
|
|
1037
1037
|
src: ze,
|
|
1038
1038
|
class: "zhk-base__key-icon",
|
|
1039
1039
|
alt: "Space"
|
|
1040
1040
|
}, null, -1)
|
|
1041
1041
|
]), 32),
|
|
1042
|
-
|
|
1042
|
+
h("button", {
|
|
1043
1043
|
class: "zhk-base__key",
|
|
1044
|
-
onPointerdown: r[28] || (r[28] = (w) => n(z)(w, () =>
|
|
1044
|
+
onPointerdown: r[28] || (r[28] = (w) => n(z)(w, () => c("。"))),
|
|
1045
1045
|
onPointerup: r[29] || (r[29] = //@ts-ignore
|
|
1046
1046
|
(...w) => n(t) && n(t)(...w)),
|
|
1047
1047
|
onPointerleave: r[30] || (r[30] = //@ts-ignore
|
|
@@ -1051,16 +1051,16 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1051
1051
|
onContextmenu: r[32] || (r[32] = C(() => {
|
|
1052
1052
|
}, ["prevent"]))
|
|
1053
1053
|
}, " 。 ", 32),
|
|
1054
|
-
|
|
1054
|
+
h("button", {
|
|
1055
1055
|
class: "zhk-base__key zhk-base__key--function",
|
|
1056
1056
|
onClick: oe,
|
|
1057
1057
|
onContextmenu: r[33] || (r[33] = C(() => {
|
|
1058
1058
|
}, ["prevent"]))
|
|
1059
1059
|
}, [
|
|
1060
|
-
|
|
1061
|
-
|
|
1060
|
+
h("span", Tt, D(l.value === "zh" ? "中" : "英"), 1),
|
|
1061
|
+
h("span", Dt, "/" + D(l.value === "zh" ? "英" : "中"), 1)
|
|
1062
1062
|
], 32),
|
|
1063
|
-
|
|
1063
|
+
h("button", {
|
|
1064
1064
|
class: "zhk-base__key zhk-base__key--function",
|
|
1065
1065
|
onPointerdown: r[34] || (r[34] = (w) => n(z)(w, () => ne())),
|
|
1066
1066
|
onPointerup: r[35] || (r[35] = //@ts-ignore
|
|
@@ -1072,7 +1072,7 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1072
1072
|
onContextmenu: r[38] || (r[38] = C(() => {
|
|
1073
1073
|
}, ["prevent"]))
|
|
1074
1074
|
}, r[41] || (r[41] = [
|
|
1075
|
-
|
|
1075
|
+
h("img", {
|
|
1076
1076
|
src: fe,
|
|
1077
1077
|
class: "zhk-base__key-icon",
|
|
1078
1078
|
alt: "Enter"
|
|
@@ -1081,7 +1081,7 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1081
1081
|
])
|
|
1082
1082
|
]));
|
|
1083
1083
|
}
|
|
1084
|
-
}),
|
|
1084
|
+
}), Ht = { class: "num-keyboard" }, Vt = { class: "num-keyboard__container" }, Bt = { class: "num-keyboard__left" }, It = { class: "num-keyboard__rows" }, At = ["onClick", "onPointerdown"], Kt = {
|
|
1085
1085
|
key: 1,
|
|
1086
1086
|
src: ze,
|
|
1087
1087
|
class: "zhk-base__key-icon",
|
|
@@ -1089,7 +1089,7 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1089
1089
|
}, Wt = { class: "num-keyboard__right" }, Ot = ["onPointerdown"], Nt = ["src", "alt"], Ut = { key: 1 }, Ft = /* @__PURE__ */ I({
|
|
1090
1090
|
__name: "NumericKeyboard",
|
|
1091
1091
|
props: {
|
|
1092
|
-
keyboardRows: { default: () =>
|
|
1092
|
+
keyboardRows: { default: () => Z().numKeys || [
|
|
1093
1093
|
["1", "2", "3"],
|
|
1094
1094
|
["4", "5", "6"],
|
|
1095
1095
|
["7", "8", "9"],
|
|
@@ -1104,73 +1104,73 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1104
1104
|
{ key: "@", icon: "", text: "@", alt: "@" },
|
|
1105
1105
|
{ key: "enter", icon: fe, text: "", alt: "Enter" }
|
|
1106
1106
|
];
|
|
1107
|
-
function l(
|
|
1108
|
-
s("key", { key:
|
|
1107
|
+
function l(g) {
|
|
1108
|
+
s("key", { key: g });
|
|
1109
1109
|
}
|
|
1110
|
-
function i(
|
|
1111
|
-
s("key", { key:
|
|
1110
|
+
function i(g, u = !0) {
|
|
1111
|
+
s("key", { key: g, isControl: u });
|
|
1112
1112
|
}
|
|
1113
1113
|
function d() {
|
|
1114
1114
|
s("exit");
|
|
1115
1115
|
}
|
|
1116
|
-
const { startRepeat: f, stopRepeat:
|
|
1117
|
-
function
|
|
1118
|
-
|
|
1116
|
+
const { startRepeat: f, stopRepeat: c } = te();
|
|
1117
|
+
function y(g, u) {
|
|
1118
|
+
g === "back" || (g === "space" && (g = " "), g === "delete" || g === "enter" ? f(u, () => i(g)) : f(u, () => l(g)));
|
|
1119
1119
|
}
|
|
1120
|
-
return (
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
(
|
|
1125
|
-
key: `row-${
|
|
1120
|
+
return (g, u) => (b(), x("div", Ht, [
|
|
1121
|
+
h("div", Vt, [
|
|
1122
|
+
h("div", Bt, [
|
|
1123
|
+
h("div", It, [
|
|
1124
|
+
(b(!0), x(L, null, V(g.keyboardRows, (p, v) => (b(), x("div", {
|
|
1125
|
+
key: `row-${v}`,
|
|
1126
1126
|
class: "num-keyboard__row"
|
|
1127
1127
|
}, [
|
|
1128
|
-
(
|
|
1129
|
-
key: `key-${
|
|
1128
|
+
(b(!0), x(L, null, V(p, (m, P) => (b(), x("button", {
|
|
1129
|
+
key: `key-${v}-${P}`,
|
|
1130
1130
|
class: O(["num-keyboard__key", {
|
|
1131
1131
|
"num-keyboard__key--back": m === "back",
|
|
1132
1132
|
"num-keyboard__key--space": m === "space"
|
|
1133
1133
|
}]),
|
|
1134
1134
|
onClick: (z) => m === "back" && d(),
|
|
1135
|
-
onPointerdown: (z) =>
|
|
1135
|
+
onPointerdown: (z) => y(m, z),
|
|
1136
1136
|
onPointerup: u[0] || (u[0] = //@ts-ignore
|
|
1137
|
-
(...z) => n(
|
|
1137
|
+
(...z) => n(c) && n(c)(...z)),
|
|
1138
1138
|
onPointerleave: u[1] || (u[1] = //@ts-ignore
|
|
1139
|
-
(...z) => n(
|
|
1139
|
+
(...z) => n(c) && n(c)(...z)),
|
|
1140
1140
|
onPointercancel: u[2] || (u[2] = //@ts-ignore
|
|
1141
|
-
(...z) => n(
|
|
1141
|
+
(...z) => n(c) && n(c)(...z)),
|
|
1142
1142
|
onContextmenu: u[3] || (u[3] = C(() => {
|
|
1143
1143
|
}, ["prevent"]))
|
|
1144
1144
|
}, [
|
|
1145
|
-
m === "back" ? (
|
|
1145
|
+
m === "back" ? (b(), x(L, { key: 0 }, [
|
|
1146
1146
|
re(" 返回 ")
|
|
1147
|
-
], 64)) : m === "space" ? (
|
|
1147
|
+
], 64)) : m === "space" ? (b(), x("img", Kt)) : (b(), x(L, { key: 2 }, [
|
|
1148
1148
|
re(D(m), 1)
|
|
1149
1149
|
], 64))
|
|
1150
1150
|
], 42, At))), 128))
|
|
1151
1151
|
]))), 128))
|
|
1152
1152
|
])
|
|
1153
1153
|
]),
|
|
1154
|
-
|
|
1155
|
-
(
|
|
1156
|
-
key: `func-${
|
|
1154
|
+
h("div", Wt, [
|
|
1155
|
+
(b(), x(L, null, V(a, (p, v) => h("button", {
|
|
1156
|
+
key: `func-${v}`,
|
|
1157
1157
|
class: "num-keyboard__key num-keyboard__key--function",
|
|
1158
|
-
onPointerdown: (m) =>
|
|
1158
|
+
onPointerdown: (m) => y(p.key, m),
|
|
1159
1159
|
onPointerup: u[4] || (u[4] = //@ts-ignore
|
|
1160
|
-
(...m) => n(
|
|
1160
|
+
(...m) => n(c) && n(c)(...m)),
|
|
1161
1161
|
onPointerleave: u[5] || (u[5] = //@ts-ignore
|
|
1162
|
-
(...m) => n(
|
|
1162
|
+
(...m) => n(c) && n(c)(...m)),
|
|
1163
1163
|
onPointercancel: u[6] || (u[6] = //@ts-ignore
|
|
1164
|
-
(...m) => n(
|
|
1164
|
+
(...m) => n(c) && n(c)(...m)),
|
|
1165
1165
|
onContextmenu: u[7] || (u[7] = C(() => {
|
|
1166
1166
|
}, ["prevent"]))
|
|
1167
1167
|
}, [
|
|
1168
|
-
p.icon ? (
|
|
1168
|
+
p.icon ? (b(), x("img", {
|
|
1169
1169
|
key: 0,
|
|
1170
1170
|
src: p.icon,
|
|
1171
1171
|
class: "num-keyboard__key-icon",
|
|
1172
1172
|
alt: p.alt
|
|
1173
|
-
}, null, 8, Nt)) : (
|
|
1173
|
+
}, null, 8, Nt)) : (b(), x("span", Ut, D(p.text), 1))
|
|
1174
1174
|
], 40, Ot)), 64))
|
|
1175
1175
|
])
|
|
1176
1176
|
])
|
|
@@ -1181,70 +1181,70 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1181
1181
|
emits: ["key", "exit"],
|
|
1182
1182
|
setup(e, { emit: o }) {
|
|
1183
1183
|
const s = o, a = E("en"), l = S(() => a.value === "zh" ? rn : sn), i = E(!1), { startRepeat: d, stopRepeat: f } = te();
|
|
1184
|
-
function v
|
|
1185
|
-
i.value && d(m, () =>
|
|
1184
|
+
function c(v, m) {
|
|
1185
|
+
i.value && d(m, () => y(v));
|
|
1186
1186
|
}
|
|
1187
|
-
function
|
|
1188
|
-
s("key", { key:
|
|
1187
|
+
function y(v) {
|
|
1188
|
+
s("key", { key: v }), i.value || s("exit");
|
|
1189
1189
|
}
|
|
1190
|
-
function
|
|
1190
|
+
function g() {
|
|
1191
1191
|
s("exit");
|
|
1192
1192
|
}
|
|
1193
|
-
function u(
|
|
1194
|
-
a.value =
|
|
1193
|
+
function u(v) {
|
|
1194
|
+
a.value = v;
|
|
1195
1195
|
}
|
|
1196
1196
|
function p() {
|
|
1197
1197
|
i.value = !i.value;
|
|
1198
1198
|
}
|
|
1199
|
-
return (
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1199
|
+
return (v, m) => (b(), x("div", Yt, [
|
|
1200
|
+
h("div", jt, [
|
|
1201
|
+
h("div", Gt, [
|
|
1202
|
+
h("div", qt, [
|
|
1203
|
+
h("button", {
|
|
1204
1204
|
class: O(["symbol-keyboard__lang-btn", { "symbol-keyboard__lang-btn--active": a.value === "zh" }]),
|
|
1205
|
-
onClick: m[0] || (m[0] = (
|
|
1205
|
+
onClick: m[0] || (m[0] = (P) => u("zh")),
|
|
1206
1206
|
onContextmenu: m[1] || (m[1] = C(() => {
|
|
1207
1207
|
}, ["prevent"]))
|
|
1208
1208
|
}, " 中文 ", 34),
|
|
1209
|
-
|
|
1209
|
+
h("button", {
|
|
1210
1210
|
class: O(["symbol-keyboard__lang-btn", { "symbol-keyboard__lang-btn--active": a.value === "en" }]),
|
|
1211
|
-
onClick: m[2] || (m[2] = (
|
|
1211
|
+
onClick: m[2] || (m[2] = (P) => u("en")),
|
|
1212
1212
|
onContextmenu: m[3] || (m[3] = C(() => {
|
|
1213
1213
|
}, ["prevent"]))
|
|
1214
1214
|
}, " 英文 ", 34)
|
|
1215
1215
|
]),
|
|
1216
|
-
|
|
1217
|
-
|
|
1216
|
+
h("div", Jt, [
|
|
1217
|
+
h("button", {
|
|
1218
1218
|
class: O(["symbol-keyboard__key symbol-keyboard__key--function symbol-keyboard__key--lock", { "symbol-keyboard__key--locked": i.value }]),
|
|
1219
1219
|
onClick: p,
|
|
1220
1220
|
onContextmenu: m[4] || (m[4] = C(() => {
|
|
1221
1221
|
}, ["prevent"]))
|
|
1222
1222
|
}, [
|
|
1223
|
-
i.value ? (
|
|
1223
|
+
i.value ? (b(), x("img", {
|
|
1224
1224
|
key: 1,
|
|
1225
1225
|
src: n(Xt),
|
|
1226
1226
|
alt: "Lock closed"
|
|
1227
|
-
}, null, 8, en)) : (
|
|
1227
|
+
}, null, 8, en)) : (b(), x("img", {
|
|
1228
1228
|
key: 0,
|
|
1229
1229
|
src: n(Zt),
|
|
1230
1230
|
alt: "Lock open"
|
|
1231
1231
|
}, null, 8, Qt))
|
|
1232
1232
|
], 34),
|
|
1233
|
-
|
|
1233
|
+
h("button", {
|
|
1234
1234
|
class: "symbol-keyboard__key symbol-keyboard__key--function symbol-keyboard__key--back",
|
|
1235
|
-
onClick:
|
|
1235
|
+
onClick: g,
|
|
1236
1236
|
onContextmenu: m[5] || (m[5] = C(() => {
|
|
1237
1237
|
}, ["prevent"]))
|
|
1238
1238
|
}, " 返回 ", 32)
|
|
1239
1239
|
])
|
|
1240
1240
|
]),
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
(
|
|
1241
|
+
h("div", tn, [
|
|
1242
|
+
h("div", nn, [
|
|
1243
|
+
(b(!0), x(L, null, V(l.value, (P, z) => (b(), x("button", {
|
|
1244
1244
|
key: `key-${z}`,
|
|
1245
1245
|
class: "symbol-keyboard__key",
|
|
1246
|
-
onClick: (t) => !i.value &&
|
|
1247
|
-
onPointerdown: (t) =>
|
|
1246
|
+
onClick: (t) => !i.value && y(P),
|
|
1247
|
+
onPointerdown: (t) => c(P, t),
|
|
1248
1248
|
onPointerup: m[6] || (m[6] = //@ts-ignore
|
|
1249
1249
|
(...t) => n(f) && n(f)(...t)),
|
|
1250
1250
|
onPointerleave: m[7] || (m[7] = //@ts-ignore
|
|
@@ -1253,7 +1253,7 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1253
1253
|
(...t) => n(f) && n(f)(...t)),
|
|
1254
1254
|
onContextmenu: m[9] || (m[9] = C(() => {
|
|
1255
1255
|
}, ["prevent"]))
|
|
1256
|
-
}, D(
|
|
1256
|
+
}, D(P), 41, on))), 128))
|
|
1257
1257
|
])
|
|
1258
1258
|
])
|
|
1259
1259
|
])
|
|
@@ -1265,44 +1265,84 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1265
1265
|
}, un = /* @__PURE__ */ I({
|
|
1266
1266
|
__name: "ZhKeyboard",
|
|
1267
1267
|
props: {
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1268
|
+
/**
|
|
1269
|
+
* 默认的键盘模式
|
|
1270
|
+
*/
|
|
1271
|
+
defaultMode: {
|
|
1272
|
+
type: String,
|
|
1273
|
+
default: () => Z().defaultMode ?? "en"
|
|
1274
|
+
},
|
|
1275
|
+
/**
|
|
1276
|
+
* 是否启用手写输入
|
|
1277
|
+
*/
|
|
1278
|
+
enableHandwriting: {
|
|
1279
|
+
type: Boolean,
|
|
1280
|
+
default: () => Z().enableHandwriting ?? !1
|
|
1281
|
+
},
|
|
1282
|
+
/**
|
|
1283
|
+
* 键盘定位模式
|
|
1284
|
+
* @default 'static'
|
|
1285
|
+
*/
|
|
1286
|
+
position: {
|
|
1287
|
+
type: String,
|
|
1288
|
+
default: () => Z().position ?? "static"
|
|
1289
|
+
},
|
|
1290
|
+
/**
|
|
1291
|
+
* 浮动模式下键盘与输入框的距离
|
|
1292
|
+
* @default 10
|
|
1293
|
+
*/
|
|
1294
|
+
floatMarginTop: {
|
|
1295
|
+
type: Number,
|
|
1296
|
+
default: () => Z().floatMarginTop ?? 0
|
|
1297
|
+
},
|
|
1298
|
+
/**
|
|
1299
|
+
* 当没有input获得焦点时是否禁用键盘
|
|
1300
|
+
* @default true
|
|
1301
|
+
*/
|
|
1302
|
+
disableWhenNoFocus: {
|
|
1303
|
+
type: Boolean,
|
|
1304
|
+
default: () => Z().disableWhenNoFocus ?? !0
|
|
1305
|
+
},
|
|
1306
|
+
/**
|
|
1307
|
+
* 数字键盘的行配置
|
|
1308
|
+
*/
|
|
1309
|
+
numKeys: {
|
|
1310
|
+
type: Array || void 0
|
|
1311
|
+
}
|
|
1273
1312
|
},
|
|
1274
1313
|
emits: ["key"],
|
|
1275
1314
|
setup(e, { emit: o }) {
|
|
1276
|
-
const s = e, a = o, l = E(s.defaultMode), i = E(s.defaultMode), d = E([]), f = E(!1),
|
|
1277
|
-
|
|
1278
|
-
|
|
1315
|
+
const s = e, a = o, l = E(s.defaultMode), i = E(s.defaultMode), d = E([]), f = E(!1), c = E(null), y = E(null), { recognizerInitialized: g, recognizerProgress: u } = ot(s.enableHandwriting);
|
|
1316
|
+
X(l, ($, R) => {
|
|
1317
|
+
$ !== R && (i.value = R);
|
|
1279
1318
|
});
|
|
1280
|
-
const p = Ze(),
|
|
1319
|
+
const p = Ze(), v = S(() => p.value && de(p.value) ? p.value : null), m = S(() => s.position === "static" || !!(p.value && de(p.value))), { height: P } = he(y);
|
|
1281
1320
|
q(() => {
|
|
1282
|
-
if (
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1321
|
+
if (v.value) {
|
|
1322
|
+
const $ = v.value.dataset.inputmode;
|
|
1323
|
+
$ && (l.value = $);
|
|
1285
1324
|
}
|
|
1286
1325
|
});
|
|
1287
|
-
const z = S(() => s.disableWhenNoFocus === !1 ? !1 : !
|
|
1326
|
+
const z = S(() => s.disableWhenNoFocus === !1 ? !1 : !v.value);
|
|
1288
1327
|
function t() {
|
|
1289
|
-
if (!
|
|
1328
|
+
if (!P.value)
|
|
1290
1329
|
return;
|
|
1291
|
-
const
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
s.position
|
|
1330
|
+
const $ = Ge(
|
|
1331
|
+
v.value,
|
|
1332
|
+
y.value,
|
|
1333
|
+
s.position,
|
|
1334
|
+
s.floatMarginTop
|
|
1295
1335
|
);
|
|
1296
|
-
|
|
1336
|
+
c.value = $;
|
|
1297
1337
|
}
|
|
1298
1338
|
q(t);
|
|
1299
1339
|
const k = Ke(t, 100);
|
|
1300
1340
|
J(window, "scroll", k, { passive: !0 }), J(window, "resize", k, { passive: !0 });
|
|
1301
|
-
function N(
|
|
1302
|
-
if (
|
|
1303
|
-
switch (
|
|
1341
|
+
function N($) {
|
|
1342
|
+
if ($.isControl) {
|
|
1343
|
+
switch ($.key) {
|
|
1304
1344
|
case "delete":
|
|
1305
|
-
et(
|
|
1345
|
+
et(v.value);
|
|
1306
1346
|
break;
|
|
1307
1347
|
case "more":
|
|
1308
1348
|
f.value = !0;
|
|
@@ -1310,57 +1350,57 @@ const st = { class: "zhk-candidate-list" }, it = ["onClick"], xe = /* @__PURE__
|
|
|
1310
1350
|
}
|
|
1311
1351
|
return;
|
|
1312
1352
|
} else
|
|
1313
|
-
ne(
|
|
1314
|
-
a("key",
|
|
1353
|
+
ne($.key);
|
|
1354
|
+
a("key", $);
|
|
1315
1355
|
}
|
|
1316
|
-
function ne(
|
|
1317
|
-
Qe(
|
|
1356
|
+
function ne($) {
|
|
1357
|
+
Qe(v.value, $);
|
|
1318
1358
|
}
|
|
1319
1359
|
function U() {
|
|
1320
|
-
|
|
1360
|
+
l.value === "hand" ? i.value = "zh" : ["num", "symbol"].includes(i.value) && (i.value = s.defaultMode), l.value = i.value;
|
|
1321
1361
|
}
|
|
1322
|
-
function oe(
|
|
1323
|
-
d.value =
|
|
1362
|
+
function oe($) {
|
|
1363
|
+
d.value = $;
|
|
1324
1364
|
}
|
|
1325
|
-
return (
|
|
1365
|
+
return ($, R) => Re((b(), x("div", {
|
|
1326
1366
|
ref_key: "keyboardRef",
|
|
1327
|
-
ref:
|
|
1367
|
+
ref: y,
|
|
1328
1368
|
class: O(["zhk", {
|
|
1329
|
-
"zhk--floating":
|
|
1330
|
-
"zhk--bottom":
|
|
1369
|
+
"zhk--floating": e.position === "float",
|
|
1370
|
+
"zhk--bottom": e.position === "bottom",
|
|
1331
1371
|
"zhk--disabled": z.value
|
|
1332
1372
|
}]),
|
|
1333
1373
|
style: se({
|
|
1334
|
-
"--keyboard-height": `${n(
|
|
1335
|
-
...
|
|
1374
|
+
"--keyboard-height": `${n(P)}px`,
|
|
1375
|
+
...c.value
|
|
1336
1376
|
}),
|
|
1337
1377
|
onMousedown: R[1] || (R[1] = C(() => {
|
|
1338
1378
|
}, ["prevent"]))
|
|
1339
1379
|
}, [
|
|
1340
|
-
z.value || !m.value || !n(
|
|
1341
|
-
|
|
1342
|
-
]))) : (
|
|
1343
|
-
l.value === "hand" ? (
|
|
1380
|
+
z.value || !m.value || !n(P) ? (b(), x("div", an, R[2] || (R[2] = [
|
|
1381
|
+
h("span", null, "请选择输入框以启用键盘", -1)
|
|
1382
|
+
]))) : (b(), x(L, { key: 1 }, [
|
|
1383
|
+
l.value === "hand" ? (b(), K(ft, {
|
|
1344
1384
|
key: 0,
|
|
1345
|
-
"recognizer-initialized": n(
|
|
1385
|
+
"recognizer-initialized": n(g),
|
|
1346
1386
|
"recognizer-progress": n(u),
|
|
1347
1387
|
onKey: N,
|
|
1348
1388
|
onExit: U,
|
|
1349
1389
|
onRecognize: oe
|
|
1350
|
-
}, null, 8, ["recognizer-initialized", "recognizer-progress"])) : l.value === "num" ? (
|
|
1390
|
+
}, null, 8, ["recognizer-initialized", "recognizer-progress"])) : l.value === "num" ? (b(), K(Ft, {
|
|
1351
1391
|
key: 1,
|
|
1352
|
-
"keyboard-rows":
|
|
1392
|
+
"keyboard-rows": e.numKeys,
|
|
1353
1393
|
onKey: N,
|
|
1354
1394
|
onExit: U
|
|
1355
|
-
}, null, 8, ["keyboard-rows"])) : l.value === "symbol" ? (
|
|
1395
|
+
}, null, 8, ["keyboard-rows"])) : l.value === "symbol" ? (b(), K(ln, {
|
|
1356
1396
|
key: 2,
|
|
1357
1397
|
onKey: N,
|
|
1358
1398
|
onExit: U
|
|
1359
|
-
})) : l.value === "en" || l.value === "zh" ? (
|
|
1399
|
+
})) : l.value === "en" || l.value === "en_cap" || l.value === "zh" ? (b(), K(Mt, {
|
|
1360
1400
|
key: 3,
|
|
1361
1401
|
modelValue: l.value,
|
|
1362
|
-
"onUpdate:modelValue": R[0] || (R[0] = (
|
|
1363
|
-
"enable-handwriting":
|
|
1402
|
+
"onUpdate:modelValue": R[0] || (R[0] = (M) => l.value = M),
|
|
1403
|
+
"enable-handwriting": e.enableHandwriting,
|
|
1364
1404
|
onKey: N
|
|
1365
1405
|
}, null, 8, ["modelValue", "enable-handwriting"])) : W("", !0)
|
|
1366
1406
|
], 64))
|
|
@@ -1382,7 +1422,7 @@ export {
|
|
|
1382
1422
|
et as delToInputElement,
|
|
1383
1423
|
ue as getHandwritingRecognizer,
|
|
1384
1424
|
pn as getInputElement,
|
|
1385
|
-
|
|
1425
|
+
Z as getKeyboardConfig,
|
|
1386
1426
|
je as getPinyinEngine,
|
|
1387
1427
|
de as isInputElement,
|
|
1388
1428
|
tt as moveCursor,
|