@usenavii/core 0.4.0 → 0.5.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,120 @@
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
+ interface AvatarSpec {
34
+ seed: string;
35
+ palette: Palette;
36
+ body: BodyShapeId;
37
+ eyes: EyeStyleId;
38
+ mouth: MouthStyleId;
39
+ antenna: AntennaStyleId;
40
+ accessory: AccessoryId;
41
+ background: BackgroundId;
42
+ topper: TopperId;
43
+ outfit: OutfitId;
44
+ /** Hue rotation applied to body fill via SVG feColorMatrix. Degrees, signed. */
45
+ hueShift: number;
46
+ /** Uniform scale on body group. ~0.92 to 1.08. */
47
+ bodyScale: number;
48
+ /** Adjustment to anchor.eyeOffset (px in viewBox units). Signed. */
49
+ eyeGapShift: number;
50
+ /** Multiplier on mouth span. ~0.85 to 1.15. */
51
+ mouthCurveScale: number;
52
+ /** Antenna rotation in degrees. Signed. */
53
+ antennaTilt: number;
54
+ /**
55
+ * Flat render mode — when true, body uses solid fill (no radial gradient),
56
+ * no sheen, no ground shadow. Used by packs that want a 2D editorial look
57
+ * (Office ID-badge, etc.). Set by `selectAvatar` from pack flags.
58
+ */
59
+ flat?: boolean;
60
+ /**
61
+ * Override background paint — when set, render emits an opaque full-bleed
62
+ * rect of this color and skips the seeded background id. Used by packs to
63
+ * force a specific plate (e.g. Office → pure white).
64
+ */
65
+ bgColor?: string;
66
+ /**
67
+ * Multiplier on the stroke width of face features (eyes, mouth, glasses
68
+ * accessory lines). Default = 1 (baseline 1.7-1.8 px in viewBox units).
69
+ * Packs like Office bump to ~1.4 for bolder editorial face features.
70
+ */
71
+ featureStroke?: number;
72
+ /**
73
+ * When true, body silhouette gets a soft outer glow halo (Gaussian blur
74
+ * behind the sharp body). Used by Neon for cyberpunk signage feel.
75
+ */
76
+ glow?: boolean;
77
+ }
78
+ interface AvatarOptions {
79
+ /** Output canvas size in px. SVG renders at viewBox 100x100; width/height attrs scale it. */
80
+ size?: number;
81
+ /** Override background. By default the seed picks. */
82
+ background?: BackgroundId | {
83
+ color: string;
84
+ };
85
+ /** Override palette id (forces a specific color family). */
86
+ paletteId?: string;
87
+ /**
88
+ * Inject a fully custom palette object (overrides `paletteId`). Useful for
89
+ * brand palettes derived at runtime — the avatar still picks deterministic
90
+ * parts from the seed but renders in your custom colors.
91
+ */
92
+ palette?: Palette;
93
+ /**
94
+ * Enable themed packs (premium content). Pack ids resolve against the
95
+ * built-in registry; unknown ids are silently skipped. When packs are
96
+ * enabled their palettes + (future) parts merge into the selection pool,
97
+ * so the same seed renders differently from the base pool.
98
+ *
99
+ * Empty/undefined → base pool only (preserves existing seed outputs).
100
+ */
101
+ packs?: readonly string[];
102
+ /**
103
+ * Bias seeded picks toward a gender expression (`masc` | `femme` | `neutral`).
104
+ * Only takes effect when an enabled pack defines `styleHints` for the value.
105
+ * Determinism preserved: same seed + same style = same output.
106
+ */
107
+ style?: StyleHint;
108
+ /** Add `role="img"` and `aria-label`. */
109
+ title?: string;
110
+ /** Emit idle animations (float, blink, antenna pulse, sparkle twinkle). Default false. */
111
+ animated?: boolean;
112
+ /**
113
+ * Opaque circular background behind the avatar (clipped to disc).
114
+ * Examples: `'#ffffff'`, `'#0b0b0c'`, `'auto'` (palette accent).
115
+ * When set, avatar renders as a filled tile rather than a transparent figure.
116
+ */
117
+ tileBg?: string;
118
+ }
119
+
120
+ export type { AccessoryId as A, BackgroundId as B, EyeStyleId as E, MouthStyleId 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usenavii/core",
3
- "version": "0.4.0",
3
+ "version": "0.5.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 };
@@ -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 };