@fxi/zartigl 0.4.0 → 0.4.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.
- package/dist/zartigl.d.ts +1 -0
- package/dist/zartigl.js +23 -20
- package/package.json +1 -1
package/dist/zartigl.d.ts
CHANGED
package/dist/zartigl.js
CHANGED
|
@@ -4124,7 +4124,7 @@ function NE(g, A, I) {
|
|
|
4124
4124
|
v: A * Math.cos(C)
|
|
4125
4125
|
};
|
|
4126
4126
|
}
|
|
4127
|
-
function
|
|
4127
|
+
function jE(g) {
|
|
4128
4128
|
return [g.direction_variable, g.magnitude_variable];
|
|
4129
4129
|
}
|
|
4130
4130
|
const RE = 0.7, vg = 20, UE = 600;
|
|
@@ -5484,9 +5484,9 @@ function WE(g) {
|
|
|
5484
5484
|
rgba8MaxParticleZoom: 4
|
|
5485
5485
|
};
|
|
5486
5486
|
}
|
|
5487
|
-
class
|
|
5487
|
+
class _E {
|
|
5488
5488
|
constructor(A) {
|
|
5489
|
-
this.fullTimeMeta = null, this.catalogLayer = null, this.catalogSource = null, this.layer = null, this.time = 0, this.pendingTime = null, this.depth = 0, this.lastMeta = null, this.timeMeta = null, this.resolvedTimeRange = null, this.verticalMeta = null, this.variableUnit = "", this.geoVideoManifest = null, this.wmtsMetadata = null, this.fieldSources = /* @__PURE__ */ new Map(), this.activeFieldSource = null, this.switchGeneration = 0, this.destroyed = !1, this.suspended = !1, this.attachQueued = !1, this.querySources = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map(), this.onMapLoad = () => this.attachWhenReady(), this.onStyleData = () => this.attachWhenReady(), this.onMapIdle = () => this.attachWhenReady(), this.id = A.id ?? "zartigl", this.map = A.map, this.catalog = A.catalog, this.sourcePreference = A.source ?? "auto", this.timeRange = A.timeRange ? { ...A.timeRange } : void 0, this.autoplay = A.geoVideo?.autoplay ?? !0, this.loop = A.geoVideo?.loop ?? !0, this.playbackRate = A.geoVideo?.playbackRate ?? 1, this.metadata = A.metadata ? { ...A.metadata } : void 0, this.before = A.before, this.visible = A.visible ?? !0, this.settings = { ...A.settings }, A.settings?.colorDomain !== void 0 && (this.settings.colorDomain = bA(A.settings.colorDomain)), this.colorDomainOverridden = A.settings?.colorDomain !== void 0, this.map.on("load", this.onMapLoad), this.map.on("styledata", this.onStyleData), this.map.on("idle", this.onMapIdle);
|
|
5489
|
+
this.fullTimeMeta = null, this.catalogLayer = null, this.catalogSource = null, this.layer = null, this.time = 0, this.pendingTime = null, this.depth = 0, this.lastMeta = null, this.timeMeta = null, this.resolvedTimeRange = null, this.verticalMeta = null, this.variableUnit = "", this.geoVideoManifest = null, this.wmtsMetadata = null, this.fieldSources = /* @__PURE__ */ new Map(), this.activeFieldSource = null, this.switchGeneration = 0, this.destroyed = !1, this.suspended = !1, this.attachQueued = !1, this.querySources = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map(), this.onMapLoad = () => this.attachWhenReady(), this.onStyleData = () => this.attachWhenReady(), this.onMapIdle = () => this.attachWhenReady(), this.id = A.id ?? "zartigl", this.map = A.map, this.catalog = A.catalog, this.sourcePreference = A.source ?? "auto", this.timeRange = A.timeRange ? { ...A.timeRange } : void 0, this.autoplay = A.geoVideo?.autoplay ?? !0, this.loop = A.geoVideo?.loop ?? !0, this.playbackRate = A.geoVideo?.playbackRate ?? 1, this.metadata = A.metadata ? { ...A.metadata } : void 0, this.before = A.before, this.visible = A.visible ?? !0, this.settings = { ...A.settings }, A.settings?.colorDomain !== void 0 && (this.settings.colorDomain = bA(A.settings.colorDomain)), this.colorDomainOverridden = A.settings?.colorDomain !== void 0, this.paletteOverridden = A.settings?.palette !== void 0, this.map.on("load", this.onMapLoad), this.map.on("styledata", this.onStyleData), this.map.on("idle", this.onMapIdle);
|
|
5490
5490
|
}
|
|
5491
5491
|
async setLayer(A, I = this.sourcePreference) {
|
|
5492
5492
|
this.assertAlive();
|
|
@@ -5511,7 +5511,7 @@ class XE {
|
|
|
5511
5511
|
}, L = pA(N, this.timeRange), k = II(N, this.timeRange);
|
|
5512
5512
|
this.detach(), this.catalogLayer = B, this.catalogSource = Q, this.sourcePreference = I, this.activeFieldSource = null, this.geoVideoManifest = r, this.wmtsMetadata = null, this.fullTimeMeta = N, this.resolvedTimeRange = L, this.timeMeta = k, this.verticalMeta = null, this.variableUnit = r.style.unit ?? "", this.variableStandardName = r.provenance.variables[0], this.time = this.pendingTime == null ? this.timeMeta.values[0] : yA(this.timeMeta.values, this.pendingTime), this.pendingTime = null, this.depth = 0;
|
|
5513
5513
|
const n = this.settings.colorDomain;
|
|
5514
|
-
this.settings = { ...C, ...this.settings }, this.settings.colorDomain = this.colorDomainOverridden ? n ?? null : r.style.colorDomain, this.settings.palette = r.style.palette, this.lastMeta = null, this.attachWhenReady();
|
|
5514
|
+
this.settings = { ...C, ...this.settings }, this.settings.colorDomain = this.colorDomainOverridden ? n ?? null : r.style.colorDomain, this.settings.palette = this.paletteOverridden ? this.settings.palette : r.style.palette, this.lastMeta = null, this.attachWhenReady();
|
|
5515
5515
|
return;
|
|
5516
5516
|
} catch (r) {
|
|
5517
5517
|
const S = r instanceof Error ? r : new Error(String(r));
|
|
@@ -5755,7 +5755,7 @@ class XE {
|
|
|
5755
5755
|
...A,
|
|
5756
5756
|
colorDomain: bA(A.colorDomain)
|
|
5757
5757
|
}, B = I.palette != null && I.palette !== this.settings.palette, C = I.particleState != null && I.particleState !== this.settings.particleState;
|
|
5758
|
-
if (I.colorDomain !== void 0 && (this.colorDomainOverridden = !0), this.settings = { ...this.settings, ...I }, !!this.layer) {
|
|
5758
|
+
if (I.colorDomain !== void 0 && (this.colorDomainOverridden = !0), I.palette !== void 0 && (this.paletteOverridden = !0), this.settings = { ...this.settings, ...I }, !!this.layer) {
|
|
5759
5759
|
if (B && this.catalogSource?.type === "geovideo") {
|
|
5760
5760
|
this.layer.setColorRamp(I.palette), this.applyMutableSettings(this.layer, I);
|
|
5761
5761
|
return;
|
|
@@ -5919,7 +5919,7 @@ function bE(g, A) {
|
|
|
5919
5919
|
function PE(g, A) {
|
|
5920
5920
|
return A === "year" ? Date.UTC(Number(g), 0, 1) : A === "month" ? (/* @__PURE__ */ new Date(`${g}-01T00:00:00Z`)).getTime() : A === "day" ? (/* @__PURE__ */ new Date(`${g}T00:00:00Z`)).getTime() : (/* @__PURE__ */ new Date(`${g}Z`)).getTime();
|
|
5921
5921
|
}
|
|
5922
|
-
function
|
|
5922
|
+
function $E(g, A, I) {
|
|
5923
5923
|
if (!A || g.length === 0) return;
|
|
5924
5924
|
if (["year", "month", "day"].includes(I)) {
|
|
5925
5925
|
const C = g.find((Q) => bE(Q, I) === A);
|
|
@@ -5931,10 +5931,13 @@ function jE(g, A, I) {
|
|
|
5931
5931
|
(C, Q) => Math.abs(Q - B) < Math.abs(C - B) ? Q : C
|
|
5932
5932
|
);
|
|
5933
5933
|
}
|
|
5934
|
+
const ZE = "0.4.1", vE = {
|
|
5935
|
+
version: ZE
|
|
5936
|
+
};
|
|
5934
5937
|
function FA(g) {
|
|
5935
5938
|
return JSON.stringify(g);
|
|
5936
5939
|
}
|
|
5937
|
-
function
|
|
5940
|
+
function VE(g) {
|
|
5938
5941
|
return JSON.stringify(g, null, 2);
|
|
5939
5942
|
}
|
|
5940
5943
|
function uI(g) {
|
|
@@ -5945,22 +5948,22 @@ function mA(g, A = 6) {
|
|
|
5945
5948
|
}
|
|
5946
5949
|
function KA(g, A) {
|
|
5947
5950
|
const I = " ".repeat(A);
|
|
5948
|
-
return
|
|
5951
|
+
return VE(g).split(`
|
|
5949
5952
|
`).map((B) => `${I}${B}`).join(`
|
|
5950
5953
|
`).trimStart();
|
|
5951
5954
|
}
|
|
5952
|
-
function
|
|
5955
|
+
function OE(g) {
|
|
5953
5956
|
return !g || Object.keys(g).length === 0 ? "" : `
|
|
5954
5957
|
z.updateSettings(${KA(g, 2)});`;
|
|
5955
5958
|
}
|
|
5956
|
-
function
|
|
5959
|
+
function zE(g, A) {
|
|
5957
5960
|
return Object.fromEntries(
|
|
5958
5961
|
A.filter((I) => Object.prototype.hasOwnProperty.call(g, I)).map((I) => [I, g[I]])
|
|
5959
5962
|
);
|
|
5960
5963
|
}
|
|
5961
5964
|
function KB(g, A, I) {
|
|
5962
5965
|
if (!I) return;
|
|
5963
|
-
const C =
|
|
5966
|
+
const C = zE(I, g === "vector" ? [
|
|
5964
5967
|
"palette",
|
|
5965
5968
|
"opacity",
|
|
5966
5969
|
"logScale",
|
|
@@ -5974,7 +5977,7 @@ function KB(g, A, I) {
|
|
|
5974
5977
|
] : A === "wmts" ? ["opacity"] : ["palette", "opacity", "logScale", "vibrance", "colorDomain"]);
|
|
5975
5978
|
return Object.keys(C).length > 0 ? C : void 0;
|
|
5976
5979
|
}
|
|
5977
|
-
function
|
|
5980
|
+
function Ai(g) {
|
|
5978
5981
|
const A = g.source ?? "auto", I = KB(
|
|
5979
5982
|
g.layerKind,
|
|
5980
5983
|
g.sourceType ?? (A === "wmts" || A === "geovideo" ? A : "zarr"),
|
|
@@ -6020,8 +6023,8 @@ ${B.join(`
|
|
|
6020
6023
|
};
|
|
6021
6024
|
}`;
|
|
6022
6025
|
}
|
|
6023
|
-
function
|
|
6024
|
-
const A = g.moduleBaseUrl ??
|
|
6026
|
+
function Ii(g) {
|
|
6027
|
+
const A = g.moduleBaseUrl ?? `https://cdn.jsdelivr.net/npm/@fxi/zartigl@${vE.version}/dist`, I = g.source ?? "auto", B = KB(
|
|
6025
6028
|
g.layerKind,
|
|
6026
6029
|
g.sourceType ?? (I === "wmts" || I === "geovideo" ? I : "zarr"),
|
|
6027
6030
|
g.settings
|
|
@@ -6051,7 +6054,7 @@ const z = new Zartigl({
|
|
|
6051
6054
|
source: ${FA(I)},
|
|
6052
6055
|
${C}${Q}});
|
|
6053
6056
|
|
|
6054
|
-
await z.setLayer(${FA(g.layerId)});${
|
|
6057
|
+
await z.setLayer(${FA(g.layerId)});${OE(B)}${E}`;
|
|
6055
6058
|
}
|
|
6056
6059
|
export {
|
|
6057
6060
|
hA as GeoVideoLayer,
|
|
@@ -6060,10 +6063,10 @@ export {
|
|
|
6060
6063
|
kA as VectorLayer,
|
|
6061
6064
|
iB as VelocityField,
|
|
6062
6065
|
EI as ZarrSource,
|
|
6063
|
-
|
|
6066
|
+
_E as Zartigl,
|
|
6064
6067
|
iI as ZartiglFrameUnavailableError,
|
|
6065
|
-
|
|
6066
|
-
|
|
6068
|
+
Ai as buildMapxWidgetSnippet,
|
|
6069
|
+
Ii as buildStandaloneDemoSnippet,
|
|
6067
6070
|
kE as buildWmtsLegendUrl,
|
|
6068
6071
|
jg as buildWmtsTileUrl,
|
|
6069
6072
|
NE as deriveDirectionMagnitudeComponents,
|
|
@@ -6071,9 +6074,9 @@ export {
|
|
|
6071
6074
|
kI as geoVideoTimeForSeconds,
|
|
6072
6075
|
WI as geoVideoTimelineValues,
|
|
6073
6076
|
NC as getPalettes,
|
|
6074
|
-
|
|
6077
|
+
jE as getVectorDerivationVariables,
|
|
6075
6078
|
kB as loadGeoVideoManifest,
|
|
6076
|
-
|
|
6079
|
+
$E as resolveTimeInputSelection,
|
|
6077
6080
|
oB as stitchVelocityChunks,
|
|
6078
6081
|
zg as validateGeoVideoManifest
|
|
6079
6082
|
};
|