@dicebear/micah 5.0.0-alpha.2 → 5.0.0-alpha.20

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 (99) hide show
  1. package/LICENSE +1 -1
  2. package/lib/colors/base.d.ts +2 -0
  3. package/lib/colors/base.js +15 -0
  4. package/lib/colors/earring.d.ts +2 -0
  5. package/lib/colors/earring.js +15 -0
  6. package/lib/colors/eyeShadow.d.ts +2 -0
  7. package/lib/colors/eyeShadow.js +15 -0
  8. package/lib/colors/eyebrows.d.ts +2 -0
  9. package/lib/colors/eyebrows.js +15 -0
  10. package/lib/colors/eyes.d.ts +2 -0
  11. package/lib/colors/eyes.js +15 -0
  12. package/lib/colors/facialHair.d.ts +2 -0
  13. package/lib/colors/facialHair.js +15 -0
  14. package/lib/colors/glasses.d.ts +2 -0
  15. package/lib/colors/glasses.js +15 -0
  16. package/lib/colors/hair.d.ts +2 -0
  17. package/lib/colors/hair.js +15 -0
  18. package/lib/colors/index.d.ts +10 -0
  19. package/lib/colors/index.js +10 -0
  20. package/lib/colors/mouth.d.ts +2 -0
  21. package/lib/colors/mouth.js +3 -0
  22. package/lib/colors/shirt.d.ts +2 -0
  23. package/lib/colors/shirt.js +15 -0
  24. package/lib/components/base.d.ts +2 -0
  25. package/lib/components/base.js +6 -0
  26. package/lib/components/earrings.d.ts +2 -0
  27. package/lib/components/earrings.js +4 -0
  28. package/lib/components/ears.d.ts +2 -0
  29. package/lib/components/ears.js +10 -0
  30. package/lib/components/eyebrows.d.ts +2 -0
  31. package/lib/components/eyebrows.js +6 -0
  32. package/lib/components/eyes.d.ts +2 -0
  33. package/lib/components/eyes.js +18 -0
  34. package/lib/components/facialHair.d.ts +2 -0
  35. package/lib/components/facialHair.js +4 -0
  36. package/lib/components/glasses.d.ts +2 -0
  37. package/lib/components/glasses.js +4 -0
  38. package/lib/components/hair.d.ts +2 -0
  39. package/lib/components/hair.js +10 -0
  40. package/lib/components/index.d.ts +11 -0
  41. package/lib/components/index.js +11 -0
  42. package/lib/components/mouth.d.ts +2 -0
  43. package/lib/components/mouth.js +10 -0
  44. package/lib/components/nose.d.ts +2 -0
  45. package/lib/components/nose.js +5 -0
  46. package/lib/components/shirt.d.ts +2 -0
  47. package/lib/components/shirt.js +5 -0
  48. package/{dist → lib}/core.d.ts +3 -3
  49. package/lib/core.js +32 -0
  50. package/{dist → lib}/hooks/onPostCreate.d.ts +10 -12
  51. package/lib/hooks/onPostCreate.js +6 -0
  52. package/lib/hooks/onPreCreate.d.ts +8 -0
  53. package/lib/hooks/onPreCreate.js +26 -0
  54. package/lib/index.d.ts +13 -0
  55. package/lib/index.js +13 -0
  56. package/lib/schema.d.ts +2 -0
  57. package/lib/schema.js +449 -0
  58. package/lib/types.d.ts +43 -0
  59. package/lib/types.js +1 -0
  60. package/{dist → lib}/utils/getColors.d.ts +8 -9
  61. package/lib/utils/getColors.js +55 -0
  62. package/{dist → lib}/utils/getComponents.d.ts +8 -9
  63. package/lib/utils/getComponents.js +77 -0
  64. package/{dist → lib}/utils/pickColor.d.ts +9 -9
  65. package/lib/utils/pickColor.js +13 -0
  66. package/{dist → lib}/utils/pickComponent.d.ts +9 -9
  67. package/lib/utils/pickComponent.js +14 -0
  68. package/package.json +19 -23
  69. package/dist/colors/base.d.ts +0 -2
  70. package/dist/colors/earring.d.ts +0 -2
  71. package/dist/colors/eyeShadow.d.ts +0 -2
  72. package/dist/colors/eyebrow.d.ts +0 -2
  73. package/dist/colors/eyes.d.ts +0 -2
  74. package/dist/colors/facialHair.d.ts +0 -2
  75. package/dist/colors/glasses.d.ts +0 -2
  76. package/dist/colors/hair.d.ts +0 -2
  77. package/dist/colors/index.d.ts +0 -10
  78. package/dist/colors/mouth.d.ts +0 -2
  79. package/dist/colors/shirt.d.ts +0 -2
  80. package/dist/components/base.d.ts +0 -2
  81. package/dist/components/earrings.d.ts +0 -2
  82. package/dist/components/ears.d.ts +0 -2
  83. package/dist/components/eyebrows.d.ts +0 -2
  84. package/dist/components/eyes.d.ts +0 -2
  85. package/dist/components/facialHair.d.ts +0 -2
  86. package/dist/components/glasses.d.ts +0 -2
  87. package/dist/components/hair.d.ts +0 -2
  88. package/dist/components/index.d.ts +0 -11
  89. package/dist/components/mouth.d.ts +0 -2
  90. package/dist/components/nose.d.ts +0 -2
  91. package/dist/components/shirt.d.ts +0 -2
  92. package/dist/hooks/onPreCreate.d.ts +0 -9
  93. package/dist/index.d.ts +0 -13
  94. package/dist/index.es.js +0 -1247
  95. package/dist/index.js +0 -1254
  96. package/dist/index.umd.js +0 -12
  97. package/dist/meta/components.d.ts +0 -4
  98. package/dist/options.d.ts +0 -32
  99. package/dist/static-types.d.ts +0 -16
