@dicebear/croodles-neutral 4.10.2 → 5.0.0-alpha.11

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 (48) hide show
  1. package/README.md +6 -5
  2. package/lib/colors/index.d.ts +1 -0
  3. package/lib/colors/index.js +1 -0
  4. package/lib/components/eyes.d.ts +2 -0
  5. package/lib/components/eyes.js +18 -0
  6. package/lib/components/index.d.ts +3 -0
  7. package/lib/components/index.js +3 -0
  8. package/lib/components/mouth.d.ts +2 -0
  9. package/lib/components/mouth.js +20 -0
  10. package/lib/components/nose.d.ts +2 -0
  11. package/lib/components/nose.js +11 -0
  12. package/lib/core.d.ts +3 -0
  13. package/lib/core.js +64 -0
  14. package/lib/hooks/onPostCreate.d.ts +11 -0
  15. package/lib/hooks/onPostCreate.js +3 -0
  16. package/lib/hooks/onPreCreate.d.ts +9 -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/meta/components.d.ts +4 -0
  21. package/lib/meta/components.js +14 -0
  22. package/lib/schema.d.ts +2 -0
  23. package/lib/schema.js +172 -0
  24. package/{dist/static-types.d.ts → lib/types.d.ts} +21 -16
  25. package/lib/types.js +1 -0
  26. package/lib/utils/getColors.d.ts +8 -0
  27. package/lib/utils/getColors.js +3 -0
  28. package/lib/utils/getComponents.d.ts +8 -0
  29. package/lib/utils/getComponents.js +23 -0
  30. package/lib/utils/pickColor.d.ts +9 -0
  31. package/lib/utils/pickColor.js +13 -0
  32. package/lib/utils/pickComponent.d.ts +9 -0
  33. package/lib/utils/pickComponent.js +14 -0
  34. package/package.json +21 -19
  35. package/dist/colors/index.d.ts +0 -0
  36. package/dist/components/eyes.d.ts +0 -2
  37. package/dist/components/index.d.ts +0 -3
  38. package/dist/components/mouth.d.ts +0 -2
  39. package/dist/components/nose.d.ts +0 -2
  40. package/dist/core.d.ts +0 -3
  41. package/dist/index.d.ts +0 -16
  42. package/dist/index.es.js +0 -168
  43. package/dist/index.js +0 -175
  44. package/dist/index.umd.js +0 -11
  45. package/dist/options.d.ts +0 -13
  46. package/dist/schema.d.ts +0 -2
  47. package/dist/utils/pickColor.d.ts +0 -3
  48. package/dist/utils/pickComponent.d.ts +0 -3
package/README.md CHANGED
@@ -1,13 +1,14 @@
1
- <h1 align="center"><img src="https://dicebear.com/api/croodles/1.svg" width="124" /> <br />Croodles Neutral</h1>
1
+ <h1 align="center"><img src="./tests/svg/0.svg" width="124" /> <br />Croodles - Neutral</h1>
2
2
  <p align="center">
3
- <strong>Avatar Style for <a href="https://dicebear.com/">DiceBear Avatars</a>.</strong><br />
4
- Design <a href="https://www.figma.com/community/file/966199982810283152">Croodles - Doodle your face</a> by vijay verma licensed under <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
3
+ <strong>Avatar Style for <a href="https://dicebear.com/">DiceBear</a></strong><br />
4
+ <a href="https://www.figma.com/community/file/966199982810283152">Croodles - Doodle your face</a>
5
+ by vijay verma
5
6
  </p>
6
7
 
7
8
  <p align="center">
8
9
  While our code is MIT licensed, the design is licensed under
9
- <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>. See <a href="https://dicebear.com/licenses">license overview</a>
10
- for more information.
10
+ <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
11
+ See <a href="https://dicebear.com/licenses">license overview</a> for more information.
11
12
  </p>
12
13
 
