@windycom/plugin-devtools 2.0.0 → 3.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 (143) hide show
  1. package/README.md +4 -0
  2. package/index.mjs +2 -2
  3. package/package.json +2 -3
  4. package/types/client/AccessProducts.d.ts +8 -0
  5. package/types/client/BottomSlide.d.ts +3 -0
  6. package/types/client/BottomSveltePlugins.d.ts +8 -0
  7. package/types/client/Calendar.d.ts +9 -17
  8. package/types/client/Color.d.ts +44 -91
  9. package/types/client/EcmwfProduct.d.ts +0 -22
  10. package/types/client/Evented.d.ts +4 -0
  11. package/types/client/ExternalSveltePlugin.d.ts +8 -2
  12. package/types/client/IDB.d.ts +69 -0
  13. package/types/client/IconProducts.d.ts +2 -0
  14. package/types/client/Layer.d.ts +1 -2
  15. package/types/client/Metric.d.ts +13 -9
  16. package/types/client/MetricClasses.d.ts +4 -3
  17. package/types/client/Overlay.d.ts +31 -16
  18. package/types/client/OverlayClasses.d.ts +11 -7
  19. package/types/client/Plugin.d.ts +6 -2
  20. package/types/client/Product.d.ts +33 -30
  21. package/types/client/RadarPlusProduct.d.ts +19 -0
  22. package/types/client/Renderer.d.ts +2 -10
  23. package/types/client/SatelliteProduct.d.ts +1 -1
  24. package/types/client/SveltePlugin.d.ts +16 -5
  25. package/types/client/TileLayer.d.ts +1 -2
  26. package/types/client/TopoMap.d.ts +10 -0
  27. package/types/client/WindowPlugin.d.ts +9 -4
  28. package/types/client/appsFlyer.d.ts +2 -0
  29. package/types/client/baseMap.d.ts +8 -5
  30. package/types/client/cityLabels.d.ts +10 -2
  31. package/types/client/cloudSync.d.ts +3 -1
  32. package/types/client/colorGradients.d.ts +13 -0
  33. package/types/client/compatibilityCheck.d.ts +1 -0
  34. package/types/client/connection.d.ts +1 -1
  35. package/types/client/customColors.d.ts +1 -0
  36. package/types/client/d.ts.files/Calendar.d.ts +11 -2
  37. package/types/client/d.ts.files/Color.d.ts +17 -5
  38. package/types/client/d.ts.files/LabelsLayer.d.ts +3 -20
  39. package/types/client/d.ts.files/Layer.d.ts +8 -1
  40. package/types/client/d.ts.files/Metric.d.ts +1 -0
  41. package/types/client/d.ts.files/Renderer.d.ts +22 -1
  42. package/types/client/d.ts.files/alerts.d.ts +119 -0
  43. package/types/client/d.ts.files/broadcast.d.ts +51 -18
  44. package/types/client/d.ts.files/dataSpecifications.d.ts +121 -137
  45. package/types/client/d.ts.files/favs.d.ts +68 -0
  46. package/types/client/d.ts.files/incomingMessages.d.ts +0 -4
  47. package/types/client/d.ts.files/lib.d.ts +5 -7
  48. package/types/client/d.ts.files/notifications.d.ts +2 -2
  49. package/types/client/d.ts.files/plugin-params.d.ts +53 -57
  50. package/types/client/d.ts.files/plugins.d.ts +31 -42
  51. package/types/client/d.ts.files/pois.d.ts +1 -1
  52. package/types/client/d.ts.files/products.d.ts +16 -5
  53. package/types/client/d.ts.files/rootScope.d.ts +13 -31
  54. package/types/client/d.ts.files/startup.d.ts +65 -0
  55. package/types/client/d.ts.files/storage.d.ts +12 -35
  56. package/types/client/d.ts.files/user.d.ts +82 -24
  57. package/types/client/detectDevice.d.ts +0 -3
  58. package/types/client/device.d.ts +1 -0
  59. package/types/client/deviceLogging.d.ts +2 -1
  60. package/types/client/embed.d.ts +70 -0
  61. package/types/client/embed2.d.ts +14 -31
  62. package/types/client/errorLogger.d.ts +28 -3
  63. package/types/client/errors.d.ts +6 -0
  64. package/types/client/fetch.d.ts +41 -16
  65. package/types/client/format.d.ts +1 -1
  66. package/types/client/ga.d.ts +1 -1
  67. package/types/client/geolocation.d.ts +15 -7
  68. package/types/client/globals.d.ts +1 -0
  69. package/types/client/http.d.ts +17 -6
  70. package/types/client/idbInstances.d.ts +36 -0
  71. package/types/client/imaker.d.ts +112 -0
  72. package/types/client/imakerMain.d.ts +49 -0
  73. package/types/client/langFiles.d.ts +2 -0
  74. package/types/client/latestBroadcasts.d.ts +1 -1
  75. package/types/client/layers.d.ts +2 -0
  76. package/types/client/lib.d.ts +6 -22
  77. package/types/client/libHtml.d.ts +1 -1
  78. package/types/client/liveAlerts.d.ts +5 -0
  79. package/types/client/liveAlerts.types.d.ts +28 -0
  80. package/types/client/loadArticlesOrWhatsNew.d.ts +1 -0
  81. package/types/client/location.d.ts +5 -0
  82. package/types/client/log.d.ts +4 -1
  83. package/types/client/lruCache.d.ts +6 -0
  84. package/types/client/map.d.ts +17 -6
  85. package/types/client/mobile.d.ts +31 -22
  86. package/types/client/models.d.ts +7 -5
  87. package/types/client/notifications.d.ts +29 -67
  88. package/types/client/overlays.d.ts +4 -1
  89. package/types/client/params.d.ts +0 -1
  90. package/types/client/permanentPromos.d.ts +1 -1
  91. package/types/client/persistentStorage.d.ts +8 -0
  92. package/types/client/picker.d.ts +1 -1
  93. package/types/client/plugins.d.ts +4 -0
  94. package/types/client/pois.d.ts +1 -2
  95. package/types/client/promo.d.ts +6 -16
  96. package/types/client/pushNotifications.d.ts +1 -1
  97. package/types/client/queryString.d.ts +1 -1
  98. package/types/client/renderUtils.d.ts +1 -1
  99. package/types/client/renderers.d.ts +7 -3
  100. package/types/client/rootScope.d.ts +23 -24
  101. package/types/client/router.d.ts +9 -29
  102. package/types/client/seoParser.d.ts +0 -14
  103. package/types/client/serviceWorkerCtrl.d.ts +8 -0
  104. package/types/client/showableErrorsService.d.ts +6 -10
  105. package/types/client/startupWeather.d.ts +13 -9
  106. package/types/client/store.d.ts +2 -2
  107. package/types/client/storeLastPosition.d.ts +4 -0
  108. package/types/client/subscription.d.ts +1 -0
  109. package/types/client/swDownloader.d.ts +7 -7
  110. package/types/client/swProxy.d.ts +1 -1
  111. package/types/client/swUtils.d.ts +3 -3
  112. package/types/client/trans.d.ts +26 -37
  113. package/types/client/user.d.ts +7 -13
  114. package/types/client/userAlerts.d.ts +68 -0
  115. package/types/client/userConsent.d.ts +6 -0
  116. package/types/client/userFavs.d.ts +46 -122
  117. package/types/client/utils.d.ts +67 -9
  118. package/types/iconfont.d.ts +8 -0
  119. package/types/interfaces.d.ts +226 -284
  120. package/types/lang-files.d.ts +1334 -142
  121. package/types/offline.d.ts +100 -0
  122. package/types/types.d.ts +108 -34
  123. package/types/client/Bar.d.ts +0 -114
  124. package/types/client/BindedBar.d.ts +0 -51
  125. package/types/client/BindedCheckbox.d.ts +0 -30
  126. package/types/client/BindedSwitch.d.ts +0 -35
  127. package/types/client/BottomTagPlugin.d.ts +0 -8
  128. package/types/client/DraggableDiv.d.ts +0 -21
  129. package/types/client/GhostBox.d.ts +0 -17
  130. package/types/client/Legend.d.ts +0 -6
  131. package/types/client/LongTap.d.ts +0 -21
  132. package/types/client/MobileCalendar.d.ts +0 -51
  133. package/types/client/OfflineMessagesClasses.d.ts +0 -30
  134. package/types/client/ProductSwitch.d.ts +0 -14
  135. package/types/client/Scrollable.d.ts +0 -14
  136. package/types/client/Switch.d.ts +0 -24
  137. package/types/client/TimestampBar.d.ts +0 -8
  138. package/types/client/d.ts.files/Product.d.ts +0 -37
  139. package/types/client/d.ts.files/errorLogger.d.ts +0 -35
  140. package/types/client/d.ts.files/trans.d.ts +0 -55
  141. package/types/client/favs.d.ts +0 -83
  142. package/types/client/offlineController.d.ts +0 -20
  143. /package/types/client/d.ts.files/{Webcams.d.ts → webcams.d.ts} +0 -0
