@dicebear/core 10.0.0-rc.1 → 10.0.0-rc.3

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 (59) hide show
  1. package/lib/Avatar.d.ts +17 -1
  2. package/lib/Avatar.js +23 -5
  3. package/lib/Error/CircularColorReferenceError.d.ts +4 -0
  4. package/lib/Error/CircularColorReferenceError.js +4 -0
  5. package/lib/Error/OptionsValidationError.d.ts +3 -0
  6. package/lib/Error/OptionsValidationError.js +3 -0
  7. package/lib/Error/StyleValidationError.d.ts +3 -0
  8. package/lib/Error/StyleValidationError.js +3 -0
  9. package/lib/Error/ValidationError.d.ts +4 -0
  10. package/lib/Error/ValidationError.js +4 -0
  11. package/lib/Options.d.ts +39 -18
  12. package/lib/Options.js +64 -164
  13. package/lib/OptionsDescriptor.d.ts +8 -0
  14. package/lib/OptionsDescriptor.js +14 -6
  15. package/lib/Prng/Fnv1a.d.ts +14 -0
  16. package/lib/Prng/Fnv1a.js +14 -3
  17. package/lib/Prng/Mulberry32.d.ts +22 -0
  18. package/lib/Prng/Mulberry32.js +22 -8
  19. package/lib/Prng.d.ts +35 -0
  20. package/lib/Prng.js +35 -6
  21. package/lib/Renderer.d.ts +11 -2
  22. package/lib/Renderer.js +60 -54
  23. package/lib/Resolver.d.ts +62 -0
  24. package/lib/Resolver.js +203 -0
  25. package/lib/Style/Canvas.d.ts +14 -0
  26. package/lib/Style/Canvas.js +14 -0
  27. package/lib/Style/Color.d.ts +14 -0
  28. package/lib/Style/Color.js +14 -0
  29. package/lib/Style/Component.d.ts +50 -1
  30. package/lib/Style/Component.js +88 -9
  31. package/lib/Style/ComponentTranslate.d.ts +10 -0
  32. package/lib/Style/ComponentTranslate.js +10 -0
  33. package/lib/Style/ComponentVariant.d.ts +10 -0
  34. package/lib/Style/ComponentVariant.js +10 -0
  35. package/lib/Style/Element.d.ts +25 -0
  36. package/lib/Style/Element.js +25 -0
  37. package/lib/Style/Meta.d.ts +16 -0
  38. package/lib/Style/Meta.js +16 -0
  39. package/lib/Style/MetaCreator.d.ts +9 -0
  40. package/lib/Style/MetaCreator.js +9 -0
  41. package/lib/Style/MetaLicense.d.ts +12 -0
  42. package/lib/Style/MetaLicense.js +12 -0
  43. package/lib/Style/MetaSource.d.ts +10 -0
  44. package/lib/Style/MetaSource.js +10 -0
  45. package/lib/Style.d.ts +37 -1
  46. package/lib/Style.js +90 -6
  47. package/lib/StyleDefinition.d.ts +8 -3
  48. package/lib/StyleOptions.d.ts +12 -10
  49. package/lib/Utils/Color.d.ts +28 -0
  50. package/lib/Utils/Color.js +28 -8
  51. package/lib/Utils/Initials.d.ts +10 -0
  52. package/lib/Utils/Initials.js +10 -3
  53. package/lib/Utils/License.d.ts +14 -0
  54. package/lib/Utils/License.js +14 -0
  55. package/lib/Utils/Xml.d.ts +6 -0
  56. package/lib/Utils/Xml.js +6 -0
  57. package/lib/Validator/OptionsValidator.js +1569 -1700
  58. package/lib/Validator/StyleValidator.js +3453 -3197
  59. package/package.json +2 -2
@@ -1,7 +1,14 @@
1
- // @see https://www.regular-expressions.info/unicode.html
1
+ /**
2
+ * Derives display initials from a seed string.
3
+ *
4
+ * @see https://www.regular-expressions.info/unicode.html
5
+ */
2
6
  export class Initials {
3
- // Strips '@...' so email addresses yield a single initial instead
4
- // of being treated as two words.
7
+ /**
8
+ * Returns one or two uppercase initials for the given seed. By default
9
+ * strips `@...` so email addresses yield a single initial instead of being
10
+ * treated as two words.
11
+ */
5
12
  static fromSeed(seed, discardAtSymbol = true) {
6
13
  let input = seed;
7
14
  if (discardAtSymbol) {
@@ -1,5 +1,19 @@
1
1
  import type { Meta } from '../Style/Meta.js';
2
+ /**
3
+ * Builds attribution strings and embedded RDF/Dublin Core metadata from a
4
+ * style's {@link Meta} block.
5
+ */
2
6
  export declare class License {
7
+ /**
8
+ * Returns a single-line attribution string suitable for `<title>` or
9
+ * `<desc>` content. Returns an empty string when no attribution data is
10
+ * available.
11
+ */
3
12
  static text(meta: Meta): string;
13
+ /**
14
+ * Builds an embedded `<metadata>` block with Dublin Core terms describing
15
+ * the style's source, creator, license, and rights statement. Returns an
16
+ * empty string when no metadata fields are populated.
17
+ */
4
18
  static xml(meta: Meta): string;
5
19
  }
@@ -1,5 +1,14 @@
1
1
  import { Xml } from './Xml.js';
2
+ /**
3
+ * Builds attribution strings and embedded RDF/Dublin Core metadata from a
4
+ * style's {@link Meta} block.
5
+ */
2
6
  export class License {
7
+ /**
8
+ * Returns a single-line attribution string suitable for `<title>` or
9
+ * `<desc>` content. Returns an empty string when no attribution data is
10
+ * available.
11
+ */
3
12
  static text(meta) {
4
13
  const sourceName = meta.source().name();
5
14
  const sourceUrl = meta.source().url();
@@ -28,6 +37,11 @@ export class License {
28
37
  }
29
38
  return result;
30
39
  }
40
+ /**
41
+ * Builds an embedded `<metadata>` block with Dublin Core terms describing
42
+ * the style's source, creator, license, and rights statement. Returns an
43
+ * empty string when no metadata fields are populated.
44
+ */
31
45
  static xml(meta) {
32
46
  const title = meta.source().name();
33
47
  const creatorName = meta.creator().name();
@@ -1,4 +1,10 @@
1
+ /**
2
+ * Minimal XML escaping helper for SVG/XML text and attribute content.
3
+ */
1
4
  export declare class Xml {
2
5
  #private;
6
+ /**
7
+ * Returns `value` with the five XML predefined entities escaped.
8
+ */
3
9
  static escape(value: string): string;
4
10
  }
package/lib/Utils/Xml.js CHANGED
@@ -4,7 +4,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _a, _Xml_entities, _Xml_pattern;
7
+ /**
8
+ * Minimal XML escaping helper for SVG/XML text and attribute content.
9
+ */
7
10
  export class Xml {
11
+ /**
12
+ * Returns `value` with the five XML predefined entities escaped.
13
+ */
8
14
  static escape(value) {
9
15
  return value.replace(__classPrivateFieldGet(_a, _a, "f", _Xml_pattern), (ch) => __classPrivateFieldGet(_a, _a, "f", _Xml_entities)[ch]);
10
16
  }