react-leaflet
Advanced tools
Comparing version 5.0.0-rc.1 to 5.0.0-rc.2
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { Control } from 'leaflet'; | ||
export type AttributionControlProps = Control.AttributionOptions; | ||
export declare const AttributionControl: import("react").ForwardRefExoticComponent<Control.AttributionOptions & import("react").RefAttributes<Control.Attribution>>; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import { type CircleProps } from '@react-leaflet/core'; | ||
@@ -3,0 +2,0 @@ import { Circle as LeafletCircle } from 'leaflet'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import { type CircleMarkerProps } from '@react-leaflet/core'; | ||
@@ -3,0 +2,0 @@ import { CircleMarker as LeafletCircleMarker } from 'leaflet'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import { type PathProps } from '@react-leaflet/core'; | ||
@@ -3,0 +2,0 @@ import { FeatureGroup as LeafletFeatureGroup } from 'leaflet'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import { type PathProps } from '@react-leaflet/core'; | ||
@@ -3,0 +2,0 @@ import type { GeoJsonObject } from 'geojson'; |
import { createElementObject, createLayerComponent, extendContext, updateMediaOverlay } from '@react-leaflet/core'; | ||
import { LatLngBounds, ImageOverlay as LeafletImageOverlay } from 'leaflet'; | ||
export const ImageOverlay = createLayerComponent(function createImageOveraly({ bounds, url, ...options }, ctx) { | ||
export const ImageOverlay = createLayerComponent(function createImageOverlay({ bounds, url, ...options }, ctx) { | ||
const overlay = new LeafletImageOverlay(url, bounds, options); | ||
@@ -5,0 +5,0 @@ return createElementObject(overlay, extendContext(ctx, { |
@@ -9,6 +9,6 @@ import { Control, type Layer } from 'leaflet'; | ||
map: import("leaflet").Map; | ||
layerContainer?: import("leaflet").LayerGroup<any> | import("@react-leaflet/core/lib/context").ControlledLayer | undefined; | ||
layersControl?: Control.Layers | undefined; | ||
overlayContainer?: Layer | undefined; | ||
pane?: string | undefined; | ||
layerContainer?: import("@react-leaflet/core/lib/context").ControlledLayer | import("leaflet").LayerGroup; | ||
layersControl?: Control.Layers; | ||
overlayContainer?: Layer; | ||
pane?: string; | ||
}>) => React.RefObject<Readonly<{ | ||
@@ -19,6 +19,6 @@ instance: Control.Layers; | ||
map: import("leaflet").Map; | ||
layerContainer?: import("leaflet").LayerGroup<any> | import("@react-leaflet/core/lib/context").ControlledLayer | undefined; | ||
layersControl?: Control.Layers | undefined; | ||
overlayContainer?: Layer | undefined; | ||
pane?: string | undefined; | ||
layerContainer?: import("@react-leaflet/core/lib/context").ControlledLayer | import("leaflet").LayerGroup; | ||
layersControl?: Control.Layers; | ||
overlayContainer?: Layer; | ||
pane?: string; | ||
}>; | ||
@@ -32,6 +32,6 @@ container?: unknown; | ||
map: import("leaflet").Map; | ||
layerContainer?: import("leaflet").LayerGroup<any> | import("@react-leaflet/core/lib/context").ControlledLayer | undefined; | ||
layersControl?: Control.Layers | undefined; | ||
overlayContainer?: Layer | undefined; | ||
pane?: string | undefined; | ||
layerContainer?: import("@react-leaflet/core/lib/context").ControlledLayer | import("leaflet").LayerGroup; | ||
layersControl?: Control.Layers; | ||
overlayContainer?: Layer; | ||
pane?: string; | ||
}>; | ||
@@ -38,0 +38,0 @@ container?: unknown; |
import { type FitBoundsOptions, type LatLngBoundsExpression, Map as LeafletMap, type MapOptions } from 'leaflet'; | ||
import React, { type CSSProperties, type ReactNode } from 'react'; | ||
export type MapRef = LeafletMap | null; | ||
export interface MapContainerProps extends MapOptions { | ||
@@ -13,2 +14,2 @@ bounds?: LatLngBoundsExpression; | ||
} | ||
export declare const MapContainer: React.ForwardRefExoticComponent<MapContainerProps & React.RefAttributes<LeafletMap | undefined>>; | ||
export declare const MapContainer: React.ForwardRefExoticComponent<MapContainerProps & React.RefAttributes<LeafletMap>>; |
import { LeafletContext, createLeafletContext } from '@react-leaflet/core'; | ||
import { Map as LeafletMap } from 'leaflet'; | ||
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'; | ||
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react'; | ||
function MapContainerComponent({ bounds, boundsOptions, center, children, className, id, placeholder, style, whenReady, zoom, ...options }, forwardedRef) { | ||
@@ -12,5 +12,8 @@ const [props] = useState({ | ||
const mapInstanceRef = useRef(undefined); | ||
useImperativeHandle(forwardedRef, ()=>mapInstanceRef.current); | ||
const mapRef = (node)=>{ | ||
if (node != null && !mapInstanceRef.current) { | ||
useImperativeHandle(forwardedRef, ()=>context?.map ?? null, [ | ||
context | ||
]); | ||
// biome-ignore lint/correctness/useExhaustiveDependencies: ref callback | ||
const mapRef = useCallback((node)=>{ | ||
if (node !== null && !mapInstanceRef.current) { | ||
const map = new LeafletMap(node, options); | ||
@@ -28,3 +31,3 @@ mapInstanceRef.current = map; | ||
} | ||
}; | ||
}, []); | ||
useEffect(()=>{ | ||
@@ -31,0 +34,0 @@ return ()=>{ |
@@ -9,2 +9,3 @@ import React, { type CSSProperties, type ReactNode } from 'react'; | ||
} | ||
export declare const Pane: React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLElement | undefined>>; | ||
export type PaneRef = HTMLElement | null; | ||
export declare const Pane: React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLElement>>; |
@@ -40,3 +40,3 @@ import { LeafletContext, addClassName, useLeafletContext } from '@react-leaflet/core'; | ||
const [paneName] = useState(props.name); | ||
const [paneElement, setPaneElement] = useState(); | ||
const [paneElement, setPaneElement] = useState(null); | ||
useImperativeHandle(forwardedRef, ()=>paneElement, [ | ||
@@ -43,0 +43,0 @@ paneElement |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { Control } from 'leaflet'; | ||
export type ScaleControlProps = Control.ScaleOptions; | ||
export declare const ScaleControl: import("react").ForwardRefExoticComponent<Control.ScaleOptions & import("react").RefAttributes<Control.Scale>>; |
@@ -11,6 +11,6 @@ import { type MediaOverlayProps } from '@react-leaflet/core'; | ||
map: import("leaflet").Map; | ||
layerContainer?: import("leaflet").LayerGroup<any> | import("@react-leaflet/core/lib/context").ControlledLayer | undefined; | ||
layersControl?: import("leaflet").Control.Layers | undefined; | ||
overlayContainer?: import("leaflet").Layer | undefined; | ||
pane?: string | undefined; | ||
layerContainer?: import("@react-leaflet/core/lib/context").ControlledLayer | import("leaflet").LayerGroup; | ||
layersControl?: import("leaflet").Control.Layers; | ||
overlayContainer?: import("leaflet").Layer; | ||
pane?: string; | ||
}>) => import("react").RefObject<Readonly<{ | ||
@@ -21,6 +21,6 @@ instance: LeafletSVGOverlay; | ||
map: import("leaflet").Map; | ||
layerContainer?: import("leaflet").LayerGroup<any> | import("@react-leaflet/core/lib/context").ControlledLayer | undefined; | ||
layersControl?: import("leaflet").Control.Layers | undefined; | ||
overlayContainer?: import("leaflet").Layer | undefined; | ||
pane?: string | undefined; | ||
layerContainer?: import("@react-leaflet/core/lib/context").ControlledLayer | import("leaflet").LayerGroup; | ||
layersControl?: import("leaflet").Control.Layers; | ||
overlayContainer?: import("leaflet").Layer; | ||
pane?: string; | ||
}>; | ||
@@ -34,6 +34,6 @@ container?: unknown; | ||
map: import("leaflet").Map; | ||
layerContainer?: import("leaflet").LayerGroup<any> | import("@react-leaflet/core/lib/context").ControlledLayer | undefined; | ||
layersControl?: import("leaflet").Control.Layers | undefined; | ||
overlayContainer?: import("leaflet").Layer | undefined; | ||
pane?: string | undefined; | ||
layerContainer?: import("@react-leaflet/core/lib/context").ControlledLayer | import("leaflet").LayerGroup; | ||
layersControl?: import("leaflet").Control.Layers; | ||
overlayContainer?: import("leaflet").Layer; | ||
pane?: string; | ||
}>; | ||
@@ -40,0 +40,0 @@ container?: unknown; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import { type LayerProps } from '@react-leaflet/core'; | ||
@@ -3,0 +2,0 @@ import { TileLayer as LeafletTileLayer, type TileLayerOptions } from 'leaflet'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import { type LayerProps } from '@react-leaflet/core'; | ||
@@ -3,0 +2,0 @@ import { TileLayer, type WMSOptions, type WMSParams } from 'leaflet'; |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { Control } from 'leaflet'; | ||
export type ZoomControlProps = Control.ZoomOptions; | ||
export declare const ZoomControl: import("react").ForwardRefExoticComponent<Control.ZoomOptions & import("react").RefAttributes<Control.Zoom>>; |
{ | ||
"name": "react-leaflet", | ||
"version": "5.0.0-rc.1", | ||
"version": "5.0.0-rc.2", | ||
"description": "React components for Leaflet maps", | ||
@@ -33,14 +33,14 @@ "repository": { | ||
"dependencies": { | ||
"@react-leaflet/core": "^3.0.0-rc.1" | ||
"@react-leaflet/core": "^3.0.0-rc.2" | ||
}, | ||
"peerDependencies": { | ||
"leaflet": "^1.9.0", | ||
"react": "rc", | ||
"react-dom": "rc" | ||
"react": "^19.0.0", | ||
"react-dom": "^19.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/geojson": "^7946.0.10", | ||
"@types/leaflet": "^1.9.1", | ||
"@types/react": "npm:types-react@rc", | ||
"@types/react-dom": "npm:types-react-dom@rc" | ||
"@types/geojson": "^7946.0.15", | ||
"@types/leaflet": "^1.9.15", | ||
"@types/react": "^19.0.0", | ||
"@types/react-dom": "^19.0.0" | ||
}, | ||
@@ -47,0 +47,0 @@ "jest": { |
48865
823
- Removedreact@19.0.0-rc.1(transitive)
- Removedreact-dom@19.0.0-rc.1(transitive)