@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Florian Körner
3
+ Copyright (c) 2022 Florian Körner
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,2 +1,2 @@
1
1
  import type { ColorGroup } from '../types.js';
2
- export declare const eyebrow: ColorGroup;
2
+ export declare const eyebrows: ColorGroup;
@@ -1,4 +1,4 @@
1
- export const eyebrow = {
1
+ export const eyebrows = {
2
2
  apricot: 'rgba(249, 201, 182, 1)',
3
3
  azure: 'rgba(210, 239, 243, 1)',
4
4
  black: 'rgba(0, 0, 0, 1)',
@@ -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 { eyebrow } from './eyebrow.js';
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,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 { eyebrow } from './eyebrow.js';
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.eyebrow.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.eyebrow.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.eyebrow.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.eyebrow.value}" stroke-width="4" stroke-linecap="round"/>`,
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, preview: false });
19
+ onPreCreate({ prng, options });
21
20
  const components = getComponents({ prng, options });
22
21
  const colors = getColors({ prng, options });
23
- onPostCreate({ prng, options, components, colors, preview: false });
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, preview, }: Props): void;
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, preview, }) {
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, preview }: Props): void;
7
+ export declare function onPreCreate({ prng, options }: Props): void;
9
8
  export {};
@@ -1,4 +1,4 @@
1
- export function onPreCreate({ prng, options, preview }) {
1
+ export function onPreCreate({ prng, options }) {
2
2
  var _a;
3
3
  // Prevent baseColor from being used a second time if possible.
4
4
  options.baseColor =
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) 2021 Florian Körner
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>, preview: import("@dicebear/core").StylePreview<import("./types.js").Options> | undefined, meta: import("@dicebear/core").StyleMeta, schema: import("json-schema").JSONSchema7;
12
- export { create, preview, meta, schema };
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) 2021 Florian Körner
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, preview, meta, schema } = style;
13
- export { create, preview, meta, schema };
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
- eyebrowColor: {
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: ['black'],
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
@@ -17,7 +17,7 @@ export interface Options {
17
17
  baseColor?: string[];
18
18
  earringColor?: string[];
19
19
  eyeShadowColor?: string[];
20
- eyebrowColor?: string[];
20
+ eyebrowsColor?: string[];
21
21
  facialHairColor?: string[];
22
22
  glassesColor?: string[];
23
23
  hairColor?: string[];
@@ -16,10 +16,10 @@ export function getColors({ prng, options }) {
16
16
  group: 'eyeShadow',
17
17
  values: options.eyeShadowColor,
18
18
  }),
19
- eyebrow: pickColor({
19
+ eyebrows: pickColor({
20
20
  prng,
21
- group: 'eyebrow',
22
- values: options.eyebrowColor,
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.16",
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.16",
32
- "@tsconfig/recommended": "^1.0.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.5.2",
36
- "uvu": "^0.5.2"
34
+ "typescript": "^4.6.3",
35
+ "uvu": "^0.5.3"
37
36
  },
38
37
  "peerDependencies": {
39
- "@dicebear/core": "^5.0.0-alpha.10"
38
+ "@dicebear/core": "^5.0.0-alpha.16"
40
39
  },
41
40
  "engines": {
42
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
41
+ "node": "^14.13.1 || >=16.0.0"
43
42
  },
44
43
  "publishConfig": {
45
44
  "access": "public"
46
45
  },
47
- "gitHead": "149a4a22c3a4d48dd5552bd22a49db0f853e0b5e"
46
+ "gitHead": "40b7190a19ba3c6c355178f1ae6c422229634e06"
48
47
  }
@@ -1,4 +0,0 @@
1
- export declare const dimensions: Record<string, {
2
- width: number;
3
- height: number;
4
- }>;
@@ -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
- };