@windycom/plugin-devtools 2.0.0 → 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 (120) hide show
  1. package/README.md +3 -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/Evented.d.ts +4 -0
  9. package/types/client/ExternalSveltePlugin.d.ts +2 -1
  10. package/types/client/IDB.d.ts +63 -0
  11. package/types/client/IconProducts.d.ts +2 -0
  12. package/types/client/Layer.d.ts +1 -2
  13. package/types/client/Metric.d.ts +8 -8
  14. package/types/client/MetricClasses.d.ts +4 -3
  15. package/types/client/Overlay.d.ts +30 -15
  16. package/types/client/OverlayClasses.d.ts +11 -7
  17. package/types/client/Plugin.d.ts +2 -2
  18. package/types/client/Product.d.ts +40 -29
  19. package/types/client/RadarPlusProduct.d.ts +19 -0
  20. package/types/client/Renderer.d.ts +2 -10
  21. package/types/client/SveltePlugin.d.ts +9 -5
  22. package/types/client/TileLayer.d.ts +1 -2
  23. package/types/client/TopoMap.d.ts +10 -0
  24. package/types/client/WindowPlugin.d.ts +7 -3
  25. package/types/client/appsFlyer.d.ts +3 -0
  26. package/types/client/baseMap.d.ts +8 -5
  27. package/types/client/cityLabels.d.ts +10 -2
  28. package/types/client/cloudSync.d.ts +3 -1
  29. package/types/client/colorGradients.d.ts +13 -0
  30. package/types/client/customColors.d.ts +1 -0
  31. package/types/client/d.ts.files/Calendar.d.ts +11 -2
  32. package/types/client/d.ts.files/Color.d.ts +16 -5
  33. package/types/client/d.ts.files/LabelsLayer.d.ts +1 -18
  34. package/types/client/d.ts.files/Layer.d.ts +8 -1
  35. package/types/client/d.ts.files/Metric.d.ts +1 -0
  36. package/types/client/d.ts.files/Renderer.d.ts +22 -1
  37. package/types/client/d.ts.files/alerts.d.ts +120 -0
  38. package/types/client/d.ts.files/broadcast.d.ts +38 -10
  39. package/types/client/d.ts.files/dataSpecifications.d.ts +81 -122
  40. package/types/client/d.ts.files/favs.d.ts +69 -0
  41. package/types/client/d.ts.files/incomingMessages.d.ts +0 -4
  42. package/types/client/d.ts.files/notifications.d.ts +2 -2
  43. package/types/client/d.ts.files/plugin-params.d.ts +35 -47
  44. package/types/client/d.ts.files/plugins.d.ts +30 -42
  45. package/types/client/d.ts.files/pois.d.ts +1 -1
  46. package/types/client/d.ts.files/products.d.ts +15 -3
  47. package/types/client/d.ts.files/rootScope.d.ts +3 -21
  48. package/types/client/d.ts.files/startup.d.ts +59 -0
  49. package/types/client/d.ts.files/storage.d.ts +12 -35
  50. package/types/client/d.ts.files/user.d.ts +79 -24
  51. package/types/client/deviceLogging.d.ts +2 -1
  52. package/types/client/embed2.d.ts +14 -31
  53. package/types/client/fetch.d.ts +29 -16
  54. package/types/client/ga.d.ts +1 -1
  55. package/types/client/geolocation.d.ts +15 -7
  56. package/types/client/globals.d.ts +1 -0
  57. package/types/client/http.d.ts +17 -0
  58. package/types/client/idbInstances.d.ts +45 -0
  59. package/types/client/langFiles.d.ts +2 -0
  60. package/types/client/layers.d.ts +2 -0
  61. package/types/client/lib.d.ts +7 -21
  62. package/types/client/loadArticlesOrWhatsNew.d.ts +1 -0
  63. package/types/client/log.d.ts +1 -0
  64. package/types/client/lruCache.d.ts +6 -0
  65. package/types/client/map.d.ts +17 -6
  66. package/types/client/mobile.d.ts +28 -20
  67. package/types/client/models.d.ts +1 -1
  68. package/types/client/notifications.d.ts +32 -67
  69. package/types/client/overlays.d.ts +4 -1
  70. package/types/client/params.d.ts +0 -1
  71. package/types/client/permanentPromos.d.ts +1 -1
  72. package/types/client/persistentStorage.d.ts +8 -0
  73. package/types/client/picker.d.ts +1 -1
  74. package/types/client/pois.d.ts +1 -2
  75. package/types/client/promo.d.ts +6 -16
  76. package/types/client/pushNotifications.d.ts +13 -1
  77. package/types/client/queryString.d.ts +1 -1
  78. package/types/client/renderUtils.d.ts +1 -1
  79. package/types/client/renderers.d.ts +7 -3
  80. package/types/client/rootScope.d.ts +14 -23
  81. package/types/client/router.d.ts +9 -5
  82. package/types/client/seoParser.d.ts +21 -0
  83. package/types/client/serviceWorkerCtrl.d.ts +8 -0
  84. package/types/client/startupWeather.d.ts +13 -9
  85. package/types/client/store.d.ts +2 -2
  86. package/types/client/storeLastPosition.d.ts +1 -0
  87. package/types/client/subscription.d.ts +1 -0
  88. package/types/client/swDownloader.d.ts +7 -7
  89. package/types/client/swProxy.d.ts +1 -1
  90. package/types/client/swUtils.d.ts +3 -3
  91. package/types/client/trans.d.ts +26 -37
  92. package/types/client/user.d.ts +5 -13
  93. package/types/client/userAlerts.d.ts +68 -0
  94. package/types/client/userConsent.d.ts +6 -0
  95. package/types/client/userFavs.d.ts +46 -121
  96. package/types/client/utils.d.ts +28 -6
  97. package/types/iconfont.d.ts +1 -0
  98. package/types/interfaces.d.ts +90 -225
  99. package/types/lang-files.d.ts +687 -119
  100. package/types/offline.d.ts +100 -0
  101. package/types/types.d.ts +59 -24
  102. package/types/client/Bar.d.ts +0 -114
  103. package/types/client/BindedBar.d.ts +0 -51
  104. package/types/client/BindedCheckbox.d.ts +0 -30
  105. package/types/client/BindedSwitch.d.ts +0 -35
  106. package/types/client/BottomTagPlugin.d.ts +0 -8
  107. package/types/client/DraggableDiv.d.ts +0 -21
  108. package/types/client/GhostBox.d.ts +0 -17
  109. package/types/client/Legend.d.ts +0 -6
  110. package/types/client/LongTap.d.ts +0 -21
  111. package/types/client/MobileCalendar.d.ts +0 -51
  112. package/types/client/OfflineMessagesClasses.d.ts +0 -30
  113. package/types/client/ProductSwitch.d.ts +0 -14
  114. package/types/client/Scrollable.d.ts +0 -14
  115. package/types/client/Switch.d.ts +0 -24
  116. package/types/client/TimestampBar.d.ts +0 -8
  117. package/types/client/d.ts.files/Product.d.ts +0 -37
  118. package/types/client/d.ts.files/trans.d.ts +0 -55
  119. package/types/client/favs.d.ts +0 -83
  120. package/types/client/offlineController.d.ts +0 -20
