@ihabdevteam/core 0.442.0 → 0.444.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/components.cjs.js +195 -190
  3. package/dist/components.esm.css +2 -2
  4. package/dist/hooks.cjs.js +5 -5
  5. package/dist/i18n.cjs.js +3 -3
  6. package/dist/ihabdevteam-core.cjs.js +191 -186
  7. package/dist/ihabdevteam-core.d.ts +346 -1
  8. package/dist/packages/core/src/components/DatePicker.css +8 -0
  9. package/dist/packages/core/src/components/DatePicker.js +13 -1
  10. package/dist/packages/core/src/components/ErrorBoundary.d.ts +55 -0
  11. package/dist/packages/core/src/components/ErrorBoundary.js +52 -0
  12. package/dist/packages/core/src/components/FolderAddPopup.d.ts +25 -0
  13. package/dist/packages/core/src/components/FolderAddPopup.js +21 -0
  14. package/dist/packages/core/src/components/FolderList.css +18 -0
  15. package/dist/packages/core/src/components/FolderList.d.ts +28 -0
  16. package/dist/packages/core/src/components/FolderList.js +23 -0
  17. package/dist/packages/core/src/components/KeepScreenAwake.d.ts +9 -0
  18. package/dist/packages/core/src/components/KeepScreenAwake.js +12 -0
  19. package/dist/packages/core/src/components/MarkIcon.css +12 -0
  20. package/dist/packages/core/src/components/MarkIcon.d.ts +20 -0
  21. package/dist/packages/core/src/components/MarkIcon.js +18 -0
  22. package/dist/packages/core/src/components/PagePopup.d.ts +52 -0
  23. package/dist/packages/core/src/components/PagePopup.js +77 -0
  24. package/dist/packages/core/src/components/Popup/Popup.css +14 -0
  25. package/dist/packages/core/src/components/Popup/Popup.d.ts +9 -0
  26. package/dist/packages/core/src/components/Popup/Popup.js +23 -4
  27. package/dist/packages/core/src/components/ScoreMarkCounts.css +9 -0
  28. package/dist/packages/core/src/components/ScoreMarkCounts.d.ts +19 -0
  29. package/dist/packages/core/src/components/ScoreMarkCounts.js +16 -0
  30. package/dist/packages/core/src/components/TextField.css +20 -0
  31. package/dist/packages/core/src/components/TextField.d.ts +17 -0
  32. package/dist/packages/core/src/components/TextField.js +19 -4
  33. package/dist/packages/core/src/components/Training/TrainingBlockGrid.js +25 -1
  34. package/dist/packages/core/src/components.d.ts +14 -0
  35. package/dist/packages/core/src/components.js +9 -0
  36. package/dist/packages/core/src/hooks/useBackClosable.d.ts +8 -0
  37. package/dist/packages/core/src/hooks/useBackClosable.js +97 -0
  38. package/dist/packages/core/src/hooks/useClosingDelay.d.ts +12 -0
  39. package/dist/packages/core/src/hooks/useClosingDelay.js +30 -0
  40. package/dist/packages/core/src/hooks/useOnline.d.ts +9 -0
  41. package/dist/packages/core/src/hooks/useOnline.js +23 -0
  42. package/dist/packages/core/src/hooks/useOutsideClose.d.ts +11 -0
  43. package/dist/packages/core/src/hooks/useOutsideClose.js +23 -0
  44. package/dist/packages/core/src/hooks/useSaveOnHide.d.ts +14 -0
  45. package/dist/packages/core/src/hooks/useSaveOnHide.js +32 -0
  46. package/dist/packages/core/src/hooks/useScreenWakeLock.d.ts +12 -0
  47. package/dist/packages/core/src/hooks/useScreenWakeLock.js +53 -0
  48. package/dist/packages/core/src/hooks.d.ts +6 -0
  49. package/dist/packages/core/src/hooks.js +7 -0
  50. package/dist/packages/core/src/i18n/locales/en.json +10 -3
  51. package/dist/packages/core/src/i18n/locales/ko.json +10 -3
  52. package/dist/packages/core/src/utils/jamoSpeech.d.ts +19 -0
  53. package/dist/packages/core/src/utils/jamoSpeech.js +53 -0
  54. package/dist/packages/core/src/utils/kstDateTime.d.ts +21 -0
  55. package/dist/packages/core/src/utils/kstDateTime.js +38 -0
  56. package/dist/packages/core/src/utils/lucideIconSet.js +2 -0
  57. package/dist/packages/core/src/utils/popupTiming.d.ts +7 -0
  58. package/dist/packages/core/src/utils/popupTiming.js +7 -0
  59. package/dist/packages/core/src/utils/wordTrainingGenerators.d.ts +1 -6
  60. package/dist/packages/core/src/utils/wordTrainingGenerators.js +3 -45
  61. package/dist/packages/core/src/utils.d.ts +2 -0
  62. package/dist/packages/core/src/utils.js +1 -0
  63. package/dist/packages/core/src/version.d.ts +1 -1
  64. package/dist/packages/core/src/version.js +1 -1
  65. package/dist/utils.cjs.js +171 -166
  66. package/package.json +1 -1
@@ -107,10 +107,24 @@ export { default as FolderHead } from './components/FolderHead';
107
107
  export type { FolderHeadProps } from './components/FolderHead';
108
108
  export { default as FolderGrid } from './components/FolderGrid';
109
109
  export type { FolderGridProps, FolderEntry } from './components/FolderGrid';
110
+ export { default as FolderList } from './components/FolderList';
111
+ export type { FolderListProps } from './components/FolderList';
112
+ export { default as FolderAddPopup } from './components/FolderAddPopup';
113
+ export type { FolderAddPopupProps } from './components/FolderAddPopup';
110
114
  export { default as CardSection } from './components/CardSection';
111
115
  export type { CardSectionProps } from './components/CardSection';
