@ihabdevteam/core 0.15.1 → 0.16.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.
@@ -4952,7 +4952,7 @@ export declare const SHORT_STORIES: unknown[];
4952
4952
  * <ShortcutBadge keys={['Ctrl', 'S']} anchor="static" />
4953
4953
  * @public
4954
4954
  */
4955
- export declare function ShortcutBadge({ keys, anchor, className, }: ShortcutBadgeProps): JSX.Element;
4955
+ export declare function ShortcutBadge({ keys, anchor, scale, className, }: ShortcutBadgeProps): JSX.Element;
4956
4956
 
4957
4957
  /** 부모 코너 배치. static 은 흐름 배치. @public */
4958
4958
  export declare type ShortcutBadgeAnchor = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'static';
@@ -4966,6 +4966,17 @@ export declare interface ShortcutBadgeProps {
4966
4966
  * 코너에서 살짝 안쪽으로 들어오게 얹힌다. static 이면 흐름 안에 배치.
4967
4967
  */
4968
4968
  anchor?: ShortcutBadgeAnchor;
4969
+ /**
4970
+ * 배지 크기 배율. 1 이 기본(키캡 한 변 24px).
4971
+ *
4972
+ * 배지는 고정 크기라, 큰 버튼 위에 얹으면 잃어버리고 작은 버튼 위에서는 덮는다.
4973
+ * 그럴 때 부르는 쪽이 정한다.
4974
+ *
4975
+ * **`transform` 으로 키우지 말 것** — 배지가 모서리에 걸치는 `translate` 와 같은
4976
+ * 속성이라 한쪽이 다른 쪽을 통째로 지운다. 이 prop 은 `--shortcut-badge-scale` 로
4977
+ * 내려가고, 자리와 배율은 CSS 한 곳에서 합쳐 적힌다.
4978
+ */
4979
+ scale?: number;
4969
4980
  className?: string;
4970
4981
  }
4971
4982
 
