@windycom/plugin-devtools 1.0.4 → 1.0.6

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 (66) hide show
  1. package/README.md +3 -1
  2. package/index.mjs +3 -2
  3. package/package.json +5 -2
  4. package/types/client/Calendar.d.ts +4 -4
  5. package/types/client/Color.d.ts +3 -3
  6. package/types/client/DataTiler.d.ts +2 -2
  7. package/types/client/GlObj.d.ts +1 -1
  8. package/types/client/Layer.d.ts +11 -11
  9. package/types/client/Metric.d.ts +5 -5
  10. package/types/client/Product.d.ts +6 -6
  11. package/types/client/Renderer.d.ts +4 -4
  12. package/types/client/Webcams.d.ts +4 -4
  13. package/types/client/d.ts.files/Calendar.d.ts +87 -0
  14. package/types/client/d.ts.files/CanvasLayer.d.ts +70 -0
  15. package/types/client/d.ts.files/Color.d.ts +82 -0
  16. package/types/client/d.ts.files/DataTiler.d.ts +45 -0
  17. package/types/client/d.ts.files/GlObj.d.ts +92 -0
  18. package/types/client/d.ts.files/LabelsLayer.d.ts +51 -0
  19. package/types/client/d.ts.files/LandMask.d.ts +17 -0
  20. package/types/client/d.ts.files/Layer.d.ts +184 -0
  21. package/types/client/d.ts.files/Metric.d.ts +192 -0
  22. package/types/client/d.ts.files/PoisOverlay.d.ts +27 -0
  23. package/types/client/d.ts.files/Product.d.ts +37 -0
  24. package/types/client/d.ts.files/Renderer.d.ts +23 -0
  25. package/types/client/d.ts.files/TileLayerCanvas.d.ts +78 -0
  26. package/types/client/d.ts.files/TileLayerMultiPatch.d.ts +13 -0
  27. package/types/client/d.ts.files/Webcams.d.ts +160 -0
  28. package/types/client/d.ts.files/broadcast.d.ts +177 -0
  29. package/types/client/d.ts.files/dataSpecifications.d.ts +943 -0
  30. package/types/client/d.ts.files/errorLogger.d.ts +35 -0
  31. package/types/client/d.ts.files/format.d.ts +48 -0
  32. package/types/client/d.ts.files/http.d.ts +87 -0
  33. package/types/client/d.ts.files/incomingMessages.d.ts +88 -0
  34. package/types/client/d.ts.files/lib.d.ts +74 -0
  35. package/types/client/d.ts.files/notifications.d.ts +39 -0
  36. package/types/client/d.ts.files/outgoingMessages.d.ts +75 -0
  37. package/types/client/d.ts.files/plugin-params.d.ts +236 -0
  38. package/types/client/d.ts.files/plugins.d.ts +132 -0
  39. package/types/client/d.ts.files/pois.d.ts +11 -0
  40. package/types/client/d.ts.files/products.d.ts +44 -0
  41. package/types/client/d.ts.files/rootScope.d.ts +43 -0
  42. package/types/client/d.ts.files/satellite.d.ts +50 -0
  43. package/types/client/d.ts.files/singleclick.d.ts +31 -0
  44. package/types/client/d.ts.files/storage.d.ts +120 -0
  45. package/types/client/d.ts.files/store.d.ts +61 -0
  46. package/types/client/d.ts.files/tileInterpolator.d.ts +35 -0
  47. package/types/client/d.ts.files/trans.d.ts +55 -0
  48. package/types/client/d.ts.files/user.d.ts +58 -0
  49. package/types/client/dataSpecifications.d.ts +1 -1
  50. package/types/client/embed2.d.ts +3 -4
  51. package/types/client/errorLogger.d.ts +1 -1
  52. package/types/client/fetch.d.ts +30 -3
  53. package/types/client/format.d.ts +2 -2
  54. package/types/client/http.d.ts +1 -1
  55. package/types/client/notifications.d.ts +2 -2
  56. package/types/client/plugins.d.ts +1 -1
  57. package/types/client/pois.d.ts +1 -1
  58. package/types/client/products.d.ts +1 -1
  59. package/types/client/rootScope.d.ts +4 -4
  60. package/types/client/singleclick.d.ts +2 -2
  61. package/types/client/storage.d.ts +1 -1
  62. package/types/client/store.d.ts +2 -2
  63. package/types/client/tileInterpolator.d.ts +3 -3
  64. package/types/client/trans.d.ts +3 -3
  65. package/types/client/user.d.ts +3 -3
  66. package/types/client/utils.d.ts +1 -1
