@ihabdevteam/core 0.446.0 → 0.448.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/components.cjs.js +21 -21
- package/dist/hooks.cjs.js +4 -4
- package/dist/i18n.cjs.js +1 -1
- package/dist/ihabdevteam-core.cjs.js +187 -187
- package/dist/ihabdevteam-core.d.ts +85 -1
- package/dist/packages/core/src/components/FolderDeleteConfirmPopup.d.ts +22 -0
- package/dist/packages/core/src/components/FolderDeleteConfirmPopup.js +19 -0
- package/dist/packages/core/src/components.d.ts +2 -0
- package/dist/packages/core/src/components.js +1 -0
- package/dist/packages/core/src/hooks/useCodeCountdown.d.ts +17 -0
- package/dist/packages/core/src/hooks/useCodeCountdown.js +23 -0
- package/dist/packages/core/src/hooks/useMediaQuery.js +22 -4
- package/dist/packages/core/src/hooks.d.ts +2 -0
- package/dist/packages/core/src/hooks.js +1 -0
- package/dist/packages/core/src/utils/wordGradeBands.d.ts +48 -0
- package/dist/packages/core/src/utils/wordGradeBands.js +79 -0
- package/dist/packages/core/src/utils.d.ts +3 -0
- package/dist/packages/core/src/utils.js +2 -0
- package/dist/packages/core/src/version.d.ts +1 -1
- package/dist/packages/core/src/version.js +1 -1
- package/dist/utils.cjs.js +168 -168
- package/package.json +1 -1
|
@@ -1798,6 +1798,16 @@ export declare interface CodeBoxProps {
|
|
|
1798
1798
|
className?: string;
|
|
1799
1799
|
}
|
|
1800
1800
|
|
|
1801
|
+
/** @public `useCodeCountdown` 이 내주는 것 */
|
|
1802
|
+
export declare interface CodeCountdown {
|
|
1803
|
+
/** 남은 초 — 0 이면 끝났다(또는 아직 안 걸었다) */
|
|
1804
|
+
left: number;
|
|
1805
|
+
/** `분:초` — 초는 두 자리(`2:05`) */
|
|
1806
|
+
clock: string;
|
|
1807
|
+
/** `초` 로 다시 건다 — 다시 받으면 처음부터 센다. `start(0)` 은 멈춘다. 음수 · 소수는 0 이상의 정수로 내린다 */
|
|
1808
|
+
start: (seconds: number) => void;
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1801
1811
|
/** @public */
|
|
1802
1812
|
export declare function ColorPicker({ value, onChange, palette, size: sizeProp, className, ariaLabel, }: ColorPickerProps): JSX.Element;
|
|
1803
1813
|
|
|
@@ -2227,7 +2237,7 @@ export declare function copyText(text: string): Promise<boolean>;
|
|
|
2227
2237
|
*
|
|
2228
2238
|
* 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
|
|
2229
2239
|
*/
|
|
2230
|
-
export declare const CORE_VERSION = "0.
|
|
2240
|
+
export declare const CORE_VERSION = "0.448.0";
|
|
2231
2241
|
|
|
2232
2242
|
/** @public */
|
|
2233
2243
|
declare const coreDefault: Record<string, unknown>;
|
|
@@ -2546,6 +2556,9 @@ export declare const DEFAULT_NOISE_SETTINGS: CoreNoiseSettings;
|
|
|
2546
2556
|
/** @public 목록 쪽당 개수의 기본값 — 말귀 회원앱 목록들이 쓰던 넷 */
|
|
2547
2557
|
export declare const DEFAULT_PAGE_SIZES: readonly [10, 25, 50, 100];
|
|
2548
2558
|
|
|
2559
|
+
/** 처음 잣대 — ~6세 · 7~9세 · 10세 이상. 서버 글자를 못 읽으면 이것으로 선다 */
|
|
2560
|
+
export declare const DEFAULT_WORD_GRADE_BANDS: readonly WordGradeBand[];
|
|
2561
|
+
|
|
2549
2562
|
/** @public */
|
|
2550
2563
|
export declare function deriveNoiseContexts(trainingData: Record<string, unknown> | null | undefined): NoiseContext_2[];
|
|
2551
2564
|
|
|
@@ -2683,6 +2696,16 @@ export declare type DialogSize = 'sm' | 'md' | 'lg' | 'full';
|
|
|
2683
2696
|
*/
|
|
2684
2697
|
declare type DifficultyLevel = 'random' | 'jong' | 'jung' | 'cho' | 'count';
|
|
2685
2698
|
|
|
2699
|
+
/**
|
|
2700
|
+
* **난이도로 보일 것** — 나이로 표시하는 분류면 `{ kind: 'age' }`, 아니면 `{ kind: 'band' }`(이름은 부르는 쪽이 짓는다).
|
|
2701
|
+
* 못 매기면 `null`(빈 칸).
|
|
2702
|
+
*
|
|
2703
|
+
* 나이가 있으면 **나이로 매긴다** — DB 트리거가 같은 셈으로 `Grade` 를 채우니 사전 낱말은 결과가 같고, 손으로 더한 낱말은
|
|
2704
|
+
* 더할 때 매긴 옛 등급(다섯 등급 시절의 `4` 같은 것)보다 나이가 맞다. 나이가 없으면 대장의 차례를 믿되, 지금 분류에 없는
|
|
2705
|
+
* 차례면 버린다.
|
|
2706
|
+
*/
|
|
2707
|
+
export declare function difficultyOf(grade: string | number | null | undefined, age: number | null | undefined, bands: readonly WordGradeBand[]): WordDifficulty | null;
|
|
2708
|
+
|
|
2686
2709
|
/** @public */
|
|
2687
2710
|
export declare interface DiscardGuard {
|
|
2688
2711
|
/** `Popup` 의 `beforeClose` 로 넘긴다 — `false` 면 안 닫힌다 */
|
|
@@ -3260,6 +3283,30 @@ export declare interface FolderAddPopupProps {
|
|
|
3260
3283
|
/** @public `parent` 바로 아래의 폴더들(한 층만) — `parent` 가 `null` 이면 맨 위의 폴더들. 받은 차례 그대로 */
|
|
3261
3284
|
export declare function folderChildren(paths: readonly string[], parent: string | null): string[];
|
|
3262
3285
|
|
|
3286
|
+
/**
|
|
3287
|
+
* **폴더 삭제 확인 창**(말귀 청 (442) ㉯ — 말귀 앱에서 옮겨 왔다, 2026-11-14). `FolderAddPopup` 과 한 벌이다.
|
|
3288
|
+
*
|
|
3289
|
+
* **글은 화면이 준다** — 폴더 안에 든 것이 화면마다 달라(훈련 묶음 · 단어훈련 · 단어표) 문구가 다르다. 여기가 쥐는 것은 셋:
|
|
3290
|
+
* · **보이는 이름은 길의 마지막 마디다**(`앙/하위` → 「하위」) — 화면이 저마다 `folderLeaf` 를 부르지 않는다.
|
|
3291
|
+
* · 되돌릴 수 없는 일이라 단추는 `danger`, 글은 코어 사전 `common.delete`(「삭제」).
|
|
3292
|
+
* · 지우는 일은 **길 전체**로 한다.
|
|
3293
|
+
* @public
|
|
3294
|
+
*/
|
|
3295
|
+
export declare function FolderDeleteConfirmPopup({ path, title, message, onConfirm, onClose }: FolderDeleteConfirmPopupProps): JSX.Element;
|
|
3296
|
+
|
|
3297
|
+
/** @public */
|
|
3298
|
+
export declare interface FolderDeleteConfirmPopupProps {
|
|
3299
|
+
/** 지울 폴더의 길(`앙/하위`) */
|
|
3300
|
+
path: string;
|
|
3301
|
+
/** 제목 — 길의 마지막 마디를 받아 짓는다 */
|
|
3302
|
+
title: (leaf: string) => string;
|
|
3303
|
+
/** 본문 — 길의 마지막 마디를 받아 짓는다 */
|
|
3304
|
+
message: (leaf: string) => string;
|
|
3305
|
+
/** 지운다 — **길 전체**를 받는다(마디 이름이 같은 폴더가 여럿일 수 있다) */
|
|
3306
|
+
onConfirm: (path: string) => void | Promise<void>;
|
|
3307
|
+
onClose: () => void;
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3263
3310
|
/**
|
|
3264
3311
|
* 폴더 칸 하나에 그릴 것.
|
|
3265
3312
|
* @public
|
|
@@ -3957,6 +4004,9 @@ export declare function gradeBandDescriptions(t: TFunction, bands: readonly Reso
|
|
|
3957
4004
|
*/
|
|
3958
4005
|
export declare function gradeDescriptions(t: TFunction): string[];
|
|
3959
4006
|
|
|
4007
|
+
/** 나이 → 분류 차례. DB 함수 `word_grade_of_age` 와 같은 셈 — 나이가 없으면 분류도 없다 */
|
|
4008
|
+
export declare function gradeOfAge(age: number | null | undefined, bands: readonly WordGradeBand[]): number | null;
|
|
4009
|
+
|
|
3960
4010
|
/** @public 이 타입에 '문제(정답) 단어' 구조 제약이 있는가(편집기 카운트/후보 좁히기 판단용). */
|
|
3961
4011
|
export declare function hasQuestionWordConstraint(typeKey: WordTrainingTypeKey): boolean;
|
|
3962
4012
|
|
|
@@ -4489,6 +4539,9 @@ export declare function isValidPhone(phone: string): boolean;
|
|
|
4489
4539
|
/** @public 단어가 해당 타입의 문제(정답) 단어로 구조적으로 유효한가. 제약 없는 타입은 항상 true. */
|
|
4490
4540
|
export declare function isValidQuestionWord(typeKey: WordTrainingTypeKey, word: string): boolean;
|
|
4491
4541
|
|
|
4542
|
+
/** 잣대가 맞는 꼴인가 — 서버의 검사와 같은 규칙. `label` 은 보지 않는다(서버에 없다) */
|
|
4543
|
+
export declare function isValidWordGradeBands(bands: unknown): bands is WordGradeBand[];
|
|
4544
|
+
|
|
4492
4545
|
/** @public */
|
|
4493
4546
|
export declare interface ItemAction {
|
|
4494
4547
|
/**
|
|
@@ -5371,6 +5424,9 @@ export declare function mergeNoiseSettings(base: CoreNoiseSettings, patch?: Part
|
|
|
5371
5424
|
*/
|
|
5372
5425
|
export declare function mergeQuestionText(parts: string[], phoneme?: boolean): string;
|
|
5373
5426
|
|
|
5427
|
+
/** `i` 번째 분류의 가장 적은 나이 — 첫 분류는 1세, 다음은 앞 분류의 다음 나이 */
|
|
5428
|
+
export declare const minAgeOf: (bands: readonly WordGradeBand[], i: number) => number;
|
|
5429
|
+
|
|
5374
5430
|
/**
|
|
5375
5431
|
* 최소대립쌍 오답 — 발음 기반 pairIndex에서 정답의 대립쌍을 가져와 공용 필터 적용.
|
|
5376
5432
|
* kind 지정 시 그 종류(cho/jung/jong)만, 없으면 전 종류.
|
|
@@ -6197,6 +6253,12 @@ export declare function parseSortValue(v: string): {
|
|
|
6197
6253
|
/** @public 한 글자를 초/중/종성으로 분해. 한글 음절이 아니면 null. */
|
|
6198
6254
|
export declare function parseSyllable(ch: string): Syllable | null;
|
|
6199
6255
|
|
|
6256
|
+
/**
|
|
6257
|
+
* 서버 글자(`{"bands":[…]}`)를 잣대로. **못 읽으면 처음 잣대로 선다** — 화면이 빈 채로 서면 무엇을 고쳐야 할지 모른다.
|
|
6258
|
+
* DB 트리거도 같은 길로 물러선다. 돌려주는 것은 **새 배열**이다(처음 잣대도 복사본) — 고쳐 써도 남에게 번지지 않는다.
|
|
6259
|
+
*/
|
|
6260
|
+
export declare function parseWordGradeBands(text: string | null | undefined): WordGradeBand[];
|
|
6261
|
+
|
|
6200
6262
|
/** CSS 커스텀 프로퍼티 키 목록 */
|
|
6201
6263
|
export declare const PASS_CARD_BG_VARS: {
|
|
6202
6264
|
readonly text: "--pass-card-text";
|
|
@@ -11794,6 +11856,15 @@ export declare function useCardDragToGroup<T = string>(onDrop: (payload: T, grou
|
|
|
11794
11856
|
*/
|
|
11795
11857
|
export declare function useClosingDelay(waitMs?: number): (todo?: () => void) => void;
|
|
11796
11858
|
|
|
11859
|
+
/**
|
|
11860
|
+
* **인증번호의 남은 시간**(말귀 청 (442) ㉰ — 말귀 앱에서 옮겨 왔다, 2026-11-14). 보낸 뒤 1초마다 줄고, 0 이면 멈춘다.
|
|
11861
|
+
*
|
|
11862
|
+
* · `running` 이 거짓이면 세지 않는다 — 아직 안 보냈거나 이미 맞췄으면 흐를 까닭이 없다(남은 초는 그대로 둔다).
|
|
11863
|
+
* · 매초 타이머를 새로 건다(`setInterval` 이 아니다) — 탭이 뒤로 가 타이머가 느려져도 한 번에 하나씩만 준다.
|
|
11864
|
+
* @public
|
|
11865
|
+
*/
|
|
11866
|
+
export declare function useCodeCountdown(running: boolean): CodeCountdown;
|
|
11867
|
+
|
|
11797
11868
|
/**
|
|
11798
11869
|
* TextField의 `suggestions` 옵션이 쓰는 자동완성 콤보박스 상태/키보드 로직.
|
|
11799
11870
|
* 순수 입력(값 관리)과 분리해서, 자동완성이 필요 없는 TextField 사용처는
|
|
@@ -12860,6 +12931,9 @@ export declare function withStepTimes(payload: unknown, shownAt?: string, answer
|
|
|
12860
12931
|
/** text 뒤에 와/과를 붙여 반환한다. */
|
|
12861
12932
|
export declare function withWaGwa(text: string): string;
|
|
12862
12933
|
|
|
12934
|
+
/** 서버가 받는 가장 많은 나이 — DB 제약(1~99)에서 마지막 분류가 설 자리 하나를 남긴다 */
|
|
12935
|
+
export declare const WORD_GRADE_MAX_AGE = 98;
|
|
12936
|
+
|
|
12863
12937
|
/**
|
|
12864
12938
|
* 약호 → i18n 열쇠 조각 표(품사·어종).
|
|
12865
12939
|
*
|
|
@@ -13013,6 +13087,16 @@ declare interface WordDataUpdatePopupProps {
|
|
|
13013
13087
|
inline?: boolean;
|
|
13014
13088
|
}
|
|
13015
13089
|
|
|
13090
|
+
/** `difficultyOf` 가 내는 것 — 나이 칩으로 보일지(`age`), 분류 이름 하나로 보일지(`band`) */
|
|
13091
|
+
export declare type WordDifficulty = {
|
|
13092
|
+
kind: 'age';
|
|
13093
|
+
age: number;
|
|
13094
|
+
grade: number;
|
|
13095
|
+
} | {
|
|
13096
|
+
kind: 'band';
|
|
13097
|
+
grade: number;
|
|
13098
|
+
};
|
|
13099
|
+
|
|
13016
13100
|
export declare interface WordEntry {
|
|
13017
13101
|
word: string;
|
|
13018
13102
|
pronunciation: string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** @public */
|
|
2
|
+
export interface FolderDeleteConfirmPopupProps {
|
|
3
|
+
/** 지울 폴더의 길(`앙/하위`) */
|
|
4
|
+
path: string;
|
|
5
|
+
/** 제목 — 길의 마지막 마디를 받아 짓는다 */
|
|
6
|
+
title: (leaf: string) => string;
|
|
7
|
+
/** 본문 — 길의 마지막 마디를 받아 짓는다 */
|
|
8
|
+
message: (leaf: string) => string;
|
|
9
|
+
/** 지운다 — **길 전체**를 받는다(마디 이름이 같은 폴더가 여럿일 수 있다) */
|
|
10
|
+
onConfirm: (path: string) => void | Promise<void>;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* **폴더 삭제 확인 창**(말귀 청 (442) ㉯ — 말귀 앱에서 옮겨 왔다, 2026-11-14). `FolderAddPopup` 과 한 벌이다.
|
|
15
|
+
*
|
|
16
|
+
* **글은 화면이 준다** — 폴더 안에 든 것이 화면마다 달라(훈련 묶음 · 단어훈련 · 단어표) 문구가 다르다. 여기가 쥐는 것은 셋:
|
|
17
|
+
* · **보이는 이름은 길의 마지막 마디다**(`앙/하위` → 「하위」) — 화면이 저마다 `folderLeaf` 를 부르지 않는다.
|
|
18
|
+
* · 되돌릴 수 없는 일이라 단추는 `danger`, 글은 코어 사전 `common.delete`(「삭제」).
|
|
19
|
+
* · 지우는 일은 **길 전체**로 한다.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export default function FolderDeleteConfirmPopup({ path, title, message, onConfirm, onClose }: FolderDeleteConfirmPopupProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import ConfirmPopup from './Popup/ConfirmPopup';
|
|
5
|
+
import { folderLeaf } from '../utils/folderPath';
|
|
6
|
+
/**
|
|
7
|
+
* **폴더 삭제 확인 창**(말귀 청 (442) ㉯ — 말귀 앱에서 옮겨 왔다, 2026-11-14). `FolderAddPopup` 과 한 벌이다.
|
|
8
|
+
*
|
|
9
|
+
* **글은 화면이 준다** — 폴더 안에 든 것이 화면마다 달라(훈련 묶음 · 단어훈련 · 단어표) 문구가 다르다. 여기가 쥐는 것은 셋:
|
|
10
|
+
* · **보이는 이름은 길의 마지막 마디다**(`앙/하위` → 「하위」) — 화면이 저마다 `folderLeaf` 를 부르지 않는다.
|
|
11
|
+
* · 되돌릴 수 없는 일이라 단추는 `danger`, 글은 코어 사전 `common.delete`(「삭제」).
|
|
12
|
+
* · 지우는 일은 **길 전체**로 한다.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export default function FolderDeleteConfirmPopup({ path, title, message, onConfirm, onClose }) {
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
const leaf = folderLeaf(path);
|
|
18
|
+
return (_jsx(ConfirmPopup, { title: title(leaf), message: message(leaf), confirmLabel: t('common.delete', '삭제'), confirmVariant: "danger", onConfirm: () => onConfirm(path), onClose: onClose }));
|
|
19
|
+
}
|
|
@@ -111,6 +111,8 @@ export { default as FolderList } from './components/FolderList';
|
|
|
111
111
|
export type { FolderListProps } from './components/FolderList';
|
|
112
112
|
export { default as FolderAddPopup } from './components/FolderAddPopup';
|
|
113
113
|
export type { FolderAddPopupProps } from './components/FolderAddPopup';
|
|
114
|
+
export { default as FolderDeleteConfirmPopup } from './components/FolderDeleteConfirmPopup';
|
|
115
|
+
export type { FolderDeleteConfirmPopupProps } from './components/FolderDeleteConfirmPopup';
|
|
114
116
|
export { default as CardSection } from './components/CardSection';
|
|
115
117
|
export type { CardSectionProps } from './components/CardSection';
|
|
116
118
|
export { default as FolderSearchSections } from './components/FolderSearchSections';
|
|
@@ -76,6 +76,7 @@ export { default as FolderHead } from './components/FolderHead';
|
|
|
76
76
|
export { default as FolderGrid } from './components/FolderGrid';
|
|
77
77
|
export { default as FolderList } from './components/FolderList';
|
|
78
78
|
export { default as FolderAddPopup } from './components/FolderAddPopup';
|
|
79
|
+
export { default as FolderDeleteConfirmPopup } from './components/FolderDeleteConfirmPopup'; // 말귀 청 (442) ㉯
|
|
79
80
|
/* 폴더 화면의 남은 조각(말귀 청 (437) ㉮, 2026-11-13) — 카드가 서는 자리 · 찾는 중 폴더마다 나눠 세우기 */
|
|
80
81
|
export { default as CardSection } from './components/CardSection';
|
|
81
82
|
export { default as FolderSearchSections } from './components/FolderSearchSections';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @public `useCodeCountdown` 이 내주는 것 */
|
|
2
|
+
export interface CodeCountdown {
|
|
3
|
+
/** 남은 초 — 0 이면 끝났다(또는 아직 안 걸었다) */
|
|
4
|
+
left: number;
|
|
5
|
+
/** `분:초` — 초는 두 자리(`2:05`) */
|
|
6
|
+
clock: string;
|
|
7
|
+
/** `초` 로 다시 건다 — 다시 받으면 처음부터 센다. `start(0)` 은 멈춘다. 음수 · 소수는 0 이상의 정수로 내린다 */
|
|
8
|
+
start: (seconds: number) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* **인증번호의 남은 시간**(말귀 청 (442) ㉰ — 말귀 앱에서 옮겨 왔다, 2026-11-14). 보낸 뒤 1초마다 줄고, 0 이면 멈춘다.
|
|
12
|
+
*
|
|
13
|
+
* · `running` 이 거짓이면 세지 않는다 — 아직 안 보냈거나 이미 맞췄으면 흐를 까닭이 없다(남은 초는 그대로 둔다).
|
|
14
|
+
* · 매초 타이머를 새로 건다(`setInterval` 이 아니다) — 탭이 뒤로 가 타이머가 느려져도 한 번에 하나씩만 준다.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare function useCodeCountdown(running: boolean): CodeCountdown;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* **인증번호의 남은 시간**(말귀 청 (442) ㉰ — 말귀 앱에서 옮겨 왔다, 2026-11-14). 보낸 뒤 1초마다 줄고, 0 이면 멈춘다.
|
|
5
|
+
*
|
|
6
|
+
* · `running` 이 거짓이면 세지 않는다 — 아직 안 보냈거나 이미 맞췄으면 흐를 까닭이 없다(남은 초는 그대로 둔다).
|
|
7
|
+
* · 매초 타이머를 새로 건다(`setInterval` 이 아니다) — 탭이 뒤로 가 타이머가 느려져도 한 번에 하나씩만 준다.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export function useCodeCountdown(running) {
|
|
11
|
+
const [left, setLeft] = useState(0);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!running || left <= 0)
|
|
14
|
+
return;
|
|
15
|
+
const timer = setTimeout(() => setLeft(s => Math.max(0, s - 1)), 1000);
|
|
16
|
+
return () => clearTimeout(timer);
|
|
17
|
+
}, [running, left]);
|
|
18
|
+
const start = useCallback((seconds) => {
|
|
19
|
+
setLeft(Number.isFinite(seconds) ? Math.max(0, Math.floor(seconds)) : 0);
|
|
20
|
+
}, []);
|
|
21
|
+
const clock = `${Math.floor(left / 60)}:${String(left % 60).padStart(2, '0')}`;
|
|
22
|
+
return { left, clock, start };
|
|
23
|
+
}
|
|
@@ -28,15 +28,33 @@ function useMatchesStore(query) {
|
|
|
28
28
|
`matchMedia(…).matches` 는 이미 false 였으니 값이 아니라 **알림**이 안 온 것이다(기기 흉내에서 change 가 빠지는 때).
|
|
29
29
|
값이 같으면 useSyncExternalStore 가 다시 그리지 않으므로 더 들어도 비용이 없다.
|
|
30
30
|
안-모음: 하는 일이 matchMedia 값 하나를 견주는 것뿐이다 — 같으면 아무것도 안 그린다. */
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
/* **한 박자 뒤에 한 번 더 읽는다**(말귀 실측 2026-11-14, 0.446.0) — 어떤 브라우저(기기 흉내)는 resize 를 미디어
|
|
32
|
+
재평가보다 **먼저** 쏜다. 그 순간 읽으면 옛 값이라 판정이 늘 한 걸음 늦었다(812 에서 아직 폰, 375 로 돌아오면 그제야
|
|
33
|
+
태블릿). 다음 틀(rAF)과, 틀이 멈춘 탭을 위해 조금 뒤(타이머)에 다시 읽는다. 값이 같으면 안 그린다. */
|
|
34
|
+
let rafId = null;
|
|
35
|
+
let timerId = null;
|
|
36
|
+
const onViewport = () => {
|
|
37
|
+
onChange();
|
|
38
|
+
if (rafId === null && typeof requestAnimationFrame !== 'undefined') {
|
|
39
|
+
rafId = requestAnimationFrame(() => { rafId = null; onChange(); });
|
|
40
|
+
}
|
|
41
|
+
if (timerId !== null)
|
|
42
|
+
clearTimeout(timerId);
|
|
43
|
+
timerId = setTimeout(() => { timerId = null; onChange(); }, 150);
|
|
44
|
+
};
|
|
45
|
+
window.addEventListener('resize', onViewport);
|
|
46
|
+
window.addEventListener('orientationchange', onViewport);
|
|
33
47
|
return () => {
|
|
34
48
|
if (mql.removeEventListener)
|
|
35
49
|
mql.removeEventListener('change', onChange);
|
|
36
50
|
else if (mql.removeListener)
|
|
37
51
|
mql.removeListener(onChange);
|
|
38
|
-
window.removeEventListener('resize',
|
|
39
|
-
window.removeEventListener('orientationchange',
|
|
52
|
+
window.removeEventListener('resize', onViewport);
|
|
53
|
+
window.removeEventListener('orientationchange', onViewport);
|
|
54
|
+
if (rafId !== null)
|
|
55
|
+
cancelAnimationFrame(rafId);
|
|
56
|
+
if (timerId !== null)
|
|
57
|
+
clearTimeout(timerId);
|
|
40
58
|
};
|
|
41
59
|
}, [query]);
|
|
42
60
|
return React.useSyncExternalStore(subscribe, () => getMatches(query), () => false);
|
|
@@ -41,4 +41,6 @@ export * from './hooks/useScreenWakeLock';
|
|
|
41
41
|
export * from './hooks/useOnline';
|
|
42
42
|
export * from './hooks/useOutsideClose';
|
|
43
43
|
export { useBackClosable } from './hooks/useBackClosable';
|
|
44
|
+
export { useCodeCountdown } from './hooks/useCodeCountdown';
|
|
45
|
+
export type { CodeCountdown } from './hooks/useCodeCountdown';
|
|
44
46
|
export * from './hooks/useClosingDelay';
|
|
@@ -47,4 +47,5 @@ export * from './hooks/useScreenWakeLock';
|
|
|
47
47
|
export * from './hooks/useOnline';
|
|
48
48
|
export * from './hooks/useOutsideClose';
|
|
49
49
|
export { useBackClosable } from './hooks/useBackClosable';
|
|
50
|
+
export { useCodeCountdown } from './hooks/useCodeCountdown'; // 인증번호 남은 시간(말귀 청 (442) ㉰)
|
|
50
51
|
export * from './hooks/useClosingDelay';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { WordGradeBand } from './wordAttributeFilterCodes';
|
|
2
|
+
/**
|
|
3
|
+
* **난이도 분류의 셈**(말귀 청 (442) ㉮, 2026-11-14) — 말귀 앱과 어드민이 한 벌씩 들고 있던 것을 모았다.
|
|
4
|
+
*
|
|
5
|
+
* 분류는 **셋으로 고정**이다(사장님 지시 2026-11-10 — 미취학 · 초등 저학년 · 초등 고학년). 원본은 말귀 서버의
|
|
6
|
+
* `app_config.word_grade_bands` 이고, 어드민이 고치는 것은 나이 경계 둘과 분류마다 **나이로 표시**(`showAge`)다.
|
|
7
|
+
*
|
|
8
|
+
* 꼴 검사는 **서버(`admin_set_word_grade_bands`)와 같은 엄한 규칙**이다 — 두 벌이 갈려 있었다(앱은 정수 · 상한을 안 봤다).
|
|
9
|
+
* · 분류는 꼭 셋, `grade` 는 1·2·3 차례대로.
|
|
10
|
+
* · 앞의 둘은 `maxAge` 가 늘어나는 **정수**이고 `WORD_GRADE_MAX_AGE`(98) 이하.
|
|
11
|
+
* · 마지막 분류만 `maxAge` 가 `null` — 그 위 나이 전부.
|
|
12
|
+
*
|
|
13
|
+
* 이름(`미취학` …)과 나이 구간 글(`6세 이하`)은 여기 없다 — 앱은 제 사전으로, 어드민은 제 화면 말로 짓는다.
|
|
14
|
+
* 칩으로 그리는 쪽은 `resolveGradeBands`(이름을 `label` 에 얹어 넘긴다).
|
|
15
|
+
*/
|
|
16
|
+
/** 서버가 받는 가장 많은 나이 — DB 제약(1~99)에서 마지막 분류가 설 자리 하나를 남긴다 */
|
|
17
|
+
export declare const WORD_GRADE_MAX_AGE = 98;
|
|
18
|
+
/** 처음 잣대 — ~6세 · 7~9세 · 10세 이상. 서버 글자를 못 읽으면 이것으로 선다 */
|
|
19
|
+
export declare const DEFAULT_WORD_GRADE_BANDS: readonly WordGradeBand[];
|
|
20
|
+
/** 잣대가 맞는 꼴인가 — 서버의 검사와 같은 규칙. `label` 은 보지 않는다(서버에 없다) */
|
|
21
|
+
export declare function isValidWordGradeBands(bands: unknown): bands is WordGradeBand[];
|
|
22
|
+
/**
|
|
23
|
+
* 서버 글자(`{"bands":[…]}`)를 잣대로. **못 읽으면 처음 잣대로 선다** — 화면이 빈 채로 서면 무엇을 고쳐야 할지 모른다.
|
|
24
|
+
* DB 트리거도 같은 길로 물러선다. 돌려주는 것은 **새 배열**이다(처음 잣대도 복사본) — 고쳐 써도 남에게 번지지 않는다.
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseWordGradeBands(text: string | null | undefined): WordGradeBand[];
|
|
27
|
+
/** `i` 번째 분류의 가장 적은 나이 — 첫 분류는 1세, 다음은 앞 분류의 다음 나이 */
|
|
28
|
+
export declare const minAgeOf: (bands: readonly WordGradeBand[], i: number) => number;
|
|
29
|
+
/** 나이 → 분류 차례. DB 함수 `word_grade_of_age` 와 같은 셈 — 나이가 없으면 분류도 없다 */
|
|
30
|
+
export declare function gradeOfAge(age: number | null | undefined, bands: readonly WordGradeBand[]): number | null;
|
|
31
|
+
/** `difficultyOf` 가 내는 것 — 나이 칩으로 보일지(`age`), 분류 이름 하나로 보일지(`band`) */
|
|
32
|
+
export type WordDifficulty = {
|
|
33
|
+
kind: 'age';
|
|
34
|
+
age: number;
|
|
35
|
+
grade: number;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'band';
|
|
38
|
+
grade: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* **난이도로 보일 것** — 나이로 표시하는 분류면 `{ kind: 'age' }`, 아니면 `{ kind: 'band' }`(이름은 부르는 쪽이 짓는다).
|
|
42
|
+
* 못 매기면 `null`(빈 칸).
|
|
43
|
+
*
|
|
44
|
+
* 나이가 있으면 **나이로 매긴다** — DB 트리거가 같은 셈으로 `Grade` 를 채우니 사전 낱말은 결과가 같고, 손으로 더한 낱말은
|
|
45
|
+
* 더할 때 매긴 옛 등급(다섯 등급 시절의 `4` 같은 것)보다 나이가 맞다. 나이가 없으면 대장의 차례를 믿되, 지금 분류에 없는
|
|
46
|
+
* 차례면 버린다.
|
|
47
|
+
*/
|
|
48
|
+
export declare function difficultyOf(grade: string | number | null | undefined, age: number | null | undefined, bands: readonly WordGradeBand[]): WordDifficulty | null;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **난이도 분류의 셈**(말귀 청 (442) ㉮, 2026-11-14) — 말귀 앱과 어드민이 한 벌씩 들고 있던 것을 모았다.
|
|
3
|
+
*
|
|
4
|
+
* 분류는 **셋으로 고정**이다(사장님 지시 2026-11-10 — 미취학 · 초등 저학년 · 초등 고학년). 원본은 말귀 서버의
|
|
5
|
+
* `app_config.word_grade_bands` 이고, 어드민이 고치는 것은 나이 경계 둘과 분류마다 **나이로 표시**(`showAge`)다.
|
|
6
|
+
*
|
|
7
|
+
* 꼴 검사는 **서버(`admin_set_word_grade_bands`)와 같은 엄한 규칙**이다 — 두 벌이 갈려 있었다(앱은 정수 · 상한을 안 봤다).
|
|
8
|
+
* · 분류는 꼭 셋, `grade` 는 1·2·3 차례대로.
|
|
9
|
+
* · 앞의 둘은 `maxAge` 가 늘어나는 **정수**이고 `WORD_GRADE_MAX_AGE`(98) 이하.
|
|
10
|
+
* · 마지막 분류만 `maxAge` 가 `null` — 그 위 나이 전부.
|
|
11
|
+
*
|
|
12
|
+
* 이름(`미취학` …)과 나이 구간 글(`6세 이하`)은 여기 없다 — 앱은 제 사전으로, 어드민은 제 화면 말로 짓는다.
|
|
13
|
+
* 칩으로 그리는 쪽은 `resolveGradeBands`(이름을 `label` 에 얹어 넘긴다).
|
|
14
|
+
*/
|
|
15
|
+
/** 서버가 받는 가장 많은 나이 — DB 제약(1~99)에서 마지막 분류가 설 자리 하나를 남긴다 */
|
|
16
|
+
export const WORD_GRADE_MAX_AGE = 98;
|
|
17
|
+
/** 처음 잣대 — ~6세 · 7~9세 · 10세 이상. 서버 글자를 못 읽으면 이것으로 선다 */
|
|
18
|
+
export const DEFAULT_WORD_GRADE_BANDS = Object.freeze([
|
|
19
|
+
Object.freeze({ grade: 1, maxAge: 6, showAge: false }),
|
|
20
|
+
Object.freeze({ grade: 2, maxAge: 9, showAge: false }),
|
|
21
|
+
Object.freeze({ grade: 3, maxAge: null, showAge: false }),
|
|
22
|
+
]);
|
|
23
|
+
/** 잣대가 맞는 꼴인가 — 서버의 검사와 같은 규칙. `label` 은 보지 않는다(서버에 없다) */
|
|
24
|
+
export function isValidWordGradeBands(bands) {
|
|
25
|
+
if (!Array.isArray(bands) || bands.length !== DEFAULT_WORD_GRADE_BANDS.length)
|
|
26
|
+
return false;
|
|
27
|
+
let prev = 0;
|
|
28
|
+
return bands.every((b, i) => {
|
|
29
|
+
if (!b || b.grade !== i + 1 || typeof b.showAge !== 'boolean')
|
|
30
|
+
return false;
|
|
31
|
+
if (i === bands.length - 1)
|
|
32
|
+
return b.maxAge === null;
|
|
33
|
+
if (typeof b.maxAge !== 'number' || !Number.isInteger(b.maxAge))
|
|
34
|
+
return false;
|
|
35
|
+
if (b.maxAge <= prev || b.maxAge > WORD_GRADE_MAX_AGE)
|
|
36
|
+
return false;
|
|
37
|
+
prev = b.maxAge;
|
|
38
|
+
return true;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 서버 글자(`{"bands":[…]}`)를 잣대로. **못 읽으면 처음 잣대로 선다** — 화면이 빈 채로 서면 무엇을 고쳐야 할지 모른다.
|
|
43
|
+
* DB 트리거도 같은 길로 물러선다. 돌려주는 것은 **새 배열**이다(처음 잣대도 복사본) — 고쳐 써도 남에게 번지지 않는다.
|
|
44
|
+
*/
|
|
45
|
+
export function parseWordGradeBands(text) {
|
|
46
|
+
const fallback = () => DEFAULT_WORD_GRADE_BANDS.map(b => ({ ...b }));
|
|
47
|
+
if (!text)
|
|
48
|
+
return fallback();
|
|
49
|
+
try {
|
|
50
|
+
const bands = JSON.parse(text)?.bands;
|
|
51
|
+
return isValidWordGradeBands(bands) ? bands.map(b => ({ ...b })) : fallback();
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return fallback();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** `i` 번째 분류의 가장 적은 나이 — 첫 분류는 1세, 다음은 앞 분류의 다음 나이 */
|
|
58
|
+
export const minAgeOf = (bands, i) => i === 0 ? 1 : (bands[i - 1]?.maxAge ?? 0) + 1;
|
|
59
|
+
/** 나이 → 분류 차례. DB 함수 `word_grade_of_age` 와 같은 셈 — 나이가 없으면 분류도 없다 */
|
|
60
|
+
export function gradeOfAge(age, bands) {
|
|
61
|
+
if (age == null)
|
|
62
|
+
return null;
|
|
63
|
+
return bands.find(b => b.maxAge == null || age <= b.maxAge)?.grade ?? null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* **난이도로 보일 것** — 나이로 표시하는 분류면 `{ kind: 'age' }`, 아니면 `{ kind: 'band' }`(이름은 부르는 쪽이 짓는다).
|
|
67
|
+
* 못 매기면 `null`(빈 칸).
|
|
68
|
+
*
|
|
69
|
+
* 나이가 있으면 **나이로 매긴다** — DB 트리거가 같은 셈으로 `Grade` 를 채우니 사전 낱말은 결과가 같고, 손으로 더한 낱말은
|
|
70
|
+
* 더할 때 매긴 옛 등급(다섯 등급 시절의 `4` 같은 것)보다 나이가 맞다. 나이가 없으면 대장의 차례를 믿되, 지금 분류에 없는
|
|
71
|
+
* 차례면 버린다.
|
|
72
|
+
*/
|
|
73
|
+
export function difficultyOf(grade, age, bands) {
|
|
74
|
+
const g = gradeOfAge(age, bands) ?? (Number(grade) || null);
|
|
75
|
+
const band = g == null ? undefined : bands.find(({ grade: n }) => n === g);
|
|
76
|
+
if (!band)
|
|
77
|
+
return null;
|
|
78
|
+
return band.showAge && age != null ? { kind: 'age', age, grade: band.grade } : { kind: 'band', grade: band.grade };
|
|
79
|
+
}
|
|
@@ -25,6 +25,9 @@ export { reorderArray, shuffle, sample } from './utils/array';
|
|
|
25
25
|
export { getErrorMessage, toUserErrorMessage, isNetworkErrorMessage, NETWORK_ERROR_MESSAGE } from './utils/errorMessage';
|
|
26
26
|
export { sortToValue, parseSortValue } from './utils/sortValue';
|
|
27
27
|
export { folderLeaf, folderParent, folderJoin, isFolderNameOk, isInFolder, withAncestors, folderChildren, folderTrail, folderTree, folderMoved, canMoveFolder, folderMoveVerdict, } from './utils/folderPath';
|
|
28
|
+
export { DEFAULT_WORD_GRADE_BANDS, WORD_GRADE_MAX_AGE, isValidWordGradeBands, parseWordGradeBands, minAgeOf, gradeOfAge, difficultyOf } from './utils/wordGradeBands';
|
|
29
|
+
export type { WordDifficulty } from './utils/wordGradeBands';
|
|
30
|
+
export type { WordGradeBand } from './utils/wordAttributeFilterCodes';
|
|
28
31
|
export { kstToIso, kstPartsAt, kstNowParts } from './utils/kstDateTime';
|
|
29
32
|
export type { KstParts } from './utils/kstDateTime';
|
|
30
33
|
export { folderMenuItems } from './utils/folderMenu';
|
|
@@ -24,6 +24,8 @@ export { getErrorMessage, toUserErrorMessage, isNetworkErrorMessage, NETWORK_ERR
|
|
|
24
24
|
export { sortToValue, parseSortValue } from './utils/sortValue';
|
|
25
25
|
/* 폴더 안의 폴더 — 이름을 길로 적는 셈(말귀 청 (435), 2026-11-13). 그리는 조각은 `FolderHead` 식구다 */
|
|
26
26
|
export { folderLeaf, folderParent, folderJoin, isFolderNameOk, isInFolder, withAncestors, folderChildren, folderTrail, folderTree, folderMoved, canMoveFolder, folderMoveVerdict, } from './utils/folderPath';
|
|
27
|
+
/* 난이도 분류의 셈 — 말귀 앱 · 어드민이 한 벌씩 들던 것(말귀 청 (442) ㉮). 꼴 검사는 서버와 같은 엄한 규칙 */
|
|
28
|
+
export { DEFAULT_WORD_GRADE_BANDS, WORD_GRADE_MAX_AGE, isValidWordGradeBands, parseWordGradeBands, minAgeOf, gradeOfAge, difficultyOf } from './utils/wordGradeBands';
|
|
27
29
|
export { kstToIso, kstPartsAt, kstNowParts } from './utils/kstDateTime'; // 한국 벽시계 ↔ 순간(말귀 청 (437) ㉳ⓒ)
|
|
28
30
|
export { folderMenuItems } from './utils/folderMenu'; // 폴더 메뉴의 줄(말귀 청 (437) ㉮)
|
|
29
31
|
export { escapeCsvField, downloadCsvText } from './utils/csv';
|