@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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* # @windy/startup
|
|
4
|
+
*
|
|
5
|
+
* Controls display of startup elements
|
|
6
|
+
*
|
|
7
|
+
* @module startup
|
|
8
|
+
*/
|
|
9
|
+
import type { GeolocationInfo, HomeLocation } from './d.ts.files/interfaces.d';
|
|
10
|
+
/**
|
|
11
|
+
* Capture an event so that the HP window is cleverly hidden, but
|
|
12
|
+
* at the same time trigger a user action (e.g. opening a menu, etc.)
|
|
13
|
+
*/
|
|
14
|
+
export declare function addDefaultListeners(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Show the weather box on HP
|
|
17
|
+
*
|
|
18
|
+
* Priority of display on HP is like this:
|
|
19
|
+
*
|
|
20
|
+
* 1. HP weather - always displayed (contains embedded CAP alerts)
|
|
21
|
+
*
|
|
22
|
+
* 2. If applicable fires whats-new or display app is obsolete
|
|
23
|
+
*
|
|
24
|
+
* 3. Live alerts - displayed if there are any for users location
|
|
25
|
+
*
|
|
26
|
+
* 4. Published article
|
|
27
|
+
*
|
|
28
|
+
* 5. Our custom promos
|
|
29
|
+
*
|
|
30
|
+
* 6. Pin to homepage - always displayed only if user has any pinned favorites
|
|
31
|
+
*
|
|
32
|
+
* @param coords At which location show the HP
|
|
33
|
+
*/
|
|
34
|
+
export declare function showStartupElements(coords: HomeLocation | GeolocationInfo): Promise<void>;
|
|
35
|
+
export declare const searchBetterLocation: (this: unknown, ...args: [] & unknown[]) => void;
|
|
36
|
+
export declare const closeAllStartupPlugins: (includingPermanentElements?: boolean) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Hides, the weather DIV
|
|
39
|
+
*
|
|
40
|
+
* @param ev Event that initiated hiding
|
|
41
|
+
*/
|
|
42
|
+
export declare function hideStartupElements(ev?: MouseEvent | KeyboardEvent | TouchEvent): void;
|
|
43
|
+
/**
|
|
44
|
+
* Click on title or home button
|
|
45
|
+
*/
|
|
46
|
+
export declare function back2home(): Promise<void>;
|
|
47
|
+
export declare const shouldHideStartupElements: () => boolean;
|
|
48
|
+
export declare const unsetShouldBeHidden: () => boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HttpPayload } from '@windy/http.d';
|
|
2
|
+
import type { WhatsNewObsolete, WhatsNewData } from '@windy/startup.d';
|
|
3
|
+
import type { LiveAlertEvent } from '@plugins/startup-live-alerts/startup-live-alerts.d';
|
|
4
|
+
import type { GeolocationInfo, HomeLocation } from '@windy/interfaces';
|
|
5
|
+
/**
|
|
6
|
+
* Opens whatsNew plugin, displays app is obsolete message or does nothing
|
|
7
|
+
*
|
|
8
|
+
* @returns true if whatsNew or app is obsolete was opened
|
|
9
|
+
*/
|
|
10
|
+
export declare const openWhatsNewOrObsoleteApp: (whatsNewPromise: Promise<HttpPayload<WhatsNewData | WhatsNewObsolete>>) => Promise<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* Determines if article should be displayed or not
|
|
13
|
+
*/
|
|
14
|
+
export declare const loadAndOpenArticle: (coords: HomeLocation | GeolocationInfo) => Promise<boolean>;
|
|
15
|
+
export declare const openLiveAlert: (coords: HomeLocation | GeolocationInfo, liveAlertsPromise: Promise<HttpPayload<{
|
|
16
|
+
alerts: LiveAlertEvent[];
|
|
17
|
+
}>>) => Promise<boolean>;
|
|
18
|
+
export declare const openPin2Hp: () => Promise<void>;
|
|
19
|
+
export declare const loadPatch: () => Promise<void>;
|
|
@@ -1,22 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { SubscriptionInfo } from '@plugins/_shared/subscription-services/subscription-services.d';
|
|
1
|
+
import type { SubscriptionInfo } from '@plugins/shared/subscription-services/subscription-services.d';
|
|
3
2
|
export type SubscriptionIssue = {
|
|
4
3
|
type: 'graced' | 'paused' | 'onhold';
|
|
5
4
|
} | {
|
|
6
5
|
type: 'expiring';
|
|
7
6
|
expiresInHours: number;
|
|
8
7
|
};
|
|
9
|
-
/**
|
|
10
|
-
* Get the current tier of the user.
|
|
11
|
-
*
|
|
12
|
-
* @returns "premium" for premium user, null otherwise
|
|
13
|
-
*/
|
|
14
|
-
export declare const getTier: () => SubTier;
|
|
15
|
-
/**
|
|
16
|
-
* When any user changes his/her premium status (redeem, restore, ...), we need to refresh token2 to
|
|
17
|
-
* reflect premium status for our backends
|
|
18
|
-
*/
|
|
19
|
-
declare const reloadUserToken: () => void;
|
|
20
8
|
/**
|
|
21
9
|
* Clear pending subscription (i.e. unclaimed, not-redeemed subscription) from store.
|
|
22
10
|
*/
|
|
@@ -27,21 +15,11 @@ export declare const clearPendingSubscription: () => void;
|
|
|
27
15
|
* @param {string} redeemCode Code to store
|
|
28
16
|
*/
|
|
29
17
|
export declare const setPendingSubscription: (redeemCode: string) => void;
|
|
30
|
-
|
|
31
|
-
* Disable all premium features for the user. It does not deactivate subscription, it is just client GUI reset.
|
|
32
|
-
*/
|
|
33
|
-
export declare const deactivateAllFeatures: () => void;
|
|
18
|
+
export declare const setSubsBodyClass: (tier: 'premium') => void;
|
|
34
19
|
/**
|
|
35
20
|
* Set a tier for the user. It also clears pending and failed subscriptions if tier is passed.
|
|
36
|
-
*
|
|
37
|
-
* @param value Tier to set for the user, "null" for the subscription deactivation
|
|
38
|
-
* @param options Optionally `reloadUserToken: true` if client should reload JWT token after setting the tier
|
|
39
|
-
* @returns Same value which has been set
|
|
40
21
|
*/
|
|
41
|
-
export declare const setTier: (
|
|
42
|
-
reloadUserToken?: boolean;
|
|
43
|
-
subscriptionInfo?: SubscriptionInfo;
|
|
44
|
-
}) => SubTier;
|
|
22
|
+
export declare const setTier: (subscriptionInfo: SubscriptionInfo | null) => void;
|
|
45
23
|
/**
|
|
46
24
|
* Returns boolean value if user has any valid premium subscription.
|
|
47
25
|
*
|
|
@@ -63,4 +41,3 @@ export declare const checkPendingSubscription: () => void;
|
|
|
63
41
|
*/
|
|
64
42
|
export declare const getBaitTitle: (issue: SubscriptionIssue | null) => string;
|
|
65
43
|
export declare const checkAndRenderSubsIssue: () => void;
|
|
66
|
-
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { LeafletGlMap } from '@leafletGl';
|
|
2
|
+
export declare class Throttler {
|
|
3
|
+
private _workItemEnergyAvailable;
|
|
4
|
+
private _workItems;
|
|
5
|
+
private _map;
|
|
6
|
+
private _interval;
|
|
7
|
+
private _lastFrameTime;
|
|
8
|
+
private _maxRefreshMs;
|
|
9
|
+
/**
|
|
10
|
+
* How much energy is accumulated per frame.
|
|
11
|
+
* This number can also be decimal.
|
|
12
|
+
* A work item consumes 1 energy by default.
|
|
13
|
+
*/
|
|
14
|
+
energyPerFrame: number;
|
|
15
|
+
maxAccumulatedEnergy: number;
|
|
16
|
+
constructor(map: LeafletGlMap);
|
|
17
|
+
/**
|
|
18
|
+
* Await this function inside an asynchronous work item that might trigger a long-running task.
|
|
19
|
+
* Returns a promise that resolves once this work item is scheduled to run.
|
|
20
|
+
* This call ensures that only a certain number of items are permitted to run within a given frame.
|
|
21
|
+
*
|
|
22
|
+
* You may optionally pass an abort signal. If the item is aborted, the promise is resolved in the next update.
|
|
23
|
+
* Distinguishing between regular promise resolve and an abort is the caller's responsibility!
|
|
24
|
+
*
|
|
25
|
+
* You may optionally specify a priority for this work item. Default is 0, higher values are scheduled with higher priority.
|
|
26
|
+
*
|
|
27
|
+
* You may optionally specify a weight multiplier for this work item. Default is 1. More work items with lower weights may be executed in a single frame.
|
|
28
|
+
*/
|
|
29
|
+
awaitThrottled(abort?: AbortSignal, priority?: number, weight?: number): Promise<void>;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
private _onNewFrame;
|
|
32
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type TileHeader } from '@windy/TileLayerUtils';
|
|
2
|
+
import { type CacheAllocationToken, type Coords } from '@leafletGl';
|
|
3
|
+
import { GlTexture } from '@windy/glUtils';
|
|
4
|
+
import { type CachedTile } from '@windy/tileLayerSource';
|
|
5
|
+
import type { Cache } from '@windy/SwitchableTileCache';
|
|
6
|
+
import type { FullRenderParameters } from '@windy/interfaces';
|
|
7
|
+
export type ReadyTile = {
|
|
8
|
+
valid: true;
|
|
9
|
+
tex: GlTexture;
|
|
10
|
+
coords: Coords;
|
|
11
|
+
header: TileHeader;
|
|
12
|
+
_token: CacheAllocationToken<CachedTile>;
|
|
13
|
+
} | {
|
|
14
|
+
valid: false;
|
|
15
|
+
_token: CacheAllocationToken<CachedTile>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Helper functions that creates a (Tile)Cache instance for use in Windy's TileLayer.
|
|
19
|
+
* The cache is configured to use {@link tileLayerSource} to fetch tiles and headers
|
|
20
|
+
* and then preprocess them on the GPU using {@link TileLayerPreprocessorStandalone}
|
|
21
|
+
* configured to the supplied {@link FullRenderParameters}.
|
|
22
|
+
*
|
|
23
|
+
* The returned `Cache` object contains the `TileCache` instance and a `destroy`
|
|
24
|
+
* function for disposing of the {@link TileLayerPreprocessorStandalone}.
|
|
25
|
+
* (But NOT the `TileCache`! It must be destroyed separately.)
|
|
26
|
+
*
|
|
27
|
+
* This function is async, since it must wait for the {@link TileLayerPreprocessorStandalone} to initialize.
|
|
28
|
+
*
|
|
29
|
+
* @param params - Full render parameters for the desired layer.
|
|
30
|
+
*/
|
|
31
|
+
export declare function makeTileLayerCache(params: FullRenderParameters): Promise<Cache<ReadyTile>>;
|
|
32
|
+
/**
|
|
33
|
+
* Replaces {z}, {x} and {y} in the URL template with the given tile coords.
|
|
34
|
+
*/
|
|
35
|
+
export declare function applyUrlTemplate(urlTemplate: string, coords: Coords): string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PixelInterpolationFun, CoordsInterpolationFun, InterpolatorPossibleReturns } from '@windy/interpolatorTypes';
|
|
2
|
+
import type { FullRenderParameters } from '@windy/interfaces';
|
|
3
|
+
type TileLayerPickerCallback = (f1: CoordsInterpolationFun, f2: PixelInterpolationFun | (() => null)) => void;
|
|
4
|
+
export declare class TileLayerInterpolator {
|
|
5
|
+
private _debugElement?;
|
|
6
|
+
private _pixelReader;
|
|
7
|
+
private _lastDataZoom;
|
|
8
|
+
private _pendingLoads;
|
|
9
|
+
private _latestParams?;
|
|
10
|
+
private _requestGiveId;
|
|
11
|
+
private _cache;
|
|
12
|
+
private _cachedRequestsByTileUrl;
|
|
13
|
+
constructor();
|
|
14
|
+
paramsChanged(params: FullRenderParameters): void;
|
|
15
|
+
/**
|
|
16
|
+
* Request to build interpolate function for purpose of picker & other stuff
|
|
17
|
+
* and since DataTiler is async, returns this function
|
|
18
|
+
* in a callback
|
|
19
|
+
*/
|
|
20
|
+
createFun(callback: TileLayerPickerCallback): void;
|
|
21
|
+
destroy(): void;
|
|
22
|
+
/**
|
|
23
|
+
* @summary Samples data from map under the given mercator coordinates
|
|
24
|
+
* @param mercatorX Mercator X relative coordinate in range <0.0, 1.0>
|
|
25
|
+
* @param mercatorY Mercator Y relative coordinate in range <0.0, 1.0>
|
|
26
|
+
* @returns Decoded and interpolated value (ready for display)
|
|
27
|
+
*/
|
|
28
|
+
sampleAtMercator(mercatorX: number, mercatorY: number, abort?: AbortController, renderParams?: FullRenderParameters): Promise<InterpolatorPossibleReturns>;
|
|
29
|
+
private _getIntZoom;
|
|
30
|
+
private _onZoomEnd;
|
|
31
|
+
private _keyDeleted;
|
|
32
|
+
private _clearAllWaitingTiles;
|
|
33
|
+
/**
|
|
34
|
+
* @summary Performs the actual read from the tile texture
|
|
35
|
+
* @param tile Tile to sample
|
|
36
|
+
*/
|
|
37
|
+
private _sampleDataFromTile;
|
|
38
|
+
}
|
|
39
|
+
export declare const tileLayerInterpolator: TileLayerInterpolator;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { LeafletGlMap, type CacheAllocationToken } from '@leafletGl';
|
|
2
|
+
import { type TileHeader } from '@windy/TileLayerUtils';
|
|
3
|
+
import { Evented } from '@windy/Evented';
|
|
4
|
+
export type CachedTile = {
|
|
5
|
+
/**
|
|
6
|
+
* When true, the tile has valid data.
|
|
7
|
+
* When false, the loading of the tile has failed.
|
|
8
|
+
*/
|
|
9
|
+
valid: true;
|
|
10
|
+
/**
|
|
11
|
+
* The WebGL texture containing this tile's image, without the header.
|
|
12
|
+
* Default filtering is linear and wrap mode is clamp-to-edge.
|
|
13
|
+
* Tile image size is 257x257.
|
|
14
|
+
*/
|
|
15
|
+
tex: WebGLTexture;
|
|
16
|
+
/**
|
|
17
|
+
* The extracted tile header.
|
|
18
|
+
*/
|
|
19
|
+
header: TileHeader;
|
|
20
|
+
url: string;
|
|
21
|
+
} | {
|
|
22
|
+
valid: false;
|
|
23
|
+
url: string;
|
|
24
|
+
};
|
|
25
|
+
type TileLayerSourceEvents = {
|
|
26
|
+
/**
|
|
27
|
+
* @ignore
|
|
28
|
+
*/
|
|
29
|
+
keydeleted: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* A reference counted cache for loading generic TileLayer tiles.
|
|
33
|
+
* Automatically extracts tile headers and uploads the images into WebGL textures.
|
|
34
|
+
*/
|
|
35
|
+
declare class TileLayerSource extends Evented<TileLayerSourceEvents> {
|
|
36
|
+
private _gl;
|
|
37
|
+
private _cache;
|
|
38
|
+
private _canvas;
|
|
39
|
+
private _ctx;
|
|
40
|
+
private _disposed;
|
|
41
|
+
constructor();
|
|
42
|
+
/**
|
|
43
|
+
* Initializes the tile source with a WebGL context.
|
|
44
|
+
*/
|
|
45
|
+
init(map: LeafletGlMap): void;
|
|
46
|
+
/**
|
|
47
|
+
* Asynchronously gets a tile. The returned token must later be "freed" by passing it to {@link free}.
|
|
48
|
+
* The returned texture is kept in cache for as long as any token referencing it exists.
|
|
49
|
+
* Same semantics as {@link ReferenceCountedCache.retrieve}.
|
|
50
|
+
*/
|
|
51
|
+
get(url: string, abort?: AbortSignal): Promise<CacheAllocationToken<CachedTile>>;
|
|
52
|
+
/**
|
|
53
|
+
* Waits for a tile for a given url to be loaded, but does not trigger the load itself.
|
|
54
|
+
* Loading of the value must be started elsewhere by calling {@link get}.
|
|
55
|
+
* Returned token must later be freed using {@link free}, same as with tokens returned from {@link get}.
|
|
56
|
+
*/
|
|
57
|
+
awaitTile(url: string, abort?: AbortSignal): Promise<CacheAllocationToken<CachedTile>>;
|
|
58
|
+
/**
|
|
59
|
+
* Returns a token and deletes its associated texture if it is no longer needed. Same semantics as {@link ReferenceCountedCache.delete}.
|
|
60
|
+
*/
|
|
61
|
+
free(tile: CacheAllocationToken<CachedTile>): void;
|
|
62
|
+
/**
|
|
63
|
+
* Releases all resources held by this TileLayerSource.
|
|
64
|
+
*/
|
|
65
|
+
dispose(): void;
|
|
66
|
+
private _imageBitmapToUint8Array;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A singleton instance of a {@link TileLayerSource}.
|
|
70
|
+
*/
|
|
71
|
+
export declare const tileLayerSource: TileLayerSource;
|
|
72
|
+
export declare function fetchImageBlob(url: string, signal?: AbortSignal): Promise<Blob | null>;
|
|
73
|
+
export declare function extractTileHeader(imageBitmapWithHeader: ImageBitmap): Promise<ImageAndHeader>;
|
|
74
|
+
export type DecodedTile = {
|
|
75
|
+
image: ImageBitmap | null;
|
|
76
|
+
url: string;
|
|
77
|
+
};
|
|
78
|
+
export type ImageAndHeader = {
|
|
79
|
+
image: ImageBitmap;
|
|
80
|
+
header: TileHeader;
|
|
81
|
+
};
|
|
82
|
+
export type DecodedTileWithHeader = {
|
|
83
|
+
url: string;
|
|
84
|
+
imageAndHeader: ImageAndHeader | null;
|
|
85
|
+
/**
|
|
86
|
+
* @internal
|
|
87
|
+
* Internal, do not use or modify.
|
|
88
|
+
*
|
|
89
|
+
* Tiles with header internally use the headerless cache to fetch the image,
|
|
90
|
+
* and only then they extract the header.
|
|
91
|
+
* This is the allocation token of the unprocessed tile image referenced by this tile.
|
|
92
|
+
*/
|
|
93
|
+
_headerlessToken: CacheAllocationToken<DecodedTile>;
|
|
94
|
+
};
|
|
95
|
+
export type TileToken<T extends DecodedTile | DecodedTileWithHeader> = CacheAllocationToken<T> & {
|
|
96
|
+
_hasHeader: T extends DecodedTileWithHeader ? true : false;
|
|
97
|
+
};
|
|
98
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Top message service that displays messages at the top of the screen
|
|
3
|
+
* Ensures only one top message is displayed at a time
|
|
4
|
+
*/
|
|
5
|
+
import { Window } from '@windy/Window';
|
|
6
|
+
import type { HTMLString } from '@windy/types';
|
|
7
|
+
export interface TopMessageOptions {
|
|
8
|
+
/** Type of the massage */
|
|
9
|
+
type: 'success' | 'error' | 'warning';
|
|
10
|
+
/** HTML content of the message */
|
|
11
|
+
html: HTMLString;
|
|
12
|
+
/** Auto-close timeout in milliseconds */
|
|
13
|
+
timeout?: number;
|
|
14
|
+
/** Called on message click */
|
|
15
|
+
onclick?: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Display a top message. If another message is currently displayed, it will be closed first.
|
|
19
|
+
* @param options Configuration for the top message
|
|
20
|
+
* @returns Promise that resolves when the message is displayed
|
|
21
|
+
*/
|
|
22
|
+
export declare const displayTopMessage: ({ html, timeout, onclick, type, }: TopMessageOptions) => Promise<Window>;
|
package/types/client/user.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare const getAvatar: () => string;
|
|
|
26
26
|
export declare const getEmail: () => string;
|
|
27
27
|
export declare const getUsername: () => string;
|
|
28
28
|
export declare const getUserId: () => number;
|
|
29
|
+
export declare const isLoggedInPromise: () => Promise<boolean>;
|
|
29
30
|
/**
|
|
30
31
|
* Open login plugin so that user can log in
|
|
31
32
|
*/
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export declare const launchConsentWindow: () => void;
|
|
2
1
|
export declare const setExplicitConsent: (analytics: boolean) => void;
|
|
3
|
-
export declare const setImplicitConsent: () => void;
|
|
4
2
|
export declare const checkConsent: (userInfo?: {
|
|
5
3
|
requiresCookieConsent: boolean;
|
|
6
4
|
}) => void;
|
|
@@ -17,10 +17,6 @@ export declare const remove: (id: FavId) => Promise<void>;
|
|
|
17
17
|
* Toggle pinning fav to top or to homepage
|
|
18
18
|
*/
|
|
19
19
|
export declare const togglePin: (id: FavId, whereToPin: 'pin2top' | 'pin2homepage', forcedTimestamp?: Timestamp) => Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Load favs from cloud
|
|
22
|
-
*/
|
|
23
|
-
export declare const loadFromCloud: () => Promise<void>;
|
|
24
20
|
/**
|
|
25
21
|
* Find all favs that match given criteria
|
|
26
22
|
*/
|
|
@@ -53,7 +49,3 @@ export declare const hasKey: (key: FavId) => Promise<boolean>;
|
|
|
53
49
|
* Uses try/catch to handle errors gracefully.
|
|
54
50
|
*/
|
|
55
51
|
export declare const enhanceWithCountryCode: (fav: Fav) => Promise<Fav>;
|
|
56
|
-
/**
|
|
57
|
-
* Removes all favs from the device TODO: Call after logging out
|
|
58
|
-
*/
|
|
59
|
-
export declare const removeAllFavsFromDevice: () => Promise<void>;
|
package/types/client/utils.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import { HttpError } from '@windy/errors';
|
|
2
3
|
import type { RegistrationError } from '@capacitor/push-notifications';
|
|
3
4
|
import type { QueryStringSource } from '@windy/http.d';
|
|
4
5
|
import type { LatLon, LinearScale, TilePoint } from '@windy/interfaces.d';
|
|
5
6
|
import type { RGBNumValues } from '@windy/interpolatorTypes';
|
|
6
|
-
import type { ExtendedStationType, HTMLString, NumOrNull, NumValue, Path, Timestamp, TimeRangeMs, ParsedQueryString, RGBAString, RGBString, ColorGradientString, RGBA } from '@windy/types.d';
|
|
7
|
+
import type { ExtendedStationType, HTMLString, NumOrNull, NumValue, Path, Timestamp, TimeRangeMs, ParsedQueryString, RGBAString, RGBString, ColorGradientString, RGBA, Hours, YearMonthDay } from '@windy/types.d';
|
|
8
|
+
import type { Vector3 } from '@windy/math';
|
|
9
|
+
import type { Readable, Subscriber, Unsubscriber } from 'svelte/store';
|
|
7
10
|
/**
|
|
8
11
|
* One minute duration in ms.
|
|
9
12
|
*/
|
|
@@ -205,14 +208,13 @@ export declare const windDir2html: (wx: WindObject) => HTMLString;
|
|
|
205
208
|
*/
|
|
206
209
|
export declare const isNear: <T extends LatLon, F extends LatLon>(a: T, b: F) => boolean;
|
|
207
210
|
/**
|
|
208
|
-
*
|
|
211
|
+
* Clamps a number to a range
|
|
209
212
|
*
|
|
210
|
-
* @param num Number to
|
|
213
|
+
* @param num Number to clamp
|
|
211
214
|
* @param min Minimum
|
|
212
215
|
* @param max Maximum
|
|
213
|
-
* @returns
|
|
216
|
+
* @returns Clamped number
|
|
214
217
|
*/
|
|
215
|
-
export declare const bound: (num: number, min: number, max: number) => number;
|
|
216
218
|
export declare const clamp: (num: number, min: number, max: number) => number;
|
|
217
219
|
/**
|
|
218
220
|
* Smoothstep https://en.wikipedia.org/wiki/Smoothstep
|
|
@@ -285,7 +287,7 @@ export declare const getAdjustedNow: (syncTime?: number) => number;
|
|
|
285
287
|
* @param lang Language code
|
|
286
288
|
* @returns True if language is supported, false otherwise
|
|
287
289
|
*/
|
|
288
|
-
export declare const isValidLang: (lang: string) => lang is "
|
|
290
|
+
export declare const isValidLang: (lang: string) => lang is "id" | "hr" | "th" | "tr" | "en" | "zh-TW" | "zh" | "ja" | "fr" | "ko" | "it" | "ru" | "nl" | "cs" | "pl" | "sv" | "fi" | "ro" | "el" | "hu" | "ca" | "da" | "ar" | "fa" | "hi" | "ta" | "sk" | "uk" | "bg" | "he" | "is" | "lt" | "et" | "vi" | "sl" | "sr" | "sq" | "pt" | "nb" | "es" | "de" | "bn";
|
|
289
291
|
/**
|
|
290
292
|
* Safely joins server name and path
|
|
291
293
|
*
|
|
@@ -338,7 +340,7 @@ export declare const download: (data: BlobPart, type: string, name: string) => v
|
|
|
338
340
|
* @param ident ID of plugin to load
|
|
339
341
|
* @returns Instance of the Capacitor plugin
|
|
340
342
|
*/
|
|
341
|
-
export declare
|
|
343
|
+
export declare function getNativePlugin<T = unknown>(ident: string): T | null;
|
|
342
344
|
/**
|
|
343
345
|
* JQuery like selector
|
|
344
346
|
*
|
|
@@ -392,6 +394,21 @@ export declare const getRefs: <N extends HTMLElement, R extends Record<string, H
|
|
|
392
394
|
* Sanitizes HTML code, escape all XSS dangerous characters
|
|
393
395
|
*/
|
|
394
396
|
export declare const sanitizeHTML: (s: string) => string;
|
|
397
|
+
export interface LogErrorDetail {
|
|
398
|
+
moduleName: string;
|
|
399
|
+
msg: string;
|
|
400
|
+
errorObject?: Error | HttpError | Event | ErrorEvent | RegistrationError;
|
|
401
|
+
additionalInfo?: {
|
|
402
|
+
/**
|
|
403
|
+
* Any additional data you want to log alongside the error to provide more context
|
|
404
|
+
*/
|
|
405
|
+
extra?: Record<string, unknown>;
|
|
406
|
+
/**
|
|
407
|
+
* Key-value pairs to use as tags in GlitchTip
|
|
408
|
+
*/
|
|
409
|
+
tags?: Record<string, string>;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
395
412
|
/**
|
|
396
413
|
* Custom error logging function.
|
|
397
414
|
*
|
|
@@ -402,7 +419,7 @@ export declare const sanitizeHTML: (s: string) => string;
|
|
|
402
419
|
* @param msg Message to report, the main body of the error
|
|
403
420
|
* @param errObj Whole error object to stringification. It is sent to Kibana under 'error' property
|
|
404
421
|
*/
|
|
405
|
-
export declare function logError(moduleName: string, msg: string, errorObject?: Error | HttpError | Event | ErrorEvent | RegistrationError): void;
|
|
422
|
+
export declare function logError(moduleName: string, msg: string, errorObject?: Error | HttpError | Event | ErrorEvent | RegistrationError, additionalInfo?: LogErrorDetail['additionalInfo']): void;
|
|
406
423
|
/**
|
|
407
424
|
* Same as scale linear from d3 library except with different params
|
|
408
425
|
* https://d3js.org/d3-scale/linear
|
|
@@ -414,8 +431,9 @@ export declare const scaleLinear: ({ domain, range, clip, }: {
|
|
|
414
431
|
range: [number, number];
|
|
415
432
|
clip?: boolean;
|
|
416
433
|
}) => LinearScale;
|
|
434
|
+
export declare const maxCanvasRatio = 2;
|
|
417
435
|
/**
|
|
418
|
-
* Unified canvasRatio used in overall Windy. Not bigger
|
|
436
|
+
* Unified canvasRatio used in overall Windy. Not bigger than maxCanvasRatio
|
|
419
437
|
*/
|
|
420
438
|
export declare const canvasRatio: number;
|
|
421
439
|
/**
|
|
@@ -495,3 +513,37 @@ export declare const getErrorMessage: (error: unknown) => string;
|
|
|
495
513
|
* Creates a color gradient from array of prepared ones
|
|
496
514
|
*/
|
|
497
515
|
export declare const createColorGradient: (gradient: (RGBAString | RGBString)[], numValues: NumValue[]) => ColorGradientString;
|
|
516
|
+
/**
|
|
517
|
+
* preventDefault wrapper for event handlers
|
|
518
|
+
*/
|
|
519
|
+
export declare const preventDefault: <E extends Event = Event>(callback: (event: E) => void) => (event: E) => void;
|
|
520
|
+
export declare const openInApp: () => void;
|
|
521
|
+
/**
|
|
522
|
+
* Given the UTC offset returns local time
|
|
523
|
+
*/
|
|
524
|
+
export declare const toLocalTime: (ts: Timestamp, utcOffset: Hours) => {
|
|
525
|
+
h: Hours;
|
|
526
|
+
m: number;
|
|
527
|
+
day: number;
|
|
528
|
+
weekDay: number;
|
|
529
|
+
yearMonthDay: YearMonthDay;
|
|
530
|
+
};
|
|
531
|
+
/**
|
|
532
|
+
* @summary Extracts positions of the tile coordinates in the per-tile request urls to enabled coordinates extraction
|
|
533
|
+
* which is required to modify the original tile request created by maplibre
|
|
534
|
+
* @param url
|
|
535
|
+
* @returns
|
|
536
|
+
*/
|
|
537
|
+
export declare function extractTileCoordsUrlPositionsFromParametricUrl(url: string): Vector3;
|
|
538
|
+
/**
|
|
539
|
+
* @summary Modifies the input leaflet zoom based on the currently used map library
|
|
540
|
+
* - maplibre zoom is offset by 1 from the leaflet zoom, since Leaflet uses
|
|
541
|
+
* zoom computed wrt 256px tile while maplibre uses 512px tile as base size
|
|
542
|
+
* @param leafletZoom Leaflet-based zoom level
|
|
543
|
+
*/
|
|
544
|
+
export declare const offsetLeafletZoom: (leafletZoom: number) => number;
|
|
545
|
+
/**
|
|
546
|
+
* Used for Svelte stores
|
|
547
|
+
* Sometimes we only want to subscribe to changes in store and don't want to be called with initial value
|
|
548
|
+
*/
|
|
549
|
+
export declare const subscribeToChange: <T>(store: Readable<T>, callback: Subscriber<T>) => Unsubscriber;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/iconfont.d.ts
CHANGED
|
@@ -189,11 +189,8 @@ export type Iconfont =
|
|
|
189
189
|
| '<!-- @echo icon-bell-plus -->'
|
|
190
190
|
| '<!-- @echo icon-x -->'
|
|
191
191
|
| '<!-- @echo icon-twitter -->'
|
|
192
|
-
| '<!-- @echo icon-
|
|
193
|
-
| '<!-- @echo icon-
|
|
194
|
-
| '<!-- @echo icon-fire-wind -->'
|
|
195
|
-
| '<!-- @echo icon-crosshair -->'
|
|
196
|
-
| '<!-- @echo icon-pushpin -->'
|
|
192
|
+
| '<!-- @echo icon-bug -->'
|
|
193
|
+
| '<!-- @echo icon-hammer -->'
|
|
197
194
|
| '<!-- @echo icon-github -->'
|
|
198
195
|
| '<!-- @echo icon-link -->'
|
|
199
196
|
| '<!-- @echo icon-plane-snowflake -->'
|