package/README.md CHANGED
@@ -4,6 +4,10 @@ Check out https://docs.windy-plugins.com for more information.
4
4
 
5
5
  # CHANGELOG
6
6
 
7
+ - 3.0.1 - TS declarations for client v46.1.0
8
+ - 3.0.0 - TS declarations for client v45.0.0
9
+ - 2.0.2 - Support Windows in file path regex
10
+ - 2.0.1 - Remove less-autoprefixer
7
11
  - 2.0.0 - TS declarations for client v42.2.0
8
12
  - 1.0.9 - Updated client TS declarations
9
13
  - 1.0.6 - Fix plugin version validation
package/index.mjs CHANGED
@@ -222,13 +222,13 @@ export function transformCodeToESMPlugin() {
222
222
  : options.output ?? {};
223
223
 
224
224
  shouldGenerateSourcemaps = Boolean(outputOptions.sourcemap);
225
- outputDirectory = outputOptions.file.replace(/\/[^/]+$/, '');
225
+ outputDirectory = outputOptions.file.replace(/[\\/][^\\/]*$/, '');
226
226
 
227
227
  return undefined;
228
228
  },
229
229
  renderChunk(code, chunk) {
230
230
  const { facadeModuleId } = chunk;
231
- const pathOfTheFile = facadeModuleId.replace(/\/[^/]*$/, '');
231
+ const pathOfTheFile = facadeModuleId.replace(/[\\/][^\\/]*$/, '');
232
232
 
233
233
  if (!fs.existsSync(outputDirectory)) {
234
234
  fs.mkdirSync(outputDirectory, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windycom/plugin-devtools",
3
- "version": "2.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Developer tools and TS declarations for developers of Windy Plugins.",
5
5
  "main": "index.mjs",
6
6
  "module": "index.mjs",
@@ -15,7 +15,6 @@
15
15
  "eslint-import-resolver-typescript": "^3.6.1",
16
16
  "eslint-plugin-svelte": "^2.35.1",
17
17
  "less": "^4.2.0",
18
- "less-plugin-autoprefixer": "^2.1.0",
19
18
  "rollup": "^4.9.6",
20
19
  "rollup-plugin-cleanup": "^3.2.1",
21
20
  "rollup-plugin-serve": "^1.1.1",
@@ -38,4 +37,4 @@
38
37
  "prettier": "^3.2.4",
39
38
  "prettier-plugin-svelte": "^3.1.2"
40
39
  }
41
- }
40
+ }
@@ -0,0 +1,8 @@
1
+ import { Product } from '@windy/Product';
2
+ import type { ProductInitParams } from '@windy/Product';
3
+ export declare class AccessProduct extends Product {
4
+ constructor(params: Partial<ProductInitParams>);
5
+ }
6
+ export declare class AccessCProduct extends AccessProduct {
7
+ constructor(params: Partial<ProductInitParams>);
8
+ }
@@ -48,6 +48,9 @@ export declare class BottomSlide extends Drag {
48
48
  ondrag(_x: number, y: number, e: Event): void;
49
49
  ondragend(): void;
50
50
  startDrag(e: TouchEvent): void;
51
+ release(): void;
51
52
  private initCloseOnSwipeDown;
53
+ private setHalfOpen;
52
54
  private updatePosition;
55
+ private onRqstPluginHalfOpen;
53
56
  }
