@dicebear/pixel-art 5.0.0-alpha.9 → 5.0.0-beta.1
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/LICENSE +1 -2
- package/README.md +8 -2
- package/lib/components/accessories.d.ts +8 -0
- package/lib/components/accessories.js +13 -0
- package/lib/components/beard.d.ts +8 -0
- package/lib/components/beard.js +17 -0
- package/lib/components/clothing.d.ts +8 -0
- package/lib/components/clothing.js +32 -0
- package/lib/components/eyes.d.ts +8 -0
- package/lib/components/eyes.js +21 -0
- package/lib/components/glasses.d.ts +8 -0
- package/lib/components/glasses.js +23 -0
- package/lib/components/hair.d.ts +8 -0
- package/lib/components/hair.js +54 -0
- package/lib/components/index.d.ts +13 -0
- package/lib/components/index.js +13 -0
- package/lib/components/mouth.d.ts +8 -0
- package/lib/components/mouth.js +32 -0
- package/lib/core.d.ts +9 -0
- package/lib/core.js +40 -0
- package/lib/hooks/onPostCreate.d.ts +16 -0
- package/lib/hooks/onPostCreate.js +9 -0
- package/lib/hooks/onPreCreate.d.ts +14 -0
- package/lib/hooks/onPreCreate.js +9 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +20 -0
- package/lib/schema.d.ts +8 -0
- package/lib/schema.js +472 -0
- package/lib/types.d.ts +34 -0
- package/lib/types.js +7 -0
- package/lib/utils/getColors.d.ts +14 -0
- package/lib/utils/getColors.js +19 -0
- package/lib/utils/getComponents.d.ts +14 -0
- package/lib/utils/getComponents.js +54 -0
- package/lib/utils/pickComponent.d.ts +15 -0
- package/lib/utils/pickComponent.js +20 -0
- package/package.json +19 -28
- package/dist/index.d.ts +0 -31
- package/dist/index.d.ts.map +0 -1
- package/dist/index.es.js +0 -659
- package/dist/index.es.js.map +0 -1
- package/dist/index.js +0 -663
- package/dist/index.js.map +0 -1
package/lib/schema.js
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
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/WTcivb1XPf5ODtyv7ZNnU9/%40dicebear%2Fpixel-art?node-id=5%3A1231
|
|
6
|
+
*/
|
|
7
|
+
export const schema = {
|
|
8
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
9
|
+
"properties": {
|
|
10
|
+
"accessories": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"enum": [
|
|
15
|
+
"variant04",
|
|
16
|
+
"variant03",
|
|
17
|
+
"variant02",
|
|
18
|
+
"variant01"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"default": [
|
|
22
|
+
"variant04",
|
|
23
|
+
"variant03",
|
|
24
|
+
"variant02",
|
|
25
|
+
"variant01"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"accessoriesColor": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"pattern": "^[a-fA-F0-9]{6}$"
|
|
33
|
+
},
|
|
34
|
+
"default": [
|
|
35
|
+
"daa520",
|
|
36
|
+
"ffd700",
|
|
37
|
+
"fafad2",
|
|
38
|
+
"d3d3d3",
|
|
39
|
+
"a9a9a9"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"accessoriesProbability": {
|
|
43
|
+
"type": "integer",
|
|
44
|
+
"minimum": 0,
|
|
45
|
+
"maximum": 100,
|
|
46
|
+
"default": 10
|
|
47
|
+
},
|
|
48
|
+
"beard": {
|
|
49
|
+
"type": "array",
|
|
50
|
+
"items": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"enum": [
|
|
53
|
+
"variant08",
|
|
54
|
+
"variant07",
|
|
55
|
+
"variant06",
|
|
56
|
+
"variant05",
|
|
57
|
+
"variant04",
|
|
58
|
+
"variant03",
|
|
59
|
+
"variant02",
|
|
60
|
+
"variant01"
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"default": [
|
|
64
|
+
"variant08",
|
|
65
|
+
"variant07",
|
|
66
|
+
"variant06",
|
|
67
|
+
"variant05",
|
|
68
|
+
"variant04",
|
|
69
|
+
"variant03",
|
|
70
|
+
"variant02",
|
|
71
|
+
"variant01"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"beardProbability": {
|
|
75
|
+
"type": "integer",
|
|
76
|
+
"minimum": 0,
|
|
77
|
+
"maximum": 100,
|
|
78
|
+
"default": 5
|
|
79
|
+
},
|
|
80
|
+
"clothing": {
|
|
81
|
+
"type": "array",
|
|
82
|
+
"items": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"enum": [
|
|
85
|
+
"variant23",
|
|
86
|
+
"variant22",
|
|
87
|
+
"variant21",
|
|
88
|
+
"variant20",
|
|
89
|
+
"variant19",
|
|
90
|
+
"variant18",
|
|
91
|
+
"variant17",
|
|
92
|
+
"variant16",
|
|
93
|
+
"variant15",
|
|
94
|
+
"variant14",
|
|
95
|
+
"variant13",
|
|
96
|
+
"variant12",
|
|
97
|
+
"variant11",
|
|
98
|
+
"variant10",
|
|
99
|
+
"variant09",
|
|
100
|
+
"variant08",
|
|
101
|
+
"variant07",
|
|
102
|
+
"variant06",
|
|
103
|
+
"variant05",
|
|
104
|
+
"variant04",
|
|
105
|
+
"variant03",
|
|
106
|
+
"variant02",
|
|
107
|
+
"variant01"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
"default": [
|
|
111
|
+
"variant23",
|
|
112
|
+
"variant22",
|
|
113
|
+
"variant21",
|
|
114
|
+
"variant20",
|
|
115
|
+
"variant19",
|
|
116
|
+
"variant18",
|
|
117
|
+
"variant17",
|
|
118
|
+
"variant16",
|
|
119
|
+
"variant15",
|
|
120
|
+
"variant14",
|
|
121
|
+
"variant13",
|
|
122
|
+
"variant12",
|
|
123
|
+
"variant11",
|
|
124
|
+
"variant10",
|
|
125
|
+
"variant09",
|
|
126
|
+
"variant08",
|
|
127
|
+
"variant07",
|
|
128
|
+
"variant06",
|
|
129
|
+
"variant05",
|
|
130
|
+
"variant04",
|
|
131
|
+
"variant03",
|
|
132
|
+
"variant02",
|
|
133
|
+
"variant01"
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"clothingColor": {
|
|
137
|
+
"type": "array",
|
|
138
|
+
"items": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"pattern": "^[a-fA-F0-9]{6}$"
|
|
141
|
+
},
|
|
142
|
+
"default": [
|
|
143
|
+
"5bc0de",
|
|
144
|
+
"428bca",
|
|
145
|
+
"03396c",
|
|
146
|
+
"88d8b0",
|
|
147
|
+
"44c585",
|
|
148
|
+
"00b159",
|
|
149
|
+
"ff6f69",
|
|
150
|
+
"d11141",
|
|
151
|
+
"ae0001",
|
|
152
|
+
"ffeead",
|
|
153
|
+
"ffd969",
|
|
154
|
+
"ffc425"
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
"eyes": {
|
|
158
|
+
"type": "array",
|
|
159
|
+
"items": {
|
|
160
|
+
"type": "string",
|
|
161
|
+
"enum": [
|
|
162
|
+
"variant12",
|
|
163
|
+
"variant11",
|
|
164
|
+
"variant10",
|
|
165
|
+
"variant09",
|
|
166
|
+
"variant08",
|
|
167
|
+
"variant07",
|
|
168
|
+
"variant06",
|
|
169
|
+
"variant05",
|
|
170
|
+
"variant04",
|
|
171
|
+
"variant03",
|
|
172
|
+
"variant02",
|
|
173
|
+
"variant01"
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
"default": [
|
|
177
|
+
"variant12",
|
|
178
|
+
"variant11",
|
|
179
|
+
"variant10",
|
|
180
|
+
"variant09",
|
|
181
|
+
"variant08",
|
|
182
|
+
"variant07",
|
|
183
|
+
"variant06",
|
|
184
|
+
"variant05",
|
|
185
|
+
"variant04",
|
|
186
|
+
"variant03",
|
|
187
|
+
"variant02",
|
|
188
|
+
"variant01"
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
"eyesColor": {
|
|
192
|
+
"type": "array",
|
|
193
|
+
"items": {
|
|
194
|
+
"type": "string",
|
|
195
|
+
"pattern": "^[a-fA-F0-9]{6}$"
|
|
196
|
+
},
|
|
197
|
+
"default": [
|
|
198
|
+
"76778b",
|
|
199
|
+
"697b94",
|
|
200
|
+
"647b90",
|
|
201
|
+
"5b7c8b",
|
|
202
|
+
"588387",
|
|
203
|
+
"876658"
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
"glasses": {
|
|
207
|
+
"type": "array",
|
|
208
|
+
"items": {
|
|
209
|
+
"type": "string",
|
|
210
|
+
"enum": [
|
|
211
|
+
"light07",
|
|
212
|
+
"light06",
|
|
213
|
+
"light05",
|
|
214
|
+
"light04",
|
|
215
|
+
"light03",
|
|
216
|
+
"light02",
|
|
217
|
+
"light01",
|
|
218
|
+
"dark07",
|
|
219
|
+
"dark06",
|
|
220
|
+
"dark05",
|
|
221
|
+
"dark04",
|
|
222
|
+
"dark03",
|
|
223
|
+
"dark02",
|
|
224
|
+
"dark01"
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
"default": [
|
|
228
|
+
"light07",
|
|
229
|
+
"light06",
|
|
230
|
+
"light05",
|
|
231
|
+
"light04",
|
|
232
|
+
"light03",
|
|
233
|
+
"light02",
|
|
234
|
+
"light01",
|
|
235
|
+
"dark07",
|
|
236
|
+
"dark06",
|
|
237
|
+
"dark05",
|
|
238
|
+
"dark04",
|
|
239
|
+
"dark03",
|
|
240
|
+
"dark02",
|
|
241
|
+
"dark01"
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
"glassesColor": {
|
|
245
|
+
"type": "array",
|
|
246
|
+
"items": {
|
|
247
|
+
"type": "string",
|
|
248
|
+
"pattern": "^[a-fA-F0-9]{6}$"
|
|
249
|
+
},
|
|
250
|
+
"default": [
|
|
251
|
+
"4b4b4b",
|
|
252
|
+
"323232",
|
|
253
|
+
"191919",
|
|
254
|
+
"43677d",
|
|
255
|
+
"5f705c",
|
|
256
|
+
"a04b5d"
|
|
257
|
+
]
|
|
258
|
+
},
|
|
259
|
+
"glassesProbability": {
|
|
260
|
+
"type": "integer",
|
|
261
|
+
"minimum": 0,
|
|
262
|
+
"maximum": 100,
|
|
263
|
+
"default": 20
|
|
264
|
+
},
|
|
265
|
+
"hair": {
|
|
266
|
+
"type": "array",
|
|
267
|
+
"items": {
|
|
268
|
+
"type": "string",
|
|
269
|
+
"enum": [
|
|
270
|
+
"short24",
|
|
271
|
+
"short23",
|
|
272
|
+
"short22",
|
|
273
|
+
"short21",
|
|
274
|
+
"short20",
|
|
275
|
+
"short19",
|
|
276
|
+
"short18",
|
|
277
|
+
"short17",
|
|
278
|
+
"short16",
|
|
279
|
+
"short15",
|
|
280
|
+
"short14",
|
|
281
|
+
"short13",
|
|
282
|
+
"short12",
|
|
283
|
+
"short11",
|
|
284
|
+
"short10",
|
|
285
|
+
"short09",
|
|
286
|
+
"short08",
|
|
287
|
+
"short07",
|
|
288
|
+
"short06",
|
|
289
|
+
"short05",
|
|
290
|
+
"short04",
|
|
291
|
+
"short03",
|
|
292
|
+
"short02",
|
|
293
|
+
"short01",
|
|
294
|
+
"long21",
|
|
295
|
+
"long20",
|
|
296
|
+
"long19",
|
|
297
|
+
"long18",
|
|
298
|
+
"long17",
|
|
299
|
+
"long16",
|
|
300
|
+
"long15",
|
|
301
|
+
"long14",
|
|
302
|
+
"long13",
|
|
303
|
+
"long12",
|
|
304
|
+
"long11",
|
|
305
|
+
"long10",
|
|
306
|
+
"long09",
|
|
307
|
+
"long08",
|
|
308
|
+
"long07",
|
|
309
|
+
"long06",
|
|
310
|
+
"long05",
|
|
311
|
+
"long04",
|
|
312
|
+
"long03",
|
|
313
|
+
"long02",
|
|
314
|
+
"long01"
|
|
315
|
+
]
|
|
316
|
+
},
|
|
317
|
+
"default": [
|
|
318
|
+
"short24",
|
|
319
|
+
"short23",
|
|
320
|
+
"short22",
|
|
321
|
+
"short21",
|
|
322
|
+
"short20",
|
|
323
|
+
"short19",
|
|
324
|
+
"short18",
|
|
325
|
+
"short17",
|
|
326
|
+
"short16",
|
|
327
|
+
"short15",
|
|
328
|
+
"short14",
|
|
329
|
+
"short13",
|
|
330
|
+
"short12",
|
|
331
|
+
"short11",
|
|
332
|
+
"short10",
|
|
333
|
+
"short09",
|
|
334
|
+
"short08",
|
|
335
|
+
"short07",
|
|
336
|
+
"short06",
|
|
337
|
+
"short05",
|
|
338
|
+
"short04",
|
|
339
|
+
"short03",
|
|
340
|
+
"short02",
|
|
341
|
+
"short01",
|
|
342
|
+
"long21",
|
|
343
|
+
"long20",
|
|
344
|
+
"long19",
|
|
345
|
+
"long18",
|
|
346
|
+
"long17",
|
|
347
|
+
"long16",
|
|
348
|
+
"long15",
|
|
349
|
+
"long14",
|
|
350
|
+
"long13",
|
|
351
|
+
"long12",
|
|
352
|
+
"long11",
|
|
353
|
+
"long10",
|
|
354
|
+
"long09",
|
|
355
|
+
"long08",
|
|
356
|
+
"long07",
|
|
357
|
+
"long06",
|
|
358
|
+
"long05",
|
|
359
|
+
"long04",
|
|
360
|
+
"long03",
|
|
361
|
+
"long02",
|
|
362
|
+
"long01"
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
"hairColor": {
|
|
366
|
+
"type": "array",
|
|
367
|
+
"items": {
|
|
368
|
+
"type": "string",
|
|
369
|
+
"pattern": "^[a-fA-F0-9]{6}$"
|
|
370
|
+
},
|
|
371
|
+
"default": [
|
|
372
|
+
"cab188",
|
|
373
|
+
"603a14",
|
|
374
|
+
"83623b",
|
|
375
|
+
"a78961",
|
|
376
|
+
"611c17",
|
|
377
|
+
"603015",
|
|
378
|
+
"612616",
|
|
379
|
+
"28150a",
|
|
380
|
+
"009bbd",
|
|
381
|
+
"bd1700",
|
|
382
|
+
"91cb15"
|
|
383
|
+
]
|
|
384
|
+
},
|
|
385
|
+
"mouth": {
|
|
386
|
+
"type": "array",
|
|
387
|
+
"items": {
|
|
388
|
+
"type": "string",
|
|
389
|
+
"enum": [
|
|
390
|
+
"sad10",
|
|
391
|
+
"sad09",
|
|
392
|
+
"sad08",
|
|
393
|
+
"sad07",
|
|
394
|
+
"sad06",
|
|
395
|
+
"sad05",
|
|
396
|
+
"sad04",
|
|
397
|
+
"sad03",
|
|
398
|
+
"sad02",
|
|
399
|
+
"sad01",
|
|
400
|
+
"happy13",
|
|
401
|
+
"happy12",
|
|
402
|
+
"happy11",
|
|
403
|
+
"happy10",
|
|
404
|
+
"happy09",
|
|
405
|
+
"happy08",
|
|
406
|
+
"happy07",
|
|
407
|
+
"happy06",
|
|
408
|
+
"happy05",
|
|
409
|
+
"happy04",
|
|
410
|
+
"happy03",
|
|
411
|
+
"happy02",
|
|
412
|
+
"happy01"
|
|
413
|
+
]
|
|
414
|
+
},
|
|
415
|
+
"default": [
|
|
416
|
+
"sad10",
|
|
417
|
+
"sad09",
|
|
418
|
+
"sad08",
|
|
419
|
+
"sad07",
|
|
420
|
+
"sad06",
|
|
421
|
+
"sad05",
|
|
422
|
+
"sad04",
|
|
423
|
+
"sad03",
|
|
424
|
+
"sad02",
|
|
425
|
+
"sad01",
|
|
426
|
+
"happy13",
|
|
427
|
+
"happy12",
|
|
428
|
+
"happy11",
|
|
429
|
+
"happy10",
|
|
430
|
+
"happy09",
|
|
431
|
+
"happy08",
|
|
432
|
+
"happy07",
|
|
433
|
+
"happy06",
|
|
434
|
+
"happy05",
|
|
435
|
+
"happy04",
|
|
436
|
+
"happy03",
|
|
437
|
+
"happy02",
|
|
438
|
+
"happy01"
|
|
439
|
+
]
|
|
440
|
+
},
|
|
441
|
+
"mouthColor": {
|
|
442
|
+
"type": "array",
|
|
443
|
+
"items": {
|
|
444
|
+
"type": "string",
|
|
445
|
+
"pattern": "^[a-fA-F0-9]{6}$"
|
|
446
|
+
},
|
|
447
|
+
"default": [
|
|
448
|
+
"d29985",
|
|
449
|
+
"c98276",
|
|
450
|
+
"e35d6a",
|
|
451
|
+
"de0f0d"
|
|
452
|
+
]
|
|
453
|
+
},
|
|
454
|
+
"skinColor": {
|
|
455
|
+
"type": "array",
|
|
456
|
+
"items": {
|
|
457
|
+
"type": "string",
|
|
458
|
+
"pattern": "^[a-fA-F0-9]{6}$"
|
|
459
|
+
},
|
|
460
|
+
"default": [
|
|
461
|
+
"ffdbac",
|
|
462
|
+
"f5cfa0",
|
|
463
|
+
"eac393",
|
|
464
|
+
"e0b687",
|
|
465
|
+
"cb9e6e",
|
|
466
|
+
"b68655",
|
|
467
|
+
"a26d3d",
|
|
468
|
+
"8d5524"
|
|
469
|
+
]
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
};
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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/WTcivb1XPf5ODtyv7ZNnU9/%40dicebear%2Fpixel-art?node-id=5%3A1231
|
|
6
|
+
*/
|
|
7
|
+
export interface Options {
|
|
8
|
+
accessories?: ('variant04' | 'variant03' | 'variant02' | 'variant01')[];
|
|
9
|
+
accessoriesProbability?: number;
|
|
10
|
+
clothing?: ('variant23' | 'variant22' | 'variant21' | 'variant20' | 'variant19' | 'variant18' | 'variant17' | 'variant16' | 'variant15' | 'variant14' | 'variant13' | 'variant12' | 'variant11' | 'variant10' | 'variant09' | 'variant08' | 'variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01')[];
|
|
11
|
+
eyes?: ('variant12' | 'variant11' | 'variant10' | 'variant09' | 'variant08' | 'variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01')[];
|
|
12
|
+
glasses?: ('light07' | 'light06' | 'light05' | 'light04' | 'light03' | 'light02' | 'light01' | 'dark07' | 'dark06' | 'dark05' | 'dark04' | 'dark03' | 'dark02' | 'dark01')[];
|
|
13
|
+
glassesProbability?: number;
|
|
14
|
+
beard?: ('variant08' | 'variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01')[];
|
|
15
|
+
beardProbability?: number;
|
|
16
|
+
mouth?: ('sad10' | 'sad09' | 'sad08' | 'sad07' | 'sad06' | 'sad05' | 'sad04' | 'sad03' | 'sad02' | 'sad01' | 'happy13' | 'happy12' | 'happy11' | 'happy10' | 'happy09' | 'happy08' | 'happy07' | 'happy06' | 'happy05' | 'happy04' | 'happy03' | 'happy02' | 'happy01')[];
|
|
17
|
+
hair?: ('short24' | 'short23' | 'short22' | 'short21' | 'short20' | 'short19' | 'short18' | 'short17' | 'short16' | 'short15' | 'short14' | 'short13' | 'short12' | 'short11' | 'short10' | 'short09' | 'short08' | 'short07' | 'short06' | 'short05' | 'short04' | 'short03' | 'short02' | 'short01' | 'long21' | 'long20' | 'long19' | 'long18' | 'long17' | 'long16' | 'long15' | 'long14' | 'long13' | 'long12' | 'long11' | 'long10' | 'long09' | 'long08' | 'long07' | 'long06' | 'long05' | 'long04' | 'long03' | 'long02' | 'long01')[];
|
|
18
|
+
accessoriesColor?: string[];
|
|
19
|
+
clothingColor?: string[];
|
|
20
|
+
eyesColor?: string[];
|
|
21
|
+
glassesColor?: string[];
|
|
22
|
+
hairColor?: string[];
|
|
23
|
+
mouthColor?: string[];
|
|
24
|
+
skinColor?: string[];
|
|
25
|
+
}
|
|
26
|
+
export declare type ColorPickCollection = Record<string, string>;
|
|
27
|
+
export declare type ComponentGroup = Record<string, ComponentGroupItem>;
|
|
28
|
+
export declare type ComponentGroupCollection = Record<string, ComponentGroup>;
|
|
29
|
+
export declare type ComponentGroupItem = (components: ComponentPickCollection, colors: ColorPickCollection) => string;
|
|
30
|
+
export declare type ComponentPickCollection = Record<string, ComponentPick>;
|
|
31
|
+
export declare type ComponentPick = {
|
|
32
|
+
name: string;
|
|
33
|
+
value: ComponentGroupItem;
|
|
34
|
+
} | undefined;
|
package/lib/types.js
ADDED
|
@@ -0,0 +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/WTcivb1XPf5ODtyv7ZNnU9/%40dicebear%2Fpixel-art?node-id=5%3A1231
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
@@ -0,0 +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/WTcivb1XPf5ODtyv7ZNnU9/%40dicebear%2Fpixel-art?node-id=5%3A1231
|
|
6
|
+
*/
|
|
7
|
+
import type { Prng } from '@dicebear/core';
|
|
8
|
+
import type { Options, ColorPickCollection } from '../types.js';
|
|
9
|
+
declare type Props = {
|
|
10
|
+
prng: Prng;
|
|
11
|
+
options: Options;
|
|
12
|
+
};
|
|
13
|
+
export declare function getColors({ prng, options }: Props): ColorPickCollection;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
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/WTcivb1XPf5ODtyv7ZNnU9/%40dicebear%2Fpixel-art?node-id=5%3A1231
|
|
6
|
+
*/
|
|
7
|
+
export function getColors({ prng, options }) {
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
9
|
+
return {
|
|
10
|
+
'accessories': (_b = prng.pick((_a = options.accessoriesColor) !== null && _a !== void 0 ? _a : [])) !== null && _b !== void 0 ? _b : 'transparent',
|
|
11
|
+
'clothing': (_d = prng.pick((_c = options.clothingColor) !== null && _c !== void 0 ? _c : [])) !== null && _d !== void 0 ? _d : 'transparent',
|
|
12
|
+
'eyes': (_f = prng.pick((_e = options.eyesColor) !== null && _e !== void 0 ? _e : [])) !== null && _f !== void 0 ? _f : 'transparent',
|
|
13
|
+
'glasses': (_h = prng.pick((_g = options.glassesColor) !== null && _g !== void 0 ? _g : [])) !== null && _h !== void 0 ? _h : 'transparent',
|
|
14
|
+
'hair': (_k = prng.pick((_j = options.hairColor) !== null && _j !== void 0 ? _j : [])) !== null && _k !== void 0 ? _k : 'transparent',
|
|
15
|
+
'mouth': (_m = prng.pick((_l = options.mouthColor) !== null && _l !== void 0 ? _l : [])) !== null && _m !== void 0 ? _m : 'transparent',
|
|
16
|
+
'skin': (_p = prng.pick((_o = options.skinColor) !== null && _o !== void 0 ? _o : [])) !== null && _p !== void 0 ? _p : 'transparent',
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
;
|
|
@@ -0,0 +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/WTcivb1XPf5ODtyv7ZNnU9/%40dicebear%2Fpixel-art?node-id=5%3A1231
|
|
6
|
+
*/
|
|
7
|
+
import type { Prng } from '@dicebear/core';
|
|
8
|
+
import type { Options, ComponentPickCollection } from '../types.js';
|
|
9
|
+
declare type Props = {
|
|
10
|
+
prng: Prng;
|
|
11
|
+
options: Options;
|
|
12
|
+
};
|
|
13
|
+
export declare function getComponents({ prng, options }: Props): ComponentPickCollection;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
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/WTcivb1XPf5ODtyv7ZNnU9/%40dicebear%2Fpixel-art?node-id=5%3A1231
|
|
6
|
+
*/
|
|
7
|
+
import { pickComponent } from './pickComponent.js';
|
|
8
|
+
export function getComponents({ prng, options }) {
|
|
9
|
+
const accessoriesComponent = pickComponent({
|
|
10
|
+
prng,
|
|
11
|
+
group: 'accessories',
|
|
12
|
+
values: options.accessories
|
|
13
|
+
});
|
|
14
|
+
const clothingComponent = pickComponent({
|
|
15
|
+
prng,
|
|
16
|
+
group: 'clothing',
|
|
17
|
+
values: options.clothing
|
|
18
|
+
});
|
|
19
|
+
const eyesComponent = pickComponent({
|
|
20
|
+
prng,
|
|
21
|
+
group: 'eyes',
|
|
22
|
+
values: options.eyes
|
|
23
|
+
});
|
|
24
|
+
const glassesComponent = pickComponent({
|
|
25
|
+
prng,
|
|
26
|
+
group: 'glasses',
|
|
27
|
+
values: options.glasses
|
|
28
|
+
});
|
|
29
|
+
const beardComponent = pickComponent({
|
|
30
|
+
prng,
|
|
31
|
+
group: 'beard',
|
|
32
|
+
values: options.beard
|
|
33
|
+
});
|
|
34
|
+
const mouthComponent = pickComponent({
|
|
35
|
+
prng,
|
|
36
|
+
group: 'mouth',
|
|
37
|
+
values: options.mouth
|
|
38
|
+
});
|
|
39
|
+
const hairComponent = pickComponent({
|
|
40
|
+
prng,
|
|
41
|
+
group: 'hair',
|
|
42
|
+
values: options.hair
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
'accessories': prng.bool(options.accessoriesProbability) ? accessoriesComponent : undefined,
|
|
46
|
+
'clothing': clothingComponent,
|
|
47
|
+
'eyes': eyesComponent,
|
|
48
|
+
'glasses': prng.bool(options.glassesProbability) ? glassesComponent : undefined,
|
|
49
|
+
'beard': prng.bool(options.beardProbability) ? beardComponent : undefined,
|
|
50
|
+
'mouth': mouthComponent,
|
|
51
|
+
'hair': hairComponent,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
;
|
|
@@ -0,0 +1,15 @@
|
|
|
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/WTcivb1XPf5ODtyv7ZNnU9/%40dicebear%2Fpixel-art?node-id=5%3A1231
|
|
6
|
+
*/
|
|
7
|
+
import type { Prng } from '@dicebear/core';
|
|
8
|
+
import type { ComponentPick } from '../types.js';
|
|
9
|
+
declare type Props = {
|
|
10
|
+
prng: Prng;
|
|
11
|
+
group: string;
|
|
12
|
+
values?: string[];
|
|
13
|
+
};
|
|
14
|
+
export declare function pickComponent({ prng, group, values }: Props): ComponentPick;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
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/WTcivb1XPf5ODtyv7ZNnU9/%40dicebear%2Fpixel-art?node-id=5%3A1231
|
|
6
|
+
*/
|
|
7
|
+
import * as components from '../components/index.js';
|
|
8
|
+
export function pickComponent({ prng, group, values = [] }) {
|
|
9
|
+
const componentCollection = components;
|
|
10
|
+
const key = prng.pick(values);
|
|
11
|
+
if (key && componentCollection[group][key]) {
|
|
12
|
+
return {
|
|
13
|
+
name: key,
|
|
14
|
+
value: componentCollection[group][key],
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|