@trailstash/ultra 5.0.3 → 5.0.4

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.
@@ -7,8 +7,8 @@ options:
7
7
  popupTemplate: >
8
8
  <h2>
9
9
  {{ type }}
10
- <a href="https://openhistoricalmap.org/{{ type }}/{{ id }}" target="_blank">{{ id }}</a>
11
- <a href="https://openhistoricalmap.org/edit?{{ type }}={{ id }}" target="_blank">✏️</a>
10
+ <a href="https://openstreetmap.org/{{ type }}/{{ id }}" target="_blank">{{ id }}</a>
11
+ <a href="https://openstreetmap.org/edit?{{ type }}={{ id }}" target="_blank">✏️</a>
12
12
  </h2>
13
13
  {% assign wikidata = tags["siren:model:wikidata"] ?? tags["model:wikidata"] %}
14
14
  {%- if wikidata %}
@@ -22,7 +22,12 @@ const defaultTemplate = `
22
22
  <br>
23
23
  {%- endfor %}
24
24
  `;
25
- const defaultContextBuilder = ({ properties }) => ({ properties });
25
+
26
+ const defaultContextBuilder = ({ properties, geometry }) => {
27
+ const context = { properties: structuredClone(properties) };
28
+ if (geometry.type === "Point") context.geometry = geometry;
29
+ return context;
30
+ };
26
31
 
27
32
  export class MapPopup extends HTMLElement {
28
33
  constructor() {
package/lib/style.js CHANGED
@@ -91,11 +91,15 @@ export async function getStyle(style, source) {
91
91
  } else if (typeof style.sprite === "string") {
92
92
  style.sprite = [{ id: "default", url: style.sprite }];
93
93
  }
94
+ const spritesheets = style.sprite.map(({ id }) => id);
94
95
  const extendedStyle = {
95
96
  ...parentStyle,
96
97
  ...style,
97
98
  sources: { ...parentStyle.sources, ...(style.sources || {}) },
98
- sprite: [...parentStyle.sprite, ...style.sprite],
99
+ sprite: [
100
+ ...parentStyle.sprite.filter(({ id }) => !spritesheets.includes(id)),
101
+ ...style.sprite,
102
+ ],
99
103
  layers,
100
104
  };
101
105
  return ensureSourceAndLayers(extendedStyle, source);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "5.0.3",
6
+ "version": "5.0.4",
7
7
  "description": "A web based tool for making MapLibre GL maps with data from sources such as Overpass, GeoJSON, GPX, KML, TCX, etc",
8
8
  "main": "index.js",
9
9
  "scripts": {