@windycom/plugin-devtools 3.0.1 → 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.
Files changed (149) hide show
  1. package/README.md +1 -0
  2. package/package.json +1 -1
  3. package/types/client/Calendar.d.ts +104 -70
  4. package/types/client/Color.d.ts +25 -5
  5. package/types/client/DataTiler.d.ts +2 -2
  6. package/types/client/EcmwfProduct.d.ts +22 -0
  7. package/types/client/EventManager.d.ts +69 -0
  8. package/types/client/ExternalSveltePlugin.d.ts +4 -3
  9. package/types/client/GlBuffer.d.ts +45 -0
  10. package/types/client/GlMesh.d.ts +147 -0
  11. package/types/client/GlProgram.d.ts +41 -0
  12. package/types/client/GlRenderer.d.ts +95 -0
  13. package/types/client/GlTexture.d.ts +98 -0
  14. package/types/client/GlVertexArray.d.ts +38 -0
  15. package/types/client/IDB.d.ts +25 -4
  16. package/types/client/LabelsLayer.d.ts +69 -2
  17. package/types/client/Layer.d.ts +96 -26
  18. package/types/client/LayerClasses.d.ts +5 -0
  19. package/types/client/Metric.d.ts +31 -46
  20. package/types/client/MetricClasses.d.ts +1 -1
  21. package/types/client/Overlay.d.ts +5 -12
  22. package/types/client/OverlayClasses.d.ts +8 -0
  23. package/types/client/Particles.d.ts +1 -1
  24. package/types/client/Product.d.ts +38 -67
  25. package/types/client/ProductClasses.d.ts +51 -0
  26. package/types/client/RadarPlusProduct.d.ts +1 -1
  27. package/types/client/Renderer.d.ts +44 -19
  28. package/types/client/SatelliteProduct.d.ts +1 -1
  29. package/types/client/ShaderStorage.d.ts +25 -0
  30. package/types/client/StartupElementPlugin.d.ts +8 -0
  31. package/types/client/SveltePlugin.d.ts +5 -5
  32. package/types/client/SwitchableTileCache.d.ts +104 -0
  33. package/types/client/TileLayer.d.ts +12 -3
  34. package/types/client/TileLayerCustom.d.ts +51 -0
  35. package/types/client/TileLayerMulti.d.ts +53 -0
  36. package/types/client/TileLayerPreprocessorStandalone.d.ts +45 -0
  37. package/types/client/TileLayerRenderer.d.ts +24 -0
  38. package/types/client/TileLayerUtils.d.ts +43 -0
  39. package/types/client/TilePreprocessor.d.ts +27 -0
  40. package/types/client/TopoMap.d.ts +4 -4
  41. package/types/client/WindowPlugin.d.ts +7 -6
  42. package/types/client/appsFlyer.d.ts +2 -1
  43. package/types/client/baseMap.d.ts +12 -2
  44. package/types/client/broadcast.d.ts +1 -1
  45. package/types/client/cityLabels.d.ts +2 -3
  46. package/types/client/colorGradients.d.ts +4 -10
  47. package/types/client/colors.d.ts +1 -2
  48. package/types/client/css.test.d.ts +1 -0
  49. package/types/client/customProtocol.d.ts +11 -0
  50. package/types/client/d.ts.files/GlObj.d.ts +1 -5
  51. package/types/client/d.ts.files/Metric.d.ts +23 -2
  52. package/types/client/d.ts.files/alerts.d.ts +1 -0
  53. package/types/client/d.ts.files/broadcast.d.ts +31 -35
  54. package/types/client/d.ts.files/dataSpecifications.d.ts +82 -66
  55. package/types/client/d.ts.files/favs.d.ts +7 -18
  56. package/types/client/d.ts.files/glUtils.d.ts +71 -0
  57. package/types/client/d.ts.files/http.d.ts +4 -4
  58. package/types/client/d.ts.files/interpolatorTypes.d.ts +5 -5
  59. package/types/client/d.ts.files/lib.d.ts +1 -2
  60. package/types/client/d.ts.files/liveAlerts.d.ts +52 -0
  61. package/types/client/d.ts.files/mapUtils.d.ts +25 -0
  62. package/types/client/d.ts.files/outgoingMessages.d.ts +1 -1
  63. package/types/client/d.ts.files/plugin-params.d.ts +46 -24
  64. package/types/client/d.ts.files/plugins.d.ts +44 -31
  65. package/types/client/d.ts.files/rootScope.d.ts +2 -0
  66. package/types/client/d.ts.files/singleclick.d.ts +4 -2
  67. package/types/client/d.ts.files/startup.d.ts +7 -52
  68. package/types/client/d.ts.files/storage.d.ts +0 -11
  69. package/types/client/d.ts.files/user.d.ts +6 -1
  70. package/types/client/d.ts.files/webcams.d.ts +9 -2
  71. package/types/client/dataLoader.d.ts +2 -2
  72. package/types/client/detectDevice.d.ts +3 -0
  73. package/types/client/embed.d.ts +2 -7
  74. package/types/client/errorLogger.d.ts +20 -1
  75. package/types/client/externalPlugins.d.ts +5 -1
  76. package/types/client/fetch.d.ts +62 -5
  77. package/types/client/format.d.ts +12 -0
  78. package/types/client/glContextUtils.d.ts +9 -0
  79. package/types/client/glStatus.d.ts +7 -0
  80. package/types/client/glTileRender.d.ts +1 -7
  81. package/types/client/glUtils.d.ts +119 -0
  82. package/types/client/http.d.ts +0 -6
  83. package/types/client/idbConnection.d.ts +13 -0
  84. package/types/client/idbInstances.d.ts +118 -13
  85. package/types/client/landLayer.d.ts +3 -0
  86. package/types/client/layers.d.ts +5 -2
  87. package/types/client/legends.d.ts +1 -1
  88. package/types/client/lib.d.ts +11 -21
  89. package/types/client/liveAlerts.d.ts +2 -2
  90. package/types/client/location.d.ts +1 -1
  91. package/types/client/map.d.ts +94 -15
  92. package/types/client/mapUtils.d.ts +66 -0
  93. package/types/client/math.d.ts +14 -0
  94. package/types/client/mobile.d.ts +16 -41
  95. package/types/client/mobileUtils.d.ts +10 -0
  96. package/types/client/models.d.ts +2 -6
  97. package/types/client/overlays.d.ts +4 -3
  98. package/types/client/particleRenderers.d.ts +1 -1
  99. package/types/client/picker.d.ts +4 -8
  100. package/types/client/plugins.d.ts +0 -4
  101. package/types/client/products.d.ts +53 -2
  102. package/types/client/promo.d.ts +28 -5
  103. package/types/client/pushNotifications.d.ts +19 -1
  104. package/types/client/renderCtrl.d.ts +1 -1
  105. package/types/client/renderTile.d.ts +2 -2
  106. package/types/client/renderUtils.d.ts +21 -27
  107. package/types/client/renderers.d.ts +6 -9
  108. package/types/client/reverseName.d.ts +2 -1
  109. package/types/client/rhMessage.d.ts +1 -1
  110. package/types/client/rootScope.d.ts +17 -9
  111. package/types/client/router.d.ts +41 -9
  112. package/types/client/seoParser.d.ts +35 -0
  113. package/types/client/showableErrorsService.d.ts +10 -6
  114. package/types/client/singleclick.d.ts +1 -1
  115. package/types/client/startup.d.ts +48 -0
  116. package/types/client/startupUtils.d.ts +19 -0
  117. package/types/client/store.d.ts +20 -52
  118. package/types/client/subscription.d.ts +3 -26
  119. package/types/client/throttler.d.ts +32 -0
  120. package/types/client/tileHelpers.d.ts +35 -0
  121. package/types/client/tileInterpolator.d.ts +1 -1
  122. package/types/client/tileLayerInterpolator.d.ts +40 -0
  123. package/types/client/tileLayerSource.d.ts +98 -0
  124. package/types/client/timestampUtils.test.d.ts +1 -0
  125. package/types/client/topMessage.d.ts +22 -0
  126. package/types/client/user.d.ts +1 -0
  127. package/types/client/userAlerts.d.ts +0 -4
  128. package/types/client/userConsent.d.ts +0 -2
  129. package/types/client/userFavs.d.ts +17 -12
  130. package/types/client/utils.d.ts +78 -25
  131. package/types/client/utils.test.d.ts +1 -0
  132. package/types/iconfont.d.ts +2 -5
  133. package/types/interfaces.d.ts +290 -88
  134. package/types/lang-files.d.ts +578 -98
  135. package/types/leaflet-gl.d.ts +12773 -0
  136. package/types/types.d.ts +323 -11
  137. package/types/client/d.ts.files/Calendar.d.ts +0 -96
  138. package/types/client/d.ts.files/CanvasLayer.d.ts +0 -70
  139. package/types/client/d.ts.files/Color.d.ts +0 -94
  140. package/types/client/d.ts.files/DataTiler.d.ts +0 -45
  141. package/types/client/d.ts.files/LandMask.d.ts +0 -17
  142. package/types/client/d.ts.files/Layer.d.ts +0 -191
  143. package/types/client/d.ts.files/PoisOverlay.d.ts +0 -27
  144. package/types/client/d.ts.files/Renderer.d.ts +0 -44
  145. package/types/client/d.ts.files/TileLayerCanvas.d.ts +0 -78
  146. package/types/client/d.ts.files/TileLayerMultiPatch.d.ts +0 -13
  147. package/types/client/d.ts.files/products.d.ts +0 -60
  148. package/types/client/imaker.d.ts +0 -112
  149. package/types/offline.d.ts +0 -100
