@trailstash/ultra 3.2.1 → 3.2.3

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.swo CHANGED
Binary file
package/cli/build.js CHANGED
@@ -11,9 +11,9 @@ const engine = new Liquid();
11
11
  export const getHTMLContext = async (configFile) => {
12
12
  const config = await import(configFile);
13
13
  const {
14
- settings: { title, description, url, mastodon },
14
+ settings: { title, icon, description, url, mastodon },
15
15
  } = config.modes[config.defaultMode];
16
- return { title, description, url, mastodon };
16
+ return { title, icon, description, url, mastodon };
17
17
  };
18
18
 
19
19
  export const buildConfigFromQuery = async (config, query) => {
@@ -7,6 +7,7 @@ import { parseSettings } from "../lib/settings.js";
7
7
  import queryProviders from "../lib/queryProviders/index.js";
8
8
  import AutoProvider from "../lib/queryProviders/auto.js";
9
9
  import {
10
+ hasHash,
10
11
  getOptionsFromQueryParams,
11
12
  getQueryFromQueryParams,
12
13
  } from "../lib/queryParams.js";
@@ -160,6 +161,8 @@ export class UltraMap extends HTMLElement {
160
161
  }
161
162
 
162
163
  #initUnbound(mapStyle) {
164
+ const hadHash = hasHash(this.options.hash);
165
+
163
166
  this.refs = {
164
167
  mapLibre: h("map-libre", {
165
168
  mapStyle,
@@ -187,6 +190,7 @@ export class UltraMap extends HTMLElement {
187
190
  return this.#run().then((data) => {
188
191
  if (
189
192
  this.#fitBounds &&
193
+ (!this.options.hash || !hadHash) &&
190
194
  !this.options.bounds &&
191
195
  (this.options.zoom === undefined || !this.options.center)
192
196
  ) {
package/index.html CHANGED
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <link rel="icon" href="./logo.png" />
6
+ <link rel="icon" href="{{ icon | default: "./logo.png" }}"/>
7
7
  {% if mastodon %}
8
8
  <link rel="me" href="{{ mastodon }}" />
9
9
  {% endif %}
@@ -41,6 +41,19 @@ const fetchURL = async (url) => {
41
41
  return await resp.text();
42
42
  };
43
43
 
44
+ export const hasHash = (hashName) => {
45
+ let hash = window.location.hash.slice(1)
46
+ if (hashName) {
47
+ const params = new URLSearchParams(hash);
48
+ hash = params.get(hashName);
49
+ }
50
+ if (!hash) {
51
+ return false
52
+ }
53
+ const loc = hash.split("/");
54
+ return loc.length >= 3 && !loc.some(v => isNaN(v));
55
+ };
56
+
44
57
  export const getQueryFromQueryParams = () => {
45
58
  const params = new URLSearchParams(window.location.hash.slice(1));
46
59
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.2.1",
6
+ "version": "3.2.3",
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": {