@windycom/plugin-devtools 1.0.9 → 3.0.0

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 (134) hide show
  1. package/README.md +4 -0
  2. package/index.mjs +2 -2
  3. package/package.json +2 -3
  4. package/types/client/AccessProducts.d.ts +8 -0
  5. package/types/client/BottomSveltePlugins.d.ts +8 -0
  6. package/types/client/Calendar.d.ts +9 -17
  7. package/types/client/Color.d.ts +43 -90
  8. package/types/client/Drag.d.ts +8 -1
  9. package/types/client/Evented.d.ts +4 -0
  10. package/types/client/ExternalSveltePlugin.d.ts +2 -1
  11. package/types/client/IDB.d.ts +63 -0
  12. package/types/client/IconProducts.d.ts +2 -0
  13. package/types/client/Layer.d.ts +1 -2
  14. package/types/client/Metric.d.ts +8 -8
  15. package/types/client/MetricClasses.d.ts +4 -3
  16. package/types/client/Overlay.d.ts +30 -15
  17. package/types/client/OverlayClasses.d.ts +11 -7
  18. package/types/client/Plugin.d.ts +2 -2
  19. package/types/client/Product.d.ts +53 -30
  20. package/types/client/RadarPlusProduct.d.ts +19 -0
  21. package/types/client/Renderer.d.ts +2 -10
  22. package/types/client/SveltePanePlugin.d.ts +4 -3
  23. package/types/client/SveltePlugin.d.ts +9 -5
  24. package/types/client/TileLayer.d.ts +1 -2
  25. package/types/client/TopoMap.d.ts +10 -0
  26. package/types/client/Window.d.ts +0 -4
  27. package/types/client/WindowPlugin.d.ts +15 -10
  28. package/types/client/appsFlyer.d.ts +3 -0
  29. package/types/client/baseMap.d.ts +8 -5
  30. package/types/client/cityLabels.d.ts +10 -2
  31. package/types/client/cloudSync.d.ts +3 -1
  32. package/types/client/colorGradients.d.ts +13 -0
  33. package/types/client/d.ts.files/Calendar.d.ts +11 -2
  34. package/types/client/d.ts.files/Color.d.ts +16 -5
  35. package/types/client/d.ts.files/LabelsLayer.d.ts +1 -18
  36. package/types/client/d.ts.files/Layer.d.ts +8 -1
  37. package/types/client/d.ts.files/Metric.d.ts +1 -0
  38. package/types/client/d.ts.files/Renderer.d.ts +22 -1
  39. package/types/client/d.ts.files/alerts.d.ts +120 -0
  40. package/types/client/d.ts.files/broadcast.d.ts +44 -17
  41. package/types/client/d.ts.files/dataSpecifications.d.ts +94 -137
  42. package/types/client/d.ts.files/favs.d.ts +69 -0
  43. package/types/client/d.ts.files/incomingMessages.d.ts +0 -4
  44. package/types/client/d.ts.files/notifications.d.ts +2 -2
  45. package/types/client/d.ts.files/plugin-params.d.ts +44 -58
  46. package/types/client/d.ts.files/plugins.d.ts +37 -52
  47. package/types/client/d.ts.files/pois.d.ts +1 -1
  48. package/types/client/d.ts.files/products.d.ts +19 -2
  49. package/types/client/d.ts.files/rootScope.d.ts +3 -21
  50. package/types/client/d.ts.files/satellite.d.ts +1 -0
  51. package/types/client/d.ts.files/startup.d.ts +59 -0
  52. package/types/client/d.ts.files/storage.d.ts +12 -35
  53. package/types/client/d.ts.files/user.d.ts +79 -24
  54. package/types/client/device.d.ts +0 -1
  55. package/types/client/deviceLogging.d.ts +2 -1
  56. package/types/client/embed2.d.ts +15 -35
  57. package/types/client/fetch.d.ts +31 -24
  58. package/types/client/ga.d.ts +4 -0
  59. package/types/client/geolocation.d.ts +14 -7
  60. package/types/client/globals.d.ts +1 -0
  61. package/types/client/http.d.ts +17 -0
  62. package/types/client/idbInstances.d.ts +45 -0
  63. package/types/client/interpolator.d.ts +2 -1
  64. package/types/client/langFiles.d.ts +2 -0
  65. package/types/client/layers.d.ts +2 -0
  66. package/types/client/lib.d.ts +7 -25
  67. package/types/client/libHtml.d.ts +1 -1
  68. package/types/client/loadArticlesOrWhatsNew.d.ts +1 -0
  69. package/types/client/log.d.ts +1 -0
  70. package/types/client/lruCache.d.ts +6 -0
  71. package/types/client/map.d.ts +17 -6
  72. package/types/client/mobile.d.ts +33 -27
  73. package/types/client/models.d.ts +1 -1
  74. package/types/client/nativeStorage.d.ts +0 -14
  75. package/types/client/notifications.d.ts +32 -67
  76. package/types/client/overlays.d.ts +4 -1
  77. package/types/client/params.d.ts +0 -1
  78. package/types/client/patchAndPromoCtrl.d.ts +13 -0
  79. package/types/client/permanentPromos.d.ts +1 -2
  80. package/types/client/persistentStorage.d.ts +8 -0
  81. package/types/client/picker.d.ts +1 -1
  82. package/types/client/pois.d.ts +1 -2
  83. package/types/client/promo.d.ts +16 -32
  84. package/types/client/pushNotifications.d.ts +13 -1
  85. package/types/client/queryString.d.ts +1 -1
  86. package/types/client/renderUtils.d.ts +1 -1
  87. package/types/client/renderers.d.ts +7 -3
  88. package/types/client/rootScope.d.ts +22 -27
  89. package/types/client/router.d.ts +10 -6
  90. package/types/client/seoParser.d.ts +21 -0
  91. package/types/client/serviceWorkerCtrl.d.ts +8 -0
  92. package/types/client/startupWeather.d.ts +27 -0
  93. package/types/client/store.d.ts +2 -2
  94. package/types/client/storeLastPosition.d.ts +1 -0
  95. package/types/client/subscription.d.ts +1 -0
  96. package/types/client/swDownloader.d.ts +7 -7
  97. package/types/client/swProxy.d.ts +1 -1
  98. package/types/client/swUtils.d.ts +3 -3
  99. package/types/client/trans.d.ts +26 -37
  100. package/types/client/user.d.ts +11 -14
  101. package/types/client/userAlerts.d.ts +68 -0
  102. package/types/client/userConsent.d.ts +6 -0
  103. package/types/client/userFavs.d.ts +46 -128
  104. package/types/client/utils.d.ts +46 -10
  105. package/types/iconfont.d.ts +6 -4
  106. package/types/interfaces.d.ts +199 -348
  107. package/types/lang-files.d.ts +736 -128
  108. package/types/offline.d.ts +100 -0
  109. package/types/types.d.ts +116 -29
  110. package/types/client/Bar.d.ts +0 -114
  111. package/types/client/BindedBar.d.ts +0 -51
  112. package/types/client/BindedCheckbox.d.ts +0 -30
  113. package/types/client/BindedDropDown.d.ts +0 -14
  114. package/types/client/BindedSwitch.d.ts +0 -35
  115. package/types/client/BottomTagPlugin.d.ts +0 -8
  116. package/types/client/Detail1hCheckbox.d.ts +0 -4
  117. package/types/client/DraggableDiv.d.ts +0 -21
  118. package/types/client/DropDown.d.ts +0 -37
  119. package/types/client/GhostBox.d.ts +0 -17
  120. package/types/client/Legend.d.ts +0 -6
  121. package/types/client/LongTap.d.ts +0 -21
  122. package/types/client/MobileCalendar.d.ts +0 -47
  123. package/types/client/OfflineMessagesClasses.d.ts +0 -30
  124. package/types/client/ProductSwitch.d.ts +0 -14
  125. package/types/client/Scrollable.d.ts +0 -14
  126. package/types/client/Switch.d.ts +0 -24
  127. package/types/client/TimestampBar.d.ts +0 -8
  128. package/types/client/Webcams.d.ts +0 -66
  129. package/types/client/d.ts.files/Product.d.ts +0 -37
  130. package/types/client/d.ts.files/trans.d.ts +0 -55
  131. package/types/client/favs.d.ts +0 -83
  132. package/types/client/hp.d.ts +0 -15
  133. package/types/client/offlineController.d.ts +0 -20
  134. /package/types/client/{loadersUI.d.ts → customColors.d.ts} +0 -0
