@ihabdevteam/core 0.376.0 → 0.379.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 +222 -0
- package/dist/components.cjs.js +181 -181
- package/dist/components.esm.css +5 -5
- package/dist/hooks.cjs.js +1 -1
- package/dist/i18n.cjs.js +1 -1
- package/dist/ihabdevteam-core.cjs.js +193 -193
- package/dist/ihabdevteam-core.d.ts +19 -8
- package/dist/packages/core/src/components/Badge.css +0 -76
- package/dist/packages/core/src/components/Badge.d.ts +1 -0
- package/dist/packages/core/src/components/Badge.js +4 -0
- package/dist/packages/core/src/components/BarChart.css +29 -29
- package/dist/packages/core/src/components/BarChart.js +20 -19
- package/dist/packages/core/src/components/BottomNav.js +3 -2
- package/dist/packages/core/src/components/ChartSection.css +70 -45
- package/dist/packages/core/src/components/ChartSection.d.ts +3 -3
- package/dist/packages/core/src/components/ChartSection.js +8 -7
- package/dist/packages/core/src/components/CircleBadge.css +87 -0
- package/dist/packages/core/src/components/CircleBadge.d.ts +1 -0
- package/dist/packages/core/src/components/CircleBadge.js +1 -0
- package/dist/packages/core/src/components/CountTile.js +1 -1
- package/dist/packages/core/src/components/Header.js +3 -2
- package/dist/packages/core/src/components/RingChart.js +6 -5
- package/dist/packages/core/src/components/Section.css +1 -1
- package/dist/packages/core/src/components/SectionHeadFloat.d.ts +1 -1
- package/dist/packages/core/src/components/SectionHeadFloat.js +1 -1
- package/dist/packages/core/src/components/StatChart.css +17 -17
- package/dist/packages/core/src/components/StatChart.d.ts +1 -1
- package/dist/packages/core/src/components/StatChart.js +3 -2
- package/dist/packages/core/src/components/Toolbar.css +1 -1
- package/dist/packages/core/src/components/Tooltip/DescriptionTooltip.css +9 -9
- package/dist/packages/core/src/components/Tooltip/DescriptionTooltip.js +3 -2
- package/dist/packages/core/src/components/Tooltip/InfoTooltip.css +6 -6
- package/dist/packages/core/src/components/Tooltip/InfoTooltip.js +2 -1
- package/dist/packages/core/src/components/Tooltip/MenuTooltip.css +15 -15
- package/dist/packages/core/src/components/Tooltip/MenuTooltip.js +2 -1
- package/dist/packages/core/src/components/Tooltip/TextBoxTooltip.css +15 -15
- package/dist/packages/core/src/components/Tooltip/TextBoxTooltip.js +4 -3
- package/dist/packages/core/src/components/Tooltip/Tooltip.css +21 -21
- package/dist/packages/core/src/components/Tooltip/Tooltip.js +4 -3
- package/dist/packages/core/src/components/Tooltip/TrainingTooltip.css +20 -5
- package/dist/packages/core/src/components/Tooltip/TrainingTooltip.d.ts +1 -1
- package/dist/packages/core/src/components/Tooltip/TrainingTooltip.js +5 -4
- package/dist/packages/core/src/components/Tooltip/WordImageTooltip.css +7 -7
- package/dist/packages/core/src/components/Tooltip/WordImageTooltip.js +5 -4
- package/dist/packages/core/src/components/Training/NoiseSettingsTooltip.css +15 -15
- package/dist/packages/core/src/components/Training/NoiseSettingsTooltip.js +3 -2
- package/dist/packages/core/src/components/Training/TrainingPagePopupBottom.js +1 -1
- package/dist/packages/core/src/components/Training/TrainingStepTextBox.css +1 -1
- package/dist/packages/core/src/components/Training/TrainingStepTitle.js +2 -2
- package/dist/packages/core/src/components/Training/useFloatingFocus.d.ts +1 -1
- package/dist/packages/core/src/components/Training/useFloatingFocus.js +2 -2
- package/dist/packages/core/src/components/Word/WordSearchResultBlock.css +0 -7
- package/dist/packages/core/src/components/Word/WordSearchResultBlock.js +1 -1
- package/dist/packages/core/src/components/Word/wordTablePrint.js +4 -4
- package/dist/packages/core/src/components/WordTable.css +112 -85
- package/dist/packages/core/src/components/WordTable.js +59 -37
- package/dist/packages/core/src/components/barChartTypes.d.ts +1 -1
- package/dist/packages/core/src/components/wordTableLayout.js +2 -2
- package/dist/packages/core/src/hooks/touchToggle.d.ts +1 -1
- package/dist/packages/core/src/hooks/touchToggle.js +2 -2
- package/dist/packages/core/src/types/wordSearch.d.ts +11 -0
- package/dist/packages/core/src/utils/legacyBlocks.d.ts +53 -0
- package/dist/packages/core/src/utils/legacyBlocks.js +131 -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
|
@@ -6,6 +6,8 @@ import { useRef, useState, useEffect, useCallback, useMemo, Fragment, } from 're
|
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import './WordTable.css';
|
|
8
8
|
import Button from './Button';
|
|
9
|
+
import Badge from './Badge';
|
|
10
|
+
import { withLegacy } from '../utils/legacyBlocks';
|
|
9
11
|
import Section from './Section';
|
|
10
12
|
import DescriptionTooltip from './Tooltip/DescriptionTooltip';
|
|
11
13
|
import { getTTSUrlResolver, getTTSFallbackUrlResolver } from '../utils/ttsConfig';
|
|
@@ -47,7 +49,7 @@ const srOnly = {
|
|
|
47
49
|
const LONG_PRESS_MS = 400;
|
|
48
50
|
/** 길게 누르기가 익기 전에 이만큼 움직이면 그건 끌기가 아니라 **스크롤**이라 취소한다 */
|
|
49
51
|
const MOVE_THRESHOLD_PX = 8;
|
|
50
|
-
function WordCell({ label, subLabel, colloquialLabel, captionLabel, homonum, showWord = true, showImage = true, showPronunciation = true, showColloquial = true, buttonSize = 40, wordInfo, outerScale = 1, }) {
|
|
52
|
+
function WordCell({ label, subLabel, colloquialLabel, captionLabel, captionBadge, homonum, showWord = true, showImage = true, showPronunciation = true, showColloquial = true, buttonSize = 40, wordInfo, outerScale = 1, }) {
|
|
51
53
|
const { t } = useTranslation();
|
|
52
54
|
const outerRef = useRef(null);
|
|
53
55
|
const infoRef = useRef(null);
|
|
@@ -251,17 +253,22 @@ function WordCell({ label, subLabel, colloquialLabel, captionLabel, homonum, sho
|
|
|
251
253
|
* 안 곱하면 또 조용히 헛돈다.
|
|
252
254
|
*/
|
|
253
255
|
const tapTooSmall = buttonSize * outerScale < MIN_TAP_PX;
|
|
254
|
-
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 })] })),
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
256
|
+
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 })] })), (captionBadge || captionLabel) && (
|
|
257
|
+
/* **[배지][이름표] 한 줄** — 둘은 성격이 다르다(청 (328)). 배지는 *무엇을 하는
|
|
258
|
+
말인가*(치료사가 고르는 잣대), 이름표는 *어떤 꼬리가 붙는가*(학습자가 낼
|
|
259
|
+
소리)다. 한 글자로 붙여 놓으면 그 둘이 안 갈린다. 가운뎃점은 안 쓴다 —
|
|
260
|
+
배지가 이미 경계다. */
|
|
261
|
+
_jsxs("span", { className: "word-table-cell__caption", children: [captionBadge && _jsx(Badge, { type: "bar", fill: "soft", size: "small", label: captionBadge }), captionLabel && _jsx("span", { className: "word-table-cell__caption-tail h5", children: captionLabel })] })), 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__side", children: [_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, loading: waiting, showTooltipInfo: waiting ? t('common.loading', '불러오는 중') : 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))
|
|
262
|
+
handleInfoEnter(); }, onPointerLeave: (e) => { if (!isTouchPointer(e))
|
|
263
|
+
handleInfoLeave(); },
|
|
264
|
+
// 이 div 자체는 포커스 대상이 아니지만 안의 Button이 포커스를 받으면
|
|
265
|
+
// focusin이 여기로 올라온다 — 그래서 래퍼에 걸어도 동작한다. 톡으로 온 초점은 톡 토글이 정한다.
|
|
266
|
+
onFocus: () => { if (!recentlyTouched())
|
|
267
|
+
handleInfoEnter(); }, onBlur: handleInfoLeave, children: [_jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "info", variant: "transparent-lightGray", useBorder: false, showTooltipInfo: false,
|
|
268
|
+
/* 아이콘만 있는 버튼이라 이름이 없으면 화면 낭독기가 "버튼"으로만 읽는다.
|
|
269
|
+
한 표에 칸마다 하나씩 있어 열두 개가 다 "버튼"이 된다 — 어느 낱말의
|
|
270
|
+
것인지 알 길이 없으므로 낱말을 이름에 넣는다. */
|
|
271
|
+
ariaLabel: t('wordTable.wordInfo', '{{word}} 낱말 정보', { word: label }), onClick: (e) => { e.stopPropagation(); infoToggle.touchPress(); } }), infoAnchor && infoTooltipItems && (_jsx(DescriptionTooltip, { anchorRect: infoAnchor, items: infoTooltipItems, showIndex: false }))] }))] })] }));
|
|
265
272
|
}
|
|
266
273
|
/**
|
|
267
274
|
* 단어표(표 디자인) — A4 종이를 컨테이너에 맞춰 축소(scale)하고,
|
|
@@ -353,8 +360,8 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
353
360
|
if (to == null)
|
|
354
361
|
return;
|
|
355
362
|
focusTarget.current = null;
|
|
356
|
-
const cells = gridRef.current?.querySelectorAll('.word-
|
|
357
|
-
cells?.[to]?.querySelector('.word-
|
|
363
|
+
const cells = gridRef.current?.querySelectorAll('.word-table__card:not(.word-table__card--filler):not(.word-table__card--base)');
|
|
364
|
+
cells?.[to]?.querySelector('.word-table__card-handle button')?.focus();
|
|
358
365
|
});
|
|
359
366
|
/* 떠날 때 걸어 둔 것을 푼다 — 길게 누르는 중에 팝업이 닫히면 window 리스너와
|
|
360
367
|
타이머가 남아 사라진 화면의 상태를 건드린다(표의 폭 조절에서 겪은 것과 같다). */
|
|
@@ -391,7 +398,7 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
391
398
|
/* 칸 안 단추를 길게 누른 것은 그 단추 몫이다(재생·정보·빼기) — 옮기기 손잡이만 예외.
|
|
392
399
|
안 가르면 발음을 들으려고 꾹 누른 손가락에 칸이 끌려간다. */
|
|
393
400
|
const pressedButton = e.target.closest?.('button');
|
|
394
|
-
if (pressedButton && !pressedButton.closest('.word-
|
|
401
|
+
if (pressedButton && !pressedButton.closest('.word-table__card-handle'))
|
|
395
402
|
return;
|
|
396
403
|
release.current?.();
|
|
397
404
|
const start = { x: e.clientX, y: e.clientY };
|
|
@@ -529,12 +536,12 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
529
536
|
const showTopBand = Boolean(brand?.show) && brand?.top !== false;
|
|
530
537
|
const showBottomBand = Boolean(brand?.show) && brand?.bottom !== false;
|
|
531
538
|
const copyright = brand?.copyright ?? '© IHAB, Inc. All rights reserved.';
|
|
532
|
-
const contentClass = cx('word-
|
|
539
|
+
const contentClass = withLegacy(cx('word-table__content', CUT_CLASS[cutLine], showOutline && 'word-table__content--outline', showDivLine && hasPairs && 'word-table__content--div-line',
|
|
533
540
|
/* 번호가 설 자리를 비운다 — 번호가 없으면 비우지 않는다(표가 공연히 낮아지지 않게) */
|
|
534
|
-
!showBrand && pageNumber && pageNumberPosition !== 'none' && 'word-
|
|
541
|
+
!showBrand && pageNumber && pageNumberPosition !== 'none' && 'word-table__content--page-number',
|
|
535
542
|
/* 띠가 설 자리를 위아래로 비운다 — 같은 까닭으로 띠가 없으면 안 비운다.
|
|
536
543
|
바닥 띠가 쪽 번호 자리를 겸하므로 둘이 겹쳐도 아래는 한 번만 비운다(CSS 가 덮어쓴다). */
|
|
537
|
-
showTopBand && 'word-
|
|
544
|
+
showTopBand && 'word-table__content--brand-top', showBottomBand && 'word-table__content--brand-bottom'));
|
|
538
545
|
// 빈칸(추가버튼)은 스케일 역보정으로 실제 크기 유지
|
|
539
546
|
const counterScale = { transform: `scale(${1 / scale})`, transformOrigin: 'center center' };
|
|
540
547
|
/* **채점 단추는 표와 함께 줄어들면 안 된다.**
|
|
@@ -561,33 +568,42 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
561
568
|
className: cx('word-table', scoring && !canMark && 'word-table--score-readonly', !wrapped && className), style: { width, height, transform: `scale(${scale})`, transformOrigin: 'top left', marginLeft: offset }, children: _jsxs("div", { ref: gridContentRef, className: contentClass, style: {
|
|
562
569
|
gridTemplateColumns: `repeat(${cols}, 1fr)`,
|
|
563
570
|
gridTemplateRows: `repeat(${rows}, 1fr)`,
|
|
564
|
-
}, children: [isEdit ? (_jsx(_Fragment, { children: (editCells ?? []).map((cell, i) => (_jsx("div", { className: cx('word-
|
|
571
|
+
}, children: [isEdit ? (_jsx(_Fragment, { children: (editCells ?? []).map((cell, i) => (_jsx("div", { className: withLegacy(cx('word-table__edit-cell', cell ? 'word-table__edit-cell--filled' : 'word-table__edit-cell--empty', activeCell === i ? 'word-table__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: withLegacy("word-table__pair-divider") }), _jsx(WordCell, { outerScale: scale, label: e.word, subLabel: e.pronunciation,
|
|
565
572
|
// 편집 칸도 구어체 발음을 넘긴다 — 빠져 있어 '구어체 발음'을 켜도 편집 모드에서만 비었다.
|
|
566
|
-
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-
|
|
573
|
+
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: withLegacy("word-table__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 && (
|
|
567
574
|
/* 걸치는 자리는 양쪽이 같은 식이다 — 가로면 왼쪽 `half.cols` 열 × 전체 `half.rows` 줄,
|
|
568
575
|
세로면 전체 `half.cols` 열 × 위 `half.rows` 줄. 둘 다 `1 / span` 으로 같게 적힌다. */
|
|
569
|
-
_jsx("div", { className: "word-
|
|
576
|
+
_jsx("div", { className: withLegacy("word-table__card word-table__card--base"), style: {
|
|
570
577
|
gridColumn: `1 / span ${half.cols}`,
|
|
571
578
|
gridRow: `1 / span ${half.rows}`,
|
|
572
579
|
/* 머리 칸과 나머지 절반을 가르는 점선 — 가로면 오른쪽, 세로면 아래쪽 */
|
|
573
580
|
...dotDashStyle(0, orientation === 'landscape' ? 2 : 1, orientation === 'landscape' ? 1 : 2, cutLine),
|
|
574
|
-
}, children: (baseItem.words ?? []).map((w, wi) => (_jsxs(Fragment, { children: [wi > 0 && _jsx("div", { className: "word-
|
|
581
|
+
}, 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, 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: 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) {
|
|
575
582
|
onReorder(dragIndex.current, index);
|
|
576
|
-
} ; 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-
|
|
577
|
-
/*
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
583
|
+
} ; 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, 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 || onReorder) && (
|
|
584
|
+
/* **오른쪽 기둥** — 빼기 → 부르는 쪽이 얹은 것 → 옮기기 손잡이 차례로 쌓인다
|
|
585
|
+
(말귀 청 (331), 2026-10-28). 전에는 빼기와 얹은 것만 **한 줄**로 서고
|
|
586
|
+
손잡이는 왼쪽 위에 따로 섰다 — 재생 단추와 **같은 자리라 겹쳤다.**
|
|
587
|
+
사장님이 세 번 세로를 이르셔서(2026-09-25 *"핸들은 닫기 버튼 아래에"* ·
|
|
588
|
+
09-27 *"닫기와 핸들 사이"* · 10-12 *"다른 쌍으로 버튼과 정보 버튼이 같은
|
|
589
|
+
높이에"*) 앱이 줄 밖으로 하나씩 꺼내 **숫자로 쌓아** 두었는데, 그 숫자가
|
|
590
|
+
단어표에 맞춘 것이라 끼어들 단추가 없는 표에서 구멍이 났다(활용표: ✕ 밑이
|
|
591
|
+
48px 비고 손잡이만 홀로 내려가 있었다).
|
|
592
|
+
**자리를 수로 못 박지 않는다** — 쌓아서 세우면 몇 개가 들든 붙어 선다. */
|
|
593
|
+
_jsxs("div", { className: withLegacy("word-table__card-actions"), children: [onRemoveItem && (_jsx("div", { className: withLegacy("word-table__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) }) })), renderCellAction?.(index, item), onReorder && (
|
|
594
|
+
/* **옮기기 손잡이.** 키보드로 순서를 바꾸려면 초점이 갈 자리가 있어야 하는데,
|
|
595
|
+
칸 자체를 초점 대상으로 만들면 칸마다 뜻 없는 탭 정지점이 하나씩 늘고
|
|
596
|
+
낭독기는 그것이 무엇인지 말할 수 없다. 이름 붙은 진짜 단추를 둔다 —
|
|
597
|
+
"끌 수 있다"는 것을 눈으로도 알려 주는 몫까지 겸한다.
|
|
598
|
+
기둥 **맨 아래**가 사장님이 이르신 차례다. */
|
|
599
|
+
_jsx("div", { className: withLegacy("word-table__card-handle"), children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "grip-vertical", variant: "transparent-lightGray", useBorder: false, showTooltipInfo: t('wordTable.reorder.hint', 'Alt + ← → 로 순서 바꾸기'),
|
|
600
|
+
/* 표에 손잡이가 열둘이면 "버튼" 만으로는 어느 칸인지 알 길이 없다 — 낱말을 이름에 넣는다 */
|
|
601
|
+
ariaLabel: t('wordTable.reorder.handle', {
|
|
602
|
+
word: (item.words ?? []).map(w => w.label).join(' / '),
|
|
603
|
+
defaultValue: '{{word}} 순서 바꾸기 (Alt + 화살표)',
|
|
604
|
+
}) }) }))] }))] }, index))), Array.from({ length: Math.max(0, itemCols * itemRows - (items?.length ?? 0)) }).map((_, i) => {
|
|
589
605
|
const isWithinCount = (items?.length ?? 0) + i < (addableCount ?? cellCount);
|
|
590
|
-
return (_jsx("div", { className: "word-
|
|
606
|
+
return (_jsx("div", { className: withLegacy("word-table__card word-table__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}`));
|
|
591
607
|
})] })), 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 ?? '말귀' }), (() => {
|
|
592
608
|
/* 표 제목 · 기관 이름 · 표 번호 — 있는 것끼리만 가운뎃점으로 잇는다
|
|
593
609
|
(사용자 지시 2026-09-30). 없는 것 자리에 점이 남으면 안 된다. */
|
|
@@ -607,7 +623,13 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
607
623
|
납작할 때 아래로만 쏠려 보이지 않게. */
|
|
608
624
|
const contents = frameHeight == null ? grid : (_jsx("div", { className: "word-table__frame", style: { height: frameHeight }, children: grid }));
|
|
609
625
|
if (wrapped) {
|
|
610
|
-
return (
|
|
626
|
+
return (
|
|
627
|
+
/* 제목을 주면 `Section` 이 표를 감싼다. 그 테두리의 이름은 **`word-table__section`**
|
|
628
|
+
이다 — 전에는 `word-table-block` 이었는데 그것은 **다른 파일의 다른 컴포넌트**
|
|
629
|
+
(`Word/WordTableBlock.tsx`)의 이름이라, 홀로 선 `<WordTable title=…>` 이 그쪽
|
|
630
|
+
규칙을 함께 받았다(`WordTableBlock.css` 의 `.word-table-block` 은 지금 빈 규칙이라
|
|
631
|
+
탈이 안 났을 뿐이다). 표 그 자체는 안쪽 `.word-table` 이다. */
|
|
632
|
+
_jsx(Section, { type: "page", icon: titleIcon, title: title, disc: disc, className: cx(withLegacy('word-table__section'), className), children: contents }));
|
|
611
633
|
}
|
|
612
634
|
return contents;
|
|
613
635
|
}
|
|
@@ -55,7 +55,7 @@ export interface BarChartProps {
|
|
|
55
55
|
* 줄어든다(2026-09-10 말귀 실측). 이 값은 굵기만 바꾼다. 막대가 많아지면 여기
|
|
56
56
|
* 적은 값을 **위 한계**로 두고 점진 축소하는 것은 그대로다. 아래 한계는 2px(그보다 작은 값은 2 로).
|
|
57
57
|
*
|
|
58
|
-
* CSS 로 덮고 싶으면 `.
|
|
58
|
+
* CSS 로 덮고 싶으면 `.bar-chart__bar`·`-stack` 의 `--bar-width` 를 쓴다 —
|
|
59
59
|
* 굵기는 인라인이 아니라 그 변수로 박혀 있다.
|
|
60
60
|
*/
|
|
61
61
|
barWidth?: number;
|
|
@@ -185,9 +185,9 @@ export function halfGridFor(orientation, count) {
|
|
|
185
185
|
return bestScale > baseScale * 1.05 ? best : base;
|
|
186
186
|
}
|
|
187
187
|
export const CUT_CLASS = {
|
|
188
|
-
show: 'word-
|
|
188
|
+
show: 'word-table__content--cut-show',
|
|
189
189
|
dashed: '',
|
|
190
|
-
corner: 'word-
|
|
190
|
+
corner: 'word-table__content--cut-corner',
|
|
191
191
|
hide: '',
|
|
192
192
|
};
|
|
193
193
|
export const POS_LABEL = {
|
|
@@ -7,7 +7,7 @@ export declare function isTouchPointer(e: {
|
|
|
7
7
|
export declare function recentlyTouched(ms?: number): boolean;
|
|
8
8
|
/**
|
|
9
9
|
* 톡으로 뒤집는 손잡이. `open` 은 지금 열림, `setOpen(next, el)` 은 열기(el 은 앵커)·닫기.
|
|
10
|
-
* `rootRef` 는 트리거를 품은 요소 — 이 밖(툴팁 판 `.
|
|
10
|
+
* `rootRef` 는 트리거를 품은 요소 — 이 밖(툴팁 판 `.tooltip__content` 도 제외)을 톡하면 닫는다.
|
|
11
11
|
*
|
|
12
12
|
* - `touchPress()` — 지금 누름이 이 트리거 위의 **톡**이었으면 뒤집고 true. 켜진 트리거는 click 에서, 막힌 단추(click 이 안 온다)는
|
|
13
13
|
* pointerup 에서 부른다. click 에서 뒤집는 까닭: pointerup 에서 열면 뒤따르는 호환 click 을 툴팁이 "바깥 누름" 으로 받아 곧바로 닫았다.
|
|
@@ -34,7 +34,7 @@ export function recentlyTouched(ms = 1000) {
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* 톡으로 뒤집는 손잡이. `open` 은 지금 열림, `setOpen(next, el)` 은 열기(el 은 앵커)·닫기.
|
|
37
|
-
* `rootRef` 는 트리거를 품은 요소 — 이 밖(툴팁 판 `.
|
|
37
|
+
* `rootRef` 는 트리거를 품은 요소 — 이 밖(툴팁 판 `.tooltip__content` 도 제외)을 톡하면 닫는다.
|
|
38
38
|
*
|
|
39
39
|
* - `touchPress()` — 지금 누름이 이 트리거 위의 **톡**이었으면 뒤집고 true. 켜진 트리거는 click 에서, 막힌 단추(click 이 안 온다)는
|
|
40
40
|
* pointerup 에서 부른다. click 에서 뒤집는 까닭: pointerup 에서 열면 뒤따르는 호환 click 을 툴팁이 "바깥 누름" 으로 받아 곧바로 닫았다.
|
|
@@ -65,7 +65,7 @@ export function useTouchToggle(open, setOpen, rootRef, { enabled = true, fallbac
|
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
openOnPress.current = null;
|
|
68
|
-
if (openRef.current && !(t && t.closest?.('.
|
|
68
|
+
if (openRef.current && !(t && t.closest?.('.tooltip__content')))
|
|
69
69
|
setOpenRef.current(false, root);
|
|
70
70
|
};
|
|
71
71
|
document.addEventListener('pointerdown', onPress, true);
|
|
@@ -15,6 +15,17 @@ export interface WordSearchResultWord {
|
|
|
15
15
|
* (말귀가 활용표를 옮기며 실측 2026-10-27).
|
|
16
16
|
*/
|
|
17
17
|
captionLabel?: string;
|
|
18
|
+
/**
|
|
19
|
+
* 이름표 앞에 서는 **배지** — `captionLabel` 과 한 줄로 낱말 **위**에 선다.
|
|
20
|
+
*
|
|
21
|
+
* 활용표의 이름표가 성격이 다른 둘이 되어서다(말귀 청 (328), 2026-10-28 사장님 지시
|
|
22
|
+
* *"양보 는 badge 로 표현하도록"*). `양보` 는 **무엇을 하는 말인가** — 치료사가 꼴을
|
|
23
|
+
* 고르는 잣대다. `-아/어도` 는 **어떤 꼬리가 붙는가** — 학습자가 낼 소리다. 한 글자로
|
|
24
|
+
* 붙여 놓으면 그 둘이 안 갈린다.
|
|
25
|
+
*
|
|
26
|
+
* 배지만 주거나 이름표만 줘도 된다. 둘 다 없으면 아무것도 안 선다.
|
|
27
|
+
*/
|
|
28
|
+
captionBadge?: string;
|
|
18
29
|
homonum?: number;
|
|
19
30
|
grade?: string;
|
|
20
31
|
syllables?: number;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **이름을 바꾼 CSS 이름 — 옛 이름을 한동안 함께 단다.**
|
|
3
|
+
*
|
|
4
|
+
* 클래스 이름은 공개된 겉면이다. 2026-10-28 실측: 말귀가 `word-table-block__card` 를
|
|
5
|
+
* **19곳**, `manager-section` 을 **19 파일**에서 겨누고 있었다. 그냥 바꾸면 그쪽은 올려
|
|
6
|
+
* 받는 순간 깨진다.
|
|
7
|
+
*
|
|
8
|
+
* 그래서 마디가 **두 이름을 다 들고** 선다 — 코어 CSS 는 새 이름만 쓰고, 앱 CSS 가 겨누던
|
|
9
|
+
* 옛 이름도 그대로 맞는다. 소비자가 다 옮겼다고 알려 오면 여기서 지운다.
|
|
10
|
+
*
|
|
11
|
+
* 규약은 `NAMING.md` 에 있다. `npm run audit:class-names` 가 이 표를 읽어, 여기 적힌
|
|
12
|
+
* 옛 이름은 *"어긋난 것"* 이 아니라 *"떼기로 한 것"* 으로 센다.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* `새 이름 → 옛 이름`. **앞머리**를 적는다 — 뒤에 붙는 조각(`__…`)과 꼴(`--…`)은 그대로
|
|
18
|
+
* 따라온다.
|
|
19
|
+
*
|
|
20
|
+
* ```
|
|
21
|
+
* 'menu-tooltip': 'tooltip-menu'
|
|
22
|
+
* menu-tooltip → tooltip-menu
|
|
23
|
+
* menu-tooltip__header → tooltip-menu__header
|
|
24
|
+
* menu-tooltip--small → tooltip-menu--small
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* 앞머리가 **경계에서 끝날 때만** 맞는다(`__` · `--` · 글 끝). 안 그러면 `tooltip` 이
|
|
28
|
+
* `tooltip-menu` 까지 집어삼킨다. 겹치는 앞머리는 **긴 쪽이 이긴다.**
|
|
29
|
+
*
|
|
30
|
+
* 비어 있는 것이 제자리다. 옛 이름을 단 채로 두는 것은 값이 든다 — 마디마다 클래스가
|
|
31
|
+
* 둘이고, 소스를 읽는 사람이 둘 중 어느 것이 진짜인지 묻게 된다.
|
|
32
|
+
*/
|
|
33
|
+
export declare const RENAMED: Readonly<Record<string, string>>;
|
|
34
|
+
/**
|
|
35
|
+
* 주어진 표에서 이 클래스의 옛 이름을 찾는다. 바뀐 적이 없으면 `null`.
|
|
36
|
+
*
|
|
37
|
+
* 표를 **받아서** 보는 꼴로 둔 것은 셀 수 있게 하려는 것이다 — 아래 `legacyNameOf` 는
|
|
38
|
+
* 지금 표에 든 것만 쓸 수 있는데, *"긴 앞머리가 이긴다"* 같은 결은 지금 표에 겹치는 짝이
|
|
39
|
+
* 없으면 **재 봐도 늘 통과한다**(심어 확인했다: 정렬을 빼도 안 울었다).
|
|
40
|
+
*/
|
|
41
|
+
export declare function legacyNameIn(table: Readonly<Record<string, string>>, cls: string): string | null;
|
|
42
|
+
/** 이 클래스의 옛 이름. 바뀐 적이 없으면 `null`. */
|
|
43
|
+
export declare function legacyNameOf(cls: string): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* 클래스 글에 **옛 이름 쌍둥이**를 덧단다.
|
|
46
|
+
*
|
|
47
|
+
* `'menu-tooltip menu-tooltip--small'`
|
|
48
|
+
* → `'menu-tooltip menu-tooltip--small tooltip-menu tooltip-menu--small'`
|
|
49
|
+
*
|
|
50
|
+
* 표에 칸이 스물넷이면 이 함수가 그만큼 돈다 — 그래서 **바뀐 이름이 하나도 없을 때는
|
|
51
|
+
* 받은 글을 그대로 돌려준다**(표가 비면 아래 `for` 가 한 번도 안 돈다).
|
|
52
|
+
*/
|
|
53
|
+
export declare function withLegacy(className: string): string;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **이름을 바꾼 CSS 이름 — 옛 이름을 한동안 함께 단다.**
|
|
3
|
+
*
|
|
4
|
+
* 클래스 이름은 공개된 겉면이다. 2026-10-28 실측: 말귀가 `word-table-block__card` 를
|
|
5
|
+
* **19곳**, `manager-section` 을 **19 파일**에서 겨누고 있었다. 그냥 바꾸면 그쪽은 올려
|
|
6
|
+
* 받는 순간 깨진다.
|
|
7
|
+
*
|
|
8
|
+
* 그래서 마디가 **두 이름을 다 들고** 선다 — 코어 CSS 는 새 이름만 쓰고, 앱 CSS 가 겨누던
|
|
9
|
+
* 옛 이름도 그대로 맞는다. 소비자가 다 옮겼다고 알려 오면 여기서 지운다.
|
|
10
|
+
*
|
|
11
|
+
* 규약은 `NAMING.md` 에 있다. `npm run audit:class-names` 가 이 표를 읽어, 여기 적힌
|
|
12
|
+
* 옛 이름은 *"어긋난 것"* 이 아니라 *"떼기로 한 것"* 으로 센다.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* `새 이름 → 옛 이름`. **앞머리**를 적는다 — 뒤에 붙는 조각(`__…`)과 꼴(`--…`)은 그대로
|
|
18
|
+
* 따라온다.
|
|
19
|
+
*
|
|
20
|
+
* ```
|
|
21
|
+
* 'menu-tooltip': 'tooltip-menu'
|
|
22
|
+
* menu-tooltip → tooltip-menu
|
|
23
|
+
* menu-tooltip__header → tooltip-menu__header
|
|
24
|
+
* menu-tooltip--small → tooltip-menu--small
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* 앞머리가 **경계에서 끝날 때만** 맞는다(`__` · `--` · 글 끝). 안 그러면 `tooltip` 이
|
|
28
|
+
* `tooltip-menu` 까지 집어삼킨다. 겹치는 앞머리는 **긴 쪽이 이긴다.**
|
|
29
|
+
*
|
|
30
|
+
* 비어 있는 것이 제자리다. 옛 이름을 단 채로 두는 것은 값이 든다 — 마디마다 클래스가
|
|
31
|
+
* 둘이고, 소스를 읽는 사람이 둘 중 어느 것이 진짜인지 묻게 된다.
|
|
32
|
+
*/
|
|
33
|
+
export const RENAMED = {
|
|
34
|
+
/* 2026-10-28, 말투를 뒤집었다 — `MenuTooltip` 이 `.tooltip-menu` 였다. 다섯이 저희끼리는
|
|
35
|
+
한 결이었지만 컴포넌트 이름과 거꾸로라, 클래스만 보고 컴포넌트를 못 찾았다. */
|
|
36
|
+
'menu-tooltip': 'tooltip-menu',
|
|
37
|
+
'description-tooltip': 'tooltip-description',
|
|
38
|
+
'text-box-tooltip': 'tooltip-textbox',
|
|
39
|
+
'training-tooltip': 'tooltip-training',
|
|
40
|
+
'word-image-tooltip': 'tooltip-word-image',
|
|
41
|
+
'info-tooltip': 'tooltip-info',
|
|
42
|
+
'noise-settings-tooltip': 'noise-settings',
|
|
43
|
+
/* `Tooltip` 제 것들 — `-` 로 이어 붙여 **조각인지 블록인지** 알 수 없었다 */
|
|
44
|
+
'tooltip__header': 'tooltip-content__header',
|
|
45
|
+
'tooltip__content': 'tooltip-content',
|
|
46
|
+
'tooltip__backdrop': 'tooltip-backdrop',
|
|
47
|
+
'tooltip__portal': 'tooltip-portal',
|
|
48
|
+
/* 2026-10-28, `WordTable` 이 제 격자·칸을 **다른 컴포넌트 이름**으로 적고 있었다 —
|
|
49
|
+
`word-table-block` 의 임자는 `Word/WordTableBlock.tsx` 다. 실측: 말귀가 이 이름들을
|
|
50
|
+
29곳에서 겨누고 있다(`__card` 19 · `__card-handle` 7 · 나머지 셋). */
|
|
51
|
+
'word-table__section': 'word-table-block',
|
|
52
|
+
'word-table__content': 'word-table-block__content',
|
|
53
|
+
'word-table__card': 'word-table-block__card',
|
|
54
|
+
'word-table__card-handle': 'word-table-block__card-handle',
|
|
55
|
+
'word-table__card-close': 'word-table-block__card-close',
|
|
56
|
+
'word-table__card-actions': 'word-table-block__card-actions',
|
|
57
|
+
'word-table__edit-cell': 'word-table-block__edit-cell',
|
|
58
|
+
'word-table__pair-divider': 'word-table-block__pair-divider',
|
|
59
|
+
/* 2026-10-28, **앱 화면의 말**이 코어에 남아 있었다 — `manager` 는 말귀 어드민의 말이지
|
|
60
|
+
이 라이브러리의 말이 아니다(`NAMING.md` §5). 클래스 30개 · 파일 11개였고, 말귀가
|
|
61
|
+
`manager-section` 을 19 파일에서 겨누고 있다. */
|
|
62
|
+
'chart-section__legend-dot': 'manager-bar-chart-legend-dot',
|
|
63
|
+
'chart-section__legend-item': 'manager-bar-chart-legend-item',
|
|
64
|
+
'chart-section__legend': 'manager-bar-chart-legend',
|
|
65
|
+
'chart-section__controls': 'manager-section-controls',
|
|
66
|
+
'chart-section__sub-row': 'barchart-sub-row',
|
|
67
|
+
'chart-section__total': 'barchart-total',
|
|
68
|
+
'chart-section': 'manager-section',
|
|
69
|
+
'bar-chart__stack-segment': 'manager-bar-chart-stack-segment',
|
|
70
|
+
'bar-chart__detail-btn': 'manager-bar-chart-detail-btn',
|
|
71
|
+
'bar-chart__gridline': 'manager-bar-chart-gridline',
|
|
72
|
+
'bar-chart__loading': 'manager-bar-chart-loading',
|
|
73
|
+
'bar-chart__scroll': 'manager-bar-chart-scroll',
|
|
74
|
+
'bar-chart__stack': 'manager-bar-chart-stack',
|
|
75
|
+
'bar-chart__x-axis': 'manager-bar-chart-x-axis',
|
|
76
|
+
'bar-chart__inner': 'manager-bar-chart-inner',
|
|
77
|
+
'bar-chart__area': 'manager-bar-chart-area',
|
|
78
|
+
'bar-chart__plot': 'manager-bar-chart-plot',
|
|
79
|
+
'bar-chart__wrap': 'manager-bar-chart-wrap',
|
|
80
|
+
'bar-chart__slot': 'manager-bar-chart-slot',
|
|
81
|
+
'bar-chart__col': 'manager-bar-chart-col',
|
|
82
|
+
'bar-chart__bar': 'manager-bar-chart-bar',
|
|
83
|
+
'stat-chart__card': 'manager-stat-card',
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* 주어진 표에서 이 클래스의 옛 이름을 찾는다. 바뀐 적이 없으면 `null`.
|
|
87
|
+
*
|
|
88
|
+
* 표를 **받아서** 보는 꼴로 둔 것은 셀 수 있게 하려는 것이다 — 아래 `legacyNameOf` 는
|
|
89
|
+
* 지금 표에 든 것만 쓸 수 있는데, *"긴 앞머리가 이긴다"* 같은 결은 지금 표에 겹치는 짝이
|
|
90
|
+
* 없으면 **재 봐도 늘 통과한다**(심어 확인했다: 정렬을 빼도 안 울었다).
|
|
91
|
+
*/
|
|
92
|
+
export function legacyNameIn(table, cls) {
|
|
93
|
+
/* 긴 앞머리부터 본다 — `a__b` 가 `a` 보다 먼저 맞아야 `a__b` 의 제 짝으로 간다 */
|
|
94
|
+
const prefixes = Object.keys(table).sort((a, b) => b.length - a.length);
|
|
95
|
+
for (const now of prefixes) {
|
|
96
|
+
if (!cls.startsWith(now))
|
|
97
|
+
continue;
|
|
98
|
+
const rest = cls.slice(now.length);
|
|
99
|
+
/* 경계에서 끝나야 한다 — `tooltip` 이 `tooltip-menu` 를 집어삼키지 않게 */
|
|
100
|
+
if (rest !== '' && !rest.startsWith('__') && !rest.startsWith('--'))
|
|
101
|
+
continue;
|
|
102
|
+
return table[now] + rest;
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
/** 이 클래스의 옛 이름. 바뀐 적이 없으면 `null`. */
|
|
107
|
+
export function legacyNameOf(cls) {
|
|
108
|
+
return legacyNameIn(RENAMED, cls);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 클래스 글에 **옛 이름 쌍둥이**를 덧단다.
|
|
112
|
+
*
|
|
113
|
+
* `'menu-tooltip menu-tooltip--small'`
|
|
114
|
+
* → `'menu-tooltip menu-tooltip--small tooltip-menu tooltip-menu--small'`
|
|
115
|
+
*
|
|
116
|
+
* 표에 칸이 스물넷이면 이 함수가 그만큼 돈다 — 그래서 **바뀐 이름이 하나도 없을 때는
|
|
117
|
+
* 받은 글을 그대로 돌려준다**(표가 비면 아래 `for` 가 한 번도 안 돈다).
|
|
118
|
+
*/
|
|
119
|
+
export function withLegacy(className) {
|
|
120
|
+
if (!className || Object.keys(RENAMED).length === 0)
|
|
121
|
+
return className;
|
|
122
|
+
const extra = [];
|
|
123
|
+
for (const cls of className.split(/\s+/)) {
|
|
124
|
+
if (!cls)
|
|
125
|
+
continue;
|
|
126
|
+
const old = legacyNameOf(cls);
|
|
127
|
+
if (old)
|
|
128
|
+
extra.push(old);
|
|
129
|
+
}
|
|
130
|
+
return extra.length ? `${className} ${extra.join(' ')}` : className;
|
|
131
|
+
}
|