@ihabdevteam/core 0.474.0 → 0.476.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.
@@ -858,7 +858,7 @@ export declare function buildGradeSection(t: TFunction, keys: WordAttributeFilte
858
858
  * 어드민이 정한 **등급 묶음**(청 (389)) — 주면 칩과 설명을 이것으로 짓는다.
859
859
  *
860
860
  * 묶음마다 `showAge` 면 그 나이들이 `N세` 칩으로(위가 열린 묶음이면 `N세 이상` 하나),
861
- * 아니면 `N등급` 칩 하나가 서고 맨 끝에 `없음`. **안 주거나 꼴이 어긋나면 옛 줄 그대로다**
861
+ * 아니면 `N등급` 칩 하나가 선다. `없음` 은 안 선다(청 (473)). **안 주거나 꼴이 어긋나면 옛 줄 그대로다**
862
862
  * (`3세`~`7세` · `2`~`4등급` · `없음`) — 꼴이 어긋날 때 고쳐 쓰지 않는 까닭은 `resolveGradeBands` 에.
863
863
  */
864
864
  bands?: readonly WordGradeBand[] | null;
@@ -2279,7 +2279,7 @@ export declare function copyText(text: string): Promise<boolean>;
2279
2279
  *
2280
2280
  * 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
2281
2281
  */
2282
- export declare const CORE_VERSION = "0.474.0";
2282
+ export declare const CORE_VERSION = "0.476.0";
2283
2283
 
2284
2284
  /** @public */
2285
2285
  declare const coreDefault: Record<string, unknown>;
@@ -4090,7 +4090,8 @@ export declare function getTTSUrlResolver(): ((text: string) => string | Promise
4090
4090
  export declare function getWordPool(): WordPool | null;
4091
4091
 
4092
4092
  /**
4093
- * **묶음에서 짓는 난이도 설명** — 묶음마다 한 줄, 맨 끝에 `없음`(청 (389)③).
4093
+ * **묶음에서 짓는 난이도 설명** — 묶음마다 한 줄(청 (389)③). `없음` 줄은 칩과 함께 걷었다(청 (473)).
4094
+ * 나이 칩 시작(`fromAge`)이 있는 묶음은 그 아래 나이가 첫 칩에 든다는 줄이 하나 더 붙는다.
4094
4095
  *
4095
4096
  * 전에는 `3세~7세: 가장 쉬운 낱말(1등급)…` 이 박혀 있었는데, 7세가 2등급이 되면서 **틀린 말**이
4096
4097
  * 되었다. 묶음은 어드민이 바꾸므로 설명도 묶음을 따라가야 한다 — 따로 적어 두면 한쪽이 안
@@ -8038,6 +8039,8 @@ declare interface ResolvedGradeBand {
8038
8039
  showAge: boolean;
8039
8040
  /** 칩 이름 — `showAge: false` 이고 이름을 받았을 때만 */
8040
8041
  label?: string;
8042
+ /** 나이 칩이 시작하는 나이 — `showAge` 이고 `minAge` 보다 클 때만(같으면 안 준 것과 같다). 아래 나이는 첫 칩에 든다 */
8043
+ fromAge?: number;
8041
8044
  }
8042
8045
 
8043
8046
  /**
@@ -13419,6 +13422,16 @@ export declare interface WordGradeBand {
13419
13422
  * **코드로 되읽힌다**(`wordAttributeValueCodeOf`). 빈 글자는 안 준 것으로 본다.
13420
13423
  */
13421
13424
  label?: string;
13425
+ /**
13426
+ * **나이 칩이 시작하는 나이**(말귀 청 (473), 사장님 지시 2026-11-20 — *"1세 … 제거해 … 2세를 3세로 병합해서
13427
+ * 표현하는걸 옵션"*). `showAge` 묶음에서만 읽는다. 정수, 그 묶음의 가장 적은 나이 이상 `maxAge` 이하
13428
+ * (열린 묶음은 99 이하). 안 주면(`undefined`·`null`) 묶음의 가장 적은 나이부터다 — 전과 같다.
13429
+ *
13430
+ * 주면 그보다 어린 나이는 **첫 칩에 합친다** — `fromAge: 3` 이면 칩이 `3세`…`6세` 이고 `3세` 칩이
13431
+ * 1·2·3세 낱말을 건진다(`matchesGradeCodes`). 난이도 칸도 2세 낱말을 `3세` 로 보인다(`difficultyOf`).
13432
+ * 칩 코드는 그대로 `age3` 이다 — 새 꼴을 안 만든다(저장된 설정·되읽기가 그대로 간다).
13433
+ */
13434
+ fromAge?: number | null;
13422
13435
  }
