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