@@ -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;
@@ -12,7 +12,7 @@ import { DataTiler } from '@windy/DataTiler';
12
12
  import type { PixelInterpolationFun, CoordsInterpolationFun } from '@windy/interpolatorTypes';
13
13
  import type { DataTile } from './dataLoader';
14
14
  import type { ExtendedTileParams } from '@windy/DataTiler.d';
15
- import type { FullRenderParameters } from '@windy/Layer.d';
15
+ import type { FullRenderParameters } from '@windy/interfaces';
16
16
  export declare class TileInterpolator extends DataTiler {
17
17
  cb<T extends true | false>(f1: CoordsInterpolationFun, // async interpolator does not use fakeFun with null return type
18
18
  f2: PixelInterpolationFun | (() => null), isAsync?: T & (true | false)): void;
@@ -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>;
@@ -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,5 +1,4 @@
1
1
  import type { AlertRequest, AlertResponse, AlertCheckResponse } from '@windy/alerts.d';
2
- import type { Fav } from '@windy/favs.d';
3
2
  import type { LatLon } from '@windy/interfaces';
4
3
  export declare enum AlertStatus {
5
4
  Triggered = "triggered",
@@ -52,9 +51,6 @@ export declare enum CloudCoverage {
52
51
  Overcast = "OVC"
53
52
  }
54
53
  export declare function getAlertTimestamps(alertId: string): Promise<AlertCheckResponse>;
55
- export declare function getAlertV3(alertId: string): Promise<Fav & {
56
- type: 'alert';
57
- }>;
58
54
  export declare function getAlerts(): Promise<AlertResponse[]>;
59
55
  export declare function getAlert(alertId: string): Promise<AlertResponse | null>;
60
56
  export declare function createAlert(data: AlertRequest): Promise<void>;
@@ -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;
@@ -1,29 +1,30 @@
1
- import type { Fav, FavId } from '@windy/favs';
1
+ import type { FavFragment, Fav, FavId } from '@windy/favs.d';
2
+ import type { Timestamp } from '@windy/types.d';
2
3
  export declare const emitChange: () => void;
3
4
  /**
4
5
  * Adds a fav to the db
5
6
  */
6
- export declare const add: () => Promise<FavId | null>;
7
+ export declare const add: (item: FavFragment) => Promise<FavId | null>;
7
8
  /**
8
9
  * Update Fav in the db
9
10
  */
10
- export declare const update: () => Promise<FavId | null>;
11
+ export declare const update: (id: FavId, properties2update: Partial<Fav>) => Promise<FavId | null>;
11
12
  /**
12
13
  * Remove fav from db
13
14
  */
14
- export declare const remove: () => Promise<void>;
15
+ export declare const remove: (id: FavId) => Promise<void>;
15
16
  /**
16
17
  * Toggle pinning fav to top or to homepage
17
18
  */
18
- export declare const togglePin: () => Promise<void>;
19
+ export declare const togglePin: (id: FavId, whereToPin: 'pin2top' | 'pin2homepage', forcedTimestamp?: Timestamp) => Promise<void>;
19
20
  /**
20
21
  * Find all favs that match given criteria
21
22
  */
22
- export declare const find: () => Promise<Fav[]>;
23
+ export declare const find: (query: Partial<Fav> | ((f: Fav) => boolean)) => Promise<Fav[]>;
23
24
  /**
24
25
  * Same as find but always returns only the first match
25
26
  */
26
- export declare const findOne: () => Promise<Fav | undefined>;
27
+ export declare const findOne: (query: Partial<Fav> | ((f: Fav) => boolean)) => Promise<Fav | undefined>;
27
28
  /**
28
29
  * Returns all favs as array
29
30
  */
@@ -31,16 +32,20 @@ export declare const getAll: () => Promise<Fav[]>;
31
32
  /**
32
33
  * Quick check if fav with given ids exists
33
34
  */
34
- export declare const isFav: () => Promise<boolean>;
35
+ export declare const isFav: (query: Partial<FavFragment>) => Promise<boolean>;
35
36
  /**
36
37
  * Toggles fav (adds or removes) from db
37
38
  */
38
- export declare const toggle: () => Promise<boolean>;
39
+ export declare const toggle: (query: Partial<FavFragment>, item: FavFragment) => Promise<boolean>;
39
40
  /**
40
41
  * Checks if fav exists
41
42
  */
42
- export declare const hasKey: () => Promise<boolean>;
43
+ export declare const hasKey: (key: FavId) => Promise<boolean>;
43
44
  /**
44
- * Removes all favs from the device TODO: Call after logging out
45
+ * Since favs does not contain cc (country code) this enhances the fav with cc
46
+ * so we could make better use of it in the GUI (search, fav list).
47
+ *
48
+ * Once, the fav is enhanced with cc, it will be stored and synced with cloud.
49
+ * Uses try/catch to handle errors gracefully.
45
50
  */
46
- export declare const removeAllFavsFromDevice: () => Promise<void>;
51
+ export declare const enhanceWithCountryCode: (fav: Fav) => Promise<Fav>;
@@ -1,32 +1,28 @@
1
- import { HttpError } from './errors';
1
+ /// <reference types="svelte" />
2
+ import { HttpError } from '@windy/errors';
2
3
  import type { RegistrationError } from '@capacitor/push-notifications';
3
- import type { RGBA } from '@windy/Color.d';
4
4
  import type { QueryStringSource } from '@windy/http.d';
5
5
  import type { LatLon, LinearScale, TilePoint } from '@windy/interfaces.d';
6
6
  import type { RGBNumValues } from '@windy/interpolatorTypes';
7
- import type { ExtendedStationType, HTMLString, NumOrNull, Timestamp, ParsedQueryString } 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';
8
10
  /**
9
- * One minute in ms.
10
- *
11
- * @type {Timestamp}
11
+ * One minute duration in ms.
12
12
  */
13
- export declare const tsMinute: Timestamp;
13
+ export declare const tsMinute: TimeRangeMs;
14
14
  /**
15
- * One hour in ms.
16
- *
17
- * @type {Timestamp}
15
+ * One hour duration in ms.
18
16
  */
19
- export declare const tsHour: Timestamp;
17
+ export declare const tsHour: TimeRangeMs;
20
18
  /**
21
- * One day in ms.
22
- *
23
- * @type {Timestamp}
19
+ * One day duration in ms.
24
20
  */
25
- export declare const tsDay: Timestamp;
21
+ export declare const tsDay: TimeRangeMs;
26
22
  /**
27
- * Long press time in ms. to be used everywhere
23
+ * Long press time duration in ms.
28
24
  */
29
- export declare const longPressTime: Timestamp;
25
+ export declare const longPressTime: TimeRangeMs;
30
26
  /**
31
27
  * Converts number to char
32
28
  *
@@ -212,14 +208,13 @@ export declare const windDir2html: (wx: WindObject) => HTMLString;
212
208
  */
213
209
  export declare const isNear: <T extends LatLon, F extends LatLon>(a: T, b: F) => boolean;
214
210
  /**
215
- * Bounds a number to a limits
211
+ * Clamps a number to a range
216
212
  *
217
- * @param num Number to bound
213
+ * @param num Number to clamp
218
214
  * @param min Minimum
219
215
  * @param max Maximum
220
- * @returns Bounded number
216
+ * @returns Clamped number
221
217
  */
222
- export declare const bound: (num: number, min: number, max: number) => number;
223
218
  export declare const clamp: (num: number, min: number, max: number) => number;
224
219
  /**
225
220
  * Smoothstep https://en.wikipedia.org/wiki/Smoothstep
@@ -292,7 +287,7 @@ export declare const getAdjustedNow: (syncTime?: number) => number;
292
287
  * @param lang Language code
293
288
  * @returns True if language is supported, false otherwise
294
289
  */
295
- export declare const isValidLang: (lang: string) => lang is "en" | "zh-TW" | "zh" | "ja" | "fr" | "ko" | "it" | "ru" | "nl" | "cs" | "tr" | "pl" | "sv" | "fi" | "ro" | "el" | "hu" | "hr" | "ca" | "da" | "ar" | "fa" | "hi" | "ta" | "sk" | "uk" | "bg" | "he" | "is" | "lt" | "et" | "vi" | "sl" | "sr" | "id" | "th" | "sq" | "pt" | "nb" | "es" | "de" | "bn";
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";
296
291
  /**
297
292
  * Safely joins server name and path
298
293
  *
@@ -345,7 +340,7 @@ export declare const download: (data: BlobPart, type: string, name: string) => v
345
340
  * @param ident ID of plugin to load
346
341
  * @returns Instance of the Capacitor plugin
347
342
  */
348
- export declare const getNativePlugin: <T = unknown>(ident: string) => T;
343
+ export declare function getNativePlugin<T = unknown>(ident: string): T | null;
349
344
  /**
350
345
  * JQuery like selector
351
346
  *
@@ -399,6 +394,21 @@ export declare const getRefs: <N extends HTMLElement, R extends Record<string, H
399
394
  * Sanitizes HTML code, escape all XSS dangerous characters
400
395
  */
401
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
+ }
402
412
  /**
403
413
  * Custom error logging function.
404
414
  *
@@ -409,7 +419,7 @@ export declare const sanitizeHTML: (s: string) => string;
409
419
  * @param msg Message to report, the main body of the error
410
420
  * @param errObj Whole error object to stringification. It is sent to Kibana under 'error' property
411
421
  */
412
- 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;
413
423
  /**
414
424
  * Same as scale linear from d3 library except with different params
415
425
  * https://d3js.org/d3-scale/linear
@@ -421,8 +431,9 @@ export declare const scaleLinear: ({ domain, range, clip, }: {
421
431
  range: [number, number];
422
432
  clip?: boolean;
423
433
  }) => LinearScale;
434
+ export declare const maxCanvasRatio = 2;
424
435
  /**
425
- * Unified canvasRatio used in overall Windy. Not bigger then 2
436
+ * Unified canvasRatio used in overall Windy. Not bigger than maxCanvasRatio
426
437
  */
427
438
  export declare const canvasRatio: number;
428
439
  /**
@@ -466,6 +477,10 @@ export declare const removeDiacritics: (s: string) => string;
466
477
  * This differs from the CSS property which capitalizes the first letter of each word.
467
478
  */
468
479
  export declare const capitalize: (text: string) => string;
480
+ /**
481
+ * Get unified path format out of ts
482
+ */
483
+ export declare const getPathFromTs: (ts: Timestamp | Date, replacerPattern?: string) => Path;
469
484
  export declare const parseQueryString: (searchQuery: string | undefined) => ParsedQueryString | undefined;
470
485
  export declare const seoLangRegex: RegExp;
471
486
  /**
@@ -494,3 +509,41 @@ export declare const parseSeoUrl: (url: string) => {
494
509
  export declare const startupPath: any;
495
510
  export declare const generateUuidV4: () => string;
496
511
  export declare const getErrorMessage: (error: unknown) => string;
512
+ /**
513
+ * Creates a color gradient from array of prepared ones
514
+ */
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 {};
@@ -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-fire-warning -->'
193
- | '<!-- @echo icon-fire-match -->'
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 -->'