@usenavii/core 0.4.0 → 0.6.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/CHANGELOG.md +191 -0
- package/README.md +3 -3
- package/dist/index.cjs +832 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +151 -3
- package/dist/index.d.ts +151 -3
- package/dist/index.js +830 -63
- package/dist/index.js.map +1 -1
- package/dist/parts.cjs +262 -43
- package/dist/parts.cjs.map +1 -1
- package/dist/parts.d.cts +16 -6
- package/dist/parts.d.ts +16 -6
- package/dist/parts.js +262 -43
- package/dist/parts.js.map +1 -1
- package/dist/types-BtX6LIyn.d.cts +139 -0
- package/dist/types-BtX6LIyn.d.ts +139 -0
- package/package.json +3 -2
- package/dist/types-BfsKZ8zK.d.cts +0 -66
- package/dist/types-BfsKZ8zK.d.ts +0 -66
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types for the Navii avatar engine.
|
|
3
|
+
*
|
|
4
|
+
* AvatarSpec is the resolved description of an individual avatar — a tuple of
|
|
5
|
+
* part IDs derived from the seed. The renderer turns it into SVG markup.
|
|
6
|
+
*/
|
|
7
|
+
interface Palette {
|
|
8
|
+
id: string;
|
|
9
|
+
bodyFrom: string;
|
|
10
|
+
bodyTo: string;
|
|
11
|
+
accent: string;
|
|
12
|
+
ink: string;
|
|
13
|
+
blush: string;
|
|
14
|
+
}
|
|
15
|
+
type BodyShapeId = 'orb' | 'tall' | 'squat' | 'pear' | 'pebble' | 'dumpling' | 'taro' | 'wisp' | 'squircle' | 'pumpkin' | 'ghost' | 'skullHead';
|
|
16
|
+
type EyeStyleId = 'round' | 'wide' | 'squint' | 'wink' | 'sleepy' | 'star' | 'heart' | 'oval' | 'dot' | 'cross';
|
|
17
|
+
type MouthStyleId = 'smile' | 'grin' | 'open' | 'flat' | 'smirk' | 'awe' | 'tongue' | 'tooth' | 'wave' | 'dot' | 'jagged' | 'fangs';
|
|
18
|
+
type AntennaStyleId = 'none' | 'classic' | 'curl' | 'double' | 'spike';
|
|
19
|
+
type AccessoryId = 'none' | 'blush' | 'freckles' | 'sparkle' | 'glasses' | 'eyepatch' | 'mole' | 'earring';
|
|
20
|
+
type BackgroundId = 'none' | 'solid' | 'ring';
|
|
21
|
+
type TopperId = 'none' | 'ears' | 'roundEars' | 'horn' | 'horns' | 'tuft' | 'cap' | 'leaf' | 'headband' | 'halo' | 'crown' | 'antlers' | 'bob' | 'bun' | 'ponytail' | 'witchHat' | 'pumpkinStem' | 'ghostSheet';
|
|
22
|
+
type OutfitId = 'none' | 'collar' | 'scarf' | 'bowtie' | 'sunflower' | 'necklace' | 'tie';
|
|
23
|
+
/**
|
|
24
|
+
* Optional style hint used to bias seeded picks toward a gender expression.
|
|
25
|
+
*
|
|
26
|
+
* The pack defines a mapping for each value (outfit + accessory + topper
|
|
27
|
+
* subsets). When set, those subsets intersect with the pack's normal picks.
|
|
28
|
+
* `neutral` is the default fallback when a pack lacks a specific mapping.
|
|
29
|
+
*
|
|
30
|
+
* Packs that don't declare styleHints simply ignore this option.
|
|
31
|
+
*/
|
|
32
|
+
type StyleHint = 'masc' | 'femme' | 'neutral';
|
|
33
|
+
/**
|
|
34
|
+
* Expression overlay for the seed flow. Overrides the seed-derived `eyes` +
|
|
35
|
+
* `mouth` selections with a curated pair that conveys a specific mood.
|
|
36
|
+
*
|
|
37
|
+
* Same seed + same mood = same avatar. Different mood = same body, different
|
|
38
|
+
* face. Pack pick constraints on eyes/mouth are bypassed by design — the
|
|
39
|
+
* mood IS the override, so Office + `happy` legitimately produces wide eyes
|
|
40
|
+
* even though Office normally restricts to dot/sleepy/squint.
|
|
41
|
+
*
|
|
42
|
+
* `neutral` (or undefined) leaves picks seed-derived (current behavior).
|
|
43
|
+
*/
|
|
44
|
+
type MoodId = 'neutral' | 'happy' | 'serious' | 'sleepy' | 'wink';
|
|
45
|
+
interface AvatarSpec {
|
|
46
|
+
seed: string;
|
|
47
|
+
palette: Palette;
|
|
48
|
+
body: BodyShapeId;
|
|
49
|
+
eyes: EyeStyleId;
|
|
50
|
+
mouth: MouthStyleId;
|
|
51
|
+
antenna: AntennaStyleId;
|
|
52
|
+
accessory: AccessoryId;
|
|
53
|
+
background: BackgroundId;
|
|
54
|
+
topper: TopperId;
|
|
55
|
+
outfit: OutfitId;
|
|
56
|
+
/** Hue rotation applied to body fill via SVG feColorMatrix. Degrees, signed. */
|
|
57
|
+
hueShift: number;
|
|
58
|
+
/** Uniform scale on body group. ~0.92 to 1.08. */
|
|
59
|
+
bodyScale: number;
|
|
60
|
+
/** Adjustment to anchor.eyeOffset (px in viewBox units). Signed. */
|
|
61
|
+
eyeGapShift: number;
|
|
62
|
+
/** Multiplier on mouth span. ~0.85 to 1.15. */
|
|
63
|
+
mouthCurveScale: number;
|
|
64
|
+
/** Antenna rotation in degrees. Signed. */
|
|
65
|
+
antennaTilt: number;
|
|
66
|
+
/**
|
|
67
|
+
* Flat render mode — when true, body uses solid fill (no radial gradient),
|
|
68
|
+
* no sheen, no ground shadow. Used by packs that want a 2D editorial look
|
|
69
|
+
* (Office ID-badge, etc.). Set by `selectAvatar` from pack flags.
|
|
70
|
+
*/
|
|
71
|
+
flat?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Override background paint — when set, render emits an opaque full-bleed
|
|
74
|
+
* rect of this color and skips the seeded background id. Used by packs to
|
|
75
|
+
* force a specific plate (e.g. Office → pure white).
|
|
76
|
+
*/
|
|
77
|
+
bgColor?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Multiplier on the stroke width of face features (eyes, mouth, glasses
|
|
80
|
+
* accessory lines). Default = 1 (baseline 1.7-1.8 px in viewBox units).
|
|
81
|
+
* Packs like Office bump to ~1.4 for bolder editorial face features.
|
|
82
|
+
*/
|
|
83
|
+
featureStroke?: number;
|
|
84
|
+
/**
|
|
85
|
+
* When true, body silhouette gets a soft outer glow halo (Gaussian blur
|
|
86
|
+
* behind the sharp body). Used by Neon for cyberpunk signage feel.
|
|
87
|
+
*/
|
|
88
|
+
glow?: boolean;
|
|
89
|
+
}
|
|
90
|
+
interface AvatarOptions {
|
|
91
|
+
/** Output canvas size in px. SVG renders at viewBox 100x100; width/height attrs scale it. */
|
|
92
|
+
size?: number;
|
|
93
|
+
/** Override background. By default the seed picks. */
|
|
94
|
+
background?: BackgroundId | {
|
|
95
|
+
color: string;
|
|
96
|
+
};
|
|
97
|
+
/** Override palette id (forces a specific color family). */
|
|
98
|
+
paletteId?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Inject a fully custom palette object (overrides `paletteId`). Useful for
|
|
101
|
+
* brand palettes derived at runtime — the avatar still picks deterministic
|
|
102
|
+
* parts from the seed but renders in your custom colors.
|
|
103
|
+
*/
|
|
104
|
+
palette?: Palette;
|
|
105
|
+
/**
|
|
106
|
+
* Enable themed packs (premium content). Pack ids resolve against the
|
|
107
|
+
* built-in registry; unknown ids are silently skipped. When packs are
|
|
108
|
+
* enabled their palettes + (future) parts merge into the selection pool,
|
|
109
|
+
* so the same seed renders differently from the base pool.
|
|
110
|
+
*
|
|
111
|
+
* Empty/undefined → base pool only (preserves existing seed outputs).
|
|
112
|
+
*/
|
|
113
|
+
packs?: readonly string[];
|
|
114
|
+
/**
|
|
115
|
+
* Bias seeded picks toward a gender expression (`masc` | `femme` | `neutral`).
|
|
116
|
+
* Only takes effect when an enabled pack defines `styleHints` for the value.
|
|
117
|
+
* Determinism preserved: same seed + same style = same output.
|
|
118
|
+
*/
|
|
119
|
+
style?: StyleHint;
|
|
120
|
+
/**
|
|
121
|
+
* Expression overlay. Overrides seed-derived eyes + mouth with a curated
|
|
122
|
+
* pair conveying a specific mood (happy / serious / sleepy / wink). Same
|
|
123
|
+
* seed + mood = same avatar; different moods on the same seed share body,
|
|
124
|
+
* palette, topper, etc. Bypasses pack pick constraints on eyes/mouth.
|
|
125
|
+
*/
|
|
126
|
+
mood?: MoodId;
|
|
127
|
+
/** Add `role="img"` and `aria-label`. */
|
|
128
|
+
title?: string;
|
|
129
|
+
/** Emit idle animations (float, blink, antenna pulse, sparkle twinkle). Default false. */
|
|
130
|
+
animated?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Opaque circular background behind the avatar (clipped to disc).
|
|
133
|
+
* Examples: `'#ffffff'`, `'#0b0b0c'`, `'auto'` (palette accent).
|
|
134
|
+
* When set, avatar renders as a filled tile rather than a transparent figure.
|
|
135
|
+
*/
|
|
136
|
+
tileBg?: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export type { AccessoryId as A, BackgroundId as B, EyeStyleId as E, MoodId as M, OutfitId as O, Palette as P, StyleHint as S, TopperId as T, AntennaStyleId as a, AvatarOptions as b, AvatarSpec as c, BodyShapeId as d, MouthStyleId as e };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usenavii/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Deterministic mascot avatar engine. Pass any seed, get back a clean, designed SVG that's the same every time.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
23
|
"README.md",
|
|
24
|
-
"LICENSE"
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"CHANGELOG.md"
|
|
25
26
|
],
|
|
26
27
|
"keywords": [
|
|
27
28
|
"avatar",
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public types for the Navii avatar engine.
|
|
3
|
-
*
|
|
4
|
-
* AvatarSpec is the resolved description of an individual avatar — a tuple of
|
|
5
|
-
* part IDs derived from the seed. The renderer turns it into SVG markup.
|
|
6
|
-
*/
|
|
7
|
-
interface Palette {
|
|
8
|
-
id: string;
|
|
9
|
-
bodyFrom: string;
|
|
10
|
-
bodyTo: string;
|
|
11
|
-
accent: string;
|
|
12
|
-
ink: string;
|
|
13
|
-
blush: string;
|
|
14
|
-
}
|
|
15
|
-
type BodyShapeId = 'orb' | 'tall' | 'squat' | 'pear' | 'pebble' | 'dumpling' | 'taro' | 'wisp';
|
|
16
|
-
type EyeStyleId = 'round' | 'wide' | 'squint' | 'wink' | 'sleepy' | 'star' | 'heart' | 'oval' | 'dot' | 'cross';
|
|
17
|
-
type MouthStyleId = 'smile' | 'grin' | 'open' | 'flat' | 'smirk' | 'awe' | 'tongue' | 'tooth' | 'wave' | 'dot';
|
|
18
|
-
type AntennaStyleId = 'none' | 'classic' | 'curl' | 'double' | 'spike';
|
|
19
|
-
type AccessoryId = 'none' | 'blush' | 'freckles' | 'sparkle' | 'glasses' | 'eyepatch' | 'mole';
|
|
20
|
-
type BackgroundId = 'none' | 'solid' | 'ring';
|
|
21
|
-
type TopperId = 'none' | 'ears' | 'roundEars' | 'horn' | 'horns' | 'tuft' | 'cap' | 'leaf' | 'headband' | 'halo' | 'crown' | 'antlers';
|
|
22
|
-
type OutfitId = 'none' | 'collar' | 'scarf' | 'bowtie' | 'sunflower' | 'necklace';
|
|
23
|
-
interface AvatarSpec {
|
|
24
|
-
seed: string;
|
|
25
|
-
palette: Palette;
|
|
26
|
-
body: BodyShapeId;
|
|
27
|
-
eyes: EyeStyleId;
|
|
28
|
-
mouth: MouthStyleId;
|
|
29
|
-
antenna: AntennaStyleId;
|
|
30
|
-
accessory: AccessoryId;
|
|
31
|
-
background: BackgroundId;
|
|
32
|
-
topper: TopperId;
|
|
33
|
-
outfit: OutfitId;
|
|
34
|
-
/** Hue rotation applied to body fill via SVG feColorMatrix. Degrees, signed. */
|
|
35
|
-
hueShift: number;
|
|
36
|
-
/** Uniform scale on body group. ~0.92 to 1.08. */
|
|
37
|
-
bodyScale: number;
|
|
38
|
-
/** Adjustment to anchor.eyeOffset (px in viewBox units). Signed. */
|
|
39
|
-
eyeGapShift: number;
|
|
40
|
-
/** Multiplier on mouth span. ~0.85 to 1.15. */
|
|
41
|
-
mouthCurveScale: number;
|
|
42
|
-
/** Antenna rotation in degrees. Signed. */
|
|
43
|
-
antennaTilt: number;
|
|
44
|
-
}
|
|
45
|
-
interface AvatarOptions {
|
|
46
|
-
/** Output canvas size in px. SVG renders at viewBox 100x100; width/height attrs scale it. */
|
|
47
|
-
size?: number;
|
|
48
|
-
/** Override background. By default the seed picks. */
|
|
49
|
-
background?: BackgroundId | {
|
|
50
|
-
color: string;
|
|
51
|
-
};
|
|
52
|
-
/** Override palette id (forces a specific color family). */
|
|
53
|
-
paletteId?: string;
|
|
54
|
-
/** Add `role="img"` and `aria-label`. */
|
|
55
|
-
title?: string;
|
|
56
|
-
/** Emit idle animations (float, blink, antenna pulse, sparkle twinkle). Default false. */
|
|
57
|
-
animated?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Opaque circular background behind the avatar (clipped to disc).
|
|
60
|
-
* Examples: `'#ffffff'`, `'#0b0b0c'`, `'auto'` (palette accent).
|
|
61
|
-
* When set, avatar renders as a filled tile rather than a transparent figure.
|
|
62
|
-
*/
|
|
63
|
-
tileBg?: string;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export type { AccessoryId as A, BackgroundId as B, EyeStyleId as E, MouthStyleId as M, OutfitId as O, Palette as P, TopperId as T, AntennaStyleId as a, AvatarOptions as b, AvatarSpec as c, BodyShapeId as d };
|
package/dist/types-BfsKZ8zK.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public types for the Navii avatar engine.
|
|
3
|
-
*
|
|
4
|
-
* AvatarSpec is the resolved description of an individual avatar — a tuple of
|
|
5
|
-
* part IDs derived from the seed. The renderer turns it into SVG markup.
|
|
6
|
-
*/
|
|
7
|
-
interface Palette {
|
|
8
|
-
id: string;
|
|
9
|
-
bodyFrom: string;
|
|
10
|
-
bodyTo: string;
|
|
11
|
-
accent: string;
|
|
12
|
-
ink: string;
|
|
13
|
-
blush: string;
|
|
14
|
-
}
|
|
15
|
-
type BodyShapeId = 'orb' | 'tall' | 'squat' | 'pear' | 'pebble' | 'dumpling' | 'taro' | 'wisp';
|
|
16
|
-
type EyeStyleId = 'round' | 'wide' | 'squint' | 'wink' | 'sleepy' | 'star' | 'heart' | 'oval' | 'dot' | 'cross';
|
|
17
|
-
type MouthStyleId = 'smile' | 'grin' | 'open' | 'flat' | 'smirk' | 'awe' | 'tongue' | 'tooth' | 'wave' | 'dot';
|
|
18
|
-
type AntennaStyleId = 'none' | 'classic' | 'curl' | 'double' | 'spike';
|
|
19
|
-
type AccessoryId = 'none' | 'blush' | 'freckles' | 'sparkle' | 'glasses' | 'eyepatch' | 'mole';
|
|
20
|
-
type BackgroundId = 'none' | 'solid' | 'ring';
|
|
21
|
-
type TopperId = 'none' | 'ears' | 'roundEars' | 'horn' | 'horns' | 'tuft' | 'cap' | 'leaf' | 'headband' | 'halo' | 'crown' | 'antlers';
|
|
22
|
-
type OutfitId = 'none' | 'collar' | 'scarf' | 'bowtie' | 'sunflower' | 'necklace';
|
|
23
|
-
interface AvatarSpec {
|
|
24
|
-
seed: string;
|
|
25
|
-
palette: Palette;
|
|
26
|
-
body: BodyShapeId;
|
|
27
|
-
eyes: EyeStyleId;
|
|
28
|
-
mouth: MouthStyleId;
|
|
29
|
-
antenna: AntennaStyleId;
|
|
30
|
-
accessory: AccessoryId;
|
|
31
|
-
background: BackgroundId;
|
|
32
|
-
topper: TopperId;
|
|
33
|
-
outfit: OutfitId;
|
|
34
|
-
/** Hue rotation applied to body fill via SVG feColorMatrix. Degrees, signed. */
|
|
35
|
-
hueShift: number;
|
|
36
|
-
/** Uniform scale on body group. ~0.92 to 1.08. */
|
|
37
|
-
bodyScale: number;
|
|
38
|
-
/** Adjustment to anchor.eyeOffset (px in viewBox units). Signed. */
|
|
39
|
-
eyeGapShift: number;
|
|
40
|
-
/** Multiplier on mouth span. ~0.85 to 1.15. */
|
|
41
|
-
mouthCurveScale: number;
|
|
42
|
-
/** Antenna rotation in degrees. Signed. */
|
|
43
|
-
antennaTilt: number;
|
|
44
|
-
}
|
|
45
|
-
interface AvatarOptions {
|
|
46
|
-
/** Output canvas size in px. SVG renders at viewBox 100x100; width/height attrs scale it. */
|
|
47
|
-
size?: number;
|
|
48
|
-
/** Override background. By default the seed picks. */
|
|
49
|
-
background?: BackgroundId | {
|
|
50
|
-
color: string;
|
|
51
|
-
};
|
|
52
|
-
/** Override palette id (forces a specific color family). */
|
|
53
|
-
paletteId?: string;
|
|
54
|
-
/** Add `role="img"` and `aria-label`. */
|
|
55
|
-
title?: string;
|
|
56
|
-
/** Emit idle animations (float, blink, antenna pulse, sparkle twinkle). Default false. */
|
|
57
|
-
animated?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Opaque circular background behind the avatar (clipped to disc).
|
|
60
|
-
* Examples: `'#ffffff'`, `'#0b0b0c'`, `'auto'` (palette accent).
|
|
61
|
-
* When set, avatar renders as a filled tile rather than a transparent figure.
|
|
62
|
-
*/
|
|
63
|
-
tileBg?: string;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export type { AccessoryId as A, BackgroundId as B, EyeStyleId as E, MouthStyleId as M, OutfitId as O, Palette as P, TopperId as T, AntennaStyleId as a, AvatarOptions as b, AvatarSpec as c, BodyShapeId as d };
|