@uiwwsw/virtual-keyboard 2.0.0 → 2.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/README.md +14 -9
- package/dist/index.js +813 -699
- package/dist/types/components/Context.d.ts +7 -0
- package/dist/types/utils/nativeEditing.d.ts +7 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as q, jsx as
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { convertQwertyToHangul as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
class
|
|
2
|
+
import { jsxs as q, jsx as T, Fragment as Me } from "react/jsx-runtime";
|
|
3
|
+
import { useContext as Oe, createContext as et, forwardRef as tt, useId as $e, useRef as I, useState as P, useMemo as He, useCallback as S, useEffect as z, useImperativeHandle as nt, useLayoutEffect as rt, createElement as at } from "react";
|
|
4
|
+
import { convertQwertyToHangul as Ue, assemble as ot, removeLastCharacter as it } from "es-hangul";
|
|
5
|
+
import { createPortal as Te } from "react-dom";
|
|
6
|
+
class ct {
|
|
7
7
|
past = [];
|
|
8
8
|
future = [];
|
|
9
|
-
record(
|
|
10
|
-
|
|
9
|
+
record(n, r) {
|
|
10
|
+
n.value !== r.value && (n.composing && r.composing && this.past.length || (this.past.push({ ...n, composing: !1 }), this.past.length > 100 && this.past.shift()), this.future = []);
|
|
11
11
|
}
|
|
12
|
-
undo(
|
|
13
|
-
const
|
|
14
|
-
return
|
|
12
|
+
undo(n) {
|
|
13
|
+
const r = this.past.pop();
|
|
14
|
+
return r ? (this.future.push({ ...n, composing: !1 }), r) : n;
|
|
15
15
|
}
|
|
16
|
-
redo(
|
|
17
|
-
const
|
|
18
|
-
return
|
|
16
|
+
redo(n) {
|
|
17
|
+
const r = this.future.pop();
|
|
18
|
+
return r ? (this.past.push({ ...n, composing: !1 }), r) : n;
|
|
19
19
|
}
|
|
20
20
|
clear() {
|
|
21
21
|
this.past = [], this.future = [];
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
function
|
|
26
|
-
const e =
|
|
24
|
+
const We = et(null);
|
|
25
|
+
function Ze() {
|
|
26
|
+
const e = Oe(We);
|
|
27
27
|
if (!e)
|
|
28
28
|
throw new Error(
|
|
29
29
|
"VirtualInput must be used within a <VirtualInputProvider>."
|
|
30
30
|
);
|
|
31
31
|
return e;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function we(e) {
|
|
34
34
|
return /^[\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF]$/.test(e);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function lt(e, n) {
|
|
37
37
|
if (e.key === "HangulMode") return { handled: !0, toggleHangulMode: !0 };
|
|
38
38
|
if (e.ctrlKey || e.metaKey || e.altKey || [...e.key].length !== 1 || /[\r\n\t]/.test(e.key))
|
|
39
39
|
return { handled: !1 };
|
|
40
|
-
const
|
|
41
|
-
return { handled: !0, text:
|
|
40
|
+
const r = n && /^[A-Za-z]$/.test(e.key) ? Ue(e.key) : e.key;
|
|
41
|
+
return { handled: !0, text: r, composing: we(r) };
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const re = [
|
|
44
44
|
[
|
|
45
45
|
{
|
|
46
46
|
label: "q",
|
|
@@ -211,7 +211,7 @@ const G = [
|
|
|
211
211
|
width: 1.25
|
|
212
212
|
}
|
|
213
213
|
]
|
|
214
|
-
],
|
|
214
|
+
], ut = [
|
|
215
215
|
[
|
|
216
216
|
{
|
|
217
217
|
label: "1",
|
|
@@ -280,7 +280,7 @@ const G = [
|
|
|
280
280
|
type: "action"
|
|
281
281
|
}
|
|
282
282
|
]
|
|
283
|
-
],
|
|
283
|
+
], st = [
|
|
284
284
|
[
|
|
285
285
|
{
|
|
286
286
|
label: "1",
|
|
@@ -363,7 +363,7 @@ const G = [
|
|
|
363
363
|
}
|
|
364
364
|
]
|
|
365
365
|
];
|
|
366
|
-
function
|
|
366
|
+
function me(e) {
|
|
367
367
|
switch (e) {
|
|
368
368
|
case "hangul":
|
|
369
369
|
return !0;
|
|
@@ -376,34 +376,34 @@ function de(e) {
|
|
|
376
376
|
return null;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
const
|
|
379
|
+
const ge = () => !0, dt = {
|
|
380
380
|
text: {
|
|
381
381
|
mode: "text",
|
|
382
|
-
layout:
|
|
383
|
-
filterKey:
|
|
382
|
+
layout: re,
|
|
383
|
+
filterKey: ge,
|
|
384
384
|
sanitizeValue: (e) => e.replace(/[\r\n\t]+/g, " ")
|
|
385
385
|
},
|
|
386
386
|
number: {
|
|
387
387
|
mode: "number",
|
|
388
|
-
layout:
|
|
388
|
+
layout: ut,
|
|
389
389
|
filterKey: (e) => /^[0-9.]+$/.test(e),
|
|
390
390
|
sanitizeValue: (e) => e.replace(/[^0-9.]/g, "")
|
|
391
391
|
},
|
|
392
392
|
tel: {
|
|
393
393
|
mode: "tel",
|
|
394
|
-
layout:
|
|
394
|
+
layout: st,
|
|
395
395
|
filterKey: (e) => /^[0-9*#+]+$/.test(e),
|
|
396
396
|
sanitizeValue: (e) => e.replace(/[^0-9*#+]/g, "")
|
|
397
397
|
},
|
|
398
398
|
hangul: {
|
|
399
399
|
mode: "hangul",
|
|
400
|
-
layout:
|
|
401
|
-
filterKey:
|
|
400
|
+
layout: re,
|
|
401
|
+
filterKey: ge,
|
|
402
402
|
sanitizeValue: (e) => e.replace(/[A-Za-z]/g, "")
|
|
403
403
|
},
|
|
404
404
|
alpha: {
|
|
405
405
|
mode: "alpha",
|
|
406
|
-
layout:
|
|
406
|
+
layout: re,
|
|
407
407
|
filterKey: (e) => /^[A-Za-z]+$/.test(e),
|
|
408
408
|
sanitizeValue: (e) => e.replace(/[^A-Za-z]/g, "")
|
|
409
409
|
},
|
|
@@ -411,270 +411,346 @@ const se = () => !0, nt = {
|
|
|
411
411
|
mode: "alphanumeric",
|
|
412
412
|
layout: [
|
|
413
413
|
Array.from("1234567890", (e) => ({ value: e })),
|
|
414
|
-
...
|
|
414
|
+
...re
|
|
415
415
|
],
|
|
416
416
|
filterKey: (e) => /^[A-Za-z0-9]+$/.test(e),
|
|
417
417
|
sanitizeValue: (e) => e.replace(/[^A-Za-z0-9]/g, "")
|
|
418
418
|
},
|
|
419
419
|
custom: {
|
|
420
420
|
mode: "custom",
|
|
421
|
-
layout:
|
|
422
|
-
filterKey:
|
|
421
|
+
layout: re,
|
|
422
|
+
filterKey: ge,
|
|
423
423
|
sanitizeValue: (e) => e.replace(/[\r\n\t]+/g, " ")
|
|
424
424
|
}
|
|
425
425
|
};
|
|
426
|
-
function
|
|
427
|
-
const
|
|
426
|
+
function Se(e) {
|
|
427
|
+
const n = e?.mode ?? "text", r = dt[n];
|
|
428
428
|
return {
|
|
429
|
-
mode:
|
|
430
|
-
layout: e?.layout ??
|
|
431
|
-
filterKey: e?.filterKey ??
|
|
432
|
-
sanitizeValue: e?.sanitizeValue ??
|
|
429
|
+
mode: n,
|
|
430
|
+
layout: e?.layout ?? r.layout ?? re,
|
|
431
|
+
filterKey: e?.filterKey ?? r.filterKey ?? ge,
|
|
432
|
+
sanitizeValue: e?.sanitizeValue ?? r.sanitizeValue ?? ((a) => a)
|
|
433
433
|
};
|
|
434
434
|
}
|
|
435
|
-
const
|
|
436
|
-
function
|
|
437
|
-
const n = Math.max(0, Math.min(r, e.length - 1));
|
|
438
|
-
for (const o of at.segment(e))
|
|
439
|
-
if (n < o.index + o.segment.length)
|
|
440
|
-
return [o.index, o.index + o.segment.length];
|
|
441
|
-
return [0, 0];
|
|
442
|
-
}
|
|
443
|
-
const Ee = (e) => Array.from(ot.segment(e));
|
|
444
|
-
function ue(e, r) {
|
|
435
|
+
const ft = new Intl.Segmenter(void 0, { granularity: "grapheme" }), Ve = (e) => Array.from(ft.segment(e));
|
|
436
|
+
function Z(e, n) {
|
|
445
437
|
return [
|
|
446
|
-
...
|
|
438
|
+
...Ve(e).map((a) => a.index),
|
|
447
439
|
e.length
|
|
448
|
-
].filter((
|
|
440
|
+
].filter((a) => a <= Math.max(0, n)).at(-1) ?? 0;
|
|
449
441
|
}
|
|
450
|
-
function
|
|
451
|
-
const
|
|
452
|
-
...
|
|
442
|
+
function Le(e, n, r) {
|
|
443
|
+
const a = [
|
|
444
|
+
...Ve(e).map((i) => i.index),
|
|
453
445
|
e.length
|
|
454
446
|
];
|
|
455
|
-
return
|
|
447
|
+
return r < 0 ? a.filter((i) => i < n).at(-1) ?? 0 : a.find((i) => i > n) ?? e.length;
|
|
456
448
|
}
|
|
457
|
-
const
|
|
458
|
-
function
|
|
459
|
-
const [i,
|
|
460
|
-
let
|
|
461
|
-
i ===
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
464
|
-
const
|
|
465
|
-
return { value:
|
|
449
|
+
const ae = ({ anchor: e, caret: n }) => [Math.min(e, n), Math.max(e, n)];
|
|
450
|
+
function qe(e, n, r = !1, a) {
|
|
451
|
+
const [i, s] = ae(e);
|
|
452
|
+
let f = e.value.slice(0, i), v = n;
|
|
453
|
+
i === s && e.composing && r && we(f.at(-1) ?? "") && (v = ot([f.at(-1), n]), f = f.slice(0, -1));
|
|
454
|
+
const c = f + v + e.value.slice(s);
|
|
455
|
+
if (a !== void 0 && c.length > a) return e;
|
|
456
|
+
const m = f.length + v.length;
|
|
457
|
+
return { value: c, caret: m, anchor: m, composing: r };
|
|
466
458
|
}
|
|
467
|
-
function
|
|
468
|
-
let [
|
|
469
|
-
if (
|
|
470
|
-
if (
|
|
471
|
-
const i = e.value.slice(0,
|
|
459
|
+
function ve(e, n) {
|
|
460
|
+
let [r, a] = ae(e);
|
|
461
|
+
if (r === a) {
|
|
462
|
+
if (n < 0 && e.composing && we(e.value[r - 1] ?? "")) {
|
|
463
|
+
const i = e.value.slice(0, r - 1) + it(e.value[r - 1]);
|
|
472
464
|
return {
|
|
473
|
-
value: i + e.value.slice(
|
|
465
|
+
value: i + e.value.slice(a),
|
|
474
466
|
anchor: i.length,
|
|
475
467
|
caret: i.length,
|
|
476
468
|
composing: !0
|
|
477
469
|
};
|
|
478
470
|
}
|
|
479
|
-
|
|
471
|
+
n < 0 ? r = Le(e.value, r, -1) : a = Le(e.value, a, 1);
|
|
480
472
|
}
|
|
481
473
|
return {
|
|
482
|
-
value: e.value.slice(0,
|
|
483
|
-
caret:
|
|
484
|
-
anchor:
|
|
474
|
+
value: e.value.slice(0, r) + e.value.slice(a),
|
|
475
|
+
caret: r,
|
|
476
|
+
anchor: r,
|
|
485
477
|
composing: !1
|
|
486
478
|
};
|
|
487
479
|
}
|
|
488
|
-
function
|
|
489
|
-
const [
|
|
480
|
+
function Fe(e, n, r = !1) {
|
|
481
|
+
const [a, i] = ae(e), s = n === "home" ? 0 : n === "end" ? e.value.length : !r && a !== i ? n < 0 ? a : i : Le(e.value, e.caret, n);
|
|
490
482
|
return {
|
|
491
483
|
...e,
|
|
492
|
-
caret:
|
|
493
|
-
anchor:
|
|
484
|
+
caret: s,
|
|
485
|
+
anchor: r ? e.anchor : s,
|
|
494
486
|
composing: !1
|
|
495
487
|
};
|
|
496
488
|
}
|
|
497
|
-
|
|
489
|
+
function pt(e, n, r, a, i, s) {
|
|
490
|
+
if (n === e.value) return e;
|
|
491
|
+
let f = 0;
|
|
492
|
+
for (; f < e.value.length && f < n.length && e.value[f] === n[f]; )
|
|
493
|
+
f++;
|
|
494
|
+
f = Math.min(
|
|
495
|
+
Z(e.value, f),
|
|
496
|
+
Z(n, f)
|
|
497
|
+
);
|
|
498
|
+
let v = e.value.length, c = n.length;
|
|
499
|
+
for (; v > f && c > f && e.value[v - 1] === n[c - 1]; )
|
|
500
|
+
v--, c--;
|
|
501
|
+
for (; Z(e.value, v) !== v || Z(n, c) !== c; )
|
|
502
|
+
v < e.value.length && v++, c < n.length && c++;
|
|
503
|
+
const m = n.slice(f, c), p = a(m).replace(/[\r\n\t]+/g, " ");
|
|
504
|
+
if (m && (!p || !i(p))) return e;
|
|
505
|
+
const l = { ...e, anchor: f, caret: v, composing: !1 }, u = m ? qe(l, p, !1, s) : ve(l, -1);
|
|
506
|
+
if (u === l) return e;
|
|
507
|
+
const V = (w) => Z(
|
|
508
|
+
u.value,
|
|
509
|
+
w <= f ? w : w >= c ? w + p.length - m.length : f + a(m.slice(0, w - f)).replace(/[\r\n\t]+/g, " ").length
|
|
510
|
+
);
|
|
511
|
+
return {
|
|
512
|
+
...u,
|
|
513
|
+
anchor: V(r.backward ? r.end : r.start),
|
|
514
|
+
caret: V(r.backward ? r.start : r.end)
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
const ht = typeof window > "u" ? z : rt, Mt = tt(
|
|
498
518
|
function({
|
|
499
|
-
value:
|
|
500
|
-
defaultValue:
|
|
501
|
-
placeholder:
|
|
519
|
+
value: n,
|
|
520
|
+
defaultValue: r = "",
|
|
521
|
+
placeholder: a,
|
|
502
522
|
onChange: i,
|
|
503
|
-
onValueChange:
|
|
504
|
-
onClipboardError:
|
|
523
|
+
onValueChange: s,
|
|
524
|
+
onClipboardError: f,
|
|
505
525
|
mode: v = "text",
|
|
506
|
-
layout:
|
|
507
|
-
filterKey:
|
|
508
|
-
sanitizeValue:
|
|
526
|
+
layout: c,
|
|
527
|
+
filterKey: m,
|
|
528
|
+
sanitizeValue: p,
|
|
509
529
|
disabled: l = !1,
|
|
510
530
|
readOnly: u = !1,
|
|
511
|
-
maxLength:
|
|
531
|
+
maxLength: V,
|
|
512
532
|
...w
|
|
513
533
|
}, Q) {
|
|
514
|
-
const H =
|
|
515
|
-
focusId:
|
|
516
|
-
onFocus:
|
|
517
|
-
onBlur:
|
|
518
|
-
defaultLayout:
|
|
519
|
-
inputRef:
|
|
520
|
-
hangulMode:
|
|
521
|
-
theme:
|
|
522
|
-
toggleKorean:
|
|
523
|
-
|
|
524
|
-
} =
|
|
525
|
-
value:
|
|
526
|
-
caret: (
|
|
527
|
-
anchor: (
|
|
534
|
+
const H = $e(), {
|
|
535
|
+
focusId: le,
|
|
536
|
+
onFocus: te,
|
|
537
|
+
onBlur: F,
|
|
538
|
+
defaultLayout: oe,
|
|
539
|
+
inputRef: X,
|
|
540
|
+
hangulMode: J,
|
|
541
|
+
theme: ue,
|
|
542
|
+
toggleKorean: g,
|
|
543
|
+
setEditingStatus: L
|
|
544
|
+
} = Ze(), y = I(null), A = I(null), x = I(!1), B = I(!1), R = I(null), [Y, N] = P(null), [b, O] = P(!1), [U, de] = P(() => ({
|
|
545
|
+
value: n ?? r,
|
|
546
|
+
caret: (n ?? r).length,
|
|
547
|
+
anchor: (n ?? r).length,
|
|
528
548
|
composing: !1
|
|
529
|
-
})),
|
|
530
|
-
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
...
|
|
534
|
-
value:
|
|
535
|
-
caret:
|
|
536
|
-
anchor:
|
|
537
|
-
composing:
|
|
549
|
+
})), W = n ?? U.value, d = I(U), ne = I(0), ie = I(new ct()), G = I(!1), h = le === H, k = I(h);
|
|
550
|
+
k.current = h;
|
|
551
|
+
const $ = n !== void 0 && n !== U.value;
|
|
552
|
+
$ && ie.current.clear(), d.current = {
|
|
553
|
+
...U,
|
|
554
|
+
value: W,
|
|
555
|
+
caret: Z(W, U.caret),
|
|
556
|
+
anchor: Z(W, U.anchor),
|
|
557
|
+
composing: $ ? !1 : U.composing
|
|
538
558
|
};
|
|
539
|
-
const
|
|
540
|
-
() =>
|
|
559
|
+
const j = He(
|
|
560
|
+
() => Se({
|
|
541
561
|
mode: v,
|
|
542
|
-
layout:
|
|
543
|
-
filterKey:
|
|
544
|
-
sanitizeValue:
|
|
562
|
+
layout: c ?? (v === "text" || v === "custom" ? oe : void 0),
|
|
563
|
+
filterKey: m,
|
|
564
|
+
sanitizeValue: p
|
|
545
565
|
}),
|
|
546
|
-
[v,
|
|
547
|
-
), [
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
(l || u) && M();
|
|
554
|
-
}, [l, u, M]), V(() => {
|
|
555
|
-
const t = (a) => {
|
|
556
|
-
B.current && B.current.id !== a.pointerId && M();
|
|
557
|
-
};
|
|
558
|
-
return window.addEventListener("blur", M), window.addEventListener("scroll", M, !0), window.addEventListener("pointerdown", t, !0), document.addEventListener("visibilitychange", M), () => {
|
|
559
|
-
M(), window.removeEventListener("blur", M), window.removeEventListener("scroll", M, !0), window.removeEventListener("pointerdown", t, !0), document.removeEventListener("visibilitychange", M);
|
|
560
|
-
};
|
|
561
|
-
}, [M]);
|
|
562
|
-
const x = k(
|
|
563
|
-
(t, a = !0) => {
|
|
564
|
-
const E = s.current.value;
|
|
565
|
-
if (a && U.current.record(s.current, t), s.current = t, m.current++, j(t), t.value !== E) {
|
|
566
|
-
c?.(t.value);
|
|
567
|
-
const $ = { value: t.value };
|
|
566
|
+
[v, c, oe, m, p]
|
|
567
|
+
), [ye, fe] = P(""), E = S(
|
|
568
|
+
(t, o = !0, C = !1) => {
|
|
569
|
+
const K = d.current.value;
|
|
570
|
+
if (o && ie.current.record(d.current, t), x.current = !C, d.current = t, ne.current++, fe(""), de(t), t.value !== K) {
|
|
571
|
+
s?.(t.value);
|
|
572
|
+
const M = { value: t.value };
|
|
568
573
|
i?.({
|
|
569
|
-
target:
|
|
570
|
-
currentTarget:
|
|
574
|
+
target: M,
|
|
575
|
+
currentTarget: M
|
|
571
576
|
});
|
|
572
577
|
}
|
|
573
578
|
},
|
|
574
|
-
[i,
|
|
575
|
-
),
|
|
576
|
-
|
|
579
|
+
[i, s]
|
|
580
|
+
), D = S(() => {
|
|
581
|
+
const t = A.current;
|
|
582
|
+
if (!t || l || x.current || t.value !== d.current.value || B.current)
|
|
583
|
+
return null;
|
|
584
|
+
const o = t.selectionStart ?? 0, C = t.selectionEnd ?? o, K = t.selectionDirection === "backward" ? { anchor: C, caret: o } : { anchor: o, caret: C }, M = Z(d.current.value, K.anchor), _ = Z(d.current.value, K.caret);
|
|
585
|
+
return (M !== d.current.anchor || _ !== d.current.caret || M !== K.anchor || _ !== K.caret) && E(
|
|
586
|
+
{ ...d.current, anchor: M, caret: _, composing: !1 },
|
|
587
|
+
!1,
|
|
588
|
+
M === K.anchor && _ === K.caret
|
|
589
|
+
), { anchor: M, caret: _ };
|
|
590
|
+
}, [l, E]);
|
|
591
|
+
z(() => {
|
|
592
|
+
const t = () => {
|
|
593
|
+
document.activeElement === A.current && D();
|
|
594
|
+
}, o = A.current;
|
|
595
|
+
return document.addEventListener("selectionchange", t), o?.addEventListener("select", t), () => {
|
|
596
|
+
document.removeEventListener("selectionchange", t), o?.removeEventListener("select", t);
|
|
597
|
+
};
|
|
598
|
+
}, [D]), ht(() => {
|
|
599
|
+
if (R.current && R.current.value !== W && (B.current = !1, R.current = null, N(null)), !l && A.current && !B.current && (x.current || $)) {
|
|
600
|
+
const { anchor: t, caret: o } = d.current, C = Math.min(t, o), K = Math.max(t, o), M = t > o ? "backward" : "forward";
|
|
601
|
+
(A.current.selectionStart !== C || A.current.selectionEnd !== K || C !== K && A.current.selectionDirection !== M) && A.current.setSelectionRange(C, K, M);
|
|
602
|
+
}
|
|
603
|
+
x.current = !1;
|
|
604
|
+
}), z(() => {
|
|
605
|
+
if (!h) return;
|
|
606
|
+
const [t, o] = ae(d.current);
|
|
607
|
+
L({
|
|
608
|
+
selectionLength: Ve(W.slice(t, o)).length,
|
|
609
|
+
hasValue: !!W,
|
|
610
|
+
message: ye
|
|
611
|
+
});
|
|
612
|
+
}, [
|
|
613
|
+
W,
|
|
614
|
+
U.anchor,
|
|
615
|
+
U.caret,
|
|
616
|
+
ye,
|
|
617
|
+
h,
|
|
618
|
+
L
|
|
619
|
+
]);
|
|
620
|
+
const ce = S(
|
|
621
|
+
(t, o = !1) => {
|
|
577
622
|
if (l || u) return;
|
|
578
|
-
|
|
579
|
-
|
|
623
|
+
D();
|
|
624
|
+
const C = j.sanitizeValue(t).replace(/[\r\n\t]+/g, " ");
|
|
625
|
+
C && E(qe(d.current, C, o, V));
|
|
580
626
|
},
|
|
581
|
-
[l, u,
|
|
582
|
-
),
|
|
583
|
-
!l && !u &&
|
|
584
|
-
}, [l, u,
|
|
585
|
-
!l && !u &&
|
|
586
|
-
}, [l, u,
|
|
587
|
-
() =>
|
|
588
|
-
...
|
|
589
|
-
caret:
|
|
627
|
+
[l, u, j, V, E, D]
|
|
628
|
+
), be = S(() => {
|
|
629
|
+
!l && !u && E(ie.current.undo(d.current), !1);
|
|
630
|
+
}, [l, u, E]), xe = S(() => {
|
|
631
|
+
!l && !u && E(ie.current.redo(d.current), !1);
|
|
632
|
+
}, [l, u, E]), Ke = S(
|
|
633
|
+
() => E({
|
|
634
|
+
...d.current,
|
|
635
|
+
caret: d.current.value.length,
|
|
590
636
|
anchor: 0,
|
|
591
637
|
composing: !1
|
|
592
638
|
}),
|
|
593
|
-
[
|
|
594
|
-
),
|
|
595
|
-
(t,
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
if (
|
|
601
|
-
|
|
639
|
+
[E]
|
|
640
|
+
), Ie = S(
|
|
641
|
+
(t, o = !1) => {
|
|
642
|
+
D(), E(Fe(d.current, t === "left" ? -1 : 1, o));
|
|
643
|
+
},
|
|
644
|
+
[E, D]
|
|
645
|
+
), Ye = (t) => {
|
|
646
|
+
if (w.onKeyDown?.(t), t.defaultPrevented || l || B.current || t.nativeEvent.isComposing || t.keyCode === 229)
|
|
647
|
+
return;
|
|
648
|
+
D();
|
|
649
|
+
const o = t.key;
|
|
650
|
+
if (o === "Escape") {
|
|
651
|
+
t.preventDefault(), E({ ...d.current, composing: !1 }), F(!0), A.current?.blur();
|
|
602
652
|
return;
|
|
603
653
|
}
|
|
604
|
-
if (
|
|
605
|
-
t.preventDefault(),
|
|
654
|
+
if (o === "HangulMode") {
|
|
655
|
+
t.preventDefault(), E({ ...d.current, composing: !1 }), g();
|
|
606
656
|
return;
|
|
607
657
|
}
|
|
608
|
-
const
|
|
609
|
-
if (
|
|
610
|
-
t.preventDefault(),
|
|
658
|
+
const C = t.ctrlKey || t.metaKey;
|
|
659
|
+
if (C && ["z", "y"].includes(o.toLowerCase())) {
|
|
660
|
+
t.preventDefault(), o.toLowerCase() === "y" || t.shiftKey ? xe() : be();
|
|
611
661
|
return;
|
|
612
662
|
}
|
|
613
|
-
if (
|
|
614
|
-
t.preventDefault(),
|
|
615
|
-
...
|
|
616
|
-
caret:
|
|
663
|
+
if (C && o.toLowerCase() === "a") {
|
|
664
|
+
t.preventDefault(), E({
|
|
665
|
+
...d.current,
|
|
666
|
+
caret: d.current.value.length,
|
|
617
667
|
anchor: 0,
|
|
618
668
|
composing: !1
|
|
619
669
|
});
|
|
620
670
|
return;
|
|
621
671
|
}
|
|
622
|
-
const
|
|
623
|
-
if (
|
|
624
|
-
t.preventDefault(),
|
|
672
|
+
const K = o === "Home" || o === "ArrowUp" || C && o === "ArrowLeft" ? "home" : o === "End" || o === "ArrowDown" || C && o === "ArrowRight" ? "end" : o === "ArrowLeft" ? -1 : o === "ArrowRight" ? 1 : null;
|
|
673
|
+
if (K !== null) {
|
|
674
|
+
t.preventDefault(), E(Fe(d.current, K, t.shiftKey));
|
|
625
675
|
return;
|
|
626
676
|
}
|
|
627
|
-
if (
|
|
628
|
-
|
|
677
|
+
if (o === "Tab" || o === "Enter") {
|
|
678
|
+
o === "Enter" && t.preventDefault(), E({ ...d.current, composing: !1 });
|
|
629
679
|
return;
|
|
630
680
|
}
|
|
631
681
|
if (u) return;
|
|
632
|
-
if (
|
|
633
|
-
t.preventDefault(),
|
|
682
|
+
if (o === "Backspace" || o === "Delete") {
|
|
683
|
+
t.preventDefault(), E(ve(d.current, o === "Backspace" ? -1 : 1));
|
|
634
684
|
return;
|
|
635
685
|
}
|
|
636
|
-
const
|
|
686
|
+
const M = lt(
|
|
637
687
|
t,
|
|
638
|
-
|
|
688
|
+
me(j.mode) ?? J
|
|
639
689
|
);
|
|
640
|
-
|
|
641
|
-
},
|
|
690
|
+
M.handled && M.text && (t.preventDefault(), j.filterKey(M.text) && ce(M.text, M.composing));
|
|
691
|
+
}, pe = S(
|
|
642
692
|
(t) => {
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
"클립보드에 접근할 수 없습니다.
|
|
646
|
-
),
|
|
693
|
+
const o = t instanceof Error ? t : new Error(String(t));
|
|
694
|
+
G.current && (fe(
|
|
695
|
+
"클립보드에 접근할 수 없습니다. 입력란을 길게 눌러 기본 편집 메뉴를 사용해 주세요."
|
|
696
|
+
), f?.(o));
|
|
647
697
|
},
|
|
648
|
-
[
|
|
649
|
-
),
|
|
650
|
-
|
|
651
|
-
t
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
698
|
+
[f]
|
|
699
|
+
), he = S(async () => {
|
|
700
|
+
D();
|
|
701
|
+
const [t, o] = ae(d.current);
|
|
702
|
+
if (t === o) return;
|
|
703
|
+
const C = d.current.value, K = d.current.value.slice(t, o);
|
|
704
|
+
try {
|
|
705
|
+
if (!navigator.clipboard?.writeText)
|
|
706
|
+
throw new Error("Clipboard API unavailable");
|
|
707
|
+
await navigator.clipboard.writeText(K);
|
|
708
|
+
} catch (M) {
|
|
709
|
+
D();
|
|
710
|
+
const _ = A.current, [Ge, Qe] = ae(d.current);
|
|
711
|
+
if (!_ || !G.current || d.current.value !== C || Ge !== t || Qe !== o)
|
|
712
|
+
throw M;
|
|
713
|
+
let ee = document.activeElement;
|
|
714
|
+
const Re = ee?.hasAttribute(
|
|
715
|
+
"data-virtual-keypad"
|
|
716
|
+
);
|
|
717
|
+
if (ee !== _ && !Re) throw M;
|
|
718
|
+
for (; ee?.shadowRoot?.activeElement; )
|
|
719
|
+
ee = ee.shadowRoot.activeElement;
|
|
720
|
+
_.focus({ preventScroll: !0 });
|
|
721
|
+
try {
|
|
722
|
+
if (!document.execCommand?.("copy")) throw M;
|
|
723
|
+
} finally {
|
|
724
|
+
ee instanceof HTMLElement && ee !== _ && Re && ee.focus({ preventScroll: !0 });
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
G.current && fe("복사했어요");
|
|
728
|
+
}, [D]), Pe = S(async () => {
|
|
655
729
|
if (l || u) return;
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
730
|
+
D();
|
|
731
|
+
const t = d.current, o = ne.current;
|
|
732
|
+
t.anchor !== t.caret && (await he(), G.current && k.current && ne.current === o && d.current.value === t.value && E(ve(t, -1)));
|
|
733
|
+
}, [l, u, he, E, D]), De = S(async () => {
|
|
659
734
|
if (l || u) return;
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
735
|
+
D();
|
|
736
|
+
const t = ne.current, o = d.current.value, C = await navigator.clipboard.readText();
|
|
737
|
+
G.current && k.current && ne.current === t && d.current.value === o && ce(C);
|
|
738
|
+
}, [l, u, ce, D]), se = He(
|
|
663
739
|
() => ({
|
|
664
740
|
focus: (t) => {
|
|
665
|
-
l ||
|
|
741
|
+
l || A.current?.focus(t);
|
|
666
742
|
},
|
|
667
743
|
blur: () => {
|
|
668
|
-
|
|
744
|
+
A.current?.blur(), k.current && F(!0);
|
|
669
745
|
},
|
|
670
|
-
getValue: () =>
|
|
671
|
-
setSelectionRange: (t,
|
|
672
|
-
...
|
|
673
|
-
anchor:
|
|
674
|
-
caret:
|
|
746
|
+
getValue: () => d.current.value,
|
|
747
|
+
setSelectionRange: (t, o) => E({
|
|
748
|
+
...d.current,
|
|
749
|
+
anchor: Z(d.current.value, t),
|
|
750
|
+
caret: Z(d.current.value, o),
|
|
675
751
|
composing: !1
|
|
676
752
|
}),
|
|
677
|
-
handleKeyDown: (t) =>
|
|
753
|
+
handleKeyDown: (t) => A.current?.dispatchEvent(
|
|
678
754
|
new KeyboardEvent("keydown", {
|
|
679
755
|
key: t.key,
|
|
680
756
|
shiftKey: t.shiftKey,
|
|
@@ -686,136 +762,91 @@ const kt = We(
|
|
|
686
762
|
cancelable: !0
|
|
687
763
|
})
|
|
688
764
|
),
|
|
689
|
-
insertText: (t,
|
|
690
|
-
|
|
765
|
+
insertText: (t, o) => {
|
|
766
|
+
j.filterKey(t) && ce(t, o);
|
|
691
767
|
},
|
|
692
768
|
scrollIntoView: () => y.current?.scrollIntoView({ block: "nearest", inline: "nearest" }),
|
|
693
|
-
moveCaret:
|
|
694
|
-
undo:
|
|
695
|
-
redo:
|
|
696
|
-
selectAll:
|
|
697
|
-
copySelection: () =>
|
|
698
|
-
pasteClipboard: () =>
|
|
699
|
-
cutSelection: () =>
|
|
769
|
+
moveCaret: Ie,
|
|
770
|
+
undo: be,
|
|
771
|
+
redo: xe,
|
|
772
|
+
selectAll: Ke,
|
|
773
|
+
copySelection: () => he().catch(pe),
|
|
774
|
+
pasteClipboard: () => De().catch(pe),
|
|
775
|
+
cutSelection: () => Pe().catch(pe)
|
|
700
776
|
}),
|
|
701
777
|
[
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
778
|
+
j,
|
|
779
|
+
ce,
|
|
780
|
+
Ie,
|
|
781
|
+
he,
|
|
782
|
+
De,
|
|
706
783
|
Pe,
|
|
707
|
-
Ae,
|
|
708
|
-
ie,
|
|
709
784
|
pe,
|
|
710
|
-
|
|
711
|
-
|
|
785
|
+
be,
|
|
786
|
+
xe,
|
|
787
|
+
Ke,
|
|
712
788
|
l,
|
|
713
|
-
|
|
714
|
-
|
|
789
|
+
F,
|
|
790
|
+
E
|
|
715
791
|
]
|
|
716
792
|
);
|
|
717
|
-
|
|
718
|
-
|
|
793
|
+
nt(Q, () => se, [se]), z(() => {
|
|
794
|
+
h || de(
|
|
719
795
|
(t) => t.composing ? { ...t, composing: !1 } : t
|
|
720
796
|
);
|
|
721
|
-
}, [
|
|
722
|
-
if (!(!
|
|
723
|
-
return
|
|
724
|
-
|
|
797
|
+
}, [h]), z(() => {
|
|
798
|
+
if (!(!h || l || u))
|
|
799
|
+
return X.current = se, () => {
|
|
800
|
+
X.current === se && (X.current = null);
|
|
725
801
|
};
|
|
726
|
-
}, [
|
|
727
|
-
|
|
728
|
-
}, [
|
|
729
|
-
|
|
730
|
-
}), [
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
if (a ? w.onCut?.(t) : w.onCopy?.(t), t.defaultPrevented || l || a && u) return;
|
|
737
|
-
const [E, $] = te(s.current);
|
|
738
|
-
E !== $ && (t.preventDefault(), t.clipboardData.setData(
|
|
802
|
+
}, [h, l, u, se, X]), z(() => {
|
|
803
|
+
h && y.current && (l || u ? F(!0) : te(H, y.current, j));
|
|
804
|
+
}, [h, l, u, H, j, te, F]), z(() => (G.current = !0, () => {
|
|
805
|
+
G.current = !1, k.current && F(!0);
|
|
806
|
+
}), [F]);
|
|
807
|
+
const ze = (t, o) => {
|
|
808
|
+
if (o ? w.onCut?.(t) : w.onCopy?.(t), t.defaultPrevented || l || o && u || t.target !== A.current) return;
|
|
809
|
+
D();
|
|
810
|
+
const [C, K] = ae(d.current);
|
|
811
|
+
C !== K && (t.preventDefault(), t.clipboardData.setData(
|
|
739
812
|
"text/plain",
|
|
740
|
-
|
|
741
|
-
),
|
|
742
|
-
},
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
}, ge = () => {
|
|
752
|
-
y.current?.focus({ preventScroll: !0 }), !u && y.current && X(H, y.current, N);
|
|
753
|
-
}, Xe = (t) => {
|
|
754
|
-
if (w.onPointerDown?.(t), t.defaultPrevented || l || t.button !== 0) return;
|
|
755
|
-
const a = t.pointerType === "mouse";
|
|
756
|
-
if (a || t.preventDefault(), B.current || t.isPrimary === !1) {
|
|
757
|
-
M();
|
|
758
|
-
return;
|
|
759
|
-
}
|
|
760
|
-
const E = ce(t.clientX), $ = t.shiftKey ? s.current.anchor : E;
|
|
761
|
-
B.current = {
|
|
762
|
-
id: t.pointerId,
|
|
763
|
-
x: t.clientX,
|
|
764
|
-
y: t.clientY,
|
|
765
|
-
anchor: $,
|
|
766
|
-
mouse: a,
|
|
767
|
-
held: !1
|
|
768
|
-
}, clearTimeout(Y.current), a ? (ge(), x({ ...s.current, caret: E, anchor: $, composing: !1 }), y.current?.setPointerCapture?.(t.pointerId)) : u || (Y.current = setTimeout(() => {
|
|
769
|
-
if (!B.current) return;
|
|
770
|
-
B.current.held = !0;
|
|
771
|
-
const [J, Ye] = it(
|
|
772
|
-
s.current.value,
|
|
773
|
-
ce(B.current.x, !1)
|
|
774
|
-
);
|
|
775
|
-
ge(), x({ ...s.current, anchor: J, caret: Ye, composing: !1 }), g();
|
|
776
|
-
}, 550));
|
|
777
|
-
}, [Ce, Ie] = te(s.current), Ue = Ee(T), Te = /* @__PURE__ */ C(
|
|
778
|
-
"span",
|
|
779
|
-
{
|
|
780
|
-
ref: z,
|
|
781
|
-
"aria-hidden": "true",
|
|
782
|
-
className: "vk-caret",
|
|
783
|
-
style: {
|
|
784
|
-
display: "inline-block",
|
|
785
|
-
width: 0,
|
|
786
|
-
height: "1.1em",
|
|
787
|
-
verticalAlign: "-0.15em",
|
|
788
|
-
position: "relative"
|
|
813
|
+
d.current.value.slice(C, K)
|
|
814
|
+
), o ? E(ve(d.current, -1)) : fe("복사했어요"));
|
|
815
|
+
}, Be = (t) => {
|
|
816
|
+
if (l || u) return;
|
|
817
|
+
const o = pt(
|
|
818
|
+
d.current,
|
|
819
|
+
t.value,
|
|
820
|
+
{
|
|
821
|
+
start: t.selectionStart ?? t.value.length,
|
|
822
|
+
end: t.selectionEnd ?? t.value.length,
|
|
823
|
+
backward: t.selectionDirection === "backward"
|
|
789
824
|
},
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
825
|
+
j.sanitizeValue,
|
|
826
|
+
j.filterKey,
|
|
827
|
+
V
|
|
828
|
+
);
|
|
829
|
+
t.value = o.value, E({ ...o });
|
|
830
|
+
}, _e = Object.fromEntries(
|
|
831
|
+
Object.entries(w).filter(([t]) => t.startsWith("aria-"))
|
|
832
|
+
), Je = Object.fromEntries(
|
|
833
|
+
Object.entries(w).filter(
|
|
834
|
+
([t]) => !t.startsWith("aria-") && !["id", "tabIndex", "role", "contentEditable", "children"].includes(
|
|
835
|
+
t
|
|
799
836
|
)
|
|
800
|
-
|
|
837
|
+
)
|
|
801
838
|
);
|
|
802
839
|
return /* @__PURE__ */ q(
|
|
803
840
|
"div",
|
|
804
841
|
{
|
|
805
|
-
...
|
|
842
|
+
...Je,
|
|
806
843
|
ref: y,
|
|
807
|
-
id: w.id ?? H,
|
|
808
|
-
role: "textbox",
|
|
809
|
-
tabIndex: l ? -1 : w.tabIndex ?? 0,
|
|
810
|
-
"aria-disabled": l || void 0,
|
|
811
|
-
"aria-readonly": u || void 0,
|
|
812
|
-
"aria-multiline": "false",
|
|
813
|
-
"aria-placeholder": o,
|
|
814
844
|
"data-virtual-input": "true",
|
|
815
|
-
"data-focused":
|
|
816
|
-
"data-value": T,
|
|
845
|
+
"data-focused": h || void 0,
|
|
817
846
|
style: {
|
|
818
|
-
|
|
847
|
+
position: "relative",
|
|
848
|
+
display: "flex",
|
|
849
|
+
alignItems: "center",
|
|
819
850
|
boxSizing: "border-box",
|
|
820
851
|
minHeight: "2.75em",
|
|
821
852
|
padding: "0.65em 0.8em",
|
|
@@ -823,91 +854,89 @@ const kt = We(
|
|
|
823
854
|
borderRadius: 8,
|
|
824
855
|
font: "inherit",
|
|
825
856
|
width: "100%",
|
|
826
|
-
whiteSpace: "pre",
|
|
827
|
-
overflowX: "auto",
|
|
828
|
-
scrollbarWidth: "none",
|
|
829
857
|
cursor: l ? "not-allowed" : "text",
|
|
830
|
-
userSelect: "none",
|
|
831
|
-
WebkitUserSelect: "none",
|
|
832
|
-
WebkitTouchCallout: "none",
|
|
833
|
-
touchAction: "manipulation",
|
|
834
858
|
opacity: l ? 0.5 : 1,
|
|
835
|
-
|
|
859
|
+
colorScheme: ue,
|
|
860
|
+
outline: b ? "2px solid currentColor" : void 0,
|
|
861
|
+
outlineOffset: 2,
|
|
836
862
|
...w.style
|
|
837
863
|
},
|
|
838
864
|
onFocus: (t) => {
|
|
839
|
-
w.onFocus?.(t), !t.defaultPrevented && !l && !u &&
|
|
865
|
+
O(!0), w.onFocus?.(t), !t.defaultPrevented && !l && !u && te(H, t.currentTarget, j);
|
|
840
866
|
},
|
|
841
867
|
onBlur: (t) => {
|
|
842
|
-
w.onBlur?.(t),
|
|
868
|
+
O(!1), w.onBlur?.(t), t.defaultPrevented || F(t);
|
|
843
869
|
},
|
|
844
|
-
onKeyDown:
|
|
845
|
-
onCopy: (t) =>
|
|
846
|
-
onCut: (t) =>
|
|
870
|
+
onKeyDown: Ye,
|
|
871
|
+
onCopy: (t) => ze(t, !1),
|
|
872
|
+
onCut: (t) => ze(t, !0),
|
|
847
873
|
onPaste: (t) => {
|
|
848
|
-
w.onPaste?.(t), !t.defaultPrevented && !l && !u && (t.preventDefault(),
|
|
849
|
-
},
|
|
850
|
-
onPointerDown: Xe,
|
|
851
|
-
onPointerMove: (t) => {
|
|
852
|
-
if (w.onPointerMove?.(t), t.defaultPrevented) {
|
|
853
|
-
M();
|
|
854
|
-
return;
|
|
855
|
-
}
|
|
856
|
-
!B.current || B.current.id !== t.pointerId || Math.hypot(
|
|
857
|
-
t.clientX - B.current.x,
|
|
858
|
-
t.clientY - B.current.y
|
|
859
|
-
) > 8 && (clearTimeout(Y.current), B.current.mouse ? x({
|
|
860
|
-
...s.current,
|
|
861
|
-
caret: ce(t.clientX),
|
|
862
|
-
anchor: B.current.anchor,
|
|
863
|
-
composing: !1
|
|
864
|
-
}) : M());
|
|
865
|
-
},
|
|
866
|
-
onPointerUp: (t) => {
|
|
867
|
-
w.onPointerUp?.(t);
|
|
868
|
-
const a = B.current;
|
|
869
|
-
if (!t.defaultPrevented && a?.id === t.pointerId && !a.mouse && !a.held && Math.hypot(t.clientX - a.x, t.clientY - a.y) <= 8) {
|
|
870
|
-
const E = ce(t.clientX);
|
|
871
|
-
ge(), x({
|
|
872
|
-
...s.current,
|
|
873
|
-
caret: E,
|
|
874
|
-
anchor: E,
|
|
875
|
-
composing: !1
|
|
876
|
-
});
|
|
877
|
-
}
|
|
878
|
-
M();
|
|
879
|
-
},
|
|
880
|
-
onPointerCancel: (t) => {
|
|
881
|
-
w.onPointerCancel?.(t), M();
|
|
882
|
-
},
|
|
883
|
-
onLostPointerCapture: (t) => {
|
|
884
|
-
w.onLostPointerCapture?.(t), B.current?.id === t.pointerId && M();
|
|
885
|
-
},
|
|
886
|
-
onContextMenu: (t) => {
|
|
887
|
-
w.onContextMenu?.(t), t.defaultPrevented || t.preventDefault();
|
|
874
|
+
w.onPaste?.(t), !t.defaultPrevented && !l && !u && (t.preventDefault(), ce(t.clipboardData.getData("text/plain")));
|
|
888
875
|
},
|
|
889
876
|
children: [
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
/* @__PURE__ */ C(
|
|
893
|
-
"span",
|
|
894
|
-
{
|
|
895
|
-
"data-char-index": a,
|
|
896
|
-
style: a >= Ce && a < Ie ? { background: "#bfdbfe", color: "#0f172a" } : void 0,
|
|
897
|
-
children: t
|
|
898
|
-
}
|
|
899
|
-
)
|
|
900
|
-
] }, a)),
|
|
901
|
-
s.current.caret === T.length && Te,
|
|
902
|
-
!T && /* @__PURE__ */ C(
|
|
903
|
-
"span",
|
|
877
|
+
/* @__PURE__ */ T(
|
|
878
|
+
"input",
|
|
904
879
|
{
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
880
|
+
..._e,
|
|
881
|
+
ref: A,
|
|
882
|
+
id: w.id ?? H,
|
|
883
|
+
type: "text",
|
|
884
|
+
role: "textbox",
|
|
885
|
+
inputMode: "none",
|
|
886
|
+
autoComplete: "off",
|
|
887
|
+
autoCorrect: "off",
|
|
888
|
+
autoCapitalize: "off",
|
|
889
|
+
spellCheck: w.spellCheck ?? !1,
|
|
890
|
+
tabIndex: l ? -1 : w.tabIndex ?? 0,
|
|
891
|
+
disabled: l,
|
|
892
|
+
readOnly: u,
|
|
893
|
+
"aria-disabled": l || void 0,
|
|
894
|
+
"aria-readonly": u || void 0,
|
|
895
|
+
"data-virtual-input": "true",
|
|
896
|
+
"data-focused": h || void 0,
|
|
897
|
+
"data-value": W,
|
|
898
|
+
placeholder: a,
|
|
899
|
+
value: Y ?? W,
|
|
900
|
+
style: {
|
|
901
|
+
position: "absolute",
|
|
902
|
+
inset: 0,
|
|
903
|
+
boxSizing: "border-box",
|
|
904
|
+
display: "block",
|
|
905
|
+
width: "100%",
|
|
906
|
+
height: "100%",
|
|
907
|
+
minWidth: 0,
|
|
908
|
+
minHeight: "1.5em",
|
|
909
|
+
margin: 0,
|
|
910
|
+
padding: "inherit",
|
|
911
|
+
border: 0,
|
|
912
|
+
borderRadius: "inherit",
|
|
913
|
+
outline: "none",
|
|
914
|
+
background: "transparent",
|
|
915
|
+
color: "inherit",
|
|
916
|
+
caretColor: "currentColor",
|
|
917
|
+
font: "inherit",
|
|
918
|
+
lineHeight: "inherit",
|
|
919
|
+
letterSpacing: "inherit",
|
|
920
|
+
textAlign: "inherit",
|
|
921
|
+
appearance: "none",
|
|
922
|
+
WebkitAppearance: "none",
|
|
923
|
+
userSelect: "text",
|
|
924
|
+
WebkitUserSelect: "text",
|
|
925
|
+
touchAction: "manipulation"
|
|
926
|
+
},
|
|
927
|
+
onChange: (t) => {
|
|
928
|
+
B.current ? N(t.currentTarget.value) : Be(t.currentTarget);
|
|
929
|
+
},
|
|
930
|
+
onSelect: D,
|
|
931
|
+
onCompositionStart: () => {
|
|
932
|
+
D(), R.current = d.current, B.current = !0, N(A.current?.value ?? d.current.value);
|
|
933
|
+
},
|
|
934
|
+
onCompositionEnd: (t) => {
|
|
935
|
+
B.current = !1, N(null), R.current?.value === d.current.value ? Be(t.currentTarget) : (t.currentTarget.value = d.current.value, E({ ...d.current })), R.current = null;
|
|
936
|
+
}
|
|
908
937
|
}
|
|
909
938
|
),
|
|
910
|
-
/* @__PURE__ */
|
|
939
|
+
/* @__PURE__ */ T(
|
|
911
940
|
"span",
|
|
912
941
|
{
|
|
913
942
|
role: "status",
|
|
@@ -919,14 +948,14 @@ const kt = We(
|
|
|
919
948
|
clipPath: "inset(50%)",
|
|
920
949
|
whiteSpace: "nowrap"
|
|
921
950
|
},
|
|
922
|
-
children:
|
|
951
|
+
children: ye
|
|
923
952
|
}
|
|
924
953
|
)
|
|
925
954
|
]
|
|
926
955
|
}
|
|
927
956
|
);
|
|
928
957
|
}
|
|
929
|
-
),
|
|
958
|
+
), gt = [
|
|
930
959
|
[
|
|
931
960
|
{
|
|
932
961
|
value: "1"
|
|
@@ -1043,97 +1072,97 @@ const kt = We(
|
|
|
1043
1072
|
}
|
|
1044
1073
|
]
|
|
1045
1074
|
];
|
|
1046
|
-
function
|
|
1075
|
+
function vt({
|
|
1047
1076
|
tagName: e,
|
|
1048
|
-
css:
|
|
1049
|
-
children:
|
|
1050
|
-
hostRef:
|
|
1077
|
+
css: n,
|
|
1078
|
+
children: r,
|
|
1079
|
+
hostRef: a,
|
|
1051
1080
|
...i
|
|
1052
1081
|
}) {
|
|
1053
|
-
const [
|
|
1054
|
-
(
|
|
1055
|
-
|
|
1082
|
+
const [s, f] = P(null), v = S(
|
|
1083
|
+
(c) => {
|
|
1084
|
+
a && (a.current = c), c && f(c.shadowRoot ?? c.attachShadow({ mode: "open" }));
|
|
1056
1085
|
},
|
|
1057
|
-
[
|
|
1086
|
+
[a]
|
|
1058
1087
|
);
|
|
1059
|
-
return
|
|
1088
|
+
return at(
|
|
1060
1089
|
e,
|
|
1061
1090
|
{ ...i, ref: v },
|
|
1062
|
-
|
|
1063
|
-
/* @__PURE__ */ q(
|
|
1064
|
-
|
|
1065
|
-
|
|
1091
|
+
s && Te(
|
|
1092
|
+
/* @__PURE__ */ q(Me, { children: [
|
|
1093
|
+
n && /* @__PURE__ */ T("style", { children: n }),
|
|
1094
|
+
r
|
|
1066
1095
|
] }),
|
|
1067
|
-
|
|
1096
|
+
s
|
|
1068
1097
|
)
|
|
1069
1098
|
);
|
|
1070
1099
|
}
|
|
1071
|
-
function
|
|
1100
|
+
function je(e, n, r) {
|
|
1072
1101
|
if (e.type === "action") return e.value === `
|
|
1073
1102
|
` ? "Enter" : e.value;
|
|
1074
1103
|
if (!/^[a-zA-Z]$/.test(e.value)) return e.value;
|
|
1075
|
-
const
|
|
1076
|
-
return
|
|
1104
|
+
const a = r ? e.value.toUpperCase() : e.value;
|
|
1105
|
+
return n ? Ue(a) : a;
|
|
1077
1106
|
}
|
|
1078
|
-
function
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1081
|
-
const i =
|
|
1082
|
-
clearTimeout(i.current),
|
|
1107
|
+
function Ae(e, { disabled: n = !1, repeat: r = !1 } = {}) {
|
|
1108
|
+
const a = I(e);
|
|
1109
|
+
a.current = e;
|
|
1110
|
+
const i = I(void 0), s = I(null), [f, v] = P(!1), c = S(() => {
|
|
1111
|
+
clearTimeout(i.current), s.current = null, v(!1);
|
|
1083
1112
|
}, []);
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
}), [
|
|
1087
|
-
|
|
1088
|
-
}, [
|
|
1089
|
-
const
|
|
1090
|
-
const l =
|
|
1091
|
-
return !!l &&
|
|
1113
|
+
z(() => (window.addEventListener("blur", c), document.addEventListener("visibilitychange", c), () => {
|
|
1114
|
+
c(), window.removeEventListener("blur", c), document.removeEventListener("visibilitychange", c);
|
|
1115
|
+
}), [c]), z(() => {
|
|
1116
|
+
n && c();
|
|
1117
|
+
}, [n, c]);
|
|
1118
|
+
const m = (p) => {
|
|
1119
|
+
const l = s.current?.bounds;
|
|
1120
|
+
return !!l && p.clientX >= l.left && p.clientX <= l.right && p.clientY >= l.top && p.clientY <= l.bottom;
|
|
1092
1121
|
};
|
|
1093
1122
|
return {
|
|
1094
|
-
"data-pressed":
|
|
1095
|
-
onPointerDown: (
|
|
1096
|
-
if (!(
|
|
1097
|
-
|
|
1098
|
-
id:
|
|
1099
|
-
bounds:
|
|
1123
|
+
"data-pressed": f || void 0,
|
|
1124
|
+
onPointerDown: (p) => {
|
|
1125
|
+
if (!(n || p.button !== 0 || s.current)) {
|
|
1126
|
+
p.preventDefault(), s.current = {
|
|
1127
|
+
id: p.pointerId,
|
|
1128
|
+
bounds: p.currentTarget.getBoundingClientRect(),
|
|
1100
1129
|
repeated: !1
|
|
1101
1130
|
}, v(!0);
|
|
1102
1131
|
try {
|
|
1103
|
-
|
|
1132
|
+
p.currentTarget.setPointerCapture?.(p.pointerId);
|
|
1104
1133
|
} catch {
|
|
1105
1134
|
}
|
|
1106
|
-
if (
|
|
1135
|
+
if (r) {
|
|
1107
1136
|
const l = () => {
|
|
1108
|
-
|
|
1137
|
+
s.current && (s.current.repeated = !0, a.current(), i.current = setTimeout(l, 65));
|
|
1109
1138
|
};
|
|
1110
1139
|
i.current = setTimeout(l, 450);
|
|
1111
1140
|
}
|
|
1112
1141
|
}
|
|
1113
1142
|
},
|
|
1114
|
-
onPointerMove: (
|
|
1115
|
-
|
|
1143
|
+
onPointerMove: (p) => {
|
|
1144
|
+
s.current?.id === p.pointerId && !m(p) && c();
|
|
1116
1145
|
},
|
|
1117
|
-
onPointerUp: (
|
|
1118
|
-
if (
|
|
1119
|
-
const l = !
|
|
1120
|
-
|
|
1146
|
+
onPointerUp: (p) => {
|
|
1147
|
+
if (s.current?.id !== p.pointerId) return;
|
|
1148
|
+
const l = !n && m(p) && !s.current.repeated;
|
|
1149
|
+
c(), l && a.current();
|
|
1121
1150
|
},
|
|
1122
|
-
onPointerCancel: (
|
|
1123
|
-
|
|
1151
|
+
onPointerCancel: (p) => {
|
|
1152
|
+
s.current?.id === p.pointerId && c();
|
|
1124
1153
|
},
|
|
1125
|
-
onLostPointerCapture: (
|
|
1126
|
-
|
|
1154
|
+
onLostPointerCapture: (p) => {
|
|
1155
|
+
s.current?.id === p.pointerId && c();
|
|
1127
1156
|
},
|
|
1128
|
-
onPointerLeave: (
|
|
1129
|
-
|
|
1157
|
+
onPointerLeave: (p) => {
|
|
1158
|
+
s.current?.id === p.pointerId && !m(p) && c();
|
|
1130
1159
|
},
|
|
1131
|
-
onClick: (
|
|
1132
|
-
!
|
|
1160
|
+
onClick: (p) => {
|
|
1161
|
+
!n && p.detail === 0 && !s.current && a.current();
|
|
1133
1162
|
}
|
|
1134
1163
|
};
|
|
1135
1164
|
}
|
|
1136
|
-
const
|
|
1165
|
+
const Ce = {
|
|
1137
1166
|
Shift: "Shift",
|
|
1138
1167
|
HangulMode: "한영 전환",
|
|
1139
1168
|
Backspace: "지우기",
|
|
@@ -1152,30 +1181,50 @@ const $e = {
|
|
|
1152
1181
|
Redo: "다시 실행",
|
|
1153
1182
|
SelectAll: "전체 선택"
|
|
1154
1183
|
};
|
|
1155
|
-
function
|
|
1184
|
+
function Ne({
|
|
1156
1185
|
cell: e,
|
|
1157
|
-
label:
|
|
1158
|
-
value:
|
|
1159
|
-
active:
|
|
1186
|
+
label: n,
|
|
1187
|
+
value: r,
|
|
1188
|
+
active: a,
|
|
1160
1189
|
disabled: i,
|
|
1161
|
-
dispatch:
|
|
1190
|
+
dispatch: s
|
|
1162
1191
|
}) {
|
|
1163
|
-
const
|
|
1192
|
+
const f = Ae(s, {
|
|
1164
1193
|
disabled: i,
|
|
1165
|
-
repeat: ["Backspace", "Delete", "ArrowLeft", "ArrowRight"].includes(
|
|
1166
|
-
}), v = e.type === "action" &&
|
|
1167
|
-
return /* @__PURE__ */
|
|
1194
|
+
repeat: ["Backspace", "Delete", "ArrowLeft", "ArrowRight"].includes(r)
|
|
1195
|
+
}), v = e.type === "action" && r === "HangulMode", c = e.type === "action" && (r === "Backspace" && (!e.label || e.label === "⌫") || r === "Delete" && (!e.label || e.label === "⌦"));
|
|
1196
|
+
return /* @__PURE__ */ T(
|
|
1168
1197
|
"button",
|
|
1169
1198
|
{
|
|
1170
1199
|
type: "button",
|
|
1171
1200
|
disabled: i,
|
|
1172
|
-
"aria-label":
|
|
1173
|
-
"aria-pressed":
|
|
1201
|
+
"aria-label": Ce[r] ?? n,
|
|
1202
|
+
"aria-pressed": a,
|
|
1174
1203
|
className: v ? "key action language" : e.type === "action" ? "key action" : "key",
|
|
1175
|
-
title: v ? i ? `${
|
|
1204
|
+
title: v ? i ? `${a ? "한국어" : "영어"} 전용` : `${a ? "영어" : "한국어"}로 전환` : void 0,
|
|
1176
1205
|
style: { flex: e.width && e.width > 0 ? e.width : 1 },
|
|
1177
|
-
...
|
|
1178
|
-
children:
|
|
1206
|
+
...f,
|
|
1207
|
+
children: c ? /* @__PURE__ */ q(
|
|
1208
|
+
"svg",
|
|
1209
|
+
{
|
|
1210
|
+
"data-key-icon": r === "Backspace" ? "backspace" : "delete",
|
|
1211
|
+
"aria-hidden": "true",
|
|
1212
|
+
width: "24",
|
|
1213
|
+
height: "24",
|
|
1214
|
+
viewBox: "0 0 24 24",
|
|
1215
|
+
fill: "none",
|
|
1216
|
+
stroke: "currentColor",
|
|
1217
|
+
strokeWidth: "1.7",
|
|
1218
|
+
strokeLinecap: "round",
|
|
1219
|
+
strokeLinejoin: "round",
|
|
1220
|
+
focusable: "false",
|
|
1221
|
+
style: r === "Delete" ? { transform: "scaleX(-1)" } : void 0,
|
|
1222
|
+
children: [
|
|
1223
|
+
/* @__PURE__ */ T("path", { d: "M9 5H20a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 20 19H9l-7-7 7-7Z" }),
|
|
1224
|
+
/* @__PURE__ */ T("path", { d: "m12 9 6 6m0-6-6 6" })
|
|
1225
|
+
]
|
|
1226
|
+
}
|
|
1227
|
+
) : v && !e.label ? /* @__PURE__ */ q("span", { className: "language-label", "aria-hidden": "true", children: [
|
|
1179
1228
|
/* @__PURE__ */ q(
|
|
1180
1229
|
"svg",
|
|
1181
1230
|
{
|
|
@@ -1189,72 +1238,73 @@ function st({
|
|
|
1189
1238
|
strokeLinejoin: "round",
|
|
1190
1239
|
focusable: "false",
|
|
1191
1240
|
children: [
|
|
1192
|
-
/* @__PURE__ */
|
|
1193
|
-
/* @__PURE__ */
|
|
1194
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ T("circle", { cx: "12", cy: "12", r: "9" }),
|
|
1242
|
+
/* @__PURE__ */ T("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
|
|
1243
|
+
/* @__PURE__ */ T("path", { d: "M3 12h18" })
|
|
1195
1244
|
]
|
|
1196
1245
|
}
|
|
1197
1246
|
),
|
|
1198
|
-
/* @__PURE__ */
|
|
1199
|
-
] }) :
|
|
1247
|
+
/* @__PURE__ */ T("span", { children: a ? "한" : "EN" })
|
|
1248
|
+
] }) : n
|
|
1200
1249
|
}
|
|
1201
1250
|
);
|
|
1202
1251
|
}
|
|
1203
|
-
function
|
|
1252
|
+
function mt({
|
|
1204
1253
|
layout: e,
|
|
1205
|
-
viewport:
|
|
1206
|
-
onHeightChange:
|
|
1254
|
+
viewport: n,
|
|
1255
|
+
onHeightChange: r
|
|
1207
1256
|
}) {
|
|
1208
|
-
const
|
|
1257
|
+
const a = Ze(), {
|
|
1209
1258
|
inputRef: i,
|
|
1210
|
-
hangulMode:
|
|
1211
|
-
shift:
|
|
1259
|
+
hangulMode: s,
|
|
1260
|
+
shift: f,
|
|
1212
1261
|
shiftLocked: v,
|
|
1213
|
-
theme:
|
|
1214
|
-
selectionMode:
|
|
1215
|
-
selectionAdjusting:
|
|
1262
|
+
theme: c,
|
|
1263
|
+
selectionMode: m,
|
|
1264
|
+
selectionAdjusting: p,
|
|
1216
1265
|
activeInputPolicy: l,
|
|
1217
|
-
|
|
1218
|
-
|
|
1266
|
+
editingStatus: u,
|
|
1267
|
+
onBlur: V
|
|
1268
|
+
} = a, w = I(null), [Q, H] = P(!1), le = Ae(() => H((g) => !g)), te = Ae(() => V(!0)), F = ["text", "hangul", "custom"].includes(
|
|
1219
1269
|
l.mode
|
|
1220
|
-
),
|
|
1221
|
-
|
|
1222
|
-
if (!
|
|
1223
|
-
const
|
|
1224
|
-
const
|
|
1225
|
-
|
|
1270
|
+
), oe = Q && F && !m ? gt : e;
|
|
1271
|
+
z(() => {
|
|
1272
|
+
if (!w.current) return;
|
|
1273
|
+
const g = () => {
|
|
1274
|
+
const y = w.current?.getBoundingClientRect().height ?? 0;
|
|
1275
|
+
r(y);
|
|
1226
1276
|
};
|
|
1227
|
-
|
|
1228
|
-
const
|
|
1229
|
-
return
|
|
1230
|
-
}, [
|
|
1231
|
-
let
|
|
1232
|
-
const
|
|
1233
|
-
(
|
|
1234
|
-
),
|
|
1235
|
-
|
|
1236
|
-
},
|
|
1237
|
-
|
|
1238
|
-
},
|
|
1239
|
-
|
|
1240
|
-
},
|
|
1241
|
-
|
|
1242
|
-
},
|
|
1243
|
-
|
|
1244
|
-
},
|
|
1245
|
-
|
|
1277
|
+
g();
|
|
1278
|
+
const L = new ResizeObserver(g);
|
|
1279
|
+
return L.observe(w.current), () => L.disconnect();
|
|
1280
|
+
}, [r]), z(() => {
|
|
1281
|
+
let g = null;
|
|
1282
|
+
const L = /* @__PURE__ */ new Set(), y = (b) => b.composedPath().some(
|
|
1283
|
+
(O) => O === w.current || O instanceof Element && O.hasAttribute("data-virtual-input")
|
|
1284
|
+
), A = (b) => {
|
|
1285
|
+
L.add(b.pointerId), g = L.size !== 1 || b.button !== 0 || y(b) ? null : { x: b.clientX, y: b.clientY, id: b.pointerId };
|
|
1286
|
+
}, x = (b) => {
|
|
1287
|
+
g && g.id === b.pointerId && Math.hypot(b.clientX - g.x, b.clientY - g.y) < 10 && !y(b) && V(!0), g = null, L.delete(b.pointerId);
|
|
1288
|
+
}, B = (b) => {
|
|
1289
|
+
g?.id === b.pointerId && Math.hypot(b.clientX - g.x, b.clientY - g.y) >= 10 && (g = null);
|
|
1290
|
+
}, R = () => {
|
|
1291
|
+
g = null;
|
|
1292
|
+
}, Y = (b) => {
|
|
1293
|
+
R(), L.delete(b.pointerId);
|
|
1294
|
+
}, N = () => {
|
|
1295
|
+
R(), L.clear();
|
|
1246
1296
|
};
|
|
1247
|
-
return window.addEventListener("pointerdown",
|
|
1248
|
-
window.removeEventListener("pointerdown",
|
|
1297
|
+
return window.addEventListener("pointerdown", A, !0), window.addEventListener("pointermove", B, !0), window.addEventListener("pointerup", x, !0), window.addEventListener("pointercancel", Y, !0), window.addEventListener("scroll", R, !0), window.addEventListener("blur", N), document.addEventListener("visibilitychange", N), () => {
|
|
1298
|
+
window.removeEventListener("pointerdown", A, !0), window.removeEventListener("pointermove", B, !0), window.removeEventListener("pointerup", x, !0), window.removeEventListener("pointercancel", Y, !0), window.removeEventListener("scroll", R, !0), window.removeEventListener("blur", N), document.removeEventListener("visibilitychange", N);
|
|
1249
1299
|
};
|
|
1250
|
-
}, [
|
|
1251
|
-
const
|
|
1252
|
-
const
|
|
1253
|
-
if (
|
|
1254
|
-
i.current?.insertText(
|
|
1300
|
+
}, [V]);
|
|
1301
|
+
const X = (g) => {
|
|
1302
|
+
const L = je(g, s, f);
|
|
1303
|
+
if (g.type !== "action") {
|
|
1304
|
+
i.current?.insertText(L, we(L)), a.consumeShift();
|
|
1255
1305
|
return;
|
|
1256
1306
|
}
|
|
1257
|
-
switch (
|
|
1307
|
+
switch (L) {
|
|
1258
1308
|
case "Undo":
|
|
1259
1309
|
i.current?.undo();
|
|
1260
1310
|
break;
|
|
@@ -1265,21 +1315,21 @@ function dt({
|
|
|
1265
1315
|
i.current?.selectAll();
|
|
1266
1316
|
break;
|
|
1267
1317
|
case "Shift":
|
|
1268
|
-
|
|
1318
|
+
a.toggleShift();
|
|
1269
1319
|
break;
|
|
1270
1320
|
case "HangulMode":
|
|
1271
1321
|
i.current?.handleKeyDown(
|
|
1272
|
-
new KeyboardEvent("keydown", { key:
|
|
1322
|
+
new KeyboardEvent("keydown", { key: L })
|
|
1273
1323
|
);
|
|
1274
1324
|
break;
|
|
1275
1325
|
case "EnterSelectionMode":
|
|
1276
|
-
|
|
1326
|
+
H(!1), a.enterSelectionMode();
|
|
1277
1327
|
break;
|
|
1278
1328
|
case "ExitSelectionMode":
|
|
1279
|
-
|
|
1329
|
+
a.exitSelectionMode();
|
|
1280
1330
|
break;
|
|
1281
1331
|
case "ToggleSelectionAdjust":
|
|
1282
|
-
|
|
1332
|
+
a.toggleSelectionAdjust();
|
|
1283
1333
|
break;
|
|
1284
1334
|
case "Copy":
|
|
1285
1335
|
i.current?.copySelection();
|
|
@@ -1291,54 +1341,54 @@ function dt({
|
|
|
1291
1341
|
i.current?.cutSelection();
|
|
1292
1342
|
break;
|
|
1293
1343
|
case "ArrowLeft":
|
|
1294
|
-
i.current?.moveCaret("left",
|
|
1344
|
+
i.current?.moveCaret("left", p);
|
|
1295
1345
|
break;
|
|
1296
1346
|
case "ArrowRight":
|
|
1297
|
-
i.current?.moveCaret("right",
|
|
1347
|
+
i.current?.moveCaret("right", p);
|
|
1298
1348
|
break;
|
|
1299
1349
|
default:
|
|
1300
|
-
|
|
1301
|
-
new KeyboardEvent("keydown", { key:
|
|
1350
|
+
L === " " ? i.current?.insertText(" ") : i.current?.handleKeyDown(
|
|
1351
|
+
new KeyboardEvent("keydown", { key: L })
|
|
1302
1352
|
);
|
|
1303
1353
|
}
|
|
1304
|
-
},
|
|
1354
|
+
}, J = me(l.mode) !== null, ue = {
|
|
1305
1355
|
position: "fixed",
|
|
1306
1356
|
zIndex: 9999,
|
|
1307
1357
|
boxSizing: "border-box",
|
|
1308
1358
|
display: "block",
|
|
1309
|
-
width: Math.min(
|
|
1310
|
-
left:
|
|
1311
|
-
transform:
|
|
1312
|
-
...
|
|
1313
|
-
maxHeight:
|
|
1359
|
+
width: Math.min(n.width || 760, 760),
|
|
1360
|
+
left: n.offsetLeft + n.width / 2,
|
|
1361
|
+
transform: n.height ? "translate(-50%, -100%)" : "translateX(-50%)",
|
|
1362
|
+
...n.height ? { top: n.offsetTop + n.height } : { bottom: 0 },
|
|
1363
|
+
maxHeight: n.height ? n.height * 0.65 : "65dvh",
|
|
1314
1364
|
overflowY: "auto",
|
|
1315
|
-
colorScheme:
|
|
1316
|
-
background:
|
|
1317
|
-
color:
|
|
1318
|
-
border: "1px solid " + (
|
|
1365
|
+
colorScheme: c,
|
|
1366
|
+
background: c === "dark" ? "#18201f" : "#e9eeeb",
|
|
1367
|
+
color: c === "dark" ? "#eef4ef" : "#203b31",
|
|
1368
|
+
border: "1px solid " + (c === "dark" ? "#35413c" : "#c8d3cb"),
|
|
1319
1369
|
borderRadius: "20px 20px 0 0",
|
|
1320
1370
|
boxShadow: "0 -8px 48px #10251a20",
|
|
1321
1371
|
touchAction: "manipulation",
|
|
1322
1372
|
userSelect: "none",
|
|
1323
1373
|
WebkitUserSelect: "none"
|
|
1324
1374
|
};
|
|
1325
|
-
return
|
|
1326
|
-
/* @__PURE__ */
|
|
1327
|
-
|
|
1375
|
+
return Te(
|
|
1376
|
+
/* @__PURE__ */ T(
|
|
1377
|
+
vt,
|
|
1328
1378
|
{
|
|
1329
1379
|
tagName: "virtual-keypad",
|
|
1330
|
-
hostRef:
|
|
1380
|
+
hostRef: w,
|
|
1331
1381
|
"data-virtual-keypad": "true",
|
|
1332
|
-
style:
|
|
1333
|
-
onPointerDown: (
|
|
1334
|
-
|
|
1382
|
+
style: ue,
|
|
1383
|
+
onPointerDown: (g) => {
|
|
1384
|
+
g.button === 0 && g.preventDefault();
|
|
1335
1385
|
},
|
|
1336
|
-
onMouseDown: (
|
|
1337
|
-
|
|
1386
|
+
onMouseDown: (g) => {
|
|
1387
|
+
g.button === 0 && g.preventDefault();
|
|
1338
1388
|
},
|
|
1339
|
-
onBlur:
|
|
1340
|
-
onKeyDown: (
|
|
1341
|
-
|
|
1389
|
+
onBlur: a.onBlur,
|
|
1390
|
+
onKeyDown: (g) => {
|
|
1391
|
+
g.key === "Escape" && (g.preventDefault(), V(!0));
|
|
1342
1392
|
},
|
|
1343
1393
|
css: `
|
|
1344
1394
|
* {
|
|
@@ -1356,6 +1406,8 @@ function dt({
|
|
|
1356
1406
|
justify-content: space-between;
|
|
1357
1407
|
padding: 0 6px 8px;
|
|
1358
1408
|
font-size: 12px;
|
|
1409
|
+
min-height: 52px;
|
|
1410
|
+
gap: 5px;
|
|
1359
1411
|
}
|
|
1360
1412
|
.toolbar span {
|
|
1361
1413
|
opacity: 0.75;
|
|
@@ -1377,13 +1429,16 @@ function dt({
|
|
|
1377
1429
|
margin-top: 7px;
|
|
1378
1430
|
}
|
|
1379
1431
|
.key {
|
|
1432
|
+
display: inline-flex;
|
|
1433
|
+
align-items: center;
|
|
1434
|
+
justify-content: center;
|
|
1380
1435
|
min-width: 0;
|
|
1381
1436
|
min-height: 44px;
|
|
1382
1437
|
border: 0;
|
|
1383
1438
|
border-radius: 8px;
|
|
1384
|
-
background: ${
|
|
1439
|
+
background: ${c === "dark" ? "#303c37" : "#fff"};
|
|
1385
1440
|
color: inherit;
|
|
1386
|
-
box-shadow: 0 2px 0 ${
|
|
1441
|
+
box-shadow: 0 2px 0 ${c === "dark" ? "#0d1611" : "#bdc9c1"};
|
|
1387
1442
|
font: inherit;
|
|
1388
1443
|
padding: 8px 0;
|
|
1389
1444
|
touch-action: none;
|
|
@@ -1391,9 +1446,29 @@ function dt({
|
|
|
1391
1446
|
user-select: none;
|
|
1392
1447
|
}
|
|
1393
1448
|
.action {
|
|
1394
|
-
background: ${
|
|
1449
|
+
background: ${c === "dark" ? "#414e46" : "#d7e1db"};
|
|
1395
1450
|
font-size: 14px;
|
|
1396
1451
|
}
|
|
1452
|
+
.selection-count {
|
|
1453
|
+
min-width: 48px;
|
|
1454
|
+
white-space: nowrap;
|
|
1455
|
+
font-size: 11px;
|
|
1456
|
+
}
|
|
1457
|
+
.selection-actions {
|
|
1458
|
+
display: flex;
|
|
1459
|
+
flex: 1;
|
|
1460
|
+
gap: 5px;
|
|
1461
|
+
}
|
|
1462
|
+
.selection-actions .key {
|
|
1463
|
+
font-size: 12px;
|
|
1464
|
+
box-shadow: none;
|
|
1465
|
+
white-space: nowrap;
|
|
1466
|
+
}
|
|
1467
|
+
.feedback {
|
|
1468
|
+
margin: 0 6px 6px;
|
|
1469
|
+
font-size: 12px;
|
|
1470
|
+
line-height: 1.5;
|
|
1471
|
+
}
|
|
1397
1472
|
.key[aria-pressed="true"]:not(.language) {
|
|
1398
1473
|
background: #246447;
|
|
1399
1474
|
color: #fff;
|
|
@@ -1445,107 +1520,135 @@ function dt({
|
|
|
1445
1520
|
`,
|
|
1446
1521
|
children: /* @__PURE__ */ q("section", { className: "keyboard", role: "group", "aria-label": "가상 키보드", children: [
|
|
1447
1522
|
/* @__PURE__ */ q("div", { className: "toolbar", children: [
|
|
1448
|
-
/* @__PURE__ */ q(
|
|
1449
|
-
|
|
1523
|
+
u.selectionLength > 0 && !m ? /* @__PURE__ */ q(Me, { children: [
|
|
1524
|
+
/* @__PURE__ */ T(
|
|
1525
|
+
"span",
|
|
1526
|
+
{
|
|
1527
|
+
className: "selection-count",
|
|
1528
|
+
title: u.message || void 0,
|
|
1529
|
+
children: u.message === "복사했어요" ? "복사했어요" : `${u.selectionLength}자 선택`
|
|
1530
|
+
}
|
|
1531
|
+
),
|
|
1532
|
+
/* @__PURE__ */ T(
|
|
1533
|
+
"div",
|
|
1534
|
+
{
|
|
1535
|
+
className: "selection-actions",
|
|
1536
|
+
role: "group",
|
|
1537
|
+
"aria-label": "선택한 텍스트 편집",
|
|
1538
|
+
children: ["Copy", "Cut", "SelectAll"].map((g) => /* @__PURE__ */ T(
|
|
1539
|
+
Ne,
|
|
1540
|
+
{
|
|
1541
|
+
cell: { value: g, type: "action" },
|
|
1542
|
+
value: g,
|
|
1543
|
+
label: Ce[g],
|
|
1544
|
+
dispatch: () => X({ value: g, type: "action" })
|
|
1545
|
+
},
|
|
1546
|
+
g
|
|
1547
|
+
))
|
|
1548
|
+
}
|
|
1549
|
+
)
|
|
1550
|
+
] }) : /* @__PURE__ */ q("span", { children: [
|
|
1551
|
+
m ? u.message === "복사했어요" ? "복사했어요" : "텍스트 편집" : Q && F ? "숫자 · 기호" : l.mode === "number" ? "숫자" : l.mode === "tel" ? "전화번호" : s ? "한국어 · 두벌식" : "English",
|
|
1450
1552
|
v ? " · Shift 고정" : ""
|
|
1451
1553
|
] }),
|
|
1452
|
-
|
|
1554
|
+
F && !m && !u.selectionLength && /* @__PURE__ */ T(
|
|
1453
1555
|
"button",
|
|
1454
1556
|
{
|
|
1455
1557
|
type: "button",
|
|
1456
1558
|
className: "close",
|
|
1457
1559
|
"aria-label": "숫자·기호 전환",
|
|
1458
|
-
"aria-pressed":
|
|
1459
|
-
...
|
|
1460
|
-
children:
|
|
1560
|
+
"aria-pressed": Q,
|
|
1561
|
+
...le,
|
|
1562
|
+
children: Q ? "가 / ABC" : "123 / #+="
|
|
1461
1563
|
}
|
|
1462
1564
|
),
|
|
1463
|
-
/* @__PURE__ */
|
|
1565
|
+
/* @__PURE__ */ T(
|
|
1464
1566
|
"button",
|
|
1465
1567
|
{
|
|
1466
1568
|
type: "button",
|
|
1467
1569
|
className: "close",
|
|
1468
|
-
...
|
|
1570
|
+
...te,
|
|
1469
1571
|
"aria-label": "키보드 닫기",
|
|
1470
1572
|
children: "닫기 ↓"
|
|
1471
1573
|
}
|
|
1472
1574
|
)
|
|
1473
1575
|
] }),
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1576
|
+
u.message && u.message !== "복사했어요" && /* @__PURE__ */ T("p", { className: "feedback", children: u.message }),
|
|
1577
|
+
oe.map((g, L) => /* @__PURE__ */ T("div", { className: "row", children: g.map((y, A) => {
|
|
1578
|
+
const x = je(y, s, f), B = y.type === "action" ? y.label ?? Ce[x] ?? x : /^[A-Za-z]$/.test(y.value) ? x : y.label ?? x, R = y.value === "Shift" ? f : y.value === "HangulMode" ? s : y.value === "ToggleSelectionAdjust" ? p : void 0;
|
|
1579
|
+
return /* @__PURE__ */ T(
|
|
1580
|
+
Ne,
|
|
1478
1581
|
{
|
|
1479
|
-
cell:
|
|
1480
|
-
label:
|
|
1481
|
-
value:
|
|
1482
|
-
active:
|
|
1483
|
-
disabled:
|
|
1484
|
-
dispatch: () =>
|
|
1582
|
+
cell: y,
|
|
1583
|
+
label: B,
|
|
1584
|
+
value: x,
|
|
1585
|
+
active: R,
|
|
1586
|
+
disabled: y.value === "HangulMode" && J || ["Copy", "Cut"].includes(x) && !u.selectionLength || x === "SelectAll" && !u.hasValue || (y.type !== "action" || x === " ") && !l.filterKey(x),
|
|
1587
|
+
dispatch: () => X(y)
|
|
1485
1588
|
},
|
|
1486
|
-
`${
|
|
1589
|
+
`${L}-${A}-${y.value}`
|
|
1487
1590
|
);
|
|
1488
|
-
}) },
|
|
1591
|
+
}) }, L))
|
|
1489
1592
|
] })
|
|
1490
1593
|
}
|
|
1491
1594
|
),
|
|
1492
1595
|
document.body
|
|
1493
1596
|
);
|
|
1494
1597
|
}
|
|
1495
|
-
const
|
|
1496
|
-
function
|
|
1497
|
-
const
|
|
1498
|
-
() =>
|
|
1598
|
+
const ke = "virtual-keyboard:storage";
|
|
1599
|
+
function wt(e, n) {
|
|
1600
|
+
const r = I(n), [a, i] = P(n), s = I(a), f = S(
|
|
1601
|
+
() => r.current instanceof Function ? r.current() : r.current,
|
|
1499
1602
|
[]
|
|
1500
1603
|
);
|
|
1501
|
-
|
|
1502
|
-
const
|
|
1604
|
+
z(() => {
|
|
1605
|
+
const c = (u) => {
|
|
1503
1606
|
try {
|
|
1504
|
-
const
|
|
1505
|
-
return typeof
|
|
1607
|
+
const V = u === null ? f() : JSON.parse(u);
|
|
1608
|
+
return typeof V == typeof f() ? V : f();
|
|
1506
1609
|
} catch {
|
|
1507
|
-
return
|
|
1610
|
+
return f();
|
|
1508
1611
|
}
|
|
1509
|
-
},
|
|
1510
|
-
|
|
1612
|
+
}, m = (u) => {
|
|
1613
|
+
s.current = c(u), i(s.current);
|
|
1511
1614
|
};
|
|
1512
1615
|
try {
|
|
1513
|
-
|
|
1616
|
+
m(window.localStorage.getItem(e));
|
|
1514
1617
|
} catch {
|
|
1515
1618
|
}
|
|
1516
|
-
const
|
|
1619
|
+
const p = (u) => {
|
|
1517
1620
|
try {
|
|
1518
1621
|
if (u.storageArea && u.storageArea !== window.localStorage)
|
|
1519
1622
|
return;
|
|
1520
1623
|
} catch {
|
|
1521
1624
|
return;
|
|
1522
1625
|
}
|
|
1523
|
-
(u.key === e || u.key === null) &&
|
|
1626
|
+
(u.key === e || u.key === null) && m(u.newValue);
|
|
1524
1627
|
}, l = (u) => {
|
|
1525
|
-
const
|
|
1526
|
-
|
|
1628
|
+
const V = u.detail;
|
|
1629
|
+
V.key === e && m(V.raw);
|
|
1527
1630
|
};
|
|
1528
|
-
return window.addEventListener("storage",
|
|
1529
|
-
window.removeEventListener("storage",
|
|
1631
|
+
return window.addEventListener("storage", p), window.addEventListener(ke, l), () => {
|
|
1632
|
+
window.removeEventListener("storage", p), window.removeEventListener(ke, l);
|
|
1530
1633
|
};
|
|
1531
|
-
}, [e,
|
|
1532
|
-
const v =
|
|
1533
|
-
(
|
|
1534
|
-
|
|
1535
|
-
new CustomEvent(
|
|
1536
|
-
detail: { key: e, raw: JSON.stringify(
|
|
1634
|
+
}, [e, f]);
|
|
1635
|
+
const v = S(
|
|
1636
|
+
(c) => {
|
|
1637
|
+
s.current = c instanceof Function ? c(s.current) : c, i(s.current), window.dispatchEvent(
|
|
1638
|
+
new CustomEvent(ke, {
|
|
1639
|
+
detail: { key: e, raw: JSON.stringify(s.current) }
|
|
1537
1640
|
})
|
|
1538
1641
|
);
|
|
1539
1642
|
try {
|
|
1540
|
-
window.localStorage.setItem(e, JSON.stringify(
|
|
1643
|
+
window.localStorage.setItem(e, JSON.stringify(s.current));
|
|
1541
1644
|
} catch {
|
|
1542
1645
|
}
|
|
1543
1646
|
},
|
|
1544
1647
|
[e]
|
|
1545
1648
|
);
|
|
1546
|
-
return [
|
|
1649
|
+
return [a, v];
|
|
1547
1650
|
}
|
|
1548
|
-
const
|
|
1651
|
+
const yt = [
|
|
1549
1652
|
[
|
|
1550
1653
|
{
|
|
1551
1654
|
label: "전체 선택",
|
|
@@ -1625,7 +1728,7 @@ const pt = [
|
|
|
1625
1728
|
type: "action"
|
|
1626
1729
|
}
|
|
1627
1730
|
]
|
|
1628
|
-
],
|
|
1731
|
+
], bt = () => typeof window > "u" ? { width: 0, height: 0, scale: 1, offsetLeft: 0, offsetTop: 0 } : typeof window < "u" && window.visualViewport ? {
|
|
1629
1732
|
width: window.visualViewport.width,
|
|
1630
1733
|
height: window.visualViewport.height,
|
|
1631
1734
|
scale: window.visualViewport.scale,
|
|
@@ -1637,185 +1740,196 @@ const pt = [
|
|
|
1637
1740
|
scale: 1,
|
|
1638
1741
|
offsetLeft: 0,
|
|
1639
1742
|
offsetTop: 0
|
|
1640
|
-
},
|
|
1641
|
-
const [e,
|
|
1743
|
+
}, xt = (e, n) => e.width === n.width && e.height === n.height && e.scale === n.scale && e.offsetLeft === n.offsetLeft && e.offsetTop === n.offsetTop, kt = () => {
|
|
1744
|
+
const [e, n] = P(() => ({
|
|
1642
1745
|
width: 0,
|
|
1643
1746
|
height: 0,
|
|
1644
1747
|
scale: 1,
|
|
1645
1748
|
offsetLeft: 0,
|
|
1646
1749
|
offsetTop: 0
|
|
1647
1750
|
}));
|
|
1648
|
-
return
|
|
1751
|
+
return z(() => {
|
|
1649
1752
|
if (typeof window > "u") return;
|
|
1650
|
-
let
|
|
1651
|
-
const
|
|
1652
|
-
const
|
|
1653
|
-
|
|
1654
|
-
(
|
|
1753
|
+
let r = null;
|
|
1754
|
+
const a = () => {
|
|
1755
|
+
const s = bt();
|
|
1756
|
+
n(
|
|
1757
|
+
(f) => xt(f, s) ? f : s
|
|
1655
1758
|
);
|
|
1656
1759
|
};
|
|
1657
|
-
|
|
1760
|
+
a();
|
|
1658
1761
|
const i = () => {
|
|
1659
|
-
|
|
1762
|
+
r !== null && cancelAnimationFrame(r), r = requestAnimationFrame(a);
|
|
1660
1763
|
};
|
|
1661
1764
|
return window.visualViewport ? (window.visualViewport.addEventListener("resize", i, {
|
|
1662
1765
|
passive: !0
|
|
1663
1766
|
}), window.visualViewport.addEventListener("scroll", i, {
|
|
1664
1767
|
passive: !0
|
|
1665
1768
|
})) : window.addEventListener("resize", i, { passive: !0 }), () => {
|
|
1666
|
-
|
|
1769
|
+
r !== null && cancelAnimationFrame(r), window.visualViewport ? (window.visualViewport.removeEventListener("resize", i), window.visualViewport.removeEventListener("scroll", i)) : window.removeEventListener("resize", i);
|
|
1667
1770
|
};
|
|
1668
1771
|
}, []), e;
|
|
1669
1772
|
};
|
|
1670
|
-
function
|
|
1671
|
-
const [e,
|
|
1672
|
-
return
|
|
1773
|
+
function Et() {
|
|
1774
|
+
const [e, n] = P("light");
|
|
1775
|
+
return z(() => {
|
|
1673
1776
|
if (typeof window > "u" || !window.matchMedia) return;
|
|
1674
|
-
const
|
|
1675
|
-
r
|
|
1676
|
-
const
|
|
1677
|
-
|
|
1777
|
+
const r = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1778
|
+
n(r.matches ? "dark" : "light");
|
|
1779
|
+
const a = (i) => {
|
|
1780
|
+
n(i.matches ? "dark" : "light");
|
|
1678
1781
|
};
|
|
1679
|
-
return
|
|
1782
|
+
return r.addEventListener("change", a), () => r.removeEventListener("change", a);
|
|
1680
1783
|
}, []), e;
|
|
1681
1784
|
}
|
|
1682
|
-
function
|
|
1785
|
+
function Xe(e) {
|
|
1683
1786
|
return e !== void 0 ? /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
1684
1787
|
e
|
|
1685
|
-
) : typeof navigator > "u" ? !1 :
|
|
1788
|
+
) : typeof navigator > "u" ? !1 : Xe(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 || typeof window < "u" && !!window.matchMedia?.("(pointer: coarse)").matches;
|
|
1686
1789
|
}
|
|
1687
|
-
const
|
|
1688
|
-
function
|
|
1790
|
+
const Ee = "virtual-keyboard:focus-change";
|
|
1791
|
+
function Tt({
|
|
1689
1792
|
children: e,
|
|
1690
|
-
layout:
|
|
1691
|
-
defaultHangulMode:
|
|
1692
|
-
theme:
|
|
1793
|
+
layout: n = re,
|
|
1794
|
+
defaultHangulMode: r = !0,
|
|
1795
|
+
theme: a,
|
|
1693
1796
|
keyboardVisibility: i = "auto"
|
|
1694
1797
|
}) {
|
|
1695
|
-
const
|
|
1798
|
+
const s = $e(), f = I(null), v = I(null), c = I(
|
|
1696
1799
|
void 0
|
|
1697
|
-
), [
|
|
1800
|
+
), [m, p] = P(), [l, u] = P(0), [V, w] = P(!1), [Q, H] = P(!1), [le, te] = P({
|
|
1801
|
+
selectionLength: 0,
|
|
1802
|
+
hasValue: !1,
|
|
1803
|
+
message: ""
|
|
1804
|
+
}), F = S((h) => {
|
|
1805
|
+
te(
|
|
1806
|
+
(k) => k.selectionLength === h.selectionLength && k.hasValue === h.hasValue && k.message === h.message ? k : h
|
|
1807
|
+
);
|
|
1808
|
+
}, []), [oe, X] = wt(
|
|
1698
1809
|
"virtual-keyboard-hangul-mode",
|
|
1699
|
-
|
|
1700
|
-
), [
|
|
1701
|
-
() =>
|
|
1702
|
-
), [
|
|
1703
|
-
|
|
1704
|
-
const
|
|
1705
|
-
|
|
1706
|
-
const
|
|
1707
|
-
return
|
|
1810
|
+
r
|
|
1811
|
+
), [J, ue] = P(
|
|
1812
|
+
() => Se({ layout: n })
|
|
1813
|
+
), [g, L] = P(!1), [y, A] = P(0), x = kt(), B = Et(), R = me(J.mode) ?? oe, Y = !!m && (i === "always" || i === "auto" && g), N = I(Y);
|
|
1814
|
+
N.current = Y, z(() => {
|
|
1815
|
+
const h = () => L(Xe());
|
|
1816
|
+
h();
|
|
1817
|
+
const k = window.matchMedia?.("(pointer: coarse)");
|
|
1818
|
+
return k?.addEventListener("change", h), () => k?.removeEventListener("change", h);
|
|
1708
1819
|
}, []);
|
|
1709
|
-
const
|
|
1710
|
-
clearTimeout(
|
|
1820
|
+
const b = S(() => {
|
|
1821
|
+
clearTimeout(c.current), v.current = null, f.current = null, p(void 0), u(0), w(!1), H(!1);
|
|
1711
1822
|
}, []);
|
|
1712
|
-
|
|
1713
|
-
const
|
|
1714
|
-
|
|
1823
|
+
z(() => {
|
|
1824
|
+
const h = (k) => {
|
|
1825
|
+
k.detail !== s && b();
|
|
1715
1826
|
};
|
|
1716
|
-
return window.addEventListener(
|
|
1717
|
-
window.removeEventListener(
|
|
1827
|
+
return window.addEventListener(Ee, h), () => {
|
|
1828
|
+
window.removeEventListener(Ee, h), clearTimeout(c.current);
|
|
1718
1829
|
};
|
|
1719
|
-
}, [
|
|
1720
|
-
const
|
|
1721
|
-
(
|
|
1722
|
-
clearTimeout(
|
|
1723
|
-
new CustomEvent(
|
|
1830
|
+
}, [s, b]);
|
|
1831
|
+
const O = S(
|
|
1832
|
+
(h, k, $) => {
|
|
1833
|
+
clearTimeout(c.current), v.current !== k && (u(0), w(!1), H(!1)), v.current = k, ue(Se($)), p(h), window.dispatchEvent(
|
|
1834
|
+
new CustomEvent(Ee, { detail: s })
|
|
1724
1835
|
);
|
|
1725
1836
|
},
|
|
1726
|
-
[
|
|
1727
|
-
),
|
|
1728
|
-
(
|
|
1729
|
-
if (
|
|
1730
|
-
|
|
1837
|
+
[s]
|
|
1838
|
+
), U = S(
|
|
1839
|
+
(h) => {
|
|
1840
|
+
if (h === !0) {
|
|
1841
|
+
const $ = document.activeElement, j = $ instanceof HTMLElement && v.current?.contains($);
|
|
1842
|
+
b(), j && $.blur();
|
|
1731
1843
|
return;
|
|
1732
1844
|
}
|
|
1733
|
-
const
|
|
1734
|
-
|
|
1845
|
+
const k = typeof h == "object" ? h.relatedTarget : null;
|
|
1846
|
+
k?.closest?.("[data-virtual-input], [data-virtual-keypad]") || !k && N.current || (clearTimeout(c.current), c.current = setTimeout(b, 0));
|
|
1735
1847
|
},
|
|
1736
|
-
[
|
|
1848
|
+
[b]
|
|
1737
1849
|
);
|
|
1738
|
-
|
|
1739
|
-
if (!
|
|
1740
|
-
const
|
|
1741
|
-
const
|
|
1742
|
-
if (!
|
|
1743
|
-
const
|
|
1744
|
-
|
|
1850
|
+
z(() => {
|
|
1851
|
+
if (!Y || !y || x.scale !== 1) return;
|
|
1852
|
+
const h = requestAnimationFrame(() => {
|
|
1853
|
+
const k = v.current?.getBoundingClientRect();
|
|
1854
|
+
if (!k) return;
|
|
1855
|
+
const $ = x.offsetTop + x.height - y - 16;
|
|
1856
|
+
k.bottom > $ && window.scrollBy({ top: k.bottom - $, behavior: "instant" });
|
|
1745
1857
|
});
|
|
1746
|
-
return () => cancelAnimationFrame(
|
|
1858
|
+
return () => cancelAnimationFrame(h);
|
|
1747
1859
|
}, [
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1860
|
+
m,
|
|
1861
|
+
Y,
|
|
1862
|
+
y,
|
|
1863
|
+
x.height,
|
|
1864
|
+
x.offsetTop,
|
|
1865
|
+
x.scale
|
|
1754
1866
|
]);
|
|
1755
|
-
const
|
|
1756
|
-
|
|
1757
|
-
}, [
|
|
1758
|
-
() => u((
|
|
1867
|
+
const de = S(() => {
|
|
1868
|
+
me(J.mode) === null && X((h) => !h);
|
|
1869
|
+
}, [J.mode, X]), W = S(
|
|
1870
|
+
() => u((h) => (h + 1) % 3),
|
|
1759
1871
|
[]
|
|
1760
|
-
),
|
|
1761
|
-
() => u((
|
|
1872
|
+
), d = S(
|
|
1873
|
+
() => u((h) => h === 1 ? 0 : h),
|
|
1762
1874
|
[]
|
|
1763
|
-
),
|
|
1875
|
+
), ne = S(() => {
|
|
1764
1876
|
w(!0), H(!1);
|
|
1765
|
-
}, []),
|
|
1877
|
+
}, []), ie = S(() => {
|
|
1766
1878
|
w(!1), H(!1);
|
|
1767
|
-
}, []),
|
|
1768
|
-
() => H((
|
|
1879
|
+
}, []), G = S(
|
|
1880
|
+
() => H((h) => !h),
|
|
1769
1881
|
[]
|
|
1770
1882
|
);
|
|
1771
1883
|
return /* @__PURE__ */ q(
|
|
1772
|
-
|
|
1884
|
+
We.Provider,
|
|
1773
1885
|
{
|
|
1774
1886
|
value: {
|
|
1775
|
-
inputRef:
|
|
1776
|
-
focusId:
|
|
1777
|
-
onFocus:
|
|
1778
|
-
onBlur:
|
|
1779
|
-
defaultLayout:
|
|
1780
|
-
hangulMode:
|
|
1887
|
+
inputRef: f,
|
|
1888
|
+
focusId: m,
|
|
1889
|
+
onFocus: O,
|
|
1890
|
+
onBlur: U,
|
|
1891
|
+
defaultLayout: n,
|
|
1892
|
+
hangulMode: R,
|
|
1781
1893
|
shift: l > 0,
|
|
1782
1894
|
shiftLocked: l === 2,
|
|
1783
|
-
theme:
|
|
1784
|
-
toggleKorean:
|
|
1895
|
+
theme: a ?? B,
|
|
1896
|
+
toggleKorean: de,
|
|
1785
1897
|
toggleShift: W,
|
|
1786
|
-
consumeShift:
|
|
1787
|
-
selectionMode:
|
|
1898
|
+
consumeShift: d,
|
|
1899
|
+
selectionMode: V,
|
|
1788
1900
|
selectionAdjusting: Q,
|
|
1789
|
-
enterSelectionMode:
|
|
1790
|
-
exitSelectionMode:
|
|
1791
|
-
toggleSelectionAdjust:
|
|
1792
|
-
activeInputPolicy:
|
|
1901
|
+
enterSelectionMode: ne,
|
|
1902
|
+
exitSelectionMode: ie,
|
|
1903
|
+
toggleSelectionAdjust: G,
|
|
1904
|
+
activeInputPolicy: J,
|
|
1905
|
+
editingStatus: le,
|
|
1906
|
+
setEditingStatus: F
|
|
1793
1907
|
},
|
|
1794
1908
|
children: [
|
|
1795
1909
|
e,
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
/* @__PURE__ */
|
|
1910
|
+
Y && /* @__PURE__ */ q(Me, { children: [
|
|
1911
|
+
Te(
|
|
1912
|
+
/* @__PURE__ */ T(
|
|
1799
1913
|
"div",
|
|
1800
1914
|
{
|
|
1801
1915
|
"aria-hidden": "true",
|
|
1802
1916
|
style: {
|
|
1803
|
-
height:
|
|
1917
|
+
height: y,
|
|
1804
1918
|
pointerEvents: "none",
|
|
1805
|
-
background: (
|
|
1919
|
+
background: (a ?? B) === "dark" ? "#121c17" : "#f7f8f4"
|
|
1806
1920
|
}
|
|
1807
1921
|
}
|
|
1808
1922
|
),
|
|
1809
1923
|
document.body
|
|
1810
1924
|
),
|
|
1811
|
-
/* @__PURE__ */
|
|
1812
|
-
|
|
1925
|
+
/* @__PURE__ */ T(
|
|
1926
|
+
mt,
|
|
1813
1927
|
{
|
|
1814
|
-
layout:
|
|
1815
|
-
viewport:
|
|
1816
|
-
onHeightChange:
|
|
1928
|
+
layout: V ? yt : J.layout,
|
|
1929
|
+
viewport: x,
|
|
1930
|
+
onHeightChange: A
|
|
1817
1931
|
},
|
|
1818
|
-
|
|
1932
|
+
m
|
|
1819
1933
|
)
|
|
1820
1934
|
] })
|
|
1821
1935
|
]
|
|
@@ -1823,6 +1937,6 @@ function Et({
|
|
|
1823
1937
|
);
|
|
1824
1938
|
}
|
|
1825
1939
|
export {
|
|
1826
|
-
|
|
1827
|
-
|
|
1940
|
+
Mt as VirtualInput,
|
|
1941
|
+
Tt as VirtualInputProvider
|
|
1828
1942
|
};
|