@@ -1,129 +1,47 @@
1
- import { Evented } from '@windy/Evented';
2
- import { Favs } from '@windy/Favs';
3
- import type { FavKey } from '@windy/Favs';
4
- import type { Fav, LatLon, SavedFav, Alert } from '@windy/interfaces.d';
1
+ import type { FavFragment, Fav, FavId } from '@windy/favs.d';
5
2
  import type { Timestamp } from '@windy/types.d';
6
- export type AlertCheckResult = {
7
- status: 'missing';
8
- text: 'Alert not in DB';
9
- } | {
10
- alert: Alert & {
11
- suspended: true;
12
- };
13
- } | {
14
- status: 'ok';
15
- alert: Alert;
16
- timestamps: Timestamp[];
17
- };
18
- interface FavsTypes {
19
- favsChanged: void;
20
- alertsChecked: number | void;
21
- }
22
- declare class SavedFavs extends Favs<SavedFav> {
23
- protected ident: "favs2";
24
- private triggeredAlerts;
25
- private favsMenuOpened;
26
- /**
27
- * Supported types in this version
28
- */
29
- private types;
30
- private overflowedKey;
31
- latestParams: Fav;
32
- on: Evented<FavsTypes>['on'];
33
- off: Evented<FavsTypes>['off'];
34
- emit: Evented<FavsTypes>['emit'];
35
- constructor();
36
- isValidFavourite(item: Fav): boolean;
37
- /**
38
- * Called on detail open or picker move. Always have latest { lat, lon } !!!!
39
- */
40
- update(params: Fav): void;
41
- /**
42
- * Check if object is an alert (or near) and have triggered timestamps
43
- * item = latLonObj or alert id
44
- * returns list of timestamps if triggered
45
- */
46
- hasTimestamps<T extends LatLon | string>(item: T): number[] | null;
47
- /**
48
- * Add favourite
49
- */
50
- add(item: Fav): boolean | Promise<string>;
51
- /**
52
- * Search for an alert either by id or latLon
53
- */
54
- getAlert<T extends LatLon | string>(item: T): SavedFav | undefined;
55
- /**
56
- *
57
- * Return favs as array
58
- */
59
- getArray(deduped?: boolean, editedAlert?: Fav): SavedFav[];
60
- isFreeLimitExceeded(editedAlert?: Fav): boolean;
61
- /**
62
- * Updates CSS info
63
- */
64
- updateCSS(): void;
65
- /**
66
- * Emits info about favs status change
67
- */
68
- emitChange(): void;
69
- /**
70
- * Send updated fav to the server
71
- */
72
- updateFav(fav: Fav): Promise<void>;
73
- rename(fav: SavedFav, name: string): Promise<void>;
74
- remove(passedItem: Fav | FavKey, isAlert?: boolean): Promise<void>;
75
- /**
76
- * Check triggering of single alert (always resolve)
77
- */
78
- checkAlerts(param?: {
79
- newlyAddedId: string;
80
- }): void;
81
- /**
82
- * Called upon inserting/deletion Display all favs on a map. This is VERY unefective method
83
- * that should keep client code small
84
- */
85
- onchange(): void;
86
- reset(): void;
87
- /**
88
- * get list of all overflowed deduplicated favs from store
89
- */
90
- getOverflowed(): SavedFav[];
91
- unstoreOverflowed(): void;
92
- resetOverflowed(): void;
93
- removeOverflowed(fav: Fav): void;
94
- /**
95
- * start to sync some overflowed
96
- */
97
- syncOverflowed(fav: Fav): void;
98
- /**
99
- * Load from cloud
100
- */
101
- private loadFromCloud;
102
- private debouncedUpdate;
103
- /**
104
- * Alert related methods
105
- * item = fav || key
106
- */
107
- private setAlertProps;
108
- private createSyncError;
109
- private checkAlert;
110
- /**
111
- * Alerts were checked
112
- */
113
- private onAlertsChecked;
114
- /**
115
- * Check validity and store fav
116
- */
117
- private checkAndStore;
118
- /**
119
- * set an object as an overflowed favs if none are set already
120
- */
121
- private storeOverflowed;
122
- /**
123
- * add item as overflowed
124
- */
125
- private addOverflowed;
126
- private onUserData;
127
- }
128
- declare const _default: SavedFavs;
129
- export default _default;
3
+ export declare const emitChange: () => void;
4
+ /**
5
+ * Adds a fav to the db
6
+ */
7
+ export declare const add: (item: FavFragment) => Promise<FavId | null>;
8
+ /**
9
+ * Update Fav in the db
10
+ */
11
+ export declare const update: (id: FavId, properties2update: Partial<Fav>) => Promise<FavId | null>;
12
+ /**
13
+ * Remove fav from db
14
+ */
15
+ export declare const remove: (id: FavId) => Promise<void>;
16
+ /**
17
+ * Toggle pinning fav to top or to homepage
18
+ */
19
+ export declare const togglePin: (id: FavId, whereToPin: 'pin2top' | 'pin2homepage', forcedTimestamp?: Timestamp) => Promise<void>;
20
+ /**
21
+ * Find all favs that match given criteria
22
+ */
23
+ export declare const find: (query: Partial<Fav> | ((f: Fav) => boolean)) => Promise<Fav[]>;
24
+ /**
25
+ * Same as find but always returns only the first match
26
+ */
27
+ export declare const findOne: (query: Partial<Fav> | ((f: Fav) => boolean)) => Promise<Fav | undefined>;
28
+ /**
29
+ * Returns all favs as array
30
+ */
31
+ export declare const getAll: () => Promise<Fav[]>;
32
+ /**
33
+ * Quick check if fav with given ids exists
34
+ */
35
+ export declare const isFav: (query: Partial<FavFragment>) => Promise<boolean>;
36
+ /**
37
+ * Toggles fav (adds or removes) from db
38
+ */
39
+ export declare const toggle: (query: Partial<FavFragment>, item: FavFragment) => Promise<boolean>;
40
+ /**
41
+ * Checks if fav exists
42
+ */
43
+ export declare const hasKey: (key: FavId) => Promise<boolean>;
44
+ /**
45
+ * Removes all favs from the device TODO: Call after logging out
46
+ */
47
+ export declare const removeAllFavsFromDevice: () => Promise<void>;
@@ -1,11 +1,10 @@
1
1
  import type { RegistrationError } from '@capacitor/push-notifications';