112
116
  export { default as FolderSearchSections } from './components/FolderSearchSections';
113
117
  export type { FolderSearchSectionsProps } from './components/FolderSearchSections';
118
+ export { default as PagePopup, usePagePopupClose } from './components/PagePopup';
119
+ export type { PagePopupProps } from './components/PagePopup';
120
+ export { default as MarkIcon } from './components/MarkIcon';
121
+ export type { MarkIconProps } from './components/MarkIcon';
122
+ export { default as ScoreMarkCounts } from './components/ScoreMarkCounts';
123
+ export type { ScoreMarkCountsProps } from './components/ScoreMarkCounts';
124
+ export { default as KeepScreenAwake } from './components/KeepScreenAwake';
125
+ export { default as ErrorBoundary } from './components/ErrorBoundary';
126
+ export type { ErrorBoundaryProps, ErrorFallbackProps } from './components/ErrorBoundary';
127
+ export { POPUP_CLOSE_MS } from './utils/popupTiming';
114
128
  export { default as FolderTreeButton } from './components/FolderTreeButton';
115
129
  export type { FolderTreeButtonProps } from './components/FolderTreeButton';
116
130
  export { default as FolderTreeTooltip } from './components/Tooltip/FolderTreeTooltip';
@@ -74,9 +74,18 @@ export { default as Breadcrumb } from './components/Breadcrumb';
74
74
  /* 폴더로 보는 화면 — 구조 단추 · 길 · 폴더 칸(말귀 청 (435), 2026-11-13). 길 셈은 `utils` 의 `folder*` 다 */
75
75
  export { default as FolderHead } from './components/FolderHead';
76
76
  export { default as FolderGrid } from './components/FolderGrid';
77
+ export { default as FolderList } from './components/FolderList';
78
+ export { default as FolderAddPopup } from './components/FolderAddPopup';
77
79
  /* 폴더 화면의 남은 조각(말귀 청 (437) ㉮, 2026-11-13) — 카드가 서는 자리 · 찾는 중 폴더마다 나눠 세우기 */
78
80
  export { default as CardSection } from './components/CardSection';
79
81
  export { default as FolderSearchSections } from './components/FolderSearchSections';
82
+ /* 말귀 앱에서 옮겨 온 조각(청 (437) ㉰ ㉱ ㉲ ㉳ⓑ ㉴, 2026-11-13) */
83
+ export { default as PagePopup, usePagePopupClose } from './components/PagePopup';
84
+ export { default as MarkIcon } from './components/MarkIcon';
85
+ export { default as ScoreMarkCounts } from './components/ScoreMarkCounts';
86
+ export { default as KeepScreenAwake } from './components/KeepScreenAwake';
87
+ export { default as ErrorBoundary } from './components/ErrorBoundary';
88
+ export { POPUP_CLOSE_MS } from './utils/popupTiming';
80
89
  export { default as FolderTreeButton } from './components/FolderTreeButton';
81
90
  export { default as FolderTreeTooltip } from './components/Tooltip/FolderTreeTooltip';
82
91
  export { default as Rating } from './components/Rating';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 열려 있는 동안 폰 '뒤로' 로 닫히게 한다.
