@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,1727 @@
1
+ /**
2
+ * Main Windy interfaces
3
+ */
4
+ import { Weekday } from '@windy/Calendar.d';
5
+ import { ExtendedTileParams } from '@windy/DataTiler.d';
6
+ import { FullRenderParameters } from '@windy/Layer.d';
7
+ import { Particles } from '@windy/Particles';
8
+ import { PluginsOpenParams, type PluginsQsParams } from '@windy/plugin-params.d';
9
+ import { Plugins } from '@windy/plugins.d';
10
+ import {
11
+ AcTimes,
12
+ Isolines,
13
+ Levels,
14
+ Overlays,
15
+ PointProducts,
16
+ Products,
17
+ SupportedLanguages,
18
+ } from '@windy/rootScope.d';
19
+ import {
20
+ BatteryPreferences,
21
+ CapAlertInfo,
22
+ CapAlertSeverity,
23
+ CapAlertType,
24
+ DetailDisplayType,
25
+ DetailRows,
26
+ Directions,
27
+ FavType,
28
+ GoogleServicesPreferences,
29
+ GpsPreferences,
30
+ HTMLString,
31
+ ISODateString,
32
+ LocationPrefecernces,
33
+ MeteogramLayers,
34
+ MeteogramLevels,
35
+ NoticicationPrefecernces,
36
+ NumOrNull,
37
+ NumValue,
38
+ Path,
39
+ Pixel,
40
+ Platform,
41
+ SearchType,
42
+ StationOrPoiType,
43
+ Timestamp,
44
+ WidgetNotificationPreferences,
45
+ YearMonthDay,
46
+ } from '@windy/types.d';
47
+ import { ClientMessage } from '@plugins/offline/offline';
48
+
49
+ export interface ExportedObj {
50
+ default?: unknown;
51
+ }
52
+
53
+ /**
54
+ * Major LatLon object
55
+ *
56
+ * WARNING & TODO: Although lat, lons should be numbers we use them in
57
+ * client as string. It is probablly result of URL parmaeters parsing
58
+ * or result of @method normalizeLatLon in @module utils.
59
+ *
60
+ * NOTE: Leaflet uses { lat, lng }, what about unification?
61
+ */
62
+ export interface LatLon {
63
+ /**
64
+ * Suprisinlly in client we use it as a string sometimes
65
+ */
66
+ lat: number;
67
+
68
+ /**
69
+ * Suprisinlly in client we use it as a string sometimes
70
+ */
71
+ lon: number;
72
+ }
73
+
74
+ export interface Coords extends LatLon {
75
+ zoom: number;
76
+ }
77
+
78
+ export interface PickerCoords extends LatLon {
79
+ zoom?: number;
80
+ noEmit?: boolean;
81
+ }
82
+
83
+ export interface BcastHistory {
84
+ ts: Timestamp;
85
+ txt: string;
86
+ }
87
+
88
+ export interface GeolocationInfo extends LatLon {
89
+ source: 'fallback' | 'gps' | 'ip' | 'meta' | 'api' | 'last';
90
+ zoom?: number;
91
+ cc?: string;
92
+ name?: string;
93
+
94
+ /**
95
+ * Time of last update
96
+ */
97
+ ts: Timestamp;
98
+ }
99
+
100
+ /**
101
+ * TODO: This is basically copied favorite
102
+ */
103
+ export interface HomeLocation extends LatLon {
104
+ title: string;
105
+ updated?: string;
106
+ }
107
+
108
+ export interface Alert {
109
+ /**
110
+ * Is alert temporarily disabled (true) or not (false)
111
+ */
112
+ suspended: boolean;
113
+
114
+ /**
115
+ * If email alerts are active, address where to send an alert
116
+ */
117
+ email?: string;
118
+
119
+ /**
120
+ * Since client v29 we moved to Capacitor and new backend notification pusher had to be used.
121
+ * This is filled by client to recognize which pusher should be used.
122
+ */
123
+ version?: number;
124
+
125
+ /**
126
+ * Wind conditions for the alert
127
+ */
128
+ wind: {
129
+ active: boolean;
130
+ min: number;
131
+ max: number;
132
+ directions: Directions[];
133
+ };
134
+
135
+ /**
136
+ * Swell conditions for the alert
137
+ */
138
+ swell: Alert['wind']; // same as wind
139
+
140
+ /**
141
+ * Snow conditions for the alert
142
+ */
143
+ snow: {
144
+ active: boolean;
145
+ min: number;
146
+ };
147
+
148
+ /**
149
+ * Rain conditions for the alert.
150
+ * WARNING: This is the only option which is missing for some items in DB
151
+ */
152
+ rain: {
153
+ active: boolean;
154
+ min: number;
155
+ hours: 3 | 6 | 12 | 24 | 48;
156
+ };
157
+
158
+ /**
159
+ * Temperature conditions for the alert
160
+ */
161
+ temp: {
162
+ active: boolean;
163
+ min: number;
164
+ max: number;
165
+ weather: ('OVC' | 'BKN' | 'FEW' | 'SKC')[];
166
+ };
167
+
168
+ /**
169
+ * Time and terms conditions for the alert
170
+ */
171
+ time: {
172
+ active: boolean;
173
+ occurence: number;
174
+ days: ('mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun')[];
175
+ hours: ('00' | '03' | '06' | '09' | '12' | '15' | '18' | '21')[];
176
+ };
177
+
178
+ /**
179
+ * Model conditions for the alert
180
+ * WARNING: This had been disabled in favor of ECMWF, but some old alerts still use GFS. Backend needs this value so it is presented in all alerts.
181
+ */
182
+ model: {
183
+ active: boolean;
184
+ model: 'ecmwf' | 'gfs';
185
+ };
186
+
187
+ /**
188
+ * Which lang shoud be used for the alert (en is default)
189
+ */
190
+ lang?: string;
191
+
192
+ /**
193
+ * Time zone offset of the user. It is used to send the alert in the midday
194
+ */
195
+ userTZoffset?: number;
196
+
197
+ /**
198
+ * Which metrics shoud be used for the alert
199
+ */
200
+ metrics?: {
201
+ wind: string; // TODO - improve with correct types after metrics refactor
202
+ temp: string; // TODO - improve with correct types after metrics refactor
203
+ waves: string; // TODO - improve with correct types after metrics refactor
204
+ rain: string; // TODO - improve with correct types after metrics refactor
205
+ snow: string; // TODO - improve with correct types after metrics refactor
206
+ };
207
+
208
+ // TODO - check if these properties really exist in DB or are added in client
209
+ tzName?: string;
210
+ utcOffset?: number;
211
+ }
212
+
213
+ export interface AlertProps {
214
+ /**
215
+ * Timestamps when the alert is active
216
+ */
217
+ timestamps: Timestamp[];
218
+
219
+ /**
220
+ * Timestamp where the state of the alert has been checked on server last time
221
+ */
222
+ checked: Timestamp;
223
+
224
+ // TODO - it seems it is not use anywhere, remove?
225
+ seen: number;
226
+
227
+ /** Whether alert is active (true) or not (false) */
228
+ triggered: boolean;
229
+
230
+ /** Weather alert is temporarily disabled (true) or not (false) */
231
+ suspended?: boolean;
232
+ }
233
+
234
+ export interface Fav extends LatLon {
235
+ /** Unique ID of item */
236
+ id: string;
237
+
238
+ /* How many times was this item hit/used */
239
+ counter?: number;
240
+
241
+ /** Title of item */
242
+ title: string;
243
+
244
+ /** OBSOLETE DEPRACATED. Name was used till 2019, all should be refactored to `title` if it is safe */
245
+ name?: string;
246
+
247
+ /** Unique invented key, for access */
248
+ key?: string;
249
+
250
+ /** Type of item */
251
+ type: FavType | SearchType;
252
+
253
+ /** Airport ICAO code in case of airport */
254
+ icao?: string;
255
+
256
+ /** Weather station ID (if WX station) */
257
+ stationId?: string;
258
+
259
+ /** Webcam ID in case of webcam */
260
+ webcamId?: number;
261
+
262
+ /** For saved routes */
263
+ route?: string;
264
+ }
265
+
266
+ /** Search result payload as received from backend */
267
+ export interface SearchResult extends Fav {
268
+ /** Localized Search result */
269
+ title: string;
270
+
271
+ /** Type of item */
272
+ type: SearchType;
273
+
274
+ /** Localized, human readable country name */
275
+ country?: string | null;
276
+
277
+ /** Lowercase ISO-2 CC */
278
+ cc?: string;
279
+
280
+ /** Localized, human readable region */
281
+ region?: string | null;
282
+
283
+ /** Localized, human readable state */
284
+ state?: string;
285
+
286
+ /** Stringified bounds of found item for case of island, country etc */
287
+ bounds?: string;
288
+
289
+ /**
290
+ * Added properties for purpose of recent searches
291
+ */
292
+
293
+ /** Creation date */
294
+ timestamp?: Timestamp;
295
+
296
+ /** Search query under which was item stored to recents */
297
+ query?: string;
298
+ }
299
+
300
+ export interface HttpSearchPayload {
301
+ header: {
302
+ type: 'search' | 'coordinates' | 'query-error' | '2airports';
303
+ };
304
+ data: SearchResult[];
305
+ }
306
+
307
+ export interface SavedFav extends Fav {
308
+ /** Title of item */
309
+ title: string;
310
+
311
+ /** Unique invented key, for access */
312
+ key: string;
313
+
314
+ /** Type of item */
315
+ type: FavType;
316
+
317
+ /** Alert settings (conditions, properties, ...) if any */
318
+ alert?: Alert;
319
+
320
+ /** Basic info about alert if any */
321
+ alertProps?: AlertProps;
322
+
323
+ /**
324
+ * Query params of the route needed for creating the route again
325
+ *
326
+ * @example car/50.43,21.49;48.14,20.61;49.18,21.41
327
+ */
328
+ route?: string;
329
+
330
+ /**
331
+ * Timestamp when the item has been updated for the last time. It is used for updating items on all devices (the most up-to-date wins)
332
+ */
333
+ updated?: Timestamp;
334
+
335
+ overflowed?: boolean;
336
+
337
+ /** DEPRACATED !!! Use `title` instead. This property is presented only because of in localstorage saved old favs compatibility. */
338
+ name?: string;
339
+ /** Used for alerts to open slider on active timestamp */
340
+ moveToTimestamp?: boolean;
341
+ }
342
+
343
+ export interface UpcomingFav extends Fav {
344
+ // TODO - is it necessary? Isn't just some migration deprecated stuff?
345
+ name?: string;
346
+
347
+ /** Type of item */
348
+ type: FavType;
349
+
350
+ // TODO - is it necessary? Can unsaved fav has a route property?
351
+ route?: string;
352
+
353
+ // TODO - is it necessary? Can unsaved fav has an alert property?
354
+ alert?: Alert;
355
+
356
+ // TODO - is it necessary? Can unsaved fav has an updated property?
357
+ updated?: Timestamp;
358
+ }
359
+
360
+ export interface SavedAlertFav extends UpcomingFav {
361
+ _id?: string;
362
+ alert: Alert;
363
+ }
364
+
365
+ export interface WeatherParameters {
366
+ overlay: Overlays;
367
+ acTime: AcTimes;
368
+ level: Levels;
369
+ isolines: Isolines;
370
+ path: Path;
371
+ product: Products;
372
+ }
373
+
374
+ export interface InputTarget extends EventTarget {
375
+ value: string;
376
+ }
377
+
378
+ export interface HTMLInputElementKeyEvent extends KeyboardEvent {
379
+ target: InputTarget;
380
+ }
381
+
382
+ /**
383
+ * Last device info sent to backend for purpose of pushNotifications
384
+ */
385
+ export interface LastSentDevice {
386
+ deviceID: string;
387
+ platform: string;
388
+ target: string;
389
+ version: string;
390
+ deactivated?: boolean;
391
+ updated?: number;
392
+ screen?: {
393
+ width: number;
394
+ height: number;
395
+ devicePixelRatio: number;
396
+ };
397
+ registrationHash?: string;
398
+ notifPluginVersion?: 1 | 2;
399
+ }
400
+
401
+ export interface Bounds {
402
+ west: number;
403
+ east: number;
404
+ north: number;
405
+ south: number;
406
+ }
407
+
408
+ /**
409
+ * Leflet's tilePoint
410
+ */
411
+ export interface TilePoint {
412
+ x: number;
413
+ y: number;
414
+ z: number;
415
+ }
416
+
417
+ /**
418
+ * Celestial object as received from backend
419
+ */
420
+ export interface Celestial {
421
+ /**
422
+ * Time zone abbreviation (for instance CEST)
423
+ */
424
+ TZabbrev: string;
425
+
426
+ /**
427
+ * Time zone name (for instance 'Europe/Luxemburg)
428
+ */
429
+ TZname: string;
430
+
431
+ /**
432
+ * TZ offset in hours
433
+ */
434
+ TZoffset: number;
435
+
436
+ /**
437
+ * TZ offset nicely formatted
438
+ */
439
+ TZoffsetFormatted: string;
440
+
441
+ /**
442
+ * TZ offset in minutes
443
+ */
444
+ TZoffsetMin: number;
445
+
446
+ /**
447
+ * Type of TZ type t..terrestial, n..nautical
448
+ */
449
+ TZtype: 't' | 'n';
450
+
451
+ /**
452
+ * Determines propability if the location is at sea or not as number from 1..0
453
+ */
454
+ atSea: number;
455
+
456
+ /**
457
+ * Formatted time of dusk
458
+ */
459
+ dusk: `${number}:${number}`;
460
+ duskTs: Timestamp;
461
+
462
+ /**
463
+ * Current time is night or not
464
+ */
465
+ isDay: boolean;
466
+
467
+ /**
468
+ * When the night starts
469
+ */
470
+ night: ISODateString;
471
+
472
+ /**
473
+ * Monet when, the data object was creted (for check of being obsolete)
474
+ */
475
+ nowObserved: ISODateString;
476
+
477
+ sunrise: `${number}:${number}`;
478
+ sunriseTs: Timestamp;
479
+ sunset: `${number}:${number}`;
480
+ sunsetTs: Timestamp;
481
+ }
482
+
483
+ /**
484
+ * Summary day as received from backend
485
+ */
486
+ export interface SummaryDay {
487
+ /**
488
+ * Identifier of the day
489
+ */
490
+ date: YearMonthDay;
491
+
492
+ /**
493
+ * Day of the molnth (starting with 1)
494
+ */
495
+ day: number;
496
+
497
+ /**
498
+ * Weather icon identifier (legacy version)
499
+ */
500
+ icon: number;
501
+
502
+ /**
503
+ * Weather icon identifier
504
+ */
505
+ icon2: number;
506
+
507
+ /**
508
+ * At which index, in the data table, the day starts
509
+ */
510
+ index: number;
511
+
512
+ /**
513
+ * How many segments, in the data table, the forecast has
514
+ */
515
+ segments: number;
516
+
517
+ /**
518
+ * Max temp in K
519
+ */
520
+ tempMax: NumValue;
521
+
522
+ /**
523
+ * Min temp in K
524
+ */
525
+ tempMin: NumValue;
526
+
527
+ /**
528
+ * Timestamp of midnight when the segment starts
529
+ */
530
+ timestamp: Timestamp;
531
+
532
+ /**
533
+ * Translation string for weekday
534
+ */
535
+ weekday: Weekday;
536
+
537
+ /**
538
+ * Mean/Average Wind force
539
+ */
540
+ wind: NumValue;
541
+
542
+ /**
543
+ * Prevailing wind direction
544
+ */
545
+ windDir: NumValue;
546
+
547
+ /**
548
+ * CAP Alert warning identifier as teo letter designstor
549
+ */
550
+ warning?: string;
551
+ }
552
+
553
+ /**
554
+ * Weather data object as received from backend (compacted version)
555
+ */
556
+ export interface SummaryDataHash {
557
+ /**
558
+ * Precip amount
559
+ */
560
+ mm: NumValue[];
561
+
562
+ /**
563
+ * Is the preciptitaion in a form fo snow?
564
+ */
565
+ snow: (1 | 0)[];
566
+
567
+ /**
568
+ * Temp in K
569
+ */
570
+ temp: NumValue[];
571
+
572
+ /**
573
+ * Timestamp of beginning of segment
574
+ */
575
+ ts: Timestamp[];
576
+
577
+ /**
578
+ * Wind force
579
+ */
580
+ wind: NumValue[];
581
+ }
582
+
583
+ export interface IsDay {
584
+ /**
585
+ * Is the segment day/night or sunrise/sunset as 0,1 or day/night ratio
586
+ */
587
+ isDay: (0 | 1 | number)[];
588
+ }
589
+
590
+ /**
591
+ * Weather data object as received from backend (full version)
592
+ */
593
+
594
+ export interface DataHash extends SummaryDataHash, IsDay {
595
+ /**
596
+ * Day identifier
597
+ */
598
+ day: YearMonthDay[];
599
+
600
+ /**
601
+ * Feeling temperature
602
+ */
603
+ feelTemp?: NumValue[];
604
+
605
+ /**
606
+ * Wind gust
607
+ */
608
+ gust: NumValue[];
609
+
610
+ /**
611
+ * Local Time hour for given place in 24h format
612
+ */
613
+ hour: number[];
614
+
615
+ /**
616
+ * Weather icon identifier (legacy version)
617
+ */
618
+ icon: number[];
619
+
620
+ /**
621
+ * Weather icon identifier
622
+ */
623
+ icon2: number[];
624
+
625
+ /**
626
+ * Moon phase icon identifier
627
+ */
628
+ moonPhase: number[];
629
+
630
+ /**
631
+ * Date of segment beggining
632
+ */
633
+ origDate: ISODateString[];
634
+
635
+ /**
636
+ * TS of segment beggining (seems same as ts)
637
+ */
638
+ origTs: Timestamp[];
639
+
640
+ /**
641
+ * ?????
642
+ */
643
+ //precipitation: NumValue[];
644
+
645
+ /**
646
+ * Surface air pressure
647
+ */
648
+ pressure: NumValue[];
649
+
650
+ /**
651
+ * Relative humidity
652
+ */
653
+ rh: NumValue[];
654
+
655
+ /**
656
+ * Is the forecasted precipitation rain?
657
+ */
658
+ rain: (0 | 1)[];
659
+
660
+ /**
661
+ * ????
662
+ */
663
+ //snowFraction: NumValue[];
664
+
665
+ /**
666
+ * Amount of snow precipitation
667
+ */
668
+ snowPrecip: NumValue[];
669
+
670
+ /**
671
+ * Amount of convective precipitation
672
+ */
673
+ convPrecip?: NumValue[];
674
+
675
+ /**
676
+ * Weather code, that explains used weather icon
677
+ */
678
+ weathercode: string[];
679
+
680
+ /**
681
+ * Wind direction
682
+ */
683
+ windDir: NumValue[];
684
+
685
+ /**
686
+ * Dew point
687
+ */
688
+ dewPoint: NumValue[];
689
+
690
+ /**
691
+ * CAP warnings as a string /^[MSE][Type]/
692
+ * can be easilly typed later on
693
+ */
694
+ warnings?: string[];
695
+
696
+ /**
697
+ * Cloud base
698
+ */
699
+ cbase?: NumValue[];
700
+
701
+ /**
702
+ * These properties are prosent, onoy in certail modelsin the sea or nearby of sea
703
+ */
704
+ swell?: NumValue[];
705
+ swellDir?: NumValue[];
706
+ swellPeriod?: NumValue[];
707
+
708
+ swell1?: NumValue[];
709
+ swell1Dir?: NumValue[];
710
+ swell1Period?: NumValue[];
711
+
712
+ swell2?: NumValue[];
713
+ swell2Dir?: NumValue[];
714
+ swell2Period?: NumValue[];
715
+
716
+ waves?: NumValue[];
717
+ wavesDir?: NumValue[];
718
+ wavesPeriod?: NumValue[];
719
+
720
+ /**
721
+ * These properties are monkey patched to data table by detail plugin
722
+ * TODO: put in diff type
723
+ */
724
+ [key: `${string}/wind`]: NumValue[];
725
+ [key: `${string}/windDir`]: NumValue[];
726
+ [key: `${string}/gust`]: NumValue[];
727
+
728
+ /**
729
+ * TODO This is ugly. Plugin station renames `mm` to `precip` property just to suit its rendering
730
+ */
731
+ precip?: NumValue[];
732
+
733
+ turbulence?: NumValue[];
734
+ icing?: NumValue[];
735
+ }
736
+
737
+ /**
738
+ * It picks all properties from DataHash which extends type passed to U parameter.
739
+ * Strict means the extension has to be from both sides.
740
+ *
741
+ * @example
742
+ * PickDataHashPropsByType<string[]> = { date: ..., origDate: ..., weathercode: ... };
743
+ * PickDataHashPropsByType<string, false> even with `warnings`, because the could be undefined and undefined does not extend number[]
744
+ */
745
+ export type PickDataHashPropsByType<U, Strict = true> = Pick<
746
+ DataHash,
747
+ {
748
+ [P in keyof Required<DataHash>]: Strict extends true
749
+ ? DataHash[P] extends U
750
+ ? U extends DataHash[P]
751
+ ? P
752
+ : never
753
+ : never
754
+ : U extends DataHash[P]
755
+ ? P
756
+ : never;
757
+ }[keyof DataHash]
758
+ >;
759
+
760
+ /**
761
+ * node-forecast header object
762
+ */
763
+ export interface NodeForecastHeader {
764
+ /**
765
+ * Quality of served data
766
+ */
767
+ cache: 'nearbyHit' | 'proximitiHit' | 'miss';
768
+
769
+ /**
770
+ * Elevation above sea level
771
+ */
772
+ elevation: number;
773
+
774
+ /**
775
+ * Height of something (it is possible, that value is monkey patched from weatherTableRender FIXME:)
776
+ */
777
+ height?: number;
778
+
779
+ /**
780
+ * Data contain info about waves
781
+ */
782
+ hasWaves?: number;
783
+
784
+ /**
785
+ * Number of available days in forecast
786
+ */
787
+ daysAvail?: number;
788
+
789
+ /**
790
+ * Served model
791
+ */
792
+ model: Products;
793
+
794
+ /**
795
+ * Ref time in format "2021-09-11"
796
+ */
797
+ refTime: YearMonthDay;
798
+
799
+ /**
800
+ * Ref time as timestamp
801
+ */
802
+ refTimeOrig: Timestamp;
803
+
804
+ /**
805
+ * Hour model step
806
+ */
807
+ step: 1 | 3;
808
+
809
+ /**
810
+ * Update time of weather model
811
+ */
812
+ update: ISODateString;
813
+
814
+ /**
815
+ * Update time of weather model
816
+ */
817
+ updateTs: Timestamp;
818
+
819
+ /**
820
+ * Some basic celestial stuff (why is it here???)
821
+ */
822
+ sunrise: Timestamp;
823
+ sunset: Timestamp;
824
+ tzName: string;
825
+
826
+ /**
827
+ * Resulted data table consist of two merged models together
828
+ */
829
+ merged: boolean;
830
+
831
+ /**
832
+ * Which model was merged with previous
833
+ */
834
+ mergedModel: Products;
835
+
836
+ /**
837
+ * Human readable merged model name
838
+ */
839
+ mergedModelName: string;
840
+
841
+ /**
842
+ * Ref time of merged model
843
+ */
844
+ mergedModelRefTime: ISODateString;
845
+
846
+ /**
847
+ * [DEPRECATED, use mergedModelStartTs instead] At which table index, merged model starts
848
+ */
849
+ mergedModelStart: number;
850
+
851
+ /**
852
+ * Timestamp where the merged model starts
853
+ */
854
+ mergedModelStartTs: number;
855
+
856
+ /**
857
+ * Elevation of model grid
858
+ */
859
+ modelElevation: number;
860
+
861
+ /**
862
+ * UTC offset in hours
863
+ */
864
+ utcOffset: number;
865
+
866
+ /**
867
+ * Surface sea temperature
868
+ */
869
+ sst?: number;
870
+ }
871
+
872
+ /**
873
+ * Weather data or Summary Weather data JSON as received from node-forecast
874
+ */
875
+ export interface WeatherDataPayload<T extends DataHash | SummaryDataHash> {
876
+ header: NodeForecastHeader;
877
+ celestial: Celestial;
878
+ summary: Record<YearMonthDay, SummaryDay>;
879
+ data: T;
880
+ now?: T extends SummaryDataHash
881
+ ? {
882
+ icon: number;
883
+ temp: NumValue;
884
+ wind: NumValue;
885
+ windDir: NumValue;
886
+ moonPhase: NumValue;
887
+ }
888
+ : never;
889
+ }
890
+
891
+ /**
892
+ * Minimsl rqrd options for RendererWeatherTable
893
+ */
894
+ export interface WeatherTableRenderingOptions {
895
+ /**
896
+ * How to display detail
897
+ */
898
+ display: DetailDisplayType;
899
+
900
+ /**
901
+ * Which rows to render
902
+ */
903
+ rows: DetailRows[];
904
+
905
+ /**
906
+ * 1h or 3h step
907
+ */
908
+ step: 1 | 3;
909
+
910
+ /**
911
+ * Width of each table cell (in pixels)
912
+ */
913
+ tdWidth: Pixel;
914
+
915
+ /**
916
+ * How many days to display
917
+ */
918
+ days: number;
919
+
920
+ /**
921
+ * Size of weather icons
922
+ */
923
+ iconSize: Pixel;
924
+
925
+ /**
926
+ * Array of times, when Alert was triggered
927
+ */
928
+ timestamps?: null | Timestamp[];
929
+
930
+ /**
931
+ * Should we display detail with Z times?
932
+ */
933
+ zuluMode?: boolean;
934
+
935
+ /**
936
+ * Shoud we display 12 or 24h format
937
+ */
938
+ is12hFormat?: boolean;
939
+
940
+ /**
941
+ * Content to put in header of legend
942
+ */
943
+ legendHeaderContent?: string;
944
+
945
+ /**
946
+ * Surface sea temperature if available
947
+ */
948
+ sst?: number;
949
+ }
950
+
951
+ // TS cannot extend from [] syntax, just create proxy type and use it in the next line
952
+ type DetailPluginOpenParams = PluginsOpenParams['detail'];
953
+
954
+ /**
955
+ * Parametrs used for displaying detail (poinr forecast)
956
+ */
957
+ export interface DetailParams extends DetailPluginOpenParams, WeatherTableRenderingOptions {
958
+ display: DetailDisplayType;
959
+ /**
960
+ * Which kind of action led to displaying the detail
961
+ */
962
+ emitter?: 'externalOpen' | 'locationChange';
963
+
964
+ /**
965
+ * Should we display extended 10hours forecast?
966
+ */
967
+ extended: boolean;
968
+
969
+ /**
970
+ * Height of background canvas
971
+ */
972
+ height?: Pixel;
973
+
974
+ /**
975
+ * Required point product
976
+ */
977
+ model: Products;
978
+
979
+ /**
980
+ * Required multiple point products
981
+ * TODO - split to more interfaces, for multimodel and others
982
+ */
983
+ models?: Products[];
984
+
985
+ //source: PluginOpenEventSource;
986
+
987
+ /**
988
+ * Type of POI that was clicked to open detail or was contained in URL on page load
989
+ */
990
+ poiType?: StationOrPoiType;
991
+
992
+ /**
993
+ * POI id that was clicked to open detail or was contained in URL on page load
994
+ */
995
+ id?: string;
996
+
997
+ /**
998
+ * height of temperature bacground canvas
999
+ */
1000
+ tempBgH?: Pixel;
1001
+
1002
+ /**
1003
+ * Always incrementing synchornization number, that enables
1004
+ * to cancel async tasks, if we will have new version of params
1005
+ * available
1006
+ */
1007
+ syncCounter: number;
1008
+ }
1009
+
1010
+ /**
1011
+ * Multimple weather models loaded by multiLoad.ts
1012
+ */
1013
+ export interface MultiLoadPayload {
1014
+ model: PointProducts;
1015
+ fcst: WeatherDataPayload<DataHash>;
1016
+ }
1017
+
1018
+ export type MeteogramDataHash = {
1019
+ [data in `${MeteogramLayers}-${MeteogramLevels}`]: NumValue[];
1020
+ } & {
1021
+ 'gh-surface': null[];
1022
+ hours: Timestamp[];
1023
+ };
1024
+
1025
+ export interface MeteogramDataPayload {
1026
+ header: NodeForecastHeader;
1027
+ celestial: Celestial;
1028
+ data: MeteogramDataHash;
1029
+ }
1030
+
1031
+ /**
1032
+ * Particle animation paramters
1033
+ */
1034
+ export interface ExtendedRenderParams extends ExtendedTileParams, FullRenderParameters {
1035
+ canvas: HTMLCanvasElement;
1036
+
1037
+ /**
1038
+ * Actual instance of particles
1039
+ */
1040
+ partObj: Particles;
1041
+
1042
+ /**
1043
+ * Pointer to dest table
1044
+ */
1045
+ vectors: Float32Array;
1046
+
1047
+ speed2pixel: number;
1048
+ }
1049
+
1050
+ /**
1051
+ * Info about articles, user has already seen
1052
+ */
1053
+ export interface SeenArticle {
1054
+ seen: Timestamp;
1055
+ checked: Timestamp;
1056
+ count: number;
1057
+ }
1058
+
1059
+ /**
1060
+ * How good are observations by this AD or WX station?
1061
+ */
1062
+ export interface ObservationInfo {
1063
+ avgDelayMin: number;
1064
+ avgFreqMin: number;
1065
+ latestObs: ISODateString;
1066
+ records: number;
1067
+ }
1068
+
1069
+ export type ArticleImportances =
1070
+ | 'extreme'
1071
+ | 'severe'
1072
+ | 'moderate'
1073
+ | 'windyAnnounce'
1074
+ | 'forecast'
1075
+ | 'windyTutorial'
1076
+ | 'educational'
1077
+ | 'timeKilling'
1078
+ | 'warning';
1079
+
1080
+ export interface ArticleAuthor {
1081
+ avatar: string;
1082
+ profile: string;
1083
+ reputation: number;
1084
+ username: string;
1085
+ userslug: string;
1086
+ }
1087
+
1088
+ /**
1089
+ * This format is used backend payload for info on HP
1090
+ */
1091
+ export interface ArticleJson {
1092
+ author: ArticleAuthor;
1093
+ coverPhoto: {
1094
+ desc: '' | string;
1095
+ link: '' | string;
1096
+ photo: '' | string;
1097
+ showArticleCover: boolean;
1098
+ src: string;
1099
+ };
1100
+ id: number;
1101
+ importance: ArticleImportances;
1102
+ language: SupportedLanguages;
1103
+ ranking: number;
1104
+ slug: string;
1105
+ subtitle: '' | string;
1106
+ title: string;
1107
+ updated: ISODateString;
1108
+
1109
+ /**
1110
+ * Monkey patched props
1111
+ */
1112
+ count: number;
1113
+ checked: Timestamp | 0;
1114
+ key: string;
1115
+ }
1116
+
1117
+ /**
1118
+ * This format is used backend payload for list of articles
1119
+ */
1120
+ export interface ExtendedArticleJson extends ArticleJson {
1121
+ countries: string | string[] | '';
1122
+ licence: 'cc-by' | 'proprietary';
1123
+ originalAuthor: {
1124
+ name: string | '';
1125
+ link: string | '';
1126
+ };
1127
+ perex: string | '';
1128
+ platform: 'all' | 'ios' | 'android';
1129
+ target: 'all' | 'index' | 'mobile';
1130
+ device: 'all' | 'desktop' | 'mobile';
1131
+ pid: number;
1132
+ published: ISODateString;
1133
+ expire: string;
1134
+ publishedBy: number;
1135
+ tags: string[];
1136
+ expiration: ISODateString;
1137
+ homepage: boolean;
1138
+ type?: 'article' | 'video';
1139
+ }
1140
+
1141
+ /**
1142
+ * This format is used backend payload for particular article in article list
1143
+ */
1144
+ export interface Article extends ExtendedArticleJson {
1145
+ status: 'published' | 'unpublished' | 'expired';
1146
+ upvotes: number;
1147
+ viewcount: number;
1148
+ internalUrl: {
1149
+ url: string;
1150
+ search: string;
1151
+ path: string;
1152
+ internal: boolean;
1153
+ }[];
1154
+ containsTwitter: boolean;
1155
+ video?: string;
1156
+ articleCoverPhoto: {
1157
+ src: string;
1158
+ photo: string;
1159
+ desc: string;
1160
+ link: string;
1161
+ };
1162
+ content: HTMLString;
1163
+ version: string;
1164
+ }
1165
+ export interface ServiceGeoipResponse {
1166
+ country: string;
1167
+ region: `${number}`;
1168
+ eu: '0' | '1';
1169
+ timezone: string;
1170
+ city: string;
1171
+ ll: [number, number];
1172
+ metro: number;
1173
+ area: number;
1174
+ ip: string;
1175
+
1176
+ /**
1177
+ * Deprecated
1178
+ */
1179
+ hash: 'oiurouoweruouoiuou';
1180
+ }
1181
+
1182
+ export interface BillingPluginMinimalProduct {
1183
+ productId: string;
1184
+ isSubscription: boolean;
1185
+ }
1186
+
1187
+ export interface BillingPlugin {
1188
+ /** Retrieves a list of full product data from Apple/Google. This function must be called before making purchases. */
1189
+ getProducts: (opts: { products: BillingPluginMinimalProduct[] }) => Promise<{
1190
+ values: import('@plugins/_shared/subscription-services/subscription-services.d').IAPProduct[];
1191
+ }>;
1192
+
1193
+ /** Buy the one-time product */
1194
+ buy: (opts: {
1195
+ productId: string;
1196
+ }) => Promise<
1197
+ import('@plugins/_shared/subscription-services/subscription-services.d').IAPBuyResponse
1198
+ >;
1199
+
1200
+ /** Buy the subscription */
1201
+ subscribe: (opts: {
1202
+ productId: string;
1203
+ offerToken?: string;
1204
+ }) => Promise<
1205
+ import('@plugins/_shared/subscription-services/subscription-services.d').IAPBuyResponse
1206
+ >;
1207
+
1208
+ /**
1209
+ * This function is only relevant to Android purchases. On Android, you must consume products that you want to let the user purchase multiple times.
1210
+ * All 3 parameters are returned by the buy() or restorePurchases() functions.
1211
+ */
1212
+ consume: (opts: {
1213
+ purchaseToken: string;
1214
+ transactionId: string;
1215
+ productId: string;
1216
+ }) => Promise<void>;
1217
+
1218
+ restorePurchases: () => Promise<{
1219
+ values: string;
1220
+ }>;
1221
+
1222
+ /**
1223
+ * On iOS, you can get the receipt at any moment by calling the getReceipt() function. Note that on iOS the receipt can contain multiple transactions. If successful, the promise returned by this function will resolve to a string with the receipt.
1224
+ * On Android this function will always return an empty string since it's not needed for Android purchases.
1225
+ */
1226
+ getReceipt: () => Promise<string>;
1227
+ }
1228
+
1229
+ export interface TimeLocal {
1230
+ weekday: Weekday;
1231
+ day: string;
1232
+ month: string;
1233
+ year: string;
1234
+ /** '09' */
1235
+ hour: string;
1236
+ }
1237
+
1238
+ export interface CapAlertHeadline {
1239
+ start: Timestamp;
1240
+ end: Timestamp;
1241
+ type: CapAlertType;
1242
+ severity: CapAlertSeverity;
1243
+ headline: string;
1244
+ event: string;
1245
+ startLocal: TimeLocal;
1246
+ endLocal: TimeLocal;
1247
+ }
1248
+
1249
+ export interface CapAlertData extends CapAlertHeadline {
1250
+ id: string;
1251
+ ident: string;
1252
+ info: CapAlertInfo;
1253
+ lat: number;
1254
+ lon: number;
1255
+ areaDesc: string;
1256
+ languages: string[];
1257
+ senderName: string;
1258
+ updated: Timestamp;
1259
+ author: string;
1260
+ certainty: string;
1261
+ }
1262
+
1263
+ export interface CapAlertPayload {
1264
+ version: number;
1265
+ celestial: Celestial;
1266
+ data: CapAlertData[];
1267
+ }
1268
+
1269
+ export interface CapAlertTags {
1270
+ start: Timestamp;
1271
+ end: Timestamp;
1272
+ id: string;
1273
+
1274
+ /**
1275
+ * '-' is an invalid type.
1276
+ * TODO: Client should not get invalid values. Fix it on the server side.
1277
+ */
1278
+ type: CapAlertType | '-';
1279
+ severity: CapAlertSeverity;
1280
+ lat: number;
1281
+ lon: number;
1282
+ info: CapAlertInfo;
1283
+
1284
+ /**
1285
+ * monkey patched prop
1286
+ */
1287
+ x: number;
1288
+
1289
+ /**
1290
+ * monkey patched prop
1291
+ */
1292
+ y: number;
1293
+ }
1294
+
1295
+ type GeometryPoints = [number, number][];
1296
+ type GeometryPolygons = GeometryPoints[];
1297
+
1298
+ export interface CapAlertTile {
1299
+ features: {
1300
+ /**
1301
+ * Array that contains EITHER array of arrays with two elements = GeometryPolygons
1302
+ * f.ex.: [
1303
+ * [
1304
+ * [0, 1],
1305
+ * [2, 3],
1306
+ * ...
1307
+ * ],
1308
+ * ...
1309
+ * ]
1310
+ * OR it is just array of arrays with two element = GeometryPoints
1311
+ * [
1312
+ * [0, 1],
1313
+ * [2, 3],
1314
+ * ...
1315
+ * ],
1316
+ */
1317
+ geometry: GeometryPoints | GeometryPolygons;
1318
+ tags: CapAlertTags;
1319
+ type: number;
1320
+ }[];
1321
+ }
1322
+
1323
+ export interface IsAppleWatchPairedResult {
1324
+ value: boolean;
1325
+ }
1326
+
1327
+ export interface IsAppleWatchCompanionAppIntalledResult {
1328
+ value: boolean;
1329
+ }
1330
+
1331
+ export interface WatchConnectObject {
1332
+ key: string;
1333
+ value: string;
1334
+ }
1335
+
1336
+ export interface WindyWatchPlugin {
1337
+ /**
1338
+ * Returns void, because this method only leave message to system
1339
+ * for sending and returns void, when message is saved, not delivered to watch
1340
+ * @param {WatchConnectObject} arg Object for save
1341
+ */
1342
+ sendDataToWatch(arg: WatchConnectObject): Promise<void>;
1343
+ /**
1344
+ * Watch conditions for the alert
1345
+ */
1346
+ isPaired: () => Promise<IsAppleWatchPairedResult>;
1347
+ isWatchAppInstalled: () => Promise<IsAppleWatchCompanionAppIntalledResult>;
1348
+ addWatchFace: () => Promise<unknown>;
1349
+ }
1350
+
1351
+ export interface WindyServicePlugin {
1352
+ openSettings: () => Promise<void | string>;
1353
+ getLocationPermnissions: () => Promise<LocationPrefecernces>;
1354
+ getNotificationPermnissions: () => Promise<NoticicationPrefecernces>;
1355
+ openApplicationSettings: () => Promise<void | string>;
1356
+ isGpsEnabled: () => Promise<GpsPreferences>;
1357
+ getBatteryUsagePermissions: () => Promise<BatteryPreferences>;
1358
+ openBatterySettings: () => Promise<void>;
1359
+ getGoogleServicesAvailability: () => Promise<GoogleServicesPreferences>;
1360
+ getWidgetNotificationPermissions: () => Promise<WidgetNotificationPreferences>;
1361
+ openWidgetNotificationSettings: () => Promise<void>;
1362
+ getBackgroundLocationPermission: () => Promise<GpsPreferences>;
1363
+ openBackgroundLocationSettings: () => Promise<void>;
1364
+ }
1365
+ /**
1366
+ * A migration tool for transferring old Web View local storage to a new location.
1367
+ * This migration is necessary when the hostname is changed in the native Capacitor configuration.
1368
+ *
1369
+ * "Old" configuration:
1370
+ * - Host: localhost
1371
+ * - Scheme: capacitor (for iOS)
1372
+ *
1373
+ * "New" configuration:
1374
+ * - Host: windy.com
1375
+ * - Scheme: capacitor (for iOS)
1376
+ */
1377
+ export interface WindyMigrationPlugin {
1378
+ /**
1379
+ * Returns the paths to old local storage based on the system. The iOS16 version is preferred if available.
1380
+ */
1381
+ findPathOldLocalStorages(): Promise<{ ios14: string | null; ios16: string | null }>;
1382
+ /**
1383
+ * Checks if at least one old local storage was found.
1384
+ */
1385
+ findOldLocalStorage: () => Promise<{ result: boolean }>;
1386
+ /**
1387
+ * Returns the file and directory structure from '/Libraries/WebKit' on iOS.
1388
+ */
1389
+ getWebKitHierarchy: () => Promise<{ result: [string] }>;
1390
+ /**
1391
+ * Initiates the migration process and natively restarts the app upon successful completion.
1392
+ * Note: This method does not control if the migration was previously done.
1393
+ */
1394
+ migrate: () => Promise<void>;
1395
+ /**
1396
+ * Will return [String:String?]? dictionary from old database
1397
+ */
1398
+ getOldLocalStorageData: () => Promise<[string: string | null] | null>;
1399
+ /**
1400
+ * Returns the timestamp of the latest migration or null if the migration hasn't been executed yet.
1401
+ */
1402
+ lastMigration: () => Promise<{ result: number | null }>;
1403
+ /**
1404
+ * Marks migration as completed and restart WebView from origin
1405
+ */
1406
+ markMigrationCompleted: () => Promise<void>;
1407
+ }
1408
+
1409
+ export interface SocialLoginParams {
1410
+ purpose: string;
1411
+ deviceId: string;
1412
+ clientLang: string;
1413
+ targetMobile: boolean;
1414
+ platform: Platform;
1415
+ redirectUrl: string;
1416
+ }
1417
+
1418
+ /**
1419
+ * Observation Weather Summary used in station plugin
1420
+ */
1421
+ export interface ObservationSummaryRecord {
1422
+ date: YearMonthDay;
1423
+ day: number;
1424
+ end: Timestamp;
1425
+ index: number;
1426
+ segments: number;
1427
+ tempMax: NumOrNull;
1428
+ tempMaxTs: Timestamp;
1429
+ tempMin: NumOrNull;
1430
+ tempMinTs: Timestamp;
1431
+ timestamp: Timestamp;
1432
+ weekday: Weekday;
1433
+ }
1434
+
1435
+ export type ObservationSummaryHash = Record<YearMonthDay, ObservationSummaryRecord>;
1436
+
1437
+ /**
1438
+ * Observation Weather data used in station plugin (so far IMHO used only to render mobile fragment)
1439
+ */
1440
+ export interface ObservationFragmentHash {
1441
+ summary: ObservationSummaryHash;
1442
+ data: {
1443
+ temp: NumOrNull[];
1444
+ wind: NumOrNull[];
1445
+ mm: NumOrNull[];
1446
+ snow: NumOrNull[];
1447
+ };
1448
+ }
1449
+
1450
+ /**
1451
+ * Opening options for Window class
1452
+ */
1453
+ export interface WindowOpeningOptions {
1454
+ /**
1455
+ * Should we open the widnow without animation?
1456
+ */
1457
+ disableOpeningAnimation?: boolean;
1458
+ }
1459
+
1460
+ /**
1461
+ * Closing options for Window class
1462
+ */
1463
+ export interface WindowClosingOptions {
1464
+ /**
1465
+ * Should we close the window without animation?
1466
+ */
1467
+ disableClosingAnimation?: boolean;
1468
+
1469
+ /**
1470
+ * Event that led to closing
1471
+ */
1472
+ ev?: MouseEvent | KeyboardEvent | TouchEvent;
1473
+ }
1474
+
1475
+ /**
1476
+ * Opening parameters for WindowPlugin opening
1477
+ */
1478
+ export interface PluginOpeningOptions<P extends keyof Plugins> extends WindowOpeningOptions {
1479
+ /**
1480
+ * Opening parameters
1481
+ */
1482
+ params?: PluginsOpenParams[P];
1483
+
1484
+ /**
1485
+ * Additional query string passed from URL
1486
+ */
1487
+ qs?: PluginsQsParams[P];
1488
+ }
1489
+
1490
+ /**
1491
+ * Point used in rplanner
1492
+ */
1493
+ export interface RplannerPoint {
1494
+ ident: number;
1495
+ marker: L.Marker;
1496
+ position: L.LatLng;
1497
+ }
1498
+
1499
+ /**
1500
+ * Waypoint used in rplanner
1501
+ */
1502
+ export interface RplannerWaypoint {
1503
+ distance?: number;
1504
+ ident?: number;
1505
+ initialBearing?: number;
1506
+ point: L.LatLng;
1507
+ rads?: {
1508
+ cosInitialBearing: number;
1509
+ cosLat: number;
1510
+ lng: number;
1511
+ sinInitialBearing: number;
1512
+ sinLat: number;
1513
+ };
1514
+ }
1515
+
1516
+ /**
1517
+ * Handy utility to calculate scales (inspired by D3 library)
1518
+ */
1519
+ export interface LinearScale {
1520
+ get: (val: NumValue) => Pixel;
1521
+ invert: (val: NumValue) => Pixel;
1522
+ }
1523
+
1524
+ /**
1525
+ * Main GDPR, privacy or cookie consent object
1526
+ */
1527
+ export interface Consent {
1528
+ /**
1529
+ * Version of the consent user agreed on. Use form 'YYYY/MM'
1530
+ *
1531
+ * If the text on consent window will have to evolve and we will HAVE to show
1532
+ * new version to the user.
1533
+ */
1534
+ version: string;
1535
+
1536
+ /**
1537
+ * Last time when user clicked on YES or NO button
1538
+ */
1539
+ timestamp: Timestamp;
1540
+
1541
+ /**
1542
+ * User agreed on anonymous analytics
1543
+ */
1544
+ analytics: boolean;
1545
+
1546
+ /**
1547
+ * Was the consent explicit or just not required
1548
+ */
1549
+ explicit: boolean;
1550
+ }
1551
+
1552
+ export interface LocationState {
1553
+ url: string;
1554
+ search: string;
1555
+ }
1556
+
1557
+ export interface WindyOfflinePlugin {
1558
+ // startOfflineMode: () => Promise<unknown>;
1559
+ // stopOfflineMode: () => Promise<unknown>;
1560
+ controlReadiness: () => Promise<{ value: boolean }>;
1561
+ // fetchOfflineData: (payload: DownloadPayload) => Promise<unknown>;
1562
+ postMessage: (message: ClientMessage) => Promise<unknown>;
1563
+ addListener: (
1564
+ eventName: 'offlineMessage',
1565
+ callback: (message: { data: string }) => void,
1566
+ ) => void;
1567
+ }
1568
+
1569
+ /**
1570
+ * Main config interface for external plugins
1571
+ * @interface ExternalPluginConfig
1572
+ */
1573
+ export interface ExternalPluginConfig {
1574
+ /**
1575
+ * Name of the plugin, that (in order to separate external and
1576
+ * our internal plugins) MUST contain `windy-plugin-` prefix
1577
+ *
1578
+ * @example 'windy-plugin-hello-world'
1579
+ */
1580
+ name: `windy-plugin-${string}`;
1581
+
1582
+ /**
1583
+ * If set, indicates, that plugin is private and should not be
1584
+ * offered to other users in plugins gallery. Companies and
1585
+ * institutions, can display their sensitive data on Windy.com
1586
+ * without any fear, that their API endpoints will be exposed.
1587
+ */
1588
+ private?: boolean;
1589
+
1590
+ /**
1591
+ * Optional path to be used for routing and displaying of plugin's
1592
+ * path as URL in browser. Must have form of SEO friendly string,
1593
+ * with express.js inspired parameters.
1594
+ *
1595
+ * If defined installed plugins can user access via URL
1596
+ * https://www.windy.com/plugin/hello-world
1597
+ *
1598
+ * @example '/hello-world'
1599
+ * @example '/hello-world/:lat/:lon'
1600
+ * @example '/hello-world/:optional?'
1601
+ */
1602
+ routerPath?: `/${string}`;
1603
+
1604
+ /**
1605
+ * Version of the plugin in semver format.
1606
+ *
1607
+ * @example '1.0.0'
1608
+ */
1609
+ version: string;
1610
+
1611
+ /**
1612
+ * Official title of the plugin, that will be displayed as a browser title,
1613
+ * when plugin will be opened
1614
+ *
1615
+ * @example 'Hello World plugin'
1616
+ */
1617
+ title: string;
1618
+
1619
+ /**
1620
+ * Unicode emoji icon, that will be displayed in plugins gallery
1621
+ * and in menu associated with this plugin
1622
+ *
1623
+ * @example '👋'
1624
+ */
1625
+ icon: string;
1626
+
1627
+ /**
1628
+ * Optional plugin description that will be displayed in plugins gallery
1629
+ *
1630
+ * @example 'This plugin demonstrates capabilities of Windy Plugin System'
1631
+ */
1632
+ description?: string;
1633
+
1634
+ /**
1635
+ * Plugin's author name
1636
+ *
1637
+ * @example 'John Doe (optional company name)'
1638
+ */
1639
+ author: string;
1640
+
1641
+ /**
1642
+ * Location of repository, with source code of the plugin
1643
+ *
1644
+ * @example 'https://github.com/windycom/hello-world-plugin'
1645
+ */
1646
+ repository?: string;
1647
+
1648
+ /**
1649
+ * Optional homepage, where plugin is described in more details
1650
+ *
1651
+ * @example 'https://www.company.com/about-our-plugin
1652
+ */
1653
+ homepage?: string;
1654
+
1655
+ /**
1656
+ * If user can open plugin from context menu on map (RH button mouse click)
1657
+ * so plugin can be opened with lat, lon parameters.
1658
+ */
1659
+ addToContextmenu?: boolean;
1660
+
1661
+ /**
1662
+ * Whether plugin (if opened) want to receive singleclick events
1663
+ * from map.
1664
+ */
1665
+ listenToSingleclick?: boolean;
1666
+
1667
+ /**
1668
+ * Plugin behavior on desktop and tablet devices
1669
+ *
1670
+ * `rhpane` plugins occupy RH pane on desktop, which provides
1671
+ * enormous amount of space, and enables to scroll down, but
1672
+ * results in automatic closing or the plugin, when any other
1673
+ * UI element opens from right side (menu, settings etc...).
1674
+ *
1675
+ * Simply put only one rhpane plugin can be opened at the same time.
1676
+ *
1677
+ * You can use `embedded` position, whose space is limited, but plugin
1678
+ * is embedded into main page and stays open.
1679
+ */
1680
+ desktopUI: 'rhpane' | 'embedded';
1681
+
1682
+ /**
1683
+ * Width of `rhpane` plugin in pixels (default is 400).
1684
+ */
1685
+ desktopWidth?: number;
1686
+
1687
+ /**
1688
+ * Plugin behavior on mobile devices
1689
+ *
1690
+ * `fullscreen` plugin occupies whole screen, while `small` takes only minimum
1691
+ * space on the bottom of the screen.
1692
+ */
1693
+ mobileUI: 'fullscreen' | 'small';
1694
+ }
1695
+
1696
+ export interface CompiledExternalPluginConfig extends ExternalPluginConfig {
1697
+ /**
1698
+ * When was this plugin built
1699
+ */
1700
+ built: Timestamp;
1701
+ builtReadable: ISODateString;
1702
+
1703
+ /**
1704
+ * If the final build contains screenshot, they are stored here
1705
+ */
1706
+ screenshot?: string;
1707
+ }
1708
+
1709
+ /**
1710
+ * Already installed external plugin
1711
+ */
1712
+ export interface InstalledExternalPluginConfig extends CompiledExternalPluginConfig {
1713
+ /**
1714
+ * URL of the plguin is used as unique identifier
1715
+ */
1716
+ url: string;
1717
+
1718
+ /**
1719
+ * From which process was plugin installed
1720
+ */
1721
+ installedBy: 'dev' | 'gallery' | 'url';
1722
+
1723
+ /**
1724
+ * When was this plugin installed by specific user
1725
+ */
1726
+ installed: Timestamp;
1727
+ }