@uiwwsw/virtual-keyboard 2.0.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { convertQwertyToHangul as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
class
|
|
2
|
+
import { jsxs as X, jsx as P, Fragment as De } from "react/jsx-runtime";
|
|
3
|
+
import { useContext as it, createContext as ct, forwardRef as lt, useId as Je, useRef as M, useState as z, useMemo as Xe, useCallback as L, useEffect as D, useImperativeHandle as ut, useLayoutEffect as st, createElement as dt } from "react";
|
|
4
|
+
import { convertQwertyToHangul as Ge, assemble as ft, removeLastCharacter as pt } from "es-hangul";
|
|
5
|
+
import { createPortal as Be } from "react-dom";
|
|
6
|
+
class ht {
|
|
7
7
|
past = [];
|
|
8
8
|
future = [];
|
|
9
9
|
record(n, r) {
|
|
@@ -21,26 +21,26 @@ class ut {
|
|
|
21
21
|
this.past = [], this.future = [];
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
function
|
|
26
|
-
const e =
|
|
24
|
+
const Qe = ct(null);
|
|
25
|
+
function Oe() {
|
|
26
|
+
const e = it(Qe);
|
|
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 xe(e) {
|
|
34
34
|
return /^[\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF]$/.test(e);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function gt(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 r = n && /^[A-Za-z]$/.test(e.key) ?
|
|
41
|
-
return { handled: !0, text: r, composing:
|
|
40
|
+
const r = n && /^[A-Za-z]$/.test(e.key) ? Ge(e.key) : e.key;
|
|
41
|
+
return { handled: !0, text: r, composing: xe(r) };
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const oe = [
|
|
44
44
|
[
|
|
45
45
|
{
|
|
46
46
|
label: "q",
|
|
@@ -211,7 +211,7 @@ const ee = [
|
|
|
211
211
|
width: 1.25
|
|
212
212
|
}
|
|
213
213
|
]
|
|
214
|
-
],
|
|
214
|
+
], vt = [
|
|
215
215
|
[
|
|
216
216
|
{
|
|
217
217
|
label: "1",
|
|
@@ -280,7 +280,7 @@ const ee = [
|
|
|
280
280
|
type: "action"
|
|
281
281
|
}
|
|
282
282
|
]
|
|
283
|
-
],
|
|
283
|
+
], mt = [
|
|
284
284
|
[
|
|
285
285
|
{
|
|
286
286
|
label: "1",
|
|
@@ -363,7 +363,7 @@ const ee = [
|
|
|
363
363
|
}
|
|
364
364
|
]
|
|
365
365
|
];
|
|
366
|
-
function
|
|
366
|
+
function be(e) {
|
|
367
367
|
switch (e) {
|
|
368
368
|
case "hangul":
|
|
369
369
|
return !0;
|
|
@@ -376,34 +376,34 @@ function ge(e) {
|
|
|
376
376
|
return null;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
const
|
|
379
|
+
const we = () => !0, wt = {
|
|
380
380
|
text: {
|
|
381
381
|
mode: "text",
|
|
382
|
-
layout:
|
|
383
|
-
filterKey:
|
|
382
|
+
layout: oe,
|
|
383
|
+
filterKey: we,
|
|
384
384
|
sanitizeValue: (e) => e.replace(/[\r\n\t]+/g, " ")
|
|
385
385
|
},
|
|
386
386
|
number: {
|
|
387
387
|
mode: "number",
|
|
388
|
-
layout:
|
|
388
|
+
layout: vt,
|
|
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: mt,
|
|
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: oe,
|
|
401
|
+
filterKey: we,
|
|
402
402
|
sanitizeValue: (e) => e.replace(/[A-Za-z]/g, "")
|
|
403
403
|
},
|
|
404
404
|
alpha: {
|
|
405
405
|
mode: "alpha",
|
|
406
|
-
layout:
|
|
406
|
+
layout: oe,
|
|
407
407
|
filterKey: (e) => /^[A-Za-z]+$/.test(e),
|
|
408
408
|
sanitizeValue: (e) => e.replace(/[^A-Za-z]/g, "")
|
|
409
409
|
},
|
|
@@ -411,82 +411,74 @@ const he = () => !0, pt = {
|
|
|
411
411
|
mode: "alphanumeric",
|
|
412
412
|
layout: [
|
|
413
413
|
Array.from("1234567890", (e) => ({ value: e })),
|
|
414
|
-
...
|
|
414
|
+
...oe
|
|
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: oe,
|
|
422
|
+
filterKey: we,
|
|
423
423
|
sanitizeValue: (e) => e.replace(/[\r\n\t]+/g, " ")
|
|
424
424
|
}
|
|
425
425
|
};
|
|
426
|
-
function
|
|
427
|
-
const n = e?.mode ?? "text", r =
|
|
426
|
+
function Te(e) {
|
|
427
|
+
const n = e?.mode ?? "text", r = wt[n];
|
|
428
428
|
return {
|
|
429
429
|
mode: n,
|
|
430
|
-
layout: e?.layout ?? r.layout ??
|
|
431
|
-
filterKey: e?.filterKey ?? r.filterKey ??
|
|
432
|
-
sanitizeValue: e?.sanitizeValue ?? r.sanitizeValue ?? ((
|
|
430
|
+
layout: e?.layout ?? r.layout ?? oe,
|
|
431
|
+
filterKey: e?.filterKey ?? r.filterKey ?? we,
|
|
432
|
+
sanitizeValue: e?.sanitizeValue ?? r.sanitizeValue ?? ((i) => i)
|
|
433
433
|
};
|
|
434
434
|
}
|
|
435
|
-
const
|
|
436
|
-
function
|
|
437
|
-
const r = Math.max(0, Math.min(n, e.length - 1));
|
|
438
|
-
for (const a of gt.segment(e))
|
|
439
|
-
if (r < a.index + a.segment.length)
|
|
440
|
-
return [a.index, a.index + a.segment.length];
|
|
441
|
-
return [0, 0];
|
|
442
|
-
}
|
|
443
|
-
const me = (e) => Array.from(ht.segment(e));
|
|
444
|
-
function oe(e, n) {
|
|
435
|
+
const yt = new Intl.Segmenter(void 0, { granularity: "grapheme" }), Re = (e) => Array.from(yt.segment(e));
|
|
436
|
+
function Z(e, n) {
|
|
445
437
|
return [
|
|
446
|
-
...
|
|
438
|
+
...Re(e).map((i) => i.index),
|
|
447
439
|
e.length
|
|
448
|
-
].filter((
|
|
440
|
+
].filter((i) => i <= Math.max(0, n)).at(-1) ?? 0;
|
|
449
441
|
}
|
|
450
|
-
function
|
|
451
|
-
const
|
|
452
|
-
...
|
|
442
|
+
function Ve(e, n, r) {
|
|
443
|
+
const i = [
|
|
444
|
+
...Re(e).map((l) => l.index),
|
|
453
445
|
e.length
|
|
454
446
|
];
|
|
455
|
-
return r < 0 ?
|
|
447
|
+
return r < 0 ? i.filter((l) => l < n).at(-1) ?? 0 : i.find((l) => l > n) ?? e.length;
|
|
456
448
|
}
|
|
457
|
-
const
|
|
458
|
-
function
|
|
459
|
-
const [
|
|
460
|
-
let
|
|
461
|
-
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
464
|
-
const
|
|
465
|
-
return { value:
|
|
449
|
+
const ie = ({ anchor: e, caret: n }) => [Math.min(e, n), Math.max(e, n)];
|
|
450
|
+
function Ke(e, n, r = !1, i) {
|
|
451
|
+
const [l, s] = ie(e);
|
|
452
|
+
let f = e.value.slice(0, l), m = n;
|
|
453
|
+
l === s && e.composing && r && xe(f.at(-1) ?? "") && (m = ft([f.at(-1), n]), f = f.slice(0, -1));
|
|
454
|
+
const u = f + m + e.value.slice(s);
|
|
455
|
+
if (i !== void 0 && u.length > i) return e;
|
|
456
|
+
const w = f.length + m.length;
|
|
457
|
+
return { value: u, caret: w, anchor: w, composing: r };
|
|
466
458
|
}
|
|
467
|
-
function
|
|
468
|
-
let [r,
|
|
469
|
-
if (r ===
|
|
470
|
-
if (n < 0 && e.composing &&
|
|
471
|
-
const
|
|
459
|
+
function ye(e, n) {
|
|
460
|
+
let [r, i] = ie(e);
|
|
461
|
+
if (r === i) {
|
|
462
|
+
if (n < 0 && e.composing && xe(e.value[r - 1] ?? "")) {
|
|
463
|
+
const l = e.value.slice(0, r - 1) + pt(e.value[r - 1]);
|
|
472
464
|
return {
|
|
473
|
-
value:
|
|
474
|
-
anchor:
|
|
475
|
-
caret:
|
|
465
|
+
value: l + e.value.slice(i),
|
|
466
|
+
anchor: l.length,
|
|
467
|
+
caret: l.length,
|
|
476
468
|
composing: !0
|
|
477
469
|
};
|
|
478
470
|
}
|
|
479
|
-
n < 0 ? r =
|
|
471
|
+
n < 0 ? r = Ve(e.value, r, -1) : i = Ve(e.value, i, 1);
|
|
480
472
|
}
|
|
481
473
|
return {
|
|
482
|
-
value: e.value.slice(0, r) + e.value.slice(
|
|
474
|
+
value: e.value.slice(0, r) + e.value.slice(i),
|
|
483
475
|
caret: r,
|
|
484
476
|
anchor: r,
|
|
485
477
|
composing: !1
|
|
486
478
|
};
|
|
487
479
|
}
|
|
488
|
-
function
|
|
489
|
-
const [
|
|
480
|
+
function Ye(e, n, r = !1) {
|
|
481
|
+
const [i, l] = ie(e), s = n === "home" ? 0 : n === "end" ? e.value.length : !r && i !== l ? n < 0 ? i : l : Ve(e.value, e.caret, n);
|
|
490
482
|
return {
|
|
491
483
|
...e,
|
|
492
484
|
caret: s,
|
|
@@ -494,279 +486,336 @@ function je(e, n, r = !1) {
|
|
|
494
486
|
composing: !1
|
|
495
487
|
};
|
|
496
488
|
}
|
|
497
|
-
function
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
489
|
+
function bt(e, n, r, i, l, 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 m = e.value.length, u = n.length;
|
|
499
|
+
for (; m > f && u > f && e.value[m - 1] === n[u - 1]; )
|
|
500
|
+
m--, u--;
|
|
501
|
+
for (; Z(e.value, m) !== m || Z(n, u) !== u; )
|
|
502
|
+
m < e.value.length && m++, u < n.length && u++;
|
|
503
|
+
const w = n.slice(f, u), p = i(w).replace(/[\r\n\t]+/g, " ");
|
|
504
|
+
if (w && (!p || !l(p))) return e;
|
|
505
|
+
const c = { ...e, anchor: f, caret: m, composing: !1 }, a = w ? Ke(c, p, !1, s) : ye(c, -1);
|
|
506
|
+
if (a === c) return e;
|
|
507
|
+
const x = (y) => Z(
|
|
508
|
+
a.value,
|
|
509
|
+
y <= f ? y : y >= u ? y + p.length - w.length : f + i(w.slice(0, y - f)).replace(/[\r\n\t]+/g, " ").length
|
|
510
|
+
);
|
|
508
511
|
return {
|
|
509
|
-
|
|
510
|
-
|
|
512
|
+
...a,
|
|
513
|
+
anchor: x(r.backward ? r.end : r.start),
|
|
514
|
+
caret: x(r.backward ? r.start : r.end)
|
|
511
515
|
};
|
|
512
516
|
}
|
|
513
|
-
|
|
514
|
-
const a = e.ownerDocument.getSelection();
|
|
515
|
-
if (!a) return;
|
|
516
|
-
const i = Ae(e);
|
|
517
|
-
if (i?.anchor === n && i.caret === r) return;
|
|
518
|
-
const s = (p) => {
|
|
519
|
-
const l = e.ownerDocument.createTreeWalker(
|
|
520
|
-
e,
|
|
521
|
-
NodeFilter.SHOW_TEXT
|
|
522
|
-
);
|
|
523
|
-
let u = l.nextNode(), P = p;
|
|
524
|
-
for (; u; ) {
|
|
525
|
-
const w = u.textContent?.length ?? 0;
|
|
526
|
-
if (P <= w) return [u, P];
|
|
527
|
-
P -= w, u = l.nextNode();
|
|
528
|
-
}
|
|
529
|
-
return [e, e.childNodes.length];
|
|
530
|
-
}, [m, v] = s(n), [d, k] = s(r);
|
|
531
|
-
a.setBaseAndExtent(m, v, d, k);
|
|
532
|
-
}
|
|
533
|
-
const Xe = typeof window > "u" ? K : at, Dt = rt(
|
|
517
|
+
const xt = typeof window > "u" ? D : st, Dt = lt(
|
|
534
518
|
function({
|
|
535
519
|
value: n,
|
|
536
520
|
defaultValue: r = "",
|
|
537
|
-
placeholder:
|
|
538
|
-
onChange:
|
|
521
|
+
placeholder: i,
|
|
522
|
+
onChange: l,
|
|
539
523
|
onValueChange: s,
|
|
540
|
-
onClipboardError:
|
|
541
|
-
mode:
|
|
542
|
-
layout:
|
|
543
|
-
filterKey:
|
|
524
|
+
onClipboardError: f,
|
|
525
|
+
mode: m = "text",
|
|
526
|
+
layout: u,
|
|
527
|
+
filterKey: w,
|
|
544
528
|
sanitizeValue: p,
|
|
545
|
-
disabled:
|
|
546
|
-
readOnly:
|
|
547
|
-
maxLength:
|
|
548
|
-
...
|
|
549
|
-
},
|
|
550
|
-
const
|
|
551
|
-
focusId:
|
|
552
|
-
onFocus:
|
|
529
|
+
disabled: c = !1,
|
|
530
|
+
readOnly: a = !1,
|
|
531
|
+
maxLength: x,
|
|
532
|
+
...y
|
|
533
|
+
}, ee) {
|
|
534
|
+
const H = Je(), {
|
|
535
|
+
focusId: se,
|
|
536
|
+
onFocus: re,
|
|
553
537
|
onBlur: F,
|
|
554
|
-
defaultLayout:
|
|
555
|
-
inputRef:
|
|
556
|
-
hangulMode:
|
|
557
|
-
theme:
|
|
558
|
-
toggleKorean:
|
|
559
|
-
setEditingStatus:
|
|
560
|
-
} =
|
|
538
|
+
defaultLayout: ce,
|
|
539
|
+
inputRef: W,
|
|
540
|
+
hangulMode: G,
|
|
541
|
+
theme: ae,
|
|
542
|
+
toggleKorean: de,
|
|
543
|
+
setEditingStatus: g
|
|
544
|
+
} = Oe(), k = M(null), v = M(null), B = M(!1), E = M(!1), $ = M(null), [j, Y] = z(null), [q, A] = z(!1), [R, ge] = z(() => ({
|
|
561
545
|
value: n ?? r,
|
|
562
546
|
caret: (n ?? r).length,
|
|
563
547
|
anchor: (n ?? r).length,
|
|
564
548
|
composing: !1
|
|
565
|
-
})),
|
|
566
|
-
|
|
567
|
-
const
|
|
568
|
-
|
|
569
|
-
...
|
|
570
|
-
value:
|
|
571
|
-
caret:
|
|
572
|
-
anchor:
|
|
573
|
-
composing:
|
|
549
|
+
})), N = n ?? R.value, d = M(R), fe = M(0), le = M(new ht()), Q = M(!1), h = se === H, C = M(h);
|
|
550
|
+
C.current = h;
|
|
551
|
+
const U = n !== void 0 && n !== R.value;
|
|
552
|
+
U && le.current.clear(), d.current = {
|
|
553
|
+
...R,
|
|
554
|
+
value: N,
|
|
555
|
+
caret: Z(N, R.caret),
|
|
556
|
+
anchor: Z(N, R.anchor),
|
|
557
|
+
composing: U ? !1 : R.composing
|
|
574
558
|
};
|
|
575
|
-
const
|
|
576
|
-
() =>
|
|
577
|
-
mode:
|
|
578
|
-
layout:
|
|
579
|
-
filterKey:
|
|
559
|
+
const T = Xe(
|
|
560
|
+
() => Te({
|
|
561
|
+
mode: m,
|
|
562
|
+
layout: u ?? (m === "text" || m === "custom" ? ce : void 0),
|
|
563
|
+
filterKey: w,
|
|
580
564
|
sanitizeValue: p
|
|
581
565
|
}),
|
|
582
|
-
[
|
|
583
|
-
), [
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
566
|
+
[m, u, ce, w, p]
|
|
567
|
+
), [ke, _] = z(""), [He, Fe] = z(!1), te = M(null), ve = M(null), pe = M({ disabled: c, readOnly: a, policy: T, maxLength: x });
|
|
568
|
+
pe.current = { disabled: c, readOnly: a, policy: T, maxLength: x };
|
|
569
|
+
const O = L(() => {
|
|
570
|
+
te.current && (te.current = null, Fe(!1));
|
|
587
571
|
}, []);
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
572
|
+
D(() => {
|
|
573
|
+
const t = te.current;
|
|
574
|
+
t && (!h || c || a || t.policy !== T || t.maxLength !== x || t.value !== N) && O();
|
|
575
|
+
}, [
|
|
576
|
+
h,
|
|
577
|
+
c,
|
|
578
|
+
a,
|
|
579
|
+
T,
|
|
580
|
+
x,
|
|
581
|
+
N,
|
|
582
|
+
O
|
|
583
|
+
]);
|
|
584
|
+
const S = L(
|
|
585
|
+
(t, o = !0, b = !1) => {
|
|
586
|
+
O();
|
|
587
|
+
const I = d.current.value;
|
|
588
|
+
if (o && le.current.record(d.current, t), B.current = !b, d.current = t, fe.current++, _(""), ge(t), t.value !== I) {
|
|
602
589
|
s?.(t.value);
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
target:
|
|
606
|
-
currentTarget:
|
|
590
|
+
const K = { value: t.value };
|
|
591
|
+
l?.({
|
|
592
|
+
target: K,
|
|
593
|
+
currentTarget: K
|
|
607
594
|
});
|
|
608
595
|
}
|
|
609
596
|
},
|
|
610
|
-
[
|
|
611
|
-
),
|
|
612
|
-
const t =
|
|
613
|
-
if (!t ||
|
|
597
|
+
[l, s, O]
|
|
598
|
+
), V = L(() => {
|
|
599
|
+
const t = v.current;
|
|
600
|
+
if (!t || c || B.current || t.value !== d.current.value || E.current)
|
|
614
601
|
return null;
|
|
615
|
-
const o =
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
return (f !== c.current.anchor || x !== c.current.caret || f !== o.anchor || x !== o.caret) && S(
|
|
619
|
-
{ ...c.current, anchor: f, caret: x, composing: !1 },
|
|
602
|
+
const o = t.selectionStart ?? 0, b = t.selectionEnd ?? o, I = t.selectionDirection === "backward" ? { anchor: b, caret: o } : { anchor: o, caret: b }, K = Z(d.current.value, I.anchor), J = Z(d.current.value, I.caret);
|
|
603
|
+
return (K !== d.current.anchor || J !== d.current.caret || K !== I.anchor || J !== I.caret) && S(
|
|
604
|
+
{ ...d.current, anchor: K, caret: J, composing: !1 },
|
|
620
605
|
!1,
|
|
621
|
-
|
|
622
|
-
), { anchor:
|
|
623
|
-
}, [
|
|
624
|
-
|
|
606
|
+
K === I.anchor && J === I.caret
|
|
607
|
+
), { anchor: K, caret: J };
|
|
608
|
+
}, [c, S]);
|
|
609
|
+
D(() => {
|
|
625
610
|
const t = () => {
|
|
626
|
-
|
|
627
|
-
|
|
611
|
+
document.activeElement === v.current && V();
|
|
612
|
+
}, o = v.current;
|
|
613
|
+
return document.addEventListener("selectionchange", t), o?.addEventListener("select", t), () => {
|
|
614
|
+
document.removeEventListener("selectionchange", t), o?.removeEventListener("select", t);
|
|
628
615
|
};
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
616
|
+
}, [V]), xt(() => {
|
|
617
|
+
if ($.current && $.current.value !== N && (E.current = !1, $.current = null, Y(null)), !c && v.current && !E.current && (B.current || U)) {
|
|
618
|
+
const { anchor: t, caret: o } = d.current, b = Math.min(t, o), I = Math.max(t, o), K = t > o ? "backward" : "forward";
|
|
619
|
+
(v.current.selectionStart !== b || v.current.selectionEnd !== I || b !== I && v.current.selectionDirection !== K) && v.current.setSelectionRange(b, I, K);
|
|
620
|
+
}
|
|
621
|
+
B.current = !1, ve.current !== null && (_(
|
|
622
|
+
N === ve.current ? "붙여넣었어요" : "입력값이 적용되지 않았어요"
|
|
623
|
+
), ve.current = null);
|
|
624
|
+
}), D(() => {
|
|
625
|
+
if (!h) return;
|
|
626
|
+
const [t, o] = ie(d.current);
|
|
627
|
+
g({
|
|
628
|
+
selectionLength: Re(N.slice(t, o)).length,
|
|
629
|
+
hasValue: !!N,
|
|
630
|
+
message: ke,
|
|
631
|
+
pasting: He
|
|
643
632
|
});
|
|
644
633
|
}, [
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
634
|
+
N,
|
|
635
|
+
R.anchor,
|
|
636
|
+
R.caret,
|
|
637
|
+
ke,
|
|
638
|
+
He,
|
|
639
|
+
h,
|
|
640
|
+
g
|
|
651
641
|
]);
|
|
652
|
-
const
|
|
642
|
+
const Ee = L(
|
|
653
643
|
(t, o = !1) => {
|
|
654
|
-
if (
|
|
655
|
-
|
|
656
|
-
const
|
|
657
|
-
|
|
644
|
+
if (c || a) return;
|
|
645
|
+
V();
|
|
646
|
+
const b = T.sanitizeValue(t).replace(/[\r\n\t]+/g, " ");
|
|
647
|
+
b && S(Ke(d.current, b, o, x));
|
|
658
648
|
},
|
|
659
|
-
[
|
|
660
|
-
),
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
649
|
+
[c, a, T, x, S, V]
|
|
650
|
+
), Se = L(
|
|
651
|
+
(t) => {
|
|
652
|
+
if (c || a || E.current) return;
|
|
653
|
+
if (V(), !t) {
|
|
654
|
+
_("붙여넣을 텍스트가 없어요");
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
const o = T.sanitizeValue(t).replace(/[\r\n\t]+/g, " ");
|
|
658
|
+
if (!o || !T.filterKey(o)) {
|
|
659
|
+
_("이 입력란에 붙여넣을 수 없는 내용이에요");
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
const b = Ke(d.current, o, !1, x);
|
|
663
|
+
if (b === d.current) {
|
|
664
|
+
_("입력 길이 제한을 초과했어요");
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
ve.current = b.value, S(b), v.current?.focus({ preventScroll: !0 });
|
|
668
|
+
},
|
|
669
|
+
[c, a, T, x, V, S]
|
|
670
|
+
), Le = L(() => {
|
|
671
|
+
!c && !a && S(le.current.undo(d.current), !1);
|
|
672
|
+
}, [c, a, S]), Ce = L(() => {
|
|
673
|
+
!c && !a && S(le.current.redo(d.current), !1);
|
|
674
|
+
}, [c, a, S]), je = L(
|
|
665
675
|
() => S({
|
|
666
|
-
...
|
|
667
|
-
caret:
|
|
676
|
+
...d.current,
|
|
677
|
+
caret: d.current.value.length,
|
|
668
678
|
anchor: 0,
|
|
669
679
|
composing: !1
|
|
670
680
|
}),
|
|
671
681
|
[S]
|
|
672
|
-
),
|
|
682
|
+
), Ne = L(
|
|
673
683
|
(t, o = !1) => {
|
|
674
|
-
|
|
684
|
+
V(), S(Ye(d.current, t === "left" ? -1 : 1, o));
|
|
675
685
|
},
|
|
676
|
-
[S,
|
|
677
|
-
),
|
|
678
|
-
if (
|
|
679
|
-
|
|
686
|
+
[S, V]
|
|
687
|
+
), tt = (t) => {
|
|
688
|
+
if (y.onKeyDown?.(t), t.defaultPrevented || c || E.current || t.nativeEvent.isComposing || t.keyCode === 229)
|
|
689
|
+
return;
|
|
690
|
+
V();
|
|
680
691
|
const o = t.key;
|
|
681
692
|
if (o === "Escape") {
|
|
682
|
-
t.preventDefault(), S({ ...
|
|
693
|
+
t.preventDefault(), S({ ...d.current, composing: !1 }), F(!0), v.current?.blur();
|
|
683
694
|
return;
|
|
684
695
|
}
|
|
685
696
|
if (o === "HangulMode") {
|
|
686
|
-
t.preventDefault(), S({ ...
|
|
697
|
+
t.preventDefault(), S({ ...d.current, composing: !1 }), de();
|
|
687
698
|
return;
|
|
688
699
|
}
|
|
689
|
-
const
|
|
690
|
-
if (
|
|
691
|
-
t.preventDefault(), o.toLowerCase() === "y" || t.shiftKey ?
|
|
700
|
+
const b = t.ctrlKey || t.metaKey;
|
|
701
|
+
if (b && ["z", "y"].includes(o.toLowerCase())) {
|
|
702
|
+
t.preventDefault(), o.toLowerCase() === "y" || t.shiftKey ? Ce() : Le();
|
|
692
703
|
return;
|
|
693
704
|
}
|
|
694
|
-
if (
|
|
705
|
+
if (b && o.toLowerCase() === "a") {
|
|
695
706
|
t.preventDefault(), S({
|
|
696
|
-
...
|
|
697
|
-
caret:
|
|
707
|
+
...d.current,
|
|
708
|
+
caret: d.current.value.length,
|
|
698
709
|
anchor: 0,
|
|
699
710
|
composing: !1
|
|
700
711
|
});
|
|
701
712
|
return;
|
|
702
713
|
}
|
|
703
|
-
const
|
|
704
|
-
if (
|
|
705
|
-
t.preventDefault(), S(
|
|
714
|
+
const I = o === "Home" || o === "ArrowUp" || b && o === "ArrowLeft" ? "home" : o === "End" || o === "ArrowDown" || b && o === "ArrowRight" ? "end" : o === "ArrowLeft" ? -1 : o === "ArrowRight" ? 1 : null;
|
|
715
|
+
if (I !== null) {
|
|
716
|
+
t.preventDefault(), S(Ye(d.current, I, t.shiftKey));
|
|
706
717
|
return;
|
|
707
718
|
}
|
|
708
719
|
if (o === "Tab" || o === "Enter") {
|
|
709
|
-
S({ ...
|
|
720
|
+
o === "Enter" && t.preventDefault(), S({ ...d.current, composing: !1 });
|
|
710
721
|
return;
|
|
711
722
|
}
|
|
712
|
-
if (
|
|
723
|
+
if (a) return;
|
|
713
724
|
if (o === "Backspace" || o === "Delete") {
|
|
714
|
-
t.preventDefault(), S(
|
|
725
|
+
t.preventDefault(), S(ye(d.current, o === "Backspace" ? -1 : 1));
|
|
715
726
|
return;
|
|
716
727
|
}
|
|
717
|
-
const
|
|
728
|
+
const K = gt(
|
|
718
729
|
t,
|
|
719
|
-
|
|
730
|
+
be(T.mode) ?? G
|
|
720
731
|
);
|
|
721
|
-
|
|
722
|
-
},
|
|
732
|
+
K.handled && K.text && (t.preventDefault(), T.filterKey(K.text) && Ee(K.text, K.composing));
|
|
733
|
+
}, ue = L(
|
|
723
734
|
(t) => {
|
|
724
735
|
const o = t instanceof Error ? t : new Error(String(t));
|
|
725
|
-
|
|
726
|
-
"클립보드에 접근할 수 없습니다.
|
|
727
|
-
),
|
|
736
|
+
Q.current && (_(
|
|
737
|
+
"클립보드에 접근할 수 없습니다. 입력란을 길게 눌러 기본 편집 메뉴를 사용해 주세요."
|
|
738
|
+
), f?.(o));
|
|
728
739
|
},
|
|
729
|
-
[
|
|
730
|
-
),
|
|
731
|
-
|
|
732
|
-
const [t, o] =
|
|
740
|
+
[f]
|
|
741
|
+
), me = L(async () => {
|
|
742
|
+
V();
|
|
743
|
+
const [t, o] = ie(d.current);
|
|
733
744
|
if (t === o) return;
|
|
734
|
-
const
|
|
745
|
+
const b = d.current.value, I = d.current.value.slice(t, o);
|
|
735
746
|
try {
|
|
736
747
|
if (!navigator.clipboard?.writeText)
|
|
737
748
|
throw new Error("Clipboard API unavailable");
|
|
738
|
-
await navigator.clipboard.writeText(
|
|
739
|
-
} catch (
|
|
740
|
-
|
|
741
|
-
|
|
749
|
+
await navigator.clipboard.writeText(I);
|
|
750
|
+
} catch (K) {
|
|
751
|
+
V();
|
|
752
|
+
const J = v.current, [at, ot] = ie(d.current);
|
|
753
|
+
if (!J || !Q.current || d.current.value !== b || at !== t || ot !== o)
|
|
754
|
+
throw K;
|
|
755
|
+
let ne = document.activeElement;
|
|
756
|
+
const Ze = ne?.hasAttribute(
|
|
757
|
+
"data-virtual-keypad"
|
|
758
|
+
);
|
|
759
|
+
if (ne !== J && !Ze) throw K;
|
|
760
|
+
for (; ne?.shadowRoot?.activeElement; )
|
|
761
|
+
ne = ne.shadowRoot.activeElement;
|
|
762
|
+
J.focus({ preventScroll: !0 });
|
|
763
|
+
try {
|
|
764
|
+
if (!document.execCommand?.("copy")) throw K;
|
|
765
|
+
} finally {
|
|
766
|
+
ne instanceof HTMLElement && ne !== J && Ze && ne.focus({ preventScroll: !0 });
|
|
767
|
+
}
|
|
742
768
|
}
|
|
743
|
-
|
|
744
|
-
}, [
|
|
745
|
-
if (
|
|
746
|
-
|
|
747
|
-
const t =
|
|
748
|
-
t.anchor !== t.caret && (await
|
|
749
|
-
}, [
|
|
750
|
-
if (
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
769
|
+
Q.current && _("복사했어요");
|
|
770
|
+
}, [V]), $e = L(async () => {
|
|
771
|
+
if (c || a) return;
|
|
772
|
+
V();
|
|
773
|
+
const t = d.current, o = fe.current;
|
|
774
|
+
t.anchor !== t.caret && (await me(), Q.current && C.current && fe.current === o && d.current.value === t.value && S(ye(t, -1)));
|
|
775
|
+
}, [c, a, me, S, V]), qe = L(async () => {
|
|
776
|
+
if (c || a || E.current || te.current)
|
|
777
|
+
return;
|
|
778
|
+
V();
|
|
779
|
+
const t = { value: d.current.value, policy: T, maxLength: x };
|
|
780
|
+
te.current = t, Fe(!0), _("");
|
|
781
|
+
const o = () => te.current === t && Q.current && C.current && !pe.current.disabled && !pe.current.readOnly && pe.current.policy === t.policy && pe.current.maxLength === t.maxLength && d.current.value === t.value;
|
|
782
|
+
try {
|
|
783
|
+
if (!navigator.clipboard?.readText)
|
|
784
|
+
throw new Error("Clipboard read unavailable");
|
|
785
|
+
const b = await navigator.clipboard.readText();
|
|
786
|
+
V(), o() && Se(b);
|
|
787
|
+
} catch (b) {
|
|
788
|
+
V(), o() && (v.current?.focus({ preventScroll: !0 }), ue(b), _(
|
|
789
|
+
"클립보드를 읽을 수 없어요. 입력란을 길게 눌러 ‘붙여넣기’를 선택해 주세요."
|
|
790
|
+
));
|
|
791
|
+
} finally {
|
|
792
|
+
te.current === t && O();
|
|
793
|
+
}
|
|
794
|
+
}, [
|
|
795
|
+
c,
|
|
796
|
+
a,
|
|
797
|
+
T,
|
|
798
|
+
x,
|
|
799
|
+
Se,
|
|
800
|
+
V,
|
|
801
|
+
ue,
|
|
802
|
+
O
|
|
803
|
+
]), he = Xe(
|
|
755
804
|
() => ({
|
|
756
805
|
focus: (t) => {
|
|
757
|
-
|
|
806
|
+
c || v.current?.focus(t);
|
|
758
807
|
},
|
|
759
808
|
blur: () => {
|
|
760
|
-
|
|
809
|
+
v.current?.blur(), C.current && F(!0);
|
|
761
810
|
},
|
|
762
|
-
getValue: () =>
|
|
811
|
+
getValue: () => d.current.value,
|
|
763
812
|
setSelectionRange: (t, o) => S({
|
|
764
|
-
...
|
|
765
|
-
anchor:
|
|
766
|
-
caret:
|
|
813
|
+
...d.current,
|
|
814
|
+
anchor: Z(d.current.value, t),
|
|
815
|
+
caret: Z(d.current.value, o),
|
|
767
816
|
composing: !1
|
|
768
817
|
}),
|
|
769
|
-
handleKeyDown: (t) =>
|
|
818
|
+
handleKeyDown: (t) => v.current?.dispatchEvent(
|
|
770
819
|
new KeyboardEvent("keydown", {
|
|
771
820
|
key: t.key,
|
|
772
821
|
shiftKey: t.shiftKey,
|
|
@@ -779,153 +828,90 @@ const Xe = typeof window > "u" ? K : at, Dt = rt(
|
|
|
779
828
|
})
|
|
780
829
|
),
|
|
781
830
|
insertText: (t, o) => {
|
|
782
|
-
|
|
831
|
+
T.filterKey(t) && Ee(t, o);
|
|
783
832
|
},
|
|
784
|
-
scrollIntoView: () =>
|
|
785
|
-
moveCaret:
|
|
786
|
-
undo:
|
|
787
|
-
redo:
|
|
788
|
-
selectAll:
|
|
789
|
-
copySelection: () =>
|
|
790
|
-
pasteClipboard: () =>
|
|
791
|
-
cutSelection: () =>
|
|
833
|
+
scrollIntoView: () => k.current?.scrollIntoView({ block: "nearest", inline: "nearest" }),
|
|
834
|
+
moveCaret: Ne,
|
|
835
|
+
undo: Le,
|
|
836
|
+
redo: Ce,
|
|
837
|
+
selectAll: je,
|
|
838
|
+
copySelection: () => me().catch(ue),
|
|
839
|
+
pasteClipboard: () => qe().catch(ue),
|
|
840
|
+
cutSelection: () => $e().catch(ue)
|
|
792
841
|
}),
|
|
793
842
|
[
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
843
|
+
T,
|
|
844
|
+
Ee,
|
|
845
|
+
Ne,
|
|
846
|
+
me,
|
|
847
|
+
qe,
|
|
848
|
+
$e,
|
|
849
|
+
ue,
|
|
850
|
+
Le,
|
|
851
|
+
Ce,
|
|
852
|
+
je,
|
|
853
|
+
c,
|
|
805
854
|
F,
|
|
806
855
|
S
|
|
807
856
|
]
|
|
808
857
|
);
|
|
809
|
-
|
|
810
|
-
|
|
858
|
+
ut(ee, () => he, [he]), D(() => {
|
|
859
|
+
h || ge(
|
|
811
860
|
(t) => t.composing ? { ...t, composing: !1 } : t
|
|
812
861
|
);
|
|
813
|
-
}, [
|
|
814
|
-
if (!(!
|
|
815
|
-
return
|
|
816
|
-
|
|
862
|
+
}, [h]), D(() => {
|
|
863
|
+
if (!(!h || c || a))
|
|
864
|
+
return W.current = he, () => {
|
|
865
|
+
W.current === he && (W.current = null);
|
|
817
866
|
};
|
|
818
|
-
}, [
|
|
819
|
-
|
|
820
|
-
}, [
|
|
821
|
-
|
|
822
|
-
}), [F])
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
), pe = ($e ?? x).getBoundingClientRect(), se = $e || !c.current.value ? pe.left : pe.right;
|
|
829
|
-
Object.assign(I.current.style, {
|
|
830
|
-
left: `${se - N.left + f.scrollLeft - f.clientLeft}px`,
|
|
831
|
-
top: `${pe.top - N.top + f.scrollTop - f.clientTop}px`,
|
|
832
|
-
height: `${pe.height}px`
|
|
833
|
-
}), !(!V || c.current.anchor !== c.current.caret) && (se > N.right - 12 ? f.scrollLeft += se - N.right + 12 : se < N.left + 12 && (f.scrollLeft -= N.left + 12 - se));
|
|
834
|
-
};
|
|
835
|
-
t();
|
|
836
|
-
const o = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
|
|
837
|
-
return o?.observe(g.current), () => o?.disconnect();
|
|
838
|
-
}, [M, C.caret, C.anchor, V]);
|
|
839
|
-
const Ne = (t, o) => {
|
|
840
|
-
if (o ? w.onCut?.(t) : w.onCopy?.(t), t.defaultPrevented || l || o && u) return;
|
|
841
|
-
const f = document.getSelection();
|
|
842
|
-
if (f && !f.isCollapsed && A.current && !Ae(A.current))
|
|
843
|
-
return;
|
|
844
|
-
H();
|
|
845
|
-
const [x, N] = te(c.current);
|
|
846
|
-
x !== N && (t.preventDefault(), t.clipboardData.setData(
|
|
867
|
+
}, [h, c, a, he, W]), D(() => {
|
|
868
|
+
h && k.current && (c || a ? F(!0) : re(H, k.current, T));
|
|
869
|
+
}, [h, c, a, H, T, re, F]), D(() => (Q.current = !0, () => {
|
|
870
|
+
Q.current = !1, te.current = null, C.current && F(!0);
|
|
871
|
+
}), [F]);
|
|
872
|
+
const Ue = (t, o) => {
|
|
873
|
+
if (o ? y.onCut?.(t) : y.onCopy?.(t), t.defaultPrevented || c || o && a || t.target !== v.current) return;
|
|
874
|
+
V();
|
|
875
|
+
const [b, I] = ie(d.current);
|
|
876
|
+
b !== I && (t.preventDefault(), t.clipboardData.setData(
|
|
847
877
|
"text/plain",
|
|
848
|
-
|
|
849
|
-
), o ? S(
|
|
850
|
-
},
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
}, xe = () => {
|
|
860
|
-
g.current?.focus({ preventScroll: !0 }), !u && g.current && Z(B, g.current, j);
|
|
861
|
-
}, Be = (t) => {
|
|
862
|
-
const [o, f] = mt(
|
|
863
|
-
c.current.value,
|
|
864
|
-
be(t, !1)
|
|
865
|
-
);
|
|
866
|
-
xe(), S({ ...c.current, anchor: o, caret: f, composing: !1 });
|
|
867
|
-
}, Qe = (t) => {
|
|
868
|
-
if (w.onPointerDown?.(t), t.defaultPrevented || l || t.button !== 0) return;
|
|
869
|
-
const o = t.pointerType === "mouse";
|
|
870
|
-
if (R.current || t.isPrimary === !1) {
|
|
871
|
-
z();
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
const f = be(t.clientX), x = t.shiftKey ? c.current.anchor : f;
|
|
875
|
-
R.current = {
|
|
876
|
-
id: t.pointerId,
|
|
877
|
-
x: t.clientX,
|
|
878
|
-
y: t.clientY,
|
|
879
|
-
anchor: x,
|
|
880
|
-
mouse: o,
|
|
881
|
-
held: !1
|
|
882
|
-
}, clearTimeout(q.current), o ? xe() : q.current = setTimeout(() => {
|
|
883
|
-
R.current && (R.current.held = !0, Be(R.current.x));
|
|
884
|
-
}, 550);
|
|
885
|
-
}, [Re, He] = te(c.current), Oe = me(M), et = /* @__PURE__ */ L(
|
|
886
|
-
"span",
|
|
887
|
-
{
|
|
888
|
-
ref: I,
|
|
889
|
-
"aria-hidden": "true",
|
|
890
|
-
className: "vk-caret",
|
|
891
|
-
style: {
|
|
892
|
-
display: V && !u && !l && Re === He ? "block" : "none",
|
|
893
|
-
width: 0,
|
|
894
|
-
height: "1.1em",
|
|
895
|
-
position: "absolute",
|
|
896
|
-
pointerEvents: "none",
|
|
897
|
-
userSelect: "none"
|
|
878
|
+
d.current.value.slice(b, I)
|
|
879
|
+
), o ? S(ye(d.current, -1)) : _("복사했어요"));
|
|
880
|
+
}, We = (t) => {
|
|
881
|
+
if (c || a) return;
|
|
882
|
+
const o = bt(
|
|
883
|
+
d.current,
|
|
884
|
+
t.value,
|
|
885
|
+
{
|
|
886
|
+
start: t.selectionStart ?? t.value.length,
|
|
887
|
+
end: t.selectionEnd ?? t.value.length,
|
|
888
|
+
backward: t.selectionDirection === "backward"
|
|
898
889
|
},
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
890
|
+
T.sanitizeValue,
|
|
891
|
+
T.filterKey,
|
|
892
|
+
x
|
|
893
|
+
);
|
|
894
|
+
t.value = o.value, S({ ...o });
|
|
895
|
+
}, nt = Object.fromEntries(
|
|
896
|
+
Object.entries(y).filter(([t]) => t.startsWith("aria-"))
|
|
897
|
+
), rt = Object.fromEntries(
|
|
898
|
+
Object.entries(y).filter(
|
|
899
|
+
([t]) => !t.startsWith("aria-") && !["id", "tabIndex", "role", "contentEditable", "children"].includes(
|
|
900
|
+
t
|
|
908
901
|
)
|
|
909
|
-
|
|
902
|
+
)
|
|
910
903
|
);
|
|
911
|
-
return /* @__PURE__ */
|
|
904
|
+
return /* @__PURE__ */ X(
|
|
912
905
|
"div",
|
|
913
906
|
{
|
|
914
|
-
...
|
|
915
|
-
ref:
|
|
916
|
-
id: w.id ?? B,
|
|
917
|
-
role: "textbox",
|
|
918
|
-
tabIndex: l ? -1 : w.tabIndex ?? 0,
|
|
919
|
-
"aria-disabled": l || void 0,
|
|
920
|
-
"aria-readonly": u || void 0,
|
|
921
|
-
"aria-multiline": "false",
|
|
922
|
-
"aria-placeholder": a,
|
|
907
|
+
...rt,
|
|
908
|
+
ref: k,
|
|
923
909
|
"data-virtual-input": "true",
|
|
924
|
-
"data-focused":
|
|
925
|
-
"data-value": M,
|
|
910
|
+
"data-focused": h || void 0,
|
|
926
911
|
style: {
|
|
927
|
-
display: "block",
|
|
928
912
|
position: "relative",
|
|
913
|
+
display: "flex",
|
|
914
|
+
alignItems: "center",
|
|
929
915
|
boxSizing: "border-box",
|
|
930
916
|
minHeight: "2.75em",
|
|
931
917
|
padding: "0.65em 0.8em",
|
|
@@ -933,86 +919,89 @@ const Xe = typeof window > "u" ? K : at, Dt = rt(
|
|
|
933
919
|
borderRadius: 8,
|
|
934
920
|
font: "inherit",
|
|
935
921
|
width: "100%",
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
WebkitTouchCallout: "default",
|
|
943
|
-
touchAction: "manipulation",
|
|
944
|
-
opacity: l ? 0.5 : 1,
|
|
945
|
-
outlineOffset: 3,
|
|
946
|
-
...w.style
|
|
922
|
+
cursor: c ? "not-allowed" : "text",
|
|
923
|
+
opacity: c ? 0.5 : 1,
|
|
924
|
+
colorScheme: ae,
|
|
925
|
+
outline: q ? "2px solid currentColor" : void 0,
|
|
926
|
+
outlineOffset: 2,
|
|
927
|
+
...y.style
|
|
947
928
|
},
|
|
948
929
|
onFocus: (t) => {
|
|
949
|
-
|
|
930
|
+
A(!0), y.onFocus?.(t), !t.defaultPrevented && !c && !a && re(H, t.currentTarget, T);
|
|
950
931
|
},
|
|
951
932
|
onBlur: (t) => {
|
|
952
|
-
|
|
933
|
+
A(!1), t.relatedTarget instanceof Element && !t.relatedTarget.closest("[data-virtual-keypad]") && O(), y.onBlur?.(t), t.defaultPrevented || F(t);
|
|
953
934
|
},
|
|
954
|
-
onKeyDown:
|
|
955
|
-
onCopy: (t) =>
|
|
956
|
-
onCut: (t) =>
|
|
935
|
+
onKeyDown: tt,
|
|
936
|
+
onCopy: (t) => Ue(t, !1),
|
|
937
|
+
onCut: (t) => Ue(t, !0),
|
|
957
938
|
onPaste: (t) => {
|
|
958
|
-
|
|
959
|
-
},
|
|
960
|
-
onPointerDown: Qe,
|
|
961
|
-
onDoubleClick: (t) => {
|
|
962
|
-
w.onDoubleClick?.(t), !(t.defaultPrevented || l || t.button !== 0) && (t.preventDefault(), Be(t.clientX));
|
|
963
|
-
},
|
|
964
|
-
onPointerMove: (t) => {
|
|
965
|
-
if (w.onPointerMove?.(t), t.defaultPrevented) {
|
|
966
|
-
z();
|
|
967
|
-
return;
|
|
968
|
-
}
|
|
969
|
-
!R.current || R.current.id !== t.pointerId || Math.hypot(
|
|
970
|
-
t.clientX - R.current.x,
|
|
971
|
-
t.clientY - R.current.y
|
|
972
|
-
) > 8 && (clearTimeout(q.current), R.current.mouse || z());
|
|
973
|
-
},
|
|
974
|
-
onPointerUp: (t) => {
|
|
975
|
-
w.onPointerUp?.(t);
|
|
976
|
-
const o = R.current;
|
|
977
|
-
if (!t.defaultPrevented && o?.id === t.pointerId && !o.held && Math.hypot(t.clientX - o.x, t.clientY - o.y) <= 8) {
|
|
978
|
-
const f = H();
|
|
979
|
-
if (!f || !o.mouse && f.anchor === f.caret) {
|
|
980
|
-
const x = be(t.clientX);
|
|
981
|
-
xe(), S({
|
|
982
|
-
...c.current,
|
|
983
|
-
caret: x,
|
|
984
|
-
anchor: t.shiftKey ? o.anchor : x,
|
|
985
|
-
composing: !1
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
z();
|
|
990
|
-
},
|
|
991
|
-
onPointerCancel: (t) => {
|
|
992
|
-
w.onPointerCancel?.(t), z();
|
|
993
|
-
},
|
|
994
|
-
onLostPointerCapture: (t) => {
|
|
995
|
-
w.onLostPointerCapture?.(t), R.current?.id === t.pointerId && z();
|
|
996
|
-
},
|
|
997
|
-
onContextMenu: (t) => {
|
|
998
|
-
w.onContextMenu?.(t), t.defaultPrevented || H();
|
|
939
|
+
y.onPaste?.(t), !t.defaultPrevented && !c && !a && (t.preventDefault(), O(), Se(t.clipboardData.getData("text/plain")));
|
|
999
940
|
},
|
|
1000
941
|
children: [
|
|
1001
|
-
/* @__PURE__ */
|
|
1002
|
-
|
|
1003
|
-
!M && /* @__PURE__ */ L(
|
|
1004
|
-
"span",
|
|
942
|
+
/* @__PURE__ */ P(
|
|
943
|
+
"input",
|
|
1005
944
|
{
|
|
1006
|
-
|
|
945
|
+
...nt,
|
|
946
|
+
ref: v,
|
|
947
|
+
id: y.id ?? H,
|
|
948
|
+
type: "text",
|
|
949
|
+
role: "textbox",
|
|
950
|
+
inputMode: "none",
|
|
951
|
+
autoComplete: "off",
|
|
952
|
+
autoCorrect: "off",
|
|
953
|
+
autoCapitalize: "off",
|
|
954
|
+
spellCheck: y.spellCheck ?? !1,
|
|
955
|
+
tabIndex: c ? -1 : y.tabIndex ?? 0,
|
|
956
|
+
disabled: c,
|
|
957
|
+
readOnly: a,
|
|
958
|
+
"aria-disabled": c || void 0,
|
|
959
|
+
"aria-readonly": a || void 0,
|
|
960
|
+
"data-virtual-input": "true",
|
|
961
|
+
"data-focused": h || void 0,
|
|
962
|
+
"data-value": N,
|
|
963
|
+
placeholder: i,
|
|
964
|
+
value: j ?? N,
|
|
1007
965
|
style: {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
966
|
+
position: "absolute",
|
|
967
|
+
inset: 0,
|
|
968
|
+
boxSizing: "border-box",
|
|
969
|
+
display: "block",
|
|
970
|
+
width: "100%",
|
|
971
|
+
height: "100%",
|
|
972
|
+
minWidth: 0,
|
|
973
|
+
minHeight: "1.5em",
|
|
974
|
+
margin: 0,
|
|
975
|
+
padding: "inherit",
|
|
976
|
+
border: 0,
|
|
977
|
+
borderRadius: "inherit",
|
|
978
|
+
outline: "none",
|
|
979
|
+
background: "transparent",
|
|
980
|
+
color: "inherit",
|
|
981
|
+
caretColor: "currentColor",
|
|
982
|
+
font: "inherit",
|
|
983
|
+
lineHeight: "inherit",
|
|
984
|
+
letterSpacing: "inherit",
|
|
985
|
+
textAlign: "inherit",
|
|
986
|
+
appearance: "none",
|
|
987
|
+
WebkitAppearance: "none",
|
|
988
|
+
userSelect: "text",
|
|
989
|
+
WebkitUserSelect: "text",
|
|
990
|
+
touchAction: "manipulation"
|
|
991
|
+
},
|
|
992
|
+
onChange: (t) => {
|
|
993
|
+
E.current ? Y(t.currentTarget.value) : We(t.currentTarget);
|
|
1011
994
|
},
|
|
1012
|
-
|
|
995
|
+
onSelect: V,
|
|
996
|
+
onCompositionStart: () => {
|
|
997
|
+
O(), V(), $.current = d.current, E.current = !0, Y(v.current?.value ?? d.current.value);
|
|
998
|
+
},
|
|
999
|
+
onCompositionEnd: (t) => {
|
|
1000
|
+
E.current = !1, Y(null), $.current?.value === d.current.value ? We(t.currentTarget) : (t.currentTarget.value = d.current.value, S({ ...d.current })), $.current = null;
|
|
1001
|
+
}
|
|
1013
1002
|
}
|
|
1014
1003
|
),
|
|
1015
|
-
/* @__PURE__ */
|
|
1004
|
+
/* @__PURE__ */ P(
|
|
1016
1005
|
"span",
|
|
1017
1006
|
{
|
|
1018
1007
|
role: "status",
|
|
@@ -1022,18 +1011,16 @@ const Xe = typeof window > "u" ? K : at, Dt = rt(
|
|
|
1022
1011
|
height: 1,
|
|
1023
1012
|
overflow: "hidden",
|
|
1024
1013
|
clipPath: "inset(50%)",
|
|
1025
|
-
whiteSpace: "nowrap"
|
|
1026
|
-
userSelect: "none",
|
|
1027
|
-
WebkitUserSelect: "none"
|
|
1014
|
+
whiteSpace: "nowrap"
|
|
1028
1015
|
},
|
|
1029
|
-
children:
|
|
1016
|
+
children: ke
|
|
1030
1017
|
}
|
|
1031
1018
|
)
|
|
1032
1019
|
]
|
|
1033
1020
|
}
|
|
1034
1021
|
);
|
|
1035
1022
|
}
|
|
1036
|
-
),
|
|
1023
|
+
), kt = [
|
|
1037
1024
|
[
|
|
1038
1025
|
{
|
|
1039
1026
|
value: "1"
|
|
@@ -1150,97 +1137,97 @@ const Xe = typeof window > "u" ? K : at, Dt = rt(
|
|
|
1150
1137
|
}
|
|
1151
1138
|
]
|
|
1152
1139
|
];
|
|
1153
|
-
function
|
|
1140
|
+
function Et({
|
|
1154
1141
|
tagName: e,
|
|
1155
1142
|
css: n,
|
|
1156
1143
|
children: r,
|
|
1157
|
-
hostRef:
|
|
1158
|
-
...
|
|
1144
|
+
hostRef: i,
|
|
1145
|
+
...l
|
|
1159
1146
|
}) {
|
|
1160
|
-
const [s,
|
|
1161
|
-
(
|
|
1162
|
-
|
|
1147
|
+
const [s, f] = z(null), m = L(
|
|
1148
|
+
(u) => {
|
|
1149
|
+
i && (i.current = u), u && f(u.shadowRoot ?? u.attachShadow({ mode: "open" }));
|
|
1163
1150
|
},
|
|
1164
|
-
[
|
|
1151
|
+
[i]
|
|
1165
1152
|
);
|
|
1166
|
-
return
|
|
1153
|
+
return dt(
|
|
1167
1154
|
e,
|
|
1168
|
-
{ ...
|
|
1169
|
-
s &&
|
|
1170
|
-
/* @__PURE__ */
|
|
1171
|
-
n && /* @__PURE__ */
|
|
1155
|
+
{ ...l, ref: m },
|
|
1156
|
+
s && Be(
|
|
1157
|
+
/* @__PURE__ */ X(De, { children: [
|
|
1158
|
+
n && /* @__PURE__ */ P("style", { children: n }),
|
|
1172
1159
|
r
|
|
1173
1160
|
] }),
|
|
1174
1161
|
s
|
|
1175
1162
|
)
|
|
1176
1163
|
);
|
|
1177
1164
|
}
|
|
1178
|
-
function
|
|
1165
|
+
function _e(e, n, r) {
|
|
1179
1166
|
if (e.type === "action") return e.value === `
|
|
1180
1167
|
` ? "Enter" : e.value;
|
|
1181
1168
|
if (!/^[a-zA-Z]$/.test(e.value)) return e.value;
|
|
1182
|
-
const
|
|
1183
|
-
return n ?
|
|
1169
|
+
const i = r ? e.value.toUpperCase() : e.value;
|
|
1170
|
+
return n ? Ge(i) : i;
|
|
1184
1171
|
}
|
|
1185
|
-
function
|
|
1186
|
-
const
|
|
1187
|
-
|
|
1188
|
-
const
|
|
1189
|
-
clearTimeout(
|
|
1172
|
+
function Ie(e, { disabled: n = !1, repeat: r = !1 } = {}) {
|
|
1173
|
+
const i = M(e);
|
|
1174
|
+
i.current = e;
|
|
1175
|
+
const l = M(void 0), s = M(null), [f, m] = z(!1), u = L(() => {
|
|
1176
|
+
clearTimeout(l.current), s.current = null, m(!1);
|
|
1190
1177
|
}, []);
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
}), [
|
|
1194
|
-
n &&
|
|
1195
|
-
}, [n,
|
|
1196
|
-
const
|
|
1197
|
-
const
|
|
1198
|
-
return !!
|
|
1178
|
+
D(() => (window.addEventListener("blur", u), document.addEventListener("visibilitychange", u), () => {
|
|
1179
|
+
u(), window.removeEventListener("blur", u), document.removeEventListener("visibilitychange", u);
|
|
1180
|
+
}), [u]), D(() => {
|
|
1181
|
+
n && u();
|
|
1182
|
+
}, [n, u]);
|
|
1183
|
+
const w = (p) => {
|
|
1184
|
+
const c = s.current?.bounds;
|
|
1185
|
+
return !!c && p.clientX >= c.left && p.clientX <= c.right && p.clientY >= c.top && p.clientY <= c.bottom;
|
|
1199
1186
|
};
|
|
1200
1187
|
return {
|
|
1201
|
-
"data-pressed":
|
|
1188
|
+
"data-pressed": f || void 0,
|
|
1202
1189
|
onPointerDown: (p) => {
|
|
1203
1190
|
if (!(n || p.button !== 0 || s.current)) {
|
|
1204
1191
|
p.preventDefault(), s.current = {
|
|
1205
1192
|
id: p.pointerId,
|
|
1206
1193
|
bounds: p.currentTarget.getBoundingClientRect(),
|
|
1207
1194
|
repeated: !1
|
|
1208
|
-
},
|
|
1195
|
+
}, m(!0);
|
|
1209
1196
|
try {
|
|
1210
1197
|
p.currentTarget.setPointerCapture?.(p.pointerId);
|
|
1211
1198
|
} catch {
|
|
1212
1199
|
}
|
|
1213
1200
|
if (r) {
|
|
1214
|
-
const
|
|
1215
|
-
s.current && (s.current.repeated = !0,
|
|
1201
|
+
const c = () => {
|
|
1202
|
+
s.current && (s.current.repeated = !0, i.current(), l.current = setTimeout(c, 65));
|
|
1216
1203
|
};
|
|
1217
|
-
|
|
1204
|
+
l.current = setTimeout(c, 450);
|
|
1218
1205
|
}
|
|
1219
1206
|
}
|
|
1220
1207
|
},
|
|
1221
1208
|
onPointerMove: (p) => {
|
|
1222
|
-
s.current?.id === p.pointerId && !
|
|
1209
|
+
s.current?.id === p.pointerId && !w(p) && u();
|
|
1223
1210
|
},
|
|
1224
1211
|
onPointerUp: (p) => {
|
|
1225
1212
|
if (s.current?.id !== p.pointerId) return;
|
|
1226
|
-
const
|
|
1227
|
-
|
|
1213
|
+
const c = !n && w(p) && !s.current.repeated;
|
|
1214
|
+
u(), c && i.current();
|
|
1228
1215
|
},
|
|
1229
1216
|
onPointerCancel: (p) => {
|
|
1230
|
-
s.current?.id === p.pointerId &&
|
|
1217
|
+
s.current?.id === p.pointerId && u();
|
|
1231
1218
|
},
|
|
1232
1219
|
onLostPointerCapture: (p) => {
|
|
1233
|
-
s.current?.id === p.pointerId &&
|
|
1220
|
+
s.current?.id === p.pointerId && u();
|
|
1234
1221
|
},
|
|
1235
1222
|
onPointerLeave: (p) => {
|
|
1236
|
-
s.current?.id === p.pointerId && !
|
|
1223
|
+
s.current?.id === p.pointerId && !w(p) && u();
|
|
1237
1224
|
},
|
|
1238
1225
|
onClick: (p) => {
|
|
1239
|
-
!n && p.detail === 0 && !s.current &&
|
|
1226
|
+
!n && p.detail === 0 && !s.current && i.current();
|
|
1240
1227
|
}
|
|
1241
1228
|
};
|
|
1242
1229
|
}
|
|
1243
|
-
const
|
|
1230
|
+
const ze = {
|
|
1244
1231
|
Shift: "Shift",
|
|
1245
1232
|
HangulMode: "한영 전환",
|
|
1246
1233
|
Backspace: "지우기",
|
|
@@ -1259,30 +1246,32 @@ const Te = {
|
|
|
1259
1246
|
Redo: "다시 실행",
|
|
1260
1247
|
SelectAll: "전체 선택"
|
|
1261
1248
|
};
|
|
1262
|
-
function
|
|
1249
|
+
function Ae({
|
|
1263
1250
|
cell: e,
|
|
1264
1251
|
label: n,
|
|
1265
1252
|
value: r,
|
|
1266
|
-
active:
|
|
1267
|
-
disabled:
|
|
1268
|
-
|
|
1253
|
+
active: i,
|
|
1254
|
+
disabled: l,
|
|
1255
|
+
busy: s,
|
|
1256
|
+
dispatch: f
|
|
1269
1257
|
}) {
|
|
1270
|
-
const m =
|
|
1271
|
-
disabled:
|
|
1258
|
+
const m = Ie(f, {
|
|
1259
|
+
disabled: l,
|
|
1272
1260
|
repeat: ["Backspace", "Delete", "ArrowLeft", "ArrowRight"].includes(r)
|
|
1273
|
-
}),
|
|
1274
|
-
return /* @__PURE__ */
|
|
1261
|
+
}), u = e.type === "action" && r === "HangulMode", w = e.type === "action" && (r === "Backspace" && (!e.label || e.label === "⌫") || r === "Delete" && (!e.label || e.label === "⌦"));
|
|
1262
|
+
return /* @__PURE__ */ P(
|
|
1275
1263
|
"button",
|
|
1276
1264
|
{
|
|
1277
1265
|
type: "button",
|
|
1278
|
-
disabled:
|
|
1279
|
-
"aria-label":
|
|
1280
|
-
"aria-pressed":
|
|
1281
|
-
|
|
1282
|
-
|
|
1266
|
+
disabled: l,
|
|
1267
|
+
"aria-label": ze[r] ?? n,
|
|
1268
|
+
"aria-pressed": i,
|
|
1269
|
+
"aria-busy": s || void 0,
|
|
1270
|
+
className: u ? "key action language" : e.type === "action" ? "key action" : "key",
|
|
1271
|
+
title: u ? l ? `${i ? "한국어" : "영어"} 전용` : `${i ? "영어" : "한국어"}로 전환` : void 0,
|
|
1283
1272
|
style: { flex: e.width && e.width > 0 ? e.width : 1 },
|
|
1284
1273
|
...m,
|
|
1285
|
-
children:
|
|
1274
|
+
children: s ? "읽는 중…" : w ? /* @__PURE__ */ X(
|
|
1286
1275
|
"svg",
|
|
1287
1276
|
{
|
|
1288
1277
|
"data-key-icon": r === "Backspace" ? "backspace" : "delete",
|
|
@@ -1298,12 +1287,12 @@ function We({
|
|
|
1298
1287
|
focusable: "false",
|
|
1299
1288
|
style: r === "Delete" ? { transform: "scaleX(-1)" } : void 0,
|
|
1300
1289
|
children: [
|
|
1301
|
-
/* @__PURE__ */
|
|
1302
|
-
/* @__PURE__ */
|
|
1290
|
+
/* @__PURE__ */ P("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" }),
|
|
1291
|
+
/* @__PURE__ */ P("path", { d: "m12 9 6 6m0-6-6 6" })
|
|
1303
1292
|
]
|
|
1304
1293
|
}
|
|
1305
|
-
) :
|
|
1306
|
-
/* @__PURE__ */
|
|
1294
|
+
) : u && !e.label ? /* @__PURE__ */ X("span", { className: "language-label", "aria-hidden": "true", children: [
|
|
1295
|
+
/* @__PURE__ */ X(
|
|
1307
1296
|
"svg",
|
|
1308
1297
|
{
|
|
1309
1298
|
width: "19",
|
|
@@ -1316,120 +1305,122 @@ function We({
|
|
|
1316
1305
|
strokeLinejoin: "round",
|
|
1317
1306
|
focusable: "false",
|
|
1318
1307
|
children: [
|
|
1319
|
-
/* @__PURE__ */
|
|
1320
|
-
/* @__PURE__ */
|
|
1321
|
-
/* @__PURE__ */
|
|
1308
|
+
/* @__PURE__ */ P("circle", { cx: "12", cy: "12", r: "9" }),
|
|
1309
|
+
/* @__PURE__ */ P("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
|
|
1310
|
+
/* @__PURE__ */ P("path", { d: "M3 12h18" })
|
|
1322
1311
|
]
|
|
1323
1312
|
}
|
|
1324
1313
|
),
|
|
1325
|
-
/* @__PURE__ */
|
|
1314
|
+
/* @__PURE__ */ P("span", { children: i ? "한" : "EN" })
|
|
1326
1315
|
] }) : n
|
|
1327
1316
|
}
|
|
1328
1317
|
);
|
|
1329
1318
|
}
|
|
1330
|
-
function
|
|
1319
|
+
function St({
|
|
1331
1320
|
layout: e,
|
|
1332
1321
|
viewport: n,
|
|
1333
1322
|
onHeightChange: r
|
|
1334
1323
|
}) {
|
|
1335
|
-
const
|
|
1336
|
-
inputRef:
|
|
1324
|
+
const i = Oe(), {
|
|
1325
|
+
inputRef: l,
|
|
1337
1326
|
hangulMode: s,
|
|
1338
|
-
shift:
|
|
1339
|
-
shiftLocked:
|
|
1340
|
-
theme:
|
|
1341
|
-
selectionMode:
|
|
1327
|
+
shift: f,
|
|
1328
|
+
shiftLocked: m,
|
|
1329
|
+
theme: u,
|
|
1330
|
+
selectionMode: w,
|
|
1342
1331
|
selectionAdjusting: p,
|
|
1343
|
-
activeInputPolicy:
|
|
1344
|
-
editingStatus:
|
|
1345
|
-
onBlur:
|
|
1346
|
-
} =
|
|
1347
|
-
|
|
1348
|
-
),
|
|
1349
|
-
|
|
1350
|
-
if (!
|
|
1351
|
-
const
|
|
1352
|
-
const
|
|
1353
|
-
r(
|
|
1332
|
+
activeInputPolicy: c,
|
|
1333
|
+
editingStatus: a,
|
|
1334
|
+
onBlur: x
|
|
1335
|
+
} = i, y = M(null), [ee, H] = z(!1), se = Ie(() => H((g) => !g)), re = Ie(() => x(!0)), F = ["text", "hangul", "custom"].includes(
|
|
1336
|
+
c.mode
|
|
1337
|
+
), ce = ee && F && !w ? kt : e;
|
|
1338
|
+
D(() => {
|
|
1339
|
+
if (!y.current) return;
|
|
1340
|
+
const g = () => {
|
|
1341
|
+
const v = y.current?.getBoundingClientRect().height ?? 0;
|
|
1342
|
+
r(v);
|
|
1354
1343
|
};
|
|
1355
|
-
|
|
1356
|
-
const
|
|
1357
|
-
return
|
|
1358
|
-
}, [r]),
|
|
1359
|
-
let
|
|
1360
|
-
const
|
|
1361
|
-
(
|
|
1362
|
-
),
|
|
1363
|
-
|
|
1364
|
-
},
|
|
1365
|
-
|
|
1366
|
-
},
|
|
1367
|
-
|
|
1368
|
-
},
|
|
1369
|
-
|
|
1370
|
-
},
|
|
1371
|
-
|
|
1372
|
-
},
|
|
1373
|
-
|
|
1344
|
+
g();
|
|
1345
|
+
const k = new ResizeObserver(g);
|
|
1346
|
+
return k.observe(y.current), () => k.disconnect();
|
|
1347
|
+
}, [r]), D(() => {
|
|
1348
|
+
let g = null;
|
|
1349
|
+
const k = /* @__PURE__ */ new Set(), v = (A) => A.composedPath().some(
|
|
1350
|
+
(R) => R === y.current || R instanceof Element && R.hasAttribute("data-virtual-input")
|
|
1351
|
+
), B = (A) => {
|
|
1352
|
+
k.add(A.pointerId), g = k.size !== 1 || A.button !== 0 || v(A) ? null : { x: A.clientX, y: A.clientY, id: A.pointerId };
|
|
1353
|
+
}, E = (A) => {
|
|
1354
|
+
g && g.id === A.pointerId && Math.hypot(A.clientX - g.x, A.clientY - g.y) < 10 && !v(A) && x(!0), g = null, k.delete(A.pointerId);
|
|
1355
|
+
}, $ = (A) => {
|
|
1356
|
+
g?.id === A.pointerId && Math.hypot(A.clientX - g.x, A.clientY - g.y) >= 10 && (g = null);
|
|
1357
|
+
}, j = () => {
|
|
1358
|
+
g = null;
|
|
1359
|
+
}, Y = (A) => {
|
|
1360
|
+
j(), k.delete(A.pointerId);
|
|
1361
|
+
}, q = () => {
|
|
1362
|
+
j(), k.clear();
|
|
1374
1363
|
};
|
|
1375
|
-
return window.addEventListener("pointerdown",
|
|
1376
|
-
window.removeEventListener("pointerdown",
|
|
1364
|
+
return window.addEventListener("pointerdown", B, !0), window.addEventListener("pointermove", $, !0), window.addEventListener("pointerup", E, !0), window.addEventListener("pointercancel", Y, !0), window.addEventListener("scroll", j, !0), window.addEventListener("blur", q), document.addEventListener("visibilitychange", q), () => {
|
|
1365
|
+
window.removeEventListener("pointerdown", B, !0), window.removeEventListener("pointermove", $, !0), window.removeEventListener("pointerup", E, !0), window.removeEventListener("pointercancel", Y, !0), window.removeEventListener("scroll", j, !0), window.removeEventListener("blur", q), document.removeEventListener("visibilitychange", q);
|
|
1377
1366
|
};
|
|
1378
|
-
}, [
|
|
1379
|
-
const
|
|
1380
|
-
const
|
|
1381
|
-
if (
|
|
1382
|
-
|
|
1367
|
+
}, [x]);
|
|
1368
|
+
const W = (g) => {
|
|
1369
|
+
const k = _e(g, s, f);
|
|
1370
|
+
if (g.type !== "action") {
|
|
1371
|
+
l.current?.insertText(k, xe(k)), i.consumeShift();
|
|
1383
1372
|
return;
|
|
1384
1373
|
}
|
|
1385
|
-
switch (
|
|
1374
|
+
switch (k) {
|
|
1386
1375
|
case "Undo":
|
|
1387
|
-
|
|
1376
|
+
l.current?.undo();
|
|
1388
1377
|
break;
|
|
1389
1378
|
case "Redo":
|
|
1390
|
-
|
|
1379
|
+
l.current?.redo();
|
|
1391
1380
|
break;
|
|
1392
1381
|
case "SelectAll":
|
|
1393
|
-
|
|
1382
|
+
l.current?.selectAll();
|
|
1394
1383
|
break;
|
|
1395
1384
|
case "Shift":
|
|
1396
|
-
|
|
1385
|
+
i.toggleShift();
|
|
1397
1386
|
break;
|
|
1398
1387
|
case "HangulMode":
|
|
1399
|
-
|
|
1400
|
-
new KeyboardEvent("keydown", { key:
|
|
1388
|
+
l.current?.handleKeyDown(
|
|
1389
|
+
new KeyboardEvent("keydown", { key: k })
|
|
1401
1390
|
);
|
|
1402
1391
|
break;
|
|
1403
1392
|
case "EnterSelectionMode":
|
|
1404
|
-
|
|
1393
|
+
H(!1), i.enterSelectionMode();
|
|
1405
1394
|
break;
|
|
1406
1395
|
case "ExitSelectionMode":
|
|
1407
|
-
|
|
1396
|
+
i.exitSelectionMode();
|
|
1408
1397
|
break;
|
|
1409
1398
|
case "ToggleSelectionAdjust":
|
|
1410
|
-
|
|
1399
|
+
i.toggleSelectionAdjust();
|
|
1411
1400
|
break;
|
|
1412
1401
|
case "Copy":
|
|
1413
|
-
|
|
1402
|
+
l.current?.copySelection();
|
|
1414
1403
|
break;
|
|
1415
1404
|
case "Paste":
|
|
1416
|
-
|
|
1405
|
+
l.current?.pasteClipboard();
|
|
1417
1406
|
break;
|
|
1418
1407
|
case "Cut":
|
|
1419
|
-
|
|
1408
|
+
l.current?.cutSelection();
|
|
1420
1409
|
break;
|
|
1421
1410
|
case "ArrowLeft":
|
|
1422
|
-
|
|
1411
|
+
l.current?.moveCaret("left", p);
|
|
1423
1412
|
break;
|
|
1424
1413
|
case "ArrowRight":
|
|
1425
|
-
|
|
1414
|
+
l.current?.moveCaret("right", p);
|
|
1426
1415
|
break;
|
|
1427
1416
|
default:
|
|
1428
|
-
|
|
1429
|
-
new KeyboardEvent("keydown", { key:
|
|
1417
|
+
k === " " ? l.current?.insertText(" ") : l.current?.handleKeyDown(
|
|
1418
|
+
new KeyboardEvent("keydown", { key: k })
|
|
1430
1419
|
);
|
|
1431
1420
|
}
|
|
1432
|
-
},
|
|
1421
|
+
}, G = be(c.mode) !== null, ae = ["복사했어요", "붙여넣었어요"].includes(
|
|
1422
|
+
a.message
|
|
1423
|
+
), de = {
|
|
1433
1424
|
position: "fixed",
|
|
1434
1425
|
zIndex: 9999,
|
|
1435
1426
|
boxSizing: "border-box",
|
|
@@ -1440,33 +1431,33 @@ function xt({
|
|
|
1440
1431
|
...n.height ? { top: n.offsetTop + n.height } : { bottom: 0 },
|
|
1441
1432
|
maxHeight: n.height ? n.height * 0.65 : "65dvh",
|
|
1442
1433
|
overflowY: "auto",
|
|
1443
|
-
colorScheme:
|
|
1444
|
-
background:
|
|
1445
|
-
color:
|
|
1446
|
-
border: "1px solid " + (
|
|
1434
|
+
colorScheme: u,
|
|
1435
|
+
background: u === "dark" ? "#18201f" : "#e9eeeb",
|
|
1436
|
+
color: u === "dark" ? "#eef4ef" : "#203b31",
|
|
1437
|
+
border: "1px solid " + (u === "dark" ? "#35413c" : "#c8d3cb"),
|
|
1447
1438
|
borderRadius: "20px 20px 0 0",
|
|
1448
1439
|
boxShadow: "0 -8px 48px #10251a20",
|
|
1449
1440
|
touchAction: "manipulation",
|
|
1450
1441
|
userSelect: "none",
|
|
1451
1442
|
WebkitUserSelect: "none"
|
|
1452
1443
|
};
|
|
1453
|
-
return
|
|
1454
|
-
/* @__PURE__ */
|
|
1455
|
-
|
|
1444
|
+
return Be(
|
|
1445
|
+
/* @__PURE__ */ P(
|
|
1446
|
+
Et,
|
|
1456
1447
|
{
|
|
1457
1448
|
tagName: "virtual-keypad",
|
|
1458
|
-
hostRef:
|
|
1449
|
+
hostRef: y,
|
|
1459
1450
|
"data-virtual-keypad": "true",
|
|
1460
|
-
style:
|
|
1461
|
-
onPointerDown: (
|
|
1462
|
-
|
|
1451
|
+
style: de,
|
|
1452
|
+
onPointerDown: (g) => {
|
|
1453
|
+
g.button === 0 && g.preventDefault();
|
|
1463
1454
|
},
|
|
1464
|
-
onMouseDown: (
|
|
1465
|
-
|
|
1455
|
+
onMouseDown: (g) => {
|
|
1456
|
+
g.button === 0 && g.preventDefault();
|
|
1466
1457
|
},
|
|
1467
|
-
onBlur:
|
|
1468
|
-
onKeyDown: (
|
|
1469
|
-
|
|
1458
|
+
onBlur: i.onBlur,
|
|
1459
|
+
onKeyDown: (g) => {
|
|
1460
|
+
g.key === "Escape" && (g.preventDefault(), x(!0));
|
|
1470
1461
|
},
|
|
1471
1462
|
css: `
|
|
1472
1463
|
* {
|
|
@@ -1490,6 +1481,23 @@ function xt({
|
|
|
1490
1481
|
.toolbar span {
|
|
1491
1482
|
opacity: 0.75;
|
|
1492
1483
|
}
|
|
1484
|
+
.toolbar-caption {
|
|
1485
|
+
flex: 1;
|
|
1486
|
+
min-width: 0;
|
|
1487
|
+
overflow: hidden;
|
|
1488
|
+
white-space: nowrap;
|
|
1489
|
+
text-overflow: ellipsis;
|
|
1490
|
+
}
|
|
1491
|
+
.toolbar > .close,
|
|
1492
|
+
.paste-action {
|
|
1493
|
+
flex-shrink: 0;
|
|
1494
|
+
}
|
|
1495
|
+
.paste-action .key {
|
|
1496
|
+
padding: 8px 10px;
|
|
1497
|
+
font-size: 12px;
|
|
1498
|
+
box-shadow: none;
|
|
1499
|
+
white-space: nowrap;
|
|
1500
|
+
}
|
|
1493
1501
|
.close {
|
|
1494
1502
|
background: transparent;
|
|
1495
1503
|
color: inherit;
|
|
@@ -1514,9 +1522,9 @@ function xt({
|
|
|
1514
1522
|
min-height: 44px;
|
|
1515
1523
|
border: 0;
|
|
1516
1524
|
border-radius: 8px;
|
|
1517
|
-
background: ${
|
|
1525
|
+
background: ${u === "dark" ? "#303c37" : "#fff"};
|
|
1518
1526
|
color: inherit;
|
|
1519
|
-
box-shadow: 0 2px 0 ${
|
|
1527
|
+
box-shadow: 0 2px 0 ${u === "dark" ? "#0d1611" : "#bdc9c1"};
|
|
1520
1528
|
font: inherit;
|
|
1521
1529
|
padding: 8px 0;
|
|
1522
1530
|
touch-action: none;
|
|
@@ -1524,7 +1532,7 @@ function xt({
|
|
|
1524
1532
|
user-select: none;
|
|
1525
1533
|
}
|
|
1526
1534
|
.action {
|
|
1527
|
-
background: ${
|
|
1535
|
+
background: ${u === "dark" ? "#414e46" : "#d7e1db"};
|
|
1528
1536
|
font-size: 14px;
|
|
1529
1537
|
}
|
|
1530
1538
|
.selection-count {
|
|
@@ -1596,124 +1604,138 @@ function xt({
|
|
|
1596
1604
|
}
|
|
1597
1605
|
}
|
|
1598
1606
|
`,
|
|
1599
|
-
children: /* @__PURE__ */
|
|
1600
|
-
/* @__PURE__ */
|
|
1601
|
-
|
|
1602
|
-
/* @__PURE__ */
|
|
1607
|
+
children: /* @__PURE__ */ X("section", { className: "keyboard", role: "group", "aria-label": "가상 키보드", children: [
|
|
1608
|
+
/* @__PURE__ */ X("div", { className: "toolbar", children: [
|
|
1609
|
+
a.selectionLength > 0 && !w ? /* @__PURE__ */ X(De, { children: [
|
|
1610
|
+
/* @__PURE__ */ P(
|
|
1603
1611
|
"span",
|
|
1604
1612
|
{
|
|
1605
1613
|
className: "selection-count",
|
|
1606
|
-
title:
|
|
1607
|
-
children:
|
|
1614
|
+
title: a.message || void 0,
|
|
1615
|
+
children: ae ? a.message : `${a.selectionLength}자 선택`
|
|
1608
1616
|
}
|
|
1609
1617
|
),
|
|
1610
|
-
/* @__PURE__ */
|
|
1618
|
+
/* @__PURE__ */ P(
|
|
1611
1619
|
"div",
|
|
1612
1620
|
{
|
|
1613
1621
|
className: "selection-actions",
|
|
1614
1622
|
role: "group",
|
|
1615
1623
|
"aria-label": "선택한 텍스트 편집",
|
|
1616
|
-
children: ["Copy", "Cut", "
|
|
1617
|
-
|
|
1624
|
+
children: ["Copy", "Cut", "Paste"].map((g) => /* @__PURE__ */ P(
|
|
1625
|
+
Ae,
|
|
1618
1626
|
{
|
|
1619
|
-
cell: { value:
|
|
1620
|
-
value:
|
|
1621
|
-
label:
|
|
1622
|
-
|
|
1627
|
+
cell: { value: g, type: "action" },
|
|
1628
|
+
value: g,
|
|
1629
|
+
label: ze[g],
|
|
1630
|
+
disabled: g === "Paste" && a.pasting,
|
|
1631
|
+
busy: g === "Paste" && a.pasting,
|
|
1632
|
+
dispatch: () => W({ value: g, type: "action" })
|
|
1623
1633
|
},
|
|
1624
|
-
|
|
1634
|
+
g
|
|
1625
1635
|
))
|
|
1626
1636
|
}
|
|
1627
1637
|
)
|
|
1628
|
-
] }) : /* @__PURE__ */
|
|
1629
|
-
|
|
1630
|
-
|
|
1638
|
+
] }) : /* @__PURE__ */ X("span", { className: "toolbar-caption", children: [
|
|
1639
|
+
ae ? a.message : w ? "텍스트 편집" : ee && F ? "숫자 · 기호" : c.mode === "number" ? "숫자" : c.mode === "tel" ? "전화번호" : s ? "한국어 · 두벌식" : "English",
|
|
1640
|
+
m ? " · Shift 고정" : ""
|
|
1631
1641
|
] }),
|
|
1632
|
-
|
|
1642
|
+
!w && !a.selectionLength && /* @__PURE__ */ P("div", { className: "paste-action", children: /* @__PURE__ */ P(
|
|
1643
|
+
Ae,
|
|
1644
|
+
{
|
|
1645
|
+
cell: { value: "Paste", type: "action" },
|
|
1646
|
+
value: "Paste",
|
|
1647
|
+
label: "붙여넣기",
|
|
1648
|
+
disabled: a.pasting,
|
|
1649
|
+
busy: a.pasting,
|
|
1650
|
+
dispatch: () => W({ value: "Paste", type: "action" })
|
|
1651
|
+
}
|
|
1652
|
+
) }),
|
|
1653
|
+
F && !w && !a.selectionLength && /* @__PURE__ */ P(
|
|
1633
1654
|
"button",
|
|
1634
1655
|
{
|
|
1635
1656
|
type: "button",
|
|
1636
1657
|
className: "close",
|
|
1637
1658
|
"aria-label": "숫자·기호 전환",
|
|
1638
|
-
"aria-pressed":
|
|
1639
|
-
...
|
|
1640
|
-
children:
|
|
1659
|
+
"aria-pressed": ee,
|
|
1660
|
+
...se,
|
|
1661
|
+
children: ee ? "가 / ABC" : "123 / #+="
|
|
1641
1662
|
}
|
|
1642
1663
|
),
|
|
1643
|
-
/* @__PURE__ */
|
|
1664
|
+
/* @__PURE__ */ P(
|
|
1644
1665
|
"button",
|
|
1645
1666
|
{
|
|
1646
1667
|
type: "button",
|
|
1647
1668
|
className: "close",
|
|
1648
|
-
...
|
|
1669
|
+
...re,
|
|
1649
1670
|
"aria-label": "키보드 닫기",
|
|
1650
1671
|
children: "닫기 ↓"
|
|
1651
1672
|
}
|
|
1652
1673
|
)
|
|
1653
1674
|
] }),
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
const
|
|
1657
|
-
return /* @__PURE__ */
|
|
1658
|
-
|
|
1675
|
+
a.message && !ae && /* @__PURE__ */ P("p", { className: "feedback", children: a.message }),
|
|
1676
|
+
ce.map((g, k) => /* @__PURE__ */ P("div", { className: "row", children: g.map((v, B) => {
|
|
1677
|
+
const E = _e(v, s, f), $ = v.type === "action" ? v.label ?? ze[E] ?? E : /^[A-Za-z]$/.test(v.value) ? E : v.label ?? E, j = v.value === "Shift" ? f : v.value === "HangulMode" ? s : v.value === "ToggleSelectionAdjust" ? p : void 0;
|
|
1678
|
+
return /* @__PURE__ */ P(
|
|
1679
|
+
Ae,
|
|
1659
1680
|
{
|
|
1660
|
-
cell:
|
|
1661
|
-
label:
|
|
1662
|
-
value:
|
|
1663
|
-
active:
|
|
1664
|
-
|
|
1665
|
-
|
|
1681
|
+
cell: v,
|
|
1682
|
+
label: $,
|
|
1683
|
+
value: E,
|
|
1684
|
+
active: j,
|
|
1685
|
+
busy: E === "Paste" && a.pasting,
|
|
1686
|
+
disabled: E === "Paste" && a.pasting || v.value === "HangulMode" && G || ["Copy", "Cut"].includes(E) && !a.selectionLength || E === "SelectAll" && !a.hasValue || (v.type !== "action" || E === " ") && !c.filterKey(E),
|
|
1687
|
+
dispatch: () => W(v)
|
|
1666
1688
|
},
|
|
1667
|
-
`${
|
|
1689
|
+
`${k}-${B}-${v.value}`
|
|
1668
1690
|
);
|
|
1669
|
-
}) },
|
|
1691
|
+
}) }, k))
|
|
1670
1692
|
] })
|
|
1671
1693
|
}
|
|
1672
1694
|
),
|
|
1673
1695
|
document.body
|
|
1674
1696
|
);
|
|
1675
1697
|
}
|
|
1676
|
-
const
|
|
1677
|
-
function
|
|
1678
|
-
const r =
|
|
1698
|
+
const Me = "virtual-keyboard:storage";
|
|
1699
|
+
function Lt(e, n) {
|
|
1700
|
+
const r = M(n), [i, l] = z(n), s = M(i), f = L(
|
|
1679
1701
|
() => r.current instanceof Function ? r.current() : r.current,
|
|
1680
1702
|
[]
|
|
1681
1703
|
);
|
|
1682
|
-
|
|
1683
|
-
const
|
|
1704
|
+
D(() => {
|
|
1705
|
+
const u = (a) => {
|
|
1684
1706
|
try {
|
|
1685
|
-
const
|
|
1686
|
-
return typeof
|
|
1707
|
+
const x = a === null ? f() : JSON.parse(a);
|
|
1708
|
+
return typeof x == typeof f() ? x : f();
|
|
1687
1709
|
} catch {
|
|
1688
|
-
return
|
|
1710
|
+
return f();
|
|
1689
1711
|
}
|
|
1690
|
-
},
|
|
1691
|
-
s.current =
|
|
1712
|
+
}, w = (a) => {
|
|
1713
|
+
s.current = u(a), l(s.current);
|
|
1692
1714
|
};
|
|
1693
1715
|
try {
|
|
1694
|
-
|
|
1716
|
+
w(window.localStorage.getItem(e));
|
|
1695
1717
|
} catch {
|
|
1696
1718
|
}
|
|
1697
|
-
const p = (
|
|
1719
|
+
const p = (a) => {
|
|
1698
1720
|
try {
|
|
1699
|
-
if (
|
|
1721
|
+
if (a.storageArea && a.storageArea !== window.localStorage)
|
|
1700
1722
|
return;
|
|
1701
1723
|
} catch {
|
|
1702
1724
|
return;
|
|
1703
1725
|
}
|
|
1704
|
-
(
|
|
1705
|
-
},
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1726
|
+
(a.key === e || a.key === null) && w(a.newValue);
|
|
1727
|
+
}, c = (a) => {
|
|
1728
|
+
const x = a.detail;
|
|
1729
|
+
x.key === e && w(x.raw);
|
|
1708
1730
|
};
|
|
1709
|
-
return window.addEventListener("storage", p), window.addEventListener(
|
|
1710
|
-
window.removeEventListener("storage", p), window.removeEventListener(
|
|
1731
|
+
return window.addEventListener("storage", p), window.addEventListener(Me, c), () => {
|
|
1732
|
+
window.removeEventListener("storage", p), window.removeEventListener(Me, c);
|
|
1711
1733
|
};
|
|
1712
|
-
}, [e,
|
|
1713
|
-
const
|
|
1714
|
-
(
|
|
1715
|
-
s.current =
|
|
1716
|
-
new CustomEvent(
|
|
1734
|
+
}, [e, f]);
|
|
1735
|
+
const m = L(
|
|
1736
|
+
(u) => {
|
|
1737
|
+
s.current = u instanceof Function ? u(s.current) : u, l(s.current), window.dispatchEvent(
|
|
1738
|
+
new CustomEvent(Me, {
|
|
1717
1739
|
detail: { key: e, raw: JSON.stringify(s.current) }
|
|
1718
1740
|
})
|
|
1719
1741
|
);
|
|
@@ -1724,9 +1746,9 @@ function kt(e, n) {
|
|
|
1724
1746
|
},
|
|
1725
1747
|
[e]
|
|
1726
1748
|
);
|
|
1727
|
-
return [
|
|
1749
|
+
return [i, m];
|
|
1728
1750
|
}
|
|
1729
|
-
const
|
|
1751
|
+
const Ct = [
|
|
1730
1752
|
[
|
|
1731
1753
|
{
|
|
1732
1754
|
label: "전체 선택",
|
|
@@ -1806,7 +1828,7 @@ const St = [
|
|
|
1806
1828
|
type: "action"
|
|
1807
1829
|
}
|
|
1808
1830
|
]
|
|
1809
|
-
],
|
|
1831
|
+
], At = () => typeof window > "u" ? { width: 0, height: 0, scale: 1, offsetLeft: 0, offsetTop: 0 } : typeof window < "u" && window.visualViewport ? {
|
|
1810
1832
|
width: window.visualViewport.width,
|
|
1811
1833
|
height: window.visualViewport.height,
|
|
1812
1834
|
scale: window.visualViewport.scale,
|
|
@@ -1818,191 +1840,197 @@ const St = [
|
|
|
1818
1840
|
scale: 1,
|
|
1819
1841
|
offsetLeft: 0,
|
|
1820
1842
|
offsetTop: 0
|
|
1821
|
-
},
|
|
1822
|
-
const [e, n] =
|
|
1843
|
+
}, Mt = (e, n) => e.width === n.width && e.height === n.height && e.scale === n.scale && e.offsetLeft === n.offsetLeft && e.offsetTop === n.offsetTop, Pt = () => {
|
|
1844
|
+
const [e, n] = z(() => ({
|
|
1823
1845
|
width: 0,
|
|
1824
1846
|
height: 0,
|
|
1825
1847
|
scale: 1,
|
|
1826
1848
|
offsetLeft: 0,
|
|
1827
1849
|
offsetTop: 0
|
|
1828
1850
|
}));
|
|
1829
|
-
return
|
|
1851
|
+
return D(() => {
|
|
1830
1852
|
if (typeof window > "u") return;
|
|
1831
1853
|
let r = null;
|
|
1832
|
-
const
|
|
1833
|
-
const s =
|
|
1854
|
+
const i = () => {
|
|
1855
|
+
const s = At();
|
|
1834
1856
|
n(
|
|
1835
|
-
(
|
|
1857
|
+
(f) => Mt(f, s) ? f : s
|
|
1836
1858
|
);
|
|
1837
1859
|
};
|
|
1838
|
-
|
|
1839
|
-
const
|
|
1840
|
-
r !== null && cancelAnimationFrame(r), r = requestAnimationFrame(
|
|
1860
|
+
i();
|
|
1861
|
+
const l = () => {
|
|
1862
|
+
r !== null && cancelAnimationFrame(r), r = requestAnimationFrame(i);
|
|
1841
1863
|
};
|
|
1842
|
-
return window.visualViewport ? (window.visualViewport.addEventListener("resize",
|
|
1864
|
+
return window.visualViewport ? (window.visualViewport.addEventListener("resize", l, {
|
|
1843
1865
|
passive: !0
|
|
1844
|
-
}), window.visualViewport.addEventListener("scroll",
|
|
1866
|
+
}), window.visualViewport.addEventListener("scroll", l, {
|
|
1845
1867
|
passive: !0
|
|
1846
|
-
})) : window.addEventListener("resize",
|
|
1847
|
-
r !== null && cancelAnimationFrame(r), window.visualViewport ? (window.visualViewport.removeEventListener("resize",
|
|
1868
|
+
})) : window.addEventListener("resize", l, { passive: !0 }), () => {
|
|
1869
|
+
r !== null && cancelAnimationFrame(r), window.visualViewport ? (window.visualViewport.removeEventListener("resize", l), window.visualViewport.removeEventListener("scroll", l)) : window.removeEventListener("resize", l);
|
|
1848
1870
|
};
|
|
1849
1871
|
}, []), e;
|
|
1850
1872
|
};
|
|
1851
|
-
function
|
|
1852
|
-
const [e, n] =
|
|
1853
|
-
return
|
|
1873
|
+
function Tt() {
|
|
1874
|
+
const [e, n] = z("light");
|
|
1875
|
+
return D(() => {
|
|
1854
1876
|
if (typeof window > "u" || !window.matchMedia) return;
|
|
1855
1877
|
const r = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1856
1878
|
n(r.matches ? "dark" : "light");
|
|
1857
|
-
const
|
|
1858
|
-
n(
|
|
1879
|
+
const i = (l) => {
|
|
1880
|
+
n(l.matches ? "dark" : "light");
|
|
1859
1881
|
};
|
|
1860
|
-
return r.addEventListener("change",
|
|
1882
|
+
return r.addEventListener("change", i), () => r.removeEventListener("change", i);
|
|
1861
1883
|
}, []), e;
|
|
1862
1884
|
}
|
|
1863
|
-
function
|
|
1885
|
+
function et(e) {
|
|
1864
1886
|
return e !== void 0 ? /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
1865
1887
|
e
|
|
1866
|
-
) : typeof navigator > "u" ? !1 :
|
|
1888
|
+
) : typeof navigator > "u" ? !1 : et(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 || typeof window < "u" && !!window.matchMedia?.("(pointer: coarse)").matches;
|
|
1867
1889
|
}
|
|
1868
|
-
const
|
|
1869
|
-
function
|
|
1890
|
+
const Pe = "virtual-keyboard:focus-change";
|
|
1891
|
+
function Bt({
|
|
1870
1892
|
children: e,
|
|
1871
|
-
layout: n =
|
|
1893
|
+
layout: n = oe,
|
|
1872
1894
|
defaultHangulMode: r = !0,
|
|
1873
|
-
theme:
|
|
1874
|
-
keyboardVisibility:
|
|
1895
|
+
theme: i,
|
|
1896
|
+
keyboardVisibility: l = "auto"
|
|
1875
1897
|
}) {
|
|
1876
|
-
const s =
|
|
1898
|
+
const s = Je(), f = M(null), m = M(null), u = M(
|
|
1877
1899
|
void 0
|
|
1878
|
-
), [
|
|
1900
|
+
), [w, p] = z(), [c, a] = z(0), [x, y] = z(!1), [ee, H] = z(!1), [se, re] = z({
|
|
1879
1901
|
selectionLength: 0,
|
|
1880
1902
|
hasValue: !1,
|
|
1881
|
-
message: ""
|
|
1882
|
-
|
|
1903
|
+
message: "",
|
|
1904
|
+
pasting: !1
|
|
1905
|
+
}), F = L((h) => {
|
|
1906
|
+
re(
|
|
1907
|
+
(C) => C.selectionLength === h.selectionLength && C.hasValue === h.hasValue && C.message === h.message && C.pasting === h.pasting ? C : h
|
|
1908
|
+
);
|
|
1909
|
+
}, []), [ce, W] = Lt(
|
|
1883
1910
|
"virtual-keyboard-hangul-mode",
|
|
1884
1911
|
r
|
|
1885
|
-
), [
|
|
1886
|
-
() =>
|
|
1887
|
-
), [
|
|
1888
|
-
|
|
1889
|
-
const
|
|
1890
|
-
|
|
1891
|
-
const
|
|
1892
|
-
return
|
|
1912
|
+
), [G, ae] = z(
|
|
1913
|
+
() => Te({ layout: n })
|
|
1914
|
+
), [de, g] = z(!1), [k, v] = z(0), B = Pt(), E = Tt(), $ = be(G.mode) ?? ce, j = !!w && (l === "always" || l === "auto" && de), Y = M(j);
|
|
1915
|
+
Y.current = j, D(() => {
|
|
1916
|
+
const h = () => g(et());
|
|
1917
|
+
h();
|
|
1918
|
+
const C = window.matchMedia?.("(pointer: coarse)");
|
|
1919
|
+
return C?.addEventListener("change", h), () => C?.removeEventListener("change", h);
|
|
1893
1920
|
}, []);
|
|
1894
|
-
const
|
|
1895
|
-
clearTimeout(
|
|
1921
|
+
const q = L(() => {
|
|
1922
|
+
clearTimeout(u.current), m.current = null, f.current = null, p(void 0), a(0), y(!1), H(!1);
|
|
1896
1923
|
}, []);
|
|
1897
|
-
|
|
1898
|
-
const
|
|
1899
|
-
|
|
1924
|
+
D(() => {
|
|
1925
|
+
const h = (C) => {
|
|
1926
|
+
C.detail !== s && q();
|
|
1900
1927
|
};
|
|
1901
|
-
return window.addEventListener(
|
|
1902
|
-
window.removeEventListener(
|
|
1928
|
+
return window.addEventListener(Pe, h), () => {
|
|
1929
|
+
window.removeEventListener(Pe, h), clearTimeout(u.current);
|
|
1903
1930
|
};
|
|
1904
|
-
}, [s,
|
|
1905
|
-
const
|
|
1906
|
-
(
|
|
1907
|
-
clearTimeout(
|
|
1908
|
-
new CustomEvent(
|
|
1931
|
+
}, [s, q]);
|
|
1932
|
+
const A = L(
|
|
1933
|
+
(h, C, U) => {
|
|
1934
|
+
clearTimeout(u.current), m.current !== C && (a(0), y(!1), H(!1)), m.current = C, ae(Te(U)), p(h), window.dispatchEvent(
|
|
1935
|
+
new CustomEvent(Pe, { detail: s })
|
|
1909
1936
|
);
|
|
1910
1937
|
},
|
|
1911
1938
|
[s]
|
|
1912
|
-
),
|
|
1913
|
-
(
|
|
1914
|
-
if (
|
|
1915
|
-
|
|
1939
|
+
), R = L(
|
|
1940
|
+
(h) => {
|
|
1941
|
+
if (h === !0) {
|
|
1942
|
+
const U = document.activeElement, T = U instanceof HTMLElement && m.current?.contains(U);
|
|
1943
|
+
q(), T && U.blur();
|
|
1916
1944
|
return;
|
|
1917
1945
|
}
|
|
1918
|
-
const
|
|
1919
|
-
|
|
1946
|
+
const C = typeof h == "object" ? h.relatedTarget : null;
|
|
1947
|
+
C?.closest?.("[data-virtual-input], [data-virtual-keypad]") || !C && Y.current || (clearTimeout(u.current), u.current = setTimeout(q, 0));
|
|
1920
1948
|
},
|
|
1921
|
-
[
|
|
1949
|
+
[q]
|
|
1922
1950
|
);
|
|
1923
|
-
|
|
1924
|
-
if (!
|
|
1925
|
-
const
|
|
1926
|
-
const
|
|
1927
|
-
if (!
|
|
1928
|
-
const
|
|
1929
|
-
|
|
1951
|
+
D(() => {
|
|
1952
|
+
if (!j || !k || B.scale !== 1) return;
|
|
1953
|
+
const h = requestAnimationFrame(() => {
|
|
1954
|
+
const C = m.current?.getBoundingClientRect();
|
|
1955
|
+
if (!C) return;
|
|
1956
|
+
const U = B.offsetTop + B.height - k - 16;
|
|
1957
|
+
C.bottom > U && window.scrollBy({ top: C.bottom - U, behavior: "instant" });
|
|
1930
1958
|
});
|
|
1931
|
-
return () => cancelAnimationFrame(
|
|
1959
|
+
return () => cancelAnimationFrame(h);
|
|
1932
1960
|
}, [
|
|
1961
|
+
w,
|
|
1962
|
+
j,
|
|
1933
1963
|
k,
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
A.offsetTop,
|
|
1938
|
-
A.scale
|
|
1964
|
+
B.height,
|
|
1965
|
+
B.offsetTop,
|
|
1966
|
+
B.scale
|
|
1939
1967
|
]);
|
|
1940
|
-
const
|
|
1941
|
-
|
|
1942
|
-
}, [
|
|
1943
|
-
() =>
|
|
1968
|
+
const ge = L(() => {
|
|
1969
|
+
be(G.mode) === null && W((h) => !h);
|
|
1970
|
+
}, [G.mode, W]), N = L(
|
|
1971
|
+
() => a((h) => (h + 1) % 3),
|
|
1944
1972
|
[]
|
|
1945
|
-
),
|
|
1946
|
-
() =>
|
|
1973
|
+
), d = L(
|
|
1974
|
+
() => a((h) => h === 1 ? 0 : h),
|
|
1947
1975
|
[]
|
|
1948
|
-
),
|
|
1949
|
-
|
|
1950
|
-
}, []), le =
|
|
1951
|
-
|
|
1952
|
-
}, []),
|
|
1953
|
-
() =>
|
|
1976
|
+
), fe = L(() => {
|
|
1977
|
+
y(!0), H(!1);
|
|
1978
|
+
}, []), le = L(() => {
|
|
1979
|
+
y(!1), H(!1);
|
|
1980
|
+
}, []), Q = L(
|
|
1981
|
+
() => H((h) => !h),
|
|
1954
1982
|
[]
|
|
1955
1983
|
);
|
|
1956
|
-
return /* @__PURE__ */
|
|
1957
|
-
|
|
1984
|
+
return /* @__PURE__ */ X(
|
|
1985
|
+
Qe.Provider,
|
|
1958
1986
|
{
|
|
1959
1987
|
value: {
|
|
1960
|
-
inputRef:
|
|
1961
|
-
focusId:
|
|
1962
|
-
onFocus:
|
|
1963
|
-
onBlur:
|
|
1988
|
+
inputRef: f,
|
|
1989
|
+
focusId: w,
|
|
1990
|
+
onFocus: A,
|
|
1991
|
+
onBlur: R,
|
|
1964
1992
|
defaultLayout: n,
|
|
1965
|
-
hangulMode:
|
|
1966
|
-
shift:
|
|
1967
|
-
shiftLocked:
|
|
1968
|
-
theme:
|
|
1969
|
-
toggleKorean:
|
|
1970
|
-
toggleShift:
|
|
1971
|
-
consumeShift:
|
|
1972
|
-
selectionMode:
|
|
1973
|
-
selectionAdjusting:
|
|
1974
|
-
enterSelectionMode:
|
|
1993
|
+
hangulMode: $,
|
|
1994
|
+
shift: c > 0,
|
|
1995
|
+
shiftLocked: c === 2,
|
|
1996
|
+
theme: i ?? E,
|
|
1997
|
+
toggleKorean: ge,
|
|
1998
|
+
toggleShift: N,
|
|
1999
|
+
consumeShift: d,
|
|
2000
|
+
selectionMode: x,
|
|
2001
|
+
selectionAdjusting: ee,
|
|
2002
|
+
enterSelectionMode: fe,
|
|
1975
2003
|
exitSelectionMode: le,
|
|
1976
|
-
toggleSelectionAdjust:
|
|
1977
|
-
activeInputPolicy:
|
|
1978
|
-
editingStatus:
|
|
1979
|
-
setEditingStatus:
|
|
2004
|
+
toggleSelectionAdjust: Q,
|
|
2005
|
+
activeInputPolicy: G,
|
|
2006
|
+
editingStatus: se,
|
|
2007
|
+
setEditingStatus: F
|
|
1980
2008
|
},
|
|
1981
2009
|
children: [
|
|
1982
2010
|
e,
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
/* @__PURE__ */
|
|
2011
|
+
j && /* @__PURE__ */ X(De, { children: [
|
|
2012
|
+
Be(
|
|
2013
|
+
/* @__PURE__ */ P(
|
|
1986
2014
|
"div",
|
|
1987
2015
|
{
|
|
1988
2016
|
"aria-hidden": "true",
|
|
1989
2017
|
style: {
|
|
1990
|
-
height:
|
|
2018
|
+
height: k,
|
|
1991
2019
|
pointerEvents: "none",
|
|
1992
|
-
background: (
|
|
2020
|
+
background: (i ?? E) === "dark" ? "#121c17" : "#f7f8f4"
|
|
1993
2021
|
}
|
|
1994
2022
|
}
|
|
1995
2023
|
),
|
|
1996
2024
|
document.body
|
|
1997
2025
|
),
|
|
1998
|
-
/* @__PURE__ */
|
|
1999
|
-
|
|
2026
|
+
/* @__PURE__ */ P(
|
|
2027
|
+
St,
|
|
2000
2028
|
{
|
|
2001
|
-
layout:
|
|
2002
|
-
viewport:
|
|
2003
|
-
onHeightChange:
|
|
2029
|
+
layout: x ? Ct : G.layout,
|
|
2030
|
+
viewport: B,
|
|
2031
|
+
onHeightChange: v
|
|
2004
2032
|
},
|
|
2005
|
-
|
|
2033
|
+
w
|
|
2006
2034
|
)
|
|
2007
2035
|
] })
|
|
2008
2036
|
]
|
|
@@ -2011,5 +2039,5 @@ function Kt({
|
|
|
2011
2039
|
}
|
|
2012
2040
|
export {
|
|
2013
2041
|
Dt as VirtualInput,
|
|
2014
|
-
|
|
2042
|
+
Bt as VirtualInputProvider
|
|
2015
2043
|
};
|