@dicebear/core 11.0.0-rc.1 → 11.0.0-rc.2
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/README.md +18 -3
- package/lib/Avatar.d.ts +4 -6
- package/lib/Avatar.js +5 -13
- package/lib/Options.d.ts +15 -3
- package/lib/Options.js +24 -10
- package/lib/OptionsDescriptor.d.ts +1 -5
- package/lib/OptionsDescriptor.js +14 -5
- package/lib/Renderer.js +51 -43
- package/lib/Resolver.d.ts +23 -1
- package/lib/Resolver.js +50 -19
- package/lib/Style.d.ts +3 -3
- package/lib/Style.js +3 -5
- package/lib/StyleDefinition.d.ts +4 -3
- package/lib/StyleOptions.d.ts +8 -2
- package/lib/Validator/OptionsValidator.js +762 -704
- package/lib/Validator/StyleValidator.js +226 -137
- package/lib/index.d.ts +20 -2
- package/lib/index.js +26 -2
- package/lib/lite.d.ts +5 -0
- package/lib/lite.js +9 -0
- package/package.json +6 -3
package/lib/index.js
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Style as StyleBase } from './Style.js';
|
|
2
|
+
import { Avatar as AvatarBase } from './Avatar.js';
|
|
3
|
+
import { StyleValidator } from './Validator/StyleValidator.js';
|
|
4
|
+
import { OptionsValidator } from './Validator/OptionsValidator.js';
|
|
5
|
+
/**
|
|
6
|
+
* A style whose definition is checked against the definition schema before
|
|
7
|
+
* it is parsed. `@dicebear/core/lite` exports the same class without the
|
|
8
|
+
* check, for definitions that come from your own code.
|
|
9
|
+
*/
|
|
10
|
+
export class Style extends StyleBase {
|
|
11
|
+
constructor(data) {
|
|
12
|
+
StyleValidator.validate(data);
|
|
13
|
+
super(data);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* An avatar whose options are checked against the options schema before it
|
|
18
|
+
* renders. `@dicebear/core/lite` exports the same class without the check,
|
|
19
|
+
* for options that come from your own code.
|
|
20
|
+
*/
|
|
21
|
+
export class Avatar extends AvatarBase {
|
|
22
|
+
constructor(style, optionsInput) {
|
|
23
|
+
OptionsValidator.validate(optionsInput ?? {});
|
|
24
|
+
super(style, optionsInput);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
3
27
|
export { Color } from './Utils/Color.js';
|
|
4
28
|
export { OptionsDescriptor } from './OptionsDescriptor.js';
|
package/lib/lite.d.ts
ADDED
package/lib/lite.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The same API as the package root, without the schema validators. A
|
|
2
|
+
// bundle that imports this entry leaves the two compiled validators out,
|
|
3
|
+
// which is about half of the library. Use it when the style definitions and
|
|
4
|
+
// the options come from your own code, and stay on the root entry when
|
|
5
|
+
// either arrives from outside.
|
|
6
|
+
export { Style } from './Style.js';
|
|
7
|
+
export { Avatar } from './Avatar.js';
|
|
8
|
+
export { Color } from './Utils/Color.js';
|
|
9
|
+
export { OptionsDescriptor } from './OptionsDescriptor.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dicebear/core",
|
|
3
|
-
"version": "11.0.0-rc.
|
|
3
|
+
"version": "11.0.0-rc.2",
|
|
4
4
|
"description": "Unique avatars from dozens of styles — deterministic, customizable, vector-based.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"avatar",
|
|
@@ -22,7 +22,10 @@
|
|
|
22
22
|
"author": "Florian Körner <contact@florian-koerner.com>",
|
|
23
23
|
"type": "module",
|
|
24
24
|
"main": "./lib/index.js",
|
|
25
|
-
"exports":
|
|
25
|
+
"exports": {
|
|
26
|
+
".": "./lib/index.js",
|
|
27
|
+
"./lite": "./lib/lite.js"
|
|
28
|
+
},
|
|
26
29
|
"types": "./lib/index.d.ts",
|
|
27
30
|
"sideEffects": false,
|
|
28
31
|
"files": [
|
|
@@ -39,7 +42,7 @@
|
|
|
39
42
|
"test": "node --test"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
42
|
-
"@dicebear/schema": "^
|
|
45
|
+
"@dicebear/schema": "^2.0.1",
|
|
43
46
|
"@exodus/schemasafe": "^1.3.0",
|
|
44
47
|
"@tsconfig/recommended": "^1.0.13",
|
|
45
48
|
"del-cli": "^7.0.0",
|