@windycom/plugin-devtools 3.0.1 → 3.0.3

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 (149) hide show
  1. package/README.md +1 -0
  2. package/package.json +1 -1
  3. package/types/client/Calendar.d.ts +104 -70
  4. package/types/client/Color.d.ts +25 -5
  5. package/types/client/DataTiler.d.ts +2 -2
  6. package/types/client/EcmwfProduct.d.ts +22 -0
  7. package/types/client/EventManager.d.ts +69 -0
  8. package/types/client/ExternalSveltePlugin.d.ts +4 -3
  9. package/types/client/GlBuffer.d.ts +45 -0
  10. package/types/client/GlMesh.d.ts +147 -0
  11. package/types/client/GlProgram.d.ts +41 -0
  12. package/types/client/GlRenderer.d.ts +95 -0
  13. package/types/client/GlTexture.d.ts +98 -0
  14. package/types/client/GlVertexArray.d.ts +38 -0
  15. package/types/client/IDB.d.ts +25 -4
  16. package/types/client/LabelsLayer.d.ts +69 -2
  17. package/types/client/Layer.d.ts +96 -26
  18. package/types/client/LayerClasses.d.ts +5 -0
  19. package/types/client/Metric.d.ts +31 -46
  20. package/types/client/MetricClasses.d.ts +1 -1
  21. package/types/client/Overlay.d.ts +5 -12
  22. package/types/client/OverlayClasses.d.ts +8 -0
  23. package/types/client/Particles.d.ts +1 -1
  24. package/types/client/Product.d.ts +38 -67
  25. package/types/client/ProductClasses.d.ts +51 -0
  26. package/types/client/RadarPlusProduct.d.ts +1 -1
  27. package/types/client/Renderer.d.ts +44 -19
  28. package/types/client/SatelliteProduct.d.ts +1 -1
  29. package/types/client/ShaderStorage.d.ts +25 -0
  30. package/types/client/StartupElementPlugin.d.ts +8 -0
  31. package/types/client/SveltePlugin.d.ts +5 -5
  32. package/types/client/SwitchableTileCache.d.ts +104 -0
  33. package/types/client/TileLayer.d.ts +12 -3
  34. package/types/client/TileLayerCustom.d.ts +51 -0
  35. package/types/client/TileLayerMulti.d.ts +53 -0
  36. package/types/client/TileLayerPreprocessorStandalone.d.ts +45 -0
  37. package/types/client/TileLayerRenderer.d.ts +24 -0
  38. package/types/client/TileLayerUtils.d.ts +43 -0
  39. package/types/client/TilePreprocessor.d.ts +27 -0
  40. package/types/client/TopoMap.d.ts +4 -4
  41. package/types/client/WindowPlugin.d.ts +7 -6
  42. package/types/client/appsFlyer.d.ts +2 -1
  43. package/types/client/baseMap.d.ts +12 -2
  44. package/types/client/broadcast.d.ts +1 -1
  45. package/types/client/cityLabels.d.ts +2 -3
  46. package/types/client/colorGradients.d.ts +4 -10
  47. package/types/client/colors.d.ts +1 -2
  48. package/types/client/css.test.d.ts +1 -0
  49. package/types/client/customProtocol.d.ts +11 -0
  50. package/types/client/d.ts.files/GlObj.d.ts +1 -5
  51. package/types/client/d.ts.files/Metric.d.ts +23 -2
  52. package/types/client/d.ts.files/alerts.d.ts +1 -0
  53. package/types/client/d.ts.files/broadcast.d.ts +31 -35
  54. package/types/client/d.ts.files/dataSpecifications.d.ts +82 -66
  55. package/types/client/d.ts.files/favs.d.ts +7 -18
  56. package/types/client/d.ts.files/glUtils.d.ts +71 -0
  57. package/types/client/d.ts.files/http.d.ts +4 -4
  58. package/types/client/d.ts.files/interpolatorTypes.d.ts +5 -5
  59. package/types/client/d.ts.files/lib.d.ts +1 -2
  60. package/types/client/d.ts.files/liveAlerts.d.ts +52 -0
  61. package/types/client/d.ts.files/mapUtils.d.ts +25 -0
  62. package/types/client/d.ts.files/outgoingMessages.d.ts +1 -1
  63. package/types/client/d.ts.files/plugin-params.d.ts +46 -24
  64. package/types/client/d.ts.files/plugins.d.ts +44 -31
  65. package/types/client/d.ts.files/rootScope.d.ts +2 -0
  66. package/types/client/d.ts.files/singleclick.d.ts +4 -2
  67. package/types/client/d.ts.files/startup.d.ts +7 -52
  68. package/types/client/d.ts.files/storage.d.ts +0 -11
  69. package/types/client/d.ts.files/user.d.ts +6 -1
  70. package/types/client/d.ts.files/webcams.d.ts +9 -2
  71. package/types/client/dataLoader.d.ts +2 -2
  72. package/types/client/detectDevice.d.ts +3 -0
  73. package/types/client/embed.d.ts +2 -7
  74. package/types/client/errorLogger.d.ts +20 -1
  75. package/types/client/externalPlugins.d.ts +5 -1
  76. package/types/client/fetch.d.ts +62 -5
  77. package/types/client/format.d.ts +12 -0
  78. package/types/client/glContextUtils.d.ts +9 -0
  79. package/types/client/glStatus.d.ts +7 -0
  80. package/types/client/glTileRender.d.ts +1 -7
  81. package/types/client/glUtils.d.ts +119 -0
  82. package/types/client/http.d.ts +0 -6
  83. package/types/client/idbConnection.d.ts +13 -0
  84. package/types/client/idbInstances.d.ts +118 -13
  85. package/types/client/landLayer.d.ts +3 -0
  86. package/types/client/layers.d.ts +5 -2
  87. package/types/client/legends.d.ts +1 -1
  88. package/types/client/lib.d.ts +11 -21
  89. package/types/client/liveAlerts.d.ts +2 -2
  90. package/types/client/location.d.ts +1 -1
  91. package/types/client/map.d.ts +94 -15
  92. package/types/client/mapUtils.d.ts +66 -0
  93. package/types/client/math.d.ts +14 -0
  94. package/types/client/mobile.d.ts +16 -41
  95. package/types/client/mobileUtils.d.ts +10 -0
  96. package/types/client/models.d.ts +2 -6
  97. package/types/client/overlays.d.ts +4 -3
  98. package/types/client/particleRenderers.d.ts +1 -1
  99. package/types/client/picker.d.ts +4 -8
  100. package/types/client/plugins.d.ts +0 -4
  101. package/types/client/products.d.ts +53 -2
  102. package/types/client/promo.d.ts +28 -5
  103. package/types/client/pushNotifications.d.ts +19 -1
  104. package/types/client/renderCtrl.d.ts +1 -1
  105. package/types/client/renderTile.d.ts +2 -2
  106. package/types/client/renderUtils.d.ts +21 -27
  107. package/types/client/renderers.d.ts +6 -9
  108. package/types/client/reverseName.d.ts +2 -1
  109. package/types/client/rhMessage.d.ts +1 -1
  110. package/types/client/rootScope.d.ts +17 -9
  111. package/types/client/router.d.ts +41 -9
  112. package/types/client/seoParser.d.ts +35 -0
  113. package/types/client/showableErrorsService.d.ts +10 -6
  114. package/types/client/singleclick.d.ts +1 -1
  115. package/types/client/startup.d.ts +48 -0
  116. package/types/client/startupUtils.d.ts +19 -0
  117. package/types/client/store.d.ts +20 -52
  118. package/types/client/subscription.d.ts +3 -26
  119. package/types/client/throttler.d.ts +32 -0
  120. package/types/client/tileHelpers.d.ts +35 -0
  121. package/types/client/tileInterpolator.d.ts +1 -1
  122. package/types/client/tileLayerInterpolator.d.ts +40 -0
  123. package/types/client/tileLayerSource.d.ts +98 -0
  124. package/types/client/timestampUtils.test.d.ts +1 -0
  125. package/types/client/topMessage.d.ts +22 -0
  126. package/types/client/user.d.ts +1 -0
  127. package/types/client/userAlerts.d.ts +0 -4
  128. package/types/client/userConsent.d.ts +0 -2
  129. package/types/client/userFavs.d.ts +17 -12
  130. package/types/client/utils.d.ts +78 -25
  131. package/types/client/utils.test.d.ts +1 -0
  132. package/types/iconfont.d.ts +2 -5
  133. package/types/interfaces.d.ts +290 -88
  134. package/types/lang-files.d.ts +578 -98
  135. package/types/leaflet-gl.d.ts +12773 -0
  136. package/types/types.d.ts +323 -11
  137. package/types/client/d.ts.files/Calendar.d.ts +0 -96
  138. package/types/client/d.ts.files/CanvasLayer.d.ts +0 -70
  139. package/types/client/d.ts.files/Color.d.ts +0 -94
  140. package/types/client/d.ts.files/DataTiler.d.ts +0 -45
  141. package/types/client/d.ts.files/LandMask.d.ts +0 -17
  142. package/types/client/d.ts.files/Layer.d.ts +0 -191
  143. package/types/client/d.ts.files/PoisOverlay.d.ts +0 -27
  144. package/types/client/d.ts.files/Renderer.d.ts +0 -44
  145. package/types/client/d.ts.files/TileLayerCanvas.d.ts +0 -78
  146. package/types/client/d.ts.files/TileLayerMultiPatch.d.ts +0 -13
  147. package/types/client/d.ts.files/products.d.ts +0 -60
  148. package/types/client/imaker.d.ts +0 -112
  149. package/types/offline.d.ts +0 -100
