Skip to content

Commit b7d9864

Browse files
authored
Merge pull request #3 from webwriter-app/next
Version 2.1.0
2 parents 8705985 + e718ef6 commit b7d9864

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+8309
-144
lines changed

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Map (`@webwriter/map@2.1.0`)
2+
[License: MIT](LICENSE) | Version: 2.1.0
3+
4+
Geographical map with different terrain options including custom tiling, and GeoJSON support.
5+
6+
## Snippets
7+
[Snippets](https://webwriter.app/docs/snippets/snippets/) are examples and templates using the package's widgets.
8+
9+
| Name | Import Path |
10+
| :--: | :---------: |
11+
| Example Location | @webwriter/map/snippets/Example-Location.html |
12+
13+
14+
15+
## `WwMap` (`<webwriter-map>`)
16+
Geographical map with different terrain options including custom tiling, and GeoJSON support.
17+
18+
### Usage
19+
20+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
21+
```html
22+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/map/widgets/webwriter-map.css" rel="stylesheet">
23+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/map/widgets/webwriter-map.js"></script>
24+
<webwriter-map></webwriter-map>
25+
```
26+
27+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
28+
29+
```
30+
npm install @webwriter/map
31+
```
32+
33+
```html
34+
<link href="@webwriter/map/widgets/webwriter-map.css" rel="stylesheet">
35+
<script type="module" src="@webwriter/map/widgets/webwriter-map.js"></script>
36+
<webwriter-map></webwriter-map>
37+
```
38+
39+
## Fields
40+
| Name (Attribute Name) | Type | Description | Default | Reflects |
41+
| :-------------------: | :--: | :---------: | :-----: | :------: |
42+
| `localize` | - | - | `LOCALIZE` ||
43+
| `mapElement` | `HTMLElement` | - | - ||
44+
| `pinDialog` | `SlDialog` | - | - ||
45+
| `switchStudentPanning` | `SlSwitch` | - | - ||
46+
| `map` (`map`) | `L.Map \| undefined` | - | - ||
47+
| `initialPos` (`initialPos`) | `{ lat: number; lng: number; }` | Initial center position of the map.<br>Expected value: object { lat: number, lng: number } (e.g. { lat: 51, lng: 19 }).<br>Optional; when set via attribute, pass a JSON string (e.g. '{"lat":51,"lng":19}'). | `{ lat: 51, lng: 19, }` ||
48+
| `mapBounds` (`mapBounds`) | `L.LatLngBoundsExpression` | Maximum bounding box for panning the map.<br>Expected value: Leaflet LatLngBoundsExpression (e.g. [[northLat, westLng], [southLat, eastLng]]).<br>Optional; when set via attribute, pass a JSON string (e.g. '[[51,6],[50,7]]'). | - ||
49+
| `maxZoom` (`maxZoom`) | `number` | Maximum zoom level allowed when `boundsActive` is true.<br>Expected value: number (Leaflet zoom level).<br>Optional. | - ||
50+
| `minZoom` (`minZoom`) | `number` | Minimum zoom level allowed.<br>Expected value: number (Leaflet zoom level).<br>Optional. | - ||
51+
| `initialZoom` (`initialZoom`) | `number` | Initial zoom level when the map is created.<br>Expected value: number (Leaflet zoom level).<br>Optional. | `13` ||
52+
| `fixedZoom` (`fixedZoom`) | `number` | Fixed zoom level to enforce when panning is not allowed for viewers (non-edit contexts).<br>Expected value: number (Leaflet zoom level).<br>Optional. | `1` ||
53+
| `markers` (`markers`) | `array` | Static pin markers to display on the map.<br>Expected value: array of { lat: number, lng: number, title?: string }.<br>Optional; when set via attribute, pass a JSON string. | `[]` ||
54+
| `objects` (`objects`) | `object` | Persisted drawing objects (rectangles, circles, polygons, polylines), keyed by id.<br>Expected value: map id -> { id, type, latlngs, radius?, borderColor, fillColor, borderOpacity, fillOpacity, label? }.<br>Optional; when set via attribute, pass a JSON string. | `{}` ||
55+
| `customTileUrl` (`customTileUrl`) | `string` | Custom tile URL template to use for the base map layer.<br>Expected value: string URL template containing {z}/{x}/{y}.<br>Optional; when empty, the default base layer is used. | `''` ||
56+
| `geoJSON` (`geoJSON`) | `string` | GeoJSON overlay to render on the map.<br>Expected value: stringified GeoJSON (Feature or FeatureCollection).<br>Optional; when empty/falsy, no GeoJSON overlay is shown. | `''` ||
57+
| `mapWidth` (`mapWidth`) | `number` | Map container width, as a percentage of the host element's width.<br>Expected value: number (0–100). Applied as CSS width: `${mapWidth}%`.<br>Optional. | `100` ||
58+
| `mapHeight` (`mapHeight`) | `number` | Map container height in pixels.<br>Expected value: number (pixels). Applied as CSS height: `${mapHeight}px`.<br>Optional. | `500` ||
59+
| `boundsActive` (`boundsActive`) | `boolean` | Whether to enforce `mapBounds` and `maxZoom` constraints on the map.<br>Expected value: boolean; when true and `mapBounds` is set, panning is constrained to those bounds.<br>Optional. | `true` ||
60+
61+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
62+
63+
*No public methods, slots, events, custom CSS properties, CSS parts, or editing config.*
64+
65+
66+
---
67+
*Generated with @webwriter/build@1.6.0*

0 commit comments

Comments
 (0)