@windycom/plugin-devtools 2.0.0 → 3.0.0

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 (120) hide show
  1. package/README.md +3 -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/BottomSveltePlugins.d.ts +8 -0
  6. package/types/client/Calendar.d.ts +9 -17
  7. package/types/client/Color.d.ts +43 -90
  8. package/types/client/Evented.d.ts +4 -0
  9. package/types/client/ExternalSveltePlugin.d.ts +2 -1
  10. package/types/client/IDB.d.ts +63 -0
  11. package/types/client/IconProducts.d.ts +2 -0
  12. package/types/client/Layer.d.ts +1 -2
  13. package/types/client/Metric.d.ts +8 -8
  14. package/types/client/MetricClasses.d.ts +4 -3
  15. package/types/client/Overlay.d.ts +30 -15
  16. package/types/client/OverlayClasses.d.ts +11 -7
  17. package/types/client/Plugin.d.ts +2 -2
  18. package/types/client/Product.d.ts +40 -29
  19. package/types/client/RadarPlusProduct.d.ts +19 -0
  20. package/types/client/Renderer.d.ts +2 -10
  21. package/types/client/SveltePlugin.d.ts +9 -5
  22. package/types/client/TileLayer.d.ts +1 -2
  23. package/types/client/TopoMap.d.ts +10 -0
  24. package/types/client/WindowPlugin.d.ts +7 -3
  25. package/types/client/appsFlyer.d.ts +3 -0
  26. package/types/client/baseMap.d.ts +8 -5
  27. package/types/client/cityLabels.d.ts +10 -2
  28. package/types/client/cloudSync.d.ts +3 -1
  29. package/types/client/colorGradients.d.ts +13 -0
  30. package/types/client/customColors.d.ts +1 -0
  31. package/types/client/d.ts.files/Calendar.d.ts +11 -2
  32. package/types/client/d.ts.files/Color.d.ts +16 -5
  33. package/types/client/d.ts.files/LabelsLayer.d.ts +1 -18
  34. package/types/client/d.ts.files/Layer.d.ts +8 -1
  35. package/types/client/d.ts.files/Metric.d.ts +1 -0
  36. package/types/client/d.ts.files/Renderer.d.ts +22 -1
  37. package/types/client/d.ts.files/alerts.d.ts +120 -0
  38. package/types/client/d.ts.files/broadcast.d.ts +38 -10
  39. package/types/client/d.ts.files/dataSpecifications.d.ts +81 -122
  40. package/types/client/d.ts.files/favs.d.ts +69 -0
  41. package/types/client/d.ts.files/incomingMessages.d.ts +0 -4
  42. package/types/client/d.ts.files/notifications.d.ts +2 -2
  43. package/types/client/d.ts.files/plugin-params.d.ts +35 -47
  44. package/types/client/d.ts.files/plugins.d.ts +30 -42
  45. package/types/client/d.ts.files/pois.d.ts +1 -1
  46. package/types/client/d.ts.files/products.d.ts +15 -3
  47. package/types/client/d.ts.files/rootScope.d.ts +3 -21
  48. package/types/client/d.ts.files/startup.d.ts +59 -0
  49. package/types/client/d.ts.files/storage.d.ts +12 -35
  50. package/types/client/d.ts.files/user.d.ts +79 -24
  51. package/types/client/deviceLogging.d.ts +2 -1
  52. package/types/client/embed2.d.ts +14 -31
  53. package/types/client/fetch.d.ts +29 -16
  54. package/types/client/ga.d.ts +1 -1
  55. package/types/client/geolocation.d.ts +15 -7
  56. package/types/client/globals.d.ts +1 -0
  57. package/types/client/http.d.ts +17 -0
  58. package/types/client/idbInstances.d.ts +45 -0
  59. package/types/client/langFiles.d.ts +2 -0
  60. package/types/client/layers.d.ts +2 -0
  61. package/types/client/lib.d.ts +7 -21
  62. package/types/client/loadArticlesOrWhatsNew.d.ts +1 -0
  63. package/types/client/log.d.ts +1 -0
  64. package/types/client/lruCache.d.ts +6 -0
  65. package/types/client/map.d.ts +17 -6
  66. package/types/client/mobile.d.ts +28 -20
  67. package/types/client/models.d.ts +1 -1
  68. package/types/client/notifications.d.ts +32 -67
  69. package/types/client/overlays.d.ts +4 -1
  70. package/types/client/params.d.ts +0 -1
  71. package/types/client/permanentPromos.d.ts +1 -1
  72. package/types/client/persistentStorage.d.ts +8 -0
  73. package/types/client/picker.d.ts +1 -1
  74. package/types/client/pois.d.ts +1 -2
  75. package/types/client/promo.d.ts +6 -16
  76. package/types/client/pushNotifications.d.ts +13 -1
  77. package/types/client/queryString.d.ts +1 -1
  78. package/types/client/renderUtils.d.ts +1 -1
  79. package/types/client/renderers.d.ts +7 -3
  80. package/types/client/rootScope.d.ts +14 -23
  81. package/types/client/router.d.ts +9 -5
  82. package/types/client/seoParser.d.ts +21 -0
  83. package/types/client/serviceWorkerCtrl.d.ts +8 -0
  84. package/types/client/startupWeather.d.ts +13 -9
  85. package/types/client/store.d.ts +2 -2
  86. package/types/client/storeLastPosition.d.ts +1 -0
  87. package/types/client/subscription.d.ts +1 -0
  88. package/types/client/swDownloader.d.ts +7 -7
  89. package/types/client/swProxy.d.ts +1 -1
  90. package/types/client/swUtils.d.ts +3 -3
  91. package/types/client/trans.d.ts +26 -37
  92. package/types/client/user.d.ts +5 -13
  93. package/types/client/userAlerts.d.ts +68 -0
  94. package/types/client/userConsent.d.ts +6 -0
  95. package/types/client/userFavs.d.ts +46 -121
  96. package/types/client/utils.d.ts +28 -6
  97. package/types/iconfont.d.ts +1 -0
  98. package/types/interfaces.d.ts +90 -225
  99. package/types/lang-files.d.ts +687 -119
  100. package/types/offline.d.ts +100 -0
  101. package/types/types.d.ts +59 -24
  102. package/types/client/Bar.d.ts +0 -114
  103. package/types/client/BindedBar.d.ts +0 -51
  104. package/types/client/BindedCheckbox.d.ts +0 -30
  105. package/types/client/BindedSwitch.d.ts +0 -35
  106. package/types/client/BottomTagPlugin.d.ts +0 -8
  107. package/types/client/DraggableDiv.d.ts +0 -21
  108. package/types/client/GhostBox.d.ts +0 -17
  109. package/types/client/Legend.d.ts +0 -6
  110. package/types/client/LongTap.d.ts +0 -21
  111. package/types/client/MobileCalendar.d.ts +0 -51
  112. package/types/client/OfflineMessagesClasses.d.ts +0 -30
  113. package/types/client/ProductSwitch.d.ts +0 -14
  114. package/types/client/Scrollable.d.ts +0 -14
  115. package/types/client/Switch.d.ts +0 -24
  116. package/types/client/TimestampBar.d.ts +0 -8
  117. package/types/client/d.ts.files/Product.d.ts +0 -37
  118. package/types/client/d.ts.files/trans.d.ts +0 -55
  119. package/types/client/favs.d.ts +0 -83
  120. package/types/client/offlineController.d.ts +0 -20