package/README.md CHANGED
@@ -4,4 +4,6 @@ Check out https://docs.windy-plugins.com for more information.
4
4
 
5
5
  # CHANGELOG
6
6
 
7
- - 1.X.X - TS declarations for client v42
7
+ - 1.0.6 - Fix plugin version validation
8
+ - 1.0.5 - Fixing .d.ts declarations
9
+ - 1.0.0 - TS declarations for client v42
package/index.mjs CHANGED
@@ -3,6 +3,7 @@ import fs from 'fs';
3
3
  import assert from 'assert';
4
4
  import MagicString from 'magic-string';
5
5
  import { walk } from 'estree-walker';
6
+ const semver = require('semver');
6
7
 
7
8
  const testLoadedPlugin = config => {
8
9
  const { name, version, title, desktopUI, mobileUI, routerPath, icon } = config;
@@ -13,8 +14,8 @@ const testLoadedPlugin = config => {
13
14
  );
14
15
 
15
16
  assert(
16
- typeof version === 'string' && version.match(/^\d+\.\d+\.\d+$/),
17
- 'Plugin version is not defined or is not in semversion format (example: 1.3.7)',
17
+ typeof version === 'string' && semver.valid(version),
18
+ 'Plugin version is not defined or is not in SemVer format (example: 1.3.7)',
18
19
  );
19
20
 
20
21
  assert(
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@windycom/plugin-devtools",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Developer tools and TS declarations for developers of Windy Plugins.",
5
5
  "main": "index.mjs",
6
6
  "module": "index.mjs",
7
7
  "author": "Windyty, S.E.",
8
- "license": "ISC"
8
+ "license": "ISC",
9
+ "dependencies": {
10
+ "semver": "^7.6.0"
11
+ }
9
12
  }
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Object containing timestamps and methods for given weather product
3
3
  */
4
- import type { CalendarDay, MinifestObject, Weekday } from '@windy/Calendar.d';
5
- import type { TimeFormatFunction } from '@windy/format.d';
6
- import type { Products } from '@windy/rootScope.d';
7
- import type { ISODateString, Path, Timestamp } from '@windy/types.d';
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 } from './d.ts.files/types.d';
8
8
  export type CalendarInitParams = Pick<Calendar, 'numOfHours' | 'minifestFile'> & {
9
9
  /**
10
10
  * Ident of product that this calendar is for
@@ -1,6 +1,6 @@
1
- import type { ColorGradient, ColorIdent, PluginColorIdent, RGBA, RGBString } from '@windy/Color.d';
2
- import type { StoreOptions } from '@windy/store.d';
3
- import type { NumValue } from '@windy/types.d';
1
+ import type { ColorGradient, ColorIdent, PluginColorIdent, RGBA, RGBString } from './d.ts.files/Color.d';
2
+ import type { StoreOptions } from './d.ts.files/store.d';
3
+ import type { NumValue } from './d.ts.files/types.d';
4
4
  export type ColorInitParams = Pick<Color, 'ident'> & Partial<Pick<Color, 'qualitative' | 'save'>> & {
5
5
  steps: number;
6
6
  default?: ColorGradient | null;
@@ -1,6 +1,6 @@
1
1
  import { dataLoader } from '@windy/dataLoader';
2
- import type { FullRenderParameters } from '@windy/Layer.d';
3
- import type { DataTile } from '@windy/dataLoader';
2
+ import type { FullRenderParameters } from './d.ts.files/Layer.d';
3
+ import type { DataTile } from './d.ts.files/dataLoader';
4
4
  import type { ExtendedTileParams } from './DataTiler.d';
5
5
  export interface TilePoint {
6
6
  x: number;
@@ -1,4 +1,4 @@
1
- import type { Canvas, ExtendedWebGLTexture, WebGLProgramObject } from '@windy/GlObj.d';
1
+ import type { Canvas, ExtendedWebGLTexture, WebGLProgramObject } from './d.ts.files/GlObj.d';
2
2
  /**
3
3
  * GLObj - Web GL context wrapper
4
4
  */
@@ -1,14 +1,14 @@
1
- import type { Color } from '@windy/Color';
2
- import type { FullRenderParameters, Layers, RenderParams, TransformFunction } from '@windy/Layer.d';
3
- import type { Metric } from '@windy/Metric';
4
- import type { Legend } from '@windy/Metric.d';
5
- import type { NumberedMetric } from '@windy/MetricClasses';
6
- import type { Product } from '@windy/Product';
7
- import type { DataQuality, FileSuffix } from '@windy/Product.d';
8
- import type { Renderers } from '@windy/Renderer.d';
9
- import type { WeatherParameters } from '@windy/interfaces.d';
10
- import type { Levels, Products } from '@windy/rootScope.d';
11
- import type { Timestamp } from '@windy/types';
1
+ import type { Color } from './d.ts.files/Color';
2
+ import type { FullRenderParameters, Layers, RenderParams, TransformFunction } from './d.ts.files/Layer.d';
3
+ import type { Metric } from './d.ts.files/Metric';
4
+ import type { Legend } from './d.ts.files/Metric.d';
5
+ import type { NumberedMetric } from './d.ts.files/MetricClasses';
6
+ import type { Product } from './d.ts.files/Product';
7
+ import type { DataQuality, FileSuffix } from './d.ts.files/Product.d';
8
+ import type { Renderers } from './d.ts.files/Renderer.d';
9
+ import type { WeatherParameters } from './d.ts.files/interfaces.d';
10
+ import type { Levels, Products } from './d.ts.files/rootScope.d';
11
+ import type { Timestamp } from './d.ts.files/types';
12
12
  type LayerInitParams = Pick<Layer, 'ident'> & Partial<Layer>;
13
13
  export declare class Layer<M extends Metric | undefined = Metric | undefined> {
14
14
  /**
@@ -1,8 +1,8 @@
1
- import type { Color } from '@windy/Color';
2
- import type { RGBString } from '@windy/Color.d';
3
- import type { ConvObj, Legend, LegendDescription, LegendLines, MetricIdent, MetricInitParams, MetricItem, MetricKey } from '@windy/Metric.d';
4
- import type { LoadedTranslations } from '@windy/trans.d';
5
- import type { HTMLString, NumValue } from '@windy/types.d';
1
+ import type { Color } from './d.ts.files/Color';
2
+ import type { RGBString } from './d.ts.files/Color.d';
3
+ import type { ConvObj, Legend, LegendDescription, LegendLines, MetricIdent, MetricInitParams, MetricItem, MetricKey } from './d.ts.files/Metric.d';
4
+ import type { LoadedTranslations } from './d.ts.files/trans.d';
5
+ import type { HTMLString, NumValue } from './d.ts.files/types.d';
6
6
  export declare const rtrnSelf: (x: NumValue) => NumValue;
7
7
  /**
8
8
  * # @windy/Metric
@@ -1,11 +1,11 @@
1
1
  import { Calendar } from '@windy/Calendar';
2
2
  import * as http from '@windy/http';
3
- import type { MinifestObject } from '@windy/Calendar.d';
4
- import type { Layers } from '@windy/Layer.d';
5
- import type { DataQuality, FileSuffix } from '@windy/Product.d';
6
- import type { LatLon } from '@windy/interfaces';
7
- import type { AcTimes, Isolines, Levels, Overlays, Products } from '@windy/rootScope.d';
8
- import type { ProductCategory, ProductIdent } from '@windy/types';
3
+ import type { MinifestObject } from './d.ts.files/Calendar.d';
4
+ import type { Layers } from './d.ts.files/Layer.d';
5
+ import type { DataQuality, FileSuffix } from './d.ts.files/Product.d';
6
+ import type { LatLon } from './d.ts.files/interfaces';
7
+ import type { AcTimes, Isolines, Levels, Overlays, Products } from './d.ts.files/rootScope.d';
8
+ import type { ProductCategory, ProductIdent } from './d.ts.files/types';
9
9
  export type ProductInitParams = Pick<Product, 'modelName' | 'provider' | 'interval'> & Partial<Pick<Product, 'provider' | 'ident' | 'maxTileZoom' | 'animationSpeed' | 'animationSpeed1h' | 'fileSuffix' | 'fileSuffixFallback' | 'JPGtransparency' | 'PNGtransparency' | 'dataQuality' | 'betterDataQuality' | 'animation' | 'labelsTemp' | 'overlays' | 'prefferedProduct' | 'pathGenerator' | 'isolines' | 'directory' | 'category' | 'modelIdent' | 'intervalPremium' | 'server' | 'modelResolution' | 'levels' | 'logo' | 'acTimes'>> & {
10
10
  requiresInfoJson?: boolean;
11
11
  forecastSize?: number;
@@ -1,7 +1,7 @@
1
- import type { FullRenderParameters } from '@windy/Layer.d';
2
- import type { Renderers } from '@windy/Renderer.d';
3
- import type { InterpolatorFactory } from '@windy/interpolator';
4
- import type { BottomTagPlugins, Plugins } from '@windy/plugins.d';
1
+ import type { FullRenderParameters } from './d.ts.files/Layer.d';
2
+ import type { Renderers } from './d.ts.files/Renderer.d';
3
+ import type { InterpolatorFactory } from './d.ts.files/interpolator';
4
+ import type { BottomTagPlugins, Plugins } from './d.ts.files/plugins.d';
5
5
  type AllowedRenderPlugins = Pick<Plugins, 'radar' | 'satellite' | 'cap-alerts' | 'isolines' | 'gl-particles' | 'particles'>;
6
6
  export interface RendererInitParams {
7
7
  ident: Renderers;
@@ -1,8 +1,8 @@
1
1
  import { ClickHandler } from '@windy/ClickHandler';
2
- import type { ClickHandlerInitParams } from '@windy/ClickHandler';
3
- import type { WebcamDetail, WebcamsLoadingParams, WebcamMetadata } from '@windy/Webcams.d';
4
- import type { Plugins } from '@windy/plugins.d';
5
- import type { LatLon } from '@windy/interfaces';
2
+ import type { ClickHandlerInitParams } from './d.ts.files/ClickHandler';
3
+ import type { WebcamDetail, WebcamsLoadingParams, WebcamMetadata } from './d.ts.files/Webcams.d';
4
+ import type { Plugins } from './d.ts.files/plugins.d';
5
+ import type { LatLon } from './d.ts.files/interfaces';
6
6
  export type WebcamsInitParams = {
7
7
  useHover?: boolean;
8
8
  maxAmount?: number;
@@ -0,0 +1,87 @@
1
+ import { LoadedTranslations } from '@windy/trans.d';
2
+ import { Timestamp, ISODateString } from '@windy/types.d';
3
+
4
+ /**
5
+ * Main minifest object. Mother of all forecasts
6
+ */
7
+ export interface MinifestObject {
8
+ /**
9
+ * Version
10
+ */
11
+ v: string;
12
+
13
+ /**
14
+ * Array of hour moments that contain forecast data
15
+ */
16
+ dst: number[][];
17
+
18
+ /**
19
+ * Main identifier, identifiing the refTime on the backend.
20
+ */
21
+ info: string;
22
+
23
+ /**
24
+ * Reference time of forecast
25
+ */
26
+ ref: ISODateString;
27
+
28
+ /**
29
+ * Update time of the forecast
30
+ */
31
+ update: ISODateString;
32
+
33
+ /**
34
+ * In an emergency case backend can set `force` property at minifest. It breaks minifest client cache and set minifest at any circumstances
35
+ */
36
+ forced?: boolean;
37
+ }
38
+
39
+ /**
40
+ * Main Calendar Day Object
41
+ */
42
+ export interface CalendarDay {
43
+ /**
44
+ * Translation ID for week day abbreviation
45
+ */
46
+ display: keyof LoadedTranslations;
47
+
48
+ /**
49
+ * Translation ID for week day abbreviation
50
+ */
51
+ displayLong: keyof LoadedTranslations;
52
+
53
+ /**
54
+ * Start of the day
55
+ */
56
+ start: Timestamp;
57
+
58
+ /**
59
+ * End of the day
60
+ */
61
+ end: Timestamp;
62
+
63
+ /**
64
+ * Midday of the day
65
+ */
66
+ middayTs: Timestamp;
67
+
68
+ /**
69
+ * Day of the month
70
+ */
71
+ day: number;
72
+
73
+ /**
74
+ * month
75
+ */
76
+ month: number;
77
+
78
+ /**
79
+ * year
80
+ */
81
+ year: number;
82
+ }
83
+
84
+ /**
85
+ * Valid translation keys
86
+ */
87
+ export type Weekday = 'SUN' | 'MON' | 'TUE' | 'WED' | 'THU' | 'FRI' | 'SAT';
@@ -0,0 +1,70 @@
1
+ export class CanvasLayer extends L.Layer {
2
+ targetPane?:
3
+ | 'mapPane'
4
+ | 'tilePane'
5
+ | 'overlayPane'
6
+ | 'objectsPane'
7
+ | 'popupPane'
8
+ | 'shadowPane'
9
+ | 'markerPane';
10
+ _showCanvasOn?: boolean;
11
+ failed?: boolean;
12
+ _canvas?: L.CanvasElement | null;
13
+ _center?: L.LatLng;
14
+ _zoom?: number;
15
+ _frame?: number | null;
16
+ wasOnZoom?: boolean;
17
+ options: L.LayerOptions & {
18
+ disableAutoReset: boolean;
19
+ padding: number;
20
+ };
21
+
22
+ initialize(this: this, options?: L.LayerOptions): void;
23
+ onResizeCanvas(this: this, width: number, height: number): void;
24
+ showCanvas(this: this, on: boolean): void;
25
+ reset(this: this): void;
26
+ canvasDisplay(this: this, enable: boolean): void;
27
+ getCanvas(this: this): L.CanvasElement | undefined | null;
28
+ redraw(this: this): void;
29
+
30
+ _resize(this: this, event: L.ResizeEvent): void;
31
+ _animateZoom(this: this, e: L.ZoomAnimEvent): void;
32
+ _onZoom(this: this): void;
33
+ _onZoomStart(this: this): void;
34
+ _onZoomEnd(this: this): void;
35
+ _moveEnd(this: this): void;
36
+ _reset(this: this): void;
37
+ _redraw(this: this): void;
38
+ _updateTransform(center: L.LatLng, zoom: number): void;
39
+
40
+ /** TODO empty by default */
41
+ onInit(this: this): void;
42
+
43
+ /** TODO true by default */
44
+ onCreateCanvas(this: this, canvas?: HTMLElement): boolean;
45
+
46
+ /** TODO empty by default */
47
+ onCanvasFailed(this: this): void;
48
+
49
+ /** TODO empty by default */
50
+ onRemoveCanvas(this: this, canvas?: HTMLElement): void;
51
+
52
+ /** TODO empty by default */
53
+ onMoveEnd(this: this): void;
54
+
55
+ /** TODO empty by default */
56
+ onZoomEnd(this: this): void;
57
+
58
+ /** TODO empty by default */
59
+ onReset(this: this): void;
60
+
61
+ // Just this typings rewrites of leaflet methods
62
+ onAdd(this: this, map: L.Map): this;
63
+ addTo(this: this, map: L.Map): this;
64
+ onRemove(this: this, map: L.Map): this;
65
+
66
+ onContextLost(): void;
67
+ onContextRestored(): void;
68
+ onContextCreationError(e: WebGLContextEvent): void;
69
+ canvasHooks(canvas: L.CanvasElement | null | undefined, on: boolean): void;
70
+ }
@@ -0,0 +1,82 @@
1
+ import { NumValue } from '@windy/types.d';
2
+
3
+ export type RGBA = [number, number, number, number];
4
+
5
+ export type YUVA = [number, number, number, number];
6
+
7
+ export type ColorGradient = [NumValue, RGBA][];
8
+
9
+ /**
10
+ * 'rgb(200,0,150)'
11
+ */
12
+ export type RGBString = string;
13
+
14
+ /**
15
+ * 'rgba(200,0,150,1)'
16
+ */
17
+ export type RGBAString = string;
18
+
19
+ export type ColorIdent =
20
+ | 'temp'
21
+ | 'wind'
22
+ | 'rh'
23
+ | 'pressure'
24
+ | 'cclAltitude'
25
+ | 'altitude'
26
+ | 'deg0'
27
+ | 'levels'
28
+ | 'rain'
29
+ | 'ptype'
30
+ | 'rainClouds'
31
+ | 'clouds'
32
+ | 'lclouds'
33
+ | 'hclouds'
34
+ | 'mclouds'
35
+ | 'cape'
36
+ | 'lightDensity'
37
+ | 'cbase'
38
+ | 'snow'
39
+ | 'rainAccu'
40
+ | 'waves'
41
+ | 'currents'
42
+ | 'currentsTide'
43
+ | 'visibility'
44
+ | 'gtco3'
45
+ | 'aod550'
46
+ | 'pm2p5'
47
+ | 'no2'
48
+ | 'tcso2'
49
+ | 'go3'
50
+ | 'cosc'
51
+ | 'dust'
52
+ | 'satellite'
53
+ | 'radar'
54
+ | 'fog'
55
+ | 'justGray'
56
+ | 'efiWind'
57
+ | 'efiTemp'
58
+ | 'efiRain'
59
+ | 'moistureAnom40'
60
+ | 'moistureAnom100'
61
+ | 'drought40'
62
+ | 'drought100'
63
+ | 'soilMoisture40'
64
+ | 'soilMoisture100'
65
+ | 'fwi'
66
+ | 'dfm10h'
67
+ | 'solarpower'
68
+ | 'uvindex'
69
+ | 'turbulence'
70
+ | 'icing'
71
+ | 'wetbulbtemp';
72
+
73
+ type PluginColorIdent =
74
+ | 'airQ'
75
+ | 'windDetail'
76
+ | 'wavesDetail'
77
+ | 'periodDetail'
78
+ | 'altitudeDetail'
79
+ | 'visibilityDetail'
80
+ | 'dewpointSpreadDetail'
81
+ | 'blitz'
82
+ | 'radiation';
@@ -0,0 +1,45 @@
1
+ import { MapCoordinates } from '@windy/dataSpecifications.d';
2
+
3
+ export interface TilePoint {
4
+ x: number;
5
+ y: number;
6
+ z: number;
7
+ }
8
+
9
+ export interface ExtendedTileParams extends MapCoordinates {
10
+ /**
11
+ * => bounds.min.x of map.getPixelBounds();
12
+ */
13
+ pixelOriginX: number;
14
+
15
+ /**
16
+ * => bounds.min.y of map.getPixelBounds();
17
+ */
18
+ pixelOriginY: number;
19
+
20
+ /**
21
+ * Data zoom
22
+ */
23
+ dZoom: number;
24
+
25
+ /**
26
+ * Size of map in piels
27
+ */
28
+ width: number;
29
+
30
+ /**
31
+ * Size of map in pxels
32
+ */
33
+ height: number;
34
+
35
+ /**
36
+ * Coords of original unwrapped map tiles
37
+ * basicaly map.getPixelBounds();
38
+ */
39
+ origTiles: {
40
+ minX: number;
41
+ minY: number;
42
+ maxX: number;
43
+ maxY: number;
44
+ };
45
+ }
@@ -0,0 +1,92 @@
1
+ import type { Texture2D } from 'plugins/_shared/gl-lib/gl-lib';
2
+ import type {
3
+ Mat2,
4
+ Mat2d,
5
+ Mat3,
6
+ Mat4,
7
+ Quat,
8
+ Quat2,
9
+ Vec2,
10
+ Vec3,
11
+ Vec4,
12
+ } from '@plugins/globe/gl-matrix/types';
13
+
14
+ export interface CustomError extends Error {
15
+ contextLost?: boolean;
16
+ isVertexShader?: boolean;
17
+ name: string;
18
+ full?: string;
19
+ }
20
+
21
+ // export type WebGLProgramObject = {
22
+ // [whatever: string]: any;
23
+ // };
24
+
25
+ export type UniformName = `u${string}`;
26
+
27
+ export type AttributeName = `a${string}`;
28
+
29
+ export type SamplerName = `s${string}`;
30
+
31
+ export type WebGLProgramAttributes = {
32
+ [attribute: AttributeName]: number;
33
+ };
34
+
35
+ export type WebGLProgramUniforms = {
36
+ [uniform: UniformName]: WebGLUniformLocation | null;
37
+ [sampler: SamplerName]: WebGLUniformLocation | null;
38
+ };
39
+
40
+ export type WebGLProgramParams = WebGLProgramAttributes & WebGLProgramUniforms;
41
+
42
+ export type AnyUniform = number | Vec2 | Vec3 | Vec4 | Mat2 | Mat2d | Mat3 | Mat4 | Quat | Quat2;
43
+
44
+ export type ShaderPars = {
45
+ uVPars0?: Vec4;
46
+ uVPars1?: Vec4;
47
+ uVPars2?: Vec4;
48
+
49
+ uMatRot?: Mat3;
50
+
51
+ uPars0?: Vec4;
52
+ uPars1?: Vec4;
53
+ } & {
54
+ [uniform: UniformName]: AnyUniform;
55
+ [uniform: SamplerName]: Texture2D | WebGLTexture | null;
56
+ };
57
+
58
+ export type WebGLProgramObject = {
59
+ program: WebGLProgram | null;
60
+ aPos?: number;
61
+ variantI?: number; // property added in VisualizerShader.compile()
62
+ } & WebGLProgramParams;
63
+
64
+ export interface ExtendedWebGLTexture extends WebGLTexture {
65
+ _width?: GLsizei;
66
+ _height?: GLsizei;
67
+ _format?: GLenum;
68
+ }
69
+
70
+ /**
71
+ * Canvas as HTML element with added properties
72
+ */
73
+ // export interface Canvas extends HTMLCanvasElement {
74
+ // cssWidth: number;
75
+ // cssHeight: number;
76
+ // cssHeightInner: number;
77
+ // pxRatio: number;
78
+ // heightInner: number;
79
+ // }
80
+
81
+ export type HTMLCanvasExtended = HTMLCanvasElement & {
82
+ cssWidth: number;
83
+ cssHeight: number;
84
+ cssHeightInner: number;
85
+ pxRatio: number;
86
+ heightInner: number;
87
+ };
88
+
89
+ /**
90
+ * HTML canvas element or HTML canvas element with added properties
91
+ */
92
+ export type Canvas = HTMLCanvasElement | HTMLCanvasExtended;
@@ -0,0 +1,51 @@
1
+ import { Timestamp } from '@windy/types.d';
2
+
3
+ type CityDivId = string; // `${x}:${y}`
4
+ type CityLabelId = string; // `${lat}/${lon}`
5
+
6
+ /** Loaded forecast data from `/citytile/*` URL endpoint */
7
+ export type CityForecastData = {
8
+ /**
9
+ * Forecasted temperatures for cities on the tile
10
+ */
11
+ forecast: {
12
+ /**
13
+ * Keys (coordinates) are in "lat/lon" format, value the forecasted temperature
14
+ */
15
+ [coordinates: string]: number[];
16
+ };
17
+ /** Reftime */
18
+ reftime: Timestamp;
19
+ /** Time from reftime in hours for every temperature value in the returned array */
20
+ hours: number[];
21
+ };
22
+
23
+ /**
24
+ * Loaded labels data from tiles.windy.com endpoint
25
+ * Format of inner arrays is [id, title to show, category of label used for CSS class, lon, lat, width in px, height in px]
26
+ */
27
+ export type CityLabelData = [string, string, string, number, number, number, number][];
28
+
29
+ /** Represantation of single one HTML label with its temperature data */
30
+ export interface CityLabel {
31
+ /** Id of the label, it is same as a key for CityForecastData, so it is used for pairing label with temperature data */
32
+ id: CityLabelId;
33
+
34
+ /** HTML element of the label for binding labels and temperature values */
35
+ el: HTMLDivElement;
36
+
37
+ /** Forecast data with temperature in K, it is lazy loaded with forecast request */
38
+ data?: number[];
39
+ }
40
+
41
+ /** Representation of one leaflet tile with its CityLabels */
42
+ export interface CityDiv {
43
+ /** Labels included in the leaflet tile */
44
+ labels: CityLabel[];
45
+
46
+ /** Mercator URL frag in format <z>/<x>/<y>. It is lazy binded when tile is created */
47
+ urlFrag?: string;
48
+
49
+ /* Array of timestamps for which the temperatures are forecasted. Lazy loaded with forecast request */
50
+ timestamps?: Timestamp[];
51
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Leaflet layer with alpha-inverse sea mask
3
+ */
4
+ export class LandMask extends L.TileLayer {
5
+ seaColorL: number;
6
+ ctx: CanvasRenderingContext2D | null;
7
+ _tileOnError(
8
+ done: L.DoneCallback,
9
+ tile: HTMLImageElement | HTMLCanvasElement,
10
+ e: string | Event,
11
+ ): void;
12
+ getTempCtx(): CanvasRenderingContext2D | null;
13
+ getTileUrl(coords: L.Coords): string;
14
+ createTile(coords: L.Coords, done: L.DoneCallback): HTMLCanvasElement | HTMLImageElement;
15
+ createImageTile(coords: L.Coords, done: L.DoneCallback): HTMLImageElement;
16
+ createCanvasTile(coords: L.Coords, done: L.DoneCallback): HTMLCanvasElement;
17
+ }