package/lib/schema.js ADDED
@@ -0,0 +1,449 @@
1
+ export const schema = {
2
+ title: 'Options',
3
+ $schema: 'http://json-schema.org/draft-07/schema#',
4
+ properties: {
5
+ base: {
6
+ type: 'array',
7
+ items: { type: 'string', enum: ['standard'] },
8
+ default: ['standard'],
9
+ examples: [['standard']],
10
+ },
11
+ baseColor: {
12
+ type: 'array',
13
+ items: {
14
+ type: 'string',
15
+ pattern: '^([0-9a-zA-Z]+|#[a-fA-F0-9]{3}|#[a-fA-F0-9]{4}|#[a-fA-F0-9]{6}|#[a-fA-F0-9]{8})$',
16
+ },
17
+ default: ['apricot', 'coast', 'topaz'],
18
+ examples: [
19
+ ['apricot'],
20
+ ['coast'],
21
+ ['topaz'],
22
+ ['lavender'],
23
+ ['sky'],
24
+ ['salmon'],
25
+ ['canary'],
26
+ ['calm'],
27
+ ['azure'],
28
+ ['seashell'],
29
+ ['mellow'],
30
+ ['black'],
31
+ ['white'],
32
+ ],
33
+ },
34
+ earringColor: {
35
+ type: 'array',
36
+ items: {
37
+ type: 'string',
38
+ pattern: '^([0-9a-zA-Z]+|#[a-fA-F0-9]{3}|#[a-fA-F0-9]{4}|#[a-fA-F0-9]{6}|#[a-fA-F0-9]{8})$',
39
+ },
40
+ default: [
41
+ 'apricot',
42
+ 'azure',
43
+ 'black',
44
+ 'calm',
45
+ 'canary',
46
+ 'coast',
47
+ 'lavender',
48
+ 'mellow',
49
+ 'salmon',
50
+ 'seashell',
51
+ 'sky',
52
+ 'topaz',
53
+ 'white',
54
+ ],
55
+ examples: [
56
+ ['apricot'],
57
+ ['azure'],
58
+ ['black'],
59
+ ['calm'],
60
+ ['canary'],
61
+ ['coast'],
62
+ ['lavender'],
63
+ ['mellow'],
64
+ ['salmon'],
65
+ ['seashell'],
66
+ ['sky'],
67
+ ['topaz'],
68
+ ['white'],
69
+ ],
70
+ },
71
+ earrings: {
72
+ type: 'array',
73
+ items: { type: 'string', enum: ['hoop', 'stud'] },
74
+ default: ['hoop', 'stud'],
75
+ examples: [['hoop'], ['stud']],
76
+ },
77
+ earringsProbability: {
78
+ type: 'integer',
79
+ minimum: 0,
80
+ maximum: 100,
81
+ default: 30,
82
+ },
83
+ ears: {
84
+ type: 'array',
85
+ items: { type: 'string', enum: ['attached', 'detached'] },
86
+ default: ['attached', 'detached'],
87
+ examples: [['attached'], ['detached']],
88
+ },
89
+ eyeShadowColor: {
90
+ type: 'array',
91
+ items: {
92
+ type: 'string',
93
+ pattern: '^([0-9a-zA-Z]+|#[a-fA-F0-9]{3}|#[a-fA-F0-9]{4}|#[a-fA-F0-9]{6}|#[a-fA-F0-9]{8})$',
94
+ },
95
+ default: ['azure', 'calm', 'mellow', 'seashell', 'white'],
96
+ examples: [
97
+ ['apricot'],
98
+ ['azure'],
99
+ ['black'],
100
+ ['calm'],
101
+ ['canary'],
102
+ ['coast'],
103
+ ['lavender'],
104
+ ['mellow'],
105
+ ['salmon'],
106
+ ['seashell'],
107
+ ['sky'],
108
+ ['topaz'],
109
+ ['white'],
110
+ ],
111
+ },
112
+ eyebrows: {
113
+ type: 'array',
114
+ items: {
115
+ type: 'string',
116
+ enum: ['up', 'down', 'eyelashesUp', 'eyelashesDown'],
117
+ },
118
+ default: ['up', 'down', 'eyelashesUp', 'eyelashesDown'],
119
+ examples: [['up'], ['down'], ['eyelashesUp'], ['eyelashesDown']],
120
+ },
121
+ eyebrowsColor: {
122
+ type: 'array',
123
+ items: {
124
+ type: 'string',
125
+ pattern: '^([0-9a-zA-Z]+|#[a-fA-F0-9]{3}|#[a-fA-F0-9]{4}|#[a-fA-F0-9]{6}|#[a-fA-F0-9]{8})$',
126
+ },
127
+ default: [
128
+ 'apricot',
129
+ 'azure',
130
+ 'black',
131
+ 'calm',
132
+ 'canary',
133
+ 'coast',
134
+ 'lavender',
135
+ 'mellow',
136
+ 'salmon',
137
+ 'seashell',
138
+ 'sky',
139
+ 'topaz',
140
+ 'white',
141
+ ],
142
+ examples: [
143
+ ['apricot'],
144
+ ['azure'],
145
+ ['black'],
146
+ ['calm'],
147
+ ['canary'],
148
+ ['coast'],
149
+ ['lavender'],
150
+ ['mellow'],
151
+ ['salmon'],
152
+ ['seashell'],
153
+ ['sky'],
154
+ ['topaz'],
155
+ ['white'],
156
+ ],
157
+ },
158
+ eyes: {
159
+ type: 'array',
160
+ items: {
161
+ type: 'string',
162
+ enum: ['eyes', 'round', 'eyesShadow', 'smiling'],
163
+ },
164
+ default: ['eyes', 'round', 'eyesShadow', 'smiling'],
165
+ examples: [['eyes'], ['round'], ['eyesShadow'], ['smiling']],
166
+ },
167
+ eyesColor: {
168
+ type: 'array',
169
+ items: {
170
+ type: 'string',
171
+ pattern: '^([0-9a-zA-Z]+|#[a-fA-F0-9]{3}|#[a-fA-F0-9]{4}|#[a-fA-F0-9]{6}|#[a-fA-F0-9]{8})$',
172
+ },
173
+ default: ['black'],
174
+ examples: [
175
+ ['apricot'],
176
+ ['azure'],
177
+ ['black'],
178
+ ['calm'],
179
+ ['canary'],
180
+ ['coast'],
181
+ ['lavender'],
182
+ ['mellow'],
183
+ ['salmon'],
184
+ ['seashell'],
185
+ ['sky'],
186
+ ['topaz'],
187
+ ['white'],
188
+ ],
189
+ },
190
+ facialHair: {
191
+ type: 'array',
192
+ items: { type: 'string', enum: ['beard', 'scruff'] },
193
+ default: ['beard', 'scruff'],
194
+ examples: [['beard'], ['scruff']],
195
+ },
196
+ facialHairColor: {
197
+ type: 'array',
198
+ items: {
199
+ type: 'string',
200
+ pattern: '^([0-9a-zA-Z]+|#[a-fA-F0-9]{3}|#[a-fA-F0-9]{4}|#[a-fA-F0-9]{6}|#[a-fA-F0-9]{8})$',
201
+ },
202
+ default: ['topaz'],
203
+ examples: [
204
+ ['apricot'],
205
+ ['azure'],
206
+ ['black'],
207
+ ['calm'],
208
+ ['canary'],
209
+ ['coast'],
210
+ ['lavender'],
211
+ ['mellow'],
212
+ ['salmon'],
213
+ ['seashell'],
214
+ ['sky'],
215
+ ['topaz'],
216
+ ['white'],
217
+ ],
218
+ },
219
+ facialHairProbability: {
220
+ type: 'integer',
221
+ minimum: 0,
222
+ maximum: 100,
223
+ default: 10,
224
+ },
225
+ glasses: {
226
+ type: 'array',
227
+ items: { type: 'string', enum: ['round', 'square'] },
228
+ default: ['round', 'square'],
229
+ examples: [['round'], ['square']],
230
+ },
231
+ glassesColor: {
232
+ type: 'array',
233
+ items: {
234
+ type: 'string',
235
+ pattern: '^([0-9a-zA-Z]+|#[a-fA-F0-9]{3}|#[a-fA-F0-9]{4}|#[a-fA-F0-9]{6}|#[a-fA-F0-9]{8})$',
236
+ },
237
+ default: [
238
+ 'apricot',
239
+ 'azure',
240
+ 'black',
241
+ 'calm',
242
+ 'canary',
243
+ 'coast',
244
+ 'lavender',
245
+ 'mellow',
246
+ 'salmon',
247
+ 'seashell',
248
+ 'sky',
249
+ 'topaz',
250
+ 'white',
251
+ ],
252
+ examples: [
253
+ ['apricot'],
254
+ ['azure'],
255
+ ['black'],
256
+ ['calm'],
257
+ ['canary'],
258
+ ['coast'],
259
+ ['lavender'],
260
+ ['mellow'],
261
+ ['salmon'],
262
+ ['seashell'],
263
+ ['sky'],
264
+ ['topaz'],
265
+ ['white'],
266
+ ],
267
+ },
268
+ glassesProbability: {
269
+ type: 'integer',
270
+ minimum: 0,
271
+ maximum: 100,
272
+ default: 30,
273
+ },
274
+ hair: {
275
+ type: 'array',
276
+ items: {
277
+ type: 'string',
278
+ enum: [
279
+ 'fonze',
280
+ 'mrT',
281
+ 'dougFunny',
282
+ 'mrClean',
283
+ 'dannyPhantom',
284
+ 'full',
285
+ 'turban',
286
+ 'pixie',
287
+ ],
288
+ },
289
+ default: [
290
+ 'fonze',
291
+ 'mrT',
292
+ 'dougFunny',
293
+ 'mrClean',
294
+ 'dannyPhantom',
295
+ 'full',
296
+ 'turban',
297
+ 'pixie',
298
+ ],
299
+ examples: [
300
+ ['fonze'],
301
+ ['mrT'],
302
+ ['dougFunny'],
303
+ ['mrClean'],
304
+ ['dannyPhantom'],
305
+ ['full'],
306
+ ['turban'],
307
+ ['pixie'],
308
+ ],
309
+ },
310
+ hairColor: {
311
+ type: 'array',
312
+ items: {
313
+ type: 'string',
314
+ pattern: '^([0-9a-zA-Z]+|#[a-fA-F0-9]{3}|#[a-fA-F0-9]{4}|#[a-fA-F0-9]{6}|#[a-fA-F0-9]{8})$',
315
+ },
316
+ default: [
317
+ 'apricot',
318
+ 'azure',
319
+ 'black',
320
+ 'calm',
321
+ 'canary',
322
+ 'coast',
323
+ 'lavender',
324
+ 'mellow',
325
+ 'salmon',
326
+ 'seashell',
327
+ 'sky',
328
+ 'topaz',
329
+ 'white',
330
+ ],
331
+ examples: [
332
+ ['apricot'],
333
+ ['azure'],
334
+ ['black'],
335
+ ['calm'],
336
+ ['canary'],
337
+ ['coast'],
338
+ ['lavender'],
339
+ ['mellow'],
340
+ ['salmon'],
341
+ ['seashell'],
342
+ ['sky'],
343
+ ['topaz'],
344
+ ['white'],
345
+ ],
346
+ },
347
+ hairProbability: {
348
+ type: 'integer',
349
+ minimum: 0,
350
+ maximum: 100,
351
+ default: 100,
352
+ },
353
+ mouth: {
354
+ type: 'array',
355
+ items: {
356
+ type: 'string',
357
+ enum: [
358
+ 'surprised',
359
+ 'laughing',
360
+ 'nervous',
361
+ 'smile',
362
+ 'sad',
363
+ 'pucker',
364
+ 'frown',
365
+ 'smirk',
366
+ ],
367
+ },
368
+ default: [
369
+ 'surprised',
370
+ 'laughing',
371
+ 'nervous',
372
+ 'smile',
373
+ 'sad',
374
+ 'pucker',
375
+ 'frown',
376
+ 'smirk',
377
+ ],
378
+ examples: [
379
+ ['surprised'],
380
+ ['laughing'],
381
+ ['nervous'],
382
+ ['smile'],
383
+ ['sad'],
384
+ ['pucker'],
385
+ ['frown'],
386
+ ['smirk'],
387
+ ],
388
+ },
389
+ mouthColor: {
390
+ type: 'array',
391
+ items: {
392
+ type: 'string',
393
+ pattern: '^([0-9a-zA-Z]+|#[a-fA-F0-9]{3}|#[a-fA-F0-9]{4}|#[a-fA-F0-9]{6}|#[a-fA-F0-9]{8})$',
394
+ },
395
+ default: ['black'],
396
+ examples: [['black']],
397
+ },
398
+ nose: {
399
+ type: 'array',
400
+ items: { type: 'string', enum: ['curve', 'pointed', 'tound'] },
401
+ default: ['curve', 'pointed', 'tound'],
402
+ examples: [['curve'], ['pointed'], ['tound']],
403
+ },
404
+ shirt: {
405
+ type: 'array',
406
+ items: { type: 'string', enum: ['open', 'crew', 'collared'] },
407
+ default: ['open', 'crew', 'collared'],
408
+ examples: [['open'], ['crew'], ['collared']],
409
+ },
410
+ shirtColor: {
411
+ type: 'array',
412
+ items: {
413
+ type: 'string',
414
+ pattern: '^([0-9a-zA-Z]+|#[a-fA-F0-9]{3}|#[a-fA-F0-9]{4}|#[a-fA-F0-9]{6}|#[a-fA-F0-9]{8})$',
415
+ },
416
+ default: [
417
+ 'apricot',
418
+ 'azure',
419
+ 'black',
420
+ 'calm',
421
+ 'canary',
422
+ 'coast',
423
+ 'lavender',
424
+ 'mellow',
425
+ 'salmon',
426
+ 'seashell',
427
+ 'sky',
428
+ 'topaz',
429
+ 'white',
430
+ ],
431
+ examples: [
432
+ ['apricot'],
433
+ ['azure'],
434
+ ['black'],
435
+ ['calm'],
436
+ ['canary'],
437
+ ['coast'],
438
+ ['lavender'],
439
+ ['mellow'],
440
+ ['salmon'],
441
+ ['seashell'],
442
+ ['sky'],
443
+ ['topaz'],
444
+ ['white'],
445
+ ],
446
+ },
447
+ },
448
+ additionalProperties: false,
449
+ };
package/lib/types.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ export interface Options {
2
+ base?: ('standard')[];
3
+ mouth?: ('surprised' | 'laughing' | 'nervous' | 'smile' | 'sad' | 'pucker' | 'frown' | 'smirk')[];
4
+ eyebrows?: ('up' | 'down' | 'eyelashesUp' | 'eyelashesDown')[];
5
+ hair?: ('fonze' | 'mrT' | 'dougFunny' | 'mrClean' | 'dannyPhantom' | 'full' | 'turban' | 'pixie')[];
6
+ hairProbability?: number;
7
+ eyes?: ('eyes' | 'round' | 'eyesShadow' | 'smiling')[];
8
+ nose?: ('curve' | 'pointed' | 'tound')[];
9
+ ears?: ('attached' | 'detached')[];
10
+ shirt?: ('open' | 'crew' | 'collared')[];
11
+ earrings?: ('hoop' | 'stud')[];
12
+ earringsProbability?: number;
13
+ glasses?: ('round' | 'square')[];
14
+ glassesProbability?: number;
15
+ facialHair?: ('beard' | 'scruff')[];
16
+ facialHairProbability?: number;
17
+ baseColor?: string[];
18
+ earringColor?: string[];
19
+ eyeShadowColor?: string[];
20
+ eyebrowsColor?: string[];
21
+ facialHairColor?: string[];
22
+ glassesColor?: string[];
23
+ hairColor?: string[];
24
+ mouthColor?: string[];
25
+ shirtColor?: string[];
26
+ eyesColor?: string[];
27
+ }
28
+ export declare type ColorGroup = Record<string, ColorGroupItem>;
29
+ export declare type ColorGroupCollection = Record<string, ColorGroup>;
30
+ export declare type ColorGroupItem = string;
31
+ export declare type ColorPickCollection = Record<string, ColorPick>;
32
+ export declare type ColorPick = {
33
+ name: string;
34
+ value: ColorGroupItem;
35
+ };
36
+ export declare type ComponentGroup = Record<string, ComponentGroupItem>;
37
+ export declare type ComponentGroupCollection = Record<string, ComponentGroup>;
38
+ export declare type ComponentGroupItem = (components: ComponentPickCollection, colors: ColorPickCollection) => string;
39
+ export declare type ComponentPickCollection = Record<string, ComponentPick>;
40
+ export declare type ComponentPick = {
41
+ name: string;
42
+ value: ComponentGroupItem;
43
+ } | undefined;
package/lib/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,8 @@
1
- import type { Prng } from '@dicebear/core';
2
- import type { Options } from '../options';
3
- import type { ColorPickCollection } from '../static-types';
4
- declare type Props = {
5
- prng: Prng;
6
- options: Options;
7
- };
8
- export declare function getColors({ prng, options }: Props): ColorPickCollection;
9
- export {};
1
+ import type { Prng } from '@dicebear/core';
2
+ import type { Options, ColorPickCollection } from '../types.js';
3
+ declare type Props = {
4
+ prng: Prng;
5
+ options: Options;
6
+ };
7
+ export declare function getColors({ prng, options }: Props): ColorPickCollection;
8
+ export {};
@@ -0,0 +1,55 @@
1
+ import { pickColor } from './pickColor.js';
2
+ export function getColors({ prng, options }) {
3
+ return {
4
+ base: pickColor({
5
+ prng,
6
+ group: 'base',
7
+ values: options.baseColor,
8
+ }),
9
+ earring: pickColor({
10
+ prng,
11
+ group: 'earring',
12
+ values: options.earringColor,
13
+ }),
14
+ eyeShadow: pickColor({
15
+ prng,
16
+ group: 'eyeShadow',
17
+ values: options.eyeShadowColor,
18
+ }),
19
+ eyebrows: pickColor({
20
+ prng,
21
+ group: 'eyebrows',
22
+ values: options.eyebrowsColor,
23
+ }),
24
+ facialHair: pickColor({
25
+ prng,
26
+ group: 'facialHair',
27
+ values: options.facialHairColor,
28
+ }),
29
+ glasses: pickColor({
30
+ prng,
31
+ group: 'glasses',
32
+ values: options.glassesColor,
33
+ }),
34
+ hair: pickColor({
35
+ prng,
36
+ group: 'hair',
37
+ values: options.hairColor,
38
+ }),
39
+ mouth: pickColor({
40
+ prng,
41
+ group: 'mouth',
42
+ values: options.mouthColor,
43
+ }),
44
+ shirt: pickColor({
45
+ prng,
46
+ group: 'shirt',
47
+ values: options.shirtColor,
48
+ }),
49
+ eyes: pickColor({
50
+ prng,
51
+ group: 'eyes',
52
+ values: options.eyesColor,
53
+ }),
54
+ };
55
+ }
@@ -1,9 +1,8 @@
1
- import type { Prng } from '@dicebear/core';
2
- import type { Options } from '../options';
3
- import type { ComponentPickCollection } from '../static-types';
4
- declare type Props = {
5
- prng: Prng;
6
- options: Options;
7
- };
8
- export declare function getComponents({ prng, options, }: Props): ComponentPickCollection;
9
- export {};
1
+ import type { Prng } from '@dicebear/core';
2
+ import type { Options, ComponentPickCollection } from '../types.js';
3
+ declare type Props = {
4
+ prng: Prng;
5
+ options: Options;
6
+ };
7
+ export declare function getComponents({ prng, options, }: Props): ComponentPickCollection;
8
+ export {};
@@ -0,0 +1,77 @@
1
+ import { pickComponent } from './pickComponent.js';
2
+ export function getComponents({ prng, options, }) {
3
+ const baseComponent = pickComponent({
4
+ prng,
5
+ group: 'base',
6
+ values: options.base,
7
+ });
8
+ const mouthComponent = pickComponent({
9
+ prng,
10
+ group: 'mouth',
11
+ values: options.mouth,
12
+ });
13
+ const eyebrowsComponent = pickComponent({
14
+ prng,
15
+ group: 'eyebrows',
16
+ values: options.eyebrows,
17
+ });
18
+ const hairComponent = pickComponent({
19
+ prng,
20
+ group: 'hair',
21
+ values: options.hair,
22
+ });
23
+ const eyesComponent = pickComponent({
24
+ prng,
25
+ group: 'eyes',
26
+ values: options.eyes,
27
+ });
28
+ const noseComponent = pickComponent({
29
+ prng,
30
+ group: 'nose',
31
+ values: options.nose,
32
+ });
33
+ const earsComponent = pickComponent({
34
+ prng,
35
+ group: 'ears',
36
+ values: options.ears,
37
+ });
38
+ const shirtComponent = pickComponent({
39
+ prng,
40
+ group: 'shirt',
41
+ values: options.shirt,
42
+ });
43
+ const earringsComponent = pickComponent({
44
+ prng,
45
+ group: 'earrings',
46
+ values: options.earrings,
47
+ });
48
+ const glassesComponent = pickComponent({
49
+ prng,
50
+ group: 'glasses',
51
+ values: options.glasses,
52
+ });
53
+ const facialHairComponent = pickComponent({
54
+ prng,
55
+ group: 'facialHair',
56
+ values: options.facialHair,
57
+ });
58
+ return {
59
+ base: baseComponent,
60
+ mouth: mouthComponent,
61
+ eyebrows: eyebrowsComponent,
62
+ hair: prng.bool(options.hairProbability) ? hairComponent : undefined,
63
+ eyes: eyesComponent,
64
+ nose: noseComponent,
65
+ ears: earsComponent,
66
+ shirt: shirtComponent,
67
+ earrings: prng.bool(options.earringsProbability)
68
+ ? earringsComponent
69
+ : undefined,
70
+ glasses: prng.bool(options.glassesProbability)
71
+ ? glassesComponent
72
+ : undefined,
73
+ facialHair: prng.bool(options.facialHairProbability)
74
+ ? facialHairComponent
75
+ : undefined,
76
+ };
77
+ }
@@ -1,9 +1,9 @@
1
- import type { Prng } from '@dicebear/core';
2
- import type { ColorPick } from '../static-types';
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
+ 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 {};