@klex/mascot 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.
@@ -0,0 +1,51 @@
1
+ import { useId } from 'react';
2
+
3
+ export function KlexGroundGrid({
4
+ fadeStart,
5
+ solidStart,
6
+ floor = false,
7
+ }: {
8
+ /** Leave both fade values out to mask the grid from outside. */
9
+ fadeStart?: number;
10
+ solidStart?: number;
11
+ /**
12
+ * Draw square tiles for a plane that is tilted back by 60deg, which halves
13
+ * its height and turns the squares into the same 2:1 diamonds.
14
+ */
15
+ floor?: boolean;
16
+ }) {
17
+ const patternId = useId();
18
+ const height = floor ? 32 : 16;
19
+
20
+ return (
21
+ <svg
22
+ aria-hidden="true"
23
+ className="pointer-events-none absolute inset-0 size-full bg-foreground/[0.025] text-foreground/15"
24
+ style={
25
+ fadeStart === undefined || solidStart === undefined
26
+ ? undefined
27
+ : {
28
+ maskImage: `linear-gradient(to bottom, transparent ${fadeStart * 100}%, black ${solidStart * 100}%)`,
29
+ }
30
+ }
31
+ >
32
+ <defs>
33
+ <pattern
34
+ id={patternId}
35
+ width="32"
36
+ height={height}
37
+ patternUnits="userSpaceOnUse"
38
+ >
39
+ <path
40
+ d={`M0 ${height / 2} 16 0 32 ${height / 2} 16 ${height}Z`}
41
+ fill="none"
42
+ stroke="currentColor"
43
+ // The tilt thins the diagonals, so start thicker to end at 0.75.
44
+ strokeWidth={floor ? 1.2 : 0.75}
45
+ />
46
+ </pattern>
47
+ </defs>
48
+ <rect width="100%" height="100%" fill={`url(#${patternId})`} />
49
+ </svg>
50
+ );
51
+ }
package/src/idle.ts ADDED
@@ -0,0 +1,61 @@
1
+ import { emotePose, REST_EMOTE } from './emotes';
2
+
3
+ const between = (min: number, max: number) => min + Math.random() * (max - min);
4
+
5
+ // Each mounted Klex owns its clocks. New pauses are drawn after every action,
6
+ // so a row of avatars does not repeat the same loop with a fixed offset.
7
+ export function createIdle() {
8
+ let time = between(0, 12);
9
+ const breathDuration = between(4.4, 5.6);
10
+ let blinkIn = between(2.5, 6);
11
+ let blinkTime = Infinity;
12
+ let blinkDuration = 0.35;
13
+ let glanceIn = between(3, 8);
14
+ let glanceTime = Infinity;
15
+ let glanceDuration = 2.5;
16
+ let glanceX = 0;
17
+ let glanceY = 0;
18
+
19
+ return {
20
+ advance(dt: number, resting: boolean) {
21
+ time += dt;
22
+ blinkTime += dt;
23
+ glanceTime += dt;
24
+ // Finish ongoing gestures while fading out, but start no new ones during
25
+ // travel or emotes. Pausing the controller freezes these clocks as well.
26
+ if (!resting) return;
27
+ blinkIn -= dt;
28
+ glanceIn -= dt;
29
+ if (blinkIn <= 0) {
30
+ blinkTime = 0;
31
+ blinkDuration = between(0.28, 0.4);
32
+ blinkIn = blinkDuration + between(2.5, 6.5);
33
+ }
34
+ if (glanceIn <= 0) {
35
+ glanceTime = 0;
36
+ glanceDuration = between(1.8, 3.2);
37
+ glanceIn = glanceDuration + between(3, 9);
38
+ const angle = between(0, Math.PI * 2);
39
+ const distance = between(0.65, 1);
40
+ glanceX = Math.cos(angle) * distance;
41
+ glanceY = Math.sin(angle) * distance * 0.7;
42
+ }
43
+ },
44
+ pose(weight: number) {
45
+ const breath = (time * Math.PI * 2) / breathDuration;
46
+ const blink = emotePose('blink', blinkTime / blinkDuration).blinkLeft;
47
+ const glance = emotePose('look-right', glanceTime / glanceDuration).lookX;
48
+ return {
49
+ ...REST_EMOTE,
50
+ compression: (1 - Math.cos(breath)) * 0.009 * weight,
51
+ headSway: Math.sin(breath / 2) * 0.65 * weight,
52
+ headTilt: Math.sin(breath / 2 - 0.45) * 0.75 * weight,
53
+ nod: Math.sin(breath - 0.6) * 0.15 * weight,
54
+ lookX: glance * glanceX * weight,
55
+ lookY: glance * glanceY * weight,
56
+ blinkLeft: blink * weight,
57
+ blinkRight: blink * weight,
58
+ };
59
+ },
60
+ };
61
+ }
package/src/index.ts ADDED
@@ -0,0 +1,32 @@
1
+ export { ACTIVITIES, type KlexActivity } from './activity';
2
+ export {
3
+ EMOTE_CATEGORIES,
4
+ EMOTES,
5
+ type Emote,
6
+ emotePose,
7
+ REST_EMOTE,
8
+ } from './emotes';
9
+ export { EXTRAS, type Extra, KlexExtras } from './extras';
10
+ export { EXPRESSIONS, type Expression, KlexEyes } from './eyes';
11
+ export { fitGaze, gazeRoom } from './gaze';
12
+ export { phoneAnchor, waveAnchor } from './geometry';
13
+ export { type KlexPosition, klexBody } from './glide';
14
+ export { KlexGroundGrid } from './ground-grid';
15
+ export {
16
+ type EmoteId,
17
+ Klex,
18
+ type KlexHandle,
19
+ type KlexProps,
20
+ } from './klex';
21
+ export { observeVisibility } from './observe-visibility';
22
+ export {
23
+ BODY_SHAPES,
24
+ type BodyShape,
25
+ DEFAULT_GLIDE,
26
+ type KlexPalette,
27
+ MOVEMENT_STYLES,
28
+ type MovementMode,
29
+ PALETTES,
30
+ } from './presets';
31
+ export { getKlexEyeColor, klexSvg, roundedPath } from './svg';
32
+ export { popTransition } from './transitions';
package/src/klex.tsx ADDED
@@ -0,0 +1,460 @@
1
+ import './name-tag.css';
2
+
3
+ import { useReducedMotion } from 'motion/react';
4
+ import {
5
+ type CSSProperties,
6
+ type ReactNode,
7
+ type Ref,
8
+ useEffectEvent,
9
+ useImperativeHandle,
10
+ useLayoutEffect,
11
+ useMemo,
12
+ useRef,
13
+ useState,
14
+ } from 'react';
15
+
16
+ import { Badge } from '@stagewise/ui';
17
+
18
+ import type { KlexActivity } from './activity';
19
+ import { EMOTES, type Emote, type EmoteLook } from './emotes';
20
+ import { type Extra, KlexExtras } from './extras';
21
+ import { type Expression, KlexEyes } from './eyes';
22
+ import { phoneAnchor, waveAnchor } from './geometry';
23
+ import { createGlide, type KlexPosition, klexBody } from './glide';
24
+ import { KlexLaptop } from './laptop';
25
+ import { observeVisibility } from './observe-visibility';
26
+ import {
27
+ BODY_SHAPES,
28
+ type BodyShape,
29
+ DEFAULT_GLIDE,
30
+ MOVEMENT_STYLES,
31
+ type MovementMode,
32
+ PALETTES,
33
+ } from './presets';
34
+ import { KlexSpeech, type KlexSpeechValue } from './speech';
35
+ import { getKlexEyeColor } from './svg';
36
+
37
+ export type {
38
+ BodyShape,
39
+ Expression,
40
+ Extra,
41
+ KlexActivity,
42
+ KlexPosition,
43
+ MovementMode,
44
+ };
45
+ export type EmoteId = Emote['id'];
46
+
47
+ export type KlexHandle = {
48
+ /** X runs from -50 (left) to 50 (right); Y is a pixel offset from the track. */
49
+ moveTo(
50
+ target: 'left' | 'right' | number | KlexPosition,
51
+ mode?: MovementMode,
52
+ ): void;
53
+ /** Restore a saved scene position without replaying travel. */
54
+ snapTo(target: KlexPosition): void;
55
+ /** Shift the current position and destination without interrupting travel. */
56
+ shiftBy(offset: KlexPosition): void;
57
+ /** Set the resting direction without moving. */
58
+ face(side: 'left' | 'right'): void;
59
+ /** Stop travel at the current position without completing its destination. */
60
+ stopMoving(): void;
61
+ /** Returns false while another emote is active or reduced motion is enabled. */
62
+ emote(id: EmoteId): boolean;
63
+ /** Show custom speech without interrupting body emotes. Pass null to dismiss. */
64
+ say(text: string | null, options?: { waiting?: boolean }): void;
65
+ setExpression(expression: Expression): void;
66
+ /** Select one extra, or 'none' to hide it. */
67
+ setExtra(extra: Extra): void;
68
+ cancelEmote(): void;
69
+ pause(): void;
70
+ resume(): void;
71
+ };
72
+
73
+ export type KlexProps = {
74
+ ref?: Ref<KlexHandle>;
75
+ children?: ReactNode;
76
+ name?: string;
77
+ /** Shown under the name in the name tag, e.g. the bot's job. */
78
+ role?: string;
79
+ shape?: BodyShape;
80
+ color?: string;
81
+ /** Character width in pixels. Movement and emotes scale with it. */
82
+ size?: number;
83
+ /** Disable the default idle animation. Sleeping and working still animate. */
84
+ idle?: boolean;
85
+ /** Persistent resting animation. Resumes after travel and emotes. */
86
+ activity?: KlexActivity;
87
+ /** Total track width. Defaults to size for a stationary avatar. */
88
+ width?: CSSProperties['width'];
89
+ /** Initial track position. Y is a pixel offset from the ground line. */
90
+ initialPosition?: KlexPosition;
91
+ /**
92
+ * `track` moves along the bottom edge, `avatar` centers the character in its
93
+ * own viewport, and `svg` renders a native 160-unit figure for an SVG scene.
94
+ */
95
+ layout?: 'track' | 'avatar' | 'svg';
96
+ className?: string;
97
+ initialExpression?: Expression;
98
+ initialExtra?: Extra;
99
+ extrasEnabled?: boolean;
100
+ settings?: typeof DEFAULT_GLIDE;
101
+ /** Lock locomotion across travel, rest, and moveTo overrides. */
102
+ movementMode?: MovementMode;
103
+ onMoveComplete?: () => void;
104
+ /** Destination reached, before the body's final settling animation. */
105
+ onMoveArrival?: () => void;
106
+ /** Reports the ground line's Y offset as the character moves. */
107
+ onDepthChange?: (y: number) => void;
108
+ /** Also fires when the active emote is cancelled. */
109
+ onEmoteComplete?: () => void;
110
+ };
111
+
112
+ export function Klex({
113
+ ref,
114
+ children,
115
+ name,
116
+ role,
117
+ shape = BODY_SHAPES[0],
118
+ color = PALETTES[0].body,
119
+ size = 160,
120
+ idle = true,
121
+ activity = 'idle',
122
+ width = size,
123
+ initialPosition,
124
+ layout = 'track',
125
+ className,
126
+ initialExpression = 'neutral',
127
+ initialExtra = 'none',
128
+ extrasEnabled = true,
129
+ settings: suppliedSettings,
130
+ movementMode,
131
+ onMoveComplete,
132
+ onMoveArrival,
133
+ onDepthChange,
134
+ onEmoteComplete,
135
+ }: KlexProps) {
136
+ const settings = useMemo(() => {
137
+ const base =
138
+ suppliedSettings ??
139
+ MOVEMENT_STYLES.find((preset) => preset.id === movementMode)?.settings ??
140
+ DEFAULT_GLIDE;
141
+ return movementMode ? { ...base, mode: movementMode } : base;
142
+ }, [suppliedSettings, movementMode]);
143
+ const eyeColor = getKlexEyeColor(color);
144
+ const [expression, setExpression] = useState(initialExpression);
145
+ const [extra, setExtra] = useState(initialExtra);
146
+ const [paused, setPaused] = useState(false);
147
+ const [visible, setVisible] = useState(false);
148
+ const containerRef = useRef<HTMLDivElement>(null);
149
+ const [speech, setSpeech] = useState<KlexSpeechValue | null>(null);
150
+ const [reactionLook, setReactionLook] = useState<EmoteLook>({});
151
+ const reducedMotion = useReducedMotion() ?? false;
152
+ const travelRef = useRef<HTMLDivElement>(null);
153
+ const actorRef = useRef<HTMLDivElement>(null);
154
+ const svgTravelRef = useRef<SVGGElement>(null);
155
+ const svgActorRef = useRef<SVGGElement>(null);
156
+ const shadowRef = useRef<SVGEllipseElement>(null);
157
+ const bodyRef = useRef<SVGPathElement>(null);
158
+ const eyesRef = useRef<SVGGElement>(null);
159
+ const laptopRef = useRef<SVGGElement>(null);
160
+ const motionRef = useRef<ReturnType<typeof createGlide> | null>(null);
161
+ const currentSettings = useRef(settings);
162
+ const startingPosition = useRef(initialPosition);
163
+ const restingBody = useMemo(
164
+ () => klexBody(undefined, undefined, shape),
165
+ [shape],
166
+ );
167
+ const handAnchor = useMemo(() => waveAnchor(shape), [shape]);
168
+ const earAnchor = useMemo(() => phoneAnchor(shape), [shape]);
169
+ const scale = layout === 'svg' ? 1 : size / 160;
170
+ const avatarLayout = layout === 'avatar';
171
+ const viewBox = avatarLayout ? '0 -10 160 160' : '0 0 160 140';
172
+ const completeMove = useEffectEvent(() => onMoveComplete?.());
173
+ const arrive = useEffectEvent(() => onMoveArrival?.());
174
+ const reportDepth = useEffectEvent((y: number) => onDepthChange?.(y));
175
+ const completeEmote = useEffectEvent(() => onEmoteComplete?.());
176
+ const configureSettings = useEffectEvent((next: typeof DEFAULT_GLIDE) => {
177
+ motionRef.current?.configure(
178
+ next,
179
+ reducedMotion,
180
+ shape,
181
+ scale,
182
+ idle,
183
+ activity,
184
+ );
185
+ });
186
+
187
+ // Scenes mark their clipping element so characters entering from outside
188
+ // the visible area keep animating.
189
+ useLayoutEffect(() => {
190
+ const element =
191
+ containerRef.current ?? svgTravelRef.current?.ownerSVGElement;
192
+ if (element)
193
+ return observeVisibility(
194
+ element.closest('[data-klex-viewport]') ?? element,
195
+ setVisible,
196
+ );
197
+ }, []);
198
+
199
+ useLayoutEffect(() => {
200
+ const travel = travelRef.current ?? svgTravelRef.current;
201
+ const actor = actorRef.current ?? svgActorRef.current;
202
+ const shadow = shadowRef.current;
203
+ const body = bodyRef.current;
204
+ const eyes = eyesRef.current;
205
+ const laptop = laptopRef.current;
206
+ if (!travel || !actor || !shadow || !body || !eyes || !laptop) return;
207
+
208
+ const motion = createGlide(
209
+ { travel, actor, shadow, body, eyes, laptop },
210
+ completeMove,
211
+ completeEmote,
212
+ setReactionLook,
213
+ currentSettings.current,
214
+ startingPosition.current,
215
+ reportDepth,
216
+ arrive,
217
+ );
218
+ motionRef.current = motion;
219
+ return () => {
220
+ motion.dispose();
221
+ motionRef.current = null;
222
+ };
223
+ }, []);
224
+
225
+ useLayoutEffect(() => {
226
+ motionRef.current?.pause(paused || !visible);
227
+ }, [paused, visible]);
228
+
229
+ // Keep a mode chosen by moveTo until the caller supplies new settings.
230
+ useLayoutEffect(() => {
231
+ currentSettings.current = settings;
232
+ configureSettings(settings);
233
+ }, [settings]);
234
+
235
+ // biome-ignore lint/correctness/useExhaustiveDependencies: Newly mounted extras need anchoring even when the ticker is stopped.
236
+ useLayoutEffect(() => {
237
+ motionRef.current?.configure(
238
+ currentSettings.current,
239
+ reducedMotion,
240
+ shape,
241
+ scale,
242
+ idle,
243
+ activity,
244
+ );
245
+ }, [
246
+ reducedMotion,
247
+ shape,
248
+ scale,
249
+ idle,
250
+ activity,
251
+ reactionLook.extra,
252
+ extra,
253
+ extrasEnabled,
254
+ ]);
255
+
256
+ useImperativeHandle(ref, () => ({
257
+ moveTo(target, mode) {
258
+ const motion = motionRef.current;
259
+ if (!motion) return;
260
+ if (mode && !movementMode) {
261
+ currentSettings.current =
262
+ MOVEMENT_STYLES.find((preset) => preset.id === mode)?.settings ??
263
+ currentSettings.current;
264
+ motion.configure(
265
+ currentSettings.current,
266
+ reducedMotion,
267
+ shape,
268
+ scale,
269
+ idle,
270
+ activity,
271
+ );
272
+ }
273
+ motion.moveTo(target === 'left' ? -50 : target === 'right' ? 50 : target);
274
+ setPaused(false);
275
+ motion.pause(!visible);
276
+ },
277
+ snapTo: (target) => motionRef.current?.snapTo(target),
278
+ shiftBy: (offset) => motionRef.current?.shiftBy(offset),
279
+ face: (side) => motionRef.current?.face(side),
280
+ stopMoving: () => motionRef.current?.stopMoving(),
281
+ emote(id) {
282
+ const action = EMOTES.find((entry) => entry.id === id);
283
+ const motion = motionRef.current;
284
+ if (!action || !motion?.playEmote(action)) return false;
285
+ setPaused(false);
286
+ motion.pause(!visible);
287
+ return true;
288
+ },
289
+ say(text, options) {
290
+ setSpeech(text ? { text, waiting: options?.waiting } : null);
291
+ },
292
+ setExpression,
293
+ setExtra,
294
+ cancelEmote: () => motionRef.current?.cancelEmote(),
295
+ pause: () => {
296
+ setPaused(true);
297
+ motionRef.current?.pause(true);
298
+ },
299
+ resume: () => {
300
+ setPaused(false);
301
+ motionRef.current?.pause(!visible);
302
+ },
303
+ }));
304
+
305
+ const drawing = (
306
+ <>
307
+ <title>{name ?? 'Klex'}</title>
308
+ <path
309
+ ref={bodyRef}
310
+ d={restingBody}
311
+ fill={color}
312
+ data-testid="klex-body"
313
+ />
314
+ <g
315
+ ref={eyesRef}
316
+ fill={eyeColor}
317
+ style={{ color: eyeColor }}
318
+ transform={`translate(${80 + shape.eyeX} ${shape.eyeY})`}
319
+ data-testid="klex-eyes"
320
+ >
321
+ <KlexEyes expression={reactionLook.expression ?? expression} />
322
+ <g style={{ color }}>
323
+ <KlexExtras
324
+ handAnchor={handAnchor}
325
+ phoneAnchor={earAnchor}
326
+ paused={paused || !visible}
327
+ transient={reactionLook.extra === 'wave'}
328
+ extra={extrasEnabled ? (reactionLook.extra ?? extra) : 'none'}
329
+ headTop={
330
+ Math.min(...shape.outline.map((point) => point[1])) -
331
+ shape.eyeY -
332
+ 10
333
+ }
334
+ />
335
+ </g>
336
+ </g>
337
+ <g
338
+ ref={laptopRef}
339
+ opacity="0"
340
+ visibility={extrasEnabled ? 'visible' : 'hidden'}
341
+ data-testid="klex-laptop"
342
+ >
343
+ <KlexLaptop shape={shape} />
344
+ </g>
345
+ </>
346
+ );
347
+ const shadow = (
348
+ <ellipse
349
+ ref={shadowRef}
350
+ cx="80"
351
+ cy="129"
352
+ rx="51"
353
+ ry="3"
354
+ fill="black"
355
+ opacity="0.12"
356
+ data-testid="klex-shadow"
357
+ />
358
+ );
359
+
360
+ // Native SVG keeps scene transforms and painter order in one coordinate
361
+ // system. WebKit mispaints transformed HTML inside SVG foreignObject.
362
+ if (layout === 'svg') {
363
+ return (
364
+ <g className={className} data-layout={layout}>
365
+ <g transform="translate(0 32)" data-klex-figure="">
366
+ <g ref={svgTravelRef} data-testid="klex-travel">
367
+ {shadow}
368
+ <g ref={svgActorRef} data-testid="klex-actor">
369
+ {drawing}
370
+ </g>
371
+ </g>
372
+ </g>
373
+ </g>
374
+ );
375
+ }
376
+
377
+ const figure = (
378
+ <>
379
+ <svg
380
+ viewBox={viewBox}
381
+ aria-hidden="true"
382
+ className="absolute inset-0 size-full! overflow-visible"
383
+ >
384
+ {shadow}
385
+ </svg>
386
+ <div
387
+ ref={actorRef}
388
+ className="relative"
389
+ style={{ height: avatarLayout ? size : (size * 140) / 160 }}
390
+ data-testid="klex-actor"
391
+ >
392
+ <KlexSpeech speech={speech} />
393
+ <svg
394
+ viewBox={viewBox}
395
+ role={children ? undefined : 'img'}
396
+ aria-label={children ? undefined : (name ?? 'Klex')}
397
+ aria-hidden={children ? true : undefined}
398
+ className="block size-full! overflow-visible"
399
+ >
400
+ {drawing}
401
+ </svg>
402
+ {name ? (
403
+ <Badge
404
+ variant="outline"
405
+ className="klex-name-badge"
406
+ data-role={role ? '' : undefined}
407
+ aria-hidden="true"
408
+ >
409
+ {name}
410
+ {role ? <span className="klex-name-role">{role}</span> : null}
411
+ </Badge>
412
+ ) : null}
413
+ {children}
414
+ </div>
415
+ </>
416
+ );
417
+
418
+ return (
419
+ <div
420
+ ref={containerRef}
421
+ className={className}
422
+ style={{ position: 'relative', flexShrink: 0, width, height: size }}
423
+ data-layout={layout}
424
+ >
425
+ {layout === 'avatar' ? (
426
+ <div
427
+ ref={travelRef}
428
+ className="absolute inset-0 flex items-center justify-center"
429
+ data-testid="klex-travel"
430
+ >
431
+ <div
432
+ className="relative shrink-0"
433
+ data-klex-figure=""
434
+ style={{
435
+ width: size,
436
+ transform: `translateY(${settings.mode === 'fly' ? 64 * scale : 0}px)`,
437
+ }}
438
+ >
439
+ {figure}
440
+ </div>
441
+ </div>
442
+ ) : (
443
+ <div
444
+ ref={travelRef}
445
+ className="absolute bottom-0 h-0"
446
+ style={{ left: size / 2, right: size / 2 }}
447
+ data-testid="klex-travel"
448
+ >
449
+ <div
450
+ className="absolute left-1/2 -translate-x-1/2"
451
+ data-klex-figure=""
452
+ style={{ width: size, bottom: -12 * scale }}
453
+ >
454
+ {figure}
455
+ </div>
456
+ </div>
457
+ )}
458
+ </div>
459
+ );
460
+ }
package/src/laptop.tsx ADDED
@@ -0,0 +1,41 @@
1
+ import { BODY_SHAPES, type BodyShape } from './presets';
2
+ import { roundedPath } from './svg';
3
+
4
+ const logoShape = BODY_SHAPES[0];
5
+ const logoPath = roundedPath(logoShape.outline);
6
+
7
+ export function KlexLaptop({ shape }: { shape: BodyShape }) {
8
+ const top = Math.max(76, shape.eyeY + 20);
9
+ const scale = Math.max(22, 120 - top) / 56;
10
+
11
+ return (
12
+ <g transform={`translate(${98 + shape.eyeX * 0.4} ${top}) scale(${scale})`}>
13
+ <g transform="matrix(1 0 -0.13 1 6 0)">
14
+ <g transform="matrix(1 0 1.25 1 -56 40)">
15
+ <rect width="72" height="16" rx="4" ry="1.25" fill="#929aa9" />
16
+ <g fill="#667184" opacity="0.8">
17
+ <rect x="3.3" y="6.5" width="3.2" height="1.05" rx="0.25" />
18
+ <rect x="7.1" y="6.5" width="3.2" height="1.05" rx="0.25" />
19
+ <rect x="3.3" y="7.95" width="6.5" height="1.05" rx="0.25" />
20
+ <rect x="3.3" y="9.4" width="5" height="1.05" rx="0.25" />
21
+ <rect x="3.3" y="10.85" width="4.2" height="1.05" rx="0.25" />
22
+ </g>
23
+ </g>
24
+ <rect x="-40" width="80" height="56" rx="4" fill="#727b8d" />
25
+ <g transform="translate(-11.2 17.8) scale(0.14)">
26
+ <path d={logoPath} fill="#c7cdd7" />
27
+ {[-9, 9].map((offset) => (
28
+ <ellipse
29
+ key={offset}
30
+ cx={80 + logoShape.eyeX + offset}
31
+ cy={logoShape.eyeY}
32
+ rx="4.5"
33
+ ry="6.5"
34
+ fill="#727b8d"
35
+ />
36
+ ))}
37
+ </g>
38
+ </g>
39
+ </g>
40
+ );
41
+ }
@@ -0,0 +1,26 @@
1
+ .klex-name-badge {
2
+ position: absolute;
3
+ bottom: calc(100% + 0.35rem);
4
+ left: 50%;
5
+ transform: translateX(-50%);
6
+ border-radius: 9999px;
7
+ background: rgb(0 0 0 / 50%);
8
+ backdrop-filter: blur(1px);
9
+ pointer-events: none;
10
+ }
11
+
12
+ /* With a role, the tag grows to two lines: the name above the role. */
13
+ .klex-name-badge[data-role] {
14
+ height: auto;
15
+ flex-direction: column;
16
+ gap: 0;
17
+ padding-block: 0.25rem;
18
+ border-radius: 0.625rem;
19
+ line-height: 1.2;
20
+ }
21
+
22
+ .klex-name-role {
23
+ color: var(--muted-foreground);
24
+ font-size: 0.625rem;
25
+ font-weight: 400;
26
+ }