package/README.md CHANGED
@@ -4,6 +4,9 @@ Check out https://docs.windy-plugins.com for more information.
4
4
 
5
5
  # CHANGELOG
6
6
 
7
+ - 3.0.0 - TS declarations for client v45.0.0
8
+ - 2.0.2 - Support Windows in file path regex
9
+ - 2.0.1 - Remove less-autoprefixer
7
10
  - 2.0.0 - TS declarations for client v42.2.0
8
11
  - 1.0.9 - Updated client TS declarations
9
12
  - 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.0",
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
+ }
@@ -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
@@ -119,28 +78,19 @@ export declare class Color {
119
78
  * return .. output Uint8Array with color data
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
  }
@@ -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>>;
@@ -25,6 +25,7 @@ export declare class ExternalSveltePlugin extends SveltePlugin<'windy-external-p
25
25
  listenToSingleclick: ExternalPluginConfig['listenToSingleclick'];
26
26
  addToContextmenu: ExternalPluginConfig['addToContextmenu'];
27
27
  constructor(params: WindowPluginInitParams<'windy-external-plugin'>, { desktopUI, title, mobileUI, desktopWidth, routerPath, listenToSingleclick, addToContextmenu, url, }: InstalledExternalPluginConfig);
28
+ open({ params, disableOpeningAnimation, qs, }: PluginOpeningOptions<'windy-external-plugin'>): Promise<void | boolean>;
28
29
  getCss(): string;
