This commit is contained in:
2025-09-12 07:32:32 -07:00
parent 4d5fca6a5e
commit 49208df277
2978 changed files with 421237 additions and 394 deletions

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

@@ -0,0 +1,34 @@
import { useEffect, useRef } from 'react';
export function createElementObject(instance, context, container) {
return Object.freeze({
instance,
context,
container
});
}
export function createElementHook(createElement, updateElement) {
if (updateElement == null) {
return function useImmutableLeafletElement(props, context) {
const elementRef = useRef();
if (!elementRef.current) elementRef.current = createElement(props, context);
return elementRef;
};
}
return function useMutableLeafletElement(props, context) {
const elementRef = useRef();
if (!elementRef.current) elementRef.current = createElement(props, context);
const propsRef = useRef(props);
const { instance } = elementRef.current;
useEffect(function updateElementProps() {
if (propsRef.current !== props) {
updateElement(instance, props, propsRef.current);
propsRef.current = props;
}
}, [
instance,
props,
context
]);
return elementRef;
};
}