@anthropomorphic/delorean 0.2.0 → 0.2.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.
@@ -1,8 +1,8 @@
1
1
  var C = (n) => {
2
2
  throw TypeError(n);
3
3
  };
4
- var T = (n, t, e) => t.has(n) || C("Cannot " + e);
5
- var i = (n, t, e) => (T(n, t, "read from private field"), e ? e.call(n) : t.get(n)), u = (n, t, e) => t.has(n) ? C("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), h = (n, t, e, m) => (T(n, t, "write to private field"), m ? m.call(n, e) : t.set(n, e), e), d = (n, t, e) => (T(n, t, "access private method"), e);
4
+ var c = (n, t, e) => t.has(n) || C("Cannot " + e);
5
+ var i = (n, t, e) => (c(n, t, "read from private field"), e ? e.call(n) : t.get(n)), u = (n, t, e) => t.has(n) ? C("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), h = (n, t, e, m) => (c(n, t, "write to private field"), m ? m.call(n, e) : t.set(n, e), e), d = (n, t, e) => (c(n, t, "access private method"), e);
6
6
  var f = (n, t, e, m) => ({
7
7
  set _(a) {
8
8
  h(n, t, a, e);
@@ -21,7 +21,7 @@ class w {
21
21
  u(this, r);
22
22
  u(this, o, []);
23
23
  u(this, l, !1);
24
- h(this, s, [...t].toSorted((m, a) => m - a)), h(this, r, i(this, s).length > 0 ? v(e, t) : void 0);
24
+ h(this, s, [...t].toSorted((m, a) => m - a)), h(this, r, i(this, s).length > 0 ? v(e, i(this, s)) : void 0);
25
25
  }
26
26
  get times() {
27
27
  return i(this, s);
@@ -33,13 +33,13 @@ class w {
33
33
  const m = this.currentTime;
34
34
  switch (e) {
35
35
  case "union":
36
- h(this, s, [.../* @__PURE__ */ new Set([...i(this, s), ...t])].sort((a, c) => a - c));
36
+ h(this, s, [.../* @__PURE__ */ new Set([...i(this, s), ...t])].sort((a, T) => a - T));
37
37
  break;
38
38
  case "intersect":
39
- h(this, s, [.../* @__PURE__ */ new Set([...i(this, s), ...t])].sort((a, c) => a - c));
39
+ h(this, s, [.../* @__PURE__ */ new Set([...i(this, s), ...t])].sort((a, T) => a - T));
40
40
  break;
41
41
  default:
42
- h(this, s, [...t].sort((a, c) => a - c));
42
+ h(this, s, [...t].sort((a, T) => a - T));
43
43
  break;
44
44
  }
45
45
  i(this, s).length === 0 ? (h(this, r, void 0), h(this, l, !1)) : m !== void 0 && i(this, s).includes(m) ? h(this, r, i(this, s).indexOf(m)) : (h(this, r, void 0), h(this, l, !1)), this.currentTime !== m && this.timeChanged(this.currentTime);
@@ -7,27 +7,27 @@ var T = (t, e, i) => w(t, typeof e != "symbol" ? e + "" : e, i), f = (t, e, i) =
7
7
  var s = (t, e, i) => (f(t, e, "read from private field"), i ? i.call(t) : e.get(t)), h = (t, e, i) => e.has(t) ? g("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), m = (t, e, i, r) => (f(t, e, "write to private field"), r ? r.call(t, i) : e.set(t, i), i);
8
8
  import * as b from "leaflet";
9
9
  import { g as p } from "../delorean.utils-DOgTNSYn.js";
10
- var a, o, d, n, l;
10
+ var a, n, d, o, l;
11
11
  class I {
12
12
  constructor(e, i) {
13
13
  T(this, "layerId");
14
14
  T(this, "layer");
15
15
  T(this, "getCapabilitiesUrl");
16
16
  h(this, a);
17
- h(this, o);
18
- h(this, d);
19
17
  h(this, n);
18
+ h(this, d);
19
+ h(this, o);
20
20
  h(this, l);
21
- m(this, a, e), this.layerId = i.layerId, this.getCapabilitiesUrl = i.getCapabilitiesUrl, m(this, o, i.tileBaseUrl), m(this, d, i.wmsOptions), this.layer = b.tileLayer.wms(s(this, o), s(this, d));
21
+ m(this, a, e), this.layerId = i.layerId, this.getCapabilitiesUrl = i.getCapabilitiesUrl, m(this, n, i.tileBaseUrl), m(this, d, i.wmsOptions), this.layer = b.tileLayer.wms(s(this, n), s(this, d));
22
22
  }
23
23
  async addTo(e, i, r = "intersect") {
24
24
  const y = await this.loadTimes();
25
- e.addLayer(this.layer), m(this, n, y.discreteValues), s(this, a).setTimes(s(this, n) ?? [], r), m(this, l, (C) => this.setTime(C)), s(this, a).addTimeChangedCallback(s(this, l));
25
+ e.addLayer(this.layer), m(this, o, y.discreteValues), s(this, a).setTimes(s(this, o) ?? [], r), m(this, l, (C) => this.setTime(C)), s(this, a).addTimeChangedCallback(s(this, l));
26
26
  const c = i ?? y.defaultValue;
27
- return c ? s(this, a).setCurrentTime(c) : s(this, a).lastTime(), await new Promise((C) => this.layer.once("load", C)), this;
27
+ return c !== void 0 ? s(this, a).setCurrentTime(c) : s(this, a).lastTime(), await new Promise((C) => this.layer.once("load", C)), this;
28
28
  }
29
29
  removeFrom(e) {
30
- return e.removeLayer(this.layer), s(this, a).removeTimes(s(this, n) ?? []), s(this, l) && s(this, a).removeTimeChangedCallback(s(this, l)), this;
30
+ return e.removeLayer(this.layer), s(this, a).removeTimes(s(this, o) ?? []), s(this, l) && s(this, a).removeTimeChangedCallback(s(this, l)), this;
31
31
  }
32
32
  loadTimes() {
33
33
  if (!this.getCapabilitiesUrl) throw new Error("getCapabilitiesUrl undefined");
@@ -44,7 +44,7 @@ class I {
44
44
  }), await y, this;
45
45
  }
46
46
  }
47
- a = new WeakMap(), o = new WeakMap(), d = new WeakMap(), n = new WeakMap(), l = new WeakMap();
47
+ a = new WeakMap(), n = new WeakMap(), d = new WeakMap(), o = new WeakMap(), l = new WeakMap();
48
48
  export {
49
49
  I as LeafletRasterTimeLayer
50
50
  };
@@ -1,13 +1,13 @@
1
- var $ = Object.defineProperty;
1
+ var v = Object.defineProperty;
2
2
  var U = (i) => {
3
3
  throw TypeError(i);
4
4
  };
5
- var v = (i, e, t) => e in i ? $(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
6
- var n = (i, e, t) => v(i, typeof e != "symbol" ? e + "" : e, t), b = (i, e, t) => e.has(i) || U("Cannot " + t);
7
- var r = (i, e, t) => (b(i, e, "read from private field"), t ? t.call(i) : e.get(i)), l = (i, e, t) => e.has(i) ? U("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), c = (i, e, t, h) => (b(i, e, "write to private field"), h ? h.call(i, t) : e.set(i, t), t), T = (i, e, t) => (b(i, e, "access private method"), t);
5
+ var $ = (i, e, t) => e in i ? v(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
6
+ var n = (i, e, t) => $(i, typeof e != "symbol" ? e + "" : e, t), b = (i, e, t) => e.has(i) || U("Cannot " + t);
7
+ var r = (i, e, t) => (b(i, e, "read from private field"), t ? t.call(i) : e.get(i)), l = (i, e, t) => e.has(i) ? U("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), d = (i, e, t, h) => (b(i, e, "write to private field"), h ? h.call(i, t) : e.set(i, t), t), T = (i, e, t) => (b(i, e, "access private method"), t);
8
8
  import * as L from "maplibre-gl";
9
9
  import { g as p } from "../delorean.utils-DOgTNSYn.js";
10
- var s, I, u, g, m, d, a, w, S, C;
10
+ var s, I, u, g, m, c, a, w, S, C;
11
11
  class R {
12
12
  constructor(e, t) {
13
13
  l(this, a);
@@ -21,17 +21,17 @@ class R {
21
21
  l(this, u);
22
22
  l(this, g);
23
23
  l(this, m);
24
- l(this, d);
25
- c(this, s, e), this.sourceId = t.sourceId, this.layerId = t.layerId, this.getCapabilitiesUrl = t.getCapabilitiesUrl, c(this, I, t.tileBaseUrl), c(this, u, new URLSearchParams(t.tileUrlParams)), c(this, g, t.tileUrlTemplate), this.source = T(this, a, w).call(this), this.layer = T(this, a, S).call(this, t.paint);
24
+ l(this, c);
25
+ d(this, s, e), this.sourceId = t.sourceId, this.layerId = t.layerId, this.getCapabilitiesUrl = t.getCapabilitiesUrl, d(this, I, t.tileBaseUrl), d(this, u, new URLSearchParams(t.tileUrlParams)), d(this, g, t.tileUrlTemplate), this.source = T(this, a, w).call(this), this.layer = T(this, a, S).call(this, t.paint);
26
26
  }
27
27
  async addTo(e, t, h = "intersect") {
28
28
  const f = await this.loadTimes();
29
- e.addSource(this.sourceId, this.source), e.addLayer(this.layer), c(this, m, f.discreteValues), r(this, s).setTimes(r(this, m) ?? [], h), c(this, d, (y) => this.setTime(e, y)), r(this, s).addTimeChangedCallback(r(this, d));
29
+ e.addSource(this.sourceId, this.source), e.addLayer(this.layer), d(this, m, f.discreteValues), r(this, s).setTimes(r(this, m) ?? [], h), d(this, c, (y) => this.setTime(e, y)), r(this, s).addTimeChangedCallback(r(this, c));
30
30
  const o = t ?? f.defaultValue;
31
- return o ? r(this, s).setCurrentTime(o) : r(this, s).lastTime(), await new Promise((y) => e.once("idle", y)), this;
31
+ return o !== void 0 ? r(this, s).setCurrentTime(o) : r(this, s).lastTime(), await new Promise((y) => e.once("idle", y)), this;
32
32
  }
33
33
  removeFrom(e) {
34
- return e.getLayer(this.layerId) && e.removeLayer(this.layerId), e.getSource(this.sourceId) && e.removeSource(this.sourceId), r(this, s).removeTimes(r(this, m) ?? []), r(this, d) && r(this, s).removeTimeChangedCallback(r(this, d)), this;
34
+ return e.getLayer(this.layerId) && e.removeLayer(this.layerId), e.getSource(this.sourceId) && e.removeSource(this.sourceId), r(this, s).removeTimes(r(this, m) ?? []), r(this, c) && r(this, s).removeTimeChangedCallback(r(this, c)), this;
35
35
  }
36
36
  loadTimes() {
37
37
  if (!this.getCapabilitiesUrl) throw new Error("getCapabilitiesUrl undefined");
@@ -48,7 +48,7 @@ class R {
48
48
  return r(this, u).set("TIME", `${new Date(h).toISOString()}`), o instanceof L.RasterTileSource && o.setTiles([T(this, a, C).call(this)]), await f, this;
49
49
  }
50
50
  }
51
- s = new WeakMap(), I = new WeakMap(), u = new WeakMap(), g = new WeakMap(), m = new WeakMap(), d = new WeakMap(), a = new WeakSet(), w = function() {
51
+ s = new WeakMap(), I = new WeakMap(), u = new WeakMap(), g = new WeakMap(), m = new WeakMap(), c = new WeakMap(), a = new WeakSet(), w = function() {
52
52
  return {
53
53
  type: "raster",
54
54
  tiles: [T(this, a, C).call(this)]
package/dist/ui/index.js CHANGED
@@ -5,7 +5,7 @@ var _ = (e) => {
5
5
  var A = (e, s, t) => s in e ? q(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
6
6
  var k = (e, s, t) => A(e, typeof s != "symbol" ? s + "" : s, t), y = (e, s, t) => s.has(e) || _("Cannot " + t);
7
7
  var n = (e, s, t) => (y(e, s, "read from private field"), t ? t.call(e) : s.get(e)), a = (e, s, t) => s.has(e) ? _("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), l = (e, s, t, i) => (y(e, s, "write to private field"), i ? i.call(e, t) : s.set(e, t), t), h = (e, s, t) => (y(e, s, "access private method"), t);
8
- var r, p, c, m, g, u, d, w, b, o, f, B, M, x, D, F, C, E, Z, R;
8
+ var r, p, c, m, g, v, d, w, b, o, f, B, M, x, D, F, C, E, Z, R;
9
9
  class L extends HTMLElement {
10
10
  constructor() {
11
11
  super();
@@ -16,7 +16,7 @@ class L extends HTMLElement {
16
16
  a(this, c);
17
17
  a(this, m);
18
18
  a(this, g);
19
- a(this, u);
19
+ a(this, v);
20
20
  a(this, d);
21
21
  a(this, w, "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20height%3D%2224px%22%20viewBox%3D%220%20-960%20960%20960%22%20width%3D%2224px%22%20fill%3D%22%23000000%22%3E%3Cpath%20d%3D%22M560-200v-560h160v560H560Zm-320%200v-560h160v560H240Z%22%2F%3E%3C%2Fsvg%3E");
22
22
  a(this, b, "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20height%3D%2224px%22%20viewBox%3D%220%20-960%20960%20960%22%20width%3D%2224px%22%20fill%3D%22%23000000%22%3E%3Cpath%20d%3D%22M320-200v-560l440%20280-440%20280Z%22%2F%3E%3C%2Fsvg%3E");
@@ -45,16 +45,16 @@ class L extends HTMLElement {
45
45
  new CustomEvent("delorean-play", { bubbles: !0, composed: !0, detail: n(this, r) })
46
46
  );
47
47
  });
48
- this.shadowRoot = this.attachShadow({ mode: "open" }), this.shadowRoot.appendChild(h(this, o, f).call(this).content.cloneNode(!0)), this.shadowRoot.appendChild(h(this, o, B).call(this).cloneNode(!0)), l(this, p, this.shadowRoot.querySelector("#datetime")), l(this, c, this.shadowRoot.querySelector("#first")), l(this, m, this.shadowRoot.querySelector("#prev")), l(this, g, this.shadowRoot.querySelector("#next")), l(this, u, this.shadowRoot.querySelector("#last")), l(this, d, this.shadowRoot.querySelector("#play"));
48
+ this.shadowRoot = this.attachShadow({ mode: "open" }), this.shadowRoot.appendChild(h(this, o, f).call(this).content.cloneNode(!0)), this.shadowRoot.appendChild(h(this, o, B).call(this).cloneNode(!0)), l(this, p, this.shadowRoot.querySelector("#datetime")), l(this, c, this.shadowRoot.querySelector("#first")), l(this, m, this.shadowRoot.querySelector("#prev")), l(this, g, this.shadowRoot.querySelector("#next")), l(this, v, this.shadowRoot.querySelector("#last")), l(this, d, this.shadowRoot.querySelector("#play"));
49
49
  }
50
50
  connectedCallback() {
51
51
  h(this, o, M).call(this);
52
52
  }
53
53
  set time(t) {
54
- n(this, p).value = t ? h(this, o, R).call(this, t) : "";
54
+ n(this, p).value = t !== void 0 ? h(this, o, R).call(this, t) : "";
55
55
  }
56
56
  }
57
- r = new WeakMap(), p = new WeakMap(), c = new WeakMap(), m = new WeakMap(), g = new WeakMap(), u = new WeakMap(), d = new WeakMap(), w = new WeakMap(), b = new WeakMap(), o = new WeakSet(), f = function() {
57
+ r = new WeakMap(), p = new WeakMap(), c = new WeakMap(), m = new WeakMap(), g = new WeakMap(), v = new WeakMap(), d = new WeakMap(), w = new WeakMap(), b = new WeakMap(), o = new WeakSet(), f = function() {
58
58
  const t = document.createElement("template");
59
59
  return t.innerHTML = `
60
60
  <div part="delorean" class="delorean">
@@ -112,15 +112,15 @@ r = new WeakMap(), p = new WeakMap(), c = new WeakMap(), m = new WeakMap(), g =
112
112
  }
113
113
  `, t;
114
114
  }, M = function() {
115
- n(this, c).onclick = n(this, x), n(this, m).onclick = n(this, D), n(this, g).onclick = n(this, F), n(this, u).onclick = n(this, C), n(this, d).onclick = n(this, E);
115
+ n(this, c).onclick = n(this, x), n(this, m).onclick = n(this, D), n(this, g).onclick = n(this, F), n(this, v).onclick = n(this, C), n(this, d).onclick = n(this, E);
116
116
  }, x = new WeakMap(), D = new WeakMap(), F = new WeakMap(), C = new WeakMap(), E = new WeakMap(), Z = function(t) {
117
117
  const i = n(this, d).querySelector("span.delorean-btn__icon");
118
118
  i && (i.style.maskImage = `url('${t ? n(this, w) : n(this, b)}')`);
119
119
  }, R = function(t) {
120
- const i = new Date(t), v = (S) => S.toString().padStart(2, "0");
120
+ const i = new Date(t), u = (S) => S.toString().padStart(2, "0");
121
121
  return [
122
- `${i.getFullYear()}-${v(i.getMonth() + 1)}-${v(i.getDate())}`,
123
- `${v(i.getHours())}:${v(i.getMinutes())}`
122
+ `${i.getFullYear()}-${u(i.getMonth() + 1)}-${u(i.getDate())}`,
123
+ `${u(i.getHours())}:${u(i.getMinutes())}`
124
124
  ].join("T");
125
125
  };
126
126
  customElements.define("delorean-controller", L);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthropomorphic/delorean",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Lightweight custom time controller library for WMS layer for Leaflet and Maplibre map frameworks.",
5
5
  "license": "MIT",
6
6
  "type": "module",