@trailstash/ultra 3.1.0-beta4 → 3.1.1
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/cli/build.js +1 -1
- package/components/ultra-ide.js +2 -2
- package/lib/queryProviders/geojson.js +4 -9
- package/lib/queryProviders/gpx.js +3 -9
- package/lib/queryProviders/kml.js +2 -12
- package/lib/queryProviders/tcx.js +2 -8
- package/lib/queryProviders/util.js +11 -0
- package/package.json +2 -2
- package/cli/.build.js.swo +0 -0
package/cli/build.js
CHANGED
package/components/ultra-ide.js
CHANGED
|
@@ -213,7 +213,7 @@ export class UltraIDE extends HTMLElement {
|
|
|
213
213
|
};
|
|
214
214
|
Object.assign(this.refs.mapLibre, {
|
|
215
215
|
...pick(settings, UltraMap.RUNTIME_SETTINGS),
|
|
216
|
-
mapStyle: setBaseStyle(settings.mapStyle, this.settings.mapStyle),
|
|
216
|
+
mapStyle: setBaseStyle(settings.mapStyle, this.settings.mapStyle || UltraMap.defaults.mapStyle),
|
|
217
217
|
});
|
|
218
218
|
|
|
219
219
|
this.refs.downloadButton.data = null;
|
|
@@ -286,7 +286,7 @@ export class UltraIDE extends HTMLElement {
|
|
|
286
286
|
const settings = parseSettings(this.query);
|
|
287
287
|
this.refs.mapLibre.mapStyle = setBaseStyle(
|
|
288
288
|
settings.mapStyle,
|
|
289
|
-
this.settings.mapStyle,
|
|
289
|
+
this.settings.mapStyle || UltraMap.defaults.mapStyle,
|
|
290
290
|
);
|
|
291
291
|
this.refs.mapLibre.run();
|
|
292
292
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { fetchIfHTTPS } from "./util.js";
|
|
2
|
+
|
|
1
3
|
const layers = (source) => [
|
|
2
4
|
{
|
|
3
5
|
id: `${source}-geojson-fill`,
|
|
@@ -117,18 +119,11 @@ const geoJsonTypes = [
|
|
|
117
119
|
"MultiPolygon",
|
|
118
120
|
];
|
|
119
121
|
async function detect(query) {
|
|
120
|
-
|
|
121
|
-
if (query.startsWith("https://")) {
|
|
122
|
-
const resp = await fetch(query, { cors: true });
|
|
123
|
-
if (resp.ok) {
|
|
124
|
-
query = await resp.text();
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
} catch {}
|
|
122
|
+
query = await fetchIfHTTPS(query);
|
|
128
123
|
try {
|
|
129
124
|
const json = JSON.parse(query);
|
|
130
125
|
if (geoJsonTypes.includes(json.type)) {
|
|
131
|
-
return
|
|
126
|
+
return true;
|
|
132
127
|
}
|
|
133
128
|
} catch {}
|
|
134
129
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fetchIfHTTPS } from "./util.js";
|
|
1
2
|
import { gpx } from "@tmcw/togeojson";
|
|
2
3
|
|
|
3
4
|
const layers = (source) => [
|
|
@@ -65,20 +66,13 @@ const layers = (source) => [
|
|
|
65
66
|
];
|
|
66
67
|
|
|
67
68
|
const detect = async (query) => {
|
|
68
|
-
|
|
69
|
-
if (query.startsWith("https://")) {
|
|
70
|
-
const resp = await fetch(query, { cors: true });
|
|
71
|
-
if (resp.ok) {
|
|
72
|
-
query = await resp.text();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
} catch {}
|
|
69
|
+
query = await fetchIfHTTPS(query);
|
|
76
70
|
const doc = new window.DOMParser().parseFromString(query, "text/xml");
|
|
77
71
|
if (
|
|
78
72
|
!doc.querySelector("parsererror") &&
|
|
79
73
|
Array.from(doc.childNodes).some((x) => x.nodeName === "gpx")
|
|
80
74
|
) {
|
|
81
|
-
return
|
|
75
|
+
return true;
|
|
82
76
|
}
|
|
83
77
|
};
|
|
84
78
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fetchIfHTTPS } from "./util.js";
|
|
1
2
|
import { kml } from "@tmcw/togeojson";
|
|
2
3
|
|
|
3
4
|
const layers = (source) => [
|
|
@@ -77,18 +78,7 @@ const detect = async (query) => {
|
|
|
77
78
|
if (query.startsWith("https://www.google.com/maps/d/")) {
|
|
78
79
|
return true;
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
-
try {
|
|
82
|
-
const resp = await fetch(query, { cors: true });
|
|
83
|
-
if (resp.ok) {
|
|
84
|
-
query = await resp.text();
|
|
85
|
-
} else {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
} catch {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
81
|
+
query = await fetchIfHTTPS(query);
|
|
92
82
|
const doc = new window.DOMParser().parseFromString(query, "text/xml");
|
|
93
83
|
return (
|
|
94
84
|
!doc.querySelector("parsererror") &&
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fetchIfHTTPS } from "./util.js";
|
|
1
2
|
import { tcx } from "@tmcw/togeojson";
|
|
2
3
|
|
|
3
4
|
const layers = (source) => [
|
|
@@ -65,14 +66,7 @@ const layers = (source) => [
|
|
|
65
66
|
];
|
|
66
67
|
|
|
67
68
|
const detect = async (query) => {
|
|
68
|
-
|
|
69
|
-
if (query.startsWith("https://")) {
|
|
70
|
-
const resp = await fetch(query, { cors: true });
|
|
71
|
-
if (resp.ok) {
|
|
72
|
-
query = await resp.text();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
} catch {}
|
|
69
|
+
query = await fetchIfHTTPS(query);
|
|
76
70
|
const doc = new window.DOMParser().parseFromString(query, "text/xml");
|
|
77
71
|
if (
|
|
78
72
|
!doc.querySelector("parsererror") &&
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "3.1.
|
|
6
|
+
"version": "3.1.1",
|
|
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": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"svg2png": "^4.1.1",
|
|
46
46
|
"ts-node": "^10.9.2"
|
|
47
47
|
},
|
|
48
|
-
"license": "
|
|
48
|
+
"license": "MIT",
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@fortawesome/fontawesome-svg-core": "^6.6.0",
|
|
51
51
|
"@fortawesome/free-solid-svg-icons": "^6.6.0",
|
package/cli/.build.js.swo
DELETED
|
Binary file
|