@ihabdevteam/core 0.423.0 → 0.424.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.
@@ -0,0 +1,250 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useId } from 'react';
4
+ import { cx } from '../utils/cx';
5
+ import { devWarnOnce } from '../utils/devWarn';
6
+ import './HeroVisual.css';
7
+ /** 제 자리에서 계속 도는 움직임 — 숨·떨림·떠다님 */
8
+ function spin(name, seconds, delay = 0) {
9
+ return { animation: `hero-visual-${name} ${seconds}s ease-in-out ${delay}s infinite` };
10
+ }
11
+ /**
12
+ * **들고 나는 움직임** — 한 바퀴와 같은 시간을 쓴다.
13
+ *
14
+ * `turn` 은 **차례**다(한 바퀴에 대한 비율). 조각이 여럿인 꼴에서 0.03 씩 밀면 하나씩
15
+ * 돋는 것으로 보인다. `backwards` 가 있어야 제 차례 전에는 "아직 안 나온 모습" 으로
16
+ * 선다 — 없으면 기다리는 동안 **다 그려진 채로** 있다가 갑자기 사라진다.
17
+ */
18
+ function enter(name, opts = {}) {
19
+ return {
20
+ className: `hero-visual__in hero-visual__in--${name}`,
21
+ style: {
22
+ transformOrigin: opts.origin,
23
+ '--hero-visual-turn': opts.turn ?? 0,
24
+ ...opts.vars,
25
+ },
26
+ };
27
+ }
28
+ /** 선이 제 손으로 그어지게 한다 — 길이에 안 매이도록 `pathLength` 를 1 로 둔다 */
29
+ const DRAWN = { pathLength: 1, strokeDasharray: '1 1' };
30
+ /** 제자리에서 커지거나 도는 것은 **제 중심**을 축으로 삼아야 한다 */
31
+ const SELF = { transformBox: 'fill-box', transformOrigin: 'center' };
32
+ /** 브랜드에서 끌어낸 한 줄기 — 1 이 가장 짙고 6 이 가장 옅다(`HeroVisual.css` 머리말) */
33
+ const C = {
34
+ c1: 'var(--hero-visual-1)',
35
+ c2: 'var(--hero-visual-2)',
36
+ c3: 'var(--hero-visual-3)',
37
+ c4: 'var(--hero-visual-4)',
38
+ c5: 'var(--hero-visual-5)',
39
+ c6: 'var(--hero-visual-6)',
40
+ };
41
+ const RAMP = [C.c1, C.c2, C.c3, C.c4, C.c5, C.c6];
42
+ /** 원 위에 고르게 놓는다 — 0도는 오른쪽, 시계 방향(SVG 는 y 가 아래로 자란다) */
43
+ function around(cx, cy, radius, count) {
44
+ return Array.from({ length: count }, (_, i) => {
45
+ const a = (i / count) * Math.PI * 2;
46
+ return { x: cx + radius * Math.cos(a), y: cy + radius * Math.sin(a) };
47
+ });
48
+ }
49
+ const ART = {
50
+ /* **피어난다** — 가운데에서 커지며 서고, 번지며 걷힌다 */
51
+ blobs: {
52
+ viewBox: '0 20 660 660',
53
+ width: 660,
54
+ height: 660,
55
+ render: (u) => (_jsxs(_Fragment, { children: [_jsxs("defs", { children: [_jsxs("linearGradient", { id: `${u}-big`, x1: "0", y1: "0", x2: "1", y2: "1", children: [_jsx("stop", { offset: ".5", stopColor: "var(--color-main)" }), _jsx("stop", { offset: ".8", stopColor: "var(--color-sub)" })] }), _jsxs("linearGradient", { id: `${u}-small`, x1: "0", y1: "0", x2: "1", y2: "1", children: [_jsx("stop", { offset: ".5", stopColor: "var(--color-sub)" }), _jsx("stop", { offset: ".8", stopColor: "color-mix(in srgb, #ffffbb 30%, var(--color-sub))" })] })] }), _jsx("g", { ...enter('bloom', { turn: 0, origin: '330px 350px' }), children: _jsxs("g", { style: spin('blob-1', 22), children: [_jsx("circle", { cx: 330, cy: 350, r: 240, fill: `url(#${u}-big)` }), [
56
+ { stroke: 'rgba(77, 205, 192, 0.45)', delay: 0 },
57
+ { stroke: 'rgba(73, 156, 223, 0.35)', delay: 1.35 },
58
+ { stroke: 'rgba(77, 205, 192, 0.25)', delay: 2.7 },
59
+ ].map((ring) => (_jsx("circle", { className: "hero-visual__ring", cx: 330, cy: 350, r: 241, fill: "none", stroke: ring.stroke, strokeWidth: 2, style: { ...SELF, animation: `hero-visual-wave 4s ease-out ${ring.delay}s infinite` } }, ring.delay)))] }) }), _jsx("g", { ...enter('bloom', { turn: 0.06, origin: '490px 490px' }), children: _jsx("circle", { cx: 490, cy: 490, r: 100, fill: `url(#${u}-small)`, style: spin('blob-2', 17, -5) }) })] })),
60
+ },
61
+ /* **제 손으로 그어진다** — 관이 한쪽 끝에서 자라 반대쪽으로 흘러갔다 지워진다 */
62
+ ribbon: {
63
+ viewBox: '-40 140 880 294',
64
+ width: 880,
65
+ height: 294,
66
+ render: (u) => {
67
+ const road = 'M-40,420 C140,470 240,330 360,340 S520,500 600,400 S560,200 440,250 S480,420 580,360 S740,200 840,140';
68
+ const tail = 'M440,250 C320,300 480,420 580,360 S740,200 840,140';
69
+ return (_jsxs(_Fragment, { children: [_jsxs("defs", { children: [_jsxs("linearGradient", { id: `${u}-rib`, gradientUnits: "userSpaceOnUse", x1: "0", y1: "420", x2: "760", y2: "120", children: [_jsx("stop", { offset: "0", stopColor: C.c1 }), _jsx("stop", { offset: ".4", stopColor: C.c3 }), _jsx("stop", { offset: ".7", stopColor: C.c4 }), _jsx("stop", { offset: "1", stopColor: C.c6 })] }), _jsxs("mask", { id: `${u}-mask`, maskUnits: "userSpaceOnUse", x: "-100", y: "-100", width: "1000", height: "800", children: [_jsx("rect", { x: "-100", y: "-100", width: "1000", height: "800", fill: "#000" }), _jsx("path", { d: road, fill: "none", stroke: "#fff", strokeWidth: 62, strokeLinecap: "round" })] }), _jsx("filter", { id: `${u}-blur`, x: "-20%", y: "-20%", width: "140%", height: "140%", children: _jsx("feGaussianBlur", { stdDeviation: "9" }) })] }), _jsxs("g", { style: spin('floaty', 7), children: [_jsx("path", { d: road, fill: "none", stroke: `url(#${u}-rib)`, strokeWidth: 64, strokeLinecap: "round", strokeLinejoin: "round", ...DRAWN, ...enter('draw') }), _jsx("g", { mask: `url(#${u}-mask)`, ...enter('fade', { turn: 0.04 }), children: _jsx("path", { d: tail, fill: "none", stroke: C.c1, strokeWidth: 64, strokeLinecap: "butt", strokeDasharray: "0 130 3000", opacity: ".34", filter: `url(#${u}-blur)`, transform: "translate(0,10)" }) }), _jsx("path", { d: tail, fill: "none", stroke: `url(#${u}-rib)`, strokeWidth: 64, strokeLinecap: "round", strokeLinejoin: "round", ...DRAWN, ...enter('draw', { turn: 0.06 }) })] })] }));
70
+ },
71
+ },
72
+ /* **떠오른다** — 아래에서 하나씩 올라와 서고, 위로 빠진다 */
73
+ spheres: {
74
+ viewBox: '0 -10 640 580',
75
+ width: 640,
76
+ height: 580,
77
+ render: (u) => {
78
+ const balls = [
79
+ { cx: 450, cy: 240, r: 190, fill: `url(#${u}-halo)`, opacity: 0.8, blur: true, idle: spin('breathe', 9), self: true, turn: 0 },
80
+ { cx: 275, cy: 45, r: 55, fill: `url(#${u}-drop)`, idle: spin('drift', 8), turn: 0.09 },
81
+ { cx: 310, cy: 310, r: 160, fill: `url(#${u}-lime)`, idle: spin('floaty', 7), turn: 0.03 },
82
+ { cx: 150, cy: 430, r: 150, fill: `url(#${u}-fade)`, opacity: 0.75, blend: true, idle: spin('floaty', 7, 2.5), turn: 0.06 },
83
+ { cx: 361, cy: 521, r: 21, fill: `url(#${u}-bead)`, idle: spin('drift', 6, 1), turn: 0.12 },
84
+ /* 아래 `origin` 이 없으면 `scale(.78)` 이 좌표계의 0, 0 을 향해 줄어들어
85
+ **구체가 왼쪽 위로 끌려간다**(`flower` 에서 겪은 것과 같은 자리). */
86
+ ];
87
+ return (_jsxs(_Fragment, { children: [_jsxs("defs", { children: [_jsxs("radialGradient", { id: `${u}-halo`, cx: ".4", cy: ".4", r: ".85", children: [_jsx("stop", { offset: "0", stopColor: C.c5 }), _jsx("stop", { offset: ".55", stopColor: C.c2 }), _jsx("stop", { offset: ".72", stopColor: "#ffffff" }), _jsx("stop", { offset: "1", stopColor: "#ffffff" })] }), _jsxs("linearGradient", { id: `${u}-drop`, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0", stopColor: C.c1 }), _jsx("stop", { offset: ".7", stopColor: C.c5 }), _jsx("stop", { offset: "1", stopColor: C.c5, stopOpacity: "0" })] }), _jsxs("linearGradient", { id: `${u}-lime`, x1: ".67", y1: ".03", x2: ".33", y2: ".97", children: [_jsx("stop", { offset: "0", stopColor: C.c6 }), _jsx("stop", { offset: ".45", stopColor: C.c4 }), _jsx("stop", { offset: "1", stopColor: C.c1 })] }), _jsxs("linearGradient", { id: `${u}-fade`, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0", stopColor: C.c1 }), _jsx("stop", { offset: ".45", stopColor: C.c3 }), _jsx("stop", { offset: ".95", stopColor: C.c3, stopOpacity: "0" })] }), _jsxs("linearGradient", { id: `${u}-bead`, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0", stopColor: C.c4 }), _jsx("stop", { offset: "1", stopColor: C.c1 })] }), _jsx("filter", { id: `${u}-soft`, x: "-30%", y: "-30%", width: "160%", height: "160%", children: _jsx("feGaussianBlur", { stdDeviation: "34" }) })] }), balls.map((b) => (_jsx("g", { ...enter('settle', { turn: b.turn, origin: `${b.cx}px ${b.cy}px` }), children: _jsx("circle", { className: b.blend ? 'hero-visual__blades' : undefined, cx: b.cx, cy: b.cy, r: b.r, fill: b.fill, opacity: b.opacity, filter: b.blur ? `url(#${u}-soft)` : undefined, style: b.self ? { ...SELF, ...b.idle } : b.idle }) }, `${b.cx},${b.cy}`)))] }));
88
+ },
89
+ },
90
+ /* **네 코너가 하나씩 돋는다** */
91
+ clover: {
92
+ viewBox: '220 140 240 240',
93
+ width: 240,
94
+ height: 240,
95
+ render: (u) => {
96
+ const petals = [
97
+ { d: 'M360,140 A140,140 0 0 1 220,280 L220,232 A92,92 0 0 0 312,140 Z', fill: `url(#${u}-p1)`, origin: '220px 140px', turn: 0 },
98
+ { d: 'M460,280 A140,140 0 0 1 320,140 L368,140 A92,92 0 0 0 460,232 Z', fill: `url(#${u}-p3)`, origin: '460px 140px', turn: 0.03 },
99
+ { d: 'M320,380 A140,140 0 0 1 460,240 L460,288 A92,92 0 0 0 368,380 Z', fill: `url(#${u}-p4)`, origin: '460px 380px', turn: 0.06 },
100
+ { d: 'M220,240 A140,140 0 0 1 360,380 L312,380 A92,92 0 0 0 220,288 Z', fill: `url(#${u}-p2)`, origin: '220px 380px', turn: 0.09 },
101
+ ];
102
+ return (_jsxs(_Fragment, { children: [_jsxs("defs", { children: [_jsxs("linearGradient", { id: `${u}-p1`, x1: "0", y1: "0", x2: "1", y2: "1", children: [_jsx("stop", { offset: "0", stopColor: C.c3 }), _jsx("stop", { offset: "1", stopColor: C.c6 })] }), _jsxs("linearGradient", { id: `${u}-p2`, x1: "0", y1: "1", x2: "1", y2: "0", children: [_jsx("stop", { offset: "0", stopColor: C.c1 }), _jsx("stop", { offset: "1", stopColor: C.c4 })] }), _jsxs("linearGradient", { id: `${u}-p3`, x1: "0", y1: "0", x2: "1", y2: "0", children: [_jsx("stop", { offset: "0", stopColor: C.c4 }), _jsx("stop", { offset: "1", stopColor: C.c3 })] }), _jsxs("linearGradient", { id: `${u}-p4`, x1: "1", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0", stopColor: C.c6 }), _jsx("stop", { offset: "1", stopColor: C.c3 })] })] }), _jsx("g", { className: "hero-visual__petals", children: petals.map((p) => (_jsx("path", { d: p.d, fill: p.fill, ...enter('pop', { turn: p.turn, origin: p.origin }) }, p.origin))) })] }));
103
+ },
104
+ },
105
+ /*
106
+ * **하나였다가 셋으로 갈라진다**(사용자 지시 2026-11-09 — *"1개였다가 4개로 배치되는
107
+ * 방식으로 나오게 해줘"* · *"4개 -> 3개로 바꾸자"*).
108
+ *
109
+ * 기울기를 **바깥 묶음에 박아 두지 않는다** — 모였을 때 셋이 같은 각이어야 하나로
110
+ * 보이므로, 각도 들고 나는 틀이 돌린다(`--a`). 흔들림(`sway`)만 안쪽 막대에 남는다.
111
+ *
112
+ * **색은 면 안에서 흐른다**(사용자 지시 2026-11-09 — *"연두컬러쪽이 부족해 맞춰줘"*).
113
+ * 단색 셋으로는 줄기의 더운 쪽(연두)이 아예 안 나왔다 — 장마다 두 칸씩 걸치게 해
114
+ * 여섯 칸을 다 쓴다.
115
+ *
116
+ * **막대의 수는 그대로다**(340 × 120). 넷이던 때 가로세로가 0.67 이라 혼자 길쭉해
117
+ * 막대를 넓혀 봤는데, 그러니 **막대 하나하나가 길쭉해졌다**(사용자 지시 —
118
+ * *"길죽하게 바뀌었는데? 아까것이 좋았는데"*). 막대는 두고 **장을 하나 줄여** 0.82 가
119
+ * 됐다 — 쌓인 높이가 줄어 가로세로가 저절로 맞는다.
120
+ */
121
+ stackedPills: {
122
+ viewBox: '19 -60 362 440',
123
+ width: 362,
124
+ height: 440,
125
+ render: (u) => (_jsxs(_Fragment, { children: [_jsxs("defs", { children: [_jsxs("linearGradient", { id: `${u}-p1`, x1: "0", y1: "0", x2: "1", y2: "1", children: [_jsx("stop", { offset: "0", stopColor: C.c5 }), _jsx("stop", { offset: "1", stopColor: C.c6 })] }), _jsxs("linearGradient", { id: `${u}-p2`, x1: "0", y1: "0", x2: "1", y2: "1", children: [_jsx("stop", { offset: "0", stopColor: C.c3 }), _jsx("stop", { offset: "1", stopColor: C.c4 })] }), _jsxs("linearGradient", { id: `${u}-p3`, x1: "0", y1: "0", x2: "1", y2: "1", children: [_jsx("stop", { offset: "0", stopColor: C.c1 }), _jsx("stop", { offset: "1", stopColor: C.c2 })] })] }), [
126
+ { cy: 60, angle: -16, color: `url(#${u}-p1)`, opacity: 0.75 },
127
+ { cy: 160, angle: 14, color: `url(#${u}-p2)`, opacity: 0.85 },
128
+ { cy: 260, angle: -14, color: `url(#${u}-p3)`, opacity: 0.95 },
129
+ ].map((p, i) => (_jsx("g", { ...enter('fan', {
130
+ origin: `200px ${p.cy}px`,
131
+ /* 모일 곳은 셋의 한가운데(160) — 거기서 포개져 하나로 보인다 */
132
+ vars: { '--dy': `${160 - p.cy}px`, '--a': `${p.angle}deg` },
133
+ }), children: _jsx("rect", { x: 30, y: p.cy - 60, width: 340, height: 120, rx: 60, fill: p.color, opacity: p.opacity, style: { ...SELF, ...spin('sway', 7, i) } }) }, p.cy)))] })),
134
+ },
135
+ /* **제 손으로 그어진다** — 두꺼운 링이 한 바퀴 돌며 그려진다 */
136
+ doubleRing: {
137
+ /* 원판이 링을 틀 밖으로 잘라 쓰던 그 상자 그대로다 — 잘린 꼴이 이 안의 모습이다 */
138
+ viewBox: '0 0 680 560',
139
+ width: 680,
140
+ height: 560,
141
+ render: (u) => (_jsxs(_Fragment, { children: [_jsxs("defs", { children: [_jsxs("linearGradient", { id: `${u}-r1`, gradientUnits: "userSpaceOnUse", x1: "60", y1: "80", x2: "520", y2: "520", children: [_jsx("stop", { offset: "0", stopColor: C.c6 }), _jsx("stop", { offset: ".5", stopColor: C.c4 }), _jsx("stop", { offset: "1", stopColor: C.c2 })] }), _jsxs("linearGradient", { id: `${u}-r2`, gradientUnits: "userSpaceOnUse", x1: "300", y1: "120", x2: "700", y2: "560", children: [_jsx("stop", { offset: "0", stopColor: C.c3 }), _jsx("stop", { offset: ".55", stopColor: C.c1 }), _jsx("stop", { offset: "1", stopColor: C.c1 })] }), _jsx("filter", { id: `${u}-shadow`, x: "-20%", y: "-20%", width: "140%", height: "140%", children: _jsx("feDropShadow", { dx: "0", dy: "14", stdDeviation: "14", floodColor: C.c1, floodOpacity: ".2" }) })] }), _jsxs("g", { style: { transformOrigin: '380px 300px', ...spin('breathe', 9) }, children: [_jsx("circle", { cx: 290, cy: 300, r: 210, fill: "none", stroke: `url(#${u}-r1)`, strokeWidth: 74, ...DRAWN, ...enter('draw') }), _jsx("circle", { cx: 500, cy: 340, r: 190, fill: "none", stroke: `url(#${u}-r2)`, strokeWidth: 74, filter: `url(#${u}-shadow)`, ...DRAWN, ...enter('draw', { turn: 0.08 }) })] })] })),
142
+ },
143
+ /* **동심 원** — 띠 넷이 가운데에서 차례로 번져 나간다
144
+ (사용자 지시 2026-11-09 — *"동심 아치는 -> 동심 원 으로 구성해줘"*).
145
+ 전에는 바닥에서 솟는 반원이었다. 띠 두께(52)와 색·박자는 그대로 두고 **원으로** 닫았다. */
146
+ concentric: {
147
+ viewBox: '0 -60 680 680',
148
+ width: 680,
149
+ height: 680,
150
+ render: (u) => (_jsxs(_Fragment, { children: [_jsxs("defs", { children: [_jsxs("linearGradient", { id: `${u}-outer`, gradientUnits: "userSpaceOnUse", x1: "20", y1: "-40", x2: "660", y2: "600", children: [_jsx("stop", { offset: "0", stopColor: C.c3 }), _jsx("stop", { offset: "1", stopColor: C.c6 })] }), _jsxs("linearGradient", { id: `${u}-mid`, gradientUnits: "userSpaceOnUse", x1: "120", y1: "280", x2: "560", y2: "280", children: [_jsx("stop", { offset: "0", stopColor: C.c2 }), _jsx("stop", { offset: "1", stopColor: C.c4 })] }), _jsxs("linearGradient", { id: `${u}-inner`, gradientUnits: "userSpaceOnUse", x1: "200", y1: "420", x2: "480", y2: "140", children: [_jsx("stop", { offset: "0", stopColor: C.c1 }), _jsx("stop", { offset: ".5", stopColor: C.c1 }), _jsx("stop", { offset: "1", stopColor: C.c3 })] })] }), [
151
+ { r: 54, stroke: C.c2, opacity: 1, idle: 0, turn: 0 },
152
+ { r: 134, stroke: `url(#${u}-inner)`, opacity: 0.9, idle: 0.4, turn: 0.04 },
153
+ { r: 214, stroke: `url(#${u}-mid)`, opacity: 0.8, idle: 0.8, turn: 0.08 },
154
+ { r: 294, stroke: `url(#${u}-outer)`, opacity: 0.55, idle: 1.2, turn: 0.12 },
155
+ ].map((ring) => (_jsx("g", { ...enter('pop', { turn: ring.turn, origin: '340px 280px' }), children: _jsx("circle", { cx: 340, cy: 280, r: ring.r, fill: "none", stroke: ring.stroke, strokeWidth: 52, opacity: ring.opacity, style: { transformOrigin: '340px 280px', ...spin('pulse', 4, ring.idle) } }) }, ring.r)))] })),
156
+ },
157
+ /* **겹쳐 있다 갈라진다** — 작은 방울이 큰 방울 안에서 미끄러져 나오며 혹이 돋는다 */
158
+ metaball: {
159
+ viewBox: '-16 82 530 536',
160
+ width: 530,
161
+ height: 536,
162
+ render: (u) => (_jsxs(_Fragment, { children: [_jsxs("defs", { children: [_jsxs("filter", { id: `${u}-goo`, x: "-20%", y: "-20%", width: "140%", height: "140%", children: [_jsx("feGaussianBlur", { stdDeviation: "18" }), _jsx("feColorMatrix", { values: "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 26 -12" })] }), _jsxs("linearGradient", { id: `${u}-big`, x1: "0", y1: "0", x2: "1", y2: "1", children: [_jsx("stop", { offset: ".5", stopColor: "var(--color-main)" }), _jsx("stop", { offset: ".8", stopColor: "var(--color-sub)" })] }), _jsxs("linearGradient", { id: `${u}-small`, x1: "0", y1: "0", x2: "1", y2: "1", children: [_jsx("stop", { offset: ".5", stopColor: "var(--color-sub)" }), _jsx("stop", { offset: ".8", stopColor: "color-mix(in srgb, #ffffbb 30%, var(--color-sub))" })] })] }), _jsxs("g", { filter: `url(#${u}-goo)`, children: [_jsx("g", { ...enter('meet', { vars: { '--from': '20px' } }), children: _jsx("circle", { cx: 240, cy: 350, r: 240, fill: `url(#${u}-big)`, style: spin('blob-1', 22) }) }), _jsx("g", { ...enter('meet', { turn: 0.03, vars: { '--from': '-120px' } }), children: _jsx("circle", { cx: 400, cy: 490, r: 100, fill: `url(#${u}-small)`, style: spin('blob-2', 17, -5) }) })] })] })),
163
+ },
164
+ /* **가운데에서 번져 나간다** — 고리 하나씩 */
165
+ dottedRipple: {
166
+ viewBox: '104 44 472 472',
167
+ width: 472,
168
+ height: 472,
169
+ render: () => (_jsxs("g", { style: { transformOrigin: '340px 280px', ...spin('breathe', 6) }, children: [_jsx("g", { ...enter('pop', { turn: 0, origin: '340px 280px' }), children: _jsx("circle", { cx: 340, cy: 280, r: 22, fill: C.c1 }) }), Array.from({ length: 5 }, (_, ring) => (_jsx("g", { ...enter('pop', { turn: 0.03 * (ring + 1), origin: '340px 280px' }), children: around(340, 280, 50 + 42 * ring, 8 + 8 * ring).map((p) => (_jsx("circle", { cx: p.x, cy: p.y, r: 9 - 1.2 * ring, fill: RAMP[ring] }, `${p.x},${p.y}`))) }, ring)))] })),
170
+ },
171
+ /*
172
+ * **가운데에 겹쳐 있다 갈라진다** — 둘이 만나 렌즈가 되는 것이 이 꼴의 뜻이다.
173
+ *
174
+ * **면이 둘뿐이라 단색으로는 다른 꼴들과 안 어울렸다**(사용자 지시 2026-11-09 —
175
+ * *"면이 2개밖에 없는데 단색이니까 다른것들과 안맞는거 같아 그라데이션으로 조정해줘"*).
176
+ * 다른 꼴은 조각이 여럿이라 **조각 사이**에서 색이 흐르는데, 이쪽은 조각이 둘이라
177
+ * 그 흐름이 **면 안에** 있어야 한다.
178
+ *
179
+ * 한쪽은 찬 쪽(파랑→시안), 다른 쪽은 더운 쪽(틸→연두)으로 둔다 — 겹친 자리가
180
+ * 무슨 색인지 읽히려면 두 쪽이 서로 다른 데서 와야 한다.
181
+ */
182
+ vesica: {
183
+ viewBox: '100 110 480 340',
184
+ width: 480,
185
+ height: 340,
186
+ render: (u) => (_jsxs(_Fragment, { children: [_jsxs("defs", { children: [_jsxs("linearGradient", { id: `${u}-cool`, x1: "0", y1: "0", x2: "1", y2: "1", children: [_jsx("stop", { offset: "0", stopColor: C.c1 }), _jsx("stop", { offset: "1", stopColor: C.c3 })] }), _jsxs("linearGradient", { id: `${u}-warm`, x1: "0", y1: "0", x2: "1", y2: "1", children: [_jsx("stop", { offset: "0", stopColor: C.c4 }), _jsx("stop", { offset: "1", stopColor: C.c6 })] })] }), _jsxs("g", { className: "hero-visual__lens", children: [_jsx("g", { ...enter('meet', { vars: { '--from': '70px' } }), children: _jsx("circle", { cx: 270, cy: 280, r: 170, fill: `url(#${u}-cool)`, opacity: ".8", style: spin('approach-r', 6) }) }), _jsx("g", { ...enter('meet', { vars: { '--from': '-70px' } }), children: _jsx("circle", { cx: 410, cy: 280, r: 170, fill: `url(#${u}-warm)`, opacity: ".8", style: spin('approach', 6) }) })] })] })),
187
+ },
188
+ /* **맨 위 판부터 차례로 돋는다** — 위에서 떨어뜨리려 했으나 상자 위쪽에 남은 자리가
189
+ 14 뿐이라 들어오는 동안 잘렸다. 차례(`turn`)가 위에서 아래로 쌓이는 느낌을 낸다. */
190
+ stackedDiscs: {
191
+ viewBox: '140 90 400 396',
192
+ width: 400,
193
+ height: 396,
194
+ render: () => (_jsx("g", { className: "hero-visual__discs", children: RAMP.map((fill, i) => (_jsx("g", { ...enter('pop', { turn: i * 0.025, origin: `340px ${150 + 58 * i}px` }), children: _jsx("ellipse", { cx: 340, cy: 150 + 58 * i, rx: 200 - 12 * i, ry: 46, fill: fill, opacity: ".8", style: spin('floaty', 7, 0.4 * i) }) }, fill))) })),
195
+ },
196
+ /* **가운데에 모였다 펴진다** — 걷힐 때도 모이며 사라진다 */
197
+ flower: {
198
+ viewBox: '140 80 400 400',
199
+ width: 400,
200
+ height: 400,
201
+ render: () => (
202
+ /* 움직임이 두 겹이다 — 묶음은 9초로 숨 쉬고, 원 여섯은 36초에 한 번 모인다(= 숨 네 번) */
203
+ _jsx("g", { className: "hero-visual__blades", style: { transformOrigin: '340px 280px', ...spin('breathe', 9) }, children: around(340, 280, 95, 6).map((p, i) => (
204
+ /* **가운데에서 피어난다**(사용자 지시 2026-11-09 — *"가운데에서 나타나도록"*).
205
+ 축을 꽃의 한가운데에 박아야 한다 — 안 박으면 `scale(.3)` 이 좌표계의 0, 0
206
+ (틀의 왼쪽 위)을 향해 줄어들어, 가운데가 아니라 **모서리에서** 날아온다. */
207
+ _jsx("g", { ...enter('unfold', {
208
+ turn: i * 0.025,
209
+ origin: '340px 280px',
210
+ vars: { '--gx': `${340 - p.x}px`, '--gy': `${280 - p.y}px` },
211
+ }), children: _jsx("circle", { cx: p.x, cy: p.y, r: 95, fill: RAMP[i], opacity: ".6", style: spin('gather', 36) }) }, `${p.x},${p.y}`))) })),
212
+ },
213
+ };
214
+ /** 꼴의 이름들 — 놀이터가 전부를 훑을 때 쓴다 @public */
215
+ export const HERO_VISUAL_VARIANTS = Object.keys(ART);
216
+ /**
217
+ * **히어로 비주얼** — 랜딩 머리에 세우는 그림.
218
+ *
219
+ * 디자인 판(claude.ai/design 의 `Hero Visual Options`)에서 고른 꼴 열셋을 한 컴포넌트가
220
+ * 쥔다. `variant` 하나만 바꾸면 그림이 바뀐다.
221
+ *
222
+ * **한 바퀴는 등장 · 머묾 · 퇴장이다.** 머무는 동안이 한 바퀴의 6할이라, 그림이 제 꼴로
223
+ * 서 있는 시간이 가장 길다. `motion="still"` 이면 **멈춰 선 한 장**이 되는데, 이때는 한
224
+ * 바퀴뿐 아니라 그림 안쪽의 숨·떨림까지 멈춘다 — 바깥만 멈추면 "멈춘 그림" 이 아니라
225
+ * "제자리에서 꿈틀대는 그림" 이 된다.
226
+ *
227
+ * **크기는 쓰는 쪽이 정한다.** 가로를 100% 로 채우고 세로는 제 비율대로 따라오므로,
228
+ * 감싸는 자리의 폭만 정해 주면 된다.
229
+ *
230
+ * ```tsx
231
+ * <div style={{ width: 520 }}>
232
+ * <HeroVisual variant="blobs" />
233
+ * </div>
234
+ * <HeroVisual variant="clover" motion="still" />
235
+ * ```
236
+ *
237
+ * @public
238
+ */
239
+ export default function HeroVisual({ variant, motion = 'loop', cycleMs = 9000, label, className, style, }) {
240
+ /* 한 쪽에 둘 이상 서면 그라데이션 이름이 부딪힌다 — 먼저 선 쪽의 것이 이기고,
241
+ 나중 것은 **남의 색으로** 칠해진다. React 가 주는 이름으로 갈라 둔다.
242
+ `:` 가 섞여 오므로 걷는다(조각 참조에서 탈이 난다). */
243
+ const uid = `hero-visual-${useId().replace(/:/g, '')}`;
244
+ /* 없는 이름이 들어와도 **빈 자리로 두지 않는다** — 그러면 화면에는 아무 말 없이
245
+ 구멍만 남는다. 랜딩의 배경으로 세우고 개발 중에만 한 번 일러둔다. */
246
+ const art = ART[variant] ?? ART.blobs;
247
+ if (!ART[variant])
248
+ devWarnOnce(`HeroVisual: 모르는 variant '${variant}' — blobs 로 세운다`);
249
+ return (_jsx("div", { className: cx('hero-visual', `hero-visual--${variant}`, motion === 'still' && 'hero-visual--still', className), style: { aspectRatio: `${art.width} / ${art.height}`, '--hero-visual-cycle': `${cycleMs}ms`, ...style }, role: label ? 'img' : undefined, "aria-label": label, "aria-hidden": label ? undefined : true, children: _jsx("svg", { className: "hero-visual__svg", viewBox: art.viewBox, preserveAspectRatio: "xMidYMid meet", focusable: "false", children: art.render(uid) }) }));
250
+ }
@@ -350,6 +350,8 @@ export { default as WordTableButton } from './components/Word/WordTableButton';
350
350
  export type { WordTableButtonProps } from './components/Word/WordTableButton';
351
351
  export { default as TrainingResultPopup } from './components/Popup/TrainingResultPopup';
352
352
  export { default as WordDataUpdatePopup } from './components/Popup/WordDataUpdatePopup';
353
+ export { default as HeroVisual, HERO_VISUAL_VARIANTS } from './components/HeroVisual';
354
+ export type { HeroVisualProps, HeroVisualVariant } from './components/HeroVisual';
353
355
  export { default as Tooltip } from './components/Tooltip/Tooltip';
354
356
  export type { TooltipProps } from './components/Tooltip/Tooltip';
355
357
  export { default as WordImageTooltip } from './components/Tooltip/WordImageTooltip';
@@ -271,6 +271,7 @@ export { default as WordTableThumbnail } from './components/Word/WordTableThumbn
271
271
  export { default as WordTableButton } from './components/Word/WordTableButton';
272
272
  export { default as TrainingResultPopup } from './components/Popup/TrainingResultPopup';
273
273
  export { default as WordDataUpdatePopup } from './components/Popup/WordDataUpdatePopup';
274
+ export { default as HeroVisual, HERO_VISUAL_VARIANTS } from './components/HeroVisual';
274
275
  export { default as Tooltip } from './components/Tooltip/Tooltip';
275
276
  export { default as WordImageTooltip } from './components/Tooltip/WordImageTooltip';
276
277
  export { default as DebugResultLauncher } from './components/Tooltip/DebugTooltip';
@@ -0,0 +1,24 @@
1
+ import type { DifficultyLevel } from '../utils/koreanSyllable';
2
+ import { type WordComposition } from './wordTrainingFilterModel';
3
+ import type { ViableComposition, WordTrainingFilterCaps } from './wordTrainingFilterSections';
4
+ /** `useWordPoolViability` 가 내놓는 것 */
5
+ export interface WordPoolViability {
6
+ /** 풀에 실제로 있는 자모·음절 수 */
7
+ viable: ViableComposition;
8
+ /** 자모를 한 번이라도 받아 왔는가 — 받기 전에는 저장된 선택을 풀면 안 된다 */
9
+ viableReady: boolean;
10
+ /** 지금 필터로 나올 정답 낱말 수 (null = 아직 안 셈) */
11
+ wordCount: number | null;
12
+ /** 풀이 바뀔 때마다 오르는 수 — 부르는 쪽이 제 다시-세기에 쓴다 */
13
+ poolVersion: number;
14
+ }
15
+ export declare function useWordPoolViability(args: {
16
+ caps: WordTrainingFilterCaps;
17
+ difficulty: DifficultyLevel;
18
+ contrastCount: number;
19
+ composition: WordComposition;
20
+ phonemeView: 'char' | 'pron' | 'direct';
21
+ excludeNoImage: boolean;
22
+ sameStructureOnly: boolean;
23
+ gradeFilter: string[];
24
+ }): WordPoolViability;
@@ -0,0 +1,101 @@
1
+ 'use client';
2
+ /**
3
+ * **풀이 무엇을 허락하는가** — 지금 필터로 고를 수 있는 자모·음절 수와, 나올 낱말 수.
4
+ *
5
+ * `useWordTrainingFilter.ts` 에서 떼어 냈다(사용자 지시 2026-11-08 — *"모두 진행해줘"*).
6
+ * 그 훅이 주석 뺀 454줄이었고, 이 덩어리가 97줄이었다.
7
+ *
8
+ * **왜 여기가 솔기인가** — 이 다섯 효과는 모두 *바깥 세상을 읽어 들이는* 일이다.
9
+ * 낱말 꾸러미를 비동기로 묻고, 창 사건 둘(`wordpool:update` · 그림 있음 캐시)을 듣고,
10
+ * 언어가 바뀌면 다시 묻는다. 반면 남은 훅은 *사용자가 고른 것*을 든다. 읽어 들이는
11
+ * 쪽과 들고 있는 쪽이 한 파일에 섞여 있었다.
12
+ *
13
+ * **읽기만 한다 — 고른 것을 안 건드린다.** 못 고르게 된 자모의 선택을 푸는 일
14
+ * (`setComposition`)은 **부르는 쪽에 남겼다.** 여기서 하면 이 훅이 상태 주인을 둘로
15
+ * 늘리고, 되돌리는 손짓이 두 파일에 걸친다. 들어가는 값과 나오는 값만 보면 되게 둔다.
16
+ *
17
+ * **글자 그대로 옮겼다** — 효과 다섯의 속과 의존성 목록을 한 줄도 안 고쳤다.
18
+ * 효과끼리 순서가 얽혀 있어(풀 판 올림 → 자모 다시 묻기 → 낱말 수 다시 세기)
19
+ * 손대면 조용히 어긋난다.
20
+ */
21
+ import { useEffect, useRef, useState } from 'react';
22
+ import { useTranslation } from 'react-i18next';
23
+ import { getViableComposition, countUsableWords } from '../utils/wordTrainingRuntime';
24
+ import { IMAGE_EXISTENCE_CACHE_UPDATED } from '../utils/imageConfig';
25
+ import { useWindowEvent } from './useWindowEvent';
26
+ import { valueToJamos, NO_CODA, syllableToFilter } from './wordTrainingFilterModel';
27
+ export function useWordPoolViability(args) {
28
+ const { caps, difficulty, contrastCount, composition, phonemeView, excludeNoImage, sameStructureOnly, gradeFilter } = args;
29
+ const { i18n } = useTranslation();
30
+ const [viable, setViable] = useState({ cho: new Set(), jung: new Set(), jong: new Set(), syllable: new Set() });
31
+ // viable 자모 데이터가 최초 로드되기 전에는 저장된 선택을 해제하지 않는다
32
+ const [viableReady, setViableReady] = useState(false);
33
+ // 현재 필터 조건으로 가능한 정답 단어 수 (안내 문구용). null = 계산 전
34
+ const [wordCount, setWordCount] = useState(null);
35
+ const [poolVersion, setPoolVersion] = useState(0);
36
+ // 단어 풀 갱신 이벤트 구독
37
+ useWindowEvent('wordpool:update', () => setPoolVersion(v => v + 1));
38
+ useWindowEvent(IMAGE_EXISTENCE_CACHE_UPDATED, () => setPoolVersion(v => v + 1));
39
+ // 언어 전환 시에도 poolVersion을 올려 재생성을 트리거한다.
40
+ // useWordTrainingDataGeneration의 batch 생성 effect는 (다른 렌더에서 매번 새 배열이 되는)
41
+ // types를 의존성에서 의도적으로 제외하므로, types의 label/subTitle이 바뀌는 유일한 외부
42
+ // 요인인 언어 전환을 poolVersion에 반영하지 않으면 perTypeData가 이전 언어로 고정된다.
43
+ const langRef = useRef(i18n.language);
44
+ useEffect(() => {
45
+ if (langRef.current !== i18n.language) {
46
+ langRef.current = i18n.language;
47
+ setPoolVersion(v => v + 1);
48
+ }
49
+ }, [i18n.language]);
50
+ // 위치별 사용 가능 자모 계산 (단어 구성 필터를 노출하는 그룹만)
51
+ useEffect(() => {
52
+ if (!caps.choseong)
53
+ return;
54
+ let cancelled = false;
55
+ getViableComposition({ difficulty, excludeNoImage })
56
+ .then(v => {
57
+ if (cancelled)
58
+ return;
59
+ setViable(v);
60
+ // 빈 결과 = 단어 풀 미로드 상태. 앞서 한 번 준비됐더라도 갱신 중엔 다시
61
+ // 준비 안 됨으로 돌려 저장된 음소 선택을 빈 집합으로 검증하지 않는다.
62
+ setViableReady(v.cho.size + v.jung.size + v.jong.size > 0);
63
+ })
64
+ .catch(() => {
65
+ if (!cancelled) {
66
+ setViable({ cho: new Set(), jung: new Set(), jong: new Set(), syllable: new Set() });
67
+ setViableReady(false);
68
+ }
69
+ });
70
+ return () => { cancelled = true; };
71
+ }, [caps.choseong, difficulty, excludeNoImage, poolVersion]);
72
+ // 현재 필터 조건으로 가능한 정답 단어 수 계산 (버튼 선택이 바뀔 때마다)
73
+ useEffect(() => {
74
+ let cancelled = false;
75
+ // 선택된 단어 구성 → CompositionFilter (선택 값을 자모로 분해, 종성 '제외'=jongNone, 음절수 범위 확장)
76
+ // 병합 버튼(예: 'ㅔㅐ')은 각 자모 OR 매칭, 단일/겹받침은 정확 매칭.
77
+ const c = composition;
78
+ const cho = c.cho ? valueToJamos(c.cho) : null;
79
+ const jung = c.jung ? valueToJamos(c.jung) : null;
80
+ const jongNone = c.jong === NO_CODA;
81
+ const jong = jongNone ? null : (c.jong ? valueToJamos(c.jong) : null);
82
+ const syllable = c.syllable != null ? syllableToFilter(c.syllable) : null;
83
+ const hasComp = !!(cho || jung || jong || jongNone || syllable);
84
+ countUsableWords({
85
+ difficulty: caps.difficulty ? difficulty : null,
86
+ contrastCount: caps.difficulty ? contrastCount : 1,
87
+ composition: caps.choseong && hasComp ? { cho, jung, jong, jongNone, syllable } : null,
88
+ excludeNoImage,
89
+ sameStructureOnly,
90
+ // 런타임 카운트는 'direct'(글자 입력=패턴)를 이해하지 못한다 — 철자 기반이므로 'char'로 취급.
91
+ phonemeView: phonemeView === 'pron' ? 'pron' : 'char',
92
+ grade: gradeFilter.length > 0 ? gradeFilter : null,
93
+ })
94
+ .then(n => { if (!cancelled)
95
+ setWordCount(n); })
96
+ .catch(() => { if (!cancelled)
97
+ setWordCount(null); });
98
+ return () => { cancelled = true; };
99
+ }, [caps.choseong, caps.difficulty, difficulty, contrastCount, composition, phonemeView, excludeNoImage, sameStructureOnly, poolVersion, gradeFilter]);
100
+ return { viable, viableReady, wordCount, poolVersion };
101
+ }
@@ -1,8 +1,10 @@
1
- import type { TFunction } from 'i18next';
2
1
  import { type FilterPanelSection } from '../types/filterPanel';
3
2
  import { type WordComposition } from './wordTrainingFilterModel';
4
3
  export { valueToJamos, NO_CODA, SYLLABLE_MIN, syllableToFilter, charToPronValue, pronToCharValue, convertComposition, EMPTY_COMPOSITION, } from './wordTrainingFilterModel';
5
4
  export type { WordComposition } from './wordTrainingFilterModel';
5
+ import { type WordTrainingFilterCaps } from './wordTrainingFilterSections';
6
+ export { gradeDescriptions } from './wordTrainingFilterSections';
7
+ export type { WordTrainingFilterCaps } from './wordTrainingFilterSections';
6
8
  /** 설정 팝업 취소 시 되돌릴 필터 스냅샷 */
7
9
  export interface WordFilterSnapshot {
8
10
  composition: WordComposition;
@@ -18,49 +20,11 @@ export interface WordFilterSnapshot {
18
20
  wordTypeFilter?: string[];
19
21
  }
20
22
  /**
21
- * 그룹이 노출할 설정 항목. 그룹에 속한 훈련 타입들의 CAPABILITY 합집합으로 결정.
22
- * (제외/이미지 없음 필터는 모든 타입에 적용되므로 항상 노출)
23
+ * 단어 훈련 그룹별 필터 상태.
24
+ * @param groupKey 그룹 식별자 (localStorage 키 및 상태 격리에 사용)
25
+ * @param caps 그룹이 노출할 설정 (난이도/단어구성). 제외 필터는 항상 노출.
23
26
  * @public
24
27
  */
25
- export interface WordTrainingFilterCaps {
26
- difficulty: boolean;
27
- /** 단어 구성(초성/중성/종성) 필터 노출 여부 */
28
- choseong: boolean;
29
- /** 품사 필터 노출 여부 — 단어표/대립쌍표와 동일 라벨(useWordAttributeFilter 공용). 기본 false. */
30
- partOfSpeech?: boolean;
31
- /** 어종 필터 노출 여부 — 단어표/대립쌍표와 동일 라벨(useWordAttributeFilter 공용). 기본 false. */
32
- wordType?: boolean;
33
- /**
34
- * 한 음절을 특정해야 하는 타입(듣고 한 음절 포함 단어 맞히기 등)용.
35
- * true면 초성/모음/종성의 '모두' 버튼을 없애고 항상 하나가 선택되도록 하며(재클릭 해제 안 됨),
36
- * 초기값을 ㄱ+ㅏ+제외('가')로 시드해 재생할 음절이 항상 확정되게 한다.
37
- */
38
- requireSyllable?: boolean;
39
- /**
40
- * 음절 수를 특정 값으로 고정해야 하는 타입(음절 합치기 등)용. 설정 시 '음절 수' 필터 섹션 자체를
41
- * 노출하지 않고(사용자가 바꿀 수 없음) composition.syllable을 항상 이 값으로 유지한다.
42
- */
43
- fixedSyllable?: number;
44
- /**
45
- * 종성을 '제외'(받침 없음)로 고정해야 하는 타입(음소 2개 합치기=초성+중성=CV)용.
46
- * 설정 시 종성 필터는 '제외'만 활성·선택되고 나머지 자모·'모두'는 비활성화된다.
47
- */
48
- fixedNoCoda?: boolean;
49
- /**
50
- * 종성이 반드시 있어야 하는 타입(음소 3개 합치기=초성+중성+종성=CVC)용.
51
- * 설정 시 종성 '제외'(받침 없음) 버튼을 아예 노출하지 않는다.
52
- */
53
- requireCoda?: boolean;
54
- }
55
- /**
56
- * 등급 고르개의 설명 줄들 — 지금 언어로. 사전에 배열이 없으면 한국어 원문.
57
- *
58
- * **공개 API 가 아니다**(대응표에 `internal`) — 코어 안에서만 쓰고, 내보내는 것은 못이 읽기 때문이다.
59
- * 그래도 **이름은 영어다** — `internal` 이라도 배포 `d.ts` 에는 그대로 나가 소비자 편집기에 보인다
60
- * (사용자 지시 2026-10-13. 소비자 사용처 0 이라 옛 이름을 남기지 않았다 — 말귀의 같은 이름 함수는 제 지역 것이다).
61
- * 앱은 제 열쇠(`wordSearch.filter.gradeInfo`)와 제 받는 함수를 따로 갖는다.
62
- */
63
- export declare function gradeDescriptions(t: TFunction): string[];
64
28
  export declare function useWordTrainingFilter(groupKey: string, caps: WordTrainingFilterCaps, opts?: {
65
29
  resetOnMount?: boolean;
66
30
  resetKey?: string;