@dicebear/micah 5.0.0-alpha.2 → 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.
Files changed (99) hide show
  1. package/LICENSE +1 -1
  2. package/lib/colors/base.d.ts +2 -0
  3. package/lib/colors/base.js +15 -0
  4. package/lib/colors/earring.d.ts +2 -0
  5. package/lib/colors/earring.js +15 -0
  6. package/lib/colors/eyeShadow.d.ts +2 -0
  7. package/lib/colors/eyeShadow.js +15 -0
  8. package/lib/colors/eyebrows.d.ts +2 -0
  9. package/lib/colors/eyebrows.js +15 -0
  10. package/lib/colors/eyes.d.ts +2 -0
  11. package/lib/colors/eyes.js +15 -0
  12. package/lib/colors/facialHair.d.ts +2 -0
  13. package/lib/colors/facialHair.js +15 -0
  14. package/lib/colors/glasses.d.ts +2 -0
  15. package/lib/colors/glasses.js +15 -0
  16. package/lib/colors/hair.d.ts +2 -0
  17. package/lib/colors/hair.js +15 -0
  18. package/lib/colors/index.d.ts +10 -0
  19. package/lib/colors/index.js +10 -0
  20. package/lib/colors/mouth.d.ts +2 -0
  21. package/lib/colors/mouth.js +3 -0
  22. package/lib/colors/shirt.d.ts +2 -0
  23. package/lib/colors/shirt.js +15 -0
  24. package/lib/components/base.d.ts +2 -0
  25. package/lib/components/base.js +6 -0
  26. package/lib/components/earrings.d.ts +2 -0
  27. package/lib/components/earrings.js +4 -0
  28. package/lib/components/ears.d.ts +2 -0
  29. package/lib/components/ears.js +10 -0
  30. package/lib/components/eyebrows.d.ts +2 -0
  31. package/lib/components/eyebrows.js +6 -0
  32. package/lib/components/eyes.d.ts +2 -0
  33. package/lib/components/eyes.js +18 -0
  34. package/lib/components/facialHair.d.ts +2 -0
  35. package/lib/components/facialHair.js +4 -0
  36. package/lib/components/glasses.d.ts +2 -0
  37. package/lib/components/glasses.js +4 -0
  38. package/lib/components/hair.d.ts +2 -0
  39. package/lib/components/hair.js +10 -0
  40. package/lib/components/index.d.ts +11 -0
  41. package/lib/components/index.js +11 -0
  42. package/lib/components/mouth.d.ts +2 -0
  43. package/lib/components/mouth.js +10 -0
  44. package/lib/components/nose.d.ts +2 -0
  45. package/lib/components/nose.js +5 -0
  46. package/lib/components/shirt.d.ts +2 -0
  47. package/lib/components/shirt.js +5 -0
  48. package/{dist → lib}/core.d.ts +3 -3
  49. package/lib/core.js +32 -0
  50. package/{dist → lib}/hooks/onPostCreate.d.ts +10 -12
  51. package/lib/hooks/onPostCreate.js +6 -0
  52. package/lib/hooks/onPreCreate.d.ts +8 -0
  53. package/lib/hooks/onPreCreate.js +26 -0
  54. package/lib/index.d.ts +13 -0
  55. package/lib/index.js +13 -0
  56. package/lib/schema.d.ts +2 -0
  57. package/lib/schema.js +449 -0
  58. package/lib/types.d.ts +43 -0
  59. package/lib/types.js +1 -0
  60. package/{dist → lib}/utils/getColors.d.ts +8 -9
  61. package/lib/utils/getColors.js +55 -0
  62. package/{dist → lib}/utils/getComponents.d.ts +8 -9
  63. package/lib/utils/getComponents.js +77 -0
  64. package/{dist → lib}/utils/pickColor.d.ts +9 -9
  65. package/lib/utils/pickColor.js +13 -0
  66. package/{dist → lib}/utils/pickComponent.d.ts +9 -9
  67. package/lib/utils/pickComponent.js +14 -0
  68. package/package.json +19 -23
  69. package/dist/colors/base.d.ts +0 -2
  70. package/dist/colors/earring.d.ts +0 -2
  71. package/dist/colors/eyeShadow.d.ts +0 -2
  72. package/dist/colors/eyebrow.d.ts +0 -2
  73. package/dist/colors/eyes.d.ts +0 -2
  74. package/dist/colors/facialHair.d.ts +0 -2
  75. package/dist/colors/glasses.d.ts +0 -2
  76. package/dist/colors/hair.d.ts +0 -2
  77. package/dist/colors/index.d.ts +0 -10
  78. package/dist/colors/mouth.d.ts +0 -2
  79. package/dist/colors/shirt.d.ts +0 -2
  80. package/dist/components/base.d.ts +0 -2
  81. package/dist/components/earrings.d.ts +0 -2
  82. package/dist/components/ears.d.ts +0 -2
  83. package/dist/components/eyebrows.d.ts +0 -2
  84. package/dist/components/eyes.d.ts +0 -2
  85. package/dist/components/facialHair.d.ts +0 -2
  86. package/dist/components/glasses.d.ts +0 -2
  87. package/dist/components/hair.d.ts +0 -2
  88. package/dist/components/index.d.ts +0 -11
  89. package/dist/components/mouth.d.ts +0 -2
  90. package/dist/components/nose.d.ts +0 -2
  91. package/dist/components/shirt.d.ts +0 -2
  92. package/dist/hooks/onPreCreate.d.ts +0 -9
  93. package/dist/index.d.ts +0 -13
  94. package/dist/index.es.js +0 -1247
  95. package/dist/index.js +0 -1254
  96. package/dist/index.umd.js +0 -12
  97. package/dist/meta/components.d.ts +0 -4
  98. package/dist/options.d.ts +0 -32
  99. package/dist/static-types.d.ts +0 -16
