@uiwwsw/virtual-keyboard 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +73 -0
- package/README.md +7 -1
- package/dist/index.js +797 -681
- package/dist/types/components/Context.d.ts +1 -0
- package/dist/types/components/Provider.d.ts +3 -1
- package/dist/types/uiLanguage.d.ts +3 -0
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1,9 +1,118 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as X, jsx as
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { convertQwertyToHangul as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
|
|
2
|
+
import { jsxs as X, jsx as T, 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 P, useState as B, useMemo as Ge, useEffect as R, useImperativeHandle as pt, useLayoutEffect as ft, createElement as ht } from "react";
|
|
4
|
+
import { convertQwertyToHangul as tt, assemble as gt, removeLastCharacter as mt } from "es-hangul";
|
|
5
|
+
import { createPortal as Fe } from "react-dom";
|
|
6
|
+
const yt = {
|
|
7
|
+
"자유 입력": "Free text",
|
|
8
|
+
"한글과 영문을 오가며 자유롭게 입력해 보세요. 한 / EN 키로 언어를 바꿀 수 있습니다.": "Type in Korean or English. Use the 한 / EN key to switch input languages.",
|
|
9
|
+
"여기서 첫 문장을 시작해 보세요": "Start your first sentence here",
|
|
10
|
+
한국어: "Korean",
|
|
11
|
+
"두벌식 자판으로 초성부터 받침까지. 조합 중에는 자모 단위로 지워집니다.": "Compose Korean syllables with the two-set layout. Backspace removes one component while composing.",
|
|
12
|
+
"한글을 한 글자씩 눌러보세요": "Try composing a Korean syllable",
|
|
13
|
+
숫자: "Numbers",
|
|
14
|
+
"숫자와 소수점만 허용합니다. 붙여넣은 내용에도 같은 문자 규칙이 적용됩니다.": "Only numbers and a decimal point are accepted, including pasted text.",
|
|
15
|
+
"수량 또는 금액 입력": "Enter a quantity or amount",
|
|
16
|
+
전화번호: "Phone number",
|
|
17
|
+
"숫자와 +, *, #을 지원하는 다이얼 패드입니다. 붙여넣을 때 구분 기호를 제거합니다.": "A dial pad for numbers, +, * and #. Separators are removed when pasting.",
|
|
18
|
+
영문: "English letters",
|
|
19
|
+
"영문 알파벳만 입력합니다. Shift를 두 번 누르면 대문자 입력이 고정됩니다.": "Only English letters are accepted. Double-tap Shift to lock uppercase.",
|
|
20
|
+
"영문 이름 또는 태그": "English name or tag",
|
|
21
|
+
"영문 + 숫자": "Letters + numbers",
|
|
22
|
+
"영문과 숫자로 구성된 코드에 사용해 보세요. 물리 키보드 입력도 지원합니다.": "Use this for alphanumeric codes. Physical keyboard input works too.",
|
|
23
|
+
커스텀: "Custom",
|
|
24
|
+
"한 번에 여러 글자를 입력하는 매크로 키입니다. 키에 표시할 이름과 실제 값을 따로 설정할 수 있습니다.": "Macro keys insert multiple characters. Configure the visible label separately from the inserted value.",
|
|
25
|
+
"빠른 문구를 선택해 보세요": "Choose a quick phrase",
|
|
26
|
+
인사: "Hello",
|
|
27
|
+
감사: "Thanks",
|
|
28
|
+
확인: "Confirm",
|
|
29
|
+
공백: "Space",
|
|
30
|
+
완료: "Done",
|
|
31
|
+
"설치 명령어를 복사했습니다.": "Installation command copied.",
|
|
32
|
+
"복사할 수 없습니다. 아래 명령어를 직접 선택해 주세요.": "Copy unavailable. Select the command below manually.",
|
|
33
|
+
"실행 가능한 전체 예제를 복사했습니다.": "Complete runnable example copied.",
|
|
34
|
+
"복사할 수 없습니다. 코드를 직접 선택해 주세요.": "Copy unavailable. Select the code manually.",
|
|
35
|
+
"키보드 체험으로 건너뛰기": "Skip to keyboard playground",
|
|
36
|
+
"Virtual Keyboard 홈": "Virtual Keyboard home",
|
|
37
|
+
"주요 메뉴": "Main navigation",
|
|
38
|
+
"사용 방법": "Usage guide",
|
|
39
|
+
"입력의 감각까지,": "Design every detail",
|
|
40
|
+
"직접 설계하세요.": "of your input.",
|
|
41
|
+
"한글 조합부터 나만의 키패드까지.": "From Korean composition to your own custom keypad.",
|
|
42
|
+
"웹에서 자연스럽게 이어지는 입력 경험을 만드세요.": "Build a natural typing experience for the web.",
|
|
43
|
+
"직접 눌러보기": "Try the keyboard",
|
|
44
|
+
"생각에서 글자로, 끊김 없이.": "From thought to text, without interruption.",
|
|
45
|
+
"한글 조합": "Korean composition",
|
|
46
|
+
"초성부터 받침까지": "Complete syllable composition",
|
|
47
|
+
"7가지 모드": "7 input modes",
|
|
48
|
+
"입력에 맞춘 키패드": "A keypad for each input",
|
|
49
|
+
"간결한 컴포넌트 API": "A concise component API",
|
|
50
|
+
"눌러보면 알 수 있어요.": "Try it for yourself.",
|
|
51
|
+
테마: "Theme",
|
|
52
|
+
"☀ 라이트": "☀ Light",
|
|
53
|
+
"☾ 다크": "☾ Dark",
|
|
54
|
+
"입력 모드": "Input mode",
|
|
55
|
+
"필요한 문자만,": "Only the characters you need,",
|
|
56
|
+
"원하는 방식으로.": "just the way you want.",
|
|
57
|
+
"직접 입력해 보세요": "Start typing",
|
|
58
|
+
"입력 내용": "Input value",
|
|
59
|
+
"초기화 ↺": "Reset ↺",
|
|
60
|
+
"커서 위치에 붙여넣기 · 길게 눌러 선택": "Paste at cursor · Hold to select",
|
|
61
|
+
"예시 채우기 ↗": "Fill example ↗",
|
|
62
|
+
"현재 값": "Current value",
|
|
63
|
+
"화면에 가상 키보드 표시": "Show the on-screen keyboard",
|
|
64
|
+
"예제 복사 ⧉": "Copy example ⧉",
|
|
65
|
+
"선택한 모드와 테마가 코드에 바로 반영됩니다.": "The code updates with your selected mode and theme.",
|
|
66
|
+
"입력란 이동": "Move between fields",
|
|
67
|
+
"범위 선택": "Select text",
|
|
68
|
+
"키보드 닫기": "Close keyboard",
|
|
69
|
+
"프로젝트에 더하는 건,": "Add it to your project",
|
|
70
|
+
"몇 줄이면 충분해요.": "in just a few lines.",
|
|
71
|
+
"Provider로 감싸고 VirtualInput을 추가하세요.": "Wrap your UI in the Provider and add VirtualInput.",
|
|
72
|
+
"기본 스타일과 키패드를 바로 사용할 수 있습니다.": "The default styling and keypads work immediately.",
|
|
73
|
+
"API 문서 살펴보기 ↗": "Read the API docs ↗",
|
|
74
|
+
"명령어 복사 ⧉": "Copy command ⧉",
|
|
75
|
+
"추가 스타일시트 없이 바로 시작하세요.": "Get started without an extra stylesheet.",
|
|
76
|
+
"의견 남기기 ↗": "Share feedback ↗",
|
|
77
|
+
"한영 전환": "Switch Korean / English",
|
|
78
|
+
지우기: "Backspace",
|
|
79
|
+
"앞 글자 지우기": "Delete forward",
|
|
80
|
+
"입력 완료": "Done",
|
|
81
|
+
"텍스트 편집": "Edit text",
|
|
82
|
+
"키보드로 돌아가기": "Back to keyboard",
|
|
83
|
+
"선택 범위 조절": "Adjust selection",
|
|
84
|
+
"커서 왼쪽": "Move cursor left",
|
|
85
|
+
"커서 오른쪽": "Move cursor right",
|
|
86
|
+
복사: "Copy",
|
|
87
|
+
붙여넣기: "Paste",
|
|
88
|
+
잘라내기: "Cut",
|
|
89
|
+
"실행 취소": "Undo",
|
|
90
|
+
"다시 실행": "Redo",
|
|
91
|
+
"전체 선택": "Select all",
|
|
92
|
+
"읽는 중…": "Reading…",
|
|
93
|
+
복사했어요: "Copied",
|
|
94
|
+
붙여넣었어요: "Pasted",
|
|
95
|
+
"입력값이 적용되지 않았어요": "The input value could not be applied",
|
|
96
|
+
"붙여넣을 텍스트가 없어요": "No text to paste",
|
|
97
|
+
"이 입력란에 붙여넣을 수 없는 내용이에요": "This content is not allowed in this field",
|
|
98
|
+
"입력 길이 제한을 초과했어요": "The input length limit was exceeded",
|
|
99
|
+
"클립보드에 접근할 수 없습니다. 입력란을 길게 눌러 기본 편집 메뉴를 사용해 주세요.": "Clipboard access is unavailable. Hold the input to use the native editing menu.",
|
|
100
|
+
"클립보드를 읽을 수 없어요. 입력란을 길게 눌러 ‘붙여넣기’를 선택해 주세요.": "Cannot read the clipboard. Hold the input and choose Paste.",
|
|
101
|
+
"가상 키보드": "Virtual keyboard",
|
|
102
|
+
"선택한 텍스트 편집": "Edit selected text",
|
|
103
|
+
"숫자 · 기호": "Numbers · symbols",
|
|
104
|
+
"한국어 · 두벌식": "Korean · two-set",
|
|
105
|
+
" · Shift 고정": " · Shift locked",
|
|
106
|
+
"숫자·기호 전환": "Switch numbers and symbols",
|
|
107
|
+
"닫기 ↓": "Close ↓",
|
|
108
|
+
편집: "Edit",
|
|
109
|
+
키보드: "Keyboard",
|
|
110
|
+
"범위 조절": "Adjust range"
|
|
111
|
+
};
|
|
112
|
+
function je(e, n) {
|
|
113
|
+
return n === "en" ? yt[e] ?? e : e;
|
|
114
|
+
}
|
|
115
|
+
class vt {
|
|
7
116
|
past = [];
|
|
8
117
|
future = [];
|
|
9
118
|
record(n, r) {
|
|
@@ -21,26 +130,26 @@ class ht {
|
|
|
21
130
|
this.past = [], this.future = [];
|
|
22
131
|
}
|
|
23
132
|
}
|
|
24
|
-
const
|
|
25
|
-
function
|
|
26
|
-
const e =
|
|
133
|
+
const nt = ut(null);
|
|
134
|
+
function xe() {
|
|
135
|
+
const e = st(nt);
|
|
27
136
|
if (!e)
|
|
28
137
|
throw new Error(
|
|
29
138
|
"VirtualInput must be used within a <VirtualInputProvider>."
|
|
30
139
|
);
|
|
31
140
|
return e;
|
|
32
141
|
}
|
|
33
|
-
function
|
|
142
|
+
function Se(e) {
|
|
34
143
|
return /^[\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF]$/.test(e);
|
|
35
144
|
}
|
|
36
|
-
function
|
|
145
|
+
function wt(e, n) {
|
|
37
146
|
if (e.key === "HangulMode") return { handled: !0, toggleHangulMode: !0 };
|
|
38
147
|
if (e.ctrlKey || e.metaKey || e.altKey || [...e.key].length !== 1 || /[\r\n\t]/.test(e.key))
|
|
39
148
|
return { handled: !1 };
|
|
40
|
-
const r = n && /^[A-Za-z]$/.test(e.key) ?
|
|
41
|
-
return { handled: !0, text: r, composing:
|
|
149
|
+
const r = n && /^[A-Za-z]$/.test(e.key) ? tt(e.key) : e.key;
|
|
150
|
+
return { handled: !0, text: r, composing: Se(r) };
|
|
42
151
|
}
|
|
43
|
-
const
|
|
152
|
+
const ce = [
|
|
44
153
|
[
|
|
45
154
|
{
|
|
46
155
|
label: "q",
|
|
@@ -211,7 +320,7 @@ const oe = [
|
|
|
211
320
|
width: 1.25
|
|
212
321
|
}
|
|
213
322
|
]
|
|
214
|
-
],
|
|
323
|
+
], bt = [
|
|
215
324
|
[
|
|
216
325
|
{
|
|
217
326
|
label: "1",
|
|
@@ -280,7 +389,7 @@ const oe = [
|
|
|
280
389
|
type: "action"
|
|
281
390
|
}
|
|
282
391
|
]
|
|
283
|
-
],
|
|
392
|
+
], kt = [
|
|
284
393
|
[
|
|
285
394
|
{
|
|
286
395
|
label: "1",
|
|
@@ -363,7 +472,7 @@ const oe = [
|
|
|
363
472
|
}
|
|
364
473
|
]
|
|
365
474
|
];
|
|
366
|
-
function
|
|
475
|
+
function Ee(e) {
|
|
367
476
|
switch (e) {
|
|
368
477
|
case "hangul":
|
|
369
478
|
return !0;
|
|
@@ -376,34 +485,34 @@ function be(e) {
|
|
|
376
485
|
return null;
|
|
377
486
|
}
|
|
378
487
|
}
|
|
379
|
-
const
|
|
488
|
+
const be = () => !0, xt = {
|
|
380
489
|
text: {
|
|
381
490
|
mode: "text",
|
|
382
|
-
layout:
|
|
383
|
-
filterKey:
|
|
491
|
+
layout: ce,
|
|
492
|
+
filterKey: be,
|
|
384
493
|
sanitizeValue: (e) => e.replace(/[\r\n\t]+/g, " ")
|
|
385
494
|
},
|
|
386
495
|
number: {
|
|
387
496
|
mode: "number",
|
|
388
|
-
layout:
|
|
497
|
+
layout: bt,
|
|
389
498
|
filterKey: (e) => /^[0-9.]+$/.test(e),
|
|
390
499
|
sanitizeValue: (e) => e.replace(/[^0-9.]/g, "")
|
|
391
500
|
},
|
|
392
501
|
tel: {
|
|
393
502
|
mode: "tel",
|
|
394
|
-
layout:
|
|
503
|
+
layout: kt,
|
|
395
504
|
filterKey: (e) => /^[0-9*#+]+$/.test(e),
|
|
396
505
|
sanitizeValue: (e) => e.replace(/[^0-9*#+]/g, "")
|
|
397
506
|
},
|
|
398
507
|
hangul: {
|
|
399
508
|
mode: "hangul",
|
|
400
|
-
layout:
|
|
401
|
-
filterKey:
|
|
509
|
+
layout: ce,
|
|
510
|
+
filterKey: be,
|
|
402
511
|
sanitizeValue: (e) => e.replace(/[A-Za-z]/g, "")
|
|
403
512
|
},
|
|
404
513
|
alpha: {
|
|
405
514
|
mode: "alpha",
|
|
406
|
-
layout:
|
|
515
|
+
layout: ce,
|
|
407
516
|
filterKey: (e) => /^[A-Za-z]+$/.test(e),
|
|
408
517
|
sanitizeValue: (e) => e.replace(/[^A-Za-z]/g, "")
|
|
409
518
|
},
|
|
@@ -411,82 +520,82 @@ const we = () => !0, wt = {
|
|
|
411
520
|
mode: "alphanumeric",
|
|
412
521
|
layout: [
|
|
413
522
|
Array.from("1234567890", (e) => ({ value: e })),
|
|
414
|
-
...
|
|
523
|
+
...ce
|
|
415
524
|
],
|
|
416
525
|
filterKey: (e) => /^[A-Za-z0-9]+$/.test(e),
|
|
417
526
|
sanitizeValue: (e) => e.replace(/[^A-Za-z0-9]/g, "")
|
|
418
527
|
},
|
|
419
528
|
custom: {
|
|
420
529
|
mode: "custom",
|
|
421
|
-
layout:
|
|
422
|
-
filterKey:
|
|
530
|
+
layout: ce,
|
|
531
|
+
filterKey: be,
|
|
423
532
|
sanitizeValue: (e) => e.replace(/[\r\n\t]+/g, " ")
|
|
424
533
|
}
|
|
425
534
|
};
|
|
426
|
-
function
|
|
427
|
-
const n = e?.mode ?? "text", r =
|
|
535
|
+
function Ve(e) {
|
|
536
|
+
const n = e?.mode ?? "text", r = xt[n];
|
|
428
537
|
return {
|
|
429
538
|
mode: n,
|
|
430
|
-
layout: e?.layout ?? r.layout ??
|
|
431
|
-
filterKey: e?.filterKey ?? r.filterKey ??
|
|
432
|
-
sanitizeValue: e?.sanitizeValue ?? r.sanitizeValue ?? ((
|
|
539
|
+
layout: e?.layout ?? r.layout ?? ce,
|
|
540
|
+
filterKey: e?.filterKey ?? r.filterKey ?? be,
|
|
541
|
+
sanitizeValue: e?.sanitizeValue ?? r.sanitizeValue ?? ((a) => a)
|
|
433
542
|
};
|
|
434
543
|
}
|
|
435
|
-
const
|
|
544
|
+
const Et = new Intl.Segmenter(void 0, { granularity: "grapheme" }), Ne = (e) => Array.from(Et.segment(e));
|
|
436
545
|
function Z(e, n) {
|
|
437
546
|
return [
|
|
438
|
-
...
|
|
547
|
+
...Ne(e).map((a) => a.index),
|
|
439
548
|
e.length
|
|
440
|
-
].filter((
|
|
549
|
+
].filter((a) => a <= Math.max(0, n)).at(-1) ?? 0;
|
|
441
550
|
}
|
|
442
|
-
function
|
|
443
|
-
const
|
|
444
|
-
...
|
|
551
|
+
function De(e, n, r) {
|
|
552
|
+
const a = [
|
|
553
|
+
...Ne(e).map((l) => l.index),
|
|
445
554
|
e.length
|
|
446
555
|
];
|
|
447
|
-
return r < 0 ?
|
|
556
|
+
return r < 0 ? a.filter((l) => l < n).at(-1) ?? 0 : a.find((l) => l > n) ?? e.length;
|
|
448
557
|
}
|
|
449
|
-
const
|
|
450
|
-
function
|
|
451
|
-
const [l,
|
|
452
|
-
let f = e.value.slice(0, l),
|
|
453
|
-
l ===
|
|
454
|
-
const u = f +
|
|
455
|
-
if (
|
|
456
|
-
const w = f.length +
|
|
558
|
+
const se = ({ anchor: e, caret: n }) => [Math.min(e, n), Math.max(e, n)];
|
|
559
|
+
function ze(e, n, r = !1, a) {
|
|
560
|
+
const [l, c] = se(e);
|
|
561
|
+
let f = e.value.slice(0, l), v = n;
|
|
562
|
+
l === c && e.composing && r && Se(f.at(-1) ?? "") && (v = gt([f.at(-1), n]), f = f.slice(0, -1));
|
|
563
|
+
const u = f + v + e.value.slice(c);
|
|
564
|
+
if (a !== void 0 && u.length > a) return e;
|
|
565
|
+
const w = f.length + v.length;
|
|
457
566
|
return { value: u, caret: w, anchor: w, composing: r };
|
|
458
567
|
}
|
|
459
|
-
function
|
|
460
|
-
let [r,
|
|
461
|
-
if (r ===
|
|
462
|
-
if (n < 0 && e.composing &&
|
|
463
|
-
const l = e.value.slice(0, r - 1) +
|
|
568
|
+
function ke(e, n) {
|
|
569
|
+
let [r, a] = se(e);
|
|
570
|
+
if (r === a) {
|
|
571
|
+
if (n < 0 && e.composing && Se(e.value[r - 1] ?? "")) {
|
|
572
|
+
const l = e.value.slice(0, r - 1) + mt(e.value[r - 1]);
|
|
464
573
|
return {
|
|
465
|
-
value: l + e.value.slice(
|
|
574
|
+
value: l + e.value.slice(a),
|
|
466
575
|
anchor: l.length,
|
|
467
576
|
caret: l.length,
|
|
468
577
|
composing: !0
|
|
469
578
|
};
|
|
470
579
|
}
|
|
471
|
-
n < 0 ? r =
|
|
580
|
+
n < 0 ? r = De(e.value, r, -1) : a = De(e.value, a, 1);
|
|
472
581
|
}
|
|
473
582
|
return {
|
|
474
|
-
value: e.value.slice(0, r) + e.value.slice(
|
|
583
|
+
value: e.value.slice(0, r) + e.value.slice(a),
|
|
475
584
|
caret: r,
|
|
476
585
|
anchor: r,
|
|
477
586
|
composing: !1
|
|
478
587
|
};
|
|
479
588
|
}
|
|
480
|
-
function
|
|
481
|
-
const [
|
|
589
|
+
function Qe(e, n, r = !1) {
|
|
590
|
+
const [a, l] = se(e), c = n === "home" ? 0 : n === "end" ? e.value.length : !r && a !== l ? n < 0 ? a : l : De(e.value, e.caret, n);
|
|
482
591
|
return {
|
|
483
592
|
...e,
|
|
484
|
-
caret:
|
|
485
|
-
anchor: r ? e.anchor :
|
|
593
|
+
caret: c,
|
|
594
|
+
anchor: r ? e.anchor : c,
|
|
486
595
|
composing: !1
|
|
487
596
|
};
|
|
488
597
|
}
|
|
489
|
-
function
|
|
598
|
+
function St(e, n, r, a, l, c) {
|
|
490
599
|
if (n === e.value) return e;
|
|
491
600
|
let f = 0;
|
|
492
601
|
for (; f < e.value.length && f < n.length && e.value[f] === n[f]; )
|
|
@@ -495,327 +604,332 @@ function bt(e, n, r, i, l, s) {
|
|
|
495
604
|
Z(e.value, f),
|
|
496
605
|
Z(n, f)
|
|
497
606
|
);
|
|
498
|
-
let
|
|
499
|
-
for (;
|
|
500
|
-
|
|
501
|
-
for (; Z(e.value,
|
|
502
|
-
|
|
503
|
-
const w = n.slice(f, u),
|
|
504
|
-
if (w && (!
|
|
505
|
-
const
|
|
506
|
-
if (
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
|
|
607
|
+
let v = e.value.length, u = n.length;
|
|
608
|
+
for (; v > f && u > f && e.value[v - 1] === n[u - 1]; )
|
|
609
|
+
v--, u--;
|
|
610
|
+
for (; Z(e.value, v) !== v || Z(n, u) !== u; )
|
|
611
|
+
v < e.value.length && v++, u < n.length && u++;
|
|
612
|
+
const w = n.slice(f, u), d = a(w).replace(/[\r\n\t]+/g, " ");
|
|
613
|
+
if (w && (!d || !l(d))) return e;
|
|
614
|
+
const i = { ...e, anchor: f, caret: v, composing: !1 }, s = w ? ze(i, d, !1, c) : ke(i, -1);
|
|
615
|
+
if (s === i) return e;
|
|
616
|
+
const h = (C) => Z(
|
|
617
|
+
s.value,
|
|
618
|
+
C <= f ? C : C >= u ? C + d.length - w.length : f + a(w.slice(0, C - f)).replace(/[\r\n\t]+/g, " ").length
|
|
510
619
|
);
|
|
511
620
|
return {
|
|
512
|
-
...
|
|
513
|
-
anchor:
|
|
514
|
-
caret:
|
|
621
|
+
...s,
|
|
622
|
+
anchor: h(r.backward ? r.end : r.start),
|
|
623
|
+
caret: h(r.backward ? r.start : r.end)
|
|
515
624
|
};
|
|
516
625
|
}
|
|
517
|
-
const
|
|
626
|
+
const Ct = typeof window > "u" ? R : ft, Ft = dt(
|
|
518
627
|
function({
|
|
519
628
|
value: n,
|
|
520
629
|
defaultValue: r = "",
|
|
521
|
-
placeholder:
|
|
630
|
+
placeholder: a,
|
|
522
631
|
onChange: l,
|
|
523
|
-
onValueChange:
|
|
632
|
+
onValueChange: c,
|
|
524
633
|
onClipboardError: f,
|
|
525
|
-
mode:
|
|
634
|
+
mode: v = "text",
|
|
526
635
|
layout: u,
|
|
527
636
|
filterKey: w,
|
|
528
|
-
sanitizeValue:
|
|
529
|
-
disabled:
|
|
530
|
-
readOnly:
|
|
531
|
-
maxLength:
|
|
532
|
-
...
|
|
533
|
-
},
|
|
534
|
-
const
|
|
535
|
-
focusId:
|
|
536
|
-
onFocus:
|
|
537
|
-
onBlur:
|
|
538
|
-
defaultLayout:
|
|
539
|
-
inputRef:
|
|
540
|
-
hangulMode:
|
|
541
|
-
theme:
|
|
542
|
-
toggleKorean:
|
|
543
|
-
setEditingStatus:
|
|
544
|
-
} =
|
|
637
|
+
sanitizeValue: d,
|
|
638
|
+
disabled: i = !1,
|
|
639
|
+
readOnly: s = !1,
|
|
640
|
+
maxLength: h,
|
|
641
|
+
...C
|
|
642
|
+
}, $) {
|
|
643
|
+
const U = et(), {
|
|
644
|
+
focusId: Y,
|
|
645
|
+
onFocus: oe,
|
|
646
|
+
onBlur: q,
|
|
647
|
+
defaultLayout: O,
|
|
648
|
+
inputRef: ee,
|
|
649
|
+
hangulMode: te,
|
|
650
|
+
theme: G,
|
|
651
|
+
toggleKorean: ie,
|
|
652
|
+
setEditingStatus: ue
|
|
653
|
+
} = xe(), { locale: g } = xe(), m = E((t) => je(t, g), [g]), L = P(null), k = P(null), M = P(!1), H = P(!1), z = P(null), [le, F] = B(null), [A, ne] = B(!1), [W, ye] = B(() => ({
|
|
545
654
|
value: n ?? r,
|
|
546
655
|
caret: (n ?? r).length,
|
|
547
656
|
anchor: (n ?? r).length,
|
|
548
657
|
composing: !1
|
|
549
|
-
})),
|
|
550
|
-
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
...
|
|
554
|
-
value:
|
|
555
|
-
caret: Z(
|
|
556
|
-
anchor: Z(
|
|
557
|
-
composing:
|
|
658
|
+
})), j = n ?? W.value, p = P(W), fe = P(0), de = P(new vt()), y = P(!1), b = Y === U, N = P(b);
|
|
659
|
+
N.current = b;
|
|
660
|
+
const he = n !== void 0 && n !== W.value;
|
|
661
|
+
he && de.current.clear(), p.current = {
|
|
662
|
+
...W,
|
|
663
|
+
value: j,
|
|
664
|
+
caret: Z(j, W.caret),
|
|
665
|
+
anchor: Z(j, W.anchor),
|
|
666
|
+
composing: he ? !1 : W.composing
|
|
558
667
|
};
|
|
559
|
-
const
|
|
560
|
-
() =>
|
|
561
|
-
mode:
|
|
562
|
-
layout: u ?? (
|
|
668
|
+
const V = Ge(
|
|
669
|
+
() => Ve({
|
|
670
|
+
mode: v,
|
|
671
|
+
layout: u ?? (v === "text" || v === "custom" ? O : void 0),
|
|
563
672
|
filterKey: w,
|
|
564
|
-
sanitizeValue:
|
|
673
|
+
sanitizeValue: d
|
|
565
674
|
}),
|
|
566
|
-
[
|
|
567
|
-
), [
|
|
568
|
-
|
|
569
|
-
const
|
|
570
|
-
|
|
675
|
+
[v, u, O, w, d]
|
|
676
|
+
), [Ce, _] = B(""), [$e, Ue] = B(!1), re = P(null), ve = P(null), ge = P({ disabled: i, readOnly: s, policy: V, maxLength: h });
|
|
677
|
+
ge.current = { disabled: i, readOnly: s, policy: V, maxLength: h };
|
|
678
|
+
const Q = E(() => {
|
|
679
|
+
re.current && (re.current = null, Ue(!1));
|
|
571
680
|
}, []);
|
|
572
|
-
|
|
573
|
-
const t =
|
|
574
|
-
t && (!
|
|
681
|
+
R(() => {
|
|
682
|
+
const t = re.current;
|
|
683
|
+
t && (!b || i || s || t.policy !== V || t.maxLength !== h || t.value !== j) && Q();
|
|
575
684
|
}, [
|
|
685
|
+
b,
|
|
686
|
+
i,
|
|
687
|
+
s,
|
|
688
|
+
V,
|
|
576
689
|
h,
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
T,
|
|
580
|
-
x,
|
|
581
|
-
N,
|
|
582
|
-
O
|
|
690
|
+
j,
|
|
691
|
+
Q
|
|
583
692
|
]);
|
|
584
|
-
const S =
|
|
585
|
-
(t, o = !0,
|
|
586
|
-
|
|
587
|
-
const
|
|
588
|
-
if (o &&
|
|
589
|
-
|
|
590
|
-
const
|
|
693
|
+
const S = E(
|
|
694
|
+
(t, o = !0, x = !1) => {
|
|
695
|
+
Q();
|
|
696
|
+
const D = p.current.value;
|
|
697
|
+
if (o && de.current.record(p.current, t), M.current = !x, p.current = t, fe.current++, _(""), ye(t), t.value !== D) {
|
|
698
|
+
c?.(t.value);
|
|
699
|
+
const I = { value: t.value };
|
|
591
700
|
l?.({
|
|
592
|
-
target:
|
|
593
|
-
currentTarget:
|
|
701
|
+
target: I,
|
|
702
|
+
currentTarget: I
|
|
594
703
|
});
|
|
595
704
|
}
|
|
596
705
|
},
|
|
597
|
-
[l,
|
|
598
|
-
),
|
|
599
|
-
const t =
|
|
600
|
-
if (!t ||
|
|
706
|
+
[l, c, Q]
|
|
707
|
+
), K = E(() => {
|
|
708
|
+
const t = k.current;
|
|
709
|
+
if (!t || i || M.current || t.value !== p.current.value || H.current)
|
|
601
710
|
return null;
|
|
602
|
-
const o = t.selectionStart ?? 0,
|
|
603
|
-
return (
|
|
604
|
-
{ ...
|
|
711
|
+
const o = t.selectionStart ?? 0, x = t.selectionEnd ?? o, D = t.selectionDirection === "backward" ? { anchor: x, caret: o } : { anchor: o, caret: x }, I = Z(p.current.value, D.anchor), J = Z(p.current.value, D.caret);
|
|
712
|
+
return (I !== p.current.anchor || J !== p.current.caret || I !== D.anchor || J !== D.caret) && S(
|
|
713
|
+
{ ...p.current, anchor: I, caret: J, composing: !1 },
|
|
605
714
|
!1,
|
|
606
|
-
|
|
607
|
-
), { anchor:
|
|
608
|
-
}, [
|
|
609
|
-
|
|
715
|
+
I === D.anchor && J === D.caret
|
|
716
|
+
), { anchor: I, caret: J };
|
|
717
|
+
}, [i, S]);
|
|
718
|
+
R(() => {
|
|
610
719
|
const t = () => {
|
|
611
|
-
document.activeElement ===
|
|
612
|
-
}, o =
|
|
720
|
+
document.activeElement === k.current && K();
|
|
721
|
+
}, o = k.current;
|
|
613
722
|
return document.addEventListener("selectionchange", t), o?.addEventListener("select", t), () => {
|
|
614
723
|
document.removeEventListener("selectionchange", t), o?.removeEventListener("select", t);
|
|
615
724
|
};
|
|
616
|
-
}, [
|
|
617
|
-
if (
|
|
618
|
-
const { anchor: t, caret: o } =
|
|
619
|
-
(
|
|
725
|
+
}, [K, m]), Ct(() => {
|
|
726
|
+
if (z.current && z.current.value !== j && (H.current = !1, z.current = null, F(null)), !i && k.current && !H.current && (M.current || he)) {
|
|
727
|
+
const { anchor: t, caret: o } = p.current, x = Math.min(t, o), D = Math.max(t, o), I = t > o ? "backward" : "forward";
|
|
728
|
+
(k.current.selectionStart !== x || k.current.selectionEnd !== D || x !== D && k.current.selectionDirection !== I) && k.current.setSelectionRange(x, D, I);
|
|
620
729
|
}
|
|
621
|
-
|
|
622
|
-
|
|
730
|
+
M.current = !1, ve.current !== null && (_(
|
|
731
|
+
j === ve.current ? m("붙여넣었어요") : m("입력값이 적용되지 않았어요")
|
|
623
732
|
), ve.current = null);
|
|
624
|
-
}),
|
|
625
|
-
if (!
|
|
626
|
-
const [t, o] =
|
|
627
|
-
|
|
628
|
-
selectionLength:
|
|
629
|
-
hasValue: !!
|
|
630
|
-
message:
|
|
631
|
-
pasting:
|
|
733
|
+
}), R(() => {
|
|
734
|
+
if (!b) return;
|
|
735
|
+
const [t, o] = se(p.current);
|
|
736
|
+
ue({
|
|
737
|
+
selectionLength: Ne(j.slice(t, o)).length,
|
|
738
|
+
hasValue: !!j,
|
|
739
|
+
message: Ce,
|
|
740
|
+
pasting: $e
|
|
632
741
|
});
|
|
633
742
|
}, [
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
743
|
+
j,
|
|
744
|
+
W.anchor,
|
|
745
|
+
W.caret,
|
|
746
|
+
Ce,
|
|
747
|
+
$e,
|
|
748
|
+
b,
|
|
749
|
+
ue
|
|
641
750
|
]);
|
|
642
|
-
const
|
|
751
|
+
const Le = E(
|
|
643
752
|
(t, o = !1) => {
|
|
644
|
-
if (
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
|
|
753
|
+
if (i || s) return;
|
|
754
|
+
K();
|
|
755
|
+
const x = V.sanitizeValue(t).replace(/[\r\n\t]+/g, " ");
|
|
756
|
+
x && S(ze(p.current, x, o, h));
|
|
648
757
|
},
|
|
649
|
-
[
|
|
650
|
-
),
|
|
758
|
+
[i, s, V, h, S, K]
|
|
759
|
+
), Ae = E(
|
|
651
760
|
(t) => {
|
|
652
|
-
if (
|
|
653
|
-
if (
|
|
654
|
-
_("붙여넣을 텍스트가 없어요");
|
|
761
|
+
if (i || s || H.current) return;
|
|
762
|
+
if (K(), !t) {
|
|
763
|
+
_(m("붙여넣을 텍스트가 없어요"));
|
|
655
764
|
return;
|
|
656
765
|
}
|
|
657
|
-
const o =
|
|
658
|
-
if (!o || !
|
|
659
|
-
_("이 입력란에 붙여넣을 수 없는 내용이에요");
|
|
766
|
+
const o = V.sanitizeValue(t).replace(/[\r\n\t]+/g, " ");
|
|
767
|
+
if (!o || !V.filterKey(o)) {
|
|
768
|
+
_(m("이 입력란에 붙여넣을 수 없는 내용이에요"));
|
|
660
769
|
return;
|
|
661
770
|
}
|
|
662
|
-
const
|
|
663
|
-
if (
|
|
664
|
-
_("입력 길이 제한을 초과했어요");
|
|
771
|
+
const x = ze(p.current, o, !1, h);
|
|
772
|
+
if (x === p.current) {
|
|
773
|
+
_(m("입력 길이 제한을 초과했어요"));
|
|
665
774
|
return;
|
|
666
775
|
}
|
|
667
|
-
ve.current =
|
|
776
|
+
ve.current = x.value, S(x), k.current?.focus({ preventScroll: !0 });
|
|
668
777
|
},
|
|
669
|
-
[
|
|
670
|
-
),
|
|
671
|
-
!
|
|
672
|
-
}, [
|
|
673
|
-
!
|
|
674
|
-
}, [
|
|
778
|
+
[i, s, V, h, K, S, m]
|
|
779
|
+
), Pe = E(() => {
|
|
780
|
+
!i && !s && S(de.current.undo(p.current), !1);
|
|
781
|
+
}, [i, s, S]), Te = E(() => {
|
|
782
|
+
!i && !s && S(de.current.redo(p.current), !1);
|
|
783
|
+
}, [i, s, S]), qe = E(
|
|
675
784
|
() => S({
|
|
676
|
-
...
|
|
677
|
-
caret:
|
|
785
|
+
...p.current,
|
|
786
|
+
caret: p.current.value.length,
|
|
678
787
|
anchor: 0,
|
|
679
788
|
composing: !1
|
|
680
789
|
}),
|
|
681
790
|
[S]
|
|
682
|
-
),
|
|
791
|
+
), We = E(
|
|
683
792
|
(t, o = !1) => {
|
|
684
|
-
|
|
793
|
+
K(), S(Qe(p.current, t === "left" ? -1 : 1, o));
|
|
685
794
|
},
|
|
686
|
-
[S,
|
|
687
|
-
),
|
|
688
|
-
if (
|
|
795
|
+
[S, K]
|
|
796
|
+
), at = (t) => {
|
|
797
|
+
if (C.onKeyDown?.(t), t.defaultPrevented || i || H.current || t.nativeEvent.isComposing || t.keyCode === 229)
|
|
689
798
|
return;
|
|
690
|
-
|
|
799
|
+
K();
|
|
691
800
|
const o = t.key;
|
|
692
801
|
if (o === "Escape") {
|
|
693
|
-
t.preventDefault(), S({ ...
|
|
802
|
+
t.preventDefault(), S({ ...p.current, composing: !1 }), q(!0), k.current?.blur();
|
|
694
803
|
return;
|
|
695
804
|
}
|
|
696
805
|
if (o === "HangulMode") {
|
|
697
|
-
t.preventDefault(), S({ ...
|
|
806
|
+
t.preventDefault(), S({ ...p.current, composing: !1 }), ie();
|
|
698
807
|
return;
|
|
699
808
|
}
|
|
700
|
-
const
|
|
701
|
-
if (
|
|
702
|
-
t.preventDefault(), o.toLowerCase() === "y" || t.shiftKey ?
|
|
809
|
+
const x = t.ctrlKey || t.metaKey;
|
|
810
|
+
if (x && ["z", "y"].includes(o.toLowerCase())) {
|
|
811
|
+
t.preventDefault(), o.toLowerCase() === "y" || t.shiftKey ? Te() : Pe();
|
|
703
812
|
return;
|
|
704
813
|
}
|
|
705
|
-
if (
|
|
814
|
+
if (x && o.toLowerCase() === "a") {
|
|
706
815
|
t.preventDefault(), S({
|
|
707
|
-
...
|
|
708
|
-
caret:
|
|
816
|
+
...p.current,
|
|
817
|
+
caret: p.current.value.length,
|
|
709
818
|
anchor: 0,
|
|
710
819
|
composing: !1
|
|
711
820
|
});
|
|
712
821
|
return;
|
|
713
822
|
}
|
|
714
|
-
const
|
|
715
|
-
if (
|
|
716
|
-
t.preventDefault(), S(
|
|
823
|
+
const D = o === "Home" || o === "ArrowUp" || x && o === "ArrowLeft" ? "home" : o === "End" || o === "ArrowDown" || x && o === "ArrowRight" ? "end" : o === "ArrowLeft" ? -1 : o === "ArrowRight" ? 1 : null;
|
|
824
|
+
if (D !== null) {
|
|
825
|
+
t.preventDefault(), S(Qe(p.current, D, t.shiftKey));
|
|
717
826
|
return;
|
|
718
827
|
}
|
|
719
828
|
if (o === "Tab" || o === "Enter") {
|
|
720
|
-
o === "Enter" && t.preventDefault(), S({ ...
|
|
829
|
+
o === "Enter" && t.preventDefault(), S({ ...p.current, composing: !1 });
|
|
721
830
|
return;
|
|
722
831
|
}
|
|
723
|
-
if (
|
|
832
|
+
if (s) return;
|
|
724
833
|
if (o === "Backspace" || o === "Delete") {
|
|
725
|
-
t.preventDefault(), S(
|
|
834
|
+
t.preventDefault(), S(ke(p.current, o === "Backspace" ? -1 : 1));
|
|
726
835
|
return;
|
|
727
836
|
}
|
|
728
|
-
const
|
|
837
|
+
const I = wt(
|
|
729
838
|
t,
|
|
730
|
-
|
|
839
|
+
Ee(V.mode) ?? te
|
|
731
840
|
);
|
|
732
|
-
|
|
733
|
-
},
|
|
841
|
+
I.handled && I.text && (t.preventDefault(), V.filterKey(I.text) && Le(I.text, I.composing));
|
|
842
|
+
}, pe = E(
|
|
734
843
|
(t) => {
|
|
735
844
|
const o = t instanceof Error ? t : new Error(String(t));
|
|
736
|
-
|
|
737
|
-
|
|
845
|
+
y.current && (_(
|
|
846
|
+
m(
|
|
847
|
+
"클립보드에 접근할 수 없습니다. 입력란을 길게 눌러 기본 편집 메뉴를 사용해 주세요."
|
|
848
|
+
)
|
|
738
849
|
), f?.(o));
|
|
739
850
|
},
|
|
740
|
-
[f]
|
|
741
|
-
),
|
|
742
|
-
|
|
743
|
-
const [t, o] =
|
|
851
|
+
[f, m]
|
|
852
|
+
), we = E(async () => {
|
|
853
|
+
K();
|
|
854
|
+
const [t, o] = se(p.current);
|
|
744
855
|
if (t === o) return;
|
|
745
|
-
const
|
|
856
|
+
const x = p.current.value, D = p.current.value.slice(t, o);
|
|
746
857
|
try {
|
|
747
858
|
if (!navigator.clipboard?.writeText)
|
|
748
859
|
throw new Error("Clipboard API unavailable");
|
|
749
|
-
await navigator.clipboard.writeText(
|
|
750
|
-
} catch (
|
|
751
|
-
|
|
752
|
-
const J =
|
|
753
|
-
if (!J || !
|
|
754
|
-
throw
|
|
755
|
-
let
|
|
756
|
-
const
|
|
860
|
+
await navigator.clipboard.writeText(D);
|
|
861
|
+
} catch (I) {
|
|
862
|
+
K();
|
|
863
|
+
const J = k.current, [lt, ct] = se(p.current);
|
|
864
|
+
if (!J || !y.current || p.current.value !== x || lt !== t || ct !== o)
|
|
865
|
+
throw I;
|
|
866
|
+
let ae = document.activeElement;
|
|
867
|
+
const Je = ae?.hasAttribute(
|
|
757
868
|
"data-virtual-keypad"
|
|
758
869
|
);
|
|
759
|
-
if (
|
|
760
|
-
for (;
|
|
761
|
-
|
|
870
|
+
if (ae !== J && !Je) throw I;
|
|
871
|
+
for (; ae?.shadowRoot?.activeElement; )
|
|
872
|
+
ae = ae.shadowRoot.activeElement;
|
|
762
873
|
J.focus({ preventScroll: !0 });
|
|
763
874
|
try {
|
|
764
|
-
if (!document.execCommand?.("copy")) throw
|
|
875
|
+
if (!document.execCommand?.("copy")) throw I;
|
|
765
876
|
} finally {
|
|
766
|
-
|
|
877
|
+
ae instanceof HTMLElement && ae !== J && Je && ae.focus({ preventScroll: !0 });
|
|
767
878
|
}
|
|
768
879
|
}
|
|
769
|
-
|
|
770
|
-
}, [
|
|
771
|
-
if (
|
|
772
|
-
|
|
773
|
-
const t =
|
|
774
|
-
t.anchor !== t.caret && (await
|
|
775
|
-
}, [
|
|
776
|
-
if (
|
|
880
|
+
y.current && _(m("복사했어요"));
|
|
881
|
+
}, [K, m]), Ze = E(async () => {
|
|
882
|
+
if (i || s) return;
|
|
883
|
+
K();
|
|
884
|
+
const t = p.current, o = fe.current;
|
|
885
|
+
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]), Xe = E(async () => {
|
|
887
|
+
if (i || s || H.current || re.current)
|
|
777
888
|
return;
|
|
778
|
-
|
|
779
|
-
const t = { value:
|
|
780
|
-
|
|
781
|
-
const o = () =>
|
|
889
|
+
K();
|
|
890
|
+
const t = { value: p.current.value, policy: V, maxLength: h };
|
|
891
|
+
re.current = t, Ue(!0), _("");
|
|
892
|
+
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;
|
|
782
893
|
try {
|
|
783
894
|
if (!navigator.clipboard?.readText)
|
|
784
895
|
throw new Error("Clipboard read unavailable");
|
|
785
|
-
const
|
|
786
|
-
|
|
787
|
-
} catch (
|
|
788
|
-
|
|
789
|
-
|
|
896
|
+
const x = await navigator.clipboard.readText();
|
|
897
|
+
K(), o() && Ae(x);
|
|
898
|
+
} catch (x) {
|
|
899
|
+
K(), o() && (k.current?.focus({ preventScroll: !0 }), pe(x), _(
|
|
900
|
+
m(
|
|
901
|
+
"클립보드를 읽을 수 없어요. 입력란을 길게 눌러 ‘붙여넣기’를 선택해 주세요."
|
|
902
|
+
)
|
|
790
903
|
));
|
|
791
904
|
} finally {
|
|
792
|
-
|
|
905
|
+
re.current === t && Q();
|
|
793
906
|
}
|
|
794
907
|
}, [
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
T,
|
|
798
|
-
x,
|
|
799
|
-
Se,
|
|
908
|
+
i,
|
|
909
|
+
s,
|
|
800
910
|
V,
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
911
|
+
h,
|
|
912
|
+
Ae,
|
|
913
|
+
K,
|
|
914
|
+
pe,
|
|
915
|
+
m,
|
|
916
|
+
Q
|
|
917
|
+
]), me = Ge(
|
|
804
918
|
() => ({
|
|
805
919
|
focus: (t) => {
|
|
806
|
-
|
|
920
|
+
i || k.current?.focus(t);
|
|
807
921
|
},
|
|
808
922
|
blur: () => {
|
|
809
|
-
|
|
923
|
+
k.current?.blur(), N.current && q(!0);
|
|
810
924
|
},
|
|
811
|
-
getValue: () =>
|
|
925
|
+
getValue: () => p.current.value,
|
|
812
926
|
setSelectionRange: (t, o) => S({
|
|
813
|
-
...
|
|
814
|
-
anchor: Z(
|
|
815
|
-
caret: Z(
|
|
927
|
+
...p.current,
|
|
928
|
+
anchor: Z(p.current.value, t),
|
|
929
|
+
caret: Z(p.current.value, o),
|
|
816
930
|
composing: !1
|
|
817
931
|
}),
|
|
818
|
-
handleKeyDown: (t) =>
|
|
932
|
+
handleKeyDown: (t) => k.current?.dispatchEvent(
|
|
819
933
|
new KeyboardEvent("keydown", {
|
|
820
934
|
key: t.key,
|
|
821
935
|
shiftKey: t.shiftKey,
|
|
@@ -828,74 +942,74 @@ const xt = typeof window > "u" ? D : st, Dt = lt(
|
|
|
828
942
|
})
|
|
829
943
|
),
|
|
830
944
|
insertText: (t, o) => {
|
|
831
|
-
|
|
945
|
+
V.filterKey(t) && Le(t, o);
|
|
832
946
|
},
|
|
833
|
-
scrollIntoView: () =>
|
|
834
|
-
moveCaret:
|
|
835
|
-
undo:
|
|
836
|
-
redo:
|
|
837
|
-
selectAll:
|
|
838
|
-
copySelection: () =>
|
|
839
|
-
pasteClipboard: () =>
|
|
840
|
-
cutSelection: () =>
|
|
947
|
+
scrollIntoView: () => L.current?.scrollIntoView({ block: "nearest", inline: "nearest" }),
|
|
948
|
+
moveCaret: We,
|
|
949
|
+
undo: Pe,
|
|
950
|
+
redo: Te,
|
|
951
|
+
selectAll: qe,
|
|
952
|
+
copySelection: () => we().catch(pe),
|
|
953
|
+
pasteClipboard: () => Xe().catch(pe),
|
|
954
|
+
cutSelection: () => Ze().catch(pe)
|
|
841
955
|
}),
|
|
842
956
|
[
|
|
843
|
-
|
|
844
|
-
Ee,
|
|
845
|
-
Ne,
|
|
846
|
-
me,
|
|
847
|
-
qe,
|
|
848
|
-
$e,
|
|
849
|
-
ue,
|
|
957
|
+
V,
|
|
850
958
|
Le,
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
959
|
+
We,
|
|
960
|
+
we,
|
|
961
|
+
Xe,
|
|
962
|
+
Ze,
|
|
963
|
+
pe,
|
|
964
|
+
Pe,
|
|
965
|
+
Te,
|
|
966
|
+
qe,
|
|
967
|
+
i,
|
|
968
|
+
q,
|
|
855
969
|
S
|
|
856
970
|
]
|
|
857
971
|
);
|
|
858
|
-
|
|
859
|
-
|
|
972
|
+
pt($, () => me, [me]), R(() => {
|
|
973
|
+
b || ye(
|
|
860
974
|
(t) => t.composing ? { ...t, composing: !1 } : t
|
|
861
975
|
);
|
|
862
|
-
}, [
|
|
863
|
-
if (!(!
|
|
864
|
-
return
|
|
865
|
-
|
|
976
|
+
}, [b]), R(() => {
|
|
977
|
+
if (!(!b || i || s))
|
|
978
|
+
return ee.current = me, () => {
|
|
979
|
+
ee.current === me && (ee.current = null);
|
|
866
980
|
};
|
|
867
|
-
}, [
|
|
868
|
-
|
|
869
|
-
}, [
|
|
870
|
-
|
|
871
|
-
}), [
|
|
872
|
-
const
|
|
873
|
-
if (o ?
|
|
874
|
-
|
|
875
|
-
const [
|
|
876
|
-
|
|
981
|
+
}, [b, i, s, me, ee]), R(() => {
|
|
982
|
+
b && L.current && (i || s ? q(!0) : oe(U, L.current, V));
|
|
983
|
+
}, [b, i, s, U, V, oe, q]), R(() => (y.current = !0, () => {
|
|
984
|
+
y.current = !1, re.current = null, N.current && q(!0);
|
|
985
|
+
}), [q]);
|
|
986
|
+
const Ye = (t, o) => {
|
|
987
|
+
if (o ? C.onCut?.(t) : C.onCopy?.(t), t.defaultPrevented || i || o && s || t.target !== k.current) return;
|
|
988
|
+
K();
|
|
989
|
+
const [x, D] = se(p.current);
|
|
990
|
+
x !== D && (t.preventDefault(), t.clipboardData.setData(
|
|
877
991
|
"text/plain",
|
|
878
|
-
|
|
879
|
-
), o ? S(
|
|
880
|
-
},
|
|
881
|
-
if (
|
|
882
|
-
const o =
|
|
883
|
-
|
|
992
|
+
p.current.value.slice(x, D)
|
|
993
|
+
), o ? S(ke(p.current, -1)) : _(m("복사했어요")));
|
|
994
|
+
}, _e = (t) => {
|
|
995
|
+
if (i || s) return;
|
|
996
|
+
const o = St(
|
|
997
|
+
p.current,
|
|
884
998
|
t.value,
|
|
885
999
|
{
|
|
886
1000
|
start: t.selectionStart ?? t.value.length,
|
|
887
1001
|
end: t.selectionEnd ?? t.value.length,
|
|
888
1002
|
backward: t.selectionDirection === "backward"
|
|
889
1003
|
},
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
1004
|
+
V.sanitizeValue,
|
|
1005
|
+
V.filterKey,
|
|
1006
|
+
h
|
|
893
1007
|
);
|
|
894
1008
|
t.value = o.value, S({ ...o });
|
|
895
|
-
},
|
|
896
|
-
Object.entries(
|
|
897
|
-
),
|
|
898
|
-
Object.entries(
|
|
1009
|
+
}, ot = Object.fromEntries(
|
|
1010
|
+
Object.entries(C).filter(([t]) => t.startsWith("aria-"))
|
|
1011
|
+
), it = Object.fromEntries(
|
|
1012
|
+
Object.entries(C).filter(
|
|
899
1013
|
([t]) => !t.startsWith("aria-") && !["id", "tabIndex", "role", "contentEditable", "children"].includes(
|
|
900
1014
|
t
|
|
901
1015
|
)
|
|
@@ -904,10 +1018,10 @@ const xt = typeof window > "u" ? D : st, Dt = lt(
|
|
|
904
1018
|
return /* @__PURE__ */ X(
|
|
905
1019
|
"div",
|
|
906
1020
|
{
|
|
907
|
-
...
|
|
908
|
-
ref:
|
|
1021
|
+
...it,
|
|
1022
|
+
ref: L,
|
|
909
1023
|
"data-virtual-input": "true",
|
|
910
|
-
"data-focused":
|
|
1024
|
+
"data-focused": b || void 0,
|
|
911
1025
|
style: {
|
|
912
1026
|
position: "relative",
|
|
913
1027
|
display: "flex",
|
|
@@ -919,49 +1033,49 @@ const xt = typeof window > "u" ? D : st, Dt = lt(
|
|
|
919
1033
|
borderRadius: 8,
|
|
920
1034
|
font: "inherit",
|
|
921
1035
|
width: "100%",
|
|
922
|
-
cursor:
|
|
923
|
-
opacity:
|
|
924
|
-
colorScheme:
|
|
925
|
-
outline:
|
|
1036
|
+
cursor: i ? "not-allowed" : "text",
|
|
1037
|
+
opacity: i ? 0.5 : 1,
|
|
1038
|
+
colorScheme: G,
|
|
1039
|
+
outline: A ? "2px solid currentColor" : void 0,
|
|
926
1040
|
outlineOffset: 2,
|
|
927
|
-
...
|
|
1041
|
+
...C.style
|
|
928
1042
|
},
|
|
929
1043
|
onFocus: (t) => {
|
|
930
|
-
|
|
1044
|
+
ne(!0), C.onFocus?.(t), !t.defaultPrevented && !i && !s && oe(U, t.currentTarget, V);
|
|
931
1045
|
},
|
|
932
1046
|
onBlur: (t) => {
|
|
933
|
-
|
|
1047
|
+
ne(!1), t.relatedTarget instanceof Element && !t.relatedTarget.closest("[data-virtual-keypad]") && Q(), C.onBlur?.(t), t.defaultPrevented || q(t);
|
|
934
1048
|
},
|
|
935
|
-
onKeyDown:
|
|
936
|
-
onCopy: (t) =>
|
|
937
|
-
onCut: (t) =>
|
|
1049
|
+
onKeyDown: at,
|
|
1050
|
+
onCopy: (t) => Ye(t, !1),
|
|
1051
|
+
onCut: (t) => Ye(t, !0),
|
|
938
1052
|
onPaste: (t) => {
|
|
939
|
-
|
|
1053
|
+
C.onPaste?.(t), !t.defaultPrevented && !i && !s && (t.preventDefault(), Q(), Ae(t.clipboardData.getData("text/plain")));
|
|
940
1054
|
},
|
|
941
1055
|
children: [
|
|
942
|
-
/* @__PURE__ */
|
|
1056
|
+
/* @__PURE__ */ T(
|
|
943
1057
|
"input",
|
|
944
1058
|
{
|
|
945
|
-
...
|
|
946
|
-
ref:
|
|
947
|
-
id:
|
|
1059
|
+
...ot,
|
|
1060
|
+
ref: k,
|
|
1061
|
+
id: C.id ?? U,
|
|
948
1062
|
type: "text",
|
|
949
1063
|
role: "textbox",
|
|
950
1064
|
inputMode: "none",
|
|
951
1065
|
autoComplete: "off",
|
|
952
1066
|
autoCorrect: "off",
|
|
953
1067
|
autoCapitalize: "off",
|
|
954
|
-
spellCheck:
|
|
955
|
-
tabIndex:
|
|
956
|
-
disabled:
|
|
957
|
-
readOnly:
|
|
958
|
-
"aria-disabled":
|
|
959
|
-
"aria-readonly":
|
|
1068
|
+
spellCheck: C.spellCheck ?? !1,
|
|
1069
|
+
tabIndex: i ? -1 : C.tabIndex ?? 0,
|
|
1070
|
+
disabled: i,
|
|
1071
|
+
readOnly: s,
|
|
1072
|
+
"aria-disabled": i || void 0,
|
|
1073
|
+
"aria-readonly": s || void 0,
|
|
960
1074
|
"data-virtual-input": "true",
|
|
961
|
-
"data-focused":
|
|
962
|
-
"data-value":
|
|
963
|
-
placeholder:
|
|
964
|
-
value:
|
|
1075
|
+
"data-focused": b || void 0,
|
|
1076
|
+
"data-value": j,
|
|
1077
|
+
placeholder: a,
|
|
1078
|
+
value: le ?? j,
|
|
965
1079
|
style: {
|
|
966
1080
|
position: "absolute",
|
|
967
1081
|
inset: 0,
|
|
@@ -990,18 +1104,18 @@ const xt = typeof window > "u" ? D : st, Dt = lt(
|
|
|
990
1104
|
touchAction: "manipulation"
|
|
991
1105
|
},
|
|
992
1106
|
onChange: (t) => {
|
|
993
|
-
|
|
1107
|
+
H.current ? F(t.currentTarget.value) : _e(t.currentTarget);
|
|
994
1108
|
},
|
|
995
|
-
onSelect:
|
|
1109
|
+
onSelect: K,
|
|
996
1110
|
onCompositionStart: () => {
|
|
997
|
-
|
|
1111
|
+
Q(), K(), z.current = p.current, H.current = !0, F(k.current?.value ?? p.current.value);
|
|
998
1112
|
},
|
|
999
1113
|
onCompositionEnd: (t) => {
|
|
1000
|
-
|
|
1114
|
+
H.current = !1, F(null), z.current?.value === p.current.value ? _e(t.currentTarget) : (t.currentTarget.value = p.current.value, S({ ...p.current })), z.current = null;
|
|
1001
1115
|
}
|
|
1002
1116
|
}
|
|
1003
1117
|
),
|
|
1004
|
-
/* @__PURE__ */
|
|
1118
|
+
/* @__PURE__ */ T(
|
|
1005
1119
|
"span",
|
|
1006
1120
|
{
|
|
1007
1121
|
role: "status",
|
|
@@ -1013,14 +1127,14 @@ const xt = typeof window > "u" ? D : st, Dt = lt(
|
|
|
1013
1127
|
clipPath: "inset(50%)",
|
|
1014
1128
|
whiteSpace: "nowrap"
|
|
1015
1129
|
},
|
|
1016
|
-
children:
|
|
1130
|
+
children: Ce
|
|
1017
1131
|
}
|
|
1018
1132
|
)
|
|
1019
1133
|
]
|
|
1020
1134
|
}
|
|
1021
1135
|
);
|
|
1022
1136
|
}
|
|
1023
|
-
),
|
|
1137
|
+
), Lt = [
|
|
1024
1138
|
[
|
|
1025
1139
|
{
|
|
1026
1140
|
value: "1"
|
|
@@ -1137,97 +1251,97 @@ const xt = typeof window > "u" ? D : st, Dt = lt(
|
|
|
1137
1251
|
}
|
|
1138
1252
|
]
|
|
1139
1253
|
];
|
|
1140
|
-
function
|
|
1254
|
+
function At({
|
|
1141
1255
|
tagName: e,
|
|
1142
1256
|
css: n,
|
|
1143
1257
|
children: r,
|
|
1144
|
-
hostRef:
|
|
1258
|
+
hostRef: a,
|
|
1145
1259
|
...l
|
|
1146
1260
|
}) {
|
|
1147
|
-
const [
|
|
1261
|
+
const [c, f] = B(null), v = E(
|
|
1148
1262
|
(u) => {
|
|
1149
|
-
|
|
1263
|
+
a && (a.current = u), u && f(u.shadowRoot ?? u.attachShadow({ mode: "open" }));
|
|
1150
1264
|
},
|
|
1151
|
-
[
|
|
1265
|
+
[a]
|
|
1152
1266
|
);
|
|
1153
|
-
return
|
|
1267
|
+
return ht(
|
|
1154
1268
|
e,
|
|
1155
|
-
{ ...l, ref:
|
|
1156
|
-
|
|
1157
|
-
/* @__PURE__ */ X(
|
|
1158
|
-
n && /* @__PURE__ */
|
|
1269
|
+
{ ...l, ref: v },
|
|
1270
|
+
c && Fe(
|
|
1271
|
+
/* @__PURE__ */ X(He, { children: [
|
|
1272
|
+
n && /* @__PURE__ */ T("style", { children: n }),
|
|
1159
1273
|
r
|
|
1160
1274
|
] }),
|
|
1161
|
-
|
|
1275
|
+
c
|
|
1162
1276
|
)
|
|
1163
1277
|
);
|
|
1164
1278
|
}
|
|
1165
|
-
function
|
|
1279
|
+
function Oe(e, n, r) {
|
|
1166
1280
|
if (e.type === "action") return e.value === `
|
|
1167
1281
|
` ? "Enter" : e.value;
|
|
1168
1282
|
if (!/^[a-zA-Z]$/.test(e.value)) return e.value;
|
|
1169
|
-
const
|
|
1170
|
-
return n ?
|
|
1283
|
+
const a = r ? e.value.toUpperCase() : e.value;
|
|
1284
|
+
return n ? tt(a) : a;
|
|
1171
1285
|
}
|
|
1172
|
-
function
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
const l =
|
|
1176
|
-
clearTimeout(l.current),
|
|
1286
|
+
function Be(e, { disabled: n = !1, repeat: r = !1 } = {}) {
|
|
1287
|
+
const a = P(e);
|
|
1288
|
+
a.current = e;
|
|
1289
|
+
const l = P(void 0), c = P(null), [f, v] = B(!1), u = E(() => {
|
|
1290
|
+
clearTimeout(l.current), c.current = null, v(!1);
|
|
1177
1291
|
}, []);
|
|
1178
|
-
|
|
1292
|
+
R(() => (window.addEventListener("blur", u), document.addEventListener("visibilitychange", u), () => {
|
|
1179
1293
|
u(), window.removeEventListener("blur", u), document.removeEventListener("visibilitychange", u);
|
|
1180
|
-
}), [u]),
|
|
1294
|
+
}), [u]), R(() => {
|
|
1181
1295
|
n && u();
|
|
1182
1296
|
}, [n, u]);
|
|
1183
|
-
const w = (
|
|
1184
|
-
const
|
|
1185
|
-
return !!
|
|
1297
|
+
const w = (d) => {
|
|
1298
|
+
const i = c.current?.bounds;
|
|
1299
|
+
return !!i && d.clientX >= i.left && d.clientX <= i.right && d.clientY >= i.top && d.clientY <= i.bottom;
|
|
1186
1300
|
};
|
|
1187
1301
|
return {
|
|
1188
1302
|
"data-pressed": f || void 0,
|
|
1189
|
-
onPointerDown: (
|
|
1190
|
-
if (!(n ||
|
|
1191
|
-
|
|
1192
|
-
id:
|
|
1193
|
-
bounds:
|
|
1303
|
+
onPointerDown: (d) => {
|
|
1304
|
+
if (!(n || d.button !== 0 || c.current)) {
|
|
1305
|
+
d.preventDefault(), c.current = {
|
|
1306
|
+
id: d.pointerId,
|
|
1307
|
+
bounds: d.currentTarget.getBoundingClientRect(),
|
|
1194
1308
|
repeated: !1
|
|
1195
|
-
},
|
|
1309
|
+
}, v(!0);
|
|
1196
1310
|
try {
|
|
1197
|
-
|
|
1311
|
+
d.currentTarget.setPointerCapture?.(d.pointerId);
|
|
1198
1312
|
} catch {
|
|
1199
1313
|
}
|
|
1200
1314
|
if (r) {
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1315
|
+
const i = () => {
|
|
1316
|
+
c.current && (c.current.repeated = !0, a.current(), l.current = setTimeout(i, 65));
|
|
1203
1317
|
};
|
|
1204
|
-
l.current = setTimeout(
|
|
1318
|
+
l.current = setTimeout(i, 450);
|
|
1205
1319
|
}
|
|
1206
1320
|
}
|
|
1207
1321
|
},
|
|
1208
|
-
onPointerMove: (
|
|
1209
|
-
|
|
1322
|
+
onPointerMove: (d) => {
|
|
1323
|
+
c.current?.id === d.pointerId && !w(d) && u();
|
|
1210
1324
|
},
|
|
1211
|
-
onPointerUp: (
|
|
1212
|
-
if (
|
|
1213
|
-
const
|
|
1214
|
-
u(),
|
|
1325
|
+
onPointerUp: (d) => {
|
|
1326
|
+
if (c.current?.id !== d.pointerId) return;
|
|
1327
|
+
const i = !n && w(d) && !c.current.repeated;
|
|
1328
|
+
u(), i && a.current();
|
|
1215
1329
|
},
|
|
1216
|
-
onPointerCancel: (
|
|
1217
|
-
|
|
1330
|
+
onPointerCancel: (d) => {
|
|
1331
|
+
c.current?.id === d.pointerId && u();
|
|
1218
1332
|
},
|
|
1219
|
-
onLostPointerCapture: (
|
|
1220
|
-
|
|
1333
|
+
onLostPointerCapture: (d) => {
|
|
1334
|
+
c.current?.id === d.pointerId && u();
|
|
1221
1335
|
},
|
|
1222
|
-
onPointerLeave: (
|
|
1223
|
-
|
|
1336
|
+
onPointerLeave: (d) => {
|
|
1337
|
+
c.current?.id === d.pointerId && !w(d) && u();
|
|
1224
1338
|
},
|
|
1225
|
-
onClick: (
|
|
1226
|
-
!n &&
|
|
1339
|
+
onClick: (d) => {
|
|
1340
|
+
!n && d.detail === 0 && !c.current && a.current();
|
|
1227
1341
|
}
|
|
1228
1342
|
};
|
|
1229
1343
|
}
|
|
1230
|
-
const
|
|
1344
|
+
const Re = {
|
|
1231
1345
|
Shift: "Shift",
|
|
1232
1346
|
HangulMode: "한영 전환",
|
|
1233
1347
|
Backspace: "지우기",
|
|
@@ -1246,32 +1360,32 @@ const ze = {
|
|
|
1246
1360
|
Redo: "다시 실행",
|
|
1247
1361
|
SelectAll: "전체 선택"
|
|
1248
1362
|
};
|
|
1249
|
-
function
|
|
1363
|
+
function Me({
|
|
1250
1364
|
cell: e,
|
|
1251
1365
|
label: n,
|
|
1252
1366
|
value: r,
|
|
1253
|
-
active:
|
|
1367
|
+
active: a,
|
|
1254
1368
|
disabled: l,
|
|
1255
|
-
busy:
|
|
1369
|
+
busy: c,
|
|
1256
1370
|
dispatch: f
|
|
1257
1371
|
}) {
|
|
1258
|
-
const
|
|
1372
|
+
const { locale: v } = xe(), u = (s) => je(s, v), w = Be(f, {
|
|
1259
1373
|
disabled: l,
|
|
1260
1374
|
repeat: ["Backspace", "Delete", "ArrowLeft", "ArrowRight"].includes(r)
|
|
1261
|
-
}),
|
|
1262
|
-
return /* @__PURE__ */
|
|
1375
|
+
}), 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__ */ T(
|
|
1263
1377
|
"button",
|
|
1264
1378
|
{
|
|
1265
1379
|
type: "button",
|
|
1266
1380
|
disabled: l,
|
|
1267
|
-
"aria-label":
|
|
1268
|
-
"aria-pressed":
|
|
1269
|
-
"aria-busy":
|
|
1270
|
-
className:
|
|
1271
|
-
title:
|
|
1381
|
+
"aria-label": u(Re[r] ?? n),
|
|
1382
|
+
"aria-pressed": a,
|
|
1383
|
+
"aria-busy": c || void 0,
|
|
1384
|
+
className: d ? "key action language" : e.type === "action" ? "key action" : "key",
|
|
1385
|
+
title: d ? l ? v === "en" ? `${a ? "Korean" : "English"} only` : `${a ? "한국어" : "영어"} 전용` : v === "en" ? `Switch to ${a ? "English" : "Korean"}` : `${a ? "영어" : "한국어"}로 전환` : void 0,
|
|
1272
1386
|
style: { flex: e.width && e.width > 0 ? e.width : 1 },
|
|
1273
|
-
...
|
|
1274
|
-
children:
|
|
1387
|
+
...w,
|
|
1388
|
+
children: c ? u("읽는 중…") : i ? /* @__PURE__ */ X(
|
|
1275
1389
|
"svg",
|
|
1276
1390
|
{
|
|
1277
1391
|
"data-key-icon": r === "Backspace" ? "backspace" : "delete",
|
|
@@ -1287,11 +1401,11 @@ function Ae({
|
|
|
1287
1401
|
focusable: "false",
|
|
1288
1402
|
style: r === "Delete" ? { transform: "scaleX(-1)" } : void 0,
|
|
1289
1403
|
children: [
|
|
1290
|
-
/* @__PURE__ */
|
|
1291
|
-
/* @__PURE__ */
|
|
1404
|
+
/* @__PURE__ */ T("path", { d: "M9 5H20a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 20 19H9l-7-7 7-7Z" }),
|
|
1405
|
+
/* @__PURE__ */ T("path", { d: "m12 9 6 6m0-6-6 6" })
|
|
1292
1406
|
]
|
|
1293
1407
|
}
|
|
1294
|
-
) :
|
|
1408
|
+
) : d && !e.label ? /* @__PURE__ */ X("span", { className: "language-label", "aria-hidden": "true", children: [
|
|
1295
1409
|
/* @__PURE__ */ X(
|
|
1296
1410
|
"svg",
|
|
1297
1411
|
{
|
|
@@ -1305,122 +1419,122 @@ function Ae({
|
|
|
1305
1419
|
strokeLinejoin: "round",
|
|
1306
1420
|
focusable: "false",
|
|
1307
1421
|
children: [
|
|
1308
|
-
/* @__PURE__ */
|
|
1309
|
-
/* @__PURE__ */
|
|
1310
|
-
/* @__PURE__ */
|
|
1422
|
+
/* @__PURE__ */ T("circle", { cx: "12", cy: "12", r: "9" }),
|
|
1423
|
+
/* @__PURE__ */ T("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
|
|
1424
|
+
/* @__PURE__ */ T("path", { d: "M3 12h18" })
|
|
1311
1425
|
]
|
|
1312
1426
|
}
|
|
1313
1427
|
),
|
|
1314
|
-
/* @__PURE__ */
|
|
1315
|
-
] }) : n
|
|
1428
|
+
/* @__PURE__ */ T("span", { children: a ? "한" : "EN" })
|
|
1429
|
+
] }) : e.type === "action" ? u(n) : n
|
|
1316
1430
|
}
|
|
1317
1431
|
);
|
|
1318
1432
|
}
|
|
1319
|
-
function
|
|
1433
|
+
function Pt({
|
|
1320
1434
|
layout: e,
|
|
1321
1435
|
viewport: n,
|
|
1322
1436
|
onHeightChange: r
|
|
1323
1437
|
}) {
|
|
1324
|
-
const
|
|
1325
|
-
inputRef:
|
|
1326
|
-
hangulMode:
|
|
1327
|
-
shift:
|
|
1328
|
-
shiftLocked:
|
|
1329
|
-
theme:
|
|
1330
|
-
selectionMode:
|
|
1331
|
-
selectionAdjusting:
|
|
1332
|
-
activeInputPolicy:
|
|
1333
|
-
editingStatus:
|
|
1334
|
-
onBlur:
|
|
1335
|
-
} =
|
|
1336
|
-
|
|
1337
|
-
),
|
|
1338
|
-
|
|
1339
|
-
if (
|
|
1438
|
+
const a = xe(), l = (g) => je(g, a.locale), {
|
|
1439
|
+
inputRef: c,
|
|
1440
|
+
hangulMode: f,
|
|
1441
|
+
shift: v,
|
|
1442
|
+
shiftLocked: u,
|
|
1443
|
+
theme: w,
|
|
1444
|
+
selectionMode: d,
|
|
1445
|
+
selectionAdjusting: i,
|
|
1446
|
+
activeInputPolicy: s,
|
|
1447
|
+
editingStatus: h,
|
|
1448
|
+
onBlur: C
|
|
1449
|
+
} = a, $ = P(null), [U, Y] = B(!1), oe = Be(() => Y((g) => !g)), q = Be(() => C(!0)), O = ["text", "hangul", "custom"].includes(
|
|
1450
|
+
s.mode
|
|
1451
|
+
), ee = U && O && !d ? Lt : e;
|
|
1452
|
+
R(() => {
|
|
1453
|
+
if (!$.current) return;
|
|
1340
1454
|
const g = () => {
|
|
1341
|
-
const
|
|
1342
|
-
r(
|
|
1455
|
+
const L = $.current?.getBoundingClientRect().height ?? 0;
|
|
1456
|
+
r(L);
|
|
1343
1457
|
};
|
|
1344
1458
|
g();
|
|
1345
|
-
const
|
|
1346
|
-
return
|
|
1347
|
-
}, [r]),
|
|
1459
|
+
const m = new ResizeObserver(g);
|
|
1460
|
+
return m.observe($.current), () => m.disconnect();
|
|
1461
|
+
}, [r]), R(() => {
|
|
1348
1462
|
let g = null;
|
|
1349
|
-
const
|
|
1350
|
-
(
|
|
1351
|
-
),
|
|
1352
|
-
|
|
1353
|
-
},
|
|
1354
|
-
g && g.id === A.pointerId && Math.hypot(A.clientX - g.x, A.clientY - g.y) < 10 && !
|
|
1355
|
-
},
|
|
1463
|
+
const m = /* @__PURE__ */ new Set(), L = (A) => A.composedPath().some(
|
|
1464
|
+
(ne) => ne === $.current || ne instanceof Element && ne.hasAttribute("data-virtual-input")
|
|
1465
|
+
), k = (A) => {
|
|
1466
|
+
m.add(A.pointerId), g = m.size !== 1 || A.button !== 0 || L(A) ? null : { x: A.clientX, y: A.clientY, id: A.pointerId };
|
|
1467
|
+
}, M = (A) => {
|
|
1468
|
+
g && g.id === A.pointerId && Math.hypot(A.clientX - g.x, A.clientY - g.y) < 10 && !L(A) && C(!0), g = null, m.delete(A.pointerId);
|
|
1469
|
+
}, H = (A) => {
|
|
1356
1470
|
g?.id === A.pointerId && Math.hypot(A.clientX - g.x, A.clientY - g.y) >= 10 && (g = null);
|
|
1357
|
-
},
|
|
1471
|
+
}, z = () => {
|
|
1358
1472
|
g = null;
|
|
1359
|
-
},
|
|
1360
|
-
|
|
1361
|
-
},
|
|
1362
|
-
|
|
1473
|
+
}, le = (A) => {
|
|
1474
|
+
z(), m.delete(A.pointerId);
|
|
1475
|
+
}, F = () => {
|
|
1476
|
+
z(), m.clear();
|
|
1363
1477
|
};
|
|
1364
|
-
return window.addEventListener("pointerdown",
|
|
1365
|
-
window.removeEventListener("pointerdown",
|
|
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", F), document.addEventListener("visibilitychange", F), () => {
|
|
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", F), document.removeEventListener("visibilitychange", F);
|
|
1366
1480
|
};
|
|
1367
|
-
}, [
|
|
1368
|
-
const
|
|
1369
|
-
const
|
|
1481
|
+
}, [C]);
|
|
1482
|
+
const te = (g) => {
|
|
1483
|
+
const m = Oe(g, f, v);
|
|
1370
1484
|
if (g.type !== "action") {
|
|
1371
|
-
|
|
1485
|
+
c.current?.insertText(m, Se(m)), a.consumeShift();
|
|
1372
1486
|
return;
|
|
1373
1487
|
}
|
|
1374
|
-
switch (
|
|
1488
|
+
switch (m) {
|
|
1375
1489
|
case "Undo":
|
|
1376
|
-
|
|
1490
|
+
c.current?.undo();
|
|
1377
1491
|
break;
|
|
1378
1492
|
case "Redo":
|
|
1379
|
-
|
|
1493
|
+
c.current?.redo();
|
|
1380
1494
|
break;
|
|
1381
1495
|
case "SelectAll":
|
|
1382
|
-
|
|
1496
|
+
c.current?.selectAll();
|
|
1383
1497
|
break;
|
|
1384
1498
|
case "Shift":
|
|
1385
|
-
|
|
1499
|
+
a.toggleShift();
|
|
1386
1500
|
break;
|
|
1387
1501
|
case "HangulMode":
|
|
1388
|
-
|
|
1389
|
-
new KeyboardEvent("keydown", { key:
|
|
1502
|
+
c.current?.handleKeyDown(
|
|
1503
|
+
new KeyboardEvent("keydown", { key: m })
|
|
1390
1504
|
);
|
|
1391
1505
|
break;
|
|
1392
1506
|
case "EnterSelectionMode":
|
|
1393
|
-
|
|
1507
|
+
Y(!1), a.enterSelectionMode();
|
|
1394
1508
|
break;
|
|
1395
1509
|
case "ExitSelectionMode":
|
|
1396
|
-
|
|
1510
|
+
a.exitSelectionMode();
|
|
1397
1511
|
break;
|
|
1398
1512
|
case "ToggleSelectionAdjust":
|
|
1399
|
-
|
|
1513
|
+
a.toggleSelectionAdjust();
|
|
1400
1514
|
break;
|
|
1401
1515
|
case "Copy":
|
|
1402
|
-
|
|
1516
|
+
c.current?.copySelection();
|
|
1403
1517
|
break;
|
|
1404
1518
|
case "Paste":
|
|
1405
|
-
|
|
1519
|
+
c.current?.pasteClipboard();
|
|
1406
1520
|
break;
|
|
1407
1521
|
case "Cut":
|
|
1408
|
-
|
|
1522
|
+
c.current?.cutSelection();
|
|
1409
1523
|
break;
|
|
1410
1524
|
case "ArrowLeft":
|
|
1411
|
-
|
|
1525
|
+
c.current?.moveCaret("left", i);
|
|
1412
1526
|
break;
|
|
1413
1527
|
case "ArrowRight":
|
|
1414
|
-
|
|
1528
|
+
c.current?.moveCaret("right", i);
|
|
1415
1529
|
break;
|
|
1416
1530
|
default:
|
|
1417
|
-
|
|
1418
|
-
new KeyboardEvent("keydown", { key:
|
|
1531
|
+
m === " " ? c.current?.insertText(" ") : c.current?.handleKeyDown(
|
|
1532
|
+
new KeyboardEvent("keydown", { key: m })
|
|
1419
1533
|
);
|
|
1420
1534
|
}
|
|
1421
|
-
}, G =
|
|
1422
|
-
|
|
1423
|
-
),
|
|
1535
|
+
}, G = Ee(s.mode) !== null, ie = [l("복사했어요"), l("붙여넣었어요")].includes(
|
|
1536
|
+
h.message
|
|
1537
|
+
), ue = {
|
|
1424
1538
|
position: "fixed",
|
|
1425
1539
|
zIndex: 9999,
|
|
1426
1540
|
boxSizing: "border-box",
|
|
@@ -1431,33 +1545,33 @@ function St({
|
|
|
1431
1545
|
...n.height ? { top: n.offsetTop + n.height } : { bottom: 0 },
|
|
1432
1546
|
maxHeight: n.height ? n.height * 0.65 : "65dvh",
|
|
1433
1547
|
overflowY: "auto",
|
|
1434
|
-
colorScheme:
|
|
1435
|
-
background:
|
|
1436
|
-
color:
|
|
1437
|
-
border: "1px solid " + (
|
|
1548
|
+
colorScheme: w,
|
|
1549
|
+
background: w === "dark" ? "#18201f" : "#e9eeeb",
|
|
1550
|
+
color: w === "dark" ? "#eef4ef" : "#203b31",
|
|
1551
|
+
border: "1px solid " + (w === "dark" ? "#35413c" : "#c8d3cb"),
|
|
1438
1552
|
borderRadius: "20px 20px 0 0",
|
|
1439
1553
|
boxShadow: "0 -8px 48px #10251a20",
|
|
1440
1554
|
touchAction: "manipulation",
|
|
1441
1555
|
userSelect: "none",
|
|
1442
1556
|
WebkitUserSelect: "none"
|
|
1443
1557
|
};
|
|
1444
|
-
return
|
|
1445
|
-
/* @__PURE__ */
|
|
1446
|
-
|
|
1558
|
+
return Fe(
|
|
1559
|
+
/* @__PURE__ */ T(
|
|
1560
|
+
At,
|
|
1447
1561
|
{
|
|
1448
1562
|
tagName: "virtual-keypad",
|
|
1449
|
-
hostRef:
|
|
1563
|
+
hostRef: $,
|
|
1450
1564
|
"data-virtual-keypad": "true",
|
|
1451
|
-
style:
|
|
1565
|
+
style: ue,
|
|
1452
1566
|
onPointerDown: (g) => {
|
|
1453
1567
|
g.button === 0 && g.preventDefault();
|
|
1454
1568
|
},
|
|
1455
1569
|
onMouseDown: (g) => {
|
|
1456
1570
|
g.button === 0 && g.preventDefault();
|
|
1457
1571
|
},
|
|
1458
|
-
onBlur:
|
|
1572
|
+
onBlur: a.onBlur,
|
|
1459
1573
|
onKeyDown: (g) => {
|
|
1460
|
-
g.key === "Escape" && (g.preventDefault(),
|
|
1574
|
+
g.key === "Escape" && (g.preventDefault(), C(!0));
|
|
1461
1575
|
},
|
|
1462
1576
|
css: `
|
|
1463
1577
|
* {
|
|
@@ -1522,9 +1636,9 @@ function St({
|
|
|
1522
1636
|
min-height: 44px;
|
|
1523
1637
|
border: 0;
|
|
1524
1638
|
border-radius: 8px;
|
|
1525
|
-
background: ${
|
|
1639
|
+
background: ${w === "dark" ? "#303c37" : "#fff"};
|
|
1526
1640
|
color: inherit;
|
|
1527
|
-
box-shadow: 0 2px 0 ${
|
|
1641
|
+
box-shadow: 0 2px 0 ${w === "dark" ? "#0d1611" : "#bdc9c1"};
|
|
1528
1642
|
font: inherit;
|
|
1529
1643
|
padding: 8px 0;
|
|
1530
1644
|
touch-action: none;
|
|
@@ -1532,7 +1646,7 @@ function St({
|
|
|
1532
1646
|
user-select: none;
|
|
1533
1647
|
}
|
|
1534
1648
|
.action {
|
|
1535
|
-
background: ${
|
|
1649
|
+
background: ${w === "dark" ? "#414e46" : "#d7e1db"};
|
|
1536
1650
|
font-size: 14px;
|
|
1537
1651
|
}
|
|
1538
1652
|
.selection-count {
|
|
@@ -1604,151 +1718,151 @@ function St({
|
|
|
1604
1718
|
}
|
|
1605
1719
|
}
|
|
1606
1720
|
`,
|
|
1607
|
-
children: /* @__PURE__ */ X("section", { className: "keyboard", role: "group", "aria-label": "가상 키보드", children: [
|
|
1721
|
+
children: /* @__PURE__ */ X("section", { className: "keyboard", role: "group", "aria-label": l("가상 키보드"), children: [
|
|
1608
1722
|
/* @__PURE__ */ X("div", { className: "toolbar", children: [
|
|
1609
|
-
|
|
1610
|
-
/* @__PURE__ */
|
|
1723
|
+
h.selectionLength > 0 && !d ? /* @__PURE__ */ X(He, { children: [
|
|
1724
|
+
/* @__PURE__ */ T(
|
|
1611
1725
|
"span",
|
|
1612
1726
|
{
|
|
1613
1727
|
className: "selection-count",
|
|
1614
|
-
title:
|
|
1615
|
-
children:
|
|
1728
|
+
title: h.message || void 0,
|
|
1729
|
+
children: ie ? h.message : a.locale === "en" ? `${h.selectionLength} characters selected` : `${h.selectionLength}자 선택`
|
|
1616
1730
|
}
|
|
1617
1731
|
),
|
|
1618
|
-
/* @__PURE__ */
|
|
1732
|
+
/* @__PURE__ */ T(
|
|
1619
1733
|
"div",
|
|
1620
1734
|
{
|
|
1621
1735
|
className: "selection-actions",
|
|
1622
1736
|
role: "group",
|
|
1623
|
-
"aria-label": "선택한 텍스트 편집",
|
|
1624
|
-
children: ["Copy", "Cut", "Paste"].map((g) => /* @__PURE__ */
|
|
1625
|
-
|
|
1737
|
+
"aria-label": l("선택한 텍스트 편집"),
|
|
1738
|
+
children: ["Copy", "Cut", "Paste"].map((g) => /* @__PURE__ */ T(
|
|
1739
|
+
Me,
|
|
1626
1740
|
{
|
|
1627
1741
|
cell: { value: g, type: "action" },
|
|
1628
1742
|
value: g,
|
|
1629
|
-
label:
|
|
1630
|
-
disabled: g === "Paste" &&
|
|
1631
|
-
busy: g === "Paste" &&
|
|
1632
|
-
dispatch: () =>
|
|
1743
|
+
label: l(Re[g]),
|
|
1744
|
+
disabled: g === "Paste" && h.pasting,
|
|
1745
|
+
busy: g === "Paste" && h.pasting,
|
|
1746
|
+
dispatch: () => te({ value: g, type: "action" })
|
|
1633
1747
|
},
|
|
1634
1748
|
g
|
|
1635
1749
|
))
|
|
1636
1750
|
}
|
|
1637
1751
|
)
|
|
1638
1752
|
] }) : /* @__PURE__ */ X("span", { className: "toolbar-caption", children: [
|
|
1639
|
-
|
|
1640
|
-
|
|
1753
|
+
ie ? h.message : d ? l("텍스트 편집") : U && O ? l("숫자 · 기호") : s.mode === "number" ? l("숫자") : s.mode === "tel" ? l("전화번호") : f ? l("한국어 · 두벌식") : "English",
|
|
1754
|
+
u ? l(" · Shift 고정") : ""
|
|
1641
1755
|
] }),
|
|
1642
|
-
!
|
|
1643
|
-
|
|
1756
|
+
!d && !h.selectionLength && /* @__PURE__ */ T("div", { className: "paste-action", children: /* @__PURE__ */ T(
|
|
1757
|
+
Me,
|
|
1644
1758
|
{
|
|
1645
1759
|
cell: { value: "Paste", type: "action" },
|
|
1646
1760
|
value: "Paste",
|
|
1647
|
-
label: "붙여넣기",
|
|
1648
|
-
disabled:
|
|
1649
|
-
busy:
|
|
1650
|
-
dispatch: () =>
|
|
1761
|
+
label: l("붙여넣기"),
|
|
1762
|
+
disabled: h.pasting,
|
|
1763
|
+
busy: h.pasting,
|
|
1764
|
+
dispatch: () => te({ value: "Paste", type: "action" })
|
|
1651
1765
|
}
|
|
1652
1766
|
) }),
|
|
1653
|
-
|
|
1767
|
+
O && !d && !h.selectionLength && /* @__PURE__ */ T(
|
|
1654
1768
|
"button",
|
|
1655
1769
|
{
|
|
1656
1770
|
type: "button",
|
|
1657
1771
|
className: "close",
|
|
1658
|
-
"aria-label": "숫자·기호 전환",
|
|
1659
|
-
"aria-pressed":
|
|
1660
|
-
...
|
|
1661
|
-
children:
|
|
1772
|
+
"aria-label": l("숫자·기호 전환"),
|
|
1773
|
+
"aria-pressed": U,
|
|
1774
|
+
...oe,
|
|
1775
|
+
children: U ? "가 / ABC" : "123 / #+="
|
|
1662
1776
|
}
|
|
1663
1777
|
),
|
|
1664
|
-
/* @__PURE__ */
|
|
1778
|
+
/* @__PURE__ */ T(
|
|
1665
1779
|
"button",
|
|
1666
1780
|
{
|
|
1667
1781
|
type: "button",
|
|
1668
1782
|
className: "close",
|
|
1669
|
-
...
|
|
1670
|
-
"aria-label": "키보드 닫기",
|
|
1671
|
-
children: "닫기 ↓"
|
|
1783
|
+
...q,
|
|
1784
|
+
"aria-label": l("키보드 닫기"),
|
|
1785
|
+
children: l("닫기 ↓")
|
|
1672
1786
|
}
|
|
1673
1787
|
)
|
|
1674
1788
|
] }),
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
const
|
|
1678
|
-
return /* @__PURE__ */
|
|
1679
|
-
|
|
1789
|
+
h.message && !ie && /* @__PURE__ */ T("p", { className: "feedback", children: h.message }),
|
|
1790
|
+
ee.map((g, m) => /* @__PURE__ */ T("div", { className: "row", children: g.map((L, k) => {
|
|
1791
|
+
const M = Oe(L, f, v), H = L.type === "action" ? L.label ?? Re[M] ?? M : /^[A-Za-z]$/.test(L.value) ? M : L.label ?? M, z = L.value === "Shift" ? v : L.value === "HangulMode" ? f : L.value === "ToggleSelectionAdjust" ? i : void 0;
|
|
1792
|
+
return /* @__PURE__ */ T(
|
|
1793
|
+
Me,
|
|
1680
1794
|
{
|
|
1681
|
-
cell:
|
|
1682
|
-
label:
|
|
1683
|
-
value:
|
|
1684
|
-
active:
|
|
1685
|
-
busy:
|
|
1686
|
-
disabled:
|
|
1687
|
-
dispatch: () =>
|
|
1795
|
+
cell: L,
|
|
1796
|
+
label: H,
|
|
1797
|
+
value: M,
|
|
1798
|
+
active: z,
|
|
1799
|
+
busy: M === "Paste" && h.pasting,
|
|
1800
|
+
disabled: M === "Paste" && h.pasting || L.value === "HangulMode" && G || ["Copy", "Cut"].includes(M) && !h.selectionLength || M === "SelectAll" && !h.hasValue || (L.type !== "action" || M === " ") && !s.filterKey(M),
|
|
1801
|
+
dispatch: () => te(L)
|
|
1688
1802
|
},
|
|
1689
|
-
`${
|
|
1803
|
+
`${m}-${k}-${L.value}`
|
|
1690
1804
|
);
|
|
1691
|
-
}) },
|
|
1805
|
+
}) }, m))
|
|
1692
1806
|
] })
|
|
1693
1807
|
}
|
|
1694
1808
|
),
|
|
1695
1809
|
document.body
|
|
1696
1810
|
);
|
|
1697
1811
|
}
|
|
1698
|
-
const
|
|
1699
|
-
function
|
|
1700
|
-
const r =
|
|
1812
|
+
const Ke = "virtual-keyboard:storage";
|
|
1813
|
+
function Tt(e, n) {
|
|
1814
|
+
const r = P(n), [a, l] = B(n), c = P(a), f = E(
|
|
1701
1815
|
() => r.current instanceof Function ? r.current() : r.current,
|
|
1702
1816
|
[]
|
|
1703
1817
|
);
|
|
1704
|
-
|
|
1705
|
-
const u = (
|
|
1818
|
+
R(() => {
|
|
1819
|
+
const u = (s) => {
|
|
1706
1820
|
try {
|
|
1707
|
-
const
|
|
1708
|
-
return typeof
|
|
1821
|
+
const h = s === null ? f() : JSON.parse(s);
|
|
1822
|
+
return typeof h == typeof f() ? h : f();
|
|
1709
1823
|
} catch {
|
|
1710
1824
|
return f();
|
|
1711
1825
|
}
|
|
1712
|
-
}, w = (
|
|
1713
|
-
|
|
1826
|
+
}, w = (s) => {
|
|
1827
|
+
c.current = u(s), l(c.current);
|
|
1714
1828
|
};
|
|
1715
1829
|
try {
|
|
1716
1830
|
w(window.localStorage.getItem(e));
|
|
1717
1831
|
} catch {
|
|
1718
1832
|
}
|
|
1719
|
-
const
|
|
1833
|
+
const d = (s) => {
|
|
1720
1834
|
try {
|
|
1721
|
-
if (
|
|
1835
|
+
if (s.storageArea && s.storageArea !== window.localStorage)
|
|
1722
1836
|
return;
|
|
1723
1837
|
} catch {
|
|
1724
1838
|
return;
|
|
1725
1839
|
}
|
|
1726
|
-
(
|
|
1727
|
-
},
|
|
1728
|
-
const
|
|
1729
|
-
|
|
1840
|
+
(s.key === e || s.key === null) && w(s.newValue);
|
|
1841
|
+
}, i = (s) => {
|
|
1842
|
+
const h = s.detail;
|
|
1843
|
+
h.key === e && w(h.raw);
|
|
1730
1844
|
};
|
|
1731
|
-
return window.addEventListener("storage",
|
|
1732
|
-
window.removeEventListener("storage",
|
|
1845
|
+
return window.addEventListener("storage", d), window.addEventListener(Ke, i), () => {
|
|
1846
|
+
window.removeEventListener("storage", d), window.removeEventListener(Ke, i);
|
|
1733
1847
|
};
|
|
1734
1848
|
}, [e, f]);
|
|
1735
|
-
const
|
|
1849
|
+
const v = E(
|
|
1736
1850
|
(u) => {
|
|
1737
|
-
|
|
1738
|
-
new CustomEvent(
|
|
1739
|
-
detail: { key: e, raw: JSON.stringify(
|
|
1851
|
+
c.current = u instanceof Function ? u(c.current) : u, l(c.current), window.dispatchEvent(
|
|
1852
|
+
new CustomEvent(Ke, {
|
|
1853
|
+
detail: { key: e, raw: JSON.stringify(c.current) }
|
|
1740
1854
|
})
|
|
1741
1855
|
);
|
|
1742
1856
|
try {
|
|
1743
|
-
window.localStorage.setItem(e, JSON.stringify(
|
|
1857
|
+
window.localStorage.setItem(e, JSON.stringify(c.current));
|
|
1744
1858
|
} catch {
|
|
1745
1859
|
}
|
|
1746
1860
|
},
|
|
1747
1861
|
[e]
|
|
1748
1862
|
);
|
|
1749
|
-
return [
|
|
1863
|
+
return [a, v];
|
|
1750
1864
|
}
|
|
1751
|
-
const
|
|
1865
|
+
const Mt = [
|
|
1752
1866
|
[
|
|
1753
1867
|
{
|
|
1754
1868
|
label: "전체 선택",
|
|
@@ -1828,7 +1942,7 @@ const Ct = [
|
|
|
1828
1942
|
type: "action"
|
|
1829
1943
|
}
|
|
1830
1944
|
]
|
|
1831
|
-
],
|
|
1945
|
+
], Kt = () => typeof window > "u" ? { width: 0, height: 0, scale: 1, offsetLeft: 0, offsetTop: 0 } : typeof window < "u" && window.visualViewport ? {
|
|
1832
1946
|
width: window.visualViewport.width,
|
|
1833
1947
|
height: window.visualViewport.height,
|
|
1834
1948
|
scale: window.visualViewport.scale,
|
|
@@ -1840,26 +1954,26 @@ const Ct = [
|
|
|
1840
1954
|
scale: 1,
|
|
1841
1955
|
offsetLeft: 0,
|
|
1842
1956
|
offsetTop: 0
|
|
1843
|
-
},
|
|
1844
|
-
const [e, n] =
|
|
1957
|
+
}, 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] = B(() => ({
|
|
1845
1959
|
width: 0,
|
|
1846
1960
|
height: 0,
|
|
1847
1961
|
scale: 1,
|
|
1848
1962
|
offsetLeft: 0,
|
|
1849
1963
|
offsetTop: 0
|
|
1850
1964
|
}));
|
|
1851
|
-
return
|
|
1965
|
+
return R(() => {
|
|
1852
1966
|
if (typeof window > "u") return;
|
|
1853
1967
|
let r = null;
|
|
1854
|
-
const
|
|
1855
|
-
const
|
|
1968
|
+
const a = () => {
|
|
1969
|
+
const c = Kt();
|
|
1856
1970
|
n(
|
|
1857
|
-
(f) =>
|
|
1971
|
+
(f) => It(f, c) ? f : c
|
|
1858
1972
|
);
|
|
1859
1973
|
};
|
|
1860
|
-
|
|
1974
|
+
a();
|
|
1861
1975
|
const l = () => {
|
|
1862
|
-
r !== null && cancelAnimationFrame(r), r = requestAnimationFrame(
|
|
1976
|
+
r !== null && cancelAnimationFrame(r), r = requestAnimationFrame(a);
|
|
1863
1977
|
};
|
|
1864
1978
|
return window.visualViewport ? (window.visualViewport.addEventListener("resize", l, {
|
|
1865
1979
|
passive: !0
|
|
@@ -1870,167 +1984,169 @@ const Ct = [
|
|
|
1870
1984
|
};
|
|
1871
1985
|
}, []), e;
|
|
1872
1986
|
};
|
|
1873
|
-
function
|
|
1874
|
-
const [e, n] =
|
|
1875
|
-
return
|
|
1987
|
+
function Dt() {
|
|
1988
|
+
const [e, n] = B("light");
|
|
1989
|
+
return R(() => {
|
|
1876
1990
|
if (typeof window > "u" || !window.matchMedia) return;
|
|
1877
1991
|
const r = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1878
1992
|
n(r.matches ? "dark" : "light");
|
|
1879
|
-
const
|
|
1993
|
+
const a = (l) => {
|
|
1880
1994
|
n(l.matches ? "dark" : "light");
|
|
1881
1995
|
};
|
|
1882
|
-
return r.addEventListener("change",
|
|
1996
|
+
return r.addEventListener("change", a), () => r.removeEventListener("change", a);
|
|
1883
1997
|
}, []), e;
|
|
1884
1998
|
}
|
|
1885
|
-
function
|
|
1999
|
+
function rt(e) {
|
|
1886
2000
|
return e !== void 0 ? /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
1887
2001
|
e
|
|
1888
|
-
) : typeof navigator > "u" ? !1 :
|
|
2002
|
+
) : typeof navigator > "u" ? !1 : rt(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 || typeof window < "u" && !!window.matchMedia?.("(pointer: coarse)").matches;
|
|
1889
2003
|
}
|
|
1890
|
-
const
|
|
1891
|
-
function
|
|
2004
|
+
const Ie = "virtual-keyboard:focus-change";
|
|
2005
|
+
function jt({
|
|
1892
2006
|
children: e,
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
2007
|
+
locale: n = "ko",
|
|
2008
|
+
layout: r = ce,
|
|
2009
|
+
defaultHangulMode: a = !0,
|
|
2010
|
+
theme: l,
|
|
2011
|
+
keyboardVisibility: c = "auto"
|
|
1897
2012
|
}) {
|
|
1898
|
-
const
|
|
2013
|
+
const f = et(), v = P(null), u = P(null), w = P(
|
|
1899
2014
|
void 0
|
|
1900
|
-
), [
|
|
2015
|
+
), [d, i] = B(), [s, h] = B(0), [C, $] = B(!1), [U, Y] = B(!1), [oe, q] = B({
|
|
1901
2016
|
selectionLength: 0,
|
|
1902
2017
|
hasValue: !1,
|
|
1903
2018
|
message: "",
|
|
1904
2019
|
pasting: !1
|
|
1905
|
-
}),
|
|
1906
|
-
|
|
1907
|
-
(
|
|
2020
|
+
}), O = E((y) => {
|
|
2021
|
+
q(
|
|
2022
|
+
(b) => b.selectionLength === y.selectionLength && b.hasValue === y.hasValue && b.message === y.message && b.pasting === y.pasting ? b : y
|
|
1908
2023
|
);
|
|
1909
|
-
}, []), [
|
|
2024
|
+
}, []), [ee, te] = Tt(
|
|
1910
2025
|
"virtual-keyboard-hangul-mode",
|
|
1911
|
-
|
|
1912
|
-
), [G,
|
|
1913
|
-
() =>
|
|
1914
|
-
), [
|
|
1915
|
-
|
|
1916
|
-
const
|
|
1917
|
-
|
|
1918
|
-
const
|
|
1919
|
-
return
|
|
2026
|
+
a
|
|
2027
|
+
), [G, ie] = B(
|
|
2028
|
+
() => Ve({ layout: r })
|
|
2029
|
+
), [ue, g] = B(!1), [m, L] = B(0), k = Vt(), M = Dt(), H = Ee(G.mode) ?? ee, z = !!d && (c === "always" || c === "auto" && ue), le = P(z);
|
|
2030
|
+
le.current = z, R(() => {
|
|
2031
|
+
const y = () => g(rt());
|
|
2032
|
+
y();
|
|
2033
|
+
const b = window.matchMedia?.("(pointer: coarse)");
|
|
2034
|
+
return b?.addEventListener("change", y), () => b?.removeEventListener("change", y);
|
|
1920
2035
|
}, []);
|
|
1921
|
-
const
|
|
1922
|
-
clearTimeout(
|
|
2036
|
+
const F = E(() => {
|
|
2037
|
+
clearTimeout(w.current), u.current = null, v.current = null, i(void 0), h(0), $(!1), Y(!1);
|
|
1923
2038
|
}, []);
|
|
1924
|
-
|
|
1925
|
-
const
|
|
1926
|
-
|
|
2039
|
+
R(() => {
|
|
2040
|
+
const y = (b) => {
|
|
2041
|
+
b.detail !== f && F();
|
|
1927
2042
|
};
|
|
1928
|
-
return window.addEventListener(
|
|
1929
|
-
window.removeEventListener(
|
|
2043
|
+
return window.addEventListener(Ie, y), () => {
|
|
2044
|
+
window.removeEventListener(Ie, y), clearTimeout(w.current);
|
|
1930
2045
|
};
|
|
1931
|
-
}, [
|
|
1932
|
-
const A =
|
|
1933
|
-
(
|
|
1934
|
-
clearTimeout(
|
|
1935
|
-
new CustomEvent(
|
|
2046
|
+
}, [f, F]);
|
|
2047
|
+
const A = E(
|
|
2048
|
+
(y, b, N) => {
|
|
2049
|
+
clearTimeout(w.current), u.current !== b && (h(0), $(!1), Y(!1)), u.current = b, ie(Ve(N)), i(y), window.dispatchEvent(
|
|
2050
|
+
new CustomEvent(Ie, { detail: f })
|
|
1936
2051
|
);
|
|
1937
2052
|
},
|
|
1938
|
-
[
|
|
1939
|
-
),
|
|
1940
|
-
(
|
|
1941
|
-
if (
|
|
1942
|
-
const
|
|
1943
|
-
|
|
2053
|
+
[f]
|
|
2054
|
+
), ne = E(
|
|
2055
|
+
(y) => {
|
|
2056
|
+
if (y === !0) {
|
|
2057
|
+
const N = document.activeElement, he = N instanceof HTMLElement && u.current?.contains(N);
|
|
2058
|
+
F(), he && N.blur();
|
|
1944
2059
|
return;
|
|
1945
2060
|
}
|
|
1946
|
-
const
|
|
1947
|
-
|
|
2061
|
+
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(F, 0));
|
|
1948
2063
|
},
|
|
1949
|
-
[
|
|
2064
|
+
[F]
|
|
1950
2065
|
);
|
|
1951
|
-
|
|
1952
|
-
if (!
|
|
1953
|
-
const
|
|
1954
|
-
const
|
|
1955
|
-
if (!
|
|
1956
|
-
const
|
|
1957
|
-
|
|
2066
|
+
R(() => {
|
|
2067
|
+
if (!z || !m || k.scale !== 1) return;
|
|
2068
|
+
const y = requestAnimationFrame(() => {
|
|
2069
|
+
const b = u.current?.getBoundingClientRect();
|
|
2070
|
+
if (!b) return;
|
|
2071
|
+
const N = k.offsetTop + k.height - m - 16;
|
|
2072
|
+
b.bottom > N && window.scrollBy({ top: b.bottom - N, behavior: "instant" });
|
|
1958
2073
|
});
|
|
1959
|
-
return () => cancelAnimationFrame(
|
|
2074
|
+
return () => cancelAnimationFrame(y);
|
|
1960
2075
|
}, [
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
2076
|
+
d,
|
|
2077
|
+
z,
|
|
2078
|
+
m,
|
|
2079
|
+
k.height,
|
|
2080
|
+
k.offsetTop,
|
|
2081
|
+
k.scale
|
|
1967
2082
|
]);
|
|
1968
|
-
const
|
|
1969
|
-
|
|
1970
|
-
}, [G.mode,
|
|
1971
|
-
() =>
|
|
2083
|
+
const W = E(() => {
|
|
2084
|
+
Ee(G.mode) === null && te((y) => !y);
|
|
2085
|
+
}, [G.mode, te]), ye = E(
|
|
2086
|
+
() => h((y) => (y + 1) % 3),
|
|
1972
2087
|
[]
|
|
1973
|
-
),
|
|
1974
|
-
() =>
|
|
2088
|
+
), j = E(
|
|
2089
|
+
() => h((y) => y === 1 ? 0 : y),
|
|
1975
2090
|
[]
|
|
1976
|
-
),
|
|
1977
|
-
|
|
1978
|
-
}, []),
|
|
1979
|
-
|
|
1980
|
-
}, []),
|
|
1981
|
-
() =>
|
|
2091
|
+
), p = E(() => {
|
|
2092
|
+
$(!0), Y(!1);
|
|
2093
|
+
}, []), fe = E(() => {
|
|
2094
|
+
$(!1), Y(!1);
|
|
2095
|
+
}, []), de = E(
|
|
2096
|
+
() => Y((y) => !y),
|
|
1982
2097
|
[]
|
|
1983
2098
|
);
|
|
1984
2099
|
return /* @__PURE__ */ X(
|
|
1985
|
-
|
|
2100
|
+
nt.Provider,
|
|
1986
2101
|
{
|
|
1987
2102
|
value: {
|
|
1988
|
-
|
|
1989
|
-
|
|
2103
|
+
locale: n,
|
|
2104
|
+
inputRef: v,
|
|
2105
|
+
focusId: d,
|
|
1990
2106
|
onFocus: A,
|
|
1991
|
-
onBlur:
|
|
1992
|
-
defaultLayout:
|
|
1993
|
-
hangulMode:
|
|
1994
|
-
shift:
|
|
1995
|
-
shiftLocked:
|
|
1996
|
-
theme:
|
|
1997
|
-
toggleKorean:
|
|
1998
|
-
toggleShift:
|
|
1999
|
-
consumeShift:
|
|
2000
|
-
selectionMode:
|
|
2001
|
-
selectionAdjusting:
|
|
2002
|
-
enterSelectionMode:
|
|
2003
|
-
exitSelectionMode:
|
|
2004
|
-
toggleSelectionAdjust:
|
|
2107
|
+
onBlur: ne,
|
|
2108
|
+
defaultLayout: r,
|
|
2109
|
+
hangulMode: H,
|
|
2110
|
+
shift: s > 0,
|
|
2111
|
+
shiftLocked: s === 2,
|
|
2112
|
+
theme: l ?? M,
|
|
2113
|
+
toggleKorean: W,
|
|
2114
|
+
toggleShift: ye,
|
|
2115
|
+
consumeShift: j,
|
|
2116
|
+
selectionMode: C,
|
|
2117
|
+
selectionAdjusting: U,
|
|
2118
|
+
enterSelectionMode: p,
|
|
2119
|
+
exitSelectionMode: fe,
|
|
2120
|
+
toggleSelectionAdjust: de,
|
|
2005
2121
|
activeInputPolicy: G,
|
|
2006
|
-
editingStatus:
|
|
2007
|
-
setEditingStatus:
|
|
2122
|
+
editingStatus: oe,
|
|
2123
|
+
setEditingStatus: O
|
|
2008
2124
|
},
|
|
2009
2125
|
children: [
|
|
2010
2126
|
e,
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
/* @__PURE__ */
|
|
2127
|
+
z && /* @__PURE__ */ X(He, { children: [
|
|
2128
|
+
Fe(
|
|
2129
|
+
/* @__PURE__ */ T(
|
|
2014
2130
|
"div",
|
|
2015
2131
|
{
|
|
2016
2132
|
"aria-hidden": "true",
|
|
2017
2133
|
style: {
|
|
2018
|
-
height:
|
|
2134
|
+
height: m,
|
|
2019
2135
|
pointerEvents: "none",
|
|
2020
|
-
background: (
|
|
2136
|
+
background: (l ?? M) === "dark" ? "#121c17" : "#f7f8f4"
|
|
2021
2137
|
}
|
|
2022
2138
|
}
|
|
2023
2139
|
),
|
|
2024
2140
|
document.body
|
|
2025
2141
|
),
|
|
2026
|
-
/* @__PURE__ */
|
|
2027
|
-
|
|
2142
|
+
/* @__PURE__ */ T(
|
|
2143
|
+
Pt,
|
|
2028
2144
|
{
|
|
2029
|
-
layout:
|
|
2030
|
-
viewport:
|
|
2031
|
-
onHeightChange:
|
|
2145
|
+
layout: C ? Mt : G.layout,
|
|
2146
|
+
viewport: k,
|
|
2147
|
+
onHeightChange: L
|
|
2032
2148
|
},
|
|
2033
|
-
|
|
2149
|
+
d
|
|
2034
2150
|
)
|
|
2035
2151
|
] })
|
|
2036
2152
|
]
|
|
@@ -2038,6 +2154,6 @@ function Bt({
|
|
|
2038
2154
|
);
|
|
2039
2155
|
}
|
|
2040
2156
|
export {
|
|
2041
|
-
|
|
2042
|
-
|
|
2157
|
+
Ft as VirtualInput,
|
|
2158
|
+
jt as VirtualInputProvider
|
|
2043
2159
|
};
|