@dicebear/micah 5.0.0-alpha.16 → 5.0.0-alpha.21
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/lib/colors/{eyebrow.d.ts → eyebrows.d.ts} +1 -1
- package/lib/colors/{eyebrow.js → eyebrows.js} +1 -1
- package/lib/colors/index.d.ts +1 -1
- package/lib/colors/index.js +1 -1
- package/lib/components/eyebrows.js +4 -4
- package/lib/core.js +2 -34
- package/lib/hooks/onPostCreate.d.ts +1 -2
- package/lib/hooks/onPostCreate.js +1 -1
- 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 +25 -11
- package/lib/types.d.ts +1 -1
- package/lib/utils/getColors.js +3 -3
- package/package.json +8 -9
- package/lib/meta/components.d.ts +0 -4
- package/lib/meta/components.js +0 -46
package/LICENSE
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ColorGroup } from '../types.js';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const eyebrows: ColorGroup;
|
package/lib/colors/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { base } from './base.js';
|
|
2
2
|
export { earring } from './earring.js';
|
|
3
3
|
export { eyeShadow } from './eyeShadow.js';
|
|
4
|
-
export {
|
|
4
|
+
export { eyebrows } from './eyebrows.js';
|
|
5
5
|
export { facialHair } from './facialHair.js';
|
|
6
6
|
export { glasses } from './glasses.js';
|
|
7
7
|
export { hair } from './hair.js';
|
package/lib/colors/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { base } from './base.js';
|
|
2
2
|
export { earring } from './earring.js';
|
|
3
3
|
export { eyeShadow } from './eyeShadow.js';
|
|
4
|
-
export {
|
|
4
|
+
export { eyebrows } from './eyebrows.js';
|
|
5
5
|
export { facialHair } from './facialHair.js';
|
|
6
6
|
export { glasses } from './glasses.js';
|
|
7
7
|
export { hair } from './hair.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const eyebrows = {
|
|
2
|
-
up: (components, colors) => `<path d="M99 10.21c5.67-2.66 19-5.1 27 6.5M23.58 35.52c2.07-5.9 9.68-17.12 23.56-14.7" stroke="${colors.
|
|
3
|
-
down: (components, colors) => `<path d="M27 26.5c6.17 2.5 21.1 3 31.5-15M94 4c5.17 5.33 18.1 12.8 28.5 0" stroke="${colors.
|
|
4
|
-
eyelashesUp: (components, colors) => `<path d="M99 10.21c5.67-2.66 19-5.1 27 6.5M23.58 35.52c2.07-5.9 9.68-17.12 23.56-14.7M26.07 29.46l-6.14-5.43M122.96 11.16l6.15-5.43M32.52 23.81l-4.04-7.13M115.51 7.51l4.05-7.13M40.6 20.2l-2.2-7.9M106.44 6.9l2.2-7.9" stroke="${colors.
|
|
5
|
-
eyelashesDown: (components, colors) => `<path d="M27 26.5c6.17 2.5 21.1 3 31.5-15M94 4c5.17 5.33 18.1 12.8 28.5 0M37.15 26.46 31 21.03M116.22 9.44l1.78-8M45.6 22.81l-4.05-7.13M108.14 9.02l.94-8.15M52.67 17.2l-2.2-7.9M100 8.03l-.78-8.16" stroke="${colors.
|
|
2
|
+
up: (components, colors) => `<path d="M99 10.21c5.67-2.66 19-5.1 27 6.5M23.58 35.52c2.07-5.9 9.68-17.12 23.56-14.7" stroke="${colors.eyebrows.value}" stroke-width="4" stroke-linecap="round"/>`,
|
|
3
|
+
down: (components, colors) => `<path d="M27 26.5c6.17 2.5 21.1 3 31.5-15M94 4c5.17 5.33 18.1 12.8 28.5 0" stroke="${colors.eyebrows.value}" stroke-width="4" stroke-linecap="round"/>`,
|
|
4
|
+
eyelashesUp: (components, colors) => `<path d="M99 10.21c5.67-2.66 19-5.1 27 6.5M23.58 35.52c2.07-5.9 9.68-17.12 23.56-14.7M26.07 29.46l-6.14-5.43M122.96 11.16l6.15-5.43M32.52 23.81l-4.04-7.13M115.51 7.51l4.05-7.13M40.6 20.2l-2.2-7.9M106.44 6.9l2.2-7.9" stroke="${colors.eyebrows.value}" stroke-width="4" stroke-linecap="round"/>`,
|
|
5
|
+
eyelashesDown: (components, colors) => `<path d="M27 26.5c6.17 2.5 21.1 3 31.5-15M94 4c5.17 5.33 18.1 12.8 28.5 0M37.15 26.46 31 21.03M116.22 9.44l1.78-8M45.6 22.81l-4.05-7.13M108.14 9.02l.94-8.15M52.67 17.2l-2.2-7.9M100 8.03l-.78-8.16" stroke="${colors.eyebrows.value}" stroke-width="4" stroke-linecap="round"/>`,
|
|
6
6
|
};
|
package/lib/core.js
CHANGED
|
@@ -3,7 +3,6 @@ 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: 'Avatar Illustration System',
|
|
@@ -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 360 360',
|
|
@@ -30,35 +29,4 @@ export const style = {
|
|
|
30
29
|
body: `<g transform="translate(80 23)">${(_b = (_a = components.base) === null || _a === void 0 ? void 0 : _a.value(components, colors)) !== null && _b !== void 0 ? _b : ''}</g><g transform="translate(170 183)">${(_d = (_c = components.mouth) === null || _c === void 0 ? void 0 : _c.value(components, colors)) !== null && _d !== void 0 ? _d : ''}</g><g transform="translate(110 102)">${(_f = (_e = components.eyebrows) === null || _e === void 0 ? void 0 : _e.value(components, colors)) !== null && _f !== void 0 ? _f : ''}</g><g transform="translate(49 11)">${(_h = (_g = components.hair) === null || _g === void 0 ? void 0 : _g.value(components, colors)) !== null && _h !== void 0 ? _h : ''}</g><g transform="translate(142 119)">${(_k = (_j = components.eyes) === null || _j === void 0 ? void 0 : _j.value(components, colors)) !== null && _k !== void 0 ? _k : ''}</g><g transform="rotate(-8 1149.44 -1186.92)">${(_m = (_l = components.nose) === null || _l === void 0 ? void 0 : _l.value(components, colors)) !== null && _m !== void 0 ? _m : ''}</g><g transform="translate(84 154)">${(_p = (_o = components.ears) === null || _o === void 0 ? void 0 : _o.value(components, colors)) !== null && _p !== void 0 ? _p : ''}</g><g transform="translate(53 272)">${(_r = (_q = components.shirt) === 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
|
// Ensure that the mouth remains visible. #132
|
|
3
3
|
if (components.facialHair && colors.facialHair.value === colors.mouth.value) {
|
|
4
4
|
colors.mouth.value = 'rgba(255, 255, 255, .2)';
|
|
@@ -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
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Micah (@dicebear/micah)
|
|
3
3
|
*
|
|
4
4
|
* Code licensed under MIT License.
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) 2022 Florian Körner
|
|
6
6
|
*
|
|
7
7
|
* Design "Avatar Illustration System" by Micah Lanier licensed under CC BY 4.0.
|
|
8
8
|
* Source: https://www.figma.com/community/file/829741575478342595
|
|
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
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Micah (@dicebear/micah)
|
|
3
3
|
*
|
|
4
4
|
* Code licensed under MIT License.
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) 2022 Florian Körner
|
|
6
6
|
*
|
|
7
7
|
* Design "Avatar Illustration System" by Micah Lanier licensed under CC BY 4.0.
|
|
8
8
|
* Source: https://www.figma.com/community/file/829741575478342595
|
|
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
|
@@ -109,13 +109,36 @@ export const schema = {
|
|
|
109
109
|
['white'],
|
|
110
110
|
],
|
|
111
111
|
},
|
|
112
|
-
|
|
112
|
+
eyebrows: {
|
|
113
|
+
type: 'array',
|
|
114
|
+
items: {
|
|
115
|
+
type: 'string',
|
|
116
|
+
enum: ['up', 'down', 'eyelashesUp', 'eyelashesDown'],
|
|
117
|
+
},
|
|
118
|
+
default: ['up', 'down', 'eyelashesUp', 'eyelashesDown'],
|
|
119
|
+
examples: [['up'], ['down'], ['eyelashesUp'], ['eyelashesDown']],
|
|
120
|
+
},
|
|
121
|
+
eyebrowsColor: {
|
|
113
122
|
type: 'array',
|
|
114
123
|
items: {
|
|
115
124
|
type: 'string',
|
|
116
125
|
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})$',
|
|
117
126
|
},
|
|
118
|
-
default: [
|
|
127
|
+
default: [
|
|
128
|
+
'apricot',
|
|
129
|
+
'azure',
|
|
130
|
+
'black',
|
|
131
|
+
'calm',
|
|
132
|
+
'canary',
|
|
133
|
+
'coast',
|
|
134
|
+
'lavender',
|
|
135
|
+
'mellow',
|
|
136
|
+
'salmon',
|
|
137
|
+
'seashell',
|
|
138
|
+
'sky',
|
|
139
|
+
'topaz',
|
|
140
|
+
'white',
|
|
141
|
+
],
|
|
119
142
|
examples: [
|
|
120
143
|
['apricot'],
|
|
121
144
|
['azure'],
|
|
@@ -132,15 +155,6 @@ export const schema = {
|
|
|
132
155
|
['white'],
|
|
133
156
|
],
|
|
134
157
|
},
|
|
135
|
-
eyebrows: {
|
|
136
|
-
type: 'array',
|
|
137
|
-
items: {
|
|
138
|
-
type: 'string',
|
|
139
|
-
enum: ['up', 'down', 'eyelashesUp', 'eyelashesDown'],
|
|
140
|
-
},
|
|
141
|
-
default: ['up', 'down', 'eyelashesUp', 'eyelashesDown'],
|
|
142
|
-
examples: [['up'], ['down'], ['eyelashesUp'], ['eyelashesDown']],
|
|
143
|
-
},
|
|
144
158
|
eyes: {
|
|
145
159
|
type: 'array',
|
|
146
160
|
items: {
|
package/lib/types.d.ts
CHANGED
package/lib/utils/getColors.js
CHANGED
|
@@ -16,10 +16,10 @@ export function getColors({ prng, options }) {
|
|
|
16
16
|
group: 'eyeShadow',
|
|
17
17
|
values: options.eyeShadowColor,
|
|
18
18
|
}),
|
|
19
|
-
|
|
19
|
+
eyebrows: pickColor({
|
|
20
20
|
prng,
|
|
21
|
-
group: '
|
|
22
|
-
values: options.
|
|
21
|
+
group: 'eyebrows',
|
|
22
|
+
values: options.eyebrowsColor,
|
|
23
23
|
}),
|
|
24
24
|
facialHair: pickColor({
|
|
25
25
|
prng,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dicebear/micah",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.21",
|
|
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.21",
|
|
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": "40b7190a19ba3c6c355178f1ae6c422229634e06"
|
|
48
47
|
}
|
package/lib/meta/components.d.ts
DELETED
package/lib/meta/components.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export const dimensions = {
|
|
2
|
-
base: {
|
|
3
|
-
width: 200,
|
|
4
|
-
height: 320,
|
|
5
|
-
},
|
|
6
|
-
mouth: {
|
|
7
|
-
width: 64,
|
|
8
|
-
height: 64,
|
|
9
|
-
},
|
|
10
|
-
eyebrows: {
|
|
11
|
-
width: 149,
|
|
12
|
-
height: 48,
|
|
13
|
-
},
|
|
14
|
-
hair: {
|
|
15
|
-
width: 240,
|
|
16
|
-
height: 200,
|
|
17
|
-
},
|
|
18
|
-
eyes: {
|
|
19
|
-
width: 96,
|
|
20
|
-
height: 48,
|
|
21
|
-
},
|
|
22
|
-
nose: {
|
|
23
|
-
width: 32,
|
|
24
|
-
height: 40,
|
|
25
|
-
},
|
|
26
|
-
ears: {
|
|
27
|
-
width: 48,
|
|
28
|
-
height: 48,
|
|
29
|
-
},
|
|
30
|
-
shirt: {
|
|
31
|
-
width: 258,
|
|
32
|
-
height: 90.8974609375,
|
|
33
|
-
},
|
|
34
|
-
earrings: {
|
|
35
|
-
width: 48,
|
|
36
|
-
height: 48,
|
|
37
|
-
},
|
|
38
|
-
glasses: {
|
|
39
|
-
width: 150.5,
|
|
40
|
-
height: 65,
|
|
41
|
-
},
|
|
42
|
-
facialHair: {
|
|
43
|
-
width: 163.72164916992188,
|
|
44
|
-
height: 153.0578155517578,
|
|
45
|
-
},
|
|
46
|
-
};
|