@dicebear/adventurer 5.0.0-alpha.15 → 5.0.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/components/features.js +1 -0
- package/lib/core.js +3 -35
- package/lib/hooks/onPostCreate.d.ts +1 -2
- package/lib/hooks/onPostCreate.js +2 -3
- package/lib/hooks/onPreCreate.d.ts +1 -2
- package/lib/hooks/onPreCreate.js +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +3 -3
- package/lib/schema.js +6 -3
- package/lib/types.d.ts +1 -1
- package/package.json +8 -9
- package/lib/meta/components.d.ts +0 -4
- package/lib/meta/components.js +0 -34
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<h1 align="center"><img src="./tests/svg/0.svg" width="124" /> <br />Adventurer</h1>
|
|
2
2
|
<p align="center">
|
|
3
3
|
<strong>Avatar Style for <a href="https://dicebear.com/">DiceBear</a></strong><br />
|
|
4
|
-
<a href="https://www.instagram.com/
|
|
4
|
+
<a href="https://www.instagram.com/lischi_art/">Adventurer</a>
|
|
5
5
|
by Lisa Wischofsky
|
|
6
6
|
</p>
|
|
7
7
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const features = {
|
|
2
|
+
mustache: (components, colors) => `<path d="M489.1 525.9c6.3 4.7 7.6 15 14 20s14.5 7.3 22.2 3.6c1 1.3 2.3 2.3 1.3 4.1-4 7-11.2 10.4-18.7 12.5a40.6 40.6 0 0 1-29.4-2.6c-6.3-3.5-9.9-9.1-14.4-14.5a59.5 59.5 0 0 1-20.4 18.8c-5.8 3-13.3 5-19.8 3.3-6.3-1.8-12-6.1-12.2-13.1-.2-2.4 1.2-2.7 3.1-3.1 1.3 1.3 2.3 2.7 4.2 3 3.5.7 7-1.2 9.1-3.8 5.4-6.4 4.5-17 10.4-22.6 6.2-5.9 16.9-8.1 24.5-4 7.7-5.2 18-6.9 26.1-1.6Z" fill="#000"/>`,
|
|
2
3
|
blush: (components, colors) => `<path d="M630.4 552.4a40.8 40.8 0 0 1 39.5 66.6 40.8 40.8 0 1 1-39.6-66.6ZM373.1 564.9a37.7 37.7 0 0 1 3 61.5 213 213 0 0 1-35-43.6c-3.3-5.9-6.7-11.2-8.8-17.6a38 38 0 0 1 40.8-.3Z" fill="#CA8D87"/>`,
|
|
3
4
|
birthmark: (components, colors) => `<path d="M604.4 568.4c4-2.4 9.4 0 11 4.2 1.8 4.4-1.8 9.9-6.5 10.2a7.8 7.8 0 0 1-8-4.8 7.8 7.8 0 0 1 3.5-9.6Z" fill="#000"/>`,
|
|
4
5
|
freckles: (components, colors) => `<path d="M611.4 569.4c4.5-2.8 10.3 1.4 8.7 6.6-1.2 4.5-7.3 5.3-10 1.9a6 6 0 0 1 1.3-8.5ZM337.1 571c2.3-1.3 5.7-.6 7.4 1.4 3 3 1 9.6-3.6 9.3-2.1-1.8-3.5-4.4-4.6-7-.6-1.6-.8-2.6.8-3.7ZM650.5 571.6c1.3-.7 3-.5 4.4-.3 3.4.8 5.4 5.1 3.5 8.2-1.6 2.9-5.1 4-8 2.2-3.9-2.2-3.7-8 0-10.1ZM372.2 574.1c4-2.2 9.5 1.2 8.7 5.9-.4 4.7-6.1 6.3-9.5 3.6-3-2.5-2.5-7.4.8-9.5ZM632.5 591.6c4.2-1.5 8.9 1.8 8 6.4-.7 5-7.1 6.3-10.1 2.6-2.6-3-1.3-7.3 2.1-9ZM358 593.8c3.7.4 6.4 4.5 4.8 8-1.2 2.5-3.3 3-5.8 3.8-1.6-2.2-3.7-4.3-4.9-6.8-.8-3.2 3-5.6 6-5Z" fill="#7A624E"/>`,
|
package/lib/core.js
CHANGED
|
@@ -3,12 +3,11 @@ import { getComponents } from './utils/getComponents.js';
|
|
|
3
3
|
import { getColors } from './utils/getColors.js';
|
|
4
4
|
import { onPreCreate } from './hooks/onPreCreate.js';
|
|
5
5
|
import { onPostCreate } from './hooks/onPostCreate.js';
|
|
6
|
-
import { dimensions } from './meta/components.js';
|
|
7
6
|
export const style = {
|
|
8
7
|
meta: {
|
|
9
8
|
title: 'Adventurer',
|
|
10
9
|
creator: 'Lisa Wischofsky',
|
|
11
|
-
source: 'https://www.instagram.com/
|
|
10
|
+
source: 'https://www.instagram.com/lischi_art/',
|
|
12
11
|
license: {
|
|
13
12
|
name: 'CC BY 4.0',
|
|
14
13
|
url: 'https://creativecommons.org/licenses/by/4.0/',
|
|
@@ -17,10 +16,10 @@ export const style = {
|
|
|
17
16
|
schema: schema,
|
|
18
17
|
create: ({ prng, options }) => {
|
|
19
18
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
20
|
-
onPreCreate({ prng, options
|
|
19
|
+
onPreCreate({ prng, options });
|
|
21
20
|
const components = getComponents({ prng, options });
|
|
22
21
|
const colors = getColors({ prng, options });
|
|
23
|
-
onPostCreate({ prng, options, components, colors
|
|
22
|
+
onPostCreate({ prng, options, components, colors });
|
|
24
23
|
return {
|
|
25
24
|
attributes: {
|
|
26
25
|
viewBox: '0 0 762 762',
|
|
@@ -30,35 +29,4 @@ export const style = {
|
|
|
30
29
|
body: `${(_b = (_a = components.base) === null || _a === void 0 ? void 0 : _a.value(components, colors)) !== null && _b !== void 0 ? _b : ''}<g transform="translate(-161 -83)">${(_d = (_c = components.eyes) === null || _c === void 0 ? void 0 : _c.value(components, colors)) !== null && _d !== void 0 ? _d : ''}</g><g transform="translate(-161 -83)">${(_f = (_e = components.eyebrows) === null || _e === void 0 ? void 0 : _e.value(components, colors)) !== null && _f !== void 0 ? _f : ''}</g><g transform="translate(-161 -83)">${(_h = (_g = components.mouth) === null || _g === void 0 ? void 0 : _g.value(components, colors)) !== null && _h !== void 0 ? _h : ''}</g><g transform="translate(-161 -83)">${(_k = (_j = components.features) === null || _j === void 0 ? void 0 : _j.value(components, colors)) !== null && _k !== void 0 ? _k : ''}</g><g transform="translate(-161 -83)">${(_m = (_l = components.glasses) === null || _l === void 0 ? void 0 : _l.value(components, colors)) !== null && _m !== void 0 ? _m : ''}</g><g transform="translate(-161 -83)">${(_p = (_o = components.hair) === null || _o === void 0 ? void 0 : _o.value(components, colors)) !== null && _p !== void 0 ? _p : ''}</g><g transform="translate(-161 -83)">${(_r = (_q = components.earrings) === null || _q === void 0 ? void 0 : _q.value(components, colors)) !== null && _r !== void 0 ? _r : ''}</g>`,
|
|
31
30
|
};
|
|
32
31
|
},
|
|
33
|
-
preview: ({ prng, options, property }) => {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
const componentGroup = property.toString();
|
|
36
|
-
const colorGroup = property.toString().replace(/Color$/, '');
|
|
37
|
-
onPreCreate({ prng, options, preview: true });
|
|
38
|
-
const components = getComponents({ prng, options });
|
|
39
|
-
const colors = getColors({ prng, options });
|
|
40
|
-
onPostCreate({ prng, options, components, colors, preview: true });
|
|
41
|
-
if (componentGroup in components) {
|
|
42
|
-
const { width, height } = dimensions[componentGroup];
|
|
43
|
-
return {
|
|
44
|
-
attributes: {
|
|
45
|
-
viewBox: `0 0 ${width} ${height}`,
|
|
46
|
-
fill: 'none',
|
|
47
|
-
'shape-rendering': 'auto',
|
|
48
|
-
},
|
|
49
|
-
body: (_b = (_a = components[componentGroup]) === null || _a === void 0 ? void 0 : _a.value(components, colors)) !== null && _b !== void 0 ? _b : '',
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
if (colorGroup in colors) {
|
|
53
|
-
return {
|
|
54
|
-
attributes: {
|
|
55
|
-
viewBox: `0 0 1 1`,
|
|
56
|
-
fill: 'none',
|
|
57
|
-
'shape-rendering': 'auto',
|
|
58
|
-
},
|
|
59
|
-
body: `<rect width="1" height="1" fill="${colors[colorGroup].value}" />`,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
return undefined;
|
|
63
|
-
},
|
|
64
32
|
};
|
|
@@ -5,7 +5,6 @@ declare type Props = {
|
|
|
5
5
|
options: StyleOptions<Options>;
|
|
6
6
|
components: ComponentPickCollection;
|
|
7
7
|
colors: ColorPickCollection;
|
|
8
|
-
preview: boolean;
|
|
9
8
|
};
|
|
10
|
-
export declare function onPostCreate({ prng, options, components, colors
|
|
9
|
+
export declare function onPostCreate({ prng, options, components, colors }: Props): void;
|
|
11
10
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function onPostCreate({ prng, options, components, colors
|
|
1
|
+
export function onPostCreate({ prng, options, components, colors }) {
|
|
2
2
|
var _a;
|
|
3
3
|
const invisibleEarringsHair = [
|
|
4
4
|
'long01',
|
|
@@ -10,8 +10,7 @@ export function onPostCreate({ prng, options, components, colors, preview, }) {
|
|
|
10
10
|
'long24',
|
|
11
11
|
'long26',
|
|
12
12
|
];
|
|
13
|
-
if (
|
|
14
|
-
((_a = components.hair) === null || _a === void 0 ? void 0 : _a.name) &&
|
|
13
|
+
if (((_a = components.hair) === null || _a === void 0 ? void 0 : _a.name) &&
|
|
15
14
|
invisibleEarringsHair.includes(components.hair.name)) {
|
|
16
15
|
components.earrings = undefined;
|
|
17
16
|
}
|
|
@@ -3,7 +3,6 @@ import { Options } from '../types.js';
|
|
|
3
3
|
declare type Props = {
|
|
4
4
|
prng: Prng;
|
|
5
5
|
options: StyleOptions<Options>;
|
|
6
|
-
preview: boolean;
|
|
7
6
|
};
|
|
8
|
-
export declare function onPreCreate({ prng, options
|
|
7
|
+
export declare function onPreCreate({ prng, options }: Props): void;
|
|
9
8
|
export {};
|
package/lib/hooks/onPreCreate.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* Copyright (c) 2022 Florian Körner
|
|
6
6
|
*
|
|
7
7
|
* Design "Adventurer" by Lisa Wischofsky licensed under CC BY 4.0.
|
|
8
|
-
* Source: https://www.instagram.com/
|
|
8
|
+
* Source: https://www.instagram.com/lischi_art/
|
|
9
9
|
* License: https://creativecommons.org/licenses/by/4.0/
|
|
10
10
|
*/
|
|
11
|
-
declare const create: import("@dicebear/core").StyleCreate<import("./types.js").Options>,
|
|
12
|
-
export { create,
|
|
11
|
+
declare const create: import("@dicebear/core").StyleCreate<import("./types.js").Options>, meta: import("@dicebear/core").StyleMeta, schema: import("json-schema").JSONSchema7;
|
|
12
|
+
export { create, meta, schema };
|
|
13
13
|
export type { Options } from './types.js';
|
package/lib/index.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* Copyright (c) 2022 Florian Körner
|
|
6
6
|
*
|
|
7
7
|
* Design "Adventurer" by Lisa Wischofsky licensed under CC BY 4.0.
|
|
8
|
-
* Source: https://www.instagram.com/
|
|
8
|
+
* Source: https://www.instagram.com/lischi_art/
|
|
9
9
|
* License: https://creativecommons.org/licenses/by/4.0/
|
|
10
10
|
*/
|
|
11
11
|
import { style } from './core.js';
|
|
12
|
-
const { create,
|
|
13
|
-
export { create,
|
|
12
|
+
const { create, meta, schema } = style;
|
|
13
|
+
export { create, meta, schema };
|
package/lib/schema.js
CHANGED
|
@@ -193,9 +193,12 @@ export const schema = {
|
|
|
193
193
|
},
|
|
194
194
|
features: {
|
|
195
195
|
type: 'array',
|
|
196
|
-
items: {
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
items: {
|
|
197
|
+
type: 'string',
|
|
198
|
+
enum: ['mustache', 'blush', 'birthmark', 'freckles'],
|
|
199
|
+
},
|
|
200
|
+
default: ['mustache', 'blush', 'birthmark', 'freckles'],
|
|
201
|
+
examples: [['mustache'], ['blush'], ['birthmark'], ['freckles']],
|
|
199
202
|
},
|
|
200
203
|
featuresProbability: {
|
|
201
204
|
type: 'integer',
|
package/lib/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface Options {
|
|
|
3
3
|
eyes?: ('variant26' | 'variant25' | 'variant24' | 'variant23' | 'variant22' | 'variant21' | 'variant20' | 'variant19' | 'variant18' | 'variant17' | 'variant16' | 'variant15' | 'variant14' | 'variant13' | 'variant12' | 'variant11' | 'variant10' | 'variant09' | 'variant08' | 'variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01')[];
|
|
4
4
|
eyebrows?: ('variant10' | 'variant09' | 'variant08' | 'variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01' | 'variant15' | 'variant14' | 'variant13' | 'variant12' | 'variant11')[];
|
|
5
5
|
mouth?: ('variant30' | 'variant29' | 'variant28' | 'variant27' | 'variant26' | 'variant25' | 'variant24' | 'variant23' | 'variant22' | 'variant21' | 'variant20' | 'variant19' | 'variant18' | 'variant17' | 'variant16' | 'variant15' | 'variant14' | 'variant13' | 'variant12' | 'variant11' | 'variant10' | 'variant09' | 'variant08' | 'variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01')[];
|
|
6
|
-
features?: ('blush' | 'birthmark' | 'freckles')[];
|
|
6
|
+
features?: ('mustache' | 'blush' | 'birthmark' | 'freckles')[];
|
|
7
7
|
featuresProbability?: number;
|
|
8
8
|
glasses?: ('variant01' | 'variant02' | 'variant03' | 'variant04' | 'variant05')[];
|
|
9
9
|
glassesProbability?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dicebear/adventurer",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.20",
|
|
4
4
|
"description": "Avatar style for DiceBear",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dicebear"
|
|
@@ -28,21 +28,20 @@
|
|
|
28
28
|
"test": "uvu tests"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@dicebear/core": "^5.0.0-alpha.
|
|
32
|
-
"@tsconfig/recommended": "^1.0.
|
|
33
|
-
"@types/jest": "^26.0.22",
|
|
31
|
+
"@dicebear/core": "^5.0.0-alpha.20",
|
|
32
|
+
"@tsconfig/recommended": "^1.0.1",
|
|
34
33
|
"del-cli": "^4.0.1",
|
|
35
|
-
"typescript": "^4.
|
|
36
|
-
"uvu": "^0.5.
|
|
34
|
+
"typescript": "^4.6.3",
|
|
35
|
+
"uvu": "^0.5.3"
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
|
39
|
-
"@dicebear/core": "^5.0.0-alpha.
|
|
38
|
+
"@dicebear/core": "^5.0.0-alpha.16"
|
|
40
39
|
},
|
|
41
40
|
"engines": {
|
|
42
|
-
"node": "^
|
|
41
|
+
"node": "^14.13.1 || >=16.0.0"
|
|
43
42
|
},
|
|
44
43
|
"publishConfig": {
|
|
45
44
|
"access": "public"
|
|
46
45
|
},
|
|
47
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "6b1c2bd64294365be21d0a133a362ede5ed62b5a"
|
|
48
47
|
}
|
package/lib/meta/components.d.ts
DELETED
package/lib/meta/components.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const dimensions = {
|
|
2
|
-
base: {
|
|
3
|
-
width: 762,
|
|
4
|
-
height: 762,
|
|
5
|
-
},
|
|
6
|
-
eyes: {
|
|
7
|
-
width: 1024,
|
|
8
|
-
height: 1024,
|
|
9
|
-
},
|
|
10
|
-
eyebrows: {
|
|
11
|
-
width: 1024,
|
|
12
|
-
height: 1024,
|
|
13
|
-
},
|
|
14
|
-
mouth: {
|
|
15
|
-
width: 1024,
|
|
16
|
-
height: 1024,
|
|
17
|
-
},
|
|
18
|
-
features: {
|
|
19
|
-
width: 1024,
|
|
20
|
-
height: 1024,
|
|
21
|
-
},
|
|
22
|
-
glasses: {
|
|
23
|
-
width: 1024,
|
|
24
|
-
height: 1024,
|
|
25
|
-
},
|
|
26
|
-
hair: {
|
|
27
|
-
width: 1024,
|
|
28
|
-
height: 1024,
|
|
29
|
-
},
|
|
30
|
-
earrings: {
|
|
31
|
-
width: 1024,
|
|
32
|
-
height: 1024,
|
|
33
|
-
},
|
|
34
|
-
};
|