2
- import type { ClientMessage } from '@plugins/offline/offline';
3
2
  import type { RGBA } from '@windy/Color.d';
4
3
  import type { HttpError } from '@windy/http';
5
4
  import type { QueryStringSource } from '@windy/http.d';
6
5
  import type { LatLon, LinearScale, TilePoint } from '@windy/interfaces.d';
7
6
  import type { RGBNumValues } from '@windy/interpolatorTypes';
8
- import type { HTMLString, Timestamp, ExtendedStationType } from '@windy/types.d';
7
+ import type { ExtendedStationType, HTMLString, NumOrNull, Timestamp } from '@windy/types.d';
9
8
  /**
10
9
  * One minute in ms.
11
10
  *
@@ -18,6 +17,12 @@ export declare const tsMinute: Timestamp;
18
17
  * @type {Timestamp}
19
18
  */
20
19
  export declare const tsHour: Timestamp;
20
+ /**
21
+ * One day in ms.
22
+ *
23
+ * @type {Timestamp}
24
+ */
25
+ export declare const tsDay: Timestamp;
21
26
  /**
22
27
  * Long press time in ms. to be used everywhere
23
28
  */
@@ -36,6 +41,10 @@ export declare const num2char: (num: number) => string;
36
41
  * @returns Number
37
42
  */
