From 00cb715ce4da565b0385822cf56d6fae66a3a81b Mon Sep 17 00:00:00 2001 From: Florian Sommariva Date: Thu, 15 Feb 2024 18:55:56 +0100 Subject: [PATCH] Remove leaflet-ant-path package --- package.json | 1 - src/components/map/ant-path.tsx | 41 --------------------------------- yarn.lock | 5 ---- 3 files changed, 47 deletions(-) delete mode 100644 src/components/map/ant-path.tsx diff --git a/package.json b/package.json index 0c3f510..a318ca6 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "clsx": "^1.2.1", "json-schema-yup-transformer": "2.0.0-beta.0", "leaflet": "^1.9.4", - "leaflet-ant-path": "^1.3.0", "leaflet.locatecontrol": "^0.79.0", "lucide-react": "^0.221.0", "next": "^13.5.4", diff --git a/src/components/map/ant-path.tsx b/src/components/map/ant-path.tsx deleted file mode 100644 index 42aeae2..0000000 --- a/src/components/map/ant-path.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { - createContainerComponent, - createElementHook, - createPathHook, -} from '@react-leaflet/core'; -import { LeafletContextInterface } from '@react-leaflet/core/lib/context'; -import { PathOptions, Polyline } from 'leaflet'; -// @ts-ignore next-line not TS definitions for this package -import { antPath } from 'leaflet-ant-path'; -import { PolylineProps } from 'react-leaflet/lib/Polyline'; - -export type AntPathOptions = PathOptions & { - dashArray?: [string, string]; - delay?: number; - weight?: number; - pulseColor?: number; -}; - -interface Props extends PolylineProps { - options: AntPathOptions; -} - -function createAntPath(props: Props, context: LeafletContextInterface) { - const instance = antPath(props.positions, props.options); - return { instance, context: { ...context, overlayContainer: instance } }; -} - -function updateAntPath(instance: Polyline, props: Props, prevProps: Props) { - if ( - props.positions !== prevProps.positions || - props.options !== prevProps.options - ) { - instance.setLatLngs(props.positions); - } -} - -const useAntPathElement = createElementHook(createAntPath, updateAntPath); -const useAntPath = createPathHook(useAntPathElement); -const AntPath = createContainerComponent(useAntPath); - -export default AntPath; diff --git a/yarn.lock b/yarn.lock index 65315af..694efcf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2636,11 +2636,6 @@ language-tags@=1.0.5: dependencies: language-subtag-registry "~0.3.2" -leaflet-ant-path@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/leaflet-ant-path/-/leaflet-ant-path-1.3.0.tgz#eac54e936e911666e61e9c2af682cba768b46a5a" - integrity sha512-wgWWcAD4w8QVguRsHh89NGj5eqwLOP6e/HazunW0fQaytqZqEh3WePWYIrmbUeMcOf2cX/+GecHkFfI5tirS1Q== - leaflet.locatecontrol@^0.79.0: version "0.79.0" resolved "https://registry.npmjs.org/leaflet.locatecontrol/-/leaflet.locatecontrol-0.79.0.tgz"