29
30
  }
30
31
  export {};
@@ -0,0 +1,63 @@
1
+ import type { Timestamp } from '@windy/types.d';
2
+ /**
3
+ * Allowed data types for storage
4
+ */
5
+ export type DatabaseStore = 'userFavs' | 'userAlerts' | 'customColors' | 'searchRecents' | 'markedNotams' | 'minifests' | 'seenArticles' | 'seenPromos';
6
+ export type BackendItem<V> = {
7
+ updated: Timestamp;
8
+ id: string;
9
+ value: V;
10
+ };
11
+ export type BackendPayload<V> = BackendItem<V>[];
12
+ export type SupportedApiEndpoints = 'notams' | 'colors' | 'alerts' | 'favs';
13
+ export type StoredObjectWithId = {
14
+ id: string;
15
+ };
16
+ export interface IDBParams {
17
+ storeId: DatabaseStore;
18
+ initPromise: Promise<IDBDatabase>;
19
+ backendApiEndpoint?: SupportedApiEndpoints;
20
+ }
21
+ /**
22
+ * Wrapper around IndexedDB to provide async storage
23
+ *
24
+ * Synchronization with backend database is also supported
25
+ */
26
+ export declare class IDB<K extends string | number, V, W = V> {
27
+ private storeId;
28
+ private memoryCache;
29
+ private cacheIsValid;
30
+ private initPromise;
31
+ /**
32
+ * Is this db synced with backend?
33
+ *
34
+ * Storing to user backend is possible only for registered and properly logged in users
35
+ * The check if user is logged in, must be dome outside of this class, preferably in GUI
36
+ */
37
+ private usesBackendSync;
38
+ /**
39
+ * URL of the API endpoint, where data should be stored
40
+ */
41
+ private apiEndpoint;
42
+ /**
43
+ * Timestamp of last db update on this device (used only when collection has userBackend)
44
+ */
45
+ private readonly lastTimeUpdatedKey;
46
+ constructor(params: IDBParams);
47
+ /** Returns all items form IDB as an array */
48
+ getAll(): Promise<V[]>;
49
+ removeAll(): Promise<void>;
50
+ hasKey(key: K): Promise<boolean>;
51
+ get(key: K | '__lastTimeUpdated'): Promise<V | null>;
52
+ remove(key: K, removeJustLocally?: boolean): Promise<void>;
53
+ /**
54
+ * Creates data on the backend and uses the received `id` to save it locally.
55
+ * Only use this method for items not created by {@link put} to avoid key mismatch!
56
+ */
57
+ add(data: W): Promise<string>;
58
+ put(key: K | '__lastTimeUpdated', data: V, insertJustLocally?: boolean): Promise<void>;
59
+ /**
60
+ * Loads data from the cloud and returns true if there was a change
61
+ */
62
+ loadFromCloud(): Promise<boolean>;
63
+ }
@@ -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
  */
@@ -114,15 +117,12 @@ export declare abstract class Metric<T extends string | number = string | number
114
117
  * Cycles throu different metrics (for example after clicking on a legend)
115
118
  */
