@dicebear/shapes 9.2.2 → 9.2.4
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/components/shape1.js +7 -7
- package/lib/components/shape2.js +7 -7
- package/lib/components/shape3.js +7 -7
- package/lib/hooks/onPreCreate.d.ts +2 -2
- package/lib/index.js +1 -1
- package/lib/schema.js +181 -241
- package/lib/utils/getColors.js +3 -4
- package/lib/utils/getComponents.d.ts +1 -1
- package/lib/utils/getComponents.js +4 -5
- package/lib/utils/pickComponent.d.ts +1 -1
- package/lib/utils/pickComponent.js +2 -2
- package/package.json +6 -6
package/lib/components/shape1.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { escape } from '@dicebear/core';
|
|
8
8
|
export const shape1 = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
rectangle: (components, colors) => `<path fill-rule="evenodd" clip-rule="evenodd" d="M90 10H10v80h80V10ZM0 0v100h100V0H0Z" fill="${escape.xml(`${colors.shape1}`)}"/>`,
|
|
10
|
+
rectangleFilled: (components, colors) => `<path d="M0 0h100v100H0V0Z" fill="${escape.xml(`${colors.shape1}`)}"/>`,
|
|
11
|
+
ellipseFilled: (components, colors) => `<path d="M100 50A50 50 0 1 1 0 50a50 50 0 0 1 100 0Z" fill="${escape.xml(`${colors.shape1}`)}"/>`,
|
|
12
|
+
ellipse: (components, colors) => `<path fill-rule="evenodd" clip-rule="evenodd" d="M50 90a40 40 0 1 0 0-80 40 40 0 0 0 0 80Zm0 10A50 50 0 1 0 50 0a50 50 0 0 0 0 100Z" fill="${escape.xml(`${colors.shape1}`)}"/>`,
|
|
13
|
+
polygonFilled: (components, colors) => `<path d="m50 7 50 86.6H0L50 7Z" fill="${escape.xml(`${colors.shape1}`)}"/>`,
|
|
14
|
+
polygon: (components, colors) => `<path fill-rule="evenodd" clip-rule="evenodd" d="M50 7 0 93.6h100L50 7Zm0 20L17.3 83.6h65.4L50 27Z" fill="${escape.xml(`${colors.shape1}`)}"/>`,
|
|
15
|
+
line: (components, colors) => `<path fill="${escape.xml(`${colors.shape1}`)}" d="M45-150h10v400H45z"/>`,
|
|
16
16
|
};
|
package/lib/components/shape2.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { escape } from '@dicebear/core';
|
|
8
8
|
export const shape2 = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
rectangle: (components, colors) => `<path fill-rule="evenodd" clip-rule="evenodd" d="M90 10H10v80h80V10ZM0 0v100h100V0H0Z" fill="${escape.xml(`${colors.shape2}`)}"/>`,
|
|
10
|
+
rectangleFilled: (components, colors) => `<path d="M0 0h100v100H0V0Z" fill="${escape.xml(`${colors.shape2}`)}"/>`,
|
|
11
|
+
ellipseFilled: (components, colors) => `<path d="M100 50A50 50 0 1 1 0 50a50 50 0 0 1 100 0Z" fill="${escape.xml(`${colors.shape2}`)}"/>`,
|
|
12
|
+
ellipse: (components, colors) => `<path fill-rule="evenodd" clip-rule="evenodd" d="M50 90a40 40 0 1 0 0-80 40 40 0 0 0 0 80Zm0 10A50 50 0 1 0 50 0a50 50 0 0 0 0 100Z" fill="${escape.xml(`${colors.shape2}`)}"/>`,
|
|
13
|
+
polygonFilled: (components, colors) => `<path d="m50 7 50 86.6H0L50 7Z" fill="${escape.xml(`${colors.shape2}`)}"/>`,
|
|
14
|
+
polygon: (components, colors) => `<path fill-rule="evenodd" clip-rule="evenodd" d="M50 7 0 93.6h100L50 7Zm0 20L17.3 83.6h65.4L50 27Z" fill="${escape.xml(`${colors.shape2}`)}"/>`,
|
|
15
|
+
line: (components, colors) => `<path fill="${escape.xml(`${colors.shape2}`)}" d="M45-150h10v400H45z"/>`,
|
|
16
16
|
};
|
package/lib/components/shape3.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { escape } from '@dicebear/core';
|
|
8
8
|
export const shape3 = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
rectangle: (components, colors) => `<path fill-rule="evenodd" clip-rule="evenodd" d="M90 10H10v80h80V10ZM0 0v100h100V0H0Z" fill="${escape.xml(`${colors.shape3}`)}"/>`,
|
|
10
|
+
rectangleFilled: (components, colors) => `<path d="M0 0h100v100H0V0Z" fill="${escape.xml(`${colors.shape3}`)}"/>`,
|
|
11
|
+
ellipseFilled: (components, colors) => `<path d="M100 50A50 50 0 1 1 0 50a50 50 0 0 1 100 0Z" fill="${escape.xml(`${colors.shape3}`)}"/>`,
|
|
12
|
+
ellipse: (components, colors) => `<path fill-rule="evenodd" clip-rule="evenodd" d="M50 90a40 40 0 1 0 0-80 40 40 0 0 0 0 80Zm0 10A50 50 0 1 0 50 0a50 50 0 0 0 0 100Z" fill="${escape.xml(`${colors.shape3}`)}"/>`,
|
|
13
|
+
polygonFilled: (components, colors) => `<path d="m50 7 50 86.6H0L50 7Z" fill="${escape.xml(`${colors.shape3}`)}"/>`,
|
|
14
|
+
polygon: (components, colors) => `<path fill-rule="evenodd" clip-rule="evenodd" d="M50 7 0 93.6h100L50 7Zm0 20L17.3 83.6h65.4L50 27Z" fill="${escape.xml(`${colors.shape3}`)}"/>`,
|
|
15
|
+
line: (components, colors) => `<path fill="${escape.xml(`${colors.shape3}`)}" d="M45-150h10v400H45z"/>`,
|
|
16
16
|
};
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Plugin: https://www.figma.com/community/plugin/1005765655729342787
|
|
5
5
|
* File: https://www.figma.com/file/bX8ZT8jK2fo5Uy8G6j2Qic
|
|
6
6
|
*/
|
|
7
|
-
import { Prng, StyleOptions } from
|
|
8
|
-
import { Options } from
|
|
7
|
+
import { Prng, StyleOptions } from '@dicebear/core';
|
|
8
|
+
import { Options } from '../types.js';
|
|
9
9
|
type Props = {
|
|
10
10
|
prng: Prng;
|
|
11
11
|
options: StyleOptions<Options>;
|
package/lib/index.js
CHANGED
|
@@ -26,7 +26,7 @@ export const create = ({ prng, options }) => {
|
|
|
26
26
|
attributes: {
|
|
27
27
|
viewBox: '0 0 100 100',
|
|
28
28
|
fill: 'none',
|
|
29
|
-
'shape-rendering': 'auto'
|
|
29
|
+
'shape-rendering': 'auto',
|
|
30
30
|
},
|
|
31
31
|
body: `<g transform="matrix(1.2 0 0 1.2 -10 -10)">${(_b = (_a = components.shape1) === null || _a === void 0 ? void 0 : _a.value(components, colors)) !== null && _b !== void 0 ? _b : ''}</g><g transform="matrix(.8 0 0 .8 10 10)">${(_d = (_c = components.shape2) === null || _c === void 0 ? void 0 : _c.value(components, colors)) !== null && _d !== void 0 ? _d : ''}</g><g transform="matrix(.4 0 0 .4 30 30)">${(_f = (_e = components.shape3) === null || _e === void 0 ? void 0 : _e.value(components, colors)) !== null && _f !== void 0 ? _f : ''}</g>`,
|
|
32
32
|
extra: () => ({
|
package/lib/schema.js
CHANGED
|
@@ -5,245 +5,185 @@
|
|
|
5
5
|
* File: https://www.figma.com/file/bX8ZT8jK2fo5Uy8G6j2Qic
|
|
6
6
|
*/
|
|
7
7
|
export const schema = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
-
|
|
155
|
-
|
|
156
|
-
]
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
"ellipse",
|
|
190
|
-
"polygonFilled",
|
|
191
|
-
"polygon",
|
|
192
|
-
"line"
|
|
193
|
-
]
|
|
194
|
-
},
|
|
195
|
-
"shape3Color": {
|
|
196
|
-
"type": "array",
|
|
197
|
-
"items": {
|
|
198
|
-
"type": "string",
|
|
199
|
-
"pattern": "^(transparent|[a-fA-F0-9]{6})$"
|
|
200
|
-
},
|
|
201
|
-
"default": [
|
|
202
|
-
"0a5b83",
|
|
203
|
-
"1c799f",
|
|
204
|
-
"69d2e7",
|
|
205
|
-
"f1f4dc",
|
|
206
|
-
"f88c49"
|
|
207
|
-
]
|
|
208
|
-
},
|
|
209
|
-
"shape3OffsetX": {
|
|
210
|
-
"type": "array",
|
|
211
|
-
"items": {
|
|
212
|
-
"type": "integer",
|
|
213
|
-
"minimum": -25,
|
|
214
|
-
"maximum": 25
|
|
215
|
-
},
|
|
216
|
-
"maxItems": 2,
|
|
217
|
-
"default": [
|
|
218
|
-
-25,
|
|
219
|
-
25
|
|
220
|
-
]
|
|
221
|
-
},
|
|
222
|
-
"shape3OffsetY": {
|
|
223
|
-
"type": "array",
|
|
224
|
-
"items": {
|
|
225
|
-
"type": "integer",
|
|
226
|
-
"minimum": -25,
|
|
227
|
-
"maximum": 25
|
|
228
|
-
},
|
|
229
|
-
"maxItems": 2,
|
|
230
|
-
"default": [
|
|
231
|
-
-25,
|
|
232
|
-
25
|
|
233
|
-
]
|
|
234
|
-
},
|
|
235
|
-
"shape3Rotation": {
|
|
236
|
-
"type": "array",
|
|
237
|
-
"items": {
|
|
238
|
-
"type": "integer",
|
|
239
|
-
"minimum": -180,
|
|
240
|
-
"maximum": 180
|
|
241
|
-
},
|
|
242
|
-
"maxItems": 2,
|
|
243
|
-
"default": [
|
|
244
|
-
-180,
|
|
245
|
-
180
|
|
246
|
-
]
|
|
247
|
-
}
|
|
248
|
-
}
|
|
8
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
9
|
+
properties: {
|
|
10
|
+
backgroundColor: {
|
|
11
|
+
type: 'array',
|
|
12
|
+
items: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
pattern: '^(transparent|[a-fA-F0-9]{6})$',
|
|
15
|
+
},
|
|
16
|
+
default: ['0a5b83', '1c799f', '69d2e7', 'f1f4dc', 'f88c49'],
|
|
17
|
+
},
|
|
18
|
+
shape1: {
|
|
19
|
+
type: 'array',
|
|
20
|
+
items: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
enum: [
|
|
23
|
+
'rectangle',
|
|
24
|
+
'rectangleFilled',
|
|
25
|
+
'ellipseFilled',
|
|
26
|
+
'ellipse',
|
|
27
|
+
'polygonFilled',
|
|
28
|
+
'polygon',
|
|
29
|
+
'line',
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
default: ['rectangleFilled', 'ellipseFilled', 'polygonFilled'],
|
|
33
|
+
},
|
|
34
|
+
shape1Color: {
|
|
35
|
+
type: 'array',
|
|
36
|
+
items: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
pattern: '^(transparent|[a-fA-F0-9]{6})$',
|
|
39
|
+
},
|
|
40
|
+
default: ['0a5b83', '1c799f', '69d2e7', 'f1f4dc', 'f88c49'],
|
|
41
|
+
},
|
|
42
|
+
shape1OffsetX: {
|
|
43
|
+
type: 'array',
|
|
44
|
+
items: {
|
|
45
|
+
type: 'integer',
|
|
46
|
+
minimum: -65,
|
|
47
|
+
maximum: 65,
|
|
48
|
+
},
|
|
49
|
+
maxItems: 2,
|
|
50
|
+
default: [-65, 65],
|
|
51
|
+
},
|
|
52
|
+
shape1OffsetY: {
|
|
53
|
+
type: 'array',
|
|
54
|
+
items: {
|
|
55
|
+
type: 'integer',
|
|
56
|
+
minimum: -45,
|
|
57
|
+
maximum: 45,
|
|
58
|
+
},
|
|
59
|
+
maxItems: 2,
|
|
60
|
+
default: [-45, 45],
|
|
61
|
+
},
|
|
62
|
+
shape1Rotation: {
|
|
63
|
+
type: 'array',
|
|
64
|
+
items: {
|
|
65
|
+
type: 'integer',
|
|
66
|
+
minimum: -160,
|
|
67
|
+
maximum: 160,
|
|
68
|
+
},
|
|
69
|
+
maxItems: 2,
|
|
70
|
+
default: [-160, 160],
|
|
71
|
+
},
|
|
72
|
+
shape2: {
|
|
73
|
+
type: 'array',
|
|
74
|
+
items: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
enum: [
|
|
77
|
+
'rectangle',
|
|
78
|
+
'rectangleFilled',
|
|
79
|
+
'ellipseFilled',
|
|
80
|
+
'ellipse',
|
|
81
|
+
'polygonFilled',
|
|
82
|
+
'polygon',
|
|
83
|
+
'line',
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
default: ['rectangleFilled', 'ellipseFilled', 'polygonFilled', 'line'],
|
|
87
|
+
},
|
|
88
|
+
shape2Color: {
|
|
89
|
+
type: 'array',
|
|
90
|
+
items: {
|
|
91
|
+
type: 'string',
|
|
92
|
+
pattern: '^(transparent|[a-fA-F0-9]{6})$',
|
|
93
|
+
},
|
|
94
|
+
default: ['0a5b83', '1c799f', '69d2e7', 'f1f4dc', 'f88c49'],
|
|
95
|
+
},
|
|
96
|
+
shape2OffsetX: {
|
|
97
|
+
type: 'array',
|
|
98
|
+
items: {
|
|
99
|
+
type: 'integer',
|
|
100
|
+
minimum: -40,
|
|
101
|
+
maximum: 40,
|
|
102
|
+
},
|
|
103
|
+
maxItems: 2,
|
|
104
|
+
default: [-40, 40],
|
|
105
|
+
},
|
|
106
|
+
shape2OffsetY: {
|
|
107
|
+
type: 'array',
|
|
108
|
+
items: {
|
|
109
|
+
type: 'integer',
|
|
110
|
+
minimum: -40,
|
|
111
|
+
maximum: 40,
|
|
112
|
+
},
|
|
113
|
+
maxItems: 2,
|
|
114
|
+
default: [-40, 40],
|
|
115
|
+
},
|
|
116
|
+
shape2Rotation: {
|
|
117
|
+
type: 'array',
|
|
118
|
+
items: {
|
|
119
|
+
type: 'integer',
|
|
120
|
+
minimum: -180,
|
|
121
|
+
maximum: 180,
|
|
122
|
+
},
|
|
123
|
+
maxItems: 2,
|
|
124
|
+
default: [-180, 180],
|
|
125
|
+
},
|
|
126
|
+
shape3: {
|
|
127
|
+
type: 'array',
|
|
128
|
+
items: {
|
|
129
|
+
type: 'string',
|
|
130
|
+
enum: [
|
|
131
|
+
'rectangle',
|
|
132
|
+
'rectangleFilled',
|
|
133
|
+
'ellipseFilled',
|
|
134
|
+
'ellipse',
|
|
135
|
+
'polygonFilled',
|
|
136
|
+
'polygon',
|
|
137
|
+
'line',
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
default: [
|
|
141
|
+
'rectangle',
|
|
142
|
+
'rectangleFilled',
|
|
143
|
+
'ellipseFilled',
|
|
144
|
+
'ellipse',
|
|
145
|
+
'polygonFilled',
|
|
146
|
+
'polygon',
|
|
147
|
+
'line',
|
|
148
|
+
],
|
|
149
|
+
},
|
|
150
|
+
shape3Color: {
|
|
151
|
+
type: 'array',
|
|
152
|
+
items: {
|
|
153
|
+
type: 'string',
|
|
154
|
+
pattern: '^(transparent|[a-fA-F0-9]{6})$',
|
|
155
|
+
},
|
|
156
|
+
default: ['0a5b83', '1c799f', '69d2e7', 'f1f4dc', 'f88c49'],
|
|
157
|
+
},
|
|
158
|
+
shape3OffsetX: {
|
|
159
|
+
type: 'array',
|
|
160
|
+
items: {
|
|
161
|
+
type: 'integer',
|
|
162
|
+
minimum: -25,
|
|
163
|
+
maximum: 25,
|
|
164
|
+
},
|
|
165
|
+
maxItems: 2,
|
|
166
|
+
default: [-25, 25],
|
|
167
|
+
},
|
|
168
|
+
shape3OffsetY: {
|
|
169
|
+
type: 'array',
|
|
170
|
+
items: {
|
|
171
|
+
type: 'integer',
|
|
172
|
+
minimum: -25,
|
|
173
|
+
maximum: 25,
|
|
174
|
+
},
|
|
175
|
+
maxItems: 2,
|
|
176
|
+
default: [-25, 25],
|
|
177
|
+
},
|
|
178
|
+
shape3Rotation: {
|
|
179
|
+
type: 'array',
|
|
180
|
+
items: {
|
|
181
|
+
type: 'integer',
|
|
182
|
+
minimum: -180,
|
|
183
|
+
maximum: 180,
|
|
184
|
+
},
|
|
185
|
+
maxItems: 2,
|
|
186
|
+
default: [-180, 180],
|
|
187
|
+
},
|
|
188
|
+
},
|
|
249
189
|
};
|
package/lib/utils/getColors.js
CHANGED
|
@@ -8,9 +8,8 @@ import { convertColor } from './convertColor.js';
|
|
|
8
8
|
export function getColors({ prng, options }) {
|
|
9
9
|
var _a, _b, _c;
|
|
10
10
|
return {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
shape1: convertColor(prng.pick((_a = options.shape1Color) !== null && _a !== void 0 ? _a : [], 'transparent')),
|
|
12
|
+
shape2: convertColor(prng.pick((_b = options.shape2Color) !== null && _b !== void 0 ? _b : [], 'transparent')),
|
|
13
|
+
shape3: convertColor(prng.pick((_c = options.shape3Color) !== null && _c !== void 0 ? _c : [], 'transparent')),
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* File: https://www.figma.com/file/bX8ZT8jK2fo5Uy8G6j2Qic
|
|
6
6
|
*/
|
|
7
7
|
import { pickComponent } from './pickComponent.js';
|
|
8
|
-
export function getComponents({ prng, options }) {
|
|
8
|
+
export function getComponents({ prng, options, }) {
|
|
9
9
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
10
10
|
const shape1Component = pickComponent({
|
|
11
11
|
prng,
|
|
@@ -38,9 +38,8 @@ export function getComponents({ prng, options }) {
|
|
|
38
38
|
offsetY: ((_j = options.shape3OffsetY) === null || _j === void 0 ? void 0 : _j.length) ? options.shape3OffsetY : [0],
|
|
39
39
|
});
|
|
40
40
|
return {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
shape1: shape1Component,
|
|
42
|
+
shape2: shape2Component,
|
|
43
|
+
shape3: shape3Component,
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
;
|
|
@@ -16,5 +16,5 @@ type Props = {
|
|
|
16
16
|
offsetX: number[];
|
|
17
17
|
offsetY: number[];
|
|
18
18
|
};
|
|
19
|
-
export declare function pickComponent({ prng, group, width, height, values, rotation, offsetX, offsetY }: Props): ComponentPick;
|
|
19
|
+
export declare function pickComponent({ prng, group, width, height, values, rotation, offsetX, offsetY, }: Props): ComponentPick;
|
|
20
20
|
export {};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* File: https://www.figma.com/file/bX8ZT8jK2fo5Uy8G6j2Qic
|
|
6
6
|
*/
|
|
7
7
|
import * as components from '../components/index.js';
|
|
8
|
-
export function pickComponent({ prng, group, width, height, values = [], rotation, offsetX, offsetY }) {
|
|
8
|
+
export function pickComponent({ prng, group, width, height, values = [], rotation, offsetX, offsetY, }) {
|
|
9
9
|
const componentCollection = components;
|
|
10
10
|
const key = prng.pick(values);
|
|
11
11
|
const pickedRotation = prng.integer(Math.min(...rotation), Math.max(...rotation));
|
|
@@ -18,7 +18,7 @@ export function pickComponent({ prng, group, width, height, values = [], rotatio
|
|
|
18
18
|
var _a, _b, _c;
|
|
19
19
|
let result = componentCollection[group][key](components, colors);
|
|
20
20
|
if (this.rotation || this.offsetX || this.offsetY) {
|
|
21
|
-
result = `<g transform="translate(${(
|
|
21
|
+
result = `<g transform="translate(${(_a = this.offsetX) !== null && _a !== void 0 ? _a : 0}, ${(_b = this.offsetY) !== null && _b !== void 0 ? _b : 0}) rotate(${(_c = this.rotation) !== null && _c !== void 0 ? _c : 0} ${width / 2} ${height / 2})">${result}</g>`;
|
|
22
22
|
}
|
|
23
23
|
return result;
|
|
24
24
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dicebear/shapes",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.4",
|
|
4
4
|
"description": "Avatar style for DiceBear",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dicebear"
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"test": "uvu tests"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@dicebear/core": "9.2.
|
|
33
|
-
"@tsconfig/recommended": "^1.0.
|
|
34
|
-
"del-cli": "^
|
|
35
|
-
"typescript": "^5.
|
|
32
|
+
"@dicebear/core": "9.2.4",
|
|
33
|
+
"@tsconfig/recommended": "^1.0.10",
|
|
34
|
+
"del-cli": "^6.0.0",
|
|
35
|
+
"typescript": "^5.8.3",
|
|
36
36
|
"uvu": "^0.5.6"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "b19e1a8e417d6cdaffbc46ca6dee3522bb266b29"
|
|
48
48
|
}
|