react-bkoi-gl 1.0.7 → 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 (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +172 -18
  3. package/dist/index.cjs +671 -736
  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/index.d.ts +4 -0
  10. package/dist/styles/react-bkoi-gl.css +1 -1
  11. package/package.json +84 -36
  12. package/bkoi-gl/package.json +0 -6
  13. package/dist/components/attribution-control.d.ts +0 -11
  14. package/dist/components/attribution-control.js +0 -19
  15. package/dist/components/attribution-control.js.map +0 -1
  16. package/dist/components/fullscreen-control.d.ts +0 -14
  17. package/dist/components/fullscreen-control.js +0 -21
  18. package/dist/components/fullscreen-control.js.map +0 -1
  19. package/dist/components/geolocate-control.d.ts +0 -37
  20. package/dist/components/geolocate-control.js +0 -46
  21. package/dist/components/geolocate-control.js.map +0 -1
  22. package/dist/components/layer.d.ts +0 -17
  23. package/dist/components/layer.js +0 -99
  24. package/dist/components/layer.js.map +0 -1
  25. package/dist/components/map.d.ts +0 -23
  26. package/dist/components/map.js +0 -102
  27. package/dist/components/map.js.map +0 -1
  28. package/dist/components/marker.d.ts +0 -41
  29. package/dist/components/marker.js +0 -98
  30. package/dist/components/marker.js.map +0 -1
  31. package/dist/components/navigation-control.d.ts +0 -11
  32. package/dist/components/navigation-control.js +0 -19
  33. package/dist/components/navigation-control.js.map +0 -1
  34. package/dist/components/popup.d.ts +0 -33
  35. package/dist/components/popup.js +0 -79
  36. package/dist/components/popup.js.map +0 -1
  37. package/dist/components/scale-control.d.ts +0 -13
  38. package/dist/components/scale-control.js +0 -31
  39. package/dist/components/scale-control.js.map +0 -1
  40. package/dist/components/source.d.ts +0 -7
  41. package/dist/components/source.js +0 -97
  42. package/dist/components/source.js.map +0 -1
  43. package/dist/components/use-control.d.ts +0 -9
  44. package/dist/components/use-control.js +0 -31
  45. package/dist/components/use-control.js.map +0 -1
  46. package/dist/components/use-map.d.ts +0 -20
  47. package/dist/components/use-map.js +0 -54
  48. package/dist/components/use-map.js.map +0 -1
  49. package/dist/exports-bkoi-gl.cjs +0 -1512
  50. package/dist/exports-bkoi-gl.d.ts +0 -89
  51. package/dist/exports-bkoi-gl.js +0 -36
  52. package/dist/exports-bkoi-gl.js.map +0 -1
  53. package/dist/exports-mapbox.d.ts +0 -139
  54. package/dist/exports-mapbox.js +0 -36
  55. package/dist/exports-mapbox.js.map +0 -1
  56. package/dist/mapbox/create-ref.d.ts +0 -9
  57. package/dist/mapbox/create-ref.js +0 -64
  58. package/dist/mapbox/create-ref.js.map +0 -1
  59. package/dist/mapbox/mapbox.d.ts +0 -81
  60. package/dist/mapbox/mapbox.js +0 -476
  61. package/dist/mapbox/mapbox.js.map +0 -1
  62. package/dist/types/common.d.ts +0 -78
  63. package/dist/types/common.js +0 -2
  64. package/dist/types/common.js.map +0 -1
  65. package/dist/types/events-bkoi-gl.d.ts +0 -49
  66. package/dist/types/events-bkoi-gl.js +0 -2
  67. package/dist/types/events-bkoi-gl.js.map +0 -1
  68. package/dist/types/events-mapbox.d.ts +0 -49
  69. package/dist/types/events-mapbox.js +0 -2
  70. package/dist/types/events-mapbox.js.map +0 -1
  71. package/dist/types/events.d.ts +0 -39
  72. package/dist/types/events.js +0 -2
  73. package/dist/types/events.js.map +0 -1
  74. package/dist/types/index.d.ts +0 -70
  75. package/dist/types/index.js +0 -5
  76. package/dist/types/index.js.map +0 -1
  77. package/dist/types/lib.d.ts +0 -224
  78. package/dist/types/lib.js +0 -2
  79. package/dist/types/lib.js.map +0 -1
  80. package/dist/types/public.d.ts +0 -2
  81. package/dist/types/public.js +0 -2
  82. package/dist/types/public.js.map +0 -1
  83. package/dist/types/style-spec-bkoi-gl.d.ts +0 -9
  84. package/dist/types/style-spec-bkoi-gl.js +0 -2
  85. package/dist/types/style-spec-bkoi-gl.js.map +0 -1
  86. package/dist/types/style-spec-mapbox.d.ts +0 -7
  87. package/dist/types/style-spec-mapbox.js +0 -2
  88. package/dist/types/style-spec-mapbox.js.map +0 -1
  89. package/dist/utils/apply-react-style.d.ts +0 -2
  90. package/dist/utils/apply-react-style.js +0 -16
  91. package/dist/utils/apply-react-style.js.map +0 -1
  92. package/dist/utils/assert.d.ts +0 -1
  93. package/dist/utils/assert.js +0 -6
  94. package/dist/utils/assert.js.map +0 -1
  95. package/dist/utils/deep-equal.d.ts +0 -15
  96. package/dist/utils/deep-equal.js +0 -46
  97. package/dist/utils/deep-equal.js.map +0 -1
  98. package/dist/utils/set-globals.d.ts +0 -22
  99. package/dist/utils/set-globals.js +0 -19
  100. package/dist/utils/set-globals.js.map +0 -1
  101. package/dist/utils/style-utils.d.ts +0 -2
  102. package/dist/utils/style-utils.js +0 -42
  103. package/dist/utils/style-utils.js.map +0 -1
  104. package/dist/utils/transform.d.ts +0 -26
  105. package/dist/utils/transform.js +0 -56
  106. package/dist/utils/transform.js.map +0 -1
  107. package/dist/utils/use-isomorphic-layout-effect.d.ts +0 -3
  108. package/dist/utils/use-isomorphic-layout-effect.js +0 -4
  109. package/dist/utils/use-isomorphic-layout-effect.js.map +0 -1
  110. package/src/components/attribution-control.ts +0 -32
  111. package/src/components/fullscreen-control.tsx +0 -37
  112. package/src/components/geolocate-control.ts +0 -90
  113. package/src/components/layer.ts +0 -133
  114. package/src/components/map.tsx +0 -155
  115. package/src/components/marker.ts +0 -137
  116. package/src/components/navigation-control.ts +0 -29
  117. package/src/components/popup.ts +0 -116
  118. package/src/components/scale-control.ts +0 -46
  119. package/src/components/source.ts +0 -158
  120. package/src/components/use-control.ts +0 -64
  121. package/src/components/use-map.tsx +0 -69
  122. package/src/exports-bkoi-gl.ts +0 -156
  123. package/src/exports-mapbox.ts +0 -159
  124. package/src/index.ts +0 -2
  125. package/src/mapbox/create-ref.ts +0 -118
  126. package/src/mapbox/mapbox.ts +0 -742
  127. package/src/types/common.ts +0 -94
  128. package/src/types/events-bkoi-gl.ts +0 -78
  129. package/src/types/events-mapbox.ts +0 -76
  130. package/src/types/events.ts +0 -73
  131. package/src/types/index.ts +0 -93
  132. package/src/types/lib.ts +0 -279
  133. package/src/types/public.ts +0 -9
  134. package/src/types/style-spec-bkoi-gl.ts +0 -81
  135. package/src/types/style-spec-mapbox.ts +0 -80
  136. package/src/utils/apply-react-style.ts +0 -20
  137. package/src/utils/assert.ts +0 -5
  138. package/src/utils/deep-equal.ts +0 -61
  139. package/src/utils/set-globals.ts +0 -57
  140. package/src/utils/style-utils.ts +0 -59
  141. package/src/utils/transform.ts +0 -86
  142. package/src/utils/use-isomorphic-layout-effect.ts +0 -7
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/components/map.tsx","../src/components/use-map.tsx","../src/utils/deep-equal.ts","../src/utils/transform.ts","../src/utils/style-utils.ts","../src/maplibre/maplibre.ts","../src/maplibre/create-ref.ts","../src/utils/use-isomorphic-layout-effect.ts","../src/utils/set-globals.ts","../src/components/logo-control.ts","../src/utils/apply-react-style.ts","../src/components/use-control.ts","../src/components/attribution-control.ts","../src/components/marker.ts","../src/utils/compare-class-names.ts","../src/components/popup.ts","../src/components/fullscreen-control.ts","../src/components/geolocate-control.ts","../src/components/navigation-control.ts","../src/components/scale-control.ts","../src/components/terrain-control.ts","../src/components/source.ts","../src/utils/assert.ts","../src/components/layer.ts","../src/exports-maplibre-gl.ts"],"sourcesContent":["export * from \"./exports-maplibre-gl.js\";\nexport { default as default } from \"./exports-maplibre-gl.js\";\n","import * as React from \"react\";\nimport {\n useState,\n useRef,\n useEffect,\n useContext,\n useMemo,\n useImperativeHandle,\n} from \"react\";\n\nimport { MountedMapsContext } from \"./use-map\";\nimport Maplibre, { MaplibreProps } from \"../maplibre/maplibre\";\nimport createRef, { MapRef } from \"../maplibre/create-ref\";\n\nimport type { CSSProperties } from \"react\";\nimport useIsomorphicLayoutEffect from \"../utils/use-isomorphic-layout-effect\";\nimport setGlobals, { GlobalSettings } from \"../utils/set-globals\";\nimport type { MapLib, MapOptions } from \"../types/lib\";\nimport { LogoControl } from \"./logo-control\";\nimport { AttributionControl } from \"./attribution-control\";\n\nexport type MapContextValue = {\n mapLib: MapLib;\n map: MapRef;\n};\n\nexport const MapContext = React.createContext<MapContextValue>(null);\n\ntype MapInitOptions = Omit<\n MapOptions,\n \"style\" | \"container\" | \"bounds\" | \"fitBoundsOptions\" | \"center\"\n>;\n\nexport type MapProps = MapInitOptions &\n MaplibreProps &\n GlobalSettings & {\n mapLib?: MapLib | Promise<MapLib>;\n reuseMaps?: boolean;\n /** Map container id */\n id?: string;\n /** Map container CSS style */\n style?: CSSProperties;\n children?: React.ReactNode;\n /** Show Barikoi logo (default: true) */\n showBarikoiLogo?: boolean;\n /** Show Attribution (default: true) */\n showAttribution?: boolean;\n } & React.RefAttributes<MapRef>;\n\nfunction _Map(props: MapProps, ref: React.Ref<MapRef>) {\n const mountedMapsContext = useContext(MountedMapsContext);\n const [mapInstance, setMapInstance] = useState<Maplibre>(null);\n const containerRef = useRef();\n\n const { current: contextValue } = useRef<MapContextValue>({\n mapLib: null,\n map: null,\n });\n\n useEffect(() => {\n const mapLib = props.mapLib;\n let isMounted = true;\n let maplibre: Maplibre;\n\n Promise.resolve(mapLib || import(\"maplibre-gl\"))\n .then((module: MapLib | { default: MapLib }) => {\n if (!isMounted) {\n return;\n }\n if (!module) {\n throw new Error(\"Invalid mapLib\");\n }\n const mapboxgl = \"Map\" in module ? module : module.default;\n if (!mapboxgl.Map) {\n throw new Error(\"Invalid mapLib\");\n }\n\n setGlobals(mapboxgl, props);\n if (props.reuseMaps) {\n maplibre = Maplibre.reuse(props, containerRef.current);\n }\n if (!maplibre) {\n maplibre = new Maplibre(\n mapboxgl.Map,\n {\n ...props,\n // @ts-ignore - attributionControl is not in the type definition but is supported by maplibre-gl\n attributionControl: false,\n },\n containerRef.current,\n );\n }\n contextValue.map = createRef(maplibre);\n contextValue.mapLib = mapboxgl;\n\n setMapInstance(maplibre);\n mountedMapsContext?.onMapMount(contextValue.map, props.id);\n })\n .catch((error) => {\n const { onError } = props;\n if (onError) {\n onError({\n type: \"error\",\n target: null,\n originalEvent: null,\n error,\n });\n } else {\n console.error(error); // eslint-disable-line\n }\n });\n\n return () => {\n isMounted = false;\n if (maplibre) {\n mountedMapsContext?.onMapUnmount(props.id);\n if (props.reuseMaps) {\n maplibre.recycle();\n } else {\n maplibre.destroy();\n }\n }\n };\n }, []);\n\n useIsomorphicLayoutEffect(() => {\n if (mapInstance) {\n mapInstance.setProps(props);\n }\n });\n\n useImperativeHandle(ref, () => contextValue.map, [mapInstance]);\n\n const style: CSSProperties = useMemo(\n () => ({\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n ...props.style,\n }),\n [props.style],\n );\n\n const CHILD_CONTAINER_STYLE = {\n height: \"100%\",\n };\n\n return (\n <div id={props.id} ref={containerRef} style={style}>\n {mapInstance && (\n <MapContext.Provider value={contextValue}>\n <div mapboxgl-children=\"\" style={CHILD_CONTAINER_STYLE}>\n {/* Automatically include Barikoi Logo and Attribution controls */}\n <LogoControl position=\"bottom-left\" />\n <AttributionControl position=\"bottom-right\" />\n {props.children}\n </div>\n </MapContext.Provider>\n )}\n </div>\n );\n}\n\nexport const Map: React.FC<MapProps> = React.forwardRef(_Map);\n","import * as React from \"react\";\nimport { useState, useCallback, useMemo, useContext } from \"react\";\n\nimport { MapRef } from \"../maplibre/create-ref\";\nimport { MapContext } from \"./map\";\n\ntype MountedMapsContextValue = {\n maps: { [id: string]: MapRef };\n onMapMount: (map: MapRef, id: string) => void;\n onMapUnmount: (id: string) => void;\n};\n\nexport const MountedMapsContext =\n React.createContext<MountedMapsContextValue>(null);\n\nexport const MapProvider: React.FC<{ children?: React.ReactNode }> = (\n props,\n) => {\n const [maps, setMaps] = useState<{ [id: string]: MapRef }>({});\n\n const onMapMount = useCallback((map: MapRef, id: string = \"default\") => {\n setMaps((currMaps) => {\n if (id === \"current\") {\n throw new Error(\"'current' cannot be used as map id\");\n }\n if (currMaps[id]) {\n throw new Error(`Multiple maps with the same id: ${id}`);\n }\n return { ...currMaps, [id]: map };\n });\n }, []);\n\n const onMapUnmount = useCallback((id: string = \"default\") => {\n setMaps((currMaps) => {\n if (currMaps[id]) {\n const nextMaps = { ...currMaps };\n delete nextMaps[id];\n return nextMaps;\n }\n return currMaps;\n });\n }, []);\n\n return (\n <MountedMapsContext.Provider\n value={{\n maps,\n onMapMount,\n onMapUnmount,\n }}\n >\n {props.children}\n </MountedMapsContext.Provider>\n );\n};\n\nexport type MapCollection = {\n [id: string]: MapRef | undefined;\n current?: MapRef;\n};\n\nexport function useMap(): MapCollection {\n const maps = useContext(MountedMapsContext)?.maps;\n const currentMap = useContext(MapContext);\n\n const mapsWithCurrent = useMemo(() => {\n return { ...maps, current: currentMap?.map };\n }, [maps, currentMap]);\n\n return mapsWithCurrent as MapCollection;\n}\n","import type { PointLike } from \"../types/common\";\n\n/**\n * Compare two points\n * @param a\n * @param b\n * @returns true if the points are equal\n */\nexport function arePointsEqual(a?: PointLike, b?: PointLike): boolean {\n const ax = Array.isArray(a) ? a[0] : a ? a.x : 0;\n const ay = Array.isArray(a) ? a[1] : a ? a.y : 0;\n const bx = Array.isArray(b) ? b[0] : b ? b.x : 0;\n const by = Array.isArray(b) ? b[1] : b ? b.y : 0;\n return ax === bx && ay === by;\n}\n\n/* eslint-disable complexity */\n/**\n * Compare any two objects\n * @param a\n * @param b\n * @returns true if the objects are deep equal\n */\nexport function deepEqual(a: unknown, b: unknown): boolean {\n if (a === b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n } else if (Array.isArray(b)) {\n return false;\n }\n if (typeof a === \"object\" && typeof b === \"object\") {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n for (const key of aKeys) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) {\n return false;\n }\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n","import type { MaplibreProps } from \"../maplibre/maplibre\";\nimport type { ViewState } from \"../types/common\";\nimport type { TransformLike } from \"../types/internal\";\nimport { deepEqual } from \"./deep-equal\";\n\n/**\n * Capture a transform's current state\n * @param transform\n * @returns descriptor of the view state\n */\nexport function transformToViewState(tr: TransformLike): ViewState {\n return {\n longitude: tr.center.lng,\n latitude: tr.center.lat,\n zoom: tr.zoom,\n pitch: tr.pitch,\n bearing: tr.bearing,\n padding: tr.padding,\n };\n}\n\n/* eslint-disable complexity */\n/**\n * Applies requested view state to a transform\n * @returns an object containing detected changes\n */\nexport function applyViewStateToTransform(\n /** An object that describes Maplibre's camera state */\n tr: TransformLike,\n /** Props from Map component */\n props: MaplibreProps,\n): Partial<TransformLike> {\n const v: Partial<ViewState> = props.viewState || props;\n const changes: Partial<TransformLike> = {};\n\n if (\n \"longitude\" in v &&\n \"latitude\" in v &&\n (v.longitude !== tr.center.lng || v.latitude !== tr.center.lat)\n ) {\n const LngLat = tr.center.constructor;\n // @ts-expect-error we should not import LngLat class from maplibre-gl because we don't know the source of mapLib\n changes.center = new LngLat(v.longitude, v.latitude);\n }\n if (\"zoom\" in v && v.zoom !== tr.zoom) {\n changes.zoom = v.zoom;\n }\n if (\"bearing\" in v && v.bearing !== tr.bearing) {\n changes.bearing = v.bearing;\n }\n if (\"pitch\" in v && v.pitch !== tr.pitch) {\n changes.pitch = v.pitch;\n }\n if (v.padding && tr.padding && !deepEqual(v.padding, tr.padding)) {\n changes.padding = v.padding;\n }\n return changes;\n}\n","import type { StyleSpecification } from \"../types/style-spec\";\nimport type { ImmutableLike } from \"../types/common\";\n\nconst refProps = [\n \"type\",\n \"source\",\n \"source-layer\",\n \"minzoom\",\n \"maxzoom\",\n \"filter\",\n \"layout\",\n];\n\n// Prepare a map style object for diffing\n// If immutable - convert to plain object\n// Work around some issues in older styles that would fail Mapbox's diffing\nexport function normalizeStyle(\n style: string | StyleSpecification | ImmutableLike<StyleSpecification>,\n): string | StyleSpecification {\n if (!style) {\n return null;\n }\n if (typeof style === \"string\") {\n return style;\n }\n if (\"toJS\" in style) {\n style = style.toJS();\n }\n if (!style.layers) {\n return style;\n }\n const layerIndex = {};\n\n for (const layer of style.layers) {\n layerIndex[layer.id] = layer;\n }\n\n const layers = style.layers.map((layer) => {\n let normalizedLayer: typeof layer = null;\n\n if (\"interactive\" in layer) {\n normalizedLayer = Object.assign({}, layer);\n // Breaks style diffing :(\n // @ts-ignore legacy field not typed\n delete normalizedLayer.interactive;\n }\n\n // Style diffing doesn't work with refs so expand them out manually before diffing.\n // @ts-ignore - ref is a legacy field not included in current type definitions\n const layerRef = layerIndex[layer.ref];\n if (layerRef) {\n normalizedLayer = normalizedLayer || Object.assign({}, layer);\n // @ts-ignore - deleting legacy ref field that's not in type definitions\n delete normalizedLayer.ref;\n // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/deref.js\n for (const propName of refProps) {\n if (propName in layerRef) {\n normalizedLayer[propName] = layerRef[propName];\n }\n }\n }\n\n return normalizedLayer || layer;\n });\n\n // Do not mutate the style object provided by the user\n return { ...style, layers };\n}\n","/* 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 */\n// eslint-disable-next-line no-use-before-define\nexport default class Maplibre {\n private _MapClass: { new (options: unknown): 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 // eslint-disable-next-line no-use-before-define\n static savedMaps: Maplibre[] = [];\n\n constructor(\n MapClass: { new (options: unknown): 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 - accessing private _container property for reuse functionality\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 - accessing private _resizeObserver property for reuse functionality\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 - calling internal _update method to force map reload\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 - temporarily overriding getContext to inject custom WebGL context\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 unknown as { style: unknown; _frame: { cancel: () => void } | null; _render: () => void };\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: Record<string, unknown> = 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: Record<string, unknown> = {\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 maplibre-gl 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 - dynamically accessing event handler from props\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 - dynamically accessing event handler from props\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 TransformLike;\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 - dynamically accessing pointer event handler from props\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","import type { Map as MapInstance } from \"../types/lib\";\nimport type Maplibre from \"./maplibre\";\n\n/** These methods may break the react binding if called directly */\nconst skipMethods = [\n \"setMaxBounds\",\n \"setMinZoom\",\n \"setMaxZoom\",\n \"setMinPitch\",\n \"setMaxPitch\",\n \"setRenderWorldCopies\",\n \"setProjection\",\n \"setStyle\",\n \"addSource\",\n \"removeSource\",\n \"addLayer\",\n \"removeLayer\",\n \"setLayerZoomRange\",\n \"setFilter\",\n \"setPaintProperty\",\n \"setLayoutProperty\",\n \"setLight\",\n \"setTerrain\",\n \"setFog\",\n \"remove\",\n] as const;\n\nexport type MapRef = {\n getMap(): MapInstance;\n} & Omit<MapInstance, (typeof skipMethods)[number]>;\n\nexport default function createRef(mapInstance: Maplibre): MapRef | null {\n if (!mapInstance) {\n return null;\n }\n\n const map = mapInstance.map;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: any = {\n getMap: () => map,\n };\n\n for (const key of getMethodNames(map)) {\n // @ts-expect-error - dynamically binding map methods to result object\n if (!(key in result) && !skipMethods.includes(key)) {\n result[key] = map[key].bind(map);\n }\n }\n\n return result;\n}\n\nfunction getMethodNames(obj: object) {\n const result = new Set<string>();\n\n let proto = obj;\n while (proto) {\n for (const key of Object.getOwnPropertyNames(proto)) {\n if (\n key[0] !== \"_\" &&\n typeof obj[key] === \"function\" &&\n key !== \"fire\" &&\n key !== \"setEventedParent\"\n ) {\n result.add(key);\n }\n }\n proto = Object.getPrototypeOf(proto);\n }\n return Array.from(result);\n}\n","// From https://github.com/streamich/react-use/blob/master/src/useIsomorphicLayoutEffect.ts\n// useLayoutEffect but does not trigger warning in server-side rendering\nimport { useEffect, useLayoutEffect } from \"react\";\n\nconst useIsomorphicLayoutEffect =\n typeof document !== \"undefined\" ? useLayoutEffect : useEffect;\n\nexport default useIsomorphicLayoutEffect;\n","export type GlobalSettings = {\n /** The maximum number of images (raster tiles, sprites, icons) to load in parallel.\n * @default 16\n */\n maxParallelImageRequests?: number;\n /** The map's RTL text plugin. Necessary for supporting the Arabic and Hebrew languages, which are written right-to-left. */\n RTLTextPlugin?: string | { pluginUrl: string; lazy?: boolean };\n /** The number of web workers instantiated on a page with maplibre-gl maps.\n * @default 2\n */\n workerCount?: number;\n /** Provides an interface for loading maplibre-gl's WebWorker bundle from a self-hosted URL.\n * This is useful if your site needs to operate in a strict CSP (Content Security Policy) environment\n * wherein you are not allowed to load JavaScript code from a Blob URL, which is default behavior. */\n workerUrl?: string;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport default function setGlobals(mapLib: any, props: GlobalSettings) {\n const { RTLTextPlugin, maxParallelImageRequests, workerCount, workerUrl } =\n props;\n if (\n RTLTextPlugin &&\n mapLib.getRTLTextPluginStatus &&\n mapLib.getRTLTextPluginStatus() === \"unavailable\"\n ) {\n const { pluginUrl, lazy = true } =\n typeof RTLTextPlugin === \"string\"\n ? { pluginUrl: RTLTextPlugin }\n : RTLTextPlugin;\n\n mapLib.setRTLTextPlugin(\n pluginUrl,\n (error?: Error) => {\n if (error) {\n // eslint-disable-next-line\n console.error(error);\n }\n },\n lazy,\n );\n }\n if (maxParallelImageRequests !== undefined) {\n mapLib.setMaxParallelImageRequests(maxParallelImageRequests);\n }\n if (workerCount !== undefined) {\n mapLib.setWorkerCount(workerCount);\n }\n if (workerUrl !== undefined) {\n mapLib.setWorkerUrl(workerUrl);\n }\n}\n","/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\nimport * as React from \"react\";\nimport { useEffect, memo } from \"react\";\nimport { applyReactStyle } from \"../utils/apply-react-style\";\nimport { useControl } from \"./use-control\";\n\nimport type { ControlPosition, LogoControlOptions, IControl, Map as MaplibreMap } from \"../types/lib\";\n\nexport type LogoControlProps = LogoControlOptions & {\n /** Placement of the control relative to the map. */\n position?: ControlPosition;\n /** CSS style override, applied to the control's container */\n style?: React.CSSProperties;\n};\n\nfunction _LogoControl(props: LogoControlProps) {\n // Create custom control\n const ctrl = useControl(\n () => {\n const control: IControl & { _container?: HTMLElement } = {\n onAdd: (map: MaplibreMap): HTMLElement => {\n // Check if logo already exists \n if (map.getContainer) {\n const existingLogo = map.getContainer().querySelector('a.maplibregl-ctrl-logo[href=\"https://www.barikoi.com\"]');\n if (existingLogo) {\n existingLogo.remove();\n }\n }\n \n const container = document.createElement(\"a\");\n container.className = \"maplibregl-ctrl-logo\";\n container.href = \"https://www.barikoi.com\";\n container.target = \"_blank\";\n container.setAttribute(\"alt\", \"Barikoi\");\n container.setAttribute(\"aria-label\", \"Barikoi logo\");\n container.setAttribute(\"rel\", \"noopener nofollow\");\n control._container = container;\n return container;\n },\n onRemove: (): void => {\n delete control._container;\n },\n };\n return control;\n },\n { position: props.position }\n );\n\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style, ctrl._container]);\n\n return null;\n}\n\nexport const LogoControl: React.FC<LogoControlProps> = memo(_LogoControl);\n","import * as React from \"react\";\n// This is a simplified version of\n// https://github.com/facebook/react/blob/4131af3e4bf52f3a003537ec95a1655147c81270/src/renderers/dom/shared/CSSPropertyOperations.js#L62\nconst unitlessNumber =\n /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;\n\nexport function applyReactStyle(\n element: HTMLElement,\n styles: React.CSSProperties,\n) {\n if (!element || !styles) {\n return;\n }\n const style = element.style;\n\n for (const key in styles) {\n const value = styles[key];\n if (Number.isFinite(value) && !unitlessNumber.test(key)) {\n style[key] = `${value}px`;\n } else {\n style[key] = value;\n }\n }\n}\n","import { useContext, useMemo, useEffect } from \"react\";\nimport type { IControl, ControlPosition } from \"../types/lib\";\nimport { MapContext } from \"./map\";\nimport type { MapContextValue } from \"./map\";\n\ntype ControlOptions = {\n position?: ControlPosition;\n};\n\nexport function useControl<T extends IControl>(\n onCreate: (context: MapContextValue) => T,\n opts?: ControlOptions,\n): T;\n\nexport function useControl<T extends IControl>(\n onCreate: (context: MapContextValue) => T,\n onRemove: (context: MapContextValue) => void,\n opts?: ControlOptions,\n): T;\n\nexport function useControl<T extends IControl>(\n onCreate: (context: MapContextValue) => T,\n onAdd: (context: MapContextValue) => void,\n onRemove: (context: MapContextValue) => void,\n opts?: ControlOptions,\n): T;\n\nexport function useControl<T extends IControl>(\n onCreate: (context: MapContextValue) => T,\n arg1?: ((context: MapContextValue) => void) | ControlOptions,\n arg2?: ((context: MapContextValue) => void) | ControlOptions,\n arg3?: ControlOptions,\n): T {\n const context = useContext(MapContext);\n const ctrl = useMemo(() => onCreate(context), []);\n\n useEffect(() => {\n const opts = (arg3 || arg2 || arg1) as ControlOptions;\n const onAdd =\n typeof arg1 === \"function\" && typeof arg2 === \"function\" ? arg1 : null;\n const onRemove =\n typeof arg2 === \"function\"\n ? arg2\n : typeof arg1 === \"function\"\n ? arg1\n : null;\n\n const { map } = context;\n if (!map.hasControl(ctrl)) {\n map.addControl(ctrl, opts?.position);\n if (onAdd) {\n onAdd(context);\n }\n }\n\n return () => {\n if (onRemove) {\n onRemove(context);\n }\n // Map might have been removed (parent effects are destroyed before child ones)\n if (map.hasControl(ctrl)) {\n map.removeControl(ctrl);\n }\n };\n }, []);\n\n return ctrl;\n}\n","/* eslint-disable max-statements */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\nimport * as React from \"react\";\nimport { useEffect, memo } from \"react\";\nimport { applyReactStyle } from \"../utils/apply-react-style\";\nimport { useControl } from \"./use-control\";\nimport { useMap } from \"./use-map\";\n\nimport type { ControlPosition, AttributionControlOptions } from \"../types/lib\";\n\nexport type AttributionControlProps = AttributionControlOptions & {\n /** Placement of the control relative to the map. */\n position?: ControlPosition;\n /** CSS style override, applied to the control's container */\n style?: React.CSSProperties;\n};\n\nfunction _AttributionControl(props: AttributionControlProps) {\n const { current: map } = useMap();\n \n const ctrl = useControl(\n ({ mapLib }) =>\n new mapLib.AttributionControl({\n compact: true,\n ...props,\n }),\n { position: props.position },\n );\n\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n\n if (!ctrl._container || !map) return;\n\n const onLoad = () => {\n setTimeout(() => {\n const inner = ctrl._container.querySelector(\n \".maplibregl-ctrl-attrib-inner\",\n );\n\n if (inner) {\n inner.innerHTML =\n '© <a href=\"https://barikoi.com\" target=\"_blank\">Barikoi</a> ' +\n '© <a href=\"https://openmaptiles.org\" target=\"_blank\">OpenMapTiles</a> ' +\n '© <a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap contributors</a>';\n }\n }, 0);\n };\n\n if (map.loaded()) {\n onLoad();\n } else {\n map.once(\"load\", onLoad);\n }\n\n return () => {\n map.off(\"load\", onLoad);\n };\n }, [props.style, ctrl._container, map]);\n\n return null;\n}\n\nexport const AttributionControl: React.FC<AttributionControlProps> =\n memo(_AttributionControl);\n","/* global document */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n useImperativeHandle,\n useEffect,\n useMemo,\n useRef,\n useContext,\n forwardRef,\n memo,\n} from \"react\";\nimport { applyReactStyle } from \"../utils/apply-react-style\";\n\nimport type {\n Popup as PopupInstance,\n Marker as MarkerInstance,\n MarkerOptions,\n} from \"../types/lib\";\nimport type { MarkerEvent, MarkerDragEvent } from \"../types/events\";\n\nimport { MapContext } from \"./map\";\nimport { arePointsEqual } from \"../utils/deep-equal\";\nimport { compareClassNames } from \"../utils/compare-class-names\";\n\nexport type MarkerProps = MarkerOptions & {\n /** Longitude of the anchor location */\n longitude: number;\n /** Latitude of the anchor location */\n latitude: number;\n\n popup?: PopupInstance;\n\n /** CSS style override, applied to the control's container */\n style?: React.CSSProperties;\n onClick?: (e: MarkerEvent<MouseEvent>) => void;\n onDragStart?: (e: MarkerDragEvent) => void;\n onDrag?: (e: MarkerDragEvent) => void;\n onDragEnd?: (e: MarkerDragEvent) => void;\n children?: React.ReactNode;\n};\n\n/* eslint-disable complexity,max-statements */\nexport const Marker: React.FC<MarkerProps> = memo(\n forwardRef((props: MarkerProps, ref: React.Ref<MarkerInstance>) => {\n const { map, mapLib } = useContext(MapContext);\n const thisRef = useRef({ props });\n\n const marker: MarkerInstance = useMemo(() => {\n let hasChildren = false;\n React.Children.forEach(props.children, (el) => {\n if (el) {\n hasChildren = true;\n }\n });\n const options = {\n ...props,\n element: hasChildren ? document.createElement(\"div\") : undefined,\n };\n\n const mk = new mapLib.Marker(options);\n mk.setLngLat([props.longitude, props.latitude]);\n\n mk.getElement().addEventListener(\"click\", (e: MouseEvent) => {\n thisRef.current.props.onClick?.({\n type: \"click\",\n target: mk,\n originalEvent: e,\n });\n });\n\n mk.on(\"dragstart\", (e) => {\n const evt = e as MarkerDragEvent;\n evt.lngLat = marker.getLngLat();\n thisRef.current.props.onDragStart?.(evt);\n });\n mk.on(\"drag\", (e) => {\n const evt = e as MarkerDragEvent;\n evt.lngLat = marker.getLngLat();\n thisRef.current.props.onDrag?.(evt);\n });\n mk.on(\"dragend\", (e) => {\n const evt = e as MarkerDragEvent;\n evt.lngLat = marker.getLngLat();\n thisRef.current.props.onDragEnd?.(evt);\n });\n\n return mk;\n }, []);\n\n useEffect(() => {\n marker.addTo(map.getMap());\n\n return () => {\n marker.remove();\n };\n }, []);\n\n const {\n longitude,\n latitude,\n offset,\n style,\n draggable = false,\n popup = null,\n rotation = 0,\n rotationAlignment = \"auto\",\n pitchAlignment = \"auto\",\n } = props;\n\n useEffect(() => {\n applyReactStyle(marker.getElement(), style);\n }, [style]);\n\n useImperativeHandle(ref, () => marker, []);\n\n const oldProps = thisRef.current.props;\n if (\n marker.getLngLat().lng !== longitude ||\n marker.getLngLat().lat !== latitude\n ) {\n marker.setLngLat([longitude, latitude]);\n }\n if (offset && !arePointsEqual(marker.getOffset(), offset)) {\n marker.setOffset(offset);\n }\n if (marker.isDraggable() !== draggable) {\n marker.setDraggable(draggable);\n }\n if (marker.getRotation() !== rotation) {\n marker.setRotation(rotation);\n }\n if (marker.getRotationAlignment() !== rotationAlignment) {\n marker.setRotationAlignment(rotationAlignment);\n }\n if (marker.getPitchAlignment() !== pitchAlignment) {\n marker.setPitchAlignment(pitchAlignment);\n }\n if (marker.getPopup() !== popup) {\n marker.setPopup(popup);\n }\n const classNameDiff = compareClassNames(\n oldProps.className,\n props.className,\n );\n if (classNameDiff) {\n for (const c of classNameDiff) {\n marker.toggleClassName(c);\n }\n }\n\n thisRef.current.props = props;\n return createPortal(props.children, marker.getElement());\n }),\n);\n","/** Compare two classNames string and return the difference */\nexport function compareClassNames(\n prevClassName: string | undefined,\n nextClassName: string | undefined,\n): string[] | null {\n if (prevClassName === nextClassName) {\n return null;\n }\n\n const prevClassList = getClassList(prevClassName);\n const nextClassList = getClassList(nextClassName);\n const diff: string[] = [];\n\n for (const c of nextClassList) {\n if (!prevClassList.has(c)) {\n diff.push(c);\n }\n }\n for (const c of prevClassList) {\n if (!nextClassList.has(c)) {\n diff.push(c);\n }\n }\n return diff.length === 0 ? null : diff;\n}\n\nfunction getClassList(className: string | undefined) {\n return new Set(className ? className.trim().split(/\\s+/) : []);\n}\n","/* eslint-disable @typescript-eslint/no-floating-promises */\n/* global document */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n useImperativeHandle,\n useEffect,\n useMemo,\n useRef,\n useContext,\n forwardRef,\n memo,\n} from \"react\";\nimport { applyReactStyle } from \"../utils/apply-react-style\";\n\nimport type { Popup as PopupInstance, PopupOptions } from \"../types/lib\";\nimport type { PopupEvent } from \"../types/events\";\n\nimport { MapContext } from \"./map\";\nimport { deepEqual } from \"../utils/deep-equal\";\nimport { compareClassNames } from \"../utils/compare-class-names\";\n\nexport type PopupProps = PopupOptions & {\n /** Longitude of the anchor location */\n longitude: number;\n /** Latitude of the anchor location */\n latitude: number;\n\n /** CSS style override, applied to the control's container */\n style?: React.CSSProperties;\n\n onOpen?: (e: PopupEvent) => void;\n onClose?: (e: PopupEvent) => void;\n children?: React.ReactNode;\n};\n\n/* eslint-disable complexity,max-statements */\nexport const Popup: React.FC<PopupProps> = memo(\n forwardRef((props: PopupProps, ref: React.Ref<PopupInstance>) => {\n const { map, mapLib } = useContext(MapContext);\n const container = useMemo(() => {\n return document.createElement(\"div\");\n }, []);\n const thisRef = useRef({ props });\n\n const popup: PopupInstance = useMemo(() => {\n const options = { ...props };\n const pp = new mapLib.Popup(options);\n pp.setLngLat([props.longitude, props.latitude]);\n pp.once(\"open\", (e) => {\n thisRef.current.props.onOpen?.(e as PopupEvent);\n });\n return pp;\n }, []);\n\n useEffect(() => {\n const onClose = (e) => {\n thisRef.current.props.onClose?.(e as PopupEvent);\n };\n popup.on(\"close\", onClose);\n popup.setDOMContent(container).addTo(map.getMap());\n\n return () => {\n // https://github.com/visgl/react-map-gl/issues/1825\n // onClose should not be fired if the popup is removed by unmounting\n // When using React strict mode, the component is mounted twice.\n // Firing the onClose callback here would be a false signal to remove the component.\n popup.off(\"close\", onClose);\n if (popup.isOpen()) {\n popup.remove();\n }\n };\n }, []);\n\n useEffect(() => {\n applyReactStyle(popup.getElement(), props.style);\n }, [props.style]);\n\n useImperativeHandle(ref, () => popup, []);\n\n if (popup.isOpen()) {\n const oldProps = thisRef.current.props;\n if (\n popup.getLngLat().lng !== props.longitude ||\n popup.getLngLat().lat !== props.latitude\n ) {\n popup.setLngLat([props.longitude, props.latitude]);\n }\n if (props.offset && !deepEqual(oldProps.offset, props.offset)) {\n popup.setOffset(props.offset);\n }\n if (\n oldProps.anchor !== props.anchor ||\n oldProps.maxWidth !== props.maxWidth\n ) {\n popup.options.anchor = props.anchor;\n popup.setMaxWidth(props.maxWidth);\n }\n const classNameDiff = compareClassNames(\n oldProps.className,\n props.className,\n );\n if (classNameDiff) {\n for (const c of classNameDiff) {\n popup.toggleClassName(c);\n }\n }\n thisRef.current.props = props;\n }\n\n return createPortal(props.children, container);\n }),\n);\n","/* global document */\nimport * as React from \"react\";\nimport { useEffect, memo } from \"react\";\nimport { applyReactStyle } from \"../utils/apply-react-style\";\nimport { useControl } from \"./use-control\";\n\nimport type { ControlPosition, FullscreenControlOptions } from \"../types/lib\";\n\nexport type FullscreenControlProps = Omit<\n FullscreenControlOptions,\n \"container\"\n> & {\n /** Id of the DOM element which should be made full screen. By default, the map container\n * element will be made full screen. */\n containerId?: string;\n /** Placement of the control relative to the map. */\n position?: ControlPosition;\n /** CSS style override, applied to the control's container */\n style?: React.CSSProperties;\n};\n\nfunction _FullscreenControl(props: FullscreenControlProps) {\n const ctrl = useControl(\n ({ mapLib }) =>\n new mapLib.FullscreenControl({\n container:\n props.containerId && document.getElementById(props.containerId),\n }),\n { position: props.position },\n );\n\n useEffect(() => {\n applyReactStyle(ctrl._controlContainer, props.style);\n }, [props.style]);\n\n return null;\n}\n\nexport const FullscreenControl: React.FC<FullscreenControlProps> =\n memo(_FullscreenControl);\n","import * as React from \"react\";\nimport {\n useImperativeHandle,\n useRef,\n useEffect,\n forwardRef,\n memo,\n} from \"react\";\nimport { applyReactStyle } from \"../utils/apply-react-style\";\nimport { useControl } from \"./use-control\";\n\nimport type {\n ControlPosition,\n GeolocateControl as GeolocateControlInstance,\n GeolocateControlOptions,\n} from \"../types/lib\";\nimport type {\n GeolocateEvent,\n GeolocateResultEvent,\n GeolocateErrorEvent,\n} from \"../types/events\";\n\nexport type GeolocateControlProps = GeolocateControlOptions & {\n /** Placement of the control relative to the map. */\n position?: ControlPosition;\n /** CSS style override, applied to the control's container */\n style?: React.CSSProperties;\n\n /** Called on each Geolocation API position update that returned as success. */\n onGeolocate?: (e: GeolocateResultEvent) => void;\n /** Called on each Geolocation API position update that returned as an error. */\n onError?: (e: GeolocateErrorEvent) => void;\n /** Called on each Geolocation API position update that returned as success but user position\n * is out of map `maxBounds`. */\n onOutOfMaxBounds?: (e: GeolocateResultEvent) => void;\n /** Called when the GeolocateControl changes to the active lock state. */\n onTrackUserLocationStart?: (e: GeolocateEvent) => void;\n /** Called when the GeolocateControl changes to the background state. */\n onTrackUserLocationEnd?: (e: GeolocateEvent) => void;\n};\n\nfunction _GeolocateControl(\n props: GeolocateControlProps,\n ref: React.Ref<GeolocateControlInstance>,\n) {\n const thisRef = useRef({ props });\n\n const ctrl = useControl(\n ({ mapLib }) => {\n const gc = new mapLib.GeolocateControl(props);\n\n // Hack: fix GeolocateControl reuse\n // When using React strict mode, the component is mounted twice.\n // GeolocateControl's UI creation is asynchronous. Removing and adding it back causes the UI to be initialized twice.\n const setupUI = gc._setupUI;\n gc._setupUI = () => {\n if (!gc._container.hasChildNodes()) {\n setupUI();\n }\n };\n\n gc.on(\"geolocate\", (e) => {\n thisRef.current.props.onGeolocate?.(e as GeolocateResultEvent);\n });\n gc.on(\"error\", (e) => {\n thisRef.current.props.onError?.(e as GeolocateErrorEvent);\n });\n gc.on(\"outofmaxbounds\", (e) => {\n thisRef.current.props.onOutOfMaxBounds?.(e as GeolocateResultEvent);\n });\n gc.on(\"trackuserlocationstart\", (e) => {\n thisRef.current.props.onTrackUserLocationStart?.(e as GeolocateEvent);\n });\n gc.on(\"trackuserlocationend\", (e) => {\n thisRef.current.props.onTrackUserLocationEnd?.(e as GeolocateEvent);\n });\n\n return gc;\n },\n { position: props.position },\n );\n\n thisRef.current.props = props;\n\n useImperativeHandle(ref, () => ctrl, []);\n\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n\n return null;\n}\n\nexport const GeolocateControl: React.FC<GeolocateControlProps> = memo(\n forwardRef(_GeolocateControl),\n);\n","import * as React from \"react\";\nimport { useEffect, memo } from \"react\";\nimport { applyReactStyle } from \"../utils/apply-react-style\";\nimport { useControl } from \"./use-control\";\n\nimport type { ControlPosition, NavigationControlOptions } from \"../types/lib\";\n\nexport type NavigationControlProps = NavigationControlOptions & {\n /** Placement of the control relative to the map. */\n position?: ControlPosition;\n /** CSS style override, applied to the control's container */\n style?: React.CSSProperties;\n};\n\nfunction _NavigationControl(props: NavigationControlProps) {\n const ctrl = useControl(({ mapLib }) => new mapLib.NavigationControl(props), {\n position: props.position,\n });\n\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n\n return null;\n}\n\nexport const NavigationControl: React.FC<NavigationControlProps> =\n memo(_NavigationControl);\n","import * as React from \"react\";\nimport { useEffect, useRef, memo } from \"react\";\nimport { applyReactStyle } from \"../utils/apply-react-style\";\nimport { useControl } from \"./use-control\";\n\nimport type { ControlPosition, ScaleControlOptions } from \"../types/lib\";\n\nexport type ScaleControlProps = ScaleControlOptions & {\n // These props will be further constraint by OptionsT\n unit?: string;\n maxWidth?: number;\n\n /** Placement of the control relative to the map. */\n position?: ControlPosition;\n /** CSS style override, applied to the control's container */\n style?: React.CSSProperties;\n};\n\nfunction _ScaleControl(props: ScaleControlProps) {\n const ctrl = useControl(({ mapLib }) => new mapLib.ScaleControl(props), {\n position: props.position,\n });\n const propsRef = useRef<ScaleControlProps>(props);\n\n const prevProps = propsRef.current;\n propsRef.current = props;\n\n const { style } = props;\n\n if (props.maxWidth !== undefined && props.maxWidth !== prevProps.maxWidth) {\n ctrl.options.maxWidth = props.maxWidth;\n }\n if (props.unit !== undefined && props.unit !== prevProps.unit) {\n ctrl.setUnit(props.unit);\n }\n\n useEffect(() => {\n applyReactStyle(ctrl._container, style);\n }, [style]);\n\n return null;\n}\n\nexport const ScaleControl: React.FC<ScaleControlProps> = memo(_ScaleControl);\n","import * as React from \"react\";\nimport { useEffect, memo } from \"react\";\nimport { applyReactStyle } from \"../utils/apply-react-style\";\nimport { useControl } from \"./use-control\";\n\nimport type { ControlPosition } from \"../types/lib\";\nimport type { TerrainSpecification } from \"../types/style-spec\";\n\nexport type TerrainControlProps = TerrainSpecification & {\n /** Placement of the control relative to the map. */\n position?: ControlPosition;\n /** CSS style override, applied to the control's container */\n style?: React.CSSProperties;\n};\n\nfunction _TerrainControl(props: TerrainControlProps) {\n const ctrl = useControl(({ mapLib }) => new mapLib.TerrainControl(props), {\n position: props.position,\n });\n\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n\n return null;\n}\n\nexport const TerrainControl: React.FC<TerrainControlProps> =\n memo(_TerrainControl);\n","import * as React from \"react\";\nimport {\n useContext,\n useEffect,\n useMemo,\n useState,\n useRef,\n cloneElement,\n} from \"react\";\nimport { MapContext } from \"./map\";\nimport assert from \"../utils/assert\";\nimport { deepEqual } from \"../utils/deep-equal\";\n\nimport type {\n GeoJSONSourceImplementation,\n ImageSourceImplementation,\n AnySourceImplementation,\n} from \"../types/internal\";\nimport type { SourceSpecification } from \"../types/style-spec\";\nimport type { Map as MapInstance } from \"../types/lib\";\n\nexport type SourceProps = SourceSpecification & {\n id?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n children?: any;\n};\n\nlet sourceCounter = 0;\n\nfunction createSource(map: MapInstance, id: string, props: SourceProps) {\n // @ts-ignore - accessing internal map.style property\n if (map.style && map.style._loaded) {\n const options = { ...props };\n delete options.id;\n delete options.children;\n // @ts-ignore - addSource accepts options without id\n map.addSource(id, options);\n return map.getSource(id);\n }\n return null;\n}\n\n/* eslint-disable complexity */\nfunction updateSource(\n source: AnySourceImplementation,\n props: SourceProps,\n prevProps: SourceProps,\n) {\n assert(props.id === prevProps.id, \"source id changed\");\n assert(props.type === prevProps.type, \"source type changed\");\n\n let changedKey = \"\";\n let changedKeyCount = 0;\n\n for (const key in props) {\n if (\n key !== \"children\" &&\n key !== \"id\" &&\n !deepEqual(prevProps[key], props[key])\n ) {\n changedKey = key;\n changedKeyCount++;\n }\n }\n\n if (!changedKeyCount) {\n return;\n }\n\n const type = props.type;\n\n if (type === \"geojson\") {\n (source as GeoJSONSourceImplementation).setData(props.data);\n } else if (type === \"image\") {\n (source as ImageSourceImplementation).updateImage({\n url: props.url,\n coordinates: props.coordinates,\n });\n } else {\n switch (changedKey) {\n case \"coordinates\":\n // @ts-ignore - setCoordinates may not exist on all source types\n source.setCoordinates?.(props.coordinates);\n break;\n case \"url\":\n // @ts-ignore - setUrl may not exist on all source types\n source.setUrl?.(props.url);\n break;\n case \"tiles\":\n // @ts-ignore - setTiles may not exist on all source types\n source.setTiles?.(props.tiles);\n break;\n default:\n // eslint-disable-next-line\n console.warn(`Unable to update <Source> prop: ${changedKey}`);\n }\n }\n}\n/* eslint-enable complexity */\n\nexport function Source(props: SourceProps) {\n const map = useContext(MapContext).map.getMap();\n const propsRef = useRef(props);\n const [, setStyleLoaded] = useState(0);\n\n const id = useMemo(() => props.id || `jsx-source-${sourceCounter++}`, []);\n\n useEffect(() => {\n if (map) {\n /* global setTimeout */\n const forceUpdate = () =>\n setTimeout(() => setStyleLoaded((version) => version + 1), 0);\n map.on(\"styledata\", forceUpdate);\n forceUpdate();\n\n return () => {\n map.off(\"styledata\", forceUpdate);\n // @ts-ignore - accessing internal map.style property\n if (map.style && map.style._loaded && map.getSource(id)) {\n // Parent effects are destroyed before child ones, see\n // https://github.com/facebook/react/issues/16728\n // Source can only be removed after all child layers are removed\n const allLayers = map.getStyle()?.layers;\n if (allLayers) {\n for (const layer of allLayers) {\n // @ts-ignore (2339) source does not exist on all layer types\n if (layer.source === id) {\n map.removeLayer(layer.id);\n }\n }\n }\n map.removeSource(id);\n }\n };\n }\n return undefined;\n }, [map]);\n\n // @ts-ignore - accessing internal map.style property\n let source = map && map.style && map.getSource(id);\n if (source) {\n updateSource(source, props, propsRef.current);\n } else {\n source = createSource(map, id, props);\n }\n propsRef.current = props;\n\n return (\n (source &&\n React.Children.map(\n props.children,\n (child) =>\n child &&\n cloneElement(child, {\n source: id,\n }),\n )) ||\n null\n );\n}\n","export default function assert(condition: unknown, message: string) {\n if (!condition) {\n throw new Error(message);\n }\n}\n","import { useContext, useEffect, useMemo, useState, useRef } from \"react\";\nimport { MapContext } from \"./map\";\nimport assert from \"../utils/assert\";\nimport { deepEqual } from \"../utils/deep-equal\";\n\nimport type { Map as MapInstance, CustomLayerInterface } from \"../types/lib\";\nimport type { LayerSpecification } from \"../types/style-spec\";\n\n// Omiting property from a union type, see\n// https://github.com/microsoft/TypeScript/issues/39556#issuecomment-656925230\ntype OptionalId<T> = T extends { id: string }\n ? Omit<T, \"id\"> & { id?: string }\n : T;\ntype OptionalSource<T> = T extends { source: string }\n ? Omit<T, \"source\"> & { source?: string }\n : T;\n\nexport type LayerProps = (\n | OptionalSource<OptionalId<LayerSpecification>>\n | CustomLayerInterface\n) & {\n /** If set, the layer will be inserted before the specified layer */\n beforeId?: string;\n};\n\n/* eslint-disable complexity, max-statements */\nfunction updateLayer(\n map: MapInstance,\n id: string,\n props: LayerProps,\n prevProps: LayerProps,\n) {\n assert(props.id === prevProps.id, \"layer id changed\");\n assert(props.type === prevProps.type, \"layer type changed\");\n\n if (props.type === \"custom\" || prevProps.type === \"custom\") {\n return;\n }\n\n // @ts-ignore filter does not exist in some Layer types\n const { layout = {}, paint = {}, filter, minzoom, maxzoom, beforeId } = props;\n\n if (beforeId !== prevProps.beforeId) {\n map.moveLayer(id, beforeId);\n }\n if (layout !== prevProps.layout) {\n const prevLayout = prevProps.layout || {};\n for (const key in layout) {\n if (!deepEqual(layout[key], prevLayout[key])) {\n map.setLayoutProperty(id, key, layout[key]);\n }\n }\n for (const key in prevLayout) {\n if (!Object.prototype.hasOwnProperty.call(layout, key)) {\n map.setLayoutProperty(id, key, undefined);\n }\n }\n }\n if (paint !== prevProps.paint) {\n const prevPaint = prevProps.paint || {};\n for (const key in paint) {\n if (!deepEqual(paint[key], prevPaint[key])) {\n map.setPaintProperty(id, key, paint[key]);\n }\n }\n for (const key in prevPaint) {\n if (!Object.prototype.hasOwnProperty.call(paint, key)) {\n map.setPaintProperty(id, key, undefined);\n }\n }\n }\n\n // @ts-ignore - filter does not exist in some Layer types\n if (!deepEqual(filter, prevProps.filter)) {\n map.setFilter(id, filter);\n }\n if (minzoom !== prevProps.minzoom || maxzoom !== prevProps.maxzoom) {\n map.setLayerZoomRange(id, minzoom, maxzoom);\n }\n}\n\nfunction createLayer(map: MapInstance, id: string, props: LayerProps) {\n // @ts-ignore - accessing internal map.style property\n if (\n map.style &&\n map.style._loaded &&\n (!(\"source\" in props) || map.getSource(props.source))\n ) {\n const options: LayerProps = { ...props, id };\n delete options.beforeId;\n\n // @ts-ignore - addLayer accepts beforeId as second parameter\n map.addLayer(options, props.beforeId);\n }\n}\n\n/* eslint-enable complexity, max-statements */\n\nlet layerCounter = 0;\n\nexport function Layer(props: LayerProps) {\n const map = useContext(MapContext).map.getMap();\n const propsRef = useRef(props);\n const [, setStyleLoaded] = useState(0);\n\n const id = useMemo(() => props.id || `jsx-layer-${layerCounter++}`, []);\n\n useEffect(() => {\n if (map) {\n const forceUpdate = () => setStyleLoaded((version) => version + 1);\n map.on(\"styledata\", forceUpdate);\n forceUpdate();\n\n return () => {\n map.off(\"styledata\", forceUpdate);\n // @ts-ignore - accessing internal map.style property\n if (map.style && map.style._loaded && map.getLayer(id)) {\n map.removeLayer(id);\n }\n };\n }\n return undefined;\n }, [map]);\n\n // @ts-ignore - accessing internal map.style property to check layer existence\n const layer = map && map.style && map.getLayer(id);\n if (layer) {\n try {\n updateLayer(map, id, props, propsRef.current);\n } catch (error) {\n console.warn(error); // eslint-disable-line\n }\n } else {\n createLayer(map, id, props);\n }\n\n // Store last rendered props\n propsRef.current = props;\n\n return null;\n}\n","import { Map } from \"./components/map\";\nexport { Map };\nexport default Map;\n\nexport { Marker } from \"./components/marker\";\nexport { Popup } from \"./components/popup\";\nexport { AttributionControl } from \"./components/attribution-control\";\nexport { FullscreenControl } from \"./components/fullscreen-control\";\nexport { GeolocateControl } from \"./components/geolocate-control\";\nexport { NavigationControl } from \"./components/navigation-control\";\nexport { ScaleControl } from \"./components/scale-control\";\nexport { TerrainControl } from \"./components/terrain-control\";\nexport { LogoControl } from \"./components/logo-control\";\nexport { Source } from \"./components/source\";\nexport { Layer } from \"./components/layer\";\nexport { useControl } from \"./components/use-control\";\nexport { MapProvider, useMap } from \"./components/use-map\";\n\nexport type { MapProps } from \"./components/map\";\nexport type { MapRef } from \"./maplibre/create-ref\";\nexport type { MarkerProps } from \"./components/marker\";\nexport type { PopupProps } from \"./components/popup\";\nexport type { AttributionControlProps } from \"./components/attribution-control\";\nexport type { FullscreenControlProps } from \"./components/fullscreen-control\";\nexport type { GeolocateControlProps } from \"./components/geolocate-control\";\nexport type { NavigationControlProps } from \"./components/navigation-control\";\nexport type { ScaleControlProps } from \"./components/scale-control\";\nexport type { TerrainControlProps } from \"./components/terrain-control\";\nexport type { LogoControlProps } from \"./components/logo-control\";\nexport type { SourceProps } from \"./components/source\";\nexport type { LayerProps } from \"./components/layer\";\n\n// Types\nexport * from \"./types/common\";\nexport * from \"./types/events\";\nexport * from \"./types/lib\";\nexport * from \"./types/style-spec\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,SAAuB;AACvB,IAAAC,gBAOO;;;ACRP,YAAuB;AACvB,mBAA2D;AAWpD,IAAM,qBACL,oBAAuC,IAAI;AAE5C,IAAM,cAAwD,CACnE,UACG;AACH,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAmC,CAAC,CAAC;AAE7D,QAAM,iBAAa,0BAAY,CAAC,KAAa,KAAa,cAAc;AACtE,YAAQ,CAAC,aAAa;AACpB,UAAI,OAAO,WAAW;AACpB,cAAM,IAAI,MAAM,oCAAoC;AAAA,MACtD;AACA,UAAI,SAAS,EAAE,GAAG;AAChB,cAAM,IAAI,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module","React","import_react","import_react_dom","import_react","import_react","import_react","import_react","import_react","import_react","React","import_react","import_react"]}
@@ -0,0 +1,370 @@
1
+ import * as React from 'react';
2
+ import { CSSProperties } from 'react';
3
+ import { PaddingOptions, MapOptions, Map as Map$1, MarkerOptions, Marker as Marker$1, PopupOptions, Popup as Popup$1, AttributionControlOptions, AttributionControl as AttributionControl$1, FullscreenControlOptions, FullscreenControl as FullscreenControl$1, GeolocateControlOptions, GeolocateControl as GeolocateControl$1, NavigationControlOptions, NavigationControl as NavigationControl$1, ScaleControlOptions, ScaleControl as ScaleControl$1, TerrainSpecification, TerrainControl as TerrainControl$1, LogoControlOptions, LogoControl as LogoControl$1, MapLayerMouseEvent, MapLayerTouchEvent, MapWheelEvent, MapLibreZoomEvent, MapLibreEvent, MapStyleDataEvent, MapSourceDataEvent, LngLat, MapMouseEvent as MapMouseEvent$1, Point, MapGeoJSONFeature, LngLatBoundsLike, PointLike, StyleSpecification, ProjectionSpecification, LightSpecification, SkySpecification, ControlPosition, SourceSpecification, LayerSpecification, CustomLayerInterface, IControl } from 'maplibre-gl';
4
+ export { AttributionControlOptions, BackgroundLayerSpecification, CanvasSourceSpecification, CircleLayerSpecification, ControlPosition, CustomLayerInterface, FillExtrusionLayerSpecification, FillLayerSpecification, FullscreenControlOptions, GeoJSONSourceSpecification, GeolocateControlOptions, HeatmapLayerSpecification, HillshadeLayerSpecification, IControl, ImageSourceSpecification, LayerSpecification, LightSpecification, LineLayerSpecification, LngLat, LngLatBounds, LngLatBoundsLike, LngLatLike, LogoControlOptions, MapLibreZoomEvent as MapBoxZoomEvent, MapLibreEvent as MapEvent, MapGeoJSONFeature, MapLayerMouseEvent, MapLayerTouchEvent, MapOptions, MapSourceDataEvent, MapStyleDataEvent, MapTouchEvent, MapWheelEvent, MarkerOptions, NavigationControlOptions, PaddingOptions, Point, PointLike, PopupOptions, ProjectionSpecification, RasterDEMSourceSpecification, RasterLayerSpecification, RasterSourceSpecification, ScaleControlOptions, SkySpecification, SourceSpecification, StyleSpecification, SymbolLayerSpecification, TerrainSpecification, VectorSourceSpecification, VideoSourceSpecification } from 'maplibre-gl';
5
+
6
+ /** Describes the camera's state */
7
+ type ViewState = {
8
+ /** Longitude at map center */
9
+ longitude: number;
10
+ /** Latitude at map center */
11
+ latitude: number;
12
+ /** Map zoom level */
13
+ zoom: number;
14
+ /** Map rotation bearing in degrees counter-clockwise from north */
15
+ bearing: number;
16
+ /** Map angle in degrees at which the camera is looking at the ground */
17
+ pitch: number;
18
+ /** Dimensions in pixels applied on each side of the viewport for shifting the vanishing point. */
19
+ padding: PaddingOptions;
20
+ };
21
+ interface ImmutableLike<T> {
22
+ toJS: () => T;
23
+ }
24
+
25
+ /**
26
+ * A user-facing type that represents the minimal intersection between Mapbox and Maplibre
27
+ * User provided `mapLib` is supposed to implement this interface
28
+ * Only losely typed for compatibility
29
+ */
30
+ interface MapLib {
31
+ supported?: (options: unknown) => boolean;
32
+ Map: {
33
+ new (options: MapOptions): Map$1;
34
+ };
35
+ Marker: {
36
+ new (options: MarkerOptions): Marker$1;
37
+ };
38
+ Popup: {
39
+ new (options: PopupOptions): Popup$1;
40
+ };
41
+ AttributionControl: {
42
+ new (options: AttributionControlOptions): AttributionControl$1;
43
+ };
44
+ FullscreenControl: {
45
+ new (options: FullscreenControlOptions): FullscreenControl$1;
46
+ };
47
+ GeolocateControl: {
48
+ new (options: GeolocateControlOptions): GeolocateControl$1;
49
+ };
50
+ NavigationControl: {
51
+ new (options: NavigationControlOptions): NavigationControl$1;
52
+ };
53
+ ScaleControl: {
54
+ new (options: ScaleControlOptions): ScaleControl$1;
55
+ };
56
+ TerrainControl: {
57
+ new (options: TerrainSpecification): TerrainControl$1;
58
+ };
59
+ LogoControl: {
60
+ new (options: LogoControlOptions): LogoControl$1;
61
+ };
62
+ }
63
+
64
+ interface MapEvent<SourceT, OriginalEventT = undefined> {
65
+ type: string;
66
+ target: SourceT;
67
+ originalEvent: OriginalEventT;
68
+ }
69
+ type ErrorEvent = MapEvent<Map$1> & {
70
+ type: "error";
71
+ error: Error;
72
+ };
73
+ type MapMouseEvent = MapMouseEvent$1 & {
74
+ point: Point;
75
+ lngLat: LngLat;
76
+ features?: MapGeoJSONFeature[];
77
+ };
78
+ type ViewStateChangeEvent = (MapEvent<Map$1, MouseEvent | TouchEvent | WheelEvent | undefined> & {
79
+ type: "movestart" | "move" | "moveend" | "zoomstart" | "zoom" | "zoomend";
80
+ viewState: ViewState;
81
+ }) | (MapEvent<Map$1, MouseEvent | TouchEvent | undefined> & {
82
+ type: "rotatestart" | "rotate" | "rotateend" | "dragstart" | "drag" | "dragend" | "pitchstart" | "pitch" | "pitchend";
83
+ viewState: ViewState;
84
+ });
85
+ type MapCallbacks = {
86
+ onMouseDown?: (e: MapLayerMouseEvent) => void;
87
+ onMouseUp?: (e: MapLayerMouseEvent) => void;
88
+ onMouseOver?: (e: MapLayerMouseEvent) => void;
89
+ onMouseMove?: (e: MapLayerMouseEvent) => void;
90
+ onClick?: (e: MapLayerMouseEvent) => void;
91
+ onDblClick?: (e: MapLayerMouseEvent) => void;
92
+ onMouseEnter?: (e: MapLayerMouseEvent) => void;
93
+ onMouseLeave?: (e: MapLayerMouseEvent) => void;
94
+ onMouseOut?: (e: MapLayerMouseEvent) => void;
95
+ onContextMenu?: (e: MapLayerMouseEvent) => void;
96
+ onTouchStart?: (e: MapLayerTouchEvent) => void;
97
+ onTouchEnd?: (e: MapLayerTouchEvent) => void;
98
+ onTouchMove?: (e: MapLayerTouchEvent) => void;
99
+ onTouchCancel?: (e: MapLayerTouchEvent) => void;
100
+ onMoveStart?: (e: ViewStateChangeEvent) => void;
101
+ onMove?: (e: ViewStateChangeEvent) => void;
102
+ onMoveEnd?: (e: ViewStateChangeEvent) => void;
103
+ onDragStart?: (e: ViewStateChangeEvent) => void;
104
+ onDrag?: (e: ViewStateChangeEvent) => void;
105
+ onDragEnd?: (e: ViewStateChangeEvent) => void;
106
+ onZoomStart?: (e: ViewStateChangeEvent) => void;
107
+ onZoom?: (e: ViewStateChangeEvent) => void;
108
+ onZoomEnd?: (e: ViewStateChangeEvent) => void;
109
+ onRotateStart?: (e: ViewStateChangeEvent) => void;
110
+ onRotate?: (e: ViewStateChangeEvent) => void;
111
+ onRotateEnd?: (e: ViewStateChangeEvent) => void;
112
+ onPitchStart?: (e: ViewStateChangeEvent) => void;
113
+ onPitch?: (e: ViewStateChangeEvent) => void;
114
+ onPitchEnd?: (e: ViewStateChangeEvent) => void;
115
+ onWheel?: (e: MapWheelEvent) => void;
116
+ onBoxZoomStart?: (e: MapLibreZoomEvent) => void;
117
+ onBoxZoomEnd?: (e: MapLibreZoomEvent) => void;
118
+ onBoxZoomCancel?: (e: MapLibreZoomEvent) => void;
119
+ onResize?: (e: MapLibreEvent) => void;
120
+ onLoad?: (e: MapLibreEvent) => void;
121
+ onRender?: (e: MapLibreEvent) => void;
122
+ onIdle?: (e: MapLibreEvent) => void;
123
+ onError?: (e: ErrorEvent) => void;
124
+ onRemove?: (e: MapLibreEvent) => void;
125
+ onData?: (e: MapStyleDataEvent | MapSourceDataEvent) => void;
126
+ onStyleData?: (e: MapStyleDataEvent) => void;
127
+ onSourceData?: (e: MapSourceDataEvent) => void;
128
+ };
129
+ type PopupEvent = {
130
+ type: "open" | "close";
131
+ target: Popup$1;
132
+ };
133
+ type MarkerEvent<OriginalEventT = undefined> = MapEvent<Marker$1, OriginalEventT>;
134
+ type MarkerDragEvent = MarkerEvent & {
135
+ type: "dragstart" | "drag" | "dragend";
136
+ lngLat: LngLat;
137
+ };
138
+ type GeolocateEvent = MapEvent<GeolocateControl$1>;
139
+ type GeolocateResultEvent = GeolocateEvent & GeolocationPosition;
140
+ type GeolocateErrorEvent = GeolocateEvent & GeolocationPositionError;
141
+
142
+ type MaplibreProps = Partial<ViewState> & MapCallbacks & {
143
+ /** Camera options used when constructing the Map instance */
144
+ initialViewState?: Partial<ViewState> & {
145
+ /** The initial bounds of the map. If bounds is specified, it overrides longitude, latitude and zoom options. */
146
+ bounds?: LngLatBoundsLike;
147
+ /** A fitBounds options object to use only when setting the bounds option. */
148
+ fitBoundsOptions?: {
149
+ offset?: PointLike;
150
+ minZoom?: number;
151
+ maxZoom?: number;
152
+ padding?: number | PaddingOptions;
153
+ };
154
+ };
155
+ /** If provided, render into an external WebGL context */
156
+ gl?: WebGLRenderingContext;
157
+ /** For external controller to override the camera state */
158
+ viewState?: ViewState & {
159
+ width: number;
160
+ height: number;
161
+ };
162
+ /** Mapbox style */
163
+ mapStyle?: string | StyleSpecification | ImmutableLike<StyleSpecification>;
164
+ /** Enable diffing when the map style changes
165
+ * @default true
166
+ */
167
+ styleDiffing?: boolean;
168
+ /** The projection property of the style. Must conform to the Projection Style Specification.
169
+ * @default 'mercator'
170
+ */
171
+ projection?: ProjectionSpecification | "mercator" | "globe";
172
+ /** Light properties of the map. */
173
+ light?: LightSpecification;
174
+ /** Terrain property of the style. Must conform to the Terrain Style Specification.
175
+ * If `undefined` is provided, removes terrain from the map. */
176
+ terrain?: TerrainSpecification;
177
+ /** Sky properties of the map. Must conform to the Sky Style Specification. */
178
+ sky?: SkySpecification;
179
+ /** Default layers to query on pointer events */
180
+ interactiveLayerIds?: string[];
181
+ /** CSS cursor */
182
+ cursor?: string;
183
+ };
184
+
185
+ /** These methods may break the react binding if called directly */
186
+ declare const skipMethods: readonly ["setMaxBounds", "setMinZoom", "setMaxZoom", "setMinPitch", "setMaxPitch", "setRenderWorldCopies", "setProjection", "setStyle", "addSource", "removeSource", "addLayer", "removeLayer", "setLayerZoomRange", "setFilter", "setPaintProperty", "setLayoutProperty", "setLight", "setTerrain", "setFog", "remove"];
187
+ type MapRef = {
188
+ getMap(): Map$1;
189
+ } & Omit<Map$1, (typeof skipMethods)[number]>;
190
+
191
+ type GlobalSettings = {
192
+ /** The maximum number of images (raster tiles, sprites, icons) to load in parallel.
193
+ * @default 16
194
+ */
195
+ maxParallelImageRequests?: number;
196
+ /** The map's RTL text plugin. Necessary for supporting the Arabic and Hebrew languages, which are written right-to-left. */
197
+ RTLTextPlugin?: string | {
198
+ pluginUrl: string;
199
+ lazy?: boolean;
200
+ };
201
+ /** The number of web workers instantiated on a page with maplibre-gl maps.
202
+ * @default 2
203
+ */
204
+ workerCount?: number;
205
+ /** Provides an interface for loading maplibre-gl's WebWorker bundle from a self-hosted URL.
206
+ * This is useful if your site needs to operate in a strict CSP (Content Security Policy) environment
207
+ * wherein you are not allowed to load JavaScript code from a Blob URL, which is default behavior. */
208
+ workerUrl?: string;
209
+ };
210
+
211
+ type MapContextValue = {
212
+ mapLib: MapLib;
213
+ map: MapRef;
214
+ };
215
+ type MapInitOptions = Omit<MapOptions, "style" | "container" | "bounds" | "fitBoundsOptions" | "center">;
216
+ type MapProps = MapInitOptions & MaplibreProps & GlobalSettings & {
217
+ mapLib?: MapLib | Promise<MapLib>;
218
+ reuseMaps?: boolean;
219
+ /** Map container id */
220
+ id?: string;
221
+ /** Map container CSS style */
222
+ style?: CSSProperties;
223
+ children?: React.ReactNode;
224
+ /** Show Barikoi logo (default: true) */
225
+ showBarikoiLogo?: boolean;
226
+ /** Show Attribution (default: true) */
227
+ showAttribution?: boolean;
228
+ } & React.RefAttributes<MapRef>;
229
+ declare const Map: React.FC<MapProps>;
230
+
231
+ type MarkerProps = MarkerOptions & {
232
+ /** Longitude of the anchor location */
233
+ longitude: number;
234
+ /** Latitude of the anchor location */
235
+ latitude: number;
236
+ popup?: Popup$1;
237
+ /** CSS style override, applied to the control's container */
238
+ style?: React.CSSProperties;
239
+ onClick?: (e: MarkerEvent<MouseEvent>) => void;
240
+ onDragStart?: (e: MarkerDragEvent) => void;
241
+ onDrag?: (e: MarkerDragEvent) => void;
242
+ onDragEnd?: (e: MarkerDragEvent) => void;
243
+ children?: React.ReactNode;
244
+ };
245
+ declare const Marker: React.FC<MarkerProps>;
246
+
247
+ type PopupProps = PopupOptions & {
248
+ /** Longitude of the anchor location */
249
+ longitude: number;
250
+ /** Latitude of the anchor location */
251
+ latitude: number;
252
+ /** CSS style override, applied to the control's container */
253
+ style?: React.CSSProperties;
254
+ onOpen?: (e: PopupEvent) => void;
255
+ onClose?: (e: PopupEvent) => void;
256
+ children?: React.ReactNode;
257
+ };
258
+ declare const Popup: React.FC<PopupProps>;
259
+
260
+ type AttributionControlProps = AttributionControlOptions & {
261
+ /** Placement of the control relative to the map. */
262
+ position?: ControlPosition;
263
+ /** CSS style override, applied to the control's container */
264
+ style?: React.CSSProperties;
265
+ };
266
+ declare const AttributionControl: React.FC<AttributionControlProps>;
267
+
268
+ type FullscreenControlProps = Omit<FullscreenControlOptions, "container"> & {
269
+ /** Id of the DOM element which should be made full screen. By default, the map container
270
+ * element will be made full screen. */
271
+ containerId?: string;
272
+ /** Placement of the control relative to the map. */
273
+ position?: ControlPosition;
274
+ /** CSS style override, applied to the control's container */
275
+ style?: React.CSSProperties;
276
+ };
277
+ declare const FullscreenControl: React.FC<FullscreenControlProps>;
278
+
279
+ type GeolocateControlProps = GeolocateControlOptions & {
280
+ /** Placement of the control relative to the map. */
281
+ position?: ControlPosition;
282
+ /** CSS style override, applied to the control's container */
283
+ style?: React.CSSProperties;
284
+ /** Called on each Geolocation API position update that returned as success. */
285
+ onGeolocate?: (e: GeolocateResultEvent) => void;
286
+ /** Called on each Geolocation API position update that returned as an error. */
287
+ onError?: (e: GeolocateErrorEvent) => void;
288
+ /** Called on each Geolocation API position update that returned as success but user position
289
+ * is out of map `maxBounds`. */
290
+ onOutOfMaxBounds?: (e: GeolocateResultEvent) => void;
291
+ /** Called when the GeolocateControl changes to the active lock state. */
292
+ onTrackUserLocationStart?: (e: GeolocateEvent) => void;
293
+ /** Called when the GeolocateControl changes to the background state. */
294
+ onTrackUserLocationEnd?: (e: GeolocateEvent) => void;
295
+ };
296
+ declare const GeolocateControl: React.FC<GeolocateControlProps>;
297
+
298
+ type NavigationControlProps = NavigationControlOptions & {
299
+ /** Placement of the control relative to the map. */
300
+ position?: ControlPosition;
301
+ /** CSS style override, applied to the control's container */
302
+ style?: React.CSSProperties;
303
+ };
304
+ declare const NavigationControl: React.FC<NavigationControlProps>;
305
+
306
+ type ScaleControlProps = ScaleControlOptions & {
307
+ unit?: string;
308
+ maxWidth?: number;
309
+ /** Placement of the control relative to the map. */
310
+ position?: ControlPosition;
311
+ /** CSS style override, applied to the control's container */
312
+ style?: React.CSSProperties;
313
+ };
314
+ declare const ScaleControl: React.FC<ScaleControlProps>;
315
+
316
+ type TerrainControlProps = TerrainSpecification & {
317
+ /** Placement of the control relative to the map. */
318
+ position?: ControlPosition;
319
+ /** CSS style override, applied to the control's container */
320
+ style?: React.CSSProperties;
321
+ };
322
+ declare const TerrainControl: React.FC<TerrainControlProps>;
323
+
324
+ type LogoControlProps = LogoControlOptions & {
325
+ /** Placement of the control relative to the map. */
326
+ position?: ControlPosition;
327
+ /** CSS style override, applied to the control's container */
328
+ style?: React.CSSProperties;
329
+ };
330
+ declare const LogoControl: React.FC<LogoControlProps>;
331
+
332
+ type SourceProps = SourceSpecification & {
333
+ id?: string;
334
+ children?: any;
335
+ };
336
+ declare function Source(props: SourceProps): any;
337
+
338
+ type OptionalId<T> = T extends {
339
+ id: string;
340
+ } ? Omit<T, "id"> & {
341
+ id?: string;
342
+ } : T;
343
+ type OptionalSource<T> = T extends {
344
+ source: string;
345
+ } ? Omit<T, "source"> & {
346
+ source?: string;
347
+ } : T;
348
+ type LayerProps = (OptionalSource<OptionalId<LayerSpecification>> | CustomLayerInterface) & {
349
+ /** If set, the layer will be inserted before the specified layer */
350
+ beforeId?: string;
351
+ };
352
+ declare function Layer(props: LayerProps): any;
353
+
354
+ type ControlOptions = {
355
+ position?: ControlPosition;
356
+ };
357
+ declare function useControl<T extends IControl>(onCreate: (context: MapContextValue) => T, opts?: ControlOptions): T;
358
+ declare function useControl<T extends IControl>(onCreate: (context: MapContextValue) => T, onRemove: (context: MapContextValue) => void, opts?: ControlOptions): T;
359
+ declare function useControl<T extends IControl>(onCreate: (context: MapContextValue) => T, onAdd: (context: MapContextValue) => void, onRemove: (context: MapContextValue) => void, opts?: ControlOptions): T;
360
+
361
+ declare const MapProvider: React.FC<{
362
+ children?: React.ReactNode;
363
+ }>;
364
+ type MapCollection = {
365
+ [id: string]: MapRef | undefined;
366
+ current?: MapRef;
367
+ };
368
+ declare function useMap(): MapCollection;
369
+
370
+ export { AttributionControl, type AttributionControlProps, type ErrorEvent, FullscreenControl, type FullscreenControlProps, GeolocateControl, type GeolocateControlProps, type GeolocateErrorEvent, type GeolocateEvent, type GeolocateResultEvent, type ImmutableLike, Layer, type LayerProps, LogoControl, type LogoControlProps, Map, type MapCallbacks, type MapLib, type MapMouseEvent, type MapProps, MapProvider, type MapRef, Marker, type MarkerDragEvent, type MarkerEvent, type MarkerProps, NavigationControl, type NavigationControlProps, Popup, type PopupEvent, type PopupProps, ScaleControl, type ScaleControlProps, Source, type SourceProps, TerrainControl, type TerrainControlProps, type ViewState, type ViewStateChangeEvent, Map as default, useControl, useMap };