@uiwwsw/virtual-keyboard 2.2.1 → 2.2.2
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.en.md +73 -41
- package/README.md +72 -182
- package/dist/index.js +222 -221
- package/package.json +15 -17
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useContext as st, createContext as ut, forwardRef as dt, useId as et, useCallback as E, useRef as
|
|
2
|
+
import { jsxs as Z, jsx as P, Fragment as He } from "react/jsx-runtime";
|
|
3
|
+
import { useContext as st, createContext as ut, forwardRef as dt, useId as et, useCallback as E, useRef as T, useState as R, useMemo as Ge, useEffect as B, useImperativeHandle as pt, useLayoutEffect as ft, createElement as ht } from "react";
|
|
4
4
|
import { convertQwertyToHangul as tt, assemble as gt, removeLastCharacter as mt } from "es-hangul";
|
|
5
|
-
import { createPortal as
|
|
5
|
+
import { createPortal as je } from "react-dom";
|
|
6
6
|
const yt = {
|
|
7
7
|
"자유 입력": "Free text",
|
|
8
8
|
"한글과 영문을 오가며 자유롭게 입력해 보세요. 한 / EN 키로 언어를 바꿀 수 있습니다.": "Type in Korean or English. Use the 한 / EN key to switch input languages.",
|
|
@@ -36,17 +36,17 @@ const yt = {
|
|
|
36
36
|
"Virtual Keyboard 홈": "Virtual Keyboard home",
|
|
37
37
|
"주요 메뉴": "Main navigation",
|
|
38
38
|
"사용 방법": "Usage guide",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"한글
|
|
42
|
-
"
|
|
39
|
+
"React 화면 키보드로": "With a React on-screen keyboard",
|
|
40
|
+
"한글을 입력합니다.": "type Korean.",
|
|
41
|
+
"한글 두벌식, 영문, 숫자, 전화번호 키패드와 사용자 정의 레이아웃.": "Korean two-set, English, number and phone keypads, and custom layouts.",
|
|
42
|
+
"한글 조합 계산은 es-hangul을 사용합니다.": "Hangul composition uses es-hangul.",
|
|
43
43
|
"직접 눌러보기": "Try the keyboard",
|
|
44
|
-
"
|
|
44
|
+
"ㅎ + ㅏ + ㄴ = 한": "ㅎ + ㅏ + ㄴ = 한",
|
|
45
45
|
"한글 조합": "Korean composition",
|
|
46
|
-
"
|
|
46
|
+
"초성·중성·종성 조합": "Initial, medial and final jamo",
|
|
47
47
|
"7가지 모드": "7 input modes",
|
|
48
48
|
"입력에 맞춘 키패드": "A keypad for each input",
|
|
49
|
-
"
|
|
49
|
+
"컴포넌트 두 개": "Two components",
|
|
50
50
|
"눌러보면 알 수 있어요.": "Try it for yourself.",
|
|
51
51
|
테마: "Theme",
|
|
52
52
|
"☀ 라이트": "☀ Light",
|
|
@@ -109,7 +109,8 @@ const yt = {
|
|
|
109
109
|
키보드: "Keyboard",
|
|
110
110
|
"범위 조절": "Adjust range"
|
|
111
111
|
};
|
|
112
|
-
|
|
112
|
+
typeof window < "u" && /^\/en(?:\/|$)/.test(window.location.pathname) || typeof __DEMO_LOCALE__ < "u" && __DEMO_LOCALE__;
|
|
113
|
+
function Fe(e, n) {
|
|
113
114
|
return n === "en" ? yt[e] ?? e : e;
|
|
114
115
|
}
|
|
115
116
|
class vt {
|
|
@@ -542,7 +543,7 @@ function Ve(e) {
|
|
|
542
543
|
};
|
|
543
544
|
}
|
|
544
545
|
const Et = new Intl.Segmenter(void 0, { granularity: "grapheme" }), Ne = (e) => Array.from(Et.segment(e));
|
|
545
|
-
function
|
|
546
|
+
function W(e, n) {
|
|
546
547
|
return [
|
|
547
548
|
...Ne(e).map((a) => a.index),
|
|
548
549
|
e.length
|
|
@@ -601,21 +602,21 @@ function St(e, n, r, a, l, c) {
|
|
|
601
602
|
for (; f < e.value.length && f < n.length && e.value[f] === n[f]; )
|
|
602
603
|
f++;
|
|
603
604
|
f = Math.min(
|
|
604
|
-
|
|
605
|
-
|
|
605
|
+
W(e.value, f),
|
|
606
|
+
W(n, f)
|
|
606
607
|
);
|
|
607
608
|
let v = e.value.length, u = n.length;
|
|
608
609
|
for (; v > f && u > f && e.value[v - 1] === n[u - 1]; )
|
|
609
610
|
v--, u--;
|
|
610
|
-
for (;
|
|
611
|
+
for (; W(e.value, v) !== v || W(n, u) !== u; )
|
|
611
612
|
v < e.value.length && v++, u < n.length && u++;
|
|
612
613
|
const w = n.slice(f, u), d = a(w).replace(/[\r\n\t]+/g, " ");
|
|
613
614
|
if (w && (!d || !l(d))) return e;
|
|
614
615
|
const i = { ...e, anchor: f, caret: v, composing: !1 }, s = w ? ze(i, d, !1, c) : ke(i, -1);
|
|
615
616
|
if (s === i) return e;
|
|
616
|
-
const h = (
|
|
617
|
+
const h = (L) => W(
|
|
617
618
|
s.value,
|
|
618
|
-
|
|
619
|
+
L <= f ? L : L >= u ? L + d.length - w.length : f + a(w.slice(0, L - f)).replace(/[\r\n\t]+/g, " ").length
|
|
619
620
|
);
|
|
620
621
|
return {
|
|
621
622
|
...s,
|
|
@@ -623,7 +624,7 @@ function St(e, n, r, a, l, c) {
|
|
|
623
624
|
caret: h(r.backward ? r.start : r.end)
|
|
624
625
|
};
|
|
625
626
|
}
|
|
626
|
-
const
|
|
627
|
+
const Lt = typeof window > "u" ? B : ft, jt = dt(
|
|
627
628
|
function({
|
|
628
629
|
value: n,
|
|
629
630
|
defaultValue: r = "",
|
|
@@ -638,32 +639,32 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
638
639
|
disabled: i = !1,
|
|
639
640
|
readOnly: s = !1,
|
|
640
641
|
maxLength: h,
|
|
641
|
-
...
|
|
642
|
+
...L
|
|
642
643
|
}, $) {
|
|
643
644
|
const U = et(), {
|
|
644
|
-
focusId:
|
|
645
|
+
focusId: X,
|
|
645
646
|
onFocus: oe,
|
|
646
|
-
onBlur:
|
|
647
|
+
onBlur: _,
|
|
647
648
|
defaultLayout: O,
|
|
648
649
|
inputRef: ee,
|
|
649
650
|
hangulMode: te,
|
|
650
651
|
theme: G,
|
|
651
652
|
toggleKorean: ie,
|
|
652
653
|
setEditingStatus: ue
|
|
653
|
-
} = xe(), { locale: g } = xe(), m = E((t) =>
|
|
654
|
+
} = xe(), { locale: g } = xe(), m = E((t) => Fe(t, g), [g]), C = T(null), k = T(null), M = T(!1), H = T(!1), z = T(null), [le, j] = R(null), [A, ne] = R(!1), [q, ye] = R(() => ({
|
|
654
655
|
value: n ?? r,
|
|
655
656
|
caret: (n ?? r).length,
|
|
656
657
|
anchor: (n ?? r).length,
|
|
657
658
|
composing: !1
|
|
658
|
-
})),
|
|
659
|
+
})), F = n ?? q.value, p = T(q), fe = T(0), de = T(new vt()), y = T(!1), b = X === U, N = T(b);
|
|
659
660
|
N.current = b;
|
|
660
|
-
const he = n !== void 0 && n !==
|
|
661
|
+
const he = n !== void 0 && n !== q.value;
|
|
661
662
|
he && de.current.clear(), p.current = {
|
|
662
|
-
...
|
|
663
|
-
value:
|
|
664
|
-
caret:
|
|
665
|
-
anchor:
|
|
666
|
-
composing: he ? !1 :
|
|
663
|
+
...q,
|
|
664
|
+
value: F,
|
|
665
|
+
caret: W(F, q.caret),
|
|
666
|
+
anchor: W(F, q.anchor),
|
|
667
|
+
composing: he ? !1 : q.composing
|
|
667
668
|
};
|
|
668
669
|
const V = Ge(
|
|
669
670
|
() => Ve({
|
|
@@ -673,28 +674,28 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
673
674
|
sanitizeValue: d
|
|
674
675
|
}),
|
|
675
676
|
[v, u, O, w, d]
|
|
676
|
-
), [
|
|
677
|
+
), [Le, Y] = R(""), [$e, Ue] = R(!1), re = T(null), ve = T(null), ge = T({ disabled: i, readOnly: s, policy: V, maxLength: h });
|
|
677
678
|
ge.current = { disabled: i, readOnly: s, policy: V, maxLength: h };
|
|
678
679
|
const Q = E(() => {
|
|
679
680
|
re.current && (re.current = null, Ue(!1));
|
|
680
681
|
}, []);
|
|
681
|
-
|
|
682
|
+
B(() => {
|
|
682
683
|
const t = re.current;
|
|
683
|
-
t && (!b || i || s || t.policy !== V || t.maxLength !== h || t.value !==
|
|
684
|
+
t && (!b || i || s || t.policy !== V || t.maxLength !== h || t.value !== F) && Q();
|
|
684
685
|
}, [
|
|
685
686
|
b,
|
|
686
687
|
i,
|
|
687
688
|
s,
|
|
688
689
|
V,
|
|
689
690
|
h,
|
|
690
|
-
|
|
691
|
+
F,
|
|
691
692
|
Q
|
|
692
693
|
]);
|
|
693
694
|
const S = E(
|
|
694
695
|
(t, o = !0, x = !1) => {
|
|
695
696
|
Q();
|
|
696
697
|
const D = p.current.value;
|
|
697
|
-
if (o && de.current.record(p.current, t), M.current = !x, p.current = t, fe.current++,
|
|
698
|
+
if (o && de.current.record(p.current, t), M.current = !x, p.current = t, fe.current++, Y(""), ye(t), t.value !== D) {
|
|
698
699
|
c?.(t.value);
|
|
699
700
|
const I = { value: t.value };
|
|
700
701
|
l?.({
|
|
@@ -708,47 +709,47 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
708
709
|
const t = k.current;
|
|
709
710
|
if (!t || i || M.current || t.value !== p.current.value || H.current)
|
|
710
711
|
return null;
|
|
711
|
-
const o = t.selectionStart ?? 0, x = t.selectionEnd ?? o, D = t.selectionDirection === "backward" ? { anchor: x, caret: o } : { anchor: o, caret: x }, I =
|
|
712
|
+
const o = t.selectionStart ?? 0, x = t.selectionEnd ?? o, D = t.selectionDirection === "backward" ? { anchor: x, caret: o } : { anchor: o, caret: x }, I = W(p.current.value, D.anchor), J = W(p.current.value, D.caret);
|
|
712
713
|
return (I !== p.current.anchor || J !== p.current.caret || I !== D.anchor || J !== D.caret) && S(
|
|
713
714
|
{ ...p.current, anchor: I, caret: J, composing: !1 },
|
|
714
715
|
!1,
|
|
715
716
|
I === D.anchor && J === D.caret
|
|
716
717
|
), { anchor: I, caret: J };
|
|
717
718
|
}, [i, S]);
|
|
718
|
-
|
|
719
|
+
B(() => {
|
|
719
720
|
const t = () => {
|
|
720
721
|
document.activeElement === k.current && K();
|
|
721
722
|
}, o = k.current;
|
|
722
723
|
return document.addEventListener("selectionchange", t), o?.addEventListener("select", t), () => {
|
|
723
724
|
document.removeEventListener("selectionchange", t), o?.removeEventListener("select", t);
|
|
724
725
|
};
|
|
725
|
-
}, [K, m]),
|
|
726
|
-
if (z.current && z.current.value !==
|
|
726
|
+
}, [K, m]), Lt(() => {
|
|
727
|
+
if (z.current && z.current.value !== F && (H.current = !1, z.current = null, j(null)), !i && k.current && !H.current && (M.current || he)) {
|
|
727
728
|
const { anchor: t, caret: o } = p.current, x = Math.min(t, o), D = Math.max(t, o), I = t > o ? "backward" : "forward";
|
|
728
729
|
(k.current.selectionStart !== x || k.current.selectionEnd !== D || x !== D && k.current.selectionDirection !== I) && k.current.setSelectionRange(x, D, I);
|
|
729
730
|
}
|
|
730
|
-
M.current = !1, ve.current !== null && (
|
|
731
|
-
|
|
731
|
+
M.current = !1, ve.current !== null && (Y(
|
|
732
|
+
F === ve.current ? m("붙여넣었어요") : m("입력값이 적용되지 않았어요")
|
|
732
733
|
), ve.current = null);
|
|
733
|
-
}),
|
|
734
|
+
}), B(() => {
|
|
734
735
|
if (!b) return;
|
|
735
736
|
const [t, o] = se(p.current);
|
|
736
737
|
ue({
|
|
737
|
-
selectionLength: Ne(
|
|
738
|
-
hasValue: !!
|
|
739
|
-
message:
|
|
738
|
+
selectionLength: Ne(F.slice(t, o)).length,
|
|
739
|
+
hasValue: !!F,
|
|
740
|
+
message: Le,
|
|
740
741
|
pasting: $e
|
|
741
742
|
});
|
|
742
743
|
}, [
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
744
|
+
F,
|
|
745
|
+
q.anchor,
|
|
746
|
+
q.caret,
|
|
747
|
+
Le,
|
|
747
748
|
$e,
|
|
748
749
|
b,
|
|
749
750
|
ue
|
|
750
751
|
]);
|
|
751
|
-
const
|
|
752
|
+
const Ce = E(
|
|
752
753
|
(t, o = !1) => {
|
|
753
754
|
if (i || s) return;
|
|
754
755
|
K();
|
|
@@ -760,27 +761,27 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
760
761
|
(t) => {
|
|
761
762
|
if (i || s || H.current) return;
|
|
762
763
|
if (K(), !t) {
|
|
763
|
-
|
|
764
|
+
Y(m("붙여넣을 텍스트가 없어요"));
|
|
764
765
|
return;
|
|
765
766
|
}
|
|
766
767
|
const o = V.sanitizeValue(t).replace(/[\r\n\t]+/g, " ");
|
|
767
768
|
if (!o || !V.filterKey(o)) {
|
|
768
|
-
|
|
769
|
+
Y(m("이 입력란에 붙여넣을 수 없는 내용이에요"));
|
|
769
770
|
return;
|
|
770
771
|
}
|
|
771
772
|
const x = ze(p.current, o, !1, h);
|
|
772
773
|
if (x === p.current) {
|
|
773
|
-
|
|
774
|
+
Y(m("입력 길이 제한을 초과했어요"));
|
|
774
775
|
return;
|
|
775
776
|
}
|
|
776
777
|
ve.current = x.value, S(x), k.current?.focus({ preventScroll: !0 });
|
|
777
778
|
},
|
|
778
779
|
[i, s, V, h, K, S, m]
|
|
779
|
-
),
|
|
780
|
+
), Te = E(() => {
|
|
780
781
|
!i && !s && S(de.current.undo(p.current), !1);
|
|
781
|
-
}, [i, s, S]),
|
|
782
|
+
}, [i, s, S]), Pe = E(() => {
|
|
782
783
|
!i && !s && S(de.current.redo(p.current), !1);
|
|
783
|
-
}, [i, s, S]),
|
|
784
|
+
}, [i, s, S]), _e = E(
|
|
784
785
|
() => S({
|
|
785
786
|
...p.current,
|
|
786
787
|
caret: p.current.value.length,
|
|
@@ -788,18 +789,18 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
788
789
|
composing: !1
|
|
789
790
|
}),
|
|
790
791
|
[S]
|
|
791
|
-
),
|
|
792
|
+
), qe = E(
|
|
792
793
|
(t, o = !1) => {
|
|
793
794
|
K(), S(Qe(p.current, t === "left" ? -1 : 1, o));
|
|
794
795
|
},
|
|
795
796
|
[S, K]
|
|
796
797
|
), at = (t) => {
|
|
797
|
-
if (
|
|
798
|
+
if (L.onKeyDown?.(t), t.defaultPrevented || i || H.current || t.nativeEvent.isComposing || t.keyCode === 229)
|
|
798
799
|
return;
|
|
799
800
|
K();
|
|
800
801
|
const o = t.key;
|
|
801
802
|
if (o === "Escape") {
|
|
802
|
-
t.preventDefault(), S({ ...p.current, composing: !1 }),
|
|
803
|
+
t.preventDefault(), S({ ...p.current, composing: !1 }), _(!0), k.current?.blur();
|
|
803
804
|
return;
|
|
804
805
|
}
|
|
805
806
|
if (o === "HangulMode") {
|
|
@@ -808,7 +809,7 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
808
809
|
}
|
|
809
810
|
const x = t.ctrlKey || t.metaKey;
|
|
810
811
|
if (x && ["z", "y"].includes(o.toLowerCase())) {
|
|
811
|
-
t.preventDefault(), o.toLowerCase() === "y" || t.shiftKey ?
|
|
812
|
+
t.preventDefault(), o.toLowerCase() === "y" || t.shiftKey ? Pe() : Te();
|
|
812
813
|
return;
|
|
813
814
|
}
|
|
814
815
|
if (x && o.toLowerCase() === "a") {
|
|
@@ -838,11 +839,11 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
838
839
|
t,
|
|
839
840
|
Ee(V.mode) ?? te
|
|
840
841
|
);
|
|
841
|
-
I.handled && I.text && (t.preventDefault(), V.filterKey(I.text) &&
|
|
842
|
+
I.handled && I.text && (t.preventDefault(), V.filterKey(I.text) && Ce(I.text, I.composing));
|
|
842
843
|
}, pe = E(
|
|
843
844
|
(t) => {
|
|
844
845
|
const o = t instanceof Error ? t : new Error(String(t));
|
|
845
|
-
y.current && (
|
|
846
|
+
y.current && (Y(
|
|
846
847
|
m(
|
|
847
848
|
"클립보드에 접근할 수 없습니다. 입력란을 길게 눌러 기본 편집 메뉴를 사용해 주세요."
|
|
848
849
|
)
|
|
@@ -877,18 +878,18 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
877
878
|
ae instanceof HTMLElement && ae !== J && Je && ae.focus({ preventScroll: !0 });
|
|
878
879
|
}
|
|
879
880
|
}
|
|
880
|
-
y.current &&
|
|
881
|
-
}, [K, m]),
|
|
881
|
+
y.current && Y(m("복사했어요"));
|
|
882
|
+
}, [K, m]), We = E(async () => {
|
|
882
883
|
if (i || s) return;
|
|
883
884
|
K();
|
|
884
885
|
const t = p.current, o = fe.current;
|
|
885
886
|
t.anchor !== t.caret && (await we(), y.current && N.current && fe.current === o && p.current.value === t.value && S(ke(t, -1)));
|
|
886
|
-
}, [i, s, we, S, K]),
|
|
887
|
+
}, [i, s, we, S, K]), Ze = E(async () => {
|
|
887
888
|
if (i || s || H.current || re.current)
|
|
888
889
|
return;
|
|
889
890
|
K();
|
|
890
891
|
const t = { value: p.current.value, policy: V, maxLength: h };
|
|
891
|
-
re.current = t, Ue(!0),
|
|
892
|
+
re.current = t, Ue(!0), Y("");
|
|
892
893
|
const o = () => re.current === t && y.current && N.current && !ge.current.disabled && !ge.current.readOnly && ge.current.policy === t.policy && ge.current.maxLength === t.maxLength && p.current.value === t.value;
|
|
893
894
|
try {
|
|
894
895
|
if (!navigator.clipboard?.readText)
|
|
@@ -896,7 +897,7 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
896
897
|
const x = await navigator.clipboard.readText();
|
|
897
898
|
K(), o() && Ae(x);
|
|
898
899
|
} catch (x) {
|
|
899
|
-
K(), o() && (k.current?.focus({ preventScroll: !0 }), pe(x),
|
|
900
|
+
K(), o() && (k.current?.focus({ preventScroll: !0 }), pe(x), Y(
|
|
900
901
|
m(
|
|
901
902
|
"클립보드를 읽을 수 없어요. 입력란을 길게 눌러 ‘붙여넣기’를 선택해 주세요."
|
|
902
903
|
)
|
|
@@ -920,13 +921,13 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
920
921
|
i || k.current?.focus(t);
|
|
921
922
|
},
|
|
922
923
|
blur: () => {
|
|
923
|
-
k.current?.blur(), N.current &&
|
|
924
|
+
k.current?.blur(), N.current && _(!0);
|
|
924
925
|
},
|
|
925
926
|
getValue: () => p.current.value,
|
|
926
927
|
setSelectionRange: (t, o) => S({
|
|
927
928
|
...p.current,
|
|
928
|
-
anchor:
|
|
929
|
-
caret:
|
|
929
|
+
anchor: W(p.current.value, t),
|
|
930
|
+
caret: W(p.current.value, o),
|
|
930
931
|
composing: !1
|
|
931
932
|
}),
|
|
932
933
|
handleKeyDown: (t) => k.current?.dispatchEvent(
|
|
@@ -942,56 +943,56 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
942
943
|
})
|
|
943
944
|
),
|
|
944
945
|
insertText: (t, o) => {
|
|
945
|
-
V.filterKey(t) &&
|
|
946
|
+
V.filterKey(t) && Ce(t, o);
|
|
946
947
|
},
|
|
947
|
-
scrollIntoView: () =>
|
|
948
|
-
moveCaret:
|
|
949
|
-
undo:
|
|
950
|
-
redo:
|
|
951
|
-
selectAll:
|
|
948
|
+
scrollIntoView: () => C.current?.scrollIntoView({ block: "nearest", inline: "nearest" }),
|
|
949
|
+
moveCaret: qe,
|
|
950
|
+
undo: Te,
|
|
951
|
+
redo: Pe,
|
|
952
|
+
selectAll: _e,
|
|
952
953
|
copySelection: () => we().catch(pe),
|
|
953
|
-
pasteClipboard: () =>
|
|
954
|
-
cutSelection: () =>
|
|
954
|
+
pasteClipboard: () => Ze().catch(pe),
|
|
955
|
+
cutSelection: () => We().catch(pe)
|
|
955
956
|
}),
|
|
956
957
|
[
|
|
957
958
|
V,
|
|
958
|
-
|
|
959
|
-
|
|
959
|
+
Ce,
|
|
960
|
+
qe,
|
|
960
961
|
we,
|
|
961
|
-
Xe,
|
|
962
962
|
Ze,
|
|
963
|
+
We,
|
|
963
964
|
pe,
|
|
964
|
-
Pe,
|
|
965
965
|
Te,
|
|
966
|
-
|
|
966
|
+
Pe,
|
|
967
|
+
_e,
|
|
967
968
|
i,
|
|
968
|
-
|
|
969
|
+
_,
|
|
969
970
|
S
|
|
970
971
|
]
|
|
971
972
|
);
|
|
972
|
-
pt($, () => me, [me]),
|
|
973
|
+
pt($, () => me, [me]), B(() => {
|
|
973
974
|
b || ye(
|
|
974
975
|
(t) => t.composing ? { ...t, composing: !1 } : t
|
|
975
976
|
);
|
|
976
|
-
}, [b]),
|
|
977
|
+
}, [b]), B(() => {
|
|
977
978
|
if (!(!b || i || s))
|
|
978
979
|
return ee.current = me, () => {
|
|
979
980
|
ee.current === me && (ee.current = null);
|
|
980
981
|
};
|
|
981
|
-
}, [b, i, s, me, ee]),
|
|
982
|
-
b &&
|
|
983
|
-
}, [b, i, s, U, V, oe,
|
|
984
|
-
y.current = !1, re.current = null, N.current &&
|
|
985
|
-
}), [
|
|
986
|
-
const
|
|
987
|
-
if (o ?
|
|
982
|
+
}, [b, i, s, me, ee]), B(() => {
|
|
983
|
+
b && C.current && (i || s ? _(!0) : oe(U, C.current, V));
|
|
984
|
+
}, [b, i, s, U, V, oe, _]), B(() => (y.current = !0, () => {
|
|
985
|
+
y.current = !1, re.current = null, N.current && _(!0);
|
|
986
|
+
}), [_]);
|
|
987
|
+
const Xe = (t, o) => {
|
|
988
|
+
if (o ? L.onCut?.(t) : L.onCopy?.(t), t.defaultPrevented || i || o && s || t.target !== k.current) return;
|
|
988
989
|
K();
|
|
989
990
|
const [x, D] = se(p.current);
|
|
990
991
|
x !== D && (t.preventDefault(), t.clipboardData.setData(
|
|
991
992
|
"text/plain",
|
|
992
993
|
p.current.value.slice(x, D)
|
|
993
|
-
), o ? S(ke(p.current, -1)) :
|
|
994
|
-
},
|
|
994
|
+
), o ? S(ke(p.current, -1)) : Y(m("복사했어요")));
|
|
995
|
+
}, Ye = (t) => {
|
|
995
996
|
if (i || s) return;
|
|
996
997
|
const o = St(
|
|
997
998
|
p.current,
|
|
@@ -1007,19 +1008,19 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
1007
1008
|
);
|
|
1008
1009
|
t.value = o.value, S({ ...o });
|
|
1009
1010
|
}, ot = Object.fromEntries(
|
|
1010
|
-
Object.entries(
|
|
1011
|
+
Object.entries(L).filter(([t]) => t.startsWith("aria-"))
|
|
1011
1012
|
), it = Object.fromEntries(
|
|
1012
|
-
Object.entries(
|
|
1013
|
+
Object.entries(L).filter(
|
|
1013
1014
|
([t]) => !t.startsWith("aria-") && !["id", "tabIndex", "role", "contentEditable", "children"].includes(
|
|
1014
1015
|
t
|
|
1015
1016
|
)
|
|
1016
1017
|
)
|
|
1017
1018
|
);
|
|
1018
|
-
return /* @__PURE__ */
|
|
1019
|
+
return /* @__PURE__ */ Z(
|
|
1019
1020
|
"div",
|
|
1020
1021
|
{
|
|
1021
1022
|
...it,
|
|
1022
|
-
ref:
|
|
1023
|
+
ref: C,
|
|
1023
1024
|
"data-virtual-input": "true",
|
|
1024
1025
|
"data-focused": b || void 0,
|
|
1025
1026
|
style: {
|
|
@@ -1038,44 +1039,44 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
1038
1039
|
colorScheme: G,
|
|
1039
1040
|
outline: A ? "2px solid currentColor" : void 0,
|
|
1040
1041
|
outlineOffset: 2,
|
|
1041
|
-
...
|
|
1042
|
+
...L.style
|
|
1042
1043
|
},
|
|
1043
1044
|
onFocus: (t) => {
|
|
1044
|
-
ne(!0),
|
|
1045
|
+
ne(!0), L.onFocus?.(t), !t.defaultPrevented && !i && !s && oe(U, t.currentTarget, V);
|
|
1045
1046
|
},
|
|
1046
1047
|
onBlur: (t) => {
|
|
1047
|
-
ne(!1), t.relatedTarget instanceof Element && !t.relatedTarget.closest("[data-virtual-keypad]") && Q(),
|
|
1048
|
+
ne(!1), t.relatedTarget instanceof Element && !t.relatedTarget.closest("[data-virtual-keypad]") && Q(), L.onBlur?.(t), t.defaultPrevented || _(t);
|
|
1048
1049
|
},
|
|
1049
1050
|
onKeyDown: at,
|
|
1050
|
-
onCopy: (t) =>
|
|
1051
|
-
onCut: (t) =>
|
|
1051
|
+
onCopy: (t) => Xe(t, !1),
|
|
1052
|
+
onCut: (t) => Xe(t, !0),
|
|
1052
1053
|
onPaste: (t) => {
|
|
1053
|
-
|
|
1054
|
+
L.onPaste?.(t), !t.defaultPrevented && !i && !s && (t.preventDefault(), Q(), Ae(t.clipboardData.getData("text/plain")));
|
|
1054
1055
|
},
|
|
1055
1056
|
children: [
|
|
1056
|
-
/* @__PURE__ */
|
|
1057
|
+
/* @__PURE__ */ P(
|
|
1057
1058
|
"input",
|
|
1058
1059
|
{
|
|
1059
1060
|
...ot,
|
|
1060
1061
|
ref: k,
|
|
1061
|
-
id:
|
|
1062
|
+
id: L.id ?? U,
|
|
1062
1063
|
type: "text",
|
|
1063
1064
|
role: "textbox",
|
|
1064
1065
|
inputMode: "none",
|
|
1065
1066
|
autoComplete: "off",
|
|
1066
1067
|
autoCorrect: "off",
|
|
1067
1068
|
autoCapitalize: "off",
|
|
1068
|
-
spellCheck:
|
|
1069
|
-
tabIndex: i ? -1 :
|
|
1069
|
+
spellCheck: L.spellCheck ?? !1,
|
|
1070
|
+
tabIndex: i ? -1 : L.tabIndex ?? 0,
|
|
1070
1071
|
disabled: i,
|
|
1071
1072
|
readOnly: s,
|
|
1072
1073
|
"aria-disabled": i || void 0,
|
|
1073
1074
|
"aria-readonly": s || void 0,
|
|
1074
1075
|
"data-virtual-input": "true",
|
|
1075
1076
|
"data-focused": b || void 0,
|
|
1076
|
-
"data-value":
|
|
1077
|
+
"data-value": F,
|
|
1077
1078
|
placeholder: a,
|
|
1078
|
-
value: le ??
|
|
1079
|
+
value: le ?? F,
|
|
1079
1080
|
style: {
|
|
1080
1081
|
position: "absolute",
|
|
1081
1082
|
inset: 0,
|
|
@@ -1104,18 +1105,18 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
1104
1105
|
touchAction: "manipulation"
|
|
1105
1106
|
},
|
|
1106
1107
|
onChange: (t) => {
|
|
1107
|
-
H.current ?
|
|
1108
|
+
H.current ? j(t.currentTarget.value) : Ye(t.currentTarget);
|
|
1108
1109
|
},
|
|
1109
1110
|
onSelect: K,
|
|
1110
1111
|
onCompositionStart: () => {
|
|
1111
|
-
Q(), K(), z.current = p.current, H.current = !0,
|
|
1112
|
+
Q(), K(), z.current = p.current, H.current = !0, j(k.current?.value ?? p.current.value);
|
|
1112
1113
|
},
|
|
1113
1114
|
onCompositionEnd: (t) => {
|
|
1114
|
-
H.current = !1,
|
|
1115
|
+
H.current = !1, j(null), z.current?.value === p.current.value ? Ye(t.currentTarget) : (t.currentTarget.value = p.current.value, S({ ...p.current })), z.current = null;
|
|
1115
1116
|
}
|
|
1116
1117
|
}
|
|
1117
1118
|
),
|
|
1118
|
-
/* @__PURE__ */
|
|
1119
|
+
/* @__PURE__ */ P(
|
|
1119
1120
|
"span",
|
|
1120
1121
|
{
|
|
1121
1122
|
role: "status",
|
|
@@ -1127,14 +1128,14 @@ const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
|
1127
1128
|
clipPath: "inset(50%)",
|
|
1128
1129
|
whiteSpace: "nowrap"
|
|
1129
1130
|
},
|
|
1130
|
-
children:
|
|
1131
|
+
children: Le
|
|
1131
1132
|
}
|
|
1132
1133
|
)
|
|
1133
1134
|
]
|
|
1134
1135
|
}
|
|
1135
1136
|
);
|
|
1136
1137
|
}
|
|
1137
|
-
),
|
|
1138
|
+
), Ct = [
|
|
1138
1139
|
[
|
|
1139
1140
|
{
|
|
1140
1141
|
value: "1"
|
|
@@ -1258,7 +1259,7 @@ function At({
|
|
|
1258
1259
|
hostRef: a,
|
|
1259
1260
|
...l
|
|
1260
1261
|
}) {
|
|
1261
|
-
const [c, f] =
|
|
1262
|
+
const [c, f] = R(null), v = E(
|
|
1262
1263
|
(u) => {
|
|
1263
1264
|
a && (a.current = u), u && f(u.shadowRoot ?? u.attachShadow({ mode: "open" }));
|
|
1264
1265
|
},
|
|
@@ -1267,9 +1268,9 @@ function At({
|
|
|
1267
1268
|
return ht(
|
|
1268
1269
|
e,
|
|
1269
1270
|
{ ...l, ref: v },
|
|
1270
|
-
c &&
|
|
1271
|
-
/* @__PURE__ */
|
|
1272
|
-
n && /* @__PURE__ */
|
|
1271
|
+
c && je(
|
|
1272
|
+
/* @__PURE__ */ Z(He, { children: [
|
|
1273
|
+
n && /* @__PURE__ */ P("style", { children: n }),
|
|
1273
1274
|
r
|
|
1274
1275
|
] }),
|
|
1275
1276
|
c
|
|
@@ -1283,15 +1284,15 @@ function Oe(e, n, r) {
|
|
|
1283
1284
|
const a = r ? e.value.toUpperCase() : e.value;
|
|
1284
1285
|
return n ? tt(a) : a;
|
|
1285
1286
|
}
|
|
1286
|
-
function
|
|
1287
|
-
const a =
|
|
1287
|
+
function Re(e, { disabled: n = !1, repeat: r = !1 } = {}) {
|
|
1288
|
+
const a = T(e);
|
|
1288
1289
|
a.current = e;
|
|
1289
|
-
const l =
|
|
1290
|
+
const l = T(void 0), c = T(null), [f, v] = R(!1), u = E(() => {
|
|
1290
1291
|
clearTimeout(l.current), c.current = null, v(!1);
|
|
1291
1292
|
}, []);
|
|
1292
|
-
|
|
1293
|
+
B(() => (window.addEventListener("blur", u), document.addEventListener("visibilitychange", u), () => {
|
|
1293
1294
|
u(), window.removeEventListener("blur", u), document.removeEventListener("visibilitychange", u);
|
|
1294
|
-
}), [u]),
|
|
1295
|
+
}), [u]), B(() => {
|
|
1295
1296
|
n && u();
|
|
1296
1297
|
}, [n, u]);
|
|
1297
1298
|
const w = (d) => {
|
|
@@ -1341,7 +1342,7 @@ function Be(e, { disabled: n = !1, repeat: r = !1 } = {}) {
|
|
|
1341
1342
|
}
|
|
1342
1343
|
};
|
|
1343
1344
|
}
|
|
1344
|
-
const
|
|
1345
|
+
const Be = {
|
|
1345
1346
|
Shift: "Shift",
|
|
1346
1347
|
HangulMode: "한영 전환",
|
|
1347
1348
|
Backspace: "지우기",
|
|
@@ -1369,23 +1370,23 @@ function Me({
|
|
|
1369
1370
|
busy: c,
|
|
1370
1371
|
dispatch: f
|
|
1371
1372
|
}) {
|
|
1372
|
-
const { locale: v } = xe(), u = (s) =>
|
|
1373
|
+
const { locale: v } = xe(), u = (s) => Fe(s, v), w = Re(f, {
|
|
1373
1374
|
disabled: l,
|
|
1374
1375
|
repeat: ["Backspace", "Delete", "ArrowLeft", "ArrowRight"].includes(r)
|
|
1375
1376
|
}), d = e.type === "action" && r === "HangulMode", i = e.type === "action" && (r === "Backspace" && (!e.label || e.label === "⌫") || r === "Delete" && (!e.label || e.label === "⌦"));
|
|
1376
|
-
return /* @__PURE__ */
|
|
1377
|
+
return /* @__PURE__ */ P(
|
|
1377
1378
|
"button",
|
|
1378
1379
|
{
|
|
1379
1380
|
type: "button",
|
|
1380
1381
|
disabled: l,
|
|
1381
|
-
"aria-label": u(
|
|
1382
|
+
"aria-label": u(Be[r] ?? n),
|
|
1382
1383
|
"aria-pressed": a,
|
|
1383
1384
|
"aria-busy": c || void 0,
|
|
1384
1385
|
className: d ? "key action language" : e.type === "action" ? "key action" : "key",
|
|
1385
1386
|
title: d ? l ? v === "en" ? `${a ? "Korean" : "English"} only` : `${a ? "한국어" : "영어"} 전용` : v === "en" ? `Switch to ${a ? "English" : "Korean"}` : `${a ? "영어" : "한국어"}로 전환` : void 0,
|
|
1386
1387
|
style: { flex: e.width && e.width > 0 ? e.width : 1 },
|
|
1387
1388
|
...w,
|
|
1388
|
-
children: c ? u("읽는 중…") : i ? /* @__PURE__ */
|
|
1389
|
+
children: c ? u("읽는 중…") : i ? /* @__PURE__ */ Z(
|
|
1389
1390
|
"svg",
|
|
1390
1391
|
{
|
|
1391
1392
|
"data-key-icon": r === "Backspace" ? "backspace" : "delete",
|
|
@@ -1401,12 +1402,12 @@ function Me({
|
|
|
1401
1402
|
focusable: "false",
|
|
1402
1403
|
style: r === "Delete" ? { transform: "scaleX(-1)" } : void 0,
|
|
1403
1404
|
children: [
|
|
1404
|
-
/* @__PURE__ */
|
|
1405
|
-
/* @__PURE__ */
|
|
1405
|
+
/* @__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" }),
|
|
1406
|
+
/* @__PURE__ */ P("path", { d: "m12 9 6 6m0-6-6 6" })
|
|
1406
1407
|
]
|
|
1407
1408
|
}
|
|
1408
|
-
) : d && !e.label ? /* @__PURE__ */
|
|
1409
|
-
/* @__PURE__ */
|
|
1409
|
+
) : d && !e.label ? /* @__PURE__ */ Z("span", { className: "language-label", "aria-hidden": "true", children: [
|
|
1410
|
+
/* @__PURE__ */ Z(
|
|
1410
1411
|
"svg",
|
|
1411
1412
|
{
|
|
1412
1413
|
width: "19",
|
|
@@ -1419,23 +1420,23 @@ function Me({
|
|
|
1419
1420
|
strokeLinejoin: "round",
|
|
1420
1421
|
focusable: "false",
|
|
1421
1422
|
children: [
|
|
1422
|
-
/* @__PURE__ */
|
|
1423
|
-
/* @__PURE__ */
|
|
1424
|
-
/* @__PURE__ */
|
|
1423
|
+
/* @__PURE__ */ P("circle", { cx: "12", cy: "12", r: "9" }),
|
|
1424
|
+
/* @__PURE__ */ P("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
|
|
1425
|
+
/* @__PURE__ */ P("path", { d: "M3 12h18" })
|
|
1425
1426
|
]
|
|
1426
1427
|
}
|
|
1427
1428
|
),
|
|
1428
|
-
/* @__PURE__ */
|
|
1429
|
+
/* @__PURE__ */ P("span", { children: a ? "한" : "EN" })
|
|
1429
1430
|
] }) : e.type === "action" ? u(n) : n
|
|
1430
1431
|
}
|
|
1431
1432
|
);
|
|
1432
1433
|
}
|
|
1433
|
-
function
|
|
1434
|
+
function Tt({
|
|
1434
1435
|
layout: e,
|
|
1435
1436
|
viewport: n,
|
|
1436
1437
|
onHeightChange: r
|
|
1437
1438
|
}) {
|
|
1438
|
-
const a = xe(), l = (g) =>
|
|
1439
|
+
const a = xe(), l = (g) => Fe(g, a.locale), {
|
|
1439
1440
|
inputRef: c,
|
|
1440
1441
|
hangulMode: f,
|
|
1441
1442
|
shift: v,
|
|
@@ -1445,40 +1446,40 @@ function Pt({
|
|
|
1445
1446
|
selectionAdjusting: i,
|
|
1446
1447
|
activeInputPolicy: s,
|
|
1447
1448
|
editingStatus: h,
|
|
1448
|
-
onBlur:
|
|
1449
|
-
} = a, $ =
|
|
1449
|
+
onBlur: L
|
|
1450
|
+
} = a, $ = T(null), [U, X] = R(!1), oe = Re(() => X((g) => !g)), _ = Re(() => L(!0)), O = ["text", "hangul", "custom"].includes(
|
|
1450
1451
|
s.mode
|
|
1451
|
-
), ee = U && O && !d ?
|
|
1452
|
-
|
|
1452
|
+
), ee = U && O && !d ? Ct : e;
|
|
1453
|
+
B(() => {
|
|
1453
1454
|
if (!$.current) return;
|
|
1454
1455
|
const g = () => {
|
|
1455
|
-
const
|
|
1456
|
-
r(
|
|
1456
|
+
const C = $.current?.getBoundingClientRect().height ?? 0;
|
|
1457
|
+
r(C);
|
|
1457
1458
|
};
|
|
1458
1459
|
g();
|
|
1459
1460
|
const m = new ResizeObserver(g);
|
|
1460
1461
|
return m.observe($.current), () => m.disconnect();
|
|
1461
|
-
}, [r]),
|
|
1462
|
+
}, [r]), B(() => {
|
|
1462
1463
|
let g = null;
|
|
1463
|
-
const m = /* @__PURE__ */ new Set(),
|
|
1464
|
+
const m = /* @__PURE__ */ new Set(), C = (A) => A.composedPath().some(
|
|
1464
1465
|
(ne) => ne === $.current || ne instanceof Element && ne.hasAttribute("data-virtual-input")
|
|
1465
1466
|
), k = (A) => {
|
|
1466
|
-
m.add(A.pointerId), g = m.size !== 1 || A.button !== 0 ||
|
|
1467
|
+
m.add(A.pointerId), g = m.size !== 1 || A.button !== 0 || C(A) ? null : { x: A.clientX, y: A.clientY, id: A.pointerId };
|
|
1467
1468
|
}, M = (A) => {
|
|
1468
|
-
g && g.id === A.pointerId && Math.hypot(A.clientX - g.x, A.clientY - g.y) < 10 && !
|
|
1469
|
+
g && g.id === A.pointerId && Math.hypot(A.clientX - g.x, A.clientY - g.y) < 10 && !C(A) && L(!0), g = null, m.delete(A.pointerId);
|
|
1469
1470
|
}, H = (A) => {
|
|
1470
1471
|
g?.id === A.pointerId && Math.hypot(A.clientX - g.x, A.clientY - g.y) >= 10 && (g = null);
|
|
1471
1472
|
}, z = () => {
|
|
1472
1473
|
g = null;
|
|
1473
1474
|
}, le = (A) => {
|
|
1474
1475
|
z(), m.delete(A.pointerId);
|
|
1475
|
-
},
|
|
1476
|
+
}, j = () => {
|
|
1476
1477
|
z(), m.clear();
|
|
1477
1478
|
};
|
|
1478
|
-
return window.addEventListener("pointerdown", k, !0), window.addEventListener("pointermove", H, !0), window.addEventListener("pointerup", M, !0), window.addEventListener("pointercancel", le, !0), window.addEventListener("scroll", z, !0), window.addEventListener("blur",
|
|
1479
|
-
window.removeEventListener("pointerdown", k, !0), window.removeEventListener("pointermove", H, !0), window.removeEventListener("pointerup", M, !0), window.removeEventListener("pointercancel", le, !0), window.removeEventListener("scroll", z, !0), window.removeEventListener("blur",
|
|
1479
|
+
return window.addEventListener("pointerdown", k, !0), window.addEventListener("pointermove", H, !0), window.addEventListener("pointerup", M, !0), window.addEventListener("pointercancel", le, !0), window.addEventListener("scroll", z, !0), window.addEventListener("blur", j), document.addEventListener("visibilitychange", j), () => {
|
|
1480
|
+
window.removeEventListener("pointerdown", k, !0), window.removeEventListener("pointermove", H, !0), window.removeEventListener("pointerup", M, !0), window.removeEventListener("pointercancel", le, !0), window.removeEventListener("scroll", z, !0), window.removeEventListener("blur", j), document.removeEventListener("visibilitychange", j);
|
|
1480
1481
|
};
|
|
1481
|
-
}, [
|
|
1482
|
+
}, [L]);
|
|
1482
1483
|
const te = (g) => {
|
|
1483
1484
|
const m = Oe(g, f, v);
|
|
1484
1485
|
if (g.type !== "action") {
|
|
@@ -1504,7 +1505,7 @@ function Pt({
|
|
|
1504
1505
|
);
|
|
1505
1506
|
break;
|
|
1506
1507
|
case "EnterSelectionMode":
|
|
1507
|
-
|
|
1508
|
+
X(!1), a.enterSelectionMode();
|
|
1508
1509
|
break;
|
|
1509
1510
|
case "ExitSelectionMode":
|
|
1510
1511
|
a.exitSelectionMode();
|
|
@@ -1555,8 +1556,8 @@ function Pt({
|
|
|
1555
1556
|
userSelect: "none",
|
|
1556
1557
|
WebkitUserSelect: "none"
|
|
1557
1558
|
};
|
|
1558
|
-
return
|
|
1559
|
-
/* @__PURE__ */
|
|
1559
|
+
return je(
|
|
1560
|
+
/* @__PURE__ */ P(
|
|
1560
1561
|
At,
|
|
1561
1562
|
{
|
|
1562
1563
|
tagName: "virtual-keypad",
|
|
@@ -1571,7 +1572,7 @@ function Pt({
|
|
|
1571
1572
|
},
|
|
1572
1573
|
onBlur: a.onBlur,
|
|
1573
1574
|
onKeyDown: (g) => {
|
|
1574
|
-
g.key === "Escape" && (g.preventDefault(),
|
|
1575
|
+
g.key === "Escape" && (g.preventDefault(), L(!0));
|
|
1575
1576
|
},
|
|
1576
1577
|
css: `
|
|
1577
1578
|
* {
|
|
@@ -1718,10 +1719,10 @@ function Pt({
|
|
|
1718
1719
|
}
|
|
1719
1720
|
}
|
|
1720
1721
|
`,
|
|
1721
|
-
children: /* @__PURE__ */
|
|
1722
|
-
/* @__PURE__ */
|
|
1723
|
-
h.selectionLength > 0 && !d ? /* @__PURE__ */
|
|
1724
|
-
/* @__PURE__ */
|
|
1722
|
+
children: /* @__PURE__ */ Z("section", { className: "keyboard", role: "group", "aria-label": l("가상 키보드"), children: [
|
|
1723
|
+
/* @__PURE__ */ Z("div", { className: "toolbar", children: [
|
|
1724
|
+
h.selectionLength > 0 && !d ? /* @__PURE__ */ Z(He, { children: [
|
|
1725
|
+
/* @__PURE__ */ P(
|
|
1725
1726
|
"span",
|
|
1726
1727
|
{
|
|
1727
1728
|
className: "selection-count",
|
|
@@ -1729,18 +1730,18 @@ function Pt({
|
|
|
1729
1730
|
children: ie ? h.message : a.locale === "en" ? `${h.selectionLength} characters selected` : `${h.selectionLength}자 선택`
|
|
1730
1731
|
}
|
|
1731
1732
|
),
|
|
1732
|
-
/* @__PURE__ */
|
|
1733
|
+
/* @__PURE__ */ P(
|
|
1733
1734
|
"div",
|
|
1734
1735
|
{
|
|
1735
1736
|
className: "selection-actions",
|
|
1736
1737
|
role: "group",
|
|
1737
1738
|
"aria-label": l("선택한 텍스트 편집"),
|
|
1738
|
-
children: ["Copy", "Cut", "Paste"].map((g) => /* @__PURE__ */
|
|
1739
|
+
children: ["Copy", "Cut", "Paste"].map((g) => /* @__PURE__ */ P(
|
|
1739
1740
|
Me,
|
|
1740
1741
|
{
|
|
1741
1742
|
cell: { value: g, type: "action" },
|
|
1742
1743
|
value: g,
|
|
1743
|
-
label: l(
|
|
1744
|
+
label: l(Be[g]),
|
|
1744
1745
|
disabled: g === "Paste" && h.pasting,
|
|
1745
1746
|
busy: g === "Paste" && h.pasting,
|
|
1746
1747
|
dispatch: () => te({ value: g, type: "action" })
|
|
@@ -1749,11 +1750,11 @@ function Pt({
|
|
|
1749
1750
|
))
|
|
1750
1751
|
}
|
|
1751
1752
|
)
|
|
1752
|
-
] }) : /* @__PURE__ */
|
|
1753
|
+
] }) : /* @__PURE__ */ Z("span", { className: "toolbar-caption", children: [
|
|
1753
1754
|
ie ? h.message : d ? l("텍스트 편집") : U && O ? l("숫자 · 기호") : s.mode === "number" ? l("숫자") : s.mode === "tel" ? l("전화번호") : f ? l("한국어 · 두벌식") : "English",
|
|
1754
1755
|
u ? l(" · Shift 고정") : ""
|
|
1755
1756
|
] }),
|
|
1756
|
-
!d && !h.selectionLength && /* @__PURE__ */
|
|
1757
|
+
!d && !h.selectionLength && /* @__PURE__ */ P("div", { className: "paste-action", children: /* @__PURE__ */ P(
|
|
1757
1758
|
Me,
|
|
1758
1759
|
{
|
|
1759
1760
|
cell: { value: "Paste", type: "action" },
|
|
@@ -1764,7 +1765,7 @@ function Pt({
|
|
|
1764
1765
|
dispatch: () => te({ value: "Paste", type: "action" })
|
|
1765
1766
|
}
|
|
1766
1767
|
) }),
|
|
1767
|
-
O && !d && !h.selectionLength && /* @__PURE__ */
|
|
1768
|
+
O && !d && !h.selectionLength && /* @__PURE__ */ P(
|
|
1768
1769
|
"button",
|
|
1769
1770
|
{
|
|
1770
1771
|
type: "button",
|
|
@@ -1775,32 +1776,32 @@ function Pt({
|
|
|
1775
1776
|
children: U ? "가 / ABC" : "123 / #+="
|
|
1776
1777
|
}
|
|
1777
1778
|
),
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
+
/* @__PURE__ */ P(
|
|
1779
1780
|
"button",
|
|
1780
1781
|
{
|
|
1781
1782
|
type: "button",
|
|
1782
1783
|
className: "close",
|
|
1783
|
-
...
|
|
1784
|
+
..._,
|
|
1784
1785
|
"aria-label": l("키보드 닫기"),
|
|
1785
1786
|
children: l("닫기 ↓")
|
|
1786
1787
|
}
|
|
1787
1788
|
)
|
|
1788
1789
|
] }),
|
|
1789
|
-
h.message && !ie && /* @__PURE__ */
|
|
1790
|
-
ee.map((g, m) => /* @__PURE__ */
|
|
1791
|
-
const M = Oe(
|
|
1792
|
-
return /* @__PURE__ */
|
|
1790
|
+
h.message && !ie && /* @__PURE__ */ P("p", { className: "feedback", children: h.message }),
|
|
1791
|
+
ee.map((g, m) => /* @__PURE__ */ P("div", { className: "row", children: g.map((C, k) => {
|
|
1792
|
+
const M = Oe(C, f, v), H = C.type === "action" ? C.label ?? Be[M] ?? M : /^[A-Za-z]$/.test(C.value) ? M : C.label ?? M, z = C.value === "Shift" ? v : C.value === "HangulMode" ? f : C.value === "ToggleSelectionAdjust" ? i : void 0;
|
|
1793
|
+
return /* @__PURE__ */ P(
|
|
1793
1794
|
Me,
|
|
1794
1795
|
{
|
|
1795
|
-
cell:
|
|
1796
|
+
cell: C,
|
|
1796
1797
|
label: H,
|
|
1797
1798
|
value: M,
|
|
1798
1799
|
active: z,
|
|
1799
1800
|
busy: M === "Paste" && h.pasting,
|
|
1800
|
-
disabled: M === "Paste" && h.pasting ||
|
|
1801
|
-
dispatch: () => te(
|
|
1801
|
+
disabled: M === "Paste" && h.pasting || C.value === "HangulMode" && G || ["Copy", "Cut"].includes(M) && !h.selectionLength || M === "SelectAll" && !h.hasValue || (C.type !== "action" || M === " ") && !s.filterKey(M),
|
|
1802
|
+
dispatch: () => te(C)
|
|
1802
1803
|
},
|
|
1803
|
-
`${m}-${k}-${
|
|
1804
|
+
`${m}-${k}-${C.value}`
|
|
1804
1805
|
);
|
|
1805
1806
|
}) }, m))
|
|
1806
1807
|
] })
|
|
@@ -1810,12 +1811,12 @@ function Pt({
|
|
|
1810
1811
|
);
|
|
1811
1812
|
}
|
|
1812
1813
|
const Ke = "virtual-keyboard:storage";
|
|
1813
|
-
function
|
|
1814
|
-
const r =
|
|
1814
|
+
function Pt(e, n) {
|
|
1815
|
+
const r = T(n), [a, l] = R(n), c = T(a), f = E(
|
|
1815
1816
|
() => r.current instanceof Function ? r.current() : r.current,
|
|
1816
1817
|
[]
|
|
1817
1818
|
);
|
|
1818
|
-
|
|
1819
|
+
B(() => {
|
|
1819
1820
|
const u = (s) => {
|
|
1820
1821
|
try {
|
|
1821
1822
|
const h = s === null ? f() : JSON.parse(s);
|
|
@@ -1955,14 +1956,14 @@ const Mt = [
|
|
|
1955
1956
|
offsetLeft: 0,
|
|
1956
1957
|
offsetTop: 0
|
|
1957
1958
|
}, It = (e, n) => e.width === n.width && e.height === n.height && e.scale === n.scale && e.offsetLeft === n.offsetLeft && e.offsetTop === n.offsetTop, Vt = () => {
|
|
1958
|
-
const [e, n] =
|
|
1959
|
+
const [e, n] = R(() => ({
|
|
1959
1960
|
width: 0,
|
|
1960
1961
|
height: 0,
|
|
1961
1962
|
scale: 1,
|
|
1962
1963
|
offsetLeft: 0,
|
|
1963
1964
|
offsetTop: 0
|
|
1964
1965
|
}));
|
|
1965
|
-
return
|
|
1966
|
+
return B(() => {
|
|
1966
1967
|
if (typeof window > "u") return;
|
|
1967
1968
|
let r = null;
|
|
1968
1969
|
const a = () => {
|
|
@@ -1985,8 +1986,8 @@ const Mt = [
|
|
|
1985
1986
|
}, []), e;
|
|
1986
1987
|
};
|
|
1987
1988
|
function Dt() {
|
|
1988
|
-
const [e, n] =
|
|
1989
|
-
return
|
|
1989
|
+
const [e, n] = R("light");
|
|
1990
|
+
return B(() => {
|
|
1990
1991
|
if (typeof window > "u" || !window.matchMedia) return;
|
|
1991
1992
|
const r = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1992
1993
|
n(r.matches ? "dark" : "light");
|
|
@@ -2002,7 +2003,7 @@ function rt(e) {
|
|
|
2002
2003
|
) : typeof navigator > "u" ? !1 : rt(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 || typeof window < "u" && !!window.matchMedia?.("(pointer: coarse)").matches;
|
|
2003
2004
|
}
|
|
2004
2005
|
const Ie = "virtual-keyboard:focus-change";
|
|
2005
|
-
function
|
|
2006
|
+
function Ft({
|
|
2006
2007
|
children: e,
|
|
2007
2008
|
locale: n = "ko",
|
|
2008
2009
|
layout: r = ce,
|
|
@@ -2010,43 +2011,43 @@ function jt({
|
|
|
2010
2011
|
theme: l,
|
|
2011
2012
|
keyboardVisibility: c = "auto"
|
|
2012
2013
|
}) {
|
|
2013
|
-
const f = et(), v =
|
|
2014
|
+
const f = et(), v = T(null), u = T(null), w = T(
|
|
2014
2015
|
void 0
|
|
2015
|
-
), [d, i] =
|
|
2016
|
+
), [d, i] = R(), [s, h] = R(0), [L, $] = R(!1), [U, X] = R(!1), [oe, _] = R({
|
|
2016
2017
|
selectionLength: 0,
|
|
2017
2018
|
hasValue: !1,
|
|
2018
2019
|
message: "",
|
|
2019
2020
|
pasting: !1
|
|
2020
2021
|
}), O = E((y) => {
|
|
2021
|
-
|
|
2022
|
+
_(
|
|
2022
2023
|
(b) => b.selectionLength === y.selectionLength && b.hasValue === y.hasValue && b.message === y.message && b.pasting === y.pasting ? b : y
|
|
2023
2024
|
);
|
|
2024
|
-
}, []), [ee, te] =
|
|
2025
|
+
}, []), [ee, te] = Pt(
|
|
2025
2026
|
"virtual-keyboard-hangul-mode",
|
|
2026
2027
|
a
|
|
2027
|
-
), [G, ie] =
|
|
2028
|
+
), [G, ie] = R(
|
|
2028
2029
|
() => Ve({ layout: r })
|
|
2029
|
-
), [ue, g] =
|
|
2030
|
-
le.current = z,
|
|
2030
|
+
), [ue, g] = R(!1), [m, C] = R(0), k = Vt(), M = Dt(), H = Ee(G.mode) ?? ee, z = !!d && (c === "always" || c === "auto" && ue), le = T(z);
|
|
2031
|
+
le.current = z, B(() => {
|
|
2031
2032
|
const y = () => g(rt());
|
|
2032
2033
|
y();
|
|
2033
2034
|
const b = window.matchMedia?.("(pointer: coarse)");
|
|
2034
2035
|
return b?.addEventListener("change", y), () => b?.removeEventListener("change", y);
|
|
2035
2036
|
}, []);
|
|
2036
|
-
const
|
|
2037
|
-
clearTimeout(w.current), u.current = null, v.current = null, i(void 0), h(0), $(!1),
|
|
2037
|
+
const j = E(() => {
|
|
2038
|
+
clearTimeout(w.current), u.current = null, v.current = null, i(void 0), h(0), $(!1), X(!1);
|
|
2038
2039
|
}, []);
|
|
2039
|
-
|
|
2040
|
+
B(() => {
|
|
2040
2041
|
const y = (b) => {
|
|
2041
|
-
b.detail !== f &&
|
|
2042
|
+
b.detail !== f && j();
|
|
2042
2043
|
};
|
|
2043
2044
|
return window.addEventListener(Ie, y), () => {
|
|
2044
2045
|
window.removeEventListener(Ie, y), clearTimeout(w.current);
|
|
2045
2046
|
};
|
|
2046
|
-
}, [f,
|
|
2047
|
+
}, [f, j]);
|
|
2047
2048
|
const A = E(
|
|
2048
2049
|
(y, b, N) => {
|
|
2049
|
-
clearTimeout(w.current), u.current !== b && (h(0), $(!1),
|
|
2050
|
+
clearTimeout(w.current), u.current !== b && (h(0), $(!1), X(!1)), u.current = b, ie(Ve(N)), i(y), window.dispatchEvent(
|
|
2050
2051
|
new CustomEvent(Ie, { detail: f })
|
|
2051
2052
|
);
|
|
2052
2053
|
},
|
|
@@ -2055,15 +2056,15 @@ function jt({
|
|
|
2055
2056
|
(y) => {
|
|
2056
2057
|
if (y === !0) {
|
|
2057
2058
|
const N = document.activeElement, he = N instanceof HTMLElement && u.current?.contains(N);
|
|
2058
|
-
|
|
2059
|
+
j(), he && N.blur();
|
|
2059
2060
|
return;
|
|
2060
2061
|
}
|
|
2061
2062
|
const b = typeof y == "object" ? y.relatedTarget : null;
|
|
2062
|
-
b?.closest?.("[data-virtual-input], [data-virtual-keypad]") || !b && le.current || (clearTimeout(w.current), w.current = setTimeout(
|
|
2063
|
+
b?.closest?.("[data-virtual-input], [data-virtual-keypad]") || !b && le.current || (clearTimeout(w.current), w.current = setTimeout(j, 0));
|
|
2063
2064
|
},
|
|
2064
|
-
[
|
|
2065
|
+
[j]
|
|
2065
2066
|
);
|
|
2066
|
-
|
|
2067
|
+
B(() => {
|
|
2067
2068
|
if (!z || !m || k.scale !== 1) return;
|
|
2068
2069
|
const y = requestAnimationFrame(() => {
|
|
2069
2070
|
const b = u.current?.getBoundingClientRect();
|
|
@@ -2080,23 +2081,23 @@ function jt({
|
|
|
2080
2081
|
k.offsetTop,
|
|
2081
2082
|
k.scale
|
|
2082
2083
|
]);
|
|
2083
|
-
const
|
|
2084
|
+
const q = E(() => {
|
|
2084
2085
|
Ee(G.mode) === null && te((y) => !y);
|
|
2085
2086
|
}, [G.mode, te]), ye = E(
|
|
2086
2087
|
() => h((y) => (y + 1) % 3),
|
|
2087
2088
|
[]
|
|
2088
|
-
),
|
|
2089
|
+
), F = E(
|
|
2089
2090
|
() => h((y) => y === 1 ? 0 : y),
|
|
2090
2091
|
[]
|
|
2091
2092
|
), p = E(() => {
|
|
2092
|
-
$(!0),
|
|
2093
|
+
$(!0), X(!1);
|
|
2093
2094
|
}, []), fe = E(() => {
|
|
2094
|
-
$(!1),
|
|
2095
|
+
$(!1), X(!1);
|
|
2095
2096
|
}, []), de = E(
|
|
2096
|
-
() =>
|
|
2097
|
+
() => X((y) => !y),
|
|
2097
2098
|
[]
|
|
2098
2099
|
);
|
|
2099
|
-
return /* @__PURE__ */
|
|
2100
|
+
return /* @__PURE__ */ Z(
|
|
2100
2101
|
nt.Provider,
|
|
2101
2102
|
{
|
|
2102
2103
|
value: {
|
|
@@ -2110,10 +2111,10 @@ function jt({
|
|
|
2110
2111
|
shift: s > 0,
|
|
2111
2112
|
shiftLocked: s === 2,
|
|
2112
2113
|
theme: l ?? M,
|
|
2113
|
-
toggleKorean:
|
|
2114
|
+
toggleKorean: q,
|
|
2114
2115
|
toggleShift: ye,
|
|
2115
|
-
consumeShift:
|
|
2116
|
-
selectionMode:
|
|
2116
|
+
consumeShift: F,
|
|
2117
|
+
selectionMode: L,
|
|
2117
2118
|
selectionAdjusting: U,
|
|
2118
2119
|
enterSelectionMode: p,
|
|
2119
2120
|
exitSelectionMode: fe,
|
|
@@ -2124,9 +2125,9 @@ function jt({
|
|
|
2124
2125
|
},
|
|
2125
2126
|
children: [
|
|
2126
2127
|
e,
|
|
2127
|
-
z && /* @__PURE__ */
|
|
2128
|
-
|
|
2129
|
-
/* @__PURE__ */
|
|
2128
|
+
z && /* @__PURE__ */ Z(He, { children: [
|
|
2129
|
+
je(
|
|
2130
|
+
/* @__PURE__ */ P(
|
|
2130
2131
|
"div",
|
|
2131
2132
|
{
|
|
2132
2133
|
"aria-hidden": "true",
|
|
@@ -2139,12 +2140,12 @@ function jt({
|
|
|
2139
2140
|
),
|
|
2140
2141
|
document.body
|
|
2141
2142
|
),
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
|
|
2143
|
+
/* @__PURE__ */ P(
|
|
2144
|
+
Tt,
|
|
2144
2145
|
{
|
|
2145
|
-
layout:
|
|
2146
|
+
layout: L ? Mt : G.layout,
|
|
2146
2147
|
viewport: k,
|
|
2147
|
-
onHeightChange:
|
|
2148
|
+
onHeightChange: C
|
|
2148
2149
|
},
|
|
2149
2150
|
d
|
|
2150
2151
|
)
|
|
@@ -2154,6 +2155,6 @@ function jt({
|
|
|
2154
2155
|
);
|
|
2155
2156
|
}
|
|
2156
2157
|
export {
|
|
2157
|
-
|
|
2158
|
-
|
|
2158
|
+
jt as VirtualInput,
|
|
2159
|
+
Ft as VirtualInputProvider
|
|
2159
2160
|
};
|