38
43
  export declare const char2num: (str: string) => number;
44
+ /**
45
+ * Size of the vector
46
+ */
47
+ export declare const vec2size: (x: number, y: number) => number;
39
48
  /**
40
49
  * Takes {lat,lon} and returns nice string out of it (rounds coords to two decimals)
41
50
  *
@@ -60,6 +69,10 @@ export declare const emptyFun: () => void;
60
69
  * @type {string}
61
70
  */
62
71
  export declare const emptyGIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
72
+ /**
73
+ * Checks if the given object is empty (has no keys).
74
+ */
75
+ export declare const isEmptyObject: (obj: Record<string, unknown>) => obj is Record<string, never>;
63
76
  /**
64
77
  * Check if obj is a valid obj contaning lat,lon
65
78
  * TODO - it returns true also for string coords, but guarding LatLon with only numbered coords!
@@ -109,11 +122,11 @@ export declare const radToDeg = 57.2957795;
109
122
  * leading edge, instead of the trailing.
110
123
  *
111
124
  * @param func Function to debounce
112
- * @param wait Time limit of debouncing
125
+ * @param wailTill Time limit of debouncing
113
126
  * @param immediate Should be function trigger on the leading edge or on the trailing
114
127
  * @returns Debounced function
115
128
  */
116
- export declare const debounce: <Args extends unknown[], F extends (...args: Args) => void>(func: (this: ThisParameterType<F>, ...args: Args & Parameters<F>) => void, wait: number, immediate?: boolean) => (this: ThisParameterType<F>, ...args: Args & Parameters<F>) => void;
129
+ export declare const debounce: <Args extends unknown[], F extends (...args: Args) => void>(func: (this: ThisParameterType<F>, ...args: Args & Parameters<F>) => void, waitTill: number, immediate?: boolean) => (this: ThisParameterType<F>, ...args: Args & Parameters<F>) => void;
117
130
  /**
118
131
  * Retun throttling function
119
132
  *
@@ -154,7 +167,7 @@ export interface WindObject extends DirObject {
154
167
  * @param v Vector [u,v]
155
168
  * @returns Object { wind, dir }
156
169
  */