@@ -1,42 +1,41 @@
1
- import type { SupportedLangFiles, Translations } from './d.ts.files/lang-files.d';
2
- import type { LoadedTranslations, LoadingOptions, TransFileInfo } from './d.ts.files/trans.d';
3
- export declare const files: Record<keyof SupportedLangFiles, TransFileInfo>;
4
1
  /**
5
- * key-value pairs with all loaded lang strings
6
- */
7
- declare const trans: LoadedTranslations;
8
- /**
9
- * Preferred language which does not existed in translations (for statistics purposes)
10
- */
11
- declare let missingLang: string | undefined;
12
- /**
13
- * Get file from storage, checks it version number and if
14
- * fits current version returns it. If file is not in storage downloads a file
15
- * and stores it in storage.
2
+ * # @windy/trans
16
3
  *
17
- * Handles versioning of the file, so each new versionof client get its correct file.
4
+ * This module handles all i18n tasks, including detecting the desired language,
5
+ * lazy loading language files, translating parts of the DOM, and returning
6
+ * translated strings for later use in the app.
18
7
  *
19
- * If filename is relative filename (set in options). For example for 'lang/cs.json'
20
- * we try to download /v5.0/lang/cz.json'
8
+ * English language stings from `main` file are hardcoded in the core by default,
9
+ * to avoid any undefined strings in DOM. Other languages are loaded on demand.
21
10
  *
22
- * Can also store files with absolute URLs
11
+ * WARNING: Contrary to previous version, Windy does not support changing language
12
+ * during a runtime. Once user opts to change the language, whole app must be reloaded.
23
13
  *
24
- * @param {string} filename Filename (e.g. 'lang/cs.json')
25
- * @param {Object} options Optionally custom options
26
- * @returns Resolves with contents of loaded file (key-value pairs)
14
+ * @module trans
27
15
  */
