@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,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* # @windy/tileInterpolator
|
|
4
|
+
*
|
|
5
|
+
* Instance of class TileInterpolator, that extends DataTiles. Interpolates single x,y map point
|
|
6
|
+
* (for purpose of picker or POIs) into real meterological values (at that point).
|
|
7
|
+
* Can work ONLY with CanvasTileLayer instance
|
|
8
|
+
*
|
|
9
|
+
* @module tileInterpolator
|
|
10
|
+
*/
|
|
11
|
+
import { DataTiler } from '@windy/DataTiler';
|
|
12
|
+
import type { PixelInterpolationFun, CoordsInterpolationFun } from '@windy/tileInterpolator.d';
|
|
13
|
+
import type { DataTile } from './dataLoader';
|
|
14
|
+
import type { ExtendedTileParams } from '@windy/DataTiler.d';
|
|
15
|
+
import type { FullRenderParameters } from '@windy/Layer.d';
|
|
16
|
+
export declare class TileInterpolator extends DataTiler {
|
|
17
|
+
cb<T extends true | false>(f1: CoordsInterpolationFun, // async interpolator does not use fakeFun with null return type
|
|
18
|
+
f2: PixelInterpolationFun | (() => null), isAsync?: T & (true | false)): void;
|
|
19
|
+
/**
|
|
20
|
+
* Request to build interpolate function for purpose of picker & other stuff
|
|
21
|
+
* and since DataTiler is async, returns this function
|
|
22
|
+
* in a callback
|
|
23
|
+
*/
|
|
24
|
+
createFun(this: this, cb: this['cb']): void;
|
|
25
|
+
tilesReady(dTiles: DataTile[][], mapParams: ExtendedTileParams, params: FullRenderParameters): void;
|
|
26
|
+
}
|
|
27
|
+
export declare const tileInterpolator: TileInterpolator;
|
package/types/trans.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { SupportedLangFiles, Translations } from '@windy/lang-files.d';
|
|
2
|
+
import type { LoadedTranslations, LoadingOptions, TransFileInfo } from '@windy/trans.d';
|
|
3
|
+
export declare const files: Record<keyof SupportedLangFiles, TransFileInfo>;
|
|
4
|
+
/**
|
|
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.
|
|
16
|
+
*
|
|
17
|
+
* Handles versioning of the file, so each new versionof client get its correct file.
|
|
18
|
+
*
|
|
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'
|
|
21
|
+
*
|
|
22
|
+
* Can also store files with absolute URLs
|
|
23
|
+
*
|
|
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)
|
|
27
|
+
*/
|
|
28
|
+
declare const getFile: (filename: string, options?: LoadingOptions) => Promise<Translations>;
|
|
29
|
+
/**
|
|
30
|
+
* Loads external language file and attach it as a source of translations. Missing translations are presented in default english lang.
|
|
31
|
+
* It does nothing in case of english, as it is already loaded by default.
|
|
32
|
+
*
|
|
33
|
+
* @param id Id of translation file
|
|
34
|
+
* @param lang Optionally forced language, client lang is used by default
|
|
35
|
+
* @returns Translations in key-pair object. Missing translations are presented in default english lang.
|
|
36
|
+
*/
|
|
37
|
+
declare const loadLangFile: (id: keyof SupportedLangFiles, lang?: "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") => Promise<void | Translations>;
|
|
38
|
+
/**
|
|
39
|
+
* Replace all `[data-*]` translation tags with proper translation in HTML element. It overrides its innerHTML
|
|
40
|
+
* Supported data suffixes: 'title', 'placeholder', 't', 'afterbegin', 'beforeend', 'tooltipsrc'
|
|
41
|
+
*
|
|
42
|
+
* @param element HTML element where tags should be replaced
|
|
43
|
+
* @example
|
|
44
|
+
* ```
|
|
45
|
+
* data-t="PHRASE"
|
|
46
|
+
*
|
|
47
|
+
* data-afterbegin=""
|
|
48
|
+
* data-beforeend=""
|
|
49
|
+
* data-tooltipsrc="PHRASE"
|
|
50
|
+
*
|
|
51
|
+
* <p>
|
|
52
|
+
* <!-- afterbegin -->
|
|
53
|
+
* foo
|
|
54
|
+
* <!-- beforeend -->
|
|
55
|
+
* </p>
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
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 };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
declare interface HTMLCanvasElement extends HTMLElement {
|
|
2
|
+
getContext(
|
|
3
|
+
contextId: 'experimental-webgl',
|
|
4
|
+
options?: WebGLContextAttributes,
|
|
5
|
+
): WebGLRenderingContext | null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// We use <const> typed arrays (rootScope), but we want to allow `includes` check for all similar types.
|
|
9
|
+
// eg. for <const>['rain', 'thunder'] we want to allow `includes('abc'), but still disallow `includes(true)`
|
|
10
|
+
// this does the job and retype property if result is true (type guards)
|
|
11
|
+
declare interface ReadonlyArray<T> {
|
|
12
|
+
includes<U>(
|
|
13
|
+
x: U & (T & U extends never ? never : unknown),
|
|
14
|
+
): x is U & (T & U extends never ? never : T);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// And same for Array
|
|
18
|
+
declare interface Array<T> {
|
|
19
|
+
includes<U>(
|
|
20
|
+
x: U & (T & U extends never ? never : unknown),
|
|
21
|
+
): x is U & (T & U extends never ? never : T);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Make Object.keys generic and do not return the stupid string[] everytime!
|
|
25
|
+
/* eslint-disable */
|
|
26
|
+
declare interface ObjectConstructor {
|
|
27
|
+
keys<T extends object>(o: T): (keyof T)[];
|
|
28
|
+
}
|
|
29
|
+
/* eslint-enable */
|
|
30
|
+
|
|
31
|
+
declare interface Element {
|
|
32
|
+
webkitRequestFullscreen(options?: FullscreenOptions): Promise<void> | undefined;
|
|
33
|
+
mozRequestFullScreen(options?: FullscreenOptions): Promise<void>;
|
|
34
|
+
msRequestFullscreen(options?: FullscreenOptions): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare interface Document {
|
|
38
|
+
webkitExitFullscreen(): Promise<void> | undefined;
|
|
39
|
+
mozCancelFullScreen(): Promise<void>;
|
|
40
|
+
msExitFullscreen(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare interface DocumentOrShadowRoot {
|
|
44
|
+
readonly webkitFullscreenElement: Element | null;
|
|
45
|
+
readonly mozFullScreenElement: Element | null;
|
|
46
|
+
readonly msFullscreenElement: Element | null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// parseInt & parseFloat work great even for number
|
|
50
|
+
declare function parseInt(string: string | number, radix?: number): number;
|
|
51
|
+
declare function parseFloat(string: string | number): number;
|
|
52
|
+
|
|
53
|
+
// isNaN works great even for undefined
|
|
54
|
+
declare function isNaN(number?: number): boolean;
|
|
55
|
+
|
|
56
|
+
// TS thinks we have nodejs application for some reason... retype timers to the DOM variant
|
|
57
|
+
/* eslint-disable */
|
|
58
|
+
declare module 'timers' {
|
|
59
|
+
global {
|
|
60
|
+
function clearInterval(handle?: number): void;
|
|
61
|
+
function clearTimeout(handle?: number): void;
|
|
62
|
+
function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
|
|
63
|
+
function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/* eslint-enable */
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// When we need to ensure some interface implements type/interface (strict mode, no property can miss or overstay)
|
|
2
|
+
// TS has no support for "interface implements interface" yet, so we need to use this helper
|
|
3
|
+
declare type Implements<
|
|
4
|
+
T,
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
R extends T & keyof R extends keyof T ? (keyof T extends keyof R ? any : never) : never,
|
|
7
|
+
> = R;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Avoid optional parameters from interface/type
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ExcludeOptional<{ a: string; b?: string }> => { a: string }
|
|
14
|
+
*/
|
|
15
|
+
declare type ExcludeOptional<T> = {
|
|
16
|
+
[P in keyof Required<T>]: Pick<T, P> extends Required<Pick<T, P>> ? T[P] : never;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** `key: value[] | undefined` to `key: value | undefined` */
|
|
20
|
+
declare type UnwrapArray<T> = T extends (infer U)[] ? U : T;
|
|
21
|
+
|
|
22
|
+
/** Trims undefined from tuple.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* [string, undefined] => [string, undefined] | [string]
|
|
26
|
+
* [string, string | undefined] => [string, string | undefined] | [string]
|
|
27
|
+
* [string, string | undefined, string | undefined] => [string, string | undefined, string | undefined] | [string, string | undefined] | [string]
|
|
28
|
+
* [string, string | undefined, string] => [string, string | undefined, string]
|
|
29
|
+
**/
|
|
30
|
+
declare type TrimUndefinedFromRight<T extends unknown[]> = T extends [...infer R, infer H]
|
|
31
|
+
? undefined extends H
|
|
32
|
+
? TrimUndefinedFromRight<R> | [...R, H]
|
|
33
|
+
: [...R, H]
|
|
34
|
+
: T;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Converts any type to array.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* string => [string];
|
|
41
|
+
* string[] => string[]
|
|
42
|
+
**/
|
|
43
|
+
declare type Arrayify<T> = T extends [...infer R] ? [...R] : [T];
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import weatherTable from '@plugins/_shared/detail-render/weatherTable';
|
|
2
|
+
import { WeatherParameters, LatLon } from './interfaces';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ISO date string representation of the Date
|
|
6
|
+
*/
|
|
7
|
+
export type ISODateString = string;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Timestamp or any time duration in ms
|
|
11
|
+
*/
|
|
12
|
+
export type Timestamp = number;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Path in a form of YYYY/MM/DD/HH or YYYYMMDDHH based on minifest/calendar version
|
|
16
|
+
*/
|
|
17
|
+
export type Path = string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Valid subscription tiers
|
|
21
|
+
*/
|
|
22
|
+
export type SubTier = 'premium' | null;
|
|
23
|
+
|
|
24
|
+
export type Platform = 'android' | 'ios' | 'desktop';
|
|
25
|
+
|
|
26
|
+
export type Device = 'mobile' | 'tablet' | 'desktop';
|
|
27
|
+
|
|
28
|
+
export type FavType = 'alert' | 'airport' | 'station' | 'fav' | 'webcam' | 'route';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Search item types as recived from backend
|
|
32
|
+
* There is more search types as received from backend (basically all OSM types)
|
|
33
|
+
*/
|
|
34
|
+
export type SearchType =
|
|
35
|
+
| FavType
|
|
36
|
+
| 'natural'
|
|
37
|
+
| 'tourism'
|
|
38
|
+
| 'amenity'
|
|
39
|
+
| 'admin'
|
|
40
|
+
| 'highway'
|
|
41
|
+
| 'railway';
|
|
42
|
+
|
|
43
|
+
export type DetailDisplayType = 'table' | 'meteogram' | 'airgram' | 'waves' | 'wind';
|
|
44
|
+
|
|
45
|
+
export type Directions = 'N' | 'NE' | 'E' | 'SE' | 'S' | 'SW' | 'W' | 'NW';
|
|
46
|
+
|
|
47
|
+
export type AlertConditionProps = 'wind' | 'swell' | 'snow' | 'rain' | 'temp' | 'time' | 'model';
|
|
48
|
+
|
|
49
|
+
export type HTMLElementWithSlider = HTMLElement & { noUiSlider?: noUiSlider.noUiSlider };
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Meteorologigal numerial value (usually in default metric as delivered from backend)
|
|
53
|
+
*/
|
|
54
|
+
export type NumValue = number;
|
|
55
|
+
|
|
56
|
+
export type NumOrNull = NumValue | null;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Format for writing a date as "YYYY-MM-DD"
|
|
60
|
+
*/
|
|
61
|
+
export type YearMonthDay = string;
|
|
62
|
+
|
|
63
|
+
export type StationType = 'ad' | 'wmo' | 'madis' | 'buoy' | 'dbuoy' | 'pws' | 'ship';
|
|
64
|
+
export type PoiType = 'airq' | 'pgspots' | 'surfspots' | 'radiation' | 'tide';
|
|
65
|
+
export type ExtendedStationType = StationType | 'radiation' | 'airq';
|
|
66
|
+
|
|
67
|
+
export type StationId = `${ExtendedStationType}-${string}`;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Type of POI that detail can be open with
|
|
71
|
+
*/
|
|
72
|
+
export type StationOrPoiType = StationType | PoiType;
|
|
73
|
+
|
|
74
|
+
export type FlightCategory = 'I' | 'V' | 'L' | 'M' | 'U';
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Allowed type of tides
|
|
78
|
+
*/
|
|
79
|
+
export type TideIdent = 'HT' | 'LT' | 'ME' | 'MF' | 'NE' | 'NF' | 'SE' | 'SF' | 'FT' | 'ET';
|
|
80
|
+
|
|
81
|
+
export type AqiPollutant =
|
|
82
|
+
| 'bc'
|
|
83
|
+
| 'co'
|
|
84
|
+
| 'co2'
|
|
85
|
+
| 'no'
|
|
86
|
+
| 'no2'
|
|
87
|
+
| 'nox'
|
|
88
|
+
| 'o3'
|
|
89
|
+
| 'pm10'
|
|
90
|
+
| 'pm25'
|
|
91
|
+
| 'so2';
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Fully enclosed and valid HTML string, that can be inserted as innerHTML to DOM
|
|
95
|
+
* NEVER use for partial HTML codes
|
|
96
|
+
*/
|
|
97
|
+
export type HTMLString = string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Supported types or table rows as used by @plugin/detail-render and @plugin/detail
|
|
101
|
+
*/
|
|
102
|
+
export type DetailRows = keyof typeof weatherTable;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Width/Height or screenposition in Pixels
|
|
106
|
+
*/
|
|
107
|
+
export type Pixel = number;
|
|
108
|
+
|
|
109
|
+
export type SveltePluginIdent = `@plugins/${keyof import('@windy/plugins.d').SveltePlugins}`;
|
|
110
|
+
|
|
111
|
+
export type SveltePanePluginIdent =
|
|
112
|
+
`@plugins/${keyof import('@windy/plugins.d').SveltePanePlugins}`;
|
|
113
|
+
|
|
114
|
+
export type TagPluginIdent = `@plugins/${keyof import('@windy/plugins.d').TagPlugins}`;
|
|
115
|
+
|
|
116
|
+
export type BottomTagPluginIdent = `@plugins/${keyof import('@windy/plugins.d').BottomTagPlugins}`;
|
|
117
|
+
|
|
118
|
+
export type PlainPluginIdent = `@plugins/${keyof import('@windy/plugins.d').PlainPlugins}`;
|
|
119
|
+
|
|
120
|
+
export type AllPluginIdent = `@plugins/${keyof import('@windy/plugins.d').Plugins}`;
|
|
121
|
+
|
|
122
|
+
export type MeteogramLayers = 'dewpoint' | 'gh' | 'rh' | 'temp' | 'wind_u' | 'wind_v';
|
|
123
|
+
|
|
124
|
+
export type MeteogramLevels =
|
|
125
|
+
| '950h'
|
|
126
|
+
| '925h'
|
|
127
|
+
| '900h'
|
|
128
|
+
| '850h'
|
|
129
|
+
| '800h'
|
|
130
|
+
| '700h'
|
|
131
|
+
| '600h'
|
|
132
|
+
| '500h'
|
|
133
|
+
| '400h'
|
|
134
|
+
| '300h'
|
|
135
|
+
| '200h'
|
|
136
|
+
| '150h'
|
|
137
|
+
| '1000h'
|
|
138
|
+
| 'surface';
|
|
139
|
+
|
|
140
|
+
export type CapAlertSeverity /** moderate **/ =
|
|
141
|
+
| 'M'
|
|
142
|
+
/** severe **/
|
|
143
|
+
| 'S'
|
|
144
|
+
| /** extreme **/ 'E'
|
|
145
|
+
| /** unknown **/ 'A';
|
|
146
|
+
|
|
147
|
+
export type CapAlertType =
|
|
148
|
+
| 'T' /** thunderstorm **/
|
|
149
|
+
| 'R' /** rain **/
|
|
150
|
+
| 'H' /** heat **/
|
|
151
|
+
| 'W' /** wind **/
|
|
152
|
+
| 'F' /** flood **/
|
|
153
|
+
| 'L' /** low temp **/
|
|
154
|
+
| 'C' /** coastal warning **/
|
|
155
|
+
| 'I' /** fires **/
|
|
156
|
+
| 'G' /** fog **/
|
|
157
|
+
| 'N' /** tornado **/
|
|
158
|
+
| 'Q' /** air quality */
|
|
159
|
+
/** these two are new not implemented in client **/
|
|
160
|
+
| 'S' /** snow ice **/
|
|
161
|
+
| 'A' /** avalanche **/
|
|
162
|
+
| '-' /** invalid */;
|
|
163
|
+
|
|
164
|
+
export type CapAlertInfo = Record<
|
|
165
|
+
string,
|
|
166
|
+
{
|
|
167
|
+
event: string;
|
|
168
|
+
description: string;
|
|
169
|
+
instruction: string;
|
|
170
|
+
senderName: string;
|
|
171
|
+
headline: string;
|
|
172
|
+
}
|
|
173
|
+
>;
|
|
174
|
+
|
|
175
|
+
export type RouteType = 'car' | 'vfr' | 'ifr' | 'elevation' | 'boat' | 'airgram';
|
|
176
|
+
|
|
177
|
+
export type RouteMotionSpeed = {
|
|
178
|
+
[key in RouteType]: number;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export type LocationPrefecernces = {
|
|
182
|
+
status: 'notDetermined' | 'restricted' | 'denied' | 'authorized' | 'unknownState';
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export type NoticicationPrefecernces = {
|
|
186
|
+
status: 'notDetermined' | 'denied' | 'authorized' | 'provisional' | 'unknownState';
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export type GpsPreferences = {
|
|
190
|
+
status: 'denied' | 'authorized';
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export type BatteryPreferences = {
|
|
194
|
+
status: 'denied' | 'authorized';
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export type WidgetNotificationPreferences = {
|
|
198
|
+
status: 'denied' | 'authorized';
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export type GoogleServicesPreferences = {
|
|
202
|
+
status: 'denied' | 'authorized';
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export type ErrorCategory = 'location' | 'notification' | 'iCloud' | 'battery';
|
|
206
|
+
|
|
207
|
+
export type ShowableError = {
|
|
208
|
+
errorId:
|
|
209
|
+
| 'ICLOUD_9' /** iCloud denied by user settings **/
|
|
210
|
+
| 'ICLOUD_25' /** Users iCloud has full storage **/
|
|
211
|
+
| 'LOC_1' /** Location services disabled in devide (for device Android) **/
|
|
212
|
+
| 'LOC_2' /** Location services disabled for application */
|
|
213
|
+
| 'NOTIF_1' /** Notification services disabled **/
|
|
214
|
+
| 'BATTERY_1' /** Battery usage restricted */
|
|
215
|
+
| 'BACKGROUND_LOCATION_1' /** Background location usage disabled */
|
|
216
|
+
| 'WIDGET_NOTIFICATION_1' /** Notifications disabled for widgets */;
|
|
217
|
+
category: ErrorCategory;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export type ShowableErrors = {
|
|
221
|
+
unresolved: Map<string, ShowableError>;
|
|
222
|
+
closed: Set<string>;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Overlay categories used for better UI navigation
|
|
227
|
+
*/
|
|
228
|
+
export type MenuCategory =
|
|
229
|
+
| 'wind'
|
|
230
|
+
| 'rain'
|
|
231
|
+
| 'sea'
|
|
232
|
+
| 'airQ'
|
|
233
|
+
| 'drought'
|
|
234
|
+
| 'temp'
|
|
235
|
+
| 'warnings'
|
|
236
|
+
| 'clouds';
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Overlay categories used for better UI navigation
|
|
240
|
+
*/
|
|
241
|
+
export type MenuItems = MenuCategory | 'all' | 'search';
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* How long should picker-mobile stay open after user interaction
|
|
245
|
+
* It is string because of UI component dropdown returns string
|
|
246
|
+
*/
|
|
247
|
+
export type PickerMobileTimeout = '3' | '6' | '9' | '12' | 'always';
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Only these first level paths are allowe to be used in log
|
|
251
|
+
*/
|
|
252
|
+
export type LogPaths =
|
|
253
|
+
| keyof WeatherParameters
|
|
254
|
+
| 'version'
|
|
255
|
+
| 'plugin'
|
|
256
|
+
| 'pois'
|
|
257
|
+
| 'startup'
|
|
258
|
+
| 'subscription'
|
|
259
|
+
| '404'
|
|
260
|
+
| 'promo'
|
|
261
|
+
| 'airport'
|
|
262
|
+
| 'appRating'
|
|
263
|
+
| 'articles'
|
|
264
|
+
| 'detail2'
|
|
265
|
+
| 'onboarding'
|
|
266
|
+
| 'station'
|
|
267
|
+
| 'weather'
|
|
268
|
+
| 'events';
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Type of user consent
|
|
272
|
+
*/
|
|
273
|
+
export type ConsentType = 'pending' | 'rejected' | 'analytics';
|
|
274
|
+
|
|
275
|
+
export type ProductCategory = 'analysis' | 'forecast';
|
|
276
|
+
|
|
277
|
+
export type ProductIdent =
|
|
278
|
+
| 'nam-conus'
|
|
279
|
+
| 'nam-hawaii'
|
|
280
|
+
| 'nam-alaska'
|
|
281
|
+
| 'icon-eu'
|
|
282
|
+
| 'icon-d2'
|
|
283
|
+
| 'arome'
|
|
284
|
+
| 'arome-antilles'
|
|
285
|
+
| 'arome-reunion'
|
|
286
|
+
| 'cams-global'
|
|
287
|
+
| 'cams-eu'
|
|
288
|
+
| 'icon-global'
|
|
289
|
+
| 'icon-gwam'
|
|
290
|
+
| 'icon-ewam'
|
|
291
|
+
| 'hrrr-alaska'
|
|
292
|
+
| 'hrrr-conus'
|
|
293
|
+
| 'bom-access'
|
|
294
|
+
| 'ukv'
|
|
295
|
+
| 'gfs'
|
|
296
|
+
| 'gfs-wave'
|
|
297
|
+
| 'ecmwf-hres'
|
|
298
|
+
| 'ecmwf-wam'
|
|
299
|
+
| 'ecmwf-efi'
|
|
300
|
+
| 'mbeurope'
|
|
301
|
+
| 'cmems'
|
|
302
|
+
| 'intersucho'
|
|
303
|
+
| 'intersucho-firerisk'
|
|
304
|
+
| 'nasa-firms';
|
|
305
|
+
|
|
306
|
+
export type PickerOpener = LatLon & { id: string };
|
|
307
|
+
|
|
308
|
+
export type ExternalPluginIdent = `windy-plugin-${string}`;
|
package/types/user.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module user
|
|
3
|
+
*
|
|
4
|
+
* 1) Wrapper for the user store object.
|
|
5
|
+
* 2) Loads user info from the server.
|
|
6
|
+
* 3) Handles user authentication.
|
|
7
|
+
* 4) Renders user avatar.
|
|
8
|
+
*
|
|
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
|
+
* it's to avoid unnecessary render of "login" button when the user is logged in, but we still wait for the server response
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* We use ./filename to motivate rollup treeshaking
|
|
14
|
+
*/
|
|
15
|
+
import type { User } from '@windy/dataSpecifications.d';
|
|
16
|
+
import type { HttpPayload } from '@windy/http.d';
|
|
17
|
+
import type { AccountLoginResponse, UserInfo } from '@windy/user.d';
|
|
18
|
+
export declare const isLoggedIn: () => boolean;
|
|
19
|
+
export declare const isPublisher: () => boolean;
|
|
20
|
+
export declare const getInfo: () => User | null;
|
|
21
|
+
/**
|
|
22
|
+
* Safe way how to retrieve use avatar
|
|
23
|
+
* @returns link to user avatar or default avatar
|
|
24
|
+
*/
|
|
25
|
+
export declare const getAvatar: () => string;
|
|
26
|
+
export declare const getEmail: () => string;
|
|
27
|
+
export declare const getUsername: () => string;
|
|
28
|
+
export declare const getUserId: () => number;
|
|
29
|
+
/**
|
|
30
|
+
* Open login plugin so that user can log in
|
|
31
|
+
*/
|
|
32
|
+
export declare const login: () => void;
|
|
33
|
+
export declare const register: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Log out the user - remove credentials and reload all things that depends on logged-in user
|
|
36
|
+
*/
|
|
37
|
+
export declare const logout: () => void;
|
|
38
|
+
export declare const setExplicitConsent: (analytics: boolean) => void;
|
|
39
|
+
export declare const setImplicitConsent: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Check if we have received valid auth object and if yes, save it and open user plugin
|
|
42
|
+
*
|
|
43
|
+
* @param userInfo user info from account or node users
|
|
44
|
+
* @returns true if user is authenticated
|
|
45
|
+
*/
|
|
46
|
+
export declare const checkAuth: (userInfo: UserInfo) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Get info about current user from account
|
|
49
|
+
*
|
|
50
|
+
* @returns Pending HttpPayload with UserInfo or null if not authenticated
|
|
51
|
+
* @throws An exception when HTTP request fails
|
|
52
|
+
*/
|
|
53
|
+
export declare const reloadInfo: () => Promise<HttpPayload<UserInfo> | null>;
|
|
54
|
+
export declare const handleLoginResponse: (response: HttpPayload<AccountLoginResponse>) => void;
|