@dicebear/core 10.0.0-rc.2 → 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.
- package/lib/Avatar.d.ts +17 -1
- package/lib/Avatar.js +23 -5
- package/lib/Error/CircularColorReferenceError.d.ts +4 -0
- package/lib/Error/CircularColorReferenceError.js +4 -0
- package/lib/Error/OptionsValidationError.d.ts +3 -0
- package/lib/Error/OptionsValidationError.js +3 -0
- package/lib/Error/StyleValidationError.d.ts +3 -0
- package/lib/Error/StyleValidationError.js +3 -0
- package/lib/Error/ValidationError.d.ts +4 -0
- package/lib/Error/ValidationError.js +4 -0
- package/lib/Options.d.ts +39 -18
- package/lib/Options.js +64 -164
- package/lib/OptionsDescriptor.d.ts +8 -0
- package/lib/OptionsDescriptor.js +14 -6
- package/lib/Prng/Fnv1a.d.ts +14 -0
- package/lib/Prng/Fnv1a.js +14 -3
- package/lib/Prng/Mulberry32.d.ts +22 -0
- package/lib/Prng/Mulberry32.js +22 -8
- package/lib/Prng.d.ts +35 -0
- package/lib/Prng.js +35 -6
- package/lib/Renderer.d.ts +11 -2
- package/lib/Renderer.js +60 -54
- package/lib/Resolver.d.ts +62 -0
- package/lib/Resolver.js +203 -0
- package/lib/Style/Canvas.d.ts +14 -0
- package/lib/Style/Canvas.js +14 -0
- package/lib/Style/Color.d.ts +14 -0
- package/lib/Style/Color.js +14 -0
- package/lib/Style/Component.d.ts +50 -1
- package/lib/Style/Component.js +88 -9
- package/lib/Style/ComponentTranslate.d.ts +10 -0
- package/lib/Style/ComponentTranslate.js +10 -0
- package/lib/Style/ComponentVariant.d.ts +10 -0
- package/lib/Style/ComponentVariant.js +10 -0
- package/lib/Style/Element.d.ts +25 -0
- package/lib/Style/Element.js +25 -0
- package/lib/Style/Meta.d.ts +16 -0
- package/lib/Style/Meta.js +16 -0
- package/lib/Style/MetaCreator.d.ts +9 -0
- package/lib/Style/MetaCreator.js +9 -0
- package/lib/Style/MetaLicense.d.ts +12 -0
- package/lib/Style/MetaLicense.js +12 -0
- package/lib/Style/MetaSource.d.ts +10 -0
- package/lib/Style/MetaSource.js +10 -0
- package/lib/Style.d.ts +37 -1
- package/lib/Style.js +90 -6
- package/lib/StyleDefinition.d.ts +8 -3
- package/lib/StyleOptions.d.ts +12 -10
- package/lib/Utils/Color.d.ts +28 -0
- package/lib/Utils/Color.js +28 -8
- package/lib/Utils/Initials.d.ts +10 -0
- package/lib/Utils/Initials.js +10 -3
- package/lib/Utils/License.d.ts +14 -0
- package/lib/Utils/License.js +14 -0
- package/lib/Utils/Xml.d.ts +6 -0
- package/lib/Utils/Xml.js +6 -0
- package/lib/Validator/OptionsValidator.js +1549 -1675
- package/lib/Validator/StyleValidator.js +3355 -3115
- package/package.json +2 -2
package/lib/Utils/Initials.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
4
|
-
|
|
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) {
|
package/lib/Utils/License.d.ts
CHANGED
|
@@ -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
|
}
|
package/lib/Utils/License.js
CHANGED
|
@@ -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();
|
package/lib/Utils/Xml.d.ts
CHANGED
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
|
}
|