28
- declare const getFile: (filename: string, options?: LoadingOptions) => Promise<Translations>;
16
+ import type { SupportedLangFiles } from '@windy/lang-files.d';
17
+ import type { LoadedTranslations } from '@windy/types';
18
+ export declare const supportedLangFiles: string[];
29
19
  /**
30
- * Loads external language file and attach it as a source of translations. Missing translations are presented in default english lang.
20
+ * key-value pairs with all loaded lang strings
21
+ * WARNING: Typing here is not true... lang files are loaded step-by-step on demand, but it is useless to use `!` everywhere
22
+ */
23
+ export declare const t: LoadedTranslations;
24
+ /**
25
+ * Preferred browsers' language (not the used one). Can contain language that is not supported by Windy
26
+ */
27
+ export declare const navigatorPreferredLang: string;
28
+ export declare const getUrlOfLangFile: (id: keyof SupportedLangFiles) => string;
29
+ /**
30
+ *english lang.
31
31
  * It does nothing in case of english, as it is already loaded by default.
32
32
  *
33
33
  * @param id Id of translation file
34
- * @param lang Optionally forced language, client lang is used by default
35
34
  * @returns Translations in key-pair object. Missing translations are presented in default english lang.
36
35
  */
37
- declare const loadLangFile: (id: keyof SupportedLangFiles, lang?: "en" | "zh-TW" | "zh" | "ja" | "fr" | "ko" | "it" | "ru" | "nl" | "cs" | "tr" | "pl" | "sv" | "fi" | "ro" | "el" | "hu" | "hr" | "ca" | "da" | "ar" | "fa" | "hi" | "ta" | "sk" | "uk" | "bg" | "he" | "is" | "lt" | "et" | "vi" | "sl" | "sr" | "id" | "th" | "sq" | "pt" | "nb" | "es" | "de" | "bn") => Promise<void | Translations>;
36
+ export declare const loadLangFile: (id: keyof SupportedLangFiles) => Promise<void>;
38
37
  /**
39
- * Replace all `[data-*]` translation tags with proper translation in HTML element. It overrides its innerHTML
38
+ * Replace. It overrides its innerHTML
40
39
  * Supported data suffixes: 'title', 'placeholder', 't', 'afterbegin', 'beforeend', 'tooltipsrc'
41
40
  *
42
41
  * @param element HTML element where tags should be replaced
@@ -55,14 +54,4 @@ declare const loadLangFile: (id: keyof SupportedLangFiles, lang?: "en" | "zh-TW"
55
54
  * </p>
56
55
  * ```
57
56
  */
58
- declare const translateDocument: <T extends HTMLElement>(element: T) => void;
59
- /**
60
- * @module trans
61
- *
62
- * - handles all i18n tasks
63
- * - detects desired language
64
- * - lazy loads language file
65
- * - translates required part of a DOM (with many limitations)
66
- * - returns translated strings for later use in app
67
- */
68
- export { getFile, loadLangFile, missingLang, trans as t, translateDocument };
57
+ export declare const translateDocument: <T extends HTMLElement>(element: T) => void;
@@ -4,21 +4,15 @@
4
4
  * 1) Wrapper for the user store object.
5
5
  * 2) Loads user info from the server.
6
6
  * 3) Handles user authentication.
7
- * 4) Renders user avatar.
8
7
  *
