devnonla-ui 0.17.2 → 0.18.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devnonla-ui",
3
- "version": "0.17.2",
3
+ "version": "0.18.1",
4
4
  "type": "module",
5
5
  "description": "NonlaUI — React controls for Nonla Agents",
6
6
  "author": "devlangla <devlangla0x01@gmail.com>",
@@ -44,8 +44,8 @@
44
44
  "@dnd-kit/core": "6.3.1",
45
45
  "@dnd-kit/sortable": "10.0.0",
46
46
  "@dnd-kit/utilities": "3.2.2",
47
+ "@fontsource-variable/geist-mono": "^5.3.0",
47
48
  "@fontsource-variable/inter": "^5.3.0",
48
- "@fontsource-variable/plus-jakarta-sans": "^5.3.0",
49
49
  "@radix-ui/react-checkbox": "^1.3.3",
50
50
  "@radix-ui/react-context-menu": "^2.3.7",
51
51
  "@radix-ui/react-dialog": "^1.1.15",
@@ -1,11 +1,11 @@
1
1
  import { createContext, type ReactNode, useContext, useEffect, useId, useState } from "react";
2
2
  import { cn } from "../lib/cn";
3
3
 
4
- /** `still` holds the pose. `idle` turns to a random direction. Defaults to `still`. */
4
+ /** `still` holds the pose. `idle` bobs the body, blinks, and glances. Defaults to `still`. */
5
5
  export type AgentAvatarMotion = "still" | "idle";
6
6
 
7
- /** Fixed facing. The shape stays centered and the eyes move that way. */
8
- export type AgentAvatarLook = "forward" | "left" | "right" | "up" | "down" | "up-left" | "up-right" | "down-left" | "down-right";
7
+ /** Fixed facing. The shape stays centered and the eyes move that way. No straight-up glance. */
8
+ export type AgentAvatarLook = "forward" | "left" | "right" | "down" | "up-left" | "up-right" | "down-left" | "down-right";
9
9
 
10
10
  /** Pupil color. Omitted picks black, or white when the face is dark. */
11
11
  export type AgentAvatarEyeColor = "black" | "white";
