4 Commits (08558515043f6e82673ed0d3129fadd6c3fa9ceb)

Author SHA1 Message Date
Buddy 0855851504 docs: document leaflet-control-layers component and active attribute 3 months ago
Buddy f85e67547d refactor: use events for control-layers layer add/remove instead of DOM traversal
Replace the #map getter (which used closest("leaflet-map") + leafletObject)
with two new custom events: leaflet-add-layer and leaflet-remove-layer.
The map listens for them and delegates to map.addLayer/removeLayer.

This removes the coupling between leaflet-control-layers and the map
element, aligning with the existing leaflet-register event protocol.
3 months ago
Buddy eba6b2e6ad refactor: use type="base" instead of slot="base" for control-layers
slot is a reserved HTML global attribute with shadow-DOM semantics;
using it was misleading even though it happened to work. Switch to
type="base" / type="overlay", which is conventional and carries no
side effects.
3 months ago
Buddy e45162b0be feat: add leaflet-control-layers component
New <leaflet-control-layers> wraps Control.Layers. Children with
slot="base" or slot="overlay" and a name attribute are automatically
registered as base layers or overlays. The control intercepts child
leaflet-register events and stops propagation so layers are managed
by the layers control rather than added directly to the map.

Unchecked layers that connected before the control are removed from
the map before the control initialises, so Control.Layers._addItem
correctly reflects the unchecked state on first render.
3 months ago