@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 CHANGED
@@ -1209,6 +1209,7 @@ export declare class Zartigl {
1209
1209
  private depth;
1210
1210
  private settings;
1211
1211
  private colorDomainOverridden;
1212
+ private paletteOverridden;
1212
1213
  private lastMeta;
1213
1214
  private timeMeta;
1214
1215
  private resolvedTimeRange;
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 zE(g) {
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 XE {
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 jE(g, A, I) {
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 ZE(g) {
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 ZE(g).split(`
5951
+ return VE(g).split(`
5949
5952
  `).map((B) => `${I}${B}`).join(`
5950
5953
  `).trimStart();
5951
5954
  }
5952
- function vE(g) {
5955
+ function OE(g) {
5953
5956
  return !g || Object.keys(g).length === 0 ? "" : `
5954
5957
  z.updateSettings(${KA(g, 2)});`;
5955
5958
  }
5956
- function VE(g, A) {
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 = VE(I, g === "vector" ? [
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 _E(g) {
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 $E(g) {
6024
- const A = g.moduleBaseUrl ?? "https://cdn.jsdelivr.net/npm/@fxi/zartigl@0.2.1/dist", I = g.source ?? "auto", B = KB(
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)});${vE(B)}${E}`;
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
- XE as Zartigl,
6066
+ _E as Zartigl,
6064
6067
  iI as ZartiglFrameUnavailableError,
6065
- _E as buildMapxWidgetSnippet,
6066
- $E as buildStandaloneDemoSnippet,
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
- zE as getVectorDerivationVariables,
6077
+ jE as getVectorDerivationVariables,
6075
6078
  kB as loadGeoVideoManifest,
6076
- jE as resolveTimeInputSelection,
6079
+ $E as resolveTimeInputSelection,
6077
6080
  oB as stitchVelocityChunks,
6078
6081
  zg as validateGeoVideoManifest
6079
6082
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fxi/zartigl",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "MapLibre GL JS visualization for catalog-backed Zarr, WMTS, and GeoVideo data",
5
5
  "repository": {
6
6
  "type": "git",