@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.
- package/README.md +3 -0
- package/index.mjs +298 -0
- package/package.json +9 -0
- package/publishExamples.sh +19 -0
- package/types/AromeProduct.d.ts +5 -0
- package/types/Bar.d.ts +114 -0
- package/types/BindedBar.d.ts +51 -0
- package/types/BindedCheckbox.d.ts +30 -0
- package/types/BindedSwitch.d.ts +35 -0
- package/types/BottomSlide.d.ts +53 -0
- package/types/BottomTagPlugin.d.ts +8 -0
- package/types/Calendar.d.ts +149 -0
- package/types/ClickHandler.d.ts +19 -0
- package/types/Color.d.ts +175 -0
- package/types/DataTiler.d.ts +41 -0
- package/types/Drag.d.ts +43 -0
- package/types/DraggableDiv.d.ts +21 -0
- package/types/DropDown.d.ts +37 -0
- package/types/EcmwfAnalysisProduct.d.ts +5 -0
- package/types/EcmwfProduct.d.ts +29 -0
- package/types/Evented.d.ts +78 -0
- package/types/ExternalSveltePlugin.d.ts +29 -0
- package/types/Favs.d.ts +83 -0
- package/types/GhostBox.d.ts +17 -0
- package/types/GlObj.d.ts +252 -0
- package/types/HrrrProducts.d.ts +5 -0
- package/types/IconProducts.d.ts +5 -0
- package/types/LabelsLayer.d.ts +2 -0
- package/types/LandMask.d.ts +2 -0
- package/types/Layer.d.ts +137 -0
- package/types/Legend.d.ts +6 -0
- package/types/LongTap.d.ts +21 -0
- package/types/Metric.d.ts +132 -0
- package/types/MetricClasses.d.ts +37 -0
- package/types/MobileCalendar.d.ts +47 -0
- package/types/NamProducts.d.ts +5 -0
- package/types/OfflineMessagesClasses.d.ts +30 -0
- package/types/Overlay.d.ts +150 -0
- package/types/OverlayClasses.d.ts +29 -0
- package/types/Particles.d.ts +111 -0
- package/types/Plugin.d.ts +112 -0
- package/types/Product.d.ts +211 -0
- package/types/ProductSwitch.d.ts +14 -0
- package/types/Renderer.d.ts +69 -0
- package/types/SatelliteProduct.d.ts +19 -0
- package/types/Scrollable.d.ts +14 -0
- package/types/StaticProduct.d.ts +7 -0
- package/types/SveltePanePlugin.d.ts +18 -0
- package/types/SveltePlugin.d.ts +40 -0
- package/types/Swipe.d.ts +34 -0
- package/types/Switch.d.ts +24 -0
- package/types/TagPlugin.d.ts +6 -0
- package/types/TileLayer.d.ts +9 -0
- package/types/TileLayerCanvas.d.ts +2 -0
- package/types/TileLayerMultiPatch.d.ts +2 -0
- package/types/TimestampBar.d.ts +8 -0
- package/types/Webcams.d.ts +66 -0
- package/types/Window.d.ts +107 -0
- package/types/WindowPlugin.d.ts +171 -0
- package/types/baseMap.d.ts +10 -0
- package/types/broadcast.d.ts +14 -0
- package/types/cityLabels.d.ts +2 -0
- package/types/cloudSync.d.ts +12 -0
- package/types/colors.d.ts +4 -0
- package/types/connection.d.ts +4 -0
- package/types/css.d.ts +25 -0
- package/types/dataLoader.d.ts +26 -0
- package/types/dataSpecifications.d.ts +12 -0
- package/types/detectDevice.d.ts +6 -0
- package/types/device.d.ts +19 -0
- package/types/deviceLogging.d.ts +13 -0
- package/types/fetch.d.ts +88 -0
- package/types/format.d.ts +102 -0
- package/types/ga.d.ts +1 -0
- package/types/geolocation.d.ts +30 -0
- package/types/glTileRender.d.ts +178 -0
- package/types/glsl-modules.d.ts +26 -0
- package/types/hp.d.ts +15 -0
- package/types/http.d.ts +62 -0
- package/types/iconfont.d.ts +196 -0
- package/types/index.d.ts +1 -0
- package/types/interfaces.d.ts +1727 -0
- package/types/interpolator.d.ts +19 -0
- package/types/lang-files.d.ts +5116 -0
- package/types/latestBroadcasts.d.ts +14 -0
- package/types/layers.d.ts +78 -0
- package/types/leaflet.d.ts +1919 -0
- package/types/legends.d.ts +6 -0
- package/types/levelUtils.d.ts +2 -0
- package/types/libGuard.d.ts +1 -0
- package/types/location.d.ts +72 -0
- package/types/log.d.ts +2 -0
- package/types/lruCache.d.ts +69 -0
- package/types/map.d.ts +80 -0
- package/types/metrics.d.ts +3 -0
- package/types/mobileUtils.d.ts +7 -0
- package/types/models.d.ts +42 -0
- package/types/node-modules.d.ts +16 -0
- package/types/notifications.d.ts +66 -0
- package/types/offlineController.d.ts +20 -0
- package/types/overlays.d.ts +67 -0
- package/types/particleRenderers.d.ts +4 -0
- package/types/permanentPromos.d.ts +2 -0
- package/types/picker.d.ts +66 -0
- package/types/plugins.d.ts +3 -0
- package/types/pois.d.ts +16 -0
- package/types/products.d.ts +3 -0
- package/types/promo.d.ts +37 -0
- package/types/query.d.ts +19 -0
- package/types/queryString.d.ts +2 -0
- package/types/renderCtrl.d.ts +8 -0
- package/types/renderTile.d.ts +6 -0
- package/types/renderUtils.d.ts +107 -0
- package/types/renderers.d.ts +20 -0
- package/types/reverseName.d.ts +10 -0
- package/types/rhMessage.d.ts +3 -0
- package/types/rootScope.d.ts +152 -0
- package/types/router.d.ts +30 -0
- package/types/seoParser.d.ts +19 -0
- package/types/share.d.ts +1 -0
- package/types/showableErrorsService.d.ts +31 -0
- package/types/singleclick.d.ts +52 -0
- package/types/storage.d.ts +3 -0
- package/types/store.d.ts +148 -0
- package/types/subscription.d.ts +65 -0
- package/types/tileInterpolator.d.ts +27 -0
- package/types/tileLayerInstance.d.ts +2 -0
- package/types/timestampUtils.d.ts +5 -0
- package/types/trans.d.ts +68 -0
- package/types/ts-interfaces.d.ts +66 -0
- package/types/ts-types.d.ts +43 -0
- package/types/types.d.ts +308 -0
- package/types/user.d.ts +54 -0
- package/types/userFavs.d.ts +129 -0
- package/types/utils.d.ts +424 -0
- package/types/variables.d.ts +238 -0
- package/types/windy-modules.d.ts +7 -0
|
@@ -0,0 +1,129 @@
|
|
|
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';
|
|
5
|
+
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;
|
package/types/utils.d.ts
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import type { RegistrationError } from '@capacitor/push-notifications';
|
|
2
|
+
import type { ClientMessage } from '@plugins/offline/offline';
|
|
3
|
+
import type { RGBA } from '@windy/Color.d';
|
|
4
|
+
import type { HttpError } from '@windy/http';
|
|
5
|
+
import type { QueryStringSource } from '@windy/http.d';
|
|
6
|
+
import type { LatLon, LinearScale, TilePoint } from '@windy/interfaces.d';
|
|
7
|
+
import type { RGBNumValues } from '@windy/tileInterpolator.d';
|
|
8
|
+
import type { HTMLString, Timestamp, ExtendedStationType } from '@windy/types.d';
|
|
9
|
+
/**
|
|
10
|
+
* One minute in ms.
|
|
11
|
+
*
|
|
12
|
+
* @type {Timestamp}
|
|
13
|
+
*/
|
|
14
|
+
export declare const tsMinute: Timestamp;
|
|
15
|
+
/**
|
|
16
|
+
* One hour in ms.
|
|
17
|
+
*
|
|
18
|
+
* @type {Timestamp}
|
|
19
|
+
*/
|
|
20
|
+
export declare const tsHour: Timestamp;
|
|
21
|
+
/**
|
|
22
|
+
* Long press time in ms. to be used everywhere
|
|
23
|
+
*/
|
|
24
|
+
export declare const longPressTime: Timestamp;
|
|
25
|
+
/**
|
|
26
|
+
* Converts number to char
|
|
27
|
+
*
|
|
28
|
+
* @param {number} num Number to convert
|
|
29
|
+
* @returns Char
|
|
30
|
+
*/
|
|
31
|
+
export declare const num2char: (num: number) => string;
|
|
32
|
+
/**
|
|
33
|
+
* Convert string to number
|
|
34
|
+
*
|
|
35
|
+
* @param str Input
|
|
36
|
+
* @returns Number
|
|
37
|
+
*/
|
|
38
|
+
export declare const char2num: (str: string) => number;
|
|
39
|
+
/**
|
|
40
|
+
* Takes {lat,lon} and returns nice string out of it (rounds coords to two decimals)
|
|
41
|
+
*
|
|
42
|
+
* @param latLon { lat, lon }
|
|
43
|
+
* @returns Stringified lat lon
|
|
44
|
+
*/
|
|
45
|
+
export declare const latLon2str: <T extends LatLon>(latLon: T) => string;
|
|
46
|
+
/**
|
|
47
|
+
* Converts simple string, like `e0kagi` into latLon object
|
|
48
|
+
*
|
|
49
|
+
* @param str String
|
|
50
|
+
* @returns Object { lat, lon }
|
|
51
|
+
*/
|
|
52
|
+
export declare const str2latLon: (str: string) => LatLon;
|
|
53
|
+
/**
|
|
54
|
+
* Reusable empty function
|
|
55
|
+
*/
|
|
56
|
+
export declare const emptyFun: () => void;
|
|
57
|
+
/**
|
|
58
|
+
* Empty GIF
|
|
59
|
+
*
|
|
60
|
+
* @type {string}
|
|
61
|
+
*/
|
|
62
|
+
export declare const emptyGIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
|
|
63
|
+
/**
|
|
64
|
+
* Check if obj is a valid obj contaning lat,lon
|
|
65
|
+
* TODO - it returns true also for string coords, but guarding LatLon with only numbered coords!
|
|
66
|
+
*
|
|
67
|
+
* @param item Object to check
|
|
68
|
+
* @returns True if it is a valid object, false otherwise
|
|
69
|
+
*/
|
|
70
|
+
export declare const isValidLatLonObj: <T>(item: LatLon | T) => item is T & LatLon;
|
|
71
|
+
/**
|
|
72
|
+
* Normalizes lat,lon to 3decimal points (as we use in in URL and XHR)
|
|
73
|
+
*
|
|
74
|
+
* @param str String with coordinate
|
|
75
|
+
* @returns Normalized coordinate
|
|
76
|
+
*/
|
|
77
|
+
export declare const normalizeLatLon: (str: string | number) => string;
|
|
78
|
+
/**
|
|
79
|
+
* Just iterates dictionary
|
|
80
|
+
*
|
|
81
|
+
* @param items Object to iterate
|
|
82
|
+
* @param cb Callback called every single iteration
|
|
83
|
+
*/
|
|
84
|
+
export declare const each: <K extends string | number | symbol, V>(items: { [P in K]?: V; }, cb: (item: V, key: K) => unknown) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Makes a deep clone of an Object. Optional @propertis
|
|
87
|
+
* can contain list of @properties {Array} that will be copied.
|
|
88
|
+
* Returns new object.
|
|
89
|
+
* Usage: params = clone(rootScope,[ 'overlay','level','maps' ])
|
|
90
|
+
*
|
|
91
|
+
* @param source Source to clone
|
|
92
|
+
* @param properties Properties to clone
|
|
93
|
+
* @returns Deep copy of the source
|
|
94
|
+
*/
|
|
95
|
+
export declare const clone: <T>(source: T, properties?: (keyof T)[]) => T;
|
|
96
|
+
/**
|
|
97
|
+
* Degrees2radians
|
|
98
|
+
*
|
|
99
|
+
* @param deg Degrees
|
|
100
|
+
* @returns radians
|
|
101
|
+
*/
|
|
102
|
+
export declare const deg2rad: (deg: number) => number;
|
|
103
|
+
export declare const degToRad = 0.017453292;
|
|
104
|
+
export declare const radToDeg = 57.2957795;
|
|
105
|
+
/**
|
|
106
|
+
* Returns a function, that, as long as it continues to be invoked, will not
|
|
107
|
+
* be triggered. The function will be called after it stops being called for
|
|
108
|
+
* N milliseconds. If `immediate` is passed, trigger the function on the
|
|
109
|
+
* leading edge, instead of the trailing.
|
|
110
|
+
*
|
|
111
|
+
* @param func Function to debounce
|
|
112
|
+
* @param wait Time limit of debouncing
|
|
113
|
+
* @param immediate Should be function trigger on the leading edge or on the trailing
|
|
114
|
+
* @returns Debounced function
|
|
115
|
+
*/
|
|
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;
|
|
117
|
+
/**
|
|
118
|
+
* Retun throttling function
|
|
119
|
+
*
|
|
120
|
+
* @param this NOT USED, it is only TS explicit this annotation build-time parameter. Consider it as the first parameter would not exist.
|
|
121
|
+
* @param fn Function to throttle
|
|
122
|
+
* @param time Throttle time in ms.
|
|
123
|
+
* @returns Throttled function
|
|
124
|
+
*/
|
|
125
|
+
export declare const throttle: <Args extends unknown[], F extends (...argmtns: Args) => void>(this: ThisParameterType<F>, fn: (this: ThisParameterType<F>, ...argmtns: Args & Parameters<F>) => void, time: number) => (this: ThisParameterType<F>, ...argmtns: Args & Parameters<F>) => void;
|
|
126
|
+
/**
|
|
127
|
+
* Pad leading zeroes to the number
|
|
128
|
+
*
|
|
129
|
+
* @param {number} num Number to pad
|
|
130
|
+
* @param {number} size Digits (default 2)
|
|
131
|
+
* @returns Padded number
|
|
132
|
+
*/
|
|
133
|
+
export declare const pad: (num: number, size?: number) => string;
|
|
134
|
+
/**
|
|
135
|
+
* Replaces {keys} in a string by properties in @data structure
|
|
136
|
+
* Usage: "confirm {num}".template({num: 5})
|
|
137
|
+
*
|
|
138
|
+
* @param str String with placeholders
|
|
139
|
+
* @param data Values for placeholders
|
|
140
|
+
* @returns String with replaced placeholders
|
|
141
|
+
*/
|
|
142
|
+
export declare const template: (str: string, data?: Record<string, unknown>) => string;
|
|
143
|
+
export interface DirObject {
|
|
144
|
+
/** Direction of wind. Backend for POI detail can return VAR here, but it should never pass into this type */
|
|
145
|
+
dir: number;
|
|
146
|
+
}
|
|
147
|
+
export interface WindObject extends DirObject {
|
|
148
|
+
wind: number;
|
|
149
|
+
gust?: number | null;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Return magnitude and angle from U,V vectors for wind
|
|
153
|
+
*
|
|
154
|
+
* @param v Vector [u,v]
|
|
155
|
+
* @returns Object { wind, dir }
|
|
156
|
+
*/
|
|
157
|
+
export declare const wind2obj: (v: [number, number] | RGBNumValues) => WindObject;
|
|
158
|
+
export interface WaveObject extends DirObject {
|
|
159
|
+
period: number;
|
|
160
|
+
size: number;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Return magnitude, period and angle from U,V vectors for waves
|
|
164
|
+
*
|
|
165
|
+
* @param v Vector [u,v,size]
|
|
166
|
+
* @returns Object { wind, dir, period }
|
|
167
|
+
*/
|
|
168
|
+
export declare const wave2obj: (v: RGBNumValues) => WaveObject;
|
|
169
|
+
/**
|
|
170
|
+
* Trush if wx object has valid direction
|
|
171
|
+
*
|
|
172
|
+
* @param wx Wind object
|
|
173
|
+
* @returns True if object has a valid direction, false otherwise
|
|
174
|
+
*/
|
|
175
|
+
export declare const hasDirection: <T extends Partial<WindObject>>(wx: T) => wx is {
|
|
176
|
+
dir: number;
|
|
177
|
+
wind: number;
|
|
178
|
+
} & T;
|
|
179
|
+
/**
|
|
180
|
+
* Ruturn piece of html with rotated wind arrow
|
|
181
|
+
*
|
|
182
|
+
* @param wx Wind object
|
|
183
|
+
* @returns HTML with oriented wind arrow
|
|
184
|
+
*/
|
|
185
|
+
export declare const windDir2html: (wx: WindObject) => HTMLString;
|
|
186
|
+
/**
|
|
187
|
+
* Cheap function to determine that two points are near
|
|
188
|
+
*
|
|
189
|
+
* @param a { lat, lon }
|
|
190
|
+
* @param b { lat, lon }
|
|
191
|
+
* @returns True if points are near to each other, false otherwise
|
|
192
|
+
*/
|
|
193
|
+
export declare const isNear: <T extends LatLon, F extends LatLon>(a: T, b: F) => boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Bounds a number to a limits
|
|
196
|
+
*
|
|
197
|
+
* @param num Number to bound
|
|
198
|
+
* @param min Minimum
|
|
199
|
+
* @param max Maximum
|
|
200
|
+
* @returns Bounded number
|
|
201
|
+
*/
|
|
202
|
+
export declare const bound: (num: number, min: number, max: number) => number;
|
|
203
|
+
/**
|
|
204
|
+
* Smoothstep https://en.wikipedia.org/wiki/Smoothstep
|
|
205
|
+
*
|
|
206
|
+
* @param min Minimum
|
|
207
|
+
* @param max Maximum
|
|
208
|
+
* @param value Value
|
|
209
|
+
* @returns Smoothed value
|
|
210
|
+
*/
|
|
211
|
+
export declare const smoothstep: (min: number, max: number, value: number) => number;
|
|
212
|
+
/**
|
|
213
|
+
* longitude <-180.0; 180.0> to mercator <0.0, 1.0>
|
|
214
|
+
*
|
|
215
|
+
* @param lon Lon value
|
|
216
|
+
* @returns Mercator value of lon
|
|
217
|
+
*/
|
|
218
|
+
export declare const lonDegToXUnit: (lon: number) => number;
|
|
219
|
+
/**
|
|
220
|
+
* Latitude <-85.05; 85.05> to mercator <1.0; 0.0>
|
|
221
|
+
*
|
|
222
|
+
* @param lat01 Lat value
|
|
223
|
+
* @returns Mercator value of lat
|
|
224
|
+
*/
|
|
225
|
+
export declare const lat01ToYUnit: (lat01: number) => number;
|
|
226
|
+
/**
|
|
227
|
+
* Lattitude <85.05; -85.05> to mercator <0.0; 1.0>
|
|
228
|
+
*
|
|
229
|
+
* @param lat Lat value
|
|
230
|
+
* @returns Mercator value of lat
|
|
231
|
+
*/
|
|
232
|
+
export declare const latDegToYUnit: (lat: number) => number;
|
|
233
|
+
/**
|
|
234
|
+
* Mercator lon to deg
|
|
235
|
+
*
|
|
236
|
+
* @param ux Mercator lon value
|
|
237
|
+
* @returns Deg value
|
|
238
|
+
*/
|
|
239
|
+
export declare const unitXToLonDeg: (ux: number) => number;
|
|
240
|
+
/**
|
|
241
|
+
* Mercator lat to deg
|
|
242
|
+
*
|
|
243
|
+
* @param uy Mercator lat value
|
|
244
|
+
* @returns Deg value
|
|
245
|
+
*/
|
|
246
|
+
export declare const unitYToLatDeg: (uy: number) => number;
|
|
247
|
+
/**
|
|
248
|
+
* Mercator lon to rad <0;1> => <-PI;PI>
|
|
249
|
+
*
|
|
250
|
+
* @param ux Mercator lon value
|
|
251
|
+
* @returns Rad value
|
|
252
|
+
*/
|
|
253
|
+
export declare const unitXToLonRad: (ux: number) => number;
|
|
254
|
+
/**
|
|
255
|
+
* Mercator lat to rad <0;1> => <-PI;PI>
|
|
256
|
+
*
|
|
257
|
+
* @param uy Mercator lat value
|
|
258
|
+
* @returns Rad value
|
|
259
|
+
*/
|
|
260
|
+
export declare const unitYToLatRad: (uy: number) => number;
|
|
261
|
+
/**
|
|
262
|
+
* Returns adjusted Date.now()
|
|
263
|
+
*
|
|
264
|
+
* @param syncTime Synchronization value (ts from server)
|
|
265
|
+
* @returns Current time
|
|
266
|
+
*/
|
|
267
|
+
export declare const getAdjustedNow: (syncTime?: number) => number;
|
|
268
|
+
/**
|
|
269
|
+
* Is valid lang ISO string (the one we have translated?)
|
|
270
|
+
*
|
|
271
|
+
* @param lang Language code
|
|
272
|
+
* @returns True if language is supported, false otherwise
|
|
273
|
+
*/
|
|
274
|
+
export declare const isValidLang: (lang: string) => lang is "id" | "hr" | "th" | "tr" | "en" | "zh-TW" | "zh" | "ja" | "fr" | "ko" | "it" | "ru" | "nl" | "cs" | "pl" | "sv" | "fi" | "ro" | "el" | "hu" | "ca" | "da" | "ar" | "fa" | "hi" | "ta" | "sk" | "uk" | "bg" | "he" | "is" | "lt" | "et" | "vi" | "sl" | "sr" | "sq" | "pt" | "nb" | "es" | "de" | "bn";
|
|
275
|
+
/**
|
|
276
|
+
* Safely joins server name (without trailing / ) and path
|
|
277
|
+
*
|
|
278
|
+
* @param url1 URL to join
|
|
279
|
+
* @param url2 URL to join
|
|
280
|
+
* @returns Joined URL
|
|
281
|
+
*/
|
|
282
|
+
export declare const joinPath: (url1: string, url2: string) => string;
|
|
283
|
+
/**
|
|
284
|
+
* Safelly adds query string to url
|
|
285
|
+
*
|
|
286
|
+
* @param url URL to which the query should be attached
|
|
287
|
+
* @param query Query to attach
|
|
288
|
+
* @returns Complete URL
|
|
289
|
+
*/
|
|
290
|
+
export declare const addQs: (url: string, query: string) => string;
|
|
291
|
+
/**
|
|
292
|
+
* Creates query string out of an key value pairs
|
|
293
|
+
*
|
|
294
|
+
* @param tokensObj Object from which the query should be created
|
|
295
|
+
* @returns key1=value1&key2=value2&...
|
|
296
|
+
*/
|
|
297
|
+
export declare const qs: (tokensObj: QueryStringSource) => string;
|
|
298
|
+
/**
|
|
299
|
+
* Loads .js file by appendig it as script element appended to the <head> section of the page
|
|
300
|
+
*
|
|
301
|
+
* @param {string} url URL of script to be loaded
|
|
302
|
+
* @param callback Callback to be called on HTML script element
|
|
303
|
+
* @returns
|
|
304
|
+
*/
|
|
305
|
+
export declare const loadScript: (url: string, callback?: (s: HTMLScriptElement) => void) => Promise<void>;
|
|
306
|
+
/**
|
|
307
|
+
* Copy object to clipboard
|
|
308
|
+
*
|
|
309
|
+
* @param str String to copy into clipboard
|
|
310
|
+
*/
|
|
311
|
+
export declare const copy2clipboard: (str: string) => void;
|
|
312
|
+
/**
|
|
313
|
+
* Force download file
|
|
314
|
+
*
|
|
315
|
+
* @param data Data to be downloaded or blob
|
|
316
|
+
* @param type Content type
|
|
317
|
+
* @param name Filename
|
|
318
|
+
*/
|
|
319
|
+
export declare const download: (data: BlobPart, type: string, name: string) => void;
|
|
320
|
+
/**
|
|
321
|
+
* Capacitor only
|
|
322
|
+
* Standard & safe way how to detect & return capacitor plugin
|
|
323
|
+
*
|
|
324
|
+
* @param ident ID of plugin to load
|
|
325
|
+
* @returns Instance of the Capacitor plugin
|
|
326
|
+
*/
|
|
327
|
+
export declare const getNativePlugin: <T = unknown>(ident: string) => T;
|
|
328
|
+
/**
|
|
329
|
+
* JQuery like selector
|
|
330
|
+
*
|
|
331
|
+
* @param sel selector
|
|
332
|
+
* @param ctx Optional context where to find an selector
|
|
333
|
+
* @returns Element by selector, null if not found
|
|
334
|
+
*/
|
|
335
|
+
export declare const $: <T extends HTMLElement = HTMLElement>(sel: string, ctx?: HTMLElement) => T;
|
|
336
|
+
/**
|
|
337
|
+
* Basic function check
|
|
338
|
+
*/
|
|
339
|
+
export declare const isFunction: (p: unknown) => p is (...pr: unknown[]) => unknown;
|
|
340
|
+
/**
|
|
341
|
+
* Is event touch event
|
|
342
|
+
*/
|
|
343
|
+
export declare const isTouchEvent: (ev: TouchEvent | MouseEvent) => ev is TouchEvent;
|
|
344
|
+
/**
|
|
345
|
+
* Spline curve
|
|
346
|
+
*/
|
|
347
|
+
export declare const spline: (p0: number, p1: number, p2: number, p3: number, t: number) => number;
|
|
348
|
+
/**
|
|
349
|
+
* Cubic hermite
|
|
350
|
+
* ABCD ..control points, t ..coord <0,1>
|
|
351
|
+
*/
|
|
352
|
+
export declare const cubicHermite: (A: number, B: number, C: number, D: number, t: number) => number;
|
|
353
|
+
/**
|
|
354
|
+
* m ..array of 16 samples; s, t ..relative coords <0,1>
|
|
355
|
+
*/
|
|
356
|
+
export declare const bicubicFiltering: (m: number[] | Float32Array, s: number, t: number) => number;
|
|
357
|
+
/**
|
|
358
|
+
* clamp integer n value to interval <0, x)
|
|
359
|
+
*/
|
|
360
|
+
export declare const clamp0X: (n: number, x: number) => number;
|
|
361
|
+
/**
|
|
362
|
+
* fast lerp
|
|
363
|
+
*/
|
|
364
|
+
export declare const lerp: (a: number, b: number, f: number) => number;
|
|
365
|
+
/**
|
|
366
|
+
* fast lerp 256
|
|
367
|
+
*/
|
|
368
|
+
export declare const lerpColor256: (a: RGBA, b: RGBA, f: number) => RGBA;
|
|
369
|
+
/**
|
|
370
|
+
* Finds all [data-ref] references in DOM and returns standard
|
|
371
|
+
* refs object
|
|
372
|
+
*/
|
|
373
|
+
export declare const getRefs: <N extends HTMLElement, R extends Record<string, HTMLElement | SVGElement>>(selectorOrNode: string | N) => {
|
|
374
|
+
node: N;
|
|
375
|
+
refs: R;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* Sanitizes HTML code, escape all XSS dangerous characters
|
|
379
|
+
*/
|
|
380
|
+
export declare const sanitizeHTML: (s: string) => string;
|
|
381
|
+
/**
|
|
382
|
+
* Custom error logging function.
|
|
383
|
+
*
|
|
384
|
+
* In order to avoid circ deps we use custom Event to notify about errors
|
|
385
|
+
* errorLogger module.
|
|
386
|
+
*
|
|
387
|
+
* @param moduleName Module name where error occured
|
|
388
|
+
* @param msg Message to report, the main body of the error
|
|
389
|
+
* @param errObj Whole error object to stringification. It is sent to Kibana under 'error' property
|
|
390
|
+
*/
|
|
391
|
+
export declare function logError(moduleName: string, msg: string, errorObject?: Error | HttpError | Event | ErrorEvent | RegistrationError): void;
|
|
392
|
+
export declare const sendMessageToServiceWorker: (message: ClientMessage) => void;
|
|
393
|
+
/**
|
|
394
|
+
* Same as scale linear from d3 library except with different params
|
|
395
|
+
* https://d3js.org/d3-scale/linear
|
|
396
|
+
* @param Object { domain: [ ], range: [] }
|
|
397
|
+
* @returns Object { get, ivert }
|
|
398
|
+
*/
|
|
399
|
+
export declare const scaleLinear: ({ domain, range, clip, }: {
|
|
400
|
+
domain: [number, number];
|
|
401
|
+
range: [number, number];
|
|
402
|
+
clip?: boolean;
|
|
403
|
+
}) => LinearScale;
|
|
404
|
+
/**
|
|
405
|
+
* Unified canvasRatio used in overall Windy. Not bigger then 2
|
|
406
|
+
*/
|
|
407
|
+
export declare const canvasRatio: number;
|
|
408
|
+
/**
|
|
409
|
+
* Returns items shared between all provided arrays
|
|
410
|
+
*/
|
|
411
|
+
export declare const intersect: <T>(arrays: T[][]) => T[];
|
|
412
|
+
/**
|
|
413
|
+
* Is the weather station professional?
|
|
414
|
+
*/
|
|
415
|
+
export declare const isProfessionalStation: (type: ExtendedStationType) => boolean;
|
|
416
|
+
/**
|
|
417
|
+
* wraps x-coord to appropriate range
|
|
418
|
+
*/
|
|
419
|
+
export declare const wrapCoords: (tilePoint: TilePoint) => TilePoint;
|
|
420
|
+
/**
|
|
421
|
+
* based on target and provided locatio returns URL where to load .js asset
|
|
422
|
+
* @param location
|
|
423
|
+
*/
|
|
424
|
+
export declare const getLoacationOfJsAssets: (location: string) => string;
|