@dicebear/lorelei 5.0.0-alpha.31 → 5.0.0-alpha.35

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.
Files changed (68) hide show
  1. package/README.md +3 -3
  2. package/lib/components/beard.d.ts +6 -0
  3. package/lib/components/beard.js +8 -2
  4. package/lib/components/earrings.d.ts +6 -0
  5. package/lib/components/earrings.js +9 -3
  6. package/lib/components/eyebrows.d.ts +6 -0
  7. package/lib/components/eyebrows.js +19 -13
  8. package/lib/components/eyes.d.ts +6 -0
  9. package/lib/components/eyes.js +30 -24
  10. package/lib/components/freckles.d.ts +6 -0
  11. package/lib/components/freckles.js +7 -1
  12. package/lib/components/glasses.d.ts +6 -0
  13. package/lib/components/glasses.js +11 -5
  14. package/lib/components/hair.d.ts +6 -0
  15. package/lib/components/hair.js +54 -192
  16. package/lib/components/hairAccessories.d.ts +6 -0
  17. package/lib/components/hairAccessories.js +7 -1
  18. package/lib/components/head.d.ts +6 -0
  19. package/lib/components/head.js +10 -16
  20. package/lib/components/index.d.ts +6 -0
  21. package/lib/components/index.js +6 -0
  22. package/lib/components/mouth.d.ts +6 -0
  23. package/lib/components/mouth.js +33 -27
  24. package/lib/components/nose.d.ts +6 -0
  25. package/lib/components/nose.js +12 -6
  26. package/lib/core.d.ts +6 -0
  27. package/lib/core.js +9 -3
  28. package/lib/hooks/onPostCreate.d.ts +8 -2
  29. package/lib/hooks/onPostCreate.js +8 -2
  30. package/lib/hooks/onPreCreate.d.ts +8 -2
  31. package/lib/hooks/onPreCreate.js +6 -0
  32. package/lib/index.d.ts +5 -10
  33. package/lib/index.js +7 -1
  34. package/lib/schema.d.ts +6 -0
  35. package/lib/schema.js +476 -547
  36. package/lib/types.d.ts +7 -8
  37. package/lib/types.js +6 -0
  38. package/lib/utils/getColors.d.ts +6 -0
  39. package/lib/utils/getColors.js +18 -51
  40. package/lib/utils/getComponents.d.ts +7 -1
  41. package/lib/utils/getComponents.js +30 -31
  42. package/lib/utils/pickComponent.d.ts +7 -1
  43. package/lib/utils/pickComponent.js +8 -2
  44. package/package.json +4 -4
  45. package/lib/colors/earrings.d.ts +0 -2
  46. package/lib/colors/earrings.js +0 -3
  47. package/lib/colors/eyebrows.d.ts +0 -2
  48. package/lib/colors/eyebrows.js +0 -3
  49. package/lib/colors/eyes.d.ts +0 -2
  50. package/lib/colors/eyes.js +0 -3
  51. package/lib/colors/freckles.d.ts +0 -2
  52. package/lib/colors/freckles.js +0 -3
  53. package/lib/colors/glasses.d.ts +0 -2
  54. package/lib/colors/glasses.js +0 -3
  55. package/lib/colors/hair.d.ts +0 -2
  56. package/lib/colors/hair.js +0 -3
  57. package/lib/colors/hairAccessories.d.ts +0 -2
  58. package/lib/colors/hairAccessories.js +0 -3
  59. package/lib/colors/index.d.ts +0 -10
  60. package/lib/colors/index.js +0 -10
  61. package/lib/colors/mouth.d.ts +0 -2
  62. package/lib/colors/mouth.js +0 -3
  63. package/lib/colors/nose.d.ts +0 -2
  64. package/lib/colors/nose.js +0 -3
  65. package/lib/colors/skin.d.ts +0 -2
  66. package/lib/colors/skin.js +0 -3
  67. package/lib/utils/pickColor.d.ts +0 -9
  68. package/lib/utils/pickColor.js +0 -13
