react-bkoi-gl 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -0
  3. package/dist/index.cjs +137 -111
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +370 -0
  6. package/dist/index.d.ts +370 -2
  7. package/dist/index.js +1434 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/styles/react-bkoi-gl.css +1 -1
  10. package/package.json +62 -30
  11. package/dist/components/attribution-control.d.ts +0 -9
  12. package/dist/components/attribution-control.js +0 -20
  13. package/dist/components/attribution-control.js.map +0 -1
  14. package/dist/components/fullscreen-control.d.ts +0 -12
  15. package/dist/components/fullscreen-control.js +0 -21
  16. package/dist/components/fullscreen-control.js.map +0 -1
  17. package/dist/components/geolocate-control.d.ts +0 -21
  18. package/dist/components/geolocate-control.js +0 -46
  19. package/dist/components/geolocate-control.js.map +0 -1
  20. package/dist/components/layer.d.ts +0 -18
  21. package/dist/components/layer.js +0 -98
  22. package/dist/components/layer.js.map +0 -1
  23. package/dist/components/logo-control.d.ts +0 -9
  24. package/dist/components/logo-control.js +0 -28
  25. package/dist/components/logo-control.js.map +0 -1
  26. package/dist/components/map.d.ts +0 -27
  27. package/dist/components/map.js +0 -108
  28. package/dist/components/map.js.map +0 -1
  29. package/dist/components/marker.d.ts +0 -18
  30. package/dist/components/marker.js +0 -105
  31. package/dist/components/marker.js.map +0 -1
  32. package/dist/components/navigation-control.d.ts +0 -9
  33. package/dist/components/navigation-control.js +0 -19
  34. package/dist/components/navigation-control.js.map +0 -1
  35. package/dist/components/popup.d.ts +0 -15
  36. package/dist/components/popup.js +0 -68
  37. package/dist/components/popup.js.map +0 -1
  38. package/dist/components/scale-control.d.ts +0 -11
  39. package/dist/components/scale-control.js +0 -31
  40. package/dist/components/scale-control.js.map +0 -1
  41. package/dist/components/source.d.ts +0 -6
  42. package/dist/components/source.js +0 -95
  43. package/dist/components/source.js.map +0 -1
  44. package/dist/components/terrain-control.d.ts +0 -10
  45. package/dist/components/terrain-control.js +0 -19
  46. package/dist/components/terrain-control.js.map +0 -1
  47. package/dist/components/use-control.d.ts +0 -9
  48. package/dist/components/use-control.js +0 -30
  49. package/dist/components/use-control.js.map +0 -1
  50. package/dist/components/use-map.d.ts +0 -19
  51. package/dist/components/use-map.js +0 -54
  52. package/dist/components/use-map.js.map +0 -1
  53. package/dist/exports-maplibre-gl.d.ts +0 -33
  54. package/dist/exports-maplibre-gl.js +0 -21
  55. package/dist/exports-maplibre-gl.js.map +0 -1
  56. package/dist/maplibre/create-ref.d.ts +0 -9
  57. package/dist/maplibre/create-ref.js +0 -30
  58. package/dist/maplibre/create-ref.js.map +0 -1
  59. package/dist/maplibre/maplibre.d.ts +0 -81
  60. package/dist/maplibre/maplibre.js +0 -387
  61. package/dist/maplibre/maplibre.js.map +0 -1
  62. package/dist/styles.d.js +0 -2
  63. package/dist/styles.d.js.map +0 -1
  64. package/dist/tsconfig.build.tsbuildinfo +0 -1
  65. package/dist/types/common.d.ts +0 -20
  66. package/dist/types/common.js +0 -2
  67. package/dist/types/common.js.map +0 -1
  68. package/dist/types/events.d.ts +0 -80
  69. package/dist/types/events.js +0 -2
  70. package/dist/types/events.js.map +0 -1
  71. package/dist/types/internal.d.ts +0 -14
  72. package/dist/types/internal.js +0 -2
  73. package/dist/types/internal.js.map +0 -1
  74. package/dist/types/lib.d.ts +0 -40
  75. package/dist/types/lib.js +0 -2
  76. package/dist/types/lib.js.map +0 -1
  77. package/dist/types/style-spec.d.ts +0 -1
  78. package/dist/types/style-spec.js +0 -2
  79. package/dist/types/style-spec.js.map +0 -1
  80. package/dist/utils/apply-react-style.d.ts +0 -2
  81. package/dist/utils/apply-react-style.js +0 -16
  82. package/dist/utils/apply-react-style.js.map +0 -1
  83. package/dist/utils/assert.d.ts +0 -1
  84. package/dist/utils/assert.js +0 -6
  85. package/dist/utils/assert.js.map +0 -1
  86. package/dist/utils/compare-class-names.d.ts +0 -2
  87. package/dist/utils/compare-class-names.js +0 -23
  88. package/dist/utils/compare-class-names.js.map +0 -1
  89. package/dist/utils/deep-equal.d.ts +0 -15
  90. package/dist/utils/deep-equal.js +0 -46
  91. package/dist/utils/deep-equal.js.map +0 -1
  92. package/dist/utils/set-globals.d.ts +0 -20
  93. package/dist/utils/set-globals.js +0 -31
  94. package/dist/utils/set-globals.js.map +0 -1
  95. package/dist/utils/style-utils.d.ts +0 -3
  96. package/dist/utils/style-utils.js +0 -42
  97. package/dist/utils/style-utils.js.map +0 -1
  98. package/dist/utils/transform.d.ts +0 -18
  99. package/dist/utils/transform.js +0 -33
  100. package/dist/utils/transform.js.map +0 -1
  101. package/dist/utils/use-isomorphic-layout-effect.d.ts +0 -3
  102. package/dist/utils/use-isomorphic-layout-effect.js +0 -4
  103. package/dist/utils/use-isomorphic-layout-effect.js.map +0 -1
  104. package/src/components/attribution-control.ts +0 -56
  105. package/src/components/fullscreen-control.ts +0 -40
  106. package/src/components/geolocate-control.ts +0 -96
  107. package/src/components/layer.ts +0 -141
  108. package/src/components/logo-control.ts +0 -44
  109. package/src/components/map.tsx +0 -166
  110. package/src/components/marker.ts +0 -155
  111. package/src/components/navigation-control.ts +0 -28
  112. package/src/components/popup.ts +0 -113
  113. package/src/components/scale-control.ts +0 -44
  114. package/src/components/source.ts +0 -159
  115. package/src/components/terrain-control.ts +0 -29
  116. package/src/components/use-control.ts +0 -68
  117. package/src/components/use-map.tsx +0 -71
  118. package/src/exports-maplibre-gl.ts +0 -37
  119. package/src/index.ts +0 -3
  120. package/src/maplibre/create-ref.ts +0 -70
  121. package/src/maplibre/maplibre.ts +0 -624
  122. package/src/styles.d.ts +0 -4
  123. package/src/types/common.ts +0 -34
  124. package/src/types/events.ts +0 -133
  125. package/src/types/internal.ts +0 -26
  126. package/src/types/lib.ts +0 -84
  127. package/src/types/style-spec.ts +0 -34
  128. package/src/utils/apply-react-style.ts +0 -24
  129. package/src/utils/assert.ts +0 -5
  130. package/src/utils/compare-class-names.ts +0 -29
  131. package/src/utils/deep-equal.ts +0 -61
  132. package/src/utils/set-globals.ts +0 -51
  133. package/src/utils/style-utils.ts +0 -68
  134. package/src/utils/transform.ts +0 -58
  135. package/src/utils/use-isomorphic-layout-effect.ts +0 -8
