@windycom/plugin-devtools 3.0.2 → 3.0.3
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 +1 -1
- package/types/client/Calendar.d.ts +4 -0
- package/types/client/Color.d.ts +9 -2
- package/types/client/DataTiler.d.ts +2 -2
- package/types/client/EventManager.d.ts +69 -0
- package/types/client/ExternalSveltePlugin.d.ts +4 -3
- package/types/client/GlBuffer.d.ts +45 -0
- package/types/client/GlMesh.d.ts +147 -0
- package/types/client/GlProgram.d.ts +41 -0
- package/types/client/GlRenderer.d.ts +95 -0
- package/types/client/GlTexture.d.ts +98 -0
- package/types/client/GlVertexArray.d.ts +38 -0
- package/types/client/IDB.d.ts +25 -4
- package/types/client/LabelsLayer.d.ts +69 -2
- package/types/client/Layer.d.ts +2 -1
- package/types/client/MetricClasses.d.ts +1 -1
- package/types/client/Overlay.d.ts +1 -5
- package/types/client/Product.d.ts +10 -5
- package/types/client/ProductClasses.d.ts +7 -0
- package/types/client/Renderer.d.ts +16 -19
- package/types/client/ShaderStorage.d.ts +25 -0
- package/types/client/StartupElementPlugin.d.ts +8 -0
- package/types/client/SveltePlugin.d.ts +4 -4
- package/types/client/SwitchableTileCache.d.ts +104 -0
- package/types/client/TileLayer.d.ts +11 -2
- package/types/client/TileLayerCustom.d.ts +51 -0
- package/types/client/TileLayerMulti.d.ts +53 -0
- package/types/client/TileLayerPreprocessorStandalone.d.ts +45 -0
- package/types/client/TileLayerRenderer.d.ts +24 -0
- package/types/client/TileLayerUtils.d.ts +43 -0
- package/types/client/TilePreprocessor.d.ts +27 -0
- package/types/client/TopoMap.d.ts +2 -1
- package/types/client/WindowPlugin.d.ts +1 -3
- package/types/client/baseMap.d.ts +12 -2
- package/types/client/broadcast.d.ts +1 -1
- package/types/client/cityLabels.d.ts +2 -3
- package/types/client/colorGradients.d.ts +1 -2
- package/types/client/css.test.d.ts +1 -0
- package/types/client/customProtocol.d.ts +11 -0
- package/types/client/d.ts.files/GlObj.d.ts +1 -5
- package/types/client/d.ts.files/Metric.d.ts +2 -0
- package/types/client/d.ts.files/broadcast.d.ts +28 -32
- package/types/client/d.ts.files/dataSpecifications.d.ts +60 -42
- package/types/client/d.ts.files/glUtils.d.ts +71 -0
- package/types/client/d.ts.files/http.d.ts +0 -5
- package/types/client/d.ts.files/interpolatorTypes.d.ts +5 -5
- package/types/client/d.ts.files/lib.d.ts +1 -1
- package/types/client/d.ts.files/liveAlerts.d.ts +52 -0
- package/types/client/d.ts.files/mapUtils.d.ts +25 -0
- package/types/client/d.ts.files/outgoingMessages.d.ts +1 -1
- package/types/client/d.ts.files/plugin-params.d.ts +31 -13
- package/types/client/d.ts.files/plugins.d.ts +44 -29
- package/types/client/d.ts.files/singleclick.d.ts +4 -2
- package/types/client/d.ts.files/startup.d.ts +7 -52
- package/types/client/d.ts.files/storage.d.ts +0 -11
- package/types/client/d.ts.files/user.d.ts +6 -1
- package/types/client/embed.d.ts +2 -5
- package/types/client/errorLogger.d.ts +19 -0
- package/types/client/externalPlugins.d.ts +4 -2
- package/types/client/fetch.d.ts +38 -5
- package/types/client/format.d.ts +11 -0
- package/types/client/glContextUtils.d.ts +9 -0
- package/types/client/glStatus.d.ts +7 -0
- package/types/client/glUtils.d.ts +119 -0
- package/types/client/http.d.ts +0 -6
- package/types/client/idbConnection.d.ts +13 -0
- package/types/client/idbInstances.d.ts +36 -42
- package/types/client/landLayer.d.ts +3 -0
- package/types/client/layers.d.ts +2 -1
- package/types/client/lib.d.ts +11 -14
- package/types/client/liveAlerts.d.ts +2 -2
- package/types/client/location.d.ts +1 -1
- package/types/client/map.d.ts +95 -22
- package/types/client/mapUtils.d.ts +66 -0
- package/types/client/math.d.ts +14 -0
- package/types/client/mobile.d.ts +16 -34
- package/types/client/mobileUtils.d.ts +10 -0
- package/types/client/models.d.ts +1 -1
- package/types/client/overlays.d.ts +2 -2
- package/types/client/picker.d.ts +4 -8
- package/types/client/products.d.ts +0 -1
- package/types/client/promo.d.ts +1 -1
- package/types/client/renderUtils.d.ts +14 -0
- package/types/client/renderers.d.ts +5 -6
- package/types/client/rootScope.d.ts +9 -9
- package/types/client/router.d.ts +7 -2
- package/types/client/singleclick.d.ts +1 -1
- package/types/client/startup.d.ts +48 -0
- package/types/client/startupUtils.d.ts +19 -0
- package/types/client/subscription.d.ts +3 -26
- package/types/client/throttler.d.ts +32 -0
- package/types/client/tileHelpers.d.ts +35 -0
- package/types/client/tileLayerInterpolator.d.ts +40 -0
- package/types/client/tileLayerSource.d.ts +98 -0
- package/types/client/timestampUtils.test.d.ts +1 -0
- package/types/client/topMessage.d.ts +22 -0
- package/types/client/user.d.ts +1 -0
- package/types/client/userConsent.d.ts +0 -2
- package/types/client/userFavs.d.ts +0 -8
- package/types/client/utils.d.ts +62 -10
- package/types/client/utils.test.d.ts +1 -0
- package/types/iconfont.d.ts +2 -5
- package/types/interfaces.d.ts +121 -100
- package/types/lang-files.d.ts +412 -72
- package/types/leaflet-gl.d.ts +12773 -0
- package/types/types.d.ts +28 -6
- package/types/client/d.ts.files/CanvasLayer.d.ts +0 -70
- package/types/client/d.ts.files/DataTiler.d.ts +0 -45
- package/types/client/d.ts.files/LandMask.d.ts +0 -17
- package/types/client/d.ts.files/PoisOverlay.d.ts +0 -27
- package/types/client/d.ts.files/TileLayerCanvas.d.ts +0 -78
- package/types/client/d.ts.files/TileLayerMultiPatch.d.ts +0 -13
package/types/client/IDB.d.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
import { Evented } from '@windy/Evented';
|
|
1
2
|
import type { Timestamp } from '@windy/types.d';
|
|
3
|
+
import type { IdbConnection } from '@windy/idbConnection';
|
|
2
4
|
/**
|
|
3
5
|
* List of all collections we will need in our database
|
|
4
6
|
* remember to update this list when adding new collections
|
|
5
7
|
* Collections MUST be created at once
|
|
6
8
|
*/
|
|
7
|
-
export declare const allUsedCollections: readonly ["customColors", "
|
|
9
|
+
export declare const allUsedCollections: readonly ["customColors", "installedPlugins2", "likedStoryComments", "log", "markedNotams", "popularLocations", "searchRecents2", "upvotedArticles", "seenPromos", "slidedCapAlerts", "userAlerts", "userFavs"];
|
|
10
|
+
interface IdbEvent {
|
|
11
|
+
_nativeSync: [{
|
|
12
|
+
storeId: DatabaseStore;
|
|
13
|
+
syncToNativeStorage: boolean;
|
|
14
|
+
}];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Used by nativeStorage.ts to sync IDB with native storage
|
|
18
|
+
*/
|
|
19
|
+
export declare const idbEmitter: Evented<IdbEvent>;
|
|
8
20
|
/**
|
|
9
21
|
* Allowed data types for storage
|
|
10
22
|
*/
|
|
@@ -15,14 +27,18 @@ export type BackendItem<V> = {
|
|
|
15
27
|
value: V;
|
|
16
28
|
};
|
|
17
29
|
export type BackendPayload<V> = BackendItem<V>[];
|
|
18
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Any objecgs synced with cloud MUST have an unique id property
|
|
32
|
+
*/
|
|
33
|
+
export type SupportedApiEndpoints = 'notams' | 'colors' | 'alerts' | 'favs' | 'plugins';
|
|
19
34
|
export type StoredObjectWithId = {
|
|
20
35
|
id: string;
|
|
21
36
|
};
|
|
22
37
|
export interface IDBParams {
|
|
23
38
|
storeId: DatabaseStore;
|
|
24
|
-
|
|
39
|
+
connection: IdbConnection;
|
|
25
40
|
backendApiEndpoint?: SupportedApiEndpoints;
|
|
41
|
+
syncToNativeStorage?: boolean;
|
|
26
42
|
}
|
|
27
43
|
/**
|
|
28
44
|
* Wrapper around IndexedDB to provide async storage
|
|
@@ -33,7 +49,7 @@ export declare class IDB<K extends string | number, V, W = V> {
|
|
|
33
49
|
private storeId;
|
|
34
50
|
private memoryCache;
|
|
35
51
|
private cacheIsValid;
|
|
36
|
-
private
|
|
52
|
+
private connection;
|
|
37
53
|
/**
|
|
38
54
|
* Is this db synced with backend?
|
|
39
55
|
*
|
|
@@ -45,6 +61,10 @@ export declare class IDB<K extends string | number, V, W = V> {
|
|
|
45
61
|
* URL of the API endpoint, where data should be stored
|
|
46
62
|
*/
|
|
47
63
|
private apiEndpoint;
|
|
64
|
+
/**
|
|
65
|
+
* Should this DB sync with mobile native storage
|
|
66
|
+
*/
|
|
67
|
+
private syncToNativeStorage;
|
|
48
68
|
/**
|
|
49
69
|
* Timestamp of last db update on this device (used only when collection has userBackend)
|
|
50
70
|
*/
|
|
@@ -67,3 +87,4 @@ export declare class IDB<K extends string | number, V, W = V> {
|
|
|
67
87
|
*/
|
|
68
88
|
loadFromCloud(): Promise<boolean>;
|
|
69
89
|
}
|
|
90
|
+
export {};
|
|
@@ -1,2 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { GridLayer, LeafletGlMap, type Coords, type GridLayerOptions } from '@leafletGl';
|
|
2
|
+
import type { CityDiv, CityDivId, CityLabel, CityLabelData } from './d.ts.files/LabelsLayer.d';
|
|
3
|
+
import type { Products } from './d.ts.files/rootScope.d';
|
|
4
|
+
import type { MetricIdent, MetricItem } from './d.ts.files/Metric.d';
|
|
5
|
+
import type { CityTemperaturesDto } from '@windy-types/citytile2';
|
|
6
|
+
/**
|
|
7
|
+
* Leaflet layer with city labels and temperatures
|
|
8
|
+
*/
|
|
9
|
+
declare class LabelsLayer extends GridLayer<CityLabelData> {
|
|
10
|
+
static defaultOptions: Required<GridLayerOptions>;
|
|
11
|
+
/** Currently selected product in client */
|
|
12
|
+
product?: Products;
|
|
13
|
+
/** Cache of leaflet tiles with labels and temperatures */
|
|
14
|
+
cityDivs: Record<CityDivId, CityDiv>;
|
|
15
|
+
/** Currently selected forecast timestamp in client */
|
|
16
|
+
ts: number;
|
|
17
|
+
/** Whether hooks are binded (true) or not (false) */
|
|
18
|
+
hasHooks: boolean;
|
|
19
|
+
forecastLoaded: boolean;
|
|
20
|
+
/** URL for getting label tiles */
|
|
21
|
+
tilesUrl?: string;
|
|
22
|
+
/** Current reftime in client */
|
|
23
|
+
refTime?: string;
|
|
24
|
+
/** Temperature unit */
|
|
25
|
+
temperatureUnit?: MetricItem;
|
|
26
|
+
constructor(options?: GridLayerOptions);
|
|
27
|
+
onAdd(leafletMap: LeafletGlMap): this;
|
|
28
|
+
onRemove(leafletMap: LeafletGlMap): this;
|
|
29
|
+
/** Creates and stores URL for fetching label tiles */
|
|
30
|
+
createTilesUrl(): void;
|
|
31
|
+
/** Update labels (e.g. when language is changed) */
|
|
32
|
+
updateLabels(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Updates product name and reference time, also can fetch and update temperature data
|
|
35
|
+
* @param refreshWeather Whether fetch forecast data or not (true from store event)
|
|
36
|
+
*/
|
|
37
|
+
updateProduct(refreshWeather?: boolean): Promise<void>;
|
|
38
|
+
/** Click event for labels */
|
|
39
|
+
onClick(sourceEl: HTMLElement): void;
|
|
40
|
+
/** TS change event whenever client's timestamp (progress bar) is changed */
|
|
41
|
+
onTsChange(ts: number): void;
|
|
42
|
+
/** Load new data when temperature unit is changed */
|
|
43
|
+
onMetricChanged(ident: MetricIdent, item: MetricItem): void;
|
|
44
|
+
/** Update temp values for all tiles, e.g. when timestamp or metric is changed (it doesn't fetch new data from the server) */
|
|
45
|
+
refreshWeather(): void;
|
|
46
|
+
/** Redraw whole layer as it was first loaded */
|
|
47
|
+
_reset(): void;
|
|
48
|
+
/** Returns array of all cities in a form { id, el } */
|
|
49
|
+
toArray(): CityLabel[];
|
|
50
|
+
getCityDivs(): CityDiv[];
|
|
51
|
+
/** Fetch forecast temperature data for the tile */
|
|
52
|
+
loadTileForecast(tileDiv: CityDiv): void;
|
|
53
|
+
/** Callback when forecast data are retrieved */
|
|
54
|
+
onForecastLoaded(tileDiv: CityDiv, data: CityTemperaturesDto): void;
|
|
55
|
+
protected _loadTileData(coords: Coords, abort: AbortSignal): Promise<CityLabelData | null>;
|
|
56
|
+
protected _createTileContents(tileRoot: HTMLElement, coords: Coords, data: CityLabelData): void;
|
|
57
|
+
/**
|
|
58
|
+
* Adds DIVs with labels to the DOM, it does not fetch any data (called e.g. after retrieving labels data)
|
|
59
|
+
* It does not render temperature which is appended to this div later
|
|
60
|
+
*/
|
|
61
|
+
private renderTile;
|
|
62
|
+
private getIndexToCityTileData;
|
|
63
|
+
/**
|
|
64
|
+
* Render forecast data for the tile, it does not fetch forecast data (called e.g. whenever refreshWeather is called)
|
|
65
|
+
* Enhances DIV with data-id="id" with loaded weather.
|
|
66
|
+
*/
|
|
67
|
+
private renderWeather;
|
|
68
|
+
}
|
|
69
|
+
export default LabelsLayer;
|
package/types/client/Layer.d.ts
CHANGED
|
@@ -22,12 +22,14 @@ export interface LayerMetricType {
|
|
|
22
22
|
ecmwfWindParticles500h: undefined;
|
|
23
23
|
ecmwfWindParticles600h: undefined;
|
|
24
24
|
waveParticles: undefined;
|
|
25
|
+
waveParticlesWaves: undefined;
|
|
25
26
|
currentParticles: undefined;
|
|
26
27
|
currentsTideParticles: undefined;
|
|
27
28
|
wind: NumberedMetric;
|
|
28
29
|
temp: NumberedMetric;
|
|
29
30
|
wetbulbtemp: NumberedMetric;
|
|
30
31
|
solarpower: NumberedMetric;
|
|
32
|
+
wavePower: NumberedMetric;
|
|
31
33
|
uvindex: UVIndexMetric;
|
|
32
34
|
dewpoint: NumberedMetric;
|
|
33
35
|
gust: NumberedMetric;
|
|
@@ -64,7 +66,6 @@ export interface LayerMetricType {
|
|
|
64
66
|
dustsm: NumberedMetric;
|
|
65
67
|
radar: NumberedMetric;
|
|
66
68
|
satellite: NumberedMetric;
|
|
67
|
-
radarPlus: NumberedMetric;
|
|
68
69
|
gtco3: NumberedMetric;
|
|
69
70
|
pm2p5: NumberedMetric;
|
|
70
71
|
no2: NumberedMetric;
|
|
@@ -31,7 +31,7 @@ export declare class SatelliteMetric extends NumberedMetric {
|
|
|
31
31
|
* Dynamic update from minifest/info.json
|
|
32
32
|
* @param pars various pars depending on concrete instance
|
|
33
33
|
*/
|
|
34
|
-
updateLines(pars: [number, number],
|
|
34
|
+
updateLines(pars: [number, number], _radarEnabled?: boolean): void;
|
|
35
35
|
}
|
|
36
36
|
export declare class PrecipMetric extends NumberedMetric {
|
|
37
37
|
initProperties(): void;
|
|
@@ -5,7 +5,7 @@ import type { Iconfont } from '@windy/iconfont.d';
|
|
|
5
5
|
import type { Overlays } from '@windy/rootScope.d';
|
|
6
6
|
import type { RGBNumValues } from '@windy/interpolatorTypes';
|
|
7
7
|
import type { LoadedTranslations, HTMLString, RGBString } from '@windy/types';
|
|
8
|
-
export type UsedOverlays = Overlays | 'swell'
|
|
8
|
+
export type UsedOverlays = Overlays | 'swell';
|
|
9
9
|
export type OverlayInitParams = Pick<Overlay, 'ident'> & Partial<Overlay>;
|
|
10
10
|
type LayerProperty<L extends Layer | undefined, P extends keyof Layer> = L extends Layer ? L[P] : undefined;
|
|
11
11
|
type MetricProperty<M extends Metric | undefined, P extends keyof Metric> = M extends Metric ? M[P] : undefined;
|
|
@@ -79,10 +79,6 @@ export declare class Overlay<I extends Overlays = Overlays, M extends I extends
|
|
|
79
79
|
* Hides particle on/off switch in GUI (so far used only in desktop GUI)
|
|
80
80
|
*/
|
|
81
81
|
hideParticles?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Disables isolines on/off switch in GUI
|
|
84
|
-
*/
|
|
85
|
-
hideIsolines?: boolean;
|
|
86
82
|
/**
|
|
87
83
|
* Given overlay display accumulation
|
|
88
84
|
*/
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Calendar } from '@windy/Calendar';
|
|
2
|
+
import { type LeafletGlMap } from '@leafletGl';
|
|
2
3
|
import type { MinifestObject } from '@windy/Calendar';
|
|
3
4
|
import type { Layers } from '@windy/Layer';
|
|
4
5
|
import type { LatLon } from '@windy/interfaces';
|
|
5
6
|
import type { Isolines, Levels, Overlays, Products } from '@windy/rootScope.d';
|
|
6
|
-
import type { ISODateString, ProductCategory, ProductIdent, Timestamp, Path, Minutes } from '@windy/types';
|
|
7
|
+
import type { ISODateString, ProductCategory, ProductIdent, Timestamp, TimeRangeMs, Path, Minutes } from '@windy/types';
|
|
7
8
|
export type DataQuality = 'normal' | 'high' | 'low' | 'ultra' | 'extreme';
|
|
8
9
|
export type FileSuffix = 'png' | 'jpg' | 'webp';
|
|
9
|
-
export type ProductInitParams = Pick<Product, 'modelName' | 'provider' | 'interval'> & Partial<Pick<Product, 'provider' | 'ident' | 'maxTileZoom' | 'animationSpeed' | 'animationSpeed1h' | 'fileSuffix' | 'fileSuffixFallback' | 'JPGtransparency' | 'PNGtransparency' | 'dataQuality' | 'betterDataQuality' | 'animation' | 'labelsTemp' | 'overlays' | 'preferredProduct' | 'isolines' | 'directory' | 'category' | 'modelIdent' | 'intervalPremium' | 'server' | 'modelResolution' | 'levels' | 'levelsOverride' | 'logo' | 'preferredWaveProduct' | 'preferredAirProduct' | 'hasAccumulations' | 'hasMinifest' | 'freeProduct' | 'hideProductSwitch' | 'modelDescription'>> & {
|
|
10
|
+
export type ProductInitParams = Pick<Product, 'modelName' | 'provider' | 'interval'> & Partial<Pick<Product, 'provider' | 'ident' | 'maxTileZoom' | 'animationSpeed' | 'animationSpeed1h' | 'fileSuffix' | 'fileSuffixFallback' | 'JPGtransparency' | 'PNGtransparency' | 'dataQuality' | 'betterDataQuality' | 'animation' | 'labelsTemp' | 'overlays' | 'preferredProduct' | 'isolines' | 'directory' | 'category' | 'modelIdent' | 'intervalPremium' | 'server' | 'modelResolution' | 'levels' | 'levelsOverride' | 'logo' | 'preferredWaveProduct' | 'preferredAirProduct' | 'hasAccumulations' | 'hasMinifest' | 'freeProduct' | 'hideProductSwitch' | 'modelDescription' | 'supportsMeteogram'>> & {
|
|
10
11
|
forecastSize?: number;
|
|
11
12
|
bounds?: [number, number][][];
|
|
12
13
|
};
|
|
@@ -15,7 +16,7 @@ export declare class Product {
|
|
|
15
16
|
* Boundaries of the product in a format [[north, west], [north, east], [south, east], [south, west]] or any more accurate polygon
|
|
16
17
|
*/
|
|
17
18
|
private bounds?;
|
|
18
|
-
|
|
19
|
+
protected minifestExpirationTime: TimeRangeMs;
|
|
19
20
|
/**
|
|
20
21
|
* Minifest loading promise
|
|
21
22
|
*/
|
|
@@ -76,7 +77,7 @@ export declare class Product {
|
|
|
76
77
|
/**
|
|
77
78
|
* Description of product for purpose of UI
|
|
78
79
|
*/
|
|
79
|
-
modelName: string;
|
|
80
|
+
modelName: string | '';
|
|
80
81
|
modelResolution?: number;
|
|
81
82
|
provider?: string;
|
|
82
83
|
/**
|
|
@@ -169,6 +170,10 @@ export declare class Product {
|
|
|
169
170
|
* Time when minifest was last updated
|
|
170
171
|
*/
|
|
171
172
|
minifestLastUpdate?: Timestamp;
|
|
173
|
+
/**
|
|
174
|
+
* Point fcst backend for this product supports airgram/meteogram
|
|
175
|
+
*/
|
|
176
|
+
supportsMeteogram?: boolean;
|
|
172
177
|
constructor(params: ProductInitParams);
|
|
173
178
|
getRefTimeISOFormat(): Promise<ISODateString | undefined>;
|
|
174
179
|
getRefTime(): Promise<Path | undefined>;
|
|
@@ -184,7 +189,7 @@ export declare class Product {
|
|
|
184
189
|
/**
|
|
185
190
|
* Detects if the the bounds are in viewport
|
|
186
191
|
*/
|
|
187
|
-
boundsAreInViewport(map:
|
|
192
|
+
boundsAreInViewport(map: LeafletGlMap): boolean;
|
|
188
193
|
close(): void;
|
|
189
194
|
open(): void;
|
|
190
195
|
getCalendar(): Promise<Calendar | undefined>;
|
|
@@ -30,6 +30,13 @@ export declare class SatAndRadarPlusProduct extends Product {
|
|
|
30
30
|
urlSuffFlow: string;
|
|
31
31
|
constructor(params: SatelliteProductInitParams);
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Auxiliary product with fake calendar required for rendering of isolines on top of overlays, that do not have calendar nor load minifest
|
|
35
|
+
* - provides timestamp array with single timestamp pair equal to the current time
|
|
36
|
+
*/
|
|
37
|
+
export declare class FakeCalendarProduct extends Product {
|
|
38
|
+
loadMinifest(): Promise<MinifestObject>;
|
|
39
|
+
}
|
|
33
40
|
export declare class NamProducts extends Product {
|
|
34
41
|
constructor(params: Partial<ProductInitParams>);
|
|
35
42
|
}
|
|
@@ -3,9 +3,15 @@ import type { Timestamp, TransformFunction } from '@windy/types';
|
|
|
3
3
|
import type { Layers } from '@windy/Layer';
|
|
4
4
|
import type { InterpolatorFactory } from '@windy/interpolator';
|
|
5
5
|
import type { BottomSveltePlugins, Plugins, SveltePlugins } from '@windy/plugins.d';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export type AllowedRenderPlugins = Pick<Plugins, 'radar' | 'radar-plus' | 'cap-alerts' | 'isolines' | 'gl-particles'>;
|
|
7
|
+
interface DependencyModuleMap {
|
|
8
|
+
radar: WPluginModules['@plugins/radar'];
|
|
9
|
+
'radar-plus': WPluginModules['@plugins/radar-plus'];
|
|
10
|
+
'cap-alerts': WPluginModules['@plugins/cap-alerts'];
|
|
11
|
+
isolines: WPluginModules['@plugins/isolines'];
|
|
12
|
+
'gl-particles': WPluginModules['@plugins/gl-particles'];
|
|
13
|
+
}
|
|
14
|
+
export type Renderers = 'tileLayer' | 'radar' | 'radarPlus' | 'capAlerts' | 'isolines' | 'particles' | 'accumulations' | 'daySwitcher' | 'noUserControl' | 'topoMap';
|
|
9
15
|
export interface TileParams extends TilePoint {
|
|
10
16
|
url: string;
|
|
11
17
|
intX: number;
|
|
@@ -26,7 +32,7 @@ export interface RendererInitParams {
|
|
|
26
32
|
* Renderer class acts as a proxy between renderController and code, which is responsible for
|
|
27
33
|
* rendering a particular layer
|
|
28
34
|
*/
|
|
29
|
-
export declare class Renderer
|
|
35
|
+
export declare class Renderer {
|
|
30
36
|
isOpen: boolean;
|
|
31
37
|
/**
|
|
32
38
|
* Ident of renderer. Not used in runtime, but essential for debugging.
|
|
@@ -44,11 +50,11 @@ export declare class Renderer<K extends keyof AllowedRenderPlugins | undefined =
|
|
|
44
50
|
* - redraw
|
|
45
51
|
* - interpolator
|
|
46
52
|
*/
|
|
47
|
-
dependency?:
|
|
53
|
+
dependency?: keyof AllowedRenderPlugins;
|
|
48
54
|
/**
|
|
49
55
|
* Loaded version of plugin dependency
|
|
50
56
|
*/
|
|
51
|
-
loadedDependency?:
|
|
57
|
+
loadedDependency?: DependencyModuleMap[keyof DependencyModuleMap];
|
|
52
58
|
/**
|
|
53
59
|
* ID of plugin, that serve as user control, which can be attached to DOM
|
|
54
60
|
* usually to #plugin-bottom div.
|
|
@@ -64,26 +70,17 @@ export declare class Renderer<K extends keyof AllowedRenderPlugins | undefined =
|
|
|
64
70
|
* userControl opening and closing is handles by rndrCtrl
|
|
65
71
|
*/
|
|
66
72
|
userControl?: AllowedUserControls;
|
|
67
|
-
/**
|
|
68
|
-
* Picker interpolation factory
|
|
69
|
-
*/
|
|
73
|
+
/** Picker interpolation factory */
|
|
70
74
|
interpolator?: InterpolatorFactory;
|
|
71
|
-
/**
|
|
72
|
-
* Instance of this renderer requires FullRenderParameters to be passed
|
|
73
|
-
* to renderer methods
|
|
74
|
-
*/
|
|
75
|
+
/** Requires FullRenderParameters */
|
|
75
76
|
requiresFullRenderParams: boolean;
|
|
76
77
|
constructor(params: RendererInitParams);
|
|
78
|
+
private static hasProp;
|
|
77
79
|
open(layerIdent: Layers, weatherParams: WeatherParameters, timestamp: Timestamp): Promise<void>;
|
|
78
|
-
/**
|
|
79
|
-
* Called by rndrCtrl. Requires list of required renderers,
|
|
80
|
-
* so we kno who will replace us. This parameters is here just because of
|
|
81
|
-
* TileLayer, which is just wrapper around Leaflet GridLayer, and we want to
|
|
82
|
-
* keep this Leaflet instance alive.
|
|
83
|
-
*/
|
|
84
80
|
close(_rqrdRenderers: Renderers[]): void;
|
|
85
81
|
onopen(params?: FullRenderParameters): void;
|
|
86
82
|
onclose(): void;
|
|
87
83
|
paramsChanged(layerIdent: Layers, weatherParams: WeatherParameters, timestamp: Timestamp): Promise<void>;
|
|
88
84
|
redraw(): void;
|
|
89
85
|
}
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @class Shader source storage for different WebGL contexts
|
|
3
|
+
* - we aim for using WebGL1 shaders where possible to minimize duplicate code, unless we need some WebGL2-specific features
|
|
4
|
+
* - therefore we use WebGL1 sources also in case of WebGL2 context, but it can be overridden in case it is necessary
|
|
5
|
+
*/
|
|
6
|
+
export declare class ShaderStorage {
|
|
7
|
+
static WGL2: {
|
|
8
|
+
vTileTextureBlit: string;
|
|
9
|
+
vScreenQuad: string;
|
|
10
|
+
fTileTextureBlit: string;
|
|
11
|
+
fTextureDebug: string;
|
|
12
|
+
fTextureBlit: string;
|
|
13
|
+
fTileLayerPreprocess: string;
|
|
14
|
+
fTileLayerPtypePreprocess: string;
|
|
15
|
+
};
|
|
16
|
+
static WGL1: {
|
|
17
|
+
vTileTextureBlit: string;
|
|
18
|
+
vScreenQuad: string;
|
|
19
|
+
fTileTextureBlit: string;
|
|
20
|
+
fTextureDebug: string;
|
|
21
|
+
fTextureBlit: string;
|
|
22
|
+
fTileLayerPreprocess: string;
|
|
23
|
+
fTileLayerPtypePreprocess: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SveltePlugin } from '@windy/SveltePlugin';
|
|
2
|
+
import type { SveltePluginInitParams } from '@windy/SveltePlugin';
|
|
3
|
+
import type { StartupElementPlugins } from '@windy/plugins.d';
|
|
4
|
+
export type StartupElementPluginInitParams<P extends keyof StartupElementPlugins> = Omit<SveltePluginInitParams<P>, 'ident'> & Pick<StartupElementPlugin<P>, 'ident'>;
|
|
5
|
+
export declare class StartupElementPlugin<P extends keyof StartupElementPlugins> extends SveltePlugin<P> {
|
|
6
|
+
ident: P;
|
|
7
|
+
constructor(params: StartupElementPluginInitParams<P>);
|
|
8
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { WindowPlugin } from '@windy/WindowPlugin';
|
|
2
2
|
import type { WindowPluginInitParams } from '@windy/WindowPlugin';
|
|
3
3
|
import type { PluginsOpenParams, PluginsQsParams } from '@windy/plugin-params.d';
|
|
4
|
-
import type { BottomSveltePlugins, SveltePanePlugins, SveltePlugins } from '@windy/plugins.d';
|
|
4
|
+
import type { BottomSveltePlugins, StartupElementPlugins, SveltePanePlugins, SveltePlugins } from '@windy/plugins.d';
|
|
5
5
|
import type { InterpolatorFactory } from '@windy/interpolator';
|
|
6
6
|
import type { FullRenderParameters } from '@windy/interfaces';
|
|
7
|
-
export declare class SvelteApp<P extends keyof SveltePlugins | keyof SveltePanePlugins | keyof BottomSveltePlugins> {
|
|
7
|
+
export declare class SvelteApp<P extends keyof SveltePlugins | keyof SveltePanePlugins | keyof BottomSveltePlugins | keyof StartupElementPlugins> {
|
|
8
8
|
interpolator?: InterpolatorFactory;
|
|
9
9
|
constructor(_args: {
|
|
10
10
|
target: HTMLElement;
|
|
@@ -30,8 +30,8 @@ export declare class ExternalSvelteApp {
|
|
|
30
30
|
$destroy(): void;
|
|
31
31
|
}
|
|
32
32
|
/** Allowed params to SveltePlugin constructor (private and protected props are omited by default) */
|
|
33
|
-
export type SveltePluginInitParams<P extends keyof SveltePlugins | keyof SveltePanePlugins | keyof BottomSveltePlugins> = Omit<WindowPluginInitParams<P>, 'ident'> & Pick<SveltePlugin<P>, 'ident'> & Partial<SveltePlugin<P>>;
|
|
34
|
-
export declare class SveltePlugin<P extends keyof SveltePlugins | keyof SveltePanePlugins | keyof BottomSveltePlugins> extends WindowPlugin<P> {
|
|
33
|
+
export type SveltePluginInitParams<P extends keyof SveltePlugins | keyof SveltePanePlugins | keyof BottomSveltePlugins | keyof StartupElementPlugins> = Omit<WindowPluginInitParams<P>, 'ident'> & Pick<SveltePlugin<P>, 'ident'> & Partial<SveltePlugin<P>>;
|
|
34
|
+
export declare class SveltePlugin<P extends keyof SveltePlugins | keyof SveltePanePlugins | keyof BottomSveltePlugins | keyof StartupElementPlugins> extends WindowPlugin<P> {
|
|
35
35
|
/**
|
|
36
36
|
* Holder of SvelteApp
|
|
37
37
|
*/
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Bounds, LeafletGlMap, TileCache, type Coords } from '@leafletGl';
|
|
2
|
+
type OnCacheDestroy = () => void;
|
|
3
|
+
export type Cache<TTile> = {
|
|
4
|
+
cache: TileCache<TTile>;
|
|
5
|
+
/**
|
|
6
|
+
* Completely cleans up the cache: disposes of the internal TileCache, un-registers event listeners, cleans up tile preprocessor.
|
|
7
|
+
*/
|
|
8
|
+
destroy: OnCacheDestroy;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* This class serves as a tile cache with the added functionality of
|
|
12
|
+
* being able to swap the internal set of tiles (internal tile cache)
|
|
13
|
+
* for a new set of tiles, but only once the new tiles are fully loaded.
|
|
14
|
+
*
|
|
15
|
+
* This is useful for when you want to eg. swap current forecast refTime or model and only display the new data once it is fully ready.
|
|
16
|
+
*
|
|
17
|
+
* Additionally, this class supports {@link awaitTile} function, which asynchronously waits for a given tile to be loaded.
|
|
18
|
+
* This does not trigger a new tile load, but waits for the tile to become required by the current map view.
|
|
19
|
+
*/
|
|
20
|
+
export declare class SwitchableTileCache<TTile> {
|
|
21
|
+
private _nextCache;
|
|
22
|
+
private _currentCache;
|
|
23
|
+
private _keepBuffer;
|
|
24
|
+
private _maxLowerZoom;
|
|
25
|
+
private _maxHigherZoom;
|
|
26
|
+
private _lastMapBounds;
|
|
27
|
+
private _lastMapZoom;
|
|
28
|
+
onSwitch?: () => void;
|
|
29
|
+
get currentCache(): Cache<TTile>;
|
|
30
|
+
get keepBuffer(): number;
|
|
31
|
+
/**
|
|
32
|
+
* Gets the map bounds, as computed at the last {@link update} call,
|
|
33
|
+
* with {@link keepBuffer} taken into account.
|
|
34
|
+
*/
|
|
35
|
+
get lastBounds(): Bounds;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the map integer zoom, as computed at the last {@link update} call.
|
|
38
|
+
*/
|
|
39
|
+
get lastZoom(): number;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new instance of {@link SwitchableTileCache}.
|
|
42
|
+
* @param initialCache - The initial tile cache to be used.
|
|
43
|
+
* @param keepBuffer - How many extra tiles in each of the four directions should be loaded in addition to the set that optimally covers the current map view.
|
|
44
|
+
* @param maxLowerZoom - If a tile at the specified zoom level is unavailable, its parent or children may be rendered instead.
|
|
45
|
+
* This value is the maximal allowed difference in zoom levels when rendering a **less** detailed tile instead of the ideal one.
|
|
46
|
+
* @param maxHigherZoom - If a tile at the specified zoom level is unavailable, its parent or children may be rendered instead.
|
|
47
|
+
* This value is the maximal allowed difference in zoom levels when rendering a **more** detailed tile instead of the ideal one.
|
|
48
|
+
*/
|
|
49
|
+
constructor(initialCache: Cache<TTile>, keepBuffer?: number, maxLowerZoom?: number, maxHigherZoom?: number);
|
|
50
|
+
/**
|
|
51
|
+
* Initializes a switch to the supplied tile cache.
|
|
52
|
+
* The current cache is switched for the supplied one once the supplied cache is done loading.
|
|
53
|
+
* Loading of new tiles for the current cache is suspended in the meantime.
|
|
54
|
+
* If a switch to another new cache was already taking place, then that new cache gets deleted.
|
|
55
|
+
*
|
|
56
|
+
* When you pass a cache to this function, you must not use that object directly anymore,
|
|
57
|
+
* as it will now be managed and later disposed of by this class.
|
|
58
|
+
*
|
|
59
|
+
* You may not pass the same instance of a tle cache to this function multiple times.
|
|
60
|
+
*/
|
|
61
|
+
setCache(cache: Cache<TTile>): void;
|
|
62
|
+
/**
|
|
63
|
+
* Updates the caches with the map's current view and zoom.
|
|
64
|
+
* Call every time the map moves.
|
|
65
|
+
*/
|
|
66
|
+
update(map: LeafletGlMap): void;
|
|
67
|
+
/**
|
|
68
|
+
* Returns an ordered array of tile coords that should be rendered to optimally cover the current map view.
|
|
69
|
+
* May return tiles of different zoom level than what is optimal, depending on
|
|
70
|
+
* what tiles are currently available and on the cache settings.
|
|
71
|
+
* Is not affected by `keepBuffer`.
|
|
72
|
+
*/
|
|
73
|
+
getRenderableCoords(): Coords[];
|
|
74
|
+
/**
|
|
75
|
+
* Returns the data in the current cache associated with the given tile.
|
|
76
|
+
* May return `null` both when the tile load failed and when the tile is not present at all.
|
|
77
|
+
* Distinguish between these two cases using {@link hasTile}.
|
|
78
|
+
*/
|
|
79
|
+
getTile(coords: Coords): TTile | null;
|
|
80
|
+
/**
|
|
81
|
+
* Returns whether the current cache has loaded the given tile.
|
|
82
|
+
*/
|
|
83
|
+
hasTile(coords: Coords): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Asynchronously returns a tile once it is loaded.
|
|
86
|
+
* However the loading of this tile can only be triggered by the user moving the map
|
|
87
|
+
* and the tile becoming visible in the map view.
|
|
88
|
+
* Always returns tiles from the latest cache available at the time of calling this function:
|
|
89
|
+
* returns tiles from the next cache, if any is present, otherwise returns tiles from the current cache.
|
|
90
|
+
*
|
|
91
|
+
* You can optionally supply an abort signal. Signalling it will cancel the tile request
|
|
92
|
+
* and remove it from the internal queues.
|
|
93
|
+
*/
|
|
94
|
+
awaitTile(coords: Coords, abort?: AbortSignal): Promise<any>;
|
|
95
|
+
/**
|
|
96
|
+
* Deletes all resources associated with this {@link SwitchableTileCache}, including its internal caches.
|
|
97
|
+
*/
|
|
98
|
+
dispose(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Updates one of the internal tile caches with up-to-date map bounds and zoom.
|
|
101
|
+
*/
|
|
102
|
+
private _updateInternal;
|
|
103
|
+
}
|
|
104
|
+
export {};
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { Renderer } from '@windy/Renderer';
|
|
2
|
-
import type { FullRenderParameters } from '@windy/interfaces';
|
|
2
|
+
import type { FullRenderParameters, WeatherParameters } from '@windy/interfaces';
|
|
3
3
|
import type { RendererInitParams, Renderers } from '@windy/Renderer';
|
|
4
|
+
import type { Layers } from '@windy/Layer';
|
|
5
|
+
import type { Timestamp } from '@windy/types';
|
|
4
6
|
export declare class TileLayer extends Renderer {
|
|
7
|
+
private readonly _layerId;
|
|
8
|
+
private _lastUsedMapParams;
|
|
9
|
+
private _initializeCallbackSet;
|
|
5
10
|
constructor(params: RendererInitParams);
|
|
6
|
-
onopen(params
|
|
11
|
+
onopen(params: FullRenderParameters): void;
|
|
7
12
|
close(rqrdRenderers: Renderers[]): void;
|
|
13
|
+
redraw(): void;
|
|
14
|
+
paramsChanged(layerIdent: Layers, weatherParams: WeatherParameters, timestamp: Timestamp): Promise<void>;
|
|
15
|
+
private _ensureMapAndSetParams;
|
|
16
|
+
private _initialize;
|
|
8
17
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { MapLibreMap } from '@leafletGl';
|
|
2
|
+
import { EventManager } from '@windy/EventManager';
|
|
3
|
+
import type { CustomLayerInterface, CustomRenderMethodInput } from '@leafletGl';
|
|
4
|
+
import type { FullRenderParameters } from '@windy/interfaces';
|
|
5
|
+
/**
|
|
6
|
+
* This is the "main" layer class for rendering forecast layers.
|
|
7
|
+
* It implement's MapLibre's custom layer interface (`onAdd`, `onRemove` and `render`)
|
|
8
|
+
* and several helper methods for handling render params change and layer enable/disable.
|
|
9
|
+
*/
|
|
10
|
+
export declare class TileLayerCustom implements CustomLayerInterface {
|
|
11
|
+
private _renderer;
|
|
12
|
+
private _enabled;
|
|
13
|
+
private _hasSea;
|
|
14
|
+
private _landOnly;
|
|
15
|
+
private _latestParams;
|
|
16
|
+
private _switchableCache;
|
|
17
|
+
private _paramsChangeId;
|
|
18
|
+
readonly eventManager: EventManager;
|
|
19
|
+
readonly type: "custom";
|
|
20
|
+
id: string;
|
|
21
|
+
constructor(layerId: string, params: FullRenderParameters);
|
|
22
|
+
get switchableCache(): any;
|
|
23
|
+
render(gl: WebGLRenderingContext | WebGL2RenderingContext, _options: CustomRenderMethodInput): void;
|
|
24
|
+
onAdd(_maplibreMap: MapLibreMap, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
25
|
+
/**
|
|
26
|
+
* @summary Hides/shows the layer
|
|
27
|
+
* - useful for example in case when we cycle between various TileLayer renderers
|
|
28
|
+
* - for the old one (e.g. accumulation) we need to hide the layer and for the new one (e.g. tileLayer) we need to show it
|
|
29
|
+
*/
|
|
30
|
+
enableDisableLayer(enable: boolean): void;
|
|
31
|
+
paramsChanged(newParams: FullRenderParameters, layerReopen?: boolean): void;
|
|
32
|
+
onRemove(_maplibreMap: MapLibreMap, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
33
|
+
private _init;
|
|
34
|
+
private _onUpdate;
|
|
35
|
+
/**
|
|
36
|
+
* Sets land or sea mask visibility.
|
|
37
|
+
* Called when {@link _switchableCache} switches to a new set of tiles
|
|
38
|
+
* or when {@link _switchableCache} is first created.
|
|
39
|
+
*/
|
|
40
|
+
private _updateLandSeaMask;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a tile cache from the current {@link _latestParams}
|
|
43
|
+
* and passes this cache to {@link _switchableCache}.
|
|
44
|
+
*
|
|
45
|
+
* If no instance of {@link _switchableCache} exists, it is created.
|
|
46
|
+
* and {@link _updateLandSeaMask} is called.
|
|
47
|
+
*
|
|
48
|
+
* Call when {@link _latestParams} changes.
|
|
49
|
+
*/
|
|
50
|
+
private _updateCache;
|
|
51
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { TileLayer, type TileLayerOptions } from '@leafletGl';
|
|
2
|
+
/**
|
|
3
|
+
* Rectangle coords at a specific zoom level; left and top are inclusive, right and bottom tiles excluded.
|
|
4
|
+
* `[ left, top, right, bottom, zoom ]`
|
|
5
|
+
*/
|
|
6
|
+
export type TileDefPatch = [number, number, number, number, number];
|
|
7
|
+
export type TileDef = {
|
|
8
|
+
/**
|
|
9
|
+
* The main tile url.
|
|
10
|
+
*/
|
|
11
|
+
url: string;
|
|
12
|
+
subdomains?: string | string[];
|
|
13
|
+
/**
|
|
14
|
+
* Tile URL for the patch region, if any is present.
|
|
15
|
+
*/
|
|
16
|
+
patchUrl?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Rectangle coords at a specific zoom level; left and top are inclusive, right and bottom tiles excluded.
|
|
19
|
+
* `[ left, top, right, bottom, zoom ]`
|
|
20
|
+
*/
|
|
21
|
+
patch?: TileDefPatch;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @class Wrapper class over LeafletGl's TileLayer used for loading data from various sources based on zoom.
|
|
25
|
+
* These sources are defined in the {@link tileDefs} object.
|
|
26
|
+
* Can optionally apply a "patch", a rectangular region which loads different tiles that the rest of the map.
|
|
27
|
+
*/
|
|
28
|
+
export declare class TileLayerMulti extends TileLayer {
|
|
29
|
+
/**
|
|
30
|
+
* Map of zoom level -> tile def.
|
|
31
|
+
* Each tiledef contains:
|
|
32
|
+
* - tile url
|
|
33
|
+
* - patch region precomputed for the current zoom level (if a patch is present)
|
|
34
|
+
* - patch tile url
|
|
35
|
+
*/
|
|
36
|
+
private _preparedTileDefs;
|
|
37
|
+
/**
|
|
38
|
+
* Maps tile coords X/Y/Z to the index of the corresponding string segment when the tile url is split with `/`.
|
|
39
|
+
*/
|
|
40
|
+
private _urlMapping;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a TileLayerMulti object.
|
|
43
|
+
* Each tile source url is defined by its url, its upper bound zoom level and an optional patch.
|
|
44
|
+
* @param tileDefs - An object where a TileDef with a given numeric key is applied to all zoom levels
|
|
45
|
+
* lower than and including its key and that are not yet covered by a different TileDef with a lower numeric key.
|
|
46
|
+
* @param options - Standard TileLayer options. Optional.
|
|
47
|
+
*/
|
|
48
|
+
constructor(tileDefs: Record<number, TileDef>, options?: TileLayerOptions);
|
|
49
|
+
/**
|
|
50
|
+
* @summary Handler for constructing the correct tile url based on the zoom
|
|
51
|
+
*/
|
|
52
|
+
private _modifyTileRequest;
|
|
53
|
+
}
|