@trailstash/ultra 3.5.2 → 3.6.0
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/components/help-modal.js
CHANGED
|
@@ -58,6 +58,7 @@ The [source code](https://gitlab.com/trailstash/ultra) of this application is re
|
|
|
58
58
|
`;
|
|
59
59
|
|
|
60
60
|
export class HelpModal extends HTMLElement {
|
|
61
|
+
type;
|
|
61
62
|
static defaults = {
|
|
62
63
|
help,
|
|
63
64
|
};
|
|
@@ -99,9 +100,14 @@ export class HelpModal extends HTMLElement {
|
|
|
99
100
|
<h4>Installed Query Providers</h4>
|
|
100
101
|
<ul>
|
|
101
102
|
${Object.entries(this.queryProviders)
|
|
102
|
-
.map(
|
|
103
|
+
.map(
|
|
104
|
+
([name, { detect }]) =>
|
|
105
|
+
`<li><code>${name}${name == this.type ? "+" : ""}${"auto" in this.queryProviders && detect ? "*" : ""}</code></li>`,
|
|
106
|
+
)
|
|
103
107
|
.join("\n")}
|
|
104
108
|
</ul>
|
|
109
|
+
<code>+</code> default provider.
|
|
110
|
+
${"auto" in this.queryProviders && Object.values(this.queryProviders).some(({ detect }) => !!detect) ? "<br><code>*</code> detected by <code>auto</code> provider." : ""}
|
|
105
111
|
</div>
|
|
106
112
|
${stylesHTML}
|
|
107
113
|
<div>
|
package/components/ultra-ide.js
CHANGED
|
@@ -135,6 +135,7 @@ export class UltraIDE extends HTMLElement {
|
|
|
135
135
|
h("help-modal", {
|
|
136
136
|
help: this.help || HelpModal.defaults.help,
|
|
137
137
|
styles: this.styles || StylePicker.defaults.styles,
|
|
138
|
+
type: this.settings.type || UltraMap.defaults.type,
|
|
138
139
|
queryProviders:
|
|
139
140
|
this.settings.queryProviders || UltraMap.defaults.queryProviders,
|
|
140
141
|
}),
|
package/docs/yaml.md
CHANGED
|
@@ -59,6 +59,7 @@ Automatically detects and chooses the right query provider out of the following:
|
|
|
59
59
|
- `kml`
|
|
60
60
|
- `gpx`
|
|
61
61
|
- `tcx`
|
|
62
|
+
- `raw`
|
|
62
63
|
|
|
63
64
|
See each provider for how it is auto-detected
|
|
64
65
|
|
|
@@ -156,6 +157,14 @@ Detected if
|
|
|
156
157
|
|
|
157
158
|
- Parses as XML and contains a top level `tcx` tag
|
|
158
159
|
|
|
160
|
+
### `raw`
|
|
161
|
+
|
|
162
|
+
A full [MapLibre Source](https://maplibre.org/maplibre-style-spec/sources/) as JSON or YAML.
|
|
163
|
+
|
|
164
|
+
Detected if
|
|
165
|
+
|
|
166
|
+
- Parses as JSON or YAML and contains a valid MapLibre Source `type`.
|
|
167
|
+
|
|
159
168
|
### `raster`
|
|
160
169
|
|
|
161
170
|
A line delimited list of [tile URLs](https://maplibre.org/maplibre-style-spec/sources/#tiles_1) for
|
|
@@ -47,10 +47,6 @@ export default class AutoProvider {
|
|
|
47
47
|
return this.#popupTemplate;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
get popupTemplate() {
|
|
51
|
-
return this.#popupTemplate;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
50
|
get invalidateCacheOnBBox() {
|
|
55
51
|
// This isn't ideal, because this is called _before_ `source`, but it will work because it's either:
|
|
56
52
|
// * undefined & the first run, so bc first run it always will execute anyway
|
|
@@ -8,20 +8,22 @@ import { osmxml, osmjson } from "./osm.js";
|
|
|
8
8
|
import kml from "./kml.js";
|
|
9
9
|
import gpx from "./gpx.js";
|
|
10
10
|
import tcx from "./tcx.js";
|
|
11
|
+
import raw from "./raw.js";
|
|
11
12
|
|
|
12
13
|
export const all = {
|
|
14
|
+
raw,
|
|
15
|
+
raster,
|
|
16
|
+
vector,
|
|
13
17
|
overpass,
|
|
14
18
|
osmWebsite,
|
|
15
19
|
osmWiki,
|
|
16
|
-
ohsome,
|
|
17
|
-
geojson,
|
|
18
20
|
osmxml,
|
|
19
21
|
osmjson,
|
|
22
|
+
geojson,
|
|
20
23
|
kml,
|
|
21
24
|
gpx,
|
|
22
25
|
tcx,
|
|
23
|
-
|
|
24
|
-
vector,
|
|
26
|
+
ohsome,
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
export default { auto: new AutoProvider(all), ...all };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import YAML from "yaml";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
source: async function geojson(query, controller) {
|
|
5
|
+
let data;
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(query);
|
|
8
|
+
} catch {
|
|
9
|
+
return YAML.parse(query, { merge: true });
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
detect,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const sourceTypes = [
|
|
16
|
+
"vector",
|
|
17
|
+
"raster",
|
|
18
|
+
"geojson",
|
|
19
|
+
"image",
|
|
20
|
+
"raster-dem",
|
|
21
|
+
"video",
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
function detect(query) {
|
|
25
|
+
try {
|
|
26
|
+
let json;
|
|
27
|
+
try {
|
|
28
|
+
json = JSON.parse(query);
|
|
29
|
+
} catch {
|
|
30
|
+
json = YAML.parse(query, { merge: true });
|
|
31
|
+
}
|
|
32
|
+
if (sourceTypes.includes(json.type)) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
} catch {}
|
|
36
|
+
}
|
package/package.json
CHANGED