@versatiles/svg-renderer 0.7.1 → 0.7.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.
@@ -785,10 +785,11 @@
785
785
  expression: {
786
786
  interpolated: false,
787
787
  parameters: [
788
- "zoom"
788
+ "zoom",
789
+ "feature"
789
790
  ]
790
791
  },
791
- "property-type": "data-constant"
792
+ "property-type": "data-driven"
792
793
  },
793
794
  "line-join": {
794
795
  type: "enum",
@@ -821,10 +822,11 @@
821
822
  expression: {
822
823
  interpolated: true,
823
824
  parameters: [
824
- "zoom"
825
+ "zoom",
826
+ "feature"
825
827
  ]
826
828
  },
827
- "property-type": "data-constant"
829
+ "property-type": "data-driven"
828
830
  },
829
831
  "line-round-limit": {
830
832
  type: "number",
@@ -837,10 +839,11 @@
837
839
  expression: {
838
840
  interpolated: true,
839
841
  parameters: [
840
- "zoom"
842
+ "zoom",
843
+ "feature"
841
844
  ]
842
845
  },
843
- "property-type": "data-constant"
846
+ "property-type": "data-driven"
844
847
  },
845
848
  "line-sort-key": {
846
849
  type: "number",
@@ -8301,7 +8304,7 @@
8301
8304
  join: [
8302
8305
  StringType,
8303
8306
  [array(StringType), StringType],
8304
- (ctx, [arr, delim]) => arr.value.join(delim.evaluate(ctx))
8307
+ (ctx, [arr, delim]) => arr.evaluate(ctx).join(delim.evaluate(ctx))
8305
8308
  ],
8306
8309
  'resolved-locale': [
8307
8310
  StringType,
@@ -9743,12 +9746,12 @@
9743
9746
  const [cx, cy] = roundXY(point.x + style.offset[0] * style.size, point.y + style.offset[1] * style.size);
9744
9747
  elements.push(`<g transform="rotate(${String(style.rotate)},${formatNum(cx)},${formatNum(cy)})">` +
9745
9748
  `<g transform="translate(${formatNum(iconXr)},${formatNum(iconYr)})${scaleStr}"${opacityAttr}${filterAttr}>` +
9746
- `<use href="#${escapeXml(symDef.symbolId)}" />` +
9749
+ `<use xlink:href="#${escapeXml(symDef.symbolId)}" />` +
9747
9750
  `</g></g>`);
9748
9751
  }
9749
9752
  else {
9750
9753
  elements.push(`<g transform="translate(${formatNum(iconXr)},${formatNum(iconYr)})${scaleStr}"${opacityAttr}${filterAttr}>` +
9751
- `<use href="#${escapeXml(symDef.symbolId)}" />` +
9754
+ `<use xlink:href="#${escapeXml(symDef.symbolId)}" />` +
9752
9755
  `</g>`);
9753
9756
  }
9754
9757
  }
@@ -9781,7 +9784,7 @@
9781
9784
  const pixelated = style.resampling === 'nearest';
9782
9785
  for (const tile of tiles) {
9783
9786
  const overlap = Math.min(tile.width, tile.height) / 10000; // slight overlap to prevent sub-pixel gaps between tiles
9784
- 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}"`;
9787
+ 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}"`;
9785
9788
  if (pixelated)
9786
9789
  attrs += ' style="image-rendering:pixelated"';
9787
9790
  this.#svg.push(`<image ${attrs} />`);
@@ -9794,19 +9797,19 @@
9794
9797
  // Build defs content
9795
9798
  const defsContent = [`<clipPath id="vb"><rect width="${w}" height="${h}"/></clipPath>`];
9796
9799
  for (const sheet of this.#spriteSheetDefs.values()) {
9797
- defsContent.push(`<image id="${escapeXml(sheet.defId)}" width="${formatNum(sheet.width)}" height="${formatNum(sheet.height)}" href="${escapeXml(sheet.href)}" />`);
9800
+ defsContent.push(`<image id="${escapeXml(sheet.defId)}" width="${formatNum(sheet.width)}" height="${formatNum(sheet.height)}" xlink:href="${escapeXml(sheet.href)}" />`);
9798
9801
  }
9799
9802
  for (const sym of this.#spriteSymbolDefs.values()) {
9800
9803
  const clipId = `${sym.symbolId}-clip`;
9801
- 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>`);
9804
+ 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>`);
9802
9805
  }
9803
9806
  for (const { content } of this.#sdfFilterDefs.values()) {
9804
9807
  defsContent.push(content);
9805
9808
  }
9806
9809
  const parts = [
9807
- `<svg viewBox="0 0 ${w} ${h}" width="${w}" height="${h}" xmlns="http://www.w3.org/2000/svg">`,
9810
+ `<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">`,
9808
9811
  `<defs>\n ${defsContent.join('\n ')}\n</defs>`,
9809
- `<g clip-path="url(#vb)">`,
9812
+ `<g id="map" clip-path="url(#vb)">`,
9810
9813
  ];
9811
9814
  if (this.#backgroundColor.alpha > 0) {
9812
9815
  parts.push(`<rect x="-1" y="-1" width="${(this.width + 2).toFixed(0)}" height="${(this.height + 2).toFixed(0)}" ${fillAttr(this.#backgroundColor)} />`);