@trailstash/ultra 3.0.0-dev1 → 3.0.0-dev2
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/.gitlab-ci.yml +1 -1
- package/components/code-editor.js +15 -0
- package/components/help-modal.js +2 -1
- package/components/ultra-loader.js +2 -11
- package/configs/overpass-ultra.js +11 -15
- package/lib/queryParams.js +0 -12
- package/package.json +15 -15
package/.gitlab-ci.yml
CHANGED
|
@@ -45,6 +45,21 @@ export class CodeEditor extends HTMLElement {
|
|
|
45
45
|
);
|
|
46
46
|
this.refs = { textarea };
|
|
47
47
|
shadow.appendChild(textarea);
|
|
48
|
+
textarea.addEventListener("dragenter", (e) => {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
});
|
|
51
|
+
textarea.addEventListener("dragover", (e) => {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
});
|
|
54
|
+
textarea.addEventListener("drop", async (e) => {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
const item = e.dataTransfer.items[0];
|
|
57
|
+
if (item.kind === "file"){
|
|
58
|
+
this.source = await item.getAsFile().text();
|
|
59
|
+
} else {
|
|
60
|
+
this.source = e.dataTransfer.getData('text/plain');
|
|
61
|
+
}
|
|
62
|
+
});
|
|
48
63
|
textarea.addEventListener("keydown", (e) => {
|
|
49
64
|
const start = e.target.selectionStart;
|
|
50
65
|
const end = e.target.selectionEnd;
|
package/components/help-modal.js
CHANGED
|
@@ -5,6 +5,7 @@ import { normalizeCSS } from "../lib/normalize.js";
|
|
|
5
5
|
import { toQueryParams } from "../lib/queryParams.js";
|
|
6
6
|
import { version as maplibreVersion } from "maplibre-gl/package.json";
|
|
7
7
|
import { version as osmtogeojsonVersion } from "osmtogeojson/package.json";
|
|
8
|
+
import packageLock from "../package-lock.json"
|
|
8
9
|
import readme from "../README.md";
|
|
9
10
|
|
|
10
11
|
export class HelpModal extends HTMLElement {
|
|
@@ -82,7 +83,7 @@ export class HelpModal extends HTMLElement {
|
|
|
82
83
|
KML/GPX/TCX to GeoJSON conversion powered by
|
|
83
84
|
<a target="_blank" href="https://github.com/placemark/togeojson"
|
|
84
85
|
>@tmcw/togeojson</a
|
|
85
|
-
>
|
|
86
|
+
> <code>${packageLock.packages['node_modules/@tmcw/togeojson'].version}</code>
|
|
86
87
|
</li>
|
|
87
88
|
</ul>
|
|
88
89
|
</div>
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { h } from "../lib/dom.js";
|
|
2
|
-
import {
|
|
3
|
-
getConfigFromQueryParams,
|
|
4
|
-
getModeFromQueryParams,
|
|
5
|
-
} from "../lib/queryParams.js";
|
|
2
|
+
import { getModeFromQueryParams } from "../lib/queryParams.js";
|
|
6
3
|
import { UltraMap } from "./ultra-map.js";
|
|
7
4
|
import { UltraIDE } from "./ultra-ide.js";
|
|
8
5
|
import pick from "lodash.pick";
|
|
@@ -28,13 +25,7 @@ export class UltraLoader extends HTMLElement {
|
|
|
28
25
|
shadow.adoptedStyleSheets.push(style);
|
|
29
26
|
|
|
30
27
|
let mode = getModeFromQueryParams() || defaultMode;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const remoteConfig = await getConfigFromQueryParams();
|
|
34
|
-
if (remoteConfig) {
|
|
35
|
-
mode = getModeFromQueryParams() || remoteConfig.defaultMode;
|
|
36
|
-
config = remoteConfig.modes[mode];
|
|
37
|
-
}
|
|
28
|
+
const config = modes[mode];
|
|
38
29
|
|
|
39
30
|
if (config.title) {
|
|
40
31
|
document.title = config.title;
|
|
@@ -79,19 +79,18 @@ let styles = [
|
|
|
79
79
|
["OpenTrailStash", "https://open.trailsta.sh/style.json", "OpenTrailStash"],
|
|
80
80
|
];
|
|
81
81
|
|
|
82
|
-
if (window.location.host === "overpass-ultra.us") {
|
|
83
|
-
//
|
|
84
|
-
} else if (window.location.host === "localhost:8000") {
|
|
85
|
-
// full config!
|
|
86
|
-
} else if (
|
|
87
|
-
window.location.host.startsWith("localhost:") ||
|
|
88
|
-
window.location.host.startsWith("127.0.0.1:")
|
|
89
|
-
) {
|
|
90
|
-
// All standard overpass-ultra.us styles work on localhost:* & 127.0.0.1:* except for protomaps
|
|
91
|
-
// bc you can't wildcard on port :(
|
|
92
|
-
styles = styles.filter((x) => !x[1].includes("protomaps"));
|
|
93
|
-
} else if (window.location.host === "ohm.overpass-ultra.us") {
|
|
82
|
+
if (window.location.host === "ohm.overpass-ultra.us") {
|
|
83
|
+
// TODO: customize help
|
|
94
84
|
styles = [];
|
|
85
|
+
query = `/*
|
|
86
|
+
This is an example Overpass query.
|
|
87
|
+
Try it out by pressing the Run button above!
|
|
88
|
+
*/
|
|
89
|
+
nwr["amenity"="theatre"]["start_date"](if:
|
|
90
|
+
t["start_date"] < "1976" &&
|
|
91
|
+
(!is_tag("end_date") || t["end_date"] >= "1975"));
|
|
92
|
+
|
|
93
|
+
out geom;`;
|
|
95
94
|
server = "https://overpass-api.openhistoricalmap.org/api/";
|
|
96
95
|
mapStyle = "https://www.openhistoricalmap.org/map-styles/main/main.json";
|
|
97
96
|
popupTemplate = `
|
|
@@ -132,9 +131,6 @@ if (window.location.host === "overpass-ultra.us") {
|
|
|
132
131
|
<a href="geo://{{coordinates[1]}},{{coordinates[0]}}">{{coordinates[1] | round: 6 }} / {{coordinates[0] | round: 6 }}</a> <small>(lat/lon)</small>
|
|
133
132
|
{%- endif %}
|
|
134
133
|
`;
|
|
135
|
-
} else {
|
|
136
|
-
styles = [];
|
|
137
|
-
mapStyle = "https://styles.trailsta.sh/osm-carto.json";
|
|
138
134
|
}
|
|
139
135
|
|
|
140
136
|
const settings = {
|
package/lib/queryParams.js
CHANGED
|
@@ -13,18 +13,6 @@ export const getModeFromQueryParams = () => {
|
|
|
13
13
|
return mode;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export const getConfigFromQueryParams = async () => {
|
|
17
|
-
const params = new URLSearchParams(window.location.hash.slice(1));
|
|
18
|
-
if (params.has("config")) {
|
|
19
|
-
const config = params.get("config");
|
|
20
|
-
if (config.endsWith(".js")) {
|
|
21
|
-
return import(new URL(config, window.location));
|
|
22
|
-
} else {
|
|
23
|
-
return (await fetch(new URL(config, window.location))).json();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
16
|
const fetchGist = async (query) => {
|
|
29
17
|
let [gistID, filename] = query.slice("gist:".length).split("/", 2);
|
|
30
18
|
let resp = await fetch(`https://api.github.com/gists/${gistID}`);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "3.0.0-
|
|
6
|
+
"version": "3.0.0-dev2",
|
|
7
7
|
"description": "A web based tool for making MapLibre GL maps with data from souces such as Overpass, GeoJSON, GPX, KML, TCX, etc",
|
|
8
8
|
"main": "index.js",
|
|
9
9
|
"scripts": {
|
|
@@ -38,32 +38,32 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://overpass-ultra.us/",
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@types/node": "^
|
|
41
|
+
"@types/node": "^22.5.4",
|
|
42
42
|
"@unvt/sprite-one": "^0.1.1",
|
|
43
|
-
"esbuild": "^0.
|
|
44
|
-
"prettier": "^3.
|
|
45
|
-
"puppeteer": "^
|
|
43
|
+
"esbuild": "^0.23.1",
|
|
44
|
+
"prettier": "^3.3.3",
|
|
45
|
+
"puppeteer": "^23.3.0",
|
|
46
46
|
"svg2png": "^4.1.1",
|
|
47
47
|
"ts-node": "^10.9.2"
|
|
48
48
|
},
|
|
49
49
|
"license": "ISC",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@fortawesome/fontawesome-svg-core": "^6.
|
|
52
|
-
"@fortawesome/free-solid-svg-icons": "^6.
|
|
53
|
-
"@oclif/core": "^4.0.
|
|
51
|
+
"@fortawesome/fontawesome-svg-core": "^6.6.0",
|
|
52
|
+
"@fortawesome/free-solid-svg-icons": "^6.6.0",
|
|
53
|
+
"@oclif/core": "^4.0.20",
|
|
54
54
|
"@tmcw/togeojson": "^5.8.1",
|
|
55
|
-
"@trailstash/maplibre-component": "^1.0.
|
|
56
|
-
"@turf/bbox": "^7.
|
|
55
|
+
"@trailstash/maplibre-component": "^1.0.1",
|
|
56
|
+
"@turf/bbox": "^7.1.0",
|
|
57
57
|
"deep-equal": "^2.2.3",
|
|
58
|
-
"liquidjs": "^10.
|
|
58
|
+
"liquidjs": "^10.16.7",
|
|
59
59
|
"lodash.pick": "^4.4.0",
|
|
60
60
|
"lz-string": "^1.5.0",
|
|
61
|
-
"maplibre-gl": "^4.
|
|
62
|
-
"marked": "^
|
|
61
|
+
"maplibre-gl": "^4.6.0",
|
|
62
|
+
"marked": "^14.1.1",
|
|
63
63
|
"normalize.css": "^8.0.1",
|
|
64
64
|
"osmtogeojson": "^3.0.0-beta.5",
|
|
65
|
-
"pmtiles": "^3.0.
|
|
66
|
-
"yaml": "^2.
|
|
65
|
+
"pmtiles": "^3.0.7",
|
|
66
|
+
"yaml": "^2.5.1"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@maplibre/maplibre-gl-style-spec": "20.x"
|