@react-leaflet/core
Advanced tools
Comparing version 3.0.0-rc.1 to 3.0.0-rc.2
@@ -1,11 +0,11 @@ | ||
import React, { type RefObject, type ReactNode } from 'react'; | ||
import React, { type PropsWithoutRef, type RefObject, type ReactNode } from 'react'; | ||
import type { DivOverlay, DivOverlayHook } from './div-overlay.js'; | ||
import type { LeafletElement } from './element.js'; | ||
type ElementHook<E, P> = (props: P) => RefObject<LeafletElement<E>>; | ||
export type PropsWithChildren = { | ||
export type PropsWithChildren = PropsWithoutRef<{ | ||
children?: ReactNode; | ||
}; | ||
export declare function createContainerComponent<E, P extends PropsWithChildren>(useElement: ElementHook<E, P>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<E>>; | ||
export declare function createDivOverlayComponent<E extends DivOverlay, P extends PropsWithChildren>(useElement: ReturnType<DivOverlayHook<E, P>>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<E>>; | ||
export declare function createLeafComponent<E, P>(useElement: ElementHook<E, P>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<E>>; | ||
}>; | ||
export declare function createContainerComponent<E, P extends PropsWithChildren>(useElement: ElementHook<E, PropsWithoutRef<P>>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<E>>; | ||
export declare function createDivOverlayComponent<E extends DivOverlay, P extends PropsWithChildren>(useElement: ReturnType<DivOverlayHook<E, PropsWithoutRef<P>>>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<E>>; | ||
export declare function createLeafComponent<E, P>(useElement: ElementHook<E, PropsWithoutRef<P>>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<E>>; | ||
export {}; |
@@ -8,5 +8,6 @@ import React, { forwardRef, useEffect, useImperativeHandle, useState } from 'react'; | ||
useImperativeHandle(forwardedRef, ()=>instance); | ||
return props.children == null ? null : /*#__PURE__*/ React.createElement(LeafletContext, { | ||
const { children } = props; | ||
return children == null ? null : /*#__PURE__*/ React.createElement(LeafletContext, { | ||
value: context | ||
}, props.children); | ||
}, children); | ||
} | ||
@@ -13,0 +14,0 @@ return /*#__PURE__*/ forwardRef(ContainerComponent); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import type { Control, Layer, LayerGroup, Map as LeafletMap } from 'leaflet'; | ||
@@ -21,7 +20,7 @@ export declare const CONTEXT_VERSION = 1; | ||
map: LeafletMap; | ||
layerContainer?: LayerGroup<any> | ControlledLayer | undefined; | ||
layersControl?: Control.Layers | undefined; | ||
overlayContainer?: Layer | undefined; | ||
pane?: string | undefined; | ||
layerContainer?: ControlledLayer | LayerGroup; | ||
layersControl?: Control.Layers; | ||
overlayContainer?: Layer; | ||
pane?: string; | ||
}> | null>; | ||
export declare function useLeafletContext(): LeafletContextInterface; |
@@ -1,3 +0,3 @@ | ||
/// <reference types="react" /> | ||
import type { Control, ControlOptions, FeatureGroup, Layer, Path } from 'leaflet'; | ||
import type { PropsWithoutRef } from 'react'; | ||
import { type PropsWithChildren } from './component.js'; | ||
@@ -13,7 +13,7 @@ import type { LeafletContextInterface } from './context.js'; | ||
} | ||
export declare function createControlComponent<E extends Control, P extends ControlOptions>(createInstance: (props: P) => E): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<P> & import("react").RefAttributes<E>>; | ||
export declare function createLayerComponent<E extends Layer, P extends LayerWithChildrenProps>(createElement: (props: P, context: LeafletContextInterface) => LeafletElement<E>, updateElement?: (instance: E, props: P, prevProps: P) => void): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<P> & import("react").RefAttributes<E>>; | ||
export declare function createOverlayComponent<E extends DivOverlay, P extends LayerWithChildrenProps>(createElement: (props: P, context: LeafletContextInterface) => LeafletElement<E>, useLifecycle: DivOverlayLifecycleHook<E, P>): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<P> & import("react").RefAttributes<E>>; | ||
export declare function createPathComponent<E extends FeatureGroup | Path, P extends PathWithChildrenProps>(createElement: (props: P, context: LeafletContextInterface) => LeafletElement<E>, updateElement?: (instance: E, props: P, prevProps: P) => void): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<P> & import("react").RefAttributes<E>>; | ||
export declare function createTileLayerComponent<E extends Layer, P extends LayerProps>(createElement: (props: P, context: LeafletContextInterface) => LeafletElement<E>, updateElement?: (instance: E, props: P, prevProps: P) => void): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<P> & import("react").RefAttributes<E>>; | ||
export declare function createControlComponent<E extends Control, P extends ControlOptions>(createInstance: (props: PropsWithoutRef<P>) => E): import("react").ForwardRefExoticComponent<PropsWithoutRef<P> & import("react").RefAttributes<E>>; | ||
export declare function createLayerComponent<E extends Layer, P extends LayerWithChildrenProps>(createElement: (props: PropsWithoutRef<P>, context: LeafletContextInterface) => LeafletElement<E>, updateElement?: (instance: E, props: PropsWithoutRef<P>, prevProps: PropsWithoutRef<P>) => void): import("react").ForwardRefExoticComponent<PropsWithoutRef<P> & import("react").RefAttributes<E>>; | ||
export declare function createOverlayComponent<E extends DivOverlay, P extends LayerWithChildrenProps>(createElement: (props: PropsWithoutRef<P>, context: LeafletContextInterface) => LeafletElement<E>, useLifecycle: DivOverlayLifecycleHook<E, PropsWithoutRef<P>>): import("react").ForwardRefExoticComponent<PropsWithoutRef<P> & import("react").RefAttributes<E>>; | ||
export declare function createPathComponent<E extends FeatureGroup | Path, P extends PathWithChildrenProps>(createElement: (props: PropsWithoutRef<P>, context: LeafletContextInterface) => LeafletElement<E>, updateElement?: (instance: E, props: PropsWithoutRef<P>, prevProps: PropsWithoutRef<P>) => void): import("react").ForwardRefExoticComponent<PropsWithoutRef<P> & import("react").RefAttributes<E>>; | ||
export declare function createTileLayerComponent<E extends Layer, P extends LayerProps>(createElement: (props: PropsWithoutRef<P>, context: LeafletContextInterface) => LeafletElement<E>, updateElement?: (instance: E, props: PropsWithoutRef<P>, prevProps: PropsWithoutRef<P>) => void): import("react").ForwardRefExoticComponent<PropsWithoutRef<P> & import("react").RefAttributes<E>>; | ||
export {}; |
{ | ||
"name": "@react-leaflet/core", | ||
"version": "3.0.0-rc.1", | ||
"version": "3.0.0-rc.2", | ||
"description": "React Leaflet core", | ||
@@ -33,8 +33,8 @@ "repository": { | ||
"leaflet": "^1.9.0", | ||
"react": "rc", | ||
"react-dom": "rc" | ||
"react": "^19.0.0", | ||
"react-dom": "^19.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "npm:types-react@rc", | ||
"@types/react-dom": "npm:types-react-dom@rc" | ||
"@types/react": "^19.0.0", | ||
"@types/react-dom": "^19.0.0" | ||
}, | ||
@@ -41,0 +41,0 @@ "jest": { |
34941