diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index 7e965f7..6e2f1ad 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -34,20 +34,6 @@ body:
placeholder: 'Instead, the following should happen: ...'
validations:
required: false
- - type: dropdown
- id: browser
- attributes:
- label: Browser
- options:
- - Firefox
- - Chrome
- - Opera
- - Safari
- - Edge
- - Other (please specify in additional context)
- multiple: true
- validations:
- required: true
- type: input
id: version
attributes:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index f4c8b08..07a4c20 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -17,10 +17,10 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
- name: Setup Node.js
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: '21'
diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml
index 1e44f9b..aff10a6 100644
--- a/.github/workflows/static.yml
+++ b/.github/workflows/static.yml
@@ -1,30 +1,21 @@
-# Simple workflow for deploying static content to GitHub Pages
-name: Deploy static content to Pages
+name: Deploy to Pages
on:
- # Runs on pushes targeting the default branch
- push:
- branches: ['release']
- paths:
- - 'examples/**'
+ release:
+ types: [created]
- # Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
-# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
-# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
-# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
- # Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
@@ -33,13 +24,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
+
- name: Setup Pages
uses: actions/configure-pages@v5
- - name: Upload artifact
+
+ - name: Upload artifacts
uses: actions/upload-pages-artifact@v3
with:
- # Upload entire repository
path: './examples'
+
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
diff --git a/.prettierrc.json b/.prettierrc.json
index d7a01a6..db516ae 100644
--- a/.prettierrc.json
+++ b/.prettierrc.json
@@ -3,5 +3,13 @@
"tabWidth": 2,
"singleQuote": true,
"printWidth": 80,
- "trailingComma": "es5"
+ "trailingComma": "es5",
+ "overrides": [
+ {
+ "files": "*.html",
+ "options": {
+ "printWidth": 120
+ }
+ }
+ ]
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f19a9e5..de47c3d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,19 @@
# Leaflet.SidePanel Changelog
+## v1.2.0 (2024-08-29)
+
+- feat: add typescript support
+- feat: new option `onToggle`
+- chore: improve docu
+- chore: change prettier scope
+- chore: ⚠️ BREAKING ⚠️ save map instance in panel
+ To update your code you have remove the map from `toggle`, `open` and `close` calls
+- chore: ⚠️ BREAKING ⚠️ rename startTab to defaultTab
+
## v1.1.0 (2024-08-25)
- feat: trigger toggle, open, close programmatically with js
-- feat: Add on tab switch event
+- feat: new option `onTabClick`
- fix: cannot toggle sidebar when hasTabs is false
- chore: Some change in docu, readme, ...
diff --git a/README.md b/README.md
index 0efd615..2e3c85c 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,11 @@
-![npm version](https://img.shields.io/npm/v/leaflet.sidepanel)
-![npm downloads](https://img.shields.io/npm/dt/leaflet.sidepanel)
-![npm license](https://img.shields.io/npm/l/leaflet.sidepanel)
+[![npm version](https://img.shields.io/npm/v/leaflet.sidepanel)](https://www.npmjs.com/package/leaflet.sidepanel)
+[![npm downloads](https://img.shields.io/npm/dt/leaflet.sidepanel)](https://www.npmjs.com/package/leaflet.sidepanel)
+[![npm license](https://img.shields.io/npm/l/leaflet.sidepanel)](https://github.com/cyclingbyte/leaflet.sidepanel?tab=MIT-1-ov-file#readme)
![last commit](https://img.shields.io/github/last-commit/cyclingbyte/Leaflet.SidePanel)
-![issues open](https://img.shields.io/github/issues/cyclingbyte/Leaflet.SidePanel)![issues closed](https://img.shields.io/github/issues-closed/cyclingbyte/Leaflet.SidePanel?label=)
+[![npm dependents](https://img.shields.io/librariesio/dependents/npm/leaflet.sidepanel)](https://www.npmjs.com/package/leaflet.sidepanel?activeTab=dependents)
+
-
+
# Leaflet.SidePanel
@@ -13,47 +14,51 @@ Slide side panel plugin for [Leaflet](https://leafletjs.com/ 'Leaflet Homepage')
This repository is a copy of [maxwell-ilai/Leaflet.SidePanel](https://github.com/maxwell-ilai/Leaflet.SidePanel 'Leaflet.SidePanel by maxwell-ilai')
-## Installation
+## Demo
+
+You can find a demo [here](https://cyclingbyte.github.io/Leaflet.SidePanel/ 'Demo for Leaflet.SidePanel')
-### NPM
+## Prerequirements
+
+- [leaflet](https://github.com/Leaflet/Leaflet) (v1.0.0 or higher)
+ (Tested with 1.8.0)
+
+## Installation
```sh
-npm i Leaflet.SidePanel
-```
+# NPM
+npm i leaflet.sidepanel
+
+# yarn
+yarn add leaflet.sidepanel
-### Browser | HTML
+# pnpm
+pnpm i leaflet.sidepanel
+```
-Include the script and css in your html file
+Or include the script and css in your html file
```html
-
+
```
-## Requirements
-
-- [leaflet](https://github.com/Leaflet/Leaflet) (v1.0.0 or higher)
- (Tested with 1.8.0)
-
## Options
- panelPosition: _'left' (default)_ | 'right' [string]
- hasTabs: _true (default)_ | false [boolean]
- tabsPosition: _'top' (default)_ | 'right' | 'bottom' | 'left' [string]
- darkMode: true | _false (default)_ [boolean]
-- pushControls: true | _false (default)_ [boolean]
-- startTab: _1 (default)_ [number | string]
+- pushControls: true | _false (default)_ [boolean]
+ Shifts the map controls (like zoom) when the side panels open, to keep them visible and usabe
+- defaultTab: _1 (default)_ [number | string]
-## Demo
+## Usage
-You can find a demo [here](https://cyclingbyte.github.io/Leaflet.SidePanel/ 'Demo for Leaflet.SidePanel')
-
-## Example
-
-**_Javascript_**
+### Javascript
```javascript
import L from 'leaflet';
@@ -67,12 +72,12 @@ const panelRight = L.control
tabsPosition: 'top',
pushControls: true,
darkMode: true,
- startTab: 'tab-5',
+ defaultTab: 'tab-5',
})
.addTo(map);
```
-**_Html_**
+### Html
```html
- Nam nec lacinia purus, in accumsan arcu. Aenean at maximus - tortor, eget porttitor leo. Fusce justo lorem, dictum nec - rutrum sed, mattis faucibus diam. Lorem ipsum dolor sit amet, - consectetur adipiscing elit. Phasellus ullamcorper ex sagittis - lacus gravida interdum quis sit amet justo. Nunc posuere massa - et feugiat efficitur. Donec est magna, lobortis sit amet - ligula ut, vehicula posuere diam. Suspendisse aliquet blandit - velit, consectetur scelerisque libero porttitor eu. Praesent - faucibus dignissim maximus. Vestibulum porta eu tellus sit - amet ultricies. Integer aliquet vestibulum massa, in interdum - arcu commodo ac. Curabitur sit amet cursus ipsum. Donec ut - diam orci. Fusce odio diam, laoreet non elit sed, suscipit - mollis leo. Fusce non turpis faucibus, placerat sapien quis, - varius ligula. Praesent ac magna id tortor ultricies ultricies - quis nec quam. -
-- Etiam varius in neque a tristique. Maecenas euismod pharetra - scelerisque. Nam in pretium nulla, vel blandit risus. Duis - posuere egestas nisi, vitae iaculis tortor varius eget. Morbi - molestie sem in varius vulputate. Cras enim sapien, malesuada - id nisi eu, volutpat congue leo. Praesent aliquet ipsum id - lectus consequat rutrum. In vitae dolor pellentesque dolor - scelerisque condimentum eget at ligula. Integer vel turpis - eros. Cras at hendrerit mauris. Aliquam erat volutpat. Quisque - vehicula pharetra mauris, nec finibus augue posuere ut. Etiam - condimentum lacus at purus luctus finibus. -
-- Nam nec lacinia purus, in accumsan arcu. Aenean at maximus - tortor, eget porttitor leo. Fusce justo lorem, dictum nec - rutrum sed, mattis faucibus diam. Lorem ipsum dolor sit amet, - consectetur adipiscing elit. Phasellus ullamcorper ex sagittis - lacus gravida interdum quis sit amet justo. Nunc posuere massa - et feugiat efficitur. Donec est magna, lobortis sit amet - ligula ut, vehicula posuere diam. Suspendisse aliquet blandit - velit, consectetur scelerisque libero porttitor eu. Praesent - faucibus dignissim maximus. Vestibulum porta eu tellus sit - amet ultricies. Integer aliquet vestibulum massa, in interdum - arcu commodo ac. Curabitur sit amet cursus ipsum. Donec ut - diam orci. Fusce odio diam, laoreet non elit sed, suscipit - mollis leo. Fusce non turpis faucibus, placerat sapien quis, - varius ligula. Praesent ac magna id tortor ultricies ultricies - quis nec quam. -
-- Etiam varius in neque a tristique. Maecenas euismod pharetra - scelerisque. Nam in pretium nulla, vel blandit risus. Duis - posuere egestas nisi, vitae iaculis tortor varius eget. Morbi - molestie sem in varius vulputate. Cras enim sapien, malesuada - id nisi eu, volutpat congue leo. Praesent aliquet ipsum id - lectus consequat rutrum. In vitae dolor pellentesque dolor - scelerisque condimentum eget at ligula. Integer vel turpis - eros. Cras at hendrerit mauris. Aliquam erat volutpat. Quisque - vehicula pharetra mauris, nec finibus augue posuere ut. Etiam - condimentum lacus at purus luctus finibus. -
-- Nam nec lacinia purus, in accumsan arcu. Aenean at maximus - tortor, eget porttitor leo. Fusce justo lorem, dictum nec - rutrum sed, mattis faucibus diam. Lorem ipsum dolor sit amet, - consectetur adipiscing elit. Phasellus ullamcorper ex sagittis - lacus gravida interdum quis sit amet justo. Nunc posuere massa - et feugiat efficitur. Donec est magna, lobortis sit amet - ligula ut, vehicula posuere diam. Suspendisse aliquet blandit - velit, consectetur scelerisque libero porttitor eu. Praesent - faucibus dignissim maximus. Vestibulum porta eu tellus sit - amet ultricies. Integer aliquet vestibulum massa, in interdum - arcu commodo ac. Curabitur sit amet cursus ipsum. Donec ut - diam orci. Fusce odio diam, laoreet non elit sed, suscipit - mollis leo. Fusce non turpis faucibus, placerat sapien quis, - varius ligula. Praesent ac magna id tortor ultricies ultricies - quis nec quam. -
-- Etiam varius in neque a tristique. Maecenas euismod pharetra - scelerisque. Nam in pretium nulla, vel blandit risus. Duis - posuere egestas nisi, vitae iaculis tortor varius eget. Morbi - molestie sem in varius vulputate. Cras enim sapien, malesuada - id nisi eu, volutpat congue leo. Praesent aliquet ipsum id - lectus consequat rutrum. In vitae dolor pellentesque dolor - scelerisque condimentum eget at ligula. Integer vel turpis - eros. Cras at hendrerit mauris. Aliquam erat volutpat. Quisque - vehicula pharetra mauris, nec finibus augue posuere ut. Etiam - condimentum lacus at purus luctus finibus. -
-+ Nam nec lacinia purus, in accumsan arcu. Aenean at maximus tortor, eget porttitor leo. Fusce justo + lorem, dictum nec rutrum sed, mattis faucibus diam. Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Phasellus ullamcorper ex sagittis lacus gravida interdum quis sit amet justo. Nunc posuere massa + et feugiat efficitur. Donec est magna, lobortis sit amet ligula ut, vehicula posuere diam. Suspendisse + aliquet blandit velit, consectetur scelerisque libero porttitor eu. Praesent faucibus dignissim maximus. + Vestibulum porta eu tellus sit amet ultricies. Integer aliquet vestibulum massa, in interdum arcu + commodo ac. Curabitur sit amet cursus ipsum. Donec ut diam orci. Fusce odio diam, laoreet non elit sed, + suscipit mollis leo. Fusce non turpis faucibus, placerat sapien quis, varius ligula. Praesent ac magna + id tortor ultricies ultricies quis nec quam. +
++ Etiam varius in neque a tristique. Maecenas euismod pharetra scelerisque. Nam in pretium nulla, vel + blandit risus. Duis posuere egestas nisi, vitae iaculis tortor varius eget. Morbi molestie sem in varius + vulputate. Cras enim sapien, malesuada id nisi eu, volutpat congue leo. Praesent aliquet ipsum id lectus + consequat rutrum. In vitae dolor pellentesque dolor scelerisque condimentum eget at ligula. Integer vel + turpis eros. Cras at hendrerit mauris. Aliquam erat volutpat. Quisque vehicula pharetra mauris, nec + finibus augue posuere ut. Etiam condimentum lacus at purus luctus finibus. +