@dicebear/core 10.5.0 → 10.6.1
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 +3 -0
- package/lib/OptionsDescriptor.d.ts +1 -0
- package/lib/OptionsDescriptor.js +6 -1
- package/lib/Renderer.js +9 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<h1><img src="https://www.dicebear.com/logo-readme.svg" width="28" /> DiceBear Core (JavaScript)</h1>
|
|
2
2
|
|
|
3
|
+
[](https://github.com/dicebear/dicebear/stargazers)
|
|
4
|
+
[](https://github.com/dicebear/dicebear/blob/10.x/LICENSE)
|
|
5
|
+
|
|
3
6
|
JavaScript implementation of the DiceBear avatar library. Generates
|
|
4
7
|
deterministic SVG avatars from style definitions and a seed string.
|
|
5
8
|
|
package/lib/OptionsDescriptor.js
CHANGED
|
@@ -70,11 +70,16 @@ _a = OptionsDescriptor, _OptionsDescriptor_descriptor = new WeakMap(), _OptionsD
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
for (const name of [...__classPrivateFieldGet(this, _OptionsDescriptor_style, "f").colors().keys(), 'background']) {
|
|
73
|
-
const
|
|
73
|
+
const color = __classPrivateFieldGet(this, _OptionsDescriptor_style, "f").colors().get(name);
|
|
74
|
+
const contrastTo = color?.contrastTo();
|
|
75
|
+
const notEqualTo = color?.notEqualTo() ?? [];
|
|
74
76
|
result[`${name}Color`] = {
|
|
75
77
|
type: 'color',
|
|
76
78
|
list: true,
|
|
77
79
|
...(contrastTo ? { contrastTo } : {}),
|
|
80
|
+
...(notEqualTo.length > 0
|
|
81
|
+
? { notEqualTo: Array.from(notEqualTo) }
|
|
82
|
+
: {}),
|
|
78
83
|
};
|
|
79
84
|
result[`${name}ColorFill`] = {
|
|
80
85
|
type: 'enum',
|
package/lib/Renderer.js
CHANGED
|
@@ -181,6 +181,15 @@ _Renderer_style = new WeakMap(), _Renderer_resolver = new WeakMap(), _Renderer_d
|
|
|
181
181
|
const attrs = __classPrivateFieldGet(this, _Renderer_instances, "m", _Renderer_renderAttributes).call(this, element.attributes());
|
|
182
182
|
const children = __classPrivateFieldGet(this, _Renderer_instances, "m", _Renderer_renderElements).call(this, element.children());
|
|
183
183
|
if (children.length === 0) {
|
|
184
|
+
// A wrapper whose children all rendered to nothing, because an optional
|
|
185
|
+
// component came up empty, has no content left to group. It draws
|
|
186
|
+
// nothing either way, but a masked group without content has an empty
|
|
187
|
+
// bounding box, and strict SVG parsers reject the whole document over
|
|
188
|
+
// it. Wrappers that carry an id stay, so references keep resolving.
|
|
189
|
+
if (element.children().length > 0 &&
|
|
190
|
+
element.attributes()?.id === undefined) {
|
|
191
|
+
return '';
|
|
192
|
+
}
|
|
184
193
|
return `<${name}${attrs}/>`;
|
|
185
194
|
}
|
|
186
195
|
return `<${name}${attrs}>${children}</${name}>`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dicebear/core",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.6.1",
|
|
4
4
|
"description": "Unique avatars from dozens of styles — deterministic, customizable, vector-based.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"avatar",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "git+https://github.com/dicebear/dicebear.git"
|
|
19
19
|
},
|
|
20
|
+
"funding": "https://www.dicebear.com/support/",
|
|
20
21
|
"license": "MIT",
|
|
21
22
|
"author": "Florian Körner <contact@florian-koerner.com>",
|
|
22
23
|
"type": "module",
|