@windycom/plugin-devtools 1.0.4 → 1.0.5

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 (65) hide show
  1. package/README.md +2 -1
  2. package/package.json +1 -1
  3. package/types/client/Calendar.d.ts +4 -4
  4. package/types/client/Color.d.ts +3 -3
  5. package/types/client/DataTiler.d.ts +2 -2
  6. package/types/client/GlObj.d.ts +1 -1
  7. package/types/client/Layer.d.ts +11 -11
  8. package/types/client/Metric.d.ts +5 -5
  9. package/types/client/Product.d.ts +6 -6
  10. package/types/client/Renderer.d.ts +4 -4
  11. package/types/client/Webcams.d.ts +4 -4
  12. package/types/client/d.ts.files/Calendar.d.ts +87 -0
  13. package/types/client/d.ts.files/CanvasLayer.d.ts +70 -0
  14. package/types/client/d.ts.files/Color.d.ts +82 -0
  15. package/types/client/d.ts.files/DataTiler.d.ts +45 -0
  16. package/types/client/d.ts.files/GlObj.d.ts +92 -0
  17. package/types/client/d.ts.files/LabelsLayer.d.ts +51 -0
  18. package/types/client/d.ts.files/LandMask.d.ts +17 -0
  19. package/types/client/d.ts.files/Layer.d.ts +184 -0
  20. package/types/client/d.ts.files/Metric.d.ts +192 -0
  21. package/types/client/d.ts.files/PoisOverlay.d.ts +27 -0
  22. package/types/client/d.ts.files/Product.d.ts +37 -0
  23. package/types/client/d.ts.files/Renderer.d.ts +23 -0
  24. package/types/client/d.ts.files/TileLayerCanvas.d.ts +78 -0
  25. package/types/client/d.ts.files/TileLayerMultiPatch.d.ts +13 -0
  26. package/types/client/d.ts.files/Webcams.d.ts +160 -0
  27. package/types/client/d.ts.files/broadcast.d.ts +177 -0
  28. package/types/client/d.ts.files/dataSpecifications.d.ts +943 -0
  29. package/types/client/d.ts.files/errorLogger.d.ts +35 -0
  30. package/types/client/d.ts.files/format.d.ts +48 -0
  31. package/types/client/d.ts.files/http.d.ts +87 -0
  32. package/types/client/d.ts.files/incomingMessages.d.ts +88 -0
  33. package/types/client/d.ts.files/lib.d.ts +74 -0
  34. package/types/client/d.ts.files/notifications.d.ts +39 -0
  35. package/types/client/d.ts.files/outgoingMessages.d.ts +75 -0
  36. package/types/client/d.ts.files/plugin-params.d.ts +236 -0
  37. package/types/client/d.ts.files/plugins.d.ts +132 -0
  38. package/types/client/d.ts.files/pois.d.ts +11 -0
  39. package/types/client/d.ts.files/products.d.ts +44 -0
  40. package/types/client/d.ts.files/rootScope.d.ts +43 -0
  41. package/types/client/d.ts.files/satellite.d.ts +50 -0
  42. package/types/client/d.ts.files/singleclick.d.ts +31 -0
  43. package/types/client/d.ts.files/storage.d.ts +120 -0
  44. package/types/client/d.ts.files/store.d.ts +61 -0
  45. package/types/client/d.ts.files/tileInterpolator.d.ts +35 -0
  46. package/types/client/d.ts.files/trans.d.ts +55 -0
  47. package/types/client/d.ts.files/user.d.ts +58 -0
  48. package/types/client/dataSpecifications.d.ts +1 -1
  49. package/types/client/embed2.d.ts +3 -4
  50. package/types/client/errorLogger.d.ts +1 -1
  51. package/types/client/fetch.d.ts +30 -3
  52. package/types/client/format.d.ts +2 -2
  53. package/types/client/http.d.ts +1 -1
  54. package/types/client/notifications.d.ts +2 -2
  55. package/types/client/plugins.d.ts +1 -1
  56. package/types/client/pois.d.ts +1 -1
  57. package/types/client/products.d.ts +1 -1
  58. package/types/client/rootScope.d.ts +4 -4
  59. package/types/client/singleclick.d.ts +2 -2
  60. package/types/client/storage.d.ts +1 -1
  61. package/types/client/store.d.ts +2 -2
  62. package/types/client/tileInterpolator.d.ts +3 -3
  63. package/types/client/trans.d.ts +3 -3
  64. package/types/client/user.d.ts +3 -3
  65. package/types/client/utils.d.ts +1 -1
