@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,41 @@
1
+ /**
2
+ * @class A wrapper class for WebGLProgram
3
+ * - used for creating shader programs (compilation of shaders, linking of shader programs etc.)
4
+ */
5
+ export declare class GlProgram {
6
+ private static numPrograms;
7
+ private _program;
8
+ /** Class instance unique id, tracks number of created instances */
9
+ private _programId;
10
+ private _programName;
11
+ private constructor();
12
+ /**
13
+ * @summary Resets program instance counter on plugin cleanup, used for debugging
14
+ */
15
+ static reset(): void;
16
+ /**
17
+ * @returns Unique program id
18
+ */
19
+ get programId(): number;
20
+ /**
21
+ * @summary Creates shader program from shader sources in strings (vertex and fragment shader source codes)
22
+ * @param vertexShaderSourceCode String with VS shader code
23
+ * @param fragmentShaderSourceCode String with FS shader code
24
+ * @param name String with program name, required for proper error reporting
25
+ * @returns {GlProgram} Created GlProgram instance
26
+ * @throws {GlError} When shader compilation fails or program linking fails
27
+ */
28
+ static constructWithSources(gl: WebGLRenderingContext, vertexShaderSourceCode: string, fragmentShaderSourceCode: string, name: string): GlProgram;
29
+ /**
30
+ * @summary Sets the program as current for rendering
31
+ */
32
+ use(gl: WebGL2RenderingContext | WebGLRenderingContext): void;
33
+ /**
34
+ * @returns {WebGLProgram} WebGLProgram handle (id)
35
+ */
36
+ getProgram(): WebGLProgram;
37
+ /**
38
+ * @summary Safely deletes the shader program including its shaders
39
+ */
40
+ destroy(gl: WebGL2RenderingContext | WebGLRenderingContext): void;
41
+ }
@@ -0,0 +1,95 @@
1
+ import { GlProgram, GlslDataType, type GlMesh } from '@windy/glUtils';
2
+ import type { UniformDataType, UniformRecord } from '@windy/glUtils.d';
3
+ import type { MapLibreMap as MaplibreGlMap } from '@leafletGl';
4
+ import type { Vector4 } from '@windy/math';
5
+ /**
6
+ * @class WebGL renderer abstraction class
7
+ * - class the should provide simple setup and usage of WebGL renderer
8
+ */
9
+ export declare class GlRenderer {
10
+ private ident;
11
+ protected static numRenderers: number;
12
+ /** List of meshes to be rendered by the renderer */
13
+ protected readonly meshes: GlMesh[];
14
+ /** Map of uniform variables used for rendering */
15
+ protected readonly uniforms: Map<string, UniformRecord>;
16
+ /** Set of uniform ids which values recently changed and therefore should be re-uploaded to the GPU */
17
+ protected readonly dirtyUniforms: Set<string>;
18
+ /** Textures must be treated separately since they must be bound each frame */
19
+ protected readonly uniformTextures: Map<string, UniformRecord>;
20
+ /** Program used for rendering */
21
+ protected program: GlProgram;
22
+ protected renderReady: boolean;
23
+ /** Color used to clear the bound framebuffer before rendering the content */
24
+ protected clearColor?: Vector4;
25
+ protected readonly rendererId: number;
26
+ constructor(ident: string);
27
+ /**
28
+ * @summary Resets renderer instance counter on plugin cleanup, used for debugging
29
+ */
30
+ static reset(): void;
31
+ /**
32
+ * @summary Initializes the renderer together with creating its shader program using the already fetched shader sources (strings)
33
+ * @param vsSrc String with source code of the Vertex Shader
34
+ * @param fsSrc String with source code of the Fragment Shader
35
+ */
36
+ initFromSources(gl: WebGLRenderingContext | WebGL2RenderingContext, vsSrc: string, fsSrc: string): void;
37
+ /**
38
+ * @summary Rerenders content into the currently bound framebuffer
39
+ * @param primitiveType Which primitives to draw (points, lines, triangles,..)
40
+ * @param numInstances If set >0, geometry is rendered as N instances
41
+ */
42
+ render(gl: WebGLRenderingContext | WebGL2RenderingContext, primitiveType?: GLenum, numInstances?: number): void;
43
+ /**
44
+ * @summary Updates value of the given uniform (global value sent to the GPU)
45
+ * @param uniformId Which uniform to update
46
+ * @param value New uniform value
47
+ */
48
+ updateUniformValue(uniformId: string, value: UniformDataType): void;
49
+ /**
50
+ * @summary Registers new uniform value to be used during rendering (uniform must be defined in the shader)
51
+ * @param uniformId Name of the uniform variable in the shader code
52
+ * @param dataType Data type of the uniform variable
53
+ * @returns {boolean} Whether the uniform was successfully registered or not
54
+ * - it can fail, for example, when the passed uniformId does not match its name defined in the program
55
+ * (or simply when it is not defined in the program)
56
+ *
57
+ */
58
+ registerUniformRecord(gl: WebGLRenderingContext | WebGL2RenderingContext, uniformId: string, dataType: GlslDataType, defaultValue?: UniformDataType): boolean;
59
+ /**
60
+ * @summary Checks whether the uniform record is already registered (to prevent multi registering)
61
+ */
62
+ isUniformRecordRegistered(uniformId: string): boolean;
63
+ /**
64
+ * @summary Adds mesh to the list of meshes to be rendered
65
+ * @param mesh
66
+ */
67
+ addMesh(mesh: GlMesh): void;
68
+ /**
69
+ * @summary Retrieves shader program owned by the renderer
70
+ */
71
+ getAttachedShader(): GlProgram;
72
+ destroy(gl: WebGLRenderingContext | WebGL2RenderingContext, map?: MaplibreGlMap): void;
73
+ /**
74
+ * @summary Sets color used for clearing the framebuffer
75
+ * @param color Values in range <0.0, 1.0>, if undefined, the color is unset
76
+ */
77
+ setClearColor(color: Vector4 | undefined): void;
78
+ /**
79
+ * @summary Clears the framebuffer with previously set clear-color
80
+ */
81
+ clear(gl: WebGLRenderingContext | WebGL2RenderingContext): void;
82
+ /**
83
+ * @summary Binds dirty uniform variables for rendering
84
+ * - dirty uniform is when its value has changed and must be re-uploaded to the GPU
85
+ * - when value does not change, there is no need to upload it in every frame
86
+ */
87
+ protected bindUniforms(gl: WebGLRenderingContext | WebGL2RenderingContext): void;
88
+ /**
89
+ * @summary Binds all textures that are registered in the shader for rendering
90
+ * - texture uniforms (more specifically texture units and textures) must be bound for every frame since it changes global WebGL state
91
+ * - texture unit id uniform is already set by "bindUniforms" method (this does not have to be updated each frame in case the texture unit does not change)
92
+ * - texture activation and binding must be preformed each frame (in case we are using multiple programs because texture binding changes global WebGL state)
93
+ */
94
+ private bindTextures;
95
+ }
@@ -0,0 +1,98 @@
1
+ import type { Vector2 } from '@windy/math';
2
+ import type { GlColorFormat } from '@windy/glUtils.d';
3
+ /**
4
+ * @class A wrapper class for WebGL Texture
5
+ */
6
+ export declare class GlTexture {
7
+ private static numTextures;
8
+ static reset(): void;
9
+ /**
10
+ * @summary Creates texture instance using remote image
11
+ * @param url Url of the image to fetch
12
+ */
13
+ static createFromUrl(gl: WebGLRenderingContext | WebGL2RenderingContext, url: string): Promise<GlTexture>;
14
+ /** Texture target (e.g. TEXTURE_2D) */
15
+ private readonly _target;
16
+ /** WebGL texture object */
17
+ private readonly _texture;
18
+ /** Class instance unique id, for debug, tracks number of created instances */
19
+ private readonly _textureId;
20
+ /** Texture color WebGL format */
21
+ private _internalFormat;
22
+ /** Current texture dimension (pixels) */
23
+ private _dimensions;
24
+ private _uvDownScale;
25
+ /** Texture uv coordinates wrapping strategy (how to handle uv coordinates out of <0.0,1.0> range) */
26
+ private wrap;
27
+ /** Texture magnification and minification filtering */
28
+ private filter;
29
+ private _usedMemory;
30
+ /**
31
+ * @param format Texture internal format (data representation, e.g. RGB, RGBA, LUMINANCE_ALPHA etc.)
32
+ * @param target Target - TEXTURE_2D, cubemap, array texture etc.
33
+ */
34
+ constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, format?: GlColorFormat, target?: GLenum, fromTexture?: WebGLTexture);
35
+ /**
36
+ * @returns The original WebGL texture object handle
37
+ */
38
+ get texture(): WebGLTexture;
39
+ /**
40
+ * @returns Class instance unique identifier
41
+ */
42
+ get textureId(): number;
43
+ /**
44
+ * @returns Texture target / type (TEXTURE_2D, array texture, cubemap, etc.)
45
+ */
46
+ get target(): GLenum;
47
+ /**
48
+ * @returns {Vector2} Dimensions of the texture
49
+ */
50
+ get dimensions(): Vector2;
51
+ set format(format: GlColorFormat);
52
+ get format(): GlColorFormat;
53
+ get uvDownScale(): Vector2;
54
+ /**
55
+ * @summary Returns gpu memory size currently used by the texture (in bytes)
56
+ */
57
+ get usedMemory(): number;
58
+ /**
59
+ * @summary Uploads new image data into the texture
60
+ * @param data either HTMLImageElement or tuple of [RawData, Dimensions]
61
+ * @param wrap texture wrapping (clamp, repeat...)
62
+ * @param filter texture minification and magnification filtering (nearest, linear)
63
+ * @param premultiply flag, whether to premultiply RGB channels by Alpha channel before uploading data to the GPU (UNPACK_PREMULTIPLY_ALPHA_WEBGL)
64
+ * ToDo: mip-maps, per-coordinate wrap, per mag/min filtering
65
+ */
66
+ updateContent(gl: WebGLRenderingContext | WebGL2RenderingContext, data: HTMLImageElement | [Uint8Array, Vector2] | [Uint8ClampedArray, Vector2] | HTMLCanvasElement | ImageBitmap, wrap?: GLenum, filter?: GLenum, premultiply?: boolean): void;
67
+ /**
68
+ * @summary Binds the texture for rendering and other operations
69
+ * @param wrap Wrap settings, how to handle texture coordinates out of <0.0, 1.0> bounds (where to read)
70
+ * @param filter Texture minification and magnification filtering (nearest / interpolation)
71
+ */
72
+ bind(gl: WebGLRenderingContext | WebGL2RenderingContext, wrap?: GLenum, filter?: GLenum): void;
73
+ /**
74
+ * @summary Unbinds the texture
75
+ */
76
+ unbind(gl: WebGLRenderingContext | WebGL2RenderingContext): void;
77
+ /**
78
+ * @summary Destructor, releases WebGL texture
79
+ */
80
+ destroy(gl: WebGLRenderingContext | WebGL2RenderingContext): void;
81
+ /**
82
+ * @summary Resizes the texture with null data and/or sets new texture format
83
+ * - the reason of performing both in one method is to ideally perform both operations using single gl.texImage2D call
84
+ * @param newSize Dimensions in pixels
85
+ * @param disableDownscale Flag that disables the resize
86
+ * (since there are multiple conditions, that can lead to preventing the resize from outer scope)
87
+ * @param newFormat Optional new color format to be set to the texture
88
+ * @returns {Vector2} A rescale vector representing the factor by which the original UV coordinates should be rescaled
89
+ * in case texture down-scaling is disabled {@link disableDownscale} --> in this way the UV range is constrained only to the valid area
90
+ */
91
+ resize(gl: WebGLRenderingContext | WebGL2RenderingContext, newSize: Vector2, disableDownscale?: boolean, newFormat?: GlColorFormat): Vector2;
92
+ /**
93
+ * @summary Reallocates the texture based on the new dimensions and/or new color format
94
+ */
95
+ private reallocate;
96
+ private setupProfiling;
97
+ private updateProfilingStats;
98
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @class A wrapper class for WebGL VertexArrayObject (VAO)
3
+ */
4
+ export declare class GlVertexArray {
5
+ private static vaosCount;
6
+ private readonly vaoId;
7
+ private vao;
8
+ /**
9
+ * @summary Resets vao instance counter on plugin cleanup, used for debugging
10
+ */
11
+ static reset(): void;
12
+ /**
13
+ * @summary Tries to create WebGL VertexArrayObject
14
+ * @returns {GlVertexArray | null} GlVertexArray instance or null,
15
+ * if WebGL1 used and VAO extension (OES_vertex_array_object) is not available
16
+ */
17
+ static create(gl: WebGLRenderingContext | WebGL2RenderingContext): GlVertexArray | null;
18
+ /**
19
+ * @summary Binds the Vertex Array for rendering
20
+ * - Binds proper VAO (either by WebGL2 or by WebGL1 extension)
21
+ */
22
+ bind(gl: WebGLRenderingContext | WebGL2RenderingContext): void;
23
+ /**
24
+ * @summary Unbinds the Vertex Array
25
+ */
26
+ unbind(gl: WebGLRenderingContext | WebGL2RenderingContext): void;
27
+ /**
28
+ * @summary Destructor - releases all WebGL resources
29
+ */
30
+ destroy(gl: WebGLRenderingContext | WebGL2RenderingContext): void;
31
+ /**
32
+ * @summary Tries to initialize the WebGL/WebGL2 VertexArrayObject
33
+ * @returns {boolean} Flag whether the initialization was successful
34
+ * - it can fail in case the WebGL2 is not supported and
35
+ * the WebGL1 extension "OES_vertex_array_object" is not available
36
+ */
37
+ private init;
38
+ }
@@ -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", "installedPlugins", "likedStoryComments", "log", "markedNotams", "popularLocations", "searchRecents", "seenArticles", "seenPromos", "seenStories", "slidedCapAlerts", "userAlerts", "userFavs"];
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
- export type SupportedApiEndpoints = 'notams' | 'colors' | 'alerts' | 'favs';
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
- initPromise: Promise<IDBDatabase>;
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 initPromise;
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
- declare const _default: any;
2
- export default _default;
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;
@@ -1,13 +1,98 @@
1
- import type { Color } from './d.ts.files/Color';
2
- import type { FullRenderParameters, Layers, RenderParams, TransformFunction } from './d.ts.files/Layer.d';
3
- import type { Metric } from './d.ts.files/Metric';
4
- import type { Legend } from './d.ts.files/Metric.d';
5
- import type { NumberedMetric } from './d.ts.files/MetricClasses';
6
- import type { DataQuality, FileSuffix, Product } from './d.ts.files/Product';
7
- import type { Renderers } from './d.ts.files/Renderer.d';
8
- import type { WeatherParameters } from './d.ts.files/interfaces.d';
9
- import type { Levels, Products } from './d.ts.files/rootScope.d';
10
- import type { Timestamp } from './d.ts.files/types';
1
+ import type { Color } from '@windy/Color';
2
+ import type { Metric } from '@windy/Metric';
3
+ import type { Legend } from '@windy/Metric.d';
4
+ import type { DataQuality, FileSuffix } from '@windy/Product';
5
+ import type { Renderers } from '@windy/Renderer';
6
+ import type { Levels, Products } from '@windy/rootScope.d';
7
+ import type { NumberedMetric, PrecipMetric, PtypeMetric, UVIndexMetric } from '@windy/MetricClasses';
8
+ import type { TransformFunction } from '@windy/types';
9
+ import type { RenderParams } from '@windy/interfaces';
10
+ /**
11
+ * All available layers and their metric value type
12
+ */
13
+ export interface LayerMetricType {
14
+ capAlerts: undefined;
15
+ pressureIsolines: undefined;
16
+ ghIsolines: undefined;
17
+ tempIsolines: undefined;
18
+ deg0Isolines: undefined;
19
+ windParticles: undefined;
20
+ ecmwfWindParticles: undefined;
21
+ ecmwfWindParticles150h: undefined;
22
+ ecmwfWindParticles500h: undefined;
23
+ ecmwfWindParticles600h: undefined;
24
+ waveParticles: undefined;
25
+ waveParticlesWaves: undefined;
26
+ currentParticles: undefined;
27
+ currentsTideParticles: undefined;
28
+ wind: NumberedMetric;
29
+ temp: NumberedMetric;
30
+ wetbulbtemp: NumberedMetric;
31
+ solarpower: NumberedMetric;
32
+ wavePower: NumberedMetric;
33
+ uvindex: UVIndexMetric;
34
+ dewpoint: NumberedMetric;
35
+ gust: NumberedMetric;
36
+ gustAccu: NumberedMetric;
37
+ rh: NumberedMetric;
38
+ pressure: NumberedMetric;
39
+ ccl: NumberedMetric;
40
+ rain: PrecipMetric;
41
+ ptype: PtypeMetric;
42
+ thunder: NumberedMetric;
43
+ clouds: NumberedMetric;
44
+ lclouds: NumberedMetric;
45
+ mclouds: NumberedMetric;
46
+ hclouds: NumberedMetric;
47
+ cape: NumberedMetric;
48
+ cbase: NumberedMetric;
49
+ fog: NumberedMetric;
50
+ snowAccu: NumberedMetric;
51
+ rainAccu: NumberedMetric;
52
+ waves: NumberedMetric;
53
+ wwaves: NumberedMetric;
54
+ swell1: NumberedMetric;
55
+ swell2: NumberedMetric;
56
+ swell3: NumberedMetric;
57
+ swell: NumberedMetric;
58
+ currents: NumberedMetric;
59
+ currentsTide: NumberedMetric;
60
+ sst: NumberedMetric;
61
+ visibility: NumberedMetric;
62
+ snowcover: NumberedMetric;
63
+ cloudtop: NumberedMetric;
64
+ deg0: NumberedMetric;
65
+ cosc: NumberedMetric;
66
+ dustsm: NumberedMetric;
67
+ radar: NumberedMetric;
68
+ satellite: NumberedMetric;
69
+ gtco3: NumberedMetric;
70
+ pm2p5: NumberedMetric;
71
+ no2: NumberedMetric;
72
+ aod550: NumberedMetric;
73
+ tcso2: NumberedMetric;
74
+ go3: NumberedMetric;
75
+ gh: NumberedMetric;
76
+ efiWind: NumberedMetric;
77
+ efiTemp: NumberedMetric;
78
+ efiRain: NumberedMetric;
79
+ moistureAnom40: PrecipMetric;
80
+ moistureAnom100: PrecipMetric;
81
+ drought40: NumberedMetric;
82
+ drought100: NumberedMetric;
83
+ soilMoisture40: NumberedMetric;
84
+ soilMoisture100: NumberedMetric;
85
+ fwi: NumberedMetric;
86
+ dfm10h: NumberedMetric;
87
+ turbulence: NumberedMetric;
88
+ icing: NumberedMetric;
89
+ topoMap: undefined;
90
+ aqi: NumberedMetric;
91
+ }
92
+ /**
93
+ * All layers available
94
+ */
95
+ export type Layers = keyof LayerMetricType;
11
96
  type LayerInitParams = Pick<Layer, 'ident'> & Partial<Layer>;
