@xweather/mapsgl 1.9.0 → 1.9.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/LICENSE.txt +1 -1
- package/dist/mapsgl.css +1 -1
- package/dist/mapsgl.d.ts +126 -12
- package/dist/mapsgl.js +4 -4
- package/package.json +1 -1
package/LICENSE.txt
CHANGED
package/dist/mapsgl.css
CHANGED
package/dist/mapsgl.d.ts
CHANGED
|
@@ -2032,6 +2032,7 @@ declare abstract class DataSource<Spec extends SourceSpecification = SourceSpeci
|
|
|
2032
2032
|
* The map layers that are currently using this data source.
|
|
2033
2033
|
*/
|
|
2034
2034
|
consumingLayers: Array<DataSourceConsumer>;
|
|
2035
|
+
private _consumingLayerIds;
|
|
2035
2036
|
/**
|
|
2036
2037
|
* The type of data source and data it manages.
|
|
2037
2038
|
* @readonly
|
|
@@ -2142,6 +2143,12 @@ export declare class DownloadManager<Task extends DownloadTask<any>> extends Eve
|
|
|
2142
2143
|
* @returns The cached task data, or undefined if not found.
|
|
2143
2144
|
*/
|
|
2144
2145
|
get(key: string): TaskData<Task> | undefined;
|
|
2146
|
+
/**
|
|
2147
|
+
* Retrieves an active (pending or in-flight) task by key.
|
|
2148
|
+
* @param key - The unique identifier for the task.
|
|
2149
|
+
* @returns The active task if present, otherwise undefined.
|
|
2150
|
+
*/
|
|
2151
|
+
getTask(key: string): Task | undefined;
|
|
2145
2152
|
/**
|
|
2146
2153
|
* Sets the task runner function used to execute download tasks.
|
|
2147
2154
|
* @param runner - The task runner function that handles task execution with retry logic.
|
|
@@ -2436,6 +2443,12 @@ export declare interface EncodedSourceSpecification<Dataset extends EncodedRaste
|
|
|
2436
2443
|
* to snowfall). The original `datasets` are still used for tile requests.
|
|
2437
2444
|
*/
|
|
2438
2445
|
effectiveDatasets?: Array<Partial<Dataset>>;
|
|
2446
|
+
/**
|
|
2447
|
+
* ID of a registered tile data transformer to run in the worker thread after tile data is loaded.
|
|
2448
|
+
* Preferred over `transformTileData` because it avoids serializing a function across threads.
|
|
2449
|
+
* @see TransformerId
|
|
2450
|
+
*/
|
|
2451
|
+
transformerId?: string;
|
|
2439
2452
|
/**
|
|
2440
2453
|
* Optional function to transform tile data after it has been loaded. This allows for custom processing or
|
|
2441
2454
|
* modification of the tile data before it is used for rendering, such as converting it to other values
|
|
@@ -2444,6 +2457,7 @@ export declare interface EncodedSourceSpecification<Dataset extends EncodedRaste
|
|
|
2444
2457
|
* @param datasets - An array of dataset objects associated with this source, which contains information about the
|
|
2445
2458
|
* original encoded data and its value ranges. This array can be modified in-place to update dataMin/dataMax
|
|
2446
2459
|
* values for transformed data.
|
|
2460
|
+
* @deprecated Use `transformerId` instead to reference a registered transformer by ID.
|
|
2447
2461
|
*/
|
|
2448
2462
|
transformTileData?: (data: RGBAImage, datasets: Array<Dataset>) => void;
|
|
2449
2463
|
}
|
|
@@ -2570,6 +2584,7 @@ declare const ExpressionOperator: {
|
|
|
2570
2584
|
readonly any: "any";
|
|
2571
2585
|
readonly toNumber: "to-number";
|
|
2572
2586
|
readonly toString: "to-string";
|
|
2587
|
+
readonly toDate: "to-date";
|
|
2573
2588
|
readonly toLocaleString: "to-locale-string";
|
|
2574
2589
|
readonly toUnit: "to-unit";
|
|
2575
2590
|
readonly toBoolean: "to-boolean";
|
|
@@ -2617,6 +2632,15 @@ declare const ExpressionOperator: {
|
|
|
2617
2632
|
readonly case: "case";
|
|
2618
2633
|
readonly match: "match";
|
|
2619
2634
|
readonly let: "let";
|
|
2635
|
+
/**
|
|
2636
|
+
* Active map timeline position as **Unix seconds** (from the map controller), not wall clock — use `now` for that.
|
|
2637
|
+
*/
|
|
2638
|
+
readonly mapTime: "map-time";
|
|
2639
|
+
/**
|
|
2640
|
+
* @deprecated Prefer `map-time` — same semantics.
|
|
2641
|
+
*/
|
|
2642
|
+
readonly time: "time";
|
|
2643
|
+
readonly now: "now";
|
|
2620
2644
|
};
|
|
2621
2645
|
|
|
2622
2646
|
export declare type ExpressionOperator = ObjectValue<typeof ExpressionOperator>;
|
|
@@ -3527,6 +3551,12 @@ export declare interface LayerSpecification {
|
|
|
3527
3551
|
* zoom level than the current map zoom level.
|
|
3528
3552
|
*/
|
|
3529
3553
|
zoomOffset?: number;
|
|
3554
|
+
/**
|
|
3555
|
+
* Whether to preload low-quality tiles when the layer is added or the time range changes,
|
|
3556
|
+
* ensuring fallback data is available immediately when panning or zooming beyond currently
|
|
3557
|
+
* loaded tile bounds. Default is `false`.
|
|
3558
|
+
*/
|
|
3559
|
+
preloadLowQuality?: boolean;
|
|
3530
3560
|
/**
|
|
3531
3561
|
* Render style configuration.
|
|
3532
3562
|
* @see PaintStyleSpec
|
|
@@ -3968,6 +3998,8 @@ dispose(all?: boolean): void;
|
|
|
3968
3998
|
export declare class MapCamera {
|
|
3969
3999
|
private _transform;
|
|
3970
4000
|
private _orientation;
|
|
4001
|
+
private readonly _quat;
|
|
4002
|
+
private readonly _vec3;
|
|
3971
4003
|
get position(): Vector3;
|
|
3972
4004
|
set position(value: Vector3);
|
|
3973
4005
|
get orientation(): Quaternion;
|
|
@@ -3983,6 +4015,10 @@ export declare class MapCamera {
|
|
|
3983
4015
|
* @returns The view matrix
|
|
3984
4016
|
*/
|
|
3985
4017
|
worldToCameraMatrix(worldSize: number, pixelsPerMeter?: number): Matrix4;
|
|
4018
|
+
/**
|
|
4019
|
+
* Writes world->camera matrix into `out` to avoid per-frame allocations.
|
|
4020
|
+
*/
|
|
4021
|
+
worldToCameraMatrixInto(out: Matrix4, worldSize: number, pixelsPerMeter?: number): Matrix4;
|
|
3986
4022
|
calculateCameraOrientation(bearing: number, pitch: number): Quaternion;
|
|
3987
4023
|
}
|
|
3988
4024
|
|
|
@@ -4324,7 +4360,27 @@ get needsViewportUpdate(): boolean;
|
|
|
4324
4360
|
*/
|
|
4325
4361
|
setRefreshInterval(minutes: number, advanceToNow?: boolean): void;
|
|
4326
4362
|
private _triggerPreloadAnimation;
|
|
4363
|
+
private _preloadAnimationRequestId;
|
|
4364
|
+
private _activePreloadAnimationPromise?;
|
|
4365
|
+
private _hasPendingPreloadAnimationRequest;
|
|
4366
|
+
/**
|
|
4367
|
+
* Schedules animation preload work and returns the active drain promise.
|
|
4368
|
+
* Calls are coalesced: if preload is already running, this only marks that another pass should run after the
|
|
4369
|
+
* current one completes.
|
|
4370
|
+
*/
|
|
4327
4371
|
preloadAnimationData(): Promise<void>;
|
|
4372
|
+
/**
|
|
4373
|
+
* Processes queued preload requests until no further requests are pending.
|
|
4374
|
+
* If a newer request arrives during a preload pass, marks animators dirty so the next pass recomputes against
|
|
4375
|
+
* the newest viewport and timeline state.
|
|
4376
|
+
*/
|
|
4377
|
+
private _drainPreloadAnimationQueue;
|
|
4378
|
+
/**
|
|
4379
|
+
* Invalidates in-flight preload work.
|
|
4380
|
+
* This does not abort the current async operation directly; it marks the current pass stale and forces the next
|
|
4381
|
+
* queued pass to refresh from latest state.
|
|
4382
|
+
*/
|
|
4383
|
+
private cancelPreloadAnimationData;
|
|
4328
4384
|
private debouncedPreloadAnimationData;
|
|
4329
4385
|
private setNeedsPreloadAnimationData;
|
|
4330
4386
|
private preloadAnimationDataIfNeeded;
|
|
@@ -5422,6 +5478,7 @@ export declare interface RenderFrameContextTileLayer {
|
|
|
5422
5478
|
getDataZoom(): number;
|
|
5423
5479
|
getVisibleTileCoords(zoom: number): TileCoord[];
|
|
5424
5480
|
getCurrentInterval?(): TimeInterval | undefined;
|
|
5481
|
+
allowExpiredTilesForRender?: boolean;
|
|
5425
5482
|
}
|
|
5426
5483
|
|
|
5427
5484
|
declare const resolveMeasurementForUnits: (type: ConversionMeasurement) => Measurement;
|
|
@@ -5574,6 +5631,7 @@ export declare class SourceMetadata extends EventDispatcher {
|
|
|
5574
5631
|
private _transformer;
|
|
5575
5632
|
private _hasLoaded;
|
|
5576
5633
|
private _lastRequestOptions;
|
|
5634
|
+
private _validTimesCache;
|
|
5577
5635
|
|
|
5578
5636
|
/**
|
|
5579
5637
|
* Creates an instance of SourceMetadata
|
|
@@ -5669,6 +5727,7 @@ export declare class SourceMetadata extends EventDispatcher {
|
|
|
5669
5727
|
* @returns A promise that resolves with the metadata for the source.
|
|
5670
5728
|
*/
|
|
5671
5729
|
load(options?: Partial<UrlRequestOptions>): Promise<Partial<SourceMetadataSchema>>;
|
|
5730
|
+
cancel(): void;
|
|
5672
5731
|
protected processMetadata(json: Record<string, any>): Partial<SourceMetadataSchema>;
|
|
5673
5732
|
}
|
|
5674
5733
|
|
|
@@ -6527,6 +6586,7 @@ declare abstract class TileLayer<Data> extends WebGLLayer<TileSource> {
|
|
|
6527
6586
|
private upgradeDataQuality;
|
|
6528
6587
|
private lastHiddenTime;
|
|
6529
6588
|
private tileLoadProgress;
|
|
6589
|
+
private _preloadLowQuality;
|
|
6530
6590
|
/**
|
|
6531
6591
|
* Returns the layer's data render quality.
|
|
6532
6592
|
* @see DataQuality
|
|
@@ -6542,7 +6602,12 @@ declare abstract class TileLayer<Data> extends WebGLLayer<TileSource> {
|
|
|
6542
6602
|
* @param id - Unique identifier of the layer.
|
|
6543
6603
|
* @param config - Config options for the layer.
|
|
6544
6604
|
*/
|
|
6545
|
-
constructor(id: string, { quality, ...config }: Partial<TileLayerConfig>);
|
|
6605
|
+
constructor(id: string, { quality, preloadLowQuality, ...config }: Partial<TileLayerConfig>);
|
|
6606
|
+
/**
|
|
6607
|
+
* Returns whether expired tiles can still be used for rendering/LOD fallback.
|
|
6608
|
+
* Default is disabled so stale tiles are not rendered after data refreshes.
|
|
6609
|
+
*/
|
|
6610
|
+
shouldRenderExpiredTiles(): boolean;
|
|
6546
6611
|
refresh(clear?: boolean): void;
|
|
6547
6612
|
/**
|
|
6548
6613
|
* Returns the layer's tile cache so renderers can use it via RenderFrameContext instead of accessing layer.source.tiles.
|
|
@@ -6558,11 +6623,21 @@ declare abstract class TileLayer<Data> extends WebGLLayer<TileSource> {
|
|
|
6558
6623
|
/**
|
|
6559
6624
|
* Returns the data zoom level used for the specified map zoom level based on the configured `quality` level.
|
|
6560
6625
|
* @param zoom - Map zoom level to get the data zoom level for.
|
|
6561
|
-
* @param
|
|
6562
|
-
* @
|
|
6626
|
+
* @param scale - Scale to apply to the data quality.
|
|
6627
|
+
* @remarks
|
|
6628
|
+
* The scale parameter is used to reduce the data quality by a factor of the specified scale. For example, if the
|
|
6629
|
+
* scale is 0.5, the data quality will be reduced by half. If the scale is 0.25, the data quality will be reduced
|
|
6630
|
+
* by one-quarter.
|
|
6631
|
+
* @returns Data zoom level, optionally adjusted by the data quality scale and clamped to the source's min/max zoom
|
|
6632
|
+
* levels.
|
|
6563
6633
|
*/
|
|
6564
|
-
getDataZoom(zoom?: number,
|
|
6565
|
-
|
|
6634
|
+
getDataZoom(zoom?: number, scale?: number): number;
|
|
6635
|
+
/**
|
|
6636
|
+
* Preloads low-quality tiles for the layer at the specified zoom level. This is used to ensure we can render data
|
|
6637
|
+
* anywhere quickly when zooming in our out beyond partial bounds for tiles not yet loaded.
|
|
6638
|
+
* @param zoom : Zoom level to preload low-quality tiles for.
|
|
6639
|
+
*/
|
|
6640
|
+
preloadLowQualityTiles(zoom?: number): void;
|
|
6566
6641
|
/**
|
|
6567
6642
|
* Returns the tile at the specified geographic coordinate.
|
|
6568
6643
|
* @param coord - Geographic coordinate to get the tile for.
|
|
@@ -6578,6 +6653,7 @@ declare abstract class TileLayer<Data> extends WebGLLayer<TileSource> {
|
|
|
6578
6653
|
* @returns Array of visible tile coordinates.
|
|
6579
6654
|
*/
|
|
6580
6655
|
getVisibleTileCoords(): Array<TileCoord>;
|
|
6656
|
+
private _alreadyPreloadedLowQualityTiles;
|
|
6581
6657
|
/**
|
|
6582
6658
|
* Requests visible tiles from the tile pyramid.
|
|
6583
6659
|
* @param reload - Whether to reload tiles that have already been requested.
|
|
@@ -6597,6 +6673,8 @@ declare abstract class TileLayer<Data> extends WebGLLayer<TileSource> {
|
|
|
6597
6673
|
private onLoadProgress;
|
|
6598
6674
|
private onLoadStart;
|
|
6599
6675
|
private onLoadComplete;
|
|
6676
|
+
private _shouldRequestTiles;
|
|
6677
|
+
onTimelineRangeChange(e: any): void;
|
|
6600
6678
|
protected onTimeSeriesDataChange(): void;
|
|
6601
6679
|
protected onMaskLayerChange(): void;
|
|
6602
6680
|
protected onMaskStateChange(): void;
|
|
@@ -6619,8 +6697,20 @@ export declare interface TileLayerConfig extends WebGLLayerConfig {
|
|
|
6619
6697
|
* at a different zoom level than the map's zoom level.
|
|
6620
6698
|
*/
|
|
6621
6699
|
zoomOffset: number;
|
|
6700
|
+
/**
|
|
6701
|
+
* Whether to preload low-quality tiles when the layer is added or the time range changes,
|
|
6702
|
+
* ensuring fallback data is available immediately when panning or zooming beyond currently
|
|
6703
|
+
* loaded tile bounds. Default is `false`.
|
|
6704
|
+
*/
|
|
6705
|
+
preloadLowQuality: boolean;
|
|
6622
6706
|
}
|
|
6623
6707
|
|
|
6708
|
+
export declare type TilePositionData = {
|
|
6709
|
+
translation: Vector3;
|
|
6710
|
+
scale: Vector3;
|
|
6711
|
+
matrix: Matrix4;
|
|
6712
|
+
};
|
|
6713
|
+
|
|
6624
6714
|
export declare type TileQuadrant = 'tl' | 'tc' | 'tr' | 'ml' | 'mc' | 'mr' | 'bl' | 'bc' | 'br';
|
|
6625
6715
|
|
|
6626
6716
|
/**
|
|
@@ -6705,6 +6795,9 @@ declare abstract class TileSource<Data = any, Source extends TileSourceSpecifica
|
|
|
6705
6795
|
* deduplication vs. load-generation guard.
|
|
6706
6796
|
*/
|
|
6707
6797
|
private _tileLoadRequestId;
|
|
6798
|
+
private _metadataLoadPromise?;
|
|
6799
|
+
private _pendingTaskCountByCoord;
|
|
6800
|
+
private _pendingIntervalsByCoord;
|
|
6708
6801
|
/**
|
|
6709
6802
|
* The minimum zoom level for the source. Defaults to `0`.
|
|
6710
6803
|
*/
|
|
@@ -6819,7 +6912,8 @@ constructor(id: string, spec: Partial<Source>);
|
|
|
6819
6912
|
headers: Headers | null;
|
|
6820
6913
|
}>;
|
|
6821
6914
|
getMetadata(options?: Partial<UrlRequestOptions>): Promise<unknown>;
|
|
6822
|
-
|
|
6915
|
+
|
|
6916
|
+
removeConsumer(consumer: DataSourceConsumer): void;
|
|
6823
6917
|
/**
|
|
6824
6918
|
* Aborts a tile request.
|
|
6825
6919
|
* @param tile - The tile to abort.
|
|
@@ -7724,6 +7818,12 @@ export declare type WeatherLayerOptions = {
|
|
|
7724
7818
|
* value is `true`.
|
|
7725
7819
|
*/
|
|
7726
7820
|
cities: boolean;
|
|
7821
|
+
/**
|
|
7822
|
+
* Whether to preload low-quality tiles when the layer is added or the time range changes,
|
|
7823
|
+
* ensuring fallback data is available immediately when panning or zooming beyond currently
|
|
7824
|
+
* loaded tile bounds. Default is `false`.
|
|
7825
|
+
*/
|
|
7826
|
+
preloadLowQuality: boolean;
|
|
7727
7827
|
}>;
|
|
7728
7828
|
/**
|
|
7729
7829
|
* Options for configuring the layer's timing behavior, for time-based data only.
|
|
@@ -7742,13 +7842,10 @@ export declare type WeatherLayerOptions = {
|
|
|
7742
7842
|
*/
|
|
7743
7843
|
legend: Partial<LegendOptions> | false;
|
|
7744
7844
|
/**
|
|
7745
|
-
*
|
|
7845
|
+
* The map's live timeline animation instance, used by source generators for both time range
|
|
7846
|
+
* parameters and per-feature animation controllers.
|
|
7746
7847
|
*/
|
|
7747
|
-
timeline:
|
|
7748
|
-
from: Date;
|
|
7749
|
-
to: Date;
|
|
7750
|
-
current: Date;
|
|
7751
|
-
};
|
|
7848
|
+
timeline: TimeAnimation;
|
|
7752
7849
|
/**
|
|
7753
7850
|
* Options for configuring a mask to apply to the layer.
|
|
7754
7851
|
*/
|
|
@@ -7839,6 +7936,8 @@ declare abstract class WebGLLayer<Source extends DataSource = DataSource> extend
|
|
|
7839
7936
|
* Whether to invert the mask layer's output.
|
|
7840
7937
|
*/
|
|
7841
7938
|
invertMaskLayer: boolean;
|
|
7939
|
+
|
|
7940
|
+
private _renderFrameContext;
|
|
7842
7941
|
|
|
7843
7942
|
/**
|
|
7844
7943
|
* Returns the render paint style configuration for this layer.
|
|
@@ -7860,6 +7959,21 @@ get mask(): LayerMask;
|
|
|
7860
7959
|
* @readonly
|
|
7861
7960
|
*/
|
|
7862
7961
|
get visible(): boolean;
|
|
7962
|
+
/**
|
|
7963
|
+
* Registers another layer as depending on this layer (for example it reads this layer via `queryFeatures`
|
|
7964
|
+
* while this layer may be hidden). When the registry is non-empty, time-series data providers may load tiles even
|
|
7965
|
+
* if this layer is not visible.
|
|
7966
|
+
*/
|
|
7967
|
+
registerDependentLayer(layer: WebGLLayer): void;
|
|
7968
|
+
/**
|
|
7969
|
+
* Removes a layer from this layer's dependent registry.
|
|
7970
|
+
*/
|
|
7971
|
+
unregisterDependentLayer(layer: WebGLLayer): void;
|
|
7972
|
+
/**
|
|
7973
|
+
* Whether any layer has registered as a dependent via
|
|
7974
|
+
* {@link WebGLLayer.registerDependentLayer}.
|
|
7975
|
+
*/
|
|
7976
|
+
hasDependentLayers(): boolean;
|
|
7863
7977
|
/**
|
|
7864
7978
|
* Returns whether this layer is enabled or not.
|
|
7865
7979
|
*/
|