@dicebear/pixel-art-neutral 5.0.0-alpha.1 → 5.0.0-alpha.13
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/colors/glasses.d.ts +2 -0
- package/lib/colors/glasses.js +8 -0
- package/lib/colors/hair.d.ts +2 -0
- package/lib/colors/hair.js +12 -0
- package/lib/colors/index.d.ts +4 -0
- package/lib/colors/index.js +4 -0
- package/lib/colors/mouth.d.ts +2 -0
- package/lib/colors/mouth.js +6 -0
- package/lib/colors/skin.d.ts +2 -0
- package/lib/colors/skin.js +10 -0
- package/lib/components/eyebrows.d.ts +2 -0
- package/lib/components/eyebrows.js +15 -0
- package/lib/components/eyes.d.ts +2 -0
- package/lib/components/eyes.js +15 -0
- package/lib/components/glasses.d.ts +2 -0
- package/lib/components/glasses.js +9 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/index.js +4 -0
- package/lib/components/mouth.d.ts +2 -0
- package/lib/components/mouth.js +22 -0
- package/{dist → lib}/core.d.ts +3 -3
- package/lib/core.js +65 -0
- package/{dist → lib}/hooks/onPostCreate.d.ts +11 -12
- package/lib/hooks/onPostCreate.js +3 -0
- package/{dist → lib}/hooks/onPreCreate.d.ts +9 -9
- package/lib/hooks/onPreCreate.js +3 -0
- package/{dist → lib}/index.d.ts +13 -13
- package/lib/index.js +13 -0
- package/{dist → lib}/meta/components.d.ts +4 -4
- package/lib/meta/components.js +18 -0
- package/lib/schema.d.ts +2 -0
- package/lib/schema.js +303 -0
- package/lib/types.d.ts +27 -0
- package/lib/types.js +1 -0
- package/{dist → lib}/utils/getColors.d.ts +8 -9
- package/lib/utils/getColors.js +25 -0
- package/{dist → lib}/utils/getComponents.d.ts +8 -9
- package/lib/utils/getComponents.js +31 -0
- package/{dist → lib}/utils/pickColor.d.ts +9 -9
- package/lib/utils/pickColor.js +13 -0
- package/{dist → lib}/utils/pickComponent.d.ts +9 -9
- package/lib/utils/pickComponent.js +14 -0
- package/package.json +18 -21
- package/dist/colors/glasses.d.ts +0 -2
- package/dist/colors/hair.d.ts +0 -2
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/mouth.d.ts +0 -2
- package/dist/colors/skin.d.ts +0 -2
- package/dist/components/eyebrows.d.ts +0 -2
- package/dist/components/eyes.d.ts +0 -2
- package/dist/components/glasses.d.ts +0 -2
- package/dist/components/index.d.ts +0 -4
- package/dist/components/mouth.d.ts +0 -2
- package/dist/index.es.js +0 -628
- package/dist/index.js +0 -635
- package/dist/index.umd.js +0 -12
- package/dist/options.d.ts +0 -16
- package/dist/static-types.d.ts +0 -16
package/lib/schema.js
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
export const schema = {
|
|
2
|
+
title: 'Options',
|
|
3
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
4
|
+
properties: {
|
|
5
|
+
backgroundColor: {
|
|
6
|
+
type: 'array',
|
|
7
|
+
items: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
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})$',
|
|
10
|
+
},
|
|
11
|
+
default: [
|
|
12
|
+
'variant01',
|
|
13
|
+
'variant02',
|
|
14
|
+
'variant03',
|
|
15
|
+
'variant04',
|
|
16
|
+
'variant05',
|
|
17
|
+
'variant06',
|
|
18
|
+
'variant07',
|
|
19
|
+
'variant08',
|
|
20
|
+
],
|
|
21
|
+
examples: [
|
|
22
|
+
['variant01'],
|
|
23
|
+
['variant02'],
|
|
24
|
+
['variant03'],
|
|
25
|
+
['variant04'],
|
|
26
|
+
['variant05'],
|
|
27
|
+
['variant06'],
|
|
28
|
+
['variant07'],
|
|
29
|
+
['variant08'],
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
eyebrows: {
|
|
33
|
+
type: 'array',
|
|
34
|
+
items: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
enum: [
|
|
37
|
+
'variant13',
|
|
38
|
+
'variant12',
|
|
39
|
+
'variant11',
|
|
40
|
+
'variant10',
|
|
41
|
+
'variant09',
|
|
42
|
+
'variant08',
|
|
43
|
+
'variant07',
|
|
44
|
+
'variant06',
|
|
45
|
+
'variant05',
|
|
46
|
+
'variant04',
|
|
47
|
+
'variant03',
|
|
48
|
+
'variant02',
|
|
49
|
+
'variant01',
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
default: [
|
|
53
|
+
'variant13',
|
|
54
|
+
'variant12',
|
|
55
|
+
'variant11',
|
|
56
|
+
'variant10',
|
|
57
|
+
'variant09',
|
|
58
|
+
'variant08',
|
|
59
|
+
'variant07',
|
|
60
|
+
'variant06',
|
|
61
|
+
'variant05',
|
|
62
|
+
'variant04',
|
|
63
|
+
'variant03',
|
|
64
|
+
'variant02',
|
|
65
|
+
'variant01',
|
|
66
|
+
],
|
|
67
|
+
examples: [
|
|
68
|
+
['variant13'],
|
|
69
|
+
['variant12'],
|
|
70
|
+
['variant11'],
|
|
71
|
+
['variant10'],
|
|
72
|
+
['variant09'],
|
|
73
|
+
['variant08'],
|
|
74
|
+
['variant07'],
|
|
75
|
+
['variant06'],
|
|
76
|
+
['variant05'],
|
|
77
|
+
['variant04'],
|
|
78
|
+
['variant03'],
|
|
79
|
+
['variant02'],
|
|
80
|
+
['variant01'],
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
eyes: {
|
|
84
|
+
type: 'array',
|
|
85
|
+
items: {
|
|
86
|
+
type: 'string',
|
|
87
|
+
enum: [
|
|
88
|
+
'variant13',
|
|
89
|
+
'variant12',
|
|
90
|
+
'variant11',
|
|
91
|
+
'variant10',
|
|
92
|
+
'variant09',
|
|
93
|
+
'variant08',
|
|
94
|
+
'variant07',
|
|
95
|
+
'variant06',
|
|
96
|
+
'variant05',
|
|
97
|
+
'variant04',
|
|
98
|
+
'variant03',
|
|
99
|
+
'variant02',
|
|
100
|
+
'variant01',
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
default: [
|
|
104
|
+
'variant13',
|
|
105
|
+
'variant12',
|
|
106
|
+
'variant11',
|
|
107
|
+
'variant10',
|
|
108
|
+
'variant09',
|
|
109
|
+
'variant08',
|
|
110
|
+
'variant07',
|
|
111
|
+
'variant06',
|
|
112
|
+
'variant05',
|
|
113
|
+
'variant04',
|
|
114
|
+
'variant03',
|
|
115
|
+
'variant02',
|
|
116
|
+
'variant01',
|
|
117
|
+
],
|
|
118
|
+
examples: [
|
|
119
|
+
['variant13'],
|
|
120
|
+
['variant12'],
|
|
121
|
+
['variant11'],
|
|
122
|
+
['variant10'],
|
|
123
|
+
['variant09'],
|
|
124
|
+
['variant08'],
|
|
125
|
+
['variant07'],
|
|
126
|
+
['variant06'],
|
|
127
|
+
['variant05'],
|
|
128
|
+
['variant04'],
|
|
129
|
+
['variant03'],
|
|
130
|
+
['variant02'],
|
|
131
|
+
['variant01'],
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
glasses: {
|
|
135
|
+
type: 'array',
|
|
136
|
+
items: {
|
|
137
|
+
type: 'string',
|
|
138
|
+
enum: [
|
|
139
|
+
'variant07',
|
|
140
|
+
'variant06',
|
|
141
|
+
'variant05',
|
|
142
|
+
'variant04',
|
|
143
|
+
'variant03',
|
|
144
|
+
'variant02',
|
|
145
|
+
'variant01',
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
default: [
|
|
149
|
+
'variant07',
|
|
150
|
+
'variant06',
|
|
151
|
+
'variant05',
|
|
152
|
+
'variant04',
|
|
153
|
+
'variant03',
|
|
154
|
+
'variant02',
|
|
155
|
+
'variant01',
|
|
156
|
+
],
|
|
157
|
+
examples: [
|
|
158
|
+
['variant07'],
|
|
159
|
+
['variant06'],
|
|
160
|
+
['variant05'],
|
|
161
|
+
['variant04'],
|
|
162
|
+
['variant03'],
|
|
163
|
+
['variant02'],
|
|
164
|
+
['variant01'],
|
|
165
|
+
],
|
|
166
|
+
},
|
|
167
|
+
glassesColor: {
|
|
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: ['green01', 'blue01', 'red01', 'black01', 'black02', 'black03'],
|
|
174
|
+
examples: [
|
|
175
|
+
['green01'],
|
|
176
|
+
['blue01'],
|
|
177
|
+
['red01'],
|
|
178
|
+
['black01'],
|
|
179
|
+
['black02'],
|
|
180
|
+
['black03'],
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
glassesProbability: {
|
|
184
|
+
type: 'integer',
|
|
185
|
+
minimum: 0,
|
|
186
|
+
maximum: 100,
|
|
187
|
+
default: 20,
|
|
188
|
+
},
|
|
189
|
+
hairColor: {
|
|
190
|
+
type: 'array',
|
|
191
|
+
items: {
|
|
192
|
+
type: 'string',
|
|
193
|
+
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})$',
|
|
194
|
+
},
|
|
195
|
+
default: [
|
|
196
|
+
'variant01',
|
|
197
|
+
'variant02',
|
|
198
|
+
'variant03',
|
|
199
|
+
'variant04',
|
|
200
|
+
'variant05',
|
|
201
|
+
'variant06',
|
|
202
|
+
'variant07',
|
|
203
|
+
'variant08',
|
|
204
|
+
'variant09',
|
|
205
|
+
'variant10',
|
|
206
|
+
],
|
|
207
|
+
examples: [
|
|
208
|
+
['variant01'],
|
|
209
|
+
['variant02'],
|
|
210
|
+
['variant03'],
|
|
211
|
+
['variant04'],
|
|
212
|
+
['variant05'],
|
|
213
|
+
['variant06'],
|
|
214
|
+
['variant07'],
|
|
215
|
+
['variant08'],
|
|
216
|
+
['variant09'],
|
|
217
|
+
['variant10'],
|
|
218
|
+
],
|
|
219
|
+
},
|
|
220
|
+
mouth: {
|
|
221
|
+
type: 'array',
|
|
222
|
+
items: {
|
|
223
|
+
type: 'string',
|
|
224
|
+
enum: [
|
|
225
|
+
'surprised03',
|
|
226
|
+
'surprised02',
|
|
227
|
+
'happy09',
|
|
228
|
+
'happy08',
|
|
229
|
+
'happy07',
|
|
230
|
+
'happy06',
|
|
231
|
+
'happy05',
|
|
232
|
+
'happy04',
|
|
233
|
+
'happy03',
|
|
234
|
+
'happy02',
|
|
235
|
+
'happy01',
|
|
236
|
+
'sad08',
|
|
237
|
+
'sad07',
|
|
238
|
+
'sad06',
|
|
239
|
+
'sad05',
|
|
240
|
+
'sad04',
|
|
241
|
+
'sad03',
|
|
242
|
+
'sad02',
|
|
243
|
+
'sad01',
|
|
244
|
+
'surprised01',
|
|
245
|
+
],
|
|
246
|
+
},
|
|
247
|
+
default: [
|
|
248
|
+
'surprised03',
|
|
249
|
+
'surprised02',
|
|
250
|
+
'happy09',
|
|
251
|
+
'happy08',
|
|
252
|
+
'happy07',
|
|
253
|
+
'happy06',
|
|
254
|
+
'happy05',
|
|
255
|
+
'happy04',
|
|
256
|
+
'happy03',
|
|
257
|
+
'happy02',
|
|
258
|
+
'happy01',
|
|
259
|
+
'sad08',
|
|
260
|
+
'sad07',
|
|
261
|
+
'sad06',
|
|
262
|
+
'sad05',
|
|
263
|
+
'sad04',
|
|
264
|
+
'sad03',
|
|
265
|
+
'sad02',
|
|
266
|
+
'sad01',
|
|
267
|
+
'surprised01',
|
|
268
|
+
],
|
|
269
|
+
examples: [
|
|
270
|
+
['surprised03'],
|
|
271
|
+
['surprised02'],
|
|
272
|
+
['happy09'],
|
|
273
|
+
['happy08'],
|
|
274
|
+
['happy07'],
|
|
275
|
+
['happy06'],
|
|
276
|
+
['happy05'],
|
|
277
|
+
['happy04'],
|
|
278
|
+
['happy03'],
|
|
279
|
+
['happy02'],
|
|
280
|
+
['happy01'],
|
|
281
|
+
['sad08'],
|
|
282
|
+
['sad07'],
|
|
283
|
+
['sad06'],
|
|
284
|
+
['sad05'],
|
|
285
|
+
['sad04'],
|
|
286
|
+
['sad03'],
|
|
287
|
+
['sad02'],
|
|
288
|
+
['sad01'],
|
|
289
|
+
['surprised01'],
|
|
290
|
+
],
|
|
291
|
+
},
|
|
292
|
+
mouthColor: {
|
|
293
|
+
type: 'array',
|
|
294
|
+
items: {
|
|
295
|
+
type: 'string',
|
|
296
|
+
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})$',
|
|
297
|
+
},
|
|
298
|
+
default: ['variant01', 'variant02', 'variant03', 'variant04'],
|
|
299
|
+
examples: [['variant01'], ['variant02'], ['variant03'], ['variant04']],
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
additionalProperties: false,
|
|
303
|
+
};
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface Options {
|
|
2
|
+
eyes?: ('variant13' | 'variant12' | 'variant11' | 'variant10' | 'variant09' | 'variant08' | 'variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01')[];
|
|
3
|
+
eyebrows?: ('variant13' | 'variant12' | 'variant11' | 'variant10' | 'variant09' | 'variant08' | 'variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01')[];
|
|
4
|
+
mouth?: ('surprised03' | 'surprised02' | 'happy09' | 'happy08' | 'happy07' | 'happy06' | 'happy05' | 'happy04' | 'happy03' | 'happy02' | 'happy01' | 'sad08' | 'sad07' | 'sad06' | 'sad05' | 'sad04' | 'sad03' | 'sad02' | 'sad01' | 'surprised01')[];
|
|
5
|
+
glasses?: ('variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01')[];
|
|
6
|
+
glassesProbability?: number;
|
|
7
|
+
backgroundColor?: string[];
|
|
8
|
+
hairColor?: string[];
|
|
9
|
+
mouthColor?: string[];
|
|
10
|
+
glassesColor?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare type ColorGroup = Record<string, ColorGroupItem>;
|
|
13
|
+
export declare type ColorGroupCollection = Record<string, ColorGroup>;
|
|
14
|
+
export declare type ColorGroupItem = string;
|
|
15
|
+
export declare type ColorPickCollection = Record<string, ColorPick>;
|
|
16
|
+
export declare type ColorPick = {
|
|
17
|
+
name: string;
|
|
18
|
+
value: ColorGroupItem;
|
|
19
|
+
};
|
|
20
|
+
export declare type ComponentGroup = Record<string, ComponentGroupItem>;
|
|
21
|
+
export declare type ComponentGroupCollection = Record<string, ComponentGroup>;
|
|
22
|
+
export declare type ComponentGroupItem = (components: ComponentPickCollection, colors: ColorPickCollection) => string;
|
|
23
|
+
export declare type ComponentPickCollection = Record<string, ComponentPick>;
|
|
24
|
+
export declare type ComponentPick = {
|
|
25
|
+
name: string;
|
|
26
|
+
value: ComponentGroupItem;
|
|
27
|
+
} | 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 '../
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
export
|
|
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,25 @@
|
|
|
1
|
+
import { pickColor } from './pickColor.js';
|
|
2
|
+
export function getColors({ prng, options }) {
|
|
3
|
+
return {
|
|
4
|
+
hair: pickColor({
|
|
5
|
+
prng,
|
|
6
|
+
group: 'hair',
|
|
7
|
+
values: options.hairColor,
|
|
8
|
+
}),
|
|
9
|
+
mouth: pickColor({
|
|
10
|
+
prng,
|
|
11
|
+
group: 'mouth',
|
|
12
|
+
values: options.mouthColor,
|
|
13
|
+
}),
|
|
14
|
+
glasses: pickColor({
|
|
15
|
+
prng,
|
|
16
|
+
group: 'glasses',
|
|
17
|
+
values: options.glassesColor,
|
|
18
|
+
}),
|
|
19
|
+
background: pickColor({
|
|
20
|
+
prng,
|
|
21
|
+
group: 'skin',
|
|
22
|
+
values: options.backgroundColor,
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { Prng } from '@dicebear/core';
|
|
2
|
-
import type { Options } from '../
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
export
|
|
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,31 @@
|
|
|
1
|
+
import { pickComponent } from './pickComponent.js';
|
|
2
|
+
export function getComponents({ prng, options, }) {
|
|
3
|
+
const eyesComponent = pickComponent({
|
|
4
|
+
prng,
|
|
5
|
+
group: 'eyes',
|
|
6
|
+
values: options.eyes,
|
|
7
|
+
});
|
|
8
|
+
const eyebrowsComponent = pickComponent({
|
|
9
|
+
prng,
|
|
10
|
+
group: 'eyebrows',
|
|
11
|
+
values: options.eyebrows,
|
|
12
|
+
});
|
|
13
|
+
const mouthComponent = pickComponent({
|
|
14
|
+
prng,
|
|
15
|
+
group: 'mouth',
|
|
16
|
+
values: options.mouth,
|
|
17
|
+
});
|
|
18
|
+
const glassesComponent = pickComponent({
|
|
19
|
+
prng,
|
|
20
|
+
group: 'glasses',
|
|
21
|
+
values: options.glasses,
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
eyes: eyesComponent,
|
|
25
|
+
eyebrows: eyebrowsComponent,
|
|
26
|
+
mouth: mouthComponent,
|
|
27
|
+
glasses: prng.bool(options.glassesProbability)
|
|
28
|
+
? glassesComponent
|
|
29
|
+
: undefined,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Prng } from '@dicebear/core';
|
|
2
|
-
import type { ColorPick } from '../
|
|
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 {};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Prng } from '@dicebear/core';
|
|
2
|
-
import type { ComponentPick } from '../
|
|
3
|
-
declare type Props = {
|
|
4
|
-
prng: Prng;
|
|
5
|
-
group: string;
|
|
6
|
-
values?: string[];
|
|
7
|
-
};
|
|
8
|
-
export declare function pickComponent({ prng, group, values, }: Props): ComponentPick;
|
|
9
|
-
export {};
|
|
1
|
+
import type { Prng } from '@dicebear/core';
|
|
2
|
+
import type { ComponentPick } from '../types.js';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
prng: Prng;
|
|
5
|
+
group: string;
|
|
6
|
+
values?: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function pickComponent({ prng, group, values, }: Props): ComponentPick;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as components from '../components/index.js';
|
|
2
|
+
export function pickComponent({ prng, group, values = [], }) {
|
|
3
|
+
const componentCollection = components;
|
|
4
|
+
const key = prng.pick(values);
|
|
5
|
+
if (componentCollection[group][key]) {
|
|
6
|
+
return {
|
|
7
|
+
name: key,
|
|
8
|
+
value: componentCollection[group][key],
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dicebear/pixel-art-neutral",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.13",
|
|
4
4
|
"description": "Avatar style for DiceBear",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dicebear"
|
|
@@ -13,39 +13,36 @@
|
|
|
13
13
|
"url": "git+https://github.com/dicebear/dicebear.git"
|
|
14
14
|
},
|
|
15
15
|
"license": "MIT",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"browser": "dist/index.umd.js",
|
|
20
|
-
"types": "dist/index.d.ts",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"exports": "./lib/index.js",
|
|
18
|
+
"types": "./lib/index.d.ts",
|
|
21
19
|
"files": [
|
|
22
20
|
"LICENSE",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
21
|
+
"lib",
|
|
22
|
+
"README.md"
|
|
25
23
|
],
|
|
26
24
|
"scripts": {
|
|
27
|
-
"
|
|
25
|
+
"prebuild": "del-cli lib",
|
|
26
|
+
"build": "tsc",
|
|
28
27
|
"prepublishOnly": "npm run build",
|
|
29
|
-
"
|
|
30
|
-
"build": "dicebear-project build DiceBear.PixelArtNeutral"
|
|
28
|
+
"test": "uvu tests"
|
|
31
29
|
},
|
|
32
30
|
"devDependencies": {
|
|
33
|
-
"@dicebear/core": "^5.0.0-alpha.
|
|
31
|
+
"@dicebear/core": "^5.0.0-alpha.13",
|
|
34
32
|
"@tsconfig/recommended": "^1.0.0",
|
|
35
33
|
"@types/jest": "^26.0.22",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"shx": "^0.3.3",
|
|
40
|
-
"ts-jest": "^26.5.4",
|
|
41
|
-
"typescript": "^4.2.3",
|
|
42
|
-
"utility-types": "^3.10.0"
|
|
34
|
+
"del-cli": "^4.0.1",
|
|
35
|
+
"typescript": "^4.5.2",
|
|
36
|
+
"uvu": "^0.5.2"
|
|
43
37
|
},
|
|
44
38
|
"peerDependencies": {
|
|
45
|
-
"@dicebear/core": "^5.0.0-alpha.
|
|
39
|
+
"@dicebear/core": "^5.0.0-alpha.10"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
46
43
|
},
|
|
47
44
|
"publishConfig": {
|
|
48
45
|
"access": "public"
|
|
49
46
|
},
|
|
50
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "73f03408dec4386525493811f0f35b30509844ad"
|
|
51
48
|
}
|
package/dist/colors/glasses.d.ts
DELETED
package/dist/colors/hair.d.ts
DELETED
package/dist/colors/index.d.ts
DELETED
package/dist/colors/mouth.d.ts
DELETED
package/dist/colors/skin.d.ts
DELETED