@dicebear/core 10.6.0 → 10.7.0-rc.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/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}>`;
@@ -299,7 +308,7 @@ _Renderer_style = new WeakMap(), _Renderer_resolver = new WeakMap(), _Renderer_d
299
308
  case 'initial': {
300
309
  // charAt(0) would return a lone surrogate (ill-formed XML) for
301
310
  // supplementary-plane initials; take the full first code point
302
- // instead, like the PHP/Python/Rust/Go/Dart ports.
311
+ // instead, like the other ports.
303
312
  const first = __classPrivateFieldGet(this, _Renderer_instances, "m", _Renderer_initials).call(this).codePointAt(0);
304
313
  return first !== undefined ? String.fromCodePoint(first) : '';
305
314
  }
@@ -2,11 +2,10 @@
2
2
  * Formats a number for SVG output, rounded to at most 5 decimal places.
3
3
  *
4
4
  * Rounding to a fixed precision keeps the output bounded and identical across
5
- * the JS, PHP, Python, Rust, Go, and Dart ports: every value becomes a
6
- * multiple of 1e-5 in the SVG coordinate range, which has no exponential form,
7
- * so the result is built from integer arithmetic (no locale- or
8
- * language-specific float stringifying). Five decimals is far below sub-pixel
9
- * precision for any realistic canvas.
5
+ * every port: every value becomes a multiple of 1e-5 in the SVG coordinate
6
+ * range, which has no exponential form, so the result is built from integer
7
+ * arithmetic (no locale- or language-specific float stringifying). Five
8
+ * decimals is far below sub-pixel precision for any realistic canvas.
10
9
  */
11
10
  export declare class Number {
12
11
  static format(value: number): string;
@@ -2,11 +2,10 @@
2
2
  * Formats a number for SVG output, rounded to at most 5 decimal places.
3
3
  *
4
4
  * Rounding to a fixed precision keeps the output bounded and identical across
5
- * the JS, PHP, Python, Rust, Go, and Dart ports: every value becomes a
6
- * multiple of 1e-5 in the SVG coordinate range, which has no exponential form,
7
- * so the result is built from integer arithmetic (no locale- or
8
- * language-specific float stringifying). Five decimals is far below sub-pixel
9
- * precision for any realistic canvas.
5
+ * every port: every value becomes a multiple of 1e-5 in the SVG coordinate
6
+ * range, which has no exponential form, so the result is built from integer
7
+ * arithmetic (no locale- or language-specific float stringifying). Five
8
+ * decimals is far below sub-pixel precision for any realistic canvas.
10
9
  */
11
10
  export class Number {
12
11
  static format(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dicebear/core",
3
- "version": "10.6.0",
3
+ "version": "10.7.0-rc.1",
4
4
  "description": "Unique avatars from dozens of styles — deterministic, customizable, vector-based.",
5
5
  "keywords": [
6
6
  "avatar",