@dicebear/bottts-neutral 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 (44) hide show
  1. package/LICENSE +1 -1
  2. package/lib/colors/base.d.ts +2 -0
  3. package/lib/colors/base.js +21 -0
  4. package/lib/colors/index.d.ts +1 -0
  5. package/lib/colors/index.js +1 -0
  6. package/lib/components/eyes.d.ts +2 -0
  7. package/lib/components/eyes.js +16 -0
  8. package/lib/components/index.d.ts +2 -0
  9. package/lib/components/index.js +2 -0
  10. package/lib/components/mouth.d.ts +2 -0
  11. package/lib/components/mouth.js +11 -0
  12. package/{dist → lib}/core.d.ts +3 -3
  13. package/lib/core.js +33 -0
  14. package/{dist → lib}/hooks/onPostCreate.d.ts +10 -12
  15. package/lib/hooks/onPostCreate.js +3 -0
  16. package/lib/hooks/onPreCreate.d.ts +8 -0
  17. package/lib/hooks/onPreCreate.js +3 -0
  18. package/lib/index.d.ts +13 -0
  19. package/lib/index.js +13 -0
  20. package/lib/schema.d.ts +2 -0
  21. package/lib/schema.js +149 -0
  22. package/{dist/static-types.d.ts → lib/types.d.ts} +21 -16
  23. package/lib/types.js +1 -0
  24. package/{dist → lib}/utils/getColors.d.ts +8 -9
  25. package/lib/utils/getColors.js +10 -0
  26. package/{dist → lib}/utils/getComponents.d.ts +8 -9
  27. package/lib/utils/getComponents.js +17 -0
  28. package/{dist → lib}/utils/pickColor.d.ts +9 -9
  29. package/lib/utils/pickColor.js +13 -0
  30. package/{dist → lib}/utils/pickComponent.d.ts +9 -9
  31. package/lib/utils/pickComponent.js +14 -0
  32. package/package.json +19 -23
  33. package/dist/colors/base.d.ts +0 -2
  34. package/dist/colors/index.d.ts +0 -1
  35. package/dist/components/eyes.d.ts +0 -2
  36. package/dist/components/index.d.ts +0 -2
  37. package/dist/components/mouth.d.ts +0 -2
  38. package/dist/hooks/onPreCreate.d.ts +0 -9
  39. package/dist/index.d.ts +0 -13
  40. package/dist/index.es.js +0 -366
  41. package/dist/index.js +0 -373
  42. package/dist/index.umd.js +0 -12
  43. package/dist/meta/components.d.ts +0 -4
  44. package/dist/options.d.ts +0 -10
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
@@ -0,0 +1,2 @@
1
+ import type { ColorGroup } from '../types.js';
2
+ export declare const base: ColorGroup;
@@ -0,0 +1,21 @@
1
+ export const base = {
2
+ amber: 'rgba(255, 179, 0, 1)',
3
+ blue: 'rgba(30, 136, 229, 1)',
4
+ blueGrey: 'rgba(84, 110, 122, 1)',
5
+ brown: 'rgba(109, 76, 65, 1)',
6
+ cyan: 'rgba(0, 172, 193, 1)',
7
+ deepOrange: 'rgba(244, 81, 30, 1)',
8
+ deepPurple: 'rgba(94, 53, 177, 1)',
9
+ green: 'rgba(67, 160, 71, 1)',
10
+ grey: 'rgba(117, 117, 117, 1)',
11
+ indigo: 'rgba(57, 73, 171, 1)',
12
+ lightBlue: 'rgba(3, 155, 229, 1)',
13
+ lightGreen: 'rgba(124, 179, 66, 1)',
14
+ lime: 'rgba(192, 202, 51, 1)',
15
+ orange: 'rgba(251, 140, 0, 1)',
16
+ pink: 'rgba(216, 27, 96, 1)',
17
+ purple: 'rgba(142, 36, 170, 1)',
18
+ red: 'rgba(229, 57, 53, 1)',
19
+ teal: 'rgba(0, 137, 123, 1)',
20
+ yellow: 'rgba(253, 216, 53, 1)',
21
+ };
@@ -0,0 +1 @@
1
+ export { base } from './base.js';
@@ -0,0 +1 @@
1
+ export { base } from './base.js';
@@ -0,0 +1,2 @@
1
+ import type { ComponentGroup } from '../types.js';
2
+ export declare const eyes: ComponentGroup;
@@ -0,0 +1,16 @@
1
+ export const eyes = {
2
+ bulging: (components, colors) => `<circle cx="28" cy="24" r="18" fill="#000" fill-opacity=".2"/><circle cx="74" cy="24" r="18" fill="#000" fill-opacity=".2"/><circle cx="28" cy="24" r="15" fill="#F1EEDA"/><circle cx="74" cy="24" r="15" fill="#F1EEDA"/><rect x="26" y="15" width="10" height="10" rx="2" fill="#000" fill-opacity=".8"/><rect x="74" y="15" width="10" height="10" rx="2" fill="#000" fill-opacity=".8"/>`,
3
+ dizzy: (components, colors) => `<path d="m25 27.2 5.5 5.5c.5.4 1.2.4 1.6 0l1.6-1.6c.4-.5.4-1.2 0-1.6L28.2 24l5.5-5.5c.4-.5.4-1.2 0-1.6l-1.6-1.6c-.5-.4-1.2-.4-1.6 0L25 20.8l-5.5-5.5c-.5-.4-1.2-.4-1.6 0l-1.6 1.6c-.4.4-.4 1.1 0 1.6l5.5 5.5-5.5 5.5c-.4.5-.4 1.2 0 1.6l1.6 1.6c.5.4 1.2.4 1.6 0l5.5-5.5ZM79 27.2l5.5 5.5c.5.4 1.2.4 1.6 0l1.6-1.6c.4-.5.4-1.2 0-1.6L82.2 24l5.5-5.5c.4-.5.4-1.2 0-1.6l-1.6-1.6c-.5-.4-1.2-.4-1.6 0L79 20.8l-5.5-5.5c-.5-.4-1.2-.4-1.6 0l-1.6 1.6c-.4.4-.4 1.1 0 1.6l5.5 5.5-5.5 5.5c-.4.5-.4 1.2 0 1.6l1.6 1.6c.5.4 1.2.4 1.6 0l5.5-5.5Z" fill="#000" fill-opacity=".8"/>`,
4
+ eva: (components, colors) => `<g fill-rule="evenodd" clip-rule="evenodd"><path d="M53 0c34.75 0 49 17.47 49 31 0 13.53-19.59 17-49 17-29.05 0-51-3.47-51-17S17.11 0 53 0Z" fill="#000" fill-opacity=".8"/><path d="M28.82 34.65c-6.53-1.35-11.24-6.34-10.52-11.14.72-4.79 6.6-7.58 13.12-6.23 6.53 1.36 11.24 6.35 10.52 11.15-.72 4.8-6.6 7.59-13.12 6.23ZM75.42 34.65c-6.52 1.36-12.4-1.43-13.12-6.23-.72-4.8 4-9.8 10.52-11.15 6.52-1.35 12.4 1.44 13.12 6.24.72 4.81-4 9.8-10.52 11.15Z" fill="#25A6F5"/></g>`,
5
+ frame1: (components, colors) => `<rect y="4" width="104" height="42" rx="4" fill="#000" fill-opacity=".8"/><rect x="28" y="25" width="10" height="11" rx="2" fill="#8BDDFF"/><rect x="66" y="25" width="10" height="11" rx="2" fill="#8BDDFF"/><path fill-rule="evenodd" clip-rule="evenodd" d="M21 4h8L12 46H4L21 4Z" fill="#fff" fill-opacity=".4"/>`,
6
+ frame2: (components, colors) => `<rect x="8" y="10" width="88" height="36" rx="4" fill="#000" fill-opacity=".8"/><rect x="28" y="21" width="10" height="17" rx="2" fill="#5EF2B8"/><rect x="66" y="21" width="10" height="17" rx="2" fill="#5EF2B8"/><path fill-rule="evenodd" clip-rule="evenodd" d="M83 10h5L76 46h-5l12-36Z" fill="#fff" fill-opacity=".4"/>`,
7
+ glow: (components, colors) => `<g fill="#fff"><circle cx="21" cy="30" r="15" fill-opacity=".1"/><circle cx="83" cy="30" r="15" fill-opacity=".1"/><circle cx="21" cy="30" r="12" fill-opacity=".1"/><circle cx="83" cy="30" r="12" fill-opacity=".1"/><circle cx="21" cy="30" r="6" fill-opacity=".8"/><circle cx="83" cy="30" r="6" fill-opacity=".8"/><circle cx="21" cy="30" r="3" fill-opacity=".8"/><circle cx="83" cy="30" r="3" fill-opacity=".8"/></g>`,
8
+ happy: (components, colors) => `<path d="m18 19 12-2M20 31c0-3.31 2.9-6 7-6 3.1 0 6 2.69 6 6M86 20l-12-3M84 31c0-3.31-2.9-6-6-6-4.1 0-7 2.69-7 6" stroke="#000" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>`,
9
+ hearts: (components, colors) => `<path d="M29.27 9.68c-2.55.13-4.96 2.24-6.25 4.15-1.48-1.76-4.1-3.6-6.65-3.47-5.48.28-8.85 3.8-8.63 8.1.3 5.72 4.88 8.89 9.7 12.24 1.71 1.15 5 4.15 5.42 4.82.42.67 2.14.6 2.58-.13a37.8 37.8 0 0 1 4.9-5.36c4.43-3.84 8.66-7.47 8.36-13.2-.23-4.3-3.95-7.44-9.43-7.15ZM87.63 10.36c-2.55-.14-5.17 1.7-6.65 3.47-1.3-1.9-3.7-4.02-6.25-4.15-5.48-.29-9.2 2.86-9.43 7.16-.3 5.72 3.93 9.35 8.36 13.19 1.6 1.32 4.55 4.64 4.9 5.36.35.7 2.06.82 2.58.13.51-.7 3.7-3.67 5.42-4.82 4.81-3.35 9.4-6.52 9.7-12.24.22-4.3-3.15-7.82-8.63-8.1Z" fill="#FF5353" fill-opacity=".8"/>`,
10
+ robocop: (components, colors) => `<rect x="7" y="16" width="91" height="16" rx="4" fill="#000" fill-opacity=".8"/><mask id="eyesRobocop-a" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="7" y="16" width="91" height="16"><rect x="7" y="16" width="91" height="16" rx="4" fill="#fff"/></mask><g mask="url(#eyesRobocop-a)" fill-rule="evenodd" clip-rule="evenodd" fill="#fff" fill-opacity=".8"><path d="M76 7h18L82 37H64L76 7ZM52 7h9L49 37h-9L52 7Z"/></g>`,
11
+ round: (components, colors) => `<g fill="#fff"><circle cx="24" cy="30" r="6"/><circle cx="80" cy="30" r="6"/></g>`,
12
+ roundFrame01: (components, colors) => `<rect y="12" width="104" height="32" rx="16" fill="#000" fill-opacity=".8"/><rect x="24" y="22" width="10" height="12" rx="2" fill="#F4F4F4"/><rect x="70" y="22" width="10" height="12" rx="2" fill="#F4F4F4"/>`,
13
+ roundFrame02: (components, colors) => `<rect y="11" width="104" height="34" rx="17" fill="#000" fill-opacity=".8"/><circle cx="29" cy="28" r="13" fill="#F1EEDA"/><circle cx="75" cy="28" r="13" fill="#F1EEDA"/><rect x="24" y="23" width="10" height="10" rx="2" fill="#000" fill-opacity=".8"/><rect x="70" y="23" width="10" height="10" rx="2" fill="#000" fill-opacity=".8"/>`,
14
+ sensor: (components, colors) => `<path d="M28 44a20 20 0 0 0 19.9-18h41.52a5 5 0 1 0 0-4H47.9A20 20 0 1 0 28 44Z" fill="#000" fill-opacity=".2"/><circle cx="94" cy="24" r="2" fill="#fff"/><circle cx="28" cy="24" r="16" fill="#000" fill-opacity=".6"/><circle cx="34" cy="16" r="3" fill="#fff"/>`,
15
+ shade01: (components, colors) => `<path d="M0 10a8 8 0 0 1 8-8h88a8 8 0 0 1 8 8v18a8 8 0 0 1-8 8H82.98c-3.27.17-5.48 1.14-6.98 2.35l-1.48 1.24c-2.47 2.12-5.15 4.4-8.24 4.4H38.67c-3.14 0-5.94-2.12-8.62-4.16-.95-.72-1.89-1.44-2.82-2.04A12.38 12.38 0 0 0 21.02 36H8a8 8 0 0 1-8-8V10Z" fill="#000" fill-opacity=".8"/><mask id="eyesShade01-a" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="2" width="104" height="42"><path d="M0 10a8 8 0 0 1 8-8h88a8 8 0 0 1 8 8v18a8 8 0 0 1-8 8H82.98c-3.27.17-5.48 1.14-6.98 2.35l-1.48 1.24c-2.47 2.12-5.15 4.4-8.24 4.4H38.67c-3.14 0-5.94-2.12-8.62-4.16-.95-.72-1.89-1.44-2.82-2.04A12.38 12.38 0 0 0 21.02 36H8a8 8 0 0 1-8-8V10Z" fill="#000" fill-opacity=".8"/></mask><g mask="url(#eyesShade01-a)"><path d="M12 19a5 5 0 0 1 5-5h70a5 5 0 0 1 5 5v2a5 5 0 0 1-5 5H74.98c-3.27.17-5.48 1.14-6.98 2.35l-1.48 1.24c-2 1.72-4.14 3.54-6.52 4.18V34H46.67c-3.14 0-5.94-2.13-8.62-4.17-.95-.72-1.89-1.44-2.82-2.04A12.38 12.38 0 0 0 29.02 26H17a5 5 0 0 1-5-5v-2Z" fill="#FF3D3D"/><path d="M12 44 32-2h-4L8 44h4ZM50-2H39L19 44h11L50-2Z" fill="#fff" fill-opacity=".2"/></g>`,
16
+ };
@@ -0,0 +1,2 @@
1
+ export { mouth } from './mouth.js';
2
+ export { eyes } from './eyes.js';
@@ -0,0 +1,2 @@
1
+ export { mouth } from './mouth.js';
2
+ export { eyes } from './eyes.js';
@@ -0,0 +1,2 @@
1
+ import type { ComponentGroup } from '../types.js';
2
+ export declare const mouth: ComponentGroup;
@@ -0,0 +1,11 @@
1
+ export const mouth = {
2
+ bite: (components, colors) => `<rect x="4" y="5" width="68" height="22" rx="5" fill="#000" fill-opacity=".2"/><rect x="8" y="9" width="60" height="14" rx="2" fill="#000" fill-opacity=".6"/><path fill-rule="evenodd" clip-rule="evenodd" d="m20 17 6-8H14l6 8ZM32 17l6-8H26l6 8ZM44 17l6-8H38l6 8ZM56 17l6-8H50l6 8Z" fill="#E1E6E8"/>`,
3
+ diagram: (components, colors) => `<rect x="4" y="4" width="68" height="24" rx="5" fill="#000" fill-opacity=".2"/><rect x="8" y="8" width="60" height="16" rx="2" fill="#000" fill-opacity=".8"/><path d="M9 17h11l2-4 3 7 4-8 2 9 3-11 3 10 3-3h15l3-4 2 7 3-3h4" stroke="#4EFAC9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`,
4
+ grill01: (components, colors) => `<g fill="#000" fill-opacity=".6"><rect x="12" y="12" width="4" height="8" rx="2"/><rect x="36" y="12" width="4" height="8" rx="2"/><rect x="24" y="12" width="4" height="8" rx="2"/><rect x="48" y="12" width="4" height="8" rx="2"/><rect x="60" y="12" width="4" height="8" rx="2"/></g>`,
5
+ grill02: (components, colors) => `<g fill="#000" fill-opacity=".6"><rect x="28" y="10" width="6" height="14" rx="2"/><rect x="14" y="10" width="6" height="14" rx="2"/><rect x="42" y="10" width="6" height="14" rx="2"/><rect x="56" y="10" width="6" height="14" rx="2"/></g>`,
6
+ grill03: (components, colors) => `<rect x="4" y="5" width="68" height="22" rx="5" fill="#000" fill-opacity=".2"/><rect x="8" y="9" width="60" height="14" rx="2" fill="#fff"/><path fill="#000" fill-opacity=".1" d="M18 9h4v14h-4zM42 9h4v14h-4zM30 9h4v14h-4zM54 9h4v14h-4z"/>`,
7
+ smile01: (components, colors) => `<path d="M27.05 8.44a2 2 0 1 1 3.9-.88C31.72 10.96 34.4 13 38 13c3.6 0 6.28-2.04 7.05-5.44a2 2 0 1 1 3.9.88C47.75 13.7 43.43 17 38 17s-9.76-3.3-10.95-8.56Z" fill="#000" fill-opacity=".6"/>`,
8
+ smile02: (components, colors) => `<path fill-rule="evenodd" clip-rule="evenodd" d="M18 10.22C18 21.78 24.47 28 38 28c13.52 0 20-6.34 20-17.78C58 9.5 57.17 8 55 8H21c-2.05 0-3 1.38-3 2.22Z" fill="#000" fill-opacity=".8"/><mask id="mouthSmile02-a" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="18" y="8" width="40" height="20"><path fill-rule="evenodd" clip-rule="evenodd" d="M18 10.22C18 21.78 24.47 28 38 28c13.52 0 20-6.34 20-17.78C58 9.5 57.17 8 55 8H21c-2.05 0-3 1.38-3 2.22Z" fill="#fff"/></mask><g mask="url(#mouthSmile02-a)"><rect x="30" y="2" width="16" height="14" rx="2" fill="#fff"/></g>`,
9
+ square01: (components, colors) => `<rect x="24" y="6" width="27" height="8" rx="4" fill="#000" fill-opacity=".8"/>`,
10
+ square02: (components, colors) => `<rect x="16" y="8" width="44" height="4" rx="2" fill="#000" fill-opacity=".8"/>`,
11
+ };
@@ -1,3 +1,3 @@
1
- import type { Style } from '@dicebear/core';
2
- import type { Options } from './options';
3
- export declare const style: Style<Options>;
1
+ import type { Style } from '@dicebear/core';
2
+ import type { Options } from './types.js';
3
+ export declare const style: Style<Options>;
package/lib/core.js ADDED
@@ -0,0 +1,33 @@
1
+ import { schema } from './schema.js';
2
+ import { getComponents } from './utils/getComponents.js';
3
+ import { getColors } from './utils/getColors.js';
4
+ import { onPreCreate } from './hooks/onPreCreate.js';
5
+ import { onPostCreate } from './hooks/onPostCreate.js';
6
+ export const style = {
7
+ meta: {
8
+ title: 'Bottts',
9
+ creator: 'Pablo Stanley',
10
+ source: 'https://bottts.com/',
11
+ license: {
12
+ name: 'Free for personal and commercial use',
13
+ url: 'https://bottts.com/',
14
+ },
15
+ },
16
+ schema: schema,
17
+ create: ({ prng, options }) => {
18
+ var _a, _b, _c, _d;
19
+ onPreCreate({ prng, options });
20
+ const components = getComponents({ prng, options });
21
+ const colors = getColors({ prng, options });
22
+ onPostCreate({ prng, options, components, colors });
23
+ options.backgroundColor = [colors.background.value];
24
+ return {
25
+ attributes: {
26
+ viewBox: '0 0 120 120',
27
+ fill: 'none',
28
+ 'shape-rendering': 'auto',
29
+ },
30
+ body: `<g transform="translate(22 68)">${(_b = (_a = components.mouth) === null || _a === void 0 ? void 0 : _a.value(components, colors)) !== null && _b !== void 0 ? _b : ''}</g><g transform="translate(8 20)">${(_d = (_c = components.eyes) === null || _c === void 0 ? void 0 : _c.value(components, colors)) !== null && _d !== void 0 ? _d : ''}</g>`,
31
+ };
32
+ },
33
+ };
@@ -1,12 +1,10 @@
1
- import { Prng, StyleOptions } from '@dicebear/core';
2
- import { Options } from '../options';
3
- import { ColorPickCollection, ComponentPickCollection } from '../static-types';
4
- declare type Props = {
5
- prng: Prng;
6
- options: StyleOptions<Options>;
7
- components: ComponentPickCollection;
8
- colors: ColorPickCollection;
9
- preview: boolean;
10
- };
11
- export declare function onPostCreate({ prng, options, components, colors, preview, }: Props): void;
12
- export {};
1
+ import { Prng, StyleOptions } from '@dicebear/core';
2
+ import { Options, ColorPickCollection, ComponentPickCollection } from '../types.js';
3
+ declare type Props = {
4
+ prng: Prng;
5
+ options: StyleOptions<Options>;
6
+ components: ComponentPickCollection;
7
+ colors: ColorPickCollection;
8
+ };
9
+ export declare function onPostCreate({ prng, options, components, colors }: Props): void;
10
+ export {};
@@ -0,0 +1,3 @@
1
+ export function onPostCreate({ prng, options, components, colors }) {
2
+ // Write your modifications here
3
+ }
@@ -0,0 +1,8 @@
1
+ import { Prng, StyleOptions } from '@dicebear/core';
2
+ import { Options } from '../types.js';
3
+ declare type Props = {
4
+ prng: Prng;
5
+ options: StyleOptions<Options>;
6
+ };
7
+ export declare function onPreCreate({ prng, options }: Props): void;
8
+ export {};
@@ -0,0 +1,3 @@
1
+ export function onPreCreate({ prng, options }) {
2
+ // Write your modifications here
3
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Bottts Neutral (@dicebear/bottts-neutral)
3
+ *
4
+ * Code licensed under MIT License.
5
+ * Copyright (c) 2022 Florian Körner
6
+ *
7
+ * Design "Bottts" by Pablo Stanley licensed under Free for personal and commercial use.
8
+ * Source: https://bottts.com/
9
+ * License: https://bottts.com/
10
+ */
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
+ export type { Options } from './types.js';
package/lib/index.js ADDED
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Bottts Neutral (@dicebear/bottts-neutral)
3
+ *
4
+ * Code licensed under MIT License.
5
+ * Copyright (c) 2022 Florian Körner
6
+ *
7
+ * Design "Bottts" by Pablo Stanley licensed under Free for personal and commercial use.
8
+ * Source: https://bottts.com/
9
+ * License: https://bottts.com/
10
+ */
11
+ import { style } from './core.js';
12
+ const { create, meta, schema } = style;
13
+ export { create, meta, schema };
@@ -0,0 +1,2 @@
1
+ import type { StyleSchema } from '@dicebear/core';
2
+ export declare const schema: StyleSchema;
package/lib/schema.js ADDED
@@ -0,0 +1,149 @@
1
+ export const schema = {
2
+ title: 'Options',
3
+ $schema: 'http://json-schema.org/draft-07/schema#',
4
+ properties: {
5
+ backgroundColor: {
6
+ type: 'array',
7
+ items: {
8
+ type: 'string',
9
+ 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})$',
10
+ },
11
+ default: [
12
+ 'amber',
13
+ 'blue',
14
+ 'blueGrey',
15
+ 'brown',
16
+ 'cyan',
17
+ 'deepOrange',
18
+ 'deepPurple',
19
+ 'green',
20
+ 'grey',
21
+ 'indigo',
22
+ 'lightBlue',
23
+ 'lightGreen',
24
+ 'lime',
25
+ 'orange',
26
+ 'pink',
27
+ 'purple',
28
+ 'red',
29
+ 'teal',
30
+ 'yellow',
31
+ ],
32
+ examples: [
33
+ ['amber'],
34
+ ['blue'],
35
+ ['blueGrey'],
36
+ ['brown'],
37
+ ['cyan'],
38
+ ['deepOrange'],
39
+ ['deepPurple'],
40
+ ['green'],
41
+ ['grey'],
42
+ ['indigo'],
43
+ ['lightBlue'],
44
+ ['lightGreen'],
45
+ ['lime'],
46
+ ['orange'],
47
+ ['pink'],
48
+ ['purple'],
49
+ ['red'],
50
+ ['teal'],
51
+ ['yellow'],
52
+ ],
53
+ },
54
+ eyes: {
55
+ type: 'array',
56
+ items: {
57
+ type: 'string',
58
+ enum: [
59
+ 'bulging',
60
+ 'dizzy',
61
+ 'eva',
62
+ 'frame1',
63
+ 'frame2',
64
+ 'glow',
65
+ 'happy',
66
+ 'hearts',
67
+ 'robocop',
68
+ 'round',
69
+ 'roundFrame01',
70
+ 'roundFrame02',
71
+ 'sensor',
72
+ 'shade01',
73
+ ],
74
+ },
75
+ default: [
76
+ 'bulging',
77
+ 'dizzy',
78
+ 'eva',
79
+ 'frame1',
80
+ 'frame2',
81
+ 'glow',
82
+ 'happy',
83
+ 'hearts',
84
+ 'robocop',
85
+ 'round',
86
+ 'roundFrame01',
87
+ 'roundFrame02',
88
+ 'sensor',
89
+ 'shade01',
90
+ ],
91
+ examples: [
92
+ ['bulging'],
93
+ ['dizzy'],
94
+ ['eva'],
95
+ ['frame1'],
96
+ ['frame2'],
97
+ ['glow'],
98
+ ['happy'],
99
+ ['hearts'],
100
+ ['robocop'],
101
+ ['round'],
102
+ ['roundFrame01'],
103
+ ['roundFrame02'],
104
+ ['sensor'],
105
+ ['shade01'],
106
+ ],
107
+ },
108
+ mouth: {
109
+ type: 'array',
110
+ items: {
111
+ type: 'string',
112
+ enum: [
113
+ 'bite',
114
+ 'diagram',
115
+ 'grill01',
116
+ 'grill02',
117
+ 'grill03',
118
+ 'smile01',
119
+ 'smile02',
120
+ 'square01',
121
+ 'square02',
122
+ ],
123
+ },
124
+ default: [
125
+ 'bite',
126
+ 'diagram',
127
+ 'grill01',
128
+ 'grill02',
129
+ 'grill03',
130
+ 'smile01',
131
+ 'smile02',
132
+ 'square01',
133
+ 'square02',
134
+ ],
135
+ examples: [
136
+ ['bite'],
137
+ ['diagram'],
138
+ ['grill01'],
139
+ ['grill02'],
140
+ ['grill03'],
141
+ ['smile01'],
142
+ ['smile02'],
143
+ ['square01'],
144
+ ['square02'],
145
+ ],
146
+ },
147
+ },
148
+ additionalProperties: false,
149
+ };
@@ -1,16 +1,21 @@
1
- export declare type ColorGroup = Record<string, ColorGroupItem>;
2
- export declare type ColorGroupCollection = Record<string, ColorGroup>;
3
- export declare type ColorGroupItem = string;
4
- export declare type ColorPickCollection = Record<string, ColorPick>;
5
- export declare type ColorPick = {
6
- name: string;
7
- value: ColorGroupItem;
8
- };
9
- export declare type ComponentGroup = Record<string, ComponentGroupItem>;
10
- export declare type ComponentGroupCollection = Record<string, ComponentGroup>;
11
- export declare type ComponentGroupItem = (components: ComponentPickCollection, colors: ColorPickCollection) => string;
12
- export declare type ComponentPickCollection = Record<string, ComponentPick>;
13
- export declare type ComponentPick = {
14
- name: string;
15
- value: ComponentGroupItem;
16
- } | undefined;
1
+ export interface Options {
2
+ mouth?: ('bite' | 'diagram' | 'grill01' | 'grill02' | 'grill03' | 'smile01' | 'smile02' | 'square01' | 'square02')[];
3
+ eyes?: ('bulging' | 'dizzy' | 'eva' | 'frame1' | 'frame2' | 'glow' | 'happy' | 'hearts' | 'robocop' | 'round' | 'roundFrame01' | 'roundFrame02' | 'sensor' | 'shade01')[];
4
+ backgroundColor?: string[];
5
+ }
6
+ export declare type ColorGroup = Record<string, ColorGroupItem>;
7
+ export declare type ColorGroupCollection = Record<string, ColorGroup>;
8
+ export declare type ColorGroupItem = string;
9
+ export declare type ColorPickCollection = Record<string, ColorPick>;
10
+ export declare type ColorPick = {
11
+ name: string;
12
+ value: ColorGroupItem;
13
+ };
14
+ export declare type ComponentGroup = Record<string, ComponentGroupItem>;
15
+ export declare type ComponentGroupCollection = Record<string, ComponentGroup>;
16
+ export declare type ComponentGroupItem = (components: ComponentPickCollection, colors: ColorPickCollection) => string;
17
+ export declare type ComponentPickCollection = Record<string, ComponentPick>;
18
+ export declare type ComponentPick = {
19
+ name: string;
20
+ value: ComponentGroupItem;
21
+ } | undefined;
package/lib/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,8 @@
1
- import type { Prng } from '@dicebear/core';
2
- import type { Options } from '../options';
3
- import type { ColorPickCollection } from '../static-types';
4
- declare type Props = {
5
- prng: Prng;
6
- options: Options;
7
- };
8
- export declare function getColors({ prng, options }: Props): ColorPickCollection;
9
- export {};
1
+ import type { Prng } from '@dicebear/core';
2
+ import type { Options, ColorPickCollection } from '../types.js';
3
+ declare type Props = {
4
+ prng: Prng;
5
+ options: Options;
6
+ };
7
+ export declare function getColors({ prng, options }: Props): ColorPickCollection;
8
+ export {};
@@ -0,0 +1,10 @@
1
+ import { pickColor } from './pickColor.js';
2
+ export function getColors({ prng, options }) {
3
+ return {
4
+ background: pickColor({
5
+ prng,
6
+ group: 'base',
7
+ values: options.backgroundColor,
8
+ }),
9
+ };
10
+ }
@@ -1,9 +1,8 @@
1
- import type { Prng } from '@dicebear/core';
2
- import type { Options } from '../options';
3
- import type { ComponentPickCollection } from '../static-types';
4
- declare type Props = {
5
- prng: Prng;
6
- options: Options;
7
- };
8
- export declare function getComponents({ prng, options, }: Props): ComponentPickCollection;
9
- export {};
1
+ import type { Prng } from '@dicebear/core';
2
+ import type { Options, ComponentPickCollection } from '../types.js';
3
+ declare type Props = {
4
+ prng: Prng;
5
+ options: Options;
6
+ };
7
+ export declare function getComponents({ prng, options, }: Props): ComponentPickCollection;
8
+ export {};
@@ -0,0 +1,17 @@
1
+ import { pickComponent } from './pickComponent.js';
2
+ export function getComponents({ prng, options, }) {
3
+ const mouthComponent = pickComponent({
4
+ prng,
5
+ group: 'mouth',
6
+ values: options.mouth,
7
+ });
8
+ const eyesComponent = pickComponent({
9
+ prng,
10
+ group: 'eyes',
11
+ values: options.eyes,
12
+ });
13
+ return {
14
+ mouth: mouthComponent,
15
+ eyes: eyesComponent,
16
+ };
17
+ }
@@ -1,9 +1,9 @@
1
- import type { Prng } from '@dicebear/core';
2
- import type { ColorPick } from '../static-types';
3
- declare type Props = {
4
- prng: Prng;
5
- group: string;
6
- values?: string[];
7
- };
8
- export declare function pickColor({ prng, group, values }: Props): ColorPick;
9
- export {};
1
+ import type { Prng } from '@dicebear/core';
2
+ import type { ColorPick } from '../types.js';
3
+ declare type Props = {
4
+ prng: Prng;
5
+ group: string;
6
+ values?: string[];
7
+ };
8
+ export declare function pickColor({ prng, group, values }: Props): ColorPick;
9
+ export {};
@@ -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/bottts-neutral",
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.BotttsNeutral"
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 +0,0 @@
1
- export { base } from './base';
@@ -1,2 +0,0 @@
1
- import type { ComponentGroup } from '../static-types';
2
- export declare const eyes: ComponentGroup;