@windycom/plugin-devtools 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +3 -0
  2. package/index.mjs +298 -0
  3. package/package.json +9 -0
  4. package/publishExamples.sh +19 -0
  5. package/types/AromeProduct.d.ts +5 -0
  6. package/types/Bar.d.ts +114 -0
  7. package/types/BindedBar.d.ts +51 -0
  8. package/types/BindedCheckbox.d.ts +30 -0
  9. package/types/BindedSwitch.d.ts +35 -0
  10. package/types/BottomSlide.d.ts +53 -0
  11. package/types/BottomTagPlugin.d.ts +8 -0
  12. package/types/Calendar.d.ts +149 -0
  13. package/types/ClickHandler.d.ts +19 -0
  14. package/types/Color.d.ts +175 -0
  15. package/types/DataTiler.d.ts +41 -0
  16. package/types/Drag.d.ts +43 -0
  17. package/types/DraggableDiv.d.ts +21 -0
  18. package/types/DropDown.d.ts +37 -0
  19. package/types/EcmwfAnalysisProduct.d.ts +5 -0
  20. package/types/EcmwfProduct.d.ts +29 -0
  21. package/types/Evented.d.ts +78 -0
  22. package/types/ExternalSveltePlugin.d.ts +29 -0
  23. package/types/Favs.d.ts +83 -0
  24. package/types/GhostBox.d.ts +17 -0
  25. package/types/GlObj.d.ts +252 -0
  26. package/types/HrrrProducts.d.ts +5 -0
  27. package/types/IconProducts.d.ts +5 -0
  28. package/types/LabelsLayer.d.ts +2 -0
  29. package/types/LandMask.d.ts +2 -0
  30. package/types/Layer.d.ts +137 -0
  31. package/types/Legend.d.ts +6 -0
  32. package/types/LongTap.d.ts +21 -0
  33. package/types/Metric.d.ts +132 -0
  34. package/types/MetricClasses.d.ts +37 -0
  35. package/types/MobileCalendar.d.ts +47 -0
  36. package/types/NamProducts.d.ts +5 -0
  37. package/types/OfflineMessagesClasses.d.ts +30 -0
  38. package/types/Overlay.d.ts +150 -0
  39. package/types/OverlayClasses.d.ts +29 -0
  40. package/types/Particles.d.ts +111 -0
  41. package/types/Plugin.d.ts +112 -0
  42. package/types/Product.d.ts +211 -0
  43. package/types/ProductSwitch.d.ts +14 -0
  44. package/types/Renderer.d.ts +69 -0
  45. package/types/SatelliteProduct.d.ts +19 -0
  46. package/types/Scrollable.d.ts +14 -0
  47. package/types/StaticProduct.d.ts +7 -0
  48. package/types/SveltePanePlugin.d.ts +18 -0
  49. package/types/SveltePlugin.d.ts +40 -0
  50. package/types/Swipe.d.ts +34 -0
  51. package/types/Switch.d.ts +24 -0
  52. package/types/TagPlugin.d.ts +6 -0
  53. package/types/TileLayer.d.ts +9 -0
  54. package/types/TileLayerCanvas.d.ts +2 -0
  55. package/types/TileLayerMultiPatch.d.ts +2 -0
  56. package/types/TimestampBar.d.ts +8 -0
  57. package/types/Webcams.d.ts +66 -0
  58. package/types/Window.d.ts +107 -0
  59. package/types/WindowPlugin.d.ts +171 -0
  60. package/types/baseMap.d.ts +10 -0
  61. package/types/broadcast.d.ts +14 -0
  62. package/types/cityLabels.d.ts +2 -0
  63. package/types/cloudSync.d.ts +12 -0
  64. package/types/colors.d.ts +4 -0
  65. package/types/connection.d.ts +4 -0
  66. package/types/css.d.ts +25 -0
  67. package/types/dataLoader.d.ts +26 -0
  68. package/types/dataSpecifications.d.ts +12 -0
  69. package/types/detectDevice.d.ts +6 -0
  70. package/types/device.d.ts +19 -0
  71. package/types/deviceLogging.d.ts +13 -0
  72. package/types/fetch.d.ts +88 -0
  73. package/types/format.d.ts +102 -0
  74. package/types/ga.d.ts +1 -0
  75. package/types/geolocation.d.ts +30 -0
  76. package/types/glTileRender.d.ts +178 -0
  77. package/types/glsl-modules.d.ts +26 -0
  78. package/types/hp.d.ts +15 -0
  79. package/types/http.d.ts +62 -0
  80. package/types/iconfont.d.ts +196 -0
  81. package/types/index.d.ts +1 -0
  82. package/types/interfaces.d.ts +1727 -0
  83. package/types/interpolator.d.ts +19 -0
  84. package/types/lang-files.d.ts +5116 -0
  85. package/types/latestBroadcasts.d.ts +14 -0
  86. package/types/layers.d.ts +78 -0
  87. package/types/leaflet.d.ts +1919 -0
  88. package/types/legends.d.ts +6 -0
  89. package/types/levelUtils.d.ts +2 -0
  90. package/types/libGuard.d.ts +1 -0
  91. package/types/location.d.ts +72 -0
  92. package/types/log.d.ts +2 -0
  93. package/types/lruCache.d.ts +69 -0
  94. package/types/map.d.ts +80 -0
  95. package/types/metrics.d.ts +3 -0
  96. package/types/mobileUtils.d.ts +7 -0
  97. package/types/models.d.ts +42 -0
  98. package/types/node-modules.d.ts +16 -0
  99. package/types/notifications.d.ts +66 -0
  100. package/types/offlineController.d.ts +20 -0
  101. package/types/overlays.d.ts +67 -0
  102. package/types/particleRenderers.d.ts +4 -0
  103. package/types/permanentPromos.d.ts +2 -0
  104. package/types/picker.d.ts +66 -0
  105. package/types/plugins.d.ts +3 -0
  106. package/types/pois.d.ts +16 -0
  107. package/types/products.d.ts +3 -0
  108. package/types/promo.d.ts +37 -0
  109. package/types/query.d.ts +19 -0
  110. package/types/queryString.d.ts +2 -0
  111. package/types/renderCtrl.d.ts +8 -0
  112. package/types/renderTile.d.ts +6 -0
  113. package/types/renderUtils.d.ts +107 -0
  114. package/types/renderers.d.ts +20 -0
  115. package/types/reverseName.d.ts +10 -0
  116. package/types/rhMessage.d.ts +3 -0
  117. package/types/rootScope.d.ts +152 -0
  118. package/types/router.d.ts +30 -0
  119. package/types/seoParser.d.ts +19 -0
  120. package/types/share.d.ts +1 -0
  121. package/types/showableErrorsService.d.ts +31 -0
  122. package/types/singleclick.d.ts +52 -0
  123. package/types/storage.d.ts +3 -0
  124. package/types/store.d.ts +148 -0
  125. package/types/subscription.d.ts +65 -0
  126. package/types/tileInterpolator.d.ts +27 -0
  127. package/types/tileLayerInstance.d.ts +2 -0
  128. package/types/timestampUtils.d.ts +5 -0
  129. package/types/trans.d.ts +68 -0
  130. package/types/ts-interfaces.d.ts +66 -0
  131. package/types/ts-types.d.ts +43 -0
  132. package/types/types.d.ts +308 -0
  133. package/types/user.d.ts +54 -0
  134. package/types/userFavs.d.ts +129 -0
  135. package/types/utils.d.ts +424 -0
  136. package/types/variables.d.ts +238 -0
  137. package/types/windy-modules.d.ts +7 -0