@@ -0,0 +1,160 @@
1
+ import { LatLon } from '@windy/interfaces.d';
2
+ import { Timestamp } from '@windy/types.d';
3
+ import { HttpPayload } from '@windy/http.d';
4
+
5
+ export type WebcamCategoryType =
6
+ | 'landscape'
7
+ | 'traffic'
8
+ | 'meteo'
9
+ | 'uncategorized'
10
+ | 'building'
11
+ | 'indoor'
12
+ | 'city'
13
+ | 'water'
14
+ | 'area'
15
+ | 'forest'
16
+ | 'mountain'
17
+ | 'island'
18
+ | 'beach'
19
+ | 'airport'
20
+ | 'park'
21
+ | 'harbor'
22
+ | 'pool'
23
+ | 'golf'
24
+ | 'lake'
25
+ | 'bay'
26
+ | 'square'
27
+ | 'coast'
28
+ | 'sportarea'
29
+ | 'resort'
30
+ | 'camping'
31
+ | 'other'
32
+ | 'xmasmarket'
33
+ | 'underwater';
34
+
35
+ export type WebcamPositionType = 'fix' | 'rotating' | 'ptz';
36
+
37
+ export type WebcamDirectionType =
38
+ | ''
39
+ | 'north'
40
+ | 'northeast'
41
+ | 'east'
42
+ | 'southeast'
43
+ | 'south'
44
+ | 'southwest'
45
+ | 'west'
46
+ | 'northwest';
47
+
48
+ export type WebcamStatusType =
49
+ | 'active'
50
+ | 'deleted'
51
+ | 'disabled'
52
+ | 'duplicate'
53
+ | 'inactive'
54
+ | 'rejected'
55
+ | 'revoked'
56
+ | 'unapproved';
57
+
58
+ export interface WebcamCategory {
59
+ id: WebcamCategoryType;
60
+ name: string;
61
+ }
62
+
63
+ export interface WebcamLocation extends LatLon {
64
+ alt: number;
65
+ city: string;
66
+ continent: string;
67
+ country: string;
68
+ subcountry: string;
69
+ title: string;
70
+ }
71
+
72
+ export interface WebcamImageUrls {
73
+ full: string;
74
+ icon: string;
75
+ normal: string;
76
+ original: string;
77
+ preview: string;
78
+ teaserbg: string;
79
+ thumbnail: string;
80
+ webcam: string;
81
+ }
82
+
83
+ export type WebcamImageSize = keyof WebcamImageUrls;
84
+
85
+ export type WebcamTimelapseType = 'day' | 'current' | 'all';
86
+ export interface WebcamDetail {
87
+ categories: WebcamCategoryType[];
88
+ contacts: { owner: string; caretaker: string };
89
+ id: number;
90
+ images: {
91
+ current: WebcamImageUrls;
92
+ daylight: WebcamImageUrls;
93
+ sizes: { [S in keyof WebcamImageUrls]: { width: number; height: number } };
94
+ };
95
+ lastDaylight: Timestamp;
96
+ lastUpdate: Timestamp;
97
+ location: WebcamLocation;
98
+ pageUrl: string;
99
+ shortTitle: string;
100
+ timelapseType: WebcamTimelapseType;
101
+ title: string;
102
+ views: Record<string, string>;
103
+ viewCount: number;
104
+ stream?: string;
105
+ l10n?: {
106
+ /** {[langIsoCode: string]: string} */
107
+ country: Record<string, string>;
108
+ /** {[langIsoCode: string]: string} */
109
+ subcountry: Record<string, string>;
110
+ /** {[langIsoCode: string]: string} */
111
+ city: Record<string, string>;
112
+ /** {[langIsoCode: string]: string} */
113
+ shortTitle: Record<string, string>;
114
+ };
115
+ }
116
+
117
+ export interface WebcamArchiveItem {
118
+ timestamp: number;
119
+ url: string;
120
+ }
121
+
122
+ export interface WebcamArchive {
123
+ day: WebcamArchiveItem[];
124
+ month: WebcamArchiveItem[];
125
+ year: WebcamArchiveItem[];
126
+ lifetime: WebcamArchiveItem[];
127
+ }
128
+
129
+ export type WebcamArchiveInterval = keyof WebcamArchive;
130
+
131
+ export interface WebcamsData {
132
+ cams: WebcamDetail[];
133
+ total: number;
134
+ }
135
+
136
+ export type WebcamsPayload = HttpPayload<WebcamsData>;
137
+
138
+ export interface WebcamsLoadingParams extends LatLon {
139
+ forceReload?: boolean;
140
+ }
141
+
142
+ export interface GeneralWcAdminResponse {
143
+ /** HTTP status code returned in response body */
144
+ code?: number;
145
+ status: 'FAILED' | 'OK';
146
+ /** Error or success message */
147
+ message: string | '';
148
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
149
+ }
150
+
151
+ export interface WebcamLastUpdatedOn {
152
+ webcamId: number[];
153
+ lastUpdatedOn: number[];
154
+ }
155
+
156
+ export interface WebcamMetadata {
157
+ updateString: string;
158
+ recencyClass: string;
159
+ distanceString: string;
160
+ }
@@ -0,0 +1,177 @@
1
+ /*
2
+ Overall broadcasted events. We have used loose coupled components
3
+ system before TS was used.
4
+
5
+ Now it is better to use close coupled components, with strong type control
6
+
7
+
8
+ TODO: Minimize amount of these events and reduce their usage
9
+
10
+ */
11
+ import { DetailLocChangeParams } from '@plugins/detail/detail.d';
12
+ import { ClientMessage, DownloadProgress, ServiceWorkerMessage } from '@plugins/offline/offline';
13
+ import { Evented } from '@windy/Evented';
14
+ import { MetricIdent, MetricItem } from '@windy/Metric.d';
15
+ import { Fav, GeolocationInfo, LatLon, WeatherParameters } from '@windy/interfaces.d';
16
+ import { Pois } from '@windy/rootScope.d';
17
+ import { ExtendedDataAndParams } from '@plugins/isolines/IsolinesCanvas2D.d';
18
+ import { Poi as GlobePoi, Params as GlobeParams } from '@plugins/globe/types.d';
19
+ import { ParsLocation as GlobeParsLocation } from '@plugins/globe/main/receiver.d';
20
+ import { NotificationPreferences } from '@windy/dataSpecifications.d';
21
+ import { PluginIdent } from '@windy/Plugin';
22
+ import { PluginSource, PluginsOpenParams, PluginsQsParams } from '@windy/plugin-params.d';
23
+ import { Plugins } from '@windy/plugins.d';
24
+ import type { ExternalPluginIdent } from '@windy/types';
25
+
26
+ type BcastTypesNonGeneric = {
27
+ /**
28
+ * @ignore
29
+ */
30
+ [key in `globe-poi-${Pois}`]: [HTMLElement | null, NonNullable<GlobePoi>];
31
+ };
32
+
33
+ /**
34
+ * # @windy/broadcast
35
+ *
36
+ * Major Windy's event emitter (instance of class {@link Evented.Evented | Evented }), used for announcing the most important events.
37
+ *
38
+ * @example
39
+ * ```js
40
+ * import broadcast from '@windy/broadcast';
41
+ *
42
+ * const listener = params => console.log('Params has changed', params);
43
+ *
44
+ * broadcast.on('redrawFinished', listener );
45
+ *
46
+ * broadcast.once('metricChanged', params => {
47
+ * // This method will be called just once
48
+ * });
49
+ *
50
+ * // Do not forget to unsubscribe any listener
51
+ * broadcast.off('redrawFinished', listener);
52
+ *
53
+ * // Let's fire some event
54
+ * broadcast.emit('rqstOpen', 'menu');
55
+ * ```
56
+ */
57
+ export interface BasicBcastTypes<T extends keyof Plugins> {
58
+ /**
59
+ * Basically most important broadcast of all, triggered just once,
60
+ * when Windy.com has been successfully loaded and all modules are ready
61
+ * to be consumed
62
+ */
63
+ dependenciesResolved: [];
64
+
65
+ /** Request to open plugin (either internal or external) */
66
+ rqstOpen: [T | string, PluginsOpenParams[T] | undefined];
67
+
68
+ /** Request to close plugin (either internal or external) */
69
+ rqstClose: [T | string, MouseEvent | TouchEvent | KeyboardEvent | undefined];
70
+
71
+ /** Request to close all opened plugins (unless plugin has noClose property) */
72
+ closeAllPlugins: [PluginIdent] | [];
73
+
74
+ /** Plugin was successfully loaded and closed */
75
+ pluginClosed: [PluginIdent | string];
76
+
77
+ /** Plugin was succesfully closed */
78
+ pluginOpened: [PluginIdent | string];
79
+
80
+ /**
81
+ * Triggered when Windy has successfully loaded and rendered requested data.
82
+ * Use this for triggering your own tasks.
83
+ */
84
+ redrawFinished: [WeatherParameters | null];
85
+
86
+ /**
87
+ * Forces various renderers to render layers, for example after
88
+ * reconfiguring color gradient, or changing particle animation settings.
89
+ */
90
+ redrawLayers: [{ noCache: boolean }] | [];
91
+
92
+ /**
93
+ * When user changes some parameters (overlay, level, date etc...).
94
+ * Do not not use this event to start any intensive action since Windy now
95
+ * must load and render all the data. We recommend to use `redrawFinished` instead.
96
+ */
97
+ paramsChanged: [WeatherParameters, keyof WeatherParameters | undefined];
98
+
99
+ /**
100
+ * Indicates that user changed any of the units (wind, temp, ...).
101
+ */
102
+ metricChanged: [MetricIdent | undefined, MetricItem | undefined];
103
+
104
+ /** Indicates that user added, remover or rename his fav @ignore */
105
+ favChanged: [];
106
+
107
+ /**
108
+ * Indicates, that router has parsed URL and launched plugin
109
+ * that was requested in URL
110
+ */
111
+ routerParsed: [PluginIdent | ExternalPluginIdent | void];
112
+
113
+ // prettier-ignore
114
+ /** @ignore */ airportLoaded: [Fav];
115
+ /** @ignore */ globeOpened: [];
116
+ /** @ignore */ globeClose: [];
117
+ /** @ignore */ globeFailed: [];
118
+ /** @ignore */ 'globe-detail': [DetailLocChangeParams | (LatLon & PluginSource)];
119
+ /** @ignore */ 'globe-isolines': [ExtendedDataAndParams | null];
120
+ /** @ignore */ 'globe-poi': [GlobeParsLocation & { type?: string; id?: string }];
121
+ /** @ignore */ 'globe-zoomIn': [[number, number] | null] | [];
122
+ /** @ignore */ 'globe-zoomOut': [[number, number] | null] | [];
123
+ /** @ignore */ 'globe-paramsChanged': [GlobeParams];
124
+ /** @ignore */ 'maps-zoomIn': [number | undefined, L.ZoomOptions | undefined];
125
+ /** @ignore */ 'maps-zoomOut': [number | undefined, L.ZoomOptions | undefined];
126
+ /** @ignore */ 'maps-paramsChanged': [WeatherParameters, keyof WeatherParameters | undefined];
127
+ /** @ignore */ detailClose: [];
128
+ /** @ignore */ detailRendered: []; // used only in embed2
129
+ /** @ignore */ reloadFavs: [];
130
+ /** @ignore */ notifPrefChanged: [NotificationPreferences | undefined];
131
+ /** @ignore */ satBackupReload: [];
132
+ /** @ignore */ promptSavePassword: [];
133
+ /** @ignore */ screenshotReady: [];
134
+ /** @ignore */ screenshotError: [Error];
135
+ /** @ignore */ onResume: [];
136
+ /** @ignore */ cloudSync: ['error', { data: Fav | string; action: string; type: 'fav' }];
137
+ /** @ignore */ back2home: [];
138
+ /** @ignore */ reloadMobileApp: [];
139
+ /** @ignore */ newLocation: [GeolocationInfo];
140
+ /** @ignore */ checkPendingSubscriptions: [];
141
+ /** @ignore */ loadingFailed: [string];
142
+ /** @ignore */ zoomIn: [];
143
+ /** @ignore */ zoomOut: [];
144
+ /** @ignore */ userReloadInfo: [];
145
+ /** @ignore */ showSocialError: [string];
146
+ /** @ignore */ openCapAlerts: [PluginsOpenParams['picker']];
147
+ /** @ignore */ openapp: [];
148
+ /** @ignore */ openSearch: [];
149
+ /** @ignore */ offlineNativeMessage: [ClientMessage];
150
+ /** @ignore */ offlineClientMessage: [ServiceWorkerMessage | { data: DownloadProgress }];
151
+ }
152
+
153
+ interface BcastTypes<T extends keyof Plugins> extends BcastTypesNonGeneric, BasicBcastTypes<T> {}
154
+
155
+ /** @ignore */
156
+ export type BcastEventsWithoutParams<T extends keyof Plugins> = keyof Pick<
157
+ BcastTypes<T>,
158
+ { [K in keyof BcastTypes<T>]: [] extends BcastTypes<T>[K] ? K : never }[keyof BcastTypes<T>]
159
+ >;
160
+
161
+ /** @ignore */
162
+ export class Broadcast extends Evented<BcastTypes<keyof Plugins>> {
163
+ // emitting `rqstOpen` is quite complicated for TS, simplify it with multiple definition
164
+ emit<K extends keyof Omit<BcastTypes<keyof Plugins>, 'rqstOpen'>>(
165
+ this: this,
166
+ topic: K,
167
+ ...data: TrimUndefinedFromRight<Arrayify<BcastTypes<keyof Plugins>[K]>>
168
+ ): void;
169
+
170
+ emit<P extends string>(
171
+ this: this,
172
+ topic: 'rqstOpen',
173
+ pluginName: P,
174
+ params?: PluginsOpenParams[P],
175
+ qs?: PluginsQsParams[P],
176
+ ): void;
177
+ }