Skip to content

Commit

Permalink
Merge pull request #3 from TurtIeSocks/leaflet-geoman-2.13.1
Browse files Browse the repository at this point in the history
Support Leaflet Geoman 2.13.1
  • Loading branch information
TurtIeSocks authored Dec 2, 2022
2 parents 93ac7b4 + d1b1fa5 commit 662f61c
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 225 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Respects all of the options, global options, and event handlers from Leaflet Geo
- [Options](https://github.com/geoman-io/leaflet-geoman/blob/0fabb8c2bfe0d40d1d9d6a827912bd53d8f6ad3b/leaflet-geoman.d.ts#L1083)
- [Global Options](https://github.com/geoman-io/leaflet-geoman/blob/0fabb8c2bfe0d40d1d9d6a827912bd53d8f6ad3b/leaflet-geoman.d.ts#L748)
- [Path Options](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/3b442d0c53fe1de99bcaf2b82fae33c22c42a052/types/leaflet/index.d.ts#L1000)
- [Lang Options](https://github.com/geoman-io/leaflet-geoman/blob/0fabb8c2bfe0d40d1d9d6a827912bd53d8f6ad3b/leaflet-geoman.d.ts#L526)
- [Lang Options](https://github.com/geoman-io/leaflet-geoman/blob/3458b8541dc283fa5404dbb3e6558bdee4a32874/leaflet-geoman.d.ts#L488)

```ts
// Additional Props
Expand All @@ -85,7 +85,7 @@ interface GeomanProps extends GeomanHandlers {
globalOptions?: PM.GlobalOptions // See global options link above
pathOptions?: L.PathOptions // See Leaflet PathOptions link above
eventDebugFn?: EventDebugFn // optional function that can be used to debug events, such as `console.log`
lang?: string // See lang options link above
lang?: PM.SupportLocales // See lang options link above
onMount?: () => void // callback that runs after it mounts to the DOM
onUnmount?: () => void // callback that runs after it unmounts
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-leaflet-geoman-v2",
"version": "0.2.1",
"version": "0.2.2",
"description": "React wrapper for the leaflet-geoman plugin",
"repository": "https://github.com/TurtIeSocks/react-leaflet-geoman",
"author": "TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com>",
Expand All @@ -20,7 +20,7 @@
"use-deep-compare-effect": "^1.8.1"
},
"devDependencies": {
"@geoman-io/leaflet-geoman-free": "^2.13.0",
"@geoman-io/leaflet-geoman-free": "^2.13.1",
"@rollup/plugin-typescript": "^8.4.0",
"@types/leaflet": "^1.7.11",
"@types/node": "^18.7.13",
Expand All @@ -37,7 +37,7 @@
"vite-plugin-checker": "^0.4.9"
},
"peerDependencies": {
"@geoman-io/leaflet-geoman-free": "^2.13.0",
"@geoman-io/leaflet-geoman-free": "^2.13.1",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0",
"react-leaflet": "^4.0.2"
Expand Down
5 changes: 1 addition & 4 deletions src/GeomanControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import type { LayerGroup } from 'leaflet'
import useDeepCompareEffect from 'use-deep-compare-effect'

import type { GeomanProps } from './types'
import reference from './events/reference'
import layerEvents from './events/layer'
import globalEvents from './events/global'
import mapEvents from './events/map'
import { reference, layerEvents, globalEvents, mapEvents } from './events'

export default function GeomanControls({
options = {},
Expand Down
2 changes: 1 addition & 1 deletion src/events/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Map } from 'leaflet'

import type { HandlersWithDebug, Method } from '../types'

export default function globalEvents(
export function globalEvents(
map: Map,
handlers: HandlersWithDebug,
method: Method
Expand Down
8 changes: 4 additions & 4 deletions src/events/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { default as globalEvents } from './global'
export { default as layerEvents } from './layer'
export { default as mapEvents } from './map'
export { default as references } from './reference'
export * from './global'
export * from './layer'
export * from './map'
export * from './reference'
2 changes: 1 addition & 1 deletion src/events/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Layer } from 'leaflet'

import type { HandlersWithDebug, Method } from '../types'

export default function layerEvents(
export function layerEvents(
layer: Layer,
handlers: HandlersWithDebug,
method: Method
Expand Down
4 changes: 2 additions & 2 deletions src/events/map.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Map } from 'leaflet'

import layerEvents from './layer'
import { layerEvents } from './layer'
import type { HandlersWithDebug, Method } from '../types'

export default function mapEvents(
export function mapEvents(
map: Map,
handlers: HandlersWithDebug,
method: Method
Expand Down
2 changes: 1 addition & 1 deletion src/events/reference.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GeomanHandlers } from '../types'

export default [
export const reference = [
'onMapRemove',
'onLayerRemove',
'onMapCut',
Expand Down
37 changes: 1 addition & 36 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
import type { PM, PathOptions } from 'leaflet'

declare module 'leaflet' {
namespace PM {
interface PMMap {
// PR https://github.com/geoman-io/leaflet-geoman/pull/1215
getGeomanLayers(asFeatureGroup: true): FeatureGroup
getGeomanLayers(asFeatureGroup?: false): Layer[]

getGeomanDrawLayers(asFeatureGroup: true): FeatureGroup
getGeomanDrawLayers(asFeatureGroup?: false): Layer[]
}
}
}

export type Method = 'on' | 'off'

export type EventDebugFn = (input?: any) => void
Expand Down Expand Up @@ -88,27 +75,5 @@ export interface GeomanProps extends GeomanHandlers {
eventDebugFn?: EventDebugFn
onMount?: () => void
onUnmount?: () => void
lang?:
| 'cz'
| 'da'
| 'de'
| 'el'
| 'en'
| 'es'
| 'fa'
| 'fr'
| 'hu'
| 'id'
| 'it'
| 'nl'
| 'no'
| 'pl'
| 'pt_br'
| 'ro'
| 'ru'
| 'sv'
| 'tr'
| 'ua'
| 'zh'
| 'zh_tw'
lang?: PM.SupportLocales
}
Loading

0 comments on commit 662f61c

Please # to comment.