@@ -0,0 +1,8 @@
1
+ import { SveltePlugin } from '@windy/SveltePlugin';
2
+ import type { SveltePluginInitParams } from '@windy/SveltePlugin';
3
+ import type { BottomSveltePlugins } from '@windy/plugins.d';
4
+ export type BottomSveltePluginInitParams<P extends keyof BottomSveltePlugins> = Omit<SveltePluginInitParams<P>, 'ident'> & Pick<BottomSveltePlugin<P>, 'ident'>;
5
+ export declare class BottomSveltePlugin<P extends keyof BottomSveltePlugins> extends SveltePlugin<P> {
6
+ ident: P;
7
+ constructor(params: BottomSveltePluginInitParams<P>);
8
+ }
@@ -4,12 +4,16 @@
4
4
  import type { CalendarDay, MinifestObject, Weekday } from './d.ts.files/Calendar.d';
5
5
  import type { TimeFormatFunction } from './d.ts.files/format.d';
6
6
  import type { Products } from './d.ts.files/rootScope.d';
7
- import type { ISODateString, Path, Timestamp } from './d.ts.files/types.d';
7
+ import type { ISODateString, Path, Timestamp, YYYYMMDDHH } 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
11
11
  */
12
12
  product: Products;
13
+ /**
14
+ * This product is a free product
15
+ */
16
+ freeProduct?: boolean;
13
17
  /**
14
18
  * Optional latest timestamp (for use for offline mode for example)
15
19
  */
