@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.
- package/CHANGELOG.md +133 -0
- package/README.md +3 -3
- package/dist/index.cjs +816 -61
- 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 +814 -62
- 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-CF0rfKly.d.cts +120 -0
- package/dist/types-CF0rfKly.d.ts +120 -0
- package/package.json +3 -2
- package/dist/types-BfsKZ8zK.d.cts +0 -66
- package/dist/types-BfsKZ8zK.d.ts +0 -66
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as AvatarOptions, c as AvatarSpec, d as BodyShapeId, E as EyeStyleId, M as MouthStyleId, a as AntennaStyleId, A as AccessoryId, B as BackgroundId, T as TopperId, O as OutfitId } from './types-
|
|
2
|
-
export {
|
|
1
|
+
import { b as AvatarOptions, c as AvatarSpec, d as BodyShapeId, E as EyeStyleId, M as MouthStyleId, a as AntennaStyleId, A as AccessoryId, B as BackgroundId, T as TopperId, O as OutfitId, P as Palette } from './types-CF0rfKly.cjs';
|
|
2
|
+
export { S as StyleHint } from './types-CF0rfKly.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Seed → stable PRNG stream.
|
|
@@ -156,6 +156,154 @@ interface BuildSpec {
|
|
|
156
156
|
*/
|
|
157
157
|
declare function build(spec?: BuildSpec, options?: AvatarOptions): string;
|
|
158
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Pack type definitions.
|
|
161
|
+
*
|
|
162
|
+
* A Pack is a themed bundle of palettes + (eventually) parts that opt-in
|
|
163
|
+
* extends the deterministic selection pool. Packs are referenced by id in
|
|
164
|
+
* `AvatarOptions.packs` — when enabled, their content joins the base pool
|
|
165
|
+
* for that render call.
|
|
166
|
+
*
|
|
167
|
+
* Identity rule: every variant a pack ships must have a NAMESPACED id of the
|
|
168
|
+
* form `<packId>/<localId>` (e.g. `office/suit-body`) to guarantee no
|
|
169
|
+
* collisions with base variants or other packs.
|
|
170
|
+
*
|
|
171
|
+
* Determinism: same `seed` + same enabled `packs` (order-insensitive, by id
|
|
172
|
+
* set) produce byte-identical output. Enabling a new pack will shift seeds
|
|
173
|
+
* that previously rendered against the base pool — by design (that's the
|
|
174
|
+
* "unlock" value).
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Part subset constraints. When a pack with `picks` is enabled, the named
|
|
179
|
+
* part type is restricted to the listed ids — `selectAvatar` will only pick
|
|
180
|
+
* from this subset (intersected with other enabled packs' picks). This is
|
|
181
|
+
* how a pack can make avatars feel themed even without shipping new SVG art:
|
|
182
|
+
* Office restricts to clean bodies + simple features + no antenna, Halloween
|
|
183
|
+
* picks creepy bodies + fang mouths + dark toppers, etc.
|
|
184
|
+
*
|
|
185
|
+
* Empty/undefined arrays = "no opinion, fall back to base pool".
|
|
186
|
+
*/
|
|
187
|
+
interface PackPicks {
|
|
188
|
+
body?: readonly BodyShapeId[];
|
|
189
|
+
eyes?: readonly EyeStyleId[];
|
|
190
|
+
mouth?: readonly MouthStyleId[];
|
|
191
|
+
antenna?: readonly AntennaStyleId[];
|
|
192
|
+
accessory?: readonly AccessoryId[];
|
|
193
|
+
topper?: readonly TopperId[];
|
|
194
|
+
background?: readonly BackgroundId[];
|
|
195
|
+
/**
|
|
196
|
+
* Constrain the outfit slot. Unlike base avatars (where outfit is always
|
|
197
|
+
* 'none' from seed selection), a pack can force outfits like ties, scarves,
|
|
198
|
+
* collars — gives the pack a wardrobe signature.
|
|
199
|
+
*/
|
|
200
|
+
outfit?: readonly OutfitId[];
|
|
201
|
+
}
|
|
202
|
+
interface Pack {
|
|
203
|
+
/** Stable identifier. Used as namespace prefix for variant ids. */
|
|
204
|
+
id: string;
|
|
205
|
+
/** Display name shown in plugin UI. */
|
|
206
|
+
name: string;
|
|
207
|
+
/** One-line description for marketing copy. */
|
|
208
|
+
description: string;
|
|
209
|
+
/** Optional emoji glyph for compact UI badges. */
|
|
210
|
+
emoji?: string;
|
|
211
|
+
/**
|
|
212
|
+
* ISO-8601 date string. If set and Date.now() < this date, plugin/UI
|
|
213
|
+
* should treat the pack as "Coming soon" and refuse activation even for
|
|
214
|
+
* Pro users. Core itself does not enforce — host code does.
|
|
215
|
+
*/
|
|
216
|
+
unlockDate?: string;
|
|
217
|
+
/**
|
|
218
|
+
* Palettes contributed by this pack. Each palette id should already be
|
|
219
|
+
* unique (e.g. prefixed with the pack id like `office:navy`) to avoid
|
|
220
|
+
* collision with the 22 base palettes.
|
|
221
|
+
*/
|
|
222
|
+
palettes?: Palette[];
|
|
223
|
+
/**
|
|
224
|
+
* Constrain selection pools for each part type. Used to give packs a
|
|
225
|
+
* cohesive visual identity (e.g. Office allows no antenna, Halloween
|
|
226
|
+
* forces fang mouths). When multiple packs are enabled, their picks are
|
|
227
|
+
* INTERSECTED — only ids present in every enabled pack's pick list
|
|
228
|
+
* survive. If the intersection is empty, fall back to the union to avoid
|
|
229
|
+
* blank renders.
|
|
230
|
+
*/
|
|
231
|
+
picks?: PackPicks;
|
|
232
|
+
/**
|
|
233
|
+
* Render style flags — pack-level directives that bypass the seeded 3D look.
|
|
234
|
+
*
|
|
235
|
+
* - `flat`: solid body fill, no gradient, no sheen, no ground shadow.
|
|
236
|
+
* Editorial / corporate look. Used by Office.
|
|
237
|
+
* - `bgColor`: opaque full-bleed background of this color. Replaces the
|
|
238
|
+
* seeded background id entirely. e.g. `#FFFFFF` for ID-badge plate.
|
|
239
|
+
* - `paletteExclusive`: when true, AvatarSpec selection only draws palettes
|
|
240
|
+
* from THIS pack's `palettes` list (intersected with base if no pack
|
|
241
|
+
* palettes exist). Prevents pack-themed avatars from accidentally using
|
|
242
|
+
* off-theme base colors.
|
|
243
|
+
*/
|
|
244
|
+
flat?: boolean;
|
|
245
|
+
bgColor?: string;
|
|
246
|
+
paletteExclusive?: boolean;
|
|
247
|
+
/**
|
|
248
|
+
* Multiplier on face-feature stroke width (eyes, mouth, glasses lines).
|
|
249
|
+
* Default = 1. Higher values = bolder face lines, useful for editorial
|
|
250
|
+
* packs (Office uses ~1.4).
|
|
251
|
+
*/
|
|
252
|
+
featureStroke?: number;
|
|
253
|
+
/**
|
|
254
|
+
* Apply an outer-glow halo behind the body silhouette. Used by Neon to
|
|
255
|
+
* give bright bodies a soft cyberpunk light bleed on the dark plate.
|
|
256
|
+
*/
|
|
257
|
+
glow?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Style-hint to part-subset mapping. When `AvatarOptions.style` is set to
|
|
260
|
+
* one of `masc`/`femme`/`neutral`, the corresponding sub-pools are
|
|
261
|
+
* INTERSECTED with the pack's normal picks. The seed still drives the
|
|
262
|
+
* actual pick — the hint only narrows the candidate pool.
|
|
263
|
+
*
|
|
264
|
+
* Packs that don't define a given style key (or omit this field entirely)
|
|
265
|
+
* fall through to the normal picks for that part.
|
|
266
|
+
*/
|
|
267
|
+
styleHints?: {
|
|
268
|
+
masc?: StylePartSubset;
|
|
269
|
+
femme?: StylePartSubset;
|
|
270
|
+
neutral?: StylePartSubset;
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
/** Read-only registry shape — host code passes one to select/render. */
|
|
274
|
+
type PackRegistry = Record<string, Pack>;
|
|
275
|
+
/**
|
|
276
|
+
* Subset of parts a pack restricts when a specific style hint is requested.
|
|
277
|
+
* Outfit / accessory / topper are the most expressive of style presentation;
|
|
278
|
+
* eyes / mouth are optional overrides for packs whose look depends on facial
|
|
279
|
+
* expression (e.g. pastel/kawaii). Bodies stay seed-driven.
|
|
280
|
+
*/
|
|
281
|
+
interface StylePartSubset {
|
|
282
|
+
eyes?: readonly EyeStyleId[];
|
|
283
|
+
mouth?: readonly MouthStyleId[];
|
|
284
|
+
outfit?: readonly OutfitId[];
|
|
285
|
+
accessory?: readonly AccessoryId[];
|
|
286
|
+
topper?: readonly TopperId[];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Built-in pack registry.
|
|
291
|
+
*
|
|
292
|
+
* Each pack is its own file so future SVG part data + palette tweaks can be
|
|
293
|
+
* authored in isolation. Adding a new pack = drop a file here + import +
|
|
294
|
+
* export it from this module.
|
|
295
|
+
*
|
|
296
|
+
* Packs ship empty for Day 1 of the pack infrastructure work — palettes +
|
|
297
|
+
* parts are added in follow-up commits. The registry exists so the wiring
|
|
298
|
+
* (selectAvatar, plugin tabs, license gating) can be tested end-to-end
|
|
299
|
+
* before any premium art lands.
|
|
300
|
+
*/
|
|
301
|
+
|
|
302
|
+
declare const BUILT_IN_PACKS: Pack[];
|
|
303
|
+
declare const PACK_REGISTRY: PackRegistry;
|
|
304
|
+
/** Resolve a list of pack ids to Pack objects, skipping unknown ids. */
|
|
305
|
+
declare function resolvePacks(ids: readonly string[] | undefined): Pack[];
|
|
306
|
+
|
|
159
307
|
/**
|
|
160
308
|
* Render a deterministic mascot avatar from a seed.
|
|
161
309
|
*
|
|
@@ -237,4 +385,4 @@ declare const Navii: {
|
|
|
237
385
|
readonly build: typeof build;
|
|
238
386
|
};
|
|
239
387
|
|
|
240
|
-
export { AccessoryId, AntennaStyleId, AvatarOptions, AvatarSpec, BackgroundId, BodyShapeId, type BuildSpec, EyeStyleId, type GroupOptions, MouthStyleId, Navii, OutfitId, type SeedFields, TopperId, build, createAvatar, createRng, cyrb53, random, renderAvatar, renderAvatarInner, renderGroup, seed, selectAvatar };
|
|
388
|
+
export { AccessoryId, AntennaStyleId, AvatarOptions, AvatarSpec, BUILT_IN_PACKS, BackgroundId, BodyShapeId, type BuildSpec, EyeStyleId, type GroupOptions, MouthStyleId, Navii, OutfitId, PACK_REGISTRY, type Pack, type PackRegistry, Palette, type SeedFields, TopperId, build, createAvatar, createRng, cyrb53, random, renderAvatar, renderAvatarInner, renderGroup, resolvePacks, seed, selectAvatar };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as AvatarOptions, c as AvatarSpec, d as BodyShapeId, E as EyeStyleId, M as MouthStyleId, a as AntennaStyleId, A as AccessoryId, B as BackgroundId, T as TopperId, O as OutfitId } from './types-
|
|
2
|
-
export {
|
|
1
|
+
import { b as AvatarOptions, c as AvatarSpec, d as BodyShapeId, E as EyeStyleId, M as MouthStyleId, a as AntennaStyleId, A as AccessoryId, B as BackgroundId, T as TopperId, O as OutfitId, P as Palette } from './types-CF0rfKly.js';
|
|
2
|
+
export { S as StyleHint } from './types-CF0rfKly.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Seed → stable PRNG stream.
|
|
@@ -156,6 +156,154 @@ interface BuildSpec {
|
|
|
156
156
|
*/
|
|
157
157
|
declare function build(spec?: BuildSpec, options?: AvatarOptions): string;
|
|
158
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Pack type definitions.
|
|
161
|
+
*
|
|
162
|
+
* A Pack is a themed bundle of palettes + (eventually) parts that opt-in
|
|
163
|
+
* extends the deterministic selection pool. Packs are referenced by id in
|
|
164
|
+
* `AvatarOptions.packs` — when enabled, their content joins the base pool
|
|
165
|
+
* for that render call.
|
|
166
|
+
*
|
|
167
|
+
* Identity rule: every variant a pack ships must have a NAMESPACED id of the
|
|
168
|
+
* form `<packId>/<localId>` (e.g. `office/suit-body`) to guarantee no
|
|
169
|
+
* collisions with base variants or other packs.
|
|
170
|
+
*
|
|
171
|
+
* Determinism: same `seed` + same enabled `packs` (order-insensitive, by id
|
|
172
|
+
* set) produce byte-identical output. Enabling a new pack will shift seeds
|
|
173
|
+
* that previously rendered against the base pool — by design (that's the
|
|
174
|
+
* "unlock" value).
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Part subset constraints. When a pack with `picks` is enabled, the named
|
|
179
|
+
* part type is restricted to the listed ids — `selectAvatar` will only pick
|
|
180
|
+
* from this subset (intersected with other enabled packs' picks). This is
|
|
181
|
+
* how a pack can make avatars feel themed even without shipping new SVG art:
|
|
182
|
+
* Office restricts to clean bodies + simple features + no antenna, Halloween
|
|
183
|
+
* picks creepy bodies + fang mouths + dark toppers, etc.
|
|
184
|
+
*
|
|
185
|
+
* Empty/undefined arrays = "no opinion, fall back to base pool".
|
|
186
|
+
*/
|
|
187
|
+
interface PackPicks {
|
|
188
|
+
body?: readonly BodyShapeId[];
|
|
189
|
+
eyes?: readonly EyeStyleId[];
|
|
190
|
+
mouth?: readonly MouthStyleId[];
|
|
191
|
+
antenna?: readonly AntennaStyleId[];
|
|
192
|
+
accessory?: readonly AccessoryId[];
|
|
193
|
+
topper?: readonly TopperId[];
|
|
194
|
+
background?: readonly BackgroundId[];
|
|
195
|
+
/**
|
|
196
|
+
* Constrain the outfit slot. Unlike base avatars (where outfit is always
|
|
197
|
+
* 'none' from seed selection), a pack can force outfits like ties, scarves,
|
|
198
|
+
* collars — gives the pack a wardrobe signature.
|
|
199
|
+
*/
|
|
200
|
+
outfit?: readonly OutfitId[];
|
|
201
|
+
}
|
|
202
|
+
interface Pack {
|
|
203
|
+
/** Stable identifier. Used as namespace prefix for variant ids. */
|
|
204
|
+
id: string;
|
|
205
|
+
/** Display name shown in plugin UI. */
|
|
206
|
+
name: string;
|
|
207
|
+
/** One-line description for marketing copy. */
|
|
208
|
+
description: string;
|
|
209
|
+
/** Optional emoji glyph for compact UI badges. */
|
|
210
|
+
emoji?: string;
|
|
211
|
+
/**
|
|
212
|
+
* ISO-8601 date string. If set and Date.now() < this date, plugin/UI
|
|
213
|
+
* should treat the pack as "Coming soon" and refuse activation even for
|
|
214
|
+
* Pro users. Core itself does not enforce — host code does.
|
|
215
|
+
*/
|
|
216
|
+
unlockDate?: string;
|
|
217
|
+
/**
|
|
218
|
+
* Palettes contributed by this pack. Each palette id should already be
|
|
219
|
+
* unique (e.g. prefixed with the pack id like `office:navy`) to avoid
|
|
220
|
+
* collision with the 22 base palettes.
|
|
221
|
+
*/
|
|
222
|
+
palettes?: Palette[];
|
|
223
|
+
/**
|
|
224
|
+
* Constrain selection pools for each part type. Used to give packs a
|
|
225
|
+
* cohesive visual identity (e.g. Office allows no antenna, Halloween
|
|
226
|
+
* forces fang mouths). When multiple packs are enabled, their picks are
|
|
227
|
+
* INTERSECTED — only ids present in every enabled pack's pick list
|
|
228
|
+
* survive. If the intersection is empty, fall back to the union to avoid
|
|
229
|
+
* blank renders.
|
|
230
|
+
*/
|
|
231
|
+
picks?: PackPicks;
|
|
232
|
+
/**
|
|
233
|
+
* Render style flags — pack-level directives that bypass the seeded 3D look.
|
|
234
|
+
*
|
|
235
|
+
* - `flat`: solid body fill, no gradient, no sheen, no ground shadow.
|
|
236
|
+
* Editorial / corporate look. Used by Office.
|
|
237
|
+
* - `bgColor`: opaque full-bleed background of this color. Replaces the
|
|
238
|
+
* seeded background id entirely. e.g. `#FFFFFF` for ID-badge plate.
|
|
239
|
+
* - `paletteExclusive`: when true, AvatarSpec selection only draws palettes
|
|
240
|
+
* from THIS pack's `palettes` list (intersected with base if no pack
|
|
241
|
+
* palettes exist). Prevents pack-themed avatars from accidentally using
|
|
242
|
+
* off-theme base colors.
|
|
243
|
+
*/
|
|
244
|
+
flat?: boolean;
|
|
245
|
+
bgColor?: string;
|
|
246
|
+
paletteExclusive?: boolean;
|
|
247
|
+
/**
|
|
248
|
+
* Multiplier on face-feature stroke width (eyes, mouth, glasses lines).
|
|
249
|
+
* Default = 1. Higher values = bolder face lines, useful for editorial
|
|
250
|
+
* packs (Office uses ~1.4).
|
|
251
|
+
*/
|
|
252
|
+
featureStroke?: number;
|
|
253
|
+
/**
|
|
254
|
+
* Apply an outer-glow halo behind the body silhouette. Used by Neon to
|
|
255
|
+
* give bright bodies a soft cyberpunk light bleed on the dark plate.
|
|
256
|
+
*/
|
|
257
|
+
glow?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Style-hint to part-subset mapping. When `AvatarOptions.style` is set to
|
|
260
|
+
* one of `masc`/`femme`/`neutral`, the corresponding sub-pools are
|
|
261
|
+
* INTERSECTED with the pack's normal picks. The seed still drives the
|
|
262
|
+
* actual pick — the hint only narrows the candidate pool.
|
|
263
|
+
*
|
|
264
|
+
* Packs that don't define a given style key (or omit this field entirely)
|
|
265
|
+
* fall through to the normal picks for that part.
|
|
266
|
+
*/
|
|
267
|
+
styleHints?: {
|
|
268
|
+
masc?: StylePartSubset;
|
|
269
|
+
femme?: StylePartSubset;
|
|
270
|
+
neutral?: StylePartSubset;
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
/** Read-only registry shape — host code passes one to select/render. */
|
|
274
|
+
type PackRegistry = Record<string, Pack>;
|
|
275
|
+
/**
|
|
276
|
+
* Subset of parts a pack restricts when a specific style hint is requested.
|
|
277
|
+
* Outfit / accessory / topper are the most expressive of style presentation;
|
|
278
|
+
* eyes / mouth are optional overrides for packs whose look depends on facial
|
|
279
|
+
* expression (e.g. pastel/kawaii). Bodies stay seed-driven.
|
|
280
|
+
*/
|
|
281
|
+
interface StylePartSubset {
|
|
282
|
+
eyes?: readonly EyeStyleId[];
|
|
283
|
+
mouth?: readonly MouthStyleId[];
|
|
284
|
+
outfit?: readonly OutfitId[];
|
|
285
|
+
accessory?: readonly AccessoryId[];
|
|
286
|
+
topper?: readonly TopperId[];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Built-in pack registry.
|
|
291
|
+
*
|
|
292
|
+
* Each pack is its own file so future SVG part data + palette tweaks can be
|
|
293
|
+
* authored in isolation. Adding a new pack = drop a file here + import +
|
|
294
|
+
* export it from this module.
|
|
295
|
+
*
|
|
296
|
+
* Packs ship empty for Day 1 of the pack infrastructure work — palettes +
|
|
297
|
+
* parts are added in follow-up commits. The registry exists so the wiring
|
|
298
|
+
* (selectAvatar, plugin tabs, license gating) can be tested end-to-end
|
|
299
|
+
* before any premium art lands.
|
|
300
|
+
*/
|
|
301
|
+
|
|
302
|
+
declare const BUILT_IN_PACKS: Pack[];
|
|
303
|
+
declare const PACK_REGISTRY: PackRegistry;
|
|
304
|
+
/** Resolve a list of pack ids to Pack objects, skipping unknown ids. */
|
|
305
|
+
declare function resolvePacks(ids: readonly string[] | undefined): Pack[];
|
|
306
|
+
|
|
159
307
|
/**
|
|
160
308
|
* Render a deterministic mascot avatar from a seed.
|
|
161
309
|
*
|
|
@@ -237,4 +385,4 @@ declare const Navii: {
|
|
|
237
385
|
readonly build: typeof build;
|
|
238
386
|
};
|
|
239
387
|
|
|
240
|
-
export { AccessoryId, AntennaStyleId, AvatarOptions, AvatarSpec, BackgroundId, BodyShapeId, type BuildSpec, EyeStyleId, type GroupOptions, MouthStyleId, Navii, OutfitId, type SeedFields, TopperId, build, createAvatar, createRng, cyrb53, random, renderAvatar, renderAvatarInner, renderGroup, seed, selectAvatar };
|
|
388
|
+
export { AccessoryId, AntennaStyleId, AvatarOptions, AvatarSpec, BUILT_IN_PACKS, BackgroundId, BodyShapeId, type BuildSpec, EyeStyleId, type GroupOptions, MouthStyleId, Navii, OutfitId, PACK_REGISTRY, type Pack, type PackRegistry, Palette, type SeedFields, TopperId, build, createAvatar, createRng, cyrb53, random, renderAvatar, renderAvatarInner, renderGroup, resolvePacks, seed, selectAvatar };
|