@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,171 @@
|
|
|
1
|
+
import { Plugin } from '@windy/Plugin';
|
|
2
|
+
import { Window } from '@windy/Window';
|
|
3
|
+
import type { PluginInitParams } from '@windy/Plugin';
|
|
4
|
+
import type { WindowInitParams } from '@windy/Window';
|
|
5
|
+
import type { PluginOpeningOptions, WindowClosingOptions } from '@windy/interfaces.d';
|
|
6
|
+
import type { InterpolatorFactory } from '@windy/interpolator';
|
|
7
|
+
import type { PluginsOpenParams, PluginsQsParams } from '@windy/plugin-params.d';
|
|
8
|
+
import type { BottomTagPlugins, SveltePanePlugins, SveltePlugins, TagPlugins } from '@windy/plugins.d';
|
|
9
|
+
import type { LoadedTranslations } from '@windy/trans.d';
|
|
10
|
+
import type { ParsedQueryString } from '@windy/queryString';
|
|
11
|
+
import type { ListeningPriority } from '@windy/singleclick.d';
|
|
12
|
+
export interface WindowPlugins extends TagPlugins, SveltePlugins, SveltePanePlugins, BottomTagPlugins {
|
|
13
|
+
}
|
|
14
|
+
/** Allowed params to WindowPlugin constructor (private and protected props are omited by default) */
|
|
15
|
+
export type WindowPluginInitParams<P extends keyof WindowPlugins> = PluginInitParams<P> & Omit<WindowInitParams, 'ident' | 'html'> & Partial<Omit<WindowPlugin<P>, 'open' | 'load' | 'refs' | 'node' | 'domEl'>>;
|
|
16
|
+
export declare abstract class WindowPlugin<P extends keyof WindowPlugins> extends Plugin<P> {
|
|
17
|
+
/**
|
|
18
|
+
* Instance of Window, that handles closing button, mounting etc
|
|
19
|
+
*/
|
|
20
|
+
window?: Window;
|
|
21
|
+
/**
|
|
22
|
+
* Is plugin mounted
|
|
23
|
+
*/
|
|
24
|
+
protected isMounted: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* ID of CSS style
|
|
27
|
+
*/
|
|
28
|
+
protected cssID: `plugin-css-${string}`;
|
|
29
|
+
/**
|
|
30
|
+
* Was CSS inserted into the DOM
|
|
31
|
+
*/
|
|
32
|
+
protected cssInserted: boolean;
|
|
33
|
+
ident: P;
|
|
34
|
+
plugin: WPluginModules[`@plugins/${P}`] & AdditionalPluginAssets;
|
|
35
|
+
/**
|
|
36
|
+
* URL title to be associated with plugin
|
|
37
|
+
*/
|
|
38
|
+
title?: keyof LoadedTranslations | string;
|
|
39
|
+
/**
|
|
40
|
+
* Attaches mobile bottom slider to the tag
|
|
41
|
+
*/
|
|
42
|
+
addMobileSlider: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Simple router, that matches URL and opens plugin
|
|
45
|
+
*
|
|
46
|
+
* Use either simple expressJs style string or RegExp for more complex matching
|
|
47
|
+
* with named groups
|
|
48
|
+
*
|
|
49
|
+
* @example /path/:lat/:lon
|
|
50
|
+
* @example /path-with-optional-param/:param?
|
|
51
|
+
* @example /^(distance|rplanner)/(?<tab>\S+)$/ ... for complex matches
|
|
52
|
+
*/
|
|
53
|
+
router?: RegExp | `/${string}`;
|
|
54
|
+
/**
|
|
55
|
+
* If router is typeof RegExp, we need some string, that will enable us to construct
|
|
56
|
+
* URL from params, so basically this string (which should have expressJs style syntax)
|
|
57
|
+
* is for that purpose.
|
|
58
|
+
*
|
|
59
|
+
* Of course, if your router is typeof string, you do not need this property at all
|
|
60
|
+
*
|
|
61
|
+
* @example /path/:lat/:lon
|
|
62
|
+
*/
|
|
63
|
+
path?: `/${string}`;
|
|
64
|
+
/**
|
|
65
|
+
* Prepends URL with SEO friendly string (e.g. /-Nastveni) in local language
|
|
66
|
+
* works only with defaultLocationAndTitle
|
|
67
|
+
*/
|
|
68
|
+
useSEOurl: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Closes plugin when swiping down (works only on mobile
|
|
71
|
+
* in plugins with BottomSlide)
|
|
72
|
+
*/
|
|
73
|
+
closeOnSwipeDown: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Closes plugin when swiping to the right
|
|
76
|
+
*/
|
|
77
|
+
closesOnSwipeRight: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Android stuff: does not close plugin on back button tap
|
|
80
|
+
*/
|
|
81
|
+
noCloseOnBackButton?: boolean;
|
|
82
|
+
interpolator?: InterpolatorFactory;
|
|
83
|
+
/**
|
|
84
|
+
* Does the window reguires keyboard input?
|
|
85
|
+
*/
|
|
86
|
+
keyboard: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Should the item be closed on click somewhere else? True for any click, false ignores everything (default), 'outside' closes Window only when clicking outside the window
|
|
89
|
+
*/
|
|
90
|
+
closeOnClick: boolean | 'outside';
|
|
91
|
+
/**
|
|
92
|
+
* Uses el.style.display = block to hide/display el on page
|
|
93
|
+
*/
|
|
94
|
+
displayBlock: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Opening of this plugin logs analytical data to GA (if allowed by user)
|
|
97
|
+
* By default is set to true
|
|
98
|
+
*/
|
|
99
|
+
logUsage: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Disable opening & closing animation
|
|
102
|
+
*/
|
|
103
|
+
noAnimation?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Class name applied to Window element
|
|
106
|
+
*/
|
|
107
|
+
className?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Attachement point, where the window will come if domEl is not specified
|
|
110
|
+
* Use data-plugin="" attribute to in HTML code, se we can distinguish between
|
|
111
|
+
* normal tags and attachement points
|
|
112
|
+
*/
|
|
113
|
+
attachPoint: string;
|
|
114
|
+
/**
|
|
115
|
+
* Indicates, that this plugin wants to recieve singleclick map events
|
|
116
|
+
* when opened and at which priority
|
|
117
|
+
*/
|
|
118
|
+
singleclickPriority: ListeningPriority | undefined;
|
|
119
|
+
constructor(params: WindowPluginInitParams<P>);
|
|
120
|
+
/**
|
|
121
|
+
* Check if plugin is loaded and decides if load or open. Params are passed to onopen fun
|
|
122
|
+
*/
|
|
123
|
+
open({ params, disableOpeningAnimation, qs }?: PluginOpeningOptions<P>): Promise<void | boolean>;
|
|
124
|
+
close(opts?: WindowClosingOptions): void;
|
|
125
|
+
/**
|
|
126
|
+
* Displays URL & tile
|
|
127
|
+
*/
|
|
128
|
+
displayURLAndTitle(params?: PluginsOpenParams[P]): void;
|
|
129
|
+
/**
|
|
130
|
+
* Ready to be overloaded: Will be called after open
|
|
131
|
+
*/
|
|
132
|
+
onopen(params?: PluginsOpenParams[P], _qs?: PluginsQsParams[P]): void;
|
|
133
|
+
/**
|
|
134
|
+
* Ready to be overloaded: Will be called before unmounting
|
|
135
|
+
*/
|
|
136
|
+
ondestroy(opts?: WindowClosingOptions): void;
|
|
137
|
+
/**
|
|
138
|
+
* Ready to be overloaded: Will be called before plugin is loaded, sync action called immediatelly after rqstOpen is fired
|
|
139
|
+
*/
|
|
140
|
+
beforeLoad(..._args: unknown[]): void;
|
|
141
|
+
/**
|
|
142
|
+
* Called by router when URL matches plugin's router (feel free to overload it)
|
|
143
|
+
*/
|
|
144
|
+
onRouteMatch({ groups }: string[] & {
|
|
145
|
+
groups: PluginsOpenParams[P];
|
|
146
|
+
}, _qs?: ParsedQueryString): PluginsOpenParams[P] | null;
|
|
147
|
+
/**
|
|
148
|
+
* When called with params, it will create valid URL for plugin
|
|
149
|
+
* as defined in router property.
|
|
150
|
+
*
|
|
151
|
+
* This is basically reverse operation of parsing URL in router
|
|
152
|
+
*/
|
|
153
|
+
getPluginUrl(params?: PluginsOpenParams[P]): string;
|
|
154
|
+
get node(): HTMLDivElement;
|
|
155
|
+
createWindow(): Window;
|
|
156
|
+
getCss(): string | undefined;
|
|
157
|
+
protected initProperties(): void;
|
|
158
|
+
protected unmount(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Append CSS styles
|
|
161
|
+
*/
|
|
162
|
+
protected mountCss(): void;
|
|
163
|
+
/**
|
|
164
|
+
* Mounting the module
|
|
165
|
+
*/
|
|
166
|
+
protected mount(): void;
|
|
167
|
+
/**
|
|
168
|
+
* After module is being mounted and fully in HTML DOM
|
|
169
|
+
*/
|
|
170
|
+
protected onmounted(): void;
|
|
171
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type MapTilesKeys = 'graymap' | 'landmaskmap' | 'simplemap' | 'graymapPatch5' | 'graymapPatch11' | 'simplemapPatch5' | 'simplemapPatch9' | 'sznmap' | 'winter' | 'satLocal' | 'sat';
|
|
2
|
+
/**
|
|
3
|
+
* Leaflet instance of actually used base layer
|
|
4
|
+
*/
|
|
5
|
+
export declare let baseLayer: L.GridLayer;
|
|
6
|
+
/**
|
|
7
|
+
* Return just record of different map tilesURLs that we use as basemap
|
|
8
|
+
*/
|
|
9
|
+
export declare const mapTilesRecord: (patchType?: string | null) => Record<MapTilesKeys, string>;
|
|
10
|
+
export declare function updateBasemap(map: L.Map): L.GridLayer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # @windy/broadcast
|
|
3
|
+
*
|
|
4
|
+
* Major Windy's event emitter (instance of class {@link Evented.Evented | Evented }), used for announcing the most important events.
|
|
5
|
+
*
|
|
6
|
+
* @module broadcast
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
import type { Broadcast } from './broadcast.d';
|
|
10
|
+
declare const bcast: Broadcast;
|
|
11
|
+
/**
|
|
12
|
+
* Major broadcast service for sending events to other parts of Windy.
|
|
13
|
+
*/
|
|
14
|
+
export default bcast;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import '@windy/colors';
|
|
2
|
+
import '@windy/metrics';
|
|
3
|
+
/**
|
|
4
|
+
* Store all user settings into cloud.
|
|
5
|
+
*
|
|
6
|
+
* @returns True if sending data to cloud passed, false otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export declare function storeSettings(): Promise<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* Loads settings from a cloud and merge them
|
|
11
|
+
*/
|
|
12
|
+
export declare function loadAndMergeSettingFromCloud(): Promise<void>;
|
package/types/css.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Adjust CSS var, optionaly a condition if current value is in selected range */
|
|
2
|
+
export declare const adjustCssValue: (ident: string, adjustPx: number, minValue?: number, maxValue?: number) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Toglles CSS on element if trigger is truish
|
|
5
|
+
*
|
|
6
|
+
* @param el DOM element
|
|
7
|
+
* @param condition if truish adds class otherwire romeves it
|
|
8
|
+
* @param cssClass CSS class
|
|
9
|
+
*/
|
|
10
|
+
export declare const toggleClass: <T extends HTMLElement>(el: T, condition: boolean, cssClass: string) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Finds a particular class in classlist of document body or any DOM el
|
|
13
|
+
* and replaces it. For example replaces class zoom-6 with zoom-5 in body
|
|
14
|
+
* if new newClass is zoom-5
|
|
15
|
+
* Usage: _.replaceClass(/pois-\S+/,'pois-' + requiredPoi)
|
|
16
|
+
*
|
|
17
|
+
* @param regExp RegExp
|
|
18
|
+
* @param newClass New class
|
|
19
|
+
* @param el HTML element
|
|
20
|
+
*/
|
|
21
|
+
export declare const replaceClass: (regExp: RegExp, newClass: string, el?: HTMLElement) => void;
|
|
22
|
+
/**
|
|
23
|
+
* The attach point for default plugins.
|
|
24
|
+
*/
|
|
25
|
+
export declare const defaultPluginsAttachPoint = "[data-plugin=\"plugins\"]";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loader service for new rendering engine
|
|
3
|
+
*/
|
|
4
|
+
import type { TransformFunction } from '@windy/Layer.d';
|
|
5
|
+
import type { TileParams } from '@windy/Renderer.d';
|
|
6
|
+
export declare class DataTile {
|
|
7
|
+
url: string;
|
|
8
|
+
status: 'undefined' | 'loaded' | 'loading' | 'failed';
|
|
9
|
+
data: ImageData['data'] | null;
|
|
10
|
+
promise?: Promise<this>;
|
|
11
|
+
headerPars?: number[];
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
z: number;
|
|
15
|
+
decodeR: TransformFunction;
|
|
16
|
+
decodeG: TransformFunction;
|
|
17
|
+
decodeB: TransformFunction;
|
|
18
|
+
transformR: TransformFunction | null;
|
|
19
|
+
transformG: TransformFunction | null;
|
|
20
|
+
transformB: TransformFunction | null;
|
|
21
|
+
constructor(url: string, tile: TileParams);
|
|
22
|
+
load(): Promise<this>;
|
|
23
|
+
}
|
|
24
|
+
export declare const dataLoader: {
|
|
25
|
+
loadTile: (tileParams: TileParams) => Promise<DataTile>;
|
|
26
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines allowed values for data store. Do not access these values directly,
|
|
3
|
+
* since format can be changed. Always use method of `store`.
|
|
4
|
+
*
|
|
5
|
+
* @module dataSpecifications
|
|
6
|
+
*/
|
|
7
|
+
import type { DataSpecifications } from '@windy/dataSpecifications.d';
|
|
8
|
+
/**
|
|
9
|
+
* Mother of all settings. All the user setting (except for large data structures) should go here
|
|
10
|
+
*/
|
|
11
|
+
declare const ds: DataSpecifications;
|
|
12
|
+
export default ds;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DeviceInfo } from '@capacitor/device';
|
|
2
|
+
/**
|
|
3
|
+
* Returns platform unique persistent id for Android and iOS, or semi-persistent generated random id for desktop
|
|
4
|
+
*
|
|
5
|
+
* @returns Platform unique persistent deviceId (iOS, Android) or generated id for desktop (stored in localstorage, so it is semi-persistent)
|
|
6
|
+
*/
|
|
7
|
+
export declare const getDeviceID: () => string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns generated semi-persistent random id
|
|
10
|
+
*
|
|
11
|
+
* @returns Generated random id (stored in localstorage, so it is semi-persistent)
|
|
12
|
+
*/
|
|
13
|
+
export declare const getVirtualDeviceID: () => string;
|
|
14
|
+
/**
|
|
15
|
+
* Returns device info if any exist
|
|
16
|
+
*
|
|
17
|
+
* @returns Device info returned by Capacitor, null for desktop or if anything failed
|
|
18
|
+
*/
|
|
19
|
+
export declare const getDeviceInfo: () => DeviceInfo | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deactivates current device from push notif backend
|
|
3
|
+
*
|
|
4
|
+
* @returns void
|
|
5
|
+
*/
|
|
6
|
+
export declare const deactivateCurrentDevice: () => Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Saves info regarding current device to localStorage and to backend
|
|
9
|
+
*
|
|
10
|
+
* @param registrationHash Push notification registration hash
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare const saveCurrentDevice: (registrationHash: string | null) => void;
|
package/types/fetch.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { CityForecastData } from '@windy/LabelsLayer.d';
|
|
2
|
+
import type { DataHash, LatLon, MeteogramDataPayload, WeatherDataPayload } from '@windy/interfaces.d';
|
|
3
|
+
import type { Pois, Products } from '@windy/rootScope.d';
|
|
4
|
+
import type { ExtendedStationType } from '@windy/types';
|
|
5
|
+
import type { HttpOptions, HttpPayload } from './http.d';
|
|
6
|
+
interface LatLonStep extends LatLon {
|
|
7
|
+
step?: number;
|
|
8
|
+
interpolate?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const getReftimeIso: (model: Products) => any;
|
|
11
|
+
/**
|
|
12
|
+
* Returns URL for webcam detail by id
|
|
13
|
+
*
|
|
14
|
+
* @param id Webcam id
|
|
15
|
+
* @returns URL for getting the webcam
|
|
16
|
+
*/
|
|
17
|
+
export declare const getWebcamDetailUrl: (id: string | number) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Returns URL for webcam list nearby lat and lon
|
|
20
|
+
*
|
|
21
|
+
* @param latLon Object with `lat` and `lon` properties
|
|
22
|
+
* @returns URL for getting list of webcams nearby lat and lon
|
|
23
|
+
*/
|
|
24
|
+
export declare const getWebcamsListUrl: <T extends LatLon & {
|
|
25
|
+
limit?: number;
|
|
26
|
+
}>({ lat, lon, limit, }: T) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Returns URL for webcam archive by id
|
|
29
|
+
*
|
|
30
|
+
* @param id Webcam id
|
|
31
|
+
* @returns URL for getting webcam archive
|
|
32
|
+
*/
|
|
33
|
+
export declare const getWebcamArchiveUrl: (id: string | number, hourly?: boolean) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Returns URL for searching webcam views using Google maps places
|
|
36
|
+
*
|
|
37
|
+
* @param {string} textQuery search query
|
|
38
|
+
* @param {LatLon} [latLon] circle center coordinates
|
|
39
|
+
* @returns {string} URL for searching webcam views
|
|
40
|
+
*/
|
|
41
|
+
export declare const getSearchWebcamViewsUrl: (textQuery: string, latLon?: LatLon) => string;
|
|
42
|
+
/**
|
|
43
|
+
* Returns URL for webcam metric. It increases counter for the ID on backend.
|
|
44
|
+
*
|
|
45
|
+
* @param id Webcam id
|
|
46
|
+
* @returns URL for ping webcam metrics
|
|
47
|
+
*/
|
|
48
|
+
export declare const getWebcamMetricsUrl: (id: string | number) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Returns URL for getting point forecast
|
|
51
|
+
*/
|
|
52
|
+
export declare const getPointForecastData: <T extends LatLonStep>(model: Products, { lat, lon, step, interpolate }: T, source: string, qs?: string, options?: HttpOptions) => Promise<HttpPayload<WeatherDataPayload<DataHash>>>;
|
|
53
|
+
/**
|
|
54
|
+
* Returns URL for getting meteogram forecast
|
|
55
|
+
*/
|
|
56
|
+
export declare const getMeteogramForecastData: <T extends LatLonStep>(model: Products, { lat, lon, step }: T, options?: HttpOptions) => Promise<HttpPayload<MeteogramDataPayload>>;
|
|
57
|
+
/**
|
|
58
|
+
* Returns URL for getting archive forecast
|
|
59
|
+
*/
|
|
60
|
+
export declare const getArchiveForecastData: <T extends LatLon>(model: Products, { lat, lon }: T, source: string, qs?: string, options?: HttpOptions) => Promise<HttpPayload<WeatherDataPayload<DataHash>>>;
|
|
61
|
+
/**
|
|
62
|
+
* Returns URL for getting citytile forecast
|
|
63
|
+
*
|
|
64
|
+
* @param model Forecast model
|
|
65
|
+
* @param frag Mercator frag in {z}/{x}/{y} format
|
|
66
|
+
* @param options HTTP options
|
|
67
|
+
* @returns URL for getting citytile forecast
|
|
68
|
+
*/
|
|
69
|
+
export declare const getCitytileData: (model: Products, frag: string, options?: HttpOptions) => Promise<HttpPayload<CityForecastData> | null>;
|
|
70
|
+
/**
|
|
71
|
+
* Returns URL for nearest POI items (stations, airQ, ...)
|
|
72
|
+
* @param param0
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
75
|
+
export declare const getNearestPoiItemsUrl: (type: Pois | 'stations', { lat, lon }: LatLon) => string;
|
|
76
|
+
/**
|
|
77
|
+
* Returns URL for tide forecast
|
|
78
|
+
*/
|
|
79
|
+
export declare const getTideForecastUrl: <T extends LatLonStep>({ lat, lon }: T) => string;
|
|
80
|
+
/**
|
|
81
|
+
* Returns URL for tide POI
|
|
82
|
+
*/
|
|
83
|
+
export declare const getTidePoiUrl: (id: string) => string;
|
|
84
|
+
/**
|
|
85
|
+
* Get observations URL
|
|
86
|
+
*/
|
|
87
|
+
export declare const getObservationsUrl: (type: ExtendedStationType, id: string, daysFrom: number, daysTo?: number) => string;
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module format
|
|
3
|
+
*
|
|
4
|
+
* Various formatting utils based on user language and settings
|
|
5
|
+
*/
|
|
6
|
+
import type { DirectionFunction, HowOldOptions, TimeFormatFunction } from '@windy/format.d';
|
|
7
|
+
import type { Timestamp } from '@windy/types';
|
|
8
|
+
/**
|
|
9
|
+
* Returns function for displaying hours (either 12,24h format) on a basis of locale store of a browser
|
|
10
|
+
* US, UK, PH, CA, AU, NZ, IN, EG, SA, CO, PK, MY - AM,PM format
|
|
11
|
+
*
|
|
12
|
+
* @returns Time format function
|
|
13
|
+
*/
|
|
14
|
+
export declare const getHoursFunction: () => TimeFormatFunction;
|
|
15
|
+
/**
|
|
16
|
+
* Returns UTC formated hours, e.g. '09:00Z' or '18:00Z'
|
|
17
|
+
*
|
|
18
|
+
* @param ts Timestamp
|
|
19
|
+
* @returns Formated UTC hours in a format '09:00Z' or '18:00Z'
|
|
20
|
+
*/
|
|
21
|
+
export declare const hourUTC: (ts: number) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Returns UTC formated hours and minutes, e.g. '09:22Z' or '18:57Z'
|
|
24
|
+
*
|
|
25
|
+
* @param ts Timestamp
|
|
26
|
+
* @returns Formated UTC hours and minutes in a format '09:22Z' or '18:57Z'
|
|
27
|
+
*/
|
|
28
|
+
export declare const hourMinuteUTC: (ts: number) => string;
|
|
29
|
+
/**
|
|
30
|
+
* => Format numbers with thousands delimiters, e.g. '10 000'
|
|
31
|
+
*
|
|
32
|
+
* @param amount Number to format
|
|
33
|
+
* @returns Formated number with thousands delimiter, e.g. '10 000'. Empty string if nothing is passed.
|
|
34
|
+
*/
|
|
35
|
+
export declare const thousands: (amount?: string | number | null) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Returns direction formatting function based on user's settings. E.g. 'N', 'NE', ... or '123°'
|
|
38
|
+
*
|
|
39
|
+
* @returns Format function to convert number into 'N', 'NE', ... strings or '123°' strings
|
|
40
|
+
*/
|
|
41
|
+
export declare const getDirFunction: () => DirectionFunction;
|
|
42
|
+
/**
|
|
43
|
+
* Returns CSS class name based on how obsolete data are
|
|
44
|
+
*
|
|
45
|
+
* @param updatedSecAgo Last update in seconds ago
|
|
46
|
+
* @param limitInMins Limit in minutes to consider update obsolete (default: 30)
|
|
47
|
+
* @returns fresh, normal (30% - 100% of limit) or obsolete for > limit
|
|
48
|
+
*/
|
|
49
|
+
export declare const obsoleteClass: (updatedSecAgo: number, limitInMins?: number) => 'fresh' | 'normal' | 'obsolete';
|
|
50
|
+
/**
|
|
51
|
+
* Returns string declaring when some event happened in the past, e.g. '5 days', '5 days ago', '4 hours 15 minutes' etc...
|
|
52
|
+
*
|
|
53
|
+
* @param options Options for output
|
|
54
|
+
* @returns '5 days', '5 days ago', '4 hours 15 minutes' etc... Empty string if any error occurs
|
|
55
|
+
*/
|
|
56
|
+
export declare const howOld: (options: HowOldOptions) => string;
|
|
57
|
+
export declare const countdown: (ts: Timestamp, options?: {
|
|
58
|
+
showSeconds?: boolean;
|
|
59
|
+
}) => string;
|
|
60
|
+
/**
|
|
61
|
+
* Converts lat,lon numbers to human friendly Degrees, Minutes and Seconds format, e.g. N49°9'21", E14°7'30"
|
|
62
|
+
*
|
|
63
|
+
* @param lat Latitude
|
|
64
|
+
* @param lon Longitude
|
|
65
|
+
* @returns DMS format of lat,lon, e.g. N49°9'21", E14°7'30"
|
|
66
|
+
*/
|
|
67
|
+
export declare const DD2DMS: (lat: number, lon: number) => string;
|
|
68
|
+
/**
|
|
69
|
+
* Get standard UTC offset string from number, e.g. -02:00, +08:00 etc.
|
|
70
|
+
*
|
|
71
|
+
* @param offsetInHours Offset of hours (could be negative as well)
|
|
72
|
+
* @returns UTC offset string, e.g. "-02:00", "+08:00" etc.
|
|
73
|
+
*/
|
|
74
|
+
export declare const utcOffsetStr: (offsetInHours: number) => string;
|
|
75
|
+
/**
|
|
76
|
+
* Format URL for purpose of SEO (slashes / are preserved)
|
|
77
|
+
*
|
|
78
|
+
* @param str String to format
|
|
79
|
+
* @returns Cleaned-up string from whitespaces and special chars (slashes / are preserved)
|
|
80
|
+
*/
|
|
81
|
+
export declare const seoUrlString: (str: string) => string;
|
|
82
|
+
/**
|
|
83
|
+
* Format string for purpose of SEO
|
|
84
|
+
*
|
|
85
|
+
* @param str String to format
|
|
86
|
+
* @returns Cleaned-up string from whitespaces and special chars
|
|
87
|
+
*/
|
|
88
|
+
export declare const seoString: (str: string) => string;
|
|
89
|
+
/**
|
|
90
|
+
* Get lang prefix for URL SEO purposes. English is default without any prefix
|
|
91
|
+
*
|
|
92
|
+
* @param lang Language
|
|
93
|
+
* @returns URL prefix with lang, e.g. `cs/` or `es/`. Empty string is returned for default lang (English)
|
|
94
|
+
*/
|
|
95
|
+
export declare const seoLang: (lang: string) => string;
|
|
96
|
+
/**
|
|
97
|
+
* Animates increasing numbers into HTML element
|
|
98
|
+
*
|
|
99
|
+
* @param viewcount Number to show at animation end
|
|
100
|
+
* @param el HTML element where animate counting and show the final number
|
|
101
|
+
*/
|
|
102
|
+
export declare const animateViews: (viewcount: number, el: HTMLElement) => void;
|
package/types/ga.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pageview: (page: string) => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import '@windy/router';
|
|
2
|
+
import type { GeolocationInfo, HomeLocation } from '@windy/interfaces.d';
|
|
3
|
+
import type { PositionOptions } from '@capacitor/geolocation';
|
|
4
|
+
/**
|
|
5
|
+
* Returns either GPS or IP location whichever is newer
|
|
6
|
+
*
|
|
7
|
+
* @returns Location got from GPS or IP, the newer is prefered
|
|
8
|
+
*/
|
|
9
|
+
export declare const getMyLatestPos: () => GeolocationInfo;
|
|
10
|
+
/**
|
|
11
|
+
* Returns promise on GPS based location with GeoIP location as a fallback
|
|
12
|
+
*
|
|
13
|
+
* @param options Optionally custom options passed to Capacitor geolocation plugin
|
|
14
|
+
* @returns Geolocation info from GPS, GeoIP as a fallback
|
|
15
|
+
*/
|
|
16
|
+
export declare const getGPSlocation: (options?: PositionOptions) => Promise<GeolocationInfo>;
|
|
17
|
+
/**
|
|
18
|
+
* Returns fallback name created from lat,lon if nothing else can be used
|
|
19
|
+
*
|
|
20
|
+
* @param lat Latitude
|
|
21
|
+
* @param lon Longitude
|
|
22
|
+
* @returns Fallback location name in a format "49.15, 14.18"
|
|
23
|
+
*/
|
|
24
|
+
export declare const getFallbackName: (lat: number | string, lon: number | string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Gets accurate home location. Cannot be used in map initialization beacause it is async.
|
|
27
|
+
*
|
|
28
|
+
* @param cb Callback function to call when location is get. Location info object is passed as a callback argument
|
|
29
|
+
*/
|
|
30
|
+
export declare const getHomeLocation: (cb: (loc: GeolocationInfo | HomeLocation) => void) => void;
|