@@ -25,10 +29,6 @@ export declare class Calendar {
25
29
  * Number of hours covered by this calendar
26
30
  */
27
31
  numOfHours: number;
28
- /**
29
- * Type of the calendare
30
- */
31
- type: 'historical' | 'mixed' | 'forecast';
32
32
  calendarHours: number;
33
33
  /**
34
34
  * Today midnigh in LT of user's computer
@@ -47,21 +47,13 @@ export declare class Calendar {
47
47
  */
48
48
  premiumStart: Timestamp | null;
49
49
  /**
50
- * End of calendar timeline
51
- */
52
- endOfcalendar: Date;
53
- /**
54
- * endOfcalendar as timestamp
50
+ * endOfCalendar as timestamp
55
51
  */
56
52
  endOfCal: Timestamp;
57
53
  /**
58
54
  * endOfCal or latest timestamp, whiever is smaller
59
55
  */
60
56
  end: Timestamp;
61
- /**
62
- * Max timestamp value, usually same as end (should be updated later on basis of minifest)
63
- */
64
- maxTimestamp: Timestamp;
65
57
  /**
66
58
  * Array of calendayr days to be used in UI
67
59
  */
@@ -85,7 +77,7 @@ export declare class Calendar {
85
77
  /**
86
78
  * Minifests's reference time is some non stndard format
87
79
  */
88
- refTime: string;
80
+ refTime: YYYYMMDDHH;
89
81
  /**
90
82
  * Minifests's reference time
91
83
  */
@@ -125,7 +117,7 @@ export declare class Calendar {
125
117
  * Return YYYY/MM/DD/HH or YYYYMMDDHH on a basis of provided date
126
118
  * we do not CHECK existence of path in minifest
127
119
  */
128
- static date2path(date: Date): Path;
120
+ static date2path(date: Date): YYYYMMDDHH;
129
121
  /**
130
122
  * Returns JavaScript date object corresponding
131
123
  * to provided path in a form YYYY/MM/DD/HH or YYYYMMDDHH
@@ -145,5 +137,5 @@ export declare class Calendar {
145
137
  /**
146
138
  * Return nearest midnight
147
139
  */
148
- static getMidnight(): Date;
140
+ static getMidnight(ts?: number): Date;
149
141
  }
@@ -1,106 +1,65 @@
1
- import type { ColorGradient, ColorIdent, PluginColorIdent, RGBA, RGBString } from './d.ts.files/Color.d';
2
- import type { StoreOptions } from './d.ts.files/store.d';
1
+ import type { ColorGradient, AnyColorIdent, RGBA, RGBString } from './d.ts.files/Color.d';
3
2
  import type { NumValue } from './d.ts.files/types.d';
4
- export type ColorInitParams = Pick<Color, 'ident'> & Partial<Pick<Color, 'qualitative' | 'save'>> & {
3
+ export type ColorInitParams = Pick<Color, 'ident'> & Partial<Pick<Color, 'qualitative'>> & {
5
4
  steps: number;
6
- default?: ColorGradient | null;
5
+ default: ColorGradient;
7
6
  opaque?: boolean;
8
- defaultKey?: string;
9
- sync?: boolean;
10
7
  prepare?: boolean;
11
8
  };
12
9
  export declare class Color {
13
10
  /**
14
11
  * Should be color table prepared in advance without calling getColor()
15
- * DO NOT MISUSE THIS PROPERTY. Use only for few colors that are used
16
- * for initial rendering and overall app
12
+ *
13
+ * DO NOT MISUSE THIS PROPERTY, generating color gradients is expensive
14
+ * CPU operation and should be done only when needed
15
+ *
16
+ * Use only for few colors that are used
17
+ * for initial rendering and overall app, like temp, wind
17
18
  */
18
19
  private prepare?;
19
- /**
20
- * Sync color to the cloud. By default is set true
21
- */
22
- private sync?;
23
- /**
24
- * set all alpha values to 255. By default is set true
25
- */
20
+ /** Set all alpha values to 255. By default is set true */
26
21
  private opaque?;
22
+ /** Items precomputed for fast color access */
27
23
  private maxIndex;
24
+ /** Items precomputed for fast color access */
28
25
  private step;
29
- /**
30
- * Index of neutral gray color
31
- */
26
+ /** Index of neutral gray color */
32
27
  private neutralGrayIndex;
33
- /**
34
- * Initial gradient
35
- */
36
- private default?;
37
- /**
38
- * Ident of color
39
- */
40
- ident: ColorIdent | PluginColorIdent | 'pressureIsolines' | 'temporary' | 'direction';
41
- /**
42
- * Store key
43
- */
44
- key: `color2_${string}`;
45
- /**
46
- * For color loaded from info,json
47
- */
48
- defaultKey?: string;
49
- /**
50
- * globe: use discrete palette (not blending between colors)
51
- */
52
- qualitative?: boolean;
53
- /**
54
- * Numebr of steps for colors table
55
- */
56
- steps: number;
57
- /**
58
- * Actually used gradient (can be sifferent than default)
59
- */
60
- gradient: ColorGradient;
61
- /**
62
- * Big interpolated RGBA Type array color table
63
- * If defined mean someone already used the color
64
- */
65
- colors?: Uint8Array | null;
66
- /**
67
- * Save color to lcal storage. By default is set true
68
- */
69
- save?: boolean;
70
- /**
71
- * Min value
72
- */
28
+ /** Initial gradient */
29
+ private defaultColorGradient;
30
+ /** Custom modified gradient */
31
+ private customColorGradient?;
32
+ /** Big interpolated RGBA Type array color table, generated when color is required */
33
+ private colors?;
34
+ /** Min value of associated numerical value */
73
35
  min: NumValue;
74
- /**
75
- * Max value
76
- */
36
+ /** Max value of associated numerical value */
77
37
  max: NumValue;
38
+ /** Ident of color */
39
+ ident: AnyColorIdent;
40
+ /** globe: use discrete palette (not blending between colors) */
41
+ qualitative?: boolean;
42
+ /** Number of steps for colors table */
43
+ steps: number;
78
44
  constructor(params: ColorInitParams);
45
+ getColorTable(): Uint8Array;
46
+ loadCustomColor(): Promise<void>;
47
+ hasCustomColor(): boolean;
79
48
  /**
80
- * Inserts the color to the store & prepares it
81
- *
82
- * @param defaultColors Default color
83
- */
84
- defineColor(defaultColors: ColorGradient): void;
85
- /**
86
- * Saves new color gradient to data store
49
+ * Updates custom color gradient
87
50
  */
88
- changeColor(gradient: ColorGradient, storeOpts?: StoreOptions): void;
51
+ setCustomColor(gradient: ColorGradient, saveToIdb?: boolean): Promise<void>;
89
52
  /**
90
- * Back to default settings
53
+ * Removes custom color gradient
91
54
  */
92
- toDefault(): void;
93
- /**
94
- * Same as getColor, but forces to generate new col tables
95
- */
96
- forceGetColor(): this;
55
+ removeCustomColor(): Promise<void>;
97
56
  /**
98
57
  * Returns a color based 'rgb()' string on provided value
99
58
  */
100
59
  color(value: NumValue): RGBString;
101
60
  /**
102
- * Returns darkened or lightened cersion of original color. Uses the
103
- * most primitive method of darkening/lightening by substracting or
61
+ * Returns darkened or lightened coercion of original color. Uses the
62
+ * most primitive method of darkening/lightening by subtracting or
104
63
  * adding vale to RGB components
105
64
  *
106
65
  * @param value Original numerical value
@@ -116,31 +75,22 @@ export declare class Color {
116
75
  * bOpaque .. set alpha to 255
117
76
  * bPremultiply .. mul RGB by A
118
77
  * valueScale .. optional scale used for WebGL texture data (coef 0.5 means half step - gradient size is doubled)
119
- * return .. output Uint8Array with color data
78
+ * return .. output Uint8Array with color data (NOTE: Uint8ClampedArray NOT SUPPORTED in WebGL!)
120
79
  */
121
80
  createGradientArray(bOpaque?: boolean, bPremultiply?: boolean, valueScale?: number): Uint8Array;
122
- createSteppedArray(sourceSmoothArray: Uint8Array, step: number, firstStep?: number): Uint8Array;
123
81
  /**
124
- * Returns color instance and creates color table (if not yet created)
82
+ * Generates gradient array for fast access to color table
125
83
  */
126
84
  getColor(): this;
127
85
  /**
128
86
  * Returns index to the color table based on value
129
87
  */
130
88
  value2index(value: NumValue): number;
131
- getColorTable(): ColorGradient | null | undefined;
89
+ getColorGradient(): ColorGradient;
132
90
  /**
133
91
  * Checks validity of a gradient that it adheres to type ColorGradient
134
92
  */
135
- private checkValidity;
136
- /**
137
- * Forces to generate new color table
138
- */
139
- private colorChanged;
140
- /**
141
- * Sets max, min values
142
- */
143
- private setMinMax;
93
+ static checkValidity(obj: unknown): boolean;
144
94
  /**
145
95
  * return array multiplied by mul coef
146
96
  */
@@ -161,7 +111,6 @@ export declare class Color {
161
111
  * preserveSaturation .. (maintain |UV| size)
162
112
  */
163
113
  private gradYuva;
164
- private vec2size;
165
114
  /**
166
115
  * interpolation between 2 colors in selected space (type)
167
116
  * type .. color space / interpolation type: 'RGB' - linear in RGB space (default)
@@ -172,4 +121,8 @@ export declare class Color {
172
121
  * rgbaArray .. [r, g, b, a]; componnents in interval <0;255>
173
122
  */
174
123
  private makePremultiplied;
124
+ /**
125
+ * If color table was already generated, we need to regenerate it
126
+ */
127
+ private regenerateColorTable;
175
128
  }
@@ -1,29 +1,7 @@
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
- };
19
4
  export declare class EcmwfProduct extends Product {
20
5
  calendar: Calendar;
21
6
  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;
29
7
  }
@@ -71,6 +71,10 @@ export declare class Evented<T> {
71
71
  once<K extends keyof T, Q extends T[K]>(topic: K, callback: (...data: TrimUndefinedFromRight<Arrayify<Q>>) => void, context?: ThisType<unknown>): number;
72
72
  off(id: number): void;
73
73
  off<K extends keyof T, Q extends T[K]>(topic: K, callback: (...data: TrimUndefinedFromRight<Arrayify<Q>>) => void, context?: ThisType<unknown>): void;
74
+ /**
75
+ * Unhooks all registered callbacks
76
+ */
77
+ offAll(): void;
74
78
  /**
75
79
  * @ignore
76
80
  */
@@ -1,7 +1,7 @@
1
1
  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
- import type { CompiledExternalPluginConfig, ExternalPluginConfig, InstalledExternalPluginConfig } from '@windy/interfaces';
4
+ import type { CompiledExternalPluginConfig, ExternalPluginConfig, InstalledExternalPluginConfig, PluginOpeningOptions } from '@windy/interfaces';
5
5
  import type { PluginPane } from './Plugin';
6
6
  /** Allowed params to SveltePlugin constructor (private and protected props are omitted by default) */
7
7
  export type ExternalSveltePluginInitParams<P extends keyof SveltePlugins | keyof SveltePanePlugins> = Omit<WindowPluginInitParams<P>, 'ident'> & Pick<SveltePlugin<P>, 'ident'> & Partial<SveltePlugin<P>>;
@@ -22,9 +22,15 @@ export declare class ExternalSveltePlugin extends SveltePlugin<'windy-external-p
22
22
  mobileConfig: Record<InstalledExternalPluginConfig['mobileUI'], Config2config>;
23
23
  desktopConfig: Record<InstalledExternalPluginConfig['desktopUI'], Config2config>;
24
24
  widthOfRhPane: number;
25
+ version: string;
25
26
  listenToSingleclick: ExternalPluginConfig['listenToSingleclick'];
26
27
  addToContextmenu: ExternalPluginConfig['addToContextmenu'];
27
- constructor(params: WindowPluginInitParams<'windy-external-plugin'>, { desktopUI, title, mobileUI, desktopWidth, routerPath, listenToSingleclick, addToContextmenu, url, }: InstalledExternalPluginConfig);
28
+ constructor(params: WindowPluginInitParams<'windy-external-plugin'>, { desktopUI, title, mobileUI, desktopWidth, routerPath, listenToSingleclick, addToContextmenu, url, version, }: InstalledExternalPluginConfig);
29
+ open({ params, disableOpeningAnimation, qs, }: PluginOpeningOptions<'windy-external-plugin'>): Promise<void | boolean>;
30
+ hasNewerVersion(latestVersion: string): boolean;
31
+ showConfirmationWindow(): Promise<boolean>;
32
+ getDayDiff(timestamp: string): number;
33
+ uninstallPlugin(): Promise<void>;
28
34
  getCss(): string;
29
35
  }
30
36
  export {};
@@ -0,0 +1,69 @@
1
+ import type { Timestamp } from '@windy/types.d';
2
+ /**
3
+ * List of all collections we will need in our database
4
+ * remember to update this list when adding new collections
5
+ * Collections MUST be created at once
6
+ */
7
+ export declare const allUsedCollections: readonly ["customColors", "installedPlugins", "likedStoryComments", "log", "markedNotams", "popularLocations", "searchRecents", "seenArticles", "seenPromos", "seenStories", "slidedCapAlerts", "userAlerts", "userFavs"];
8
+ /**
9
+ * Allowed data types for storage
10
+ */
11
+ export type DatabaseStore = (typeof allUsedCollections)[number];
12
+ export type BackendItem<V> = {
13
+ updated: Timestamp;
14
+ id: string;
15
+ value: V;
16
+ };
17
+ export type BackendPayload<V> = BackendItem<V>[];
18
+ export type SupportedApiEndpoints = 'notams' | 'colors' | 'alerts' | 'favs';
19
+ export type StoredObjectWithId = {
20
+ id: string;
21
+ };
22
+ export interface IDBParams {
23
+ storeId: DatabaseStore;
24
+ initPromise: Promise<IDBDatabase>;
25
+ backendApiEndpoint?: SupportedApiEndpoints;
26
+ }
27
+ /**
28
+ * Wrapper around IndexedDB to provide async storage
29
+ *
30
+ * Synchronization with backend database is also supported
31
+ */
32
+ export declare class IDB<K extends string | number, V, W = V> {
33
+ private storeId;
34
+ private memoryCache;
35
+ private cacheIsValid;
36
+ private initPromise;
37
+ /**
38
+ * Is this db synced with backend?
39
+ *
40
+ * Storing to user backend is possible only for registered and properly logged in users
41
+ * The check if user is logged in, must be dome outside of this class, preferably in GUI
42
+ */
43
+ private usesBackendSync;
44
+ /**
45
+ * URL of the API endpoint, where data should be stored
46
+ */
47
+ private apiEndpoint;
48
+ /**
49
+ * Timestamp of last db update on this device (used only when collection has userBackend)
50
+ */
51
+ private readonly lastTimeUpdatedKey;
52
+ constructor(params: IDBParams);
53
+ /** Returns all items form IDB as an array */
54
+ getAll(): Promise<V[]>;
55
+ removeAll(): Promise<void>;
56
+ hasKey(key: K): Promise<boolean>;
57
+ get(key: K | '__lastTimeUpdated'): Promise<V | null>;
58
+ remove(key: K, removeJustLocally?: boolean): Promise<void>;
59
+ /**
60
+ * Creates data on the backend and uses the received `id` to save it locally.
61
+ * Only use this method for items not created by {@link put} to avoid key mismatch!
62
+ */
63
+ add(data: W): Promise<string>;
64
+ put(key: K | '__lastTimeUpdated', data: V, insertJustLocally?: boolean): Promise<void>;
65
+ /**
66
+ * Loads data from the cloud and returns true if there was a change
67
+ */
68
+ loadFromCloud(): Promise<boolean>;
69
+ }
@@ -1,5 +1,7 @@
1
1
  import { Product } from '@windy/Product';
2
+ import type { Overlays } from '@windy/rootScope.d';
2
3
  import type { ProductInitParams } from './Product';
4
+ export declare const iconOverlays: Overlays[];
3
5
  export declare class IconProducts extends Product {
4
6
  constructor(params: Pick<ProductInitParams, 'modelName'> & Partial<ProductInitParams>);
5
7
  }
@@ -3,8 +3,7 @@ import type { FullRenderParameters, Layers, RenderParams, TransformFunction } fr
3
3
  import type { Metric } from './d.ts.files/Metric';
4
4
  import type { Legend } from './d.ts.files/Metric.d';
5
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';
6
+ import type { DataQuality, FileSuffix, Product } from './d.ts.files/Product';
8
7
  import type { Renderers } from './d.ts.files/Renderer.d';
9
8
  import type { WeatherParameters } from './d.ts.files/interfaces.d';
10
9
  import type { Levels, Products } from './d.ts.files/rootScope.d';
@@ -1,8 +1,7 @@
1
1
  import type { Color } from './d.ts.files/Color';
2
2
  import type { RGBString } from './d.ts.files/Color.d';
3
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';
4
+ import type { HTMLString, NumValue, LoadedTranslations } from './d.ts.files/types.d';
6
5
  export declare const rtrnSelf: (x: NumValue) => NumValue;
7
6
  /**
8
7
  * # @windy/Metric
@@ -30,6 +29,10 @@ export declare abstract class Metric<T extends string | number = string | number
30
29
  * Conversion functions
31
30
  */
32
31
  conv: ConvObj;
32
+ /**
33
+ * Backward conversion functions
34
+ */
35
+ backConv?: ConvObj;
33
36
  /**
34
37
  * number ' ' metric separator
35
38
  */
@@ -83,13 +86,17 @@ export declare abstract class Metric<T extends string | number = string | number
83
86
  * @param params
84
87
  */
85
88
  constructor(params: MetricInitParams);
89
+ /**
90
+ * Returns metric value
91
+ */
92
+ getMetric(): MetricItem;
86
93
  onMetricChanged(metric: MetricItem): void;
87
94
  getDefault(): MetricItem;
88
95
  setDefault(): void;
89
96
  /**
90
97
  * get value + label on a basis of user selected metric
91
98
  */
92
- convertValue(value: NumValue, separator?: string, suffix?: string): string;
99
+ convertValue(value: NumValue, separator?: string, suffix?: string, forcedPrecision?: number): string;
93
100
  /**
94
101
  * Not available
95
102
  */
@@ -114,15 +121,12 @@ export declare abstract class Metric<T extends string | number = string | number
114
121
  * Cycles throu different metrics (for example after clicking on a legend)
115
122
  */
116
123
  cycleMetric(uiIdent?: string): void;
117
- /** color object is required for classic gradient metrics, discrete ones do not need it as colors are hardcoded for them */
118
- renderLegend(col: Color | undefined, el: HTMLDivElement, legend: Legend): void;
119
- /**
120
- * Renders colorfull legent onto the el
121
- */
122
- renderGradientLegend(col: Color | undefined, el: HTMLDivElement, legend: Legend): {
124
+ static getGradientLegend: (col: Color | undefined, legend: Legend, metric: MetricItem) => {
123
125
  background: string;
124
126
  content: HTMLString;
125
127
  } | null;
128
+ /** color object is required for classic gradient metrics, discrete ones do not need it as colors are hardcoded for them */
129
+ renderLegend(col: Color | undefined, el: HTMLDivElement, legend: Legend): void;
126
130
  renderDiscreteLegend(): {
127
131
  background: '';
128
132
  content: HTMLString;
@@ -1,11 +1,12 @@
1
1
  import { Metric } from '@windy/Metric';
2
2
  import type { MetricItem, MetricInitParams } from '@windy/Metric.d';
3
- import type { NumValue } from '@windy/types.d';
3
+ import type { NumValue } from '@windy/types';
4
4
  export declare class NumberedMetric extends Metric<number> {
5
5
  /**
6
6
  * produces converted number value without label
7
+ * - in case the @param back is set to true, inverse conversion is performed
7
8
  */
8
- convertNumber(value: NumValue, forcedPrecision?: number, metric?: MetricItem): number;
9
+ convertNumber(value: NumValue, forcedPrecision?: number, metric?: MetricItem, back?: boolean): number;
9
10
  }
10
11
  export declare class CapAlertMetric extends Metric<number> {
11
12
  /**
@@ -30,7 +31,7 @@ export declare class SatelliteMetric extends NumberedMetric {
30
31
  * Dynamic update from minifest/info.json
31
32
  * @param pars various pars depending on concrete instance
32
33
  */
33
- updateLines(pars: [number, number]): void;
34
+ updateLines(pars: [number, number], radarEnabled?: boolean): void;
34
35
  }
35
36
  export declare class PrecipMetric extends NumberedMetric {
36
37
  initProperties(): void;