3
+ *
4
+ * @param open 열려 있는가. 거짓이면 아무것도 안 한다.
5
+ * @param onBack 뒤로가 왔을 때 부른다 — 닫는다. **`false` 를 돌려주면 안 닫은 것**으로 보고 칸을 도로 쌓는다.
6
+ * @public
7
+ */
8
+ export declare function useBackClosable(open: boolean, onBack: () => boolean | void): void;
@@ -0,0 +1,97 @@
1
+ 'use client';
2
+ import { useEffect, useRef } from 'react';
3
+ const STATE_KEY = '__ihabBackClosable';
4
+ const stack = [];
5
+ let ignorePops = 0;
6
+ let listening = false;
7
+ let nextId = 1;
8
+ function topState() {
9
+ try {
10
+ const s = window.history.state;
11
+ const v = s?.[STATE_KEY];
12
+ return typeof v === 'number' ? v : undefined;
13
+ }
14
+ catch {
15
+ return undefined;
16
+ }
17
+ }
18
+ function pushMark(id) {
19
+ try {
20
+ /* 라우터가 쓰는 표(react-router 의 `idx` · `key`, Next 의 `__NA` 등)를 지우지 않게 지금 표에 얹는다 */
21
+ const prev = (window.history.state ?? {});
22
+ window.history.pushState({ ...prev, [STATE_KEY]: id }, '');
23
+ }
24
+ catch { /* 못 쌓으면 뒤로가 창을 못 닫을 뿐이다 */ }
25
+ }
26
+ function onPop() {
27
+ if (ignorePops > 0) {
28
+ ignorePops--;
29
+ return;
30
+ }
31
+ const top = stack[stack.length - 1];
32
+ if (!top)
33
+ return;
34
+ /* 앞으로(forward)로 우리 칸에 되돌아온 것 — 닫을 일이 아니다 */
35
+ if (topState() === top.id)
36
+ return;
37
+ if (top.onBack() === false) {
38
+ pushMark(top.id);
39
+ return;
40
+ }
41
+ /* 닫혔다 — 칸은 이미 걷혔으니 떠날 때 되돌리지 않게 스택에서 먼저 뺀다 */
42
+ stack.pop();
43
+ }
44
+ function listen() {
45
+ if (listening || typeof window === 'undefined')
46
+ return;
47
+ window.addEventListener('popstate', onPop);
48
+ listening = true;
49
+ }
50
+ /**
51
+ * 열려 있는 동안 폰 '뒤로' 로 닫히게 한다.
52
+ *
53
+ * @param open 열려 있는가. 거짓이면 아무것도 안 한다.
54
+ * @param onBack 뒤로가 왔을 때 부른다 — 닫는다. **`false` 를 돌려주면 안 닫은 것**으로 보고 칸을 도로 쌓는다.
55
+ * @public
56
+ */
57
+ export function useBackClosable(open, onBack) {
58
+ const onBackRef = useRef(onBack);
59
+ useEffect(() => { onBackRef.current = onBack; });
60
+ const idRef = useRef(null);
61
+ useEffect(() => {
62
+ if (!open || typeof window === 'undefined')
63
+ return;
64
+ listen();
65
+ /* 엄격 모드로 다시 걸릴 때는 같은 번호를 쓰고, 칸이 아직 맨 위면 또 쌓지 않는다 */
66
+ const id = idRef.current ?? (idRef.current = nextId++);
67
+ const entry = { id, onBack: () => onBackRef.current() };
68
+ stack.push(entry);
69
+ if (topState() !== id)
70
+ pushMark(id);
71
+ return () => {
72
+ const i = stack.indexOf(entry);
73
+ /* 뒤로로 닫혔으면 onPop 이 이미 뺐다 — 칸도 걷혀 있다 */
74
+ if (i < 0) {
75
+ idRef.current = null;
76
+ return;
77
+ }
78
+ stack.splice(i, 1);
79
+ setTimeout(() => {
80
+ /* 다시 걸렸으면(엄격 모드) 그대로 둔다 */
81
+ if (stack.some(e => e.id === id))
82
+ return;
83
+ if (idRef.current === id)
84
+ idRef.current = null;
85
+ if (topState() !== id)
86
+ return;
87
+ ignorePops++;
88
+ try {
89
+ window.history.back();
90
+ }
91
+ catch {
92
+ ignorePops--;
93
+ }
94
+ }, 0);
95
+ };
96
+ }, [open]);
97
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * **창이 사라질 짬을 준 뒤에 치른다**(말귀 청 (437) ㉳ⓑ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
3
+ *
4
+ * 고객을 지우는 것처럼 **이 창 자체가 없어지는** 일은, 곧바로 치르면 창이 붙은 채로 바깥이 목록을 다시 그려 사라지는 그림과
5
+ * 겹친다. 한 박자 늦추면 창이 먼저 가고 목록이 그다음이다. 기다리는 시간은 `Popup` 의 닫힘 시간(`POPUP_CLOSE_MS`) — 움직임
6
+ * 줄이기에서는 `Popup` 처럼 0 이다(앱 사본은 260 을 베껴 들고 움직임 줄이기를 몰랐다).
7
+ *
8
+ * · **기다리는 동안 창이 먼저 없어질 수 있다** — 걷힐 때 반드시 시계를 끈다(없는 창이 남긴 일이 뒤늦게 터지지 않게).
9
+ * · 한 번에 **하나만** 잰다 — 다시 부르면 앞의 것을 덮어쓴다. 두 번 눌러도 일은 한 번만 난다.
10
+ * @public
11
+ */
12
+ export declare function useClosingDelay(waitMs?: number): (todo?: () => void) => void;
@@ -0,0 +1,30 @@
1
+ 'use client';
2
+ import { useCallback, useEffect, useRef } from 'react';
3
+ import { POPUP_CLOSE_MS } from '../utils/popupTiming';
4
+ import { prefersReducedMotion } from './usePrefersReducedMotion';
5
+ /**
6
+ * **창이 사라질 짬을 준 뒤에 치른다**(말귀 청 (437) ㉳ⓑ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
7
+ *
8
+ * 고객을 지우는 것처럼 **이 창 자체가 없어지는** 일은, 곧바로 치르면 창이 붙은 채로 바깥이 목록을 다시 그려 사라지는 그림과
9
+ * 겹친다. 한 박자 늦추면 창이 먼저 가고 목록이 그다음이다. 기다리는 시간은 `Popup` 의 닫힘 시간(`POPUP_CLOSE_MS`) — 움직임
10
+ * 줄이기에서는 `Popup` 처럼 0 이다(앱 사본은 260 을 베껴 들고 움직임 줄이기를 몰랐다).
11
+ *
12
+ * · **기다리는 동안 창이 먼저 없어질 수 있다** — 걷힐 때 반드시 시계를 끈다(없는 창이 남긴 일이 뒤늦게 터지지 않게).
13
+ * · 한 번에 **하나만** 잰다 — 다시 부르면 앞의 것을 덮어쓴다. 두 번 눌러도 일은 한 번만 난다.
14
+ * @public
15
+ */
16
+ export function useClosingDelay(waitMs) {
17
+ const clock = useRef(null);
18
+ const turnOff = useCallback(() => {
19
+ if (clock.current) {
20
+ clearTimeout(clock.current);
21
+ clock.current = null;
22
+ }
23
+ }, []);
24
+ useEffect(() => turnOff, [turnOff]);
25
+ return useCallback((todo) => {
26
+ turnOff();
27
+ const ms = waitMs ?? (prefersReducedMotion() ? 0 : POPUP_CLOSE_MS);
28
+ clock.current = setTimeout(() => { clock.current = null; todo?.(); }, ms);
29
+ }, [turnOff, waitMs]);
30
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * **망이 붙어 있나**(말귀 청 (437) ㉲ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
3
+ *
4
+ * `navigator.onLine` 이 **참이라고 인터넷이 되는 것은 아니다**(공유기에만 붙은 상태도 참). 거짓일 때만 믿는다 — 그래서 이 값은
5
+ * "끊겼다" 를 말하는 데만 쓰고 "붙었다" 를 보장하는 데는 안 쓴다. `useSyncExternalStore` 로 그릴 때마다 바깥 값을 읽어,
6
+ * 첫 그림과 효과 사이에 바뀐 것을 놓치지 않는다. `navigator` 가 없는 터전(서버)에서는 붙은 것으로 친다 — 틀린 띠가 더 나쁘다.
7
+ * @public
8
+ */
9
+ export declare function useOnline(): boolean;
@@ -0,0 +1,23 @@
1
+ 'use client';
2
+ import { useSyncExternalStore } from 'react';
3
+ function subscribe(onChange) {
4
+ window.addEventListener('online', onChange);
5
+ window.addEventListener('offline', onChange);
6
+ return () => {
7
+ window.removeEventListener('online', onChange);
8
+ window.removeEventListener('offline', onChange);
9
+ };
10
+ }
11
+ /** 거짓일 때만 끊긴 것으로 — `undefined` 는 모르는 것이라 붙은 쪽으로 읽는다 */
12
+ const read = () => typeof navigator === 'undefined' || navigator.onLine !== false;
13
+ /**
14
+ * **망이 붙어 있나**(말귀 청 (437) ㉲ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
15
+ *
16
+ * `navigator.onLine` 이 **참이라고 인터넷이 되는 것은 아니다**(공유기에만 붙은 상태도 참). 거짓일 때만 믿는다 — 그래서 이 값은
17
+ * "끊겼다" 를 말하는 데만 쓰고 "붙었다" 를 보장하는 데는 안 쓴다. `useSyncExternalStore` 로 그릴 때마다 바깥 값을 읽어,
18
+ * 첫 그림과 효과 사이에 바뀐 것을 놓치지 않는다. `navigator` 가 없는 터전(서버)에서는 붙은 것으로 친다 — 틀린 띠가 더 나쁘다.
19
+ * @public
20
+ */
21
+ export function useOnline() {
22
+ return useSyncExternalStore(subscribe, read, () => true);
23
+ }
@@ -0,0 +1,11 @@
1
+ import { type RefObject } from 'react';
2
+ /**
3
+ * **밖을 누르면 접는다** — 펴 둔 목록 · 판을 닫는 한 가지 배선(말귀 청 (437) ㉲ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
4
+ *
5
+ * · **`mousedown` 에서 닫는다**(`click` 이 아니라) — 누르는 순간 닫혀야 그 아래 것이 눌리지 않는다. 통 **안**이면 아무 일도 안 한다.
6
+ * · **펴 있을 때만 듣는다** — 접힌 목록 수십 개가 문서 듣개를 물고 있을 까닭이 없다.
7
+ * · 닫는 함수는 ref 로 들고 최신 것을 부른다 — 인라인 함수를 넘겨도 렌더마다 듣개를 다시 걸지 않는다.
8
+ * 닻이 있는 떠 있는 메뉴는 `useAnchoredMenu` 가 같은 일을 한다 — 이것은 제자리에 펴지는 목록 · 판 몫이다.
9
+ * @public
10
+ */
11
+ export declare function useOutsideClose(isOpen: boolean, boxRef: RefObject<HTMLElement | null>, close: () => void): void;
@@ -0,0 +1,23 @@
1
+ 'use client';
2
+ import { useEffect } from 'react';
3
+ import { useLatestRef } from './useLatestRef';
4
+ /**
5
+ * **밖을 누르면 접는다** — 펴 둔 목록 · 판을 닫는 한 가지 배선(말귀 청 (437) ㉲ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
6
+ *
7
+ * · **`mousedown` 에서 닫는다**(`click` 이 아니라) — 누르는 순간 닫혀야 그 아래 것이 눌리지 않는다. 통 **안**이면 아무 일도 안 한다.
8
+ * · **펴 있을 때만 듣는다** — 접힌 목록 수십 개가 문서 듣개를 물고 있을 까닭이 없다.
9
+ * · 닫는 함수는 ref 로 들고 최신 것을 부른다 — 인라인 함수를 넘겨도 렌더마다 듣개를 다시 걸지 않는다.
10
+ * 닻이 있는 떠 있는 메뉴는 `useAnchoredMenu` 가 같은 일을 한다 — 이것은 제자리에 펴지는 목록 · 판 몫이다.
11
+ * @public
12
+ */
13
+ export function useOutsideClose(isOpen, boxRef, close) {
14
+ const latest = useLatestRef(close);
15
+ useEffect(() => {
16
+ if (!isOpen)
17
+ return;
18
+ const onDown = (e) => { if (!boxRef.current?.contains(e.target))
19
+ latest.current(); };
20
+ document.addEventListener('mousedown', onDown);
21
+ return () => document.removeEventListener('mousedown', onDown);
22
+ }, [isOpen, boxRef, latest]);
23
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * **쪽이 숨는 순간 초안을 바로 적는다**(말귀 청 (437) ㉲ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
3
+ *
4
+ * 고치던 것을 늦춰(디바운스) 적는 화면은, 마지막 손질 뒤 그 짬 안에 탭이 사라지면 그 손질만 빠진다. 폰에서는 드물지 않다 —
5
+ * 글자를 치고 바로 홈 단추를 누르거나 전화가 와서 앱이 뒤로 밀린다. 묻는 길(`beforeunload`)은 iOS 사파리가 거의 안 쏴서 못 쓴다.
6
+ *
7
+ * · `visibilitychange` → `hidden` 이 폰에서 실제로 오는 신호다(홈 · 앱 전환 · 화면 잠금).
8
+ * · `pagehide` 는 탭을 닫거나 옮길 때 · 뒤로-앞으로 캐시로 들어갈 때 와서 `hidden` 이 안 오는 경우를 메운다.
9
+ * 둘 다 올 수 있다 — 같은 값을 두 번 적어도 해가 없게(멱등하게) 적는다.
10
+ *
11
+ * **여기서 비동기를 하지 않는다** — 숨는 순간 브라우저는 약속이 끝나기를 안 기다린다. `localStorage` 처럼 그 자리에서 끝나는 쓰기만.
12
+ * @public
13
+ */
14
+ export declare function useSaveOnHide(save: () => void, enabled?: boolean): void;
@@ -0,0 +1,32 @@
1
+ 'use client';
2
+ import { useEffect } from 'react';
3
+ import { useLatestRef } from './useLatestRef';
4
+ /**
5
+ * **쪽이 숨는 순간 초안을 바로 적는다**(말귀 청 (437) ㉲ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
6
+ *
7
+ * 고치던 것을 늦춰(디바운스) 적는 화면은, 마지막 손질 뒤 그 짬 안에 탭이 사라지면 그 손질만 빠진다. 폰에서는 드물지 않다 —
8
+ * 글자를 치고 바로 홈 단추를 누르거나 전화가 와서 앱이 뒤로 밀린다. 묻는 길(`beforeunload`)은 iOS 사파리가 거의 안 쏴서 못 쓴다.
9
+ *
10
+ * · `visibilitychange` → `hidden` 이 폰에서 실제로 오는 신호다(홈 · 앱 전환 · 화면 잠금).
11
+ * · `pagehide` 는 탭을 닫거나 옮길 때 · 뒤로-앞으로 캐시로 들어갈 때 와서 `hidden` 이 안 오는 경우를 메운다.
12
+ * 둘 다 올 수 있다 — 같은 값을 두 번 적어도 해가 없게(멱등하게) 적는다.
13
+ *
14
+ * **여기서 비동기를 하지 않는다** — 숨는 순간 브라우저는 약속이 끝나기를 안 기다린다. `localStorage` 처럼 그 자리에서 끝나는 쓰기만.
15
+ * @public
16
+ */
17
+ export function useSaveOnHide(save, enabled = true) {
18
+ const latest = useLatestRef(save);
19
+ useEffect(() => {
20
+ if (!enabled)
21
+ return;
22
+ const flush = () => { latest.current(); };
23
+ const onVisibility = () => { if (document.visibilityState === 'hidden')
24
+ flush(); };
25
+ document.addEventListener('visibilitychange', onVisibility);
26
+ window.addEventListener('pagehide', flush);
27
+ return () => {
28
+ document.removeEventListener('visibilitychange', onVisibility);
29
+ window.removeEventListener('pagehide', flush);
30
+ };
31
+ }, [enabled, latest]);
32
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * **켜 둔 동안 폰 화면이 저절로 꺼지지 않게 한다**(말귀 청 (437) ㉲ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
3
+ *
4
+ * 훈련은 "듣고 → 고르기" 라 손이 화면에 닿지 않는 구간이 길다 — 폰의 화면 꺼짐(30초 · 1분)이 먼저 와서 소리는 나는데 화면이
5
+ * 꺼지고, 깨우면 잠금 화면이 가로막는다.
6
+ *
7
+ * · `active` 인 동안 `wakeLock.request('screen')` 을 잡는다. 못 잡으면(저전력 모드 · 안 되는 브라우저) **조용히** 지나간다.
8
+ * · 탭이 숨겨지면 브라우저가 알아서 놓는다. **다시 보이면 다시 잡는다**(`visibilitychange`).
9
+ * · 끝나면 놓는다. 잡는 중에 끝났으면 잡힌 것을 바로 놓는다(언마운트 뒤에 남는 잠금이 없게).
10
+ * @public
11
+ */
12
+ export declare function useScreenWakeLock(active: boolean): void;
@@ -0,0 +1,53 @@
1
+ 'use client';
2
+ import { useEffect } from 'react';
3
+ /**
4
+ * **켜 둔 동안 폰 화면이 저절로 꺼지지 않게 한다**(말귀 청 (437) ㉲ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
5
+ *
6
+ * 훈련은 "듣고 → 고르기" 라 손이 화면에 닿지 않는 구간이 길다 — 폰의 화면 꺼짐(30초 · 1분)이 먼저 와서 소리는 나는데 화면이
7
+ * 꺼지고, 깨우면 잠금 화면이 가로막는다.
8
+ *
9
+ * · `active` 인 동안 `wakeLock.request('screen')` 을 잡는다. 못 잡으면(저전력 모드 · 안 되는 브라우저) **조용히** 지나간다.
10
+ * · 탭이 숨겨지면 브라우저가 알아서 놓는다. **다시 보이면 다시 잡는다**(`visibilitychange`).
11
+ * · 끝나면 놓는다. 잡는 중에 끝났으면 잡힌 것을 바로 놓는다(언마운트 뒤에 남는 잠금이 없게).
12
+ * @public
13
+ */
14
+ export function useScreenWakeLock(active) {
15
+ useEffect(() => {
16
+ if (!active || typeof navigator === 'undefined')
17
+ return;
18
+ const wakeLock = navigator.wakeLock;
19
+ if (!wakeLock)
20
+ return;
21
+ let sentinel = null;
22
+ let stopped = false;
23
+ const acquire = async () => {
24
+ if (stopped || sentinel || document.visibilityState !== 'visible')
25
+ return;
26
+ try {
27
+ const got = await wakeLock.request('screen');
28
+ if (stopped) {
29
+ void got.release().catch(() => { });
30
+ return;
31
+ }
32
+ sentinel = got;
33
+ got.addEventListener('release', () => { if (sentinel === got)
34
+ sentinel = null; });
35
+ }
36
+ catch {
37
+ /* 저전력 모드 · 권한 거절 — 화면이 평소처럼 꺼질 뿐이다 */
38
+ }
39
+ };
40
+ const onVisible = () => { if (document.visibilityState === 'visible')
41
+ void acquire(); };
42
+ void acquire();
43
+ document.addEventListener('visibilitychange', onVisible);
44
+ return () => {
45
+ stopped = true;
46
+ document.removeEventListener('visibilitychange', onVisible);
47
+ if (sentinel) {
48
+ void sentinel.release().catch(() => { });
49
+ sentinel = null;
50
+ }
51
+ };
52
+ }, [active]);
53
+ }
@@ -36,3 +36,9 @@ export { useInlineSvg } from './hooks/useInlineSvg';
36
36
  export * from './hooks/useFolderBrowse';
37
37
  export * from './hooks/useCardDragToGroup';
38
38
  export * from './hooks/usePageSizeOptions';
39
+ export * from './hooks/useSaveOnHide';
40
+ export * from './hooks/useScreenWakeLock';
41
+ export * from './hooks/useOnline';
42
+ export * from './hooks/useOutsideClose';
43
+ export { useBackClosable } from './hooks/useBackClosable';
44
+ export * from './hooks/useClosingDelay';
@@ -41,3 +41,10 @@ export { useInlineSvg } from './hooks/useInlineSvg';
41
41
  export * from './hooks/useFolderBrowse';
42
42
  export * from './hooks/useCardDragToGroup';
43
43
  export * from './hooks/usePageSizeOptions'; // "N개씩 보기" 목록(말귀 청 (437) ㉳ⓐ)
44
+ /* 브라우저 생애 · 닫힘 기다리기(말귀 청 (437) ㉲ ㉳ⓑ, 2026-11-13) */
45
+ export * from './hooks/useSaveOnHide';
46
+ export * from './hooks/useScreenWakeLock';
47
+ export * from './hooks/useOnline';
48
+ export * from './hooks/useOutsideClose';
49
+ export { useBackClosable } from './hooks/useBackClosable';
50
+ export * from './hooks/useClosingDelay';
@@ -102,7 +102,8 @@
102
102
  }
103
103
  },
104
104
  "unknownError": "Unknown error",
105
- "networkError": "The network connection is unstable. Check your connection and try again."
105
+ "networkError": "The network connection is unstable. Check your connection and try again.",
106
+ "add": "Add"
106
107
  },
107
108
  "calendar": {
108
109
  "rangeSelect": "Select period",
@@ -987,7 +988,8 @@
987
988
  "imageCount": "{{done}} / {{total}} items"
988
989
  },
989
990
  "textField": {
990
- "clearAriaLabel": "Clear input"
991
+ "clearAriaLabel": "Clear input",
992
+ "showPassword": "Show password"
991
993
  },
992
994
  "segmentedControl": {
993
995
  "ariaLabel": "Select tab"
@@ -1119,7 +1121,12 @@
1119
1121
  "placeMenu": "{{name}} menu",
1120
1122
  "tree": "Show folder structure",
1121
1123
  "fold": "Collapse {{name}}",
1122
- "unfold": "Expand {{name}}"
1124
+ "unfold": "Expand {{name}}",
1125
+ "add": {
1126
+ "title": "Add Folder",
1127
+ "sub": "Enter a name for the new folder.",
1128
+ "placeholder": "Folder name"
1129
+ }
1123
1130
  },
1124
1131
  "board": {
1125
1132
  "empty": "No items yet."
@@ -98,7 +98,8 @@
98
98
  }
99
99
  },
100
100
  "unknownError": "알 수 없는 오류",
101
- "networkError": "네트워크 연결이 불안정합니다. 연결 상태를 확인한 뒤 다시 시도해 주세요."
101
+ "networkError": "네트워크 연결이 불안정합니다. 연결 상태를 확인한 뒤 다시 시도해 주세요.",
102
+ "add": "추가"
102
103
  },
103
104
  "calendar": {
104
105
  "rangeSelect": "기간 선택",
@@ -972,7 +973,8 @@
972
973
  "imageCount": "{{done}} / {{total}}개"
973
974
  },
974
975
  "textField": {
975
- "clearAriaLabel": "입력값 지우기"
976
+ "clearAriaLabel": "입력값 지우기",
977
+ "showPassword": "비밀번호 보기"
976
978
  },
977
979
  "segmentedControl": {
978
980
  "ariaLabel": "선택 탭"
@@ -1101,7 +1103,12 @@
1101
1103
  "placeMenu": "{{name}} 메뉴",
1102
1104
  "tree": "폴더 구조 보기",
1103
1105
  "fold": "{{name}} 접기",
1104
- "unfold": "{{name}} 펼치기"
1106
+ "unfold": "{{name}} 펼치기",
1107
+ "add": {
1108
+ "title": "폴더 추가",
1109
+ "sub": "새 폴더 이름을 입력하세요.",
1110
+ "placeholder": "폴더 이름"
1111
+ }
1105
1112
  },
1106
1113
  "board": {
1107
1114
  "empty": "등록된 항목이 없습니다."
@@ -0,0 +1,19 @@
1
+ /**
2
+ * **자모를 소리 내어 읽을 이름으로** — 작은 파일(말귀 청 (438) ㉳ⓑ, 2026-11-14).
3
+ *
4
+ * `wordTrainingGenerators`(25kB 남짓)에 있었는데, 말귀 앱의 첫 조각이 이 함수 하나만 쓰면서 그 파일을 통째로
5
+ * 끌고 왔다. 읽기 셈에 드는 것(낱자 이름 표 · 조사 맞추기)만 여기 둔다. `@ihabdevteam/core/utils/jamoSpeech` 로
6
+ * 바로 받거나, 예전처럼 `@ihabdevteam/core/utils` 에서 받는다.
7
+ */
8
+ /**
9
+ * 자모 → 낱자 이름(TTS가 음소를 정확히 읽도록). 자음은 명칭(ㄱ→기역), 모음은 소릿값(ㅏ→아).
10
+ * bare 자모('ㄱ')를 그대로 TTS에 넣으면 엔진이 '그/가'처럼 잘못 읽어, 음소 합치기 문장에서 이름으로 치환한다.
11
+ */
12
+ /** @internal 낱자 이름 표 — `wordTrainingGenerators` 의 합치기 문장도 이 표를 쓴다 */
13
+ export declare const JAMO_NAME: Record<string, string>;
14
+ /**
15
+ * @public TTS 전용 변환 — 문장 속 따옴표로 감싼 낱개 자모("ㄱ")를 낱자 이름("기역")으로 치환하고 뒤 조사를 맞춘다.
16
+ * 표시 텍스트는 자모 그대로 두고(교육용 표기), 합성·캐시 키에만 이 변환을 적용한다. 자음은 명칭(ㄱ→기역),
17
+ * 모음은 소릿값(ㅏ→아). 음소 합치기뿐 아니라 음소 바꾸기·자음 탈락 등 자모가 든 모든 문장에 공통 적용된다.
18
+ */
19
+ export declare function jamoToNamesForSpeech(text: string): string;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * **자모를 소리 내어 읽을 이름으로** — 작은 파일(말귀 청 (438) ㉳ⓑ, 2026-11-14).
3
+ *
4
+ * `wordTrainingGenerators`(25kB 남짓)에 있었는데, 말귀 앱의 첫 조각이 이 함수 하나만 쓰면서 그 파일을 통째로
5
+ * 끌고 왔다. 읽기 셈에 드는 것(낱자 이름 표 · 조사 맞추기)만 여기 둔다. `@ihabdevteam/core/utils/jamoSpeech` 로
6
+ * 바로 받거나, 예전처럼 `@ihabdevteam/core/utils` 에서 받는다.
7
+ */
8
+ /**
9
+ * 자모 → 낱자 이름(TTS가 음소를 정확히 읽도록). 자음은 명칭(ㄱ→기역), 모음은 소릿값(ㅏ→아).
10
+ * bare 자모('ㄱ')를 그대로 TTS에 넣으면 엔진이 '그/가'처럼 잘못 읽어, 음소 합치기 문장에서 이름으로 치환한다.
11
+ */
12
+ /** @internal 낱자 이름 표 — `wordTrainingGenerators` 의 합치기 문장도 이 표를 쓴다 */
13
+ export const JAMO_NAME = {
14
+ // 자음(초성·종성 공용 낱자 이름)
15
+ 'ㄱ': '기역', 'ㄲ': '쌍기역', 'ㄴ': '니은', 'ㄷ': '디귿', 'ㄸ': '쌍디귿', 'ㄹ': '리을',
16
+ 'ㅁ': '미음', 'ㅂ': '비읍', 'ㅃ': '쌍비읍', 'ㅅ': '시옷', 'ㅆ': '쌍시옷', 'ㅇ': '이응',
17
+ 'ㅈ': '지읒', 'ㅉ': '쌍지읒', 'ㅊ': '치읓', 'ㅋ': '키읔', 'ㅌ': '티읕', 'ㅍ': '피읖', 'ㅎ': '히읗',
18
+ // 겹받침(홑받침만 쓰지만 방어적으로 포함)
19
+ 'ㄳ': '기역시옷', 'ㄵ': '니은지읒', 'ㄶ': '니은히읗', 'ㄺ': '리을기역', 'ㄻ': '리을미음',
20
+ 'ㄼ': '리을비읍', 'ㄽ': '리을시옷', 'ㄾ': '리을티읕', 'ㄿ': '리을피읖', 'ㅀ': '리을히읗', 'ㅄ': '비읍시옷',
21
+ // 모음(소릿값 = 낱자 이름)
22
+ 'ㅏ': '아', 'ㅐ': '애', 'ㅑ': '야', 'ㅒ': '얘', 'ㅓ': '어', 'ㅔ': '에', 'ㅕ': '여', 'ㅖ': '예',
23
+ 'ㅗ': '오', 'ㅘ': '와', 'ㅙ': '왜', 'ㅚ': '외', 'ㅛ': '요', 'ㅜ': '우', 'ㅝ': '워', 'ㅞ': '웨',
24
+ 'ㅟ': '위', 'ㅠ': '유', 'ㅡ': '으', 'ㅢ': '의', 'ㅣ': '이',
25
+ };
26
+ /**
27
+ * @public TTS 전용 변환 — 문장 속 따옴표로 감싼 낱개 자모("ㄱ")를 낱자 이름("기역")으로 치환하고 뒤 조사를 맞춘다.
28
+ * 표시 텍스트는 자모 그대로 두고(교육용 표기), 합성·캐시 키에만 이 변환을 적용한다. 자음은 명칭(ㄱ→기역),
29
+ * 모음은 소릿값(ㅏ→아). 음소 합치기뿐 아니라 음소 바꾸기·자음 탈락 등 자모가 든 모든 문장에 공통 적용된다.
30
+ */
31
+ export function jamoToNamesForSpeech(text) {
32
+ return text.replace(/"([ㄱ-ㅣ])"(으로|와|과|을|를|이|가|은|는|로)?/g, (m, jamo, josa) => {
33
+ const name = JAMO_NAME[jamo];
34
+ if (!name)
35
+ return m;
36
+ if (!josa)
37
+ return `"${name}"`;
38
+ const jong = (name.charCodeAt(name.length - 1) - 0xAC00) % 28;
39
+ const hasJong = jong !== 0;
40
+ let j = josa;
41
+ if (josa === '와' || josa === '과')
42
+ j = hasJong ? '과' : '와';
43
+ else if (josa === '을' || josa === '를')
44
+ j = hasJong ? '을' : '를';
45
+ else if (josa === '이' || josa === '가')
46
+ j = hasJong ? '이' : '가';
47
+ else if (josa === '은' || josa === '는')
48
+ j = hasJong ? '은' : '는';
49
+ else if (josa === '으로' || josa === '로')
50
+ j = (jong === 0 || jong === 8) ? '로' : '으로';
51
+ return `"${name}"${j}`;
52
+ });
53
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * **화면이 고른 한국 시각(벽시계)을 서버가 아는 순간으로, 또 그 반대로**(말귀 청 (437) ㉳ⓒ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
3
+ *
4
+ * `timestamptz` 칸에 시간대 표기가 없는 문자열(`2026-09-06T12:55:00`)을 보내면 서버가 UTC 로 읽어 **9시간이 밀린다**
5
+ * (말귀 실측: 12:55 → 21:55, 저녁 것은 날짜까지 하루). 기기 시간대가 아니라 **한국 시각**으로 읽는다 — 뉴욕 기기에서
6
+ * 12:55 를 골라도 KST 12:55 다. 한국은 서머타임이 없어 +09:00 한 값이다. KST 날짜 셈의 다른 식구는 `utils/date.ts`.
7
+ */
8
+ /** @public `YYYY-MM-DD` + `HH:mm`(한국 시각) → `Z` 붙은 ISO. 못 읽을 값(2월 31일 · 25시 …)이면 `null` */
9
+ export declare function kstToIso(date: string, time: string): string | null;
10
+ /** @public 연 · 월 · 일 · 시 · 분 칸(한국 시각) */
11
+ export interface KstParts {
12
+ year: string;
13
+ month: string;
14
+ day: string;
15
+ hour: string;
16
+ minute: string;
17
+ }
18
+ /** @public 칸(한국 시각)이 가리키는 순간. 못 읽으면 Invalid Date */
19
+ export declare function kstPartsAt(p: KstParts): Date;
20
+ /** @public 그 순간의 한국 시각을 칸으로 — 기본은 지금. 두 자리로 채운다 */
21
+ export declare function kstNowParts(now?: Date): KstParts;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * **화면이 고른 한국 시각(벽시계)을 서버가 아는 순간으로, 또 그 반대로**(말귀 청 (437) ㉳ⓒ — 말귀 앱에서 옮겨 왔다, 2026-11-13).
3
+ *
4
+ * `timestamptz` 칸에 시간대 표기가 없는 문자열(`2026-09-06T12:55:00`)을 보내면 서버가 UTC 로 읽어 **9시간이 밀린다**
5
+ * (말귀 실측: 12:55 → 21:55, 저녁 것은 날짜까지 하루). 기기 시간대가 아니라 **한국 시각**으로 읽는다 — 뉴욕 기기에서
6
+ * 12:55 를 골라도 KST 12:55 다. 한국은 서머타임이 없어 +09:00 한 값이다. KST 날짜 셈의 다른 식구는 `utils/date.ts`.
7
+ */
8
+ const KST_OFFSET_H = 9;
9
+ /** @public `YYYY-MM-DD` + `HH:mm`(한국 시각) → `Z` 붙은 ISO. 못 읽을 값(2월 31일 · 25시 …)이면 `null` */
10
+ export function kstToIso(date, time) {
11
+ const day = /^(\d{4})-(\d{2})-(\d{2})$/.exec(date);
12
+ const hm = /^(\d{1,2}):(\d{2})$/.exec(time);
13
+ if (!day || !hm)
14
+ return null;
15
+ const [y, m, d] = [Number(day[1]), Number(day[2]), Number(day[3])];
16
+ const [hh, mm] = [Number(hm[1]), Number(hm[2])];
17
+ if (hh > 23 || mm > 59)
18
+ return null;
19
+ /* 2월 31일은 Date 가 조용히 다음 달로 넘긴다 — 넘어갔으면 못 읽은 것. 조용히 다른 날로 저장하느니 안 보내는 편이 낫다 */
20
+ const calendar = new Date(Date.UTC(y, m - 1, d));
21
+ if (calendar.getUTCMonth() !== m - 1 || calendar.getUTCDate() !== d)
22
+ return null;
23
+ return new Date(Date.UTC(y, m - 1, d, hh - KST_OFFSET_H, mm)).toISOString();
24
+ }
25
+ /** @public 칸(한국 시각)이 가리키는 순간. 못 읽으면 Invalid Date */
26
+ export function kstPartsAt(p) {
27
+ const iso = kstToIso(`${p.year}-${p.month.padStart(2, '0')}-${p.day.padStart(2, '0')}`, `${p.hour}:${p.minute.padStart(2, '0')}`);
28
+ return new Date(iso ?? NaN);
29
+ }
30
+ /** @public 그 순간의 한국 시각을 칸으로 — 기본은 지금. 두 자리로 채운다 */
31
+ export function kstNowParts(now = new Date()) {
32
+ const korea = new Date(now.getTime() + KST_OFFSET_H * 3600_000);
33
+ const two = (n) => String(n).padStart(2, '0');
34
+ return {
35
+ year: String(korea.getUTCFullYear()), month: two(korea.getUTCMonth() + 1), day: two(korea.getUTCDate()),
36
+ hour: two(korea.getUTCHours()), minute: two(korea.getUTCMinutes()),
37
+ };
38
+ }
@@ -64,6 +64,7 @@ import EllipsisIcon from 'lucide-react/dist/esm/icons/ellipsis.mjs';
64
64
  import EraserIcon from 'lucide-react/dist/esm/icons/eraser.mjs';
65
65
  import ExternalLinkIcon from 'lucide-react/dist/esm/icons/external-link.mjs';
66
66
  import EyeIcon from 'lucide-react/dist/esm/icons/eye.mjs';
67
+ import EyeOffIcon from 'lucide-react/dist/esm/icons/eye-off.mjs';
67
68
  import FileTextIcon from 'lucide-react/dist/esm/icons/file-text.mjs';
68
69
  import FlipHorizontalIcon from 'lucide-react/dist/esm/icons/flip-horizontal.mjs';
69
70
  import FolderIcon from 'lucide-react/dist/esm/icons/folder.mjs';
@@ -250,6 +251,7 @@ export const STATIC_LUCIDE_ICONS = {
250
251
  'eraser': EraserIcon,
251
252
  'external-link': ExternalLinkIcon,
252
253
  'eye': EyeIcon,
254
+ 'eye-off': EyeOffIcon,
253
255
  'file-text': FileTextIcon,
254
256
  'flip-horizontal': FlipHorizontalIcon,
255
257
  'folder': FolderIcon,