@trailstash/ultra 3.1.0 → 3.1.2
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 +5 -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/overpass.js +7 -0
- package/lib/queryProviders/tcx.js +2 -8
- package/lib/queryProviders/util.js +11 -0
- package/package.json +1 -1
- package/cli/.build.js.swo +0 -0
package/cli/build.js
CHANGED
package/components/ultra-ide.js
CHANGED
|
@@ -213,7 +213,10 @@ export class UltraIDE extends HTMLElement {
|
|
|
213
213
|
};
|
|
214
214
|
Object.assign(this.refs.mapLibre, {
|
|
215
215
|
...pick(settings, UltraMap.RUNTIME_SETTINGS),
|
|
216
|
-
mapStyle: setBaseStyle(
|
|
216
|
+
mapStyle: setBaseStyle(
|
|
217
|
+
settings.mapStyle,
|
|
218
|
+
this.settings.mapStyle || UltraMap.defaults.mapStyle,
|
|
219
|
+
),
|
|
217
220
|
});
|
|
218
221
|
|
|
219
222
|
this.refs.downloadButton.data = null;
|
|
@@ -286,7 +289,7 @@ export class UltraIDE extends HTMLElement {
|
|
|
286
289
|
const settings = parseSettings(this.query);
|
|
287
290
|
this.refs.mapLibre.mapStyle = setBaseStyle(
|
|
288
291
|
settings.mapStyle,
|
|
289
|
-
this.settings.mapStyle,
|
|
292
|
+
this.settings.mapStyle || UltraMap.defaults.mapStyle,
|
|
290
293
|
);
|
|
291
294
|
this.refs.mapLibre.run();
|
|
292
295
|
}
|
|
@@ -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") &&
|
|
@@ -33,6 +33,13 @@ const overpassQLRegexes = [
|
|
|
33
33
|
/out( geom| center| skel)?;/,
|
|
34
34
|
];
|
|
35
35
|
function detect(query) {
|
|
36
|
+
const doc = new window.DOMParser().parseFromString(query, "text/xml");
|
|
37
|
+
if (
|
|
38
|
+
!doc.querySelector("parsererror") &&
|
|
39
|
+
Array.from(doc.childNodes).some((x) => x.nodeName === "osm-script")
|
|
40
|
+
) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
36
43
|
for (const re of overpassQLRegexes) {
|
|
37
44
|
if (query.match(re)) {
|
|
38
45
|
return query;
|
|
@@ -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
package/cli/.build.js.swo
DELETED
|
Binary file
|