This commit is contained in:
2025-09-11 07:45:25 -07:00
parent ca8798848e
commit 955946e79d
2873 changed files with 299107 additions and 183282 deletions

28
node_modules/@react-leaflet/core/lib/path.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import { useEffect, useRef } from 'react';
import { useLeafletContext } from './context.js';
import { useEventHandlers } from './events.js';
import { useLayerLifecycle } from './layer.js';
import { withPane } from './pane.js';
export function usePathOptions(element, props) {
const optionsRef = useRef();
useEffect(function updatePathOptions() {
if (props.pathOptions !== optionsRef.current) {
const options = props.pathOptions ?? {};
element.instance.setStyle(options);
optionsRef.current = options;
}
}, [
element,
props
]);
}
export function createPathHook(useElement) {
return function usePath(props) {
const context = useLeafletContext();
const elementRef = useElement(withPane(props, context), context);
useEventHandlers(elementRef.current, props.eventHandlers);
useLayerLifecycle(elementRef.current, context);
usePathOptions(elementRef.current, props);
return elementRef;
};
}