9
- * data-user='logged-in' or 'logged-out' attr is added to the body tag when we know the state of the user (a CSS way of isUserLoggedIn function).
10
8
  * it's to avoid unnecessary render of "login" button when the user is logged in, but we still wait for the server response
11
9
  *
12
10
  * @module user
13
11
  */
14
- /**
15
- * We use ./filename to motivate rollup treeshaking
16
- */
17
- import type { User } from './d.ts.files/dataSpecifications.d';
18
12
  import type { HttpPayload } from './d.ts.files/http.d';
19
- import type { AccountLoginResponse, UserInfo } from './d.ts.files/user.d';
13
+ import type { AccountLoginResponse, UserInfo, User, LoginAndFinishAction } from './d.ts.files/user.d';
20
14
  /**
21
- * Quick check is user is loggedIn
15
+ * Quick check is user is loggedIn.
22
16
  */
23
17
  export declare const isLoggedIn: () => boolean;
24
18
  export declare const getInfo: () => User | null;
@@ -33,14 +27,12 @@ export declare const getUserId: () => number;
33
27
  /**
34
28
  * Open login plugin so that user can log in
35
29
  */
36
- export declare const login: () => void;
30
+ export declare const login: (finishAction?: LoginAndFinishAction) => void;
37
31
  export declare const register: () => void;
38
32
  /**
39
33
  * Log out the user - remove credentials and reload all things that depends on logged-in user
40
34
  */
41
35
  export declare const logout: () => Promise<void>;
42
- export declare const setExplicitConsent: (analytics: boolean) => void;
43
- export declare const setImplicitConsent: () => void;
44
36
  /**
45
37
  * Check if we have received valid auth object and if yes, save it and open user plugin
46
38
  *
@@ -48,7 +40,7 @@ export declare const setImplicitConsent: () => void;
48
40
  * @param handleConsent should we handle analytics consent (api/info endpoint)
49
41
  * @returns true if user is authenticated
50
42
  */
51
- export declare const checkAuth: (userInfo: UserInfo, handleConsent: boolean) => boolean;
43
+ export declare const checkAuth: (userInfoPayload: UserInfo, handleConsent: boolean) => Promise<boolean>;
52
44
  /**
53
45
  * Get info about current user from account
54
46
  *
@@ -56,4 +48,4 @@ export declare const checkAuth: (userInfo: UserInfo, handleConsent: boolean) =>
56
48
  * @throws An exception when HTTP request fails
57
49
  */
58
50
  export declare const reloadInfo: () => Promise<HttpPayload<UserInfo> | null>;