@@ -130,7 +130,6 @@ const LOOK: Record<AgentAvatarLook, [number, number]> = {
130
130
  forward: [0, 0],
131
131
  left: [-6.4, 0],
132
132
  right: [6.4, 0],
133
- up: [0, -4.4],
134
133
  down: [0, 4.4],
135
134
  "up-left": [-4.5, -3.1],
136
135
  "up-right": [4.5, -3.1],
@@ -273,6 +272,19 @@ function Shape({ shape, color, eyeColor }: AgentAvatarConfig) {
273
272
  return <InkContext.Provider value={eyeFill(color, eyeColor)}>{body[shape]}</InkContext.Provider>;
274
273
  }
275
274
 
275
+ export {
276
+ eyeFill,
277
+ InkContext,
278
+ LOOK,
279
+ mixHex,
280
+ PaintContext,
281
+ resolveConfig as resolveAvatarConfig,
282
+ ShadowContext,
283
+ Shape as AvatarShape,
284
+ stagger as avatarStagger,
285
+ useIdleLook,
286
+ };
287
+
276
288
  export function AgentAvatar({ config, size = 64, motion = "still", look = "forward", className, label = "Agent" }: AgentAvatarProps) {
277
289
  const resolved = resolveConfig(config);
278
290
  const delay = stagger(`${resolved.shape}${resolved.color}`);
@@ -0,0 +1,458 @@
1
+ import { useEffect, useId, useState } from "react";
2
+ import { cn } from "../lib/cn";
3
+ import {
4
+ AGENT_AVATAR_PARTS,
5
+ type AgentAvatarConfig,
6
+ type AgentAvatarEyeColor,
7
+ type AgentAvatarLook,
8
+ AvatarShape,
9
+ avatarStagger,
10
+ LOOK,
11
+ mixHex,
12
+ PaintContext,
13
+ ShadowContext,
14
+ useIdleLook,
15
+ } from "./AgentAvatar";
16
+
17
+ /**
18
+ * `still` holds the pose. `idle` blinks and glances. `walk` steps the legs and swings the arms in the `look` direction.
19
+ * `run` is the same gait, faster, with a bigger swing and deeper knee and elbow bend.
20
+ * `talk` nods a little and gestures; pass `say` for a speech bubble above the head.
21
+ */
22
+ export type AgentBodyMotion = "still" | "idle" | "walk" | "run" | "talk";
23
+
24
+ /** Pause after a page finishes before the next one. */
25
+ const PAGE_HOLD_MS = 1100;
26
+
27
+ /** Split on sentence ends / newlines, keeping the punctuation on the chunk. */
28
+ function splitSentences(text: string): string[] {
29
+ const parts = text.match(/[^.!?…\n]+(?:[.!?…]+|\n+)?/g);
30
+ if (!parts) return text.trim() ? [text.trim()] : [];
31
+ return parts.map((part) => part.replace(/\s+/g, " ").trim()).filter(Boolean);
32
+ }
33
+
34
+ /** Break a long run into word pages that fit `maxChars`. Oversized words are hard-sliced. */
35
+ function chunkWords(text: string, maxChars: number): string[] {
36
+ const words = text.split(" ").filter(Boolean);
37
+ const pages: string[] = [];
38
+ let buf = "";
39
+
40
+ const push = () => {
41
+ if (buf) pages.push(buf);
42
+ buf = "";
43
+ };
44
+
45
+ for (const word of words) {
46
+ if (word.length > maxChars) {
47
+ push();
48
+ for (let i = 0; i < word.length; i += maxChars) {
49
+ pages.push(word.slice(i, i + maxChars));
50
+ }
51
+ continue;
52
+ }
53
+ if (!buf) {
54
+ buf = word;
55
+ } else if (buf.length + 1 + word.length <= maxChars) {
56
+ buf = `${buf} ${word}`;
57
+ } else {
58
+ push();
59
+ buf = word;
60
+ }
61
+ }
62
+ push();
63
+ return pages;
64
+ }
65
+
66
+ /**
67
+ * Paginate like an RPG dialogue box: prefer whole sentences, then pack short ones
68
+ * together, and word-wrap anything longer than `maxChars`.
69
+ */
70
+ function paginateSay(text: string, maxChars: number): string[] {
71
+ const pages: string[] = [];
72
+ let buf = "";
73
+
74
+ const flush = () => {
75
+ if (buf) pages.push(buf);
76
+ buf = "";
77
+ };
78
+
79
+ for (const sentence of splitSentences(text)) {
80
+ if (sentence.length > maxChars) {
81
+ flush();
82
+ pages.push(...chunkWords(sentence, maxChars));
83
+ continue;
84
+ }
85
+ if (!buf) {
86
+ buf = sentence;
87
+ } else if (buf.length + 1 + sentence.length <= maxChars) {
88
+ buf = `${buf} ${sentence}`;
89
+ } else {
90
+ flush();
91
+ buf = sentence;
92
+ }
93
+ }
94
+ flush();
95
+ return pages.length ? pages : [text];
96
+ }
97
+
98
+ /**
99
+ * Types the current page, then advances. Long `say` is cut into short pages first.
100
+ * Returns a blinking "more" cue while waiting on a non-final page.
101
+ */
102
+ function useDialogue(text: string | undefined, maxChars: number, msPerChar = 32) {
103
+ const pages = text ? paginateSay(text, maxChars) : [];
104
+ const [page, setPage] = useState(0);
105
+ const [shown, setShown] = useState("");
106
+ const [typing, setTyping] = useState(false);
107
+
108
+ useEffect(() => {
109
+ setPage(0);
110
+ }, [text, maxChars]);
111
+
112
+ const current = pages[page];
113
+ const hasMore = page < pages.length - 1;
114
+
115
+ useEffect(() => {
116
+ if (!current) {
117
+ setShown("");
118
+ setTyping(false);
119
+ return;
120
+ }
121
+
122
+ const media = window.matchMedia("(prefers-reduced-motion: reduce)");
123
+ let interval = 0;
124
+ let hold = 0;
125
+
126
+ const advanceLater = () => {
127
+ if (!hasMore) return;
128
+ hold = window.setTimeout(() => setPage((p) => p + 1), PAGE_HOLD_MS);
129
+ };
130
+
131
+ if (media.matches) {
132
+ setShown(current);
133
+ setTyping(false);
134
+ advanceLater();
135
+ return () => window.clearTimeout(hold);
136
+ }
137
+
138
+ setShown("");
139
+ setTyping(true);
140
+ let i = 0;
141
+ interval = window.setInterval(() => {
142
+ i += 1;
143
+ setShown(current.slice(0, i));
144
+ if (i >= current.length) {
145
+ window.clearInterval(interval);
146
+ setTyping(false);
147
+ advanceLater();
148
+ }
149
+ }, msPerChar);
150
+
151
+ return () => {
152
+ window.clearInterval(interval);
153
+ window.clearTimeout(hold);
154
+ };
155
+ }, [current, hasMore, msPerChar]);
156
+
157
+ return { shown, typing, hasMore: hasMore && !typing };
158
+ }
159
+
160
+ /** Same 13 head shapes and palette as `AgentAvatar`. */
161
+ export const AGENT_BODY_PARTS = AGENT_AVATAR_PARTS;
162
+
163
+ type BodyShape = (typeof AGENT_BODY_PARTS.shape)[number] | "round";
164
+
165
+ export type AgentBodyConfig = {
166
+ shape: BodyShape;
167
+ color: string;
168
+ eyeColor?: AgentAvatarEyeColor;
169
+ };
170
+
171
+ /** Facing / walking direction. `up` is away from the viewer (seen from behind). */
172
+ export type AgentBodyLook = AgentAvatarLook | "up";
173
+
174
+ export type AgentBodyProps = {
175
+ /** Head shape and character color. Omitted parts use `nonla` and `#F47820`. */
176
+ config?: Partial<AgentBodyConfig>;
177
+ /** Width in px. Height follows the standing viewBox. Defaults to 80. */
178
+ size?: number;
179
+ motion?: AgentBodyMotion;
180
+ /** Facing / walking direction. Defaults to `forward`. */
181
+ look?: AgentBodyLook;
182
+ /**
183
+ * Spoken line. Shows an RPG speech bubble that types out above the head.
184
+ * Long text is split into short pages (by sentence, then by length) and advanced automatically.
185
+ */
186
+ say?: string;
187
+ className?: string;
188
+ /** Accessible name. Defaults to "Agent". */
189
+ label?: string;
190
+ };
191
+
192
+ const DEFAULT_BODY_CONFIG: AgentAvatarConfig = {
193
+ shape: "nonla",
194
+ color: "#F47820",
195
+ };
196
+
197
+ function resolveBodyConfig(config?: Partial<AgentBodyConfig>): AgentAvatarConfig {
198
+ const rawShape = config?.shape ?? DEFAULT_BODY_CONFIG.shape;
199
+ const shape = rawShape === "round" ? "circle" : rawShape;
200
+ return {
201
+ shape,
202
+ color: config?.color ?? DEFAULT_BODY_CONFIG.color,
203
+ eyeColor: config?.eyeColor,
204
+ };
205
+ }
206
+
207
+ const VIEW_W = 80;
208
+ const VIEW_H = 108;
209
+ const ASPECT = VIEW_H / VIEW_W;
210
+
211
+ /**
212
+ * Cylinder torso: straight sides, same width top to bottom, softly rounded ends.
213
+ * Spans x=28.5..51.5, y=46..76. The shoulders (y=53) and hips (y=72) sit inside it.
214
+ * Sized a bit fuller than the head so the standing figure does not read as bobbleheaded.
215
+ */
216
+ const TORSO = { x: 28.5, y: 46, width: 23, height: 30, rx: 7.5 } as const;
217
+
218
+ /**
219
+ * Short neck between the head and the torso. Narrow and mostly tucked under the chin
220
+ * so it does not read as a column sitting behind the head.
221
+ */
222
+ const NECK = { x: 36.5, y: 39.5, width: 7, height: 10, rx: 2.2 } as const;
223
+
224
+ /** Shoulder joints at rest (far arm x=25.5, near arm x=54.5) and the torso center. */
225
+ const ARM_FAR_X = 25.5;
226
+ const ARM_NEAR_X = 54.5;
227
+ const ARM_CENTER = 40;
228
+ /**
229
+ * Side walk turns the torso a little toward the viewer: the near shoulder slips back and the far
230
+ * shoulder forward by this much, so the shoulders are close but not stacked.
231
+ */
232
+ const ARM_TURN = 2.5;
233
+ /** Hip joints at rest (far leg x=35, near leg x=45). In a side walk they turn like the shoulders. */
234
+ const LEG_FAR_X = 35;
235
+ const LEG_NEAR_X = 45;
236
+ const LEG_TURN = ARM_TURN;
237
+
238
+ /**
239
+ * Where each head ends, in the 64-unit head box, measured near the neck column
240
+ * and after the shape's own vertical shift. Heads differ a lot (a pill ends at 46, a gem at 56),
241
+ * so each one is nudged vertically until its underside lands on the same line above the neck.
242
+ */
243
+ const HEAD_BOTTOM: Record<AgentAvatarConfig["shape"], number> = {
244
+ circle: 53.5,
245
+ square: 55,
246
+ triangle: 56,
247
+ diamond: 51.7,
248
+ hex: 54,
249
+ gem: 56,
250
+ pill: 46,
251
+ arch: 48.3,
252
+ cloud: 48,
253
+ blob: 49.7,
254
+ drop: 54.4,
255
+ shield: 51.4,
256
+ /** Face circle bottom (~52.4); a lower value left the chin hanging over the neck. */
257
+ nonla: 52.6,
258
+ };
259
+
260
+ /** Where the head underside should land (y in the body viewBox). Extra overlap hides the neck top. */
261
+ const HEAD_JOIN_Y = NECK.y + 4.5;
262
+ /** Head box is 64×64; keep it under ~0.7 so the torso reads larger than the face. */
263
+ const HEAD_SCALE = 0.68;
264
+ const HEAD_X = Number(((VIEW_W - 64 * HEAD_SCALE) / 2).toFixed(2));
265
+
266
+ function walkAxis(look: AgentBodyLook): "left" | "right" | "up" | "down" {
267
+ if (look === "left" || look === "up-left" || look === "down-left") return "left";
268
+ if (look === "right" || look === "up-right" || look === "down-right") return "right";
269
+ if (look === "up") return "up";
270
+ return "down";
271
+ }
272
+
273
+ /**
274
+ * Full standing character: `AgentAvatar` head on a neck and rounded torso, with two arms and two legs.
275
+ * Each limb is drawn straight and rotates around a joint that sits inside the torso,
276
+ * so nothing detaches when it walks.
277
+ */
278
+ export function AgentBody({
279
+ config,
280
+ size = 80,
281
+ motion = "still",
282
+ look = "forward",
283
+ say,
284
+ className,
285
+ label = "Agent",
286
+ }: AgentBodyProps) {
287
+ const resolved = resolveBodyConfig(config);
288
+ const delay = avatarStagger(`${resolved.shape}${resolved.color}`);
289
+ /** `look="up"` is the view from behind: no eyes, so there is nothing to glance with. */
290
+ const fromBehind = look === "up";
291
+ /** Walking down is walking at the viewer: the face looks straight ahead, not down. */
292
+ const home: AgentAvatarLook = look === "down" || look === "up" ? "forward" : look;
293
+ const shown = useIdleLook(motion === "idle" && !fromBehind, home, delay);
294
+ const [ex, ey] = LOOK[shown];
295
+ const dir = walkAxis(shown);
296
+ const headDrop = Number((HEAD_JOIN_Y - HEAD_BOTTOM[resolved.shape] * HEAD_SCALE).toFixed(2));
297
+ /** `run` reuses the walk cycle: same `data-motion="walk"` rules, with the gait sizes raised through `data-gait`. */
298
+ const walking = motion === "walk" || motion === "run";
299
+ const sideWalk = walking && (dir === "left" || dir === "right");
300
+ const turn = dir === "right" ? 1 : -1;
301
+ const farArmX = ARM_CENTER + turn * ARM_TURN - ARM_FAR_X;
302
+ const nearArmX = ARM_CENTER - turn * ARM_TURN - ARM_NEAR_X;
303
+ const farLegX = ARM_CENTER + turn * LEG_TURN - LEG_FAR_X;
304
+ const nearLegX = ARM_CENTER - turn * LEG_TURN - LEG_NEAR_X;
305
+ const line = say?.trim() || undefined;
306
+ const bubbleMax = Math.round(Math.min(200, Math.max(112, size * 2.35)));
307
+ /** ~2–3 mono lines in the bubble. Scales a little with character size. */
308
+ const pageChars = Math.round(Math.min(52, Math.max(36, size * 0.48)));
309
+ const { shown: typed, typing, hasMore } = useDialogue(line, pageChars);
310
+ const uid = useId().replace(/:/g, "");
311
+ const headLight = `nonla-bh-${uid}`;
312
+ const torsoLight = `nonla-bt-${uid}`;
313
+ const neckLight = `nonla-bn-${uid}`;
314
+ const shadow = `nonla-bs-${uid}`;
315
+
316
+ /** Limbs stay a step lighter than the torso so the body mass reads clearly. */
317
+ const nearStroke = mixHex(resolved.color, "#fff", 0.14);
318
+ const farStroke = mixHex(resolved.color, "#fff", 0.02);
319
+ const strokeProps = {
320
+ fill: "none" as const,
321
+ strokeWidth: 5.2,
322
+ strokeLinecap: "round" as const,
323
+ strokeLinejoin: "round" as const,
324
+ };
325
+
326
+ return (
327
+ <span
328
+ role="img"
329
+ aria-label={line ? `${label}. ${line}` : label}
330
+ data-motion={motion === "run" ? "walk" : motion}
331
+ data-gait={motion === "run" ? "run" : undefined}
332
+ data-look={shown}
333
+ data-dir={dir}
334
+ data-back={fromBehind ? "" : undefined}
335
+ data-say={line ? "" : undefined}
336
+ className={cn("nonla-body", className)}
337
+ style={{
338
+ width: size,
339
+ height: size * ASPECT,
340
+ ["--nonla-avatar-delay" as string]: `${delay}s`,
341
+ ["--nonla-avatar-ex" as string]: `${(ex / 64) * 100}%`,
342
+ ["--nonla-avatar-ey" as string]: `${(ey / 64) * 100}%`,
343
+ ["--nonla-body-bubble-size" as string]: `${Math.max(11, Math.round(size * 0.145))}px`,
344
+ ["--nonla-body-bubble-max" as string]: `${bubbleMax}px`,
345
+ }}
346
+ >
347
+ {line ? (
348
+ <span
349
+ className="nonla-body-bubble"
350
+ data-typing={typing ? "" : undefined}
351
+ data-more={hasMore ? "" : undefined}
352
+ aria-hidden
353
+ >
354
+ <span className="nonla-body-bubble-text">
355
+ {typed}
356
+ {typing ? <span className="nonla-body-bubble-caret" /> : null}
357
+ </span>
358
+ {hasMore ? <span className="nonla-body-bubble-more" /> : null}
359
+ </span>
360
+ ) : null}
361
+ <svg viewBox={`0 0 ${VIEW_W} ${VIEW_H}`} width="100%" height="100%" aria-hidden>
362
+ <defs>
363
+ <linearGradient id={headLight} gradientUnits="userSpaceOnUse" x1="32" y1="4" x2="32" y2="60">
364
+ <stop offset="0" stopColor={mixHex(resolved.color, "#fff", 0.16)} />
365
+ <stop offset="1" stopColor={resolved.color} />
366
+ </linearGradient>
367
+ {/* Torso a step darker than head/limbs so the body mass separates from the sticks. */}
368
+ <linearGradient id={torsoLight} gradientUnits="userSpaceOnUse" x1={TORSO.x} y1="0" x2={TORSO.x + TORSO.width} y2="0">
369
+ <stop offset="0" stopColor={mixHex(resolved.color, "#000", 0.1)} />
370
+ <stop offset="0.32" stopColor={mixHex(resolved.color, "#000", 0.04)} />
371
+ <stop offset="0.75" stopColor={mixHex(resolved.color, "#000", 0.14)} />
372
+ <stop offset="1" stopColor={mixHex(resolved.color, "#000", 0.22)} />
373
+ </linearGradient>
374
+ {/* Neck sits between head and torso — closer to the brighter limb tone. */}
375
+ <linearGradient id={neckLight} gradientUnits="userSpaceOnUse" x1={NECK.x} y1="0" x2={NECK.x + NECK.width} y2="0">
376
+ <stop offset="0" stopColor={mixHex(resolved.color, "#fff", 0.08)} />
377
+ <stop offset="0.5" stopColor={mixHex(resolved.color, "#fff", 0.04)} />
378
+ <stop offset="1" stopColor={mixHex(resolved.color, "#000", 0.06)} />
379
+ </linearGradient>
380
+ <filter id={shadow} x="-20%" y="-20%" width="140%" height="150%">
381
+ <feDropShadow dx="0" dy="0.9" stdDeviation="0.6" floodColor="#000" floodOpacity="0.18" />
382
+ </filter>
383
+ </defs>
384
+
385
+ <g filter={`url(#${shadow})`}>
386
+ {/*
387
+ Limbs are drawn straight down from their joints. The rest splay and the walk cycle are
388
+ CSS rotations around that joint. Legs and arms start inside the torso, which is painted
389
+ over the joints, so the joint is always covered.
390
+ Hip y=72 -> knee y=85 -> foot y=98. Shoulder y=53 -> elbow y=61.5 -> hand y=70.
391
+ */}
392
+
393
+ {/* Legs first: the torso covers the hips */}
394
+ {/* In a side walk the hips sit at the torso center, turned a hair like the shoulders. */}
395
+ <g transform={sideWalk ? `translate(${farLegX} 0)` : undefined}>
396
+ <g className="nonla-stick-leg nonla-stick-leg-b" stroke={farStroke} {...strokeProps}>
397
+ {/* One stick at rest; walk swaps to thigh + shin so the knee can fold. */}
398
+ <line className="nonla-stick-leg-bone" x1="35" y1="72" x2="35" y2="98" />
399
+ <line className="nonla-stick-thigh" x1="35" y1="72" x2="35" y2="85" />
400
+ <g className="nonla-stick-shin">
401
+ <line x1="35" y1="85" x2="35" y2="98" />
402
+ </g>
403
+ </g>
404
+ </g>
405
+ <g transform={sideWalk ? `translate(${nearLegX} 0)` : undefined}>
406
+ <g className="nonla-stick-leg nonla-stick-leg-f" stroke={nearStroke} {...strokeProps}>
407
+ <line className="nonla-stick-leg-bone" x1="45" y1="72" x2="45" y2="98" />
408
+ <line className="nonla-stick-thigh" x1="45" y1="72" x2="45" y2="85" />
409
+ <g className="nonla-stick-shin">
410
+ <line x1="45" y1="85" x2="45" y2="98" />
411
+ </g>
412
+ </g>
413
+ </g>
414
+
415
+ {/*
416
+ Left arm sits behind the torso edge. In a side walk (left or right) both shoulders move
417
+ to the middle of the torso, a hair apart as if the torso is turned a little toward the
418
+ viewer. The far arm stays behind the torso and the near arm in front.
419
+ */}
420
+ <g transform={sideWalk ? `translate(${farArmX} 0)` : undefined}>
421
+ <g className="nonla-stick-arm nonla-stick-arm-b" stroke={farStroke} {...strokeProps}>
422
+ <line x1="25.5" y1="53" x2="25.5" y2="61.5" />
423
+ <g className="nonla-stick-forearm">
424
+ <line x1="25.5" y1="61.5" x2="25.5" y2="70" />
425
+ </g>
426
+ </g>
427
+ </g>
428
+
429
+ {/* Neck, then the cylinder torso over its lower end */}
430
+ <rect className="nonla-body-neck" {...NECK} fill={`url(#${neckLight})`} />
431
+ <rect className="nonla-body-torso" {...TORSO} fill={`url(#${torsoLight})`} />
432
+
433
+ {/* Right arm hangs in front of the torso edge */}
434
+ <g transform={sideWalk ? `translate(${nearArmX} 0)` : undefined}>
435
+ <g className="nonla-stick-arm nonla-stick-arm-f" stroke={nearStroke} {...strokeProps}>
436
+ <line x1="54.5" y1="53" x2="54.5" y2="61.5" />
437
+ <g className="nonla-stick-forearm">
438
+ <line x1="54.5" y1="61.5" x2="54.5" y2="70" />
439
+ </g>
440
+ </g>
441
+ </g>
442
+
443
+ {/* AgentAvatar head on top */}
444
+ <g className="nonla-body-head">
445
+ <g transform={`translate(${HEAD_X} ${headDrop}) scale(${HEAD_SCALE})`}>
446
+ <PaintContext.Provider value={`url(#${headLight})`}>
447
+ {/* No shadow of its own: the group already has one, and a second one under the head dirties the neck. */}
448
+ <ShadowContext.Provider value={undefined}>
449
+ <AvatarShape {...resolved} />
450
+ </ShadowContext.Provider>
451
+ </PaintContext.Provider>
452
+ </g>
453
+ </g>
454
+ </g>
455
+ </svg>
456
+ </span>
457
+ );
458
+ }