Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/react-leaflet

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/react-leaflet - npm Package Compare versions

Comparing version 1.0.7 to 1.1.0

412

react-leaflet/index.d.ts

@@ -1,6 +0,6 @@

// Type definitions for react-leaflet 1.0
// Type definitions for react-leaflet 1.1
// Project: https://github.com/PaulLeCam/react-leaflet
// Definitions by: Dave Leaver <https://github.com/danzel>
// Definitions by: Dave Leaver <https://github.com/danzel>, David Schneider <https://github.com/davschne>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.2

@@ -13,224 +13,340 @@ import * as Leaflet from 'leaflet';

export interface LeafletLayerEvents {
export type Children = React.ReactNode | React.ReactNode[];
export interface MapEvents {
onclick?(event: Leaflet.MouseEvent): void;
ondblclick?(event: Leaflet.MouseEvent): void;
onmousedown?(event: Leaflet.MouseEvent): void;
onmouseup?(event: Leaflet.MouseEvent): void;
onmouseover?(event: Leaflet.MouseEvent): void;
onmouseout?(event: Leaflet.MouseEvent): void;
onmousemove?(event: Leaflet.MouseEvent): void;
oncontextmenu?(event: Leaflet.MouseEvent): void;
onfocus?(event: Leaflet.Event): void;
onblur?(event: Leaflet.Event): void;
onpreclick?(event: Leaflet.MouseEvent): void;
onload?(event: Leaflet.Event): void;
onunload?(event: Leaflet.Event): void;
onviewreset?(event: Leaflet.Event): void;
onmove?(event: Leaflet.Event): void;
onmovestart?(event: Leaflet.Event): void;
onmoveend?(event: Leaflet.Event): void;
ondragstart?(event: Leaflet.Event): void;
ondrag?(event: Leaflet.Event): void;
ondragend?(event: Leaflet.DragEndEvent): void;
onzoomstart?(event: Leaflet.Event): void;
onzoomend?(event: Leaflet.Event): void;
onzoomlevelschange?(event: Leaflet.Event): void;
onresize?(event: Leaflet.ResizeEvent): void;
onautopanstart?(event: Leaflet.Event): void;
onlayeradd?(event: Leaflet.LayerEvent): void;
onlayerremove?(event: Leaflet.LayerEvent): void;
onbaselayerchange?(event: Leaflet.LayersControlEvent): void;
onoverlayadd?(event: Leaflet.LayersControlEvent): void;
onoverlayremove?(event: Leaflet.LayersControlEvent): void;
onlayeradd?(event: Leaflet.LayerEvent): void;
onlayerremove?(event: Leaflet.LayerEvent): void;
onlocationfound?(event: Leaflet.LocationEvent): void;
onlocationerror?(event: Leaflet.ErrorEvent): void;
onpopupopen?(event: Leaflet.PopupEvent): void;
onpopupclose?(event: Leaflet.PopupEvent): void;
}
export interface LeafletMapStateChangeEvents {
onzoomlevelschange?(event: Leaflet.Event): void;
onresize?(event: Leaflet.ResizeEvent): void;
onunload?(event: Leaflet.Event): void;
onviewreset?(event: Leaflet.Event): void;
onload?(event: Leaflet.Event): void;
onzoomstart?(event: Leaflet.Event): void;
onmovestart?(event: Leaflet.Event): void;
onzoom?(event: Leaflet.Event): void;
export interface MarkerEvents {
onclick?(event: Leaflet.MouseEvent): void;
ondblclick?(event: Leaflet.MouseEvent): void;
onmousedown?(event: Leaflet.MouseEvent): void;
onmouseover?(event: Leaflet.MouseEvent): void;
onmouseout?(event: Leaflet.MouseEvent): void;
oncontextmenu?(event: Leaflet.MouseEvent): void;
ondragstart?(event: Leaflet.Event): void;
ondrag?(event: Leaflet.Event): void;
ondragend?(event: Leaflet.DragEndEvent): void;
onmove?(event: Leaflet.Event): void;
onzoomend?(event: Leaflet.Event): void;
onmoveend?(event: Leaflet.Event): void;
}
export interface LeafletPopupEvents {
onadd?(event: Leaflet.Event): void;
onremove?(event: Leaflet.Event): void;
onpopupopen?(event: Leaflet.PopupEvent): void;
onpopupclose?(event: Leaflet.PopupEvent): void;
onautopanstart?(event: Leaflet.Event): void;
}
export interface LeafletTooltipEvents {
ontooltipopen?(event: Leaflet.TooltipEvent): void;
ontooltipclose?(event: Leaflet.TooltipEvent): void;
export interface TileLayerEvents {
onloading?(event: Leaflet.Event): void;
onload?(event: Leaflet.Event): void;
ontileloadstart?(event: Leaflet.TileEvent): void;
ontileload?(event: Leaflet.TileEvent): void;
ontileunload?(event: Leaflet.TileEvent): void;
ontileerror?(event: Leaflet.TileEvent): void;
}
export interface LeafletLocationEvents {
onlocationerror?(event: Leaflet.ErrorEvent): void;
onlocationfound?(event: Leaflet.LocationEvent): void;
}
export interface LeafletInteractionEvents {
export interface PathEvents {
onclick?(event: Leaflet.MouseEvent): void;
ondblclick?(event: Leaflet.MouseEvent): void;
onmousedown?(event: Leaflet.MouseEvent): void;
onmouseup?(event: Leaflet.MouseEvent): void;
onmouseover?(event: Leaflet.MouseEvent): void;
onmouseout?(event: Leaflet.MouseEvent): void;
onmousemove?(event: Leaflet.MouseEvent): void;
oncontextmenu?(event: Leaflet.MouseEvent): void;
onkeypress?(event: Leaflet.KeyboardEvent): void;
onpreclick?(event: Leaflet.MouseEvent): void;
onadd?(event: Leaflet.Event): void;
onremove?(event: Leaflet.Event): void;
onpopupopen?(event: Leaflet.PopupEvent): void;
onpopupclose?(event: Leaflet.PopupEvent): void;
}
export interface LeafletOtherEvents {
onzoomanim?(event: Leaflet.ZoomAnimEvent): void;
export interface FeatureGroupEvents {
onclick?(event: Leaflet.MouseEvent): void;
ondblclick?(event: Leaflet.MouseEvent): void;
onmouseover?(event: Leaflet.MouseEvent): void;
onmouseout?(event: Leaflet.MouseEvent): void;
oncontextmenu?(event: Leaflet.MouseEvent): void;
onlayeradd?(event: Leaflet.LayerEvent): void;
onlayerremove?(event: Leaflet.LayerEvent): void;
}
export interface LeafletDraggingEvents {
ondragstart?(event: Leaflet.Event): void;
onmovestart?(event: Leaflet.Event): void;
ondrag?(event: Leaflet.Event): void;
ondragend?(event: Leaflet.DragEndEvent): void;
onmoveend?(event: Leaflet.Event): void;
export interface LayersControlEvents {
onbaselayerchange?(event: Leaflet.LayersControlEvent): void;
onoverlayadd?(event: Leaflet.LayersControlEvent): void;
onoverlayremove?(event: Leaflet.LayersControlEvent): void;
}
export interface MapProps extends React.HTMLProps<Map>,
LeafletLayerEvents, LeafletMapStateChangeEvents, LeafletPopupEvents, LeafletTooltipEvents, LeafletLocationEvents, LeafletInteractionEvents, LeafletOtherEvents, Leaflet.MapOptions {
export type LeafletEvents = MapEvents
& MarkerEvents
& TileLayerEvents
& PathEvents
& FeatureGroupEvents
& LayersControlEvents;
// Most react-leaflet components take two type parameters:
// - P : the component's props object
// - E : the corresponding Leaflet element
// These type parameters aren't needed for instantiating a component, but they are useful for
// extending react-leaflet classes.
export class MapComponent<P, E extends Leaflet.Class> extends React.Component<P, {}> {
_leafletEvents: LeafletEvents;
leafletElement: E;
extractLeafletEvents(props: P): LeafletEvents;
bindLeafletEvents(next: LeafletEvents, prev: LeafletEvents): LeafletEvents;
fireLeafletEvent(type: string, data: any): void;
getOptions(props: P): P;
}
export interface MapProps extends MapEvents, Leaflet.MapOptions, Leaflet.LocateOptions, Leaflet.FitBoundsOptions {
animate?: boolean;
bounds?: Leaflet.LatLngBoundsExpression;
boundsOptions?: Leaflet.FitBoundsOptions;
center?: Leaflet.LatLngExpression;
children?: Children;
className?: string;
id?: string;
maxBounds?: Leaflet.LatLngBoundsExpression;
maxZoom?: number;
minZoom?: number;
style?: React.CSSProperties;
useFlyTo?: boolean;
zoom?: number;
}
id?: string;
export class Map<P extends MapProps, E extends Leaflet.Map> extends MapComponent<P, E> {
className?: string;
container: HTMLDivElement;
getChildContext(): { layerContainer: E, map: E };
createLeafletElement(props: P): E;
updateLeafletElement(fromProps: P, toProps: P): void;
bindContainer(container: HTMLDivElement): void;
shouldUpdateCenter(next: Leaflet.LatLngExpression, prev: Leaflet.LatLngExpression): boolean;
shouldUpdateBounds(next: Leaflet.LatLngBoundsExpression, prev: Leaflet.LatLngBoundsExpression): boolean;
}
export type Map = React.ComponentClass<MapProps>;
export const Map: Map;
export interface MapInstance extends React.Component<MapProps, {}> {
leafletElement: Leaflet.Map;
}
export interface PaneProps {
name?: string;
children?: Children;
map?: Leaflet.Map;
className?: string;
style?: React.CSSProperties;
className?: string;
pane?: string;
}
export const Pane: React.ComponentClass<PaneProps>;
// There is no Layer class, these are the base props for all layers on the map
export interface LayerProps extends LeafletInteractionEvents {
onadd?(event: Leaflet.Event): void;
onremove?(event: Leaflet.Event): void;
// Popup events
onpopupopen?(event: Leaflet.PopupEvent): void;
onpopupclose?(event: Leaflet.PopupEvent): void;
// Tooltip events
ontooltipopen?(event: Leaflet.TooltipEvent): void;
ontooltipclose?(event: Leaflet.TooltipEvent): void;
export interface PaneState {
name?: string;
}
export class Pane<P extends PaneProps, S extends PaneState> extends React.Component<P, S> {
getChildContext(): { pane: string };
createPane(props: P): void;
removePane(): void;
setStyle(arg: { style?: string, className?: string }): void;
getParentPane(): HTMLElement | undefined;
getPane(name: string): HTMLElement | undefined;
}
export interface MarkerProps extends LayerProps, LeafletDraggingEvents {
position: Leaflet.LatLngExpression;
draggable?: boolean;
icon?: Leaflet.BaseIcon;
zIndexOffset?: number;
opacity?: number;
export interface MapLayerProps {
children?: Children;
}
export const Marker: React.ComponentClass<MarkerProps>;
export interface MarkerInstance extends React.Component<MarkerProps, {}> {
leafletElement: Leaflet.Marker;
export interface LayerContainer {
addLayer(layer: Leaflet.Layer): this;
removeLayer(layer: number | Leaflet.Layer): this;
}
export interface PopupProps extends LayerProps, Leaflet.PopupOptions {
position?: Leaflet.LatLngExpression;
export class MapLayer<P extends MapLayerProps, E extends Leaflet.Class> extends MapComponent<P, E> {
createLeafletElement(props: P): E;
updateLeafletElement(fromProps: P, toProps: P): void;
readonly layerContainer: LayerContainer | Leaflet.Map;
}
export const Popup: React.ComponentClass<PopupProps>;
// tslint:disable-next-line:no-empty-interface
export interface TooltipProps extends LayerProps, Leaflet.TooltipOptions { }
export const Tooltip: React.ComponentClass<TooltipProps>;
export interface GridLayerProps extends LayerProps {
opacity?: number;
zIndex?: number;
onloading?(event: Leaflet.Event): void;
ontileunload?(event: Leaflet.TileEvent): void;
ontileloadstart?(event: Leaflet.TileEvent): void;
ontileerror?(event: Leaflet.TileErrorEvent): void;
ontileload?(event: Leaflet.TileEvent): void;
onload?(event: Leaflet.Event): void;
export interface GridLayerProps extends Leaflet.GridLayerOptions {
children?: Children;
}
export const GridLayer: React.ComponentClass<GridLayerProps>;
export class GridLayer<P extends GridLayerProps, E extends Leaflet.GridLayer> extends MapLayer<P, E> {}
export interface TileLayerProps extends GridLayerProps, Leaflet.TileLayerOptions {
export interface TileLayerProps extends TileLayerEvents, Leaflet.TileLayerOptions {
children?: Children;
url: string;
}
export const TileLayer: React.ComponentClass<TileLayerProps>;
export class TileLayer<P extends TileLayerProps, E extends Leaflet.TileLayer> extends GridLayer<P, E> { }
export interface ImageOverlayProps extends LayerProps, LeafletInteractionEvents {
export interface WMSTileLayerProps extends TileLayerEvents, Leaflet.WMSOptions {
children?: Children;
url: string;
opacity?: string;
}
export const ImageOverlay: React.ComponentClass<ImageOverlayProps>;
export class WMSTileLayer<P extends WMSTileLayerProps, E extends Leaflet.TileLayer.WMS> extends GridLayer<P, E> { }
export interface WMSTileLayerProps extends TileLayerProps {
export interface ImageOverlayProps extends Leaflet.ImageOverlayOptions {
bounds: Leaflet.LatLngBoundsExpression;
children?: Children;
url: string;
}
export const WMSTileLayer: React.ComponentClass<WMSTileLayerProps>;
export class ImageOverlay<P extends ImageOverlayProps, E extends Leaflet.ImageOverlay> extends MapLayer<P, E> {
getChildContext(): { popupContainer: E };
}
// Path is an abstract class
// tslint:disable-next-line:no-empty-interface
export interface PathProps extends LeafletLayerEvents, LeafletInteractionEvents, Leaflet.PathOptions {}
export interface LayerGroupProps {
children?: Children;
}
export class LayerGroup<P extends LayerGroupProps, E extends Leaflet.LayerGroup> extends MapLayer<P, E> {
getChildContext(): { layerContainer: E };
}
export interface CircleProps extends PathProps {
export interface MarkerProps extends MarkerEvents, Leaflet.MarkerOptions {
children?: Children;
position: Leaflet.LatLngExpression;
}
export class Marker<P extends MarkerProps, E extends Leaflet.Marker> extends MapLayer<P, E> {
getChildContext(): { popupContainer: E };
}
export interface PathProps extends PathEvents, Leaflet.PathOptions { }
export abstract class Path<P extends PathProps, E> extends MapLayer<P, E> {
getChildContext(): { popupContainer: E };
getPathOptions(props: P): Leaflet.PathOptions;
setStyle(options: Leaflet.PathOptions): void;
setStyleIfChanged(fromProps: P, toProps: P): void;
}
export interface CircleProps extends PathEvents, Leaflet.CircleMarkerOptions {
center: Leaflet.LatLngExpression;
radius?: number;
children?: Children;
radius: number;
}
export const Circle: React.ComponentClass<CircleProps>;
export class Circle<P extends CircleProps, E extends Leaflet.Circle> extends Path<P, E> { }
export interface CircleMarkerProps extends PathProps {
export interface CircleMarkerProps extends PathEvents, Leaflet.CircleMarkerOptions {
center: Leaflet.LatLngExpression;
radius?: number;
children?: Children;
radius: number;
}
export const CircleMarker: React.ComponentClass<CircleMarkerProps>;
export class CircleMarker<P extends CircleMarkerProps, E extends Leaflet.CircleMarker> extends Path<P, E> { }
export interface PolylineProps extends PathProps {
export interface FeatureGroupProps extends FeatureGroupEvents, Leaflet.PathOptions {
children?: Children;
}
export class FeatureGroup<P extends FeatureGroupProps, E extends Leaflet.FeatureGroup> extends Path<P, E> {
getChildContext(): { layerContainer: E, popupContainer: E };
}
export interface GeoJSONProps extends FeatureGroupEvents, Leaflet.GeoJSONOptions {
children?: Children;
data: GeoJSON.GeoJsonObject;
style?: Leaflet.StyleFunction;
}
export class GeoJSON<P extends GeoJSONProps, E extends Leaflet.GeoJSON> extends Path<P, E> { }
export interface PolylineProps extends PathEvents, Leaflet.PolylineOptions {
children?: Children;
positions: Leaflet.LatLngExpression[] | Leaflet.LatLngExpression[][];
}
export const Polyline: React.ComponentClass<PolylineProps>;
export class Polyline<P extends PolylineProps, E extends Leaflet.Polyline> extends Path<P, E> { }
export interface PolygonProps extends PathProps {
export interface PolygonProps extends PathEvents, Leaflet.PolylineOptions {
children?: Children;
popupContainer?: Leaflet.FeatureGroup;
positions: Leaflet.LatLngExpression[] | Leaflet.LatLngExpression[][] | Leaflet.LatLngExpression[][][];
}
export const Polygon: React.ComponentClass<PolygonProps>;
export class Polygon<P extends PolygonProps, E extends Leaflet.Polygon> extends Path<P, E> { }
export interface RectangleProps extends PathProps {
export interface RectangleProps extends PathEvents, Leaflet.PolylineOptions {
children?: Children;
bounds: Leaflet.LatLngBoundsExpression;
popupContainer?: Leaflet.FeatureGroup;
}
export const Rectangle: React.ComponentClass<RectangleProps>;
export class Rectangle<P extends RectangleProps, E extends Leaflet.Rectangle> extends Path<P, E> { }
// tslint:disable-next-line:no-empty-interface
export interface LayerGroupProps extends LayerProps { }
export const LayerGroup: React.ComponentClass<LayerGroupProps>;
export interface PopupProps extends Leaflet.PopupOptions {
children?: Children;
position?: Leaflet.LatLngExpression;
}
export class Popup<P extends PopupProps, E extends Leaflet.Popup> extends MapComponent<P, E> {
onPopupOpen(arg: { popup: E }): void;
onPopupClose(arg: { popup: E }): void;
renderPopupContent(): void;
removePopupContent(): void;
}
// tslint:disable-next-line:no-empty-interface
export interface FeatureGroupProps extends LayerGroupProps, Leaflet.PathOptions { }
export const FeatureGroup: React.ComponentClass<FeatureGroupProps>;
export interface GeoJSONProps extends FeatureGroupProps, Leaflet.GeoJSONOptions {
data: GeoJSON.GeoJsonObject;
export interface TooltipProps extends Leaflet.TooltipOptions {
children?: Children;
}
export const GeoJSON: React.ComponentClass<GeoJSONProps>;
export class Tooltip<P extends TooltipProps, E extends Leaflet.Tooltip> extends MapComponent<P, E> {
onTooltipOpen(arg: { tooltip: E }): void;
onTooltipClose(arg: { tooltip: E }): void;
renderTooltipContent(): void;
removeTooltipContent(): void;
}
export interface AttributionControlProps {
position?: Leaflet.ControlPosition;
export type MapControlProps = Leaflet.ControlOptions;
export class MapControl<P extends MapControlProps, E extends Leaflet.Control> extends React.Component<P, {}> {
leafletElement: E;
createLeafletElement(props: P): E;
updateLeafletElement(fromProps: P, toProps: P): void;
}
export const AttributionControl: React.ComponentClass<AttributionControlProps>;
export interface LayersControlProps {
position?: Leaflet.ControlPosition;
export type AttributionControlProps = Leaflet.Control.AttributionOptions;
export class AttributionControl<P extends AttributionControlProps, E extends Leaflet.Control.Attribution> extends MapControl<P, E> { }
export interface LayersControlProps extends LayersControlEvents, Leaflet.Control.LayersOptions {
baseLayers?: Leaflet.Control.LayersObject;
children?: Children;
overlays?: Leaflet.Control.LayersObject;
}
export const LayersControl: React.ComponentClass<LayersControlProps> & { BaseLayer: LayersControl.BaseLayer, Overlay: LayersControl.Overlay };
export class LayersControl<P extends AttributionControlProps, E extends Leaflet.Control.Layers> extends MapControl<P, E> { }
export namespace LayersControl {
interface LayersControlLayerProps {
name: string;
interface BaseControlledLayerProps {
checked?: boolean;
children?: Children;
removeLayer?(layer: Leaflet.Layer): void;
removeLayerControl?(layer: Leaflet.Layer): void;
}
type BaseLayer = React.ComponentClass<LayersControlLayerProps>;
type Overlay = React.ComponentClass<LayersControlLayerProps>;
interface ControlledLayerProps extends BaseControlledLayerProps {
addBaseLayer?(layer: Leaflet.Layer, name: string, checked: boolean): void;
addOverlay?(layer: Leaflet.Layer, name: string, checked: boolean): void;
name: string;
}
class ControlledLayer<P extends BaseControlledLayerProps> extends React.Component<P, {}> {
layer?: Leaflet.Layer;
getChildContext(): { layerContainer: LayerContainer };
addLayer(): void;
removeLayer(layer: Leaflet.Layer): void;
}
class BaseLayer<P extends ControlledLayerProps> extends ControlledLayer<P> { }
class Overlay<P extends ControlledLayerProps> extends ControlledLayer<P> { }
}
export interface MapControlProps {
position?: Leaflet.ControlPosition;
}
export class MapControl<T extends MapControlProps> extends React.Component<T, any> {
leafletElement?: L.Control;
}
export type ScaleControlProps = Leaflet.Control.ScaleOptions;
export class ScaleControl<P extends ScaleControlProps, E extends Leaflet.Control.Scale> extends MapControl<P, E> { }
export interface ScaleControlProps {
position: Leaflet.ControlPosition;
}
export const ScaleControl: React.ComponentClass<ScaleControlProps>;
export interface ZoomControlProps {
position: Leaflet.ControlPosition;
}
export const ZoomControl: React.ComponentClass<ZoomControlProps>;
export type ZoomControlProps = Leaflet.Control.ZoomOptions;
export class ZoomControl<P extends ZoomControlProps, E extends Leaflet.Control.Zoom> extends MapControl<P, E> { }
{
"name": "@types/react-leaflet",
"version": "1.0.7",
"version": "1.1.0",
"description": "TypeScript definitions for react-leaflet",

@@ -10,2 +10,6 @@ "license": "MIT",

"url": "https://github.com/danzel"
},
{
"name": "David Schneider",
"url": "https://github.com/davschne"
}

@@ -24,4 +28,4 @@ ],

"peerDependencies": {},
"typesPublisherContentHash": "fa25c36bded7b4a990a6805c462d0a12911316e3f4bdc51e86df5147afa1365f",
"typeScriptVersion": "2.1"
"typesPublisherContentHash": "e84ccd1a4518abe0982dde0ae2b620ca9c1858fc2ff696323c9c02e7fc522258",
"typeScriptVersion": "2.2"
}

@@ -11,3 +11,3 @@ # Installation

Additional Details
* Last updated: Mon, 17 Apr 2017 17:55:17 GMT
* Last updated: Wed, 19 Apr 2017 16:17:53 GMT
* Dependencies: leaflet, react

@@ -17,2 +17,2 @@ * Global values: none

# Credits
These definitions were written by Dave Leaver <https://github.com/danzel>.
These definitions were written by Dave Leaver <https://github.com/danzel>, David Schneider <https://github.com/davschne>.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc