@dicebear/core 5.0.0-alpha.8 → 5.0.0-beta.0
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 -1
- package/README.md +1 -1
- package/lib/core.d.ts +2 -0
- package/lib/core.js +50 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +11 -0
- package/lib/schema.d.ts +2 -0
- package/lib/schema.js +58 -0
- package/lib/types.d.ts +63 -0
- package/lib/types.js +1 -0
- package/lib/utils/escape.d.ts +1 -0
- package/lib/utils/escape.js +8 -0
- package/lib/utils/license.d.ts +3 -0
- package/lib/utils/license.js +60 -0
- package/lib/utils/options.d.ts +3 -0
- package/lib/utils/options.js +34 -0
- package/lib/utils/prng.d.ts +2 -0
- package/lib/utils/prng.js +42 -0
- package/lib/utils/svg.d.ts +15 -0
- package/lib/utils/svg.js +69 -0
- package/package.json +19 -28
- package/dist/index.d.ts +0 -73
- package/dist/index.d.ts.map +0 -1
- package/dist/index.es.js +0 -361
- package/dist/index.es.js.map +0 -1
- package/dist/index.js +0 -368
- package/dist/index.js.map +0 -1
package/dist/index.es.js
DELETED
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
function $parcel$interopDefault(a) {
|
|
2
|
-
return a && a.__esModule ? a.default : a;
|
|
3
|
-
}
|
|
4
|
-
var $1cbc10b9b964be85$exports = {};
|
|
5
|
-
$1cbc10b9b964be85$exports = JSON.parse("{\"type\":\"object\",\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"title\":\"Options\",\"properties\":{\"seed\":{\"type\":\"string\"},\"dataUri\":{\"type\":\"boolean\",\"default\":false},\"flip\":{\"type\":\"boolean\",\"default\":false},\"rotate\":{\"type\":\"integer\",\"minimum\":0,\"maximum\":360,\"default\":0},\"scale\":{\"type\":\"integer\",\"minimum\":0,\"maximum\":200,\"default\":100},\"radius\":{\"type\":\"integer\",\"minimum\":0,\"maximum\":50,\"default\":0},\"size\":{\"type\":\"integer\",\"minimum\":1},\"backgroundColor\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"string\",\"pattern\":\"^#([a-fA-F0-9]{3}|[a-fA-F0-9]{4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$\"},{\"type\":\"string\",\"pattern\":\"^[0-9a-zA-Z]+$\"}]}},\"translateX\":{\"type\":\"integer\",\"minimum\":-100,\"maximum\":100,\"default\":0},\"translateY\":{\"type\":\"integer\",\"minimum\":-100,\"maximum\":100,\"default\":0},\"clip\":{\"type\":\"boolean\",\"default\":true}},\"additionalProperties\":false}");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function $b60b4211d37b9c99$export$f2913fe8983302e(attr) {
|
|
9
|
-
return attr.replace(/&/g, '&').replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const $0fa42aafa2b0e524$var$ccLicenses = {
|
|
14
|
-
by: {
|
|
15
|
-
permits: [
|
|
16
|
-
'Reproduction',
|
|
17
|
-
'Distribution',
|
|
18
|
-
'DerivativeWorks'
|
|
19
|
-
],
|
|
20
|
-
requires: [
|
|
21
|
-
'Notice',
|
|
22
|
-
'Attribution'
|
|
23
|
-
],
|
|
24
|
-
prohibits: []
|
|
25
|
-
},
|
|
26
|
-
'by-sa': {
|
|
27
|
-
permits: [
|
|
28
|
-
'Reproduction',
|
|
29
|
-
'Distribution',
|
|
30
|
-
'DerivativeWorks'
|
|
31
|
-
],
|
|
32
|
-
requires: [
|
|
33
|
-
'Notice',
|
|
34
|
-
'Attribution',
|
|
35
|
-
'ShareAlike'
|
|
36
|
-
],
|
|
37
|
-
prohibits: []
|
|
38
|
-
},
|
|
39
|
-
'by-nd': {
|
|
40
|
-
permits: [
|
|
41
|
-
'Reproduction',
|
|
42
|
-
'Distribution'
|
|
43
|
-
],
|
|
44
|
-
requires: [
|
|
45
|
-
'Notice',
|
|
46
|
-
'Attribution'
|
|
47
|
-
],
|
|
48
|
-
prohibits: []
|
|
49
|
-
},
|
|
50
|
-
'by-nc': {
|
|
51
|
-
permits: [
|
|
52
|
-
'Reproduction',
|
|
53
|
-
'Distribution',
|
|
54
|
-
'DerivativeWorks'
|
|
55
|
-
],
|
|
56
|
-
requires: [
|
|
57
|
-
'Notice',
|
|
58
|
-
'Attribution'
|
|
59
|
-
],
|
|
60
|
-
prohibits: [
|
|
61
|
-
'CommercialUse'
|
|
62
|
-
]
|
|
63
|
-
},
|
|
64
|
-
'by-nc-sa': {
|
|
65
|
-
permits: [
|
|
66
|
-
'Reproduction',
|
|
67
|
-
'Distribution',
|
|
68
|
-
'DerivativeWorks'
|
|
69
|
-
],
|
|
70
|
-
requires: [
|
|
71
|
-
'Notice',
|
|
72
|
-
'Attribution',
|
|
73
|
-
'ShareAlike'
|
|
74
|
-
],
|
|
75
|
-
prohibits: [
|
|
76
|
-
'CommercialUse'
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
'by-nc-nd': {
|
|
80
|
-
permits: [
|
|
81
|
-
'Reproduction',
|
|
82
|
-
'Distribution'
|
|
83
|
-
],
|
|
84
|
-
requires: [
|
|
85
|
-
'Notice',
|
|
86
|
-
'Attribution'
|
|
87
|
-
],
|
|
88
|
-
prohibits: [
|
|
89
|
-
'CommercialUse'
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
zero: {
|
|
93
|
-
permits: [
|
|
94
|
-
'Reproduction',
|
|
95
|
-
'Distribution',
|
|
96
|
-
'DerivativeWorks'
|
|
97
|
-
],
|
|
98
|
-
requires: [],
|
|
99
|
-
prohibits: []
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
function $0fa42aafa2b0e524$export$856f728536d122cb({ children: children , x: x , y: y }) {
|
|
103
|
-
return `<g transform="translate(${x}, ${y})">${children}</g>`;
|
|
104
|
-
}
|
|
105
|
-
function $0fa42aafa2b0e524$export$ab2b4d38813484ba() {
|
|
106
|
-
return {
|
|
107
|
-
'xmlns:dc': 'http://purl.org/dc/elements/1.1/',
|
|
108
|
-
'xmlns:cc': 'http://creativecommons.org/ns#',
|
|
109
|
-
'xmlns:rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|
|
110
|
-
'xmlns:svg': 'http://www.w3.org/2000/svg',
|
|
111
|
-
xmlns: 'http://www.w3.org/2000/svg'
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function $0fa42aafa2b0e524$export$8548546c0aa631e6(style) {
|
|
115
|
-
return `<metadata>` + `<rdf:RDF>` + `<cc:Work>` + `<dc:format>image/svg+xml</dc:format>` + `<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />` + `${$0fa42aafa2b0e524$export$9c003c8b6f6e1a83(style)}` + `${$0fa42aafa2b0e524$export$a23db5a46c5fdace(style)}` + `${$0fa42aafa2b0e524$export$eda3c259c5f3ed1e(style)}` + `${$0fa42aafa2b0e524$export$ee256ae11fb8e0f6(style)}` + `${$0fa42aafa2b0e524$export$deeb094c24418a39(style)}` + `</cc:Work>` + `${$0fa42aafa2b0e524$export$9e4d659818e08107(style)}` + `</rdf:RDF>` + `</metadata>`;
|
|
116
|
-
}
|
|
117
|
-
function $0fa42aafa2b0e524$export$9c003c8b6f6e1a83(style) {
|
|
118
|
-
if (style.meta.title) return `<dc:title>${style.meta.title}</dc:title>`;
|
|
119
|
-
return '';
|
|
120
|
-
}
|
|
121
|
-
function $0fa42aafa2b0e524$export$a23db5a46c5fdace(style) {
|
|
122
|
-
if (style.meta.creator) {
|
|
123
|
-
let creators = Array.isArray(style.meta.creator) ? style.meta.creator : [
|
|
124
|
-
style.meta.creator
|
|
125
|
-
];
|
|
126
|
-
return `<dc:creator>${$0fa42aafa2b0e524$export$cb60788f9ae66e61(creators)}</dc:creator>`;
|
|
127
|
-
}
|
|
128
|
-
return '';
|
|
129
|
-
}
|
|
130
|
-
function $0fa42aafa2b0e524$export$eda3c259c5f3ed1e(style) {
|
|
131
|
-
if (style.meta.source) return `<dc:source>${style.meta.source}</dc:source>`;
|
|
132
|
-
return '';
|
|
133
|
-
}
|
|
134
|
-
function $0fa42aafa2b0e524$export$ee256ae11fb8e0f6(style) {
|
|
135
|
-
if (style.meta.license) return `<cc:license rdf:resource="${style.meta.license.url}" />`;
|
|
136
|
-
return '';
|
|
137
|
-
}
|
|
138
|
-
function $0fa42aafa2b0e524$export$deeb094c24418a39(style) {
|
|
139
|
-
if (style.meta.contributor) {
|
|
140
|
-
let contributors = Array.isArray(style.meta.contributor) ? style.meta.contributor : [
|
|
141
|
-
style.meta.contributor
|
|
142
|
-
];
|
|
143
|
-
return `<dc:contributor>${$0fa42aafa2b0e524$export$cb60788f9ae66e61(contributors)}</dc:contributor>`;
|
|
144
|
-
}
|
|
145
|
-
return '';
|
|
146
|
-
}
|
|
147
|
-
function $0fa42aafa2b0e524$export$cb60788f9ae66e61(agents) {
|
|
148
|
-
return agents.map((agent)=>`<cc:Agent><dc:title>${agent}</dc:title></cc:Agent>`
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
function $0fa42aafa2b0e524$export$9e4d659818e08107(style) {
|
|
152
|
-
var ref;
|
|
153
|
-
let match = (ref = style.meta.license) === null || ref === void 0 ? void 0 : ref.url.match(/^https?:\/\/creativecommons.org\/(?:licenses|publicdomain)\/([a-z\-]+)\/\d.\d\//);
|
|
154
|
-
if (match) {
|
|
155
|
-
let license = $0fa42aafa2b0e524$var$ccLicenses[match[1]];
|
|
156
|
-
if (license) {
|
|
157
|
-
var ref1;
|
|
158
|
-
let result = ``;
|
|
159
|
-
license.permits.forEach((permits)=>{
|
|
160
|
-
result += `<cc:permits rdf:resource="https://creativecommons.org/ns#${permits}" />`;
|
|
161
|
-
});
|
|
162
|
-
license.requires.forEach((requires)=>{
|
|
163
|
-
result += `<cc:requires rdf:resource="https://creativecommons.org/ns#${requires}" />`;
|
|
164
|
-
});
|
|
165
|
-
license.prohibits.forEach((prohibits)=>{
|
|
166
|
-
result += `<cc:prohibits rdf:resource="https://creativecommons.org/ns#${prohibits}" />`;
|
|
167
|
-
});
|
|
168
|
-
return `<cc:License rdf:about="${(ref1 = style.meta.license) === null || ref1 === void 0 ? void 0 : ref1.url}">${result}</cc:License>`;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return '';
|
|
172
|
-
}
|
|
173
|
-
function $0fa42aafa2b0e524$export$d2a32b662cec697e(result) {
|
|
174
|
-
let viewBox = result.attributes['viewBox'].split(' ');
|
|
175
|
-
let x = parseInt(viewBox[0]);
|
|
176
|
-
let y = parseInt(viewBox[1]);
|
|
177
|
-
let width = parseInt(viewBox[2]);
|
|
178
|
-
let height = parseInt(viewBox[3]);
|
|
179
|
-
return {
|
|
180
|
-
x: x,
|
|
181
|
-
y: y,
|
|
182
|
-
width: width,
|
|
183
|
-
height: height
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function $0fa42aafa2b0e524$export$e0ba6f7f8209085e(result, backgroundColor) {
|
|
187
|
-
let { width: width , height: height , x: x , y: y } = $0fa42aafa2b0e524$export$d2a32b662cec697e(result);
|
|
188
|
-
return `<rect fill="${backgroundColor}" width="${width}" height="${height}" x="${x}" y="${y}" />${result.body}`;
|
|
189
|
-
}
|
|
190
|
-
function $0fa42aafa2b0e524$export$c834547aca49957b(result, scale) {
|
|
191
|
-
let { width: width , height: height , x: x , y: y } = $0fa42aafa2b0e524$export$d2a32b662cec697e(result);
|
|
192
|
-
let percent = scale ? (scale - 100) / 100 : 0;
|
|
193
|
-
let translateX = (width / 2 + x) * percent * -1;
|
|
194
|
-
let translateY = (height / 2 + y) * percent * -1;
|
|
195
|
-
return `<g transform="translate(${translateX} ${translateY}) scale(${scale / 100})">${result.body}</g>`;
|
|
196
|
-
}
|
|
197
|
-
function $0fa42aafa2b0e524$export$d6f5f87d27cbbe0f(result, x, y) {
|
|
198
|
-
let viewBox = $0fa42aafa2b0e524$export$d2a32b662cec697e(result);
|
|
199
|
-
let translateX = (viewBox.width + viewBox.x * 2) * ((x !== null && x !== void 0 ? x : 0) / 100);
|
|
200
|
-
let translateY = (viewBox.height + viewBox.y * 2) * ((y !== null && y !== void 0 ? y : 0) / 100);
|
|
201
|
-
return `<g transform="translate(${translateX} ${translateY})">${result.body}</g>`;
|
|
202
|
-
}
|
|
203
|
-
function $0fa42aafa2b0e524$export$38df2acdbfbce309(result, rotate) {
|
|
204
|
-
let { width: width , height: height , x: x , y: y } = $0fa42aafa2b0e524$export$d2a32b662cec697e(result);
|
|
205
|
-
return `<g transform="rotate(${rotate}, ${width / 2 + x}, ${height / 2 + y})">${result.body}</g>`;
|
|
206
|
-
}
|
|
207
|
-
function $0fa42aafa2b0e524$export$90015ee4a3937667(result) {
|
|
208
|
-
let { width: width , x: x } = $0fa42aafa2b0e524$export$d2a32b662cec697e(result);
|
|
209
|
-
return `<g transform="scale(-1 1) translate(${width * -1 - x * 2} 0)">${result.body}</g>`;
|
|
210
|
-
}
|
|
211
|
-
function $0fa42aafa2b0e524$export$e3f2409025136fe9(result, radius) {
|
|
212
|
-
let { width: width , height: height , x: x , y: y } = $0fa42aafa2b0e524$export$d2a32b662cec697e(result);
|
|
213
|
-
let rx = radius ? width * radius / 100 : 0;
|
|
214
|
-
let ry = radius ? height * radius / 100 : 0;
|
|
215
|
-
return `<mask id="viewboxMask">` + `<rect width="${width}" height="${height}" rx="${rx}" ry="${ry}" x="${x}" y="${y}" fill="#fff" />` + `</mask>` + `<g mask="url(#viewboxMask)">${result.body}</g>`;
|
|
216
|
-
}
|
|
217
|
-
function $0fa42aafa2b0e524$export$d29d121524f3ec8b(attributes) {
|
|
218
|
-
attributes = {
|
|
219
|
-
...$0fa42aafa2b0e524$export$ab2b4d38813484ba(),
|
|
220
|
-
...attributes
|
|
221
|
-
};
|
|
222
|
-
return Object.keys(attributes).map((attr)=>`${$b60b4211d37b9c99$export$f2913fe8983302e(attr)}="${$b60b4211d37b9c99$export$f2913fe8983302e(attributes[attr])}"`
|
|
223
|
-
).join(' ');
|
|
224
|
-
}
|
|
225
|
-
function $0fa42aafa2b0e524$export$9237c576b9b6deae(svg) {
|
|
226
|
-
return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
function $7dace9bad3da5937$export$3cb21709c4058847(schema) {
|
|
232
|
-
var _properties;
|
|
233
|
-
return (_properties = schema.properties) !== null && _properties !== void 0 ? _properties : {
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
function $7dace9bad3da5937$export$ebe90cb607ad99e(schema) {
|
|
237
|
-
let result = {
|
|
238
|
-
};
|
|
239
|
-
let props = $7dace9bad3da5937$export$3cb21709c4058847(schema);
|
|
240
|
-
Object.keys(props).forEach((key)=>{
|
|
241
|
-
let val = props[key];
|
|
242
|
-
if (typeof val === 'object' && undefined !== val.default) result[key] = val.default;
|
|
243
|
-
});
|
|
244
|
-
return result;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
function $a9764362d26b4a5c$export$4950aa0f605343fb(style, options) {
|
|
249
|
-
let result = {
|
|
250
|
-
seed: Math.random().toString(),
|
|
251
|
-
...$7dace9bad3da5937$export$ebe90cb607ad99e((/*@__PURE__*/$parcel$interopDefault($1cbc10b9b964be85$exports))),
|
|
252
|
-
...$7dace9bad3da5937$export$ebe90cb607ad99e(style.schema),
|
|
253
|
-
...options
|
|
254
|
-
};
|
|
255
|
-
return result;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
const $b3a7fceeb7192ab0$var$MIN = -2147483648;
|
|
260
|
-
const $b3a7fceeb7192ab0$var$MAX = 2147483647;
|
|
261
|
-
function $b3a7fceeb7192ab0$var$xorshift(value) {
|
|
262
|
-
value ^= value << 13;
|
|
263
|
-
value ^= value >> 17;
|
|
264
|
-
value ^= value << 5;
|
|
265
|
-
return value;
|
|
266
|
-
}
|
|
267
|
-
function $b3a7fceeb7192ab0$var$hashSeed(seed) {
|
|
268
|
-
let hash = 0;
|
|
269
|
-
for(let i = 0; i < seed.length; i++){
|
|
270
|
-
hash = (hash << 5) - hash + seed.charCodeAt(i) | 0;
|
|
271
|
-
hash = $b3a7fceeb7192ab0$var$xorshift(hash);
|
|
272
|
-
}
|
|
273
|
-
return hash;
|
|
274
|
-
}
|
|
275
|
-
function $b3a7fceeb7192ab0$var$randomSeed() {
|
|
276
|
-
return $b3a7fceeb7192ab0$var$MIN + Math.floor(($b3a7fceeb7192ab0$var$MAX - $b3a7fceeb7192ab0$var$MIN) * Math.random()).toString();
|
|
277
|
-
}
|
|
278
|
-
function $b3a7fceeb7192ab0$export$185802fd694ee1f5(seed) {
|
|
279
|
-
seed = seed !== null && seed !== void 0 ? seed : $b3a7fceeb7192ab0$var$randomSeed();
|
|
280
|
-
let value = $b3a7fceeb7192ab0$var$hashSeed(seed) || 1;
|
|
281
|
-
const next = ()=>value = $b3a7fceeb7192ab0$var$xorshift(value)
|
|
282
|
-
;
|
|
283
|
-
const integer = (min, max)=>{
|
|
284
|
-
return Math.floor((next() - $b3a7fceeb7192ab0$var$MIN) / ($b3a7fceeb7192ab0$var$MAX - $b3a7fceeb7192ab0$var$MIN) * (max + 1 - min) + min);
|
|
285
|
-
};
|
|
286
|
-
return {
|
|
287
|
-
seed: seed,
|
|
288
|
-
bool (likelihood = 50) {
|
|
289
|
-
return integer(0, 100) <= likelihood;
|
|
290
|
-
},
|
|
291
|
-
integer (min, max) {
|
|
292
|
-
return integer(min, max);
|
|
293
|
-
},
|
|
294
|
-
pick (arr) {
|
|
295
|
-
return arr[integer(0, arr.length - 1)];
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
function $3b3eaa6d45c31ec9$export$b595133eef38c254(style, options = {
|
|
303
|
-
}) {
|
|
304
|
-
options = $a9764362d26b4a5c$export$4950aa0f605343fb(style, options);
|
|
305
|
-
const prng = $b3a7fceeb7192ab0$export$185802fd694ee1f5(options.seed);
|
|
306
|
-
const result = style.create({
|
|
307
|
-
prng: prng,
|
|
308
|
-
options: options
|
|
309
|
-
});
|
|
310
|
-
var _backgroundColor;
|
|
311
|
-
const backgroundColor = prng.pick((_backgroundColor = options.backgroundColor) !== null && _backgroundColor !== void 0 ? _backgroundColor : []);
|
|
312
|
-
if (options.size) {
|
|
313
|
-
result.attributes.width = options.size.toString();
|
|
314
|
-
result.attributes.height = options.size.toString();
|
|
315
|
-
}
|
|
316
|
-
if (options.scale !== undefined && options.scale !== 100) result.body = $0fa42aafa2b0e524$export$c834547aca49957b(result, options.scale);
|
|
317
|
-
if (options.flip) result.body = $0fa42aafa2b0e524$export$90015ee4a3937667(result);
|
|
318
|
-
if (options.rotate) result.body = $0fa42aafa2b0e524$export$38df2acdbfbce309(result, options.rotate);
|
|
319
|
-
if (options.translateX || options.translateY) result.body = $0fa42aafa2b0e524$export$d6f5f87d27cbbe0f(result, options.translateX, options.translateY);
|
|
320
|
-
if (backgroundColor && backgroundColor !== 'transparent') result.body = $0fa42aafa2b0e524$export$e0ba6f7f8209085e(result, backgroundColor);
|
|
321
|
-
var _radius;
|
|
322
|
-
if (options.radius || options.clip) result.body = $0fa42aafa2b0e524$export$e3f2409025136fe9(result, (_radius = options.radius) !== null && _radius !== void 0 ? _radius : 0);
|
|
323
|
-
let avatar = `<svg ${$0fa42aafa2b0e524$export$d29d121524f3ec8b(result.attributes)}>` + `${$0fa42aafa2b0e524$export$8548546c0aa631e6(style)}` + `${result.body}` + `</svg>`;
|
|
324
|
-
return options.dataUri ? $0fa42aafa2b0e524$export$9237c576b9b6deae(avatar) : avatar;
|
|
325
|
-
}
|
|
326
|
-
function $3b3eaa6d45c31ec9$export$dd58ed3d8e4bd91(style, options, property) {
|
|
327
|
-
var ref;
|
|
328
|
-
options = $a9764362d26b4a5c$export$4950aa0f605343fb(style, options);
|
|
329
|
-
const prng = $b3a7fceeb7192ab0$export$185802fd694ee1f5(options.seed);
|
|
330
|
-
let result = (ref = style.preview) === null || ref === void 0 ? void 0 : ref.call(style, {
|
|
331
|
-
prng: prng,
|
|
332
|
-
options: options,
|
|
333
|
-
property: property
|
|
334
|
-
});
|
|
335
|
-
var _backgroundColor;
|
|
336
|
-
const backgroundColor = prng.pick((_backgroundColor = options.backgroundColor) !== null && _backgroundColor !== void 0 ? _backgroundColor : []);
|
|
337
|
-
const hasBackgroundColor = backgroundColor && backgroundColor !== 'transparent';
|
|
338
|
-
const isBackgroundVisible = property === 'backgroundColor';
|
|
339
|
-
if (undefined === result) {
|
|
340
|
-
if (hasBackgroundColor && isBackgroundVisible) result = {
|
|
341
|
-
attributes: {
|
|
342
|
-
viewBox: `0 0 1 1`,
|
|
343
|
-
fill: 'none',
|
|
344
|
-
'shape-rendering': 'auto'
|
|
345
|
-
},
|
|
346
|
-
body: ``
|
|
347
|
-
};
|
|
348
|
-
else return undefined;
|
|
349
|
-
}
|
|
350
|
-
if (hasBackgroundColor && isBackgroundVisible) result.body = $0fa42aafa2b0e524$export$e0ba6f7f8209085e(result, backgroundColor);
|
|
351
|
-
let avatar = `<svg ${$0fa42aafa2b0e524$export$d29d121524f3ec8b(result.attributes)}>` + `${$0fa42aafa2b0e524$export$8548546c0aa631e6(style)}` + `${result.body}` + `</svg>`;
|
|
352
|
-
return options.dataUri ? $0fa42aafa2b0e524$export$9237c576b9b6deae(avatar) : avatar;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const $77d7b25e5b8a700b$export$4902baddc787debb = (/*@__PURE__*/$parcel$interopDefault($1cbc10b9b964be85$exports));
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
export {$77d7b25e5b8a700b$export$4902baddc787debb as schema, $3b3eaa6d45c31ec9$export$b595133eef38c254 as createAvatar, $3b3eaa6d45c31ec9$export$dd58ed3d8e4bd91 as createPreview, $b3a7fceeb7192ab0$export$185802fd694ee1f5 as createPrng};
|
|
361
|
-
//# sourceMappingURL=index.es.js.map
|
package/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G,QAAQ,KAAK,CAAiB;IAE1D,EAAE,EAAE,SAAS,KAAK,MAAM,EAAE,CAAC;QACzB,EAAE,EAAE,kBAAkB,IAAI,mBAAmB,EAC3C,MAAM,GAAG,CAAC;YACR,UAAU,EAAE,CAAC;gBACX,OAAO,GAAG,OAAO;gBACjB,IAAI,EAAE,CAAM;gBACZ,CAAiB,kBAAE,CAAM;YAC3B,CAAC;YACD,IAAI;QACN,CAAC;aAED,MAAM,CAAC,SAAS;IAEpB,CAAC;IAED,EAAE,EAAE,kBAAkB,IAAI,mBAAmB,EAC3C,MAAM,CAAC,IAAI,GAAG,yCAA2B,CAAC,MAAM,EAAE,eAAe;IAGnE,GAAG,CAAC,MAAM,IACP,KAAK,EAAE,yCAAyB,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,OACnD,yCAAoB,CAAC,KAAK,SAC1B,MAAM,CAAC,IAAI,MACb,MAAM;IAET,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,yCAAgB,CAAC,MAAM,IAAI,MAAM;AAC5D,CAAC;;;;AFhFD,KAAK,CAAC,yCAAM,GAAG,gEAAa","sources":["packages/@dicebear/core/src/index.ts","packages/@dicebear/core/src/schema.json","packages/@dicebear/core/src/core.ts","packages/@dicebear/core/src/utils/svg.ts","packages/@dicebear/core/src/utils/escape.ts","packages/@dicebear/core/src/utils/options.ts","packages/@dicebear/core/src/utils/schema.ts","packages/@dicebear/core/src/utils/prng.ts"],"sourcesContent":["/*!\n * DiceBear (@dicebear/core)\n *\n * Code licensed under MIT (https://github.com/dicebear/dicebear/blob/main/LICENSE)\n * Copyright (c) 2021 Florian Körner\n */\n\n// parcel bug workaround\nimport type * as JSONSchema from 'json-schema';\n// import type { JSONSchema7 } from 'json-schema';\nimport untypedSchema from './schema.json';\n\nconst schema = untypedSchema as JSONSchema.JSONSchema7;\n\nexport { schema };\nexport { createAvatar, createPreview } from './core';\nexport { create as createPrng } from './utils/prng';\nexport type { Prng, Style, StyleOptions, StyleSchema } from './types';\n","{\n \"type\": \"object\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"title\": \"Options\",\n \"properties\": {\n \"seed\": {\n \"type\": \"string\"\n },\n \"dataUri\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"flip\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"rotate\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 360,\n \"default\": 0\n },\n \"scale\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 200,\n \"default\": 100\n },\n \"radius\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 50,\n \"default\": 0\n },\n \"size\": {\n \"type\": \"integer\",\n \"minimum\": 1\n },\n \"backgroundColor\": {\n \"type\": \"array\",\n \"items\": {\n \"anyOf\": [\n {\n \"type\": \"string\",\n \"pattern\": \"^#([a-fA-F0-9]{3}|[a-fA-F0-9]{4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$\"\n },\n {\n \"type\": \"string\",\n \"pattern\": \"^[0-9a-zA-Z]+$\"\n }\n ]\n }\n },\n \"translateX\": {\n \"type\": \"integer\",\n \"minimum\": -100,\n \"maximum\": 100,\n \"default\": 0\n },\n \"translateY\": {\n \"type\": \"integer\",\n \"minimum\": -100,\n \"maximum\": 100,\n \"default\": 0\n },\n \"clip\": {\n \"type\": \"boolean\",\n \"default\": true\n }\n },\n \"additionalProperties\": false\n}\n","import type { Style, StyleOptions } from './types';\nimport * as svgUtils from './utils/svg';\nimport { merge as mergeOptions } from './utils/options';\nimport { create as createPrng } from './utils/prng';\nimport { convertToDataUri } from './utils/svg';\n\nexport function createAvatar<O extends {}>(style: Style<O>, options: StyleOptions<O> = {}): string {\n options = mergeOptions(style, options);\n\n const prng = createPrng(options.seed);\n const result = style.create({ prng: prng, options });\n const backgroundColor = prng.pick(options.backgroundColor ?? []);\n\n if (options.size) {\n result.attributes.width = options.size.toString();\n result.attributes.height = options.size.toString();\n }\n\n if (options.scale !== undefined && options.scale !== 100) {\n result.body = svgUtils.addScale(result, options.scale);\n }\n\n if (options.flip) {\n result.body = svgUtils.addFlip(result);\n }\n\n if (options.rotate) {\n result.body = svgUtils.addRotate(result, options.rotate);\n }\n\n if (options.translateX || options.translateY) {\n result.body = svgUtils.addTranslate(result, options.translateX, options.translateY);\n }\n\n if (backgroundColor && backgroundColor !== 'transparent') {\n result.body = svgUtils.addBackgroundColor(result, backgroundColor);\n }\n\n if (options.radius || options.clip) {\n result.body = svgUtils.addViewboxMask(result, options.radius ?? 0);\n }\n\n let avatar =\n `<svg ${svgUtils.createAttrString(result.attributes)}>` +\n `${svgUtils.getMetadata(style)}` +\n `${result.body}` +\n `</svg>`;\n\n return options.dataUri ? convertToDataUri(avatar) : avatar;\n}\n\nexport function createPreview<O extends {}>(\n style: Style<O>,\n options: StyleOptions<O>,\n property: keyof StyleOptions<O>\n): string | undefined {\n options = mergeOptions(style, options);\n\n const prng = createPrng(options.seed);\n\n let result = style.preview?.({ prng, options, property });\n\n const backgroundColor = prng.pick(options.backgroundColor ?? []);\n const hasBackgroundColor = backgroundColor && backgroundColor !== 'transparent';\n const isBackgroundVisible = property === 'backgroundColor';\n\n if (undefined === result) {\n if (hasBackgroundColor && isBackgroundVisible) {\n result = {\n attributes: {\n viewBox: `0 0 1 1`,\n fill: 'none',\n 'shape-rendering': 'auto',\n },\n body: ``,\n };\n } else {\n return undefined;\n }\n }\n\n if (hasBackgroundColor && isBackgroundVisible) {\n result.body = svgUtils.addBackgroundColor(result, backgroundColor);\n }\n\n let avatar =\n `<svg ${svgUtils.createAttrString(result.attributes)}>` +\n `${svgUtils.getMetadata(style)}` +\n `${result.body}` +\n `</svg>`;\n\n return options.dataUri ? convertToDataUri(avatar) : avatar;\n}\n","import type { Options } from '../options';\nimport type { Style, StyleCreateResult, StyleCreateResultAttributes } from '../types';\nimport * as escape from './escape';\n\ntype CreateGroupProps = {\n children: string;\n x: number;\n y: number;\n};\n\nconst ccLicenses: Record<string, { permits: string[]; requires: string[]; prohibits: string[] }> = {\n by: {\n permits: ['Reproduction', 'Distribution', 'DerivativeWorks'],\n requires: ['Notice', 'Attribution'],\n prohibits: [],\n },\n 'by-sa': {\n permits: ['Reproduction', 'Distribution', 'DerivativeWorks'],\n requires: ['Notice', 'Attribution', 'ShareAlike'],\n prohibits: [],\n },\n 'by-nd': {\n permits: ['Reproduction', 'Distribution'],\n requires: ['Notice', 'Attribution'],\n prohibits: [],\n },\n 'by-nc': {\n permits: ['Reproduction', 'Distribution', 'DerivativeWorks'],\n requires: ['Notice', 'Attribution'],\n prohibits: ['CommercialUse'],\n },\n 'by-nc-sa': {\n permits: ['Reproduction', 'Distribution', 'DerivativeWorks'],\n requires: ['Notice', 'Attribution', 'ShareAlike'],\n prohibits: ['CommercialUse'],\n },\n 'by-nc-nd': {\n permits: ['Reproduction', 'Distribution'],\n requires: ['Notice', 'Attribution'],\n prohibits: ['CommercialUse'],\n },\n zero: {\n permits: ['Reproduction', 'Distribution', 'DerivativeWorks'],\n requires: [],\n prohibits: [],\n },\n};\n\nexport function createGroup({ children, x, y }: CreateGroupProps) {\n return `<g transform=\"translate(${x}, ${y})\">${children}</g>`;\n}\n\nexport function getXmlnsAttributes() {\n return {\n 'xmlns:dc': 'http://purl.org/dc/elements/1.1/',\n 'xmlns:cc': 'http://creativecommons.org/ns#',\n 'xmlns:rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n 'xmlns:svg': 'http://www.w3.org/2000/svg',\n xmlns: 'http://www.w3.org/2000/svg',\n };\n}\n\nexport function getMetadata<O extends Options>(style: Style<O>) {\n return (\n `<metadata>` +\n `<rdf:RDF>` +\n `<cc:Work>` +\n `<dc:format>image/svg+xml</dc:format>` +\n `<dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" />` +\n `${getMetadataWorkTitle(style)}` +\n `${getMetadataWorkCreator(style)}` +\n `${getMetadataWorkSource(style)}` +\n `${getMetadataWorkLicense(style)}` +\n `${getMetadataWorkContributor(style)}` +\n `</cc:Work>` +\n `${getMetadataLicense(style)}` +\n `</rdf:RDF>` +\n `</metadata>`\n );\n}\n\nexport function getMetadataWorkTitle<O extends Options>(style: Style<O>) {\n if (style.meta.title) {\n return `<dc:title>${style.meta.title}</dc:title>`;\n }\n\n return '';\n}\n\nexport function getMetadataWorkCreator<O extends Options>(style: Style<O>) {\n if (style.meta.creator) {\n let creators = Array.isArray(style.meta.creator) ? style.meta.creator : [style.meta.creator];\n\n return `<dc:creator>${getMetadataWorkAgents(creators)}</dc:creator>`;\n }\n\n return '';\n}\n\nexport function getMetadataWorkSource<O extends Options>(style: Style<O>) {\n if (style.meta.source) {\n return `<dc:source>${style.meta.source}</dc:source>`;\n }\n\n return '';\n}\n\nexport function getMetadataWorkLicense<O extends Options>(style: Style<O>) {\n if (style.meta.license) {\n return `<cc:license rdf:resource=\"${style.meta.license.url}\" />`;\n }\n\n return '';\n}\n\nexport function getMetadataWorkContributor<O extends Options>(style: Style<O>) {\n if (style.meta.contributor) {\n let contributors = Array.isArray(style.meta.contributor) ? style.meta.contributor : [style.meta.contributor];\n\n return `<dc:contributor>${getMetadataWorkAgents(contributors)}</dc:contributor>`;\n }\n\n return '';\n}\n\nexport function getMetadataWorkAgents(agents: string[]) {\n return agents.map((agent) => `<cc:Agent><dc:title>${agent}</dc:title></cc:Agent>`);\n}\n\nexport function getMetadataLicense<O extends Options>(style: Style<O>) {\n let match = style.meta.license?.url.match(\n /^https?:\\/\\/creativecommons.org\\/(?:licenses|publicdomain)\\/([a-z\\-]+)\\/\\d.\\d\\//\n );\n\n if (match) {\n let license = ccLicenses[match[1]];\n\n if (license) {\n let result = ``;\n\n license.permits.forEach((permits) => {\n result += `<cc:permits rdf:resource=\"https://creativecommons.org/ns#${permits}\" />`;\n });\n\n license.requires.forEach((requires) => {\n result += `<cc:requires rdf:resource=\"https://creativecommons.org/ns#${requires}\" />`;\n });\n\n license.prohibits.forEach((prohibits) => {\n result += `<cc:prohibits rdf:resource=\"https://creativecommons.org/ns#${prohibits}\" />`;\n });\n\n return `<cc:License rdf:about=\"${style.meta.license?.url}\">${result}</cc:License>`;\n }\n }\n\n return '';\n}\n\nexport function getViewBox(result: StyleCreateResult) {\n let viewBox = result.attributes['viewBox'].split(' ');\n let x = parseInt(viewBox[0]);\n let y = parseInt(viewBox[1]);\n let width = parseInt(viewBox[2]);\n let height = parseInt(viewBox[3]);\n\n return {\n x,\n y,\n width,\n height,\n };\n}\n\nexport function addBackgroundColor(result: StyleCreateResult, backgroundColor: string) {\n let { width, height, x, y } = getViewBox(result);\n\n return `<rect fill=\"${backgroundColor}\" width=\"${width}\" height=\"${height}\" x=\"${x}\" y=\"${y}\" />${result.body}`;\n}\n\nexport function addScale(result: StyleCreateResult, scale: number) {\n let { width, height, x, y } = getViewBox(result);\n\n let percent = scale ? (scale - 100) / 100 : 0;\n\n let translateX = (width / 2 + x) * percent * -1;\n let translateY = (height / 2 + y) * percent * -1;\n\n return `<g transform=\"translate(${translateX} ${translateY}) scale(${scale / 100})\">${result.body}</g>`;\n}\n\nexport function addTranslate(result: StyleCreateResult, x?: number, y?: number) {\n let viewBox = getViewBox(result);\n\n let translateX = (viewBox.width + viewBox.x * 2) * ((x ?? 0) / 100);\n let translateY = (viewBox.height + viewBox.y * 2) * ((y ?? 0) / 100);\n\n return `<g transform=\"translate(${translateX} ${translateY})\">${result.body}</g>`;\n}\n\nexport function addRotate(result: StyleCreateResult, rotate: number) {\n let { width, height, x, y } = getViewBox(result);\n\n return `<g transform=\"rotate(${rotate}, ${width / 2 + x}, ${height / 2 + y})\">${result.body}</g>`;\n}\n\nexport function addFlip(result: StyleCreateResult) {\n let { width, x } = getViewBox(result);\n\n return `<g transform=\"scale(-1 1) translate(${width * -1 - x * 2} 0)\">${result.body}</g>`;\n}\n\nexport function addViewboxMask(result: StyleCreateResult, radius: number) {\n let { width, height, x, y } = getViewBox(result);\n\n let rx = radius ? (width * radius) / 100 : 0;\n let ry = radius ? (height * radius) / 100 : 0;\n\n return (\n `<mask id=\"viewboxMask\">` +\n `<rect width=\"${width}\" height=\"${height}\" rx=\"${rx}\" ry=\"${ry}\" x=\"${x}\" y=\"${y}\" fill=\"#fff\" />` +\n `</mask>` +\n `<g mask=\"url(#viewboxMask)\">${result.body}</g>`\n );\n}\n\nexport function createAttrString(attributes: StyleCreateResultAttributes): string {\n attributes = { ...getXmlnsAttributes(), ...attributes };\n\n return Object.keys(attributes)\n .map((attr) => `${escape.xml(attr)}=\"${escape.xml(attributes[attr])}\"`)\n .join(' ');\n}\n\nexport function convertToDataUri(svg: string): string {\n return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;\n}\n","export function xml(attr: string) {\n return attr\n .replace(/&/g, '&')\n .replace(/'/g, ''')\n .replace(/\"/g, '"')\n .replace(/</g, '<')\n .replace(/>/g, '>');\n}\n","import type { Style, StyleOptions } from '../types';\nimport coreSchema from '../schema.json';\nimport * as schema from './schema';\nimport { JSONSchema7 } from 'json-schema';\n\nexport function merge<O extends {}>(style: Style<O>, options: StyleOptions<O>): StyleOptions<O> {\n let result: StyleOptions<O> = {\n ...{\n seed: Math.random().toString(),\n },\n ...(schema.defaults(coreSchema as JSONSchema7) as StyleOptions<O>),\n ...(schema.defaults(style.schema) as StyleOptions<O>),\n ...options,\n };\n\n return result;\n}\n","import { StyleSchema } from '../types';\n\nexport function properties(schema: StyleSchema) {\n return schema.properties ?? {};\n}\n\nexport function defaults(schema: StyleSchema) {\n let result: Record<string, unknown> = {};\n let props = properties(schema);\n\n Object.keys(props).forEach((key) => {\n let val = props[key];\n\n if (typeof val === 'object' && undefined !== val.default) {\n result[key] = val.default;\n }\n });\n\n return result;\n}\n","import type { Prng } from '../types';\n\nconst MIN = -2147483648;\nconst MAX = 2147483647;\n\nfunction xorshift(value: number) {\n value ^= value << 13;\n value ^= value >> 17;\n value ^= value << 5;\n\n return value;\n}\n\nfunction hashSeed(seed: string) {\n let hash = 0;\n\n for (let i = 0; i < seed.length; i++) {\n hash = ((hash << 5) - hash + seed.charCodeAt(i)) | 0;\n hash = xorshift(hash);\n }\n\n return hash;\n}\n\nfunction randomSeed() {\n return MIN + Math.floor((MAX - MIN) * Math.random()).toString();\n}\n\nexport function create(seed?: string): Prng {\n seed = seed ?? randomSeed();\n\n let value = hashSeed(seed) || 1;\n\n const next = () => (value = xorshift(value));\n\n const integer = (min: number, max: number) => {\n return Math.floor(((next() - MIN) / (MAX - MIN)) * (max + 1 - min) + min);\n };\n\n return {\n seed,\n bool(likelihood: number = 50) {\n return integer(0, 100) <= likelihood;\n },\n integer(min: number, max: number) {\n return integer(min, max);\n },\n pick<T>(arr: T[]): T {\n return arr[integer(0, arr.length - 1)];\n },\n };\n}\n"],"names":[],"version":3,"file":"index.es.js.map"}
|