59
- export declare const handleLoginResponse: (response: HttpPayload<AccountLoginResponse>) => void;
51
+ export declare const handleLoginResponse: (response: HttpPayload<AccountLoginResponse>, provider: string) => Promise<void>;
@@ -0,0 +1,68 @@
1
+ import type { AlertRequest, AlertResponse, AlertCheckResponse } from '@windy/alerts.d';
2
+ import type { Fav } from '@windy/favs.d';
3
+ import type { LatLon } from '@windy/interfaces';
4
+ export declare enum AlertStatus {
5
+ Triggered = "triggered",
6
+ Normal = "normal",
7
+ Suspended = "suspended"
8
+ }
9
+ export declare enum AlertConditionType {
10
+ Cloudiness = "cloudiness",
11
+ FreshSnow = "freshSnow",
12
+ Rainfall = "rainfall",
13
+ Swell = "swell",
14
+ Temperature = "temperature",
15
+ Time = "time",
16
+ Wind = "wind"
17
+ }
18
+ export declare enum Direction {
19
+ N = "N",
20
+ NE = "NE",
21
+ E = "E",
22
+ SE = "SE",
23
+ S = "S",
24
+ SW = "SW",
25
+ W = "W",
26
+ NW = "NW"
27
+ }
28
+ export declare enum Weekday {
29
+ Monday = "mon",
30
+ Tuesday = "tue",
31
+ Wednesday = "wed",
32
+ Thursday = "thu",
33
+ Friday = "fri",
34
+ Saturday = "sat",
35
+ Sunday = "sun"
36
+ }
37
+ /**
38
+ * https://www.eoas.ubc.ca/courses/atsc113/flying/met_concepts/01-met_concepts/01c-cloud_coverage/index.html
39
+ *
40
+ * Values are meteorological convention.
41
+ */
42
+ export declare enum CloudCoverage {
43
+ /** No clouds */
44
+ SkyClear = "SKC",
45
+ /** 1/8 to 2/8 cloud cover */
46
+ Few = "FEW",
47
+ /** 3/8 to 4/8 cloud cover */
48
+ Scattered = "SCT",
49
+ /** 5/8 to 7/8 cloud cover */
50
+ Broken = "BKN",
51
+ /** 8/8 cloud cover */
52
+ Overcast = "OVC"
53
+ }
54
+ export declare function getAlertTimestamps(alertId: string): Promise<AlertCheckResponse>;
55
+ export declare function getAlertV3(alertId: string): Promise<Fav & {
56
+ type: 'alert';
57
+ }>;
58
+ export declare function getAlerts(): Promise<AlertResponse[]>;
59
+ export declare function getAlert(alertId: string): Promise<AlertResponse | null>;
60
+ export declare function createAlert(data: AlertRequest): Promise<void>;
61
+ export declare function updateAlert(data: AlertResponse): Promise<AlertResponse>;
62
+ export declare function deleteAlert(alertId: string): Promise<void>;
63
+ export declare function getNearAlert(location: LatLon): Promise<AlertResponse | undefined>;
64
+ export declare function getNearAlerts(location: LatLon): Promise<AlertResponse[]>;
65
+ export declare function add(latLonAndName: LatLon & {
66
+ locationName?: string;
67
+ }): void;
68
+ export declare function userHasAnyAlerts(): Promise<boolean>;
@@ -0,0 +1,6 @@
1
+ export declare const launchConsentWindow: () => void;
2
+ export declare const setExplicitConsent: (analytics: boolean) => void;
3
+ export declare const setImplicitConsent: () => void;
4
+ export declare const checkConsent: (userInfo?: {
5
+ requiresCookieConsent: boolean;
6
+ }) => void;
@@ -1,122 +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
- /**
26
- * Supported types in this version
27
- */
28
- private types;
29
- private overflowedKey;
30
- on: Evented<FavsTypes>['on'];
31
- off: Evented<FavsTypes>['off'];
32
- emit: Evented<FavsTypes>['emit'];
33
- constructor();
34
- isValidFavourite(item: Fav): boolean;
35
- /**
36
- * Check if object is an alert (or near) and have triggered timestamps
37
- * item = latLonObj or alert id
38
- * returns list of timestamps if triggered
39
- */
40
- hasTimestamps<T extends LatLon | string>(item: T): number[] | null;
41
- /**
42
- * Add favorite
43
- */
44
- add(item: Fav): boolean | Promise<string>;
45
- /**
46
- * Search for an alert either by id or latLon
47
- */
48
- getAlert<T extends LatLon | string>(item: T): SavedFav | undefined;
49
- /**
50
- *
51
- * Return favs as array
52
- */
53
- getArray(deduped?: boolean, editedAlert?: Fav): SavedFav[];
54
- isFreeLimitExceeded(editedAlert?: Fav): boolean;
55
- /**
56
- * Emits info about favs status change
57
- */
58
- emitChange(): void;
59
- /**
60
- * Send updated fav to the server
61
- */
62
- updateFav(fav: Fav): Promise<void>;
63
- rename(fav: SavedFav, name: string): Promise<void>;
64
- remove(passedItem: Fav | FavKey, isAlert?: boolean): Promise<void>;
65
- /**
66
- * Check triggering of single alert (always resolve)
67
- */
68
- checkAlerts(param?: {
69
- newlyAddedId: string;
70
- }): void;
71
- /**
72
- * Called upon inserting/deletion Display all favs on a map. This is VERY unefective method
73
- * that should keep client code small
74
- */
75
- onchange(): void;
76
- reset(): void;
77
- /**
78
- * get list of all overflowed deduplicated favs from store
79
- */
80
- getOverflowed(): SavedFav[];
81
- unstoreOverflowed(): void;
82
- resetOverflowed(): void;
83
- removeOverflowed(fav: Fav): void;
84
- /**
85
- * start to sync some overflowed
86
- */
87
- syncOverflowed(fav: Fav): void;
88
- /**
89
- * Toggle pinning fav to top or to homepage
90
- */
91
- togglePin(fav: SavedFav, whereToPin: 'pin2top' | 'pin2homepage', forcedTimestamp?: Timestamp): null | undefined | Timestamp;
92
- /**
93
- * Load from cloud
94
- */
95
- private loadFromCloud;
96
- /**
97
- * Alert related methods
98
- * item = fav || key
99
- */
100
- private setAlertProps;
101
- private createSyncError;
102
- private checkAlert;
103
- /**
104
- * Alerts were checked
105
- */
106
- private onAlertsChecked;
107
- /**
108
- * Check validity and store fav
109
- */
110
- private checkAndStore;
111
- /**
112
- * set an object as an overflowed favs if none are set already
113
- */
114
- private storeOverflowed;
115
- /**
116
- * add item as overflowed
117
- */
118
- private addOverflowed;
119
- private onUserData;
120
- }
121
- declare const _default: SavedFavs;
122
- 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,5 +1,4 @@
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';
@@ -42,6 +41,10 @@ export declare const num2char: (num: number) => string;
42
41
  * @returns Number
