@ihabdevteam/core 0.371.0 → 0.373.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 +163 -0
- package/dist/components.cjs.js +178 -178
- package/dist/components.esm.css +2 -2
- package/dist/hooks.cjs.js +1 -1
- package/dist/i18n.cjs.js +1 -1
- package/dist/ihabdevteam-core.cjs.js +182 -182
- package/dist/ihabdevteam-core.d.ts +28 -2
- package/dist/packages/core/src/components/Word/wordTableBlockTypes.d.ts +35 -4
- package/dist/packages/core/src/components/Word/wordTableBlockTypes.js +37 -6
- package/dist/packages/core/src/components/WordTable.css +17 -0
- package/dist/packages/core/src/components/WordTable.d.ts +15 -1
- package/dist/packages/core/src/components/WordTable.js +47 -15
- package/dist/packages/core/src/components/wordTableLayout.d.ts +40 -0
- package/dist/packages/core/src/components/wordTableLayout.js +64 -0
- package/dist/packages/core/src/types/wordSearch.d.ts +12 -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 +1 -1
- package/package.json +1 -1
|
@@ -1770,7 +1770,7 @@ export declare function copyText(text: string): Promise<boolean>;
|
|
|
1770
1770
|
*
|
|
1771
1771
|
* 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
|
|
1772
1772
|
*/
|
|
1773
|
-
export declare const CORE_VERSION = "0.
|
|
1773
|
+
export declare const CORE_VERSION = "0.373.0";
|
|
1774
1774
|
|
|
1775
1775
|
/** @public */
|
|
1776
1776
|
declare const coreDefault: Record<string, unknown>;
|
|
@@ -11462,6 +11462,18 @@ export declare interface WordSearchResultWord {
|
|
|
11462
11462
|
label: string;
|
|
11463
11463
|
subLabel?: string;
|
|
11464
11464
|
colloquialLabel?: string;
|
|
11465
|
+
/**
|
|
11466
|
+
* 칸 **밑에 작게 붙는 이름표** — 그 칸이 무엇인지 말한다(`-아/어요` · `과거`).
|
|
11467
|
+
*
|
|
11468
|
+
* 활용표처럼 **칸마다 같은 낱말의 다른 꼴**이 서는 표를 위해 둔다. 거기서는 글자만 보고
|
|
11469
|
+
* 어느 꼴인지 가릴 수 없다 — `감사했다` 가 과거인 것은 알아도 `감사하고` 가 무엇인지는
|
|
11470
|
+
* 사람마다 다르게 읽는다.
|
|
11471
|
+
*
|
|
11472
|
+
* **발음(`subLabel`) 자리에 적으면 안 된다.** 칸의 재생 단추가 `subLabel || label` 로
|
|
11473
|
+
* 소리를 받아 오므로, 거기 이름표를 적으면 칸이 `-아/어요` 를 **소리 내어 읽는다**
|
|
11474
|
+
* (말귀가 활용표를 옮기며 실측 2026-10-27).
|
|
11475
|
+
*/
|
|
11476
|
+
captionLabel?: string;
|
|
11465
11477
|
homonum?: number;
|
|
11466
11478
|
grade?: string;
|
|
11467
11479
|
syllables?: number;
|
|
@@ -11481,7 +11493,7 @@ export declare interface WordSearchResultWord {
|
|
|
11481
11493
|
* 표시(items)·편집(editCells) 두 모드를 지원한다.
|
|
11482
11494
|
* @public
|
|
11483
11495
|
*/
|
|
11484
|
-
export declare function WordTable({ title, titleIcon, disc, className, orientation, contentTypes, cutLine, showOutline, showDivLine, items, editCells, count, activeCell, onActivateCell, onRemoveCell, onRemoveItem, onReorder, renderCellAction, showFillerAdd, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): JSX.Element;
|
|
11496
|
+
export declare function WordTable({ title, titleIcon, disc, className, orientation, contentTypes, baseItem, baseContentTypes, cutLine, showOutline, showDivLine, items, editCells, count, activeCell, onActivateCell, onRemoveCell, onRemoveItem, onReorder, renderCellAction, showFillerAdd, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): JSX.Element;
|
|
11485
11497
|
|
|
11486
11498
|
export declare function WordTableBlock({ title, titleIcon, disc, filterTitle, filterCollapsible, filterDefaultCollapsed, filterCollapsed, onFilterCollapsedChange, filterHeaderSummary, brand, code, items, onSaveComplete, onLoad, onRemoveItem, onReset, resetLabel, saveButtonLabel, secondarySaveButtonLabel, onReorder, showCellCount, onAddItem, className, renderSavePopup, renderWordSearch, hideControls, saveOnly, tableName, nameValue, onNameChange, descriptionValue, onDescriptionChange, namePlaceholder, descriptionPlaceholder, existingNames, editingName, onCancel, initialItemsPerPage, renderCellAction, actionsLeftExtra }: WordTableBlockProps): JSX.Element;
|
|
11487
11499
|
|
|
@@ -11827,6 +11839,20 @@ export declare interface WordTableProps {
|
|
|
11827
11839
|
className?: string;
|
|
11828
11840
|
orientation?: WordTableOrientation;
|
|
11829
11841
|
contentTypes?: WordTableContentType[];
|
|
11842
|
+
/**
|
|
11843
|
+
* 표의 **절반을 쓰는 머리 칸** — 가로면 왼쪽 절반, 세로면 위쪽 절반. 나머지 절반에
|
|
11844
|
+
* `items` 가 격자로 선다. 칸 속은 표의 다른 칸과 같은 조각(`WordCell`)으로 그린다.
|
|
11845
|
+
*
|
|
11846
|
+
* 활용표처럼 **모든 칸이 같은 낱말**인 표를 위해 둔다 — 그 표를 그냥 그리면 같은 그림이
|
|
11847
|
+
* 칸마다 되풀이된다. 머리 칸에만 그림을 두고 나머지는 글자만 세우는 꼴이다
|
|
11848
|
+
* (`baseContentTypes` 로 머리 칸만 따로 가린다).
|
|
11849
|
+
*
|
|
11850
|
+
* 표시 모드에서만 받는다 — `editCells` 로 그리는 편집 격자는 칸을 **번호로** 세므로
|
|
11851
|
+
* 걸친 칸이 들어오면 활성 칸·추가 자리가 어긋난다.
|
|
11852
|
+
*/
|
|
11853
|
+
baseItem?: WordSearchResultItem;
|
|
11854
|
+
/** 머리 칸에만 걸리는 보임 — 안 주면 `contentTypes` 를 따른다. */
|
|
11855
|
+
baseContentTypes?: WordTableContentType[];
|
|
11830
11856
|
cutLine?: WordTableCutLine;
|
|
11831
11857
|
showOutline?: boolean;
|
|
11832
11858
|
showDivLine?: boolean;
|
|
@@ -172,12 +172,43 @@ export interface WordTableBlockProps {
|
|
|
172
172
|
/**
|
|
173
173
|
* 한 쪽에 놓을 수 있는 칸 수 — **상한이 곧 이 배열의 끝**이다.
|
|
174
174
|
*
|
|
175
|
-
* 12
|
|
176
|
-
* `Math.max(...CELL_COUNTS)` 에
|
|
175
|
+
* **12 로 돌아왔다**(사장님 결정 2026-10-27, 화면에서 16을 보신 뒤). 같은 날 12 → 16 으로
|
|
176
|
+
* 올렸다가 되돌린 것이다. 앱의 `MAX_SELECT` 가 짝 시험으로 `Math.max(...CELL_COUNTS)` 에
|
|
177
|
+
* 묶여 있어, 여기가 상한을 정한다.
|
|
178
|
+
*
|
|
179
|
+
* ## 되돌린 까닭은 **빈 칸**이다
|
|
180
|
+
*
|
|
181
|
+
* 칸 수를 올려도 배율은 안 깎인다(12~16 이 가로 `.6617` · 세로 `.7019` 로 같다 — 행을
|
|
182
|
+
* 묶어 두었으므로). 깎이는 대신 **빈 칸이 생긴다.** 양쪽 방향 다 꽉 차는 수는 **12 가
|
|
183
|
+
* 마지막**이다:
|
|
184
|
+
*
|
|
185
|
+
* | 칸 수 | 가로 | 빈칸 | 세로 | 빈칸 |
|
|
186
|
+
* |---|---|---|---|---|
|
|
187
|
+
* | **12** | 4×3 | **0** | 3×4 | **0** |
|
|
188
|
+
* | 15 | 5×3 | 0 | 4×4 | 1 |
|
|
189
|
+
* | 16 | 6×3 | **2** | 4×4 | 0 |
|
|
190
|
+
*
|
|
191
|
+
* 16의 가로는 **고칠 길이 없다** — 행을 3 으로 묶은 채 꽉 채우려면 열이 정수로 안 나오고
|
|
192
|
+
* (16/3), 행을 4 로 바꾸면 4×4 로 꽉 차는 대신 배율이 `.6617` → `.4963` 으로 깎인다.
|
|
193
|
+
* 18 로 더 가면 `LAYOUTS` 에 없어 `gridFor` 의 자동 셈으로 떨어져 **가로 5×4(빈칸 2 ·
|
|
194
|
+
* 배율 `.4963`) · 세로 4×5(빈칸 2 · `.5615`)** 로 양쪽이 다 쪼그라든다.
|
|
195
|
+
*
|
|
196
|
+
* ## `LAYOUTS` 의 13~16 은 **잠들어 있다 — 지우지 않는다**
|
|
197
|
+
*
|
|
198
|
+
* 이 배열이 12 까지라 13~16 은 지금 아무도 고를 수 없지만, 틀린 값이 아니라 손으로 맞춰
|
|
199
|
+
* 둔 값이다(행을 묶어 배율을 지키는 배치). 단어풀에서 골라 인쇄하는 길이 열리면 다시 쓴다.
|
|
200
|
+
* `wordTableCells16_1027` 이 **둘을 함께 재어** 지키고 있다 — 상한이 12 인 것과, 13~16 이
|
|
201
|
+
* `LAYOUTS` 에 살아 있는 것.
|
|
177
202
|
*
|
|
178
203
|
* **늘릴 때는 `LAYOUTS` 도 함께 본다** — 표에 없는 수는 `gridFor` 가 만들어 내는데,
|
|
179
|
-
* 그 셈은
|
|
204
|
+
* 그 셈은 **행을 늘려** 그림칸을 쪼그라뜨린다.
|
|
180
205
|
*/
|
|
181
206
|
export declare const CELL_COUNTS: number[];
|
|
182
|
-
/**
|
|
207
|
+
/**
|
|
208
|
+
* 표시(인쇄) 모드에서 선택 가능한 "페이지당 개수"(단어/대립쌍 수) — 이 값 그대로 페이지당 칸 수가 된다
|
|
209
|
+
*
|
|
210
|
+
* **6 을 더했다**(사장님 지시 2026-10-27, "페이지당 단어수 6 추가"). 8 과 4 사이가 비어
|
|
211
|
+
* 있던 자리다. 6 은 가로 3×2 · 세로 2×3 으로 **양쪽 다 꽉 차는 수**라, 12칸 표를 두 장으로
|
|
212
|
+
* 나눌 때 빈 칸이 안 생긴다.
|
|
213
|
+
*/
|
|
183
214
|
export declare const ITEMS_PER_PAGE_OPTIONS: number[];
|
|
@@ -1,12 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 한 쪽에 놓을 수 있는 칸 수 — **상한이 곧 이 배열의 끝**이다.
|
|
3
3
|
*
|
|
4
|
-
* 12
|
|
5
|
-
* `Math.max(...CELL_COUNTS)` 에
|
|
4
|
+
* **12 로 돌아왔다**(사장님 결정 2026-10-27, 화면에서 16을 보신 뒤). 같은 날 12 → 16 으로
|
|
5
|
+
* 올렸다가 되돌린 것이다. 앱의 `MAX_SELECT` 가 짝 시험으로 `Math.max(...CELL_COUNTS)` 에
|
|
6
|
+
* 묶여 있어, 여기가 상한을 정한다.
|
|
7
|
+
*
|
|
8
|
+
* ## 되돌린 까닭은 **빈 칸**이다
|
|
9
|
+
*
|
|
10
|
+
* 칸 수를 올려도 배율은 안 깎인다(12~16 이 가로 `.6617` · 세로 `.7019` 로 같다 — 행을
|
|
11
|
+
* 묶어 두었으므로). 깎이는 대신 **빈 칸이 생긴다.** 양쪽 방향 다 꽉 차는 수는 **12 가
|
|
12
|
+
* 마지막**이다:
|
|
13
|
+
*
|
|
14
|
+
* | 칸 수 | 가로 | 빈칸 | 세로 | 빈칸 |
|
|
15
|
+
* |---|---|---|---|---|
|
|
16
|
+
* | **12** | 4×3 | **0** | 3×4 | **0** |
|
|
17
|
+
* | 15 | 5×3 | 0 | 4×4 | 1 |
|
|
18
|
+
* | 16 | 6×3 | **2** | 4×4 | 0 |
|
|
19
|
+
*
|
|
20
|
+
* 16의 가로는 **고칠 길이 없다** — 행을 3 으로 묶은 채 꽉 채우려면 열이 정수로 안 나오고
|
|
21
|
+
* (16/3), 행을 4 로 바꾸면 4×4 로 꽉 차는 대신 배율이 `.6617` → `.4963` 으로 깎인다.
|
|
22
|
+
* 18 로 더 가면 `LAYOUTS` 에 없어 `gridFor` 의 자동 셈으로 떨어져 **가로 5×4(빈칸 2 ·
|
|
23
|
+
* 배율 `.4963`) · 세로 4×5(빈칸 2 · `.5615`)** 로 양쪽이 다 쪼그라든다.
|
|
24
|
+
*
|
|
25
|
+
* ## `LAYOUTS` 의 13~16 은 **잠들어 있다 — 지우지 않는다**
|
|
26
|
+
*
|
|
27
|
+
* 이 배열이 12 까지라 13~16 은 지금 아무도 고를 수 없지만, 틀린 값이 아니라 손으로 맞춰
|
|
28
|
+
* 둔 값이다(행을 묶어 배율을 지키는 배치). 단어풀에서 골라 인쇄하는 길이 열리면 다시 쓴다.
|
|
29
|
+
* `wordTableCells16_1027` 이 **둘을 함께 재어** 지키고 있다 — 상한이 12 인 것과, 13~16 이
|
|
30
|
+
* `LAYOUTS` 에 살아 있는 것.
|
|
6
31
|
*
|
|
7
32
|
* **늘릴 때는 `LAYOUTS` 도 함께 본다** — 표에 없는 수는 `gridFor` 가 만들어 내는데,
|
|
8
|
-
* 그 셈은
|
|
33
|
+
* 그 셈은 **행을 늘려** 그림칸을 쪼그라뜨린다.
|
|
34
|
+
*/
|
|
35
|
+
export const CELL_COUNTS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
36
|
+
/**
|
|
37
|
+
* 표시(인쇄) 모드에서 선택 가능한 "페이지당 개수"(단어/대립쌍 수) — 이 값 그대로 페이지당 칸 수가 된다
|
|
38
|
+
*
|
|
39
|
+
* **6 을 더했다**(사장님 지시 2026-10-27, "페이지당 단어수 6 추가"). 8 과 4 사이가 비어
|
|
40
|
+
* 있던 자리다. 6 은 가로 3×2 · 세로 2×3 으로 **양쪽 다 꽉 차는 수**라, 12칸 표를 두 장으로
|
|
41
|
+
* 나눌 때 빈 칸이 안 생긴다.
|
|
9
42
|
*/
|
|
10
|
-
export const
|
|
11
|
-
/** 표시(인쇄) 모드에서 선택 가능한 "페이지당 개수"(단어/대립쌍 수) — 이 값 그대로 페이지당 칸 수가 된다 */
|
|
12
|
-
export const ITEMS_PER_PAGE_OPTIONS = [8, 4, 2, 1];
|
|
43
|
+
export const ITEMS_PER_PAGE_OPTIONS = [8, 6, 4, 2, 1];
|
|
@@ -555,6 +555,15 @@
|
|
|
555
555
|
font-weight: var(--wt-cell-sub-weight, var(--text-h3-weight));
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
+
/* 칸 밑 이름표(`captionLabel`) — 활용표의 `-아/어요` · `과거` 가 서는 자리.
|
|
559
|
+
**발음과 같은 여림으로 둔다**(`--color-gray`) — 더 여리게 하면 종이에서 안 읽힌다.
|
|
560
|
+
낱말을 읽는 데 방해가 되면 안 되지만, 치료 자리에서 뽑아 보는 종이라 **읽히기는 해야 한다.** */
|
|
561
|
+
.word-table-cell__caption {
|
|
562
|
+
color: var(--color-gray);
|
|
563
|
+
text-align: center;
|
|
564
|
+
white-space: nowrap;
|
|
565
|
+
}
|
|
566
|
+
|
|
558
567
|
.word-table-cell__colloquial {
|
|
559
568
|
color: var(--color-lightGray);
|
|
560
569
|
text-align: center;
|
|
@@ -909,3 +918,11 @@
|
|
|
909
918
|
/* 남는 세로를 위아래로 나눈다 — 표가 상자보다 납작할 때 아래로만 쏠려 보이지 않게 */
|
|
910
919
|
align-items: center;
|
|
911
920
|
}
|
|
921
|
+
|
|
922
|
+
/* **표의 절반을 쓰는 머리 칸**(`baseItem`) — 가로면 왼쪽 절반, 세로면 위쪽 절반.
|
|
923
|
+
걸치는 자리는 칸 수에 따라 달라지므로 인라인으로 걸고, 여기서는 면과 결만 쥔다.
|
|
924
|
+
`--filler` 와 달리 속을 가운데로 모으지 않는다 — 속의 `WordCell` 이 제 상자를 꽉 쓴다.
|
|
925
|
+
옮기기·초점 셈에서 이 칸은 빠진다(`WordTable.tsx` 의 카드 쿼리가 `:not()` 으로 뺀다). */
|
|
926
|
+
.word-table-block__card--base {
|
|
927
|
+
align-items: stretch;
|
|
928
|
+
}
|
|
@@ -13,6 +13,20 @@ export interface WordTableProps {
|
|
|
13
13
|
className?: string;
|
|
14
14
|
orientation?: WordTableOrientation;
|
|
15
15
|
contentTypes?: WordTableContentType[];
|
|
16
|
+
/**
|
|
17
|
+
* 표의 **절반을 쓰는 머리 칸** — 가로면 왼쪽 절반, 세로면 위쪽 절반. 나머지 절반에
|
|
18
|
+
* `items` 가 격자로 선다. 칸 속은 표의 다른 칸과 같은 조각(`WordCell`)으로 그린다.
|
|
19
|
+
*
|
|
20
|
+
* 활용표처럼 **모든 칸이 같은 낱말**인 표를 위해 둔다 — 그 표를 그냥 그리면 같은 그림이
|
|
21
|
+
* 칸마다 되풀이된다. 머리 칸에만 그림을 두고 나머지는 글자만 세우는 꼴이다
|
|
22
|
+
* (`baseContentTypes` 로 머리 칸만 따로 가린다).
|
|
23
|
+
*
|
|
24
|
+
* 표시 모드에서만 받는다 — `editCells` 로 그리는 편집 격자는 칸을 **번호로** 세므로
|
|
25
|
+
* 걸친 칸이 들어오면 활성 칸·추가 자리가 어긋난다.
|
|
26
|
+
*/
|
|
27
|
+
baseItem?: WordSearchResultItem;
|
|
28
|
+
/** 머리 칸에만 걸리는 보임 — 안 주면 `contentTypes` 를 따른다. */
|
|
29
|
+
baseContentTypes?: WordTableContentType[];
|
|
16
30
|
cutLine?: WordTableCutLine;
|
|
17
31
|
showOutline?: boolean;
|
|
18
32
|
showDivLine?: boolean;
|
|
@@ -188,4 +202,4 @@ export interface WordTableProps {
|
|
|
188
202
|
* 표시(items)·편집(editCells) 두 모드를 지원한다.
|
|
189
203
|
* @public
|
|
190
204
|
*/
|
|
191
|
-
export default function WordTable({ title, titleIcon, disc, className, orientation, contentTypes, cutLine, showOutline, showDivLine, items, editCells, count, activeCell, onActivateCell, onRemoveCell, onRemoveItem, onReorder, renderCellAction, showFillerAdd, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): import("react").JSX.Element;
|
|
205
|
+
export default function WordTable({ title, titleIcon, disc, className, orientation, contentTypes, baseItem, baseContentTypes, cutLine, showOutline, showDivLine, items, editCells, count, activeCell, onActivateCell, onRemoveCell, onRemoveItem, onReorder, renderCellAction, showFillerAdd, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): import("react").JSX.Element;
|
|
@@ -21,7 +21,7 @@ import { isTouchPointer, recentlyTouched, useTouchToggle } from '../hooks/touchT
|
|
|
21
21
|
ihab 은 **흰 판을 마스크로 쓴다**(사용자 지시 2026-09-30: 글자색을 입힌다) — 그쪽은
|
|
22
22
|
`WordTable.css` 가 제 곁의 파일을 직접 가리키므로 여기서 안 들여온다. */
|
|
23
23
|
import speechearLogo from '../logo/Logo_SpeechEar_ko.svg';
|
|
24
|
-
import { WORD_TABLE_PAPER, gridFor, CUT_CLASS, posLabels, wordTypeLabels, expandSlashLabel, dotDashStyle, REF_W_BOTH, REF_W_TEXT_ONLY, REF_W_IMAGE_ONLY, REF_H_BOTH, REF_H_TEXT_ONLY, REF_H_IMAGE_ONLY, } from './wordTableLayout';
|
|
24
|
+
import { WORD_TABLE_PAPER, gridFor, halfGridFor, CUT_CLASS, posLabels, wordTypeLabels, expandSlashLabel, dotDashStyle, REF_W_BOTH, REF_W_TEXT_ONLY, REF_W_IMAGE_ONLY, REF_H_BOTH, REF_H_TEXT_ONLY, REF_H_IMAGE_ONLY, } from './wordTableLayout';
|
|
25
25
|
import { useFitScale } from './useFitScale';
|
|
26
26
|
import { claimSound } from './Training/currentSound';
|
|
27
27
|
import { playOneShot } from './Training/oneShotSound';
|
|
@@ -47,7 +47,7 @@ const srOnly = {
|
|
|
47
47
|
const LONG_PRESS_MS = 400;
|
|
48
48
|
/** 길게 누르기가 익기 전에 이만큼 움직이면 그건 끌기가 아니라 **스크롤**이라 취소한다 */
|
|
49
49
|
const MOVE_THRESHOLD_PX = 8;
|
|
50
|
-
function WordCell({ label, subLabel, colloquialLabel, homonum, showWord = true, showImage = true, showPronunciation = true, showColloquial = true, buttonSize = 40, wordInfo, outerScale = 1, }) {
|
|
50
|
+
function WordCell({ label, subLabel, colloquialLabel, captionLabel, homonum, showWord = true, showImage = true, showPronunciation = true, showColloquial = true, buttonSize = 40, wordInfo, outerScale = 1, }) {
|
|
51
51
|
const { t } = useTranslation();
|
|
52
52
|
const outerRef = useRef(null);
|
|
53
53
|
const infoRef = useRef(null);
|
|
@@ -174,7 +174,7 @@ function WordCell({ label, subLabel, colloquialLabel, homonum, showWord = true,
|
|
|
174
174
|
* 안 곱하면 또 조용히 헛돈다.
|
|
175
175
|
*/
|
|
176
176
|
const tapTooSmall = buttonSize * outerScale < MIN_TAP_PX;
|
|
177
|
-
return (_jsxs("div", { ref: outerRef, className: cx('word-table-cell', tapTooSmall && 'word-table-cell--tap-too-small', hasImage ? 'word-table-cell--with-image' : ''), "data-ref-w": refW, "data-ref-h": refH, children: [_jsxs("div", { className: "word-table-cell__inner", style: { transform: `scale(${scale})` }, children: [hasImage && (_jsxs("div", { className: "word-table-cell__image-wrap", children: [imgLoading && _jsx("div", { className: "word-table-cell__spinner" }), _jsx("img", { ref: imgRef, className: "word-table-cell__image", src: imageUrl, alt: label, draggable: false, style: { opacity: imgLoading ? 0 : 1 }, onLoad: handleImgLoad, onError: handleImgError })] })), showWord && _jsx("span", { className: "word-table-cell__word h0", children: label }), showPronunciation && pron && _jsxs("span", { className: "word-table-cell__sub h3", children: ["[", pron, "]"] }), showColloquial && colloquialLabel && _jsxs("span", { className: "word-table-cell__colloquial h5", children: ["[", colloquialLabel, "]"] })] }), _jsxs("div", { className: "word-table-cell__play-button", "data-audio-src": audioUrl, children: [_jsx("span", { "data-play-state": "play", style: { display: playing ? 'none' : undefined }, children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "play", variant: "transparent-lightGray", useBorder: false, showTooltipInfo: t('common.play', '재생'), ariaLabel: label ? t('common.playFor', { name: label, defaultValue: `${label} 재생` }) : t('common.play', '재생'), onClick: handlePlay }) }), _jsx("span", { "data-play-state": "pause", style: { display: playing ? undefined : 'none' }, children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "pause", useBorder: false, selected: true, showTooltipInfo: t('common.pause', '멈춤'), ariaLabel: label ? t('common.pauseFor', { name: label, defaultValue: `${label} 멈춤` }) : t('common.pause', '멈춤'), onClick: handlePlay }) })] }), wordInfo && (_jsxs("div", { ref: infoRef, className: "word-table-cell__info-button", onPointerEnter: (e) => { if (!isTouchPointer(e))
|
|
177
|
+
return (_jsxs("div", { ref: outerRef, className: cx('word-table-cell', tapTooSmall && 'word-table-cell--tap-too-small', hasImage ? 'word-table-cell--with-image' : ''), "data-ref-w": refW, "data-ref-h": refH, children: [_jsxs("div", { className: "word-table-cell__inner", style: { transform: `scale(${scale})` }, children: [hasImage && (_jsxs("div", { className: "word-table-cell__image-wrap", children: [imgLoading && _jsx("div", { className: "word-table-cell__spinner" }), _jsx("img", { ref: imgRef, className: "word-table-cell__image", src: imageUrl, alt: label, draggable: false, style: { opacity: imgLoading ? 0 : 1 }, onLoad: handleImgLoad, onError: handleImgError })] })), showWord && _jsx("span", { className: "word-table-cell__word h0", children: label }), captionLabel && _jsx("span", { className: "word-table-cell__caption h5", children: captionLabel }), showPronunciation && pron && _jsxs("span", { className: "word-table-cell__sub h3", children: ["[", pron, "]"] }), showColloquial && colloquialLabel && _jsxs("span", { className: "word-table-cell__colloquial h5", children: ["[", colloquialLabel, "]"] })] }), _jsxs("div", { className: "word-table-cell__play-button", "data-audio-src": audioUrl, children: [_jsx("span", { "data-play-state": "play", style: { display: playing ? 'none' : undefined }, children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "play", variant: "transparent-lightGray", useBorder: false, showTooltipInfo: t('common.play', '재생'), ariaLabel: label ? t('common.playFor', { name: label, defaultValue: `${label} 재생` }) : t('common.play', '재생'), onClick: handlePlay }) }), _jsx("span", { "data-play-state": "pause", style: { display: playing ? undefined : 'none' }, children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "pause", useBorder: false, selected: true, showTooltipInfo: t('common.pause', '멈춤'), ariaLabel: label ? t('common.pauseFor', { name: label, defaultValue: `${label} 멈춤` }) : t('common.pause', '멈춤'), onClick: handlePlay }) })] }), wordInfo && (_jsxs("div", { ref: infoRef, className: "word-table-cell__info-button", onPointerEnter: (e) => { if (!isTouchPointer(e))
|
|
178
178
|
handleInfoEnter(); }, onPointerLeave: (e) => { if (!isTouchPointer(e))
|
|
179
179
|
handleInfoLeave(); },
|
|
180
180
|
// 이 div 자체는 포커스 대상이 아니지만 안의 Button이 포커스를 받으면
|
|
@@ -192,7 +192,7 @@ function WordCell({ label, subLabel, colloquialLabel, homonum, showWord = true,
|
|
|
192
192
|
* 표시(items)·편집(editCells) 두 모드를 지원한다.
|
|
193
193
|
* @public
|
|
194
194
|
*/
|
|
195
|
-
export default function WordTable({ title, titleIcon, disc, className, orientation = 'landscape', contentTypes = ['image', 'word', 'standardPron'], cutLine = 'show', showOutline = true, showDivLine = true, items, editCells, count, activeCell = null, onActivateCell, onRemoveCell, onRemoveItem, onReorder, renderCellAction, showFillerAdd = false, contentRef, buttonSize = 40, brand, code, pageNumber, pageNumberPosition = 'right', fitHeight = false, scoring = false, marks, onMarkClick, scoreIndexOffset = 0, }) {
|
|
195
|
+
export default function WordTable({ title, titleIcon, disc, className, orientation = 'landscape', contentTypes = ['image', 'word', 'standardPron'], baseItem, baseContentTypes, cutLine = 'show', showOutline = true, showDivLine = true, items, editCells, count, activeCell = null, onActivateCell, onRemoveCell, onRemoveItem, onReorder, renderCellAction, showFillerAdd = false, contentRef, buttonSize = 40, brand, code, pageNumber, pageNumberPosition = 'right', fitHeight = false, scoring = false, marks, onMarkClick, scoreIndexOffset = 0, }) {
|
|
196
196
|
const clickMark = useCallback((cellIndex, clicked) => {
|
|
197
197
|
onMarkClick?.(scoreIndexOffset + cellIndex, clicked);
|
|
198
198
|
}, [onMarkClick, scoreIndexOffset]);
|
|
@@ -276,7 +276,7 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
276
276
|
if (to == null)
|
|
277
277
|
return;
|
|
278
278
|
focusTarget.current = null;
|
|
279
|
-
const cells = gridRef.current?.querySelectorAll('.word-table-block__card:not(.word-table-block__card--filler)');
|
|
279
|
+
const cells = gridRef.current?.querySelectorAll('.word-table-block__card:not(.word-table-block__card--filler):not(.word-table-block__card--base)');
|
|
280
280
|
cells?.[to]?.querySelector('.word-table-block__card-handle button')?.focus();
|
|
281
281
|
});
|
|
282
282
|
/* 떠날 때 걸어 둔 것을 푼다 — 길게 누르는 중에 팝업이 닫히면 window 리스너와
|
|
@@ -410,13 +410,37 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
410
410
|
const { scalerRef, scale, offset } = useFitScale(width, fitHeight ? height : undefined);
|
|
411
411
|
const dataLen = isEdit ? (editCells?.length ?? 0) : (items?.length ?? 0);
|
|
412
412
|
const cellCount = Math.max(count ?? dataLen, 1);
|
|
413
|
-
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
413
|
+
/* 머리 칸은 표시 모드에서만 — 편집 격자는 칸을 번호로 세므로 걸친 칸이 번호를 어긋낸다 */
|
|
414
|
+
const hasBase = !isEdit && !!baseItem;
|
|
415
|
+
/**
|
|
416
|
+
* **반쪽은 방향만 뒤집힌 같은 비율이다.** 종이가 A 계열이라 가로 1123×794 의 왼쪽
|
|
417
|
+
* 절반은 561.5×794(비 0.7072)로 세로 전체(0.7070)와 같고, 세로의 위쪽 절반은
|
|
418
|
+
* 794×561.5 로 가로 전체와 같다. 그래서 손으로 맞춰 둔 `LAYOUTS` 를 **방향만 뒤집어** 쓴다 —
|
|
419
|
+
* 반쪽 전용 배치표를 또 두지 않는다.
|
|
420
|
+
*
|
|
421
|
+
* **다만 뒤집기만 하면 읽기 결정까지 따라온다**(사장님 지시 2026-10-27 "wordcell 에 맞춰서").
|
|
422
|
+
* `LAYOUTS.portrait` 가 2~5 를 한 열로 세우는 것은 낱말을 한 줄에 하나씩 **읽히려는** 결정이지
|
|
423
|
+
* 칸을 크게 세우려는 결정이 아니다. 꼴 넷이 그 자리였다 — 반쪽에서 `1×4`(배율 0.4963)로 서던
|
|
424
|
+
* 것이 `2×2` 면 **0.9925**, 정확히 두 배이고 칸이 기준 칸(280×400)과 거의 같아진다.
|
|
425
|
+
* 고르는 자는 `halfGridFor` 머리말에 있다(빈 칸을 더 안 늘리고, 5% 넘게 좋아질 때만 바꾼다).
|
|
426
|
+
*/
|
|
427
|
+
const half = halfGridFor(orientation, cellCount);
|
|
428
|
+
const plain = gridFor(orientation, cellCount);
|
|
429
|
+
/** `items` 가 서는 반쪽의 격자 — 자르는 선과 빈칸 셈이 이것을 센다 */
|
|
430
|
+
const itemCols = hasBase ? half.cols : plain.cols;
|
|
431
|
+
const itemRows = hasBase ? half.rows : plain.rows;
|
|
432
|
+
/* 겉 격자는 반쪽을 둘로 — 머리 칸이 한쪽을 통째로 걸친다. 한 격자로 두어야
|
|
433
|
+
`--cut-show` 의 선 바탕과 `gap: 1px` 셈을 그대로 쓸 수 있다(겹격자로 쪼개면 틈이 둘이 된다). */
|
|
434
|
+
const cols = hasBase && orientation === 'landscape' ? half.cols * 2 : itemCols;
|
|
435
|
+
const rows = hasBase && orientation === 'portrait' ? half.rows * 2 : itemRows;
|
|
436
|
+
const showOf = (types) => ({
|
|
437
|
+
word: types.length === 0 || types.includes('word'),
|
|
438
|
+
image: types.length === 0 || types.includes('image'),
|
|
439
|
+
pron: types.length === 0 || types.includes('standardPron'),
|
|
440
|
+
colloq: types.length === 0 || types.includes('colloquialPron'),
|
|
441
|
+
});
|
|
442
|
+
const show = showOf(contentTypes);
|
|
443
|
+
const baseShow = showOf(baseContentTypes ?? contentTypes);
|
|
420
444
|
const hasPairs = isEdit
|
|
421
445
|
? (editCells ?? []).some(c => c !== null && c.length > 1)
|
|
422
446
|
: (items ?? []).some(item => (item.words ?? []).length > 1);
|
|
@@ -462,9 +486,17 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
462
486
|
gridTemplateRows: `repeat(${rows}, 1fr)`,
|
|
463
487
|
}, children: [isEdit ? (_jsx(_Fragment, { children: (editCells ?? []).map((cell, i) => (_jsx("div", { className: cx('word-table-block__edit-cell', cell ? 'word-table-block__edit-cell--filled' : 'word-table-block__edit-cell--empty', activeCell === i ? 'word-table-block__edit-cell--active' : ''), style: dotDashStyle(i, cols, rows, cutLine), children: cell ? (_jsxs(_Fragment, { children: [cell.map((e, wi) => (_jsxs(Fragment, { children: [wi > 0 && _jsx("div", { className: "word-table-block__pair-divider" }), _jsx(WordCell, { outerScale: scale, label: e.word, subLabel: e.pronunciation,
|
|
464
488
|
// 편집 칸도 구어체 발음을 넘긴다 — 빠져 있어 '구어체 발음'을 켜도 편집 모드에서만 비었다.
|
|
465
|
-
colloquialLabel: e.colloquialPronunciation, homonum: e.homonum, showWord: show.word, showImage: show.image, showPronunciation: show.pron, showColloquial: show.colloq, buttonSize: buttonSize })] }, wi))), scoring && renderScore(i, cell.map(e => e.word).join(' / ')), onRemoveCell && (_jsx("div", { className: "word-table-block__card-close", children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "x", variant: "transparent-lightGray", useBorder: false, showTooltipInfo: cell.length > 1 ? t('wordPrint.removePair', '대립쌍 빼기') : t('wordPrint.removeWord', '단어 빼기'), ariaLabel: cell.length > 1 ? t('wordPrint.removePair', '대립쌍 빼기') : t('wordPrint.removeWord', '단어 빼기'), onClick: () => onRemoveCell(i) }) }))] })) : (onActivateCell && (_jsx("div", { style: counterScale, children: _jsx(Button, { htmlType: "button", size: "48", type: "bar", icon: "plus", label: t('wordTable.addWord', '추가하기'), onClick: () => onActivateCell(i) }) }))) }, i))) })) : (_jsxs(_Fragment, { children: [
|
|
489
|
+
colloquialLabel: e.colloquialPronunciation, homonum: e.homonum, showWord: show.word, showImage: show.image, showPronunciation: show.pron, showColloquial: show.colloq, buttonSize: buttonSize })] }, wi))), scoring && renderScore(i, cell.map(e => e.word).join(' / ')), onRemoveCell && (_jsx("div", { className: "word-table-block__card-close", children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "x", variant: "transparent-lightGray", useBorder: false, showTooltipInfo: cell.length > 1 ? t('wordPrint.removePair', '대립쌍 빼기') : t('wordPrint.removeWord', '단어 빼기'), ariaLabel: cell.length > 1 ? t('wordPrint.removePair', '대립쌍 빼기') : t('wordPrint.removeWord', '단어 빼기'), onClick: () => onRemoveCell(i) }) }))] })) : (onActivateCell && (_jsx("div", { style: counterScale, children: _jsx(Button, { htmlType: "button", size: "48", type: "bar", icon: "plus", label: t('wordTable.addWord', '추가하기'), onClick: () => onActivateCell(i) }) }))) }, i))) })) : (_jsxs(_Fragment, { children: [hasBase && baseItem && (
|
|
490
|
+
/* 걸치는 자리는 양쪽이 같은 식이다 — 가로면 왼쪽 `half.cols` 열 × 전체 `half.rows` 줄,
|
|
491
|
+
세로면 전체 `half.cols` 열 × 위 `half.rows` 줄. 둘 다 `1 / span` 으로 같게 적힌다. */
|
|
492
|
+
_jsx("div", { className: "word-table-block__card word-table-block__card--base", style: {
|
|
493
|
+
gridColumn: `1 / span ${half.cols}`,
|
|
494
|
+
gridRow: `1 / span ${half.rows}`,
|
|
495
|
+
/* 머리 칸과 나머지 절반을 가르는 점선 — 가로면 오른쪽, 세로면 아래쪽 */
|
|
496
|
+
...dotDashStyle(0, orientation === 'landscape' ? 2 : 1, orientation === 'landscape' ? 1 : 2, cutLine),
|
|
497
|
+
}, children: (baseItem.words ?? []).map((w, wi) => (_jsxs(Fragment, { children: [wi > 0 && _jsx("div", { className: "word-table-block__pair-divider" }), _jsx(WordCell, { outerScale: scale, label: w.label, subLabel: w.subLabel, colloquialLabel: w.colloquialLabel, captionLabel: w.captionLabel, homonum: w.homonum, showWord: baseShow.word, showImage: baseShow.image, showPronunciation: baseShow.pron, showColloquial: baseShow.colloq, buttonSize: buttonSize, wordInfo: (w.grade || w.syllables != null || w.pos || w.wordType) ? { grade: w.grade, syllables: w.syllables, pos: w.pos, wordType: w.wordType } : undefined })] }, wi))) })), (items ?? []).map((item, index) => (_jsxs("div", { "data-wordtable-cell": onReorder ? index : undefined, className: `word-table-block__card${onReorder ? ' word-table-block__card--draggable' : ''}${dragOver === index ? ' word-table-block__card--drag-over' : ''}${dragging === index ? ' word-table-block__card--dragging' : ''}`, style: dotDashStyle(index, itemCols, itemRows, cutLine), draggable: !!onReorder, onPointerDown: onReorder ? (e) => longPressDrag(e, index) : undefined, onKeyDown: onReorder ? (e) => moveByKey(e, index) : undefined, onDragStart: onReorder ? () => { dragIndex.current = index; } : undefined, onDragOver: onReorder ? (e) => { e.preventDefault(); setDragOver(index); } : undefined, onDragLeave: onReorder ? () => setDragOver(null) : undefined, onDrop: onReorder ? (e) => { e.preventDefault(); if (dragIndex.current !== null && dragIndex.current !== index) {
|
|
466
498
|
onReorder(dragIndex.current, index);
|
|
467
|
-
} ; dragIndex.current = null; setDragOver(null); } : undefined, onDragEnd: onReorder ? () => { dragIndex.current = null; setDragOver(null); } : undefined, children: [(item.words ?? []).map((w, i) => (_jsxs(Fragment, { children: [i > 0 && _jsx("div", { className: "word-table-block__pair-divider" }), _jsx(WordCell, { outerScale: scale, label: w.label, subLabel: w.subLabel, colloquialLabel: w.colloquialLabel, homonum: w.homonum, showWord: show.word, showImage: show.image, showPronunciation: show.pron, showColloquial: show.colloq, buttonSize: buttonSize, wordInfo: (w.grade || w.syllables != null || w.pos || w.wordType) ? { grade: w.grade, syllables: w.syllables, pos: w.pos, wordType: w.wordType } : undefined })] }, i))), scoring && renderScore(index, (item.words ?? []).map(w => w.label).join(' / ')), onReorder && (
|
|
499
|
+
} ; dragIndex.current = null; setDragOver(null); } : undefined, onDragEnd: onReorder ? () => { dragIndex.current = null; setDragOver(null); } : undefined, children: [(item.words ?? []).map((w, i) => (_jsxs(Fragment, { children: [i > 0 && _jsx("div", { className: "word-table-block__pair-divider" }), _jsx(WordCell, { outerScale: scale, label: w.label, subLabel: w.subLabel, colloquialLabel: w.colloquialLabel, captionLabel: w.captionLabel, homonum: w.homonum, showWord: show.word, showImage: show.image, showPronunciation: show.pron, showColloquial: show.colloq, buttonSize: buttonSize, wordInfo: (w.grade || w.syllables != null || w.pos || w.wordType) ? { grade: w.grade, syllables: w.syllables, pos: w.pos, wordType: w.wordType } : undefined })] }, i))), scoring && renderScore(index, (item.words ?? []).map(w => w.label).join(' / ')), onReorder && (
|
|
468
500
|
/* **옮기기 손잡이.** 키보드로 순서를 바꾸려면 초점이 갈 자리가 있어야 하는데,
|
|
469
501
|
칸 자체를 초점 대상으로 만들면 칸마다 뜻 없는 탭 정지점이 하나씩 늘고
|
|
470
502
|
낭독기는 그것이 무엇인지 말할 수 없다. 이름 붙은 진짜 단추를 둔다 —
|
|
@@ -476,7 +508,7 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
476
508
|
defaultValue: '{{word}} 순서 바꾸기 (Alt + 화살표)',
|
|
477
509
|
}) }) })), (renderCellAction || onRemoveItem) && (
|
|
478
510
|
/* 오른쪽 위 한 줄 — 부르는 쪽이 얹은 것과 빼기가 나란히 선다(지우는 것이 끝) */
|
|
479
|
-
_jsxs("div", { className: "word-table-block__card-actions", children: [renderCellAction?.(index, item), onRemoveItem && (_jsx("div", { className: "word-table-block__card-close", children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "x", variant: "transparent-lightGray", useBorder: false, showTooltipInfo: (item.words ?? []).length > 1 ? t('wordPrint.removePair', '대립쌍 빼기') : t('wordPrint.removeWord', '단어 빼기'), ariaLabel: (item.words ?? []).length > 1 ? t('wordPrint.removePair', '대립쌍 빼기') : t('wordPrint.removeWord', '단어 빼기'), onClick: () => onRemoveItem(item.id) }) }))] }))] },
|
|
511
|
+
_jsxs("div", { className: "word-table-block__card-actions", children: [renderCellAction?.(index, item), onRemoveItem && (_jsx("div", { className: "word-table-block__card-close", children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "x", variant: "transparent-lightGray", useBorder: false, showTooltipInfo: (item.words ?? []).length > 1 ? t('wordPrint.removePair', '대립쌍 빼기') : t('wordPrint.removeWord', '단어 빼기'), ariaLabel: (item.words ?? []).length > 1 ? t('wordPrint.removePair', '대립쌍 빼기') : t('wordPrint.removeWord', '단어 빼기'), onClick: () => onRemoveItem(item.id) }) }))] }))] }, index))), Array.from({ length: Math.max(0, itemCols * itemRows - (items?.length ?? 0)) }).map((_, i) => {
|
|
480
512
|
const isWithinCount = (items?.length ?? 0) + i < cellCount;
|
|
481
513
|
return (_jsx("div", { className: "word-table-block__card word-table-block__card--filler", children: showFillerAdd && onActivateCell && isWithinCount && (_jsx("div", { style: counterScale, children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "bar", icon: "plus", label: t('wordTable.addWord', '추가하기'), onClick: () => onActivateCell((items?.length ?? 0) + i) }) })) }, `filler-${i}`));
|
|
482
514
|
})] })), showTopBand && (_jsx(_Fragment, { children: _jsxs("div", { className: "word-table__band word-table__band--top", children: [_jsx("img", { className: "word-table__brand-logo", src: brand?.topLogo?.src ?? speechearLogo, alt: brand?.topLogo?.alt ?? '말귀' }), (() => {
|
|
@@ -83,6 +83,46 @@ export declare function gridFor(orientation: WordTableOrientation, count: number
|
|
|
83
83
|
cols: number;
|
|
84
84
|
rows: number;
|
|
85
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* @public **머리 칸이 절반을 쓸 때, 나머지 절반에 설 격자.**
|
|
88
|
+
*
|
|
89
|
+
* 반쪽은 **방향만 뒤집힌 같은 비율**이라(가로 1123×794 의 왼쪽 절반은 561.5×794 = 0.7072,
|
|
90
|
+
* 세로 전체가 0.7070) 온 장 배치표(`LAYOUTS`)를 뒤집어 쓰는 것이 **출발점**이다.
|
|
91
|
+
*
|
|
92
|
+
* ## 그런데 뒤집기만 하면 **읽기 결정까지 따라온다**
|
|
93
|
+
*
|
|
94
|
+
* `LAYOUTS.portrait` 는 2~5 를 한 열로 세운다. 그것은 낱말 목록을 **한 줄에 하나씩** 읽히려는
|
|
95
|
+
* 결정이지, 칸을 크게 세우려는 결정이 아니다. 반쪽에 그대로 옮기면 그 결정만 따라오고 칸이
|
|
96
|
+
* 쪼그라든다 — **꼴 넷이 그 자리였다**(말귀 활용표 실측 2026-10-27).
|
|
97
|
+
*
|
|
98
|
+
* 가로 종이 오른쪽 절반(561.5×794)에 기준 칸(280×400)을 놓고 잰 것:
|
|
99
|
+
*
|
|
100
|
+
* ```
|
|
101
|
+
* n 뒤집은 LAYOUTS 여기서 고르는 것 n 뒤집은 LAYOUTS 여기서 고르는 것
|
|
102
|
+
* 4 1×4 0.4963 → 2×2 0.9925 (2.00배) 7 2×4 0.4963 그대로
|
|
103
|
+
* 9 2×5 0.3970 → 3×3 0.6617 (1.67배) 11 3×4 0.4963 그대로
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* **2×2 가 기준 칸과 거의 같다** — 561.5×794 를 넷으로 쪼개면 280.75×397 이고 기준 칸이
|
|
107
|
+
* 280×400 이다. 꼴 넷은 반쪽에서 **원래 크기로 설 수 있었는데** 그것을 버리고 쌓고 있었다.
|
|
108
|
+
*
|
|
109
|
+
* ## 고르는 자
|
|
110
|
+
*
|
|
111
|
+
* **① 빈 칸을 더 늘리지 않는다.** 사장님이 16→12 에서 세우신 자다. 그래서 *지금 뒤집은 값이
|
|
112
|
+
* 남기는 빈 칸* 을 천장으로 두고 그 안에서만 고른다.
|
|
113
|
+
*
|
|
114
|
+
* **② 그 안에서 배율이 가장 큰 것.** 배율은 `min(칸폭/280, 칸높이/400)` — 칸이 쓰는 그 자다.
|
|
115
|
+
*
|
|
116
|
+
* **③ 5% 넘게 좋아질 때만 바꾼다.** 수 대부분은 1% 차이로 가로·세로만 뒤집히는데, 그 1% 를
|
|
117
|
+
* 좇아 이미 선 표의 모양을 흔들 까닭이 없다. 이 문턱 덕에 **실제로 움직이는 것은 4 와 9 뿐**이다.
|
|
118
|
+
*
|
|
119
|
+
* ①이 없으면 7은 `7×1`(0.2865 — **지금의 0.58배**), 11은 `11×1`(0.1823 — **0.37배**)로 간다.
|
|
120
|
+
* "빈 칸 없는 것 중 가장 큰 것" 은 그래서 안 된다 — 그 둘은 쪼갤 수가 없는 수다.
|
|
121
|
+
*/
|
|
122
|
+
export declare function halfGridFor(orientation: WordTableOrientation, count: number): {
|
|
123
|
+
cols: number;
|
|
124
|
+
rows: number;
|
|
125
|
+
};
|
|
86
126
|
export declare const CUT_CLASS: Record<WordTableCutLine, string>;
|
|
87
127
|
export declare const POS_LABEL: Record<string, string>;
|
|
88
128
|
/** 어종(단어 유형) 약호 → 전체 표기. 데이터의 Class 컬럼은 축약형('고유'/'한자'/'외래'/'혼종')을 쓴다. */
|
|
@@ -120,6 +120,70 @@ export function gridFor(orientation, count) {
|
|
|
120
120
|
[cols, rows] = [rows, cols];
|
|
121
121
|
return { cols, rows };
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* @public **머리 칸이 절반을 쓸 때, 나머지 절반에 설 격자.**
|
|
125
|
+
*
|
|
126
|
+
* 반쪽은 **방향만 뒤집힌 같은 비율**이라(가로 1123×794 의 왼쪽 절반은 561.5×794 = 0.7072,
|
|
127
|
+
* 세로 전체가 0.7070) 온 장 배치표(`LAYOUTS`)를 뒤집어 쓰는 것이 **출발점**이다.
|
|
128
|
+
*
|
|
129
|
+
* ## 그런데 뒤집기만 하면 **읽기 결정까지 따라온다**
|
|
130
|
+
*
|
|
131
|
+
* `LAYOUTS.portrait` 는 2~5 를 한 열로 세운다. 그것은 낱말 목록을 **한 줄에 하나씩** 읽히려는
|
|
132
|
+
* 결정이지, 칸을 크게 세우려는 결정이 아니다. 반쪽에 그대로 옮기면 그 결정만 따라오고 칸이
|
|
133
|
+
* 쪼그라든다 — **꼴 넷이 그 자리였다**(말귀 활용표 실측 2026-10-27).
|
|
134
|
+
*
|
|
135
|
+
* 가로 종이 오른쪽 절반(561.5×794)에 기준 칸(280×400)을 놓고 잰 것:
|
|
136
|
+
*
|
|
137
|
+
* ```
|
|
138
|
+
* n 뒤집은 LAYOUTS 여기서 고르는 것 n 뒤집은 LAYOUTS 여기서 고르는 것
|
|
139
|
+
* 4 1×4 0.4963 → 2×2 0.9925 (2.00배) 7 2×4 0.4963 그대로
|
|
140
|
+
* 9 2×5 0.3970 → 3×3 0.6617 (1.67배) 11 3×4 0.4963 그대로
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* **2×2 가 기준 칸과 거의 같다** — 561.5×794 를 넷으로 쪼개면 280.75×397 이고 기준 칸이
|
|
144
|
+
* 280×400 이다. 꼴 넷은 반쪽에서 **원래 크기로 설 수 있었는데** 그것을 버리고 쌓고 있었다.
|
|
145
|
+
*
|
|
146
|
+
* ## 고르는 자
|
|
147
|
+
*
|
|
148
|
+
* **① 빈 칸을 더 늘리지 않는다.** 사장님이 16→12 에서 세우신 자다. 그래서 *지금 뒤집은 값이
|
|
149
|
+
* 남기는 빈 칸* 을 천장으로 두고 그 안에서만 고른다.
|
|
150
|
+
*
|
|
151
|
+
* **② 그 안에서 배율이 가장 큰 것.** 배율은 `min(칸폭/280, 칸높이/400)` — 칸이 쓰는 그 자다.
|
|
152
|
+
*
|
|
153
|
+
* **③ 5% 넘게 좋아질 때만 바꾼다.** 수 대부분은 1% 차이로 가로·세로만 뒤집히는데, 그 1% 를
|
|
154
|
+
* 좇아 이미 선 표의 모양을 흔들 까닭이 없다. 이 문턱 덕에 **실제로 움직이는 것은 4 와 9 뿐**이다.
|
|
155
|
+
*
|
|
156
|
+
* ①이 없으면 7은 `7×1`(0.2865 — **지금의 0.58배**), 11은 `11×1`(0.1823 — **0.37배**)로 간다.
|
|
157
|
+
* "빈 칸 없는 것 중 가장 큰 것" 은 그래서 안 된다 — 그 둘은 쪼갤 수가 없는 수다.
|
|
158
|
+
*/
|
|
159
|
+
export function halfGridFor(orientation, count) {
|
|
160
|
+
/* 출발점 — 반쪽은 방향이 뒤집힌 꼴이라 배치표도 뒤집어 부른다 */
|
|
161
|
+
const base = gridFor(orientation === 'landscape' ? 'portrait' : 'landscape', count);
|
|
162
|
+
const n = Math.max(1, Math.ceil(count));
|
|
163
|
+
if (n <= 1)
|
|
164
|
+
return base;
|
|
165
|
+
const paper = WORD_TABLE_PAPER[orientation];
|
|
166
|
+
/* 가로면 왼쪽 절반(폭이 반), 세로면 위쪽 절반(높이가 반) */
|
|
167
|
+
const halfW = orientation === 'landscape' ? paper.width / 2 : paper.width;
|
|
168
|
+
const halfH = orientation === 'landscape' ? paper.height : paper.height / 2;
|
|
169
|
+
const scaleOf = (cols, rows) => Math.min((halfW / cols) / REF_W_BOTH, (halfH / rows) / REF_H_BOTH);
|
|
170
|
+
const emptyCeiling = Math.max(0, base.cols * base.rows - n);
|
|
171
|
+
const baseScale = scaleOf(base.cols, base.rows);
|
|
172
|
+
let best = base;
|
|
173
|
+
let bestScale = baseScale;
|
|
174
|
+
for (let cols = 1; cols <= n; cols++) {
|
|
175
|
+
const rows = Math.ceil(n / cols);
|
|
176
|
+
if (cols * rows - n > emptyCeiling)
|
|
177
|
+
continue;
|
|
178
|
+
const s = scaleOf(cols, rows);
|
|
179
|
+
if (s > bestScale) {
|
|
180
|
+
best = { cols, rows };
|
|
181
|
+
bestScale = s;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/* 5% 문턱 — 안 넘으면 지금 값을 그대로 둔다(머리말 ③) */
|
|
185
|
+
return bestScale > baseScale * 1.05 ? best : base;
|
|
186
|
+
}
|
|
123
187
|
export const CUT_CLASS = {
|
|
124
188
|
show: 'word-table-block__content--cut-show',
|
|
125
189
|
dashed: '',
|
|
@@ -3,6 +3,18 @@ export interface WordSearchResultWord {
|
|
|
3
3
|
label: string;
|
|
4
4
|
subLabel?: string;
|
|
5
5
|
colloquialLabel?: string;
|
|
6
|
+
/**
|
|
7
|
+
* 칸 **밑에 작게 붙는 이름표** — 그 칸이 무엇인지 말한다(`-아/어요` · `과거`).
|
|
8
|
+
*
|
|
9
|
+
* 활용표처럼 **칸마다 같은 낱말의 다른 꼴**이 서는 표를 위해 둔다. 거기서는 글자만 보고
|
|
10
|
+
* 어느 꼴인지 가릴 수 없다 — `감사했다` 가 과거인 것은 알아도 `감사하고` 가 무엇인지는
|
|
11
|
+
* 사람마다 다르게 읽는다.
|
|
12
|
+
*
|
|
13
|
+
* **발음(`subLabel`) 자리에 적으면 안 된다.** 칸의 재생 단추가 `subLabel || label` 로
|
|
14
|
+
* 소리를 받아 오므로, 거기 이름표를 적으면 칸이 `-아/어요` 를 **소리 내어 읽는다**
|
|
15
|
+
* (말귀가 활용표를 옮기며 실측 2026-10-27).
|
|
16
|
+
*/
|
|
17
|
+
captionLabel?: string;
|
|
6
18
|
homonum?: number;
|
|
7
19
|
grade?: string;
|
|
8
20
|
syllables?: number;
|