13423
13436
 
13424
13437
  /**
@@ -13525,6 +13538,8 @@ export declare interface WordPoolEntry {
13525
13538
  pronunciation?: string;
13526
13539
  /** 난이도 등급('1'~'4'). 없으면 undefined. */
13527
13540
  grade?: string;
13541
+ /** 나이(`WordEntry.age`) — 단어훈련의 나이 칩(`3세` 등)이 이것으로 건진다. 없으면 나이 칩에 안 걸린다(말귀 청 (474)). */
13542
+ age?: number | null;
13528
13543
  }
13529
13544
 
13530
13545
  /**
@@ -43,13 +43,14 @@ export declare function buildGradeSection(t: TFunction, keys: WordAttributeFilte
43
43
  * 어드민이 정한 **등급 묶음**(청 (389)) — 주면 칩과 설명을 이것으로 짓는다.
44
44
  *
45
45
  * 묶음마다 `showAge` 면 그 나이들이 `N세` 칩으로(위가 열린 묶음이면 `N세 이상` 하나),
46
- * 아니면 `N등급` 칩 하나가 서고 맨 끝에 `없음`. **안 주거나 꼴이 어긋나면 옛 줄 그대로다**
46
+ * 아니면 `N등급` 칩 하나가 선다. `없음` 은 안 선다(청 (473)). **안 주거나 꼴이 어긋나면 옛 줄 그대로다**
47
47
  * (`3세`~`7세` · `2`~`4등급` · `없음`) — 꼴이 어긋날 때 고쳐 쓰지 않는 까닭은 `resolveGradeBands` 에.
48
48
  */
49
49
  bands?: readonly WordGradeBand[] | null;
50
50
  }): FilterPanelSection;
51
51
  /**
52
- * **묶음에서 짓는 난이도 설명** — 묶음마다 한 줄, 맨 끝에 `없음`(청 (389)③).
52
+ * **묶음에서 짓는 난이도 설명** — 묶음마다 한 줄(청 (389)③). `없음` 줄은 칩과 함께 걷었다(청 (473)).
53
+ * 나이 칩 시작(`fromAge`)이 있는 묶음은 그 아래 나이가 첫 칩에 든다는 줄이 하나 더 붙는다.
53
54
  *
54
55
  * 전에는 `3세~7세: 가장 쉬운 낱말(1등급)…` 이 박혀 있었는데, 7세가 2등급이 되면서 **틀린 말**이
55
56
  * 되었다. 묶음은 어드민이 바꾸므로 설명도 묶음을 따라가야 한다 — 따로 적어 두면 한쪽이 안
@@ -2,7 +2,7 @@
2
2
  import { useMemo } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { FILTER_ALL_VALUE } from '../types/filterPanel';
5
- import { toWordAttributeFilterCodes, wordAttributeFilterFromCodes, wordAttributeSectionOf, wordAttributeValueCodeOf, wordAttributeLabelLanguageOf, resolveGradeBands, gradeBandCodes, ageOfGradeCode, agePlusOfGradeCode, } from '../utils/wordAttributeFilterCodes';
5
+ import { toWordAttributeFilterCodes, wordAttributeFilterFromCodes, wordAttributeSectionOf, wordAttributeValueCodeOf, wordAttributeLabelLanguageOf, resolveGradeBands, gradeBandCodes, gradeBandChipStart, ageOfGradeCode, agePlusOfGradeCode, } from '../utils/wordAttributeFilterCodes';
6
6
  /* 저장용 코드 모양과 오가는 도구 — 공용 속성 필터를 언어와 무관하게 저장·복원한다(utils/wordAttributeFilterCodes) */
7
7
  export { toWordAttributeFilterCodes, wordAttributeFilterFromCodes, normalizeWordAttributeFilter } from '../utils/wordAttributeFilterCodes';
8
8
  /**
@@ -48,7 +48,10 @@ export function buildGradeSection(t, keys, opts) {
48
48
  label: keys.difficulty,
49
49
  /* 칩 글자는 `wordAttributeFilterCodes` 의 사전과 **같은 열쇠·같은 틀**로 짓는다 — 거기서
50
50
  코드로 못 읽으면 칩은 켜져 보이는데 한 낱말도 안 걸린다(`없음` 이 밟았던 꼴) */