13
14
  <p align="center">
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { ComponentGroup } from '../types.js';
2
+ export declare const eyes: ComponentGroup;
@@ -0,0 +1,18 @@
1
+ export const eyes = {
2
+ variant16: (components, colors) => `<g stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M37.2 32s0 0 0 0" stroke="#fff"/><path d="M30.5 41.3c-5.1.3-8.2-4-9.2-6C27 30 35.5 33 39.1 35c-.7 2-3.4 6-8.6 6.3Z" stroke="#000"/><path d="M28.6 37.2c.8.5 2.7 1.1 4-.8 1.6-2.4-2.4-5-3.7-3.8-1 1-.6 2.4-.2 3M90.7 35.2c1-.4 2.6-1.8 1.6-4-1.2-2.8-5.8-.8-5.5 1 .3 1.5 1.9 2 2.6 2" stroke="#000"/><path d="M90.7 38.8c-5 1.2-9-2.8-9.8-5.5 4.6-6 15-3.5 17.6-1.3-.4 2-2.8 5.7-7.8 6.8ZM17.3 21c5.5-1.1 18.3-1.5 25.2 5.1M75.6 25.7c3.3-5.4 14.2-11.2 22-7.6" stroke="#000"/></g>`,
3
+ variant15: (components, colors) => `<g stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M25.5 18.2c1.7-1.3 6.1-2.6 11.3-1.9 4.5.6 6.4 2.3 7.7 4.3M73 20c2-2.8 5.8-3.3 8.2-3.4 2.4-.2 5 0 7.2.6M4 20.6l13.7 8.5M48.2 33A31.5 31.5 0 0 1 68.7 31M96.9 28.8c2.5-1.3 10.6-8.8 13.1-10.6M18.1 29.7c-.3 3.7-.4 13.1 4.4 16.6 4.7 3.5 23.5-.3 25.2-1 1.7-.5 1.7-7.7-.9-14.3-2.1-5.5-20.5-3.7-28-2.3"/><path d="M70.5 28c6-2.7 22-1 25 0 3.7 1 4.1 10.3 3.8 13.7C98.9 45 78.8 45 74 44.9c-3.7-.1-4.9-11.6-4-16.5M33.4 32.3c-.4.2-1 1-.8 1.9.4 1 3.4 2.5 3.5.8.1-1.7-.4-2.3-1.2-1.6"/><path d="M81.6 31.2c-.6.6-1.7 1.8-1 2.3 1 .7 4.3 2.3 4 0-.2-1.8-1.1-1.7-1.5-1.4l-.8.8"/></g>`,
4
+ variant14: (components, colors) => `<g stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M20.8 12.3c1.7-1.3 6.2-2.6 11.3-2 4.5.7 6.4 2.3 7.7 4.3M72.9 14.2c2-3 5.7-3.7 8-4 2.4-.2 5.1-.2 7.3.4M4 21.2l13.7 6.5M48.2 31.5a31.5 31.5 0 0 1 20.5-1.8M96.9 27.3a193 193 0 0 0 13.1-8.6M24.6 49.9c-5-3.1-10.5-15.7-5.9-22.7 5.3-7.8 23.8-8.7 28.1 2.4 2.6 6.5 1.6 12.7 1 14.3-1.9 4.5-10.3 13.9-23.2 6ZM95.5 26.5c-5.6-8-21-8.3-25.4.4-1.9 3.7-3 14.2 4.4 20.2 3.8 3 18 8.2 22.8-5.2 2.2-6.3.4-12.2-1.8-15.4Z"/><path d="M34.4 29.8c-.4.2-1.1 1-.8 1.8.4 1.2 3.4 2.5 3.5.9.1-1.7-.5-2.3-1.2-1.6M81 27.7c-.6.5-1.7 1.8-1 2.3 1 .6 4.2 2.3 4 0-.3-1.9-1.1-1.7-1.5-1.4l-.9.7"/></g>`,
5
+ variant13: (components, colors) => `<g stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M26.8 19.1c1.3 1.2 4.7 2.4 8.6 1.7 3.5-.5 5-2 6-3.9M70 16.1c2 2.6 5.4 3.4 7.6 3.6 2.2 0 5-.8 7.2-2M4 20.5 17.7 29M48.2 32.8A31.5 31.5 0 0 1 68.7 31M96.9 28.7c2.5-1.4 10.6-7.8 13.1-9.7"/><path d="M22.6 46c-8.3-3.1-7.6-11.4-3.7-17.2 3-3.8 22.8-2.2 27.2 1.8 4.2 3.8 2.3 11.8-1.8 14.3-3.4 2-16.2 3.1-21.7 1ZM94.4 26.7c-3.6-1.2-18.2-1-24 2.6-3.8 2.5-6.5 14.7 3.6 16 4.6.7 14.9 0 18.7-1.8 8.2-3.9 6.8-15.2 1.7-16.8Z"/><path d="M29.7 35.3c1-2 3.2-2.6 4.1-2.6 3.1 0 4 1.3 4.7 2.1M78 35.3c1-2 3.1-2.6 4-2.6 3.2 0 4 1.3 4.7 2.1"/></g>`,
6
+ variant12: (components, colors) => `<path d="M33 35.6c-1.8-1.7.5-4.4 2.5-3.4 2.5 1.3 3.4 4.3 1.2 6.5s-7.2.8-7.5-4.5c-.3-5.3 6.5-9.2 10-3 3.3 6.3 2.2 11.9-5.2 11.9-5.1 0-7.3-3.6-7.9-7-1-6.7 2.5-13.6 9.7-12 4.5 1 9.7 4 8.8 13.3-1 9.3-6 10.3-12.3 9.2-7.7-1.3-9.8-8.2-7.3-16M78.5 35.6c-1.9-1.7.4-4.4 2.4-3.4 2.5 1.3 3.4 4.3 1.2 6.5-2.1 2.2-7.1.8-7.5-4.5-.3-5.3 6.5-9.2 10-3 3.3 6.3 2.2 11.9-5.2 11.9-5.1 0-7.3-3.6-7.8-7-1-6.7 2.4-13.6 9.7-12 4.4 1 9.6 4 8.7 13.3-1 9.3-6 10.3-12.3 9.2-7.7-1.3-9.8-8.2-7.3-16M29.8 15.9c3 2.2 8.8 2.6 12 1M72.2 16.8c3.6 1 9.2-.3 11.8-2.8" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
7
+ variant11: (components, colors) => `<g stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M35.3 28.9c-2.3.1-7.3 1.4-8.1 5.6-1 5.3 2.1 7.4 3.3 8 1 .4 8.2 1.8 9.1-3 .9-5-1.5-8.4-2.9-9-1.4-.6-5.6 1.6-6.2 4-.7 2.4-2.7 3.4 0 5 2.6 1.4 4.5 3.4 6.2.4 1.8-3 1.4-6.6 0-6.9-1.4-.2-4.5.6-4.5 2.5 0 2 .4 5 1.4 4 .8-.9 1.5-3 1.7-4M84.5 27c-2.4 0-7.3 1.4-8.1 5.6-1 5.3 2.1 7.4 3.2 7.9 1.2.5 8.3 1.9 9.2-3 .9-5-1.5-8.3-2.9-9-1.4-.5-5.6 1.7-6.3 4-.6 2.5-2.6 3.5 0 5 2.7 1.5 4.5 3.5 6.3.5 1.8-3 1.4-6.7 0-7-1.4-.2-4.5.7-4.5 2.6 0 1.9.4 4.9 1.4 3.9.8-.8 1.5-3 1.7-4" stroke="#000"/><path d="M85.4 37.3s0 0 0 0M32.2 34.6c-.4 0-1.2.2-1 .9.3.7 1.4.5 1.6 0 .3-.6-.2-1.7-.2-1.7M81.4 32.7c-.4 0-1.3.2-1 .8.3.7 1.3.6 1.6 0 .2-.5-.3-1.7-.3-1.7" stroke="#fff"/><path d="M27.5 21.8c1-1.3 3.8-3.4 6-2M78 18c1-1.3 4.2-1.4 4.7 0" stroke="#000"/></g>`,
8
+ variant10: (components, colors) => `<g stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M20.4 39.8c2.2-3.1 9-8.4 19-4" stroke="#000"/><path d="M29 35.3c-1 .5-2.8 2.1-1.6 4.5 1.5 3 6.5.5 6-1.5-.4-1.6-2.1-2-3-2M17 24.6C21.8 23 33.2 21 40 27M71.4 24.6c4.8-1.7 16.2-3.6 23 2.3" stroke="#000"/><path d="M68 28c6.4-.8 24.3 1.6 27 3.2 3 1.8 3.5 15.2 1.2 21.6-1.2 3.2-13.3 6.7-23.8 0-7.5-4.7-5.9-18.8-5-23.7" stroke="#F24E1E"/><path d="M70.6 31c-.7 1.9-1.8 8.5-2.5 10.8l5-10.2c-.7 3.2-3.5 14.2-3.3 15.2.3 1.2 5.9-15.3 6.5-15.2.6 0-4.4 16.9-4.4 17.9s5.8-17.2 6.7-17.2c.9 0-4.4 17.9-3.8 18.8.6.9 5.2-17.3 6-18.2C81.4 32 76.1 53 77 53c.8 0 6.1-21 6.9-19 .7 2-5.1 22-3.2 20.3 2-1.6 5.6-21.8 7-20.3 1.5 1.5-4.4 20.8-3.2 20.3C85.8 53.8 90 35 90.6 35c.6 0-2.4 20.8-1.8 19.4l5-19.4c.3-1.2 0 3 0 6.9-.1 3-2.2 10.5-2.5 12.5l4.4-14.6c0 2.3 0 7.6-.3 10.1-.3 2.6-.8 3.7-1 4M6 3a253.7 253.7 0 0 0 58.6 26c3 .8 28 4.5 32 2.3 3.3-1.7 11.2-14 13-16" stroke="#F24E1E"/></g>`,
9
+ variant09: (components, colors) => `<g stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M23.2 17.6c1.6.8 6 1.7 11.2 1.3 4.5-.4 6.5-1.5 7.8-2.9M75.2 15c2.1 1.9 5.9 2.3 8.3 2.3 2.3.1 5 0 7.1-.4M4 18.5 17.7 26M48.2 29.8A31.5 31.5 0 0 1 68.7 28M96.9 25.6c2.5-1.3 10.6-7.7 13.1-9.6M18.1 26.6c-.3 3.7-1.7 15.6 0 17.6 2.6 3 27.8-1 29.5-1.5 1.6-.6 2-8.8-.5-15.4-2.2-5.5-20.8-3.1-28.4-1.8"/><path d="m19.5 31.9 2.8-5.4c-.8 3.3-3 11-2.8 12 .3 1.2 5.7-12.6 6.3-12.6.6.1-4.5 16-4.5 17s6-17 6.9-17c.9 0-4.2 15.6-3.6 16.5.6 1 5.4-16 6.2-16.9.7-.9-4.3 18.2-3.4 18.1.8 0 6.1-21 6.9-19 .7 2-4.9 21.2-3 19.5 2-1.6 5.4-21 6.8-19.5 1.4 1.5-3.6 20-2.4 19.5 1.3-.5 4.6-17.6 5.2-17.6.6 0-1 17.1-.5 17.1s3.3-14 3.7-15.1c.3-1.2 1-.5 1 3.4-.1 3-1.3 9-1.6 11l3-7.6M70.8 33l2.8-7c-.8 3.3-2.3 10-2 10.9.2 1.2 5-11.5 5.5-11.4.6 0-3.5 13.1-3.5 14 0 1 5-14 5.9-14 .9 0-3.6 14.8-3 15.7.6.9 4.8-15.3 5.6-16.2.7-.9-4.3 18.2-3.4 18.1.8 0 6.1-21 6.9-19 .7 2-5.1 20.7-3.2 19 2-1.6 5.6-20.5 7-19 1.4 1.5-3.6 20-2.4 19.6C88.3 43 91.6 26 92.2 26c.6 0-1 17-.5 17s2.7-12.7 3-13.9c.4-1.1 1.3-.5 1.2 3.3 0 3.1-.8 7.9-1.1 9.9l3-7.6"/><path d="M70.5 24.8c6-2.7 22.2-1 25.2 0 3.8 1.1 3.6 14.7 3.3 18-.4 3.4-22.1.2-26.8 0-3.7-.1-3-12.7-2.1-17.6"/></g>`,
10
+ variant08: (components, colors) => `<g stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M34.8 27.8c3.3.6 11-.1 14.7-7.9M65.2 15c.5 2.7 2.7 8.5 7.4 10.8 4.6 2.3 8.8 2.3 10.3 2M21.2 40.5a134 134 0 0 1 27.1-5M21 42.7c6.8-1.3 20.5-4.5 25.2-5.2M67.3 34.8c7.1-1.3 22.3 2.4 26.3 4.1"/><path d="M66.7 35.2c7.1-1.2 20.6 3.7 24.6 5.5"/><path d="M66.5 36.1c7-1.3 21.6 4.9 25.6 6.7"/><path d="M66.5 37.5c7-1.3 21.6 5 25.6 6.9M25 41.3c6.5-2.3 20.5-6.6 24-5.2M24 45c6.6-2.3 20.3-6.2 24-7"/></g>`,
11
+ variant07: (components, colors) => `<g stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M35.5 48c-.7-.6-5.1-2.3-7.4-6.2-2.3-3.8-2.5-7.7 0-9.3 1.6-1.2 5.1.6 7.4 2.2M36.4 34c1.5-1.6 4.1-3 6.7-1.6 1.8 1 1.6 7.1 0 9.4-1.2 1.9-5.2 5-6.7 6M77.7 33.3c-2.2-2.1-7.1-5.4-9.2-1.7-2.6 4.6 5.6 13 10.2 14.8M79.8 47c2.2-1.7 7-5.4 7.8-6.6 1-1.5 2.8-8 0-10.6-2.8-2.6-8.6 1-8.6 5.2" stroke="#F24E1E"/><path d="M26 18.3c.6-1.4 3-4.2 7-3.7 5.2.6 6.2 1.5 7.4 3.7M72.2 16.2c.5-1.7 3-4.8 8.2-4 5.2.6 7 3.5 7.3 4.9" stroke="#000"/></g>`,
12
+ variant06: (components, colors) => `<g stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M42.8 24c-6.4.3-17.8 3.1-17.8 11.4C25 47.8 34.7 50 38.2 50c3 0 9.2-1.6 11.5-4 2.3-2.6 3.2-12.6 1.6-15.8-1.1-2.2-3.2-5-7-5"/><path d="M30.7 32.3c-.4 0-1.2.2-1 .9.3.6 1.4.5 1.6 0 .3-.6-.2-1.8-.2-1.8M78.6 42c.3.6.5.4.7 0"/><path d="M80.3 30.4c-3 .8-8.6 3.8-7.4 9.9 1.3 6 5.8 7.7 10.4 6.4 4.5-1.4 7-7.6 6.4-10.3-1-3.4-5.7-6-9.4-5M28.7 16.7c2.1 1.6 8 4.3 14.3 2.4 6.3-2 11.2-7.5 12.8-10.1M78.9 14.5c-1 1 .2 4.7 2.4 5.5 2.2.9 3.6 1.5 5.8 1.5"/></g>`,
13
+ variant05: (components, colors) => `<path d="M30.2 23.6c2.6 1.8 7.7 6 8.2 7.8.4 2-8.8 5.3-13.4 6.8M89.4 22c-3.6 1.3-10.5 4.3-9.7 6 1 2.1 6.9 3.7 9.7 5.8" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
14
+ variant04: (components, colors) => `<path d="M26.7 26.3c1-2.5 4.2-7.3 9.9-7.1 5.7.2 8.3 3.4 8.9 5M71.2 24.6c1-2.9 4.2-8.4 9.2-7.7 5 .6 7.5 4.3 8.1 6M25 43c2.7-4 9.5-6.7 15-6.2 6.7.6 4.3 6.6 2.6 7.3-2.2.9-5.2-.9-3.3-3.3 1.4-2 2.8 0 2.4.8M72.6 38.6c1.7-1.7 6.5-5.2 11.4-5 6.1.4 7.8 3.4 6 5.5-2 2.2-4.6 2.5-4.6 0 0-2.4 2-2.5 2.8-1" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
15
+ variant03: (components, colors) => `<g stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M21 41.9c.6-1 2.2-3 4-3.2M25.8 45.2l2.8-5M32.5 41.8c0 1.1-1.2 5.4-1.2 5.4" stroke="#F24E1E"/><path d="M21.3 32.1c1.2 2.8 5 8.4 10.3 9.2 5.4.7 9.2-1.1 10.4-2.1" stroke="#000"/><path d="M80.8 40.3V44M84.4 39.4 86 43M87.8 38.4c.7.7 2.6 2 2.6 3" stroke="#F24E1E"/><path d="M72.8 35c1.2 1.5 4.2 4.3 6.5 4.3 3 0 8.2-.8 12-4.3M21.1 22c1-1.6 4.6-4.9 11-5.3 6.5-.4 9.1 1.2 9.7 2M73.7 20.7c1.5-2 5.9-6.2 11.5-6.2 2.3.4 7.1 2.1 8.8 6.6" stroke="#000"/></g>`,
16
+ variant02: (components, colors) => `<g stroke="#000" stroke-linecap="round" stroke-linejoin="round"><path d="M34 27.7c7-2.6 13.2 5.2 13.2 10.9 0 6.8-5.3 12.5-10.3 12.5-5 0-9.9-5.7-9.9-12.5 0-5.7 4-9.8 7.8-11.3M77.4 23.2c6.6-2.6 11 5.4 11 11 0 6.8-3.8 12.6-8.5 12.6-4.6 0-9-4.7-9-12.2C71 27 74.5 24.4 78 23" stroke-width="3"/><path d="M40.1 40.5s0 0 0 0M82 38.2s0 0 0 0" stroke-width="6"/><path d="M28.2 19.3c2.8-3.2 10-7.9 17-1.6M66.2 15.1c4.3-4.2 14.4-10.4 20-1.8" stroke-width="3"/></g>`,
17
+ variant01: (components, colors) => `<g stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M22.3 39.3c2.2-3.1 9-8.4 19-4M78 35c2.9-2.7 10.6-6.3 19.5 0"/><path d="M30.8 34.8c-1 .5-2.7 2.1-1.5 4.5 1.5 3 6.5.5 6-1.5-.4-1.6-2.2-2-3-2M87.3 32.4c-1 .2-3 1.4-2.4 4 .8 3.3 6.3 2 6.2-.2 0-1.6-1.7-2.4-2.5-2.5M18 25.9c5.4-1.7 18-3.6 25.7 2.2M75.2 28.7c3.4-5.4 14.3-11.2 22-7.6"/></g>`,
18
+ };
@@ -0,0 +1,3 @@
1
+ export { eyes } from './eyes.js';
2
+ export { nose } from './nose.js';
3
+ export { mouth } from './mouth.js';
@@ -0,0 +1,3 @@
1
+ export { eyes } from './eyes.js';
2
+ export { nose } from './nose.js';
3
+ export { mouth } from './mouth.js';
@@ -0,0 +1,2 @@
1
+ import type { ComponentGroup } from '../types.js';
2
+ export declare const mouth: ComponentGroup;
@@ -0,0 +1,20 @@
1
+ export const mouth = {
2
+ variant18: (components, colors) => `<path d="M20 19.5C22.2 15 31.3 5.6 50.3 6" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
3
+ variant17: (components, colors) => `<path d="M44.4 6.5c-4.2 2-20.4 6.7-30.4 4.2 6.2 10 35 11.4 39.6 2.5 5-9.4-4.1-9.3-9.2-6.7Z" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
4
+ variant16: (components, colors) => `<path d="M13.6 13.8c4.7 4 13.5 6.5 22.5 5.4A25 25 0 0 0 54.9 8.5M10 16.5c1.6-1 4.8-3.7 5-6.6M53.1 6c1 1.6 3.8 4.8 6.6 5" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
5
+ variant15: (components, colors) => `<path d="M13.6 14.5c4.7 4 12.5 10.4 22.9-2 6.6-7.8 15.9.9 18.4-3.2M10 17.3c1.6-1 4.8-3.8 5-6.7M55.3 6c-.1 1.9.1 6 2.2 8" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
6
+ variant14: (components, colors) => `<path d="M15 14s4.2 1.6 7 0c2.9-1.5 3-5.9 5.2-3.6 2.6 3 3 4.9 4.5 6.3 1.5 1.5 2.6-5 3.9-7 1.2-2.3 4.6 6.1 6.6 6.1 1.9 0 1.4-9.5 3.6-7.5 2.1 1.9 1.8 5.4 8.8 3.4" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
7
+ variant13: (components, colors) => `<g stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M22.2 21.5c-.5.5-3-7.1-4.1-11l7.4 1.2-3.3 9.8ZM49.4 20.4c-.7.3-3-6-4.3-10l6-2c-1 3.1-.6 11.6-1.7 12Z"/><path d="M13 4.7c3 6.2 12.4 7.7 24 6.4C47.4 10 53.4 6.7 56.4 3"/></g>`,
8
+ variant12: (components, colors) => `<g stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M54.3 13.7c4.9-9.4-1.4-10-6.6-7.4a48.9 48.9 0 0 1-23.5 2.4C17.8 6.3 14.4 2 14 13c-.4 11 36.2 8.6 40.3.8Z"/><path d="M15.2 11.9c8 2.7 27 5.8 39.2-4M24 11l-1 5.6M30.8 12.4l-.5 6.2M37.4 11.7l1 6.4M45.3 9.8l1.4 7"/></g>`,
9
+ variant11: (components, colors) => `<path d="M34 9c-7.2 0-14-1.2-17-2 1 2.6 3.4 12 17 12 13.7 0 16.5-9.2 18.3-12-6 1.8-11 2-18.3 2Z" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
10
+ variant10: (components, colors) => `<path d="M54.7 2c-7.3 0-26-.6-38.7 2.7C16 15.4 28.6 25 39.2 22 50 19 56.2 7 54.7 2Z" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
11
+ variant09: (components, colors) => `<g stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M16 6.6c5.3 2.5 13.5 8 22.7 7.7 11-.3 14.6-6.1 16-9.3"/><path d="M34.3 6.3c-3-1.9-8.6 1.8-10 4.2 1.6 5.5 7.4 9.2 14 9.2 7.3 0 11.3-6.3 12-8.5h0c-.7-1.2-1.8-3.3-4.8-4.9-3.7-2-6.1 6-6.8 6-.7 0-.6-3.6-4.4-6Z"/></g>`,
12
+ variant08: (components, colors) => `<path d="M4 14.8s5.7-2.8 7.1-7.6M12.2 9c.2.8-7 9.3-7 9.3M14.2 8.6C13.7 12.7 9 18.9 9 18.9M11.6 20s5.3-4.8 5.8-10.3M19.6 9.4c0 3.5-1.7 11.2-1.7 11.2M45.6 7.7V20M18.7 20.2s4.2-5.3 4.2-9.6M49.2 18.2s-3-6.2-3-10.6M25.3 10.2c.3 2.4-2.9 9.8-2.9 9.8M55.5 6.9c.3 2.3 5.4 8.3 5.4 8.3M49.2 8a50 50 0 0 0 4.8 9.8M27.7 10c-.6 4-1.3 10.7-1.3 10.7M50.8 7.3l6.4 9.2M30 9.9c.6 2.8.8 8.6 3.7 10.6M58.5 7.3c1.5 2.3 4.4 5.9 8.2 6.8M34 9c0 1.3-1.8 5.9 1 11M40 20.5S35 14.3 35 9M37.5 8.6c0 3.8 6.1 12 6.1 12M44.5 20c-.6-2-3.8-9.3-3.4-12.5" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
13
+ variant07: (components, colors) => `<path d="M12 5.6c2.4 4 6.6 15.1 22.7 15.1C51 20.7 57 6.5 57.7 5" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
14
+ variant06: (components, colors) => `<path d="M43.8 10.4c-8 1.5-20.5 1-22.4 2.4-3.4 3.7 16.2 1.3 20.5.8 8.8-1 11.7-4.9 2-3.2Z" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
15
+ variant05: (components, colors) => `<g stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M11 11.2c3 1.1 9.3 3 24.3 1.7C54 11.2 54.3 9.6 58.7 7"/><path d="M35.7 7.6A36.7 36.7 0 0 0 17 12.7c15.7 12.4 34.8 0 34.8-2.6-2.4-1-2.4-3.3-16-2.5Z"/></g>`,
16
+ variant04: (components, colors) => `<path d="M34 10c-7.2 0-14-1.2-17-2 1 2.6 6.4 8.3 17 8.3 12 0 16.5-5.5 18.3-8.3-6 1.8-11 2-18.3 2Z" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
17
+ variant03: (components, colors) => `<path d="M19.5 10c-1.3 2.1.4 7.7 15.3 6.8 14.9-1 19-9 14.5-8.8-6.2.2-10.7 4.2-20.1 2-3.4-.7-8.5-2-9.7 0Z" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
18
+ variant02: (components, colors) => `<path d="M22 16.7c7.2 3.9 23.1 2 25.4-7 .2-1 0-2.7-1.2-2.7" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
19
+ variant01: (components, colors) => `<path d="M17 12a88 88 0 0 0 36.2 0" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
20
+ };
@@ -0,0 +1,2 @@
1
+ import type { ComponentGroup } from '../types.js';
2
+ export declare const nose: ComponentGroup;
@@ -0,0 +1,11 @@
1
+ export const nose = {
2
+ variant09: (components, colors) => `<path d="M23.3 22.4c.7.8 2.6 5.5-5.6 6.5-7 .8-7.1-3.7-7.1-5.3" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
3
+ variant08: (components, colors) => `<path d="M15.3 18c-4 .9-7.2 6.8-4 10 4 4 12.3 4.7 13.1 0 .7-3.9-1.3-6-2.7-6.7" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
4
+ variant07: (components, colors) => `<path d="M2 2.7c3.5 0 7.7 5.7 8.1 14.8.7 14.7-4.2 19.4 0 27 2.7 5 17.8 4.7 21.9-3.6 3.2-6.5-3-12-6.6-20.7-3.5-8.3-5.7-13.4-2-18.2" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
5
+ variant06: (components, colors) => `<path d="M24.3 5c-.8 5.3-1.2 16.3.3 22.3 3.6 14.1-1.5 17.5-3.2 17.5-5.3 0-6.5-4.7-7.7-18-1.5-16.5-1.6-16.3-3.7-21" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
6
+ variant05: (components, colors) => `<path d="M20.8 8c2.7 8 7.6 25.3 5.8 29.4-2.1 5-5.4-2.3-5.4 3.5-1 2.8-3.8 3.2-5.1-1.6-1.3-4.7-5.2 3.5-6.5 1.6-3.6-1.6-.7-7.1 1.2-8.9" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
7
+ variant04: (components, colors) => `<path d="M13.3 12C15 28 20.7 22.4 23 31.3c2 7-9.2 7.7-12.1 5.4" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
8
+ variant03: (components, colors) => `<path d="M13 43.8c3.7 0 8.5-1.5 9.2-6 .6-3.7-5.6-3.1-7.3-7.4A70.4 70.4 0 0 1 15 7" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
9
+ variant02: (components, colors) => `<path d="M21.7 10c5 4 12 23 6 29S19 34.3 14 34.3c-5.1 0-9 6-8.5-1 .4-5.6 4-5.5 4.7-5.8" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
10
+ variant01: (components, colors) => `<path d="M13.7 15c3.9 2.1 11 11.9 10.2 17.3-.5 3.6-8.5 2.5-12.9 1.7" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`,
11
+ };
package/lib/core.d.ts ADDED
@@ -0,0 +1,3 @@
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,64 @@
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
+ import { dimensions } from './meta/components.js';
7
+ export const style = {
8
+ meta: {
9
+ title: 'Croodles - Doodle your face',
10
+ creator: 'vijay verma',
11
+ source: 'https://www.figma.com/community/file/966199982810283152',
12
+ license: {
13
+ name: 'CC BY 4.0',
14
+ url: 'https://creativecommons.org/licenses/by/4.0/',
15
+ },
16
+ },
17
+ schema: schema,
18
+ create: ({ prng, options }) => {
19
+ var _a, _b, _c, _d, _e, _f;
20
+ onPreCreate({ prng, options, preview: false });
21
+ const components = getComponents({ prng, options });
22
+ const colors = getColors({ prng, options });
23
+ onPostCreate({ prng, options, components, colors, preview: false });
24
+ return {
25
+ attributes: {
26
+ viewBox: '0 0 128 128',
27
+ fill: 'none',
28
+ 'shape-rendering': 'auto',
29
+ },
30
+ body: `<g transform="translate(7 4)">${(_b = (_a = components.eyes) === null || _a === void 0 ? void 0 : _a.value(components, colors)) !== null && _b !== void 0 ? _b : ''}</g><g transform="translate(47 46)">${(_d = (_c = components.nose) === null || _c === void 0 ? void 0 : _c.value(components, colors)) !== null && _d !== void 0 ? _d : ''}</g><g transform="translate(30 93)">${(_f = (_e = components.mouth) === null || _e === void 0 ? void 0 : _e.value(components, colors)) !== null && _f !== void 0 ? _f : ''}</g>`,
31
+ };
32
+ },
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
+ };
@@ -0,0 +1,11 @@
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
+ preview: boolean;
9
+ };
10
+ export declare function onPostCreate({ prng, options, components, colors, preview, }: Props): void;
11
+ export {};
@@ -0,0 +1,3 @@
1
+ export function onPostCreate({ prng, options, components, colors, preview, }) {
2
+ // Write your modifications here
3
+ }
@@ -0,0 +1,9 @@
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
+ preview: boolean;
7
+ };
8
+ export declare function onPreCreate({ prng, options, preview }: Props): void;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ export function onPreCreate({ prng, options, preview }) {
2
+ // Write your modifications here
3
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Croodles - Neutral (@dicebear/croodles-neutral)
3
+ *
4
+ * Code licensed under MIT License.
5
+ * Copyright (c) 2021 Florian Körner
6
+ *
7
+ * Design "Croodles - Doodle your face" by vijay verma licensed under CC BY 4.0.
8
+ * Source: https://www.figma.com/community/file/966199982810283152
9
+ * License: https://creativecommons.org/licenses/by/4.0/
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 };
13
+ export type { Options } from './types.js';
package/lib/index.js ADDED
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Croodles - Neutral (@dicebear/croodles-neutral)
3
+ *
4
+ * Code licensed under MIT License.
5
+ * Copyright (c) 2021 Florian Körner
6
+ *
7
+ * Design "Croodles - Doodle your face" by vijay verma licensed under CC BY 4.0.
8
+ * Source: https://www.figma.com/community/file/966199982810283152
9
+ * License: https://creativecommons.org/licenses/by/4.0/
10
+ */
11
+ import { style } from './core.js';
12
+ const { create, preview, meta, schema } = style;
13
+ export { create, preview, meta, schema };
@@ -0,0 +1,4 @@
1
+ export declare const dimensions: Record<string, {
2
+ width: number;
3
+ height: number;
4
+ }>;
@@ -0,0 +1,14 @@
1
+ export const dimensions = {
2
+ eyes: {
3
+ width: 115,
4
+ height: 60,
5
+ },
6
+ nose: {
7
+ width: 35,
8
+ height: 50,
9
+ },
10
+ mouth: {
11
+ width: 70,
12
+ height: 25,
13
+ },
14
+ };
@@ -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,172 @@
1
+ export const schema = {
2
+ title: 'Options',
3
+ $schema: 'http://json-schema.org/draft-07/schema#',
4
+ properties: {
5
+ eyes: {
6
+ type: 'array',
7
+ items: {
8
+ type: 'string',
9
+ enum: [
10
+ 'variant16',
11
+ 'variant15',
12
+ 'variant14',
13
+ 'variant13',
14
+ 'variant12',
15
+ 'variant11',
16
+ 'variant10',
17
+ 'variant09',
18
+ 'variant08',
19
+ 'variant07',
20
+ 'variant06',
21
+ 'variant05',
22
+ 'variant04',
23
+ 'variant03',
24
+ 'variant02',
25
+ 'variant01',
26
+ ],
27
+ },
28
+ default: [
29
+ 'variant16',
30
+ 'variant15',
31
+ 'variant14',
32
+ 'variant13',
33
+ 'variant12',
34
+ 'variant11',
35
+ 'variant10',
36
+ 'variant09',
37
+ 'variant08',
38
+ 'variant07',
39
+ 'variant06',
40
+ 'variant05',
41
+ 'variant04',
42
+ 'variant03',
43
+ 'variant02',
44
+ 'variant01',
45
+ ],
46
+ examples: [
47
+ ['variant16'],
48
+ ['variant15'],
49
+ ['variant14'],
50
+ ['variant13'],
51
+ ['variant12'],
52
+ ['variant11'],
53
+ ['variant10'],
54
+ ['variant09'],
55
+ ['variant08'],
56
+ ['variant07'],
57
+ ['variant06'],
58
+ ['variant05'],
59
+ ['variant04'],
60
+ ['variant03'],
61
+ ['variant02'],
62
+ ['variant01'],
63
+ ],
64
+ },
65
+ mouth: {
66
+ type: 'array',
67
+ items: {
68
+ type: 'string',
69
+ enum: [
70
+ 'variant18',
71
+ 'variant17',
72
+ 'variant16',
73
+ 'variant15',
74
+ 'variant14',
75
+ 'variant13',
76
+ 'variant12',
77
+ 'variant11',
78
+ 'variant10',
79
+ 'variant09',
80
+ 'variant08',
81
+ 'variant07',
82
+ 'variant06',
83
+ 'variant05',
84
+ 'variant04',
85
+ 'variant03',
86
+ 'variant02',
87
+ 'variant01',
88
+ ],
89
+ },
90
+ default: [
91
+ 'variant18',
92
+ 'variant17',
93
+ 'variant16',
94
+ 'variant15',
95
+ 'variant14',
96
+ 'variant13',
97
+ 'variant12',
98
+ 'variant11',
99
+ 'variant10',
100
+ 'variant09',
101
+ 'variant08',
102
+ 'variant07',
103
+ 'variant06',
104
+ 'variant05',
105
+ 'variant04',
106
+ 'variant03',
107
+ 'variant02',
108
+ 'variant01',
109
+ ],
110
+ examples: [
111
+ ['variant18'],
112
+ ['variant17'],
113
+ ['variant16'],
114
+ ['variant15'],
115
+ ['variant14'],
116
+ ['variant13'],
117
+ ['variant12'],
118
+ ['variant11'],
119
+ ['variant10'],
120
+ ['variant09'],
121
+ ['variant08'],
122
+ ['variant07'],
123
+ ['variant06'],
124
+ ['variant05'],
125
+ ['variant04'],
126
+ ['variant03'],
127
+ ['variant02'],
128
+ ['variant01'],
129
+ ],
130
+ },
131
+ nose: {
132
+ type: 'array',
133
+ items: {
134
+ type: 'string',
135
+ enum: [
136
+ 'variant09',
137
+ 'variant08',
138
+ 'variant07',
139
+ 'variant06',
140
+ 'variant05',
141
+ 'variant04',
142
+ 'variant03',
143
+ 'variant02',
144
+ 'variant01',
145
+ ],
146
+ },
147
+ default: [
148
+ 'variant09',
149
+ 'variant08',
150
+ 'variant07',
151
+ 'variant06',
152
+ 'variant05',
153
+ 'variant04',
154
+ 'variant03',
155
+ 'variant02',
156
+ 'variant01',
157
+ ],
158
+ examples: [
159
+ ['variant09'],
160
+ ['variant08'],
161
+ ['variant07'],
162
+ ['variant06'],
163
+ ['variant05'],
164
+ ['variant04'],
165
+ ['variant03'],
166
+ ['variant02'],
167
+ ['variant01'],
168
+ ],
169
+ },
170
+ },
171
+ additionalProperties: false,
172
+ };
@@ -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
+ eyes?: ('variant16' | 'variant15' | 'variant14' | 'variant13' | 'variant12' | 'variant11' | 'variant10' | 'variant09' | 'variant08' | 'variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01')[];
3
+ nose?: ('variant09' | 'variant08' | 'variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01')[];
4
+ mouth?: ('variant18' | 'variant17' | 'variant16' | 'variant15' | 'variant14' | 'variant13' | 'variant12' | 'variant11' | 'variant10' | 'variant09' | 'variant08' | 'variant07' | 'variant06' | 'variant05' | 'variant04' | 'variant03' | 'variant02' | 'variant01')[];
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 {};
@@ -0,0 +1,8 @@
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,3 @@
1
+ export function getColors({ prng, options }) {
2
+ return {};
3
+ }
@@ -0,0 +1,8 @@
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,23 @@
1
+ import { pickComponent } from './pickComponent.js';
2
+ export function getComponents({ prng, options, }) {
3
+ const eyesComponent = pickComponent({
4
+ prng,
5
+ group: 'eyes',
6
+ values: options.eyes,
7
+ });
8
+ const noseComponent = pickComponent({
9
+ prng,
10
+ group: 'nose',
11
+ values: options.nose,
12
+ });
13
+ const mouthComponent = pickComponent({
14
+ prng,
15
+ group: 'mouth',
16
+ values: options.mouth,
17
+ });
18
+ return {
19
+ eyes: eyesComponent,
20
+ nose: noseComponent,
21
+ mouth: mouthComponent,
22
+ };
23
+ }
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,9 @@
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
+ }