@@ -0,0 +1,83 @@
1
+ import type { Fav, UpcomingFav } from '@windy/interfaces.d';
2
+ export type FavKey = string;
3
+ export type FavsInitParams = {
4
+ ident: `favs${number}` | `recents${number}`;
5
+ };
6
+ export declare class Favs<T extends Fav> {
7
+ /** Local storage key (under which are data stored) */
8
+ protected ident: `favs${number}` | `recents${number}`;
9
+ private lastModified?;
10
+ /** Major data holder */
11
+ data: Record<FavKey, T>;
12
+ constructor(params: FavsInitParams);
13
+ /**
14
+ * Returning key for item key is either ICAO code or lat/lon stripped to 3 decimals or alertID
15
+ */
16
+ key(item: Partial<Fav> | string): string;
17
+ /**
18
+ * Add airport or location to local storage
19
+ */
20
+ prepareAdd(item: UpcomingFav): FavKey;
21
+ /**
22
+ * Add airport or location to local storage and sync with cloud
23
+ * query parameter is only for inherited classes, it is not used in this class
24
+ */
25
+ add(item: Fav, _query?: string): boolean | Promise<string> | void;
26
+ findFavByProperties(item: Partial<Fav> | FavKey): Fav | undefined;
27
+ /**
28
+ * Deduplicates two collections for example favs, recents, search results
29
+ * returns deduplicated and mergedcollection, whereas collection2 has higher proprity
30
+ */
31
+ dedupeAndConcat(collection1: Fav[], collection2: Fav[]): Fav[];
32
+ /**
33
+ * Dedupe
34
+ */
35
+ dedupeFav(item: Partial<Fav> | FavKey, findingFun: (cmp: (i: Fav) => boolean) => Fav | undefined): Fav | undefined;
36
+ /**
37
+ * Check if this is favorite or not
38
+ */
39
+ isFav(item: FavKey | Partial<Fav>): boolean;
40
+ /**
41
+ * Save all in localStorage
42
+ */
43
+ save(): void;
44
+ /**
45
+ * Update timestamp in localStorage
46
+ */
47
+ updateTimestamp(): void;
48
+ /**
49
+ * Load from localStorage
50
+ */
51
+ load(): void;
52
+ /**
53
+ * Called upon add/removal
54
+ */
55
+ onchange(): void;
56
+ /**
57
+ * Remove fav item from local storage - key or object
58
+ */
59
+ prepareRename(fav: Fav, name: string): boolean;
60
+ rename(fav: Fav, name: string): void;
61
+ /**
62
+ * Remove fav item from local storage - key or object
63
+ */
64
+ prepareRemove(item: Fav | FavKey): void;
65
+ /**
66
+ * Remove fav item. Second parameter and promise return type is to stay consistent with child types inheriting from this
67
+ */
68
+ remove(item: Fav | FavKey, _isAlert?: boolean): Promise<void>;
69
+ getAll(): Record<string, T>;
70
+ /**
71
+ * increase counter of item
72
+ */
73
+ hit(item: Fav): void;
74
+ /**
75
+ * Filters && sorts items and rtrns a list of keys
76
+ */
77
+ sortFavs(query: string | undefined | null, sortProperty: 'timestamp' | 'counter', excludeItems?: FavKey[] | null): FavKey[];
78
+ /**
79
+ * Returns array of up to @num most popular items filtered by @query and sorted by @sortProperty. @exclude is list
80
+ * of items containing keys that should be excluded from result
81
+ */
82
+ get(num: number, query: string | undefined | null, sortProperty: 'timestamp' | 'counter', exclude?: Fav[]): Fav[];
83
+ }
@@ -0,0 +1,17 @@
1
+ import type { Drag } from './Drag';
2
+ export type GhostBoxInitParams = {
3
+ drag: Drag;
4
+ progressLine: HTMLElement;
5
+ ghost: HTMLElement | null;
6
+ updateGhost?(event: MouseEvent | TouchEvent): void;
7
+ };
8
+ export declare class GhostBox {
9
+ private drag;
10
+ progressLine: HTMLElement;
11
+ ghost: HTMLElement | null;
12
+ constructor(params: GhostBoxInitParams);
13
+ private updateGhost;
14
+ private onGhostMouseEnter;
15
+ private onGhostMouseLeave;
16
+ private onGhostMouseMove;
17
+ }
@@ -0,0 +1,252 @@
1
+ import type { Canvas, ExtendedWebGLTexture, WebGLProgramObject } from '@windy/GlObj.d';
2
+ /**
3
+ * GLObj - Web GL context wrapper
4
+ */
5
+ declare class GLObj {
6
+ /**
7
+ * Little endianess
8
+ */
9
+ static littleEndian: boolean;
10
+ /**
11
+ * newId for new instance
12
+ */
13
+ static newId: number;
14
+ /**
15
+ * New id for gl context
16
+ */
17
+ static newGlId: number;
18
+ /**
19
+ * id for instances comparison
20
+ */
21
+ id: number;
22
+ /**
23
+ * Gl context id for comparison
24
+ */
25
+ glId: number;
26
+ /**
27
+ * Stored param MAX_TEXTURE_SIZE from last gl context
28
+ */
29
+ maxTextureSize: number;
30
+ /**
31
+ * Name for debug purposes
32
+ */
33
+ _name?: string;
34
+ /**
35
+ * store WebGL objects references in own arrays
36
+ */
37
+ keepRefs: boolean;
38
+ /**
39
+ * store reference for vertex and pixel shaders
40
+ */
41
+ keepRefsShaders: boolean;
42
+ /**
43
+ * arrays for reference storing
44
+ */
45
+ framebuffers: WebGLFramebuffer[];
46
+ buffers: WebGLBuffer[];
47
+ shaders: WebGLShader[];
48
+ programs: WebGLProgram[];
49
+ textures: ExtendedWebGLTexture[];
50
+ /**
51
+ * web gl context
52
+ */
53
+ _gl: null | WebGLRenderingContext;
54
+ /**
55
+ * associated HTMLCanvasElement
56
+ */
57
+ canvas: null | Canvas;
58
+ /**
59
+ * Last result of checkGlError()
60
+ */
61
+ isGlError: boolean;
62
+ /**
63
+ * Last error message generated by checkGlError()
64
+ */
65
+ lastGlErrorMsg: string;
66
+ constructor(keepRefs?: boolean, keepRefsShaders?: boolean);
67
+ /**
68
+ * reset all
69
+ */
70
+ reset(): void;
71
+ /**
72
+ * create webGl rendering context on given canvas
73
+ *
74
+ * @param canvas HTMLCanvasElement
75
+ * @param flags contextAttributes
76
+ * @param name context name for debug purposes
77
+ */
78
+ create(canvas: Canvas, flags: WebGLContextAttributes, name?: string): void | WebGLRenderingContext | null;
79
+ /**
80
+ * Rets true if canvas or webgl context is NOT valid
81
+ */
82
+ isInvalid(): boolean;
83
+ /**
84
+ * Get WebGLRendering context. If it is null we consider the error was thrown earlier
85
+ */
86
+ gl(): WebGLRenderingContext | null;
87
+ /**
88
+ * !DEPRECATED!
89
+ */
90
+ get(): WebGLRenderingContext | null;
91
+ getCanvas(): Canvas | null;
92
+ /**
93
+ * Create shader and compile source
94
+ *
95
+ * @param source .. shader source string
96
+ * @param isVertexShader .. shader type (true .. gl.VERTEX_SHADER, false .. gl.FRAGMENT_SHADER)
97
+ * @param name .. name of shader
98
+ * @returns shader
99
+ */
100
+ createShader(source: string, isVertexShader: boolean, name?: string): WebGLShader | null;
101
+ /**
102
+ * create shader program (compile and link vertex and fragment sources and loop through attributes and uniforms )
103
+ *
104
+ * @param vertexSource .. shader source string
105
+ * @param fragmentSource .. shader source string
106
+ * @param defs .. array of #define strings
107
+ * @param name .. optional shader name
108
+ * @returns Object { program, <attributes names>, <uniforms names> };
109
+ */
110
+ createProgramObj(vertexSource: string, fragmentSource: string, defs?: string[] | null, name?: string): WebGLProgramObject | null;
111
+ /**
112
+ * delete shader program
113
+ */
114
+ deleteProgramObj(program: WebGLProgram): void;
115
+ /**
116
+ * bind attribute (source of vertex data) to shader program (set before)
117
+ *
118
+ * @param buffer .. vertex buffer
119
+ * @param attribute .. attribute index in shader program
120
+ * @param numComponents ..attribute vector component <1;4>
121
+ * @param type .. (gl.UNSIGNED_BYTE, gl.SHORT, gl.UNSIGNED_SHORT, gl.FLOAT)
122
+ * @param normalized .. normalize fixed-point data (gl.TRUE, gl.FALSE)
123
+ * @param stride ..in bytes between the beginning of consecutive vertex attributes (vertex size in bytes)
124
+ * @param offset ..in bytes of the first component in the vertex attribute array. Must be a multiple of type.
125
+ */
126
+ bindAttribute(buffer: WebGLBuffer | null, attribute: GLuint, numComponents: GLint, type: GLenum, normalized: GLboolean, stride: GLsizei, offset: GLintptr): void;
127
+ /**
128
+ * Loads texture from url
129
+ * @param name texture name
130
+ * @param url Texture URL
131
+ * @param minFilter Min-filter
132
+ * @param magFilter Mag-filter
133
+ * @param wrap texture wrap S and texture wrap T
134
+ * @param genMips generate mipmaps?
135
+ */
136
+ textureFromUrlPromise<K extends string>(name: K, url: string, minFilter: GLint, magFilter: GLint, wrap: GLenum, genMips: boolean): Promise<[K, ExtendedWebGLTexture | null]>;
137
+ /**
138
+ * Loads texture from base64 image (async! may be delayed)
139
+ *
140
+ * @param minFilter ?????
141
+ * @param magFilter ?????
142
+ * @param wrap ?????
143
+ * @param base64 ?????
144
+ * @param genMips ?????
145
+ * @returns gl texture object
146
+ */
147
+ createTextureFromBase64(minFilter: GLenum, magFilter: GLenum, wrap: GLenum, base64: string, genMips: boolean): ExtendedWebGLTexture | null;
148
+ /**
149
+ * create 2D texture
150
+ *
151
+ * @param minFilter .. gl.NEAREST, gl.LINEAR, gl.NEAREST_MIPMAP_NEAREST, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR, gl.LINEAR_MIPMAP_LINEAR
152
+ * @param magFilter .. gl.NEAREST, gl.LINEAR
153
+ * @param wrap .. gl.CLAMP_TO_EDGE, gl.REPEAT, gl.MIRRORED_REPEAT
154
+ * @param data .. Uint8Array or imageData
155
+ * @param width .. dimensions for Uint8Array data
156
+ * @param height .. dimensions for Uint8Array data
157
+ * @param format .. gl.RGBA, gl.RGB, gl.LUMINANCE_ALPHA, gl.LUMINANCE, gl.ALPHA
158
+ * @param genMips .. true/false generate mipmap chain (sizes must be power of 2)
159
+ * @description texImage2D: https://developer.mozilla.org/en/docs/Web/API/WebGLRenderingContext/texImage2D
160
+ */
161
+ createTexture2D(minFilter: GLenum, magFilter: GLenum, wrap: GLenum, data: TexImageSource | ArrayBufferView | (TexImageSource | ArrayBufferView)[] | null, width: GLsizei, height: GLsizei, format?: GLenum, genMips?: boolean): ExtendedWebGLTexture | null;
162
+ /**
163
+ * resize existing 2D texture
164
+ *
165
+ * @param texture .. existing 2D texture
166
+ * @param data .. Uint8Array or imageData or Array of mips (Uint8Array)
167
+ * @param width .. dimensions for Uint8Array data
168
+ * @param height .. dimensions for Uint8Array data
169
+ * @param format .. gl.RGBA, gl.RGB, gl.LUMINANCE_ALPHA, gl.LUMINANCE, gl.ALPHA
170
+ * @param genMips .. true/false generate mipmap chain
171
+ * @description texImage2D: https://developer.mozilla.org/en/docs/Web/API/WebGLRenderingContext/texImage2D
172
+ */
173
+ resizeTexture2D(texture: ExtendedWebGLTexture | null, data: TexImageSource | ArrayBufferView | (TexImageSource | ArrayBufferView)[] | null, width: GLsizei, height: GLsizei, format?: GLenum, genMips?: boolean): ExtendedWebGLTexture | null;
174
+ /**
175
+ * delete 2D texture object
176
+ */
177
+ deleteTexture2D(texture: WebGLTexture): void;
178
+ /**
179
+ * activate texture and bind it to sampler unit
180
+ *
181
+ * @param texture .. previously created 2D texture
182
+ * @param unit .. index of sampler unit
183
+ * @param shaderVar .. optional shader uniform sampler2D variable
184
+ */
185
+ bindTexture2D(texture: WebGLTexture | null, unit?: GLenum, shaderVar?: WebGLUniformLocation | null): void;
186
+ /**
187
+ * set texture filter and wrap params (bind texture before by bindTexture2D)
188
+ *
189
+ * @param minFilter .. gl.LINEAR, gl.NEAREST, gl.NEAREST_MIPMAP_NEAREST, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR (default value), gl.LINEAR_MIPMAP_LINEAR
190
+ * @param magFilter .. gl.LINEAR (default value), gl.NEAREST
191
+ * @param wrapS .. gl.REPEAT (default value),gl.CLAMP_TO_EDGE, gl.MIRRORED_REPEAT
192
+ * @param wrapT .. gl.REPEAT (default value),gl.CLAMP_TO_EDGE, gl.MIRRORED_REPEAT
193
+ */
194
+ setBindedTexture2DParams(minFilter: GLenum, magFilter: GLenum, wrapS: GLenum, wrapT?: GLenum): void;
195
+ /**
196
+ * create vertex (attributes source) buffer from data
197
+ *
198
+ * @param data .. ArrayBuffer, SharedArrayBuffer or ArrayBufferView; will be copied into the data store
199
+ */
200
+ createBuffer(data: BufferSource): WebGLBuffer | null;
201
+ /**
202
+ * delete vertex or index buffer
203
+ */
204
+ deleteBuffer(buffer: WebGLBuffer): void;
205
+ /**
206
+ * @param buffer .. created vertex buffer
207
+ * @param data .. ArrayBuffer, SharedArrayBuffer or ArrayBufferView; will be copied into the data store
208
+ */
209
+ setBufferData(buffer: WebGLBuffer, data: BufferSource): void;
210
+ /**
211
+ * create indices buffer from data
212
+ *
213
+ * @param data .. ArrayBuffer, SharedArrayBuffer or ArrayBufferView; will be copied into the data store
214
+ */
215
+ createIndexBuffer(data: BufferSource): WebGLBuffer | null;
216
+ createFramebuffer(): WebGLFramebuffer | null;
217
+ /**
218
+ * delete Framebuffer
219
+ */
220
+ deleteFramebuffer(framebuffer: WebGLFramebuffer): void;
221
+ /**
222
+ * bind or unbind framebuffer
223
+ *
224
+ * @param framebuffer .. or null for unbind
225
+ * @param texture .. compatible 2D texture
226
+ */
227
+ bindFramebuffer(framebuffer: WebGLFramebuffer | null, texture?: WebGLTexture | null): void;
228
+ /**
229
+ * release all GL resources and reset
230
+ */
231
+ release(): void;
232
+ /**
233
+ * Sets this.isGlError and this.lastGlErrorMsg
234
+ * @returns isGlError: boolean
235
+ */
236
+ checkGlError(): boolean;
237
+ /**
238
+ * Checks WebGL status and returns message
239
+ * @returns lastGlErrorMsg: string
240
+ */
241
+ getGlStatus(): string;
242
+ /**
243
+ * get next greater size which is power of 2
244
+ * (ex: 11 >>> 16, 17 >>> 32, ... )
245
+ */
246
+ static getNextPowerOf2Size(size: number): number;
247
+ /**
248
+ * remove object from array (Array.findIndex() not supported by all browsers)
249
+ */
250
+ static removeFromArray<T = WebGLFramebuffer | WebGLBuffer | WebGLProgram | WebGLShader | ExtendedWebGLTexture>(o: T, a: T[]): number;
251
+ }
252
+ export default GLObj;
@@ -0,0 +1,5 @@
1
+ import { Product } from '@windy/Product';
2
+ import type { ProductInitParams } from '@windy/Product';
3
+ export declare class HrrrProducts extends Product {
4
+ constructor(params: Partial<ProductInitParams>);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { Product } from '@windy/Product';
2
+ import type { ProductInitParams } from './Product';
3
+ export declare class IconProducts extends Product {
4
+ constructor(params: Pick<ProductInitParams, 'modelName'> & Partial<ProductInitParams>);
5
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,137 @@
1
+ import type { Color } from '@windy/Color';
2
+ import type { FullRenderParameters, Layers, RenderParams, TransformFunction } from '@windy/Layer.d';
3
+ import type { Metric } from '@windy/Metric';
4
+ import type { Legend } from '@windy/Metric.d';
5
+ import type { NumberedMetric } from '@windy/MetricClasses';
6
+ import type { Product } from '@windy/Product';
7
+ import type { DataQuality, FileSuffix } from '@windy/Product.d';
8
+ import type { Renderers } from '@windy/Renderer.d';
9
+ import type { WeatherParameters } from '@windy/interfaces.d';
10
+ import type { Levels, Products } from '@windy/rootScope.d';
11
+ import type { Timestamp } from '@windy/types';
12
+ type LayerInitParams = Pick<Layer, 'ident'> & Partial<Layer>;
13
+ export declare class Layer<M extends Metric | undefined = Metric | undefined> {
14
+ /**
15
+ * Colors instance(s) used for this overlay
16
+ */
17
+ c: Color;
18
+ /**
19
+ * Metric instances used for this overlay
20
+ */
21
+ m: M extends Metric ? M : undefined;
22
+ /**
23
+ * Alternative legend
24
+ */
25
+ l?: Legend;
26
+ /**
27
+ * Layer identifier (used for metric settings) since some overlays are just pointers to
28
+ * other overlays, identifier can be same for more overlays.
29
+ */
30
+ ident: Layers;
31
+ /**
32
+ * Standard renderer ident
33
+ */
34
+ renderer: Renderers;
35
+ /**
36
+ * If set replaces overlay as filename for particular file path
37
+ */
38
+ filename?: string;
39
+ /**
40
+ * If true applies "sea" class to body tag which influencess way, the globe is displayed
41
+ */
42
+ sea: boolean;
43
+ /**
44
+ * If defined overwrites data precision quality of product
45
+ */
46
+ dataQuality: DataQuality;
47
+ /**
48
+ * If set overrides file suffix of product
49
+ */
50
+ fileSuffix: FileSuffix;
51
+ /**
52
+ * Blue channel defines transparency
53
+ */
54
+ JPGtransparency: boolean;
55
+ /**
56
+ * PNG file with defined transparency
57
+ */
58
+ PNGtransparency?: boolean;
59
+ /**
60
+ * Overrides product's maxTileZoom
61
+ */
62
+ maxTileZoom?: {
63
+ free: number;
64
+ premium: number;
65
+ };
66
+ /**
67
+ * These properties are passed directlly to renderer
68
+ */
69
+ renderParams: RenderParams;
70
+ /**
71
+ * Overrides param's product
72
+ */
73
+ product?: Products;
74
+ /**
75
+ * Overrides products or params levels
76
+ */
77
+ levels: Levels[];
78
+ /**
79
+ * Optional quary string that enhances query string
80
+ */
81
+ query?: string;
82
+ /**
83
+ * webGL transformation
84
+ */
85
+ wTransformR?: number | 'rainLog';
86
+ /**
87
+ * What is this? webGL or Globe hasParticles?
88
+ */
89
+ hasParticles?: boolean;
90
+ /**
91
+ * Metrics to use in color settings
92
+ * If users opts to change colors of this layer, use this metrics
93
+ */
94
+ cm?: Metric;
95
+ /**
96
+ * Overwrite's products pathgenerator
97
+ */
98
+ pathGenerator?: string;
99
+ /**
100
+ * Method to transfrom value in R channel
101
+ */
102
+ transformR?: TransformFunction;
103
+ /**
104
+ * Method to transfrom value in G channel
105
+ */
106
+ transformG?: TransformFunction;
107
+ /**
108
+ * Method to transfrom value in B channel
109
+ */
110
+ transformB?: TransformFunction;
111
+ constructor(params: LayerInitParams);
112
+ /**
113
+ * Just calls Color's getColor() method
114
+ */
115
+ getColor(): ReturnType<Color['getColor']>;
116
+ /**
117
+ * getColor for layers, with mutliple colors (like rainClouds)
118
+ */
119
+ getColor2?(): ReturnType<Color['getColor']>;
120
+ /**
121
+ * Just call Product's open and return its Calendar
122
+ */
123
+ getCalendar(prodIdent: Products): ReturnType<Product['open']>;
124
+ /**
125
+ * Creates RenderingParameters
126
+ */
127
+ getParams(weatherParams: WeatherParameters, productIdent: Products, timestamp?: Timestamp, refTime?: string): Promise<FullRenderParameters>;
128
+ /**
129
+ * Return amounts of dots, based on rain
130
+ */
131
+ getAmountByColor?(Rf: number, Gf: number): 0 | 1 | 2 | 3 | 4;
132
+ protected initProperties(): void;
133
+ }
134
+ export declare class WaveLayer extends Layer<NumberedMetric> {
135
+ initProperties(): void;
136
+ }
137
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare class Legend {
2
+ el: HTMLDivElement;
3
+ constructor(el: HTMLDivElement);
4
+ onclick(): void;
5
+ render(): void;
6
+ }
@@ -0,0 +1,21 @@
1
+ import type { HapticsPlugin } from '@capacitor/haptics';
2
+ export type LongTapInitParams = Pick<LongTap, 'el'> & {
3
+ useHaptics?: boolean;
4
+ onClick?(e: MouseEvent | TouchEvent): void;
5
+ onLongTap?(ev: MouseEvent | TouchEvent): void;
6
+ };
7
+ export declare class LongTap {
8
+ el: HTMLElement;
9
+ useHaptics: boolean;
10
+ haptics: HapticsPlugin | null;
11
+ timer: ReturnType<typeof setTimeout> | null;
12
+ longPressed: boolean;
13
+ constructor(params: LongTapInitParams);
14
+ onClick(_e: MouseEvent | TouchEvent): void;
15
+ onLongTap(_e: MouseEvent | TouchEvent): void;
16
+ onCLickPressed(e: MouseEvent | TouchEvent): void;
17
+ longTapPressed(e: TouchEvent): void;
18
+ touchStart(e: TouchEvent): void;
19
+ touchEnd(): void;
20
+ clearLongPressTimer(): void;
21
+ }
@@ -0,0 +1,132 @@
1
+ import type { Color } from '@windy/Color';
2
+ import type { RGBString } from '@windy/Color.d';
3
+ import type { ConvObj, Legend, LegendDescription, LegendLines, MetricIdent, MetricInitParams, MetricItem, MetricKey } from '@windy/Metric.d';
4
+ import type { LoadedTranslations } from '@windy/trans.d';
5
+ import type { HTMLString, NumValue } from '@windy/types.d';
6
+ export declare const rtrnSelf: (x: NumValue) => NumValue;
7
+ /**
8
+ * # @windy/Metric
9
+ *
10
+ * Major Windy class for conversion of units, that are used in Windy.com.
11
+ *
12
+ * Enjoy methods like `convertValue`, `convertNumber`, `listMetrics`, `howManyMetrics`
13
+ *
14
+ * Never ever, change users selected metric without their consent.
15
+ */
16
+ export declare abstract class Metric<T extends string | number = string | number> {
17
+ /**
18
+ * Identifies metric
19
+ */
20
+ ident: MetricIdent;
21
+ /**
22
+ * Store key
23
+ */
24
+ key: MetricKey;
25
+ /**
26
+ * Actually selected metric
27
+ */
28
+ metric: MetricItem;
29
+ /**
30
+ * Conversion functions
31
+ */
32
+ conv: ConvObj;
33
+ /**
34
+ * number ' ' metric separator
35
+ */
36
+ separator: '' | ' ';
37
+ /**
38
+ * Default metric for start-up
39
+ * [ metric, imperial, ??? ]
40
+ */
41
+ defaults: MetricItem[];
42
+ /**
43
+ * Sync the metric to native iOS/Android apps
44
+ */
45
+ nativeSync: boolean;
46
+ /**
47
+ * Legend description
48
+ */
49
+ description: LegendDescription;
50
+ /**
51
+ * Array defining how the legend will look like
52
+ */
53
+ lines: LegendLines;
54
+ /**
55
+ * Keeps cohesion in between multiple metric instances. For example setting `in`
56
+ * in rain will set `in` in snow also
57
+ */
58
+ cohesion?: {
59
+ [ident in MetricIdent]?: {
60
+ [unit in MetricItem]?: MetricItem;
61
+ };
62
+ };
63
+ /**
64
+ * Some metrics have discrete legend.
65
+ * If so, these labels define it, where NumValue is numerical value, to grab color from color table
66
+ */
67
+ discreteLegend?: {
68
+ /**
69
+ * Should all items in legend have same width?
70
+ */
71
+ hasEqualItemsWidth?: boolean;
72
+ /**
73
+ * Array of trans strings and clored string.
74
+ *
75
+ * For simplicity of sloution, the legned colors are hardcoded
76
+ * thus they do not react on 'users' defined color. This will
77
+ * be know bug and we will not handle this case.
78
+ */
79
+ labels: [keyof LoadedTranslations, RGBString][];
80
+ };
81
+ /**
82
+ * Colors used to render discrete legend
83
+ * @param params
84
+ */
85
+ constructor(params: MetricInitParams);
86
+ onMetricChanged(metric: MetricItem): void;
87
+ getDefault(): MetricItem;
88
+ setDefault(): void;
89
+ /**
90
+ * get value + label on a basis of user selected metric
91
+ */
92
+ convertValue(value: NumValue, separator?: string, suffix?: string): string;
93
+ /**
94
+ * Not available
95
+ */
96
+ na(): string | '-';
97
+ /**
98
+ * produces converted number value without label
99
+ */
100
+ abstract convertNumber(value: NumValue, forcedPrecision?: number, metric?: MetricItem): T;
101
+ /**
102
+ * List all avail metrics
103
+ */
104
+ listMetrics(): MetricItem[];
105
+ /**
106
+ * How many metrics we have
107
+ */
108
+ howManyMetrics(): number;
109
+ /**
110
+ * Stores required metric into storage
111
+ */
112
+ setMetric(metric: MetricItem, uiIdent?: string): void;
113
+ /**
114
+ * Cycles throu different metrics (for example after clicking on a legend)
115
+ */
116
+ cycleMetric(uiIdent?: string): void;
117
+ /** color object is required for classic gradient metrics, discrete ones do not need it as colors are hardcoded for them */
118
+ renderLegend(col: Color | undefined, el: HTMLDivElement, legend: Legend): void;
119
+ /**
120
+ * Renders colorfull legent onto the el
121
+ */
122
+ renderGradientLegend(col: Color | undefined, el: HTMLDivElement, legend: Legend): {
123
+ background: string;
124
+ content: HTMLString;
125
+ } | null;
126
+ renderDiscreteLegend(): {
127
+ background: '';
128
+ content: HTMLString;
129
+ };
130
+ protected initProperties(): void;
131
+ private _createKey;
132
+ }