package/lib/types.d.ts CHANGED
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Do not change this file manually! This file was generated with the "Dicebear Exporter"-Plugin for Figma.
3
+ *
4
+ * Plugin: https://www.figma.com/community/plugin/1005765655729342787
5
+ * File: https://www.figma.com/file/FCwwMBxsRND9Mbtpg5PUic/%40dicebear%2Florelei?node-id=23%3A2194
6
+ */
1
7
  export interface Options {
2
8
  hair?: ('variant48' | 'variant47' | 'variant46' | 'variant45' | 'variant44' | 'variant43' | 'variant42' | 'variant41' | 'variant40' | 'variant39' | 'variant38' | 'variant37' | 'variant36' | 'variant35' | 'variant34' | 'variant33' | 'variant32' | 'variant31' | 'variant30' | 'variant29' | 'variant28' | 'variant27' | 'variant26' | 'variant25' | 'variant24' | 'variant23' | 'variant22' | 'variant21' | 'variant20' | 'variant19' | 'variant18' | 'variant17' | 'variant16' | 'variant15' | 'variant14' | 'variant13' | 'variant12' | 'variant11' | 'variant10' | 'variant09' | 'variant08' | 'variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01')[];
3
9
  hairAccessories?: ('flowers')[];
@@ -26,14 +32,7 @@ export interface Options {
26
32
  noseColor?: string[];
27
33
  hairAccessoriesColor?: string[];
28
34
  }
29
- export declare type ColorGroup = Record<string, ColorGroupItem>;
30
- export declare type ColorGroupCollection = Record<string, ColorGroup>;
31
- export declare type ColorGroupItem = string;
32
- export declare type ColorPickCollection = Record<string, ColorPick>;
33
- export declare type ColorPick = {
34
- name: string;
35
- value: ColorGroupItem;
36
- };
35
+ export declare type ColorPickCollection = Record<string, string>;
37
36
  export declare type ComponentGroup = Record<string, ComponentGroupItem>;
38
37
  export declare type ComponentGroupCollection = Record<string, ComponentGroup>;
39
38
  export declare type ComponentGroupItem = (components: ComponentPickCollection, colors: ColorPickCollection) => string;
package/lib/types.js CHANGED
@@ -1 +1,7 @@
1
+ /**
2
+ * Do not change this file manually! This file was generated with the "Dicebear Exporter"-Plugin for Figma.
3
+ *
4
+ * Plugin: https://www.figma.com/community/plugin/1005765655729342787
5
+ * File: https://www.figma.com/file/FCwwMBxsRND9Mbtpg5PUic/%40dicebear%2Florelei?node-id=23%3A2194
6
+ */
1
7
  export {};
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Do not change this file manually! This file was generated with the "Dicebear Exporter"-Plugin for Figma.
3
+ *
4
+ * Plugin: https://www.figma.com/community/plugin/1005765655729342787
5
+ * File: https://www.figma.com/file/FCwwMBxsRND9Mbtpg5PUic/%40dicebear%2Florelei?node-id=23%3A2194
6
+ */
1
7
  import type { Prng } from '@dicebear/core';
2
8
  import type { Options, ColorPickCollection } from '../types.js';
3
9
  declare type Props = {
@@ -1,55 +1,22 @@
1
- import { pickColor } from './pickColor.js';
1
+ /**
2
+ * Do not change this file manually! This file was generated with the "Dicebear Exporter"-Plugin for Figma.
3
+ *
4
+ * Plugin: https://www.figma.com/community/plugin/1005765655729342787
5
+ * File: https://www.figma.com/file/FCwwMBxsRND9Mbtpg5PUic/%40dicebear%2Florelei?node-id=23%3A2194
6
+ */
2
7
  export function getColors({ prng, options }) {
8
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
3
9
  return {
4
- hair: pickColor({
5
- prng,
6
- group: 'hair',
7
- values: options.hairColor,
8
- }),
9
- skin: pickColor({
10
- prng,
11
- group: 'skin',
12
- values: options.skinColor,
13
- }),
14
- earrings: pickColor({
15
- prng,
16
- group: 'earrings',
17
- values: options.earringsColor,
18
- }),
19
- eyebrows: pickColor({
20
- prng,
21
- group: 'eyebrows',
22
- values: options.eyebrowsColor,
23
- }),
24
- eyes: pickColor({
25
- prng,
26
- group: 'eyes',
27
- values: options.eyesColor,
28
- }),
29
- freckles: pickColor({
30
- prng,
31
- group: 'freckles',
32
- values: options.frecklesColor,
33
- }),
34
- glasses: pickColor({
35
- prng,
36
- group: 'glasses',
37
- values: options.glassesColor,
38
- }),
39
- mouth: pickColor({
40
- prng,
41
- group: 'mouth',
42
- values: options.mouthColor,
43
- }),
44
- nose: pickColor({
45
- prng,
46
- group: 'nose',
47
- values: options.noseColor,
48
- }),
49
- hairAccessories: pickColor({
50
- prng,
51
- group: 'hairAccessories',
52
- values: options.hairAccessoriesColor,
53
- }),
10
+ 'hair': (_b = prng.pick((_a = options.hairColor) !== null && _a !== void 0 ? _a : [])) !== null && _b !== void 0 ? _b : 'transparent',
11
+ 'skin': (_d = prng.pick((_c = options.skinColor) !== null && _c !== void 0 ? _c : [])) !== null && _d !== void 0 ? _d : 'transparent',
12
+ 'earrings': (_f = prng.pick((_e = options.earringsColor) !== null && _e !== void 0 ? _e : [])) !== null && _f !== void 0 ? _f : 'transparent',
13
+ 'eyebrows': (_h = prng.pick((_g = options.eyebrowsColor) !== null && _g !== void 0 ? _g : [])) !== null && _h !== void 0 ? _h : 'transparent',
14
+ 'eyes': (_k = prng.pick((_j = options.eyesColor) !== null && _j !== void 0 ? _j : [])) !== null && _k !== void 0 ? _k : 'transparent',
15
+ 'freckles': (_m = prng.pick((_l = options.frecklesColor) !== null && _l !== void 0 ? _l : [])) !== null && _m !== void 0 ? _m : 'transparent',
16
+ 'glasses': (_p = prng.pick((_o = options.glassesColor) !== null && _o !== void 0 ? _o : [])) !== null && _p !== void 0 ? _p : 'transparent',
17
+ 'mouth': (_r = prng.pick((_q = options.mouthColor) !== null && _q !== void 0 ? _q : [])) !== null && _r !== void 0 ? _r : 'transparent',
18
+ 'nose': (_t = prng.pick((_s = options.noseColor) !== null && _s !== void 0 ? _s : [])) !== null && _t !== void 0 ? _t : 'transparent',
19
+ 'hairAccessories': (_v = prng.pick((_u = options.hairAccessoriesColor) !== null && _u !== void 0 ? _u : [])) !== null && _v !== void 0 ? _v : 'transparent',
54
20
  };
55
21
  }
22
+ ;
@@ -1,8 +1,14 @@
1
+ /**
2
+ * Do not change this file manually! This file was generated with the "Dicebear Exporter"-Plugin for Figma.
3
+ *
4
+ * Plugin: https://www.figma.com/community/plugin/1005765655729342787
5
+ * File: https://www.figma.com/file/FCwwMBxsRND9Mbtpg5PUic/%40dicebear%2Florelei?node-id=23%3A2194
6
+ */
1
7
  import type { Prng } from '@dicebear/core';
2
8
  import type { Options, ComponentPickCollection } from '../types.js';
3
9
  declare type Props = {
4
10
  prng: Prng;
5
11
  options: Options;
6
12
  };
7
- export declare function getComponents({ prng, options, }: Props): ComponentPickCollection;
13
+ export declare function getComponents({ prng, options }: Props): ComponentPickCollection;
8
14
  export {};
@@ -1,79 +1,78 @@
1
+ /**
2
+ * Do not change this file manually! This file was generated with the "Dicebear Exporter"-Plugin for Figma.
3
+ *
4
+ * Plugin: https://www.figma.com/community/plugin/1005765655729342787
5
+ * File: https://www.figma.com/file/FCwwMBxsRND9Mbtpg5PUic/%40dicebear%2Florelei?node-id=23%3A2194
6
+ */
1
7
  import { pickComponent } from './pickComponent.js';
2
- export function getComponents({ prng, options, }) {
8
+ export function getComponents({ prng, options }) {
3
9
  const hairComponent = pickComponent({
4
10
  prng,
5
11
  group: 'hair',
6
- values: options.hair,
12
+ values: options.hair
7
13
  });
8
14
  const hairAccessoriesComponent = pickComponent({
9
15
  prng,
10
16
  group: 'hairAccessories',
11
- values: options.hairAccessories,
17
+ values: options.hairAccessories
12
18
  });
13
19
  const headComponent = pickComponent({
14
20
  prng,
15
21
  group: 'head',
16
- values: options.head,
22
+ values: options.head
17
23
  });
18
24
  const eyesComponent = pickComponent({
19
25
  prng,
20
26
  group: 'eyes',
21
- values: options.eyes,
27
+ values: options.eyes
22
28
  });
23
29
  const eyebrowsComponent = pickComponent({
24
30
  prng,
25
31
  group: 'eyebrows',
26
- values: options.eyebrows,
32
+ values: options.eyebrows
27
33
  });
28
34
  const earringsComponent = pickComponent({
29
35
  prng,
30
36
  group: 'earrings',
31
- values: options.earrings,
37
+ values: options.earrings
32
38
  });
33
39
  const frecklesComponent = pickComponent({
34
40
  prng,
35
41
  group: 'freckles',
36
- values: options.freckles,
42
+ values: options.freckles
37
43
  });
38
44
  const noseComponent = pickComponent({
39
45
  prng,
40
46
  group: 'nose',
41
- values: options.nose,
47
+ values: options.nose
42
48
  });
43
49
  const beardComponent = pickComponent({
44
50
  prng,
45
51
  group: 'beard',
46
- values: options.beard,
52
+ values: options.beard
47
53
  });
48
54
  const mouthComponent = pickComponent({
49
55
  prng,
50
56
  group: 'mouth',
51
- values: options.mouth,
57
+ values: options.mouth
52
58
  });
53
59
  const glassesComponent = pickComponent({
54
60
  prng,
55
61
  group: 'glasses',
56
- values: options.glasses,
62
+ values: options.glasses
57
63
  });
58
64
  return {
59
- hair: hairComponent,
60
- hairAccessories: prng.bool(options.hairAccessoriesProbability)
61
- ? hairAccessoriesComponent
62
- : undefined,
63
- head: headComponent,
64
- eyes: eyesComponent,
65
- eyebrows: eyebrowsComponent,
66
- earrings: prng.bool(options.earringsProbability)
67
- ? earringsComponent
68
- : undefined,
69
- freckles: prng.bool(options.frecklesProbability)
70
- ? frecklesComponent
71
- : undefined,
72
- nose: noseComponent,
73
- beard: prng.bool(options.beardProbability) ? beardComponent : undefined,
74
- mouth: mouthComponent,
75
- glasses: prng.bool(options.glassesProbability)
76
- ? glassesComponent
77
- : undefined,
65
+ 'hair': hairComponent,
66
+ 'hairAccessories': prng.bool(options.hairAccessoriesProbability) ? hairAccessoriesComponent : undefined,
67
+ 'head': headComponent,
68
+ 'eyes': eyesComponent,
69
+ 'eyebrows': eyebrowsComponent,
70
+ 'earrings': prng.bool(options.earringsProbability) ? earringsComponent : undefined,
71
+ 'freckles': prng.bool(options.frecklesProbability) ? frecklesComponent : undefined,
72
+ 'nose': noseComponent,
73
+ 'beard': prng.bool(options.beardProbability) ? beardComponent : undefined,
74
+ 'mouth': mouthComponent,
75
+ 'glasses': prng.bool(options.glassesProbability) ? glassesComponent : undefined,
78
76
  };
79
77
  }
78
+ ;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Do not change this file manually! This file was generated with the "Dicebear Exporter"-Plugin for Figma.
3
+ *
4
+ * Plugin: https://www.figma.com/community/plugin/1005765655729342787
5
+ * File: https://www.figma.com/file/FCwwMBxsRND9Mbtpg5PUic/%40dicebear%2Florelei?node-id=23%3A2194
6
+ */
1
7
  import type { Prng } from '@dicebear/core';
2
8
  import type { ComponentPick } from '../types.js';
3
9
  declare type Props = {
@@ -5,5 +11,5 @@ declare type Props = {
5
11
  group: string;
6
12
  values?: string[];
7
13
  };
8
- export declare function pickComponent({ prng, group, values, }: Props): ComponentPick;
14
+ export declare function pickComponent({ prng, group, values }: Props): ComponentPick;
9
15
  export {};
@@ -1,8 +1,14 @@
1
+ /**
2
+ * Do not change this file manually! This file was generated with the "Dicebear Exporter"-Plugin for Figma.
3
+ *
4
+ * Plugin: https://www.figma.com/community/plugin/1005765655729342787
5
+ * File: https://www.figma.com/file/FCwwMBxsRND9Mbtpg5PUic/%40dicebear%2Florelei?node-id=23%3A2194
6
+ */
1
7
  import * as components from '../components/index.js';
2
- export function pickComponent({ prng, group, values = [], }) {
8
+ export function pickComponent({ prng, group, values = [] }) {
3
9
  const componentCollection = components;
4
10
  const key = prng.pick(values);
5
- if (componentCollection[group][key]) {
11
+ if (key && componentCollection[group][key]) {
6
12
  return {
7
13
  name: key,
8
14
  value: componentCollection[group][key],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dicebear/lorelei",
3
- "version": "5.0.0-alpha.31",
3
+ "version": "5.0.0-alpha.35",
4
4
  "description": "Avatar style for DiceBear",
5
5
  "keywords": [
6
6
  "dicebear"
@@ -28,14 +28,14 @@
28
28
  "test": "uvu tests"
29
29
  },
30
30
  "devDependencies": {
31
- "@dicebear/core": "^5.0.0-alpha.31",
31
+ "@dicebear/core": "^5.0.0-alpha.35",
32
32
  "@tsconfig/recommended": "^1.0.1",
33
33
  "del-cli": "^4.0.1",
34
34
  "typescript": "^4.6.3",
35
35
  "uvu": "^0.5.3"
36
36
  },
37
37
  "peerDependencies": {
38
- "@dicebear/core": "^5.0.0-alpha.16"
38
+ "@dicebear/core": "^5.0.0-alpha.32"
39
39
  },
40
40
  "engines": {
41
41
  "node": "^14.13.1 || >=16.0.0"
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "088e33eb5bc45d01c9b6350011d973a5bd23bcc8"
46
+ "gitHead": "e6f55ebe3a5b8a60394744d95533528bb8b119ef"
47
47
  }
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../types.js';
2
- export declare const earrings: ColorGroup;
@@ -1,3 +0,0 @@
1
- export const earrings = {
2
- black: 'rgba(0, 0, 0, 1)',
3
- };
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../types.js';
2
- export declare const eyebrows: ColorGroup;
@@ -1,3 +0,0 @@
1
- export const eyebrows = {
2
- black: 'rgba(0, 0, 0, 1)',
3
- };
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../types.js';
2
- export declare const eyes: ColorGroup;
@@ -1,3 +0,0 @@
1
- export const eyes = {
2
- black: 'rgba(0, 0, 0, 1)',
3
- };
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../types.js';
2
- export declare const freckles: ColorGroup;
@@ -1,3 +0,0 @@
1
- export const freckles = {
2
- black: 'rgba(0, 0, 0, 1)',
3
- };
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../types.js';
2
- export declare const glasses: ColorGroup;
@@ -1,3 +0,0 @@
1
- export const glasses = {
2
- black: 'rgba(0, 0, 0, 1)',
3
- };
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../types.js';
2
- export declare const hair: ColorGroup;
@@ -1,3 +0,0 @@
1
- export const hair = {
2
- black: 'rgba(0, 0, 0, 1)',
3
- };
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../types.js';
2
- export declare const hairAccessories: ColorGroup;
@@ -1,3 +0,0 @@
1
- export const hairAccessories = {
2
- black: 'rgba(0, 0, 0, 1)',
3
- };
@@ -1,10 +0,0 @@
1
- export { hair } from './hair.js';
2
- export { skin } from './skin.js';
3
- export { earrings } from './earrings.js';
4
- export { eyebrows } from './eyebrows.js';
5
- export { eyes } from './eyes.js';
6
- export { freckles } from './freckles.js';
7
- export { glasses } from './glasses.js';
8
- export { mouth } from './mouth.js';
9
- export { nose } from './nose.js';
10
- export { hairAccessories } from './hairAccessories.js';
@@ -1,10 +0,0 @@
1
- export { hair } from './hair.js';
2
- export { skin } from './skin.js';
3
- export { earrings } from './earrings.js';
4
- export { eyebrows } from './eyebrows.js';
5
- export { eyes } from './eyes.js';
6
- export { freckles } from './freckles.js';
7
- export { glasses } from './glasses.js';
8
- export { mouth } from './mouth.js';
9
- export { nose } from './nose.js';
10
- export { hairAccessories } from './hairAccessories.js';
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../types.js';
2
- export declare const mouth: ColorGroup;
@@ -1,3 +0,0 @@
1
- export const mouth = {
2
- black: 'rgba(0, 0, 0, 1)',
3
- };
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../types.js';
2
- export declare const nose: ColorGroup;
@@ -1,3 +0,0 @@
1
- export const nose = {
2
- black: 'rgba(0, 0, 0, 1)',
3
- };
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../types.js';
2
- export declare const skin: ColorGroup;
@@ -1,3 +0,0 @@
1
- export const skin = {
2
- white: 'rgba(255, 255, 255, 1)',
3
- };
@@ -1,9 +0,0 @@
1
- import type { Prng } from '@dicebear/core';
2
- import type { ColorPick } from '../types.js';
3
- declare type Props = {
4
- prng: Prng;
5
- group: string;
6
- values?: string[];
7
- };
8
- export declare function pickColor({ prng, group, values }: Props): ColorPick;
9
- export {};
@@ -1,13 +0,0 @@
1
- import * as colors from '../colors/index.js';
2
- export function pickColor({ prng, group, values = [] }) {
3
- var _a;
4
- const colorCollection = colors;
5
- if (values.length === 0) {
6
- values.push('transparent');
7
- }
8
- const key = prng.pick(values);
9
- return {
10
- name: key,
11
- value: (_a = colorCollection[group][key]) !== null && _a !== void 0 ? _a : key,
12
- };
13
- }