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