@guardian/interactive-component-library 0.7.5 → 0.7.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.
@@ -68,6 +68,7 @@ export class Map {
68
68
  changed(): void;
69
69
  transition(options: {
70
70
  duration: number;
71
+ ease: (t: any) => any;
71
72
  }, callback: any): Promise<any>;
72
73
  _isTransitioning: boolean;
73
74
  /** PRIVATE METHODS */
@@ -184,8 +184,8 @@ class Map {
184
184
  changed() {
185
185
  this._requestRender();
186
186
  }
187
- async transition(options = { duration: 500 }, callback) {
188
- const ease = options.ease || ((t) => t);
187
+ async transition(options = { duration: 500, ease: (t) => t }, callback) {
188
+ const ease = options.ease;
189
189
  return new Promise((resolve) => {
190
190
  this._isTransitioning = true;
191
191
  this.dispatcher.dispatch(MapEvent.TRANSITION_START);
@@ -14,7 +14,7 @@ export class TextLayer {
14
14
  * @constructor
15
15
  * @param {Object} params
16
16
  * @param {VectorSource} params.source
17
- * @param {Style | (() => Style)} [params.style=undefined]
17
+ * @param {Style | ((feature: import('../Feature').Feature, zoom: number, isHovering: boolean) => Style)} [params.style=undefined]
18
18
  * @param {number} [params.minZoom=0]
19
19
  * @param {number} [params.opacity=1]
20
20
  * @param {boolean} [params.declutter=true]
@@ -35,7 +35,7 @@ export class TextLayer {
35
35
  */
36
36
  constructor({ source, style, minZoom, opacity, declutter, declutterBoundingBoxPadding, drawCollisionBoxes, onClick, onHover, restyleOnHover, }: {
37
37
  source: VectorSource;
38
- style?: Style | (() => Style);
38
+ style?: Style | ((feature: import('../Feature').Feature, zoom: number, isHovering: boolean) => Style);
39
39
  minZoom?: number;
40
40
  opacity?: number;
41
41
  declutter?: boolean;
@@ -77,7 +77,7 @@ class TextLayer {
77
77
  * @constructor
78
78
  * @param {Object} params
79
79
  * @param {VectorSource} params.source
80
- * @param {Style | (() => Style)} [params.style=undefined]
80
+ * @param {Style | ((feature: import('../Feature').Feature, zoom: number, isHovering: boolean) => Style)} [params.style=undefined]
81
81
  * @param {number} [params.minZoom=0]
82
82
  * @param {number} [params.opacity=1]
83
83
  * @param {boolean} [params.declutter=true]
@@ -73,7 +73,7 @@ export class VectorLayer {
73
73
  */
74
74
  getExtent(): import('../util').Extent | null;
75
75
  findFeatures(coordinate: any): any;
76
- renderFrame(frameState: any, canvas: any): HTMLCanvasElement;
76
+ renderFrame(frameState: any, canvas: any): any;
77
77
  }
78
78
  export namespace VectorLayer {
79
79
  /** @param {VectorLayerComponentProps} props */
@@ -13,5 +13,5 @@ export class VectorLayerRenderer {
13
13
  /**
14
14
  * @param {HTMLCanvasElement} canvas
15
15
  */
16
- renderFrame(frameState: any, canvas: HTMLCanvasElement): HTMLCanvasElement;
16
+ renderFrame(frameState: any, canvas: HTMLCanvasElement): any;
17
17
  }
@@ -12,7 +12,7 @@ class VectorLayerRenderer {
12
12
  * @param {HTMLCanvasElement} canvas
13
13
  */
14
14
  renderFrame(frameState, canvas) {
15
- if (this.layer.opacity === 0) return canvas;
15
+ if (this.layer.opacity === 0) return null;
16
16
  const { projection, visibleExtent, transform } = frameState.viewState;
17
17
  const context = canvas.getContext("2d");
18
18
  context.save();
@@ -18,7 +18,7 @@ function toRgba(color, opacity = 1) {
18
18
  let a = rgbaMatch[4] !== void 0 ? parseFloat(rgbaMatch[4]) : opacity;
19
19
  return `rgba(${r}, ${g}, ${b}, ${a})`;
20
20
  }
21
- throw new Error("Unsupported color format");
21
+ throw new Error(`Unsupported color format: ${color}`);
22
22
  }
23
23
  export {
24
24
  toRgba
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@guardian/interactive-component-library",
3
3
  "private": false,
4
- "version": "0.7.5",
4
+ "version": "0.7.6",
5
5
  "packageManager": "pnpm@8.4.0",
6
6
  "repository": {
7
7
  "type": "git",