You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
3.5 KiB

{"ast":null,"code":"import { useEffect } from 'react';\nimport { useAttribution } from './attribution.js';\nimport { useLeafletContext } from './context.js';\nimport { useEventHandlers } from './events.js';\nimport { withPane } from './pane.js';\nexport function useLayerLifecycle(element, context) {\n useEffect(function addLayer() {\n const container = context.layerContainer ?? context.map;\n container.addLayer(element.instance);\n return function removeLayer() {\n context.layerContainer?.removeLayer(element.instance);\n context.map.removeLayer(element.instance);\n };\n }, [context, element]);\n}\nexport function createLayerHook(useElement) {\n return function useLayer(props) {\n const context = useLeafletContext();\n const elementRef = useElement(withPane(props, context), context);\n useAttribution(context.map, props.attribution);\n useEventHandlers(elementRef.current, props.eventHandlers);\n useLayerLifecycle(elementRef.current, context);\n return elementRef;\n };\n}","map":{"version":3,"names":["useEffect","useAttribution","useLeafletContext","useEventHandlers","withPane","useLayerLifecycle","element","context","addLayer","container","layerContainer","map","instance","removeLayer","createLayerHook","useElement","useLayer","props","elementRef","attribution","current","eventHandlers"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/@react-leaflet/core/lib/layer.js"],"sourcesContent":["import { useEffect } from 'react';\nimport { useAttribution } from './attribution.js';\nimport { useLeafletContext } from './context.js';\nimport { useEventHandlers } from './events.js';\nimport { withPane } from './pane.js';\nexport function useLayerLifecycle(element, context) {\n useEffect(function addLayer() {\n const container = context.layerContainer ?? context.map;\n container.addLayer(element.instance);\n return function removeLayer() {\n context.layerContainer?.removeLayer(element.instance);\n context.map.removeLayer(element.instance);\n };\n }, [\n context,\n element\n ]);\n}\nexport function createLayerHook(useElement) {\n return function useLayer(props) {\n const context = useLeafletContext();\n const elementRef = useElement(withPane(props, context), context);\n useAttribution(context.map, props.attribution);\n useEventHandlers(elementRef.current, props.eventHandlers);\n useLayerLifecycle(elementRef.current, context);\n return elementRef;\n };\n}\n"],"mappings":"AAAA,SAASA,SAAT,QAA0B,OAA1B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,iBAAT,QAAkC,cAAlC;AACA,SAASC,gBAAT,QAAiC,aAAjC;AACA,SAASC,QAAT,QAAyB,WAAzB;AACA,OAAO,SAASC,iBAAT,CAA2BC,OAA3B,EAAoCC,OAApC,EAA6C;EAChDP,SAAS,CAAC,SAASQ,QAAT,GAAoB;IAC1B,MAAMC,SAAS,GAAGF,OAAO,CAACG,cAAR,IAA0BH,OAAO,CAACI,GAApD;IACAF,SAAS,CAACD,QAAV,CAAmBF,OAAO,CAACM,QAA3B;IACA,OAAO,SAASC,WAAT,GAAuB;MAC1BN,OAAO,CAACG,cAAR,EAAwBG,WAAxB,CAAoCP,OAAO,CAACM,QAA5C;MACAL,OAAO,CAACI,GAAR,CAAYE,WAAZ,CAAwBP,OAAO,CAACM,QAAhC;IACH,CAHD;EAIH,CAPQ,EAON,CACCL,OADD,EAECD,OAFD,CAPM,CAAT;AAWH;AACD,OAAO,SAASQ,eAAT,CAAyBC,UAAzB,EAAqC;EACxC,OAAO,SAASC,QAAT,CAAkBC,KAAlB,EAAyB;IAC5B,MAAMV,OAAO,GAAGL,iBAAiB,EAAjC;IACA,MAAMgB,UAAU,GAAGH,UAAU,CAACX,QAAQ,CAACa,KAAD,EAAQV,OAAR,CAAT,EAA2BA,OAA3B,CAA7B;IACAN,cAAc,CAACM,OAAO,CAACI,GAAT,EAAcM,KAAK,CAACE,WAApB,CAAd;IACAhB,gBAAgB,CAACe,UAAU,CAACE,OAAZ,EAAqBH,KAAK,CAACI,aAA3B,CAAhB;IACAhB,iBAAiB,CAACa,UAAU,CAACE,OAAZ,EAAqBb,OAArB,CAAjB;IACA,OAAOW,UAAP;EACH,CAPD;AAQH"},"metadata":{},"sourceType":"module"}