@aguacerowx/mapsgl 0.0.48 → 0.0.49

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aguacerowx/mapsgl",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -21,7 +21,7 @@
21
21
  "esbuild": "^0.21.5"
22
22
  },
23
23
  "dependencies": {
24
- "@aguacerowx/javascript-sdk": "^0.0.20",
24
+ "@aguacerowx/javascript-sdk": "^0.0.21",
25
25
  "buffer": "^6.0.3",
26
26
  "fzstd": "^0.1.1",
27
27
  "mapbox-gl": "^3.4.0",
@@ -177,6 +177,7 @@ export class WeatherLayerManager extends EventEmitter {
177
177
  variable: this.core.state?.variable,
178
178
  mrmsDurationValue: this.core.state?.mrmsDurationValue,
179
179
  mrmsTimestamp: this.core.state?.mrmsTimestamp,
180
+ nexradDurationValue: this.core.state?.nexradDurationValue,
180
181
  satelliteDurationValue: this.core.state?.satelliteDurationValue,
181
182
  },
182
183
  });
@@ -570,13 +571,13 @@ export class WeatherLayerManager extends EventEmitter {
570
571
  this.currentLoadedTimeKey = null;
571
572
  }
572
573
 
573
- if (!state.satelliteKey || state.satelliteTimestamp == null) {
574
+ if (!state.satelliteInstrumentId || state.satelliteTimestamp == null) {
574
575
  this._tearDownSatellite();
575
576
  this.map.triggerRepaint();
576
577
  return;
577
578
  }
578
579
 
579
- const satRunKey = `${state.satelliteKey}|${state.variable || ''}`;
580
+ const satRunKey = `${state.satelliteInstrumentId}|${state.satelliteSectorLabel}|${state.satelliteChannel}|${state.variable || ''}`;
580
581
  if (!this.satelliteLayer || this._satelliteRunKey !== satRunKey) {
581
582
  this._rebuildSatelliteLayer(state, satRunKey);
582
583
  }
@@ -668,20 +669,19 @@ export class WeatherLayerManager extends EventEmitter {
668
669
 
669
670
  _satelliteTimelineId(state) {
670
671
  const keys = Object.keys(state.satelliteTimeToFileMap || {}).sort((a, b) => Number(a) - Number(b));
671
- return `${state.satelliteKey}|${state.variable || ''}|${keys.join(',')}`;
672
+ return `${state.satelliteInstrumentId}|${state.satelliteSectorLabel}|${state.satelliteChannel}|${state.variable || ''}|${keys.join(',')}`;
672
673
  }
673
674
 
674
675
  _getSatelliteFetchParts(state, satelliteTimestamp) {
675
676
  const fileName = resolveSatelliteS3FileName(
676
- state.satelliteKey,
677
+ state.satelliteChannel,
677
678
  state.satelliteTimeToFileMap,
678
679
  satelliteTimestamp
679
680
  );
680
681
  if (!fileName) {
681
682
  return null;
682
683
  }
683
- const parts = state.satelliteKey.split('.');
684
- const channelName = parts[2] || state.variable;
684
+ const channelName = state.satelliteChannel || state.variable;
685
685
  const channelNameUpper = String(channelName).toUpperCase();
686
686
  let s3FileName = fileName.replace('MULTI', channelNameUpper);
687
687
  if (!s3FileName.endsWith('.ktx2')) {
@@ -871,9 +871,15 @@ export class WeatherLayerManager extends EventEmitter {
871
871
  async setSatelliteDurationValue(value) {
872
872
  return this.core.setSatelliteDurationValue(value);
873
873
  }
874
+ async setSatelliteSelection(opts) {
875
+ return this.core.setSatelliteSelection(opts);
876
+ }
874
877
  async setMRMSDurationValue(value) {
875
878
  return this.core.setMRMSDurationValue(value);
876
879
  }
880
+ async setNexradDurationValue(value) {
881
+ return this.core.setNexradDurationValue(value);
882
+ }
877
883
 
878
884
  /** Refreshes NEXRAD object-key listings for the current site / product / tilt (NEXRAD mode only). */
879
885
  async refreshNexradTimes() {
@@ -1389,7 +1395,7 @@ export class WeatherLayerManager extends EventEmitter {
1389
1395
  const s = this.core.state;
1390
1396
  const { isMRMS, isSatellite, isNexrad, model: currentModel, variable: currentVariable, date, run } = s;
1391
1397
 
1392
- if (isSatellite && s.satelliteKey) {
1398
+ if (isSatellite && s.satelliteInstrumentId) {
1393
1399
  const prevTimeline = this.core._computeSatelliteTimeline();
1394
1400
  const prevTimes = [...(prevTimeline.unixTimes || [])]
1395
1401
  .map((t) => Number(t))
@@ -1413,7 +1419,12 @@ export class WeatherLayerManager extends EventEmitter {
1413
1419
  } else if (curSat != null && newMax != null && nextTimes.length && !nextTimes.includes(curSat)) {
1414
1420
  await this.core.setSatelliteTimestamp(newMax);
1415
1421
  }
1416
- this.emit('data:updated', { type: 'satellite', satelliteKey: s.satelliteKey });
1422
+ this.emit('data:updated', {
1423
+ type: 'satellite',
1424
+ satelliteInstrumentId: s.satelliteInstrumentId,
1425
+ satelliteSectorLabel: s.satelliteSectorLabel,
1426
+ satelliteChannel: s.satelliteChannel,
1427
+ });
1417
1428
  return;
1418
1429
  }
1419
1430
 
@@ -1,40 +1,11 @@
1
- import pkg from '../package.json' with { type: 'json' };
2
-
3
1
  /**
4
2
  * jsDelivr serves the `basis/` folder from the published npm package (no `public/basis/` copy).
5
3
  * Use when you consume `@aguacerowx/mapsgl` from the registry and do not host transcoder assets yourself.
6
4
  */
7
- export const JSDELIVR_BASIS_BASE_URL = `https://cdn.jsdelivr.net/npm/@aguacerowx/mapsgl@${pkg.version}/basis/`;
5
+ export const JSDELIVR_BASIS_BASE_URL = `https://cdn.jsdelivr.net/npm/@aguacerowx/mapsgl/basis/`;
8
6
 
9
7
  /**
10
- * Default: resolve `mapsgl/basis/` inside this package.
11
- *
12
- * We cannot use `new URL('..', new URL('.', import.meta.url))`: Vite aliases `@aguacerowx/mapsgl` to
13
- * `mapsgl/index.js`, so the "directory" of this module is often `.../mapsgl/` and `..` becomes the
14
- * monorepo `packages/` folder — wrong (`packages/basis/` instead of `packages/mapsgl/basis/`).
15
- * Webpack also rejects `new URL('../basis/', import.meta.url)` as an unresolved module, so we locate
16
- * the `mapsgl` path segment and append `basis/`.
17
- *
18
- * In Vite production builds the folder URL becomes your app origin `/basis/`, so place copies under
19
- * `public/basis/` (or sync from `node_modules/@aguacerowx/mapsgl/basis`).
20
- * For CDN-only, pass {@link JSDELIVR_BASIS_BASE_URL} as `WeatherLayerManager({ basisBaseUrl: ... })`.
8
+ * Default to the jsDelivr CDN so users don't have to host the files themselves.
9
+ * You can override this by passing `basisBaseUrl` to `WeatherLayerManager`.
21
10
  */
22
- const _mapsglRootHref = (() => {
23
- const u = import.meta.url;
24
- const slashIdx = u.indexOf('/mapsgl/');
25
- if (slashIdx >= 0) {
26
- return u.slice(0, slashIdx + '/mapsgl/'.length);
27
- }
28
- // e.g. cdn.jsdelivr.net/.../mapsgl@0.0.47/dist/... (no `/mapsgl/` substring)
29
- const atMatch = u.match(/\/mapsgl@[^/]+\//);
30
- if (atMatch && atMatch.index !== undefined) {
31
- return u.slice(0, atMatch.index + atMatch[0].length);
32
- }
33
- const srcMarker = '/src/';
34
- const j = u.lastIndexOf(srcMarker);
35
- if (j >= 0) {
36
- return `${u.slice(0, j)}/`;
37
- }
38
- return new URL('../', new URL('.', u)).href;
39
- })();
40
- export const DEFAULT_BASIS_BASE_URL = new URL('basis/', _mapsglRootHref).href;
11
+ export const DEFAULT_BASIS_BASE_URL = JSDELIVR_BASIS_BASE_URL;