@windycom/plugin-devtools 2.0.0 → 3.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.
- package/README.md +4 -0
- package/index.mjs +2 -2
- package/package.json +2 -3
- package/types/client/AccessProducts.d.ts +8 -0
- package/types/client/BottomSlide.d.ts +3 -0
- package/types/client/BottomSveltePlugins.d.ts +8 -0
- package/types/client/Calendar.d.ts +9 -17
- package/types/client/Color.d.ts +44 -91
- package/types/client/EcmwfProduct.d.ts +0 -22
- package/types/client/Evented.d.ts +4 -0
- package/types/client/ExternalSveltePlugin.d.ts +8 -2
- package/types/client/IDB.d.ts +69 -0
- package/types/client/IconProducts.d.ts +2 -0
- package/types/client/Layer.d.ts +1 -2
- package/types/client/Metric.d.ts +13 -9
- package/types/client/MetricClasses.d.ts +4 -3
- package/types/client/Overlay.d.ts +31 -16
- package/types/client/OverlayClasses.d.ts +11 -7
- package/types/client/Plugin.d.ts +6 -2
- package/types/client/Product.d.ts +33 -30
- package/types/client/RadarPlusProduct.d.ts +19 -0
- package/types/client/Renderer.d.ts +2 -10
- package/types/client/SatelliteProduct.d.ts +1 -1
- package/types/client/SveltePlugin.d.ts +16 -5
- package/types/client/TileLayer.d.ts +1 -2
- package/types/client/TopoMap.d.ts +10 -0
- package/types/client/WindowPlugin.d.ts +9 -4
- package/types/client/appsFlyer.d.ts +2 -0
- package/types/client/baseMap.d.ts +8 -5
- package/types/client/cityLabels.d.ts +10 -2
- package/types/client/cloudSync.d.ts +3 -1
- package/types/client/colorGradients.d.ts +13 -0
- package/types/client/compatibilityCheck.d.ts +1 -0
- package/types/client/connection.d.ts +1 -1
- package/types/client/customColors.d.ts +1 -0
- package/types/client/d.ts.files/Calendar.d.ts +11 -2
- package/types/client/d.ts.files/Color.d.ts +17 -5
- package/types/client/d.ts.files/LabelsLayer.d.ts +3 -20
- package/types/client/d.ts.files/Layer.d.ts +8 -1
- package/types/client/d.ts.files/Metric.d.ts +1 -0
- package/types/client/d.ts.files/Renderer.d.ts +22 -1
- package/types/client/d.ts.files/alerts.d.ts +119 -0
- package/types/client/d.ts.files/broadcast.d.ts +51 -18
- package/types/client/d.ts.files/dataSpecifications.d.ts +121 -137
- package/types/client/d.ts.files/favs.d.ts +68 -0
- package/types/client/d.ts.files/incomingMessages.d.ts +0 -4
- package/types/client/d.ts.files/lib.d.ts +5 -7
- package/types/client/d.ts.files/notifications.d.ts +2 -2
- package/types/client/d.ts.files/plugin-params.d.ts +53 -57
- package/types/client/d.ts.files/plugins.d.ts +31 -42
- package/types/client/d.ts.files/pois.d.ts +1 -1
- package/types/client/d.ts.files/products.d.ts +16 -5
- package/types/client/d.ts.files/rootScope.d.ts +13 -31
- package/types/client/d.ts.files/startup.d.ts +65 -0
- package/types/client/d.ts.files/storage.d.ts +12 -35
- package/types/client/d.ts.files/user.d.ts +82 -24
- package/types/client/detectDevice.d.ts +0 -3
- package/types/client/device.d.ts +1 -0
- package/types/client/deviceLogging.d.ts +2 -1
- package/types/client/embed.d.ts +70 -0
- package/types/client/embed2.d.ts +14 -31
- package/types/client/errorLogger.d.ts +28 -3
- package/types/client/errors.d.ts +6 -0
- package/types/client/fetch.d.ts +41 -16
- package/types/client/format.d.ts +1 -1
- package/types/client/ga.d.ts +1 -1
- package/types/client/geolocation.d.ts +15 -7
- package/types/client/globals.d.ts +1 -0
- package/types/client/http.d.ts +17 -6
- package/types/client/idbInstances.d.ts +36 -0
- package/types/client/imaker.d.ts +112 -0
- package/types/client/imakerMain.d.ts +49 -0
- package/types/client/langFiles.d.ts +2 -0
- package/types/client/latestBroadcasts.d.ts +1 -1
- package/types/client/layers.d.ts +2 -0
- package/types/client/lib.d.ts +6 -22
- package/types/client/libHtml.d.ts +1 -1
- package/types/client/liveAlerts.d.ts +5 -0
- package/types/client/liveAlerts.types.d.ts +28 -0
- package/types/client/loadArticlesOrWhatsNew.d.ts +1 -0
- package/types/client/location.d.ts +5 -0
- package/types/client/log.d.ts +4 -1
- package/types/client/lruCache.d.ts +6 -0
- package/types/client/map.d.ts +17 -6
- package/types/client/mobile.d.ts +31 -22
- package/types/client/models.d.ts +7 -5
- package/types/client/notifications.d.ts +29 -67
- package/types/client/overlays.d.ts +4 -1
- package/types/client/params.d.ts +0 -1
- package/types/client/permanentPromos.d.ts +1 -1
- package/types/client/persistentStorage.d.ts +8 -0
- package/types/client/picker.d.ts +1 -1
- package/types/client/plugins.d.ts +4 -0
- package/types/client/pois.d.ts +1 -2
- package/types/client/promo.d.ts +6 -16
- package/types/client/pushNotifications.d.ts +1 -1
- package/types/client/queryString.d.ts +1 -1
- package/types/client/renderUtils.d.ts +1 -1
- package/types/client/renderers.d.ts +7 -3
- package/types/client/rootScope.d.ts +23 -24
- package/types/client/router.d.ts +9 -29
- package/types/client/seoParser.d.ts +0 -14
- package/types/client/serviceWorkerCtrl.d.ts +8 -0
- package/types/client/showableErrorsService.d.ts +6 -10
- package/types/client/startupWeather.d.ts +13 -9
- package/types/client/store.d.ts +2 -2
- package/types/client/storeLastPosition.d.ts +4 -0
- package/types/client/subscription.d.ts +1 -0
- package/types/client/swDownloader.d.ts +7 -7
- package/types/client/swProxy.d.ts +1 -1
- package/types/client/swUtils.d.ts +3 -3
- package/types/client/trans.d.ts +26 -37
- package/types/client/user.d.ts +7 -13
- package/types/client/userAlerts.d.ts +68 -0
- package/types/client/userConsent.d.ts +6 -0
- package/types/client/userFavs.d.ts +46 -122
- package/types/client/utils.d.ts +67 -9
- package/types/iconfont.d.ts +8 -0
- package/types/interfaces.d.ts +226 -284
- package/types/lang-files.d.ts +1334 -142
- package/types/offline.d.ts +100 -0
- package/types/types.d.ts +108 -34
- package/types/client/Bar.d.ts +0 -114
- package/types/client/BindedBar.d.ts +0 -51
- package/types/client/BindedCheckbox.d.ts +0 -30
- package/types/client/BindedSwitch.d.ts +0 -35
- package/types/client/BottomTagPlugin.d.ts +0 -8
- package/types/client/DraggableDiv.d.ts +0 -21
- package/types/client/GhostBox.d.ts +0 -17
- package/types/client/Legend.d.ts +0 -6
- package/types/client/LongTap.d.ts +0 -21
- package/types/client/MobileCalendar.d.ts +0 -51
- package/types/client/OfflineMessagesClasses.d.ts +0 -30
- package/types/client/ProductSwitch.d.ts +0 -14
- package/types/client/Scrollable.d.ts +0 -14
- package/types/client/Switch.d.ts +0 -24
- package/types/client/TimestampBar.d.ts +0 -8
- package/types/client/d.ts.files/Product.d.ts +0 -37
- package/types/client/d.ts.files/errorLogger.d.ts +0 -35
- package/types/client/d.ts.files/trans.d.ts +0 -55
- package/types/client/favs.d.ts +0 -83
- package/types/client/offlineController.d.ts +0 -20
- /package/types/client/d.ts.files/{Webcams.d.ts → webcams.d.ts} +0 -0
package/types/client/trans.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
20
|
-
*
|
|
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
|
-
*
|
|
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
|
-
* @
|
|
25
|
-
* @param {Object} options Optionally custom options
|
|
26
|
-
* @returns Resolves with contents of loaded file (key-value pairs)
|
|
14
|
+
* @module trans
|
|
27
15
|
*/
|
|
28
|
-
|
|
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
|
-
*
|
|
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
|
|
36
|
+
export declare const loadLangFile: (id: keyof SupportedLangFiles) => Promise<void>;
|
|
38
37
|
/**
|
|
39
|
-
* Replace
|
|
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;
|
package/types/client/user.d.ts
CHANGED
|
@@ -4,24 +4,20 @@
|
|
|
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';
|
|
12
|
+
import '@windy/liveAlerts';
|
|
18
13
|
import type { HttpPayload } from './d.ts.files/http.d';
|
|
19
|
-
import type { AccountLoginResponse, UserInfo } from './d.ts.files/user.d';
|
|
14
|
+
import type { AccountLoginResponse, UserInfo, User, LoginAndFinishAction } from './d.ts.files/user.d';
|
|
20
15
|
/**
|
|
21
|
-
* Quick check is user is loggedIn
|
|
16
|
+
* Quick check is user is loggedIn.
|
|
22
17
|
*/
|
|
23
18
|
export declare const isLoggedIn: () => boolean;
|
|
24
19
|
export declare const getInfo: () => User | null;
|
|
20
|
+
export declare const emptyAvatar = "<!-- @echo IMG_ABSOLUTE_PATH -->/avatar.jpg";
|
|
25
21
|
/**
|
|
26
22
|
* Safe way how to retrieve use avatar
|
|
27
23
|
* @returns link to user avatar or default avatar
|
|
@@ -33,14 +29,12 @@ export declare const getUserId: () => number;
|
|
|
33
29
|
/**
|
|
34
30
|
* Open login plugin so that user can log in
|
|
35
31
|
*/
|
|
36
|
-
export declare const login: () => void;
|
|
32
|
+
export declare const login: (finishAction?: LoginAndFinishAction) => void;
|
|
37
33
|
export declare const register: () => void;
|
|
38
34
|
/**
|
|
39
35
|
* Log out the user - remove credentials and reload all things that depends on logged-in user
|
|
40
36
|
*/
|
|
41
37
|
export declare const logout: () => Promise<void>;
|
|
42
|
-
export declare const setExplicitConsent: (analytics: boolean) => void;
|
|
43
|
-
export declare const setImplicitConsent: () => void;
|
|
44
38
|
/**
|
|
45
39
|
* Check if we have received valid auth object and if yes, save it and open user plugin
|
|
46
40
|
*
|
|
@@ -48,7 +42,7 @@ export declare const setImplicitConsent: () => void;
|
|
|
48
42
|
* @param handleConsent should we handle analytics consent (api/info endpoint)
|
|
49
43
|
* @returns true if user is authenticated
|
|
50
44
|
*/
|
|
51
|
-
export declare const checkAuth: (
|
|
45
|
+
export declare const checkAuth: (userInfoPayload: UserInfo, handleConsent: boolean) => Promise<boolean>;
|
|
52
46
|
/**
|
|
53
47
|
* Get info about current user from account
|
|
54
48
|
*
|
|
@@ -56,4 +50,4 @@ export declare const checkAuth: (userInfo: UserInfo, handleConsent: boolean) =>
|
|
|
56
50
|
* @throws An exception when HTTP request fails
|
|
57
51
|
*/
|
|
58
52
|
export declare const reloadInfo: () => Promise<HttpPayload<UserInfo> | null>;
|
|
59
|
-
export declare const handleLoginResponse: (response: HttpPayload<AccountLoginResponse
|
|
53
|
+
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,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
declare
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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;
|
|
1
|
+
import type { Fav, FavId } from '@windy/favs';
|
|
2
|
+
export declare const emitChange: () => void;
|
|
3
|
+
/**
|
|
4
|
+
* Adds a fav to the db
|
|
5
|
+
*/
|
|
6
|
+
export declare const add: () => Promise<FavId | null>;
|
|
7
|
+
/**
|
|
8
|
+
* Update Fav in the db
|
|
9
|
+
*/
|
|
10
|
+
export declare const update: () => Promise<FavId | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Remove fav from db
|
|
13
|
+
*/
|
|
14
|
+
export declare const remove: () => Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Toggle pinning fav to top or to homepage
|
|
17
|
+
*/
|
|
18
|
+
export declare const togglePin: () => Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Find all favs that match given criteria
|
|
21
|
+
*/
|
|
22
|
+
export declare const find: () => Promise<Fav[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Same as find but always returns only the first match
|
|
25
|
+
*/
|
|
26
|
+
export declare const findOne: () => Promise<Fav | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Returns all favs as array
|
|
29
|
+
*/
|
|
30
|
+
export declare const getAll: () => Promise<Fav[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Quick check if fav with given ids exists
|
|
33
|
+
*/
|
|
34
|
+
export declare const isFav: () => Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Toggles fav (adds or removes) from db
|
|
37
|
+
*/
|
|
38
|
+
export declare const toggle: () => Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Checks if fav exists
|
|
41
|
+
*/
|
|
42
|
+
export declare const hasKey: () => Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Removes all favs from the device TODO: Call after logging out
|
|
45
|
+
*/
|
|
46
|
+
export declare const removeAllFavsFromDevice: () => Promise<void>;
|
package/types/client/utils.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { HttpError } from './errors';
|
|
1
2
|
import type { RegistrationError } from '@capacitor/push-notifications';
|
|
2
|
-
import type { ClientMessage } from '@plugins/offline/offline';
|
|
3
3
|
import type { RGBA } from '@windy/Color.d';
|
|
4
|
-
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 { ExtendedStationType, HTMLString, NumOrNull, Timestamp } from '@windy/types.d';
|
|
7
|
+
import type { ExtendedStationType, HTMLString, NumOrNull, Timestamp, ParsedQueryString } from '@windy/types.d';
|
|
9
8
|
/**
|
|
10
9
|
* One minute in ms.
|
|
11
10
|
*
|
|
@@ -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,13 +122,17 @@ 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
|
|
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,
|
|
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
|
+
* Returns a throttled variant of the input function, using a timer to limit calls of the input function.
|
|
132
|
+
* If the throttled function is called and the timer is not running, the input function is executed immediatelly and a timer is started.
|
|
133
|
+
* If the throttled function is called again before the timer runs out, the input function is not executed, but the call arguments are stored
|
|
134
|
+
* and the input function is called once the timer runs out.
|
|
135
|
+
* If the throttled function is called multiple times while the timer is running, only the latest call arguments are used once the timer runs out.
|
|
129
136
|
*
|
|
130
137
|
* @param this NOT USED, it is only TS explicit this annotation build-time parameter. Consider it as the first parameter would not exist.
|
|
131
138
|
* @param fn Function to throttle
|
|
@@ -164,7 +171,10 @@ export interface WindObject extends DirObject {
|
|
|
164
171
|
* @param v Vector [u,v]
|
|
165
172
|
* @returns Object { wind, dir }
|
|
166
173
|
*/
|
|
167
|
-
export declare const wind2obj: (
|
|
174
|
+
export declare const wind2obj: ([u, v]: [
|
|
175
|
+
number,
|
|
176
|
+
number
|
|
177
|
+
] | RGBNumValues) => WindObject;
|
|
168
178
|
export interface WaveObject extends DirObject {
|
|
169
179
|
period: number;
|
|
170
180
|
size: number;
|
|
@@ -175,7 +185,7 @@ export interface WaveObject extends DirObject {
|
|
|
175
185
|
* @param v Vector [u,v,size]
|
|
176
186
|
* @returns Object { wind, dir, period }
|
|
177
187
|
*/
|
|
178
|
-
export declare const wave2obj: (v: RGBNumValues) => WaveObject;
|
|
188
|
+
export declare const wave2obj: ([u, v, size]: RGBNumValues) => WaveObject;
|
|
179
189
|
/**
|
|
180
190
|
* Trush if wx object has valid direction
|
|
181
191
|
*
|
|
@@ -210,6 +220,7 @@ export declare const isNear: <T extends LatLon, F extends LatLon>(a: T, b: F) =>
|
|
|
210
220
|
* @returns Bounded number
|
|
211
221
|
*/
|
|
212
222
|
export declare const bound: (num: number, min: number, max: number) => number;
|
|
223
|
+
export declare const clamp: (num: number, min: number, max: number) => number;
|
|
213
224
|
/**
|
|
214
225
|
* Smoothstep https://en.wikipedia.org/wiki/Smoothstep
|
|
215
226
|
*
|
|
@@ -399,7 +410,6 @@ export declare const sanitizeHTML: (s: string) => string;
|
|
|
399
410
|
* @param errObj Whole error object to stringification. It is sent to Kibana under 'error' property
|
|
400
411
|
*/
|
|
401
412
|
export declare function logError(moduleName: string, msg: string, errorObject?: Error | HttpError | Event | ErrorEvent | RegistrationError): void;
|
|
402
|
-
export declare const sendMessageToServiceWorker: (message: ClientMessage) => void;
|
|
403
413
|
/**
|
|
404
414
|
* Same as scale linear from d3 library except with different params
|
|
405
415
|
* https://d3js.org/d3-scale/linear
|
|
@@ -436,3 +446,51 @@ export declare const getLocationOfJsAssets: (location: string) => string;
|
|
|
436
446
|
* Is valid NumValue
|
|
437
447
|
*/
|
|
438
448
|
export declare const isValidNumber: (d: NumOrNull | undefined) => boolean;
|
|
449
|
+
/**
|
|
450
|
+
* Converts C to K
|
|
451
|
+
*/
|
|
452
|
+
export declare const c2kelvin: (c: number) => number;
|
|
453
|
+
/**
|
|
454
|
+
* Async version of wait
|
|
455
|
+
*/
|
|
456
|
+
export declare const wait: (t: Timestamp) => Promise<void>;
|
|
457
|
+
/**
|
|
458
|
+
* Removes accents and diacritics from string
|
|
459
|
+
* "Crème Brûlée" -> "Creme Brulee"
|
|
460
|
+
* https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript
|
|
461
|
+
* TODO: Use Unicode property escapes when widely supported, currently at 94% at caniuse
|
|
462
|
+
*/
|
|
463
|
+
export declare const removeDiacritics: (s: string) => string;
|
|
464
|
+
/**
|
|
465
|
+
* Capitalizes the first letter of a string.
|
|
466
|
+
* This differs from the CSS property which capitalizes the first letter of each word.
|
|
467
|
+
*/
|
|
468
|
+
export declare const capitalize: (text: string) => string;
|
|
469
|
+
export declare const parseQueryString: (searchQuery: string | undefined) => ParsedQueryString | undefined;
|
|
470
|
+
export declare const seoLangRegex: RegExp;
|
|
471
|
+
/**
|
|
472
|
+
* Examples of SEO URLs:
|
|
473
|
+
*
|
|
474
|
+
* ## https://www.windy.com/cs/... (case [1])
|
|
475
|
+
* SEO language, used in @module trans Must be followed by string
|
|
476
|
+
*
|
|
477
|
+
* ## https://www.windy.com/-Name-Whatever-overlay (case [2])
|
|
478
|
+
* SEO Name of Overlay
|
|
479
|
+
*
|
|
480
|
+
* ## https://www.windy.com/-Name-Whatever/... (case [3])
|
|
481
|
+
* SEO NAME of plugin name, followed by any other string
|
|
482
|
+
*
|
|
483
|
+
* Remember that numbers are not allowed at the beginning of the URL, to distinguish
|
|
484
|
+
* any URL from detail.
|
|
485
|
+
*
|
|
486
|
+
*/
|
|
487
|
+
export declare const parseSeoUrl: (url: string) => {
|
|
488
|
+
purl: string;
|
|
489
|
+
overlay: string;
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* Safely URL decoded startup pathname
|
|
493
|
+
*/
|
|
494
|
+
export declare const startupPath: any;
|
|
495
|
+
export declare const generateUuidV4: () => string;
|
|
496
|
+
export declare const getErrorMessage: (error: unknown) => string;
|
package/types/iconfont.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// !!! Automatically generated file by make/iconfont.ts !!!
|
|
2
2
|
|
|
3
3
|
export type Iconfont =
|
|
4
|
+
| '<!-- @echo icon-pictures -->'
|
|
5
|
+
| '<!-- @echo icon-comment-o -->'
|
|
4
6
|
| '<!-- @echo icon-upload -->'
|
|
5
7
|
| '<!-- @echo icon-long-tap -->'
|
|
6
8
|
| '<!-- @echo icon-moving-cloud -->'
|
|
@@ -182,10 +184,16 @@ export type Iconfont =
|
|
|
182
184
|
| '<!-- @echo icon-crown-king -->'
|
|
183
185
|
| '<!-- @echo icon-tide -->'
|
|
184
186
|
| '<!-- @echo icon-car -->'
|
|
187
|
+
| '<!-- @echo icon-cloud-lightning-big-plus -->'
|
|
185
188
|
| '<!-- @echo icon-share -->'
|
|
186
189
|
| '<!-- @echo icon-bell-plus -->'
|
|
187
190
|
| '<!-- @echo icon-x -->'
|
|
188
191
|
| '<!-- @echo icon-twitter -->'
|
|
192
|
+
| '<!-- @echo icon-fire-warning -->'
|
|
193
|
+
| '<!-- @echo icon-fire-match -->'
|
|
194
|
+
| '<!-- @echo icon-fire-wind -->'
|
|
195
|
+
| '<!-- @echo icon-crosshair -->'
|
|
196
|
+
| '<!-- @echo icon-pushpin -->'
|
|
189
197
|
| '<!-- @echo icon-github -->'
|
|
190
198
|
| '<!-- @echo icon-link -->'
|
|
191
199
|
| '<!-- @echo icon-plane-snowflake -->'
|