157
- export declare const wind2obj: (v: [number, number] | RGBNumValues) => WindObject;
170
+ export declare const wind2obj: ([u, v]: [number, number] | RGBNumValues) => WindObject;
158
171
  export interface WaveObject extends DirObject {
159
172
  period: number;
160
173
  size: number;
@@ -165,7 +178,7 @@ export interface WaveObject extends DirObject {
165
178
  * @param v Vector [u,v,size]
166
179
  * @returns Object { wind, dir, period }
167
180
  */
168
- export declare const wave2obj: (v: RGBNumValues) => WaveObject;
181
+ export declare const wave2obj: ([u, v, size]: RGBNumValues) => WaveObject;
169
182
  /**
170
183
  * Trush if wx object has valid direction
171
184
  *
@@ -299,7 +312,7 @@ export declare const qs: (tokensObj: QueryStringSource) => string;
299
312
  * Loads .js file by appendig it as script element appended to the <head> section of the page
300
313
  *
301
314
  * @param {string} url URL of script to be loaded
302
- * @param callback Callback to be called on HTML script element
315
+ * @param callback Callback to be called on HTML script element (WARNING: it is not called on script load)
303
316
  * @returns
304
317
  */
305
318
  export declare const loadScript: (url: string, callback?: (s: HTMLScriptElement) => void) => Promise<void>;
@@ -389,12 +402,11 @@ export declare const sanitizeHTML: (s: string) => string;
389
402
  * @param errObj Whole error object to stringification. It is sent to Kibana under 'error' property
390
403
  */
391
404
  export declare function logError(moduleName: string, msg: string, errorObject?: Error | HttpError | Event | ErrorEvent | RegistrationError): void;
392
- export declare const sendMessageToServiceWorker: (message: ClientMessage) => void;
393
405
  /**
394
406
  * Same as scale linear from d3 library except with different params
395
407
  * https://d3js.org/d3-scale/linear
396
408
  * @param Object { domain: [ ], range: [] }
397
- * @returns Object { get, ivert }
409
+ * @returns Object { get, invert }
398
410
  */
399
411
  export declare const scaleLinear: ({ domain, range, clip, }: {
400
412
  domain: [number, number];
@@ -421,4 +433,28 @@ export declare const wrapCoords: (tilePoint: TilePoint) => TilePoint;
421
433
  * based on target and provided locatio returns URL where to load .js asset
422
434
  * @param location
423
435
  */
424
- export declare const getLoacationOfJsAssets: (location: string) => string;
436
+ export declare const getLocationOfJsAssets: (location: string) => string;
437
+ /**
438
+ * Is valid NumValue
439
+ */
440
+ export declare const isValidNumber: (d: NumOrNull | undefined) => boolean;
441
+ /**
442
+ * Converts C to K
443
+ */
444
+ export declare const c2kelvin: (c: number) => number;
445
+ /**
446
+ * Async version of wait
447
+ */
448
+ export declare const wait: (t: Timestamp) => Promise<void>;
449
+ /**
450
+ * Removes accents and diacritics from string
451
+ * "Crème Brûlée" -> "Creme Brulee"
452
+ * https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript
453
+ * TODO: Use Unicode property escapes when widely supported, currently at 94% at caniuse
454
+ */
455
+ export declare const removeDiacritics: (s: string) => string;
456
+ /**
457
+ * Capitalizes the first letter of a string.
458
+ * This differs from the CSS property which capitalizes the first letter of each word.
459
+ */
460
+ export declare const capitalize: (text: string) => string;
@@ -1,10 +1,7 @@
1
1
  // !!! Automatically generated file by make/iconfont.ts !!!
2
2
 
3
3
  export type Iconfont =
4
- | '<!-- @echo icon-share -->'
5
- | '<!-- @echo icon-bell-plus -->'
6
- | '<!-- @echo icon-x -->'
7
- | '<!-- @echo icon-twitter -->'
4
+ | '<!-- @echo icon-upload -->'
8
5
  | '<!-- @echo icon-long-tap -->'
9
6
  | '<!-- @echo icon-moving-cloud -->'
10
7
  | '<!-- @echo icon-uv -->'
@@ -185,6 +182,11 @@ export type Iconfont =
185
182
  | '<!-- @echo icon-crown-king -->'
186
183
  | '<!-- @echo icon-tide -->'
187
184
  | '<!-- @echo icon-car -->'
185
+ | '<!-- @echo icon-cloud-lightning-big-plus -->'
186
+ | '<!-- @echo icon-share -->'
187
+ | '<!-- @echo icon-bell-plus -->'
188
+ | '<!-- @echo icon-x -->'
189
+ | '<!-- @echo icon-twitter -->'
188
190
  | '<!-- @echo icon-github -->'
189
191
  | '<!-- @echo icon-link -->'
190
192
  | '<!-- @echo icon-plane-snowflake -->'