@@ -0,0 +1,13 @@
1
+ import * as colors from '../colors/index.js';
2
+ export function pickColor({ prng, group, values = [] }) {
3
+ var _a;
4
+ const colorCollection = colors;
5
+ if (values.length === 0) {
6
+ values.push('transparent');
7
+ }
8
+ const key = prng.pick(values);
9
+ return {
10
+ name: key,
11
+ value: (_a = colorCollection[group][key]) !== null && _a !== void 0 ? _a : key,
12
+ };
13
+ }
@@ -1,9 +1,9 @@
1
- import type { Prng } from '@dicebear/core';
2
- import type { ComponentPick } from '../static-types';
3
- declare type Props = {
4
- prng: Prng;
5
- group: string;
6
- values?: string[];
7
- };
8
- export declare function pickComponent({ prng, group, values, }: Props): ComponentPick;
9
- export {};
1
+ import type { Prng } from '@dicebear/core';
2
+ import type { ComponentPick } from '../types.js';
3
+ declare type Props = {
4
+ prng: Prng;
5
+ group: string;
6
+ values?: string[];
7
+ };
8
+ export declare function pickComponent({ prng, group, values, }: Props): ComponentPick;
9
+ export {};
@@ -0,0 +1,14 @@
1
+ import * as components from '../components/index.js';
2
+ export function pickComponent({ prng, group, values = [], }) {
3
+ const componentCollection = components;
4
+ const key = prng.pick(values);
5
+ if (componentCollection[group][key]) {
6
+ return {
7
+ name: key,
8
+ value: componentCollection[group][key],
9
+ };
10
+ }
11
+ else {
12
+ return undefined;
13
+ }
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dicebear/micah",
3
- "version": "5.0.0-alpha.2",
3
+ "version": "5.0.0-alpha.20",
4
4
  "description": "Avatar style for DiceBear",
5
5
  "keywords": [
6
6
  "dicebear"
@@ -13,39 +13,35 @@
13
13
  "url": "git+https://github.com/dicebear/dicebear.git"
14
14
  },
15
15
  "license": "MIT",
16
- "source": "src/index.ts",
17
- "main": "dist/index.js",
18
- "module": "dist/index.es.js",
19
- "browser": "dist/index.umd.js",
20
- "types": "dist/index.d.ts",
16
+ "type": "module",
17
+ "exports": "./lib/index.js",
18
+ "types": "./lib/index.d.ts",
21
19
  "files": [
22
20
  "LICENSE",
23
- "README.md",
24
- "dist"
21
+ "lib",
22
+ "README.md"
25
23
  ],
26
24
  "scripts": {
27
- "test": "jest",
25
+ "prebuild": "del-cli lib",
26
+ "build": "tsc",
28
27
  "prepublishOnly": "npm run build",
29
- "prebuild": "shx rm -rf dist",
30
- "build": "dicebear-project build DiceBear.Micah"
28
+ "test": "uvu tests"
31
29
  },
32
30
  "devDependencies": {
33
- "@dicebear/core": "^5.0.0-alpha.2",
34
- "@tsconfig/recommended": "^1.0.0",
35
- "@types/jest": "^26.0.22",
36
- "@types/node": "^10.11.6",
37
- "dicebear-project": "^5.0.0-alpha.2",
38
- "jest": "^26.6.3",
39
- "shx": "^0.3.3",
40
- "ts-jest": "^26.5.4",
41
- "typescript": "^4.2.3",
42
- "utility-types": "^3.10.0"
31
+ "@dicebear/core": "^5.0.0-alpha.20",
32
+ "@tsconfig/recommended": "^1.0.1",
33
+ "del-cli": "^4.0.1",
34
+ "typescript": "^4.6.3",
35
+ "uvu": "^0.5.3"
43
36
  },
44
37
  "peerDependencies": {
45
- "@dicebear/core": "^5.0.0-alpha.2"
38
+ "@dicebear/core": "^5.0.0-alpha.16"
39
+ },
40
+ "engines": {
41
+ "node": "^14.13.1 || >=16.0.0"
46
42
  },
47
43
  "publishConfig": {
48
44
  "access": "public"
49
45
  },
50
- "gitHead": "a29200fdf7cc9a6ddbb363c9b7f275844b005361"
46
+ "gitHead": "6b1c2bd64294365be21d0a133a362ede5ed62b5a"
51
47
  }
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../static-types';
2
- export declare const base: ColorGroup;
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../static-types';
2
- export declare const earring: ColorGroup;
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../static-types';
2
- export declare const eyeShadow: ColorGroup;
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../static-types';
2
- export declare const eyebrow: ColorGroup;
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../static-types';
2
- export declare const eyes: ColorGroup;
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../static-types';
2
- export declare const facialHair: ColorGroup;
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../static-types';
2
- export declare const glasses: ColorGroup;
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../static-types';
2
- export declare const hair: ColorGroup;
@@ -1,10 +0,0 @@
1
- export { base } from './base';
2
- export { earring } from './earring';
3
- export { eyeShadow } from './eyeShadow';
4
- export { eyebrow } from './eyebrow';
5
- export { facialHair } from './facialHair';
6
- export { glasses } from './glasses';
7
- export { hair } from './hair';
8
- export { mouth } from './mouth';
9
- export { shirt } from './shirt';
10
- export { eyes } from './eyes';
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../static-types';
2
- export declare const mouth: ColorGroup;
@@ -1,2 +0,0 @@
1
- import type { ColorGroup } from '../static-types';
2
- export declare const shirt: ColorGroup;
@@ -1,2 +0,0 @@
1
- import type { ComponentGroup } from '../static-types';
2
- export declare const base: ComponentGroup;
@@ -1,2 +0,0 @@
1
- import type { ComponentGroup } from '../static-types';
2
- export declare const earrings: ComponentGroup;
@@ -1,2 +0,0 @@
1
- import type { ComponentGroup } from '../static-types';
2
- export declare const ears: ComponentGroup;
@@ -1,2 +0,0 @@
1
- import type { ComponentGroup } from '../static-types';
2
- export declare const eyebrows: ComponentGroup;
@@ -1,2 +0,0 @@
1
- import type { ComponentGroup } from '../static-types';
2
- export declare const eyes: ComponentGroup;
@@ -1,2 +0,0 @@
1
- import type { ComponentGroup } from '../static-types';
2
- export declare const facialHair: ComponentGroup;
@@ -1,2 +0,0 @@
1
- import type { ComponentGroup } from '../static-types';
2
- export declare const glasses: ComponentGroup;
@@ -1,2 +0,0 @@
1
- import type { ComponentGroup } from '../static-types';
2
- export declare const hair: ComponentGroup;
@@ -1,11 +0,0 @@
1
- export { base } from './base';
2
- export { mouth } from './mouth';
3
- export { eyebrows } from './eyebrows';
4
- export { hair } from './hair';
5
- export { eyes } from './eyes';
6
- export { nose } from './nose';
7
- export { ears } from './ears';
8
- export { shirt } from './shirt';
9
- export { earrings } from './earrings';
10
- export { glasses } from './glasses';
11
- export { facialHair } from './facialHair';
@@ -1,2 +0,0 @@
1
- import type { ComponentGroup } from '../static-types';
2
- export declare const mouth: ComponentGroup;
@@ -1,2 +0,0 @@
1
- import type { ComponentGroup } from '../static-types';
2
- export declare const nose: ComponentGroup;
@@ -1,2 +0,0 @@
1
- import type { ComponentGroup } from '../static-types';
2
- export declare const shirt: ComponentGroup;
@@ -1,9 +0,0 @@
1
- import { Prng, StyleOptions } from '@dicebear/core';
2
- import { Options } from '../options';
3
- declare type Props = {
4
- prng: Prng;
5
- options: StyleOptions<Options>;
6
- preview: boolean;
7
- };
8
- export declare function onPreCreate({ prng, options, preview }: Props): void;
9
- export {};
package/dist/index.d.ts DELETED
@@ -1,13 +0,0 @@
1
- /*!
2
- * Micah (@dicebear/micah)
3
- *
4
- * Code licensed under MIT License.
5
- * Copyright (c) 2021 Florian Körner
6
- *
7
- * Design "Avatar Illustration System" by Micah Lanier licensed under CC BY 4.0.
8
- * Source: https://www.figma.com/community/file/829741575478342595
9
- * License: https://creativecommons.org/licenses/by/4.0/
10
- */
11
- declare let create: import("@dicebear/core").StyleCreate<import("./options").Options>, preview: import("@dicebear/core").StylePreview<import("./options").Options> | undefined, meta: import("@dicebear/core").StyleMeta, schema: import("json-schema").JSONSchema7;
12
- export { create, preview, meta, schema };
13
- export { Options } from './options';