@usenavii/core 0.5.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 +59 -1
- package/dist/index.cjs +18 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/dist/parts.d.cts +1 -1
- package/dist/parts.d.ts +1 -1
- package/dist/{types-CF0rfKly.d.cts → types-BtX6LIyn.d.cts} +20 -1
- package/dist/{types-CF0rfKly.d.ts → types-BtX6LIyn.d.ts} +20 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as AvatarOptions, c as AvatarSpec, d as BodyShapeId, E as EyeStyleId,
|
|
2
|
-
export { S as StyleHint } from './types-
|
|
1
|
+
import { b as AvatarOptions, c as AvatarSpec, d as BodyShapeId, E as EyeStyleId, e as MouthStyleId, a as AntennaStyleId, A as AccessoryId, B as BackgroundId, T as TopperId, O as OutfitId, P as Palette } from './types-BtX6LIyn.cjs';
|
|
2
|
+
export { M as MoodId, S as StyleHint } from './types-BtX6LIyn.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Seed → stable PRNG stream.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as AvatarOptions, c as AvatarSpec, d as BodyShapeId, E as EyeStyleId,
|
|
2
|
-
export { S as StyleHint } from './types-
|
|
1
|
+
import { b as AvatarOptions, c as AvatarSpec, d as BodyShapeId, E as EyeStyleId, e as MouthStyleId, a as AntennaStyleId, A as AccessoryId, B as BackgroundId, T as TopperId, O as OutfitId, P as Palette } from './types-BtX6LIyn.js';
|
|
2
|
+
export { M as MoodId, S as StyleHint } from './types-BtX6LIyn.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Seed → stable PRNG stream.
|
package/dist/index.js
CHANGED
|
@@ -1337,6 +1337,18 @@ function resolvePacks(ids) {
|
|
|
1337
1337
|
}
|
|
1338
1338
|
|
|
1339
1339
|
// src/select.ts
|
|
1340
|
+
var MOOD_EYES = {
|
|
1341
|
+
happy: "wide",
|
|
1342
|
+
serious: "squint",
|
|
1343
|
+
sleepy: "sleepy",
|
|
1344
|
+
wink: "wink"
|
|
1345
|
+
};
|
|
1346
|
+
var MOOD_MOUTH = {
|
|
1347
|
+
happy: "smile",
|
|
1348
|
+
serious: "flat",
|
|
1349
|
+
sleepy: "dot",
|
|
1350
|
+
wink: "smirk"
|
|
1351
|
+
};
|
|
1340
1352
|
function applyStyleHint(pool, packs, hint, partKey) {
|
|
1341
1353
|
for (const pack of packs) {
|
|
1342
1354
|
const subset = pack.styleHints?.[hint]?.[partKey];
|
|
@@ -1398,10 +1410,13 @@ function selectAvatar(seed2, options = {}) {
|
|
|
1398
1410
|
topperPool = applyStyleHint(topperPool, enabledPacks, styleHint, "topper");
|
|
1399
1411
|
}
|
|
1400
1412
|
const body = rng.pick(bodyPool);
|
|
1401
|
-
const
|
|
1402
|
-
const
|
|
1413
|
+
const eyesPicked = rng.pick(eyesPool);
|
|
1414
|
+
const mouthPicked = rng.pick(mouthPool);
|
|
1403
1415
|
const antenna = rng.pick(antennaPool);
|
|
1404
1416
|
const accessory = rng.pick(accessoryPool);
|
|
1417
|
+
const mood = options.mood;
|
|
1418
|
+
const eyes = mood && mood !== "neutral" ? MOOD_EYES[mood] : eyesPicked;
|
|
1419
|
+
const mouth = mood && mood !== "neutral" ? MOOD_MOUTH[mood] : mouthPicked;
|
|
1405
1420
|
let background;
|
|
1406
1421
|
if (typeof options.background === "string") {
|
|
1407
1422
|
background = options.background;
|
|
@@ -1672,7 +1687,7 @@ function seed(fields) {
|
|
|
1672
1687
|
|
|
1673
1688
|
// src/build.ts
|
|
1674
1689
|
function build(spec = {}, options = {}) {
|
|
1675
|
-
const palette = spec.palette ? PALETTE_BY_ID[spec.palette] ?? PALETTES[0] : PALETTES[0];
|
|
1690
|
+
const palette = options.palette ?? (spec.palette ? PALETTE_BY_ID[spec.palette] ?? PALETTES[0] : PALETTES[0]);
|
|
1676
1691
|
const resolved = {
|
|
1677
1692
|
seed: "__build__",
|
|
1678
1693
|
palette,
|