116
119
  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): {
120
+ static getGradientLegend: (col: Color | undefined, legend: Legend, metric: MetricItem) => {
123
121
  background: string;
124
122
  content: HTMLString;
125
123
  } | null;
124
+ /** color object is required for classic gradient metrics, discrete ones do not need it as colors are hardcoded for them */
125
+ renderLegend(col: Color | undefined, el: HTMLDivElement, legend: Legend): void;
126
126
  renderDiscreteLegend(): {
127
127
  background: '';
128
128
  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;
@@ -5,13 +5,13 @@ import type { DirectionFunction } from '@windy/format.d';
5
5
  import type { Iconfont } from '@windy/iconfont.d';
6
6
  import type { Overlays } from '@windy/rootScope.d';
7
7
  import type { RGBNumValues } from '@windy/interpolatorTypes';
8
- import type { LoadedTranslations } from '@windy/trans.d';
9
- import type { HTMLString } from '@windy/types';
10
- export type UsedOverlays = Overlays | 'gh' | 'swell' | 'satelliteIRBT';
8
+ import type { LoadedTranslations, HTMLString } from '@windy/types';
9
+ import type { RGBAString } from '@windy/Color.d';
10
+ export type UsedOverlays = Overlays | 'swell' | 'satelliteIRBT';
11
11
  export type OverlayInitParams = Pick<Overlay, 'ident'> & Partial<Overlay>;
12
12
  type LayerProperty<L extends Layer | undefined, P extends keyof Layer> = L extends Layer ? L[P] : undefined;
13
13
  type MetricProperty<M extends Metric | undefined, P extends keyof Metric> = M extends Metric ? M[P] : undefined;
14
- export declare class Overlay<I extends Overlays | 'gh' = Overlays | 'gh', M extends I extends Layers ? LayerMetricType[I] : undefined = I extends Layers ? LayerMetricType[I] : undefined, L extends Layer<M> | undefined = I extends Layers ? Layer<M> : undefined> {
14
+ export declare class Overlay<I extends Overlays = Overlays, M extends I extends Layers ? LayerMetricType[I] : undefined = I extends Layers ? LayerMetricType[I] : undefined, L extends Layer<M> | undefined = I extends Layers ? Layer<M> : undefined> {
15
15
  /**
16
16
  * Main ident
17
17
  */
@@ -53,6 +53,10 @@ export declare class Overlay<I extends Overlays | 'gh' = Overlays | 'gh', M exte
53
53
  * Hide interpolated weather value over cities, when user switches to POI cities
54
54
  */
55
55
  hideWxLabels?: boolean;
56
+ /**
57
+ * Hide elevation in the desktop picker
58
+ */
59
+ hidePickerElevation?: boolean;
56
60
  /**
57
61
  * Eg. in day-switcher we need as short name as possible
58
62
  */
@@ -74,7 +78,7 @@ export declare class Overlay<I extends Overlays | 'gh' = Overlays | 'gh', M exte
74
78
  */
75
79
  partOf?: Overlays;
76
80
  /**
77
- * Applies class 'hide-particles' to the body
81
+ * Hides particle on/off switch in GUI (so far used only in desktop GUI)
78
82
  */
79
83
  hideParticles?: boolean;
80
84
  /**
@@ -100,7 +104,24 @@ export declare class Overlay<I extends Overlays | 'gh' = Overlays | 'gh', M exte
100
104
  c: LayerProperty<L, 'c'>;
101
105
  l: LayerProperty<L, 'l'>;
102
106
  cm: LayerProperty<L, 'cm'>;
107
+ /**
108
+ * Do not display this overlay in URL
109
+ */
110
+ hideFromURL?: boolean;
111
+ /**
112
+ * Optional promo badge to be displayed in GUI
113
+ */
114
+ promoBadge?: string;
115
+ promoBadgeColor?: RGBAString;
116
+ /**
117
+ * Optional menu image thumbnail
118
+ */
119
+ menuImage?: string;
103
120
  constructor(params: OverlayInitParams);
121
+ /**
122
+ * When clicking on overlay in menu, do the following action (ready to be overloaded)
123
+ */
124
+ onClick(): void;
104
125
  /**
105
126
  * Render's overlay's legend inside el
106
127
  */
@@ -111,6 +132,10 @@ export declare class Overlay<I extends Overlays | 'gh' = Overlays | 'gh', M exte
111
132
  * @param short If true, return shortened version of description if avail
112
133
  */
113
134
  getName(short?: boolean): string;
135
+ /**
136
+ * Return URL of image for overlay
137
+ */
138
+ getMenuImagePath(): string;
114
139
  /**
115
140
  * Get menu title
116
141
  *
@@ -131,16 +156,6 @@ export declare class Overlay<I extends Overlays | 'gh' = Overlays | 'gh', M exte
131
156
  * @param values Interpolated values
132
157
  */
133
158
  createPickerHTML(values: RGBNumValues, _directionFormattingFunction: DirectionFunction): HTMLString;
134
- /**
135
- * In case of picker interpolator returns null value, this method is called
136
- * (is consumed by PickerMobile only so far)
137
- */
138
- createPickerInvalidHTML(): HTMLString;
139
- /**
140
- * Create title for picker content
141
- * @param alternativeContent Alternative text inside title
142
- */
143
- createPickerTitle(alternativeContent?: string): HTMLString;
144
159
  /**
145
160
  * Just proxy to the Metric's metric property
146
161
  */
@@ -2,28 +2,32 @@ import { Overlay } from '@windy/Overlay';
2
2
  import type { DirectionFunction } from '@windy/format.d';
3
3
  import type { Overlays } from '@windy/rootScope.d';
4
4
  import type { RGBNumValues } from '@windy/interpolatorTypes';
5
- import type { LoadedTranslations } from '@windy/trans.d';
6
- export declare class CurrentOverlay<I extends Overlays | 'gh' = Overlays | 'gh'> extends Overlay<I> {
5
+ import type { LoadedTranslations } from '@windy/types';
6
+ export declare class CurrentOverlay<I extends Overlays = Overlays> extends Overlay<I> {
7
+ hidePickerElevation: boolean;
7
8
  createPickerHTML(values: RGBNumValues, formatDir: DirectionFunction): string;
8
9
  }
9
- export declare class WaveOverlay<I extends Overlays | 'gh' = Overlays | 'gh'> extends Overlay<I> {
10
+ export declare class WaveOverlay<I extends Overlays = Overlays> extends Overlay<I> {
11
+ hidePickerElevation: boolean;
10
12
  createPickerHTML(values: RGBNumValues, formatDir: DirectionFunction): string;
11
13
  }
12
- export declare class AwpOverlay<I extends Overlays | 'gh' = Overlays | 'gh'> extends Overlay<I> {
14
+ export declare class AwpOverlay<I extends Overlays = Overlays> extends Overlay<I> {
13
15
  labels: {
14
16
  [value: number]: keyof LoadedTranslations;
15
17
  };
16
18
  createPickerHTML(values: RGBNumValues): string;
17
19
  }
18
- export declare class FwiOverlay<I extends Overlays | 'gh' = Overlays | 'gh'> extends Overlay<I> {
20
+ export declare class FwiOverlay<I extends Overlays = Overlays> extends Overlay<I> {
19
21
  labels: {
20
22
  [value: number]: keyof LoadedTranslations;
21
23
  };
22
24
  createPickerHTML(values: RGBNumValues): string;
23
25
  }
24
- export declare class RainPtypeOverlay<I extends Overlays | 'gh' = Overlays | 'gh'> extends Overlay<I> {
26
+ export declare class RainPtypeOverlay<I extends Overlays = Overlays> extends Overlay<I> {
27
+ hidePickerElevation: boolean;
25
28
  createPickerHTML(values: RGBNumValues): string;
26
29
  }
27
- export declare class CloudsOverlay<I extends Overlays | 'gh' = Overlays | 'gh'> extends Overlay<I> {
30
+ export declare class CloudsOverlay<I extends Overlays = Overlays> extends Overlay<I> {
31
+ hidePickerElevation: boolean;
28
32
  createPickerHTML(values: RGBNumValues): string;
29
33
  }
@@ -45,7 +45,7 @@ export declare class Plugin<P extends PluginIdent> {
45
45
  /**
46
46
  * Required language files
47
47
  */
48
- langFiles?: LangFileKey[];
48
+ langFiles: LangFileKey[];
49
49
  /**
50
50
  * Status of the plugin (is loaded or not)
51
51
  */
@@ -60,7 +60,7 @@ export declare class Plugin<P extends PluginIdent> {
60
60
  */
61
61
  pane?: PluginPane;
62
62
  /**
63
- * Is the tag currentlly open?
63
+ * Is the tag currently open?
64
64
  */
65
65
  isOpen?: boolean;
66
66
  /**