import { SVGOverlay, type CrossOrigin, type ImageOverlayOptions, type LatLngBoundsExpression, } from 'leaflet'; import { bool, choice, json, num, positional, str, type PropDef, type Positional, } from '../core/props.ts'; import { getBounds } from '../core/shared-props.ts'; import { WithProps, type LeafletAddEventListener, type LeafletElementConstructor, type LeafletRemoveEventListener, } from '../core/with-props.ts'; import type { PathEvents } from '../core/event-types.ts'; const PROPS: { bounds: Positional; opacity: PropDef; interactive: PropDef; crossOrigin: PropDef; zIndex: PropDef; className: PropDef; } = { bounds: positional(json([], { get: getBounds })), opacity: num(1.0), interactive: bool(), crossOrigin: choice(''), zIndex: num(), className: str(), }; const Base: LeafletElementConstructor = WithProps(PROPS); export default class LeafletSVGOverlayElement extends Base { declare readonly leafletObject?: SVGOverlay; declare addEventListener: LeafletAddEventListener; declare removeEventListener: LeafletRemoveEventListener; createLeafletObject(options: ImageOverlayOptions): SVGOverlay { const svg = this.querySelector('svg') ?? document.createElementNS('http://www.w3.org/2000/svg', 'svg'); return new SVGOverlay(svg, this.bounds, options); } }