51
- items: [...gradeBandCodes(resolved).map(code => gradeChipLabel(t, code, resolved)), t('wordSearch.filter.gradeNone', '없음')],
51
+ /* **묶음을 받은 줄에는 `없음` 이 안 선다**(말귀 청 (473), 사장님 지시 2026-11-20 *"없음 은 제거해"*).
52
+ 모든 낱말에 나이가 있고 DB 가 나이로 등급을 매기니 빈 등급이 없다(라이브 0). 켜도 한 낱말도 안 건졌다.
53
+ 저장된 `none` 은 그대로 읽는다(`isGradeCode` · 사전) — 화면에서만 빠진다. 묶음이 없는 옛 줄은 그대로다. */
54
+ items: gradeBandCodes(resolved).map(code => gradeChipLabel(t, code, resolved)),
52
55
  multiple: true,
53
56
  allOption: true,
54
57
  allLabel: opts?.allLabel,
@@ -102,7 +105,8 @@ function gradeChipLabel(t, code, bands) {
102
105
  return t('wordSearch.filter.grade', { n: Number(code), defaultValue: `${code}등급` });
103
106
  }
104
107
  /**
105
- * **묶음에서 짓는 난이도 설명** — 묶음마다 한 줄, 맨 끝에 `없음`(청 (389)③).
108
+ * **묶음에서 짓는 난이도 설명** — 묶음마다 한 줄(청 (389)③). `없음` 줄은 칩과 함께 걷었다(청 (473)).
109
+ * 나이 칩 시작(`fromAge`)이 있는 묶음은 그 아래 나이가 첫 칩에 든다는 줄이 하나 더 붙는다.
106
110
  *
107
111
  * 전에는 `3세~7세: 가장 쉬운 낱말(1등급)…` 이 박혀 있었는데, 7세가 2등급이 되면서 **틀린 말**이
108
112
  * 되었다. 묶음은 어드민이 바꾸므로 설명도 묶음을 따라가야 한다 — 따로 적어 두면 한쪽이 안
@@ -117,23 +121,31 @@ export function gradeBandDescriptions(t, bands) {
117
121
  표현하지 않기로 했어"*). 나이로 보이는 묶음은 이름을 안 받으므로 이름 있는 묶음과 섞이면
118
122
  `1등급 낱말을…` 이 남는데, 그러면 칩에는 없는 `등급` 이 설명에만 나온다. */
119
123
  const named = bands.some(b => b.label);
120
- const lines = bands.map((band) => {
124
+ const lines = bands.flatMap((band) => {
125
+ /* 나이로 보이는 묶음은 **칩이 시작하는 나이**부터 적는다(청 (473) `fromAge`) — 칩에 없는 `1세` 를 설명에 안 쓴다 */
126
+ const lo = band.showAge ? gradeBandChipStart(band) : band.minAge;
121
127
  const ages = band.maxAge == null
122
- ? t('wordSearch.filter.agePlus', { n: band.minAge, defaultValue: `${band.minAge}세 이상` })
123
- : band.minAge === band.maxAge
124
- ? t('wordSearch.filter.age', { n: band.minAge, defaultValue: `${band.minAge}세` })
125
- : t('wordSearch.filter.ageRange', { from: band.minAge, to: band.maxAge, defaultValue: `${band.minAge}세~${band.maxAge}세` });
128
+ ? t('wordSearch.filter.agePlus', { n: lo, defaultValue: `${lo}세 이상` })
129
+ : lo === band.maxAge
130
+ ? t('wordSearch.filter.age', { n: lo, defaultValue: `${lo}세` })
131
+ : t('wordSearch.filter.ageRange', { from: lo, to: band.maxAge, defaultValue: `${lo}세~${band.maxAge}세` });
132
+ const floor = band.showAge && band.fromAge != null
133
+ ? [t('wordSearch.filter.difficultyInfoAgeFloor', { n: band.fromAge, defaultValue: `${band.fromAge}세: ${band.fromAge}세보다 어린 낱말도 함께 듭니다.` })]
134
+ : [];
135
+ return [describe(band, ages, lo), ...floor];
136
+ });
137
+ return lines;
138
+ function describe(band, ages, lo) {
126
139
  const grade = band.label ?? t('wordSearch.filter.grade', { n: band.grade, defaultValue: `${band.grade}등급` });
127
140
  if (!band.showAge)
128
141
  return t('wordSearch.filter.difficultyInfoBandGrade', { grade, ages, defaultValue: `${grade}: ${ages} 낱말입니다.` });
129
142
  if (named)
130
143
  return t('wordSearch.filter.difficultyInfoBandAgeNamed', { ages, defaultValue: `${ages}: 나이로 나눈 낱말입니다.` });
131
- if (band.maxAge != null && band.maxAge > band.minAge) {
144
+ if (band.maxAge != null && band.maxAge > lo) {
132
145
  return t('wordSearch.filter.difficultyInfoBandAge', { grade, ages, defaultValue: `${ages}: ${grade} 낱말을 나이별로 나눈 것입니다.` });
133
146
  }
134
147
  return t('wordSearch.filter.difficultyInfoBandAgeOne', { grade, ages, defaultValue: `${ages}: ${grade} 낱말입니다.` });
135
- });
136
- return [...lines, t('wordSearch.filter.difficultyInfoNone', '없음: 난이도가 매겨지지 않은 낱말입니다.')];
148
+ }
137
149
  }
