@ihabdevteam/core 0.461.0 → 0.462.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 +10 -0
- package/dist/components.cjs.js +177 -177
- 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 +184 -184
- package/dist/ihabdevteam-core.d.ts +63 -8
- package/dist/packages/core/src/components/Alert.d.ts +8 -2
- package/dist/packages/core/src/components/Alert.js +13 -2
- package/dist/packages/core/src/components/Button.js +19 -4
- package/dist/packages/core/src/components/ChartSection.css +3 -1
- package/dist/packages/core/src/components/Report/ReportDocument.css +19 -0
- package/dist/packages/core/src/components/Report/ReportDocument.d.ts +15 -1
- package/dist/packages/core/src/components/Report/ReportDocument.js +16 -3
- package/dist/packages/core/src/components/TextField.css +20 -0
- package/dist/packages/core/src/components/TextField.d.ts +7 -0
- package/dist/packages/core/src/components/TextField.js +3 -3
- package/dist/packages/core/src/components/Training/TrainingPagePopup.js +12 -7
- package/dist/packages/core/src/components/Word/WordTableThumbnail.d.ts +3 -1
- package/dist/packages/core/src/components/Word/WordTableThumbnail.js +2 -2
- package/dist/packages/core/src/components/buttonTypes.d.ts +5 -0
- package/dist/packages/core/src/utils/noiseSettingsStore.d.ts +22 -3
- package/dist/packages/core/src/utils/noiseSettingsStore.js +14 -3
- package/dist/packages/core/src/utils.d.ts +1 -1
- package/dist/packages/core/src/utils.js +1 -1
- package/dist/packages/core/src/version.d.ts +1 -1
- package/dist/packages/core/src/version.js +1 -1
- package/dist/utils.cjs.js +167 -167
- package/package.json +1 -1
|
@@ -86,8 +86,7 @@ export declare interface ActionCardProps {
|
|
|
86
86
|
className?: string;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
export declare function Alert({ tone, title, message, children, dismissible, onDismiss, live, className, }: AlertProps): JSX.Element | null;
|
|
89
|
+
export declare function Alert({ tone, title, message, children, dismissible, onDismiss, live, className, variant, }: AlertProps): JSX.Element | null;
|
|
91
90
|
|
|
92
91
|
/** @public */
|
|
93
92
|
export declare interface AlertProps {
|
|
@@ -106,6 +105,13 @@ export declare interface AlertProps {
|
|
|
106
105
|
*/
|
|
107
106
|
live?: 'assertive' | 'polite' | 'off';
|
|
108
107
|
className?: string;
|
|
108
|
+
/**
|
|
109
|
+
* 꼴 — 기본 `'box'`(아이콘 · 제목 · 닫기). `'bar'` 는 **얇은 알림 막대**다(말귀 청 (463)).
|
|
110
|
+
* `<Badge type="bar" size="medium" fill="soft" variant=… role=…>` 와 **같은 얼굴**로 그린다
|
|
111
|
+
* (아이콘 없음 · 상태 색 글 · 연한 바탕). 제목과 글이 둘 다 오면 이어서 한 줄로 쓴다.
|
|
112
|
+
* 막대에는 닫기 단추가 없다(`dismissible` 은 무시한다).
|
|
113
|
+
*/
|
|
114
|
+
variant?: 'box' | 'bar';
|
|
109
115
|
}
|
|
110
116
|
|
|
111
117
|
/** @public */
|
|
@@ -1119,6 +1125,11 @@ export declare interface ButtonProps {
|
|
|
1119
1125
|
loading?: boolean;
|
|
1120
1126
|
/** label을 숨기려면 false로 설정 */
|
|
1121
1127
|
useLabel?: boolean;
|
|
1128
|
+
/**
|
|
1129
|
+
* 창 폭이 이 값(px) **미만**이면 글을 떼고 아이콘만 남긴다(말귀 청 (461)).
|
|
1130
|
+
* 낭독기 이름은 `ariaLabel` 또는 글 그대로 남는다. 안 주면 폭과 상관없이 글을 그린다.
|
|
1131
|
+
*/
|
|
1132
|
+
labelHiddenBelow?: number;
|
|
1122
1133
|
useBorder?: boolean;
|
|
1123
1134
|
useBG?: boolean;
|
|
1124
1135
|
/** disabled 시 버튼을 배경색으로 가리는 스타일 */
|
|
@@ -2251,7 +2262,7 @@ export declare function copyText(text: string): Promise<boolean>;
|
|
|
2251
2262
|
*
|
|
2252
2263
|
* 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
|
|
2253
2264
|
*/
|
|
2254
|
-
export declare const CORE_VERSION = "0.
|
|
2265
|
+
export declare const CORE_VERSION = "0.462.0";
|
|
2255
2266
|
|
|
2256
2267
|
/** @public */
|
|
2257
2268
|
declare const coreDefault: Record<string, unknown>;
|
|
@@ -5292,9 +5303,18 @@ export declare function loadMyGameRanks(): Promise<Record<string, {
|
|
|
5292
5303
|
rank: number;
|
|
5293
5304
|
}> | null>;
|
|
5294
5305
|
|
|
5295
|
-
/** @public 저장된 소음설정 로드. 미설정/실패 시 null. */
|
|
5306
|
+
/** @public 저장된 소음설정 로드. 미설정/실패 시 null. 실패를 가려 받으려면 `loadNoiseSettingsResult`. */
|
|
5296
5307
|
export declare function loadNoiseSettings(): Promise<Partial<CoreNoiseSettings> | null>;
|
|
5297
5308
|
|
|
5309
|
+
/**
|
|
5310
|
+
* @public 저장된 소음설정 로드 — **못 읽음을 따로 알린다**(말귀 청 (454)).
|
|
5311
|
+
* `failed` 가 참이면 `settings` 는 null 이고, 부르는 쪽은 그 값으로 저장하면 안 된다.
|
|
5312
|
+
*/
|
|
5313
|
+
export declare function loadNoiseSettingsResult(): Promise<{
|
|
5314
|
+
settings: Partial<CoreNoiseSettings> | null;
|
|
5315
|
+
failed: boolean;
|
|
5316
|
+
}>;
|
|
5317
|
+
|
|
5298
5318
|
export declare function loadTrainingData(): Promise<void>;
|
|
5299
5319
|
|
|
5300
5320
|
export declare const LOCALE_STORAGE_KEY = "ihab_display_language";
|
|
@@ -5699,10 +5719,22 @@ export declare function noiseRatioOf(settings: Pick<CoreNoiseSettings, 'level' |
|
|
|
5699
5719
|
noiseRatio?: number;
|
|
5700
5720
|
}): number;
|
|
5701
5721
|
|
|
5722
|
+
/** @public `NoiseSettingsStore.load` 가 '못 읽었다' 를 알리는 꼴. */
|
|
5723
|
+
declare interface NoiseSettingsLoadFailed {
|
|
5724
|
+
failed: true;
|
|
5725
|
+
}
|
|
5726
|
+
|
|
5702
5727
|
/** @public 소음설정 영속 저장소. 앱에서 Supabase 연결을 주입한다. */
|
|
5703
5728
|
export declare interface NoiseSettingsStore {
|
|
5704
|
-
/**
|
|
5705
|
-
|
|
5729
|
+
/**
|
|
5730
|
+
* 현재 훈련 대상(본인 또는 고객)의 저장된 소음설정. 없으면 null.
|
|
5731
|
+
*
|
|
5732
|
+
* **못 읽었으면 던지거나(reject) `{ failed: true }` 를 준다**(말귀 청 (454)). 그러면 그 훈련 창은
|
|
5733
|
+
* 기본값으로 돌되 **그 창에서는 `save` 를 부르지 않는다** — 안 그러면 '기본값 + 바꾼 한 칸' 이
|
|
5734
|
+
* 저장을 통째로 덮어, 맞춰 둔 소음 레벨·종류가 기본값이 된다. 다른 창은 그대로다.
|
|
5735
|
+
* `null` 은 '정한 적 없음' 이다(그때는 기본값으로 시작하고 저장도 한다).
|
|
5736
|
+
*/
|
|
5737
|
+
load: () => Promise<Partial<CoreNoiseSettings> | NoiseSettingsLoadFailed | null>;
|
|
5706
5738
|
/**
|
|
5707
5739
|
* 현재 훈련 대상의 소음설정을 저장(fire-and-forget).
|
|
5708
5740
|
* 훈련 팝업은 판 중 변경(슬라이더 끌기 등)을 **멈춘 뒤 300ms 에 마지막 값만** 넘기고, 떠날 때·pagehide 에 남은 값을 즉시 넘긴다.
|
|
@@ -7858,7 +7890,7 @@ export declare interface ReportBlock {
|
|
|
7858
7890
|
*
|
|
7859
7891
|
* @public
|
|
7860
7892
|
*/
|
|
7861
|
-
export declare function ReportDocument({ blocks, sectionTitles, logo, footer, pageLabel, pageWidth, pageHeight, margin, className, style, }: ReportDocumentProps): JSX.Element;
|
|
7893
|
+
export declare function ReportDocument({ blocks, sectionTitles, logo, footer, pageLabel, pageWidth, pageHeight, margin, className, style, page, zoom, layout, onPageCountChange, }: ReportDocumentProps): JSX.Element;
|
|
7862
7894
|
|
|
7863
7895
|
/** @public */
|
|
7864
7896
|
export declare interface ReportDocumentProps {
|
|
@@ -7886,6 +7918,20 @@ export declare interface ReportDocumentProps {
|
|
|
7886
7918
|
margin?: string;
|
|
7887
7919
|
className?: string;
|
|
7888
7920
|
style?: CSSProperties;
|
|
7921
|
+
/**
|
|
7922
|
+
* 화면에 **이 쪽만** 보인다(1부터 센다, 말귀 청 (460)). 쪽 수를 넘으면 끝 쪽을 보인다.
|
|
7923
|
+
* 인쇄에는 안 따라간다 — 인쇄는 늘 모든 쪽이다. 안 주면 모든 쪽을 보인다.
|
|
7924
|
+
*/
|
|
7925
|
+
page?: number;
|
|
7926
|
+
/** 화면 미리보기 배율(예: `0.8`). 인쇄에는 안 따라간다. @defaultValue `1` */
|
|
7927
|
+
zoom?: number;
|
|
7928
|
+
/**
|
|
7929
|
+
* 화면에서 쪽을 놓는 꼴 — `'stack'` 은 세로로 쌓고, `'spread'` 는 가로로 나란히 놓다
|
|
7930
|
+
* 넘치면 줄을 바꾼다. 인쇄에는 안 따라간다. @defaultValue `'stack'`
|
|
7931
|
+
*/
|
|
7932
|
+
layout?: 'stack' | 'spread';
|
|
7933
|
+
/** 쪽을 다 나눈 뒤 쪽 수를 알린다 — 쪽 넘김 손잡이(`page`)의 끝을 정할 때 쓴다. */
|
|
7934
|
+
onPageCountChange?: (total: number) => void;
|
|
7889
7935
|
}
|
|
7890
7936
|
|
|
7891
7937
|
/** @public */
|
|
@@ -9948,6 +9994,13 @@ export declare interface TextFieldProps {
|
|
|
9948
9994
|
readOnly?: boolean;
|
|
9949
9995
|
/** 에러 메시지 — 설정 시 빨간 테두리 + 에러 텍스트 표시 */
|
|
9950
9996
|
error?: string;
|
|
9997
|
+
/**
|
|
9998
|
+
* 꼴만 바꾸는 상태 — 글 없이 테두리·바탕을 상태 색으로 칠한다(말귀 청 (462)).
|
|
9999
|
+
* `'success'` 는 초록, `'error'` 는 빨강. 끈 칸(`disabled`)에서도 흐려지지 않는다
|
|
10000
|
+
* (맞았다/틀렸다를 보여 주고 칸을 잠그는 자리 — 타자게임 등).
|
|
10001
|
+
* 메시지가 필요하면 `error` 를 쓴다. `aria-invalid` 는 `status="error"` 에도 선다.
|
|
10002
|
+
*/
|
|
10003
|
+
status?: 'success' | 'error';
|
|
9951
10004
|
/** 입력 필드 아래 도움말 텍스트 */
|
|
9952
10005
|
helperText?: string;
|
|
9953
10006
|
/** 최대 글자 수 — 설정 시 글자수 카운터 표시 */
|
|
@@ -14309,9 +14362,11 @@ export declare interface WordTableProps {
|
|
|
14309
14362
|
}
|
|
14310
14363
|
|
|
14311
14364
|
/** @public 단어표 내용 미니 미리보기(그리드 썸네일). */
|
|
14312
|
-
export declare function WordTableThumbnail({ items, className }: {
|
|
14365
|
+
export declare function WordTableThumbnail({ items, className, columns }: {
|
|
14313
14366
|
items: WordSearchResultItem[];
|
|
14314
14367
|
className?: string;
|
|
14368
|
+
/** 칸 열 수. 안 주면 낱말 셋 이하는 1열, 넷 이상은 2열(말귀 청 (459)·(375)). */
|
|
14369
|
+
columns?: number;
|
|
14315
14370
|
}): JSX.Element;
|
|
14316
14371
|
|
|
14317
14372
|
declare interface WordTrainingDataEntry {
|
|
@@ -19,6 +19,12 @@ export interface AlertProps {
|
|
|
19
19
|
*/
|
|
20
20
|
live?: 'assertive' | 'polite' | 'off';
|
|
21
21
|
className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* 꼴 — 기본 `'box'`(아이콘 · 제목 · 닫기). `'bar'` 는 **얇은 알림 막대**다(말귀 청 (463)).
|
|
24
|
+
* `<Badge type="bar" size="medium" fill="soft" variant=… role=…>` 와 **같은 얼굴**로 그린다
|
|
25
|
+
* (아이콘 없음 · 상태 색 글 · 연한 바탕). 제목과 글이 둘 다 오면 이어서 한 줄로 쓴다.
|
|
26
|
+
* 막대에는 닫기 단추가 없다(`dismissible` 은 무시한다).
|
|
27
|
+
*/
|
|
28
|
+
variant?: 'box' | 'bar';
|
|
22
29
|
}
|
|
23
|
-
|
|
24
|
-
export default function Alert({ tone, title, message, children, dismissible, onDismiss, live, className, }: AlertProps): import("react").JSX.Element | null;
|
|
30
|
+
export default function Alert({ tone, title, message, children, dismissible, onDismiss, live, className, variant, }: AlertProps): import("react").JSX.Element | null;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cx } from '../utils/cx';
|
|
4
4
|
import { useCallback, useRef, useState } from 'react';
|
|
5
5
|
import { moveFocusOutside } from '../hooks/focusReturn';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import Icon from './Icon';
|
|
8
|
+
import Badge from './Badge';
|
|
8
9
|
import './Alert.css';
|
|
9
10
|
const TONE_ICON = {
|
|
10
11
|
info: 'info',
|
|
@@ -13,7 +14,14 @@ const TONE_ICON = {
|
|
|
13
14
|
danger: 'alert-circle',
|
|
14
15
|
};
|
|
15
16
|
/** @public */
|
|
16
|
-
|
|
17
|
+
/* 막대 꼴의 색 — Badge 의 variant 이름으로 옮긴다. `info` 는 브랜드색(`main`)이다. */
|
|
18
|
+
const BAR_VARIANT = {
|
|
19
|
+
info: 'main',
|
|
20
|
+
success: 'success',
|
|
21
|
+
warning: 'warning',
|
|
22
|
+
danger: 'danger',
|
|
23
|
+
};
|
|
24
|
+
export default function Alert({ tone = 'info', title, message, children, dismissible = false, onDismiss, live, className = '', variant = 'box', }) {
|
|
17
25
|
const { t } = useTranslation();
|
|
18
26
|
const [dismissed, setDismissed] = useState(false);
|
|
19
27
|
const rootRef = useRef(null);
|
|
@@ -33,5 +41,8 @@ export default function Alert({ tone = 'info', title, message, children, dismiss
|
|
|
33
41
|
const role = liveMode === 'assertive' ? 'alert' : liveMode === 'polite' ? 'status' : undefined;
|
|
34
42
|
const hasTitle = Boolean(title);
|
|
35
43
|
const hasMessage = Boolean(message || children);
|
|
44
|
+
if (variant === 'bar') {
|
|
45
|
+
return (_jsx(Badge, { type: "bar", size: "medium", fill: "soft", variant: BAR_VARIANT[tone], role: role, className: className || undefined, children: hasTitle && hasMessage ? _jsxs(_Fragment, { children: [title, " ", message || children] }) : (title || message || children) }));
|
|
46
|
+
}
|
|
36
47
|
return (_jsxs("div", { ref: rootRef, className: cls, role: role, children: [_jsxs("div", { className: "alert__body", children: [_jsxs("div", { className: "alert__header", children: [_jsx(Icon, { icon: TONE_ICON[tone], size: 20, className: "alert__icon" }), hasTitle && _jsx("span", { className: "alert__title body-2", children: title }), !hasTitle && hasMessage && _jsx("div", { className: "alert__message body-3", children: message || children })] }), hasTitle && hasMessage && (_jsx("div", { className: "alert__message alert__message--indented body-3", children: message || children }))] }), dismissible && (_jsx("button", { type: "button", className: "alert__dismiss", onClick: handleDismiss, "aria-label": t('common.close', '닫기'), children: "\u00D7" }))] }));
|
|
37
48
|
}
|
|
@@ -7,13 +7,14 @@ import './Button.css';
|
|
|
7
7
|
import { useControlSize } from './controlSizeContext';
|
|
8
8
|
import Icon from './Icon';
|
|
9
9
|
import Loader from './Loader';
|
|
10
|
+
import useMediaQuery from '../hooks/useMediaQuery';
|
|
10
11
|
import InfoTooltip from "./Tooltip/InfoTooltip";
|
|
11
12
|
import DescriptionTooltip from "./Tooltip/DescriptionTooltip";
|
|
12
13
|
import { isTouchPointer, recentlyTouched, useTouchToggle } from '../hooks/touchToggle';
|
|
13
14
|
/* **ref 는 forwardRef 로 받는다** — React 19 는 ref 를 props 로 넘기지만 peer 는 16.8~ 라, React 18(kscan) 에서는 함수 컴포넌트에 준
|
|
14
15
|
ref 가 버려진다. 게다가 전에는 안쪽 ref(`btnRef`)가 props 에서 온 ref 를 덮어써 19 에서도 부르는 쪽 ref 가 비었다. 두 ref 를 잇는다. */
|
|
15
16
|
function ButtonInner(props, forwardedRef) {
|
|
16
|
-
const { size: sizeProp, type: explicitType, htmlType, href, target, rel, icon, rightIcon, label: labelProp, count, subLabel, children, ariaLabel, variant = 'default', align = 'center', nowrap = false, ellipsis = false, selected, toggleable = false, ariaExpanded, ariaControls, disabled = false, loading = false, useLabel = true, useBorder = true, useBG = true, useDisabledCovered = false, useDisabledInvisible = false, useDisabledFilled = false, width, minWidth, onClick, onDisabledClick, showTooltipInfo = false, tooltipInfoText = null, tooltipDescription = null, tooltipOnly = false, iconSize = 'medium', iconColor, shape = 'rounded', color, className, ...rest } = props;
|
|
17
|
+
const { size: sizeProp, type: explicitType, htmlType, href, target, rel, icon, rightIcon, label: labelProp, count, subLabel, children, ariaLabel, variant = 'default', align = 'center', nowrap = false, ellipsis = false, selected, toggleable = false, ariaExpanded, ariaControls, disabled = false, loading = false, useLabel = true, labelHiddenBelow, useBorder = true, useBG = true, useDisabledCovered = false, useDisabledInvisible = false, useDisabledFilled = false, width, minWidth, onClick, onDisabledClick, showTooltipInfo = false, tooltipInfoText = null, tooltipDescription = null, tooltipOnly = false, iconSize = 'medium', iconColor, shape = 'rounded', color, className, ...rest } = props;
|
|
17
18
|
/* 안 주면 가장 가까운 판 · 표의 값(말귀 청 (419) 덧) — 테두리 없는 판 48 · 테두리 있는 판과 표 40.
|
|
18
19
|
판 · 표 밖이면 **본래 기본값 48** 그대로다(공용 수 40 을 쓰지 않는다 — 쪽 위 단추가 다 줄어든다). */
|
|
19
20
|
const inheritedSize = useControlSize();
|
|
@@ -272,14 +273,19 @@ function ButtonInner(props, forwardedRef) {
|
|
|
272
273
|
오른쪽 아이콘까지 돌아 **한 단추에 도는 표시가 둘**이 된다. 아이콘이 없는 단추에는
|
|
273
274
|
글자 앞에 세운다 — 그 자리도 기다리고 있기는 마찬가지다. */
|
|
274
275
|
const renderMainIcon = (label) => (loading ? renderSpinner() : renderIcon(icon, label));
|
|
276
|
+
/* 좁은 화면에서 글을 떼는 단추(`labelHiddenBelow`)만 폭을 듣는다 — 단추마다 창 크기를
|
|
277
|
+
구독하면 단추 수만큼 듣는 이가 생긴다. 그래서 그 단추에만 듣는 조각을 따로 세운다. */
|
|
278
|
+
const renderLabel = () => (labelHiddenBelow && labelHiddenBelow > 0
|
|
279
|
+
? _jsx(NarrowHiddenLabel, { below: labelHiddenBelow, className: `button__label ${labelTypoClass}`, children: renderLabelContent() })
|
|
280
|
+
: _jsx("span", { className: `button__label ${labelTypoClass}`, children: renderLabelContent() }));
|
|
275
281
|
const renderContent = () => {
|
|
276
282
|
if (type === 'dot') {
|
|
277
|
-
return (_jsxs(_Fragment, { children: [renderMainIcon(), hasLabel &&
|
|
283
|
+
return (_jsxs(_Fragment, { children: [renderMainIcon(), hasLabel && renderLabel()] }));
|
|
278
284
|
}
|
|
279
285
|
if (align === 'center' && (icon || loading)) {
|
|
280
|
-
return (_jsxs(_Fragment, { children: [_jsxs("span", { className: "button__center-group", children: [_jsx("span", { className: "button__left", children: renderMainIcon() }), hasLabel &&
|
|
286
|
+
return (_jsxs(_Fragment, { children: [_jsxs("span", { className: "button__center-group", children: [_jsx("span", { className: "button__left", children: renderMainIcon() }), hasLabel && renderLabel()] }), hasRight && _jsx("span", { className: "button__right", children: renderIcon(rightIcon) })] }));
|
|
281
287
|
}
|
|
282
|
-
return (_jsxs(_Fragment, { children: [(icon || loading) && _jsx("span", { className: "button__left", children: renderMainIcon(ariaLabel ?? label) }), hasLabel &&
|
|
288
|
+
return (_jsxs(_Fragment, { children: [(icon || loading) && _jsx("span", { className: "button__left", children: renderMainIcon(ariaLabel ?? label) }), hasLabel && renderLabel(), hasRight && _jsx("span", { className: "button__right", children: renderIcon(rightIcon) })] }));
|
|
283
289
|
};
|
|
284
290
|
/* href 가 있고 비활성이 아니면 링크로 렌더한다. */
|
|
285
291
|
const isLink = !!href && !disabledProp;
|
|
@@ -325,3 +331,12 @@ function ButtonInner(props, forwardedRef) {
|
|
|
325
331
|
const Button = forwardRef(ButtonInner);
|
|
326
332
|
Button.displayName = 'Button';
|
|
327
333
|
export default Button;
|
|
334
|
+
/**
|
|
335
|
+
* 창 폭이 `below` 미만이면 글을 **자리째** 뺀다(말귀 청 (461)). 낭독기 이름은 단추의
|
|
336
|
+
* `aria-label`(= `ariaLabel` 또는 글) 이 그대로 들고 있으므로 깎이지 않는다.
|
|
337
|
+
* `display: none` 이라 아이콘과 글 사이 간격도 함께 사라진다.
|
|
338
|
+
*/
|
|
339
|
+
function NarrowHiddenLabel({ below, className, children }) {
|
|
340
|
+
const narrow = useMediaQuery(`(max-width: ${below - 0.02}px)`);
|
|
341
|
+
return _jsx("span", { className: className, style: narrow ? { display: 'none' } : undefined, children: children });
|
|
342
|
+
}
|
|
@@ -55,7 +55,9 @@
|
|
|
55
55
|
cursor: pointer;
|
|
56
56
|
transition: box-shadow 120ms ease, border-color 120ms ease;
|
|
57
57
|
}
|
|
58
|
-
.chart-section--clickable:hover {
|
|
58
|
+
.chart-section--clickable:hover:not(:has(:is(button, a, [role="button"]):hover)) {
|
|
59
|
+
/* 속 단추 위에서는 카드가 안 켜진다 — 단추를 누르면 카드로 가지 않는다(말귀 청 (459)·(374)).
|
|
60
|
+
FilterPanel 머리와 같은 길. */
|
|
59
61
|
border-color: var(--color-main);
|
|
60
62
|
box-shadow: var(--shadow-dropdown);
|
|
61
63
|
}
|
|
@@ -112,6 +112,25 @@
|
|
|
112
112
|
height: calc(var(--report-page-h) - var(--report-margin) * 2);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
/* ── 화면 미리보기 손잡이(말귀 청 (460)) — 모두 `screen` 에만 건다. 인쇄는 늘 모든 쪽 · 1배 · 세로. ── */
|
|
116
|
+
@media screen {
|
|
117
|
+
/* `page` 로 고른 쪽 밖은 화면에서 숨는다 */
|
|
118
|
+
.report-doc__page--off-screen {
|
|
119
|
+
display: none;
|
|
120
|
+
}
|
|
121
|
+
/* 배율 — 안 주면 변수가 없어 1 이다 */
|
|
122
|
+
.report-doc__page {
|
|
123
|
+
zoom: var(--report-zoom, 1);
|
|
124
|
+
}
|
|
125
|
+
/* 나란히 — 넘치면 줄을 바꾼다 */
|
|
126
|
+
.report-doc--spread .report-doc__pages {
|
|
127
|
+
flex-direction: row;
|
|
128
|
+
flex-wrap: wrap;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
align-items: flex-start;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
115
134
|
@media print {
|
|
116
135
|
.report-doc {
|
|
117
136
|
display: block;
|
|
@@ -46,6 +46,20 @@ export interface ReportDocumentProps {
|
|
|
46
46
|
margin?: string;
|
|
47
47
|
className?: string;
|
|
48
48
|
style?: CSSProperties;
|
|
49
|
+
/**
|
|
50
|
+
* 화면에 **이 쪽만** 보인다(1부터 센다, 말귀 청 (460)). 쪽 수를 넘으면 끝 쪽을 보인다.
|
|
51
|
+
* 인쇄에는 안 따라간다 — 인쇄는 늘 모든 쪽이다. 안 주면 모든 쪽을 보인다.
|
|
52
|
+
*/
|
|
53
|
+
page?: number;
|
|
54
|
+
/** 화면 미리보기 배율(예: `0.8`). 인쇄에는 안 따라간다. @defaultValue `1` */
|
|
55
|
+
zoom?: number;
|
|
56
|
+
/**
|
|
57
|
+
* 화면에서 쪽을 놓는 꼴 — `'stack'` 은 세로로 쌓고, `'spread'` 는 가로로 나란히 놓다
|
|
58
|
+
* 넘치면 줄을 바꾼다. 인쇄에는 안 따라간다. @defaultValue `'stack'`
|
|
59
|
+
*/
|
|
60
|
+
layout?: 'stack' | 'spread';
|
|
61
|
+
/** 쪽을 다 나눈 뒤 쪽 수를 알린다 — 쪽 넘김 손잡이(`page`)의 끝을 정할 때 쓴다. */
|
|
62
|
+
onPageCountChange?: (total: number) => void;
|
|
49
63
|
}
|
|
50
64
|
/**
|
|
51
65
|
* 인쇄물처럼 쪽이 나뉘는 보고서 문서.
|
|
@@ -81,4 +95,4 @@ export interface ReportDocumentProps {
|
|
|
81
95
|
*
|
|
82
96
|
* @public
|
|
83
97
|
*/
|
|
84
|
-
export default function ReportDocument({ blocks, sectionTitles, logo, footer, pageLabel, pageWidth, pageHeight, margin, className, style, }: ReportDocumentProps): import("react").JSX.Element;
|
|
98
|
+
export default function ReportDocument({ blocks, sectionTitles, logo, footer, pageLabel, pageWidth, pageHeight, margin, className, style, page, zoom, layout, onPageCountChange, }: ReportDocumentProps): import("react").JSX.Element;
|
|
@@ -41,7 +41,7 @@ const DEFAULT_PAGE_LABEL = (page, total) => `${page} / ${total}`;
|
|
|
41
41
|
*
|
|
42
42
|
* @public
|
|
43
43
|
*/
|
|
44
|
-
export default function ReportDocument({ blocks, sectionTitles, logo, footer, pageLabel = DEFAULT_PAGE_LABEL, pageWidth, pageHeight, margin, className, style, }) {
|
|
44
|
+
export default function ReportDocument({ blocks, sectionTitles, logo, footer, pageLabel = DEFAULT_PAGE_LABEL, pageWidth, pageHeight, margin, className, style, page, zoom, layout = 'stack', onPageCountChange, }) {
|
|
45
45
|
const { t } = useTranslation();
|
|
46
46
|
const rootRef = useRef(null);
|
|
47
47
|
const measureRef = useRef(null);
|
|
@@ -80,6 +80,18 @@ export default function ReportDocument({ blocks, sectionTitles, logo, footer, pa
|
|
|
80
80
|
돌리는 값은 예전과 한 바이트도 다르지 않다. */
|
|
81
81
|
const shape = blocks.map((b) => `${b.id}\u0000${b.section ?? ''}\u0000${b.group ?? ''}`).join('\u0001');
|
|
82
82
|
const pages = measured && measured.shape === shape ? measured.pages : null;
|
|
83
|
+
const pageCount = pages ? pages.length : 0;
|
|
84
|
+
/* 알림은 최신 손잡이로 — 소비자가 렌더마다 새 함수를 줘도 다시 재지 않는다 */
|
|
85
|
+
const onPageCountRef = useRef(onPageCountChange);
|
|
86
|
+
onPageCountRef.current = onPageCountChange;
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (pageCount > 0)
|
|
89
|
+
onPageCountRef.current?.(pageCount);
|
|
90
|
+
}, [pageCount]);
|
|
91
|
+
/* 보일 쪽(0부터) — 안 주면 null(모두). 넘으면 끝 쪽, 1 아래면 첫 쪽 */
|
|
92
|
+
const shownIndex = page != null && pageCount > 0
|
|
93
|
+
? Math.min(pageCount, Math.max(1, Math.floor(page))) - 1
|
|
94
|
+
: null;
|
|
83
95
|
/* 자(ruler)의 높이 — 0 에서 크기가 생기면(숨겨져 있다 보이게 됨) 다시 잰다 */
|
|
84
96
|
const [rulerSize, setRulerSize] = useState(0);
|
|
85
97
|
useEffect(() => {
|
|
@@ -203,9 +215,10 @@ export default function ReportDocument({ blocks, sectionTitles, logo, footer, pa
|
|
|
203
215
|
...(pageWidth ? { '--report-page-w': pageWidth } : null),
|
|
204
216
|
...(pageHeight ? { '--report-page-h': pageHeight } : null),
|
|
205
217
|
...(margin ? { '--report-margin': margin } : null),
|
|
218
|
+
...(zoom != null && zoom > 0 && zoom !== 1 ? { '--report-zoom': String(zoom) } : null),
|
|
206
219
|
...style,
|
|
207
220
|
};
|
|
208
|
-
return (_jsxs("div", { ref: rootRef, className: cx('report-doc', className), style: vars,
|
|
221
|
+
return (_jsxs("div", { ref: rootRef, className: cx('report-doc', layout === 'spread' && 'report-doc--spread', className), style: vars,
|
|
209
222
|
/* 굴릴 것이 있을 때만 포커스를 받는다. 이름 없이 포커스만 주면 낭독기가
|
|
210
223
|
문서 전체를 읽어 버리므로 역할과 이름을 함께 준다. */
|
|
211
224
|
tabIndex: overflowing ? 0 : undefined, role: overflowing ? 'group' : undefined, "aria-label": overflowing ? t('report.previewRegion', '보고서 미리보기') : undefined, children: [_jsxs("div", { className: "report-doc__measure", "aria-hidden": true, children: [_jsx("div", { ref: rulerRef, className: "report-doc__ruler" }), _jsx("div", { ref: chromeRef, children: chromeSections.map((sec) => {
|
|
@@ -213,6 +226,6 @@ export default function ReportDocument({ blocks, sectionTitles, logo, footer, pa
|
|
|
213
226
|
return _jsxs("div", { "data-chrome-section": sec, children: [c.header, c.footer] }, sec);
|
|
214
227
|
}) }), _jsx("div", { ref: measureRef, className: "report-doc__measure-blocks", children: blocks.map((b) => (_jsx("div", { children: b.content }, b.id))) })] }), pages && (_jsx("div", { className: "report-doc__pages", children: pages.map((idxs, p) => {
|
|
215
228
|
const { header, footer: pageFooter } = chrome(p + 1, pages.length, blocks[idxs[0]].section);
|
|
216
|
-
return (_jsxs("section", { className:
|
|
229
|
+
return (_jsxs("section", { className: cx('report-doc__page', shownIndex != null && shownIndex !== p && 'report-doc__page--off-screen'), children: [header, idxs.map((i) => (_jsx("div", { children: blocks[i].content }, blocks[i].id))), pageFooter] }, p));
|
|
217
230
|
}) }))] }));
|
|
218
231
|
}
|
|
@@ -79,6 +79,26 @@
|
|
|
79
79
|
opacity: 0.5;
|
|
80
80
|
cursor: not-allowed;
|
|
81
81
|
}
|
|
82
|
+
/* 꼴만 바꾸는 상태(말귀 청 (462)) — 테두리·바탕을 상태 색으로. 끈 칸에서도 흐려지지 않는다:
|
|
83
|
+
맞았다/틀렸다를 보여 주고 칸을 잠그는 자리라 흐리면 결과가 안 읽힌다. */
|
|
84
|
+
.text-field--status-success .text-field__wrap {
|
|
85
|
+
border-color: var(--color-success);
|
|
86
|
+
background: color-mix(in srgb, var(--color-success) 8%, var(--color-white));
|
|
87
|
+
}
|
|
88
|
+
.text-field--status-error .text-field__wrap {
|
|
89
|
+
border-color: var(--color-error);
|
|
90
|
+
background: color-mix(in srgb, var(--color-error) 8%, var(--color-white));
|
|
91
|
+
}
|
|
92
|
+
.text-field--status-success .text-field__wrap:focus-within {
|
|
93
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success) 10%, transparent);
|
|
94
|
+
}
|
|
95
|
+
.text-field--status-error .text-field__wrap:focus-within {
|
|
96
|
+
box-shadow: 0 0 0 3px var(--color-error-a10);
|
|
97
|
+
}
|
|
98
|
+
.text-field--disabled.text-field--status-success .text-field__wrap,
|
|
99
|
+
.text-field--disabled.text-field--status-error .text-field__wrap {
|
|
100
|
+
opacity: 1;
|
|
101
|
+
}
|
|
82
102
|
/* 읽기 전용은 마우스 클릭·텍스트 선택 불가, 보더 제거.
|
|
83
103
|
키보드 포커스(Tab)는 닿는다 — 값을 낭독기로 들을 수 있어야 한다(TextField.tsx 참고). */
|
|
84
104
|
.text-field--readonly .text-field__input {
|
|
@@ -56,6 +56,13 @@ export interface TextFieldProps {
|
|
|
56
56
|
readOnly?: boolean;
|
|
57
57
|
/** 에러 메시지 — 설정 시 빨간 테두리 + 에러 텍스트 표시 */
|
|
58
58
|
error?: string;
|
|
59
|
+
/**
|
|
60
|
+
* 꼴만 바꾸는 상태 — 글 없이 테두리·바탕을 상태 색으로 칠한다(말귀 청 (462)).
|
|
61
|
+
* `'success'` 는 초록, `'error'` 는 빨강. 끈 칸(`disabled`)에서도 흐려지지 않는다
|
|
62
|
+
* (맞았다/틀렸다를 보여 주고 칸을 잠그는 자리 — 타자게임 등).
|
|
63
|
+
* 메시지가 필요하면 `error` 를 쓴다. `aria-invalid` 는 `status="error"` 에도 선다.
|
|
64
|
+
*/
|
|
65
|
+
status?: 'success' | 'error';
|
|
59
66
|
/** 입력 필드 아래 도움말 텍스트 */
|
|
60
67
|
helperText?: string;
|
|
61
68
|
/** 최대 글자 수 — 설정 시 글자수 카운터 표시 */
|
|
@@ -15,7 +15,7 @@ import { useControlSize } from './controlSizeContext';
|
|
|
15
15
|
import { CONTROL_SIZE } from './controlSize';
|
|
16
16
|
/** @public */
|
|
17
17
|
export default function TextField(props) {
|
|
18
|
-
const { value, defaultValue, name, inputRef, onChange, label, ariaLabel, ariaDescribedBy, required, placeholder, ghostText, ghostHint, type = 'text', disabled = false, readOnly = false, error, helperText, maxLength,
|
|
18
|
+
const { value, defaultValue, name, inputRef, onChange, label, ariaLabel, ariaDescribedBy, required, placeholder, ghostText, ghostHint, type = 'text', disabled = false, readOnly = false, error, status, helperText, maxLength,
|
|
19
19
|
/* **기본은 40이다**(사장님 지시 2026-10-25, 말귀 청 (405)) — 같은 줄에 서는 다른
|
|
20
20
|
조작기가 40이다(세그먼트 단추·줄 옆 `Button`). 글자 칸만 48이라 수를 받는 줄이
|
|
21
21
|
토글 줄보다 눈에 띄게 깊었다(실측: 그 줄 80px ↔ 토글 줄 56px → 72px 로 좁혀짐).
|
|
@@ -196,7 +196,7 @@ export default function TextField(props) {
|
|
|
196
196
|
}, [value, innerLen, newline]);
|
|
197
197
|
const isOver = maxLength != null && len > maxLength;
|
|
198
198
|
const iconSize = size === 32 ? 16 : 20;
|
|
199
|
-
const cls = cx('text-field', `text-field--s${size}`, variant === 'display' ? 'text-field--display' : '', fullWidth ? 'text-field--full-width' : '', disabled ? 'text-field--disabled' : '', readOnly ? 'text-field--readonly' : '', error ? 'text-field--error' : '', leftIcon ? 'text-field--has-left-icon' : '', (rightIcon || clearable || canReveal) ? 'text-field--has-right-icon' : '', className);
|
|
199
|
+
const cls = cx('text-field', `text-field--s${size}`, variant === 'display' ? 'text-field--display' : '', fullWidth ? 'text-field--full-width' : '', disabled ? 'text-field--disabled' : '', readOnly ? 'text-field--readonly' : '', error ? 'text-field--error' : '', status ? `text-field--status-${status}` : '', leftIcon ? 'text-field--has-left-icon' : '', (rightIcon || clearable || canReveal) ? 'text-field--has-right-icon' : '', className);
|
|
200
200
|
const sharedInputProps = {
|
|
201
201
|
id: inputId,
|
|
202
202
|
// controlled면 value, uncontrolled면 defaultValue (IME 조합 충돌 회피)
|
|
@@ -219,7 +219,7 @@ export default function TextField(props) {
|
|
|
219
219
|
autoCorrect,
|
|
220
220
|
'aria-label': !label && ariaLabel ? ariaLabel : undefined,
|
|
221
221
|
'aria-required': required,
|
|
222
|
-
'aria-invalid': !!error,
|
|
222
|
+
'aria-invalid': !!error || status === 'error',
|
|
223
223
|
/* 안의 것(helperText·error)과 바깥의 것(ariaDescribedBy)을 **잇는다** — 둘 중 하나로
|
|
224
224
|
덮으면 오류가 뜬 순간 바깥 도움말이 사라지거나, 반대로 오류가 안 읽힌다. */
|
|
225
225
|
'aria-describedby': [(helperText || error) ? helperId : null, ariaDescribedBy].filter(Boolean).join(' ') || undefined,
|
|
@@ -25,7 +25,7 @@ import TrainingResultPopup from '../Popup/TrainingResultPopup';
|
|
|
25
25
|
import useTrainingSessionLog from '../../hooks/useTrainingSessionLog';
|
|
26
26
|
import { logTrainingCompletion } from '../../utils/trainingLogger';
|
|
27
27
|
import { toItemResults } from '../../utils/trainingItemResults';
|
|
28
|
-
import {
|
|
28
|
+
import { loadNoiseSettingsResult, saveNoiseSettings, reportAppliedNoiseSettings } from '../../utils/noiseSettingsStore';
|
|
29
29
|
/** 판 중 소음 설정 변경을 저장하기 전 기다리는 시간(ms) — 멈춘 뒤 이만큼 지나면 마지막 값만 저장한다. */
|
|
30
30
|
const NOISE_SAVE_DEBOUNCE_MS = 300;
|
|
31
31
|
/* 움직임 최소화면 닫힘 대기를 0 으로 — 사라지는 애니메이션을 보여 줄 까닭이 없다. (공용 훅이 생기면 그것으로 합친다.) */
|
|
@@ -174,6 +174,9 @@ function TrainingPagePopupInner(props) {
|
|
|
174
174
|
남아 다음 판부터 소음이 안 났다) 늦게 온 불러오기가 그 변경을 다시 덮었다. */
|
|
175
175
|
const noiseLoadedRef = useRef(false);
|
|
176
176
|
const pendingNoiseRef = useRef(null);
|
|
177
|
+
/* **못 읽은 창은 저장하지 않는다**(말귀 청 (454)) — 기본값으로 돌되, 여기서 바꾼 한 칸을 저장하면
|
|
178
|
+
'기본값 + 그 한 칸' 이 맞춰 둔 소음 설정을 통째로 덮는다. 창마다 따로 쥔다(다른 창은 그대로). */
|
|
179
|
+
const noiseLoadFailedRef = useRef(false);
|
|
177
180
|
// 계정/고객 저장소에서 초기값 로드 (앱이 configureNoiseSettingsStore로 주입)
|
|
178
181
|
useEffect(() => {
|
|
179
182
|
let cancelled = false;
|
|
@@ -190,7 +193,7 @@ function TrainingPagePopupInner(props) {
|
|
|
190
193
|
const merged = pending ? mergeNoiseSettings(loaded, pending) : loaded;
|
|
191
194
|
noiseSettingsRef.current = merged;
|
|
192
195
|
setNoisePart(merged);
|
|
193
|
-
if (pending && !noiseOverrideRef.current)
|
|
196
|
+
if (pending && !noiseOverrideRef.current && !noiseLoadFailedRef.current)
|
|
194
197
|
saveNoiseSettings(merged);
|
|
195
198
|
reportAppliedNoiseSettings(merged);
|
|
196
199
|
// override 는 병합이 끝난 **뒤에** 덮는다 — 로드가 늦게 와도 override 가 이긴다.
|
|
@@ -203,13 +206,15 @@ function TrainingPagePopupInner(props) {
|
|
|
203
206
|
reportAppliedNoiseSettings(applied);
|
|
204
207
|
}
|
|
205
208
|
};
|
|
206
|
-
void
|
|
209
|
+
void loadNoiseSettingsResult().then(({ settings: saved, failed }) => {
|
|
210
|
+
if (failed)
|
|
211
|
+
noiseLoadFailedRef.current = true;
|
|
207
212
|
if (cancelled) {
|
|
208
213
|
// 초기 로드를 기다리던 사이 창이 닫혀도, 그 전에 사용자가 바꾼 값은
|
|
209
214
|
// 저장값 위에 병합해 남긴다. 로드 전 기본 enabled:false 를 그대로 저장하지 않는다.
|
|
210
215
|
const pending = pendingNoiseRef.current;
|
|
211
216
|
pendingNoiseRef.current = null;
|
|
212
|
-
if (pending && !noiseOverrideRef.current) {
|
|
217
|
+
if (pending && !noiseOverrideRef.current && !failed) {
|
|
213
218
|
const loaded = saved ? mergeNoiseSettings({ ...DEFAULT_NOISE_SETTINGS, enabled: false }, saved) : { ...DEFAULT_NOISE_SETTINGS };
|
|
214
219
|
saveNoiseSettings(mergeNoiseSettings(loaded, pending));
|
|
215
220
|
}
|
|
@@ -239,7 +244,7 @@ function TrainingPagePopupInner(props) {
|
|
|
239
244
|
}
|
|
240
245
|
const pending = pendingSaveRef.current;
|
|
241
246
|
pendingSaveRef.current = null;
|
|
242
|
-
if (pending)
|
|
247
|
+
if (pending && !noiseLoadFailedRef.current)
|
|
243
248
|
saveNoiseSettings(pending);
|
|
244
249
|
}, []);
|
|
245
250
|
useEffect(() => {
|
|
@@ -266,8 +271,8 @@ function TrainingPagePopupInner(props) {
|
|
|
266
271
|
reportAppliedNoiseSettings(merged);
|
|
267
272
|
return;
|
|
268
273
|
}
|
|
269
|
-
// noiseOverride 판은 저장하지 않는다 — 판 중에 바꾼 것도 이 판에만.
|
|
270
|
-
if (!noiseOverrideRef.current) {
|
|
274
|
+
// noiseOverride 판은 저장하지 않는다 — 판 중에 바꾼 것도 이 판에만. 못 읽은 창도 저장하지 않는다(454).
|
|
275
|
+
if (!noiseOverrideRef.current && !noiseLoadFailedRef.current) {
|
|
271
276
|
pendingSaveRef.current = merged;
|
|
272
277
|
if (saveTimerRef.current !== null)
|
|
273
278
|
clearTimeout(saveTimerRef.current);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { WordSearchResultItem } from '../../types/wordSearch';
|
|
2
2
|
import './WordTableThumbnail.css';
|
|
3
3
|
/** @public 단어표 내용 미니 미리보기(그리드 썸네일). */
|
|
4
|
-
export default function WordTableThumbnail({ items, className }: {
|
|
4
|
+
export default function WordTableThumbnail({ items, className, columns }: {
|
|
5
5
|
items: WordSearchResultItem[];
|
|
6
6
|
className?: string;
|
|
7
|
+
/** 칸 열 수. 안 주면 낱말 셋 이하는 1열, 넷 이상은 2열(말귀 청 (459)·(375)). */
|
|
8
|
+
columns?: number;
|
|
7
9
|
}): import("react").JSX.Element;
|
|
@@ -40,7 +40,7 @@ import './WordTableThumbnail.css';
|
|
|
40
40
|
*/
|
|
41
41
|
const MAX_THUMB_CELLS = 8;
|
|
42
42
|
/** @public 단어표 내용 미니 미리보기(그리드 썸네일). */
|
|
43
|
-
export default function WordTableThumbnail({ items, className }) {
|
|
43
|
+
export default function WordTableThumbnail({ items, className, columns }) {
|
|
44
44
|
const { t } = useTranslation();
|
|
45
45
|
const moreRef = useRef(null);
|
|
46
46
|
const [moreAnchor, setMoreAnchor] = useState(null);
|
|
@@ -54,7 +54,7 @@ export default function WordTableThumbnail({ items, className }) {
|
|
|
54
54
|
closeMore(); }, moreRef);
|
|
55
55
|
const n = items.length;
|
|
56
56
|
// 3개 이하는 세로 1열(빈칸 없이 3개가 세로로), 4개 이상은 2열
|
|
57
|
-
const cols = n <= 3 ? 1 : 2;
|
|
57
|
+
const cols = columns && columns > 0 ? Math.floor(columns) : (n <= 3 ? 1 : 2);
|
|
58
58
|
/* 넘치면 마지막 한 칸을 `+N` 에 내준다 — 앞 칸들을 보이고 끝 칸이 "그 밖 몇" 이다 */
|
|
59
59
|
const cap = MAX_THUMB_CELLS;
|
|
60
60
|
const over = n > cap;
|
|
@@ -148,6 +148,11 @@ export interface ButtonProps {
|
|
|
148
148
|
loading?: boolean;
|
|
149
149
|
/** label을 숨기려면 false로 설정 */
|
|
150
150
|
useLabel?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* 창 폭이 이 값(px) **미만**이면 글을 떼고 아이콘만 남긴다(말귀 청 (461)).
|
|
153
|
+
* 낭독기 이름은 `ariaLabel` 또는 글 그대로 남는다. 안 주면 폭과 상관없이 글을 그린다.
|
|
154
|
+
*/
|
|
155
|
+
labelHiddenBelow?: number;
|
|
151
156
|
useBorder?: boolean;
|
|
152
157
|
useBG?: boolean;
|
|
153
158
|
/** disabled 시 버튼을 배경색으로 가리는 스타일 */
|
|
@@ -8,10 +8,21 @@
|
|
|
8
8
|
* 앱이 주입한 콜백 내부에서 현재 훈련 대상에 따라 결정한다.
|
|
9
9
|
*/
|
|
10
10
|
import type { CoreNoiseSettings } from '../types/training';
|
|
11
|
+
/** @public `NoiseSettingsStore.load` 가 '못 읽었다' 를 알리는 꼴. */
|
|
12
|
+
export interface NoiseSettingsLoadFailed {
|
|
13
|
+
failed: true;
|
|
14
|
+
}
|
|
11
15
|
/** @public 소음설정 영속 저장소. 앱에서 Supabase 연결을 주입한다. */
|
|
12
16
|
export interface NoiseSettingsStore {
|
|
13
|
-
/**
|
|
14
|
-
|
|
17
|
+
/**
|
|
18
|
+
* 현재 훈련 대상(본인 또는 고객)의 저장된 소음설정. 없으면 null.
|
|
19
|
+
*
|
|
20
|
+
* **못 읽었으면 던지거나(reject) `{ failed: true }` 를 준다**(말귀 청 (454)). 그러면 그 훈련 창은
|
|
21
|
+
* 기본값으로 돌되 **그 창에서는 `save` 를 부르지 않는다** — 안 그러면 '기본값 + 바꾼 한 칸' 이
|
|
22
|
+
* 저장을 통째로 덮어, 맞춰 둔 소음 레벨·종류가 기본값이 된다. 다른 창은 그대로다.
|
|
23
|
+
* `null` 은 '정한 적 없음' 이다(그때는 기본값으로 시작하고 저장도 한다).
|
|
24
|
+
*/
|
|
25
|
+
load: () => Promise<Partial<CoreNoiseSettings> | NoiseSettingsLoadFailed | null>;
|
|
15
26
|
/**
|
|
16
27
|
* 현재 훈련 대상의 소음설정을 저장(fire-and-forget).
|
|
17
28
|
* 훈련 팝업은 판 중 변경(슬라이더 끌기 등)을 **멈춘 뒤 300ms 에 마지막 값만** 넘기고, 떠날 때·pagehide 에 남은 값을 즉시 넘긴다.
|
|
@@ -29,8 +40,16 @@ export interface NoiseSettingsStore {
|
|
|
29
40
|
}
|
|
30
41
|
/** @public */
|
|
31
42
|
export declare function configureNoiseSettingsStore(store: NoiseSettingsStore | null): void;
|
|
32
|
-
/** @public 저장된 소음설정 로드. 미설정/실패 시 null. */
|
|
43
|
+
/** @public 저장된 소음설정 로드. 미설정/실패 시 null. 실패를 가려 받으려면 `loadNoiseSettingsResult`. */
|
|
33
44
|
export declare function loadNoiseSettings(): Promise<Partial<CoreNoiseSettings> | null>;
|
|
45
|
+
/**
|
|
46
|
+
* @public 저장된 소음설정 로드 — **못 읽음을 따로 알린다**(말귀 청 (454)).
|
|
47
|
+
* `failed` 가 참이면 `settings` 는 null 이고, 부르는 쪽은 그 값으로 저장하면 안 된다.
|
|
48
|
+
*/
|
|
49
|
+
export declare function loadNoiseSettingsResult(): Promise<{
|
|
50
|
+
settings: Partial<CoreNoiseSettings> | null;
|
|
51
|
+
failed: boolean;
|
|
52
|
+
}>;
|
|
34
53
|
/** @public 소음설정 저장(fire-and-forget). */
|
|
35
54
|
export declare function saveNoiseSettings(settings: CoreNoiseSettings): void;
|
|
36
55
|
/**
|
|
@@ -1,17 +1,28 @@
|
|
|
1
|
+
const isFailed = (v) => !!v && typeof v === 'object' && v.failed === true;
|
|
1
2
|
const g = globalThis;
|
|
2
3
|
/** @public */
|
|
3
4
|
export function configureNoiseSettingsStore(store) {
|
|
4
5
|
g.__ihabNoiseSettingsStore = store;
|
|
5
6
|
}
|
|
6
|
-
/** @public 저장된 소음설정 로드. 미설정/실패 시 null. */
|
|
7
|
+
/** @public 저장된 소음설정 로드. 미설정/실패 시 null. 실패를 가려 받으려면 `loadNoiseSettingsResult`. */
|
|
7
8
|
export async function loadNoiseSettings() {
|
|
9
|
+
return (await loadNoiseSettingsResult()).settings;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @public 저장된 소음설정 로드 — **못 읽음을 따로 알린다**(말귀 청 (454)).
|
|
13
|
+
* `failed` 가 참이면 `settings` 는 null 이고, 부르는 쪽은 그 값으로 저장하면 안 된다.
|
|
14
|
+
*/
|
|
15
|
+
export async function loadNoiseSettingsResult() {
|
|
8
16
|
try {
|
|
9
|
-
|
|
17
|
+
const v = await g.__ihabNoiseSettingsStore?.load();
|
|
18
|
+
if (isFailed(v))
|
|
19
|
+
return { settings: null, failed: true };
|
|
20
|
+
return { settings: v ?? null, failed: false };
|
|
10
21
|
}
|
|
11
22
|
catch (e) {
|
|
12
23
|
if (import.meta.env?.DEV)
|
|
13
24
|
console.warn('[noiseSettingsStore] load', e);
|
|
14
|
-
return null;
|
|
25
|
+
return { settings: null, failed: true };
|
|
15
26
|
}
|
|
16
27
|
}
|
|
17
28
|
/** @public 소음설정 저장(fire-and-forget). */
|