@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.
package/dist/index.cjs CHANGED
@@ -600,10 +600,11 @@ var layout_line = {
600
600
  expression: {
601
601
  interpolated: false,
602
602
  parameters: [
603
- "zoom"
603
+ "zoom",
604
+ "feature"
604
605
  ]
605
606
  },
606
- "property-type": "data-constant"
607
+ "property-type": "data-driven"
607
608
  },
608
609
  "line-join": {
609
610
  type: "enum",
@@ -636,10 +637,11 @@ var layout_line = {
636
637
  expression: {
637
638
  interpolated: true,
638
639
  parameters: [
639
- "zoom"
640
+ "zoom",
641
+ "feature"
640
642
  ]
641
643
  },
642
- "property-type": "data-constant"
644
+ "property-type": "data-driven"
643
645
  },
644
646
  "line-round-limit": {
645
647
  type: "number",
@@ -652,10 +654,11 @@ var layout_line = {
652
654
  expression: {
653
655
  interpolated: true,
654
656
  parameters: [
655
- "zoom"
657
+ "zoom",
658
+ "feature"
656
659
  ]
657
660
  },
658
- "property-type": "data-constant"
661
+ "property-type": "data-driven"
659
662
  },
660
663
  "line-sort-key": {
661
664
  type: "number",
@@ -8116,7 +8119,7 @@ CompoundExpression.register(expressions$1, {
8116
8119
  join: [
8117
8120
  StringType,
8118
8121
  [array(StringType), StringType],
8119
- (ctx, [arr, delim]) => arr.value.join(delim.evaluate(ctx))
8122
+ (ctx, [arr, delim]) => arr.evaluate(ctx).join(delim.evaluate(ctx))
8120
8123
  ],
8121
8124
  'resolved-locale': [
8122
8125
  StringType,
@@ -9558,12 +9561,12 @@ class SVGRenderer {
9558
9561
  const [cx, cy] = roundXY(point.x + style.offset[0] * style.size, point.y + style.offset[1] * style.size);
9559
9562
  elements.push(`<g transform="rotate(${String(style.rotate)},${formatNum(cx)},${formatNum(cy)})">` +
9560
9563
  `<g transform="translate(${formatNum(iconXr)},${formatNum(iconYr)})${scaleStr}"${opacityAttr}${filterAttr}>` +
9561
- `<use href="#${escapeXml(symDef.symbolId)}" />` +
9564
+ `<use xlink:href="#${escapeXml(symDef.symbolId)}" />` +
9562
9565
  `</g></g>`);
9563
9566
  }
9564
9567
  else {
9565
9568
  elements.push(`<g transform="translate(${formatNum(iconXr)},${formatNum(iconYr)})${scaleStr}"${opacityAttr}${filterAttr}>` +
9566
- `<use href="#${escapeXml(symDef.symbolId)}" />` +
9569
+ `<use xlink:href="#${escapeXml(symDef.symbolId)}" />` +
9567
9570
  `</g>`);
9568
9571
  }
9569
9572
  }
@@ -9596,7 +9599,7 @@ class SVGRenderer {
9596
9599
  const pixelated = style.resampling === 'nearest';
9597
9600
  for (const tile of tiles) {
9598
9601
  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}"`;
9602
+ 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
9603
  if (pixelated)
9601
9604
  attrs += ' style="image-rendering:pixelated"';
9602
9605
  this.#svg.push(`<image ${attrs} />`);
@@ -9609,19 +9612,19 @@ class SVGRenderer {
9609
9612
  // Build defs content
9610
9613
  const defsContent = [`<clipPath id="vb"><rect width="${w}" height="${h}"/></clipPath>`];
9611
9614
  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)}" />`);
9615
+ defsContent.push(`<image id="${escapeXml(sheet.defId)}" width="${formatNum(sheet.width)}" height="${formatNum(sheet.height)}" xlink:href="${escapeXml(sheet.href)}" />`);
9613
9616
  }
9614
9617
  for (const sym of this.#spriteSymbolDefs.values()) {
9615
9618
  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>`);
9619
+ 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
9620
  }
9618
9621
  for (const { content } of this.#sdfFilterDefs.values()) {
9619
9622
  defsContent.push(content);
9620
9623
  }
9621
9624
  const parts = [
9622
- `<svg viewBox="0 0 ${w} ${h}" width="${w}" height="${h}" xmlns="http://www.w3.org/2000/svg">`,
9625
+ `<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
9626
  `<defs>\n ${defsContent.join('\n ')}\n</defs>`,
9624
- `<g clip-path="url(#vb)">`,
9627
+ `<g id="map" clip-path="url(#vb)">`,
9625
9628
  ];
9626
9629
  if (this.#backgroundColor.alpha > 0) {
9627
9630
  parts.push(`<rect x="-1" y="-1" width="${(this.width + 2).toFixed(0)}" height="${(this.height + 2).toFixed(0)}" ${fillAttr(this.#backgroundColor)} />`);