@dicebear/personas 5.0.3 → 5.1.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/lib/index.js CHANGED
@@ -28,6 +28,16 @@ export const create = ({ prng, options }) => {
28
28
  'shape-rendering': 'auto'
29
29
  },
30
30
  body: `<path d="M37 46.08V52a5 5 0 0 1-10 0v-5.92A14.04 14.04 0 0 1 18.58 37h-.08a4.5 4.5 0 0 1-.5-8.97V27a14 14 0 1 1 28 0v1.03a4.5 4.5 0 0 1-.58 8.97A14.04 14.04 0 0 1 37 46.08Z" fill="${escape.xml(`${colors.skin}`)}"/><mask id="personas-a" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="14" y="13" width="36" height="44"><path d="M37 46.08V52a5 5 0 0 1-10 0v-5.92A14.04 14.04 0 0 1 18.58 37h-.08a4.5 4.5 0 0 1-.5-8.97V27a14 14 0 1 1 28 0v1.03a4.5 4.5 0 0 1-.58 8.97A14.04 14.04 0 0 1 37 46.08Z" fill="#fff"/></mask><g mask="url(#personas-a)"><path d="M32 13a14 14 0 0 1 14 14v6a14 14 0 1 1-28 0v-6a14 14 0 0 1 14-14Z" fill="#fff" style="mix-blend-mode:overlay" opacity=".36"/></g><g transform="translate(20 24)">${(_b = (_a = components.eyes) === null || _a === void 0 ? void 0 : _a.value(components, colors)) !== null && _b !== void 0 ? _b : ''}</g><g transform="translate(2 2)">${(_d = (_c = components.hair) === null || _c === void 0 ? void 0 : _c.value(components, colors)) !== null && _d !== void 0 ? _d : ''}</g><g transform="translate(11 44)">${(_f = (_e = components.body) === null || _e === void 0 ? void 0 : _e.value(components, colors)) !== null && _f !== void 0 ? _f : ''}</g><g transform="translate(23 36)">${(_h = (_g = components.mouth) === null || _g === void 0 ? void 0 : _g.value(components, colors)) !== null && _h !== void 0 ? _h : ''}</g><g transform="translate(24 28)">${(_k = (_j = components.nose) === null || _j === void 0 ? void 0 : _j.value(components, colors)) !== null && _k !== void 0 ? _k : ''}</g><g transform="translate(14 26)">${(_m = (_l = components.facialHair) === null || _l === void 0 ? void 0 : _l.value(components, colors)) !== null && _m !== void 0 ? _m : ''}</g>`,
31
+ extra: () => ({
32
+ ...Object.entries(components).reduce((acc, [key, value]) => {
33
+ acc[key] = value === null || value === void 0 ? void 0 : value.name;
34
+ return acc;
35
+ }, {}),
36
+ ...Object.entries(colors).reduce((acc, [key, value]) => {
37
+ acc[`${key}Color`] = value;
38
+ return acc;
39
+ }, {}),
40
+ }),
31
41
  };
32
42
  };
33
43
  export { schema } from './schema.js';
@@ -5,8 +5,5 @@
5
5
  * File: https://www.figma.com/file/oa0iScDLrh1tVFzSud2Dwc
6
6
  */
7
7
  export function convertColor(color) {
8
- if ('transparent' === color) {
9
- return color;
10
- }
11
- return `#${color}`;
8
+ return 'transparent' === color ? color : `#${color}`;
12
9
  }
@@ -6,11 +6,11 @@
6
6
  */
7
7
  import { convertColor } from './convertColor.js';
8
8
  export function getColors({ prng, options }) {
9
- var _a, _b, _c, _d, _e, _f;
9
+ var _a, _b, _c;
10
10
  return {
11
- 'hair': convertColor((_b = prng.pick((_a = options.hairColor) !== null && _a !== void 0 ? _a : [])) !== null && _b !== void 0 ? _b : 'transparent'),
12
- 'clothing': convertColor((_d = prng.pick((_c = options.clothingColor) !== null && _c !== void 0 ? _c : [])) !== null && _d !== void 0 ? _d : 'transparent'),
13
- 'skin': convertColor((_f = prng.pick((_e = options.skinColor) !== null && _e !== void 0 ? _e : [])) !== null && _f !== void 0 ? _f : 'transparent'),
11
+ 'hair': convertColor(prng.pick((_a = options.hairColor) !== null && _a !== void 0 ? _a : [], 'transparent')),
12
+ 'clothing': convertColor(prng.pick((_b = options.clothingColor) !== null && _b !== void 0 ? _b : [], 'transparent')),
13
+ 'skin': convertColor(prng.pick((_c = options.skinColor) !== null && _c !== void 0 ? _c : [], 'transparent')),
14
14
  };
15
15
  }
16
16
  ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dicebear/personas",
3
- "version": "5.0.3",
3
+ "version": "5.1.0",
4
4
  "description": "Avatar style for DiceBear",
5
5
  "keywords": [
6
6
  "dicebear"
@@ -29,7 +29,7 @@
29
29
  "test": "uvu tests"
30
30
  },
31
31
  "devDependencies": {
32
- "@dicebear/core": "^5.0.3",
32
+ "@dicebear/core": "^5.1.0",
33
33
  "@tsconfig/recommended": "^1.0.1",
34
34
  "del-cli": "^4.0.1",
35
35
  "typescript": "^4.6.3",
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "14f86eb4ad8c481902d505c838c26420370d232c"
47
+ "gitHead": "4f9e4686aa33809026d6ce25c4a5f2d0750d59f4"
48
48
  }