@anthropomorphic/delorean 0.1.0 → 0.2.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/dist/core/index.js +61 -43
- package/dist/delorean/adapters/leaflet/leaflet.adapter.d.ts +1 -1
- package/dist/delorean/adapters/maplibre/maplibregl.adapter.d.ts +1 -1
- package/dist/delorean/core/delorean.store.d.ts +5 -4
- package/dist/delorean/ui/delorean.component.d.ts +1 -1
- package/dist/leaflet/index.js +23 -21
- package/dist/maplibre/index.js +28 -26
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
|
@@ -1,89 +1,107 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var C = (n) => {
|
|
2
|
+
throw TypeError(n);
|
|
3
3
|
};
|
|
4
|
-
var T = (
|
|
5
|
-
var i = (
|
|
6
|
-
var
|
|
7
|
-
set _(
|
|
8
|
-
n
|
|
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);
|
|
6
|
+
var f = (n, t, e, m) => ({
|
|
7
|
+
set _(a) {
|
|
8
|
+
h(n, t, a, e);
|
|
9
9
|
},
|
|
10
10
|
get _() {
|
|
11
|
-
return i(
|
|
11
|
+
return i(n, t, m);
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
import { a as
|
|
15
|
-
import { g as
|
|
16
|
-
var
|
|
17
|
-
class
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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, t) : void 0);
|
|
25
25
|
}
|
|
26
26
|
get times() {
|
|
27
|
-
return i(this,
|
|
27
|
+
return i(this, s);
|
|
28
28
|
}
|
|
29
29
|
get currentTime() {
|
|
30
|
-
return i(this,
|
|
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
|
-
|
|
36
|
+
h(this, s, [.../* @__PURE__ */ new Set([...i(this, s), ...t])].sort((a, c) => a - c));
|
|
36
37
|
break;
|
|
37
38
|
case "intersect":
|
|
38
|
-
|
|
39
|
+
h(this, s, [.../* @__PURE__ */ new Set([...i(this, s), ...t])].sort((a, c) => a - c));
|
|
39
40
|
break;
|
|
40
41
|
default:
|
|
41
|
-
|
|
42
|
+
h(this, s, [...t].sort((a, c) => a - c));
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
85
|
+
h(this, l, t), d(this, g, p).call(this, () => this.nextTime(), e);
|
|
68
86
|
}
|
|
69
87
|
addTimeChangedCallback(t) {
|
|
70
|
-
i(this,
|
|
88
|
+
i(this, o).push(t);
|
|
71
89
|
}
|
|
72
90
|
removeTimeChangedCallback(t) {
|
|
73
|
-
|
|
91
|
+
h(this, o, i(this, o).filter((e) => e !== t));
|
|
74
92
|
}
|
|
75
93
|
timeChanged(t) {
|
|
76
|
-
i(this,
|
|
94
|
+
i(this, o).forEach((e) => e(t));
|
|
77
95
|
}
|
|
78
96
|
}
|
|
79
|
-
|
|
80
|
-
for (; i(this,
|
|
81
|
-
await
|
|
82
|
-
},
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
}
|
package/dist/leaflet/index.js
CHANGED
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
var
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
2
|
var g = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var s = (t, e, 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,
|
|
11
|
-
class
|
|
10
|
+
var a, o, d, n, l;
|
|
11
|
+
class I {
|
|
12
12
|
constructor(e, i) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
T(this, "layerId");
|
|
14
|
+
T(this, "layer");
|
|
15
|
+
T(this, "getCapabilitiesUrl");
|
|
16
16
|
h(this, a);
|
|
17
17
|
h(this, o);
|
|
18
18
|
h(this, d);
|
|
19
19
|
h(this, n);
|
|
20
|
-
h(this,
|
|
20
|
+
h(this, l);
|
|
21
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));
|
|
22
22
|
}
|
|
23
|
-
async addTo(e, i,
|
|
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) ?? [],
|
|
26
|
-
const
|
|
27
|
-
return
|
|
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));
|
|
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;
|
|
28
28
|
}
|
|
29
29
|
removeFrom(e) {
|
|
30
|
-
return e.removeLayer(this.layer), s(this, a).removeTimes(s(this, n) ?? []), s(this,
|
|
30
|
+
return e.removeLayer(this.layer), s(this, a).removeTimes(s(this, n) ?? []), 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,
|
|
38
|
-
|
|
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(
|
|
42
|
-
}), await
|
|
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(),
|
|
47
|
+
a = new WeakMap(), o = new WeakMap(), d = new WeakMap(), n = new WeakMap(), l = new WeakMap();
|
|
46
48
|
export {
|
|
47
|
-
|
|
49
|
+
I as LeafletRasterTimeLayer
|
|
48
50
|
};
|
package/dist/maplibre/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var $ = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var U = (i) => {
|
|
3
3
|
throw TypeError(i);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var n = (i, e, t) =>
|
|
7
|
-
var r = (i, e, t) => (
|
|
8
|
-
import * as
|
|
9
|
-
import { g as
|
|
10
|
-
var s, I, u,
|
|
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);
|
|
8
|
+
import * as L from "maplibre-gl";
|
|
9
|
+
import { g as p } from "../delorean.utils-DOgTNSYn.js";
|
|
10
|
+
var s, I, u, g, m, d, 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,
|
|
22
|
+
l(this, g);
|
|
23
23
|
l(this, m);
|
|
24
|
-
l(this,
|
|
25
|
-
|
|
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);
|
|
26
26
|
}
|
|
27
|
-
async addTo(e, t,
|
|
28
|
-
const
|
|
29
|
-
e.addSource(this.sourceId, this.source), e.addLayer(this.layer),
|
|
30
|
-
const
|
|
31
|
-
return
|
|
27
|
+
async addTo(e, t, h = "intersect") {
|
|
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));
|
|
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;
|
|
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,
|
|
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;
|
|
35
35
|
}
|
|
36
36
|
loadTimes() {
|
|
37
37
|
if (!this.getCapabilitiesUrl) throw new Error("getCapabilitiesUrl undefined");
|
|
38
|
-
return
|
|
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
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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(),
|
|
51
|
+
s = new WeakMap(), I = new WeakMap(), u = new WeakMap(), g = new WeakMap(), m = new WeakMap(), d = new WeakMap(), a = new WeakSet(), w = function() {
|
|
50
52
|
return {
|
|
51
53
|
type: "raster",
|
|
52
|
-
tiles: [
|
|
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
|
-
},
|
|
62
|
-
return `${r(this, I)}?${r(this, u).toString()}&${Object.entries(r(this,
|
|
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
|
@@ -51,7 +51,7 @@ class L extends HTMLElement {
|
|
|
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 ? h(this, o, R).call(this, t) : "";
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
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() {
|
package/package.json
CHANGED