docs: add full attribute tables for all components

Replace the brief 'Other components' section with complete per-component
attribute tables including defaults and descriptions. Add CSS/resize docs
for leaflet-map and a shared path-style reference table.
main
Buddy 4 months ago
parent 2c2e83b7d0
commit fcfcdbfb7a

@ -147,63 +147,248 @@ el.scrollWheelZoom = false; // disable at runtime
All `leaflet-map` properties are two-way: reading returns the live map value; writing updates both the attribute and the map. All `leaflet-map` properties are two-way: reading returns the live map value; writing updates both the attribute and the map.
### CSS
Leaflet's stylesheet is loaded from a CDN via a `<link>` in the shadow DOM. Marker icon paths are derived from the CSS URL automatically.
| Attribute | Default | Description |
|---|---|---|
| `css-url` | `https://unpkg.com/leaflet@1.9.4/dist/leaflet.css` | URL for Leaflet CSS |
| `css-integrity` | `sha256-...` | SRI hash (required with default URL; when `css-url` is custom, no default integrity is used unless explicitly set) |
| `css-crossorigin` | _(auto)_ | `"anonymous"` when integrity is active, otherwise absent. Set explicitly to override. |
### Resize
A `ResizeObserver` on the host element automatically calls `map.invalidateSize()` whenever the element's dimensions change — from CSS classes, inline styles, attribute changes, or parent layout.
--- ---
## Other components ## Components
### Tile layers ### `<leaflet-tile-layer>`
| Element | Key attributes | | Attribute | Default | Description |
|---|---| |---|---|---|
| `leaflet-tile-layer` | `url`, `attribution`, `min-zoom`, `max-zoom`, `opacity`, `z-index` | | `url` | `''` | Tile URL template (`https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`) |
| `leaflet-tile-layer-wms` | `url`, `layers`, `styles`, `format`, `transparent`, `version` | | `attribution` | `''` | Attribution text |
| `min-zoom` | `0` | Minimum zoom level |
| `max-zoom` | `18` | Maximum zoom level |
| `opacity` | `1.0` | Tile layer opacity |
| `z-index` | `0` | Z-index |
### Vector layers ### `<leaflet-tile-layer-wms>`
Path style attributes (`color`, `weight`, `opacity`, `fill`, `fill-color`, `fill-opacity`, `dash-array`, `line-cap`, `line-join`) are shared by all vector layers. | Attribute | Default | Description |
|---|---|---|
| `url` | `''` | WMS service URL |
| `layers` | `''` | Comma-separated layer names |
| `styles` | `''` | Comma-separated style names |
| `format` | `'image/jpeg'` | Image format |
| `transparent` | — | Request transparent tiles |
| `version` | `'1.1.1'` | WMS version |
| `uppercase` | — | Use uppercase WMS parameter names |
### `<leaflet-marker>`
| Element | Additional attributes | Notes | | Attribute | Default | Description |
|---|---|---| |---|---|---|
| `leaflet-circle` | `lat`, `lng`, `radius` (meters) | | | `lat` | `0` | Latitude |
| `leaflet-circle-marker` | `lat`, `lng`, `radius` (pixels) | | | `lng` | `0` | Longitude |
| `leaflet-polyline` | — | Vertices via `<leaflet-line>` children | | `title` | `''` | Tooltip text on hover |
| `leaflet-polygon` | — | Vertices via `<leaflet-line>` children | | `alt` | `''` | Alt text for the marker image |
| `leaflet-rectangle` | `bounds` (JSON) | | | `draggable` | — | Allow dragging the marker |
| `leaflet-line` | `lat`, `lng` | Vertex only — not rendered directly | | `opacity` | `1.0` | Marker opacity |
| `z-index-offset` | `0` | Z-index offset |
### Markers & overlays ### `<leaflet-circle>`
| Element | Key attributes | All [path style](#path-style) attributes apply.
|---|---|
| `leaflet-marker` | `lat`, `lng`, `title`, `alt`, `draggable`, `opacity`, `z-index-offset` |
| `leaflet-image-overlay` | `url`, `bounds` (JSON), `opacity`, `alt`, `interactive` |
| `leaflet-video-overlay` | `url`, `bounds` (JSON), `opacity`, `loop`, `autoplay`, `muted` |
| `leaflet-svg-overlay` | `bounds` (JSON), `opacity`, `interactive` — wrap an `<svg>` element |
### Groups & GeoJSON | Attribute | Default | Description |
|---|---|---|
| `lat` | `0` | Center latitude |
| `lng` | `0` | Center longitude |
| `radius` | `1000` | Radius in meters |
| Element | Key attributes | ### `<leaflet-circle-marker>`
|---|---|
| `leaflet-layer-group` | — |
| `leaflet-feature-group` | — |
| `leaflet-geojson` | `data` (GeoJSON string), plus path style attributes |
### UI layers All [path style](#path-style) attributes apply.
Content is set via `innerHTML`, not attributes. | Attribute | Default | Description |
|---|---|---|
| `lat` | `0` | Center latitude |
| `lng` | `0` | Center longitude |
| `radius` | `10` | Radius in pixels |
| Element | Key attributes | ### `<leaflet-polyline>`
|---|---|
| `leaflet-popup` | `lat`, `lng`, `max-width`, `min-width`, `auto-pan`, `close-button`, `auto-close` |
| `leaflet-tooltip` | `lat`, `lng`, `direction`, `permanent`, `sticky`, `opacity` |
### Controls Coordinates are taken from child `<leaflet-line>` elements, not from attributes. All [path style](#path-style) attributes apply (excluding `fill*` — polylines don't fill).
| Element | Key attributes | | Attribute | Default | Description |
|---|---| |---|---|---|
| `leaflet-control-zoom` | `position`, `zoom-in-text`, `zoom-out-text` | | `color` | `'#3388ff'` | Stroke color |
| `leaflet-control-attribution` | `position`, `prefix` | | `weight` | `3` | Stroke width (px) |
| `leaflet-control-scale` | `position`, `max-width`, `metric`, `imperial` | | `opacity` | `1.0` | Stroke opacity |
### `<leaflet-polygon>`
Coordinates are taken from child `<leaflet-line>` elements, not from attributes. All [path style](#path-style) attributes apply.
### `<leaflet-rectangle>`
All [path style](#path-style) attributes apply.
| Attribute | Default | Description |
|---|---|---|
| `bounds` | `''` | Bounding box as JSON: `[[south,west],[north,east]]` |
### `<leaflet-line>`
Vertex helper — not rendered directly. Used as a child of `<leaflet-polyline>` or `<leaflet-polygon>`.
| Attribute | Default | Description |
|---|---|---|
| `lat` | `0` | Latitude |
| `lng` | `0` | Longitude |
### `<leaflet-image-overlay>`
| Attribute | Default | Description |
|---|---|---|
| `url` | `''` | Image URL |
| `bounds` | `''` | Bounding box as JSON: `[[south,west],[north,east]]` |
| `opacity` | `1.0` | Overlay opacity |
| `alt` | `''` | Alt text |
| `interactive` | — | Receive mouse/touch events |
| `cross-origin` | `''` | CORS setting for the image |
| `error-overlay-url` | `''` | Fallback image on load error |
| `z-index` | `0` | Z-index |
| `class-name` | `''` | CSS class for the image element |
### `<leaflet-video-overlay>`
| Attribute | Default | Description |
|---|---|---|
| `url` | `''` | Video URL |
| `bounds` | `''` | Bounding box as JSON: `[[south,west],[north,east]]` |
| `opacity` | `1.0` | Overlay opacity |
| `alt` | `''` | Alt text |
| `interactive` | — | Receive mouse/touch events |
| `cross-origin` | `''` | CORS setting for the video |
| `loop` | — | Loop playback |
| `autoplay` | — | Start playing automatically |
| `muted` | — | Mute audio |
| `playsinline` | — | Play inline (mobile) |
### `<leaflet-svg-overlay>`
Content comes from an inline `<svg>` child element. No `url` attribute.
| Attribute | Default | Description |
|---|---|---|
| `bounds` | `''` | Bounding box as JSON: `[[south,west],[north,east]]` |
| `opacity` | `1.0` | Overlay opacity |
| `interactive` | — | Receive mouse/touch events |
| `cross-origin` | `''` | CORS setting |
| `z-index` | `0` | Z-index |
| `class-name` | `''` | CSS class for the SVG element |
### `<leaflet-layer-group>`
Passthrough container. No attributes. Accepts layers, popups, and tooltips as children.
### `<leaflet-feature-group>`
Passthrough container with Leaflet's `FeatureGroup` (supports `getBounds()`, style propagation, etc.). No attributes. Accepts layers, popups, and tooltips as children.
### `<leaflet-geojson>`
All [path style](#path-style) attributes apply.
| Attribute | Default | Description |
|---|---|---|
| `data` | `''` | GeoJSON string |
| `stroke` | `''` | Stroke color (overrides `color`) |
| `line-cap` | `'round'` | Line cap style |
| `line-join` | `'round'` | Line join style |
| `dash-array` | `''` | Dash pattern |
| `dash-offset` | `''` | Dash offset |
| `fill-rule` | `'evenodd'` | Fill rule |
### `<leaflet-popup>`
Content comes from `innerHTML`, not an attribute. Mutations to innerHTML sync automatically via a `MutationObserver`.
| Attribute | Default | Description |
|---|---|---|
| `lat` | `0` | Latitude (omit to auto-attach to the parent layer's position) |
| `lng` | `0` | Longitude |
| `max-width` | `300` | Maximum width (px) |
| `min-width` | `50` | Minimum width (px) |
| `max-height` | `0` | Maximum height (px; `0` = unlimited) |
| `auto-pan` | — | Automatically pan the map to keep the popup visible |
| `close-button` | — | Show a close button |
| `auto-close` | — | Close the popup when another popup is opened |
### `<leaflet-tooltip>`
Content comes from `innerHTML`, not an attribute.
| Attribute | Default | Description |
|---|---|---|
| `lat` | `0` | Latitude (omit to auto-attach to the parent layer's position) |
| `lng` | `0` | Longitude |
| `pane` | — | Map pane name |
| `offset` | — | Pixel offset as JSON: `[x, y]` |
| `direction` | `'auto'` | Direction: `'right'`, `'left'`, `'top'`, `'bottom'`, `'center'`, `'auto'` |
| `permanent` | — | Always visible (no hover required) |
| `sticky` | — | Follow the mouse |
| `opacity` | `1.0` | Tooltip opacity |
### `<leaflet-control-zoom>`
| Attribute | Default | Description |
|---|---|---|
| `position` | `'topleft'` | Corner position |
| `zoom-in-text` | `'+'` | Zoom-in button label |
| `zoom-in-title` | `'Zoom in'` | Zoom-in button tooltip |
| `zoom-out-text` | `'-'` | Zoom-out button label |
| `zoom-out-title` | `'Zoom out'` | Zoom-out button tooltip |
### `<leaflet-control-attribution>`
| Attribute | Default | Description |
|---|---|---|
| `position` | `'bottomright'` | Corner position |
| `prefix` | `''` | Text before the attribution |
### `<leaflet-control-scale>`
| Attribute | Default | Description |
|---|---|---|
| `position` | `'bottomleft'` | Corner position |
| `max-width` | `100` | Maximum width of the scale (px) |
| `metric` | — | Show metric scale (m/km) |
| `imperial` | — | Show imperial scale (mi/ft) |
| `update-when-idle` | — | Update only when the map stops moving |
## Path style
The following attributes apply to `<leaflet-circle>`, `<leaflet-circle-marker>`, `<leaflet-polyline>`, `<leaflet-polygon>`, `<leaflet-rectangle>`, and `<leaflet-geojson>`.
| Attribute | Default | Description |
|---|---|---|
| `color` | `'#3388ff'` | Stroke color |
| `weight` | `3` | Stroke width (px) |
| `opacity` | `1.0` | Stroke opacity |
| `line-cap` | `'round'` | Line cap: `'butt'`, `'round'`, `'square'` |
| `line-join` | `'round'` | Line join: `'miter'`, `'round'`, `'bevel'` |
| `dash-array` | `''` | Dash pattern, e.g. `'5, 10'` |
| `dash-offset` | `''` | Dash offset |
| `fill` | — | Enable fill |
| `fill-color` | `'#3388ff'` | Fill color |
| `fill-opacity` | `0.2` | Fill opacity |
| `fill-rule` | `'evenodd'` | Fill rule: `'nonzero'`, `'evenodd'` |
## Nesting rules ## Nesting rules

Loading…
Cancel
Save