@planet/maps 11.0.0-dev.1740425469803 → 11.0.0-dev.1740442925922

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 (93) hide show
  1. package/Map.js +16 -16
  2. package/Overlay.js +8 -0
  3. package/View.js +8 -0
  4. package/control/Attribution.js +8 -0
  5. package/control/Control.js +8 -0
  6. package/control/FullScreen.js +8 -0
  7. package/control/MousePosition.js +8 -0
  8. package/control/OverviewMap.js +8 -0
  9. package/control/Rotate.js +8 -0
  10. package/control/ScaleLine.js +8 -0
  11. package/control/Zoom.js +8 -0
  12. package/control/ZoomSlider.js +8 -0
  13. package/control/ZoomToExtent.js +8 -0
  14. package/interaction/DblClickDragZoom.js +8 -0
  15. package/interaction/DoubleClickZoom.js +8 -0
  16. package/interaction/DragAndDrop.js +8 -0
  17. package/interaction/DragBox.js +8 -0
  18. package/interaction/DragPan.js +8 -0
  19. package/interaction/DragRotate.js +8 -0
  20. package/interaction/DragRotateAndZoom.js +8 -0
  21. package/interaction/DragZoom.js +8 -0
  22. package/interaction/Draw.js +8 -0
  23. package/interaction/Extent.js +8 -0
  24. package/interaction/Interaction.js +8 -0
  25. package/interaction/KeyboardPan.js +8 -0
  26. package/interaction/KeyboardZoom.js +8 -0
  27. package/interaction/Link.js +8 -0
  28. package/interaction/Modify.js +8 -0
  29. package/interaction/MouseWheelZoom.js +8 -0
  30. package/interaction/PinchRotate.js +8 -0
  31. package/interaction/PinchZoom.js +8 -0
  32. package/interaction/Pointer.js +8 -0
  33. package/interaction/Select.js +8 -0
  34. package/interaction/Snap.js +8 -0
  35. package/interaction/Translate.js +8 -0
  36. package/internal/config.js +1 -0
  37. package/internal/render.js +106 -40
  38. package/internal/update.js +37 -4
  39. package/layer/Base.js +9 -5
  40. package/layer/BaseImage.js +9 -5
  41. package/layer/BaseTile.js +9 -5
  42. package/layer/BaseVector.js +9 -5
  43. package/layer/Flow.js +9 -5
  44. package/layer/Graticule.js +9 -5
  45. package/layer/Group.js +9 -5
  46. package/layer/Heatmap.js +9 -5
  47. package/layer/Image.js +9 -5
  48. package/layer/Layer.js +9 -5
  49. package/layer/MapboxVector.js +8 -5
  50. package/layer/Tile.js +9 -5
  51. package/layer/Vector.js +9 -5
  52. package/layer/VectorImage.js +9 -5
  53. package/layer/VectorTile.js +9 -5
  54. package/layer/WebGLPoints.js +9 -5
  55. package/layer/WebGLTile.js +9 -5
  56. package/layer/WebGLVector.js +9 -5
  57. package/layer/WebGLVectorTile.js +9 -5
  58. package/package.json +16 -8
  59. package/source/BingMaps.js +8 -0
  60. package/source/CartoDB.js +8 -0
  61. package/source/Cluster.js +8 -0
  62. package/source/DataTile.js +8 -0
  63. package/source/GeoTIFF.js +8 -0
  64. package/source/Google.js +8 -0
  65. package/source/IIIF.js +8 -0
  66. package/source/Image.js +8 -0
  67. package/source/ImageArcGISRest.js +8 -0
  68. package/source/ImageCanvas.js +8 -0
  69. package/source/ImageMapGuide.js +8 -0
  70. package/source/ImageStatic.js +8 -0
  71. package/source/ImageTile.js +8 -0
  72. package/source/ImageWMS.js +8 -0
  73. package/source/OGCMapTile.js +8 -0
  74. package/source/OGCVectorTile.js +8 -0
  75. package/source/OSM.js +8 -0
  76. package/source/Raster.js +8 -0
  77. package/source/SentinelHub.js +8 -0
  78. package/source/Source.js +8 -0
  79. package/source/StadiaMaps.js +8 -0
  80. package/source/Tile.js +8 -0
  81. package/source/TileArcGISRest.js +8 -0
  82. package/source/TileDebug.js +8 -0
  83. package/source/TileImage.js +8 -0
  84. package/source/TileJSON.js +8 -0
  85. package/source/TileWMS.js +8 -0
  86. package/source/UTFGrid.js +8 -0
  87. package/source/UrlTile.js +8 -0
  88. package/source/Vector.js +8 -0
  89. package/source/VectorTile.js +8 -0
  90. package/source/WMTS.js +8 -0
  91. package/source/XYZ.js +8 -0
  92. package/source/Zoomify.js +8 -0
  93. package/interaction/Property.js +0 -22
