@anthropomorphic/delorean 0.1.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,89 +1,107 @@
1
- var d = (r) => {
2
- throw TypeError(r);
1
+ var C = (n) => {
2
+ throw TypeError(n);
3
3
  };
4
- var T = (r, t, e) => t.has(r) || d("Cannot " + e);
5
- var i = (r, t, e) => (T(r, t, "read from private field"), e ? e.call(r) : t.get(r)), g = (r, t, e) => t.has(r) ? d("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), n = (r, t, e, a) => (T(r, t, "write to private field"), a ? a.call(r, e) : t.set(r, e), e), f = (r, t, e) => (T(r, t, "access private method"), e);
6
- var u = (r, t, e, a) => ({
7
- set _(m) {
8
- n(r, t, m, 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
+ var f = (n, t, e, m) => ({
7
+ set _(a) {
8
+ h(n, t, a, e);
9
9
  },
10
10
  get _() {
11
- return i(r, t, a);
11
+ return i(n, t, m);
12
12
  }
13
13
  });
14
- import { a as C } from "../delorean.utils-DOgTNSYn.js";
15
- import { g as y } from "../delorean.utils-DOgTNSYn.js";
16
- var h, s, l, o, c, b, k;
17
- class x {
14
+ import { a as v } from "../delorean.utils-DOgTNSYn.js";
15
+ import { g as P } from "../delorean.utils-DOgTNSYn.js";
16
+ var s, r, o, l, g, p, x;
17
+ class w {
18
18
  constructor(t = [], e = (/* @__PURE__ */ new Date()).getTime()) {
19
- g(this, c);
20
- g(this, h);
21
- g(this, s);
22
- g(this, l, []);
23
- g(this, o, !1);
24
- n(this, h, [...t].toSorted((a, m) => a - m)), n(this, s, C(e, t));
19
+ u(this, g);
20
+ u(this, s);
21
+ u(this, r);
22
+ u(this, o, []);
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, i(this, s)) : void 0);
25
25
  }
26
26
  get times() {
27
- return i(this, h);
27
+ return i(this, s);
28
28
  }
29
29
  get currentTime() {
30
- return i(this, h)[i(this, s)];
30
+ return i(this, r) ? i(this, s)[i(this, r)] : void 0;
31
31
  }
32
32
  setTimes(t, e = "intersect") {
33
+ const m = this.currentTime;
33
34
  switch (e) {
34
35
  case "union":
35
- n(this, h, [...i(this, h), ...t].toSorted((a, m) => a - m));
36
+ h(this, s, [.../* @__PURE__ */ new Set([...i(this, s), ...t])].sort((a, T) => a - T));
36
37
  break;
37
38
  case "intersect":
38
- n(this, h, [...new Set([...i(this, h), ...t].toSorted((a, m) => a - m))]);
39
+ h(this, s, [.../* @__PURE__ */ new Set([...i(this, s), ...t])].sort((a, T) => a - T));
39
40
  break;
40
41
  default:
41
- n(this, h, [...t]);
42
+ h(this, s, [...t].sort((a, T) => a - T));
42
43
  break;
43
44
  }
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);
44
46
  }
45
47
  setCurrentTime(t) {
46
- n(this, s, C(t, i(this, h))), this.timeChanged(this.currentTime);
48
+ if (i(this, s).length === 0) {
49
+ this.resetCurrentTime();
50
+ return;
51
+ }
52
+ h(this, r, v(t, i(this, s))), this.timeChanged(this.currentTime);
53
+ }
54
+ resetCurrentTime() {
55
+ h(this, r, void 0), h(this, l, !1), this.timeChanged(void 0);
47
56
  }
48
57
  removeTimes(t) {
49
- const e = new Set(t);
50
- n(this, h, i(this, h).filter(
51
- (a) => !e.has(a)
52
- ));
58
+ const e = this.currentTime, m = new Set(t);
59
+ h(this, s, i(this, s).filter((a) => !m.has(a))), i(this, s).length === 0 || e === void 0 || m.has(e) ? (h(this, r, void 0), h(this, l, !1)) : h(this, r, i(this, s).indexOf(e)), this.currentTime !== e && this.timeChanged(this.currentTime);
53
60
  }
54
61
  prevTime(t = !0) {
55
- u(this, s)._--, t ? (i(this, s) < 0 && n(this, s, i(this, h).length - 1), i(this, s) > i(this, h).length - 1 && n(this, s, 0)) : (i(this, s) < 0 && n(this, s, 0), i(this, s) > i(this, h).length - 1 && n(this, s, i(this, h).length - 1)), this.timeChanged(this.currentTime);
62
+ i(this, r) === void 0 || i(this, s).length === 0 || (f(this, r)._--, t ? i(this, r) < 0 && h(this, r, i(this, s).length - 1) : h(this, r, Math.max(0, i(this, r))), this.timeChanged(this.currentTime));
56
63
  }
57
64
  nextTime(t = !0) {
58
- u(this, s)._++, t ? (i(this, s) < 0 && n(this, s, i(this, h).length - 1), i(this, s) > i(this, h).length - 1 && n(this, s, 0)) : (i(this, s) < 0 && n(this, s, 0), i(this, s) > i(this, h).length - 1 && n(this, s, i(this, h).length - 1)), this.timeChanged(this.currentTime);
65
+ i(this, r) === void 0 || i(this, s).length === 0 || (f(this, r)._++, t ? i(this, r) >= i(this, s).length && h(this, r, 0) : h(this, r, Math.min(
66
+ i(this, s).length - 1,
67
+ i(this, r)
68
+ )), this.timeChanged(this.currentTime));
59
69
  }
60
70
  firstTime() {
61
- n(this, s, 0), this.timeChanged(this.currentTime);
71
+ if (i(this, s).length === 0) {
72
+ this.resetCurrentTime();
73
+ return;
74
+ }
75
+ h(this, r, 0), this.timeChanged(this.currentTime);
62
76
  }
63
77
  lastTime() {
64
- n(this, s, i(this, h).length - 1), this.timeChanged(this.currentTime);
78
+ if (i(this, s).length === 0) {
79
+ this.resetCurrentTime();
80
+ return;
81
+ }
82
+ h(this, r, i(this, s).length - 1), this.timeChanged(this.currentTime);
65
83
  }
66
84
  togglePlay(t, e = 3e3) {
67
- n(this, o, t), f(this, c, b).call(this, () => this.nextTime(), e);
85
+ h(this, l, t), d(this, g, p).call(this, () => this.nextTime(), e);
68
86
  }
69
87
  addTimeChangedCallback(t) {
70
- i(this, l).push(t);
88
+ i(this, o).push(t);
71
89
  }
72
90
  removeTimeChangedCallback(t) {
73
- n(this, l, i(this, l).filter((e) => e !== t));
91
+ h(this, o, i(this, o).filter((e) => e !== t));
74
92
  }
75
93
  timeChanged(t) {
76
- i(this, l).forEach((e) => e(t));
94
+ i(this, o).forEach((e) => e(t));
77
95
  }
78
96
  }
79
- h = new WeakMap(), s = new WeakMap(), l = new WeakMap(), o = new WeakMap(), c = new WeakSet(), b = async function(t, e) {
80
- for (; i(this, o) && (await t(), !!i(this, o)); )
81
- await f(this, c, k).call(this, e);
82
- }, k = function(t) {
97
+ s = new WeakMap(), r = new WeakMap(), o = new WeakMap(), l = new WeakMap(), g = new WeakSet(), p = async function(t, e) {
98
+ for (; i(this, l) && (await t(), !!i(this, l)); )
99
+ await d(this, g, x).call(this, e);
100
+ }, x = function(t) {
83
101
  return new Promise((e) => setTimeout(e, t));
84
102
  };
85
103
  export {
86
- x as Delorean,
87
- C as getCurrentTimeIndex,
88
- y as getLayerTimes
104
+ w as Delorean,
105
+ v as getCurrentTimeIndex,
106
+ P as getLayerTimes
89
107
  };
@@ -10,5 +10,5 @@ export declare class LeafletRasterTimeLayer {
10
10
  addTo(map: leaflet.Map, defaultTime?: number, operation?: TimesOperation): Promise<this>;
11
11
  removeFrom(map: leaflet.Map): this;
12
12
  loadTimes(): Promise<LayerTimeInfo>;
13
- setTime(time: number): Promise<this>;
13
+ setTime(time: number | undefined): Promise<this>;
14
14
  }
@@ -12,5 +12,5 @@ export declare class MaplibreglRasterTimeLayer {
12
12
  addTo(map: maplibregl.Map, defaultTime?: number, operation?: TimesOperation): Promise<this>;
13
13
  removeFrom(map: maplibregl.Map): this;
14
14
  loadTimes(): Promise<LayerTimeInfo>;
15
- setTime(map: maplibregl.Map, time: number): Promise<this>;
15
+ setTime(map: maplibregl.Map, time: number | undefined): Promise<this>;
16
16
  }
@@ -3,16 +3,17 @@ export declare class Delorean {
3
3
  #private;
4
4
  constructor(defaultTimes?: number[], defaultCurrentTime?: number);
5
5
  get times(): number[];
6
- get currentTime(): number;
6
+ get currentTime(): number | undefined;
7
7
  setTimes(newTimes: number[], operation?: TimesOperation): void;
8
8
  setCurrentTime(time: number): void;
9
+ resetCurrentTime(): void;
9
10
  removeTimes(timesToRemove: number[]): void;
10
11
  prevTime(loop?: boolean): void;
11
12
  nextTime(loop?: boolean): void;
12
13
  firstTime(): void;
13
14
  lastTime(): void;
14
15
  togglePlay(isPlaying: boolean, interval?: number): void;
15
- addTimeChangedCallback(callback: (newTime: number) => void): void;
16
- removeTimeChangedCallback(callback: (newTime: number) => void): void;
17
- timeChanged(newTime: number): void;
16
+ addTimeChangedCallback(callback: (newTime: number | undefined) => void): void;
17
+ removeTimeChangedCallback(callback: (newTime: number | undefined) => void): void;
18
+ timeChanged(newTime: number | undefined): void;
18
19
  }
@@ -3,5 +3,5 @@ export declare class DeloreanController extends HTMLElement {
3
3
  shadowRoot: ShadowRoot;
4
4
  constructor();
5
5
  connectedCallback(): void;
6
- set time(value: number);
6
+ set time(value: number | undefined);
7
7
  }
@@ -1,48 +1,50 @@
1
- var f = Object.defineProperty;
1
+ var u = Object.defineProperty;
2
2
  var g = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
- var u = (t, e, i) => e in t ? f(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
6
- var c = (t, e, i) => u(t, typeof e != "symbol" ? e + "" : e, i), w = (t, e, i) => e.has(t) || g("Cannot " + i);
7
- var s = (t, e, i) => (w(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, l) => (w(t, e, "write to private field"), l ? l.call(t, i) : e.set(t, i), i);
5
+ var w = (t, e, i) => e in t ? u(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
6
+ var T = (t, e, i) => w(t, typeof e != "symbol" ? e + "" : e, i), f = (t, e, i) => e.has(t) || g("Cannot " + i);
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, r;
11
- class L {
10
+ var a, n, d, o, l;
11
+ class I {
12
12
  constructor(e, i) {
13
- c(this, "layerId");
14
- c(this, "layer");
15
- c(this, "getCapabilitiesUrl");
13
+ T(this, "layerId");
14
+ T(this, "layer");
15
+ T(this, "getCapabilitiesUrl");
16
16
  h(this, a);
17
- h(this, o);
18
- h(this, d);
19
17
  h(this, n);
20
- h(this, r);
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));
18
+ h(this, d);
19
+ h(this, o);
20
+ h(this, l);
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
- async addTo(e, i, l = "intersect") {
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) ?? [], l), m(this, r, (T) => this.setTime(T)), s(this, a).addTimeChangedCallback(s(this, r));
26
- const C = i ?? y.defaultValue;
27
- return C ? s(this, a).setCurrentTime(C) : s(this, a).lastTime(), await new Promise((T) => this.layer.once("load", T)), this;
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
+ const c = i ?? y.defaultValue;
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, r) && s(this, a).removeTimeChangedCallback(s(this, r)), 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");
34
34
  return p(this.getCapabilitiesUrl, this.layerId);
35
35
  }
36
36
  async setTime(e) {
37
- const i = this.layer, l = new Promise((y) => {
38
- i.once("load", () => y());
37
+ const i = this.layer, r = e ?? s(this, a).times.at(-1);
38
+ if (r === void 0) return this;
39
+ const y = new Promise((c) => {
40
+ i.once("load", () => c());
39
41
  });
40
42
  return i.setParams({
41
- time: new Date(e).toISOString()
42
- }), await l, this;
43
+ time: new Date(r).toISOString()
44
+ }), await y, this;
43
45
  }
44
46
  }
45
- a = new WeakMap(), o = new WeakMap(), d = new WeakMap(), n = new WeakMap(), r = new WeakMap();
47
+ a = new WeakMap(), n = new WeakMap(), d = new WeakMap(), o = new WeakMap(), l = new WeakMap();
46
48
  export {
47
- L as LeafletRasterTimeLayer
49
+ I as LeafletRasterTimeLayer
48
50
  };
@@ -1,13 +1,13 @@
1
- var $ = Object.defineProperty;
2
- var b = (i) => {
1
+ var v = Object.defineProperty;
2
+ var U = (i) => {
3
3
  throw TypeError(i);
4
4
  };
5
- var L = (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) => L(i, typeof e != "symbol" ? e + "" : e, t), C = (i, e, t) => e.has(i) || b("Cannot " + t);
7
- var r = (i, e, t) => (C(i, e, "read from private field"), t ? t.call(i) : e.get(i)), l = (i, e, t) => e.has(i) ? b("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), o = (i, e, t, d) => (C(i, e, "write to private field"), d ? d.call(i, t) : e.set(i, t), t), y = (i, e, t) => (C(i, e, "access private method"), t);
8
- import * as p from "maplibre-gl";
9
- import { g as v } from "../delorean.utils-DOgTNSYn.js";
10
- var s, I, u, T, m, c, a, w, S, U;
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
+ import * as L from "maplibre-gl";
9
+ import { g as p } from "../delorean.utils-DOgTNSYn.js";
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);
@@ -19,37 +19,39 @@ class R {
19
19
  l(this, s);
20
20
  l(this, I);
21
21
  l(this, u);
22
- l(this, T);
22
+ l(this, g);
23
23
  l(this, m);
24
24
  l(this, c);
25
- o(this, s, e), this.sourceId = t.sourceId, this.layerId = t.layerId, this.getCapabilitiesUrl = t.getCapabilitiesUrl, o(this, I, t.tileBaseUrl), o(this, u, new URLSearchParams(t.tileUrlParams)), o(this, T, t.tileUrlTemplate), this.source = y(this, a, w).call(this), this.layer = y(this, a, S).call(this, t.paint);
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
- async addTo(e, t, d = "intersect") {
28
- const h = await this.loadTimes();
29
- e.addSource(this.sourceId, this.source), e.addLayer(this.layer), o(this, m, h.discreteValues), r(this, s).setTimes(r(this, m) ?? [], d), o(this, c, (f) => this.setTime(e, f)), r(this, s).addTimeChangedCallback(r(this, c));
30
- const g = t ?? h.defaultValue;
31
- return g ? r(this, s).setCurrentTime(g) : r(this, s).lastTime(), await new Promise((f) => e.once("idle", f)), this;
27
+ async addTo(e, t, h = "intersect") {
28
+ const f = await this.loadTimes();
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
+ const o = t ?? f.defaultValue;
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
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");
38
- return v(this.getCapabilitiesUrl, this.layerId);
38
+ return p(this.getCapabilitiesUrl, this.layerId);
39
39
  }
40
40
  async setTime(e, t) {
41
41
  if (!e) throw new Error(`Cannot set time: layer "${this.layerId}" is not attached to a map.`);
42
- const d = new Promise((g) => {
43
- e.once("idle", () => g());
44
- }), h = e.getSource(this.sourceId);
45
- if (!h || h.type !== "raster") throw new Error(`Raster source "${this.sourceId}" not found.`);
46
- return r(this, u).set("TIME", `${new Date(t).toISOString()}`), h instanceof p.RasterTileSource && h.setTiles([y(this, a, U).call(this)]), await d, this;
42
+ const h = t ?? r(this, s).times.at(-1);
43
+ if (h === void 0) return this;
44
+ const f = new Promise((y) => {
45
+ e.once("idle", () => y());
46
+ }), o = e.getSource(this.sourceId);
47
+ if (!o || o.type !== "raster") throw new Error(`Raster source "${this.sourceId}" not found.`);
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;
47
49
  }
48
50
  }
49
- s = new WeakMap(), I = new WeakMap(), u = new WeakMap(), T = new WeakMap(), m = new WeakMap(), c = 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() {
50
52
  return {
51
53
  type: "raster",
52
- tiles: [y(this, a, U).call(this)]
54
+ tiles: [T(this, a, C).call(this)]
53
55
  };
54
56
  }, S = function(e) {
55
57
  return {
@@ -58,8 +60,8 @@ s = new WeakMap(), I = new WeakMap(), u = new WeakMap(), T = new WeakMap(), m =
58
60
  type: "raster",
59
61
  paint: e ?? {}
60
62
  };
61
- }, U = function() {
62
- return `${r(this, I)}?${r(this, u).toString()}&${Object.entries(r(this, T)).map(([e, t]) => `${e}=${t}`).join("&")}`;
63
+ }, C = function() {
64
+ return `${r(this, I)}?${r(this, u).toString()}&${Object.entries(r(this, g)).map(([e, t]) => `${e}=${t}`).join("&")}`;
63
65
  };
64
66
  export {
65
67
  R as MaplibreglRasterTimeLayer
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 = 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.1.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",