package/README.md CHANGED
@@ -4,6 +4,7 @@ Check out https://docs.windy-plugins.com for more information.
4
4
 
5
5
  # CHANGELOG
6
6
 
7
+ - 3.0.2 - TS declarations for client v47.0.2
7
8
  - 3.0.1 - TS declarations for client v46.1.0
8
9
  - 3.0.0 - TS declarations for client v45.0.0
9
10
  - 2.0.2 - Support Windows in file path regex
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windycom/plugin-devtools",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "Developer tools and TS declarations for developers of Windy Plugins.",
5
5
  "main": "index.mjs",
6
6
  "module": "index.mjs",
@@ -1,139 +1,173 @@
1
+ import type { Products } from '@windy/rootScope.d';
2
+ import type { ISODateString, Path, Timestamp, LoadedTranslations } from '@windy/types.d';
1
3
  /**
2
- * Object containing timestamps and methods for given weather product
4
+ * Main minifest object received from backend
3
5
  */
4
- import type { CalendarDay, MinifestObject, Weekday } from './d.ts.files/Calendar.d';
5
- import type { TimeFormatFunction } from './d.ts.files/format.d';
6
- import type { Products } from './d.ts.files/rootScope.d';
7
- import type { ISODateString, Path, Timestamp, YYYYMMDDHH } from './d.ts.files/types.d';
8
- export type CalendarInitParams = Pick<Calendar, 'numOfHours' | 'minifestFile'> & {
6
+ export interface MinifestObject {
9
7
  /**
10
- * Ident of product that this calendar is for
8
+ * Version
11
9
  */
12
- product: Products;
10
+ v: string;
13
11
  /**
14
- * This product is a free product
12
+ * Array of hour moments that contain forecast data
15
13
  */
16
- freeProduct?: boolean;
14
+ dst: number[][];
17
15
  /**
18
- * Optional latest timestamp (for use for offline mode for example)
16
+ * Main identifier, identifying the refTime on the backend.
19
17
  */
20
- lastTimestamp?: Timestamp;
21
- };
22
- export declare class Calendar {
18
+ info: string;
23
19
  /**
24
- * Time formatting function
20
+ * Reference time of forecast
25
21
  */
26
- static readonly localeHours: TimeFormatFunction;
27
- static readonly weekdays: Weekday[];
22
+ ref: ISODateString;
28
23
  /**
29
- * Number of hours covered by this calendar
24
+ * Update time of the forecast
30
25
  */
31
- numOfHours: number;
32
- calendarHours: number;
26
+ update: ISODateString;
33
27
  /**
34
- * Today midnigh in LT of user's computer
28
+ * In an emergency case backend can set `force` property at minifest. It breaks minifest client cache and set minifest at any circumstances
35
29
  */
36
- midnight: Date;
30
+ forced?: boolean;
31
+ }
32
+ /**
33
+ * Main Calendar Day Object
34
+ */
35
+ export interface CalendarDay {
37
36
  /**
38
- * This midnight of other defined start of timeline
37
+ * Translation ID for week day one letter/symbol abbreviation
39
38
  */
40
- startOfTimeline: Date;
39
+ displayShort: keyof LoadedTranslations;
41
40
  /**
42
- * startOfTimeline in the form of timestamp
41
+ * Translation ID for week day abbreviation
43
42
  */
44
- start: Timestamp;
43
+ display: keyof LoadedTranslations;
45
44
  /**
46
- * startOfPremiumTimeline in the form of timestamp; null if it is free in whole range
45
+ * Translation ID for week day abbreviation
47
46
  */
48
- premiumStart: Timestamp | null;
47
+ displayLong: keyof LoadedTranslations;
49
48
  /**
50
- * endOfCalendar as timestamp
49
+ * Start of the day
51
50
  */
52
- endOfCal: Timestamp;
51
+ start: Timestamp;
53
52
  /**
54
- * endOfCal or latest timestamp, whiever is smaller
53
+ * End of the day
55
54
  */
56
55
  end: Timestamp;
57
56
  /**
58
- * Array of calendayr days to be used in UI
57
+ * Midday of the day
59
58
  */
60
- days: CalendarDay[];
59
+ middayTs: Timestamp;
61
60
  /**
62
- * Array of timestamps that contain valid forecast
61
+ * Day of the month
63
62
  */
64
- timestamps: Timestamp[];
63
+ day: number;
65
64
  /**
66
- * Array of URL paths that equal to timestamps in a form of "2021/05/27/19"
65
+ * Forecast for this day is for Premium users only
67
66
  */
68
- paths: string[];
67
+ premium: boolean;
68
+ /**
69
+ * Forecast for this day is available
70
+ */
71
+ hasForecast: boolean;
72
+ }
73
+ /**
74
+ * Valid translation keys
75
+ */
76
+ export type Weekday = 'SUN' | 'MON' | 'TUE' | 'WED' | 'THU' | 'FRI' | 'SAT';
77
+ export type CalendarInitParams = {
69
78
  /**
70
79
  * Minifest that led to construction of this instance
71
80
  */
72
- minifestFile: MinifestObject;
81
+ minifest: MinifestObject;
73
82
  /**
74
- * Is the minifest valid or emergency, created out of the air?
83
+ * Ident of product that this calendar is created for
75
84
  */
76
- minifestValid: boolean;
85
+ productIdent: Products;
77
86
  /**
78
- * Minifests's reference time is some non stndard format
87
+ * This product is a free product
79
88
  */
80
- refTime: YYYYMMDDHH;
89
+ freeProduct?: boolean;
81
90
  /**
82
- * Minifests's reference time
91
+ * Minimum number of hours this calendar should cover
83
92
  */
84
- refTimeTs: Timestamp;
93
+ minimumHours: number;
94
+ };
95
+ export declare class Calendar {
96
+ static readonly weekdays: Weekday[];
85
97
  /**
86
- * Minifests's reference time
98
+ * At what day we start premium forecast
87
99
  */
88
- refTimeTxt: ISODateString;
100
+ private premiumStartDay;
89
101
  /**
90
- * Forecast update time
102
+ * Ident of a product that this Calendar is associated with (just for debug purposes)
91
103
  */
92
- updateTs: Timestamp;
104
+ private productIdent;
93
105
  /**
94
- * Forecast update time
106
+ * Number of hours in the calendar
95
107
  */
96
- updateTxt: ISODateString;
97
- constructor(params: CalendarInitParams);
98
- initProperties(): void;
108
+ calendarHours: number;
99
109
  /**
100
- * Bound ts to be be within limit of calendar
110
+ * Today midnight in LT of user's computer
101
111
  */
102
- boundTs(ts: Timestamp): Timestamp;
112
+ midnight: Date;
103
113
  /**
104
- * Finds closes valid path on the basis of timestamp
114
+ * startOfTimeline in the form of timestamp
105
115
  */
106
- ts2path(ts: Timestamp): Path;
116
+ start: Timestamp;
107
117
  /**
108
- * Creates timestamps out of the air, with 3h interval (fixed)
118
+ * startOfPremiumTimeline in the form of timestamp; null if it is free in whole range
109
119
  */
110
- createTimestamps(): void;
111
- prepareTimesFromMinifest(minifest: MinifestObject): boolean;
120
+ premiumStart: Timestamp | null;
112
121
  /**
113
- * Creates timestamps & paths arrays from minifest
122
+ * endOfPremiumTimeline in the form of timestamp; null if it is free in whole range
114
123
  */
115
- createTimestampsFromMinifest(minifest: MinifestObject): boolean;
124
+ premiumEnd: Timestamp | null;
116
125
  /**
117
- * Return YYYY/MM/DD/HH or YYYYMMDDHH on a basis of provided date
118
- * we do not CHECK existence of path in minifest
126
+ * endOfCalendar as timestamp
119
127
  */
120
- static date2path(date: Date): YYYYMMDDHH;
128
+ endOfCal: Timestamp;
121
129
  /**
122
- * Returns JavaScript date object corresponding
123
- * to provided path in a form YYYY/MM/DD/HH or YYYYMMDDHH
130
+ * endOfCal or latest timestamp, whoever is smaller
124
131
  */
125
- static path2date(path: string): Date;
132
+ end: Timestamp;
126
133
  /**
127
- * Returns nice, human readable date string out of ts
134
+ * Array of calendar days to be used in UI
128
135
  */
129
- static ts2string(ts: string | number): string;
136
+ days: CalendarDay[];
137
+ /**
138
+ * Array of timestamps that contain valid forecast
139
+ */
140
+ timestamps: Timestamp[];
141
+ /**
142
+ * Array of URL paths that equal to timestamps in a form of "2021/05/27/19"
143
+ */
144
+ paths: Path[];
145
+ /**
146
+ * Forecast update time
147
+ */
148
+ updateTs: Timestamp;
149
+ /**
150
+ * Minifests's reference time
151
+ */
152
+ refTimeTs: Timestamp;
153
+ constructor({ productIdent, minifest, freeProduct, minimumHours }: CalendarInitParams);
154
+ /**
155
+ * Bound ts to be be within limit of calendar
156
+ */
157
+ boundTs(ts: Timestamp): Timestamp;
158
+ /**
159
+ * Finds closes valid path on the basis of timestamp
160
+ */
161
+ ts2path(ts: Timestamp): Path;
162
+ private createDays;
163
+ private createTimestamps;
130
164
  /**
131
165
  * Adds hours or days to date
132
166
  *
133
167
  * @example
134
168
  * date = this.add( new Date(), 13, 'days' )
135
169
  */
136
- static add(date: Date, x: number, what?: 'days' | 'hours' | undefined): Date;
170
+ private add;
137
171
  /**
138
172
  * Return nearest midnight
139
173
  */
@@ -1,10 +1,22 @@
1
- import type { ColorGradient, AnyColorIdent, RGBA, RGBString } from './d.ts.files/Color.d';
2
- import type { NumValue } from './d.ts.files/types.d';
1
+ import type { RGBA, RGBString, ColorGradient, NumValue, ColorGradientString } from '@windy/types.d';
2
+ export type ColorIdent = 'temp' | 'wind' | 'rh' | 'pressure' | 'cclAltitude' | 'altitude' | 'deg0' | 'levels' | 'rain' | 'ptype' | 'rainClouds' | 'clouds' | 'lclouds' | 'hclouds' | 'mclouds' | 'cape' | 'lightDensity' | 'cbase' | 'snow' | 'rainAccu' | 'waves' | 'currents' | 'visibility' | 'gtco3' | 'aod550' | 'pm2p5' | 'no2' | 'tcso2' | 'go3' | 'cosc' | 'dust' | 'satellite' | 'radar' | 'fog' | 'justGray' | 'efiWind' | 'efiTemp' | 'efiRain' | 'moistureAnom40' | 'moistureAnom100' | 'drought' | 'soilMoisture' | 'fwi' | 'dfm10h' | 'solarpower' | 'wavePower' | 'uvindex' | 'turbulence' | 'icing' | 'wetbulbtemp' | 'aqi' | 'dewpoint';
3
+ export type PluginColorIdent = 'windDetail' | 'wavesDetail' | 'periodDetail' | 'altitudeDetail' | 'visibilityDetail' | 'dewpointSpreadDetail' | 'blitz' | 'radiation' | 'pmDetail' | 'dustDetail' | 'coscDetail' | 'no2Detail' | 'pollenDetail' | 'so2Detail' | 'aqiGradientDetail' | 'wavePowerDetail';
4
+ export type AnyColorIdent = ColorIdent | PluginColorIdent | 'pressureIsolines' | 'temporary' | 'direction' | 'airgramColor' | 'tempFillColors' | 'tideGraphColors' | 'aqiFillColors';
5
+ export interface UserColor {
6
+ id: AnyColorIdent;
7
+ gradient: ColorGradient;
8
+ }
3
9
  export type ColorInitParams = Pick<Color, 'ident'> & Partial<Pick<Color, 'qualitative'>> & {
4
- steps: number;
5
- default: ColorGradient;
10
+ default: ColorGradientString;
11
+ steps?: number;
6
12
  opaque?: boolean;
7
13
  prepare?: boolean;
14
+ /**
15
+ * Min and max gradient value override
16
+ * - used for gradients with constant min and max values
17
+ * - e.g. radar with [0,256] in all cases (gradient is not resized based on the current gradient extents)
18
+ */
19
+ minMaxValue?: [NumValue, NumValue];
8
20
  };
9
21
  export declare class Color {
10
22
  /**
@@ -26,9 +38,12 @@ export declare class Color {
26
38
  /** Index of neutral gray color */
27
39
  private neutralGrayIndex;
28
40
  /** Initial gradient */
29
- private defaultColorGradient;
41
+ private initialColorGradient;
42
+ /** Initial gradient, that was parsed to RGBA arrays from RGBAStrings */
43
+ private defaultColorGradient?;
30
44
  /** Custom modified gradient */
31
45
  private customColorGradient?;
46
+ private minMaxValue?;
32
47
  /** Big interpolated RGBA Type array color table, generated when color is required */
33
48
  private colors?;
34
49
  /** Min value of associated numerical value */
@@ -91,6 +106,11 @@ export declare class Color {
91
106
  * Checks validity of a gradient that it adheres to type ColorGradient
92
107
  */
93
108
  static checkValidity(obj: unknown): boolean;
109
+ private parseRGBAString;
110
+ /**
111
+ * Converts ColorGradientString into ColorGradient
112
+ */
113
+ private parseColorGradient;
94
114
  /**
95
115
  * return array multiplied by mul coef
96
116
  */
@@ -1,6 +1,6 @@
1
1
  import { dataLoader } from '@windy/dataLoader';
2
- import type { FullRenderParameters } from './d.ts.files/Layer.d';
3
- import type { DataTile } from './d.ts.files/dataLoader';
2
+ import type { FullRenderParameters } from '@windy/interfaces';
3
+ import type { DataTile } from '@windy/dataLoader';
4
4
  import type { ExtendedTileParams } from './DataTiler.d';
5
5
  export interface TilePoint {
6
6
  x: number;
@@ -1,7 +1,29 @@
1
1
  import { Calendar } from '@windy/Calendar';
2
2
  import { Product } from '@windy/Product';
3
3
  import type { ProductInitParams } from '@windy/Product';
4
+ /**
5
+ * Common product params for ECMWF products.
6
+ */
7
+ export declare const EcmwfProductParams: {
8
+ modelName: string;
9
+ modelResolution: number;
10
+ provider: string;
11
+ interval: number;
12
+ intervalPremium: number;
13
+ maxTileZoom: {
14
+ free: number;
15
+ premium: number;
16
+ };
17
+ dataQuality: "normal";
18
+ };
4
19
  export declare class EcmwfProduct extends Product {
5
20
  calendar: Calendar;
6
21
  constructor(params: Partial<ProductInitParams>);
22
+ /**
23
+ * Create fake minifest file for ECMWF product to use it during rendering of
24
+ * UI before real minifest is loaded.
25
+ *
26
+ * DO NOT TRY TO USE THIS CALENDAR FOR FETCHING DATA FROM SERVER!!!!
27
+ */
28
+ static createVirtualCalendar(this: EcmwfProduct): Calendar;
7
29
  }
@@ -0,0 +1,69 @@
1
+ /// <reference types="svelte" />
2
+ import store from '@windy/store';
3
+ import type { StoreTypes } from '@windy/store.d';
4
+ import type { Evented as MaplibreEvented, Listener, MapEventType, MapLayerEventType, LeafletEventHandlerFn } from '@leafletGl';
5
+ import type { Evented } from '@windy/Evented';
6
+ import type { BcastTypes } from '@windy/broadcast.d';
7
+ import type { Plugins } from '@windy/plugins.d';
8
+ import type { Readable, Subscriber } from 'svelte/store';
9
+ type MapLibreEventTypes = MapLayerEventType | MapEventType | string;
10
+ type BcastEventTypes = keyof BcastTypes<keyof Plugins>;
11
+ /**
12
+ * @class A class for managing event listeners
13
+ * - used to safely bind AND unbind listeners by storing callback references
14
+ */
15
+ export declare class EventManager {
16
+ private DOMCallbacks;
17
+ private MapLibreCallbacks;
18
+ private storeCallbacks;
19
+ private eventedCallbacks;
20
+ private broadcastCallbacks;
21
+ private mapCallbacks;
22
+ private unsubscribers;
23
+ /**
24
+ * @summary Registers specific event listener on a given DOM target with a given callback
25
+ * @param target - target to listen on
26
+ * @param topic - which event to listen for
27
+ * @param callback - callback function that should process the event
28
+ */
29
+ addDOMListener<T extends EventTarget>(target: T, topic: Parameters<T['addEventListener']>[0], callback: Parameters<T['addEventListener']>[1]): void;
30
+ /**
31
+ * @summary Registers specific event listener on a given MapLibre target with a given callback
32
+ * @param target - target to listen on
33
+ * @param topic - which event to listen for
34
+ * @param callback - callback function that should process the event
35
+ */
36
+ addMapLibreListener<T extends MapLibreEventTypes>(target: MaplibreEvented, topic: T, callback: Listener): void;
37
+ /**
38
+ * @summary Registers specific event listener on windy store with a given callback
39
+ * @param topic - which event to listen for
40
+ * @param callback - callback function that should process the event
41
+ */
42
+ addStoreListener<T extends keyof StoreTypes>(topic: T, callback: Parameters<(typeof store)['on']>[1]): void;
43
+ /**
44
+ * @summary Registers specific event listener on a given windy/evented target with a given callback
45
+ * @param target - target to listen on
46
+ * @param topic - which event to listen for
47
+ * @param callback - callback function that should process the event
48
+ */
49
+ addEventedListener<T>(target: Evented<T>, topic: keyof T, callback: (typeof this.eventedCallbacks)[string][number]['ref']): void;
50
+ /**
51
+ * @summary Registers specific event listener on windy broadcast with a given callback
52
+ * @param topic - which event to listen for
53
+ * @param callback - callback function that should process the event
54
+ */
55
+ addBroadcastListener(topic: BcastEventTypes, callback: (typeof this.broadcastCallbacks)[string][number]['ref']): void;
56
+ addMapListener(topic: string, callback: LeafletEventHandlerFn): void;
57
+ addSvelteStoreListener<T>(svelteStore: Readable<T>, callback: Subscriber<T>, onlyOnChange?: boolean): void;
58
+ /**
59
+ * Subscribe to DOM mutations using MutationObserver
60
+ *
61
+ * See https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
62
+ */
63
+ addMutationObserverListener(target: Node, options: MutationObserverInit, callback: MutationCallback): void;
64
+ /**
65
+ * @summary Cleanup method to remove (unregister) all registered listeners
66
+ */
67
+ removeListeners(): void;
68
+ }
69
+ export {};
@@ -2,7 +2,8 @@ import { SveltePlugin, type ExternalSvelteApp } from '@windy/SveltePlugin';
2
2
  import type { WindowPluginInitParams } from '@windy/WindowPlugin';
3
3
  import type { SveltePanePlugins, SveltePlugins } from '@windy/plugins.d';
4
4
  import type { CompiledExternalPluginConfig, ExternalPluginConfig, InstalledExternalPluginConfig, PluginOpeningOptions } from '@windy/interfaces';
5
- import type { PluginPane } from './Plugin';
5
+ import type { PluginPane } from '@windy/Plugin';
6
+ import type { SemVersion } from '@windy/types';
6
7
  /** Allowed params to SveltePlugin constructor (private and protected props are omitted by default) */
7
8
  export type ExternalSveltePluginInitParams<P extends keyof SveltePlugins | keyof SveltePanePlugins> = Omit<WindowPluginInitParams<P>, 'ident'> & Pick<SveltePlugin<P>, 'ident'> & Partial<SveltePlugin<P>>;
8
9
  export type LoadeExternalSveltePlugin = {
@@ -22,12 +23,12 @@ export declare class ExternalSveltePlugin extends SveltePlugin<'windy-external-p
22
23
  mobileConfig: Record<InstalledExternalPluginConfig['mobileUI'], Config2config>;
23
24
  desktopConfig: Record<InstalledExternalPluginConfig['desktopUI'], Config2config>;
24
25
  widthOfRhPane: number;
25
- version: string;
26
+ version: SemVersion;
26
27
  listenToSingleclick: ExternalPluginConfig['listenToSingleclick'];
27
28
  addToContextmenu: ExternalPluginConfig['addToContextmenu'];
28
29
  constructor(params: WindowPluginInitParams<'windy-external-plugin'>, { desktopUI, title, mobileUI, desktopWidth, routerPath, listenToSingleclick, addToContextmenu, url, version, }: InstalledExternalPluginConfig);
29
30
  open({ params, disableOpeningAnimation, qs, }: PluginOpeningOptions<'windy-external-plugin'>): Promise<void | boolean>;
30
- hasNewerVersion(latestVersion: string): boolean;
31
+ hasNewerVersion(latestVersion: SemVersion): boolean;
31
32
  showConfirmationWindow(): Promise<boolean>;
32
33
  getDayDiff(timestamp: string): number;
33
34
  uninstallPlugin(): Promise<void>;
@@ -0,0 +1,45 @@
1
+ import type { TypedArray } from '@windy/glUtils.d';
2
+ export declare enum GlBufferType {
3
+ VERTEX,
4
+ INDEX
5
+ }
6
+ export declare enum GlBufferUsage {
7
+ STATIC,
8
+ DYNAMIC
9
+ }
10
+ /**
11
+ * @class A wrapper class over WebGLBuffer
12
+ */
13
+ export declare class GlBuffer {
14
+ private static idCounter;
15
+ /** Reference to the WebGL buffer on the GPU */
16
+ protected readonly buffer: WebGLBuffer;
17
+ protected type: GlBufferType;
18
+ /** Length of uploaded data array in the buffer */
19
+ protected _dataLength: number;
20
+ /** Class instance unique id, for debug, tracks number of created instances */
21
+ protected readonly bufferId: number;
22
+ constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, type: GlBufferType);
23
+ /**
24
+ * @summary Resets buffer instance counter on plugin cleanup, used for debugging
25
+ */
26
+ static reset(): void;
27
+ /**
28
+ * @summary Binds buffer for subsequent operations
29
+ */
30
+ bind(gl: WebGLRenderingContext | WebGL2RenderingContext): void;
31
+ /**
32
+ * @summary Unbinds the buffer
33
+ */
34
+ unbind(gl: WebGLRenderingContext | WebGL2RenderingContext): void;
35
+ /**
36
+ * @summary Updates data in the GPU buffer
37
+ * @param data Data to be uploaded to the GPU buffer
38
+ * @param usage Buffer update frequency (how the buffer will be updated)
39
+ */
40
+ update(gl: WebGLRenderingContext | WebGL2RenderingContext, data: TypedArray, usage?: GlBufferUsage): void;
41
+ /** @summary Returns number of elements inside the buffer */
42
+ get length(): number;
43
+ /** @summary Deletes the WebGL buffer */
44
+ destroy(gl: WebGLRenderingContext | WebGL2RenderingContext): void;
45
+ }
@@ -0,0 +1,147 @@
1
+ import type { TypedArray } from '@windy/glUtils.d';
2
+ import type { GlProgram } from '@windy/GlProgram';
3
+ /**
4
+ * @class A class that represents abstraction of a renderable logical geometry chunk
5
+ * - (geometry with the same properties, requiring same rendering approach)
6
+ */
7
+ export declare class GlMesh {
8
+ private static numMeshes;
9
+ /**
10
+ * Array of vertex streams (Vertex Buffer Objects) used for rendering the mesh
11
+ * - GPU buffer references | Key-value map in the future (multiple geometry buffers)
12
+ */
13
+ private readonly vbos;
14
+ /** Size of the GPU buffer | Key-value map in the future (multiple geometry buffers) */
15
+ private vertexCount;
16
+ /**
17
+ * Array of vertex attributes mapping
18
+ * - one map for each vertex stream, since every stream has at least one attribute defined by layout index and size
19
+ * - maps attributes bound to the given GPU buffer (VBO)
20
+ */
21
+ private readonly attributes;
22
+ /**
23
+ * Size of all attributes for one vertex in the given vertex stream
24
+ * e.g. one vertex has Vec3 position, Vec2 uv, and Vec3 color --> stride is 3+2+3 = 8 bytes
25
+ * */
26
+ private readonly buffersStride;
27
+ /** Element Buffer Object for storing vertex indices for indexed rendering */
28
+ private ebo?;
29
+ /**
30
+ * Map of Vertex Array Objects
31
+ * VAO - represents binding of geometry layout with a given shader program
32
+ * - one VAO is for given GlProgram (not per vertex stream)
33
+ * - one VAO handles binding of all vertex streams, but for every GlProgram, new VAO should be created since each shader can have different layout
34
+ */
35
+ private readonly vaos;
36
+ private readonly meshId;
37
+ private instanceBuffer?;
38
+ private instanceAttributes?;
39
+ private instanceBufferStride;
40
+ private instancingInitialized;
41
+ private drawElementsCall;
42
+ private drawArraysCall;
43
+ private vertexDivisorCall;
44
+ /**
45
+ * @param vertexData Default vertex stream data (can be interleaved - defined by layout)
46
+ * @param indexData Optional index buffer data (in case of indexed data rendering)
47
+ * @param dynamic Signals, whether the geometry will be updated frequently or is static
48
+ */
49
+ constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, vertexData: Float32Array, indexData?: Uint16Array, dynamic?: boolean);
50
+ /**
51
+ * @summary Resets mesh instance counter on plugin cleanup, used for debugging
52
+ */
53
+ static reset(): void;
54
+ /**
55
+ * @summary Performs draw call of the mesh w.r.t. current state defined by VAO / attributes layout + given shader program
56
+ * - WARNING: this call assumes, that GlProgram.use() / gl.useProgram(programId) was already called!
57
+ * - automatically performs the appropriate call -> instanced/non-instanced + indexed/non-indexed - all based on the state given by the supplied data
58
+ * @param program Shader program used to identify the render/geometry state
59
+ * @param primType Which primitives to draw with the vertex data
60
+ * @param offset Offset in the geometry buffer (defaults to 0)
61
+ * @param count Number of vertices / elements to draw from the buffer (defaults to full size of the geometry)
62
+ * @param numInstances When instanced rendering used, signals, how many instances to draw
63
+ */
64
+ render(gl: WebGLRenderingContext | WebGL2RenderingContext, program: GlProgram, primitiveType?: GLenum, numInstances?: number): void;
65
+ /**
66
+ * @summary Creates new geometry layout binding / (new VAO if available) w.r.t. supplied shader program
67
+ * - goal: the same mesh geometry can be reused by many shaders with different layouts (we are binding to the given shader)
68
+ * - TODO: currently works with only one buffer (interleaved/joined data), extend this to support multiple buffers (streams) + per-buffer layout setup
69
+ * @param shaderProgram Shader program for which to setup the layout
70
+ * @param vertexAttribLayout Specifies, how the mesh data should be mapped to the given shader (VS)
71
+ * - e.g. {a_pos : 3, a_uv : 2} defines two attributes, first vertex position with three components, second texture coordinates vector with two components
72
+ * - the object keys must respect names of the attribute variables in the Vertex Shader
73
+ * @param vertexStreamIndex Index of vertex stream (VBO) for which the layout is being registered. Default one is 0
74
+ */
75
+ registerShaderGeometryLayout(gl: WebGLRenderingContext | WebGL2RenderingContext, shaderProgram: GlProgram, vertexAttribLayout: Record<string, number>, vertexStreamIndex?: number): void;
76
+ /**
77
+ * @summary Destructor
78
+ */
79
+ destroy(gl: WebGLRenderingContext | WebGL2RenderingContext): void;
80
+ /**
81
+ * @summary Appends vertex stream to the mesh.
82
+ * Do not forget to register vertex layout for this stream via {@link registerShaderGeometryLayout} method
83
+ * @param vertexData Typed array (Float32Array) with vertex data (position, tex. coordinates etc.)
84
+ * @param dynamic Whether the data will be updated frequently or not
85
+ * @returns Index of the newly registered vertex stream
86
+ */
87
+ addVertexStream(gl: WebGLRenderingContext | WebGL2RenderingContext, vertexData: Float32Array, dynamic?: boolean): number;
88
+ /**
89
+ * @summary Dynamically updates content of the given vertex stream. Assumes, that the layout remains the same
90
+ * @param streamIndex Which stream data to update
91
+ * @param vertexData New vertex data
92
+ */
93
+ updateVertexStream(gl: WebGLRenderingContext | WebGL2RenderingContext, streamIndex: number, vertexData: Float32Array): boolean;
94
+ /**
95
+ * @summary Initializes instancing-related methods based on used WebGL context
96
+ * - if not called explicitly, it is called during instanced rendering (however in that case we don't get the status, whether instancing is available)
97
+ * @returns Status, whether instancing was successfully initialized or whether it failed (extension not supported...)
98
+ */
99
+ initInstancing(gl: WebGL2RenderingContext | WebGLRenderingContext): boolean;
100
+ /**
101
+ * @summary Adds / updates instance data, binds instance buffer with the given shader
102
+ * - signals, that further rendering will be performed as instanced (based on thw supplied "numInstances" parameter in the render method)
103
+ * @param program Shader program used for instanced rendering
104
+ * @param instanceData Per-instance data (buffer with elements, where each element is assigned to one instance (defined by "gl.vertexAttribDivisor"))
105
+ * @returns true/false, whether update was successful (can fail, when WebGL2 not available together with 'ANGLE_instanced_arrays' extension not available)
106
+ */
107
+ setInstanceStream(gl: WebGLRenderingContext | WebGL2RenderingContext, program: GlProgram, instanceData: TypedArray, instanceAttribLayout: Record<string, [number, number]>): boolean;
108
+ /**
109
+ * @summary Dynamically updates content of the mesh instance stream.
110
+ * - Assumes, that the layout remains the same
111
+ * - Currently only one instance stream is supported
112
+ * @param instanceData New instance data
113
+ */
114
+ updateInstanceStream(gl: WebGLRenderingContext | WebGL2RenderingContext, instanceData: TypedArray): boolean;
115
+ /**
116
+ * @returns {boolean} Flag, that instance stream was already created, so subsequent data uploads should call {@link updateInstanceStream}
117
+ */
118
+ hasInstanceStream(): boolean;
119
+ /**
120
+ * @summary Binds geometry (and index if available) buffer for following operations (e.g. rendering)
121
+ * - Also used for layout definition when creating VAO {@link GlVertexArray}
122
+ */
123
+ private bindGeometry;
124
+ /**
125
+ * @summary Performs rendering of the mesh numInstances-times using WebGL2 context or WebGL1 extension
126
+ */
127
+ private renderInstanced;
128
+ }
129
+ /**
130
+ * @class A container with common geometries
131
+ */
132
+ export declare class MeshFactory {
133
+ /** 2D Quad geometry containing only unique vertices (for indexed rendering / triangle fan)
134
+ * Contains vertex coordinates + UV coordinates
135
+ * - an appropriate vertex layout should be {a_pos: 2, u_uv: 2}
136
+ */
137
+ static quadMeshUniqueVtxUv: number[];
138
+ /** 2D Quad mesh with unique vertices with only vertex positions
139
+ * - an appropriate vertex layout should be {a_pos: 2}
140
+ */
141
+ static quadMeshUniqueVtx: number[];
142
+ /** 2D Quad mesh with defined as two triangles - 6 vertices (not - unique)
143
+ * - basically geometry for drawArrays as gl.TRIANGLE
144
+ * - an appropriate vertex layout should be {a_pos: 2}
145
+ */
146
+ static quadMeshTrianglesVtx: number[];
147
+ }