@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.
Files changed (137) hide show
  1. package/README.md +3 -0
  2. package/index.mjs +298 -0
  3. package/package.json +9 -0
  4. package/publishExamples.sh +19 -0
  5. package/types/AromeProduct.d.ts +5 -0
  6. package/types/Bar.d.ts +114 -0
  7. package/types/BindedBar.d.ts +51 -0
  8. package/types/BindedCheckbox.d.ts +30 -0
  9. package/types/BindedSwitch.d.ts +35 -0
  10. package/types/BottomSlide.d.ts +53 -0
  11. package/types/BottomTagPlugin.d.ts +8 -0
  12. package/types/Calendar.d.ts +149 -0
  13. package/types/ClickHandler.d.ts +19 -0
  14. package/types/Color.d.ts +175 -0
  15. package/types/DataTiler.d.ts +41 -0
  16. package/types/Drag.d.ts +43 -0
  17. package/types/DraggableDiv.d.ts +21 -0
  18. package/types/DropDown.d.ts +37 -0
  19. package/types/EcmwfAnalysisProduct.d.ts +5 -0
  20. package/types/EcmwfProduct.d.ts +29 -0
  21. package/types/Evented.d.ts +78 -0
  22. package/types/ExternalSveltePlugin.d.ts +29 -0
  23. package/types/Favs.d.ts +83 -0
  24. package/types/GhostBox.d.ts +17 -0
  25. package/types/GlObj.d.ts +252 -0
  26. package/types/HrrrProducts.d.ts +5 -0
  27. package/types/IconProducts.d.ts +5 -0
  28. package/types/LabelsLayer.d.ts +2 -0
  29. package/types/LandMask.d.ts +2 -0
  30. package/types/Layer.d.ts +137 -0
  31. package/types/Legend.d.ts +6 -0
  32. package/types/LongTap.d.ts +21 -0
  33. package/types/Metric.d.ts +132 -0
  34. package/types/MetricClasses.d.ts +37 -0
  35. package/types/MobileCalendar.d.ts +47 -0
  36. package/types/NamProducts.d.ts +5 -0
  37. package/types/OfflineMessagesClasses.d.ts +30 -0
  38. package/types/Overlay.d.ts +150 -0
  39. package/types/OverlayClasses.d.ts +29 -0
  40. package/types/Particles.d.ts +111 -0
  41. package/types/Plugin.d.ts +112 -0
  42. package/types/Product.d.ts +211 -0
  43. package/types/ProductSwitch.d.ts +14 -0
  44. package/types/Renderer.d.ts +69 -0
  45. package/types/SatelliteProduct.d.ts +19 -0
  46. package/types/Scrollable.d.ts +14 -0
  47. package/types/StaticProduct.d.ts +7 -0
  48. package/types/SveltePanePlugin.d.ts +18 -0
  49. package/types/SveltePlugin.d.ts +40 -0
  50. package/types/Swipe.d.ts +34 -0
  51. package/types/Switch.d.ts +24 -0
  52. package/types/TagPlugin.d.ts +6 -0
  53. package/types/TileLayer.d.ts +9 -0
  54. package/types/TileLayerCanvas.d.ts +2 -0
  55. package/types/TileLayerMultiPatch.d.ts +2 -0
  56. package/types/TimestampBar.d.ts +8 -0
  57. package/types/Webcams.d.ts +66 -0
  58. package/types/Window.d.ts +107 -0
  59. package/types/WindowPlugin.d.ts +171 -0
  60. package/types/baseMap.d.ts +10 -0
  61. package/types/broadcast.d.ts +14 -0
  62. package/types/cityLabels.d.ts +2 -0
  63. package/types/cloudSync.d.ts +12 -0
  64. package/types/colors.d.ts +4 -0
  65. package/types/connection.d.ts +4 -0
  66. package/types/css.d.ts +25 -0
  67. package/types/dataLoader.d.ts +26 -0
  68. package/types/dataSpecifications.d.ts +12 -0
  69. package/types/detectDevice.d.ts +6 -0
  70. package/types/device.d.ts +19 -0
  71. package/types/deviceLogging.d.ts +13 -0
  72. package/types/fetch.d.ts +88 -0
  73. package/types/format.d.ts +102 -0
  74. package/types/ga.d.ts +1 -0
  75. package/types/geolocation.d.ts +30 -0
  76. package/types/glTileRender.d.ts +178 -0
  77. package/types/glsl-modules.d.ts +26 -0
  78. package/types/hp.d.ts +15 -0
  79. package/types/http.d.ts +62 -0
  80. package/types/iconfont.d.ts +196 -0
  81. package/types/index.d.ts +1 -0
  82. package/types/interfaces.d.ts +1727 -0
  83. package/types/interpolator.d.ts +19 -0
  84. package/types/lang-files.d.ts +5116 -0
  85. package/types/latestBroadcasts.d.ts +14 -0
  86. package/types/layers.d.ts +78 -0
  87. package/types/leaflet.d.ts +1919 -0
  88. package/types/legends.d.ts +6 -0
  89. package/types/levelUtils.d.ts +2 -0
  90. package/types/libGuard.d.ts +1 -0
  91. package/types/location.d.ts +72 -0
  92. package/types/log.d.ts +2 -0
  93. package/types/lruCache.d.ts +69 -0
  94. package/types/map.d.ts +80 -0
  95. package/types/metrics.d.ts +3 -0
  96. package/types/mobileUtils.d.ts +7 -0
  97. package/types/models.d.ts +42 -0
  98. package/types/node-modules.d.ts +16 -0
  99. package/types/notifications.d.ts +66 -0
  100. package/types/offlineController.d.ts +20 -0
  101. package/types/overlays.d.ts +67 -0
  102. package/types/particleRenderers.d.ts +4 -0
  103. package/types/permanentPromos.d.ts +2 -0
  104. package/types/picker.d.ts +66 -0
  105. package/types/plugins.d.ts +3 -0
  106. package/types/pois.d.ts +16 -0
  107. package/types/products.d.ts +3 -0
  108. package/types/promo.d.ts +37 -0
  109. package/types/query.d.ts +19 -0
  110. package/types/queryString.d.ts +2 -0
  111. package/types/renderCtrl.d.ts +8 -0
  112. package/types/renderTile.d.ts +6 -0
  113. package/types/renderUtils.d.ts +107 -0
  114. package/types/renderers.d.ts +20 -0
  115. package/types/reverseName.d.ts +10 -0
  116. package/types/rhMessage.d.ts +3 -0
  117. package/types/rootScope.d.ts +152 -0
  118. package/types/router.d.ts +30 -0
  119. package/types/seoParser.d.ts +19 -0
  120. package/types/share.d.ts +1 -0
  121. package/types/showableErrorsService.d.ts +31 -0
  122. package/types/singleclick.d.ts +52 -0
  123. package/types/storage.d.ts +3 -0
  124. package/types/store.d.ts +148 -0
  125. package/types/subscription.d.ts +65 -0
  126. package/types/tileInterpolator.d.ts +27 -0
  127. package/types/tileLayerInstance.d.ts +2 -0
  128. package/types/timestampUtils.d.ts +5 -0
  129. package/types/trans.d.ts +68 -0
  130. package/types/ts-interfaces.d.ts +66 -0
  131. package/types/ts-types.d.ts +43 -0
  132. package/types/types.d.ts +308 -0
  133. package/types/user.d.ts +54 -0
  134. package/types/userFavs.d.ts +129 -0
  135. package/types/utils.d.ts +424 -0
  136. package/types/variables.d.ts +238 -0
  137. package/types/windy-modules.d.ts +7 -0