@@ -1,18 +1,23 @@
1
+ import OLMap from 'ol/Map.js';
1
2
  import Overlay from 'ol/Overlay.js';
2
3
  import View from 'ol/View.js';
3
4
  import Control from 'ol/control/Control.js';
4
5
  import Interaction from 'ol/interaction/Interaction.js';
5
6
  import BaseLayer from 'ol/layer/Base.js';
6
7
  import GroupLayer from 'ol/layer/Group.js';
8
+ import Layer from 'ol/layer/Layer.js';
7
9
  import Source from 'ol/source/Source.js';
10
+ import Vector from 'ol/source/Vector.js';
8
11
  import ReactReconciler from 'react-reconciler';
9
12
  import {
10
13
  ConcurrentRoot,
11
14
  DefaultEventPriority,
15
+ //@ts-ignore (TODO: remove after https://github.com/DefinitelyTyped/DefinitelyTyped/pull/72046 is released)
12
16
  NoEventPriority,
13
17
  } from 'react-reconciler/constants.js';
14
18
  import {CONTROL, INTERACTION, LAYER, OVERLAY, SOURCE, VIEW} from './config.js';
15
19
  import {
20
+ arrayEquals,
16
21
  prepareControlUpdate,
17
22
  prepareInteractionUpdate,
18
23
  prepareLayerUpdate,
@@ -25,14 +30,23 @@ import {
25
30
  const listenerRegex = /^on([A-Z].*)/;
26
31
  const listenerColonRegex = /^onChange-/;
27
32
 
33
+ /**
34
+ * @param {string} str A string.
35
+ */
28
36
  function upperFirst(str) {
29
37
  return str[0].toUpperCase() + str.slice(1);
30
38
  }
31
39
 
40
+ /**
41
+ * @param {string} str A string.
42
+ */
32
43
  function setterName(str) {
33
44
  return 'set' + upperFirst(str);
34
45
  }
35
46
 
47
+ /**
48
+ * @type {Object<string, boolean>}
49
+ */
36
50
  const knownTypes = {
37
51
  [VIEW]: true,
38
52
  [OVERLAY]: true,
@@ -43,29 +57,8 @@ const knownTypes = {
43
57
  };
44
58
 
45
59
  /**
46
- * @param {Array} a1 An array.
47
- * @param {Array} a2 An array.
48
- * @return {boolean} All elements in the array are the same;
60
+ * @type {import('./update.js').Updater}
49
61
  */
50
- function arrayEquals(a1, a2) {
51
- if (!a1 || !a2) {
52
- return false;
53
- }
54
- const len1 = a1.length;
55
- const len2 = a2.length;
56
- if (len1 !== len2) {
57
- return false;
58
- }
59
- for (let i = 0; i < len1; i += 1) {
60
- const v1 = a1[i];
61
- const v2 = a2[i];
62
- if (v1 !== v2) {
63
- return false;
64
- }
65
- }
66
- return true;
67
- }
68
-
69
62
  export function updateInstanceFromProps(instance, type, oldProps, newProps) {
70
63
  for (const key in newProps) {
71
64
  if (reservedProps[key]) {
@@ -105,31 +98,46 @@ export function updateInstanceFromProps(instance, type, oldProps, newProps) {
105
98
  continue;
106
99
  }
107
100
 
108
- if (key === 'features' && typeof instance.addFeatures === 'function') {
109
- // TODO: there is likely a smarter way to diff features
110
- instance.clear(true);
111
- instance.addFeatures(newValue);
112
- continue;
101
+ if (instance instanceof Vector) {
102
+ if (key === 'features') {
103
+ // TODO: there is likely a smarter way to diff features
104
+ instance.clear(true);
105
+ instance.addFeatures(newValue);
106
+ continue;
107
+ }
113
108
  }
114
109
 
115
- if (
116
- key === 'interactions' &&
117
- typeof instance.addInteraction === 'function'
118
- ) {
119
- instance.getInteractions().clear();
120
- newValue.forEach(interaction => instance.addInteraction(interaction));
121
- continue;
122
- }
123
- if (key === 'controls' && typeof instance.addControl === 'function') {
124
- instance.getControls().clear();
125
- newValue.forEach(control => instance.addControl(control));
126
- continue;
110
+ if (instance instanceof OLMap) {
111
+ if (key === 'interactions') {
112
+ const interactions = /** @type {Array<Interaction>} */ (newValue);
113
+ instance.getInteractions().clear();
114
+ interactions.forEach(interaction =>
115
+ instance.addInteraction(interaction),
116
+ );
117
+ continue;
118
+ }
119
+ if (key === 'controls') {
120
+ const controls = /** @type {Array<Control>} */ (newValue);
121
+ instance.getControls().clear();
122
+ controls.forEach(control => instance.addControl(control));
123
+ continue;
124
+ }
127
125
  }
128
126
 
129
127
  throw new Error(`Cannot update '${key}' property`);
130
128
  }
131
129
  }
132
130
 
131
+ /**
132
+ * @typedef {Object} InstanceProps
133
+ * @property {new(options: any) => any} cls A class.
134
+ * @property {any} [options] The options.
135
+ */
136
+
137
+ /**
138
+ * @param {string} type The string type.
139
+ * @param {InstanceProps} The instance props.
140
+ */
133
141
  function createInstance(type, {cls: Constructor, ...props}) {
134
142
  if (!knownTypes[type]) {
135
143
  throw new Error(`Unsupported element type: ${type}`);
@@ -147,6 +155,10 @@ function createTextInstance() {
147
155
  throw new Error('Cannot add text to the map');
148
156
  }
149
157
 
158
+ /**
159
+ * @param {OLMap} map The map.
160
+ * @param {any} child The child.
161
+ */
150
162
  function appendChildToContainer(map, child) {
151
163
  if (child instanceof View) {
152
164
  map.setView(child);
@@ -171,9 +183,13 @@ function appendChildToContainer(map, child) {
171
183
  throw new Error(`Cannot add child to the map: ${child}`);
172
184
  }
173
185
 
186
+ /**
187
+ * @param {any} parent The parent.
188
+ * @param {any} child The child.
189
+ */
174
190
  function appendChild(parent, child) {
175
191
  if (child instanceof Source) {
176
- if (!(parent instanceof BaseLayer)) {
192
+ if (!(parent instanceof Layer)) {
177
193
  throw new Error(`Cannot add source to ${parent}`);
178
194
  }
179
195
  parent.setSource(child);
@@ -187,6 +203,9 @@ function appendChild(parent, child) {
187
203
  throw new Error(`Cannot add ${child} to ${parent}`);
188
204
  }
189
205
 
206
+ /**
207
+ * @type {Object<string, import('./update.js').Updater>}
208
+ */
190
209
  const updaters = {
191
210
  [VIEW]: prepareViewUpdate,
192
211
  [OVERLAY]: prepareOverlayUpdate,
@@ -196,6 +215,12 @@ const updaters = {
196
215
  [SOURCE]: prepareSourceUpdate,
197
216
  };
198
217
 
218
+ /**
219
+ * @param {any} instance The instance to update.
220
+ * @param {string} type The string type.
221
+ * @param {Object<string, any>} oldProps The old props.
222
+ * @param {Object<string, any>} newProps The new props.
223
+ */
199
224
  function prepareUpdate(instance, type, oldProps, newProps) {
200
225
  const updater = updaters[type];
201
226
  if (!updater) {
@@ -204,10 +229,17 @@ function prepareUpdate(instance, type, oldProps, newProps) {
204
229
  return updater(instance, type, oldProps, newProps);
205
230
  }
206
231
 
232
+ /**
233
+ * @type {import('./update.js').Updater}
234
+ */
207
235
  function commitUpdate(instance, type, oldProps, newProps) {
208
236
  updateInstanceFromProps(instance, type, oldProps, newProps);
209
237
  }
210
238
 
239
+ /**
240
+ * @param {OLMap} map The map.
241
+ * @param {any} child The object to remove from the map.
242
+ */
211
243
  function removeChildFromContainer(map, child) {
212
244
  if (child instanceof View) {
213
245
  map.setView(child);
@@ -232,6 +264,10 @@ function removeChildFromContainer(map, child) {
232
264
  throw new Error(`Cannot remove child from the map: ${child}`);
233
265
  }
234
266
 
267
+ /**
268
+ * @param {any} parent The parent object.
269
+ * @param {any} child The child object.
270
+ */
235
271
  function removeChild(parent, child) {
236
272
  // this happens with group layers
237
273
  if (child instanceof BaseLayer && parent.getLayers) {
@@ -241,12 +277,21 @@ function removeChild(parent, child) {
241
277
  throw new Error(`TODO: implement removeChild for ${parent} and ${child}`);
242
278
  }
243
279
 
280
+ /**
281
+ * @param {OLMap} map The map.
282
+ */
244
283
  function clearContainer(map) {
245
284
  map.getLayers().clear();
246
285
  // Need to leave the default controls and interactions.
247
286
  // TODO: determine when this gets called.
248
287
  }
249
288
 
289
+ /**
290
+ * @template {any} T
291
+ * @param {import("ol/Collection.js").default<T>} collection A collection.
292
+ * @param {T} child The child to insert.
293
+ * @param {T} beforeChild The insertion point.
294
+ */
250
295
  function insertInCollection(collection, child, beforeChild) {
251
296
  const index = collection.getArray().indexOf(beforeChild);
252
297
  if (index < 0) {
@@ -256,6 +301,11 @@ function insertInCollection(collection, child, beforeChild) {
256
301
  }
257
302
  }
258
303
 
304
+ /**
305
+ * @param {OLMap} map The map.
306
+ * @param {any} child The child to insert.
307
+ * @param {any} beforeChild The insertion point.
308
+ */
259
309
  function insertInContainerBefore(map, child, beforeChild) {
260
310
  if (child instanceof View) {
261
311
  map.setView(child);
@@ -276,6 +326,11 @@ function insertInContainerBefore(map, child, beforeChild) {
276
326
  }
277
327
  }
278
328
 
329
+ /**
330
+ * @param {any} parent The parent.
331
+ * @param {any} child The child to insert.
332
+ * @param {any} beforeChild The insertion point.
333
+ */
279
334
  function insertBefore(parent, child, beforeChild) {
280
335
  if (child instanceof BaseLayer && parent instanceof GroupLayer) {
281
336
  insertInCollection(parent.getLayers(), child, beforeChild);
@@ -308,6 +363,7 @@ const reconciler = ReactReconciler({
308
363
  return null;
309
364
  },
310
365
 
366
+ //@ts-ignore
311
367
  shouldAttemptEagerTransition() {
312
368
  return false;
313
369
  },
@@ -330,6 +386,9 @@ const reconciler = ReactReconciler({
330
386
  return null;
331
387
  },
332
388
 
389
+ /**
390
+ * @param {number} newPriority The new priority.
391
+ */
333
392
  setCurrentUpdatePriority(newPriority) {
334
393
  currentUpdatePriority = newPriority;
335
394
  },
@@ -378,8 +437,15 @@ const reconciler = ReactReconciler({
378
437
  detachDeletedInstance() {},
379
438
  });
380
439
 
440
+ /**
441
+ * @type {Map<any, ReactReconciler.OpaqueRoot>}
442
+ */
381
443
  const roots = new Map();
382
444
 
445
+ /**
446
+ * @param {React.ReactNode} element The element to render.
447
+ * @param {any} container The container.
448
+ */
383
449
  export function render(element, container) {
384
450
  let root = roots.get(container);
385
451
  if (!root) {
@@ -1,15 +1,33 @@
1
- function arrayEquals(a, b) {
2
- if (a.length !== b.length) {
1
+ /**
2
+ * @typedef {function(any, string, Object<string, any>, Object<string, any>): any} Updater
3
+ */
4
+
5
+ /**
6
+ * @param {Array<any>} [a1] An array.
7
+ * @param {Array<any>} [a2] An array.
8
+ * @return {boolean} All elements in the array are the same;
9
+ */
10
+ export function arrayEquals(a1, a2) {
11
+ if (!a1 || !a2) {
12
+ return false;
13
+ }
14
+ const len = a1.length;
15
+ if (len !== a2.length) {
3
16
  return false;
4
17
  }
5
- for (let i = 0; i < a.length; i++) {
6
- if (a[i] !== b[i]) {
18
+ for (let i = 0; i < len; i += 1) {
19
+ const v1 = a1[i];
20
+ const v2 = a2[i];
21
+ if (v1 !== v2) {
7
22
  return false;
8
23
  }
9
24
  }
10
25
  return true;
11
26
  }
12
27
 
28
+ /**
29
+ * @type {Object<string, boolean>}
30
+ */
13
31
  export const reservedProps = {
14
32
  children: true,
15
33
  cls: true,
@@ -17,10 +35,19 @@ export const reservedProps = {
17
35
  ref: true, // TODO: deal with changing ref
18
36
  };
19
37
 
38
+ /**
39
+ * @param {import("ol/View.js").default} view The view.
40
+ * @param {string} type The string type.
41
+ * @param {Object<string, any>} oldProps The old props.
42
+ * @param {Object<string, any>} newProps The new props.
43
+ */
20
44
  export function prepareViewUpdate(view, type, oldProps, newProps) {
21
45
  if (view.getAnimating()) {
22
46
  return null;
23
47
  }
48
+ /**
49
+ * @type {Object<string, any>}
50
+ */
24
51
  const payload = {};
25
52
  let needsUpdate = false;
26
53
  for (const key in newProps) {
@@ -71,7 +98,13 @@ export function prepareViewUpdate(view, type, oldProps, newProps) {
71
98
  return payload;
72
99
  }
73
100
 
101
+ /**
102
+ * @type {Updater}
103
+ */
74
104
  function prepareGenericUpdate(instance, type, oldProps, newProps) {
105
+ /**
106
+ * @type {Object<string, any>}
107
+ */
75
108
  const payload = {};
76
109
  let needsUpdate = false;
77
110
  for (const key in newProps) {
package/layer/Base.js CHANGED
@@ -15,13 +15,17 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import OLBase from 'ol/layer/Base.js';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} BaseProps
22
+ * @property {ConstructorParameters<typeof OLBase>[0]} [options] The layer options.
23
+ * @property {React.ReactNode} children The layer source.
24
+ */
25
+
26
+ /**
27
+ * @param {BaseProps | Object<string, any>} props The layer props.
28
+ */
21
29
  export default function Base({children, ...props}) {
22
30
  return createElement('layer', {cls: OLBase, ...props}, children);
23
31
  }
24
-
25
- Base.propTypes = {
26
- children: propTypes.node,
27
- };
@@ -15,13 +15,17 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import OLBaseImage from 'ol/layer/BaseImage.js';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} BaseImageProps
22
+ * @property {ConstructorParameters<typeof OLBaseImage>[0]} [options] The layer options.
23
+ * @property {React.ReactNode} children The layer source.
24
+ */
25
+
26
+ /**
27
+ * @param {BaseImageProps | Object<string, any>} props The layer props.
28
+ */
21
29
  export default function BaseImage({children, ...props}) {
22
30
  return createElement('layer', {cls: OLBaseImage, ...props}, children);
23
31
  }
24
-
25
- BaseImage.propTypes = {
26
- children: propTypes.node,
27
- };
package/layer/BaseTile.js CHANGED
@@ -15,13 +15,17 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import OLBaseTile from 'ol/layer/BaseTile.js';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} BaseTileProps
22
+ * @property {ConstructorParameters<typeof OLBaseTile>[0]} [options] The layer options.
23
+ * @property {React.ReactNode} children The layer source.
24
+ */
25
+
26
+ /**
27
+ * @param {BaseTileProps | Object<string, any>} props The layer props.
28
+ */
21
29
  export default function BaseTile({children, ...props}) {
22
30
  return createElement('layer', {cls: OLBaseTile, ...props}, children);
23
31
  }
24
-
25
- BaseTile.propTypes = {
26
- children: propTypes.node,
27
- };
@@ -15,13 +15,17 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import OLBaseVector from 'ol/layer/BaseVector.js';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} BaseVectorProps
22
+ * @property {ConstructorParameters<typeof OLBaseVector>[0]} [options] The layer options.
23
+ * @property {React.ReactNode} children The layer source.
24
+ */
25
+
26
+ /**
27
+ * @param {BaseVectorProps | Object<string, any>} props The layer props.
28
+ */
21
29
  export default function BaseVector({children, ...props}) {
22
30
  return createElement('layer', {cls: OLBaseVector, ...props}, children);
23
31
  }
24
-
25
- BaseVector.propTypes = {
26
- children: propTypes.node,
27
- };
package/layer/Flow.js CHANGED
@@ -15,13 +15,17 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import OLFlow from 'ol/layer/Flow.js';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} FlowProps
22
+ * @property {ConstructorParameters<typeof OLFlow>[0]} [options] The layer options.
23
+ * @property {React.ReactNode} children The layer source.
24
+ */
25
+
26
+ /**
27
+ * @param {FlowProps | Object<string, any>} props The layer props.
28
+ */
21
29
  export default function Flow({children, ...props}) {
22
30
  return createElement('layer', {cls: OLFlow, ...props}, children);
23
31
  }
24
-
25
- Flow.propTypes = {
26
- children: propTypes.node,
27
- };
@@ -15,13 +15,17 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import OLGraticule from 'ol/layer/Graticule.js';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} GraticuleProps
22
+ * @property {ConstructorParameters<typeof OLGraticule>[0]} [options] The layer options.
23
+ * @property {React.ReactNode} children The layer source.
24
+ */
25
+
26
+ /**
27
+ * @param {GraticuleProps | Object<string, any>} props The layer props.
28
+ */
21
29
  export default function Graticule({children, ...props}) {
22
30
  return createElement('layer', {cls: OLGraticule, ...props}, children);
23
31
  }
24
-
25
- Graticule.propTypes = {
26
- children: propTypes.node,
27
- };
package/layer/Group.js CHANGED
@@ -15,13 +15,17 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import OLGroup from 'ol/layer/Group.js';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} GroupProps
22
+ * @property {ConstructorParameters<typeof OLGroup>[0]} [options] The layer options.
23
+ * @property {React.ReactNode} children The layer source.
24
+ */
25
+
26
+ /**
27
+ * @param {GroupProps | Object<string, any>} props The layer props.
28
+ */
21
29
  export default function Group({children, ...props}) {
22
30
  return createElement('layer', {cls: OLGroup, ...props}, children);
23
31
  }
24
-
25
- Group.propTypes = {
26
- children: propTypes.node,
27
- };
package/layer/Heatmap.js CHANGED
@@ -15,13 +15,17 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import OLHeatmap from 'ol/layer/Heatmap.js';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} HeatmapProps
22
+ * @property {ConstructorParameters<typeof OLHeatmap>[0]} [options] The layer options.
23
+ * @property {React.ReactNode} children The layer source.
24
+ */
25
+
26
+ /**
27
+ * @param {HeatmapProps | Object<string, any>} props The layer props.
28
+ */
21
29
  export default function Heatmap({children, ...props}) {
22
30
  return createElement('layer', {cls: OLHeatmap, ...props}, children);
23
31
  }
24
-
25
- Heatmap.propTypes = {
26
- children: propTypes.node,
27
- };
package/layer/Image.js CHANGED
@@ -15,13 +15,17 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import OLImage from 'ol/layer/Image.js';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} ImageProps
22
+ * @property {ConstructorParameters<typeof OLImage>[0]} [options] The layer options.
23
+ * @property {React.ReactNode} children The layer source.
24
+ */
25
+
26
+ /**
27
+ * @param {ImageProps | Object<string, any>} props The layer props.
28
+ */
21
29
  export default function Image({children, ...props}) {
22
30
  return createElement('layer', {cls: OLImage, ...props}, children);
23
31
  }
24
-
25
- Image.propTypes = {
26
- children: propTypes.node,
27
- };
package/layer/Layer.js CHANGED
@@ -15,13 +15,17 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import OLLayer from 'ol/layer/Layer.js';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} LayerProps
22
+ * @property {ConstructorParameters<typeof OLLayer>[0]} [options] The layer options.
23
+ * @property {React.ReactNode} children The layer source.
24
+ */
25
+
26
+ /**
27
+ * @param {LayerProps | Object<string, any>} props The layer props.
28
+ */
21
29
  export default function Layer({children, ...props}) {
22
30
  return createElement('layer', {cls: OLLayer, ...props}, children);
23
31
  }
24
-
25
- Layer.propTypes = {
26
- children: propTypes.node,
27
- };
@@ -15,13 +15,16 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import {MapboxVectorLayer as OLMBVectorLayer} from 'ol-mapbox-style';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} MapboxVectorProps
22
+ * @property {React.ReactNode} children The layer source.
23
+ */
24
+
25
+ /**
26
+ * @param {MapboxVectorProps | Object<string, any>} props The layer props.
27
+ */
21
28
  export default function MapboxVector({children, ...props}) {
22
29
  return createElement('layer', {cls: OLMBVectorLayer, ...props}, children);
23
30
  }
24
-
25
- MapboxVector.propTypes = {
26
- children: propTypes.node,
27
- };
package/layer/Tile.js CHANGED
@@ -15,13 +15,17 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import OLTile from 'ol/layer/Tile.js';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} TileProps
22
+ * @property {ConstructorParameters<typeof OLTile>[0]} [options] The layer options.
23
+ * @property {React.ReactNode} children The layer source.
24
+ */
25
+
26
+ /**
27
+ * @param {TileProps | Object<string, any>} props The layer props.
28
+ */
21
29
  export default function Tile({children, ...props}) {
22
30
  return createElement('layer', {cls: OLTile, ...props}, children);
23
31
  }
24
-
25
- Tile.propTypes = {
26
- children: propTypes.node,
27
- };
package/layer/Vector.js CHANGED
@@ -15,13 +15,17 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import OLVector from 'ol/layer/Vector.js';
18
- import propTypes from 'prop-types';
19
18
  import {createElement} from 'react';
20
19
 
20
+ /**
21
+ * @typedef {Object} VectorProps
22
+ * @property {ConstructorParameters<typeof OLVector>[0]} [options] The layer options.
23
+ * @property {React.ReactNode} children The layer source.
24
+ */
25
+
26
+ /**
27
+ * @param {VectorProps | Object<string, any>} props The layer props.
28
+ */
21
29
  export default function Vector({children, ...props}) {
22
30
  return createElement('layer', {cls: OLVector, ...props}, children);
23
31
  }
24
-
25
- Vector.propTypes = {
26
- children: propTypes.node,
27
- };