@versatiles/svg-renderer 0.7.1 → 0.7.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/dist/index.cjs CHANGED
@@ -9558,12 +9558,12 @@ class SVGRenderer {
9558
9558
  const [cx, cy] = roundXY(point.x + style.offset[0] * style.size, point.y + style.offset[1] * style.size);
9559
9559
  elements.push(`<g transform="rotate(${String(style.rotate)},${formatNum(cx)},${formatNum(cy)})">` +
9560
9560
  `<g transform="translate(${formatNum(iconXr)},${formatNum(iconYr)})${scaleStr}"${opacityAttr}${filterAttr}>` +
9561
- `<use href="#${escapeXml(symDef.symbolId)}" />` +
9561
+ `<use xlink:href="#${escapeXml(symDef.symbolId)}" />` +
9562
9562
  `</g></g>`);
9563
9563
  }
9564
9564
  else {
9565
9565
  elements.push(`<g transform="translate(${formatNum(iconXr)},${formatNum(iconYr)})${scaleStr}"${opacityAttr}${filterAttr}>` +
9566
- `<use href="#${escapeXml(symDef.symbolId)}" />` +
9566
+ `<use xlink:href="#${escapeXml(symDef.symbolId)}" />` +
9567
9567
  `</g>`);
9568
9568
  }
9569
9569
  }
@@ -9596,7 +9596,7 @@ class SVGRenderer {
9596
9596
  const pixelated = style.resampling === 'nearest';
9597
9597
  for (const tile of tiles) {
9598
9598
  const overlap = Math.min(tile.width, tile.height) / 10000; // slight overlap to prevent sub-pixel gaps between tiles
9599
- let attrs = `x="${formatScaled(tile.x - overlap)}" y="${formatScaled(tile.y - overlap)}" width="${formatScaled(tile.width + overlap * 2)}" height="${formatScaled(tile.height + overlap * 2)}" href="${tile.dataUri}"`;
9599
+ let attrs = `x="${formatScaled(tile.x - overlap)}" y="${formatScaled(tile.y - overlap)}" width="${formatScaled(tile.width + overlap * 2)}" height="${formatScaled(tile.height + overlap * 2)}" xlink:href="${tile.dataUri}"`;
9600
9600
  if (pixelated)
9601
9601
  attrs += ' style="image-rendering:pixelated"';
9602
9602
  this.#svg.push(`<image ${attrs} />`);
@@ -9609,19 +9609,19 @@ class SVGRenderer {
9609
9609
  // Build defs content
9610
9610
  const defsContent = [`<clipPath id="vb"><rect width="${w}" height="${h}"/></clipPath>`];
9611
9611
  for (const sheet of this.#spriteSheetDefs.values()) {
9612
- defsContent.push(`<image id="${escapeXml(sheet.defId)}" width="${formatNum(sheet.width)}" height="${formatNum(sheet.height)}" href="${escapeXml(sheet.href)}" />`);
9612
+ defsContent.push(`<image id="${escapeXml(sheet.defId)}" width="${formatNum(sheet.width)}" height="${formatNum(sheet.height)}" xlink:href="${escapeXml(sheet.href)}" />`);
9613
9613
  }
9614
9614
  for (const sym of this.#spriteSymbolDefs.values()) {
9615
9615
  const clipId = `${sym.symbolId}-clip`;
9616
- defsContent.push(`<clipPath id="${escapeXml(clipId)}"><rect width="${formatNum(sym.width)}" height="${formatNum(sym.height)}" /></clipPath>`, `<symbol id="${escapeXml(sym.symbolId)}"><g clip-path="url(#${escapeXml(clipId)})"><use href="#${escapeXml(sym.sheetDefId)}" x="${formatNum(-sym.x)}" y="${formatNum(-sym.y)}" /></g></symbol>`);
9616
+ defsContent.push(`<clipPath id="${escapeXml(clipId)}"><rect width="${formatNum(sym.width)}" height="${formatNum(sym.height)}" /></clipPath>`, `<symbol id="${escapeXml(sym.symbolId)}"><g clip-path="url(#${escapeXml(clipId)})"><use xlink:href="#${escapeXml(sym.sheetDefId)}" x="${formatNum(-sym.x)}" y="${formatNum(-sym.y)}" /></g></symbol>`);
9617
9617
  }
9618
9618
  for (const { content } of this.#sdfFilterDefs.values()) {
9619
9619
  defsContent.push(content);
9620
9620
  }
9621
9621
  const parts = [
9622
- `<svg viewBox="0 0 ${w} ${h}" width="${w}" height="${h}" xmlns="http://www.w3.org/2000/svg">`,
9622
+ `<svg viewBox="0 0 ${w} ${h}" width="${w}" height="${h}" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">`,
9623
9623
  `<defs>\n ${defsContent.join('\n ')}\n</defs>`,
9624
- `<g clip-path="url(#vb)">`,
9624
+ `<g id="map" clip-path="url(#vb)">`,
9625
9625
  ];
9626
9626
  if (this.#backgroundColor.alpha > 0) {
9627
9627
  parts.push(`<rect x="-1" y="-1" width="${(this.width + 2).toFixed(0)}" height="${(this.height + 2).toFixed(0)}" ${fillAttr(this.#backgroundColor)} />`);