react-bkoi-gl 1.0.5 → 1.0.7

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.
@@ -1,7 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- var _Mapbox;
3
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
1
  import { transformToViewState, applyViewStateToTransform, cloneTransform, syncProjection } from "../utils/transform.js";
6
2
  import { normalizeStyle } from "../utils/style-utils.js";
7
3
  import { deepEqual } from "../utils/deep-equal.js";
@@ -61,53 +57,18 @@ const otherEvents = {
61
57
  const settingNames = ['minZoom', 'maxZoom', 'minPitch', 'maxPitch', 'maxBounds', 'projection', 'renderWorldCopies'];
62
58
  const handlerNames = ['scrollZoom', 'boxZoom', 'dragRotate', 'dragPan', 'keyboard', 'doubleClickZoom', 'touchZoomRotate', 'touchPitch'];
63
59
  export default class Mapbox {
60
+ _map = null;
61
+ _internalUpdate = false;
62
+ _inRender = false;
63
+ _hoveredFeatures = null;
64
+ _deferredEvents = {
65
+ move: false,
66
+ zoom: false,
67
+ pitch: false,
68
+ rotate: false
69
+ };
70
+ static savedMaps = [];
64
71
  constructor(MapClass, props, container) {
65
- this._MapClass = void 0;
66
- this._map = null;
67
- this.props = void 0;
68
- this._renderTransform = void 0;
69
- this._internalUpdate = false;
70
- this._inRender = false;
71
- this._hoveredFeatures = null;
72
- this._deferredEvents = {
73
- move: false,
74
- zoom: false,
75
- pitch: false,
76
- rotate: false
77
- };
78
- this._onEvent = e => {
79
- const cb = this.props[otherEvents[e.type]];
80
- if (cb) {
81
- cb(e);
82
- } else if (e.type === 'error') {
83
- console.error(e.error);
84
- }
85
- };
86
- this._onPointerEvent = e => {
87
- if (e.type === 'mousemove' || e.type === 'mouseout') {
88
- this._updateHover(e);
89
- }
90
- const cb = this.props[pointerEvents[e.type]];
91
- if (cb) {
92
- if (this.props.interactiveLayerIds && e.type !== 'mouseover' && e.type !== 'mouseout') {
93
- e.features = this._hoveredFeatures || this._queryRenderedFeatures(e.point);
94
- }
95
- cb(e);
96
- delete e.features;
97
- }
98
- };
99
- this._onCameraEvent = e => {
100
- if (!this._internalUpdate) {
101
- const cb = this.props[cameraEvents[e.type]];
102
- if (cb) {
103
- cb(e);
104
- }
105
- }
106
- if (e.type in this._deferredEvents) {
107
- this._deferredEvents[e.type] = false;
108
- }
109
- };
110
- this._onAfterRepaint = void 0;
111
72
  this._MapClass = MapClass;
112
73
  this.props = props;
113
74
  this._initialize(container);
@@ -151,18 +112,20 @@ export default class Mapbox {
151
112
  resizeObserver.disconnect();
152
113
  resizeObserver.observe(container);
153
114
  }
154
- that.setProps(_objectSpread(_objectSpread({}, props), {}, {
115
+ that.setProps({
116
+ ...props,
155
117
  styleDiffing: false
156
- }));
118
+ });
157
119
  map.resize();
158
120
  const {
159
121
  initialViewState
160
122
  } = props;
161
123
  if (initialViewState) {
162
124
  if (initialViewState.bounds) {
163
- map.fitBounds(initialViewState.bounds, _objectSpread(_objectSpread({}, initialViewState.fitBoundsOptions), {}, {
125
+ map.fitBounds(initialViewState.bounds, {
126
+ ...initialViewState.fitBoundsOptions,
164
127
  duration: 0
165
- }));
128
+ });
166
129
  } else {
167
130
  that._updateViewState(initialViewState, false);
168
131
  }
@@ -182,11 +145,13 @@ export default class Mapbox {
182
145
  const {
183
146
  mapStyle = DEFAULT_STYLE
184
147
  } = props;
185
- const mapOptions = _objectSpread(_objectSpread(_objectSpread({}, props), props.initialViewState), {}, {
148
+ const mapOptions = {
149
+ ...props,
150
+ ...props.initialViewState,
186
151
  accessToken: props.mapboxAccessToken || getAccessTokenFromEnv() || null,
187
152
  container,
188
153
  style: normalizeStyle(mapStyle)
189
- });
154
+ };
190
155
  const viewState = mapOptions.initialViewState || mapOptions.viewState || mapOptions;
191
156
  Object.assign(mapOptions, {
192
157
  center: [viewState.longitude || 0, viewState.latitude || 0],
@@ -245,7 +210,7 @@ export default class Mapbox {
245
210
  recycle() {
246
211
  const container = this.map.getContainer();
247
212
  const children = container.querySelector('[mapboxgl-children]');
248
- children === null || children === void 0 || children.remove();
213
+ children?.remove();
249
214
  Mapbox.savedMaps.push(this);
250
215
  }
251
216
  destroy() {
@@ -294,16 +259,19 @@ export default class Mapbox {
294
259
  if (isMoving) {
295
260
  tr.cameraElevationReference = 'sea';
296
261
  }
297
- const changed = applyViewStateToTransform(tr, _objectSpread(_objectSpread({}, transformToViewState(map.transform)), nextProps));
262
+ const changed = applyViewStateToTransform(tr, {
263
+ ...transformToViewState(map.transform),
264
+ ...nextProps
265
+ });
298
266
  if (isMoving) {
299
267
  tr.cameraElevationReference = 'ground';
300
268
  }
301
269
  if (changed && triggerEvents) {
302
270
  const deferredEvents = this._deferredEvents;
303
271
  deferredEvents.move = true;
304
- deferredEvents.zoom || (deferredEvents.zoom = zoom !== tr.zoom);
305
- deferredEvents.rotate || (deferredEvents.rotate = bearing !== tr.bearing);
306
- deferredEvents.pitch || (deferredEvents.pitch = pitch !== tr.pitch);
272
+ deferredEvents.zoom ||= zoom !== tr.zoom;
273
+ deferredEvents.rotate ||= bearing !== tr.bearing;
274
+ deferredEvents.pitch ||= pitch !== tr.pitch;
307
275
  }
308
276
  if (!isMoving) {
309
277
  applyViewStateToTransform(map.transform, nextProps);
@@ -317,7 +285,7 @@ export default class Mapbox {
317
285
  if (propName in nextProps && !deepEqual(nextProps[propName], currProps[propName])) {
318
286
  changed = true;
319
287
  const setter = map[`set${propName[0].toUpperCase()}${propName.slice(1)}`];
320
- setter === null || setter === void 0 || setter.call(map, nextProps[propName]);
288
+ setter?.call(map, nextProps[propName]);
321
289
  }
322
290
  }
323
291
  return changed;
@@ -367,9 +335,8 @@ export default class Mapbox {
367
335
  const map = this._map;
368
336
  let changed = false;
369
337
  for (const propName of handlerNames) {
370
- var _nextProps$propName, _currProps$propName;
371
- const newValue = (_nextProps$propName = nextProps[propName]) !== null && _nextProps$propName !== void 0 ? _nextProps$propName : true;
372
- const oldValue = (_currProps$propName = currProps[propName]) !== null && _currProps$propName !== void 0 ? _currProps$propName : true;
338
+ const newValue = nextProps[propName] ?? true;
339
+ const oldValue = currProps[propName] ?? true;
373
340
  if (!deepEqual(newValue, oldValue)) {
374
341
  changed = true;
375
342
  if (newValue) {
@@ -381,6 +348,14 @@ export default class Mapbox {
381
348
  }
382
349
  return changed;
383
350
  }
351
+ _onEvent = e => {
352
+ const cb = this.props[otherEvents[e.type]];
353
+ if (cb) {
354
+ cb(e);
355
+ } else if (e.type === 'error') {
356
+ console.error(e.error);
357
+ }
358
+ };
384
359
  _queryRenderedFeatures(point) {
385
360
  const map = this._map;
386
361
  const tr = map.transform;
@@ -392,7 +367,7 @@ export default class Mapbox {
392
367
  return map.queryRenderedFeatures(point, {
393
368
  layers: interactiveLayerIds.filter(map.getLayer.bind(map))
394
369
  });
395
- } catch (_unused) {
370
+ } catch {
396
371
  return [];
397
372
  } finally {
398
373
  map.transform = tr;
@@ -404,9 +379,8 @@ export default class Mapbox {
404
379
  } = this;
405
380
  const shouldTrackHoveredFeatures = props.interactiveLayerIds && (props.onMouseMove || props.onMouseEnter || props.onMouseLeave);
406
381
  if (shouldTrackHoveredFeatures) {
407
- var _this$_hoveredFeature;
408
382
  const eventType = e.type;
409
- const wasHovering = ((_this$_hoveredFeature = this._hoveredFeatures) === null || _this$_hoveredFeature === void 0 ? void 0 : _this$_hoveredFeature.length) > 0;
383
+ const wasHovering = this._hoveredFeatures?.length > 0;
410
384
  const features = this._queryRenderedFeatures(e.point);
411
385
  const isHovering = features.length > 0;
412
386
  if (!isHovering && wasHovering) {
@@ -423,6 +397,30 @@ export default class Mapbox {
423
397
  this._hoveredFeatures = null;
424
398
  }
425
399
  }
400
+ _onPointerEvent = e => {
401
+ if (e.type === 'mousemove' || e.type === 'mouseout') {
402
+ this._updateHover(e);
403
+ }
404
+ const cb = this.props[pointerEvents[e.type]];
405
+ if (cb) {
406
+ if (this.props.interactiveLayerIds && e.type !== 'mouseover' && e.type !== 'mouseout') {
407
+ e.features = this._hoveredFeatures || this._queryRenderedFeatures(e.point);
408
+ }
409
+ cb(e);
410
+ delete e.features;
411
+ }
412
+ };
413
+ _onCameraEvent = e => {
414
+ if (!this._internalUpdate) {
415
+ const cb = this.props[cameraEvents[e.type]];
416
+ if (cb) {
417
+ cb(e);
418
+ }
419
+ }
420
+ if (e.type in this._deferredEvents) {
421
+ this._deferredEvents[e.type] = false;
422
+ }
423
+ };
426
424
  _fireEvent(baseFire, event, properties) {
427
425
  const map = this._map;
428
426
  const tr = map.transform;
@@ -461,8 +459,6 @@ export default class Mapbox {
461
459
  };
462
460
  }
463
461
  }
464
- _Mapbox = Mapbox;
465
- Mapbox.savedMaps = [];
466
462
  function getAccessTokenFromEnv() {
467
463
  let accessToken = null;
468
464
  if (typeof location !== 'undefined') {
@@ -471,10 +467,10 @@ function getAccessTokenFromEnv() {
471
467
  }
472
468
  try {
473
469
  accessToken = accessToken || process.env.MapboxAccessToken;
474
- } catch (_unused2) {}
470
+ } catch {}
475
471
  try {
476
472
  accessToken = accessToken || process.env.REACT_APP_MAPBOX_ACCESS_TOKEN;
477
- } catch (_unused3) {}
473
+ } catch {}
478
474
  return accessToken;
479
475
  }
480
476
  //# sourceMappingURL=mapbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapbox.js","names":["transformToViewState","applyViewStateToTransform","cloneTransform","syncProjection","normalizeStyle","deepEqual","DEFAULT_STYLE","version","sources","layers","pointerEvents","mousedown","mouseup","mouseover","mousemove","click","dblclick","mouseenter","mouseleave","mouseout","contextmenu","touchstart","touchend","touchmove","touchcancel","cameraEvents","movestart","move","moveend","dragstart","drag","dragend","zoomstart","zoom","zoomend","rotatestart","rotate","rotateend","pitchstart","pitch","pitchend","otherEvents","wheel","boxzoomstart","boxzoomend","boxzoomcancel","resize","load","render","idle","remove","data","styledata","sourcedata","error","settingNames","handlerNames","Mapbox","constructor","MapClass","props","container","_MapClass","_map","_renderTransform","_internalUpdate","_inRender","_hoveredFeatures","_deferredEvents","_onEvent","e","cb","type","console","_onPointerEvent","_updateHover","interactiveLayerIds","features","_queryRenderedFeatures","point","_onCameraEvent","_onAfterRepaint","_initialize","map","transform","setProps","oldProps","settingsChanged","_updateSettings","_createShadowTransform","sizeChanged","_updateSize","viewStateChanged","_updateViewState","_updateStyle","_updateStyleComponents","_updateHandlers","isMoving","redraw","reuse","that","savedMaps","pop","oldContainer","getContainer","className","childNodes","length","appendChild","_container","resizeObserver","_resizeObserver","disconnect","observe","_objectSpread","styleDiffing","initialViewState","bounds","fitBounds","fitBoundsOptions","duration","isStyleLoaded","fire","once","_update","mapStyle","mapOptions","accessToken","mapboxAccessToken","getAccessTokenFromEnv","style","viewState","Object","assign","center","longitude","latitude","bearing","gl","getContext","HTMLCanvasElement","prototype","padding","setPadding","cursor","getCanvas","renderMap","_render","arg","call","runRenderTaskQueue","_renderTaskQueue","run","_onBeforeRepaint","on","fireEvent","_fireEvent","bind","width","height","eventName","recycle","children","querySelector","push","destroy","_frame","cancel","renderTransform","painter","nextProps","triggerEvents","tr","cameraElevationReference","changed","deferredEvents","currProps","propName","setter","toUpperCase","slice","options","diff","localIdeographFontFamily","setStyle","setLight","light","setFog","fog","setTerrain","terrain","getSource","source","_nextProps$propName","_currProps$propName","newValue","oldValue","enable","disable","queryRenderedFeatures","filter","getLayer","_unused","shouldTrackHoveredFeatures","onMouseMove","onMouseEnter","onMouseLeave","_this$_hoveredFeature","eventType","wasHovering","isHovering","baseFire","event","properties","_Mapbox","location","match","exec","search","process","env","MapboxAccessToken","_unused2","REACT_APP_MAPBOX_ACCESS_TOKEN","_unused3"],"sources":["../../src/mapbox/mapbox.ts"],"sourcesContent":["import {\n transformToViewState,\n applyViewStateToTransform,\n cloneTransform,\n syncProjection\n} from '../utils/transform';\nimport {normalizeStyle} from '../utils/style-utils';\nimport {deepEqual} from '../utils/deep-equal';\n\nimport type {\n Transform,\n ViewState,\n ViewStateChangeEvent,\n Point,\n PointLike,\n PaddingOptions,\n MapStyle,\n ImmutableLike,\n LngLatBoundsLike,\n Callbacks,\n MapEvent,\n ErrorEvent,\n MapMouseEvent,\n MapGeoJSONFeature,\n MapInstance,\n MapInstanceInternal\n} from '../types';\n\nexport type MapboxProps<\n StyleT extends MapStyle = MapStyle,\n CallbacksT extends Callbacks = {}\n> = Partial<ViewState> &\n CallbacksT & {\n // Init options\n mapboxAccessToken?: string;\n\n /** Camera options used when constructing the Map instance */\n initialViewState?: Partial<ViewState> & {\n /** The initial bounds of the map. If bounds is specified, it overrides longitude, latitude and zoom options. */\n bounds?: LngLatBoundsLike;\n /** A fitBounds options object to use only when setting the bounds option. */\n fitBoundsOptions?: {\n offset?: PointLike;\n minZoom?: number;\n maxZoom?: number;\n padding?: number | PaddingOptions;\n };\n };\n\n /** If provided, render into an external WebGL context */\n gl?: WebGLRenderingContext;\n\n /** For external controller to override the camera state */\n viewState?: ViewState & {\n width: number;\n height: number;\n };\n\n // Styling\n\n /** Mapbox style */\n mapStyle?: string | StyleT | ImmutableLike<StyleT>;\n /** Enable diffing when the map style changes\n * @default true\n */\n styleDiffing?: boolean;\n /** The fog property of the style. Must conform to the Fog Style Specification .\n * If `undefined` is provided, removes the fog from the map. */\n fog?: StyleT['fog'];\n /** Light properties of the map. */\n light?: StyleT['light'];\n /** Terrain property of the style. Must conform to the Terrain Style Specification .\n * If `undefined` is provided, removes terrain from the map. */\n terrain?: StyleT['terrain'];\n\n /** Default layers to query on pointer events */\n interactiveLayerIds?: string[];\n /** CSS cursor */\n cursor?: string;\n };\n\nconst DEFAULT_STYLE = {version: 8, sources: {}, layers: []} as MapStyle;\n\nconst pointerEvents = {\n mousedown: 'onMouseDown',\n mouseup: 'onMouseUp',\n mouseover: 'onMouseOver',\n mousemove: 'onMouseMove',\n click: 'onClick',\n dblclick: 'onDblClick',\n mouseenter: 'onMouseEnter',\n mouseleave: 'onMouseLeave',\n mouseout: 'onMouseOut',\n contextmenu: 'onContextMenu',\n touchstart: 'onTouchStart',\n touchend: 'onTouchEnd',\n touchmove: 'onTouchMove',\n touchcancel: 'onTouchCancel'\n};\nconst cameraEvents = {\n movestart: 'onMoveStart',\n move: 'onMove',\n moveend: 'onMoveEnd',\n dragstart: 'onDragStart',\n drag: 'onDrag',\n dragend: 'onDragEnd',\n zoomstart: 'onZoomStart',\n zoom: 'onZoom',\n zoomend: 'onZoomEnd',\n rotatestart: 'onRotateStart',\n rotate: 'onRotate',\n rotateend: 'onRotateEnd',\n pitchstart: 'onPitchStart',\n pitch: 'onPitch',\n pitchend: 'onPitchEnd'\n};\nconst otherEvents = {\n wheel: 'onWheel',\n boxzoomstart: 'onBoxZoomStart',\n boxzoomend: 'onBoxZoomEnd',\n boxzoomcancel: 'onBoxZoomCancel',\n resize: 'onResize',\n load: 'onLoad',\n render: 'onRender',\n idle: 'onIdle',\n remove: 'onRemove',\n data: 'onData',\n styledata: 'onStyleData',\n sourcedata: 'onSourceData',\n error: 'onError'\n};\nconst settingNames = [\n 'minZoom',\n 'maxZoom',\n 'minPitch',\n 'maxPitch',\n 'maxBounds',\n 'projection',\n 'renderWorldCopies'\n];\nconst handlerNames = [\n 'scrollZoom',\n 'boxZoom',\n 'dragRotate',\n 'dragPan',\n 'keyboard',\n 'doubleClickZoom',\n 'touchZoomRotate',\n 'touchPitch'\n];\n\n/**\n * A wrapper for mapbox-gl's Map class\n */\nexport default class Mapbox<\n StyleT extends MapStyle = MapStyle,\n CallbacksT extends Callbacks = {},\n MapT extends MapInstance = MapInstance\n> {\n private _MapClass: {new (options: any): MapInstance};\n // mapboxgl.Map instance\n private _map: MapInstanceInternal<MapT> = null;\n // User-supplied props\n props: MapboxProps<StyleT, CallbacksT>;\n\n // Mapbox map is stateful.\n // During method calls/user interactions, map.transform is mutated and\n // deviate from user-supplied props.\n // In order to control the map reactively, we shadow the transform\n // with the one below, which reflects the view state resolved from\n // both user-supplied props and the underlying state\n private _renderTransform: Transform;\n\n // Internal states\n private _internalUpdate: boolean = false;\n private _inRender: boolean = false;\n private _hoveredFeatures: MapGeoJSONFeature[] = null;\n private _deferredEvents: {\n move: boolean;\n zoom: boolean;\n pitch: boolean;\n rotate: boolean;\n } = {\n move: false,\n zoom: false,\n pitch: false,\n rotate: false\n };\n\n static savedMaps: Mapbox[] = [];\n\n constructor(\n MapClass: {new (options: any): MapInstance},\n props: MapboxProps<StyleT, CallbacksT>,\n container: HTMLDivElement\n ) {\n this._MapClass = MapClass;\n this.props = props;\n this._initialize(container);\n }\n\n get map(): MapT {\n return this._map;\n }\n\n get transform(): Transform {\n return this._renderTransform;\n }\n\n setProps(props: MapboxProps<StyleT, CallbacksT>) {\n const oldProps = this.props;\n this.props = props;\n\n const settingsChanged = this._updateSettings(props, oldProps);\n if (settingsChanged) {\n this._createShadowTransform(this._map);\n }\n const sizeChanged = this._updateSize(props);\n const viewStateChanged = this._updateViewState(props, true);\n this._updateStyle(props, oldProps);\n this._updateStyleComponents(props, oldProps);\n this._updateHandlers(props, oldProps);\n\n // If 1) view state has changed to match props and\n // 2) the props change is not triggered by map events,\n // it's driven by an external state change. Redraw immediately\n if (settingsChanged || sizeChanged || (viewStateChanged && !this._map.isMoving())) {\n this.redraw();\n }\n }\n\n static reuse<StyleT extends MapStyle, CallbacksT extends Callbacks, MapT extends MapInstance>(\n props: MapboxProps<StyleT, CallbacksT>,\n container: HTMLDivElement\n ): Mapbox<StyleT, CallbacksT, MapT> {\n const that = Mapbox.savedMaps.pop() as Mapbox<StyleT, CallbacksT, MapT>;\n if (!that) {\n return null;\n }\n\n const map = that.map;\n // When reusing the saved map, we need to reparent the map(canvas) and other child nodes\n // intoto the new container from the props.\n // Step 1: reparenting child nodes from old container to new container\n const oldContainer = map.getContainer();\n container.className = oldContainer.className;\n while (oldContainer.childNodes.length > 0) {\n container.appendChild(oldContainer.childNodes[0]);\n }\n // Step 2: replace the internal container with new container from the react component\n // @ts-ignore\n map._container = container;\n\n // With maplibre-gl as mapLib, map uses ResizeObserver to observe when its container resizes.\n // When reusing the saved map, we need to disconnect the observer and observe the new container.\n // Step 3: telling the ResizeObserver to disconnect and observe the new container\n // @ts-ignore\n const resizeObserver = map._resizeObserver;\n if (resizeObserver) {\n resizeObserver.disconnect();\n resizeObserver.observe(container);\n }\n\n // Step 4: apply new props\n that.setProps({...props, styleDiffing: false});\n map.resize();\n const {initialViewState} = props;\n if (initialViewState) {\n if (initialViewState.bounds) {\n map.fitBounds(initialViewState.bounds, {...initialViewState.fitBoundsOptions, duration: 0});\n } else {\n that._updateViewState(initialViewState, false);\n }\n }\n\n // Simulate load event\n if (map.isStyleLoaded()) {\n map.fire('load');\n } else {\n map.once('styledata', () => map.fire('load'));\n }\n\n // Force reload\n // @ts-ignore\n map._update();\n return that;\n }\n\n /* eslint-disable complexity,max-statements */\n _initialize(container: HTMLDivElement) {\n const {props} = this;\n const {mapStyle = DEFAULT_STYLE} = props;\n const mapOptions = {\n ...props,\n ...props.initialViewState,\n accessToken: props.mapboxAccessToken || getAccessTokenFromEnv() || null,\n container,\n style: normalizeStyle(mapStyle)\n };\n\n const viewState = mapOptions.initialViewState || mapOptions.viewState || mapOptions;\n Object.assign(mapOptions, {\n center: [viewState.longitude || 0, viewState.latitude || 0],\n zoom: viewState.zoom || 0,\n pitch: viewState.pitch || 0,\n bearing: viewState.bearing || 0\n });\n\n if (props.gl) {\n // eslint-disable-next-line\n const getContext = HTMLCanvasElement.prototype.getContext;\n // Hijack canvas.getContext to return our own WebGLContext\n // This will be called inside the mapboxgl.Map constructor\n // @ts-expect-error\n HTMLCanvasElement.prototype.getContext = () => {\n // Unhijack immediately\n HTMLCanvasElement.prototype.getContext = getContext;\n return props.gl;\n };\n }\n\n const map = new this._MapClass(mapOptions) as MapInstanceInternal<MapT>;\n // Props that are not part of constructor options\n if (viewState.padding) {\n map.setPadding(viewState.padding);\n }\n if (props.cursor) {\n map.getCanvas().style.cursor = props.cursor;\n }\n this._createShadowTransform(map);\n\n // Hack\n // Insert code into map's render cycle\n const renderMap = map._render;\n map._render = (arg: number) => {\n this._inRender = true;\n renderMap.call(map, arg);\n this._inRender = false;\n };\n const runRenderTaskQueue = map._renderTaskQueue.run;\n map._renderTaskQueue.run = (arg: number) => {\n runRenderTaskQueue.call(map._renderTaskQueue, arg);\n this._onBeforeRepaint();\n };\n map.on('render', () => this._onAfterRepaint());\n // Insert code into map's event pipeline\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const fireEvent = map.fire;\n map.fire = this._fireEvent.bind(this, fireEvent);\n\n // add listeners\n map.on('resize', () => {\n this._renderTransform.resize(map.transform.width, map.transform.height);\n });\n map.on('styledata', () => {\n this._updateStyleComponents(this.props, {});\n // Projection can be set in stylesheet\n syncProjection(map.transform, this._renderTransform);\n });\n map.on('sourcedata', () => this._updateStyleComponents(this.props, {}));\n for (const eventName in pointerEvents) {\n map.on(eventName, this._onPointerEvent);\n }\n for (const eventName in cameraEvents) {\n map.on(eventName, this._onCameraEvent);\n }\n for (const eventName in otherEvents) {\n map.on(eventName, this._onEvent);\n }\n this._map = map;\n }\n /* eslint-enable complexity,max-statements */\n\n recycle() {\n // Clean up unnecessary elements before storing for reuse.\n const container = this.map.getContainer();\n const children = container.querySelector('[mapboxgl-children]');\n children?.remove();\n\n Mapbox.savedMaps.push(this);\n }\n\n destroy() {\n this._map.remove();\n }\n\n // Force redraw the map now. Typically resize() and jumpTo() is reflected in the next\n // render cycle, which is managed by Mapbox's animation loop.\n // This removes the synchronization issue caused by requestAnimationFrame.\n redraw() {\n const map = this._map as any;\n // map._render will throw error if style does not exist\n // https://github.com/mapbox/mapbox-gl-js/blob/fb9fc316da14e99ff4368f3e4faa3888fb43c513\n // /src/ui/map.js#L1834\n if (!this._inRender && map.style) {\n // cancel the scheduled update\n if (map._frame) {\n map._frame.cancel();\n map._frame = null;\n }\n // the order is important - render() may schedule another update\n map._render();\n }\n }\n\n _createShadowTransform(map: any) {\n const renderTransform = cloneTransform(map.transform);\n map.painter.transform = renderTransform;\n\n this._renderTransform = renderTransform;\n }\n\n /* Trigger map resize if size is controlled\n @param {object} nextProps\n @returns {bool} true if size has changed\n */\n _updateSize(nextProps: MapboxProps<StyleT>): boolean {\n // Check if size is controlled\n const {viewState} = nextProps;\n if (viewState) {\n const map = this._map;\n if (viewState.width !== map.transform.width || viewState.height !== map.transform.height) {\n map.resize();\n return true;\n }\n }\n return false;\n }\n\n // Adapted from map.jumpTo\n /* Update camera to match props\n @param {object} nextProps\n @param {bool} triggerEvents - should fire camera events\n @returns {bool} true if anything is changed\n */\n _updateViewState(nextProps: MapboxProps<StyleT>, triggerEvents: boolean): boolean {\n if (this._internalUpdate) {\n return false;\n }\n const map = this._map;\n\n const tr = this._renderTransform;\n // Take a snapshot of the transform before mutation\n const {zoom, pitch, bearing} = tr;\n const isMoving = map.isMoving();\n\n if (isMoving) {\n // All movement of the camera is done relative to the sea level\n tr.cameraElevationReference = 'sea';\n }\n const changed = applyViewStateToTransform(tr, {\n ...transformToViewState(map.transform),\n ...nextProps\n });\n if (isMoving) {\n // Reset camera reference\n tr.cameraElevationReference = 'ground';\n }\n\n if (changed && triggerEvents) {\n const deferredEvents = this._deferredEvents;\n // Delay DOM control updates to the next render cycle\n deferredEvents.move = true;\n deferredEvents.zoom ||= zoom !== tr.zoom;\n deferredEvents.rotate ||= bearing !== tr.bearing;\n deferredEvents.pitch ||= pitch !== tr.pitch;\n }\n\n // Avoid manipulating the real transform when interaction/animation is ongoing\n // as it would interfere with Mapbox's handlers\n if (!isMoving) {\n applyViewStateToTransform(map.transform, nextProps);\n }\n\n return changed;\n }\n\n /* Update camera constraints and projection settings to match props\n @param {object} nextProps\n @param {object} currProps\n @returns {bool} true if anything is changed\n */\n _updateSettings(nextProps: MapboxProps<StyleT>, currProps: MapboxProps<StyleT>): boolean {\n const map = this._map;\n let changed = false;\n for (const propName of settingNames) {\n if (propName in nextProps && !deepEqual(nextProps[propName], currProps[propName])) {\n changed = true;\n const setter = map[`set${propName[0].toUpperCase()}${propName.slice(1)}`];\n setter?.call(map, nextProps[propName]);\n }\n }\n return changed;\n }\n\n /* Update map style to match props\n @param {object} nextProps\n @param {object} currProps\n @returns {bool} true if style is changed\n */\n _updateStyle(nextProps: MapboxProps<StyleT>, currProps: MapboxProps<StyleT>): boolean {\n if (nextProps.cursor !== currProps.cursor) {\n this._map.getCanvas().style.cursor = nextProps.cursor || '';\n }\n if (nextProps.mapStyle !== currProps.mapStyle) {\n const {mapStyle = DEFAULT_STYLE, styleDiffing = true} = nextProps;\n const options: any = {\n diff: styleDiffing\n };\n if ('localIdeographFontFamily' in nextProps) {\n // @ts-ignore Mapbox specific prop\n options.localIdeographFontFamily = nextProps.localIdeographFontFamily;\n }\n this._map.setStyle(normalizeStyle(mapStyle), options);\n return true;\n }\n return false;\n }\n\n /* Update fog, light and terrain to match props\n @param {object} nextProps\n @param {object} currProps\n @returns {bool} true if anything is changed\n */\n _updateStyleComponents(nextProps: MapboxProps<StyleT>, currProps: MapboxProps<StyleT>): boolean {\n const map = this._map;\n let changed = false;\n if (map.isStyleLoaded()) {\n if ('light' in nextProps && map.setLight && !deepEqual(nextProps.light, currProps.light)) {\n changed = true;\n map.setLight(nextProps.light);\n }\n if ('fog' in nextProps && map.setFog && !deepEqual(nextProps.fog, currProps.fog)) {\n changed = true;\n map.setFog(nextProps.fog);\n }\n if (\n 'terrain' in nextProps &&\n map.setTerrain &&\n !deepEqual(nextProps.terrain, currProps.terrain)\n ) {\n if (!nextProps.terrain || map.getSource(nextProps.terrain.source)) {\n changed = true;\n map.setTerrain(nextProps.terrain);\n }\n }\n }\n return changed;\n }\n\n /* Update interaction handlers to match props\n @param {object} nextProps\n @param {object} currProps\n @returns {bool} true if anything is changed\n */\n _updateHandlers(nextProps: MapboxProps<StyleT>, currProps: MapboxProps<StyleT>): boolean {\n const map = this._map;\n let changed = false;\n for (const propName of handlerNames) {\n const newValue = nextProps[propName] ?? true;\n const oldValue = currProps[propName] ?? true;\n if (!deepEqual(newValue, oldValue)) {\n changed = true;\n if (newValue) {\n map[propName].enable(newValue);\n } else {\n map[propName].disable();\n }\n }\n }\n return changed;\n }\n\n _onEvent = (e: MapEvent<MapT>) => {\n // @ts-ignore\n const cb = this.props[otherEvents[e.type]];\n if (cb) {\n cb(e);\n } else if (e.type === 'error') {\n console.error((e as ErrorEvent<MapT>).error); // eslint-disable-line\n }\n };\n\n private _queryRenderedFeatures(point: Point) {\n const map = this._map;\n const tr = map.transform;\n const {interactiveLayerIds = []} = this.props;\n try {\n map.transform = this._renderTransform;\n return map.queryRenderedFeatures(point, {\n layers: interactiveLayerIds.filter(map.getLayer.bind(map))\n });\n } catch {\n // May fail if style is not loaded\n return [];\n } finally {\n map.transform = tr;\n }\n }\n\n _updateHover(e: MapMouseEvent<MapT>) {\n const {props} = this;\n const shouldTrackHoveredFeatures =\n props.interactiveLayerIds && (props.onMouseMove || props.onMouseEnter || props.onMouseLeave);\n\n if (shouldTrackHoveredFeatures) {\n const eventType = e.type;\n const wasHovering = this._hoveredFeatures?.length > 0;\n const features = this._queryRenderedFeatures(e.point);\n const isHovering = features.length > 0;\n\n if (!isHovering && wasHovering) {\n e.type = 'mouseleave';\n this._onPointerEvent(e);\n }\n this._hoveredFeatures = features;\n if (isHovering && !wasHovering) {\n e.type = 'mouseenter';\n this._onPointerEvent(e);\n }\n e.type = eventType;\n } else {\n this._hoveredFeatures = null;\n }\n }\n\n _onPointerEvent = (e: MapMouseEvent<MapT> | MapMouseEvent<MapT>) => {\n if (e.type === 'mousemove' || e.type === 'mouseout') {\n this._updateHover(e);\n }\n\n // @ts-ignore\n const cb = this.props[pointerEvents[e.type]];\n if (cb) {\n if (this.props.interactiveLayerIds && e.type !== 'mouseover' && e.type !== 'mouseout') {\n e.features = this._hoveredFeatures || this._queryRenderedFeatures(e.point);\n }\n cb(e);\n delete e.features;\n }\n };\n\n _onCameraEvent = (e: ViewStateChangeEvent<MapT>) => {\n if (!this._internalUpdate) {\n // @ts-ignore\n const cb = this.props[cameraEvents[e.type]];\n if (cb) {\n cb(e);\n }\n }\n if (e.type in this._deferredEvents) {\n this._deferredEvents[e.type] = false;\n }\n };\n\n _fireEvent(baseFire: Function, event: string | MapEvent<MapT>, properties?: object) {\n const map = this._map;\n const tr = map.transform;\n\n const eventType = typeof event === 'string' ? event : event.type;\n if (eventType === 'move') {\n this._updateViewState(this.props, false);\n }\n if (eventType in cameraEvents) {\n if (typeof event === 'object') {\n (event as unknown as ViewStateChangeEvent<MapT>).viewState = transformToViewState(tr);\n }\n if (this._map.isMoving()) {\n // Replace map.transform with ours during the callbacks\n map.transform = this._renderTransform;\n baseFire.call(map, event, properties);\n map.transform = tr;\n\n return map;\n }\n }\n baseFire.call(map, event, properties);\n\n return map;\n }\n\n // All camera manipulations are complete, ready to repaint\n _onBeforeRepaint() {\n const map = this._map;\n\n // If there are camera changes driven by props, invoke camera events so that DOM controls are synced\n this._internalUpdate = true;\n for (const eventType in this._deferredEvents) {\n if (this._deferredEvents[eventType]) {\n map.fire(eventType);\n }\n }\n this._internalUpdate = false;\n\n const tr = this._map.transform;\n // Make sure camera matches the current props\n map.transform = this._renderTransform;\n\n this._onAfterRepaint = () => {\n // Mapbox transitions between non-mercator projection and mercator during render time\n // Copy it back to the other\n syncProjection(this._renderTransform, tr);\n // Restores camera state before render/load events are fired\n map.transform = tr;\n };\n }\n\n _onAfterRepaint: () => void;\n}\n\n/**\n * Access token can be provided via one of:\n * mapboxAccessToken prop\n * access_token query parameter\n * MapboxAccessToken environment variable\n * REACT_APP_MAPBOX_ACCESS_TOKEN environment variable\n * @returns access token\n */\nfunction getAccessTokenFromEnv(): string {\n let accessToken = null;\n\n /* global location, process */\n if (typeof location !== 'undefined') {\n const match = /access_token=([^&\\/]*)/.exec(location.search);\n accessToken = match && match[1];\n }\n\n // Note: This depends on bundler plugins (e.g. webpack) importing environment correctly\n try {\n accessToken = accessToken || process.env.MapboxAccessToken;\n } catch {\n // ignore\n }\n\n try {\n accessToken = accessToken || process.env.REACT_APP_MAPBOX_ACCESS_TOKEN;\n } catch {\n // ignore\n }\n\n return accessToken;\n}\n"],"mappings":";;;;SACEA,oBAAoB,EACpBC,yBAAyB,EACzBC,cAAc,EACdC,cAAc;AAAA,SAERC,cAAc;AAAA,SACdC,SAAS;AA0EjB,MAAMC,aAAa,GAAG;EAACC,OAAO,EAAE,CAAC;EAAEC,OAAO,EAAE,CAAC,CAAC;EAAEC,MAAM,EAAE;AAAE,CAAa;AAEvE,MAAMC,aAAa,GAAG;EACpBC,SAAS,EAAE,aAAa;EACxBC,OAAO,EAAE,WAAW;EACpBC,SAAS,EAAE,aAAa;EACxBC,SAAS,EAAE,aAAa;EACxBC,KAAK,EAAE,SAAS;EAChBC,QAAQ,EAAE,YAAY;EACtBC,UAAU,EAAE,cAAc;EAC1BC,UAAU,EAAE,cAAc;EAC1BC,QAAQ,EAAE,YAAY;EACtBC,WAAW,EAAE,eAAe;EAC5BC,UAAU,EAAE,cAAc;EAC1BC,QAAQ,EAAE,YAAY;EACtBC,SAAS,EAAE,aAAa;EACxBC,WAAW,EAAE;AACf,CAAC;AACD,MAAMC,YAAY,GAAG;EACnBC,SAAS,EAAE,aAAa;EACxBC,IAAI,EAAE,QAAQ;EACdC,OAAO,EAAE,WAAW;EACpBC,SAAS,EAAE,aAAa;EACxBC,IAAI,EAAE,QAAQ;EACdC,OAAO,EAAE,WAAW;EACpBC,SAAS,EAAE,aAAa;EACxBC,IAAI,EAAE,QAAQ;EACdC,OAAO,EAAE,WAAW;EACpBC,WAAW,EAAE,eAAe;EAC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,GAAGA,WAAW,IAAI4F,OAAO,CAACC,GAAG,CAACC,iBAAiB;EAC5D,CAAC,CAAC,OAAAC,QAAA,EAAM,CAER;EAEA,IAAI;IACF/F,WAAW,GAAGA,WAAW,IAAI4F,OAAO,CAACC,GAAG,CAACG,6BAA6B;EACxE,CAAC,CAAC,OAAAC,QAAA,EAAM,CAER;EAEA,OAAOjG,WAAW;AACpB","ignoreList":[]}
1
+ {"version":3,"file":"mapbox.js","names":["transformToViewState","applyViewStateToTransform","cloneTransform","syncProjection","normalizeStyle","deepEqual","DEFAULT_STYLE","version","sources","layers","pointerEvents","mousedown","mouseup","mouseover","mousemove","click","dblclick","mouseenter","mouseleave","mouseout","contextmenu","touchstart","touchend","touchmove","touchcancel","cameraEvents","movestart","move","moveend","dragstart","drag","dragend","zoomstart","zoom","zoomend","rotatestart","rotate","rotateend","pitchstart","pitch","pitchend","otherEvents","wheel","boxzoomstart","boxzoomend","boxzoomcancel","resize","load","render","idle","remove","data","styledata","sourcedata","error","settingNames","handlerNames","Mapbox","_map","_internalUpdate","_inRender","_hoveredFeatures","_deferredEvents","savedMaps","constructor","MapClass","props","container","_MapClass","_initialize","map","transform","_renderTransform","setProps","oldProps","settingsChanged","_updateSettings","_createShadowTransform","sizeChanged","_updateSize","viewStateChanged","_updateViewState","_updateStyle","_updateStyleComponents","_updateHandlers","isMoving","redraw","reuse","that","pop","oldContainer","getContainer","className","childNodes","length","appendChild","_container","resizeObserver","_resizeObserver","disconnect","observe","styleDiffing","initialViewState","bounds","fitBounds","fitBoundsOptions","duration","isStyleLoaded","fire","once","_update","mapStyle","mapOptions","accessToken","mapboxAccessToken","getAccessTokenFromEnv","style","viewState","Object","assign","center","longitude","latitude","bearing","gl","getContext","HTMLCanvasElement","prototype","padding","setPadding","cursor","getCanvas","renderMap","_render","arg","call","runRenderTaskQueue","_renderTaskQueue","run","_onBeforeRepaint","on","_onAfterRepaint","fireEvent","_fireEvent","bind","width","height","eventName","_onPointerEvent","_onCameraEvent","_onEvent","recycle","children","querySelector","push","destroy","_frame","cancel","renderTransform","painter","nextProps","triggerEvents","tr","cameraElevationReference","changed","deferredEvents","currProps","propName","setter","toUpperCase","slice","options","diff","localIdeographFontFamily","setStyle","setLight","light","setFog","fog","setTerrain","terrain","getSource","source","newValue","oldValue","enable","disable","e","cb","type","console","_queryRenderedFeatures","point","interactiveLayerIds","queryRenderedFeatures","filter","getLayer","_updateHover","shouldTrackHoveredFeatures","onMouseMove","onMouseEnter","onMouseLeave","eventType","wasHovering","features","isHovering","baseFire","event","properties","location","match","exec","search","process","env","MapboxAccessToken","REACT_APP_MAPBOX_ACCESS_TOKEN"],"sources":["../../src/mapbox/mapbox.ts"],"sourcesContent":["import {\n transformToViewState,\n applyViewStateToTransform,\n cloneTransform,\n syncProjection\n} from '../utils/transform';\nimport {normalizeStyle} from '../utils/style-utils';\nimport {deepEqual} from '../utils/deep-equal';\n\nimport type {\n Transform,\n ViewState,\n ViewStateChangeEvent,\n Point,\n PointLike,\n PaddingOptions,\n MapStyle,\n ImmutableLike,\n LngLatBoundsLike,\n Callbacks,\n MapEvent,\n ErrorEvent,\n MapMouseEvent,\n MapGeoJSONFeature,\n MapInstance,\n MapInstanceInternal\n} from '../types';\n\nexport type MapboxProps<\n StyleT extends MapStyle = MapStyle,\n CallbacksT extends Callbacks = {}\n> = Partial<ViewState> &\n CallbacksT & {\n // Init options\n mapboxAccessToken?: string;\n\n /** Camera options used when constructing the Map instance */\n initialViewState?: Partial<ViewState> & {\n /** The initial bounds of the map. If bounds is specified, it overrides longitude, latitude and zoom options. */\n bounds?: LngLatBoundsLike;\n /** A fitBounds options object to use only when setting the bounds option. */\n fitBoundsOptions?: {\n offset?: PointLike;\n minZoom?: number;\n maxZoom?: number;\n padding?: number | PaddingOptions;\n };\n };\n\n /** If provided, render into an external WebGL context */\n gl?: WebGLRenderingContext;\n\n /** For external controller to override the camera state */\n viewState?: ViewState & {\n width: number;\n height: number;\n };\n\n // Styling\n\n /** Mapbox style */\n mapStyle?: string | StyleT | ImmutableLike<StyleT>;\n /** Enable diffing when the map style changes\n * @default true\n */\n styleDiffing?: boolean;\n /** The fog property of the style. Must conform to the Fog Style Specification .\n * If `undefined` is provided, removes the fog from the map. */\n fog?: StyleT['fog'];\n /** Light properties of the map. */\n light?: StyleT['light'];\n /** Terrain property of the style. Must conform to the Terrain Style Specification .\n * If `undefined` is provided, removes terrain from the map. */\n terrain?: StyleT['terrain'];\n\n /** Default layers to query on pointer events */\n interactiveLayerIds?: string[];\n /** CSS cursor */\n cursor?: string;\n };\n\nconst DEFAULT_STYLE = {version: 8, sources: {}, layers: []} as MapStyle;\n\nconst pointerEvents = {\n mousedown: 'onMouseDown',\n mouseup: 'onMouseUp',\n mouseover: 'onMouseOver',\n mousemove: 'onMouseMove',\n click: 'onClick',\n dblclick: 'onDblClick',\n mouseenter: 'onMouseEnter',\n mouseleave: 'onMouseLeave',\n mouseout: 'onMouseOut',\n contextmenu: 'onContextMenu',\n touchstart: 'onTouchStart',\n touchend: 'onTouchEnd',\n touchmove: 'onTouchMove',\n touchcancel: 'onTouchCancel'\n};\nconst cameraEvents = {\n movestart: 'onMoveStart',\n move: 'onMove',\n moveend: 'onMoveEnd',\n dragstart: 'onDragStart',\n drag: 'onDrag',\n dragend: 'onDragEnd',\n zoomstart: 'onZoomStart',\n zoom: 'onZoom',\n zoomend: 'onZoomEnd',\n rotatestart: 'onRotateStart',\n rotate: 'onRotate',\n rotateend: 'onRotateEnd',\n pitchstart: 'onPitchStart',\n pitch: 'onPitch',\n pitchend: 'onPitchEnd'\n};\nconst otherEvents = {\n wheel: 'onWheel',\n boxzoomstart: 'onBoxZoomStart',\n boxzoomend: 'onBoxZoomEnd',\n boxzoomcancel: 'onBoxZoomCancel',\n resize: 'onResize',\n load: 'onLoad',\n render: 'onRender',\n idle: 'onIdle',\n remove: 'onRemove',\n data: 'onData',\n styledata: 'onStyleData',\n sourcedata: 'onSourceData',\n error: 'onError'\n};\nconst settingNames = [\n 'minZoom',\n 'maxZoom',\n 'minPitch',\n 'maxPitch',\n 'maxBounds',\n 'projection',\n 'renderWorldCopies'\n];\nconst handlerNames = [\n 'scrollZoom',\n 'boxZoom',\n 'dragRotate',\n 'dragPan',\n 'keyboard',\n 'doubleClickZoom',\n 'touchZoomRotate',\n 'touchPitch'\n];\n\n/**\n * A wrapper for mapbox-gl's Map class\n */\nexport default class Mapbox<\n StyleT extends MapStyle = MapStyle,\n CallbacksT extends Callbacks = {},\n MapT extends MapInstance = MapInstance\n> {\n private _MapClass: {new (options: any): MapInstance};\n // mapboxgl.Map instance\n private _map: MapInstanceInternal<MapT> = null;\n // User-supplied props\n props: MapboxProps<StyleT, CallbacksT>;\n\n // Mapbox map is stateful.\n // During method calls/user interactions, map.transform is mutated and\n // deviate from user-supplied props.\n // In order to control the map reactively, we shadow the transform\n // with the one below, which reflects the view state resolved from\n // both user-supplied props and the underlying state\n private _renderTransform: Transform;\n\n // Internal states\n private _internalUpdate: boolean = false;\n private _inRender: boolean = false;\n private _hoveredFeatures: MapGeoJSONFeature[] = null;\n private _deferredEvents: {\n move: boolean;\n zoom: boolean;\n pitch: boolean;\n rotate: boolean;\n } = {\n move: false,\n zoom: false,\n pitch: false,\n rotate: false\n };\n\n static savedMaps: Mapbox[] = [];\n\n constructor(\n MapClass: {new (options: any): MapInstance},\n props: MapboxProps<StyleT, CallbacksT>,\n container: HTMLDivElement\n ) {\n this._MapClass = MapClass;\n this.props = props;\n this._initialize(container);\n }\n\n get map(): MapT {\n return this._map;\n }\n\n get transform(): Transform {\n return this._renderTransform;\n }\n\n setProps(props: MapboxProps<StyleT, CallbacksT>) {\n const oldProps = this.props;\n this.props = props;\n\n const settingsChanged = this._updateSettings(props, oldProps);\n if (settingsChanged) {\n this._createShadowTransform(this._map);\n }\n const sizeChanged = this._updateSize(props);\n const viewStateChanged = this._updateViewState(props, true);\n this._updateStyle(props, oldProps);\n this._updateStyleComponents(props, oldProps);\n this._updateHandlers(props, oldProps);\n\n // If 1) view state has changed to match props and\n // 2) the props change is not triggered by map events,\n // it's driven by an external state change. Redraw immediately\n if (settingsChanged || sizeChanged || (viewStateChanged && !this._map.isMoving())) {\n this.redraw();\n }\n }\n\n static reuse<StyleT extends MapStyle, CallbacksT extends Callbacks, MapT extends MapInstance>(\n props: MapboxProps<StyleT, CallbacksT>,\n container: HTMLDivElement\n ): Mapbox<StyleT, CallbacksT, MapT> {\n const that = Mapbox.savedMaps.pop() as Mapbox<StyleT, CallbacksT, MapT>;\n if (!that) {\n return null;\n }\n\n const map = that.map;\n // When reusing the saved map, we need to reparent the map(canvas) and other child nodes\n // intoto the new container from the props.\n // Step 1: reparenting child nodes from old container to new container\n const oldContainer = map.getContainer();\n container.className = oldContainer.className;\n while (oldContainer.childNodes.length > 0) {\n container.appendChild(oldContainer.childNodes[0]);\n }\n // Step 2: replace the internal container with new container from the react component\n // @ts-ignore\n map._container = container;\n\n // With maplibre-gl as mapLib, map uses ResizeObserver to observe when its container resizes.\n // When reusing the saved map, we need to disconnect the observer and observe the new container.\n // Step 3: telling the ResizeObserver to disconnect and observe the new container\n // @ts-ignore\n const resizeObserver = map._resizeObserver;\n if (resizeObserver) {\n resizeObserver.disconnect();\n resizeObserver.observe(container);\n }\n\n // Step 4: apply new props\n that.setProps({...props, styleDiffing: false});\n map.resize();\n const {initialViewState} = props;\n if (initialViewState) {\n if (initialViewState.bounds) {\n map.fitBounds(initialViewState.bounds, {...initialViewState.fitBoundsOptions, duration: 0});\n } else {\n that._updateViewState(initialViewState, false);\n }\n }\n\n // Simulate load event\n if (map.isStyleLoaded()) {\n map.fire('load');\n } else {\n map.once('styledata', () => map.fire('load'));\n }\n\n // Force reload\n // @ts-ignore\n map._update();\n return that;\n }\n\n /* eslint-disable complexity,max-statements */\n _initialize(container: HTMLDivElement) {\n const {props} = this;\n const {mapStyle = DEFAULT_STYLE} = props;\n const mapOptions = {\n ...props,\n ...props.initialViewState,\n accessToken: props.mapboxAccessToken || getAccessTokenFromEnv() || null,\n container,\n style: normalizeStyle(mapStyle)\n };\n\n const viewState = mapOptions.initialViewState || mapOptions.viewState || mapOptions;\n Object.assign(mapOptions, {\n center: [viewState.longitude || 0, viewState.latitude || 0],\n zoom: viewState.zoom || 0,\n pitch: viewState.pitch || 0,\n bearing: viewState.bearing || 0\n });\n\n if (props.gl) {\n // eslint-disable-next-line\n const getContext = HTMLCanvasElement.prototype.getContext;\n // Hijack canvas.getContext to return our own WebGLContext\n // This will be called inside the mapboxgl.Map constructor\n // @ts-expect-error\n HTMLCanvasElement.prototype.getContext = () => {\n // Unhijack immediately\n HTMLCanvasElement.prototype.getContext = getContext;\n return props.gl;\n };\n }\n\n const map = new this._MapClass(mapOptions) as MapInstanceInternal<MapT>;\n // Props that are not part of constructor options\n if (viewState.padding) {\n map.setPadding(viewState.padding);\n }\n if (props.cursor) {\n map.getCanvas().style.cursor = props.cursor;\n }\n this._createShadowTransform(map);\n\n // Hack\n // Insert code into map's render cycle\n const renderMap = map._render;\n map._render = (arg: number) => {\n this._inRender = true;\n renderMap.call(map, arg);\n this._inRender = false;\n };\n const runRenderTaskQueue = map._renderTaskQueue.run;\n map._renderTaskQueue.run = (arg: number) => {\n runRenderTaskQueue.call(map._renderTaskQueue, arg);\n this._onBeforeRepaint();\n };\n map.on('render', () => this._onAfterRepaint());\n // Insert code into map's event pipeline\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const fireEvent = map.fire;\n map.fire = this._fireEvent.bind(this, fireEvent);\n\n // add listeners\n map.on('resize', () => {\n this._renderTransform.resize(map.transform.width, map.transform.height);\n });\n map.on('styledata', () => {\n this._updateStyleComponents(this.props, {});\n // Projection can be set in stylesheet\n syncProjection(map.transform, this._renderTransform);\n });\n map.on('sourcedata', () => this._updateStyleComponents(this.props, {}));\n for (const eventName in pointerEvents) {\n map.on(eventName, this._onPointerEvent);\n }\n for (const eventName in cameraEvents) {\n map.on(eventName, this._onCameraEvent);\n }\n for (const eventName in otherEvents) {\n map.on(eventName, this._onEvent);\n }\n this._map = map;\n }\n /* eslint-enable complexity,max-statements */\n\n recycle() {\n // Clean up unnecessary elements before storing for reuse.\n const container = this.map.getContainer();\n const children = container.querySelector('[mapboxgl-children]');\n children?.remove();\n\n Mapbox.savedMaps.push(this);\n }\n\n destroy() {\n this._map.remove();\n }\n\n // Force redraw the map now. Typically resize() and jumpTo() is reflected in the next\n // render cycle, which is managed by Mapbox's animation loop.\n // This removes the synchronization issue caused by requestAnimationFrame.\n redraw() {\n const map = this._map as any;\n // map._render will throw error if style does not exist\n // https://github.com/mapbox/mapbox-gl-js/blob/fb9fc316da14e99ff4368f3e4faa3888fb43c513\n // /src/ui/map.js#L1834\n if (!this._inRender && map.style) {\n // cancel the scheduled update\n if (map._frame) {\n map._frame.cancel();\n map._frame = null;\n }\n // the order is important - render() may schedule another update\n map._render();\n }\n }\n\n _createShadowTransform(map: any) {\n const renderTransform = cloneTransform(map.transform);\n map.painter.transform = renderTransform;\n\n this._renderTransform = renderTransform;\n }\n\n /* Trigger map resize if size is controlled\n @param {object} nextProps\n @returns {bool} true if size has changed\n */\n _updateSize(nextProps: MapboxProps<StyleT>): boolean {\n // Check if size is controlled\n const {viewState} = nextProps;\n if (viewState) {\n const map = this._map;\n if (viewState.width !== map.transform.width || viewState.height !== map.transform.height) {\n map.resize();\n return true;\n }\n }\n return false;\n }\n\n // Adapted from map.jumpTo\n /* Update camera to match props\n @param {object} nextProps\n @param {bool} triggerEvents - should fire camera events\n @returns {bool} true if anything is changed\n */\n _updateViewState(nextProps: MapboxProps<StyleT>, triggerEvents: boolean): boolean {\n if (this._internalUpdate) {\n return false;\n }\n const map = this._map;\n\n const tr = this._renderTransform;\n // Take a snapshot of the transform before mutation\n const {zoom, pitch, bearing} = tr;\n const isMoving = map.isMoving();\n\n if (isMoving) {\n // All movement of the camera is done relative to the sea level\n tr.cameraElevationReference = 'sea';\n }\n const changed = applyViewStateToTransform(tr, {\n ...transformToViewState(map.transform),\n ...nextProps\n });\n if (isMoving) {\n // Reset camera reference\n tr.cameraElevationReference = 'ground';\n }\n\n if (changed && triggerEvents) {\n const deferredEvents = this._deferredEvents;\n // Delay DOM control updates to the next render cycle\n deferredEvents.move = true;\n deferredEvents.zoom ||= zoom !== tr.zoom;\n deferredEvents.rotate ||= bearing !== tr.bearing;\n deferredEvents.pitch ||= pitch !== tr.pitch;\n }\n\n // Avoid manipulating the real transform when interaction/animation is ongoing\n // as it would interfere with Mapbox's handlers\n if (!isMoving) {\n applyViewStateToTransform(map.transform, nextProps);\n }\n\n return changed;\n }\n\n /* Update camera constraints and projection settings to match props\n @param {object} nextProps\n @param {object} currProps\n @returns {bool} true if anything is changed\n */\n _updateSettings(nextProps: MapboxProps<StyleT>, currProps: MapboxProps<StyleT>): boolean {\n const map = this._map;\n let changed = false;\n for (const propName of settingNames) {\n if (propName in nextProps && !deepEqual(nextProps[propName], currProps[propName])) {\n changed = true;\n const setter = map[`set${propName[0].toUpperCase()}${propName.slice(1)}`];\n setter?.call(map, nextProps[propName]);\n }\n }\n return changed;\n }\n\n /* Update map style to match props\n @param {object} nextProps\n @param {object} currProps\n @returns {bool} true if style is changed\n */\n _updateStyle(nextProps: MapboxProps<StyleT>, currProps: MapboxProps<StyleT>): boolean {\n if (nextProps.cursor !== currProps.cursor) {\n this._map.getCanvas().style.cursor = nextProps.cursor || '';\n }\n if (nextProps.mapStyle !== currProps.mapStyle) {\n const {mapStyle = DEFAULT_STYLE, styleDiffing = true} = nextProps;\n const options: any = {\n diff: styleDiffing\n };\n if ('localIdeographFontFamily' in nextProps) {\n // @ts-ignore Mapbox specific prop\n options.localIdeographFontFamily = nextProps.localIdeographFontFamily;\n }\n this._map.setStyle(normalizeStyle(mapStyle), options);\n return true;\n }\n return false;\n }\n\n /* Update fog, light and terrain to match props\n @param {object} nextProps\n @param {object} currProps\n @returns {bool} true if anything is changed\n */\n _updateStyleComponents(nextProps: MapboxProps<StyleT>, currProps: MapboxProps<StyleT>): boolean {\n const map = this._map;\n let changed = false;\n if (map.isStyleLoaded()) {\n if ('light' in nextProps && map.setLight && !deepEqual(nextProps.light, currProps.light)) {\n changed = true;\n map.setLight(nextProps.light);\n }\n if ('fog' in nextProps && map.setFog && !deepEqual(nextProps.fog, currProps.fog)) {\n changed = true;\n map.setFog(nextProps.fog);\n }\n if (\n 'terrain' in nextProps &&\n map.setTerrain &&\n !deepEqual(nextProps.terrain, currProps.terrain)\n ) {\n if (!nextProps.terrain || map.getSource(nextProps.terrain.source)) {\n changed = true;\n map.setTerrain(nextProps.terrain);\n }\n }\n }\n return changed;\n }\n\n /* Update interaction handlers to match props\n @param {object} nextProps\n @param {object} currProps\n @returns {bool} true if anything is changed\n */\n _updateHandlers(nextProps: MapboxProps<StyleT>, currProps: MapboxProps<StyleT>): boolean {\n const map = this._map;\n let changed = false;\n for (const propName of handlerNames) {\n const newValue = nextProps[propName] ?? true;\n const oldValue = currProps[propName] ?? true;\n if (!deepEqual(newValue, oldValue)) {\n changed = true;\n if (newValue) {\n map[propName].enable(newValue);\n } else {\n map[propName].disable();\n }\n }\n }\n return changed;\n }\n\n _onEvent = (e: MapEvent<MapT>) => {\n // @ts-ignore\n const cb = this.props[otherEvents[e.type]];\n if (cb) {\n cb(e);\n } else if (e.type === 'error') {\n console.error((e as ErrorEvent<MapT>).error); // eslint-disable-line\n }\n };\n\n private _queryRenderedFeatures(point: Point) {\n const map = this._map;\n const tr = map.transform;\n const {interactiveLayerIds = []} = this.props;\n try {\n map.transform = this._renderTransform;\n return map.queryRenderedFeatures(point, {\n layers: interactiveLayerIds.filter(map.getLayer.bind(map))\n });\n } catch {\n // May fail if style is not loaded\n return [];\n } finally {\n map.transform = tr;\n }\n }\n\n _updateHover(e: MapMouseEvent<MapT>) {\n const {props} = this;\n const shouldTrackHoveredFeatures =\n props.interactiveLayerIds && (props.onMouseMove || props.onMouseEnter || props.onMouseLeave);\n\n if (shouldTrackHoveredFeatures) {\n const eventType = e.type;\n const wasHovering = this._hoveredFeatures?.length > 0;\n const features = this._queryRenderedFeatures(e.point);\n const isHovering = features.length > 0;\n\n if (!isHovering && wasHovering) {\n e.type = 'mouseleave';\n this._onPointerEvent(e);\n }\n this._hoveredFeatures = features;\n if (isHovering && !wasHovering) {\n e.type = 'mouseenter';\n this._onPointerEvent(e);\n }\n e.type = eventType;\n } else {\n this._hoveredFeatures = null;\n }\n }\n\n _onPointerEvent = (e: MapMouseEvent<MapT> | MapMouseEvent<MapT>) => {\n if (e.type === 'mousemove' || e.type === 'mouseout') {\n this._updateHover(e);\n }\n\n // @ts-ignore\n const cb = this.props[pointerEvents[e.type]];\n if (cb) {\n if (this.props.interactiveLayerIds && e.type !== 'mouseover' && e.type !== 'mouseout') {\n e.features = this._hoveredFeatures || this._queryRenderedFeatures(e.point);\n }\n cb(e);\n delete e.features;\n }\n };\n\n _onCameraEvent = (e: ViewStateChangeEvent<MapT>) => {\n if (!this._internalUpdate) {\n // @ts-ignore\n const cb = this.props[cameraEvents[e.type]];\n if (cb) {\n cb(e);\n }\n }\n if (e.type in this._deferredEvents) {\n this._deferredEvents[e.type] = false;\n }\n };\n\n _fireEvent(baseFire: Function, event: string | MapEvent<MapT>, properties?: object) {\n const map = this._map;\n const tr = map.transform;\n\n const eventType = typeof event === 'string' ? event : event.type;\n if (eventType === 'move') {\n this._updateViewState(this.props, false);\n }\n if (eventType in cameraEvents) {\n if (typeof event === 'object') {\n (event as unknown as ViewStateChangeEvent<MapT>).viewState = transformToViewState(tr);\n }\n if (this._map.isMoving()) {\n // Replace map.transform with ours during the callbacks\n map.transform = this._renderTransform;\n baseFire.call(map, event, properties);\n map.transform = tr;\n\n return map;\n }\n }\n baseFire.call(map, event, properties);\n\n return map;\n }\n\n // All camera manipulations are complete, ready to repaint\n _onBeforeRepaint() {\n const map = this._map;\n\n // If there are camera changes driven by props, invoke camera events so that DOM controls are synced\n this._internalUpdate = true;\n for (const eventType in this._deferredEvents) {\n if (this._deferredEvents[eventType]) {\n map.fire(eventType);\n }\n }\n this._internalUpdate = false;\n\n const tr = this._map.transform;\n // Make sure camera matches the current props\n map.transform = this._renderTransform;\n\n this._onAfterRepaint = () => {\n // Mapbox transitions between non-mercator projection and mercator during render time\n // Copy it back to the other\n syncProjection(this._renderTransform, tr);\n // Restores camera state before render/load events are fired\n map.transform = tr;\n };\n }\n\n _onAfterRepaint: () => void;\n}\n\n/**\n * Access token can be provided via one of:\n * mapboxAccessToken prop\n * access_token query parameter\n * MapboxAccessToken environment variable\n * REACT_APP_MAPBOX_ACCESS_TOKEN environment variable\n * @returns access token\n */\nfunction getAccessTokenFromEnv(): string {\n let accessToken = null;\n\n /* global location, process */\n if (typeof location !== 'undefined') {\n const match = /access_token=([^&\\/]*)/.exec(location.search);\n accessToken = match && match[1];\n }\n\n // Note: This depends on bundler plugins (e.g. webpack) importing environment correctly\n try {\n accessToken = accessToken || process.env.MapboxAccessToken;\n } catch {\n // ignore\n }\n\n try {\n accessToken = accessToken || process.env.REACT_APP_MAPBOX_ACCESS_TOKEN;\n } catch {\n // ignore\n }\n\n return accessToken;\n}\n"],"mappings":"SACEA,oBAAoB,EACpBC,yBAAyB,EACzBC,cAAc,EACdC,cAAc;AAAA,SAERC,cAAc;AAAA,SACdC,SAAS;AA0EjB,MAAMC,aAAa,GAAG;EAACC,OAAO,EAAE,CAAC;EAAEC,OAAO,EAAE,CAAC,CAAC;EAAEC,MAAM,EAAE;AAAE,CAAa;AAEvE,MAAMC,aAAa,GAAG;EACpBC,SAAS,EAAE,aAAa;EACxBC,OAAO,EAAE,WAAW;EACpBC,SAAS,EAAE,aAAa;EACxBC,SAAS,EAAE,aAAa;EACxBC,KAAK,EAAE,SAAS;EAChBC,QAAQ,EAAE,YAAY;EACtBC,UAAU,EAAE,cAAc;EAC1BC,UAAU,EAAE,cAAc;EAC1BC,QAAQ,EAAE,YAAY;EACtBC,WAAW,EAAE,eAAe;EAC5BC,UAAU,EAAE,cAAc;EAC1BC,QAAQ,EAAE,YAAY;EACtBC,SAAS,EAAE,aAAa;EACxBC,WAAW,EAAE;AACf,CAAC;AACD,MAAM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