12
97
  export declare class Layer<M extends Metric | undefined = Metric | undefined> {
13
98
  /**
@@ -75,7 +160,7 @@ export declare class Layer<M extends Metric | undefined = Metric | undefined> {
75
160
  */
76
161
  levels: Levels[];
77
162
  /**
78
- * Optional quary string that enhances query string
163
+ * Optional query string that enhances query string
79
164
  */
80
165
  query?: string;
81
166
  /**
@@ -91,10 +176,6 @@ export declare class Layer<M extends Metric | undefined = Metric | undefined> {
91
176
  * If users opts to change colors of this layer, use this metrics
92
177
  */
93
178
  cm?: Metric;
94
- /**
95
- * Overwrite's products pathgenerator
96
- */
97
- pathGenerator?: string;
98
179
  /**
99
180
  * Method to transfrom value in R channel
100
181
  */
@@ -116,21 +197,10 @@ export declare class Layer<M extends Metric | undefined = Metric | undefined> {
116
197
  * getColor for layers, with mutliple colors (like rainClouds)
117
198
  */
118
199
  getColor2?(): ReturnType<Color['getColor']>;
119
- /**
120
- * Just call Product's open and return its Calendar
121
- */
122
- getCalendar(prodIdent: Products): ReturnType<Product['open']>;
123
- /**
124
- * Creates RenderingParameters
125
- */
126
- getParams(weatherParams: WeatherParameters, productIdent: Products, timestamp?: Timestamp, refTime?: string): Promise<FullRenderParameters>;
127
200
  /**
128
201
  * Return amounts of dots, based on rain
129
202
  */
130
203
  getAmountByColor?(Rf: number, Gf: number): 0 | 1 | 2 | 3 | 4;
131
204
  protected initProperties(): void;
132
205
  }
133
- export declare class WaveLayer extends Layer<NumberedMetric> {
134
- initProperties(): void;
135
- }
136
206
  export {};
@@ -0,0 +1,5 @@
1
+ import { Layer } from '@windy/Layer';
2
+ import type { NumberedMetric } from '@windy/MetricClasses';
3
+ export declare class WaveLayer extends Layer<NumberedMetric> {
4
+ initProperties(): void;
5
+ }