@@ -5108,7 +5119,7 @@ export declare interface SliderProps {
5108
5119
  export declare function sortToValue(key: string, asc: boolean): string | undefined;
5109
5120
 
5110
5121
  /** @public */
5111
- export declare function SoundCompass({ speakers, size, viewT, activeSpeakerId, playedIds, selectedId, answerId, showFeedback, clickable, onSelectSpeaker, buttonSize, showIcon, shortcutAnchor, }: SoundCompassProps): JSX.Element;
5122
+ export declare function SoundCompass({ speakers, size, viewT, activeSpeakerId, playedIds, selectedId, answerId, showFeedback, clickable, onSelectSpeaker, buttonSize, showIcon, shortcutAnchor, shortcutScale, }: SoundCompassProps): JSX.Element;
5112
5123
 
5113
5124
  export declare interface SoundCompassExam {
5114
5125
  /** `<SoundCompass {...bind} />` 로 펼쳐 넣는 제어 props */
@@ -5189,6 +5200,14 @@ export declare interface SoundCompassProps {
5189
5200
  * 배지 전부에 같이 걸린다 — 스피커마다 다른 자리에 두면 눈이 규칙을 못 잡는다.
5190
5201
  */
5191
5202
  shortcutAnchor?: ShortcutBadgeAnchor;
5203
+ /**
5204
+ * 배지 크기 배율. 안 주면 버튼 크기에서 스스로 정한다
5205
+ * (`clamp(0.75, buttonSize / 56, 3)` — 묶이지 않는 동안 버튼 대비 0.43 으로 일정).
5206
+ *
5207
+ * 스스로 정하는 값이 안 맞는 자리가 있다. 상한에 붙으면 더 큰 버튼에서 배지가
5208
+ * 작아지고, 상한을 올려도 다음 소비자가 또 그 끝에서 막힌다. 그럴 때 직접 준다.
5209
+ */
5210
+ shortcutScale?: number;
5192
5211
  }
5193
5212
 
5194
5213
  /**
@@ -10,6 +10,17 @@ export interface ShortcutBadgeProps {
10
10
  * 코너에서 살짝 안쪽으로 들어오게 얹힌다. static 이면 흐름 안에 배치.
11
11
  */
12
12
  anchor?: ShortcutBadgeAnchor;
13
+ /**
14
+ * 배지 크기 배율. 1 이 기본(키캡 한 변 24px).
15
+ *
16
+ * 배지는 고정 크기라, 큰 버튼 위에 얹으면 잃어버리고 작은 버튼 위에서는 덮는다.
17
+ * 그럴 때 부르는 쪽이 정한다.
18
+ *
19
+ * **`transform` 으로 키우지 말 것** — 배지가 모서리에 걸치는 `translate` 와 같은
20
+ * 속성이라 한쪽이 다른 쪽을 통째로 지운다. 이 prop 은 `--shortcut-badge-scale` 로
21
+ * 내려가고, 자리와 배율은 CSS 한 곳에서 합쳐 적힌다.
22
+ */
23
+ scale?: number;
13
24
  className?: string;
14
25
  }
15
26
  /**
@@ -28,4 +39,4 @@ export interface ShortcutBadgeProps {
28
39
  * <ShortcutBadge keys={['Ctrl', 'S']} anchor="static" />
29
40
  * @public
30
41
  */
31
- export default function ShortcutBadge({ keys, anchor, className, }: ShortcutBadgeProps): import("react").JSX.Element;
42
+ export default function ShortcutBadge({ keys, anchor, scale, className, }: ShortcutBadgeProps): import("react").JSX.Element;
@@ -17,7 +17,7 @@ import './ShortcutBadge.css';
17
17
  * <ShortcutBadge keys={['Ctrl', 'S']} anchor="static" />
18
18
  * @public
19
19
  */
20
- export default function ShortcutBadge({ keys, anchor = 'top-right', className = '', }) {
20
+ export default function ShortcutBadge({ keys, anchor = 'top-right', scale, className = '', }) {
21
21
  const list = Array.isArray(keys) ? keys : [keys];
22
- return (_jsx("span", { className: cx('shortcut-badge', `shortcut-badge--${anchor}`, className), children: list.map((key, index) => (_jsxs("span", { className: "shortcut-badge__group", children: [index > 0 && _jsx("span", { className: "shortcut-badge__plus", children: "+" }), _jsx("kbd", { className: "shortcut-badge__key", children: key })] }, `${key}-${index}`))) }));
22
+ return (_jsx("span", { className: cx('shortcut-badge', `shortcut-badge--${anchor}`, className), style: scale === undefined ? undefined : { ['--shortcut-badge-scale']: String(scale) }, children: list.map((key, index) => (_jsxs("span", { className: "shortcut-badge__group", children: [index > 0 && _jsx("span", { className: "shortcut-badge__plus", children: "+" }), _jsx("kbd", { className: "shortcut-badge__key", children: key })] }, `${key}-${index}`))) }));
23
23
  }
@@ -44,6 +44,14 @@ export interface SoundCompassProps {
44
44
  * 배지 전부에 같이 걸린다 — 스피커마다 다른 자리에 두면 눈이 규칙을 못 잡는다.
45
45
  */
46
46
  shortcutAnchor?: ShortcutBadgeAnchor;
47
+ /**
48
+ * 배지 크기 배율. 안 주면 버튼 크기에서 스스로 정한다
49
+ * (`clamp(0.75, buttonSize / 56, 3)` — 묶이지 않는 동안 버튼 대비 0.43 으로 일정).
50
+ *
51
+ * 스스로 정하는 값이 안 맞는 자리가 있다. 상한에 붙으면 더 큰 버튼에서 배지가
52
+ * 작아지고, 상한을 올려도 다음 소비자가 또 그 끝에서 막힌다. 그럴 때 직접 준다.
53
+ */
54
+ shortcutScale?: number;
47
55
  }
48
56
  /** @public */
49
- export default function SoundCompass({ speakers, size, viewT, activeSpeakerId, playedIds, selectedId, answerId, showFeedback, clickable, onSelectSpeaker, buttonSize, showIcon, shortcutAnchor, }: SoundCompassProps): import("react").JSX.Element;
57
+ export default function SoundCompass({ speakers, size, viewT, activeSpeakerId, playedIds, selectedId, answerId, showFeedback, clickable, onSelectSpeaker, buttonSize, showIcon, shortcutAnchor, shortcutScale, }: SoundCompassProps): import("react").JSX.Element;
@@ -14,7 +14,7 @@ import ShortcutBadge from './ShortcutBadge';
14
14
  import './SoundCompass.css';
15
15
  const lerp = (a, b, t) => a + (b - a) * t;
16
16
  /** @public */
17
- export default function SoundCompass({ speakers, size = 300, viewT = 0, activeSpeakerId = null, playedIds, selectedId = null, answerId = null, showFeedback = false, clickable = false, onSelectSpeaker, buttonSize = 40, showIcon = true, shortcutAnchor = 'top-right', }) {
17
+ export default function SoundCompass({ speakers, size = 300, viewT = 0, activeSpeakerId = null, playedIds, selectedId = null, answerId = null, showFeedback = false, clickable = false, onSelectSpeaker, buttonSize = 40, showIcon = true, shortcutAnchor = 'top-right', shortcutScale, }) {
18
18
  const t = Math.max(0, Math.min(1, viewT));
19
19
  const CENTER = size / 2;
20
20
  // ── 탑뷰 좌표 ──────────────────────────────────────────────────────────
@@ -161,9 +161,13 @@ export default function SoundCompass({ speakers, size = 300, viewT = 0, activeSp
161
161
  // 104~168px 을 쓰는 소비 앱에서 배지가 0.37 → 0.23 으로 다시 작아졌다.
162
162
  // 3 이면 168px 까지 묶이지 않는다. 하한 0.75 는 배지가 읽히는 크기다.
163
163
  //
164
+ // 그래도 이 식이 안 맞는 자리는 남는다 — 상한을 올려도 다음 소비자가 또
165
+ // 그 끝에서 막힌다. 그래서 `shortcutScale` 로 직접 줄 수 있게 열어 두고,
166
+ // 안 주면 이 식이 그대로 쓰인다.
167
+ //
164
168
  // 배율은 transform 이 아니라 변수로 넘긴다 — 배지의 anchor 가 같은 속성에
165
169
  // translate 를 걸고 있어, 여기서 transform 을 걸면 그것을 지운다.
166
- ['--shortcut-badge-scale']: String(Math.max(0.75, Math.min(3, buttonSize / 56))),
170
+ ['--shortcut-badge-scale']: String(shortcutScale ?? Math.max(0.75, Math.min(3, buttonSize / 56))),
167
171
  pointerEvents: (clickable ? 'auto' : 'none'),
168
172
  cursor: clickable ? 'pointer' : 'default',
169
173
  // 호출된(=idle이 아닌) 스피커를 다른 스피커 위로 끌어올렸다가, 초기화되면 다시 낮춘다
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ihabdevteam/core",
3
- "version": "0.15.1",
3
+ "version": "0.16.0",
4
4
  "private": false,
5
5
  "main": "dist/ihabdevteam-core.cjs.js",
6
6
  "module": "dist/ihabdevteam-core.esm.js",