@@ -0,0 +1,6 @@
1
+ import type { DataTile } from '@windy/dataLoader';
2
+ import type { TileParams } from '@windy/Renderer.d';
3
+ import type { TileLayerCanvas } from '@windy/TileLayerCanvas.d';
4
+ declare const renderNoDataTile: (canvas: HTMLCanvasElement, url?: string) => void;
5
+ declare const renderTile: (this: TileLayerCanvas, step: 1 | 2, canvas: HTMLCanvasElement, rqrdSyncNum: number, tInfo: TileParams, dTile: DataTile) => void;
6
+ export { renderTile, renderNoDataTile };
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Shared rendering utilities (and also event emmiter for rendering purposes)
3
+ */
4
+ import { Evented } from '@windy/Evented';
5
+ import type { Color } from '@windy/Color';
6
+ import type { Layer } from '@windy/Layer';
7
+ import type { FullRenderParameters } from '@windy/Layer.d';
8
+ import type { DataQuality } from '@windy/Product.d';
9
+ import type { TileParams } from '@windy/Renderer.d';
10
+ import type { TilePoint } from '@windy/interfaces.d';
11
+ interface Events {
12
+ rendered: ['particles' | 'isolines' | 'map' | 'radar' | 'satellite' | 'tileLayer'];
13
+ glParticlesFailed: [];
14
+ toggleSeaMask: [boolean];
15
+ toggleLandMask: [boolean];
16
+ }
17
+ export declare const emitter: Evented<Events>;
18
+ /**
19
+ * Zoom2zoom transformation table
20
+ *
21
+ * Maximal zoomlevels:
22
+ *
23
+ * GFS 0, 1, 2
24
+ * ECMWF 0, 1, 2, 3
25
+ * NAM/MBEUROPE 0, 1, 2, 3, 4, 5
26
+ *
27
+ * WARNING: Minimal dataZoom for map zooms 10,11 is 3 since
28
+ * maximal amount of data -> pixel trnasition ration is 256 !!!
29
+ *
30
+ * NOTE: particles don't work for zoom 0 on -180/180 border ("low" map zooms 3 & 4 changed to data zoom 1)
31
+ */
32
+ export declare const zoom2zoom: Record<DataQuality, number[]>;
33
+ /**
34
+ * Return tiles width (amount of tiles) based on zoom level
35
+ */
36
+ export declare const tileW: (zoom: number) => number;
37
+ /**
38
+ * return transormation ratio based on map zoom and data zoom
39
+ */
40
+ export declare const getTrans: (mapZoom: number, dZoom: number) => number;
41
+ /**
42
+ * Return data zoom based on params
43
+ * BUG: Sometime we receive not valid dataQuality
44
+ * if upgradeDataQuality flag is set upgrade to better quality
45
+ */
46
+ export declare const getDataZoom: (params: FullRenderParameters, tileZoom: number) => number;
47
+ /**
48
+ * Returns coordinates and details of data tile based on map tile or null if out of bounds
49
+ */
50
+ export declare const whichTile: (tilePoint: TilePoint, params: FullRenderParameters) => TileParams | null;
51
+ /**
52
+ * Test that values in blue channel are bigger than X,
53
+ * which means transparensu for this point in JPG data tile
54
+ */
55
+ export declare const testJPGtransparency: (source: Uint8ClampedArray, sourceIndex: number) => boolean;
56
+ /**
57
+ * Test transparency of PNGoverlay
58
+ */
59
+ export declare const testPNGtransparency: (source: Uint8ClampedArray, sourceIndex: number) => boolean;
60
+ /**
61
+ * Object containing 3D tables with precalculated
62
+ * interpolation wights
63
+ *
64
+ * @description
65
+ *
66
+ * key is trans number (1,2,4,8...)
67
+ * ```
68
+ * wTables = {
69
+ * '2': [ p00w1, p00w2, p00w3, p00w4, p01w1, p01w2, p01w3, p01w4,
70
+ * p10w1, p10w2, p10w3, p10w4, p00w1, p00w2, p00w3, p00w4 ]
71
+ *
72
+ * }
73
+ * ```
74
+ */
75
+ export declare const wTables: Record<number, Uint16Array>;
76
+ /**
77
+ * get wTable (and generate it if not done yet)
78
+ */
79
+ export declare const getWTable: (trans: number) => Uint16Array | null;
80
+ export type ColorizingFun = (x: number, y: number, scalar: number) => void;
81
+ /**
82
+ * Create function for colorizing x,y, point in step x step area
83
+ * Allowd values of step are 1,2
84
+ * Colorizes only for 256x256 tiles
85
+ */
86
+ export declare const createFillFun: (dest: Uint8ClampedArray, step: 1 | 2, col: Color) => ColorizingFun;
87
+ export type CombinedColorizingFun = (x: number, y: number, value1: number, value2: number) => void;
88
+ /**
89
+ * Create special colorizing function for 256x256 tile
90
+ * that will combine two overlays (applies only for 2x2) pixels
91
+ * Amount can be 0..4
92
+ *
93
+ * [1,2]
94
+ * [3,4]
95
+ */
96
+ export declare const createCombinedFillFun: (dest: Uint8ClampedArray, c1: Color, c2: Color, amountFun: Layer['getAmountByColor']) => CombinedColorizingFun;
97
+ /**
98
+ * Reusable 256x256 image data object
99
+ * WARNING: Watch concurency,only one task can use this
100
+ */
101
+ export declare const imgData: ImageData;
102
+ /**
103
+ * Interpolates to nearest discreet value either by using intrpolation table
104
+ * or a,b,c,d coefs
105
+ */
106
+ export declare const interpolateNearest: (w: number[] | null, wIndex: number, G00: number, G01: number, G10: number, G11: number, a: number, b: number, c: number, d: number) => number;
107
+ export {};
@@ -0,0 +1,20 @@
1
+ import { Renderer } from '@windy/Renderer';
2
+ import { TileLayer } from '@windy/TileLayer';
3
+ declare const renderers: {
4
+ /**
5
+ * All layers should be now supported by gl-tiles-render
6
+ * Original tileLayer and patternator rendering ('legacy-tile-render')
7
+ * is used as backup (or when "Compatibility mode" is active)
8
+ */
9
+ tileLayer: TileLayer;
10
+ noUserControl: TileLayer;
11
+ radar: Renderer<"radar", typeof import("@plugins/_radar/radar")>;
12
+ satellite: Renderer<"satellite", typeof import("@plugins/satellite/satellite")>;
13
+ capAlerts: Renderer<"cap-alerts", typeof import("@plugins/cap-alerts/cap-alerts")>;
14
+ isolines: Renderer<"isolines", typeof import("@plugins/isolines/isolines")>;
15
+ particles: Renderer<"gl-particles", typeof import("@plugins/gl-particles/gl-particles")> | Renderer<"particles", typeof import("@plugins/particles/particles")>;
16
+ /** Extreme forecast and intersucho layers */
17
+ daySwitcher: TileLayer;
18
+ accumulations: TileLayer;
19
+ };
20
+ export default renderers;
@@ -0,0 +1,10 @@
1
+ import type { ReverseResult } from '@windy/dataSpecifications.d';
2
+ import type { LatLon } from '@windy/interfaces.d';
3
+ /**
4
+ * Returns reverse data for given lat,lon
5
+ *
6
+ * @param latLon `lat` and `lon` of the place to geo reverse
7
+ * @param forcedZoom Optionally zoom to force
8
+ * @returns Reverse data, fallback object if anything failed
9
+ */
10
+ export declare const get: <T extends LatLon>({ lat, lon }: T, forcedZoom?: number) => Promise<ReverseResult>;
@@ -0,0 +1,3 @@
1
+ import type { HTMLString } from '@windy/types';
2
+ export declare const insert: (html: HTMLString) => void;
3
+ export declare const clear: () => void;
@@ -0,0 +1,152 @@
1
+ import type { Iconfont } from '@windy/iconfont';
2
+ import type { Isolines, Pois } from '@windy/rootScope.d';
3
+ import type { LoadedTranslations } from '@windy/trans.d';
4
+ /**
5
+ * Version of Windy.com client (as taken from package.json)
6
+ * @ignore
7
+ */
8
+ export declare const version: string;
9
+ /**
10
+ * Target
11
+ * @ignore
12
+ */
13
+ export declare const target: "index" | "mobile" | "lib" | "embed2";
14
+ /**
15
+ * Platform
16
+ * @ignore
17
+ */
18
+ export declare const platform: import("../../types/types").Platform;
19
+ /**
20
+ * Device
21
+ * @ignore
22
+ */
23
+ export declare const device: import("../../types/types").Device;
24
+ /**
25
+ * List of Windy's supported languages
26
+ */
27
+ export declare const supportedLanguages: readonly ["en", "zh-TW", "zh", "ja", "fr", "ko", "it", "ru", "nl", "cs", "tr", "pl", "sv", "fi", "ro", "el", "hu", "hr", "ca", "da", "ar", "fa", "hi", "ta", "sk", "uk", "bg", "he", "is", "lt", "et", "vi", "sl", "sr", "id", "th", "sq", "pt", "nb", "es", "de", "bn"];
28
+ /**
29
+ * Server used to download weather data files. DO NOT PUT TRAILING "/" TO THE URL
30
+ * @ignore
31
+ */
32
+ export declare const server: string;
33
+ /**
34
+ * Server, where our node.js APIs are running. DO NOT PUT TRAILING "/" TO THE URL
35
+ * @ignore
36
+ */
37
+ export declare let nodeServer: string;
38
+ /**
39
+ * For debugging purposes, you can change the server used to query our APIs
40
+ * @ignore
41
+ */
42
+ export declare const setNodeServer: (value: string) => void;
43
+ /**
44
+ * Map tile server
45
+ * @ignore
46
+ */
47
+ export declare const tileServer: string;
48
+ /**
49
+ * Community forum DO NOT PUT TRAILING "/" TO THE URL
50
+ * @ignore
51
+ */
52
+ export declare const community = "<!-- @echo NODEBB_HOST -->";
53
+ /**
54
+ * Where all the assets (libs,fonts,plugins,lang files) are located
55
+ *
56
+ * if (DEBUG && TARGET_LIB) assets = 'http://prod.windy.com:8000/v/' + W.assets;
57
+ *
58
+ * @ignore
59
+ */
60
+ export declare const assets: string;
61
+ /**
62
+ * Supported list of weather levels
63
+ */
64
+ export declare const levels: readonly ["surface", "100m", "975h", "950h", "925h", "900h", "850h", "800h", "700h", "600h", "500h", "400h", "300h", "250h", "200h", "150h", "10h"];
65
+ /**
66
+ * Point forecast API endpoint prefix
67
+ * @ignore
68
+ */
69
+ export declare const pointForecast = "v2.7";
70
+ /**
71
+ * Directory containing latest weather icons
72
+ * @ignore
73
+ */
74
+ export declare const iconsDir = "<!-- @echo IMG_RELATIVE_PATH -->/icons6";
75
+ /**
76
+ * List of valid overlay identifiers
77
+ */
78
+ export declare const overlays: readonly ["radar", "satellite", "wind", "gust", "gustAccu", "turbulence", "icing", "rain", "rainAccu", "snowAccu", "snowcover", "ptype", "thunder", "temp", "dewpoint", "rh", "deg0", "wetbulbtemp", "solarpower", "uvindex", "clouds", "hclouds", "mclouds", "lclouds", "fog", "cloudtop", "cbase", "visibility", "cape", "ccl", "waves", "swell1", "swell2", "swell3", "wwaves", "sst", "currents", "currentsTide", "no2", "pm2p5", "aod550", "gtco3", "tcso2", "go3", "cosc", "dustsm", "pressure", "efiTemp", "efiWind", "efiRain", "capAlerts", "soilMoisture40", "soilMoisture100", "moistureAnom40", "moistureAnom100", "drought40", "drought100", "fwi", "dfm10h"];
79
+ /**
80
+ * List of valid accumulation times
81
+ */
82
+ export declare const acTimes: readonly ["next12h", "next24h", "next2d", "next48h", "next60h", "next3d", "next5d", "next10d"];
83
+ /**
84
+ * Identifier of products that cover only certain area
85
+ */
86
+ export declare const localProducts: readonly ["nems", "namConus", "namHawaii", "namAlaska", "iconEu", "iconD2", "arome", "aromeAntilles", "aromeReunion", "camsEu", "iconEuWaves", "hrrrAlaska", "hrrrConus", "bomAccess", "ukv"];
87
+ /**
88
+ * Identifiers of global products
89
+ */
90
+ export declare const globalProducts: readonly ["gfs", "ecmwf", "ecmwfAnalysis", "radar", "ecmwfWaves", "gfsWaves", "icon", "iconWaves", "capAlerts", "cams", "efi", "satellite", "cmems", "drought", "fireDanger", "activeFires"];
91
+ /**
92
+ * Identifiers of sea products
93
+ */
94
+ export declare const seaProducts: readonly ["ecmwfWaves", "gfsWaves", "iconWaves", "iconEuWaves", "cmems"];
95
+ /**
96
+ * identifiers of air quality product
97
+ */
98
+ export declare const airQualityProducts: readonly ["cams", "camsEu"];
99
+ /**
100
+ * identifiers of local products, that have point forecast
101
+ */
102
+ export declare const localPointProducts: readonly ["namConus", "namHawaii", "namAlaska", "iconD2", "iconEu", "iconEuWaves", "arome", "aromeAntilles", "aromeReunion", "hrrrAlaska", "hrrrConus", "bomAccess", "ukv"];
103
+ /**
104
+ * Identifiers of global products, that have point forecast
105
+ */
106
+ export declare const globalPointProducts: readonly ["gfs", "ecmwf", "icon", "mblue"];
107
+ /**
108
+ * Identifiers of all land products combined
109
+ */
110
+ export declare const products: readonly ["gfs", "ecmwf", "ecmwfAnalysis", "radar", "ecmwfWaves", "gfsWaves", "icon", "iconWaves", "capAlerts", "cams", "efi", "satellite", "cmems", "drought", "fireDanger", "activeFires", "nems", "namConus", "namHawaii", "namAlaska", "iconEu", "iconD2", "arome", "aromeAntilles", "aromeReunion", "camsEu", "iconEuWaves", "hrrrAlaska", "hrrrConus", "bomAccess", "ukv", "cams", "camsEu", "mblue"];
111
+ /**
112
+ * Identifiers of all point products combines
113
+ */
114
+ export declare const pointProducts: readonly ["gfs", "ecmwf", "icon", "mblue", "namConus", "namHawaii", "namAlaska", "iconD2", "iconEu", "iconEuWaves", "arome", "aromeAntilles", "aromeReunion", "hrrrAlaska", "hrrrConus", "bomAccess", "ukv"];
115
+ /**
116
+ * IndicatesIndicates that that browsing device is mobile
117
+ */
118
+ export declare const isMobile: boolean;
119
+ /**
120
+ * Indicates that browsing device is tablet
121
+ */
122
+ export declare const isTablet: boolean;
123
+ /**
124
+ * Indicates that browsing device is mobile or tablet
125
+ */
126
+ export declare const isMobileOrTablet: boolean;
127
+ /**
128
+ * Indicates that browsing device has retina display
129
+ * @ignore
130
+ */
131
+ export declare const isRetina: boolean;
132
+ /**
133
+ * Preferred browsers' language (not the used one). Can contain language that is not supported by Windy
134
+ */
135
+ export declare const prefLang: string;
136
+ /**
137
+ * Valid levels, their identifier and display string
138
+ * @ignore this will crash Markdown parser
139
+ */
140
+ export declare const levelsData: {
141
+ [L in (typeof levels)[number]]: [string, string];
142
+ };
143
+ /**
144
+ * Valid POI layers, their name and icon
145
+ * @ignore this will crash Markdown parser
146
+ */
147
+ export declare const pois: Record<Pois, [keyof LoadedTranslations | string, Iconfont]>;
148
+ /**
149
+ * List of valid isoline identifiers
150
+ * @ignore this will crash Markdown parser
151
+ */
152
+ export declare const isolines: Isolines[];
@@ -0,0 +1,30 @@
1
+ import { type ParsedQueryString } from '../utils/queryString';
2
+ import type { Coords, PickerCoords } from '@windy/interfaces.d';
3
+ import type { ExternalPluginIdent } from '@windy/types';
4
+ import type { PluginIdent } from '@windy/Plugin';
5
+ type StartupCoords = {
6
+ sharedCoords: Coords | null;
7
+ pickerCoords: PickerCoords | null;
8
+ };
9
+ /**
10
+ * Parse URL to plugin and its parameters (if any)
11
+ *
12
+ * @returns true if some of the plugins was matched, false otherwise
13
+ */
14
+ export declare function resolveRoute(purl: string, source: 'url' | 'back-button', parsedQs?: ParsedQueryString): ExternalPluginIdent | PluginIdent | void;
15
+ /**
16
+ * Parse search part of the URL
17
+ * eg: https://www.windy.com/?overlay,level,acTime,lat,lon,zoom,marker
18
+ * lat,lon,zoom are obligatory and must go always together
19
+ * All other params are optional and can be in any order
20
+ * WARNING: This method has thousands of side effects!!
21
+ *
22
+ * @param searchQuery Search part of the URL, eg: lat,lon,zoom,marker
23
+ * @returns Coordinates from the URL (if any) and coordinates of the picker (if any)
24
+ */
25
+ export declare function parseSearch(searchQuery: string | undefined, parsedQs?: ParsedQueryString): StartupCoords | undefined;
26
+ /**
27
+ * Parsed coordinates from URL
28
+ */
29
+ export declare const sharedCoords: Coords;
30
+ export {};
@@ -0,0 +1,19 @@
1
+ declare const _default: {
2
+ /**
3
+ * Language parsed from startupUrl, null if cannot be parsed
4
+ */
5
+ lang: string;
6
+ /**
7
+ * Path part of the startup URL without SEO parts
8
+ */
9
+ purl: string;
10
+ /**
11
+ * Path part of the initial URL when client was open
12
+ */
13
+ startupUrl: string;
14
+ /**
15
+ * Overlay parsed from startupUrl, null if cannot be parsed
16
+ */
17
+ overlay: string;
18
+ };
19
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare const share: () => void;
@@ -0,0 +1,31 @@
1
+ import type { ErrorCategory, ShowableError } from '@windy/types.d';
2
+ /**
3
+ * Add showableError to local storage
4
+ * @param error
5
+ */
6
+ export declare const add: (error: ShowableError) => void;
7
+ /**
8
+ * Sets showableError to not be displayed anymore
9
+ * @param errorId
10
+ */
11
+ export declare const close: (errorId: string) => void;
12
+ /**
13
+ * It return array unresolvedErrors with removed showableError
14
+ * @param errorId
15
+ */
16
+ export declare const resolve: (errorId: string) => void;
17
+ /**
18
+ * It resolve whole category of errors from unresolvedErrors
19
+ * @param category
20
+ */
21
+ export declare const resolveCategory: (category: ErrorCategory) => void;
22
+ /**
23
+ * Returns unresolved errors
24
+ * @returns ShowableError[]
25
+ */
26
+ export declare const getUnresolvedErrors: () => ShowableError[];
27
+ /**
28
+ * Control if error was resolved, based on category of the error
29
+ * @param error
30
+ */
31
+ export declare function checkError(error: ShowableError): void;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * # @windy/singleclick
3
+ *
4
+ * Handles singleclick events on map and determines, which consumer should get it.
5
+ * If none is found, it emits event with `click` topic, which is usually cached by `@windy/picker`
6
+ * module and it opens weather picker on desired location.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { singleclick } from '@windy/singleclick';
11
+ *
12
+ * // Plugin will get singleclick events ONLY if they are properly configured
13
+ * // to get singleclick events
14
+ * singleclick.on('windy-plugin-name', (ev) => {
15
+ * console.log('I got singleclick event', ev);
16
+ * })
17
+ * ```
18
+ *
19
+ * @module singleclick
20
+ */
21
+ import { Evented } from '@windy/Evented';
22
+ import type { PluginIdent } from '@windy/Plugin';
23
+ import type { SingleclickTypes, ListeningPriority } from '@windy/singleclick.d';
24
+ /**
25
+ * Main singleclick event emitter (instance of class {@link Evented.Evented | Evented }.)
26
+ *
27
+ * It contains well defined methods `on`, `off` and `once`
28
+ * and it emits events, whose topic is one of eligible consumer
29
+ */
30
+ export declare const singleclick: Evented<SingleclickTypes>;
31
+ /**
32
+ * Register the plugin (identified by its ident) to be on the list to
33
+ * receive singleclick events.
34
+ *
35
+ * There can be only one listener with high priority (usually actually opened
36
+ * plugin), and one with low priority (usually some map layer).
37
+ *
38
+ * Well configured plugins do not need to use this method, as they are automatically
39
+ * released, by Windy's plugin system when they are closed.
40
+ */
41
+ export declare const register: (ident: PluginIdent, priority: ListeningPriority) => keyof import("../pluginSystem/plugins").Plugins;
42
+ /**
43
+ * Release the plugin from the list of singleclick events. Well configured plugins
44
+ * do not need to use this method, as they are automatically released, by Windy's
45
+ * plugin system when they are closed.
46
+ */
47
+ export declare const release: (ident: PluginIdent, priority: ListeningPriority) => void;
48
+ /**
49
+ * Handles all singleclick events from instance of Leaflet map
50
+ * @ignore
51
+ */
52
+ export declare const opener: (ev: L.LeafletMouseEvent) => void;
@@ -0,0 +1,3 @@
1
+ import type { Storage } from '@windy/storage.d';
2
+ declare const _default: Storage;
3
+ export default _default;
@@ -0,0 +1,148 @@
1
+ /**
2
+ * # @windy/store
3
+ *
4
+ * Represents a key-value store with methods for getting, setting, and observing values.
5
+ * The store maintains the integrity of the parameters and checks the validity of the input.
6
+ *
7
+ * Used store keys are defined as `DataSpecifications` interface.
8
+ *
9
+ * Check out complete list of {@link DataSpecifications.DataSpecifications | store properties}.
10
+ *
11
+ * Used for storing major parameters and user settings.
12
+ *
13
+ * It also supports observing changes to the values and retrieving allowed values for each key.
14
+ *
15
+ * Use methods `get` to read value from store, `set` to change value in the store and `on` to observe change of the value.
16
+ * Some of the items respond to method `getAllowed` to return array of allowed values.
17
+ *
18
+ * Method `set` returns `true` if provided value was valid and was actually changed.
19
+ *
20
+ * Store is instance of class {@link Evented.Evented | Evented }.
21
+ *
22
+ * @example
23
+ * ```js
24
+ * var overlay = store.get('overlay');
25
+ * // 'wind' ... actually used overlay
26
+ *
27
+ * var allowedOverlays = store.getAllowed('overlay');
28
+ * // ['wind', 'rain', ... ] ... list of allowed values
29
+ *
30
+ * store.set('overlay', 'rain');
31
+ * // true ... Overlay was changed to rain
32
+ *
33
+ * store.on('overlay', ovr => {
34
+ * // Called when value was changed
35
+ * });
36
+ * ```
37
+ *
38
+ * @module store
39
+ */
40
+ import { Evented } from '@windy/Evented';
41
+ import type { DataSpecifications, DataSpecificationsObject } from '@windy/dataSpecifications.d';
42
+ import type { SetReturnType, StoreOptions, StoreTypes } from '@windy/store.d';
43
+ declare class Store extends Evented<StoreTypes> {
44
+ /**
45
+ * Set default value for given key
46
+ *
47
+ * @param name Name
48
+ * @param value Value
49
+ */
50
+ setDefault<T extends keyof DataSpecifications, Item extends DataSpecifications[T]>(name: T, value: Item['def']): void;
51
+ /**
52
+ * Defines property in dataSpecification list. Used for example for
53
+ * definition of `syncSet` or `asyncSet`
54
+ *
55
+ * @param name identifier of property in dataSpecification
56
+ * @param prop property
57
+ * @param value Value
58
+ */
59
+ defineProperty: <T extends keyof DataSpecifications, Prop extends keyof DataSpecifications[T], Value extends DataSpecifications[T][Prop]>(name: T, prop: Prop, value: Value) => void;
60
+ /**
61
+ * Retrieves property from dataSpecifications
62
+ *
63
+ * @param name identifier of property in dataSpecification
64
+ * @returns Stored value
65
+ */
66
+ getProperty: <T extends keyof DataSpecifications>(name: T) => DataSpecifications[T];
67
+ /**
68
+ * Checks existence of property
69
+ *
70
+ * @param name Name
71
+ * @returns True if property exists
72
+ */
73
+ hasProperty: <T extends keyof DataSpecifications>(name: T) => boolean;
74
+ _set<T extends keyof DataSpecifications, Item extends DataSpecifications[T]>(name: T, item: Item, opts: StoreOptions, value: Item['def'] | null): void;
75
+ /**
76
+ * Sets a value in key, value store. If succesfull,a nd value has been changed, store will brodcast message with name and value.
77
+ * Limitation:** Our store is quite primitive so it can not compare Arrays and Objects. Always create new one or use `forceChange` * option.
78
+ *
79
+ * @param name Name
80
+ * @param value Value
81
+ * @param opts Options
82
+ * @returns optional, returns true if value was changed, undefined if change failed, Promise obj if change was asynchronous
83
+ */
84
+ set<T extends keyof DataSpecifications, Item extends DataSpecifications[T]>(name: T, value: Item['def'] | null, opts?: StoreOptions): SetReturnType<T>;
85
+ /**
86
+ * Set it to null leading to defaults values
87
+ *
88
+ * @param name Name
89
+ * @param opts Options
90
+ */
91
+ remove: <T extends keyof DataSpecifications>(name: T, opts?: StoreOptions) => void;
92
+ /**
93
+ * Outputs all allowed properties for give key into console.log
94
+ */
95
+ getAll: () => void;
96
+ /**
97
+ * Return list of permitted values for given key
98
+ *
99
+ * @param name Name
100
+ * @returns List of allowed values for the name; or string with info it is checked by function
101
+ */
102
+ getAllowed: <T extends keyof DataSpecifications, Item extends DataSpecifications[T]>(name: T) => string | Item["allowed"];
103
+ /**
104
+ * Returns default value for given key
105
+ *
106
+ * @param name Name
107
+ * @returns Data specification type
108
+ */
109
+ getDefault<T extends keyof DataSpecifications, Item extends DataSpecifications[T]>(name: T): Item['def'];
110
+ isAsyncStore<T>(item: DataSpecificationsObject<T>): item is DataSpecificationsObject<T> & Required<Pick<DataSpecificationsObject<T>, 'asyncSet'>>;
111
+ /**
112
+ * Check if value was changed
113
+ * !!!! WARNING: for perfomance reasons check only against hot cache, so can
114
+ * lead to faulty results around default || never used values
115
+ *
116
+ * @param name Name
117
+ * @param item Item
118
+ * @param value Value
119
+ * @returns True if value was changed
120
+ */
121
+ wasChanged<T extends keyof DataSpecifications, Item extends DataSpecifications[T]>(name: T, item: Item, value: Item['def']): boolean;
122
+ /**
123
+ * Insert dataSpecifications key (if not present)
124
+ *
125
+ * @param name Name
126
+ * @param obj Data specifications object
127
+ */
128
+ insert: <T extends keyof DataSpecifications, Item extends DataSpecifications[T]>(name: T, obj: Item) => void;
129
+ /**
130
+ * Retrieves value stored in store
131
+ *
132
+ * @param {string} name Name
133
+ * @param {boolean} options.forceGet Skip cache and return even nullish value with no default polyfill
134
+ * @returns stored value
135
+ */
136
+ get<T extends keyof DataSpecifications, Item extends DataSpecifications[T]>(name: T, options?: {
137
+ forceGet: boolean;
138
+ }): Item['def'];
139
+ isValid<T>(item: DataSpecificationsObject<T>, value: T): boolean;
140
+ }
141
+ declare const store: Store;
142
+ export declare const getAll: () => void, getAllowed: <T extends keyof DataSpecifications, Item extends DataSpecifications[T]>(name: T) => string | Item["allowed"], getDefault: <T extends keyof DataSpecifications, Item extends DataSpecifications[T]>(name: T) => Item["def"], get: <T extends keyof DataSpecifications, Item extends DataSpecifications[T]>(name: T, options?: {
143
+ forceGet: boolean;
144
+ }) => Item["def"], on: <K extends keyof StoreTypes, Q extends StoreTypes[K]>(topic: K, callback: (...data: TrimUndefinedFromRight<Arrayify<Q>>) => void, context?: ThisType<unknown>, once?: boolean) => number, off: {
145
+ (id: number): void;
146
+ <K extends keyof StoreTypes, Q extends StoreTypes[K]>(topic: K, callback: (...data: TrimUndefinedFromRight<Arrayify<Q>>) => void, context?: ThisType<unknown>): void;
147
+ }, once: <K extends keyof StoreTypes, Q extends StoreTypes[K]>(topic: K, callback: (...data: TrimUndefinedFromRight<Arrayify<Q>>) => void, context?: ThisType<unknown>) => number, set: <T extends keyof DataSpecifications, Item extends DataSpecifications[T]>(name: T, value: Item["def"], opts?: StoreOptions) => SetReturnType<T>;
148
+ export default store;
@@ -0,0 +1,65 @@
1
+ import type { SubTier } from '@windy/types.d';
2
+ import type { SubscriptionInfo } from '@plugins/_shared/subscription-services/subscription-services.d';
3
+ export type SubscriptionIssue = {
4
+ type: 'graced' | 'paused' | 'onhold';
5
+ } | {
6
+ type: 'expiring';
7
+ expiresInHours: number;
8
+ };
9
+ /**
10
+ * Get the current tier of the user.
11
+ *
12
+ * @returns "premium" for premium user, null otherwise
13
+ */
14
+ export declare const getTier: () => SubTier;
15
+ /**
16
+ * When any user changes his/her premium status (redeem, restore, ...), we need to refresh token2 to
17
+ * reflect premium status for our backends
18
+ */
19
+ declare const reloadUserToken: () => void;
20
+ /**
21
+ * Clear pending subscription (i.e. unclaimed, not-redeemed subscription) from store.
22
+ */
23
+ export declare const clearPendingSubscription: () => void;
24
+ /**
25
+ * Set pending subscription to store.
26
+ *
27
+ * @param {string} redeemCode Code to store
28
+ */
29
+ export declare const setPendingSubscription: (redeemCode: string) => void;
30
+ /**
31
+ * Disable all premium features for the user. It does not deactivate subscription, it is just client GUI reset.
32
+ */
33
+ export declare const deactivateAllFeatures: () => void;
34
+ /**
35
+ * Set a tier for the user. It also clears pending and failed subscriptions if tier is passed.
36
+ *
37
+ * @param value Tier to set for the user, "null" for the subscription deactivation
38
+ * @param options Optionally `reloadUserToken: true` if client should reload JWT token after setting the tier
39
+ * @returns Same value which has been set
40
+ */
41
+ export declare const setTier: (value: SubTier, options?: {
42
+ reloadUserToken?: boolean;
43
+ subscriptionInfo?: SubscriptionInfo;
44
+ }) => SubTier;
45
+ /**
46
+ * Returns boolean value if user has any valid premium subscription.
47
+ *
48
+ * @returns True if user has a valid premium subscription, false otherwise
49
+ */
50
+ export declare const hasAny: () => boolean;
51
+ /**
52
+ * Returns null if everything is ok, object with issue otherwise.
53
+ */
54
+ export declare const getIssue: () => SubscriptionIssue | null;
55
+ /**
56
+ * Check if any pending subscription (i.e. unclaimed, not-redeemed subscription) is stored.
57
+ * Open `pending-subscription` plugin if yes, void otherwise
58
+ */
59
+ export declare const checkPendingSubscription: () => void;
60
+ /**
61
+ * Returns short text for buttons which inform user about any subscription issue.
62
+ * It is used only as a gateway to solving the whole issue. It must be short and clear.
63
+ */
64
+ export declare const getBaitTitle: (issue: SubscriptionIssue | null) => string;
65
+ export {};