138
150
  /** @public 품사 FilterPanelSection — 세 화면 공용. */
139
151
  export function buildPartOfSpeechSection(keys) {
@@ -14,6 +14,7 @@
14
14
  "difficultyInfoGrade": "Grades 2–4: harder words, not split by age.",
15
15
  "difficultyInfoNone": "None: words with no difficulty assigned.",
16
16
  "difficultyInfoBandAge": "{{ages}}: {{grade}} words, split by age.",
17
+ "difficultyInfoAgeFloor": "Age {{n}}: also includes words for younger ages.",
17
18
  "difficultyInfoBandAgeOne": "{{ages}}: {{grade}} words.",
18
19
  "difficultyInfoBandGrade": "{{grade}}: words for {{ages}}.",
19
20
  "difficultyInfoBandAgeNamed": "{{ages}}: words split by age.",
@@ -716,6 +716,7 @@
716
716
  "difficultyInfoGrade": "Grades 2–4: harder words, not split by age.",
717
717
  "difficultyInfoNone": "None: words with no difficulty assigned.",
718
718
  "difficultyInfoBandAge": "{{ages}}: {{grade}} words, split by age.",
719
+ "difficultyInfoAgeFloor": "Age {{n}}: also includes words for younger ages.",
719
720
  "difficultyInfoBandAgeOne": "{{ages}}: {{grade}} words.",
720
721
  "difficultyInfoBandGrade": "{{grade}}: words for {{ages}}.",
721
722
  "difficultyInfoBandAgeNamed": "{{ages}}: words split by age.",
@@ -702,6 +702,7 @@
702
702
  "difficultyInfoGrade": "2~4등급: 그보다 어려운 낱말이고, 나이로는 나누지 않습니다.",
703
703
  "difficultyInfoNone": "없음: 난이도가 매겨지지 않은 낱말입니다.",
704
704
  "difficultyInfoBandAge": "{{ages}}: {{grade}} 낱말을 나이별로 나눈 것입니다.",
705
+ "difficultyInfoAgeFloor": "{{n}}세: {{n}}세보다 어린 낱말도 함께 듭니다.",
705
706
  "difficultyInfoBandAgeOne": "{{ages}}: {{grade}} 낱말입니다.",
706
707
  "difficultyInfoBandGrade": "{{grade}}: {{ages}} 낱말입니다.",
707
708
  "difficultyInfoBandAgeNamed": "{{ages}}: 나이로 나눈 낱말입니다.",
@@ -86,6 +86,16 @@ export interface WordGradeBand {
86
86
  * **코드로 되읽힌다**(`wordAttributeValueCodeOf`). 빈 글자는 안 준 것으로 본다.
87
87
  */
88
88
  label?: string;
89
+ /**
90
+ * **나이 칩이 시작하는 나이**(말귀 청 (473), 사장님 지시 2026-11-20 — *"1세 … 제거해 … 2세를 3세로 병합해서
91
+ * 표현하는걸 옵션"*). `showAge` 묶음에서만 읽는다. 정수, 그 묶음의 가장 적은 나이 이상 `maxAge` 이하
92
+ * (열린 묶음은 99 이하). 안 주면(`undefined`·`null`) 묶음의 가장 적은 나이부터다 — 전과 같다.
93
+ *
94
+ * 주면 그보다 어린 나이는 **첫 칩에 합친다** — `fromAge: 3` 이면 칩이 `3세`…`6세` 이고 `3세` 칩이
95
+ * 1·2·3세 낱말을 건진다(`matchesGradeCodes`). 난이도 칸도 2세 낱말을 `3세` 로 보인다(`difficultyOf`).
96
+ * 칩 코드는 그대로 `age3` 이다 — 새 꼴을 안 만든다(저장된 설정·되읽기가 그대로 간다).
97
+ */
98
+ fromAge?: number | null;
89
99
  }
90
100
  /** 묶음 하나를 나이 범위로 편 것 */
91
101
  export interface ResolvedGradeBand {
@@ -95,7 +105,11 @@ export interface ResolvedGradeBand {
95
105
  showAge: boolean;
96
106
  /** 칩 이름 — `showAge: false` 이고 이름을 받았을 때만 */
97
107
  label?: string;
108
+ /** 나이 칩이 시작하는 나이 — `showAge` 이고 `minAge` 보다 클 때만(같으면 안 준 것과 같다). 아래 나이는 첫 칩에 든다 */
109
+ fromAge?: number;
98
110
  }
111
+ /** 편 묶음의 **첫 칩 나이** — `fromAge` 가 있으면 그것, 없으면 `minAge` */
112
+ export declare const gradeBandChipStart: (band: ResolvedGradeBand) => number;
99
113
  /**
100
114
  * 묶음 목록을 나이 범위로 편다. **꼴이 어긋나면 `null`** — 부르는 쪽은 묶음이 없는 것처럼 간다.
101
115
  *
@@ -99,6 +99,11 @@ age) {
99
99
  if (age != null) {
100
100
  if (set.has(`age${age}`))
101
101
  return true;
102
+ /* `fromAge` 아래 나이는 첫 칩이 건진다(청 (473)) — 묶음은 `resolveGradeBands` 가 마지막으로 본 것이다.
103
+ 칩이 그 묶음에서 지어지므로 칩이 선 화면에서는 늘 맞다 */
104
+ const floor = floorChipOfAge(age, currentBands);
105
+ if (floor && set.has(floor))
106
+ return true;
102
107
  for (const code of set) {
103
108
  const from = agePlusOfGradeCode(code);
104
109
  if (from != null && age >= from)
@@ -134,6 +139,20 @@ export function agePlusOfGradeCode(code) {
134
139
  const m = AGE_PLUS_CODE.exec(code);
135
140
  return m ? Number(m[1]) : null;
136
141
  }
142
+ /** 편 묶음의 **첫 칩 나이** — `fromAge` 가 있으면 그것, 없으면 `minAge` */
143
+ export const gradeBandChipStart = (band) => band.fromAge ?? band.minAge;
144
+ /**
145
+ * 나이 하나가 **어느 칩에 합쳐지나** — `fromAge` 아래 나이면 그 묶음의 첫 칩 코드, 아니면 `null`.
146
+ * 열린 묶음은 `age{fromAge}plus` 다.
147
+ */
148
+ function floorChipOfAge(age, bands) {
149
+ if (!bands)
150
+ return null;
151
+ const band = bands.find(b => age >= b.minAge && (b.maxAge == null || age <= b.maxAge));
152
+ if (!band || band.fromAge == null || age >= band.fromAge)
153
+ return null;
154
+ return band.maxAge == null ? `age${band.fromAge}plus` : `age${band.fromAge}`;
155
+ }
137
156
  /**
138
157
  * 묶음 목록을 나이 범위로 편다. **꼴이 어긋나면 `null`** — 부르는 쪽은 묶음이 없는 것처럼 간다.
139
158
  *
@@ -160,17 +179,30 @@ export function resolveGradeBands(bands) {
160
179
  const resolved = { grade: band.grade, minAge, maxAge: null, showAge: band.showAge };
161
180
  if (label)
162
181
  resolved.label = label;
163
- if (i === bands.length - 1) {
182
+ const last = i === bands.length - 1;
183
+ let max = null;
184
+ if (last) {
164
185
  if (band.maxAge !== null)
165
186
  return null;
166
- out.push(resolved);
167
- break;
168
187
  }
169
- const max = band.maxAge;
170
- if (typeof max !== 'number' || !Number.isInteger(max) || max < minAge || max >= MAX_AGE)
171
- return null;
172
- resolved.maxAge = max;
188
+ else {
189
+ const m = band.maxAge;
190
+ if (typeof m !== 'number' || !Number.isInteger(m) || m < minAge || m >= MAX_AGE)
191
+ return null;
192
+ max = m;
193
+ resolved.maxAge = m;
194
+ }
195
+ /* `fromAge` 는 꼴이 어긋나면 묶음 전체를 버린다 — 고쳐 쓰면 칩과 서버가 다른 나이를 본다 */
196
+ const from = band.fromAge;
197
+ if (from != null) {
198
+ if (typeof from !== 'number' || !Number.isInteger(from) || from < minAge || from > (max ?? MAX_AGE))
199
+ return null;
200
+ if (band.showAge && from > minAge)
201
+ resolved.fromAge = from;
202
+ }
173
203
  out.push(resolved);
204
+ if (last || max == null)
205
+ break;
174
206
  minAge = max + 1;
175
207
  }
176
208
  /* 이름표끼리 같으면 하나로 되읽혀 다른 칩을 켠다 */
@@ -275,7 +307,12 @@ export function alignGradeCodesToBands(codes, bands) {
275
307
  const age = ageOfGradeCode(code);
276
308
  if (age != null) {
277
309
  const band = bandOfAge(age);
278
- push(band && !(band.showAge && band.maxAge != null) ? chipsOf(band) : [code]);
310
+ if (band && band.showAge && band.maxAge != null) {
311
+ /* 첫 칩 아래 나이(`fromAge` 로 합쳐진 `age1`·`age2`)는 첫 칩으로(청 (473)) */
312
+ push([age < gradeBandChipStart(band) ? `age${gradeBandChipStart(band)}` : code]);
313
+ }
314
+ else
315
+ push(band ? chipsOf(band) : [code]);
279
316
  continue;
280
317
  }
281
318
  const from = agePlusOfGradeCode(code);
@@ -288,7 +325,7 @@ export function alignGradeCodesToBands(codes, bands) {
288
325
  for (const band of touched) {
289
326
  if (band.showAge && band.maxAge != null) {
290
327
  const ages = [];
291
- for (let n = Math.max(from, band.minAge); n <= band.maxAge; n++)
328
+ for (let n = Math.max(from, gradeBandChipStart(band)); n <= band.maxAge; n++)
292
329
  ages.push(`age${n}`);
293
330
  push(ages);
294
331
  }
@@ -314,11 +351,12 @@ export function gradeBandCodes(bands) {
314
351
  out.push(String(band.grade));
315
352
  continue;
316
353
  }
354
+ const start = gradeBandChipStart(band);
317
355
  if (band.maxAge == null) {
318
- out.push(`age${band.minAge}plus`);
356
+ out.push(`age${start}plus`);
319
357
  continue;
320
358
  }
321
- for (let n = band.minAge; n <= band.maxAge; n++)
359
+ for (let n = start; n <= band.maxAge; n++)
322
360
  out.push(`age${n}`);
323
361
  }
324
362
  return out;
@@ -10,6 +10,7 @@ export type { WordGradeBand };
10
10
  * · 분류는 꼭 셋, `grade` 는 1·2·3 차례대로.
11
11
  * · 앞의 둘은 `maxAge` 가 늘어나는 **정수**이고 `WORD_GRADE_MAX_AGE`(98) 이하.
12
12
  * · 마지막 분류만 `maxAge` 가 `null` — 그 위 나이 전부.
13
+ * · `fromAge`(나이 칩 시작, 청 (473))는 없어도 되고, 있으면 정수 · 그 분류의 가장 적은 나이 이상 · `maxAge` 이하(열린 분류는 99).
13
14
  *
14
15
  * 이름(`미취학` …)과 나이 구간 글(`6세 이하`)은 여기 없다 — 앱은 제 사전으로, 어드민은 제 화면 말로 짓는다.
15
16
  * 칩으로 그리는 쪽은 `resolveGradeBands`(이름을 `label` 에 얹어 넘긴다).
@@ -8,6 +8,7 @@
8
8
  * · 분류는 꼭 셋, `grade` 는 1·2·3 차례대로.
9
9
  * · 앞의 둘은 `maxAge` 가 늘어나는 **정수**이고 `WORD_GRADE_MAX_AGE`(98) 이하.
10
10
  * · 마지막 분류만 `maxAge` 가 `null` — 그 위 나이 전부.
11
+ * · `fromAge`(나이 칩 시작, 청 (473))는 없어도 되고, 있으면 정수 · 그 분류의 가장 적은 나이 이상 · `maxAge` 이하(열린 분류는 99).
11
12
  *
12
13
  * 이름(`미취학` …)과 나이 구간 글(`6세 이하`)은 여기 없다 — 앱은 제 사전으로, 어드민은 제 화면 말로 짓는다.
13
14
  * 칩으로 그리는 쪽은 `resolveGradeBands`(이름을 `label` 에 얹어 넘긴다).
@@ -28,14 +29,26 @@ export function isValidWordGradeBands(bands) {
28
29
  return bands.every((b, i) => {
29
30
  if (!b || b.grade !== i + 1 || typeof b.showAge !== 'boolean')
30
31
  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;
32
+ const minAge = prev + 1;
33
+ let max;
34
+ if (i === bands.length - 1) {
35
+ if (b.maxAge !== null)
36
+ return false;
37
+ max = WORD_GRADE_MAX_AGE + 1;
38
+ }
39
+ else {
40
+ if (typeof b.maxAge !== 'number' || !Number.isInteger(b.maxAge))
41
+ return false;
42
+ if (b.maxAge <= prev || b.maxAge > WORD_GRADE_MAX_AGE)
43
+ return false;
44
+ max = b.maxAge;
45
+ prev = b.maxAge;
46
+ }
47
+ /* 나이 칩 시작(청 (473)) — 없거나 null 이면 전과 같다. 있으면 정수, 그 분류의 가장 적은 나이 ~ maxAge(열린 분류는 99) */
48
+ const from = b.fromAge;
49
+ if (from == null)
50
+ return true;
51
+ return typeof from === 'number' && Number.isInteger(from) && from >= minAge && from <= max;
39
52
  });
40
53
  }
41
54
  /**
@@ -75,5 +88,9 @@ export function difficultyOf(grade, age, bands) {
75
88
  const band = g == null ? undefined : bands.find(({ grade: n }) => n === g);
76
89
  if (!band)
77
90
  return null;
78
- return band.showAge && age != null ? { kind: 'age', age, grade: band.grade } : { kind: 'band', grade: band.grade };
91
+ if (!band.showAge || age == null)
92
+ return { kind: 'band', grade: band.grade };
93
+ /* 나이 칩 시작 아래 나이는 첫 칩 나이로 보인다(청 (473)) — 2세 낱말이 `3세` 칩에 들므로 칸도 `3세` */
94
+ const from = typeof band.fromAge === 'number' ? band.fromAge : null;
95
+ return { kind: 'age', age: from != null && age < from ? from : age, grade: band.grade };
79
96
  }
@@ -17,6 +17,8 @@ export interface WordPoolEntry {
17
17
  pronunciation?: string;
18
18
  /** 난이도 등급('1'~'4'). 없으면 undefined. */
19
19
  grade?: string;
20
+ /** 나이(`WordEntry.age`) — 단어훈련의 나이 칩(`3세` 등)이 이것으로 건진다. 없으면 나이 칩에 안 걸린다(말귀 청 (474)). */
21
+ age?: number | null;
20
22
  }
21
23
  export interface WordPool {
22
24
  entries: WordPoolEntry[];
@@ -49,6 +49,9 @@ function getMvpView() {
49
49
  : [],
50
50
  pron: e.pronunciation || e.word,
51
51
  grade: e.grade,
52
+ /* 나이 칩(`age3` 등)이 이것을 본다 — 빠져 있어 단어훈련에서 나이 칩이 늘 0건이었다(말귀 청 (474),
53
+ 0.390.0 부터). 거르는 두 자리는 `w.age` 를 읽는데 실어 주는 자리가 없었다 */
54
+ age: e.age ?? undefined,
52
55
  });
53
56
  }
54
57
  _cachedView = view;
@@ -46,4 +46,4 @@
46
46
  *
47
47
  * 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
48
48
  */
49
- export declare const CORE_VERSION = "0.474.0";
49
+ export declare const CORE_VERSION = "0.476.0";
@@ -46,4 +46,4 @@
46
46
  *
47
47
  * 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
48
48
  */
49
- export const CORE_VERSION = '0.474.0';
49
+ export const CORE_VERSION = '0.476.0';