@@ -1,81 +0,0 @@
1
- import type { ViewState, PointLike, PaddingOptions, ImmutableLike, LngLatBoundsLike } from "../types/common";
2
- import type { StyleSpecification, SkySpecification, LightSpecification, TerrainSpecification, ProjectionSpecification } from "../types/style-spec";
3
- import type { Map as MapInstance } from "../types/lib";
4
- import type { MapCallbacks } from "../types/events";
5
- export type MaplibreProps = Partial<ViewState> & MapCallbacks & {
6
- /** Camera options used when constructing the Map instance */
7
- initialViewState?: Partial<ViewState> & {
8
- /** The initial bounds of the map. If bounds is specified, it overrides longitude, latitude and zoom options. */
9
- bounds?: LngLatBoundsLike;
10
- /** A fitBounds options object to use only when setting the bounds option. */
11
- fitBoundsOptions?: {
12
- offset?: PointLike;
13
- minZoom?: number;
14
- maxZoom?: number;
15
- padding?: number | PaddingOptions;
16
- };
17
- };
18
- /** If provided, render into an external WebGL context */
19
- gl?: WebGLRenderingContext;
20
- /** For external controller to override the camera state */
21
- viewState?: ViewState & {
22
- width: number;
23
- height: number;
24
- };
25
- /** Mapbox style */
26
- mapStyle?: string | StyleSpecification | ImmutableLike<StyleSpecification>;
27
- /** Enable diffing when the map style changes
28
- * @default true
29
- */
30
- styleDiffing?: boolean;
31
- /** The projection property of the style. Must conform to the Projection Style Specification.
32
- * @default 'mercator'
33
- */
34
- projection?: ProjectionSpecification | "mercator" | "globe";
35
- /** Light properties of the map. */
36
- light?: LightSpecification;
37
- /** Terrain property of the style. Must conform to the Terrain Style Specification.
38
- * If `undefined` is provided, removes terrain from the map. */
39
- terrain?: TerrainSpecification;
40
- /** Sky properties of the map. Must conform to the Sky Style Specification. */
41
- sky?: SkySpecification;
42
- /** Default layers to query on pointer events */
43
- interactiveLayerIds?: string[];
44
- /** CSS cursor */
45
- cursor?: string;
46
- };
47
- /**
48
- * A wrapper for mapbox-gl's Map class
49
- */
50
- export default class Maplibre {
51
- private _MapClass;
52
- private _map;
53
- props: MaplibreProps;
54
- private _internalUpdate;
55
- private _hoveredFeatures;
56
- private _propsedCameraUpdate;
57
- private _styleComponents;
58
- static savedMaps: Maplibre[];
59
- constructor(MapClass: {
60
- new (options: any): MapInstance;
61
- }, props: MaplibreProps, container: HTMLDivElement);
62
- get map(): MapInstance;
63
- setProps(props: MaplibreProps): void;
64
- static reuse(props: MaplibreProps, container: HTMLDivElement): Maplibre;
65
- private _initialize;
66
- recycle(): void;
67
- destroy(): void;
68
- redraw(): void;
69
- private _updateSize;
70
- private _updateViewState;
71
- private _updateSettings;
72
- private _updateStyle;
73
- private _updateStyleComponents;
74
- private _updateHandlers;
75
- private _onEvent;
76
- private _onCameraEvent;
77
- private _onCameraUpdate;
78
- private _queryRenderedFeatures;
79
- private _updateHover;
80
- private _onPointerEvent;
81
- }
@@ -1,387 +0,0 @@
1
- import { transformToViewState, applyViewStateToTransform } from "../utils/transform.js";
2
- import { normalizeStyle } from "../utils/style-utils.js";
3
- import { deepEqual } from "../utils/deep-equal.js";
4
- const DEFAULT_STYLE = {
5
- version: 8,
6
- sources: {},
7
- layers: []
8
- };
9
- const pointerEvents = {
10
- mousedown: "onMouseDown",
11
- mouseup: "onMouseUp",
12
- mouseover: "onMouseOver",
13
- mousemove: "onMouseMove",
14
- click: "onClick",
15
- dblclick: "onDblClick",
16
- mouseenter: "onMouseEnter",
17
- mouseleave: "onMouseLeave",
18
- mouseout: "onMouseOut",
19
- contextmenu: "onContextMenu",
20
- touchstart: "onTouchStart",
21
- touchend: "onTouchEnd",
22
- touchmove: "onTouchMove",
23
- touchcancel: "onTouchCancel"
24
- };
25
- const cameraEvents = {
26
- movestart: "onMoveStart",
27
- move: "onMove",
28
- moveend: "onMoveEnd",
29
- dragstart: "onDragStart",
30
- drag: "onDrag",
31
- dragend: "onDragEnd",
32
- zoomstart: "onZoomStart",
33
- zoom: "onZoom",
34
- zoomend: "onZoomEnd",
35
- rotatestart: "onRotateStart",
36
- rotate: "onRotate",
37
- rotateend: "onRotateEnd",
38
- pitchstart: "onPitchStart",
39
- pitch: "onPitch",
40
- pitchend: "onPitchEnd"
41
- };
42
- const otherEvents = {
43
- wheel: "onWheel",
44
- boxzoomstart: "onBoxZoomStart",
45
- boxzoomend: "onBoxZoomEnd",
46
- boxzoomcancel: "onBoxZoomCancel",
47
- resize: "onResize",
48
- load: "onLoad",
49
- render: "onRender",
50
- idle: "onIdle",
51
- remove: "onRemove",
52
- data: "onData",
53
- styledata: "onStyleData",
54
- sourcedata: "onSourceData",
55
- error: "onError"
56
- };
57
- const settingNames = ["minZoom", "maxZoom", "minPitch", "maxPitch", "maxBounds", "projection", "renderWorldCopies"];
58
- const handlerNames = ["scrollZoom", "boxZoom", "dragRotate", "dragPan", "keyboard", "doubleClickZoom", "touchZoomRotate", "touchPitch"];
59
- export default class Maplibre {
60
- _map = null;
61
- _internalUpdate = false;
62
- _hoveredFeatures = null;
63
- _propsedCameraUpdate = null;
64
- _styleComponents = {};
65
- static savedMaps = [];
66
- constructor(MapClass, props, container) {
67
- this._MapClass = MapClass;
68
- this.props = props;
69
- this._initialize(container);
70
- }
71
- get map() {
72
- return this._map;
73
- }
74
- setProps(props) {
75
- const oldProps = this.props;
76
- this.props = props;
77
- const settingsChanged = this._updateSettings(props, oldProps);
78
- const sizeChanged = this._updateSize(props);
79
- const viewStateChanged = this._updateViewState(props);
80
- this._updateStyle(props, oldProps);
81
- this._updateStyleComponents(props);
82
- this._updateHandlers(props, oldProps);
83
- if (settingsChanged || sizeChanged || viewStateChanged && !this._map.isMoving()) {
84
- this.redraw();
85
- }
86
- }
87
- static reuse(props, container) {
88
- const that = Maplibre.savedMaps.pop();
89
- if (!that) {
90
- return null;
91
- }
92
- const map = that.map;
93
- const oldContainer = map.getContainer();
94
- container.className = oldContainer.className;
95
- while (oldContainer.childNodes.length > 0) {
96
- container.appendChild(oldContainer.childNodes[0]);
97
- }
98
- map._container = container;
99
- const resizeObserver = map._resizeObserver;
100
- if (resizeObserver) {
101
- resizeObserver.disconnect();
102
- resizeObserver.observe(container);
103
- }
104
- that.setProps({
105
- ...props,
106
- styleDiffing: false
107
- });
108
- map.resize();
109
- const {
110
- initialViewState
111
- } = props;
112
- if (initialViewState) {
113
- if (initialViewState.bounds) {
114
- map.fitBounds(initialViewState.bounds, {
115
- ...initialViewState.fitBoundsOptions,
116
- duration: 0
117
- });
118
- } else {
119
- that._updateViewState(initialViewState);
120
- }
121
- }
122
- if (map.isStyleLoaded()) {
123
- map.fire("load");
124
- } else {
125
- map.once("style.load", () => map.fire("load"));
126
- }
127
- map._update();
128
- return that;
129
- }
130
- _initialize(container) {
131
- const {
132
- props
133
- } = this;
134
- const {
135
- mapStyle = DEFAULT_STYLE
136
- } = props;
137
- const mapOptions = {
138
- ...props,
139
- ...props.initialViewState,
140
- container,
141
- style: normalizeStyle(mapStyle)
142
- };
143
- const viewState = mapOptions.initialViewState || mapOptions.viewState || mapOptions;
144
- Object.assign(mapOptions, {
145
- center: [viewState.longitude || 0, viewState.latitude || 0],
146
- zoom: viewState.zoom || 0,
147
- pitch: viewState.pitch || 0,
148
- bearing: viewState.bearing || 0
149
- });
150
- if (props.gl) {
151
- const getContext = HTMLCanvasElement.prototype.getContext;
152
- HTMLCanvasElement.prototype.getContext = () => {
153
- HTMLCanvasElement.prototype.getContext = getContext;
154
- return props.gl;
155
- };
156
- }
157
- const map = new this._MapClass(mapOptions);
158
- if (viewState.padding) {
159
- map.setPadding(viewState.padding);
160
- }
161
- if (props.cursor) {
162
- map.getCanvas().style.cursor = props.cursor;
163
- }
164
- map.transformCameraUpdate = this._onCameraUpdate;
165
- map.on("style.load", () => {
166
- this._styleComponents = {
167
- light: map.getLight(),
168
- sky: map.getSky(),
169
- projection: map.getProjection?.(),
170
- terrain: map.getTerrain()
171
- };
172
- this._updateStyleComponents(this.props);
173
- });
174
- map.on("sourcedata", () => {
175
- this._updateStyleComponents(this.props);
176
- });
177
- for (const eventName in pointerEvents) {
178
- map.on(eventName, this._onPointerEvent);
179
- }
180
- for (const eventName in cameraEvents) {
181
- map.on(eventName, this._onCameraEvent);
182
- }
183
- for (const eventName in otherEvents) {
184
- map.on(eventName, this._onEvent);
185
- }
186
- this._map = map;
187
- }
188
- recycle() {
189
- const container = this.map.getContainer();
190
- const children = container.querySelector("[mapboxgl-children]");
191
- children?.remove();
192
- Maplibre.savedMaps.push(this);
193
- }
194
- destroy() {
195
- this._map.remove();
196
- }
197
- redraw() {
198
- const map = this._map;
199
- if (map.style) {
200
- if (map._frame) {
201
- map._frame.cancel();
202
- map._frame = null;
203
- }
204
- map._render();
205
- }
206
- }
207
- _updateSize(nextProps) {
208
- const {
209
- viewState
210
- } = nextProps;
211
- if (viewState) {
212
- const map = this._map;
213
- if (viewState.width !== map.transform.width || viewState.height !== map.transform.height) {
214
- map.resize();
215
- return true;
216
- }
217
- }
218
- return false;
219
- }
220
- _updateViewState(nextProps) {
221
- const map = this._map;
222
- const tr = map.transform;
223
- const isMoving = map.isMoving();
224
- if (!isMoving) {
225
- const changes = applyViewStateToTransform(tr, nextProps);
226
- if (Object.keys(changes).length > 0) {
227
- this._internalUpdate = true;
228
- map.jumpTo(changes);
229
- this._internalUpdate = false;
230
- return true;
231
- }
232
- }
233
- return false;
234
- }
235
- _updateSettings(nextProps, currProps) {
236
- const map = this._map;
237
- let changed = false;
238
- for (const propName of settingNames) {
239
- if (propName in nextProps && !deepEqual(nextProps[propName], currProps[propName])) {
240
- changed = true;
241
- const setter = map[`set${propName[0].toUpperCase()}${propName.slice(1)}`];
242
- setter?.call(map, nextProps[propName]);
243
- }
244
- }
245
- return changed;
246
- }
247
- _updateStyle(nextProps, currProps) {
248
- if (nextProps.cursor !== currProps.cursor) {
249
- this._map.getCanvas().style.cursor = nextProps.cursor || "";
250
- }
251
- if (nextProps.mapStyle !== currProps.mapStyle) {
252
- const {
253
- mapStyle = DEFAULT_STYLE,
254
- styleDiffing = true
255
- } = nextProps;
256
- const options = {
257
- diff: styleDiffing
258
- };
259
- if ("localIdeographFontFamily" in nextProps) {
260
- options.localIdeographFontFamily = nextProps.localIdeographFontFamily;
261
- }
262
- this._map.setStyle(normalizeStyle(mapStyle), options);
263
- }
264
- }
265
- _updateStyleComponents(_ref) {
266
- let {
267
- light,
268
- projection,
269
- sky,
270
- terrain
271
- } = _ref;
272
- const map = this._map;
273
- const currProps = this._styleComponents;
274
- if (map.style._loaded) {
275
- if (light && !deepEqual(light, currProps.light)) {
276
- currProps.light = light;
277
- map.setLight(light);
278
- }
279
- if (projection && !deepEqual(projection, currProps.projection) && projection !== currProps.projection?.type) {
280
- currProps.projection = typeof projection === "string" ? {
281
- type: projection
282
- } : projection;
283
- map.setProjection?.(currProps.projection);
284
- }
285
- if (sky && !deepEqual(sky, currProps.sky)) {
286
- currProps.sky = sky;
287
- map.setSky(sky);
288
- }
289
- if (terrain !== undefined && !deepEqual(terrain, currProps.terrain)) {
290
- if (!terrain || map.getSource(terrain.source)) {
291
- currProps.terrain = terrain;
292
- map.setTerrain(terrain);
293
- }
294
- }
295
- }
296
- }
297
- _updateHandlers(nextProps, currProps) {
298
- const map = this._map;
299
- for (const propName of handlerNames) {
300
- const newValue = nextProps[propName] ?? true;
301
- const oldValue = currProps[propName] ?? true;
302
- if (!deepEqual(newValue, oldValue)) {
303
- if (newValue) {
304
- map[propName].enable(newValue);
305
- } else {
306
- map[propName].disable();
307
- }
308
- }
309
- }
310
- }
311
- _onEvent = e => {
312
- const cb = this.props[otherEvents[e.type]];
313
- if (cb) {
314
- cb(e);
315
- } else if (e.type === "error") {
316
- console.error(e.error);
317
- }
318
- };
319
- _onCameraEvent = e => {
320
- if (this._internalUpdate) {
321
- return;
322
- }
323
- e.viewState = this._propsedCameraUpdate || transformToViewState(this._map.transform);
324
- const cb = this.props[cameraEvents[e.type]];
325
- if (cb) {
326
- cb(e);
327
- }
328
- };
329
- _onCameraUpdate = tr => {
330
- if (this._internalUpdate) {
331
- return tr;
332
- }
333
- this._propsedCameraUpdate = transformToViewState(tr);
334
- return applyViewStateToTransform(tr, this.props);
335
- };
336
- _queryRenderedFeatures(point) {
337
- const map = this._map;
338
- const {
339
- interactiveLayerIds = []
340
- } = this.props;
341
- try {
342
- return map.queryRenderedFeatures(point, {
343
- layers: interactiveLayerIds.filter(map.getLayer.bind(map))
344
- });
345
- } catch {
346
- return [];
347
- }
348
- }
349
- _updateHover(e) {
350
- const {
351
- props
352
- } = this;
353
- const shouldTrackHoveredFeatures = props.interactiveLayerIds && (props.onMouseMove || props.onMouseEnter || props.onMouseLeave);
354
- if (shouldTrackHoveredFeatures) {
355
- const eventType = e.type;
356
- const wasHovering = this._hoveredFeatures?.length > 0;
357
- const features = this._queryRenderedFeatures(e.point);
358
- const isHovering = features.length > 0;
359
- if (!isHovering && wasHovering) {
360
- e.type = "mouseleave";
361
- this._onPointerEvent(e);
362
- }
363
- this._hoveredFeatures = features;
364
- if (isHovering && !wasHovering) {
365
- e.type = "mouseenter";
366
- this._onPointerEvent(e);
367
- }
368
- e.type = eventType;
369
- } else {
370
- this._hoveredFeatures = null;
371
- }
372
- }
373
- _onPointerEvent = e => {
374
- if (e.type === "mousemove" || e.type === "mouseout") {
375
- this._updateHover(e);
376
- }
377
- const cb = this.props[pointerEvents[e.type]];
378
- if (cb) {
379
- if (this.props.interactiveLayerIds && e.type !== "mouseover" && e.type !== "mouseout") {
380
- e.features = this._hoveredFeatures || this._queryRenderedFeatures(e.point);
381
- }
382
- cb(e);
383
- delete e.features;
384
- }
385
- };
386
- }
387
- //# sourceMappingURL=maplibre.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"maplibre.js","names":["transformToViewState","applyViewStateToTransform","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","Maplibre","_map","_internalUpdate","_hoveredFeatures","_propsedCameraUpdate","_styleComponents","savedMaps","constructor","MapClass","props","container","_MapClass","_initialize","map","setProps","oldProps","settingsChanged","_updateSettings","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","style","viewState","Object","assign","center","longitude","latitude","bearing","gl","getContext","HTMLCanvasElement","prototype","padding","setPadding","cursor","getCanvas","transformCameraUpdate","_onCameraUpdate","on","light","getLight","sky","getSky","projection","getProjection","terrain","getTerrain","eventName","_onPointerEvent","_onCameraEvent","_onEvent","recycle","children","querySelector","push","destroy","_frame","cancel","_render","nextProps","width","transform","height","tr","changes","keys","jumpTo","currProps","changed","propName","setter","toUpperCase","slice","call","options","diff","localIdeographFontFamily","setStyle","_ref","_loaded","setLight","type","setProjection","setSky","undefined","getSource","source","setTerrain","newValue","oldValue","enable","disable","e","cb","console","_queryRenderedFeatures","point","interactiveLayerIds","queryRenderedFeatures","filter","getLayer","bind","_updateHover","shouldTrackHoveredFeatures","onMouseMove","onMouseEnter","onMouseLeave","eventType","wasHovering","features","isHovering"],"sources":["../../src/maplibre/maplibre.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-floating-promises */\nimport {\n transformToViewState,\n applyViewStateToTransform,\n} from \"../utils/transform\";\nimport { normalizeStyle } from \"../utils/style-utils\";\nimport { deepEqual } from \"../utils/deep-equal\";\n\nimport type { TransformLike } from \"../types/internal\";\nimport type {\n ViewState,\n Point,\n PointLike,\n PaddingOptions,\n ImmutableLike,\n LngLatBoundsLike,\n MapGeoJSONFeature,\n} from \"../types/common\";\nimport type {\n StyleSpecification,\n SkySpecification,\n LightSpecification,\n TerrainSpecification,\n ProjectionSpecification,\n} from \"../types/style-spec\";\nimport type { Map as MapInstance } from \"../types/lib\";\nimport type {\n MapCallbacks,\n ViewStateChangeEvent,\n MapEvent,\n ErrorEvent,\n MapMouseEvent,\n} from \"../types/events\";\n\nexport type MaplibreProps = Partial<ViewState> &\n MapCallbacks & {\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 | StyleSpecification | ImmutableLike<StyleSpecification>;\n /** Enable diffing when the map style changes\n * @default true\n */\n styleDiffing?: boolean;\n /** The projection property of the style. Must conform to the Projection Style Specification.\n * @default 'mercator'\n */\n projection?: ProjectionSpecification | \"mercator\" | \"globe\";\n /** Light properties of the map. */\n light?: LightSpecification;\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?: TerrainSpecification;\n /** Sky properties of the map. Must conform to the Sky Style Specification. */\n sky?: SkySpecification;\n\n /** Default layers to query on pointer events */\n interactiveLayerIds?: string[];\n /** CSS cursor */\n cursor?: string;\n };\n\nconst DEFAULT_STYLE = {\n version: 8,\n sources: {},\n layers: [],\n} as StyleSpecification;\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 Maplibre {\n private _MapClass: { new (options: any): MapInstance };\n // mapboxgl.Map instance\n private _map: MapInstance = null;\n // User-supplied props\n props: MaplibreProps;\n\n // Internal states\n private _internalUpdate: boolean = false;\n private _hoveredFeatures: MapGeoJSONFeature[] = null;\n private _propsedCameraUpdate: ViewState | null = null;\n private _styleComponents: {\n light?: LightSpecification;\n sky?: SkySpecification;\n projection?: ProjectionSpecification;\n terrain?: TerrainSpecification | null;\n } = {};\n\n static savedMaps: Maplibre[] = [];\n\n constructor(\n MapClass: { new (options: any): MapInstance },\n props: MaplibreProps,\n container: HTMLDivElement,\n ) {\n this._MapClass = MapClass;\n this.props = props;\n this._initialize(container);\n }\n\n get map(): MapInstance {\n return this._map;\n }\n\n setProps(props: MaplibreProps) {\n const oldProps = this.props;\n this.props = props;\n\n const settingsChanged = this._updateSettings(props, oldProps);\n const sizeChanged = this._updateSize(props);\n const viewStateChanged = this._updateViewState(props);\n this._updateStyle(props, oldProps);\n this._updateStyleComponents(props);\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 (\n settingsChanged ||\n sizeChanged ||\n (viewStateChanged && !this._map.isMoving())\n ) {\n this.redraw();\n }\n }\n\n static reuse(props: MaplibreProps, container: HTMLDivElement): Maplibre {\n const that = Maplibre.savedMaps.pop();\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, {\n ...initialViewState.fitBoundsOptions,\n duration: 0,\n });\n } else {\n that._updateViewState(initialViewState);\n }\n }\n\n // Simulate load event\n if (map.isStyleLoaded()) {\n map.fire(\"load\");\n } else {\n map.once(\"style.load\", () => 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 private _initialize(container: HTMLDivElement) {\n const { props } = this;\n const { mapStyle = DEFAULT_STYLE } = props;\n const mapOptions = {\n ...props,\n ...props.initialViewState,\n container,\n style: normalizeStyle(mapStyle),\n };\n\n const viewState =\n 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);\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\n // add listeners\n map.transformCameraUpdate = this._onCameraUpdate;\n map.on(\"style.load\", () => {\n // Map style has changed, this would have wiped out all settings from props\n this._styleComponents = {\n light: map.getLight(),\n sky: map.getSky(),\n // @ts-ignore getProjection() does not exist in v4\n projection: map.getProjection?.(),\n terrain: map.getTerrain(),\n };\n this._updateStyleComponents(this.props);\n });\n map.on(\"sourcedata\", () => {\n // Some sources have loaded, we may need them to attach terrain\n this._updateStyleComponents(this.props);\n });\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 Maplibre.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 (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 /* Trigger map resize if size is controlled\n @param {object} nextProps\n @returns {bool} true if size has changed\n */\n private _updateSize(nextProps: MaplibreProps): boolean {\n // Check if size is controlled\n const { viewState } = nextProps;\n if (viewState) {\n const map = this._map;\n if (\n viewState.width !== map.transform.width ||\n viewState.height !== map.transform.height\n ) {\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 private _updateViewState(nextProps: MaplibreProps): boolean {\n const map = this._map;\n const tr = map.transform;\n const isMoving = map.isMoving();\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 const changes: any = applyViewStateToTransform(tr, nextProps);\n if (Object.keys(changes).length > 0) {\n this._internalUpdate = true;\n map.jumpTo(changes);\n this._internalUpdate = false;\n return true;\n }\n }\n\n return false;\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 private _updateSettings(\n nextProps: MaplibreProps,\n currProps: MaplibreProps,\n ): boolean {\n const map = this._map;\n let changed = false;\n for (const propName of settingNames) {\n if (\n propName in nextProps &&\n !deepEqual(nextProps[propName], currProps[propName])\n ) {\n changed = true;\n const setter =\n 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 private _updateStyle(\n nextProps: MaplibreProps,\n currProps: MaplibreProps,\n ): void {\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 }\n }\n\n /* Update fog, light, projection and terrain to match props\n * These props are special because\n * 1. They can not be applied right away. Certain conditions (style loaded, source loaded, etc.) must be met\n * 2. They can be overwritten by mapStyle\n */\n private _updateStyleComponents({\n light,\n projection,\n sky,\n terrain,\n }: MaplibreProps): void {\n const map = this._map;\n const currProps = this._styleComponents;\n // We can safely manipulate map style once it's loaded\n if (map.style._loaded) {\n if (light && !deepEqual(light, currProps.light)) {\n currProps.light = light;\n map.setLight(light);\n }\n if (\n projection &&\n !deepEqual(projection, currProps.projection) &&\n projection !== currProps.projection?.type\n ) {\n currProps.projection =\n typeof projection === \"string\" ? { type: projection } : projection;\n // @ts-ignore setProjection does not exist in v4\n map.setProjection?.(currProps.projection);\n }\n if (sky && !deepEqual(sky, currProps.sky)) {\n currProps.sky = sky;\n map.setSky(sky);\n }\n if (terrain !== undefined && !deepEqual(terrain, currProps.terrain)) {\n if (!terrain || map.getSource(terrain.source)) {\n currProps.terrain = terrain;\n map.setTerrain(terrain);\n }\n }\n }\n }\n\n /* Update interaction handlers to match props */\n private _updateHandlers(\n nextProps: MaplibreProps,\n currProps: MaplibreProps,\n ): void {\n const map = this._map;\n for (const propName of handlerNames) {\n const newValue = nextProps[propName] ?? true;\n const oldValue = currProps[propName] ?? true;\n if (!deepEqual(newValue, oldValue)) {\n if (newValue) {\n map[propName].enable(newValue);\n } else {\n map[propName].disable();\n }\n }\n }\n }\n\n private _onEvent = (e: MapEvent) => {\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).error); // eslint-disable-line\n }\n };\n\n private _onCameraEvent = (e: ViewStateChangeEvent) => {\n if (this._internalUpdate) {\n return;\n }\n e.viewState =\n this._propsedCameraUpdate || transformToViewState(this._map.transform);\n // @ts-ignore\n const cb = this.props[cameraEvents[e.type]];\n if (cb) {\n cb(e);\n }\n };\n\n private _onCameraUpdate = (tr: TransformLike) => {\n if (this._internalUpdate) {\n return tr;\n }\n this._propsedCameraUpdate = transformToViewState(tr);\n return applyViewStateToTransform(tr, this.props) as any;\n };\n\n private _queryRenderedFeatures(point: Point) {\n const map = this._map;\n const { interactiveLayerIds = [] } = this.props;\n try {\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 }\n }\n\n private _updateHover(e: MapMouseEvent) {\n const { props } = this;\n const shouldTrackHoveredFeatures =\n props.interactiveLayerIds &&\n (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 private _onPointerEvent = (e: MapMouseEvent) => {\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 (\n this.props.interactiveLayerIds &&\n e.type !== \"mouseover\" &&\n e.type !== \"mouseout\"\n ) {\n e.features =\n this._hoveredFeatures || this._queryRenderedFeatures(e.point);\n }\n cb(e);\n delete e.features;\n }\n };\n}\n"],"mappings":"SAEEA,oBAAoB,EACpBC,yBAAyB;AAAA,SAElBC,cAAc;AAAA,SACdC,SAAS;AA8ElB,MAAMC,aAAa,GAAG;EACpBC,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE;AACV,CAAuB;AAEvB,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,eA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CAACX,IAAI,GAAG,YAAY;QACrB,IAAI,CAACjC,eAAe,CAAC4C,CAAC,CAAC;MACzB;MACAA,CAAC,CAACX,IAAI,GAAG0B,SAAS;IACpB,CAAC,MAAM;MACL,IAAI,CAACzI,gBAAgB,GAAG,IAAI;IAC9B;EACF;EAEQ8E,eAAe,GAAI4C,CAAgB,IAAK;IAC9C,IAAIA,CAAC,CAACX,IAAI,KAAK,WAAW,IAAIW,CAAC,CAACX,IAAI,KAAK,UAAU,EAAE;MACnD,IAAI,CAACqB,YAAY,CAACV,CAAC,CAAC;IACtB;IAGA,MAAMC,EAAE,GAAG,IAAI,CAACrH,KAAK,CAACxD,aAAa,CAAC4K,CAAC,CAACX,IAAI,CAAC,CAAC;IAC5C,IAAIY,EAAE,EAAE;MACN,IACE,IAAI,CAACrH,KAAK,CAACyH,mBAAmB,IAC9BL,CAAC,CAACX,IAAI,KAAK,WAAW,IACtBW,CAAC,CAACX,IAAI,KAAK,UAAU,EACrB;QACAW,CAAC,CAACiB,QAAQ,GACR,IAAI,CAAC3I,gBAAgB,IAAI,IAAI,CAAC6H,sBAAsB,CAACH,CAAC,CAACI,KAAK,CAAC;MACjE;MACAH,EAAE,CAACD,CAAC,CAAC;MACL,OAAOA,CAAC,CAACiB,QAAQ;IACnB;EACF,CAAC;AACH","ignoreList":[]}
package/dist/styles.d.js DELETED
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=styles.d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.d.js","names":[],"sources":["../src/styles.d.ts"],"sourcesContent":["declare module 'react-bkoi-gl/styles' {\n const css: string;\n export default css;\n}"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"root":["../src/exports-maplibre-gl.ts","../src/index.ts","../src/styles.d.ts","../src/components/attribution-control.ts","../src/components/fullscreen-control.ts","../src/components/geolocate-control.ts","../src/components/layer.ts","../src/components/logo-control.ts","../src/components/map.tsx","../src/components/marker.ts","../src/components/navigation-control.ts","../src/components/popup.ts","../src/components/scale-control.ts","../src/components/source.ts","../src/components/terrain-control.ts","../src/components/use-control.ts","../src/components/use-map.tsx","../src/maplibre/create-ref.ts","../src/maplibre/maplibre.ts","../src/types/common.ts","../src/types/events.ts","../src/types/internal.ts","../src/types/lib.ts","../src/types/style-spec.ts","../src/utils/apply-react-style.ts","../src/utils/assert.ts","../src/utils/compare-class-names.ts","../src/utils/deep-equal.ts","../src/utils/set-globals.ts","../src/utils/style-utils.ts","../src/utils/transform.ts","../src/utils/use-isomorphic-layout-effect.ts"],"version":"5.8.3"}
@@ -1,20 +0,0 @@
1
- import type { PaddingOptions } from "maplibre-gl";
2
- export type { Point, PointLike, LngLat, LngLatLike, LngLatBounds, LngLatBoundsLike, PaddingOptions, MapGeoJSONFeature, } from "maplibre-gl";
3
- /** Describes the camera's state */
4
- export type ViewState = {
5
- /** Longitude at map center */
6
- longitude: number;
7
- /** Latitude at map center */
8
- latitude: number;
9
- /** Map zoom level */
10
- zoom: number;
11
- /** Map rotation bearing in degrees counter-clockwise from north */
12
- bearing: number;
13
- /** Map angle in degrees at which the camera is looking at the ground */
14
- pitch: number;
15
- /** Dimensions in pixels applied on each side of the viewport for shifting the vanishing point. */
16
- padding: PaddingOptions;
17
- };
18
- export interface ImmutableLike<T> {
19
- toJS: () => T;
20
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=common.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","names":[],"sources":["../../src/types/common.ts"],"sourcesContent":["import type { PaddingOptions } from \"maplibre-gl\";\n\nexport type {\n Point,\n PointLike,\n LngLat,\n LngLatLike,\n LngLatBounds,\n LngLatBoundsLike,\n PaddingOptions,\n MapGeoJSONFeature,\n} from \"maplibre-gl\";\n\n/* Public */\n\n/** Describes the camera's state */\nexport type ViewState = {\n /** Longitude at map center */\n longitude: number;\n /** Latitude at map center */\n latitude: number;\n /** Map zoom level */\n zoom: number;\n /** Map rotation bearing in degrees counter-clockwise from north */\n bearing: number;\n /** Map angle in degrees at which the camera is looking at the ground */\n pitch: number;\n /** Dimensions in pixels applied on each side of the viewport for shifting the vanishing point. */\n padding: PaddingOptions;\n};\n\nexport interface ImmutableLike<T> {\n toJS: () => T;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,80 +0,0 @@
1
- import type { Point, LngLat, MapGeoJSONFeature, ViewState } from "./common";
2
- import type { Map, Marker, Popup, GeolocateControl, MapLibreEvent, MapMouseEvent as _MapMouseEvent, MapLayerMouseEvent, MapTouchEvent, MapLayerTouchEvent, MapStyleDataEvent, MapSourceDataEvent, MapWheelEvent, MapLibreZoomEvent as MapBoxZoomEvent } from "maplibre-gl";
3
- export type { MapLibreEvent as MapEvent, MapLayerMouseEvent, MapTouchEvent, MapLayerTouchEvent, MapStyleDataEvent, MapSourceDataEvent, MapWheelEvent, MapBoxZoomEvent, };
4
- export type MapCallbacks = {
5
- onMouseDown?: (e: MapLayerMouseEvent) => void;
6
- onMouseUp?: (e: MapLayerMouseEvent) => void;
7
- onMouseOver?: (e: MapLayerMouseEvent) => void;
8
- onMouseMove?: (e: MapLayerMouseEvent) => void;
9
- onClick?: (e: MapLayerMouseEvent) => void;
10
- onDblClick?: (e: MapLayerMouseEvent) => void;
11
- onMouseEnter?: (e: MapLayerMouseEvent) => void;
12
- onMouseLeave?: (e: MapLayerMouseEvent) => void;
13
- onMouseOut?: (e: MapLayerMouseEvent) => void;
14
- onContextMenu?: (e: MapLayerMouseEvent) => void;
15
- onTouchStart?: (e: MapLayerTouchEvent) => void;
16
- onTouchEnd?: (e: MapLayerTouchEvent) => void;
17
- onTouchMove?: (e: MapLayerTouchEvent) => void;
18
- onTouchCancel?: (e: MapLayerTouchEvent) => void;
19
- onMoveStart?: (e: ViewStateChangeEvent) => void;
20
- onMove?: (e: ViewStateChangeEvent) => void;
21
- onMoveEnd?: (e: ViewStateChangeEvent) => void;
22
- onDragStart?: (e: ViewStateChangeEvent) => void;
23
- onDrag?: (e: ViewStateChangeEvent) => void;
24
- onDragEnd?: (e: ViewStateChangeEvent) => void;
25
- onZoomStart?: (e: ViewStateChangeEvent) => void;
26
- onZoom?: (e: ViewStateChangeEvent) => void;
27
- onZoomEnd?: (e: ViewStateChangeEvent) => void;
28
- onRotateStart?: (e: ViewStateChangeEvent) => void;
29
- onRotate?: (e: ViewStateChangeEvent) => void;
30
- onRotateEnd?: (e: ViewStateChangeEvent) => void;
31
- onPitchStart?: (e: ViewStateChangeEvent) => void;
32
- onPitch?: (e: ViewStateChangeEvent) => void;
33
- onPitchEnd?: (e: ViewStateChangeEvent) => void;
34
- onWheel?: (e: MapWheelEvent) => void;
35
- onBoxZoomStart?: (e: MapBoxZoomEvent) => void;
36
- onBoxZoomEnd?: (e: MapBoxZoomEvent) => void;
37
- onBoxZoomCancel?: (e: MapBoxZoomEvent) => void;
38
- onResize?: (e: MapLibreEvent) => void;
39
- onLoad?: (e: MapLibreEvent) => void;
40
- onRender?: (e: MapLibreEvent) => void;
41
- onIdle?: (e: MapLibreEvent) => void;
42
- onError?: (e: ErrorEvent) => void;
43
- onRemove?: (e: MapLibreEvent) => void;
44
- onData?: (e: MapStyleDataEvent | MapSourceDataEvent) => void;
45
- onStyleData?: (e: MapStyleDataEvent) => void;
46
- onSourceData?: (e: MapSourceDataEvent) => void;
47
- };
48
- interface MapEvent<SourceT, OriginalEventT = undefined> {
49
- type: string;
50
- target: SourceT;
51
- originalEvent: OriginalEventT;
52
- }
53
- export type ErrorEvent = MapEvent<Map> & {
54
- type: "error";
55
- error: Error;
56
- };
57
- export type MapMouseEvent = _MapMouseEvent & {
58
- point: Point;
59
- lngLat: LngLat;
60
- features?: MapGeoJSONFeature[];
61
- };
62
- export type ViewStateChangeEvent = (MapEvent<Map, MouseEvent | TouchEvent | WheelEvent | undefined> & {
63
- type: "movestart" | "move" | "moveend" | "zoomstart" | "zoom" | "zoomend";
64
- viewState: ViewState;
65
- }) | (MapEvent<Map, MouseEvent | TouchEvent | undefined> & {
66
- type: "rotatestart" | "rotate" | "rotateend" | "dragstart" | "drag" | "dragend" | "pitchstart" | "pitch" | "pitchend";
67
- viewState: ViewState;
68
- });
69
- export type PopupEvent = {
70
- type: "open" | "close";
71
- target: Popup;
72
- };
73
- export type MarkerEvent<OriginalEventT = undefined> = MapEvent<Marker, OriginalEventT>;
74
- export type MarkerDragEvent = MarkerEvent & {
75
- type: "dragstart" | "drag" | "dragend";
76
- lngLat: LngLat;
77
- };
78
- export type GeolocateEvent = MapEvent<GeolocateControl>;
79
- export type GeolocateResultEvent = GeolocateEvent & GeolocationPosition;
80
- export type GeolocateErrorEvent = GeolocateEvent & GeolocationPositionError;