kodeui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +30 -2
- package/bin/kodeui.mjs +89 -0
- package/package.json +37 -4
- package/skill/kodeui/SKILL.md +105 -0
- package/skill/kodeui/assets/tokens.css +40 -0
- package/skill/kodeui/components/aurora-input/AuroraInput.tsx +153 -0
- package/skill/kodeui/components/aurora-input/aurora-input.css +218 -0
- package/skill/kodeui/components/aurora-input/index.ts +2 -0
- package/skill/kodeui/components/bloom-wall/BloomWall.tsx +90 -0
- package/skill/kodeui/components/bloom-wall/bloom-wall.css +10 -0
- package/skill/kodeui/components/bloom-wall/engine.ts +1022 -0
- package/skill/kodeui/components/bloom-wall/icons/icons-a.ts +818 -0
- package/skill/kodeui/components/bloom-wall/icons/icons-b.ts +827 -0
- package/skill/kodeui/components/bloom-wall/icons/index.ts +25 -0
- package/skill/kodeui/components/bloom-wall/icons/types.ts +8 -0
- package/skill/kodeui/components/bloom-wall/index.ts +12 -0
- package/skill/kodeui/components/bloom-wall/paint.ts +113 -0
- package/skill/kodeui/components/bloom-wall/palettes.ts +32 -0
- package/skill/kodeui/components/blur-in-text/BlurInText.tsx +53 -0
- package/skill/kodeui/components/blur-in-text/blur-in-text.css +14 -0
- package/skill/kodeui/components/blur-in-text/index.ts +2 -0
- package/skill/kodeui/components/glass-reveal/GlassReveal.tsx +108 -0
- package/skill/kodeui/components/glass-reveal/glass-reveal.css +126 -0
- package/skill/kodeui/components/glass-reveal/index.ts +2 -0
- package/skill/kodeui/components/glow-card/GlowCard.tsx +67 -0
- package/skill/kodeui/components/glow-card/glow-card.css +134 -0
- package/skill/kodeui/components/glow-card/index.ts +2 -0
- package/skill/kodeui/components/launch-chip/LaunchChip.tsx +180 -0
- package/skill/kodeui/components/launch-chip/icons.tsx +119 -0
- package/skill/kodeui/components/launch-chip/index.ts +3 -0
- package/skill/kodeui/components/launch-chip/launch-chip.css +345 -0
- package/skill/kodeui/components/ring-reveal/RingReveal.tsx +84 -0
- package/skill/kodeui/components/ring-reveal/index.ts +4 -0
- package/skill/kodeui/components/ring-reveal/ring-reveal.css +10 -0
- package/skill/kodeui/components/ring-reveal/ring.ts +298 -0
- package/skill/kodeui/components/rolling-text/RollingText.tsx +121 -0
- package/skill/kodeui/components/rolling-text/index.ts +4 -0
- package/skill/kodeui/components/rolling-text/roll.ts +94 -0
- package/skill/kodeui/components/rolling-text/rolling-text.css +43 -0
- package/skill/kodeui/components/use-live-transcript/index.ts +2 -0
- package/skill/kodeui/components/use-live-transcript/useLiveTranscript.ts +215 -0
- package/skill/kodeui/components/voice-input/VoiceInput.tsx +273 -0
- package/skill/kodeui/components/voice-input/icons.tsx +27 -0
- package/skill/kodeui/components/voice-input/index.ts +4 -0
- package/skill/kodeui/components/voice-input/useVoiceRecorder.ts +289 -0
- package/skill/kodeui/components/voice-input/voice-input.css +34 -0
- package/skill/kodeui/components/voice-note/VoiceNote.tsx +170 -0
- package/skill/kodeui/components/voice-note/index.ts +3 -0
- package/skill/kodeui/components/voice-note/noteFile.ts +25 -0
- package/skill/kodeui/components/voice-note/voice-note.css +45 -0
- package/skill/kodeui/references/aurora-input.md +44 -0
- package/skill/kodeui/references/bloom-wall.md +59 -0
- package/skill/kodeui/references/blur-in-text.md +17 -0
- package/skill/kodeui/references/frameworks.md +46 -0
- package/skill/kodeui/references/glass-reveal.md +40 -0
- package/skill/kodeui/references/glow-card.md +48 -0
- package/skill/kodeui/references/launch-chip.md +37 -0
- package/skill/kodeui/references/recipes.md +77 -0
- package/skill/kodeui/references/ring-reveal.md +35 -0
- package/skill/kodeui/references/rolling-text.md +19 -0
- package/skill/kodeui/references/theming.md +45 -0
- package/skill/kodeui/references/use-live-transcript.md +28 -0
- package/skill/kodeui/references/voice-input.md +60 -0
- package/skill/kodeui/references/voice-note.md +22 -0
- package/skill/kodeui/scripts/add.mjs +192 -0
- package/skill/kodeui/scripts/manifest.json +92 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Launch Chip.
|
|
3
|
+
* Timeline after the chip's delay (D), splash intro / grid intro:
|
|
4
|
+
* 0 chip fades in from a 10px blur (0.45 s; 1 s without a splash)
|
|
5
|
+
* 0.55 the orb wipes in left to right as a pill the size of the chip
|
|
6
|
+
* 0.5-0.8 eight icons start drifting, each on its own clock
|
|
7
|
+
* 0.8 the word fades in from a blur
|
|
8
|
+
* 3.75 / 3.65 word and icons fade out
|
|
9
|
+
* 3.75-4.35 / 4.27-5.2 the pill shrinks into the 26px badge
|
|
10
|
+
* 4.22 / 4.7 the label slides down into place
|
|
11
|
+
* 4.25 / 4.85 the badge text fades in
|
|
12
|
+
* 4.1 / 5.3 the 8 s roll to the secondary line and back starts
|
|
13
|
+
* Everything that moves lives in the no-preference block, so "reduce motion" shows the end state.
|
|
14
|
+
*/
|
|
15
|
+
.ku-launch-chip {
|
|
16
|
+
--ku-chip-delay: 1.3s;
|
|
17
|
+
--ku-chip-grow: 16px;
|
|
18
|
+
--ku-chip-cycle-at: .5s;
|
|
19
|
+
position: relative;
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: 8px;
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 6px 12px 6px 6px;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
background-color: transparent;
|
|
28
|
+
border: 1px solid var(--ku-outline, #24342c);
|
|
29
|
+
border-radius: 9999px;
|
|
30
|
+
color: var(--ku-text, #e8f1eb);
|
|
31
|
+
font-family: inherit;
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
line-height: 21px;
|
|
34
|
+
transition: background-color .2s;
|
|
35
|
+
-webkit-tap-highlight-color: transparent;
|
|
36
|
+
}
|
|
37
|
+
.ku-launch-chip.is-splash { --ku-chip-cycle-at: 4.1s; }
|
|
38
|
+
.ku-launch-chip.is-splash.is-grid { --ku-chip-cycle-at: 5.3s; }
|
|
39
|
+
.ku-launch-chip:hover,
|
|
40
|
+
.ku-launch-chip:focus-visible { background-color: var(--ku-surface-high, #192620); outline: none; }
|
|
41
|
+
.ku-launch-chip:focus-visible { box-shadow: 0 0 0 2px var(--ku-fern, #5ee08a); }
|
|
42
|
+
.ku-launch-chip:active { background-color: var(--ku-surface-highest, #213029); }
|
|
43
|
+
|
|
44
|
+
/* ------------------------------------------------------------ the badge */
|
|
45
|
+
.ku-launch-chip__lead {
|
|
46
|
+
position: relative;
|
|
47
|
+
display: inline-grid;
|
|
48
|
+
place-items: center;
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
width: 26px;
|
|
51
|
+
height: 26px;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* a glassy orb: three layered lights, slowly panning, with film grain on top */
|
|
56
|
+
.ku-launch-chip__orb {
|
|
57
|
+
position: relative;
|
|
58
|
+
grid-area: 1 / 1;
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
flex-shrink: 0;
|
|
63
|
+
width: 26px;
|
|
64
|
+
height: 26px;
|
|
65
|
+
border-radius: 9999px;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
isolation: isolate;
|
|
68
|
+
background-color: #0f5e4a;
|
|
69
|
+
background-image:
|
|
70
|
+
radial-gradient(circle at 82% 82%, #f2ffe6 0, #a3ecc8 26%, transparent 58%),
|
|
71
|
+
radial-gradient(circle at 18% 18%, #02201a 0, #0c5040 38%, transparent 68%),
|
|
72
|
+
linear-gradient(136.64deg, #083a2f, #178a68 38%, #42cfb2 72%, #d9f6c6);
|
|
73
|
+
background-position: 50% 50%;
|
|
74
|
+
background-size: 176% 176%;
|
|
75
|
+
}
|
|
76
|
+
.ku-launch-chip.is-splash .ku-launch-chip__orb { background-size: 190% 190%; }
|
|
77
|
+
.ku-launch-chip__orb::after {
|
|
78
|
+
content: "";
|
|
79
|
+
position: absolute;
|
|
80
|
+
inset: 0;
|
|
81
|
+
z-index: 1;
|
|
82
|
+
border-radius: inherit;
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 160'%3E%3Cfilter id='g' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='.8 .8 .8 0 -.7 .8 .8 .8 0 -.7 .8 .8 .8 0 -.7 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
|
|
85
|
+
background-size: 64px 64px;
|
|
86
|
+
mix-blend-mode: overlay;
|
|
87
|
+
opacity: .36;
|
|
88
|
+
}
|
|
89
|
+
.ku-launch-chip__badge {
|
|
90
|
+
position: relative;
|
|
91
|
+
z-index: 2;
|
|
92
|
+
font-size: 16px;
|
|
93
|
+
font-weight: 500;
|
|
94
|
+
line-height: 24px;
|
|
95
|
+
color: var(--ku-night, #060c09);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* ------------------------------------------------------------ the splash layer */
|
|
99
|
+
.ku-launch-chip__splash { display: none; }
|
|
100
|
+
.ku-launch-chip__word {
|
|
101
|
+
position: relative;
|
|
102
|
+
z-index: 2;
|
|
103
|
+
font-size: 14px;
|
|
104
|
+
font-weight: 500;
|
|
105
|
+
line-height: 21px;
|
|
106
|
+
letter-spacing: 1.68px;
|
|
107
|
+
padding-inline-start: 1.68px;
|
|
108
|
+
text-transform: uppercase;
|
|
109
|
+
color: #fbfff8;
|
|
110
|
+
}
|
|
111
|
+
.ku-launch-chip.is-grid .ku-launch-chip__word {
|
|
112
|
+
color: #f3fff8;
|
|
113
|
+
text-shadow: 0 0 10px rgba(60, 214, 196, .56), 0 1px 6px rgba(3, 14, 10, .72);
|
|
114
|
+
}
|
|
115
|
+
.ku-launch-chip__spark {
|
|
116
|
+
position: absolute;
|
|
117
|
+
z-index: 1;
|
|
118
|
+
display: inline-flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
justify-content: center;
|
|
121
|
+
width: var(--ku-spark-size, 13px);
|
|
122
|
+
height: var(--ku-spark-size, 13px);
|
|
123
|
+
pointer-events: none;
|
|
124
|
+
opacity: 0;
|
|
125
|
+
filter: drop-shadow(0 0 3.5px var(--ku-spark-glow, rgba(230, 243, 106, .55)));
|
|
126
|
+
}
|
|
127
|
+
.ku-launch-chip__spark > svg { display: block; width: 100%; height: 100%; overflow: visible; }
|
|
128
|
+
/* while a Glass Reveal is on, the drifting icons stay hidden */
|
|
129
|
+
:is([data-glass="active"], [data-glass="fading"]) .ku-launch-chip__spark { visibility: hidden; }
|
|
130
|
+
|
|
131
|
+
/* ------------------------------------------------------------ the rolling label */
|
|
132
|
+
/* a one-line window with soft edges over three lines: label / secondary / label again */
|
|
133
|
+
.ku-launch-chip__window {
|
|
134
|
+
display: inline-flex;
|
|
135
|
+
align-items: flex-start;
|
|
136
|
+
height: 21px;
|
|
137
|
+
overflow: hidden;
|
|
138
|
+
padding-right: 0;
|
|
139
|
+
-webkit-mask-image: linear-gradient(transparent 0, #000 12%, #000 88%, transparent);
|
|
140
|
+
mask-image: linear-gradient(transparent 0, #000 12%, #000 88%, transparent);
|
|
141
|
+
}
|
|
142
|
+
.ku-launch-chip__track {
|
|
143
|
+
position: relative;
|
|
144
|
+
display: inline-flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
align-items: flex-start;
|
|
147
|
+
height: 21px;
|
|
148
|
+
will-change: transform;
|
|
149
|
+
}
|
|
150
|
+
.ku-launch-chip__line {
|
|
151
|
+
display: inline-flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
flex-shrink: 0;
|
|
154
|
+
height: 21px;
|
|
155
|
+
white-space: nowrap;
|
|
156
|
+
font-size: 14px;
|
|
157
|
+
font-weight: 500;
|
|
158
|
+
line-height: 21px;
|
|
159
|
+
}
|
|
160
|
+
.ku-launch-chip__line + .ku-launch-chip__line { position: absolute; left: 0; top: 100%; }
|
|
161
|
+
.ku-launch-chip__line + .ku-launch-chip__line + .ku-launch-chip__line { top: 200%; }
|
|
162
|
+
|
|
163
|
+
/* ------------------------------------------------------------ motion */
|
|
164
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
165
|
+
.ku-launch-chip {
|
|
166
|
+
animation: ku-chip-in 1s ease-out var(--ku-chip-delay, 1.3s) both;
|
|
167
|
+
}
|
|
168
|
+
.ku-launch-chip.is-splash { animation-duration: .45s; }
|
|
169
|
+
|
|
170
|
+
.ku-launch-chip__orb { animation: ku-chip-orb-drift 8s ease-in-out infinite alternate; }
|
|
171
|
+
|
|
172
|
+
/* splash: the badge lives on the chip itself while it is a pill */
|
|
173
|
+
.ku-launch-chip.is-splash .ku-launch-chip__lead { position: static; overflow: visible; }
|
|
174
|
+
.ku-launch-chip.is-splash .ku-launch-chip__orb {
|
|
175
|
+
position: absolute;
|
|
176
|
+
z-index: 1;
|
|
177
|
+
animation:
|
|
178
|
+
ku-chip-orb-unfold 3.8s linear calc(var(--ku-chip-delay, 1.3s) + .55s) both,
|
|
179
|
+
ku-chip-orb-drift 8s ease-in-out calc(var(--ku-chip-delay, 1.3s) + 4.35s) infinite alternate;
|
|
180
|
+
}
|
|
181
|
+
.ku-launch-chip.is-splash.is-grid .ku-launch-chip__orb {
|
|
182
|
+
animation:
|
|
183
|
+
ku-chip-orb-unfold-long 4.65s linear calc(var(--ku-chip-delay, 1.3s) + .55s) both,
|
|
184
|
+
ku-chip-orb-drift 8s ease-in-out calc(var(--ku-chip-delay, 1.3s) + 5.2s) infinite alternate;
|
|
185
|
+
}
|
|
186
|
+
.ku-launch-chip.is-splash .ku-launch-chip__badge {
|
|
187
|
+
animation: ku-chip-fade-in .3s ease-out calc(var(--ku-chip-delay, 1.3s) + 4.25s) both;
|
|
188
|
+
}
|
|
189
|
+
.ku-launch-chip.is-splash.is-grid .ku-launch-chip__badge {
|
|
190
|
+
animation: ku-chip-fade-in .45s cubic-bezier(.22, 1, .36, 1) calc(var(--ku-chip-delay, 1.3s) + 4.85s) both;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.ku-launch-chip.is-splash .ku-launch-chip__splash {
|
|
194
|
+
position: absolute;
|
|
195
|
+
inset: 0;
|
|
196
|
+
z-index: 2;
|
|
197
|
+
display: flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
justify-content: center;
|
|
200
|
+
border-radius: inherit;
|
|
201
|
+
overflow: hidden;
|
|
202
|
+
pointer-events: none;
|
|
203
|
+
animation: ku-chip-fade-out .25s cubic-bezier(.23, 1, .32, 1) calc(var(--ku-chip-delay, 1.3s) + 3.75s) forwards;
|
|
204
|
+
}
|
|
205
|
+
.ku-launch-chip.is-splash.is-grid .ku-launch-chip__splash {
|
|
206
|
+
animation: ku-chip-fade-out .5s cubic-bezier(.2, 0, 0, 1) calc(var(--ku-chip-delay, 1.3s) + 3.65s) forwards;
|
|
207
|
+
}
|
|
208
|
+
.ku-launch-chip__word {
|
|
209
|
+
animation: ku-chip-word-in .45s cubic-bezier(.23, 1, .32, 1) calc(var(--ku-chip-delay, 1.3s) + .8s) both;
|
|
210
|
+
}
|
|
211
|
+
.ku-launch-chip__spark {
|
|
212
|
+
animation: ku-chip-spark-float var(--ku-spark-dur, 2.85s) ease calc(var(--ku-chip-delay, 1.3s) + var(--ku-spark-delay, .55s)) 1 both;
|
|
213
|
+
}
|
|
214
|
+
.ku-launch-chip__spark[data-motion="spin"] { animation-name: ku-chip-spark-spin; }
|
|
215
|
+
.ku-launch-chip__spark[data-motion="orbit"] { animation-name: ku-chip-spark-orbit; }
|
|
216
|
+
.ku-launch-chip__spark[data-motion="pulse"] { animation-name: ku-chip-spark-pulse; }
|
|
217
|
+
|
|
218
|
+
.ku-launch-chip.is-splash .ku-launch-chip__line:first-child {
|
|
219
|
+
animation: ku-chip-label-in .4s cubic-bezier(.22, 1, .36, 1) calc(var(--ku-chip-delay, 1.3s) + 4.22s) both;
|
|
220
|
+
}
|
|
221
|
+
.ku-launch-chip.is-splash.is-grid .ku-launch-chip__line:first-child {
|
|
222
|
+
animation-duration: .55s;
|
|
223
|
+
animation-delay: calc(var(--ku-chip-delay, 1.3s) + 4.7s);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.ku-launch-chip__window.is-rolling {
|
|
227
|
+
animation: ku-chip-widen 8s cubic-bezier(.65, 0, .35, 1) calc(var(--ku-chip-delay, 1.3s) + var(--ku-chip-cycle-at, .5s)) 1 both;
|
|
228
|
+
}
|
|
229
|
+
.ku-launch-chip__window.is-rolling.is-narrowing { animation-name: ku-chip-narrow; }
|
|
230
|
+
.ku-launch-chip__window.is-rolling .ku-launch-chip__track {
|
|
231
|
+
animation: ku-chip-roll 8s cubic-bezier(.65, 0, .35, 1) calc(var(--ku-chip-delay, 1.3s) + var(--ku-chip-cycle-at, .5s)) 1 both;
|
|
232
|
+
}
|
|
233
|
+
.ku-launch-chip__window.is-rolling.is-narrowing .ku-launch-chip__track { animation-name: ku-chip-roll-narrow; }
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
@keyframes ku-chip-in {
|
|
237
|
+
from { opacity: 0; filter: blur(10px); }
|
|
238
|
+
to { opacity: 1; filter: none; }
|
|
239
|
+
}
|
|
240
|
+
@keyframes ku-chip-fade-in { from { opacity: 0; } to { opacity: 1; } }
|
|
241
|
+
@keyframes ku-chip-fade-out { from { opacity: 1; } to { opacity: 0; } }
|
|
242
|
+
@keyframes ku-chip-word-in {
|
|
243
|
+
from { opacity: 0; filter: blur(10px); }
|
|
244
|
+
to { opacity: 1; filter: blur(0); }
|
|
245
|
+
}
|
|
246
|
+
@keyframes ku-chip-orb-drift {
|
|
247
|
+
0% { background-position: 78% 68%; }
|
|
248
|
+
50% { background-position: 50% 55%; }
|
|
249
|
+
100% { background-position: 22% 68%; }
|
|
250
|
+
}
|
|
251
|
+
/* the pill: wiped in from the left, held behind the word, then pulled into the 26px badge */
|
|
252
|
+
@keyframes ku-chip-orb-unfold {
|
|
253
|
+
0% {
|
|
254
|
+
animation-timing-function: cubic-bezier(.22, 1, .36, 1);
|
|
255
|
+
background-position: 96% 64%;
|
|
256
|
+
clip-path: inset(0 100% 0 0 round 9999px);
|
|
257
|
+
top: 0; left: 0; width: 100%; height: 100%;
|
|
258
|
+
}
|
|
259
|
+
18.42%, 84.21% {
|
|
260
|
+
animation-timing-function: cubic-bezier(.65, 0, .35, 1);
|
|
261
|
+
background-position: 42% 50%;
|
|
262
|
+
clip-path: inset(0 round 9999px);
|
|
263
|
+
top: 0; left: 0; width: 100%; height: 100%;
|
|
264
|
+
}
|
|
265
|
+
51.32% { background-position: 35% 54%; }
|
|
266
|
+
100% {
|
|
267
|
+
background-position: 78% 68%;
|
|
268
|
+
clip-path: inset(0 round 9999px);
|
|
269
|
+
top: 6px; left: 6px; width: 26px; height: 26px;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
@keyframes ku-chip-orb-unfold-long {
|
|
273
|
+
0% {
|
|
274
|
+
animation-timing-function: cubic-bezier(.22, 1, .36, 1);
|
|
275
|
+
background-position: 96% 64%;
|
|
276
|
+
clip-path: inset(0 100% 0 0 round 9999px);
|
|
277
|
+
top: 0; left: 0; width: 100%; height: 100%;
|
|
278
|
+
}
|
|
279
|
+
15%, 80% {
|
|
280
|
+
animation-timing-function: cubic-bezier(.2, 0, 0, 1);
|
|
281
|
+
background-position: 42% 50%;
|
|
282
|
+
clip-path: inset(0 round 9999px);
|
|
283
|
+
top: 0; left: 0; width: 100%; height: 100%;
|
|
284
|
+
}
|
|
285
|
+
48% { background-position: 35% 54%; }
|
|
286
|
+
100% {
|
|
287
|
+
background-position: 78% 68%;
|
|
288
|
+
clip-path: inset(0 round 9999px);
|
|
289
|
+
top: 6px; left: 6px; width: 26px; height: 26px;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
@keyframes ku-chip-spark-spin {
|
|
293
|
+
0% { opacity: 0; transform: translate3d(0, 3px, 0) scale(.86) rotate(0deg); }
|
|
294
|
+
18% { opacity: var(--ku-spark-peak, .94); }
|
|
295
|
+
52% { transform: translate3d(var(--ku-spark-dx, 4px), var(--ku-spark-dy, -3px), 0) scale(1.04) rotate(72deg); }
|
|
296
|
+
84% { opacity: calc(var(--ku-spark-peak, .94) * .88); }
|
|
297
|
+
100% { opacity: 0; transform: translate3d(calc(var(--ku-spark-dx, 4px) * -.5), calc(var(--ku-spark-dy, -3px) * 1.4), 0) scale(.92) rotate(148deg); }
|
|
298
|
+
}
|
|
299
|
+
@keyframes ku-chip-spark-orbit {
|
|
300
|
+
0% { opacity: 0; transform: translate3d(-4px, 3px, 0) scale(.88) rotate(-14deg); }
|
|
301
|
+
20% { opacity: var(--ku-spark-peak, .96); }
|
|
302
|
+
55% { transform: translate3d(var(--ku-spark-dx, 5px), var(--ku-spark-dy, -4px), 0) scale(1.06) rotate(10deg); }
|
|
303
|
+
85% { opacity: calc(var(--ku-spark-peak, .96) * .88); }
|
|
304
|
+
100% { opacity: 0; transform: translate3d(calc(var(--ku-spark-dx, 5px) * 1.3), calc(var(--ku-spark-dy, -4px) * .4), 0) scale(.94) rotate(22deg); }
|
|
305
|
+
}
|
|
306
|
+
@keyframes ku-chip-spark-pulse {
|
|
307
|
+
0% { opacity: 0; transform: translate3d(0, 2px, 0) scale(.86); }
|
|
308
|
+
22% { opacity: var(--ku-spark-peak, .94); transform: translate3d(calc(var(--ku-spark-dx, 3px) * .5), var(--ku-spark-dy, -2px), 0) scale(1.1); }
|
|
309
|
+
56% { opacity: calc(var(--ku-spark-peak, .94) * .72); transform: translate3d(var(--ku-spark-dx, 3px), calc(var(--ku-spark-dy, -2px) * -.5), 0) scale(.94); }
|
|
310
|
+
82% { opacity: var(--ku-spark-peak, .94); transform: translate3d(calc(var(--ku-spark-dx, 3px) * .4), var(--ku-spark-dy, -2px), 0) scale(1.08); }
|
|
311
|
+
100% { opacity: 0; transform: translate3d(0, -3px, 0) scale(.9); }
|
|
312
|
+
}
|
|
313
|
+
@keyframes ku-chip-spark-float {
|
|
314
|
+
0% { opacity: 0; transform: translate3d(0, 4px, 0) scale(.88) rotate(-8deg); }
|
|
315
|
+
20% { opacity: var(--ku-spark-peak, .94); }
|
|
316
|
+
52% { transform: translate3d(var(--ku-spark-dx, -4px), var(--ku-spark-dy, -4px), 0) scale(1.04) rotate(8deg); }
|
|
317
|
+
84% { opacity: calc(var(--ku-spark-peak, .94) * .86); }
|
|
318
|
+
100% { opacity: 0; transform: translate3d(calc(var(--ku-spark-dx, -4px) * 1.2), calc(var(--ku-spark-dy, -4px) * 1.3), 0) scale(.92) rotate(-4deg); }
|
|
319
|
+
}
|
|
320
|
+
@keyframes ku-chip-label-in {
|
|
321
|
+
from { opacity: 0; transform: translateY(-6px); filter: blur(4px); }
|
|
322
|
+
to { opacity: 1; transform: translateY(0); filter: blur(0); }
|
|
323
|
+
}
|
|
324
|
+
/* longer secondary line: widen, roll up, hold, roll up to the copy, narrow */
|
|
325
|
+
@keyframes ku-chip-widen {
|
|
326
|
+
0%, 25% { padding-right: 0; }
|
|
327
|
+
31.25%, 93.75% { padding-right: var(--ku-chip-grow, 16px); }
|
|
328
|
+
100% { padding-right: 0; }
|
|
329
|
+
}
|
|
330
|
+
@keyframes ku-chip-roll {
|
|
331
|
+
0%, 31.25% { transform: translateY(0); }
|
|
332
|
+
43.75%, 81.25% { transform: translateY(-100%); }
|
|
333
|
+
93.75%, 100% { transform: translateY(-200%); }
|
|
334
|
+
}
|
|
335
|
+
/* shorter secondary line: roll up, narrow, hold, widen, roll up to the copy */
|
|
336
|
+
@keyframes ku-chip-narrow {
|
|
337
|
+
0%, 37.5% { margin-right: 0; }
|
|
338
|
+
45%, 75% { margin-right: var(--ku-chip-grow, 0); }
|
|
339
|
+
82.5%, 100% { margin-right: 0; }
|
|
340
|
+
}
|
|
341
|
+
@keyframes ku-chip-roll-narrow {
|
|
342
|
+
0%, 25% { transform: translateY(0); }
|
|
343
|
+
37.5%, 82.5% { transform: translateY(-100%); }
|
|
344
|
+
95%, 100% { transform: translateY(-200%); }
|
|
345
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, type CSSProperties, type RefObject } from 'react';
|
|
2
|
+
import { RingEngine } from './ring';
|
|
3
|
+
import './ring-reveal.css';
|
|
4
|
+
|
|
5
|
+
export type RingOrigin = RefObject<HTMLElement | null> | (() => { x: number; y: number });
|
|
6
|
+
|
|
7
|
+
export interface RingRevealProps {
|
|
8
|
+
/** true = the ring opens from the origin; false = it folds back in */
|
|
9
|
+
active: boolean;
|
|
10
|
+
/** ref: the element's centre; function: a point in the canvas's own px. Default: the centre */
|
|
11
|
+
origin?: RingOrigin;
|
|
12
|
+
/** the colour behind the ring, default the KodeUI night #060c09 */
|
|
13
|
+
color?: string;
|
|
14
|
+
/** 1 = real time, 0.25 = slow motion */
|
|
15
|
+
timeScale?: number;
|
|
16
|
+
/** the quick fold used after a click */
|
|
17
|
+
fastFade?: boolean;
|
|
18
|
+
/** called when a fold has finished and the canvas is clear */
|
|
19
|
+
onIdle?: () => void;
|
|
20
|
+
className?: string;
|
|
21
|
+
style?: CSSProperties;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface RingRevealHandle {
|
|
25
|
+
readonly engine: RingEngine | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function originPoint(origin: RingOrigin | undefined, canvas: HTMLCanvasElement): { x: number; y: number } {
|
|
29
|
+
if (typeof origin === 'function') return origin();
|
|
30
|
+
const box = canvas.getBoundingClientRect();
|
|
31
|
+
const el = origin ? origin.current : null;
|
|
32
|
+
if (el) {
|
|
33
|
+
const r = el.getBoundingClientRect();
|
|
34
|
+
return { x: r.left + r.width / 2 - box.left, y: r.top + r.height / 2 - box.top };
|
|
35
|
+
}
|
|
36
|
+
return { x: box.width / 2, y: box.height / 2 };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const FILL: CSSProperties = { position: 'absolute', inset: 0, width: '100%', height: '100%', pointerEvents: 'none' };
|
|
40
|
+
|
|
41
|
+
/** A soft ring that grows out of an element and darkens everything behind it. */
|
|
42
|
+
export const RingReveal = forwardRef<RingRevealHandle, RingRevealProps>(function RingReveal(
|
|
43
|
+
{ active, origin, color, timeScale = 1, fastFade = false, onIdle, className, style },
|
|
44
|
+
ref,
|
|
45
|
+
) {
|
|
46
|
+
const canvasRef = useRef<HTMLCanvasElement>(null);
|
|
47
|
+
const engineRef = useRef<RingEngine | null>(null);
|
|
48
|
+
const originRef = useRef(origin);
|
|
49
|
+
originRef.current = origin;
|
|
50
|
+
const onIdleRef = useRef(onIdle);
|
|
51
|
+
onIdleRef.current = onIdle;
|
|
52
|
+
const firstColor = useRef(color);
|
|
53
|
+
|
|
54
|
+
useImperativeHandle(ref, () => ({ get engine() { return engineRef.current; } }), []);
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const canvas = canvasRef.current;
|
|
58
|
+
if (!canvas) return;
|
|
59
|
+
const engine = new RingEngine(canvas, {
|
|
60
|
+
origin: () => originPoint(originRef.current, canvas),
|
|
61
|
+
color: firstColor.current,
|
|
62
|
+
onIdle: () => onIdleRef.current?.(),
|
|
63
|
+
});
|
|
64
|
+
engineRef.current = engine;
|
|
65
|
+
return () => {
|
|
66
|
+
engine.destroy();
|
|
67
|
+
if (engineRef.current === engine) engineRef.current = null;
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
|
+
|
|
71
|
+
useEffect(() => { engineRef.current?.setColor(color); }, [color]);
|
|
72
|
+
useEffect(() => { if (engineRef.current) engineRef.current.timeScale = timeScale > 0 ? timeScale : 1; }, [timeScale]);
|
|
73
|
+
useEffect(() => { engineRef.current?.setFastFade(fastFade); }, [fastFade]);
|
|
74
|
+
useEffect(() => { engineRef.current?.setActive(active); }, [active]);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<canvas
|
|
78
|
+
ref={canvasRef}
|
|
79
|
+
className={'ku-ring-reveal' + (className ? ' ' + className : '')}
|
|
80
|
+
style={style ? { ...FILL, ...style } : FILL}
|
|
81
|
+
aria-hidden="true"
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { RingReveal } from './RingReveal';
|
|
2
|
+
export type { RingRevealProps, RingRevealHandle, RingOrigin } from './RingReveal';
|
|
3
|
+
export { RingEngine, openCover, foldCover, plainFade, RING_OPEN_SECONDS, RING_REOPEN_SECONDS, RING_FOLD_SECONDS } from './ring';
|
|
4
|
+
export type { RingEngineOptions, RingState } from './ring';
|