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,134 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* KodeUI Glow Card
|
|
3
|
+
* A 1 px light runs round the card's border and a blurred copy of it glows behind.
|
|
4
|
+
* The angle and the four light colours are registered properties, so the angle can spin
|
|
5
|
+
* and the colours can fade from half strength to full on hover.
|
|
6
|
+
*/
|
|
7
|
+
@property --ku-glow-card-angle { syntax: '<angle>'; initial-value: 0deg; inherits: true; }
|
|
8
|
+
@property --ku-glow-card-a { syntax: '<color>'; initial-value: rgba(77, 168, 255, .55); inherits: true; }
|
|
9
|
+
@property --ku-glow-card-b { syntax: '<color>'; initial-value: rgba(94, 224, 138, .5); inherits: true; }
|
|
10
|
+
@property --ku-glow-card-c { syntax: '<color>'; initial-value: rgba(255, 193, 77, .5); inherits: true; }
|
|
11
|
+
@property --ku-glow-card-d { syntax: '<color>'; initial-value: rgba(255, 107, 107, .5); inherits: true; }
|
|
12
|
+
|
|
13
|
+
.ku-glow-card {
|
|
14
|
+
/* the four lights: lagoon, fern, amber, coral (override with the `colors` prop) */
|
|
15
|
+
--ku-gc-1: var(--ku-glow-card-1, var(--ku-lagoon, #4da8ff));
|
|
16
|
+
--ku-gc-2: var(--ku-glow-card-2, var(--ku-fern, #5ee08a));
|
|
17
|
+
--ku-gc-3: var(--ku-glow-card-3, var(--ku-amber, #ffc14d));
|
|
18
|
+
--ku-gc-4: var(--ku-glow-card-4, var(--ku-coral, #ff6b6b));
|
|
19
|
+
--ku-gc-rest: var(--ku-glow-card-neutral, var(--ku-outline, #24342c));
|
|
20
|
+
--ku-gc-radius: var(--ku-glow-card-radius, 16px);
|
|
21
|
+
|
|
22
|
+
/* at rest every light shows at half strength */
|
|
23
|
+
--ku-glow-card-a: color-mix(in srgb, var(--ku-gc-1) 55%, transparent);
|
|
24
|
+
--ku-glow-card-b: color-mix(in srgb, var(--ku-gc-2) 50%, transparent);
|
|
25
|
+
--ku-glow-card-c: color-mix(in srgb, var(--ku-gc-3) 50%, transparent);
|
|
26
|
+
--ku-glow-card-d: color-mix(in srgb, var(--ku-gc-4) 50%, transparent);
|
|
27
|
+
|
|
28
|
+
position: relative;
|
|
29
|
+
isolation: isolate;
|
|
30
|
+
display: block;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
padding: 1px;
|
|
33
|
+
border-radius: var(--ku-gc-radius);
|
|
34
|
+
box-shadow: 0 3px 3px -1.5px rgba(4, 10, 7, .04), 0 8px 8px -4px rgba(4, 10, 7, .03), 0 20px 24px -4px rgba(4, 10, 7, .08);
|
|
35
|
+
transition:
|
|
36
|
+
--ku-glow-card-a .6s ease-in-out, --ku-glow-card-b .6s ease-in-out,
|
|
37
|
+
--ku-glow-card-c .6s ease-in-out, --ku-glow-card-d .6s ease-in-out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* ::before is the soft glow, ::after the crisp 1 px ring; the body covers all but its edge */
|
|
41
|
+
.ku-glow-card::before,
|
|
42
|
+
.ku-glow-card::after {
|
|
43
|
+
content: '';
|
|
44
|
+
position: absolute;
|
|
45
|
+
inset: 0;
|
|
46
|
+
z-index: -1;
|
|
47
|
+
border-radius: inherit;
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
background: conic-gradient(from var(--ku-glow-card-angle, 0deg) at 50% 50%,
|
|
50
|
+
var(--ku-gc-rest) 0deg, var(--ku-gc-rest) 69deg,
|
|
51
|
+
var(--ku-glow-card-a) 115deg, var(--ku-glow-card-b) 193deg,
|
|
52
|
+
var(--ku-gc-rest) 270deg, var(--ku-glow-card-c) 291deg,
|
|
53
|
+
var(--ku-glow-card-d) 322deg, var(--ku-gc-rest) 1turn);
|
|
54
|
+
}
|
|
55
|
+
.ku-glow-card::before {
|
|
56
|
+
filter: blur(14px);
|
|
57
|
+
opacity: .4;
|
|
58
|
+
transition: filter .6s ease-in-out, opacity .6s ease-in-out;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* lit: full-strength lights and a bigger, brighter glow */
|
|
62
|
+
.ku-glow-card:hover,
|
|
63
|
+
.ku-glow-card[data-hover] {
|
|
64
|
+
--ku-glow-card-a: var(--ku-gc-1);
|
|
65
|
+
--ku-glow-card-b: var(--ku-gc-2);
|
|
66
|
+
--ku-glow-card-c: var(--ku-gc-3);
|
|
67
|
+
--ku-glow-card-d: var(--ku-gc-4);
|
|
68
|
+
}
|
|
69
|
+
.ku-glow-card:hover::before,
|
|
70
|
+
.ku-glow-card[data-hover]::before {
|
|
71
|
+
filter: blur(18px);
|
|
72
|
+
opacity: .7;
|
|
73
|
+
}
|
|
74
|
+
/* keyboard focus lights it too (its own rules, so browsers without :has keep the hover) */
|
|
75
|
+
.ku-glow-card:has(> .ku-glow-card__body:focus-visible) {
|
|
76
|
+
--ku-glow-card-a: var(--ku-gc-1);
|
|
77
|
+
--ku-glow-card-b: var(--ku-gc-2);
|
|
78
|
+
--ku-glow-card-c: var(--ku-gc-3);
|
|
79
|
+
--ku-glow-card-d: var(--ku-gc-4);
|
|
80
|
+
}
|
|
81
|
+
.ku-glow-card:has(> .ku-glow-card__body:focus-visible)::before {
|
|
82
|
+
filter: blur(18px);
|
|
83
|
+
opacity: .7;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* one turn per 40 s, one per 8 s while lit (the angle jumps when the speed changes) */
|
|
87
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
88
|
+
.ku-glow-card { animation: ku-glow-card-spin var(--ku-glow-card-spin, 40s) linear infinite; }
|
|
89
|
+
.ku-glow-card:hover,
|
|
90
|
+
.ku-glow-card[data-hover] { animation-duration: var(--ku-glow-card-hover-spin, 8s); }
|
|
91
|
+
.ku-glow-card:has(> .ku-glow-card__body:focus-visible) { animation-duration: var(--ku-glow-card-hover-spin, 8s); }
|
|
92
|
+
}
|
|
93
|
+
@keyframes ku-glow-card-spin { to { --ku-glow-card-angle: 360deg; } }
|
|
94
|
+
|
|
95
|
+
.ku-glow-card__body {
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
gap: 2px;
|
|
99
|
+
box-sizing: border-box;
|
|
100
|
+
width: 100%;
|
|
101
|
+
margin: 0;
|
|
102
|
+
padding: 12px;
|
|
103
|
+
border: none;
|
|
104
|
+
border-radius: calc(var(--ku-gc-radius) - 1px);
|
|
105
|
+
background-color: var(--ku-glow-card-bg, var(--ku-surface, #131e18));
|
|
106
|
+
color: var(--ku-text, #e8f1eb);
|
|
107
|
+
font: inherit;
|
|
108
|
+
text-align: start;
|
|
109
|
+
text-decoration: none;
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
transition: background-color .2s ease-in-out;
|
|
112
|
+
}
|
|
113
|
+
div.ku-glow-card__body { cursor: default; }
|
|
114
|
+
.ku-glow-card__body:hover,
|
|
115
|
+
.ku-glow-card[data-hover] > .ku-glow-card__body {
|
|
116
|
+
background-color: var(--ku-glow-card-bg-hover, var(--ku-surface-high, #192620));
|
|
117
|
+
}
|
|
118
|
+
.ku-glow-card__body:focus { outline: none; }
|
|
119
|
+
.ku-glow-card__body:focus-visible { outline: 2px solid var(--ku-fern, #5ee08a); outline-offset: 3px; }
|
|
120
|
+
|
|
121
|
+
.ku-glow-card__title {
|
|
122
|
+
display: block;
|
|
123
|
+
font-size: 12px;
|
|
124
|
+
font-weight: 500;
|
|
125
|
+
line-height: 18px;
|
|
126
|
+
color: var(--ku-text, #e8f1eb);
|
|
127
|
+
}
|
|
128
|
+
.ku-glow-card__text {
|
|
129
|
+
display: block;
|
|
130
|
+
font-size: 12px;
|
|
131
|
+
font-weight: 400;
|
|
132
|
+
line-height: 18px;
|
|
133
|
+
color: var(--ku-text-2, #a2b6aa);
|
|
134
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef, useEffect, useLayoutEffect, useRef, useState,
|
|
3
|
+
type ButtonHTMLAttributes, type CSSProperties, type ReactNode,
|
|
4
|
+
} from 'react';
|
|
5
|
+
import { NATURE_GLOWS, NATURE_ICONS } from './icons';
|
|
6
|
+
import './launch-chip.css';
|
|
7
|
+
|
|
8
|
+
export interface LaunchChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
9
|
+
/** The main line, e.g. "KodeUI 1.0 is here". */
|
|
10
|
+
label: string;
|
|
11
|
+
/** A second line the label rolls up to and back from. The chip widens or narrows to fit it. */
|
|
12
|
+
secondaryLabel?: string;
|
|
13
|
+
/** The word shown big in the splash pill, e.g. "Bloom". */
|
|
14
|
+
word?: string;
|
|
15
|
+
/** Text on the round badge at the left, e.g. "1". */
|
|
16
|
+
badge?: string;
|
|
17
|
+
/**
|
|
18
|
+
* 'splash' = the pill wipe with drifting icons, then the badge.
|
|
19
|
+
* 'grid' = the same splash on the slower timing used when a Bloom Wall intro plays with it.
|
|
20
|
+
* 'none' = the chip just fades in.
|
|
21
|
+
*/
|
|
22
|
+
intro?: 'splash' | 'grid' | 'none';
|
|
23
|
+
/** Seconds before the chip enters. Default 1.3. */
|
|
24
|
+
delay?: number;
|
|
25
|
+
/** Eight tiny SVGs for the splash. Default: the KodeUI night-garden set. */
|
|
26
|
+
icons?: ReactNode[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type Motion = 'spin' | 'orbit' | 'pulse' | 'float';
|
|
30
|
+
interface Slot {
|
|
31
|
+
motion: Motion;
|
|
32
|
+
delay: number; // s after the chip enters
|
|
33
|
+
dur: number; // s
|
|
34
|
+
dx: number; // px
|
|
35
|
+
dy: number; // px
|
|
36
|
+
peak: number; // peak opacity
|
|
37
|
+
size: number; // px
|
|
38
|
+
left: number; // % of the chip
|
|
39
|
+
top: number; // % of the chip
|
|
40
|
+
z?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Where each splash icon sits and how it moves. */
|
|
44
|
+
const SLOTS: readonly Slot[] = [
|
|
45
|
+
{ motion: 'orbit', delay: 0.5, dur: 2.95, dx: 4, dy: -3, peak: 0.96, size: 15, left: 6, top: 24 },
|
|
46
|
+
{ motion: 'spin', delay: 0.62, dur: 2.75, dx: -3, dy: -4, peak: 0.94, size: 13, left: 16, top: 52, z: 2 },
|
|
47
|
+
{ motion: 'float', delay: 0.72, dur: 2.65, dx: 4, dy: 3, peak: 0.9, size: 12, left: 26.5, top: 18 },
|
|
48
|
+
{ motion: 'pulse', delay: 0.8, dur: 2.55, dx: -3, dy: -3, peak: 0.86, size: 11, left: 32, top: 62 },
|
|
49
|
+
{ motion: 'spin', delay: 0.68, dur: 2.8, dx: 3, dy: -3, peak: 0.9, size: 12, left: 66, top: 18 },
|
|
50
|
+
{ motion: 'spin', delay: 0.58, dur: 2.9, dx: -4, dy: -2, peak: 0.95, size: 14, left: 73.5, top: 58, z: 2 },
|
|
51
|
+
{ motion: 'pulse', delay: 0.78, dur: 2.7, dx: 3, dy: 3, peak: 0.92, size: 12.5, left: 82, top: 20 },
|
|
52
|
+
{ motion: 'float', delay: 0.54, dur: 3, dx: -4, dy: -3, peak: 0.96, size: 14.5, left: 89.5, top: 48 },
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
type Vars = CSSProperties & Record<`--${string}`, string | number>;
|
|
56
|
+
|
|
57
|
+
const useIsoLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* An announcement pill. With a splash intro a glowing pill wipes across it, tiny icons drift
|
|
61
|
+
* and fade around a word, then the pill shrinks into the round badge, the label slides in and
|
|
62
|
+
* later rolls up to the secondary line and back. Pure CSS motion, measured once in JS so the
|
|
63
|
+
* pill can grow (or shrink) to fit the secondary line. Forwarded ref is the <button>.
|
|
64
|
+
*/
|
|
65
|
+
export const LaunchChip = forwardRef<HTMLButtonElement, LaunchChipProps>(function LaunchChip(
|
|
66
|
+
{ label, secondaryLabel, word, badge, intro = 'splash', delay = 1.3, icons, className, style, type, children: _children, ...rest },
|
|
67
|
+
ref,
|
|
68
|
+
) {
|
|
69
|
+
const orbRef = useRef<HTMLSpanElement | null>(null);
|
|
70
|
+
const windowRef = useRef<HTMLSpanElement | null>(null);
|
|
71
|
+
const trackRef = useRef<HTMLSpanElement | null>(null);
|
|
72
|
+
const firstRef = useRef<HTMLSpanElement | null>(null);
|
|
73
|
+
const secondRef = useRef<HTMLSpanElement | null>(null);
|
|
74
|
+
const [delta, setDelta] = useState<number | null>(null);
|
|
75
|
+
const rolls = Boolean(secondaryLabel);
|
|
76
|
+
const splash = intro !== 'none';
|
|
77
|
+
|
|
78
|
+
// How much wider (or narrower, if negative) the secondary line is. Measured before the first
|
|
79
|
+
// paint, then again whenever a line changes size (a web font arriving, a new label).
|
|
80
|
+
useIsoLayoutEffect(() => {
|
|
81
|
+
const a = firstRef.current;
|
|
82
|
+
const b = secondRef.current;
|
|
83
|
+
if (!rolls || !a || !b) return;
|
|
84
|
+
const measure = () => {
|
|
85
|
+
const d = b.offsetWidth - a.offsetWidth;
|
|
86
|
+
setDelta((prev) => (prev === d ? prev : d));
|
|
87
|
+
};
|
|
88
|
+
measure();
|
|
89
|
+
let live = true;
|
|
90
|
+
const ro = typeof ResizeObserver === 'function' ? new ResizeObserver(measure) : null;
|
|
91
|
+
ro?.observe(a);
|
|
92
|
+
ro?.observe(b);
|
|
93
|
+
document.fonts?.ready.then(() => { if (live) measure(); }, () => {});
|
|
94
|
+
return () => {
|
|
95
|
+
live = false;
|
|
96
|
+
ro?.disconnect();
|
|
97
|
+
};
|
|
98
|
+
}, [rolls, label, secondaryLabel]);
|
|
99
|
+
|
|
100
|
+
// A shorter secondary line uses the shrinking schedule. Switching schedule restarts the two
|
|
101
|
+
// CSS animations, so put them back on the chip's own clock.
|
|
102
|
+
const narrowing = delta !== null && delta < 0;
|
|
103
|
+
const wasNarrowing = useRef(false);
|
|
104
|
+
useIsoLayoutEffect(() => {
|
|
105
|
+
if (wasNarrowing.current === narrowing) return;
|
|
106
|
+
wasNarrowing.current = narrowing;
|
|
107
|
+
const orb = orbRef.current;
|
|
108
|
+
if (!orb || typeof orb.getAnimations !== 'function') return;
|
|
109
|
+
// the orb's endless drift started when the chip mounted, like every part of the intro, and never finishes
|
|
110
|
+
const clock = orb.getAnimations().find((a) => (a as CSSAnimation).animationName === 'ku-chip-orb-drift');
|
|
111
|
+
if (!clock) return;
|
|
112
|
+
for (const el of [windowRef.current, trackRef.current]) {
|
|
113
|
+
el?.getAnimations().forEach((a) => {
|
|
114
|
+
if (!(a as CSSAnimation).animationName) return;
|
|
115
|
+
a.playbackRate = clock.playbackRate;
|
|
116
|
+
// a running clock: share its start time (no frame lost); a clock still waiting for its first frame: share its time
|
|
117
|
+
if (clock.startTime !== null) a.startTime = clock.startTime;
|
|
118
|
+
else if (clock.currentTime !== null) a.currentTime = clock.currentTime;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}, [narrowing]);
|
|
122
|
+
|
|
123
|
+
const vars: Vars = { '--ku-chip-delay': `${delay}s` };
|
|
124
|
+
if (delta !== null) vars['--ku-chip-grow'] = `${delta}px`;
|
|
125
|
+
|
|
126
|
+
const art = icons ?? NATURE_ICONS;
|
|
127
|
+
const classes = ['ku-launch-chip'];
|
|
128
|
+
if (splash) classes.push('is-splash');
|
|
129
|
+
if (intro === 'grid') classes.push('is-grid');
|
|
130
|
+
if (className) classes.push(className);
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<button
|
|
134
|
+
ref={ref}
|
|
135
|
+
type={type ?? 'button'}
|
|
136
|
+
className={classes.join(' ')}
|
|
137
|
+
data-intro={intro}
|
|
138
|
+
style={{ ...vars, ...style }}
|
|
139
|
+
{...rest}
|
|
140
|
+
>
|
|
141
|
+
{splash && (
|
|
142
|
+
<span className="ku-launch-chip__splash" aria-hidden="true">
|
|
143
|
+
{SLOTS.slice(0, Math.min(SLOTS.length, art.length)).map((slot, i) => (
|
|
144
|
+
<span key={i} className="ku-launch-chip__spark" data-motion={slot.motion} style={sparkStyle(slot, NATURE_GLOWS[i])}>
|
|
145
|
+
{art[i]}
|
|
146
|
+
</span>
|
|
147
|
+
))}
|
|
148
|
+
{word && <span className="ku-launch-chip__word">{word}</span>}
|
|
149
|
+
</span>
|
|
150
|
+
)}
|
|
151
|
+
<span className="ku-launch-chip__lead" aria-hidden="true">
|
|
152
|
+
<span ref={orbRef} className="ku-launch-chip__orb">
|
|
153
|
+
{badge && <span className="ku-launch-chip__badge">{badge}</span>}
|
|
154
|
+
</span>
|
|
155
|
+
</span>
|
|
156
|
+
<span ref={windowRef} className={'ku-launch-chip__window' + (rolls ? ' is-rolling' : '') + (narrowing ? ' is-narrowing' : '')}>
|
|
157
|
+
<span ref={trackRef} className="ku-launch-chip__track">
|
|
158
|
+
<span ref={firstRef} className="ku-launch-chip__line">{label}</span>
|
|
159
|
+
{rolls && <span ref={secondRef} className="ku-launch-chip__line" aria-hidden="true">{secondaryLabel}</span>}
|
|
160
|
+
{rolls && <span className="ku-launch-chip__line" aria-hidden="true">{label}</span>}
|
|
161
|
+
</span>
|
|
162
|
+
</span>
|
|
163
|
+
</button>
|
|
164
|
+
);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
function sparkStyle(slot: Slot, glow: string): Vars {
|
|
168
|
+
return {
|
|
169
|
+
'--ku-spark-delay': `${slot.delay}s`,
|
|
170
|
+
'--ku-spark-dur': `${slot.dur}s`,
|
|
171
|
+
'--ku-spark-dx': `${slot.dx}px`,
|
|
172
|
+
'--ku-spark-dy': `${slot.dy}px`,
|
|
173
|
+
'--ku-spark-peak': slot.peak,
|
|
174
|
+
'--ku-spark-size': `${slot.size}px`,
|
|
175
|
+
'--ku-spark-glow': glow,
|
|
176
|
+
left: `${slot.left}%`,
|
|
177
|
+
top: `${slot.top}%`,
|
|
178
|
+
...(slot.z ? { zIndex: slot.z } : null),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* The eight tiny night-garden icons that drift across the chip during its splash.
|
|
5
|
+
* Drawn on a 24 x 24 grid with thin glowing lines, in the KodeUI nature lights.
|
|
6
|
+
* Order matters: each one sits in a slot with its own motion (see SLOTS in LaunchChip.tsx).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const ring = (count: number, r1: number, r2: number) => {
|
|
10
|
+
let d = '';
|
|
11
|
+
for (let i = 0; i < count; i++) {
|
|
12
|
+
const a = (i / count) * Math.PI * 2 - Math.PI / 2;
|
|
13
|
+
const c = Math.cos(a), s = Math.sin(a);
|
|
14
|
+
d += `M${(12 + c * r1).toFixed(2)} ${(12 + s * r1).toFixed(2)}L${(12 + c * r2).toFixed(2)} ${(12 + s * r2).toFixed(2)}`;
|
|
15
|
+
}
|
|
16
|
+
return d;
|
|
17
|
+
};
|
|
18
|
+
const dots = (count: number, r: number) =>
|
|
19
|
+
Array.from({ length: count }, (_, i) => {
|
|
20
|
+
const a = (i / count) * Math.PI * 2 - Math.PI / 2;
|
|
21
|
+
return [Number((12 + Math.cos(a) * r).toFixed(2)), Number((12 + Math.sin(a) * r).toFixed(2))] as const;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const DANDELION_STALKS = ring(12, 3.3, 8.1);
|
|
25
|
+
const DANDELION_SEEDS = dots(12, 9.1);
|
|
26
|
+
|
|
27
|
+
/** 1. A firefly on a dotted loop (orbits). */
|
|
28
|
+
const Firefly = (
|
|
29
|
+
<svg viewBox="0 0 24 24" fill="none" strokeLinecap="round" strokeLinejoin="round">
|
|
30
|
+
<ellipse cx="12" cy="12.4" rx="9.6" ry="4.4" transform="rotate(-22 12 12.4)" stroke="#3cd6c4" strokeWidth="1" strokeOpacity=".72" strokeDasharray="1.4 2.2" />
|
|
31
|
+
<path d="M14.5 10.6c-1-2.3-.4-4.3 1.2-4.7 1.3.9 1.1 3-1.2 4.7Z" stroke="#f4ffd6" strokeWidth=".9" strokeOpacity=".85" />
|
|
32
|
+
<path d="M15.3 11.3c1.9-1.5 3.9-1.4 4.6 0-.8 1.3-2.7 1.4-4.6 0Z" stroke="#f4ffd6" strokeWidth=".9" strokeOpacity=".78" />
|
|
33
|
+
<circle cx="14.3" cy="12.7" r="2.1" fill="#e6f36a" />
|
|
34
|
+
<circle cx="6.2" cy="15.7" r="1.1" fill="#e6f36a" fillOpacity=".82" />
|
|
35
|
+
<circle cx="20" cy="7.6" r=".75" fill="#e6f36a" fillOpacity=".7" />
|
|
36
|
+
</svg>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
/** 2. A five-petal night flower (spins). */
|
|
40
|
+
const Flower = (
|
|
41
|
+
<svg viewBox="0 0 24 24" fill="#ff8fc8" fillOpacity=".16" stroke="#ff8fc8" strokeWidth="1.05">
|
|
42
|
+
{[0, 72, 144, 216, 288].map((a) => (
|
|
43
|
+
<ellipse key={a} cx="12" cy="7.1" rx="2.7" ry="4.2" transform={`rotate(${a} 12 12)`} strokeOpacity=".92" />
|
|
44
|
+
))}
|
|
45
|
+
<circle cx="12" cy="12" r="1.9" fill="#ffe58a" fillOpacity=".95" stroke="none" />
|
|
46
|
+
</svg>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
/** 3. A falling leaf with its veins (floats). */
|
|
50
|
+
const LEAF = 'M4.8 19.2C4.6 10.6 10.2 4.8 19.4 4.6c.2 9.2-5.6 14.8-14.6 14.6Z';
|
|
51
|
+
const Leaf = (
|
|
52
|
+
<svg viewBox="0 0 24 24" fill="none" strokeLinecap="round" strokeLinejoin="round">
|
|
53
|
+
<path d={LEAF} fill="#ffc14d" fillOpacity=".3" />
|
|
54
|
+
<path d={LEAF} stroke="#ffc14d" strokeWidth="1.3" strokeOpacity=".96" />
|
|
55
|
+
<path d="M3.4 20.6 16.2 7.8M8.6 15.4V12M8.6 15.4H12M11.8 12.2V9.4M11.8 12.2h2.9" stroke="#ffe2a3" strokeWidth=".9" strokeOpacity=".8" />
|
|
56
|
+
</svg>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
/** 4. A raindrop with a glint (pulses). */
|
|
60
|
+
const Raindrop = (
|
|
61
|
+
<svg viewBox="0 0 24 24" fill="none" strokeLinecap="round" strokeLinejoin="round">
|
|
62
|
+
<path d="M12 3.4c2.9 3.7 5.4 7 5.4 10.1a5.4 5.4 0 0 1-10.8 0c0-3.1 2.5-6.4 5.4-10.1Z" fill="#4da8ff" fillOpacity=".28" stroke="#8fcbff" strokeWidth="1.7" strokeOpacity=".94" />
|
|
63
|
+
<path d="M9.4 14a2.7 2.7 0 0 0 2 2.5" stroke="#eaf6ff" strokeWidth="1.15" strokeOpacity=".92" />
|
|
64
|
+
</svg>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
/** 5. A fern frond still curled up (spins). */
|
|
68
|
+
const FernCurl = (
|
|
69
|
+
<svg viewBox="0 0 24 24" fill="none" strokeLinecap="round" strokeLinejoin="round">
|
|
70
|
+
<path d="M12 12a1.4 1.4 0 0 1 2.8 0 2.6 2.6 0 0 1-5.2 0 4 4 0 0 1 8 0 5.3 5.3 0 0 1-5.3 5.3c-1.7 0-3.4 1.4-4.4 3.6" stroke="#0f7d45" strokeWidth="1.45" strokeOpacity=".96" />
|
|
71
|
+
<path d="M18.6 9.2l1.6-1M16 6.9l.7-1.8M12.4 6.4l-.3-1.9M8.9 8.3 7.5 7M7.2 11.9l-1.9-.2" stroke="#1c9e56" strokeWidth="1.15" strokeOpacity=".95" />
|
|
72
|
+
</svg>
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
/** 6. A dandelion clock, seeds ready to go (spins). */
|
|
76
|
+
const Dandelion = (
|
|
77
|
+
<svg viewBox="0 0 24 24" fill="none" strokeLinecap="round">
|
|
78
|
+
<path d={DANDELION_STALKS} stroke="#ffe58a" strokeWidth=".85" strokeOpacity=".86" />
|
|
79
|
+
{DANDELION_SEEDS.map(([x, y], i) => (
|
|
80
|
+
<circle key={i} cx={x} cy={y} r={i % 2 ? 0.75 : 0.95} fill="#fff3b8" fillOpacity=".92" />
|
|
81
|
+
))}
|
|
82
|
+
<circle cx="12" cy="12" r="2.1" fill="#ffc14d" fillOpacity=".32" stroke="#ffc14d" strokeWidth="1.2" strokeOpacity=".96" />
|
|
83
|
+
</svg>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
/** 7. A glowing mushroom (pulses). */
|
|
87
|
+
const Mushroom = (
|
|
88
|
+
<svg viewBox="0 0 24 24" fill="none" strokeLinecap="round" strokeLinejoin="round">
|
|
89
|
+
<path d="M3.4 13.4C3.4 7.9 7.2 4.2 12 4.2s8.6 3.7 8.6 9.2Z" fill="#9d8bf7" fillOpacity=".42" stroke="#7d68ee" strokeWidth="1.3" strokeOpacity=".96" />
|
|
90
|
+
<path d="M9.7 13.4c-.1 2.6-.5 4.9-1.1 6.6h6.8c-.6-1.7-1-4-1.1-6.6" stroke="#8f7cf2" strokeWidth="1.1" strokeOpacity=".9" />
|
|
91
|
+
<circle cx="8.4" cy="9.6" r="1.15" fill="#ff8fc8" />
|
|
92
|
+
<circle cx="12.6" cy="7.2" r="1" fill="#ff8fc8" fillOpacity=".9" />
|
|
93
|
+
<circle cx="16" cy="10.4" r="1.25" fill="#ff8fc8" fillOpacity=".95" />
|
|
94
|
+
</svg>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
/** 8. A crescent moon with a star (floats). */
|
|
98
|
+
const Moon = (
|
|
99
|
+
<svg viewBox="0 0 24 24" fill="none" strokeLinecap="round" strokeLinejoin="round">
|
|
100
|
+
<path d="M10.68 4.11A8 8 0 1 0 19.68 14.24 6.8 6.8 0 0 1 10.68 4.11Z" fill="#4da8ff" fillOpacity=".3" stroke="#2f86e0" strokeWidth="1.35" strokeOpacity=".95" />
|
|
101
|
+
<path d="M18.4 2.6l.55 1.55 1.55.55-1.55.55-.55 1.55-.55-1.55-1.55-.55 1.55-.55Z" fill="#ffc14d" />
|
|
102
|
+
<circle cx="21" cy="9.6" r=".7" fill="#ffc14d" fillOpacity=".8" />
|
|
103
|
+
</svg>
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
/** The default set, in slot order. */
|
|
107
|
+
export const NATURE_ICONS: readonly ReactNode[] = [Firefly, Flower, Leaf, Raindrop, FernCurl, Dandelion, Mushroom, Moon];
|
|
108
|
+
|
|
109
|
+
/** Glow colour behind each default icon, in slot order. */
|
|
110
|
+
export const NATURE_GLOWS: readonly string[] = [
|
|
111
|
+
'rgba(230, 243, 106, .55)', // firefly
|
|
112
|
+
'rgba(255, 143, 200, .52)', // bloom
|
|
113
|
+
'rgba(255, 107, 107, .5)', // coral
|
|
114
|
+
'rgba(77, 168, 255, .5)', // lagoon
|
|
115
|
+
'rgba(94, 224, 138, .5)', // fern
|
|
116
|
+
'rgba(255, 193, 77, .5)', // amber
|
|
117
|
+
'rgba(157, 139, 247, .52)', // aurora
|
|
118
|
+
'rgba(60, 214, 196, .55)', // sea glass
|
|
119
|
+
];
|