@ihabdevteam/core 0.401.0 → 0.402.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 +35 -0
- package/dist/components.cjs.js +175 -175
- package/dist/components.esm.css +1 -1
- package/dist/hooks.cjs.js +3 -3
- package/dist/i18n.cjs.js +3 -3
- package/dist/ihabdevteam-core.cjs.js +26 -26
- package/dist/ihabdevteam-core.d.ts +17 -1
- package/dist/packages/core/src/components/Word/WordTableThumbnail.css +7 -0
- package/dist/packages/core/src/components/Word/WordTableThumbnail.js +32 -2
- package/dist/packages/core/src/components/WordTable.js +8 -4
- package/dist/packages/core/src/i18n/locales/en.json +3 -1
- package/dist/packages/core/src/i18n/locales/ko.json +2 -1
- package/dist/packages/core/src/types/wordSearch.d.ts +16 -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 +3 -3
- package/package.json +1 -1
|
@@ -1922,7 +1922,7 @@ export declare function copyText(text: string): Promise<boolean>;
|
|
|
1922
1922
|
*
|
|
1923
1923
|
* 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
|
|
1924
1924
|
*/
|
|
1925
|
-
export declare const CORE_VERSION = "0.
|
|
1925
|
+
export declare const CORE_VERSION = "0.402.0";
|
|
1926
1926
|
|
|
1927
1927
|
/** @public */
|
|
1928
1928
|
declare const coreDefault: Record<string, unknown>;
|
|
@@ -11685,6 +11685,22 @@ export declare interface WordSearchResultWord {
|
|
|
11685
11685
|
* 배지만 주거나 이름표만 줘도 된다. 둘 다 없으면 아무것도 안 선다.
|
|
11686
11686
|
*/
|
|
11687
11687
|
captionBadge?: string;
|
|
11688
|
+
/**
|
|
11689
|
+
* **그림을 찾을 때 쓸 낱말** — 안 주면 `label` 로 찾는다(말귀 청 (355), 2026-10-29).
|
|
11690
|
+
*
|
|
11691
|
+
* 칸의 글자와 그림이 **갈라져야 하는 표**를 위해 둔다. 사장님이 꼴 고르기를 이르시며
|
|
11692
|
+
* 함께 정하신 것이다(2026-10-29) — **그림은 기본형**, **표준발음·소리는 칸에 적힌 낱말**.
|
|
11693
|
+
* 칸이 `고프면` 으로 서면 그 글자로는 그림이 없어 **그림이 사라지는데**, 단어표는 그림으로
|
|
11694
|
+
* 알아보는 표라 그러면 쓸 수 없다. `imageLabel: '고프다'` 를 함께 주면 글자는 그 꼴대로
|
|
11695
|
+
* 서고 그림만 기본형 것을 쓴다.
|
|
11696
|
+
*
|
|
11697
|
+
* **소리 쪽은 이 값을 안 본다** — 재생은 그대로 `subLabel || label` 이다. 꼴을 바꾼 칸은
|
|
11698
|
+
* 그 꼴의 소리가 나야 한다(틀린 자극을 주지 않는다).
|
|
11699
|
+
*
|
|
11700
|
+
* 동음이의 번호(`homonum`)는 그림을 찾을 때 **그대로 함께 간다** — 기본형이 둘 이상이면
|
|
11701
|
+
* 그 번호가 가린다.
|
|
11702
|
+
*/
|
|
11703
|
+
imageLabel?: string;
|
|
11688
11704
|
homonum?: number;
|
|
11689
11705
|
grade?: string;
|
|
11690
11706
|
syllables?: number;
|
|
@@ -64,6 +64,13 @@
|
|
|
64
64
|
글자는 낱말 칸과 같은 꼴로 두되 흐리게 — 낱말이 아니라 세는 수라 읽는 차례가 뒤다. */
|
|
65
65
|
.word-table-thumb__cell--more {
|
|
66
66
|
justify-content: center;
|
|
67
|
+
/* **얹으면 가려진 낱말이 뜬다**(청 (354)) — 누르는 자리가 아니라 초점만 받으므로
|
|
68
|
+
손 모양을 띄우지 않는다. 풍선은 `document.body` 로 날아가 앉으니(포털) 여기에
|
|
69
|
+
`position` 을 줄 까닭이 없다. */
|
|
70
|
+
outline-offset: -2px;
|
|
71
|
+
}
|
|
72
|
+
.word-table-thumb__cell--more:focus-visible {
|
|
73
|
+
outline: 2px solid var(--color-main);
|
|
67
74
|
}
|
|
68
75
|
.word-table-thumb__more {
|
|
69
76
|
color: var(--color-gray);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cx } from '../../utils/cx';
|
|
4
|
-
import { Fragment } from 'react';
|
|
4
|
+
import { Fragment, useCallback, useRef, useState } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import DescriptionTooltip from '../Tooltip/DescriptionTooltip';
|
|
7
|
+
import { isTouchPointer, recentlyTouched, useTouchToggle } from '../../hooks/touchToggle';
|
|
6
8
|
import './WordTableThumbnail.css';
|
|
7
9
|
/**
|
|
8
10
|
* **썸네일이 그리는 칸은 여덟까지다.**
|
|
@@ -40,6 +42,16 @@ const MAX_THUMB_CELLS = 8;
|
|
|
40
42
|
/** @public 단어표 내용 미니 미리보기(그리드 썸네일). */
|
|
41
43
|
export default function WordTableThumbnail({ items, className }) {
|
|
42
44
|
const { t } = useTranslation();
|
|
45
|
+
const moreRef = useRef(null);
|
|
46
|
+
const [moreAnchor, setMoreAnchor] = useState(null);
|
|
47
|
+
const openMore = useCallback(() => setMoreAnchor(moreRef.current?.getBoundingClientRect() ?? null), []);
|
|
48
|
+
const closeMore = useCallback(() => setMoreAnchor(null), []);
|
|
49
|
+
/* 톡 — 손가락에는 얹기가 없다. 톡으로 열고 닫는다(마우스·키보드는 그대로).
|
|
50
|
+
칸의 `ⓘ` 가 쓰는 것과 같은 자다. */
|
|
51
|
+
const moreToggle = useTouchToggle(!!moreAnchor, (next) => { if (next)
|
|
52
|
+
openMore();
|
|
53
|
+
else
|
|
54
|
+
closeMore(); }, moreRef);
|
|
43
55
|
const n = items.length;
|
|
44
56
|
// 3개 이하는 세로 1열(빈칸 없이 3개가 세로로), 4개 이상은 2열
|
|
45
57
|
const cols = n <= 3 ? 1 : 2;
|
|
@@ -48,11 +60,29 @@ export default function WordTableThumbnail({ items, className }) {
|
|
|
48
60
|
const over = n > cap;
|
|
49
61
|
const shown = items.slice(0, over ? cap - 1 : cap);
|
|
50
62
|
const hiddenCount = n - shown.length;
|
|
63
|
+
/* 가려진 칸의 낱말 — 한 칸에 둘이면(대립쌍) 빗금으로 잇는다(표의 다른 자리와 같은 꼴).
|
|
64
|
+
`words` 가 빠진 항목은 아래 칸 그리기와 같은 방어로 `id` 를 쓴다. */
|
|
65
|
+
const hiddenLabels = items.slice(shown.length)
|
|
66
|
+
.map(it => (it.words?.length ? it.words.map(w => w.label).join(' / ') : it.id));
|
|
51
67
|
const rows = Math.ceil(Math.min(n, cap) / cols) || 1;
|
|
52
68
|
const total = cols * rows;
|
|
53
69
|
return (_jsx("div", { className: cx('word-table-thumb', className), style: { gridTemplateColumns: `repeat(${cols}, 1fr)` }, children: Array.from({ length: total }, (_, i) => {
|
|
54
70
|
if (over && i === cap - 1) {
|
|
55
|
-
return (
|
|
71
|
+
return (
|
|
72
|
+
/* **`+N` 에 얹으면 가려진 낱말이 뜬다**(말귀 청 (354), 2026-10-29. 사장님이
|
|
73
|
+
화면에서 물으셨다 — *"+6 에는 호버하면 tooltip으로 해당 단어들 보여줄 수 있어?"*).
|
|
74
|
+
이 칸은 **누르는 자리가 아니다** — 카드가 누르는 자리라 `role="button"` 을 주면
|
|
75
|
+
속에 또 하나가 생긴다. `tabIndex` 만 둬서 초점이 닿게 하고, 낭독기에는 낱말을
|
|
76
|
+
이름으로 보낸다. 줄로 쌓는 `DescriptionTooltip` 을 쓴다 — 가로로 늘어나면
|
|
77
|
+
여섯 낱말에서 카드보다 넓어진다. */
|
|
78
|
+
_jsxs("div", { ref: moreRef, className: "word-table-thumb__cell word-table-thumb__cell--more", tabIndex: 0, "aria-label": t('wordTable.thumbMoreAria', {
|
|
79
|
+
count: hiddenCount,
|
|
80
|
+
words: hiddenLabels.join(', '),
|
|
81
|
+
defaultValue: '그 밖 {{count}}칸: {{words}}',
|
|
82
|
+
}), onPointerEnter: (e) => { if (!isTouchPointer(e))
|
|
83
|
+
openMore(); }, onPointerLeave: (e) => { if (!isTouchPointer(e))
|
|
84
|
+
closeMore(); }, onFocus: () => { if (!recentlyTouched())
|
|
85
|
+
openMore(); }, onBlur: closeMore, onClick: (e) => { e.stopPropagation(); moreToggle.touchPress(); }, children: [_jsx("span", { className: "word-table-thumb__more body-3", children: t('wordTable.thumbMore', { count: hiddenCount, defaultValue: '+{{count}}' }) }), moreAnchor && hiddenLabels.length > 0 && (_jsx(DescriptionTooltip, { anchorRect: moreAnchor, items: hiddenLabels, showIndex: false, closeOnOutsideClick: false }))] }, i));
|
|
56
86
|
}
|
|
57
87
|
const item = shown[i];
|
|
58
88
|
if (!item)
|
|
@@ -77,7 +77,7 @@ function rowTemplate(rows) {
|
|
|
77
77
|
return '100%';
|
|
78
78
|
return `repeat(${rows}, calc((100% - ${rows - 1} * var(--wt-cell-gap, 0px)) / ${rows}))`;
|
|
79
79
|
}
|
|
80
|
-
function WordCell({ label, subLabel, colloquialLabel, captionLabel, captionBadge, homonum, showWord = true, showImage = true, showPronunciation = true, showColloquial = true, showCaption = true, buttonSize = 40, wordInfo, outerScale = 1, }) {
|
|
80
|
+
function WordCell({ label, subLabel, colloquialLabel, captionLabel, captionBadge, imageLabel, homonum, showWord = true, showImage = true, showPronunciation = true, showColloquial = true, showCaption = true, buttonSize = 40, wordInfo, outerScale = 1, }) {
|
|
81
81
|
const { t } = useTranslation();
|
|
82
82
|
const outerRef = useRef(null);
|
|
83
83
|
const infoRef = useRef(null);
|
|
@@ -94,7 +94,11 @@ function WordCell({ label, subLabel, colloquialLabel, captionLabel, captionBadge
|
|
|
94
94
|
const [infoAnchor, setInfoAnchor] = useState(null);
|
|
95
95
|
// 발음(subLabel)이 없으면 단어로 표준발음 조회(앱 주입 resolver)
|
|
96
96
|
const pron = (subLabel && subLabel.length > 0) ? subLabel : (getPronunciationResolver()?.(label, homonum) ?? '');
|
|
97
|
-
|
|
97
|
+
/* **그림만 다른 낱말로 찾을 수 있다**(말귀 청 (355), 2026-10-29) — 칸의 글자가 꼴에 따라
|
|
98
|
+
바뀌어도(`고프면`) 그림은 기본형(`고프다`) 것을 쓴다. 안 주면 지금 그대로 `label` 이라
|
|
99
|
+
활용표·대립쌍표·옛 표가 한 글자도 안 바뀐다.
|
|
100
|
+
**소리는 여기를 안 본다** — 재생은 그대로 `subLabel || label` 이다(그 꼴의 소리가 나야 한다). */
|
|
101
|
+
const imageUrl = getImageResolver()?.(imageLabel || label, homonum) ?? '';
|
|
98
102
|
const { imgRef, loading: imgLoading, failed: imgFailed, onLoad: handleImgLoad, onError: handleImgError } = useWordImage(imageUrl);
|
|
99
103
|
const handleInfoEnter = useCallback(() => setInfoAnchor(infoRef.current?.getBoundingClientRect() ?? null), []);
|
|
100
104
|
const handleInfoLeave = useCallback(() => setInfoAnchor(null), []);
|
|
@@ -678,9 +682,9 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
678
682
|
gridRow: `1 / span ${half.rows}`,
|
|
679
683
|
/* 머리 칸과 나머지 절반을 가르는 점선 — 가로면 오른쪽, 세로면 아래쪽 */
|
|
680
684
|
...dotDashStyle(0, orientation === 'landscape' ? 2 : 1, orientation === 'landscape' ? 1 : 2, cutLine),
|
|
681
|
-
}, children: (baseItem.words ?? []).map((w, wi) => (_jsxs(Fragment, { children: [wi > 0 && _jsx("div", { className: withLegacy("word-table__pair-divider") }), _jsx(WordCell, { outerScale: scale, label: w.label, subLabel: w.subLabel, colloquialLabel: w.colloquialLabel, captionLabel: w.captionLabel, captionBadge: w.captionBadge, homonum: w.homonum, showWord: baseShow.word, showImage: baseShow.image, showPronunciation: baseShow.pron, showColloquial: baseShow.colloq, showCaption: baseShow.caption, 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, "data-wordtable-index": onReorder ? indexOffset + index : undefined, className: withLegacy(`word-table__card${onReorder ? ' word-table__card--draggable' : ''}${dragOver === index ? ' word-table__card--drag-over' : ''}${dragging === index ? ' word-table__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) {
|
|
685
|
+
}, children: (baseItem.words ?? []).map((w, wi) => (_jsxs(Fragment, { children: [wi > 0 && _jsx("div", { className: withLegacy("word-table__pair-divider") }), _jsx(WordCell, { outerScale: scale, label: w.label, subLabel: w.subLabel, colloquialLabel: w.colloquialLabel, captionLabel: w.captionLabel, captionBadge: w.captionBadge, imageLabel: w.imageLabel, homonum: w.homonum, showWord: baseShow.word, showImage: baseShow.image, showPronunciation: baseShow.pron, showColloquial: baseShow.colloq, showCaption: baseShow.caption, 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, "data-wordtable-index": onReorder ? indexOffset + index : undefined, className: withLegacy(`word-table__card${onReorder ? ' word-table__card--draggable' : ''}${dragOver === index ? ' word-table__card--drag-over' : ''}${dragging === index ? ' word-table__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) {
|
|
682
686
|
onReorder(dragIndex.current, index);
|
|
683
|
-
} ; 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: withLegacy("word-table__pair-divider") }), _jsx(WordCell, { outerScale: scale, label: w.label, subLabel: w.subLabel, colloquialLabel: w.colloquialLabel, captionLabel: w.captionLabel, captionBadge: w.captionBadge, homonum: w.homonum, showWord: show.word, showImage: show.image, showPronunciation: show.pron, showColloquial: show.colloq, showCaption: show.caption, 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(' / ')), (renderCellAction || onRemoveItem || onCopyItem || onReplaceItem || onReorder) && (
|
|
687
|
+
} ; 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: withLegacy("word-table__pair-divider") }), _jsx(WordCell, { outerScale: scale, label: w.label, subLabel: w.subLabel, colloquialLabel: w.colloquialLabel, captionLabel: w.captionLabel, captionBadge: w.captionBadge, imageLabel: w.imageLabel, homonum: w.homonum, showWord: show.word, showImage: show.image, showPronunciation: show.pron, showColloquial: show.colloq, showCaption: show.caption, 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(' / ')), (renderCellAction || onRemoveItem || onCopyItem || onReplaceItem || onReorder) && (
|
|
684
688
|
/* **오른쪽 기둥** — 빼기 → 부르는 쪽이 얹은 것 → 옮기기 손잡이 차례로 쌓인다
|
|
685
689
|
(말귀 청 (331), 2026-10-28). 전에는 빼기와 얹은 것만 **한 줄**로 서고
|
|
686
690
|
손잡이는 왼쪽 위에 따로 섰다 — 재생 단추와 **같은 자리라 겹쳤다.**
|
|
@@ -689,7 +689,9 @@
|
|
|
689
689
|
"replaceItem": "Other words",
|
|
690
690
|
"replacePair": "Other pairs",
|
|
691
691
|
"replaceItemAria": "Swap cell {{n}} only",
|
|
692
|
-
"replacePairAria": "Swap pair {{n}} only"
|
|
692
|
+
"replacePairAria": "Swap pair {{n}} only",
|
|
693
|
+
"thumbMoreAria_one": "1 more cell: {{words}}",
|
|
694
|
+
"thumbMoreAria_other": "{{count}} more cells: {{words}}"
|
|
693
695
|
},
|
|
694
696
|
"wordSearch": {
|
|
695
697
|
"filterTitle": "Word Search Settings",
|
|
@@ -676,7 +676,8 @@
|
|
|
676
676
|
"replaceItem": "다른 단어로",
|
|
677
677
|
"replacePair": "다른 쌍으로",
|
|
678
678
|
"replaceItemAria": "{{n}}번 칸만 다른 단어로",
|
|
679
|
-
"replacePairAria": "{{n}}번 칸만 다른 쌍으로"
|
|
679
|
+
"replacePairAria": "{{n}}번 칸만 다른 쌍으로",
|
|
680
|
+
"thumbMoreAria": "그 밖 {{count}}칸: {{words}}"
|
|
680
681
|
},
|
|
681
682
|
"wordSearch": {
|
|
682
683
|
"filterTitle": "단어 검색 설정",
|
|
@@ -26,6 +26,22 @@ export interface WordSearchResultWord {
|
|
|
26
26
|
* 배지만 주거나 이름표만 줘도 된다. 둘 다 없으면 아무것도 안 선다.
|
|
27
27
|
*/
|
|
28
28
|
captionBadge?: string;
|
|
29
|
+
/**
|
|
30
|
+
* **그림을 찾을 때 쓸 낱말** — 안 주면 `label` 로 찾는다(말귀 청 (355), 2026-10-29).
|
|
31
|
+
*
|
|
32
|
+
* 칸의 글자와 그림이 **갈라져야 하는 표**를 위해 둔다. 사장님이 꼴 고르기를 이르시며
|
|
33
|
+
* 함께 정하신 것이다(2026-10-29) — **그림은 기본형**, **표준발음·소리는 칸에 적힌 낱말**.
|
|
34
|
+
* 칸이 `고프면` 으로 서면 그 글자로는 그림이 없어 **그림이 사라지는데**, 단어표는 그림으로
|
|
35
|
+
* 알아보는 표라 그러면 쓸 수 없다. `imageLabel: '고프다'` 를 함께 주면 글자는 그 꼴대로
|
|
36
|
+
* 서고 그림만 기본형 것을 쓴다.
|
|
37
|
+
*
|
|
38
|
+
* **소리 쪽은 이 값을 안 본다** — 재생은 그대로 `subLabel || label` 이다. 꼴을 바꾼 칸은
|
|
39
|
+
* 그 꼴의 소리가 나야 한다(틀린 자극을 주지 않는다).
|
|
40
|
+
*
|
|
41
|
+
* 동음이의 번호(`homonum`)는 그림을 찾을 때 **그대로 함께 간다** — 기본형이 둘 이상이면
|
|
42
|
+
* 그 번호가 가린다.
|
|
43
|
+
*/
|
|
44
|
+
imageLabel?: string;
|
|
29
45
|
homonum?: number;
|
|
30
46
|
grade?: string;
|
|
31
47
|
syllables?: number;
|