react-bkoi-gl 2.0.1 → 2.1.0
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.
- package/README.md +1420 -176
- package/dist/index.cjs +1181 -174
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +548 -48
- package/dist/index.d.ts +548 -48
- package/dist/index.js +1189 -203
- package/dist/index.js.map +1 -1
- package/dist/styles/react-bkoi-gl.css +95 -1
- package/package.json +28 -8
package/dist/index.cjs.map
CHANGED
|
@@ -1 +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,MAAM,mCAAmC,EAAE,EAAE;AAAA,MACzD;AACA,aAAO,EAAE,GAAG,UAAU,CAAC,EAAE,GAAG,IAAI;AAAA,IAClC,CAAC;AAAA,EACH,GAAG,CAAC,CAAC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AU,IAAI,UAAU,MAAM,MAAM,IACnD;AACA,UAAM,UAAsB,EAAE,GAAG,OAAO,GAAG;AAC3C,WAAO,QAAQ;AAGf,QAAI,SAAS,SAAS,MAAM,QAAQ;AAAA,EACtC;AACF;AAIA,IAAI,eAAe;AAEZ,SAAS,MAAM,OAAmB;AACvC,QAAM,UAAM,2BAAW,UAAU,EAAE,IAAI,OAAO;AAC9C,QAAM,eAAW,uBAAO,KAAK;AAC7B,QAAM,CAAC,EAAE,cAAc,QAAI,yBAAS,CAAC;AAErC,QAAM,SAAK,wBAAQ,MAAM,MAAM,MAAM,aAAa,cAAc,IAAI,CAAC,CAAC;AAEtE,gCAAU,MAAM;AACd,QAAI,KAAK;AACP,YAAM,cAAc,MAAM,eAAe,CAAC,YAAY,UAAU,CAAC;AACjE,UAAI,GAAG,aAAa,WAAW;AAC/B,kBAAY;AAEZ,aAAO,MAAM;AACX,YAAI,IAAI,aAAa,WAAW;AAEhC,YAAI,IAAI,SAAS,IAAI,MAAM,WAAW,IAAI,SAAS,EAAE,GAAG;AACtD,cAAI,YAAY,EAAE;AAAA,QACpB;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,GAAG,CAAC;AAGR,QAAM,QAAQ,OAAO,IAAI,SAAS,IAAI,SAAS,EAAE;AACjD,MAAI,OAAO;AACT,QAAI;AACF,kBAAY,KAAK,IAAI,OAAO,SAAS,OAAO;AAAA,IAC9C,SAAS,OAAO;AACd,cAAQ,KAAK,KAAK;AAAA,IACpB;AAAA,EACF,OAAO;AACL,gBAAY,KAAK,IAAI,KAAK;AAAA,EAC5B;AAGA,WAAS,UAAU;AAEnB,SAAO;AACT;;;AC1IA,IAAO,8BAAQ;","names":["React","import_react","import_react","import_react","import_react","import_react","module","React","import_react","import_react_dom","import_react","import_react","import_react","import_react","import_react","import_react","React","import_react","import_react"]}
|
|
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/canvas-source.ts","../src/components/layer.ts","../src/components/draw-control.ts","../src/components/globe-control.ts","../src/components/minimap-control.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 { useState, useRef, useEffect, useContext, useMemo, useImperativeHandle } 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 type { MapOptionsInternal } from '../types/internal'\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 } & 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 | null = null\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 attributionControl: false,\n } as MapOptions & MapOptionsInternal & MaplibreProps,\n containerRef.current\n )\n }\n if (maplibre) {\n contextValue.map = createRef(maplibre)\n contextValue.mapLib = mapboxgl\n setMapInstance(maplibre)\n }\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)\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 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 = React.createContext<MountedMapsContextValue>(null)\n\nexport const MapProvider: React.FC<{ children?: React.ReactNode }> = props => {\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 // If currentMap is available from MapContext, use it\n // Otherwise, fall back to the first registered map from MountedMapsContext\n const current = currentMap?.map || (maps ? Object.values(maps)[0] : undefined)\n return { ...maps, current }\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/**\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/**\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 = ['type', 'source', 'source-layer', 'minzoom', 'maxzoom', 'filter', 'layout']\n\n// Legacy layer type with optional fields not in current type definitions\ninterface LegacyLayer {\n id: string\n interactive?: boolean\n ref?: string\n [key: string]: unknown\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 | null {\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: Record<string, LegacyLayer> = {}\n\n for (const layer of style.layers) {\n layerIndex[layer.id] = layer as LegacyLayer\n }\n\n const layers = style.layers.map(layer => {\n const legacyLayer = layer as LegacyLayer\n let normalizedLayer: LegacyLayer | null = null\n\n if ('interactive' in legacyLayer) {\n normalizedLayer = Object.assign({}, legacyLayer)\n // Breaks style diffing :(\n delete normalizedLayer.interactive\n }\n\n // Style diffing doesn't work with refs so expand them out manually before diffing.\n const layerRef = layerIndex[legacyLayer.ref as string]\n if (layerRef) {\n normalizedLayer = normalizedLayer || Object.assign({}, legacyLayer)\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) as typeof layer\n })\n\n // Do not mutate the style object provided by the user\n return { ...style, layers }\n}\n","import { transformToViewState, applyViewStateToTransform } from '../utils/transform'\nimport { normalizeStyle } from '../utils/style-utils'\nimport { deepEqual } from '../utils/deep-equal'\n\nimport type { TransformLike, MapInternalProperties, MapWithProjection } 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\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 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 (settingsChanged || sizeChanged || (viewStateChanged && !this._map.isMoving())) {\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 const mapInternal = map as unknown as MapInternalProperties\n mapInternal._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 const resizeObserver = mapInternal._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 const mapInternalForUpdate = map as unknown as MapInternalProperties\n mapInternalForUpdate._update()\n return that\n }\n\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 = 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 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 const mapWithProjection = map as unknown as MapWithProjection\n this._styleComponents = {\n light: map.getLight(),\n sky: map.getSky(),\n projection: mapWithProjection.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\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 {\n style: unknown\n _frame: { cancel: () => void } | null\n _render: () => void\n }\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 (viewState.width !== map.transform.width || viewState.height !== map.transform.height) {\n map.resize()\n return true\n }\n }\n return false\n }\n\n // Adapted from map.jumpTo\n /* Update camera to match props\n @param {object} nextProps\n @param {bool} triggerEvents - should fire camera events\n @returns {bool} true if anything is changed\n */\n 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(nextProps: MaplibreProps, currProps: MaplibreProps): boolean {\n const map = this._map\n let changed = false\n for (const propName of settingNames) {\n if (propName in nextProps && !deepEqual(nextProps[propName], currProps[propName])) {\n changed = true\n const setter = map[`set${propName[0].toUpperCase()}${propName.slice(1)}`]\n setter?.call(map, nextProps[propName])\n }\n }\n return changed\n }\n\n /* Update map style to match props */\n private _updateStyle(nextProps: MaplibreProps, currProps: MaplibreProps): 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 // Mapbox specific prop not in maplibre types\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({ light, projection, sky, terrain }: MaplibreProps): void {\n const map = this._map\n const currProps = this._styleComponents\n const mapWithProjection = map as unknown as MapWithProjection\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 = typeof projection === 'string' ? { type: projection } : projection\n mapWithProjection.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(nextProps: MaplibreProps, currProps: MaplibreProps): 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 const handlerName = otherEvents[e.type] as keyof MapCallbacks\n const cb = this.props[handlerName] as ((e: MapEvent) => void) | undefined\n if (cb) {\n cb(e)\n } else if (e.type === 'error') {\n console.error((e as ErrorEvent).error)\n }\n }\n\n private _onCameraEvent = (e: ViewStateChangeEvent) => {\n if (this._internalUpdate) {\n return\n }\n e.viewState = this._propsedCameraUpdate || transformToViewState(this._map.transform)\n const handlerName = cameraEvents[e.type] as keyof MapCallbacks\n const cb = this.props[handlerName] as ((e: ViewStateChangeEvent) => void) | undefined\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 && (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 const handlerName = pointerEvents[e.type as keyof typeof pointerEvents] as keyof MapCallbacks\n const cb = this.props[handlerName] as ((e: MapMouseEvent) => void) | undefined\n if (cb) {\n if (this.props.interactiveLayerIds && e.type !== 'mouseover' && e.type !== 'mouseout') {\n e.features = this._hoveredFeatures || this._queryRenderedFeatures(e.point)\n }\n cb(e)\n delete e.features\n }\n }\n}\n","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\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 = 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/**\n * Validates that a URL uses a safe protocol (http/https)\n */\nconst validateUrl = (url: string, settingName: string): boolean => {\n try {\n const parsed = new URL(url)\n if (!['http:', 'https:'].includes(parsed.protocol)) {\n console.warn(`${settingName}: Only http/https protocols are allowed, got: ${parsed.protocol}`)\n return false\n }\n return true\n } catch {\n console.warn(`${settingName}: Invalid URL format: ${url}`)\n return false\n }\n}\n\nexport default function setGlobals(mapLib: any, props: GlobalSettings) {\n const { RTLTextPlugin, maxParallelImageRequests, workerCount, workerUrl } = props\n if (\n RTLTextPlugin &&\n mapLib.getRTLTextPluginStatus &&\n mapLib.getRTLTextPluginStatus() === 'unavailable'\n ) {\n const { pluginUrl, lazy = true } =\n typeof RTLTextPlugin === 'string' ? { pluginUrl: RTLTextPlugin } : RTLTextPlugin\n\n if (validateUrl(pluginUrl, 'RTLTextPlugin')) {\n mapLib.setRTLTextPlugin(\n pluginUrl,\n (error?: Error) => {\n if (error) {\n console.error(error)\n }\n },\n lazy\n )\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 if (validateUrl(workerUrl, 'workerUrl')) {\n mapLib.setWorkerUrl(workerUrl)\n }\n }\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 {\n ControlPosition,\n LogoControlOptions,\n IControl,\n Map as MaplibreMap,\n} 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\n .getContainer()\n .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 = /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/\n\nexport function applyReactStyle(element: HTMLElement, styles: React.CSSProperties) {\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, MapControl } 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 MapControl>(\n onCreate: (context: MapContextValue) => T,\n opts?: ControlOptions\n): T\n\nexport function useControl<T extends MapControl>(\n onCreate: (context: MapContextValue) => T,\n onRemove: (context: MapContextValue) => void,\n opts?: ControlOptions\n): T\n\nexport function useControl<T extends MapControl>(\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 MapControl>(\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\n if (!context) {\n throw new Error('useControl must be used within a Map component')\n }\n\n const ctrl = useMemo(() => onCreate(context), [])\n\n useEffect(() => {\n const opts = (arg3 || arg2 || arg1) as ControlOptions\n const onAdd = typeof arg1 === 'function' && typeof arg2 === 'function' ? arg1 : null\n const onRemove = typeof arg2 === 'function' ? arg2 : typeof arg1 === 'function' ? arg1 : null\n\n const { map } = context\n const ctrlAsIControl = ctrl as unknown as IControl\n if (!map.hasControl(ctrlAsIControl)) {\n map.addControl(ctrlAsIControl, 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(ctrlAsIControl)) {\n map.removeControl(ctrlAsIControl)\n }\n }\n }, [])\n\n return ctrl\n}\n","import * 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('.maplibregl-ctrl-attrib-inner')\n\n if (inner) {\n // Use DOM APIs instead of innerHTML for security\n inner.textContent = ''\n\n const createLink = (text: string, href: string) => {\n const a = document.createElement('a')\n a.href = href\n a.target = '_blank'\n a.rel = 'noopener noreferrer'\n a.textContent = text\n return a\n }\n\n inner.appendChild(createLink('Barikoi', 'https://barikoi.com'))\n inner.appendChild(document.createTextNode(' © '))\n inner.appendChild(createLink('OpenMapTiles', 'https://openmaptiles.org'))\n inner.appendChild(document.createTextNode(' © '))\n inner.appendChild(\n createLink('OpenStreetMap contributors', 'https://www.openstreetmap.org/copyright')\n )\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> = 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 { Popup as PopupInstance, Marker as MarkerInstance, MarkerOptions } 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\nexport const Marker: React.FC<MarkerProps> = memo(\n forwardRef((props: MarkerProps, ref: React.Ref<MarkerInstance>) => {\n const { map, mapLib } = useContext(MapContext)\n const callbackRef = useRef<{\n onClick?: MarkerProps['onClick']\n onDragStart?: MarkerProps['onDragStart']\n onDrag?: MarkerProps['onDrag']\n onDragEnd?: MarkerProps['onDragEnd']\n }>({})\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 return mk\n }, [])\n\n useEffect(() => {\n callbackRef.current = {\n onClick: props.onClick,\n onDragStart: props.onDragStart,\n onDrag: props.onDrag,\n onDragEnd: props.onDragEnd,\n }\n })\n\n useEffect(() => {\n const clickHandler = (e: MouseEvent) => {\n callbackRef.current.onClick?.({\n type: 'click',\n target: marker,\n originalEvent: e,\n })\n }\n\n marker.getElement().addEventListener('click', clickHandler)\n\n const dragStartHandler = (e: MarkerDragEvent) => {\n e.lngLat = marker.getLngLat()\n callbackRef.current.onDragStart?.(e)\n }\n\n const dragHandler = (e: MarkerDragEvent) => {\n e.lngLat = marker.getLngLat()\n callbackRef.current.onDrag?.(e)\n }\n\n const dragEndHandler = (e: MarkerDragEvent) => {\n e.lngLat = marker.getLngLat()\n callbackRef.current.onDragEnd?.(e)\n }\n\n marker.on('dragstart', dragStartHandler)\n marker.on('drag', dragHandler)\n marker.on('dragend', dragEndHandler)\n\n marker.addTo(map.getMap())\n\n return () => {\n marker.getElement().removeEventListener('click', clickHandler)\n marker.off('dragstart', dragStartHandler)\n marker.off('drag', dragHandler)\n marker.off('dragend', dragEndHandler)\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 className,\n } = props\n\n useEffect(() => {\n applyReactStyle(marker.getElement(), style)\n }, [style])\n\n useImperativeHandle(ref, () => marker, [])\n\n const prevClassNameRef = useRef(className)\n\n // Intentionally no dependency array - we need to update marker properties on every render\n // to ensure they reflect the latest props. This avoids stale prop issues and is safe\n // because the marker's setter methods are idempotent.\n useEffect(() => {\n if (marker.getLngLat().lng !== longitude || marker.getLngLat().lat !== latitude) {\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(prevClassNameRef.current, className)\n if (classNameDiff) {\n for (const c of classNameDiff) {\n marker.toggleClassName(c)\n }\n }\n prevClassNameRef.current = className\n })\n\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","/* global document */\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { useImperativeHandle, useEffect, useMemo, useContext, forwardRef, memo } from 'react'\nimport { applyReactStyle } from '../utils/apply-react-style'\n\nimport type { Popup as PopupInstance, PopupOptions, MapMouseEventBase } from '../types/lib'\nimport type { PopupEvent } from '../types/events'\n\nimport { MapContext } from './map'\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\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\n const popup: PopupInstance = useMemo(() => {\n const options = { ...props }\n const pp = new mapLib.Popup(options)\n pp.setLngLat([props.longitude, props.latitude])\n return pp\n }, [])\n\n useImperativeHandle(ref, () => popup, [])\n\n useEffect(() => {\n const onOpen = (e: MapMouseEventBase) => {\n props.onOpen?.(e as unknown as PopupEvent)\n }\n const onClose = (e: MapMouseEventBase) => {\n props.onClose?.(e as unknown as PopupEvent)\n }\n popup.on('open', onOpen)\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('open', onOpen)\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 useEffect(() => {\n if (popup.isOpen()) {\n if (popup.getLngLat().lng !== props.longitude || popup.getLngLat().lat !== props.latitude) {\n popup.setLngLat([props.longitude, props.latitude])\n }\n }\n }, [props.longitude, props.latitude])\n\n useEffect(() => {\n if (popup.isOpen() && props.offset) {\n popup.setOffset(props.offset)\n }\n }, [props.offset])\n\n useEffect(() => {\n if (popup.isOpen() && props.maxWidth !== undefined) {\n popup.setMaxWidth(props.maxWidth)\n }\n }, [props.maxWidth])\n\n useEffect(() => {\n if (popup.isOpen() && props.className) {\n const currentClassName = popup.options.className || ''\n const classNameDiff = compareClassNames(currentClassName, props.className)\n if (classNameDiff) {\n for (const c of classNameDiff) {\n popup.toggleClassName(c)\n }\n }\n }\n }, [props.className])\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<FullscreenControlOptions, 'container'> & {\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: 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> = memo(_FullscreenControl)\n","import * as React from 'react'\nimport { useImperativeHandle, useRef, useEffect, forwardRef, memo } 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 { GeolocateEvent, GeolocateResultEvent, GeolocateErrorEvent } 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(props: GeolocateControlProps, ref: React.Ref<GeolocateControlInstance>) {\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(forwardRef(_GeolocateControl))\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> = 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, maxWidth, unit } = props\n\n // Move prop updates to useEffect to avoid render-phase side effects\n useEffect(() => {\n if (maxWidth !== undefined && maxWidth !== prevProps.maxWidth) {\n ctrl.options.maxWidth = maxWidth\n }\n if (unit !== undefined && unit !== prevProps.unit) {\n ctrl.setUnit(unit)\n }\n }, [ctrl, maxWidth, unit, prevProps.maxWidth, prevProps.unit])\n\n useEffect(() => {\n applyReactStyle(ctrl._container, style)\n }, [ctrl, 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> = memo(_TerrainControl)\n","/**\n * @fileoverview Source component for adding data sources to a MapLibre GL map.\n *\n * Sources define the data that layers can render. This component supports all\n * MapLibre GL source types including GeoJSON, vector tiles, raster tiles. image. and video.\n *\n * @module components/source\n * @see {@link https://maplibre.org/maplibre-gl-js/docs/sources/}\n */\n\nimport * as React from 'react'\nimport {\n useContext,\n useEffect,\n useMemo,\n useState,\n useRef,\n cloneElement,\n memo,\n useId,\n forwardRef,\n useImperativeHandle,\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 MapInternalProperties,\n SourceWithOptionalMethods,\n LayerWithSource,\n} from '../types/internal'\nimport type { SourceSpecification } from '../types/style-spec'\nimport type { Map as MapInstance } from '../types/lib'\n\n/**\n * Props for the Source component.\n *\n * @typedef {Object} SourceProps\n * @property {string} [id] - Unique identifier for the source. If not provided. one will be generated automatically.\n * @property {React.ReactNode} [children] - Child Layer components that will use this source.\n * @extends {SourceSpecification}\n *\n * @example\n * ```tsx\n * // GeoJSON source with a layer\n * <Source id=\"my-data\" type=\"geojson\" data={geojsonData}>\n * <Layer id=\"points-layer\" type=\"circle\" paint={{ 'circle-radius': 8 }} />\n * </Source>\n *\n * // Vector tile source\n * <Source id=\"streets\" type=\"vector\" url=\"mapbox://streets-v11\" />\n *\n * // Raster source\n * <Source id=\"satellite\" type=\"raster\" tiles={['https://example.com/tiles/{z}/{x}/{y}.png']} tileSize={256} />\n * ```\n */\nexport type SourceProps = SourceSpecification & {\n /** Unique identifier for the source. If not provided. one will be generated automatically. */\n id?: string\n\n /** Child Layer components that will use this source. */\n children?: any\n}\n\n/**\n * Creates a new source on the map.\n *\n * @param {MapInstance} map - The MapLibre GL map instance\n * @param {string} id - Unique identifier for the source\n * @param {SourceProps} props - Source properties\n * @returns {AnySourceImplementation | null} The created source or null if style not loaded\n * @private\n */\nfunction createSource(\n map: MapInstance,\n id: string,\n props: SourceProps\n): AnySourceImplementation | null {\n const mapInternal = map as unknown as MapInternalProperties\n if (mapInternal.style && mapInternal.style._loaded) {\n const options = { ...props }\n delete options.id\n delete options.children\n map.addSource(id, options as SourceSpecification)\n return map.getSource(id)\n }\n return null\n}\n\n/**\n * Updates an existing source with new properties.\n *\n * Handles updates for different source types:\n * - GeoJSON sources: updates data via setData()\n * - Image sources: updates via updateImage()\n * - Other sources: uses optional setCoordinates. setUrl. or setTiles methods\n *\n * @param {AnySourceImplementation} source - The source to update\n * @param {SourceProps} props - New properties\n * @param {SourceProps} prevProps - Previous properties\n * @throws {Error} If source id or type changes\n * @private\n */\nfunction updateSource(\n source: AnySourceImplementation,\n props: SourceProps,\n prevProps: SourceProps\n): void {\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 (key !== 'children' && key !== 'id' && !deepEqual(prevProps[key], props[key])) {\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 const sourceWithMethods = source as unknown as SourceWithOptionalMethods\n const propsWithOptional = props as Record<string, unknown>\n switch (changedKey) {\n case 'coordinates':\n sourceWithMethods.setCoordinates?.(propsWithOptional.coordinates)\n break\n case 'url':\n sourceWithMethods.setUrl?.(propsWithOptional.url as string)\n break\n case 'tiles':\n sourceWithMethods.setTiles?.(propsWithOptional.tiles as string[])\n break\n default:\n console.warn(`Unable to update <Source> prop: ${changedKey}`)\n }\n }\n}\n\n/**\n * Source component for adding data sources to a MapLibre GL map.\n *\n * Sources define the data that layers render. Supports all MapLibre GL source\n * types including GeoJSON. vector tiles. raster tiles. image. and video.\n *\n * @component\n * @example\n * ```tsx\n * // GeoJSON source with a layer\n * <Source id=\"my-data\" type=\"geojson\" data={geojsonData}>\n * <Layer id=\"points-layer\" type=\"circle\" paint={{ 'circle-radius': 8 }} />\n * </Source>\n *\n * // Vector tile source\n * <Source id=\"streets\" type=\"vector\" url=\"mapbox://streets-v11\" />\n *\n * // Raster source\n * <Source id=\"satellite\" type=\"raster\" tiles={['https://example.com/tiles/{z}/{x}/{y}.png']} tileSize={256} />\n *\n * // With ref forwarding\n * const sourceRef = useRef(null);\n * <Source ref={sourceRef} id=\"my-data\" type=\"geojson\" data={data}>\n * <Layer type=\"circle\" />\n * </Source>\n *\n * // Access source methods\n * useEffect(() => {\n * if (sourceRef.current) {\n * sourceRef.current.setData(newData);\n * }\n * }, [newData]);\n * ```\n */\nfunction _Source(props: SourceProps, ref: React.Ref<AnySourceImplementation | null>) {\n const map = useContext(MapContext).map.getMap()\n const propsRef = useRef(props)\n const sourceRef = useRef<AnySourceImplementation | null>(null)\n const [, setStyleLoaded] = useState(0)\n\n // Generate a stable ID once on mount\n // Note: props.id changes after mount will trigger an error in updateSource\n const generatedId = useId()\n const id = useMemo(\n () => props.id || `jsx-source-${generatedId.replace(/:/g, '-')}`,\n // Empty deps - id is set once on mount and should not change\n []\n )\n\n useEffect(() => {\n if (map) {\n /* global setTimeout */\n const forceUpdate = () => setTimeout(() => setStyleLoaded(version => version + 1), 0)\n map.on('styledata', forceUpdate)\n forceUpdate()\n\n return () => {\n map.off('styledata', forceUpdate)\n const mapInternal = map as unknown as MapInternalProperties\n if (mapInternal.style && mapInternal.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 const layerWithSource = layer as unknown as LayerWithSource\n if (layerWithSource.source === id) {\n map.removeLayer(layer.id)\n }\n }\n }\n map.removeSource(id)\n }\n }\n }\n return undefined\n }, [map])\n\n const mapInternal = map as unknown as MapInternalProperties\n let source = map && mapInternal.style && map.getSource(id)\n if (source) {\n updateSource(source, props, propsRef.current)\n } else {\n source = createSource(map, id, props)\n }\n\n // Update source ref for imperative handle\n sourceRef.current = source\n propsRef.current = props\n\n // Expose source instance via ref\n useImperativeHandle(ref, () => sourceRef.current, [source])\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\nexport const Source = memo(React.forwardRef(_Source))\n","export default function assert(condition: unknown, message: string) {\n if (!condition) {\n throw new Error(message)\n }\n}\n","/**\n * @fileoverview CanvasSource component for adding canvas-based data sources to a MapLibre GL map.\n *\n * Canvas sources allow rendering custom HTML canvas elements as map layers.\n * This is useful for dynamic, animated, or custom-rendered data overlays.\n *\n * @module components/canvas-source\n * @see {@link https://maplibre.org/maplibre-gl-js/docs/sources/}\n */\n\nimport * as React from 'react'\nimport { useContext, useEffect, useMemo, useRef, useState, memo } from 'react'\nimport { MapContext } from './map'\n\nimport type { Map as MapInstance } from '../types/lib'\nimport type { MapInternalProperties, SourceWithOptionalMethods } from '../types/internal'\n\n/**\n * Coordinates for the canvas corners [top-left, top-right, bottom-right, bottom-left]\n */\nexport type CanvasCoordinates = [\n [number, number], // top-left [lng, lat]\n [number, number], // top-right [lng, lat]\n [number, number], // bottom-right [lng, lat]\n [number, number], // bottom-left [lng, lat]\n]\n\n/**\n * Props for the CanvasSource component.\n *\n * @typedef {Object} CanvasSourceProps\n * @property {string} [id] - Unique identifier for the source.\n * @property {CanvasCoordinates} coordinates - Corner coordinates of the canvas.\n * @property {HTMLCanvasElement} canvas - The canvas element to render.\n * @property {boolean} [animate] - Whether to animate the canvas (re-render on each frame).\n * @property {number} [width] - Width of the canvas context.\n * @property {number} [height] - Height of the canvas context.\n * @property {React.ReactNode} [children] - Child Layer components.\n *\n * @example\n * ```tsx\n * // Canvas source with dynamic content\n * const canvasRef = useRef<HTMLCanvasElement>(null);\n * const [canvasEl, setCanvasEl] = useState<HTMLCanvasElement | null>(null);\n *\n * useEffect(() => {\n * const canvas = canvasRef.current;\n * if (!canvas) return;\n * const ctx = canvas.getContext('2d');\n * if (ctx) {\n * ctx.fillStyle = 'rgba(255, 0, 0, 0.5)';\n * ctx.fillRect(0, 0, 100, 100);\n * }\n * setCanvasEl(canvas);\n * }, []);\n *\n * {canvasEl && (\n * <CanvasSource\n * id=\"canvas-source\"\n * coordinates={[\n * [90.39, 23.83], // top-left\n * [90.41, 23.83], // top-right\n * [90.41, 23.81], // bottom-right\n * [90.39, 23.81] // bottom-left\n * ]}\n * canvas={canvasEl}\n * >\n * <Layer type=\"raster\" paint={{ 'raster-opacity': 0.8 }} />\n * </CanvasSource>\n * )}\n * ```\n */\nexport type CanvasSourceProps = {\n /** Unique identifier for the source */\n id?: string\n /** Corner coordinates of the canvas [top-left, top-right, bottom-right, bottom-left] */\n coordinates: CanvasCoordinates\n /** The canvas element to render */\n canvas: HTMLCanvasElement\n /** Whether to animate the canvas (re-render on each frame) */\n animate?: boolean\n /** Width of the canvas context */\n width?: number\n /** Height of the canvas context */\n height?: number\n /** Child Layer components */\n children?: React.ReactNode\n}\n\n/**\n * CanvasSource component for adding canvas-based data sources to a MapLibre GL map.\n *\n * Canvas sources allow rendering custom HTML canvas elements as map layers.\n * This is useful for dynamic, animated, or custom-rendered data overlays.\n *\n * @component\n * @example\n * ```tsx\n * import { Map, CanvasSource, Layer } from 'react-bkoi-gl';\n * import \"react-bkoi-gl/styles\";\n * import { useRef, useEffect, useState } from 'react';\n *\n * function CanvasExample() {\n * const canvasRef = useRef<HTMLCanvasElement>(null);\n * const [canvasEl, setCanvasEl] = useState<HTMLCanvasElement | null>(null);\n *\n * useEffect(() => {\n * const canvas = canvasRef.current;\n * if (!canvas) return;\n *\n * const ctx = canvas.getContext('2d');\n * if (ctx) {\n * ctx.fillStyle = 'rgba(0, 100, 255, 0.5)';\n * ctx.fillRect(0, 0, 256, 256);\n * ctx.fillStyle = 'rgba(255, 0, 0, 0.8)';\n * ctx.beginPath();\n * ctx.arc(128, 128, 50, 0, 2 * Math.PI);\n * ctx.fill();\n * }\n *\n * setCanvasEl(canvas);\n * }, []);\n *\n * return (\n * <Map\n * mapStyle={`https://map.barikoi.com/styles/osm-liberty/style.json?key=${API_KEY}`}\n * initialViewState={{\n * longitude: 90.3938,\n * latitude: 23.8216,\n * zoom: 12\n * }}\n * >\n * <canvas ref={canvasRef} width={256} height={256} style={{ display: 'none' }} />\n * {canvasEl && (\n * <CanvasSource\n * id=\"my-canvas\"\n * coordinates={[\n * [90.38, 23.83],\n * [90.41, 23.83],\n * [90.41, 23.81],\n * [90.38, 23.81]\n * ]}\n * canvas={canvasEl}\n * >\n * <Layer type=\"raster\" paint={{ 'raster-opacity': 0.8 }} />\n * </CanvasSource>\n * )}\n * </Map>\n * );\n * }\n * ```\n */\nfunction _CanvasSource(props: CanvasSourceProps) {\n const map = useContext(MapContext).map.getMap()\n const propsRef = useRef(props)\n\n const id = useMemo(() => props.id || `canvas-source-${Date.now()}`, [props.id])\n\n useEffect(() => {\n if (!map) return undefined\n\n const mapInternal = map as unknown as MapInternalProperties\n let source: maplibregl.CanvasSource | null = null\n\n const addSource = () => {\n if (!mapInternal.style || !mapInternal.style._loaded) return\n if (map.getSource(id)) return\n\n const { coordinates, canvas, animate } = props\n\n // Add canvas source\n ;(map as any).addSource(id, {\n type: 'canvas',\n coordinates,\n canvas,\n animate: animate || false,\n })\n\n source = map.getSource(id) as maplibregl.CanvasSource\n }\n\n const updateSource = () => {\n if (!source) return\n\n const { coordinates, canvas } = props\n const prevProps = propsRef.current\n\n // Update coordinates if changed\n if (JSON.stringify(coordinates) !== JSON.stringify(prevProps.coordinates)) {\n const sourceWithMethods = source as unknown as SourceWithOptionalMethods\n sourceWithMethods.setCoordinates?.(coordinates)\n }\n }\n\n // Wait for style to load\n if (mapInternal.style && mapInternal.style._loaded) {\n addSource()\n } else {\n map.once('styledata', addSource)\n }\n\n return () => {\n map.off('styledata', addSource)\n const mapInternalForCleanup = map as unknown as MapInternalProperties\n if (mapInternalForCleanup.style && mapInternalForCleanup.style._loaded && map.getSource(id)) {\n // Remove all layers using this source first\n const allLayers = map.getStyle()?.layers\n if (allLayers) {\n for (const layer of allLayers) {\n if ((layer as any).source === id) {\n map.removeLayer(layer.id)\n }\n }\n }\n map.removeSource(id)\n }\n }\n }, [map, id])\n\n // Update source when props change\n useEffect(() => {\n if (!map) return\n\n const source = map.getSource(id) as maplibregl.CanvasSource | undefined\n if (!source) return\n\n const { coordinates } = props\n const prevProps = propsRef.current\n\n // Update coordinates if changed\n if (JSON.stringify(coordinates) !== JSON.stringify(prevProps.coordinates)) {\n const sourceWithMethods = source as unknown as SourceWithOptionalMethods\n sourceWithMethods.setCoordinates?.(coordinates)\n }\n\n propsRef.current = props\n }, [map, id, props.coordinates, props.canvas])\n\n // Render children with source id\n if (!map) return null\n\n const mapInternal = map as unknown as MapInternalProperties\n if (!mapInternal.style || !mapInternal.style._loaded || !map.getSource(id)) {\n return null\n }\n\n // Clone children and pass source id\n return (\n (props.children &&\n React.Children.map(\n props.children,\n child =>\n child &&\n React.cloneElement(child as React.ReactElement, {\n source: id,\n })\n )) ||\n null\n )\n}\n\nexport const CanvasSource = memo<CanvasSourceProps>(_CanvasSource)\n","/**\n * @fileoverview Layer component for adding visual layers to a MapLibre GL map.\n *\n * Layers define how data from sources is rendered on the map. This component supports\n * all MapLibre GL layer types including fill, line, circle, symbol. raster. and more.\n *\n * @module components/layer\n * @see {@link https://maplibre.org/maplibre-gl-js/docs/layers/}\n */\n\nimport { useContext, useEffect, useMemo, useState, useRef, memo, useId } from 'react'\nimport { MapContext } from './map'\nimport assert from '../utils/assert'\nimport { deepEqual } from '../utils/deep-equal'\n\nimport type { FilterSpecification, MapLayerMouseEvent } from 'maplibre-gl'\n\nimport type { Map as MapInstance, CustomLayerInterface } from '../types/lib'\nimport type { LayerSpecification } from '../types/style-spec'\nimport type { MapInternalProperties } from '../types/internal'\n\n/**\n * Type for layer with filter property (not all layer types have filter)\n * @private\n */\ntype LayerWithFilter = {\n filter?: FilterSpecification | null\n layout?: Record<string, unknown>\n paint?: Record<string, unknown>\n minzoom?: number\n maxzoom?: number\n beforeId?: string\n type?: string\n id?: string\n source?: string\n}\n\n/**\n * Event handlers for layer interactions\n * @private\n */\ntype LayerEventHandlers = {\n onClick?: (e: MapLayerMouseEvent) => void\n onMouseEnter?: (e: MapLayerMouseEvent) => void\n onMouseLeave?: (e: MapLayerMouseEvent) => void\n onMouseMove?: (e: MapLayerMouseEvent) => void\n onMouseDown?: (e: MapLayerMouseEvent) => void\n onMouseUp?: (e: MapLayerMouseEvent) => void\n onContextMenu?: (e: MapLayerMouseEvent) => void\n onDoubleClick?: (e: MapLayerMouseEvent) => void\n}\n\n/**\n * Utility type to make id optional in layer specification.\n * @private\n */\ntype OptionalId<T> = T extends { id: string } ? Omit<T, 'id'> & { id?: string } : T\n\n/**\n * Utility type to make source optional in layer specification.\n * @private\n */\ntype OptionalSource<T> = T extends { source: string } ? Omit<T, 'source'> & { source?: string } : T\n\n/**\n * Props for the Layer component.\n *\n * @typedef {Object} LayerProps\n * @property {string} [id] - Unique identifier for the layer. If not provided, one will be generated automatically.\n * @property {string} [source] - The source ID this layer should use (inherited from parent Source component).\n * @property {string} [beforeId] - If set, the layer will be inserted before the specified layer.\n * @property {function} [onClick] - Called when the layer is clicked.\n * @property {function} [onMouseEnter] - Called when the mouse enters the layer.\n * @property {function} [onMouseLeave] - Called when the mouse leaves the layer.\n * @property {function} [onMouseMove] - Called when the mouse moves over the layer.\n * @property {function} [onMouseDown] - Called when mouse button is pressed on the layer.\n * @property {function} [onMouseUp] - Called when mouse button is released on the layer.\n * @property {function} [onContextMenu] - Called on right-click context menu.\n * @property {function} [onDoubleClick] - Called on double click.\n * @extends {LayerSpecification | CustomLayerInterface}\n *\n * @example\n * ```tsx\n * // Circle layer with paint properties\n * <Layer\n * id=\"points-layer\"\n * type=\"circle\"\n * paint={{\n * 'circle-radius': 8,\n * 'circle-color': '#007cbf'\n * }}\n * />\n *\n * // Line layer with filter\n * <Layer\n * id=\"roads-layer\"\n * type=\"line\"\n * source=\"streets\"\n * source-layer=\"road\"\n * filter={['==', ['get', 'type'], 'primary']}\n * paint={{ 'line-width': 2 }}\n * />\n *\n * // Interactive layer with events\n * <Layer\n * id=\"interactive-layer\"\n * type=\"fill\"\n * paint={{ 'fill-color': '#088' }}\n * onClick={(e) => console.log('Clicked:', e.features)}\n * onMouseEnter={(e) => console.log('Hover:', e.features)}\n * onMouseLeave={() => console.log('Left layer')}\n * />\n *\n * // Custom layer\n * <Layer\n * type=\"custom\"\n * renderingMode=\"2d\"\n * onAdd={(map) => { ... }}\n * render={(gl, matrix) => { ... }}\n * />\n * ```\n */\nexport type LayerProps = (OptionalSource<OptionalId<LayerSpecification>> | CustomLayerInterface) & {\n /** If set, the layer will be inserted before the specified layer */\n beforeId?: string\n /** Called when the layer is clicked */\n onClick?: (e: MapLayerMouseEvent) => void\n /** Called when the mouse enters the layer */\n onMouseEnter?: (e: MapLayerMouseEvent) => void\n /** Called when the mouse leaves the layer */\n onMouseLeave?: () => void\n /** Called when the mouse moves over the layer */\n onMouseMove?: (e: MapLayerMouseEvent) => void\n /** Called when mouse button is pressed on the layer */\n onMouseDown?: (e: MapLayerMouseEvent) => void\n /** Called when mouse button is released on the layer */\n onMouseUp?: (e: MapLayerMouseEvent) => void\n /** Called on right-click context menu */\n onContextMenu?: (e: MapLayerMouseEvent) => void\n /** Called on double click */\n onDoubleClick?: (e: MapLayerMouseEvent) => void\n}\n\n/**\n * Updates an existing layer with new properties.\n *\n * Handles updates for:\n * - Layout properties via setLayoutProperty()\n * - Paint properties via setPaintProperty()\n * - Filter via setFilter()\n * - Zoom range via setLayerZoomRange()\n * - Layer order via moveLayer()\n *\n * @param {MapInstance} map - The MapLibre GL map instance\n * @param {string} id - Unique identifier for the layer\n * @param {LayerProps} props - New properties\n * @param {LayerProps} prevProps - Previous properties\n * @throws {Error} If layer id or type changes\n * @private\n */\nfunction updateLayer(map: MapInstance, id: string, props: LayerProps, prevProps: LayerProps): void {\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 const propsWithFilter = props as unknown as LayerWithFilter\n const prevPropsWithFilter = prevProps as unknown as LayerWithFilter\n const { layout = {}, paint = {}, filter, minzoom, maxzoom, beforeId } = propsWithFilter\n\n if (beforeId !== prevPropsWithFilter.beforeId) {\n map.moveLayer(id, beforeId)\n }\n if (layout !== prevPropsWithFilter.layout) {\n const prevLayout = prevPropsWithFilter.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 !== prevPropsWithFilter.paint) {\n const prevPaint = prevPropsWithFilter.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 if (!deepEqual(filter, prevPropsWithFilter.filter)) {\n map.setFilter(id, filter ?? null)\n }\n if (minzoom !== prevPropsWithFilter.minzoom || maxzoom !== prevPropsWithFilter.maxzoom) {\n map.setLayerZoomRange(id, minzoom, maxzoom)\n }\n}\n\n/**\n * Creates a new layer on the map.\n *\n * @param {MapInstance} map - The MapLibre GL map instance\n * @param {string} id - Unique identifier for the layer\n * @param {LayerProps} props - Layer properties\n * @private\n */\nfunction createLayer(map: MapInstance, id: string, props: LayerProps): void {\n const mapInternal = map as unknown as MapInternalProperties\n if (\n mapInternal.style &&\n mapInternal.style._loaded &&\n (!('source' in props) || map.getSource(props.source as string))\n ) {\n const options: LayerProps = { ...props, id }\n delete options.beforeId\n\n map.addLayer(options as LayerSpecification, props.beforeId)\n }\n}\n\n/**\n * Layer component for adding visual layers to a MapLibre GL map.\n *\n * Layers define how data from sources is rendered on the map. Supports all\n * MapLibre GL layer types including fill, line, circle, symbol, raster,\n * hillshade, heatmap, and custom layers.\n *\n * Must be a child of a Source component (for data layers) or used standalone\n * with a source prop for pre-existing sources.\n *\n * @component\n * @example\n * ```tsx\n * // Circle layer with paint properties\n * <Layer\n * id=\"points-layer\"\n * type=\"circle\"\n * paint={{\n * 'circle-radius': 8,\n * 'circle-color': '#007cbf'\n * }}\n * />\n *\n * // Line layer with filter\n * <Layer\n * id=\"roads-layer\"\n * type=\"line\"\n * source=\"streets\"\n * source-layer=\"road\"\n * filter={['==', ['get', 'type'], 'primary']}\n * paint={{ 'line-width': 2 }}\n * />\n *\n * // Inside a Source component\n * <Source id=\"geojson\" type=\"geojson\" data={data}>\n * <Layer type=\"circle\" paint={{ 'circle-radius': 6 }} />\n * </Source>\n * ```\n */\nfunction _Layer(props: LayerProps) {\n const map = useContext(MapContext).map.getMap()\n const propsRef = useRef(props)\n const [, setStyleLoaded] = useState(0)\n\n // Generate a stable ID once on mount\n // Note: props.id changes after mount will trigger an error in updateLayer\n const generatedId = useId()\n const id = useMemo(\n () => props.id || `jsx-layer-${generatedId.replace(/:/g, '-')}`,\n // Empty deps - id is set once on mount and should not change\n []\n )\n\n // Extract event handlers\n const {\n onClick,\n onMouseEnter,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onMouseUp,\n onContextMenu,\n onDoubleClick,\n } = props\n\n // Store callbacks in refs to avoid re-registering events\n const callbacksRef = useRef({\n onClick,\n onMouseEnter,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onMouseUp,\n onContextMenu,\n onDoubleClick,\n })\n\n // Update refs when callbacks change\n useEffect(() => {\n callbacksRef.current = {\n onClick,\n onMouseEnter,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onMouseUp,\n onContextMenu,\n onDoubleClick,\n }\n }, [\n onClick,\n onMouseEnter,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onMouseUp,\n onContextMenu,\n onDoubleClick,\n ])\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 const mapInternal = map as unknown as MapInternalProperties\n if (mapInternal.style && mapInternal.style._loaded && map.getLayer(id)) {\n map.removeLayer(id)\n }\n }\n }\n return undefined\n }, [map])\n\n // Register layer event handlers\n useEffect(() => {\n if (!map) return undefined\n\n const hasEventHandler =\n onClick ||\n onMouseEnter ||\n onMouseLeave ||\n onMouseMove ||\n onMouseDown ||\n onMouseUp ||\n onContextMenu ||\n onDoubleClick\n\n if (!hasEventHandler) return undefined\n\n // Event handlers\n const handleClick = (e: MapLayerMouseEvent) => {\n callbacksRef.current.onClick?.(e)\n }\n\n const handleMouseEnter = (e: MapLayerMouseEvent) => {\n callbacksRef.current.onMouseEnter?.(e)\n // Change cursor to pointer\n if (callbacksRef.current.onClick) {\n map.getCanvas().style.cursor = 'pointer'\n }\n }\n\n const handleMouseLeave = () => {\n callbacksRef.current.onMouseLeave?.()\n // Reset cursor\n map.getCanvas().style.cursor = ''\n }\n\n const handleMouseMove = (e: MapLayerMouseEvent) => {\n callbacksRef.current.onMouseMove?.(e)\n }\n\n const handleMouseDown = (e: MapLayerMouseEvent) => {\n callbacksRef.current.onMouseDown?.(e)\n }\n\n const handleMouseUp = (e: MapLayerMouseEvent) => {\n callbacksRef.current.onMouseUp?.(e)\n }\n\n const handleContextMenu = (e: MapLayerMouseEvent) => {\n callbacksRef.current.onContextMenu?.(e)\n }\n\n const handleDoubleClick = (e: MapLayerMouseEvent) => {\n callbacksRef.current.onDoubleClick?.(e)\n }\n\n // Register events\n if (onClick) map.on('click', id, handleClick)\n if (onMouseEnter) map.on('mouseenter', id, handleMouseEnter)\n if (onMouseLeave) map.on('mouseleave', id, handleMouseLeave)\n if (onMouseMove) map.on('mousemove', id, handleMouseMove)\n if (onMouseDown) map.on('mousedown', id, handleMouseDown)\n if (onMouseUp) map.on('mouseup', id, handleMouseUp)\n if (onContextMenu) map.on('contextmenu', id, handleContextMenu)\n if (onDoubleClick) map.on('dblclick', id, handleDoubleClick)\n\n // Cleanup\n return () => {\n if (onClick) map.off('click', id, handleClick)\n if (onMouseEnter) map.off('mouseenter', id, handleMouseEnter)\n if (onMouseLeave) map.off('mouseleave', id, handleMouseLeave)\n if (onMouseMove) map.off('mousemove', id, handleMouseMove)\n if (onMouseDown) map.off('mousedown', id, handleMouseDown)\n if (onMouseUp) map.off('mouseup', id, handleMouseUp)\n if (onContextMenu) map.off('contextmenu', id, handleContextMenu)\n if (onDoubleClick) map.off('dblclick', id, handleDoubleClick)\n }\n }, [\n map,\n id,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onMouseUp,\n onContextMenu,\n onDoubleClick,\n ])\n\n const mapInternal = map as unknown as MapInternalProperties\n const layer = map && mapInternal.style && map.getLayer(id)\n if (layer) {\n try {\n updateLayer(map, id, props, propsRef.current)\n } catch (error) {\n console.warn(error)\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\nexport const Layer = memo(_Layer)\n","import * as React from 'react'\nimport { useEffect, useMemo, memo, useRef, useState, useContext } from 'react'\nimport MapboxDraw from 'maplibre-gl-draw'\nimport { MapContext } from './map'\n\nimport type { ControlPosition, IControl, Map as MapInstance } from '../types/lib'\n\n/**\n * Draw event types\n */\nexport interface DrawEvent {\n type: string\n features?: GeoJSON.Feature<GeoJSON.Geometry>[]\n featureIds?: string[]\n mode?: string\n originalEvent?: unknown\n}\n\n/**\n * Draw control options - extends maplibre-gl-draw options\n */\nexport interface DrawControlOptions {\n /** Whether controls are displayed by default */\n displayControlsDefault?: boolean\n /** Control configuration */\n controls?: {\n point?: boolean\n line_string?: boolean\n polygon?: boolean\n trash?: boolean\n combine_features?: boolean\n uncombine_features?: boolean\n }\n /** Custom styles for draw layers */\n styles?: unknown[]\n /** Available modes */\n modes?: Record<string, unknown>\n /** Default mode */\n defaultMode?: string\n}\n\nexport type DrawControlProps = DrawControlOptions & {\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 /** Callback fired when a feature is created */\n onDrawCreate?: (e: DrawEvent) => void\n /** Callback fired when a feature is deleted */\n onDrawDelete?: (e: DrawEvent) => void\n /** Callback fired when a feature is updated */\n onDrawUpdate?: (e: DrawEvent) => void\n /** Callback fired when the selection changes */\n onDrawSelectionChange?: (e: DrawEvent) => void\n /** Callback fired when the draw mode changes */\n onDrawModeChange?: (e: DrawEvent) => void\n /** Callback fired when features are combined */\n onDrawCombine?: (e: DrawEvent) => void\n /** Callback fired when features are uncombined */\n onDrawUncombine?: (e: DrawEvent) => void\n /** Callback fired when rendering */\n onDrawRender?: (e: DrawEvent) => void\n}\n\n/**\n * Default draw options - enables polygon and trash controls\n */\nconst defaultDrawOptions: DrawControlOptions = {\n displayControlsDefault: false,\n controls: {\n polygon: true,\n trash: true,\n },\n}\n\nfunction _DrawControl(props: DrawControlProps) {\n const {\n position,\n style,\n onDrawCreate,\n onDrawDelete,\n onDrawUpdate,\n onDrawSelectionChange,\n onDrawModeChange,\n onDrawCombine,\n onDrawUncombine,\n onDrawRender,\n ...drawOptions\n } = props\n\n const context = useContext(MapContext)\n\n if (!context) {\n throw new Error('DrawControl must be used within a Map component')\n }\n\n // Deep merge user options with defaults to preserve nested object properties\n const options = useMemo<DrawControlOptions>(\n () => ({\n ...defaultDrawOptions,\n ...drawOptions,\n controls: {\n ...defaultDrawOptions.controls,\n ...drawOptions.controls,\n },\n }),\n [\n drawOptions.displayControlsDefault,\n drawOptions.controls,\n drawOptions.styles,\n drawOptions.modes,\n drawOptions.defaultMode,\n ]\n )\n\n // Create a stable key for the options to detect changes\n const optionsKey = useMemo(() => JSON.stringify(options), [options])\n\n // Track callbacks in refs to avoid recreating the control for callback changes\n const callbacksRef = useRef({\n onDrawCreate,\n onDrawDelete,\n onDrawUpdate,\n onDrawSelectionChange,\n onDrawModeChange,\n onDrawCombine,\n onDrawUncombine,\n onDrawRender,\n })\n\n useEffect(() => {\n callbacksRef.current = {\n onDrawCreate,\n onDrawDelete,\n onDrawUpdate,\n onDrawSelectionChange,\n onDrawModeChange,\n onDrawCombine,\n onDrawUncombine,\n onDrawRender,\n }\n }, [\n onDrawCreate,\n onDrawDelete,\n onDrawUpdate,\n onDrawSelectionChange,\n onDrawModeChange,\n onDrawCombine,\n onDrawUncombine,\n onDrawRender,\n ])\n\n // Store control reference\n const ctrlRef = useRef<(IControl & { getMode: () => string }) | null>(null)\n const listenersRef = useRef<{\n handleCreate?: (e: DrawEvent) => void\n handleUpdate?: (e: DrawEvent) => void\n handleDelete?: (e: DrawEvent) => void\n handleSelectionChange?: (e: DrawEvent) => void\n handleModeChange?: (e: DrawEvent) => void\n handleCombine?: (e: DrawEvent) => void\n handleUncombine?: (e: DrawEvent) => void\n handleRender?: (e: DrawEvent) => void\n }>({})\n\n useEffect(() => {\n const { map } = context\n if (!map) return\n\n const mapInstance = map.getMap() as MapInstance\n if (!mapInstance) return\n\n const DrawClass = MapboxDraw as typeof MapboxDraw & {\n new (options: DrawControlOptions): IControl & { getMode: () => string }\n }\n\n // Helper to reset cursor when not in drawing mode\n const resetCursorIfNeeded = () => {\n if (ctrlRef.current) {\n const currentMode = ctrlRef.current.getMode()\n if (currentMode === 'simple_select') {\n mapInstance.getCanvas().style.cursor = ''\n }\n }\n }\n\n // Event handlers\n const handleCreate = (e: DrawEvent) => {\n resetCursorIfNeeded()\n callbacksRef.current.onDrawCreate?.(e)\n }\n\n const handleUpdate = (e: DrawEvent) => {\n resetCursorIfNeeded()\n callbacksRef.current.onDrawUpdate?.(e)\n }\n\n const handleDelete = (e: DrawEvent) => {\n resetCursorIfNeeded()\n callbacksRef.current.onDrawDelete?.(e)\n }\n\n const handleSelectionChange = (e: DrawEvent) => {\n resetCursorIfNeeded()\n callbacksRef.current.onDrawSelectionChange?.(e)\n }\n\n const handleModeChange = (e: DrawEvent) => {\n resetCursorIfNeeded()\n callbacksRef.current.onDrawModeChange?.(e)\n }\n\n const handleCombine = (e: DrawEvent) => {\n callbacksRef.current.onDrawCombine?.(e)\n }\n\n const handleUncombine = (e: DrawEvent) => {\n callbacksRef.current.onDrawUncombine?.(e)\n }\n\n const handleRender = (e: DrawEvent) => {\n callbacksRef.current.onDrawRender?.(e)\n }\n\n // Create new control\n const ctrl = new DrawClass(options)\n ctrlRef.current = ctrl\n\n // Add control to map\n map.addControl(ctrl, position)\n\n // Store listeners for cleanup\n listenersRef.current = {\n handleCreate,\n handleUpdate,\n handleDelete,\n handleSelectionChange,\n handleModeChange,\n handleCombine,\n handleUncombine,\n handleRender,\n }\n\n // Add event listeners\n mapInstance.on('draw.create', handleCreate)\n mapInstance.on('draw.update', handleUpdate)\n mapInstance.on('draw.delete', handleDelete)\n mapInstance.on('draw.selectionchange', handleSelectionChange)\n mapInstance.on('draw.modechange', handleModeChange)\n mapInstance.on('draw.combine', handleCombine)\n mapInstance.on('draw.uncombine', handleUncombine)\n mapInstance.on('draw.render', handleRender)\n\n // Cleanup function\n return () => {\n // Remove event listeners\n if (listenersRef.current.handleCreate) {\n mapInstance.off('draw.create', listenersRef.current.handleCreate)\n }\n if (listenersRef.current.handleUpdate) {\n mapInstance.off('draw.update', listenersRef.current.handleUpdate)\n }\n if (listenersRef.current.handleDelete) {\n mapInstance.off('draw.delete', listenersRef.current.handleDelete)\n }\n if (listenersRef.current.handleSelectionChange) {\n mapInstance.off('draw.selectionchange', listenersRef.current.handleSelectionChange)\n }\n if (listenersRef.current.handleModeChange) {\n mapInstance.off('draw.modechange', listenersRef.current.handleModeChange)\n }\n if (listenersRef.current.handleCombine) {\n mapInstance.off('draw.combine', listenersRef.current.handleCombine)\n }\n if (listenersRef.current.handleUncombine) {\n mapInstance.off('draw.uncombine', listenersRef.current.handleUncombine)\n }\n if (listenersRef.current.handleRender) {\n mapInstance.off('draw.render', listenersRef.current.handleRender)\n }\n\n // Remove control from map\n if (ctrlRef.current && map.hasControl(ctrlRef.current)) {\n map.removeControl(ctrlRef.current)\n }\n ctrlRef.current = null\n }\n }, [context, optionsKey, position])\n\n return null\n}\n\nexport const DrawControl = memo(_DrawControl)\n","/**\n * @fileoverview GlobeControl component for switching between 3D globe and 2D map views.\n *\n * Provides a control button to toggle between mercator (2D flat map) and\n * globe (3D) projections in MapLibre GL 3.x+.\n *\n * @module components/globe-control\n * @see {@link https://maplibre.org/maplibre-gl-js/docs/layers/}\n */\n\nimport { useEffect, memo, useRef } from 'react'\nimport { useControl } from './use-control'\n\nimport type { ControlPosition, IControl, Map as MapInstance } from '../types/lib'\n\n/**\n * Options for the GlobeControl\n */\nexport interface GlobeControlOptions {\n /** Custom button element */\n buttonElement?: HTMLElement\n /** Custom button class name */\n buttonClassName?: string\n /** Button title/tooltip text */\n buttonTitle?: string\n /** Custom CSS for the button */\n buttonStyle?: React.CSSProperties\n}\n\nexport type GlobeControlProps = GlobeControlOptions & {\n /** Position of the control on the map */\n position?: ControlPosition\n /** Called when projection changes */\n onProjectionChange?: (isGlobe: boolean) => void\n}\n\n/**\n * Default button SVG icons\n */\nconst GLOBE_SVG = `<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" stroke=\"currentColor\" stroke-width=\"2\">\n <circle cx=\"12\" cy=\"12\" r=\"9\" fill=\"none\"/>\n <path d=\"M12 21a9 9-9 0 0-9 9-9 0 0 9h0c2.2a8.2 2.3 5.1 5.8-5.5c-.4-.4-.5-.9-.5-1.5v-1.3c0-2.3 1.8-4.2 4-4.5V5.5c-1.8.5-3.5 2-4.5 2.8 0 5.2 2.3 5.2 5 0z\"/>\n <path d=\"M12 3c-2.8 0-5.2 2.3-5.2 5h2c0-1.5.1-1.1.5-1.5L5.8 9 2.3 5.1 8.2 2c.4 0 .9-.5 1.5-.5h1.3c2.3 0 4.2-1.8 4.5-4h-2c0 1.5-1.8 3.5-4 4.5V21c2.8 0 5.2-2.3 5.2-5h-2c0 1.5-.1 1.1-.5 1.5L18.2 15 14.8l2.7-5.1c-.4 0-.9.5-1.5.5h-1.3c-2.3 0-4.2 1.8-4.5 4h2c0-1.5 1.8-3.5 4-4.5V3z\"/>\n</svg>`\n\nconst MAP_SVG = `<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" stroke=\"currentColor\" stroke-width=\"2\">\n <rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" fill=\"none\"/>\n <path d=\"M3 9h18M3 15h18M9 3v18M15 3v18\"/>\n</svg>`\n\n/**\n * GlobeControlImpl class implementing IControl interface\n */\nclass GlobeControlImpl implements IControl {\n private _container: HTMLDivElement\n private _button: HTMLButtonElement\n private _map: MapInstance | null = null\n private _isGlobe: boolean = false\n private _options: GlobeControlOptions\n private _onProjectionChange?: (isGlobe: boolean) => void\n\n constructor(\n options: GlobeControlOptions,\n callbacks: {\n onProjectionChange?: (isGlobe: boolean) => void\n }\n ) {\n this._options = options\n this._onProjectionChange = callbacks.onProjectionChange\n this._container = document.createElement('div')\n this._container.className = 'maplibregl-ctrl maplibregl-ctrl-group'\n this._button = this._createButton()\n this._container.appendChild(this._button)\n }\n\n private _createButton(): HTMLButtonElement {\n const button =\n (this._options.buttonElement as HTMLButtonElement) || document.createElement('button')\n\n if (!this._options.buttonElement) {\n button.className = this._options.buttonClassName || 'maplibregl-ctrl-globe'\n button.type = 'button'\n button.title = this._options.buttonTitle || 'Toggle Globe View'\n button.setAttribute('aria-label', 'Toggle Globe View')\n button.innerHTML = this._isGlobe ? MAP_SVG : GLOBE_SVG\n\n // Apply custom styles\n Object.assign(button.style, {\n padding: '5px',\n border: 'none',\n background: 'white',\n cursor: 'pointer',\n borderRadius: '4px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n ...this._options.buttonStyle,\n })\n }\n\n button.addEventListener('click', () => this._toggleGlobe())\n\n return button\n }\n\n private _toggleGlobe(): void {\n if (!this._map) return\n\n this._isGlobe = !this._isGlobe\n\n // Update button icon\n this._button.innerHTML = this._isGlobe ? MAP_SVG : GLOBE_SVG\n this._button.title = this._isGlobe ? 'Switch to Map View' : 'Switch to Globe View'\n\n // Set projection\n try {\n const projection = this._isGlobe ? { type: 'globe' } : { type: 'mercator' }\n ;(this._map as any).setProjection(projection)\n this._onProjectionChange?.(this._isGlobe)\n } catch (error) {\n console.warn('GlobeControl: setProjection not available', error)\n }\n }\n\n onAdd(map: MapInstance): HTMLElement {\n this._map = map\n\n // Check if globe projection is available\n try {\n const currentProjection = (map as any).getProjection?.()\n this._isGlobe = currentProjection?.type === 'globe'\n this._button.innerHTML = this._isGlobe ? MAP_SVG : GLOBE_SVG\n } catch {\n // Globe projection not available, default to map view\n this._isGlobe = false\n }\n\n return this._container\n }\n\n onRemove(): void {\n this._container.parentNode?.removeChild(this._container)\n this._map = null\n }\n\n /**\n * Check if currently in globe view\n */\n isGlobe(): boolean {\n return this._isGlobe\n }\n\n /**\n * Set the projection programmatically\n */\n setGlobe(isGlobe: boolean): void {\n if (this._isGlobe !== isGlobe) {\n this._toggleGlobe()\n }\n }\n}\n\n/**\n * GlobeControl component for toggling between 3D globe and 2D map views.\n *\n * This control works with MapLibre GL 3.x+ which supports globe projection.\n * Adds a button to the map that toggles between mercator (flat) and globe (3D) projections.\n *\n * @component\n * @example\n * ```tsx\n * import { Map, GlobeControl } from 'react-bkoi-gl';\n * import \"react-bkoi-gl/styles\";\n *\n * function GlobeExample() {\n * const handleProjectionChange = (isGlobe) => {\n * console.log('Globe view:', isGlobe);\n * };\n *\n * return (\n * <Map\n * mapStyle={`https://map.barikoi.com/styles/osm-liberty/style.json?key=${API_KEY}`}\n * initialViewState={{\n * longitude: 90.3938,\n * latitude: 23.8216,\n * zoom: 12\n * }}\n * >\n * <GlobeControl\n * position=\"top-right\"\n * onProjectionChange={handleProjectionChange}\n * />\n * </Map>\n * );\n * }\n * ```\n */\nfunction _GlobeControl(props: GlobeControlProps) {\n const { position, onProjectionChange, ...options } = props\n\n // Store callback in ref to avoid recreating control\n const callbacksRef = useRef({ onProjectionChange })\n\n // Update callback ref when it changes\n useEffect(() => {\n callbacksRef.current = { onProjectionChange }\n }, [onProjectionChange])\n\n useControl(\n () => {\n return new GlobeControlImpl(options, {\n onProjectionChange: isGlobe => callbacksRef.current.onProjectionChange?.(isGlobe),\n })\n },\n { position }\n )\n\n return null\n}\n\nexport const GlobeControl = memo(_GlobeControl)\n","import * as React from 'react'\nimport { useEffect, memo } from 'react'\nimport {\n Map,\n type IControl,\n type GeoJSONSource,\n type ControlPosition,\n type StyleSpecification,\n} from 'maplibre-gl'\nimport { useControl } from './use-control'\n\ntype MapLibreMap = Map\n\n/**\n * Map interaction types that can be disabled/enabled\n */\nexport type MapInteractions =\n | 'dragPan'\n | 'scrollZoom'\n | 'boxZoom'\n | 'dragRotate'\n | 'keyboard'\n | 'doubleClickZoom'\n | 'touchZoomRotate'\n\n/**\n * Configuration for minimap interactions\n */\nexport type MinimapInteractions = Record<MapInteractions, boolean>\n\n/**\n * Configuration for the parent rectangle overlay\n */\nexport interface ParentRectConfig {\n /** Layout properties for the line layer */\n lineLayout?: Record<string, unknown>\n /** Paint properties for the line layer */\n linePaint?: Record<string, unknown>\n /** Paint properties for the fill layer */\n fillPaint?: Record<string, unknown>\n}\n\n/**\n * Configuration for the toggle button\n */\nexport interface ToggleButtonConfig {\n /** Custom SVG icon */\n icon?: string\n /** Custom CSS class */\n className?: string\n /** Custom inline styles */\n style?: Record<string, string>\n /** Background color of the icon */\n iconBackgroundColor?: string\n /** Hover color */\n hoverColor?: string\n /** Enable rotation based on position */\n enableRotation?: boolean\n /** Custom rotation angle */\n rotationAngle?: number\n}\n\n/**\n * Minimap control options\n */\nexport interface MinimapControlOptions {\n /** Initial center coordinates */\n center?: [number, number]\n /** Barikoi API access token */\n accessToken?: string\n /** Map style for the minimap */\n style?: string | StyleSpecification\n /** Zoom level difference from parent */\n zoomAdjust?: number\n /** Lock to specific zoom level */\n lockZoom?: number\n /** Sync pitch with parent */\n pitchAdjust?: boolean\n /** Custom container styles */\n containerStyle?: Record<string, string>\n /** Position on map */\n position?: ControlPosition\n /** Parent rectangle configuration */\n parentRect?: ParentRectConfig\n /** Whether minimap can be toggled */\n toggleable?: boolean\n /** Toggle button configuration */\n toggleButton?: ToggleButtonConfig\n /** Start minimized */\n initialMinimized?: boolean\n /** Width when minimized */\n collapsedWidth?: string\n /** Height when minimized */\n collapsedHeight?: string\n /** Border radius */\n borderRadius?: string\n /** Interaction configuration */\n interactions?: Partial<MinimapInteractions>\n /** Toggle callback */\n onToggle?: (isMinimized: boolean) => void\n /** Hide tooltip text */\n hideText?: string\n /** Show tooltip text */\n showText?: string\n /** Enable responsive sizing */\n responsive?: boolean\n /** Responsive width */\n responsiveWidth?: string\n /** Responsive height */\n responsiveHeight?: string\n /** Minimum width */\n minWidth?: string\n /** Minimum height */\n minHeight?: string\n /** Maximum width */\n maxWidth?: string\n /** Maximum height */\n maxHeight?: string\n}\n\nexport type MinimapControlProps = MinimapControlOptions\n\n// Named constants for default values\nconst DEFAULT_ZOOM_ADJUST = -4\nconst DEFAULT_COLLAPSED_SIZE = '29px'\nconst DEFAULT_BORDER_RADIUS = '3px'\nconst TRANSITION_DURATION_MS = 600\nconst RESIZE_DEBOUNCE_MS = 100\nconst DEFAULT_WIDTH = '400px'\nconst DEFAULT_HEIGHT = '300px'\n\n/**\n * Default interactions (dragPan enabled for navigation)\n */\nconst defaultInteractions: MinimapInteractions = {\n dragPan: true,\n scrollZoom: false,\n boxZoom: false,\n dragRotate: false,\n keyboard: false,\n doubleClickZoom: false,\n touchZoomRotate: false,\n}\n\n/**\n * Default SVG icon for toggle button\n */\nconst DEFAULT_ICON = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M17.6 18L8 8.4V17H6V5h12v2H9.4l9.6 9.6l-1.4 1.4Z\" /></svg>`\n\n/**\n * Generate a random UUID using crypto API\n */\nfunction getRandomUUID(): string {\n if (typeof crypto !== 'undefined' && crypto.randomUUID) {\n return crypto.randomUUID()\n }\n // Fallback for older environments\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n const array = new Uint8Array(1)\n crypto.getRandomValues(array)\n const r = array[0] % 16\n const v = c === 'x' ? r : (r & 0x3) | 0x8\n return v.toString(16)\n })\n}\n\n/**\n * Sanitize SVG string to prevent XSS attacks\n */\nfunction sanitizeSVG(svgString: string): string {\n // Only allow valid SVG structure\n const svgPattern = /^<svg[^>]*>[\\s\\S]*<\\/svg>$/i\n if (!svgPattern.test(svgString)) {\n console.warn('Invalid SVG format, using default icon')\n return DEFAULT_ICON\n }\n\n // Remove potentially dangerous elements and attributes\n return svgString\n .replace(/<script[\\s\\S]*?<\\/script>/gi, '')\n .replace(/\\s*on\\w+\\s*=\\s*[\"'][^\"']*[\"']/gi, '')\n .replace(/javascript:/gi, '')\n}\n\n/**\n * Internal minimap options\n */\ninterface InternalMinimapOptions extends MinimapControlOptions {\n container?: HTMLElement\n zoom?: number\n minZoom?: number\n maxZoom?: number\n bearing?: number\n pitch?: number\n attributionControl: boolean\n logoPosition?: string\n}\n\n/**\n * Minimap class - wraps MapLibre Map as a control\n */\nclass Minimap implements IControl {\n private options: InternalMinimapOptions\n private map!: MapLibreMap\n private parentMap!: MapLibreMap\n private container!: HTMLElement\n private readonly id: string\n private parentRect?: GeoJSON.Feature<GeoJSON.Polygon>\n private differentStyle = false\n private desync?: () => void\n private toggleButtonCleanup?: () => void\n private isMinimized = false\n private resizeHandler?: () => void\n\n constructor(options: MinimapControlOptions = {}) {\n this.id = `minimap-${getRandomUUID()}`\n\n if (options.style !== undefined) {\n this.differentStyle = true\n }\n\n const interactions = { ...defaultInteractions, ...(options.interactions ?? {}) }\n\n const containerStyle = this.validateContainerStyle(options.containerStyle)\n\n this.options = {\n zoomAdjust: DEFAULT_ZOOM_ADJUST,\n position: 'top-right',\n pitchAdjust: false,\n attributionControl: false,\n logoPosition: 'bottom-left',\n toggleable: true,\n initialMinimized: false,\n collapsedWidth: DEFAULT_COLLAPSED_SIZE,\n collapsedHeight: DEFAULT_COLLAPSED_SIZE,\n borderRadius: DEFAULT_BORDER_RADIUS,\n hideText: 'Hide minimap',\n showText: 'Show minimap',\n responsive: true,\n responsiveWidth: '20vw',\n responsiveHeight: '20vh',\n minWidth: '200px',\n minHeight: '150px',\n maxWidth: DEFAULT_WIDTH,\n maxHeight: DEFAULT_HEIGHT,\n interactions,\n ...options,\n containerStyle,\n } as InternalMinimapOptions\n\n if (options.lockZoom !== undefined) {\n this.options.minZoom = options.lockZoom\n this.options.maxZoom = options.lockZoom\n }\n\n this.isMinimized = this.options.initialMinimized ?? false\n }\n\n onAdd(parentMap: MapLibreMap): HTMLElement {\n this.parentMap = parentMap\n\n this.container = this.createContainer()\n\n this.options.container = this.container\n this.options.zoom = parentMap.getZoom() + (this.options.zoomAdjust ?? DEFAULT_ZOOM_ADJUST)\n this.options.center ??= parentMap.getCenter().toArray() as [number, number]\n this.options.bearing = parentMap.getBearing()\n this.options.pitch = this.options.pitchAdjust ? parentMap.getPitch() : 0\n\n if (!this.differentStyle) {\n this.options.style = parentMap.getStyle()\n }\n\n this.map = new Map(this.options as unknown as ConstructorParameters<typeof Map>[0])\n\n this.map.once('style.load', () => {\n this.map.resize()\n })\n\n this.map.once('load', () => {\n this.configureInteractions()\n this.addParentRect(this.options.parentRect)\n this.desync = this.syncMaps()\n this.setupToggleButton()\n this.setupResponsiveSizing()\n })\n\n return this.container\n }\n\n onRemove(): void {\n if (this.resizeHandler) {\n window.removeEventListener('resize', this.resizeHandler)\n this.resizeHandler = undefined\n }\n this.toggleButtonCleanup?.()\n this.desync?.()\n this.container.remove()\n }\n\n private createContainer(): HTMLElement {\n const container = document.createElement('div')\n container.id = this.id\n container.className =\n 'maplibregl-ctrl maplibregl-ctrl-group maplibregl-ctrl-minimap custom-ctrl-minimap'\n\n if (this.isMinimized) {\n container.classList.add('minimized')\n }\n\n const styleEl = document.createElement('style')\n styleEl.innerHTML = this.getContainerStyles()\n container.appendChild(styleEl)\n\n if (this.options.containerStyle) {\n for (const [key, value] of Object.entries(this.options.containerStyle)) {\n container.style.setProperty(key, value)\n }\n }\n\n if (this.isMinimized) {\n container.style.width = this.options.collapsedWidth || DEFAULT_COLLAPSED_SIZE\n container.style.height = this.options.collapsedHeight || DEFAULT_COLLAPSED_SIZE\n }\n\n const preventDefault = (e: Event) => e.preventDefault()\n container.addEventListener('contextmenu', preventDefault)\n\n return container\n }\n\n private getContainerStyles(): string {\n const width = this.options.containerStyle?.width || DEFAULT_WIDTH\n const height = this.options.containerStyle?.height || DEFAULT_HEIGHT\n const collapsedWidth = this.options.collapsedWidth || DEFAULT_COLLAPSED_SIZE\n const collapsedHeight = this.options.collapsedHeight || DEFAULT_COLLAPSED_SIZE\n const borderRadius = this.options.borderRadius || DEFAULT_BORDER_RADIUS\n\n return `\n #${this.id}.custom-ctrl-minimap {\n cursor: default !important;\n box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);\n transition: width 0.6s ease-in, height 0.6s ease-in, border-color 0s ease-in;\n border-style: solid;\n border-radius: ${borderRadius};\n border-width: 4px;\n border-color: white;\n width: ${width};\n height: ${height};\n overflow: hidden;\n background: #fff;\n position: relative;\n }\n #${this.id}.minimized {\n border-radius: 3px !important;\n width: ${collapsedWidth};\n height: ${collapsedHeight};\n }\n #${this.id} canvas {\n width: 100% !important;\n height: 100% !important;\n display: block;\n }\n @media (prefers-color-scheme: dark) {\n #${this.id}.custom-ctrl-minimap {\n border-color: hsl(0, 0%, 15.2%);\n }\n }\n `\n }\n\n private validateContainerStyle(style?: Record<string, string>): Record<string, string> {\n const defaults = { border: '1px solid #000', width: DEFAULT_WIDTH, height: DEFAULT_HEIGHT }\n if (!style) return defaults\n\n const validated: Record<string, string> = {}\n if (style.width) {\n validated.width = CSS.supports('width', style.width) ? style.width : defaults.width\n } else {\n validated.width = defaults.width\n }\n if (style.height) {\n validated.height = CSS.supports('height', style.height) ? style.height : defaults.height\n } else {\n validated.height = defaults.height\n }\n for (const [key, value] of Object.entries(style)) {\n if (key !== 'width' && key !== 'height') {\n validated[key] = value\n }\n }\n return validated\n }\n\n private configureInteractions(): void {\n const interactions = this.options.interactions || defaultInteractions\n for (const [interaction, enabled] of Object.entries(interactions)) {\n if (!enabled) {\n const interactionMethod = interaction as keyof MinimapInteractions\n const interactionObj = this.map[interactionMethod] as { disable: () => void } | undefined\n interactionObj?.disable()\n }\n }\n }\n\n private setupToggleButton(): void {\n if (!this.options.toggleable) return\n\n const el = document.createElement('button')\n const elId = 'btn-' + getRandomUUID()\n\n el.innerHTML = sanitizeSVG(this.options.toggleButton?.icon || DEFAULT_ICON)\n el.setAttribute('id', elId)\n el.setAttribute('type', 'button')\n el.setAttribute('aria-label', this.options.hideText || 'Hide minimap')\n el.setAttribute('title', this.options.hideText || 'Hide minimap')\n\n if (this.options.toggleButton?.className) {\n const classes = this.options.toggleButton.className.split(' ')\n classes.forEach(cls => el.classList.add(cls))\n }\n\n const iconBackgroundColor = this.options.toggleButton?.iconBackgroundColor || 'black'\n const hoverColor = this.options.toggleButton?.hoverColor || '#e5e7e3'\n\n const styleEl = document.createElement('style')\n styleEl.innerHTML = `\n button#${elId} {\n border-radius: 0 !important;\n color: black;\n background-color: ${iconBackgroundColor};\n border: none;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: all 0.2s ease-in;\n position: absolute;\n width: 24px;\n height: 24px;\n z-index: 2;\n padding: 0;\n left: 0;\n top: 0;\n }\n button#${elId}:hover {\n background-color: ${hoverColor} !important;\n }\n button#${elId} svg {\n fill: white;\n width: 16px;\n height: 16px;\n }\n .minimized > button#${elId} > * {\n transform: rotate(-180deg);\n }\n `\n\n const clickHandler = () => {\n this.toggle()\n const minimized = this.container.classList.contains('minimized')\n const text = minimized\n ? this.options.showText || 'Show minimap'\n : this.options.hideText || 'Hide minimap'\n el.setAttribute('aria-label', text)\n el.setAttribute('title', text)\n }\n\n el.addEventListener('click', clickHandler)\n document.head.appendChild(styleEl)\n this.container.appendChild(el)\n\n this.toggleButtonCleanup = () => {\n el.removeEventListener('click', clickHandler)\n styleEl.remove()\n this.container.removeChild(el)\n }\n }\n\n private setupResponsiveSizing(): void {\n if (!this.options.responsive) return\n\n const updateSize = () => {\n if (this.isMinimized) return\n\n const vw = window.innerWidth / 100\n const vh = window.innerHeight / 100\n\n const responsiveWidth = this.options.responsiveWidth || '20vw'\n const responsiveHeight = this.options.responsiveHeight || '20vh'\n\n let width: number\n let height: number\n\n if (responsiveWidth.endsWith('vw')) {\n width = parseFloat(responsiveWidth) * vw\n } else if (responsiveWidth.endsWith('%')) {\n width = (parseFloat(responsiveWidth) / 100) * window.innerWidth\n } else {\n width = parseFloat(responsiveWidth)\n }\n\n if (responsiveHeight.endsWith('vh')) {\n height = parseFloat(responsiveHeight) * vh\n } else if (responsiveHeight.endsWith('%')) {\n height = (parseFloat(responsiveHeight) / 100) * window.innerHeight\n } else {\n height = parseFloat(responsiveHeight)\n }\n\n const minW = parseFloat(this.options.minWidth || '200px')\n const minH = parseFloat(this.options.minHeight || '150px')\n const maxW = parseFloat(this.options.maxWidth || DEFAULT_WIDTH)\n const maxH = parseFloat(this.options.maxHeight || DEFAULT_HEIGHT)\n\n width = Math.max(minW, Math.min(maxW, width))\n height = Math.max(minH, Math.min(maxH, height))\n\n this.container.style.width = `${width}px`\n this.container.style.height = `${height}px`\n\n this.map.resize()\n this.setParentBounds()\n }\n\n updateSize()\n\n let resizeTimeout: ReturnType<typeof setTimeout>\n this.resizeHandler = () => {\n clearTimeout(resizeTimeout)\n resizeTimeout = setTimeout(updateSize, RESIZE_DEBOUNCE_MS)\n }\n\n window.addEventListener('resize', this.resizeHandler)\n }\n\n toggle(): void {\n this.isMinimized = !this.isMinimized\n\n const collapsedWidth = this.options.collapsedWidth || DEFAULT_COLLAPSED_SIZE\n const collapsedHeight = this.options.collapsedHeight || DEFAULT_COLLAPSED_SIZE\n\n if (this.isMinimized) {\n this.container.classList.add('minimized')\n this.container.style.width = collapsedWidth\n this.container.style.height = collapsedHeight\n } else {\n this.container.classList.remove('minimized')\n if (this.options.responsive && this.resizeHandler) {\n this.resizeHandler()\n } else {\n const expandedWidth = this.options.containerStyle?.width || DEFAULT_WIDTH\n const expandedHeight = this.options.containerStyle?.height || DEFAULT_HEIGHT\n this.container.style.width = expandedWidth\n this.container.style.height = expandedHeight\n }\n }\n\n this.options.onToggle?.(this.isMinimized)\n\n setTimeout(() => {\n this.map.resize()\n this.setParentBounds()\n }, TRANSITION_DURATION_MS)\n }\n\n isMinimizedState(): boolean {\n return this.isMinimized\n }\n\n private addParentRect(rect?: ParentRectConfig): void {\n if (rect === undefined || (rect.linePaint === undefined && rect.fillPaint === undefined)) {\n return\n }\n\n this.parentRect = {\n type: 'Feature',\n properties: { name: 'parentRect' },\n geometry: {\n type: 'Polygon',\n coordinates: [[[], [], [], [], []]],\n },\n }\n\n this.map.addSource('parentRect', {\n type: 'geojson',\n data: this.parentRect,\n })\n\n if (rect.lineLayout !== undefined || rect.linePaint !== undefined) {\n this.map.addLayer({\n id: 'parentRectOutline',\n type: 'line',\n source: 'parentRect',\n layout: { ...(rect.lineLayout || {}) },\n paint: {\n 'line-color': '#FFF',\n 'line-width': 1,\n 'line-opacity': 0.85,\n ...(rect.linePaint || {}),\n },\n })\n }\n\n if (rect.fillPaint !== undefined) {\n this.map.addLayer({\n id: 'parentRectFill',\n type: 'fill',\n source: 'parentRect',\n layout: {},\n paint: {\n 'fill-color': '#08F',\n 'fill-opacity': 0.135,\n ...(rect.fillPaint || {}),\n },\n })\n }\n\n this.setParentBounds()\n }\n\n private setParentBounds(): void {\n if (this.parentRect === undefined || this.isMinimized) return\n\n const { devicePixelRatio } = window\n const canvas = this.parentMap.getCanvas()\n const width = canvas.width / devicePixelRatio\n const height = canvas.height / devicePixelRatio\n\n const unproject = this.parentMap.unproject.bind(this.parentMap)\n const northWest = unproject([0, 0])\n const northEast = unproject([width, 0])\n const southWest = unproject([0, height])\n const southEast = unproject([width, height])\n\n this.parentRect.geometry.coordinates = [\n [\n southWest.toArray(),\n southEast.toArray(),\n northEast.toArray(),\n northWest.toArray(),\n southWest.toArray(),\n ],\n ]\n\n const source = this.map.getSource<GeoJSONSource>('parentRect')\n if (source !== undefined) {\n source.setData(this.parentRect)\n }\n }\n\n private syncMaps(): () => void {\n const { pitchAdjust } = this.options\n\n const parentCallback = () => {\n if (!this.isMinimized) {\n sync('parent')\n }\n }\n const minimapCallback = () => {\n if (!this.isMinimized) {\n sync('minimap')\n }\n }\n\n const on = () => {\n this.parentMap.on('move', parentCallback)\n this.map.on('move', minimapCallback)\n }\n\n const off = () => {\n this.parentMap.off('move', parentCallback)\n this.map.off('move', minimapCallback)\n }\n\n const sync = (which: 'parent' | 'minimap') => {\n off()\n\n const from = which === 'parent' ? this.parentMap : this.map\n const to = which === 'parent' ? this.map : this.parentMap\n\n const center = from.getCenter()\n const zoom =\n from.getZoom() +\n (this.options.zoomAdjust ?? DEFAULT_ZOOM_ADJUST) * (which === 'parent' ? 1 : -1)\n const bearing = from.getBearing()\n const pitch = from.getPitch()\n\n to.jumpTo({\n center,\n zoom,\n bearing,\n pitch: pitchAdjust ? pitch : 0,\n })\n\n this.setParentBounds()\n on()\n }\n\n on()\n\n return () => {\n off()\n }\n }\n}\n\nfunction _MinimapControl(props: MinimapControlProps) {\n const { position, ...options } = props\n\n // Create minimap control using useControl\n useControl<Minimap>(() => new Minimap(options), { position })\n\n return null\n}\n\nexport const MinimapControl = memo(_MinimapControl)\n\n// Also export the Minimap class for direct use\nexport { Minimap }\n","import { Map } from './components/map'\n\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 { CanvasSource } from './components/canvas-source'\nexport { Layer } from './components/layer'\nexport { useControl } from './components/use-control'\nexport { MapProvider, useMap } from './components/use-map'\nexport { DrawControl } from './components/draw-control'\nexport { GlobeControl } from './components/globe-control'\nexport {\n MinimapControl,\n Minimap,\n type MinimapControlOptions,\n type MinimapControlProps,\n type MinimapInteractions,\n type MapInteractions,\n type ParentRectConfig,\n type ToggleButtonConfig,\n} from './components/minimap-control'\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 { CanvasSourceProps, CanvasCoordinates } from './components/canvas-source'\nexport type { LayerProps } from './components/layer'\n\n// Re-export MapLayerMouseEvent for layer event typing\nexport type { MapLayerMouseEvent } from 'maplibre-gl'\nexport type { DrawControlProps, DrawControlOptions } from './components/draw-control'\nexport type { GlobeControlProps, GlobeControlOptions } from './components/globe-control'\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;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,SAAuB;AACvB,IAAAC,gBAAsF;;;ACDtF,YAAuB;AACvB,mBAA2D;AAWpD,IAAM,qBAA2B,oBAAuC,IAAI;AAE5E,IAAM,cAAwD,WAAS;AAC5E,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAmC,CAAC,CAAC;AAE7D,QAAM,iBAAa,0BAAY,CAAC,KAAa,KAAa,cAAc;AACtE,YAAQ,cAAY;AAClB,UAAI,OAAO,WAAW;AACpB,cAAM,IAAI,MAAM,oCAAoC;AAAA,MACtD;AACA,U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K,UAAU,GAAG,QAAQ,cAAc;AACxC,WAAK,IAAI,GAAG,QAAQ,eAAe;AAAA,IACrC;AAEA,UAAM,MAAM,MAAM;AAChB,WAAK,UAAU,IAAI,QAAQ,cAAc;AACzC,WAAK,IAAI,IAAI,QAAQ,eAAe;AAAA,IACtC;AAEA,UAAM,OAAO,CAAC,UAAgC;AAC5C,UAAI;AAEJ,YAAM,OAAO,UAAU,WAAW,KAAK,YAAY,KAAK;AACxD,YAAM,KAAK,UAAU,WAAW,KAAK,MAAM,KAAK;AAEhD,YAAM,SAAS,KAAK,UAAU;AAC9B,YAAM,OACJ,KAAK,QAAQ,KACZ,KAAK,QAAQ,cAAc,wBAAwB,UAAU,WAAW,IAAI;AAC/E,YAAM,UAAU,KAAK,WAAW;AAChC,YAAM,QAAQ,KAAK,SAAS;AAE5B,SAAG,OAAO;AAAA,QACR;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO,cAAc,QAAQ;AAAA,MAC/B,CAAC;AAED,WAAK,gBAAgB;AACrB,SAAG;AAAA,IACL;AAEA,OAAG;AAEH,WAAO,MAAM;AACX,UAAI;AAAA,IACN;AAAA,EACF;AACF;AAEA,SAAS,gBAAgB,OAA4B;AACnD,QAAM,EAAE,UAAU,GAAG,QAAQ,IAAI;AAGjC,aAAoB,MAAM,IAAI,QAAQ,OAAO,GAAG,EAAE,SAAS,CAAC;AAE5D,SAAO;AACT;AAEO,IAAM,qBAAiB,qBAAK,eAAe;;;ACzsBlD,IAAO,8BAAQ;","names":["React","import_react","import_react","import_react","import_react","import_react","module","React","import_react","import_react_dom","import_react","import_react","import_react","import_react","import_react","import_react","React","import_react","mapInternal","React","import_react","mapInternal","updateSource","import_react","mapInternal","import_react","MapboxDraw","import_react","import_react"]}
|