43
42
  */
44
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;
45
48
  /**
46
49
  * Takes {lat,lon} and returns nice string out of it (rounds coords to two decimals)
47
50
  *
@@ -119,11 +122,11 @@ export declare const radToDeg = 57.2957795;
119
122
  * leading edge, instead of the trailing.
120
123
  *
121
124
  * @param func Function to debounce
122
- * @param wait Time limit of debouncing
125
+ * @param wailTill Time limit of debouncing
123
126
  * @param immediate Should be function trigger on the leading edge or on the trailing
124
127
  * @returns Debounced function
125
128
  */
126
- 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;
127
130
  /**
128
131
  * Retun throttling function
129
132
  *
@@ -164,7 +167,7 @@ export interface WindObject extends DirObject {
164
167
  * @param v Vector [u,v]
165
168
  * @returns Object { wind, dir }
166
169
  */
167
- export declare const wind2obj: (v: [number, number] | RGBNumValues) => WindObject;
170
+ export declare const wind2obj: ([u, v]: [number, number] | RGBNumValues) => WindObject;
168
171
  export interface WaveObject extends DirObject {
169
172
  period: number;
170
173
  size: number;
@@ -175,7 +178,7 @@ export interface WaveObject extends DirObject {
175
178
  * @param v Vector [u,v,size]
176
179
  * @returns Object { wind, dir, period }
177
180
  */
178
- export declare const wave2obj: (v: RGBNumValues) => WaveObject;
181
+ export declare const wave2obj: ([u, v, size]: RGBNumValues) => WaveObject;
179
182
  /**
180
183
  * Trush if wx object has valid direction
181
184
  *
@@ -399,7 +402,6 @@ export declare const sanitizeHTML: (s: string) => string;
399
402
  * @param errObj Whole error object to stringification. It is sent to Kibana under 'error' property
400
403
  */
401
404
  export declare function logError(moduleName: string, msg: string, errorObject?: Error | HttpError | Event | ErrorEvent | RegistrationError): void;
402
- export declare const sendMessageToServiceWorker: (message: ClientMessage) => void;
403
405
  /**
404
406
  * Same as scale linear from d3 library except with different params
405
407
  * https://d3js.org/d3-scale/linear
@@ -436,3 +438,23 @@ export declare const getLocationOfJsAssets: (location: string) => string;
436
438
  * Is valid NumValue
437
439
  */
438
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;
@@ -182,6 +182,7 @@ export type Iconfont =
182
182
  | '<!-- @echo icon-crown-king -->'
183
183
  | '<!-- @echo icon-tide -->'
184
184
  | '<!-- @echo icon-car -->'
185
+ | '<!-- @echo icon-cloud-lightning-big-plus -->'
185
186
  | '<!-- @echo icon-share -->'
186
187
  | '<!-- @echo icon-bell-plus -->'
187
188
  | '<!-- @echo icon-x -->'