├── .browserslistrc
├── .commitlintrc.json
├── .eslintrc.js
├── .github
├── dependabot.yml
└── workflows
│ ├── main.yml
│ └── release.yml
├── .gitignore
├── .husky
├── commit-msg
└── pre-commit
├── .npmignore
├── .nvmrc
├── .prettierignore
├── .prettierrc.json
├── .releaserc.json
├── LICENSE
├── README.md
├── changelog.md
├── examples
├── README.md
├── list-storage
│ ├── .gitignore
│ ├── index.html
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ └── vite.svg
│ ├── src
│ │ ├── main.ts
│ │ ├── style.css
│ │ └── vite-env.d.ts
│ └── tsconfig.json
├── map-layers-and-control
│ ├── .gitignore
│ ├── index.html
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ └── vite.svg
│ ├── src
│ │ ├── main.ts
│ │ ├── storageLayer.ts
│ │ ├── style.css
│ │ └── vite-env.d.ts
│ └── tsconfig.json
└── map-wmts
│ ├── .gitignore
│ ├── index.html
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ └── vite.svg
│ ├── src
│ ├── main.ts
│ ├── style.css
│ └── vite-env.d.ts
│ └── tsconfig.json
├── karma.conf.ts
├── package-lock.json
├── package.json
├── rollup.config.mjs
├── src
├── ControlSaveTiles.ts
├── TileLayerOffline.ts
├── TileManager.ts
├── images
│ └── save.png
└── index.ts
├── test
├── ControlSaveTilesTest.ts
├── TileLayerTest.ts
└── TileManagerTest.ts
├── tmp
└── .gitkeep
└── tsconfig.json
/.browserslistrc:
--------------------------------------------------------------------------------
1 | defaults
2 | not dead
3 | not ie 11
--------------------------------------------------------------------------------
/.commitlintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["@commitlint/config-conventional"]
3 | }
4 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | ignorePatterns: ['/dist'],
3 | env: {
4 | browser: true,
5 | },
6 | extends: ['airbnb-base', 'prettier'],
7 | parserOptions: {
8 | project: './tsconfig.json',
9 | },
10 | overrides: [
11 | {
12 | files: ['src/**/*.ts', 'test/**/*.ts'],
13 | extends: ['airbnb-base', 'airbnb-typescript/base', 'prettier'],
14 | rules: {
15 | 'import/no-extraneous-dependencies': [
16 | 'error',
17 | {
18 | devDependencies: true,
19 | optionalDependencies: false,
20 | peerDependencies: false,
21 | },
22 | ],
23 | 'no-underscore-dangle': 0,
24 | 'no-return-assign': ['error', 'except-parens'],
25 | },
26 | },
27 | ],
28 | };
29 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: 'npm'
4 | directory: '/'
5 | schedule:
6 | interval: 'monthly'
7 | target-branch: 'main'
8 | versioning-strategy: increase-if-necessary
9 | allow:
10 | # Allow both direct and indirect updates for all packages
11 | - dependency-type: "direct"
12 | commit-message:
13 | prefix: fix
14 | prefix-development: chore
15 | include: scope
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 | on:
3 | pull_request: ~
4 | push:
5 | branches:
6 | - main
7 | jobs:
8 | run:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - name: Check out repository
12 | uses: actions/checkout@v3
13 |
14 | - name: Set up Node
15 | uses: actions/setup-node@v3
16 | with:
17 | node-version: 20
18 | check-latest: true
19 |
20 | - name: Cache dependencies
21 | id: cache-dependencies
22 | uses: actions/cache@v3
23 | with:
24 | path: node_modules
25 | key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
26 |
27 | - name: Install dependencies
28 | if: steps.cache-dependencies.outputs.cache-hit != 'true'
29 | run: npm ci
30 |
31 | - name: Build project
32 | run: npm run build
33 |
34 | - name: lint
35 | run: npm run lint
36 |
37 | - name: test
38 | run: npm run test
39 |
40 | - name: Upload coverage reports to Codecov
41 | uses: codecov/codecov-action@v4.0.1
42 | with:
43 | token: ${{ secrets.CODECOV_TOKEN }}
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Release
2 |
3 | on: workflow_dispatch
4 | permissions:
5 | contents: read # for checkout
6 |
7 | jobs:
8 | release:
9 | name: Release
10 | runs-on: ubuntu-latest
11 |
12 | permissions:
13 | contents: write # to be able to publish a GitHub release
14 | issues: write # to be able to comment on released issues
15 | pull-requests: write # to be able to comment on released pull requests
16 | id-token: write # to enable use of OIDC for npm provenance
17 |
18 | steps:
19 | - name: Checkout Code
20 | uses: actions/checkout@v2
21 |
22 | - name: Setup Node.js
23 | uses: actions/setup-node@v2
24 | with:
25 | node-version: 20
26 |
27 | - name: Install Dependencies
28 | run: npm ci
29 |
30 | - name: Build
31 | run: npm run build
32 |
33 | - name: Pack
34 | run: npm pack
35 |
36 |
37 | - name: Semantic Release
38 | env:
39 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
41 | run: npx semantic-release
42 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /nbproject
2 | /bower_components
3 | node_modules
4 | /dist
5 | npm-debug.log
6 | .eslintcache
7 | /.vscode
8 | /tmp/**
9 | !/tmp/.gitkeep
10 | coverage
11 |
--------------------------------------------------------------------------------
/.husky/commit-msg:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | . "$(dirname "$0")/_/husky.sh"
3 |
4 | npx --no-install commitlint --edit $1
5 |
--------------------------------------------------------------------------------
/.husky/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | . "$(dirname "$0")/_/husky.sh"
3 |
4 | npx lint-staged
5 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | /nbproject
2 | /bower_components
3 | node_modules
4 | npm-debug.log
5 | docs
6 | .vscode
7 | .eslintcache
8 | tmp
9 |
--------------------------------------------------------------------------------
/.nvmrc:
--------------------------------------------------------------------------------
1 | lts/iron
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | dist
2 | node_modules
--------------------------------------------------------------------------------
/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true
3 | }
4 |
--------------------------------------------------------------------------------
/.releaserc.json:
--------------------------------------------------------------------------------
1 | {
2 | "branches": ["master"],
3 | "plugins": [
4 | "@semantic-release/commit-analyzer",
5 | "@semantic-release/release-notes-generator",
6 | [
7 | "@semantic-release/github",
8 | {
9 | "assets": ["leaflet.offline*.tgz"]
10 | }
11 | ],
12 | "@semantic-release/npm"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # leaflet.offline
2 |
3 | [](https://badge.fury.io/js/leaflet.offline)
4 | [](https://codecov.io/github/allartk/leaflet.offline)
5 | [](https://travis-ci.org/allartk/leaflet.offline)
6 |
7 | This library can be used to create maps, which are still available when you are offline and are fast when your connection is not. It works in the browser or can be used in an mobile app based on html and in progressive webapps.
8 |
9 | - [examples](https://github.com/allartk/leaflet.offline/tree/main/examples)
10 |
11 | ## Dependencies
12 |
13 | - [Leafletjs](http://leafletjs.com/)
14 | - [idb](https://www.npmjs.com/package/idb) To store the tiles with promises
15 |
16 | ## Install
17 |
18 | ### With npm
19 |
20 | The package and it's dependencies can also be downloaded into
21 | your existing project with [npm](http://npmjs.com):
22 |
23 | ```
24 | npm install leaflet.offline
25 | ```
26 |
27 | In your script add:
28 |
29 | ```
30 | import 'leaflet.offline'
31 | ```
32 |
33 | ### Manual
34 |
35 | Unpack the file for the release (find them under the releasestab ) and add dist/bundle.js in a script tag
36 | to your page (after leaflet and idb).
37 |
38 | ### Development
39 |
40 | For running the example locally, you'll need to clone the project and run:
41 |
42 | ```
43 | npm i && npm run build
44 | cd docs
45 | npm install && npm run start
46 | ```
47 |
48 | **pull requests welcome**
49 |
50 | * You MUST test your code with `npm test` and `npm run lint`.
51 | * Please one feature at a time, if you can split your PR, please do so.
52 | * Also, do not mix a feature with package updates.
53 | * [Use commit message conventions](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#rules)
54 |
55 | ## Api
56 |
57 | Generate docs with
58 |
59 | ```
60 | npm run-script docs
61 | ```
62 |
--------------------------------------------------------------------------------
/changelog.md:
--------------------------------------------------------------------------------
1 | # Version 3
2 |
3 | - Removal of setOption method on the control
4 | - getTile is now getBlobByKey
5 | - openTilesDataBase is now an export function to get whole idb database
6 | - New control option alwaysDownload, if false, the control will not redownload tiles already in the db (and the savetile\* event do not fire)
7 |
8 | # Version 4
9 |
10 | - Changed arguments of getStoredTilesAsJson: send an object with tilesize instead of the full layer
11 |
--------------------------------------------------------------------------------
/examples/README.md:
--------------------------------------------------------------------------------
1 | # Examples
2 |
3 |
4 | The examples are based on [vite's vanilla-ts template](https://vite.dev/guide/#scaffolding-your-first-vite-project)
5 |
6 | ```
7 | cd dir/
8 | npm i
9 | npm run dev
10 | ```
--------------------------------------------------------------------------------
/examples/list-storage/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/examples/list-storage/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Storage
8 |
9 |
10 |
11 |
12 |
18 |
19 |
20 | Total
21 |
22 |
27 | All
28 |
29 |
30 |
35 | Old
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | Source url
49 | Storage key
50 | Bytes
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/examples/list-storage/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "list-storage",
3 | "version": "0.0.0",
4 | "lockfileVersion": 3,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "list-storage",
9 | "version": "0.0.0",
10 | "devDependencies": {
11 | "bootstrap": "^5.3.3",
12 | "idb": "^8.0.0",
13 | "leaflet": "^1.9.4",
14 | "leaflet.offline": "^3.1.0",
15 | "prettier": "^3.3.3",
16 | "typescript": "~5.6.2",
17 | "vite": "^5.4.12"
18 | }
19 | },
20 | "node_modules/@esbuild/aix-ppc64": {
21 | "version": "0.21.5",
22 | "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",
23 | "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==",
24 | "cpu": [
25 | "ppc64"
26 | ],
27 | "dev": true,
28 | "license": "MIT",
29 | "optional": true,
30 | "os": [
31 | "aix"
32 | ],
33 | "engines": {
34 | "node": ">=12"
35 | }
36 | },
37 | "node_modules/@esbuild/android-arm": {
38 | "version": "0.21.5",
39 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz",
40 | "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==",
41 | "cpu": [
42 | "arm"
43 | ],
44 | "dev": true,
45 | "license": "MIT",
46 | "optional": true,
47 | "os": [
48 | "android"
49 | ],
50 | "engines": {
51 | "node": ">=12"
52 | }
53 | },
54 | "node_modules/@esbuild/android-arm64": {
55 | "version": "0.21.5",
56 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz",
57 | "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==",
58 | "cpu": [
59 | "arm64"
60 | ],
61 | "dev": true,
62 | "license": "MIT",
63 | "optional": true,
64 | "os": [
65 | "android"
66 | ],
67 | "engines": {
68 | "node": ">=12"
69 | }
70 | },
71 | "node_modules/@esbuild/android-x64": {
72 | "version": "0.21.5",
73 | "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz",
74 | "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==",
75 | "cpu": [
76 | "x64"
77 | ],
78 | "dev": true,
79 | "license": "MIT",
80 | "optional": true,
81 | "os": [
82 | "android"
83 | ],
84 | "engines": {
85 | "node": ">=12"
86 | }
87 | },
88 | "node_modules/@esbuild/darwin-arm64": {
89 | "version": "0.21.5",
90 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz",
91 | "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==",
92 | "cpu": [
93 | "arm64"
94 | ],
95 | "dev": true,
96 | "license": "MIT",
97 | "optional": true,
98 | "os": [
99 | "darwin"
100 | ],
101 | "engines": {
102 | "node": ">=12"
103 | }
104 | },
105 | "node_modules/@esbuild/darwin-x64": {
106 | "version": "0.21.5",
107 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz",
108 | "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==",
109 | "cpu": [
110 | "x64"
111 | ],
112 | "dev": true,
113 | "license": "MIT",
114 | "optional": true,
115 | "os": [
116 | "darwin"
117 | ],
118 | "engines": {
119 | "node": ">=12"
120 | }
121 | },
122 | "node_modules/@esbuild/freebsd-arm64": {
123 | "version": "0.21.5",
124 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz",
125 | "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==",
126 | "cpu": [
127 | "arm64"
128 | ],
129 | "dev": true,
130 | "license": "MIT",
131 | "optional": true,
132 | "os": [
133 | "freebsd"
134 | ],
135 | "engines": {
136 | "node": ">=12"
137 | }
138 | },
139 | "node_modules/@esbuild/freebsd-x64": {
140 | "version": "0.21.5",
141 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz",
142 | "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==",
143 | "cpu": [
144 | "x64"
145 | ],
146 | "dev": true,
147 | "license": "MIT",
148 | "optional": true,
149 | "os": [
150 | "freebsd"
151 | ],
152 | "engines": {
153 | "node": ">=12"
154 | }
155 | },
156 | "node_modules/@esbuild/linux-arm": {
157 | "version": "0.21.5",
158 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz",
159 | "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==",
160 | "cpu": [
161 | "arm"
162 | ],
163 | "dev": true,
164 | "license": "MIT",
165 | "optional": true,
166 | "os": [
167 | "linux"
168 | ],
169 | "engines": {
170 | "node": ">=12"
171 | }
172 | },
173 | "node_modules/@esbuild/linux-arm64": {
174 | "version": "0.21.5",
175 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz",
176 | "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==",
177 | "cpu": [
178 | "arm64"
179 | ],
180 | "dev": true,
181 | "license": "MIT",
182 | "optional": true,
183 | "os": [
184 | "linux"
185 | ],
186 | "engines": {
187 | "node": ">=12"
188 | }
189 | },
190 | "node_modules/@esbuild/linux-ia32": {
191 | "version": "0.21.5",
192 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz",
193 | "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==",
194 | "cpu": [
195 | "ia32"
196 | ],
197 | "dev": true,
198 | "license": "MIT",
199 | "optional": true,
200 | "os": [
201 | "linux"
202 | ],
203 | "engines": {
204 | "node": ">=12"
205 | }
206 | },
207 | "node_modules/@esbuild/linux-loong64": {
208 | "version": "0.21.5",
209 | "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz",
210 | "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==",
211 | "cpu": [
212 | "loong64"
213 | ],
214 | "dev": true,
215 | "license": "MIT",
216 | "optional": true,
217 | "os": [
218 | "linux"
219 | ],
220 | "engines": {
221 | "node": ">=12"
222 | }
223 | },
224 | "node_modules/@esbuild/linux-mips64el": {
225 | "version": "0.21.5",
226 | "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz",
227 | "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==",
228 | "cpu": [
229 | "mips64el"
230 | ],
231 | "dev": true,
232 | "license": "MIT",
233 | "optional": true,
234 | "os": [
235 | "linux"
236 | ],
237 | "engines": {
238 | "node": ">=12"
239 | }
240 | },
241 | "node_modules/@esbuild/linux-ppc64": {
242 | "version": "0.21.5",
243 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz",
244 | "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==",
245 | "cpu": [
246 | "ppc64"
247 | ],
248 | "dev": true,
249 | "license": "MIT",
250 | "optional": true,
251 | "os": [
252 | "linux"
253 | ],
254 | "engines": {
255 | "node": ">=12"
256 | }
257 | },
258 | "node_modules/@esbuild/linux-riscv64": {
259 | "version": "0.21.5",
260 | "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz",
261 | "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==",
262 | "cpu": [
263 | "riscv64"
264 | ],
265 | "dev": true,
266 | "license": "MIT",
267 | "optional": true,
268 | "os": [
269 | "linux"
270 | ],
271 | "engines": {
272 | "node": ">=12"
273 | }
274 | },
275 | "node_modules/@esbuild/linux-s390x": {
276 | "version": "0.21.5",
277 | "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz",
278 | "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==",
279 | "cpu": [
280 | "s390x"
281 | ],
282 | "dev": true,
283 | "license": "MIT",
284 | "optional": true,
285 | "os": [
286 | "linux"
287 | ],
288 | "engines": {
289 | "node": ">=12"
290 | }
291 | },
292 | "node_modules/@esbuild/linux-x64": {
293 | "version": "0.21.5",
294 | "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz",
295 | "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==",
296 | "cpu": [
297 | "x64"
298 | ],
299 | "dev": true,
300 | "license": "MIT",
301 | "optional": true,
302 | "os": [
303 | "linux"
304 | ],
305 | "engines": {
306 | "node": ">=12"
307 | }
308 | },
309 | "node_modules/@esbuild/netbsd-x64": {
310 | "version": "0.21.5",
311 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",
312 | "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==",
313 | "cpu": [
314 | "x64"
315 | ],
316 | "dev": true,
317 | "license": "MIT",
318 | "optional": true,
319 | "os": [
320 | "netbsd"
321 | ],
322 | "engines": {
323 | "node": ">=12"
324 | }
325 | },
326 | "node_modules/@esbuild/openbsd-x64": {
327 | "version": "0.21.5",
328 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz",
329 | "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==",
330 | "cpu": [
331 | "x64"
332 | ],
333 | "dev": true,
334 | "license": "MIT",
335 | "optional": true,
336 | "os": [
337 | "openbsd"
338 | ],
339 | "engines": {
340 | "node": ">=12"
341 | }
342 | },
343 | "node_modules/@esbuild/sunos-x64": {
344 | "version": "0.21.5",
345 | "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz",
346 | "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==",
347 | "cpu": [
348 | "x64"
349 | ],
350 | "dev": true,
351 | "license": "MIT",
352 | "optional": true,
353 | "os": [
354 | "sunos"
355 | ],
356 | "engines": {
357 | "node": ">=12"
358 | }
359 | },
360 | "node_modules/@esbuild/win32-arm64": {
361 | "version": "0.21.5",
362 | "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz",
363 | "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==",
364 | "cpu": [
365 | "arm64"
366 | ],
367 | "dev": true,
368 | "license": "MIT",
369 | "optional": true,
370 | "os": [
371 | "win32"
372 | ],
373 | "engines": {
374 | "node": ">=12"
375 | }
376 | },
377 | "node_modules/@esbuild/win32-ia32": {
378 | "version": "0.21.5",
379 | "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz",
380 | "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==",
381 | "cpu": [
382 | "ia32"
383 | ],
384 | "dev": true,
385 | "license": "MIT",
386 | "optional": true,
387 | "os": [
388 | "win32"
389 | ],
390 | "engines": {
391 | "node": ">=12"
392 | }
393 | },
394 | "node_modules/@esbuild/win32-x64": {
395 | "version": "0.21.5",
396 | "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz",
397 | "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==",
398 | "cpu": [
399 | "x64"
400 | ],
401 | "dev": true,
402 | "license": "MIT",
403 | "optional": true,
404 | "os": [
405 | "win32"
406 | ],
407 | "engines": {
408 | "node": ">=12"
409 | }
410 | },
411 | "node_modules/@popperjs/core": {
412 | "version": "2.11.8",
413 | "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
414 | "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==",
415 | "dev": true,
416 | "license": "MIT",
417 | "peer": true,
418 | "funding": {
419 | "type": "opencollective",
420 | "url": "https://opencollective.com/popperjs"
421 | }
422 | },
423 | "node_modules/@rollup/rollup-android-arm-eabi": {
424 | "version": "4.27.2",
425 | "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.27.2.tgz",
426 | "integrity": "sha512-Tj+j7Pyzd15wAdSJswvs5CJzJNV+qqSUcr/aCD+jpQSBtXvGnV0pnrjoc8zFTe9fcKCatkpFpOO7yAzpO998HA==",
427 | "cpu": [
428 | "arm"
429 | ],
430 | "dev": true,
431 | "license": "MIT",
432 | "optional": true,
433 | "os": [
434 | "android"
435 | ]
436 | },
437 | "node_modules/@rollup/rollup-android-arm64": {
438 | "version": "4.27.2",
439 | "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.27.2.tgz",
440 | "integrity": "sha512-xsPeJgh2ThBpUqlLgRfiVYBEf/P1nWlWvReG+aBWfNv3XEBpa6ZCmxSVnxJgLgkNz4IbxpLy64h2gCmAAQLneQ==",
441 | "cpu": [
442 | "arm64"
443 | ],
444 | "dev": true,
445 | "license": "MIT",
446 | "optional": true,
447 | "os": [
448 | "android"
449 | ]
450 | },
451 | "node_modules/@rollup/rollup-darwin-arm64": {
452 | "version": "4.27.2",
453 | "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.27.2.tgz",
454 | "integrity": "sha512-KnXU4m9MywuZFedL35Z3PuwiTSn/yqRIhrEA9j+7OSkji39NzVkgxuxTYg5F8ryGysq4iFADaU5osSizMXhU2A==",
455 | "cpu": [
456 | "arm64"
457 | ],
458 | "dev": true,
459 | "license": "MIT",
460 | "optional": true,
461 | "os": [
462 | "darwin"
463 | ]
464 | },
465 | "node_modules/@rollup/rollup-darwin-x64": {
466 | "version": "4.27.2",
467 | "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.27.2.tgz",
468 | "integrity": "sha512-Hj77A3yTvUeCIx/Vi+4d4IbYhyTwtHj07lVzUgpUq9YpJSEiGJj4vXMKwzJ3w5zp5v3PFvpJNgc/J31smZey6g==",
469 | "cpu": [
470 | "x64"
471 | ],
472 | "dev": true,
473 | "license": "MIT",
474 | "optional": true,
475 | "os": [
476 | "darwin"
477 | ]
478 | },
479 | "node_modules/@rollup/rollup-freebsd-arm64": {
480 | "version": "4.27.2",
481 | "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.27.2.tgz",
482 | "integrity": "sha512-RjgKf5C3xbn8gxvCm5VgKZ4nn0pRAIe90J0/fdHUsgztd3+Zesb2lm2+r6uX4prV2eUByuxJNdt647/1KPRq5g==",
483 | "cpu": [
484 | "arm64"
485 | ],
486 | "dev": true,
487 | "license": "MIT",
488 | "optional": true,
489 | "os": [
490 | "freebsd"
491 | ]
492 | },
493 | "node_modules/@rollup/rollup-freebsd-x64": {
494 | "version": "4.27.2",
495 | "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.27.2.tgz",
496 | "integrity": "sha512-duq21FoXwQtuws+V9H6UZ+eCBc7fxSpMK1GQINKn3fAyd9DFYKPJNcUhdIKOrMFjLEJgQskoMoiuizMt+dl20g==",
497 | "cpu": [
498 | "x64"
499 | ],
500 | "dev": true,
501 | "license": "MIT",
502 | "optional": true,
503 | "os": [
504 | "freebsd"
505 | ]
506 | },
507 | "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
508 | "version": "4.27.2",
509 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.27.2.tgz",
510 | "integrity": "sha512-6npqOKEPRZkLrMcvyC/32OzJ2srdPzCylJjiTJT2c0bwwSGm7nz2F9mNQ1WrAqCBZROcQn91Fno+khFhVijmFA==",
511 | "cpu": [
512 | "arm"
513 | ],
514 | "dev": true,
515 | "license": "MIT",
516 | "optional": true,
517 | "os": [
518 | "linux"
519 | ]
520 | },
521 | "node_modules/@rollup/rollup-linux-arm-musleabihf": {
522 | "version": "4.27.2",
523 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.27.2.tgz",
524 | "integrity": "sha512-V9Xg6eXtgBtHq2jnuQwM/jr2mwe2EycnopO8cbOvpzFuySCGtKlPCI3Hj9xup/pJK5Q0388qfZZy2DqV2J8ftw==",
525 | "cpu": [
526 | "arm"
527 | ],
528 | "dev": true,
529 | "license": "MIT",
530 | "optional": true,
531 | "os": [
532 | "linux"
533 | ]
534 | },
535 | "node_modules/@rollup/rollup-linux-arm64-gnu": {
536 | "version": "4.27.2",
537 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.27.2.tgz",
538 | "integrity": "sha512-uCFX9gtZJoQl2xDTpRdseYuNqyKkuMDtH6zSrBTA28yTfKyjN9hQ2B04N5ynR8ILCoSDOrG/Eg+J2TtJ1e/CSA==",
539 | "cpu": [
540 | "arm64"
541 | ],
542 | "dev": true,
543 | "license": "MIT",
544 | "optional": true,
545 | "os": [
546 | "linux"
547 | ]
548 | },
549 | "node_modules/@rollup/rollup-linux-arm64-musl": {
550 | "version": "4.27.2",
551 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.27.2.tgz",
552 | "integrity": "sha512-/PU9P+7Rkz8JFYDHIi+xzHabOu9qEWR07L5nWLIUsvserrxegZExKCi2jhMZRd0ATdboKylu/K5yAXbp7fYFvA==",
553 | "cpu": [
554 | "arm64"
555 | ],
556 | "dev": true,
557 | "license": "MIT",
558 | "optional": true,
559 | "os": [
560 | "linux"
561 | ]
562 | },
563 | "node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
564 | "version": "4.27.2",
565 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.27.2.tgz",
566 | "integrity": "sha512-eCHmol/dT5odMYi/N0R0HC8V8QE40rEpkyje/ZAXJYNNoSfrObOvG/Mn+s1F/FJyB7co7UQZZf6FuWnN6a7f4g==",
567 | "cpu": [
568 | "ppc64"
569 | ],
570 | "dev": true,
571 | "license": "MIT",
572 | "optional": true,
573 | "os": [
574 | "linux"
575 | ]
576 | },
577 | "node_modules/@rollup/rollup-linux-riscv64-gnu": {
578 | "version": "4.27.2",
579 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.27.2.tgz",
580 | "integrity": "sha512-DEP3Njr9/ADDln3kNi76PXonLMSSMiCir0VHXxmGSHxCxDfQ70oWjHcJGfiBugzaqmYdTC7Y+8Int6qbnxPBIQ==",
581 | "cpu": [
582 | "riscv64"
583 | ],
584 | "dev": true,
585 | "license": "MIT",
586 | "optional": true,
587 | "os": [
588 | "linux"
589 | ]
590 | },
591 | "node_modules/@rollup/rollup-linux-s390x-gnu": {
592 | "version": "4.27.2",
593 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.27.2.tgz",
594 | "integrity": "sha512-NHGo5i6IE/PtEPh5m0yw5OmPMpesFnzMIS/lzvN5vknnC1sXM5Z/id5VgcNPgpD+wHmIcuYYgW+Q53v+9s96lQ==",
595 | "cpu": [
596 | "s390x"
597 | ],
598 | "dev": true,
599 | "license": "MIT",
600 | "optional": true,
601 | "os": [
602 | "linux"
603 | ]
604 | },
605 | "node_modules/@rollup/rollup-linux-x64-gnu": {
606 | "version": "4.27.2",
607 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.27.2.tgz",
608 | "integrity": "sha512-PaW2DY5Tan+IFvNJGHDmUrORadbe/Ceh8tQxi8cmdQVCCYsLoQo2cuaSj+AU+YRX8M4ivS2vJ9UGaxfuNN7gmg==",
609 | "cpu": [
610 | "x64"
611 | ],
612 | "dev": true,
613 | "license": "MIT",
614 | "optional": true,
615 | "os": [
616 | "linux"
617 | ]
618 | },
619 | "node_modules/@rollup/rollup-linux-x64-musl": {
620 | "version": "4.27.2",
621 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.27.2.tgz",
622 | "integrity": "sha512-dOlWEMg2gI91Qx5I/HYqOD6iqlJspxLcS4Zlg3vjk1srE67z5T2Uz91yg/qA8sY0XcwQrFzWWiZhMNERylLrpQ==",
623 | "cpu": [
624 | "x64"
625 | ],
626 | "dev": true,
627 | "license": "MIT",
628 | "optional": true,
629 | "os": [
630 | "linux"
631 | ]
632 | },
633 | "node_modules/@rollup/rollup-win32-arm64-msvc": {
634 | "version": "4.27.2",
635 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.27.2.tgz",
636 | "integrity": "sha512-euMIv/4x5Y2/ImlbGl88mwKNXDsvzbWUlT7DFky76z2keajCtcbAsN9LUdmk31hAoVmJJYSThgdA0EsPeTr1+w==",
637 | "cpu": [
638 | "arm64"
639 | ],
640 | "dev": true,
641 | "license": "MIT",
642 | "optional": true,
643 | "os": [
644 | "win32"
645 | ]
646 | },
647 | "node_modules/@rollup/rollup-win32-ia32-msvc": {
648 | "version": "4.27.2",
649 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.27.2.tgz",
650 | "integrity": "sha512-RsnE6LQkUHlkC10RKngtHNLxb7scFykEbEwOFDjr3CeCMG+Rr+cKqlkKc2/wJ1u4u990urRHCbjz31x84PBrSQ==",
651 | "cpu": [
652 | "ia32"
653 | ],
654 | "dev": true,
655 | "license": "MIT",
656 | "optional": true,
657 | "os": [
658 | "win32"
659 | ]
660 | },
661 | "node_modules/@rollup/rollup-win32-x64-msvc": {
662 | "version": "4.27.2",
663 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.27.2.tgz",
664 | "integrity": "sha512-foJM5vv+z2KQmn7emYdDLyTbkoO5bkHZE1oth2tWbQNGW7mX32d46Hz6T0MqXdWS2vBZhaEtHqdy9WYwGfiliA==",
665 | "cpu": [
666 | "x64"
667 | ],
668 | "dev": true,
669 | "license": "MIT",
670 | "optional": true,
671 | "os": [
672 | "win32"
673 | ]
674 | },
675 | "node_modules/@types/estree": {
676 | "version": "1.0.6",
677 | "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
678 | "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==",
679 | "dev": true,
680 | "license": "MIT"
681 | },
682 | "node_modules/bootstrap": {
683 | "version": "5.3.3",
684 | "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.3.tgz",
685 | "integrity": "sha512-8HLCdWgyoMguSO9o+aH+iuZ+aht+mzW0u3HIMzVu7Srrpv7EBBxTnrFlSCskwdY1+EOFQSm7uMJhNQHkdPcmjg==",
686 | "dev": true,
687 | "funding": [
688 | {
689 | "type": "github",
690 | "url": "https://github.com/sponsors/twbs"
691 | },
692 | {
693 | "type": "opencollective",
694 | "url": "https://opencollective.com/bootstrap"
695 | }
696 | ],
697 | "license": "MIT",
698 | "peerDependencies": {
699 | "@popperjs/core": "^2.11.8"
700 | }
701 | },
702 | "node_modules/esbuild": {
703 | "version": "0.21.5",
704 | "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
705 | "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
706 | "dev": true,
707 | "hasInstallScript": true,
708 | "license": "MIT",
709 | "bin": {
710 | "esbuild": "bin/esbuild"
711 | },
712 | "engines": {
713 | "node": ">=12"
714 | },
715 | "optionalDependencies": {
716 | "@esbuild/aix-ppc64": "0.21.5",
717 | "@esbuild/android-arm": "0.21.5",
718 | "@esbuild/android-arm64": "0.21.5",
719 | "@esbuild/android-x64": "0.21.5",
720 | "@esbuild/darwin-arm64": "0.21.5",
721 | "@esbuild/darwin-x64": "0.21.5",
722 | "@esbuild/freebsd-arm64": "0.21.5",
723 | "@esbuild/freebsd-x64": "0.21.5",
724 | "@esbuild/linux-arm": "0.21.5",
725 | "@esbuild/linux-arm64": "0.21.5",
726 | "@esbuild/linux-ia32": "0.21.5",
727 | "@esbuild/linux-loong64": "0.21.5",
728 | "@esbuild/linux-mips64el": "0.21.5",
729 | "@esbuild/linux-ppc64": "0.21.5",
730 | "@esbuild/linux-riscv64": "0.21.5",
731 | "@esbuild/linux-s390x": "0.21.5",
732 | "@esbuild/linux-x64": "0.21.5",
733 | "@esbuild/netbsd-x64": "0.21.5",
734 | "@esbuild/openbsd-x64": "0.21.5",
735 | "@esbuild/sunos-x64": "0.21.5",
736 | "@esbuild/win32-arm64": "0.21.5",
737 | "@esbuild/win32-ia32": "0.21.5",
738 | "@esbuild/win32-x64": "0.21.5"
739 | }
740 | },
741 | "node_modules/fsevents": {
742 | "version": "2.3.3",
743 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
744 | "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
745 | "dev": true,
746 | "hasInstallScript": true,
747 | "license": "MIT",
748 | "optional": true,
749 | "os": [
750 | "darwin"
751 | ],
752 | "engines": {
753 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
754 | }
755 | },
756 | "node_modules/idb": {
757 | "version": "8.0.0",
758 | "resolved": "https://registry.npmjs.org/idb/-/idb-8.0.0.tgz",
759 | "integrity": "sha512-l//qvlAKGmQO31Qn7xdzagVPPaHTxXx199MhrAFuVBTPqydcPYBWjkrbv4Y0ktB+GmWOiwHl237UUOrLmQxLvw==",
760 | "dev": true,
761 | "license": "ISC"
762 | },
763 | "node_modules/leaflet": {
764 | "version": "1.9.4",
765 | "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz",
766 | "integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==",
767 | "dev": true,
768 | "license": "BSD-2-Clause"
769 | },
770 | "node_modules/leaflet.offline": {
771 | "version": "3.1.0",
772 | "resolved": "https://registry.npmjs.org/leaflet.offline/-/leaflet.offline-3.1.0.tgz",
773 | "integrity": "sha512-dl3mzTEl1SnmzvJtJ0hVFLvlFX2wut/srvRAZ3A3g7Ee/RQkOo5zQ6tfVNhKe8N+adGXqcdEqEY9kgUxXCnEAw==",
774 | "dev": true,
775 | "license": "ISC",
776 | "dependencies": {
777 | "idb": "^7.1.1",
778 | "leaflet": "^1.6.0"
779 | },
780 | "engines": {
781 | "node": ">=16"
782 | }
783 | },
784 | "node_modules/leaflet.offline/node_modules/idb": {
785 | "version": "7.1.1",
786 | "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz",
787 | "integrity": "sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==",
788 | "dev": true,
789 | "license": "ISC"
790 | },
791 | "node_modules/nanoid": {
792 | "version": "3.3.7",
793 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
794 | "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
795 | "dev": true,
796 | "funding": [
797 | {
798 | "type": "github",
799 | "url": "https://github.com/sponsors/ai"
800 | }
801 | ],
802 | "license": "MIT",
803 | "bin": {
804 | "nanoid": "bin/nanoid.cjs"
805 | },
806 | "engines": {
807 | "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
808 | }
809 | },
810 | "node_modules/picocolors": {
811 | "version": "1.1.1",
812 | "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
813 | "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
814 | "dev": true,
815 | "license": "ISC"
816 | },
817 | "node_modules/postcss": {
818 | "version": "8.4.49",
819 | "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz",
820 | "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==",
821 | "dev": true,
822 | "funding": [
823 | {
824 | "type": "opencollective",
825 | "url": "https://opencollective.com/postcss/"
826 | },
827 | {
828 | "type": "tidelift",
829 | "url": "https://tidelift.com/funding/github/npm/postcss"
830 | },
831 | {
832 | "type": "github",
833 | "url": "https://github.com/sponsors/ai"
834 | }
835 | ],
836 | "license": "MIT",
837 | "dependencies": {
838 | "nanoid": "^3.3.7",
839 | "picocolors": "^1.1.1",
840 | "source-map-js": "^1.2.1"
841 | },
842 | "engines": {
843 | "node": "^10 || ^12 || >=14"
844 | }
845 | },
846 | "node_modules/prettier": {
847 | "version": "3.3.3",
848 | "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
849 | "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
850 | "dev": true,
851 | "license": "MIT",
852 | "bin": {
853 | "prettier": "bin/prettier.cjs"
854 | },
855 | "engines": {
856 | "node": ">=14"
857 | },
858 | "funding": {
859 | "url": "https://github.com/prettier/prettier?sponsor=1"
860 | }
861 | },
862 | "node_modules/rollup": {
863 | "version": "4.27.2",
864 | "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.27.2.tgz",
865 | "integrity": "sha512-KreA+PzWmk2yaFmZVwe6GB2uBD86nXl86OsDkt1bJS9p3vqWuEQ6HnJJ+j/mZi/q0920P99/MVRlB4L3crpF5w==",
866 | "dev": true,
867 | "license": "MIT",
868 | "dependencies": {
869 | "@types/estree": "1.0.6"
870 | },
871 | "bin": {
872 | "rollup": "dist/bin/rollup"
873 | },
874 | "engines": {
875 | "node": ">=18.0.0",
876 | "npm": ">=8.0.0"
877 | },
878 | "optionalDependencies": {
879 | "@rollup/rollup-android-arm-eabi": "4.27.2",
880 | "@rollup/rollup-android-arm64": "4.27.2",
881 | "@rollup/rollup-darwin-arm64": "4.27.2",
882 | "@rollup/rollup-darwin-x64": "4.27.2",
883 | "@rollup/rollup-freebsd-arm64": "4.27.2",
884 | "@rollup/rollup-freebsd-x64": "4.27.2",
885 | "@rollup/rollup-linux-arm-gnueabihf": "4.27.2",
886 | "@rollup/rollup-linux-arm-musleabihf": "4.27.2",
887 | "@rollup/rollup-linux-arm64-gnu": "4.27.2",
888 | "@rollup/rollup-linux-arm64-musl": "4.27.2",
889 | "@rollup/rollup-linux-powerpc64le-gnu": "4.27.2",
890 | "@rollup/rollup-linux-riscv64-gnu": "4.27.2",
891 | "@rollup/rollup-linux-s390x-gnu": "4.27.2",
892 | "@rollup/rollup-linux-x64-gnu": "4.27.2",
893 | "@rollup/rollup-linux-x64-musl": "4.27.2",
894 | "@rollup/rollup-win32-arm64-msvc": "4.27.2",
895 | "@rollup/rollup-win32-ia32-msvc": "4.27.2",
896 | "@rollup/rollup-win32-x64-msvc": "4.27.2",
897 | "fsevents": "~2.3.2"
898 | }
899 | },
900 | "node_modules/source-map-js": {
901 | "version": "1.2.1",
902 | "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
903 | "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
904 | "dev": true,
905 | "license": "BSD-3-Clause",
906 | "engines": {
907 | "node": ">=0.10.0"
908 | }
909 | },
910 | "node_modules/typescript": {
911 | "version": "5.6.3",
912 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
913 | "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
914 | "dev": true,
915 | "license": "Apache-2.0",
916 | "bin": {
917 | "tsc": "bin/tsc",
918 | "tsserver": "bin/tsserver"
919 | },
920 | "engines": {
921 | "node": ">=14.17"
922 | }
923 | },
924 | "node_modules/vite": {
925 | "version": "5.4.12",
926 | "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.12.tgz",
927 | "integrity": "sha512-KwUaKB27TvWwDJr1GjjWthLMATbGEbeWYZIbGZ5qFIsgPP3vWzLu4cVooqhm5/Z2SPDUMjyPVjTztm5tYKwQxA==",
928 | "dev": true,
929 | "license": "MIT",
930 | "dependencies": {
931 | "esbuild": "^0.21.3",
932 | "postcss": "^8.4.43",
933 | "rollup": "^4.20.0"
934 | },
935 | "bin": {
936 | "vite": "bin/vite.js"
937 | },
938 | "engines": {
939 | "node": "^18.0.0 || >=20.0.0"
940 | },
941 | "funding": {
942 | "url": "https://github.com/vitejs/vite?sponsor=1"
943 | },
944 | "optionalDependencies": {
945 | "fsevents": "~2.3.3"
946 | },
947 | "peerDependencies": {
948 | "@types/node": "^18.0.0 || >=20.0.0",
949 | "less": "*",
950 | "lightningcss": "^1.21.0",
951 | "sass": "*",
952 | "sass-embedded": "*",
953 | "stylus": "*",
954 | "sugarss": "*",
955 | "terser": "^5.4.0"
956 | },
957 | "peerDependenciesMeta": {
958 | "@types/node": {
959 | "optional": true
960 | },
961 | "less": {
962 | "optional": true
963 | },
964 | "lightningcss": {
965 | "optional": true
966 | },
967 | "sass": {
968 | "optional": true
969 | },
970 | "sass-embedded": {
971 | "optional": true
972 | },
973 | "stylus": {
974 | "optional": true
975 | },
976 | "sugarss": {
977 | "optional": true
978 | },
979 | "terser": {
980 | "optional": true
981 | }
982 | }
983 | }
984 | }
985 | }
986 |
--------------------------------------------------------------------------------
/examples/list-storage/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "list-storage",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "tsc && vite build",
9 | "preview": "vite preview"
10 | },
11 | "devDependencies": {
12 | "bootstrap": "^5.3.3",
13 | "idb": "^8.0.0",
14 | "leaflet": "^1.9.4",
15 | "leaflet.offline": "^3.1.0",
16 | "prettier": "^3.3.3",
17 | "typescript": "~5.6.2",
18 | "vite": "^5.4.12"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/examples/list-storage/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/examples/list-storage/src/main.ts:
--------------------------------------------------------------------------------
1 | import './style.css';
2 | import { getStorageInfo, removeTile, truncate } from 'leaflet.offline';
3 |
4 | export const urlTemplate = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
5 | export const wmtsUrlTemplate =
6 | 'https://service.pdok.nl/brt/achtergrondkaart/wmts/v2_0?service=WMTS&request=GetTile&version=1.0.0&tilematrixset=EPSG:3857&layer={layer}&tilematrix={z}&tilerow={y}&tilecol={x}&format=image%2Fpng';
7 |
8 | const layerSelector = document.getElementById(
9 | 'selectlayer',
10 | ) as HTMLSelectElement;
11 |
12 | function createLayerOpts() {
13 | const xyzOpt = document.createElement('option');
14 | xyzOpt.value = urlTemplate;
15 | xyzOpt.text = 'osm';
16 | const wmtsOpt = document.createElement('option');
17 | wmtsOpt.value = wmtsUrlTemplate;
18 | wmtsOpt.text = 'wmts api layer';
19 | layerSelector.add(xyzOpt);
20 | layerSelector.add(wmtsOpt);
21 | layerSelector.value = urlTemplate;
22 | }
23 |
24 | const createTable = (url: string) =>
25 | getStorageInfo(url).then((r) => {
26 | document.getElementById('storage')!.innerHTML = r.length.toString();
27 | const list = document.getElementById(
28 | 'tileinforows',
29 | ) as HTMLTableSectionElement;
30 | list.innerHTML = '';
31 | for (let i = 0; i < r.length; i += 1) {
32 | const tileInfo = r[i];
33 | list.insertAdjacentHTML(
34 | 'beforeend',
35 | `
36 | ${i}
37 | ${tileInfo.url}
38 | ${r[i].key}
39 | ${tileInfo.blob.size}
40 | `,
41 | );
42 | }
43 | });
44 |
45 | createLayerOpts();
46 | createTable(layerSelector.value);
47 |
48 | const rmButton = document.getElementById('remove_tiles') as HTMLButtonElement;
49 | rmButton.addEventListener('click', () =>
50 | truncate().then(() => createTable(layerSelector.value)),
51 | );
52 |
53 | const rmOldButton = document.getElementById(
54 | 'remove_old_tiles',
55 | ) as HTMLButtonElement;
56 | rmOldButton.addEventListener('click', async () => {
57 | const tiles = await getStorageInfo(urlTemplate);
58 | const minCreatedAt = new Date().setDate(-30);
59 | await Promise.all(
60 | tiles.map((tile) =>
61 | tile.createdAt < minCreatedAt ? removeTile(tile.key) : Promise.resolve(),
62 | ),
63 | );
64 | createTable(layerSelector.value);
65 | });
66 |
67 | layerSelector.addEventListener('change', (e) => {
68 | // @ts-ignore
69 | createTable(e.target.value);
70 | });
71 |
--------------------------------------------------------------------------------
/examples/list-storage/src/style.css:
--------------------------------------------------------------------------------
1 | @import "bootstrap/dist/css/bootstrap.css";
2 | @import "leaflet/dist/leaflet.css";
--------------------------------------------------------------------------------
/examples/list-storage/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/examples/list-storage/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "module": "ESNext",
6 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
7 | "skipLibCheck": true,
8 |
9 | /* Bundler mode */
10 | "moduleResolution": "Bundler",
11 | "allowImportingTsExtensions": true,
12 | "isolatedModules": true,
13 | "moduleDetection": "force",
14 | "noEmit": true,
15 |
16 | /* Linting */
17 | "strict": true,
18 | "noUnusedLocals": true,
19 | "noUnusedParameters": true,
20 | "noFallthroughCasesInSwitch": true,
21 | "noUncheckedSideEffectImports": true
22 | },
23 | "include": ["src"]
24 | }
25 |
--------------------------------------------------------------------------------
/examples/map-layers-and-control/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/examples/map-layers-and-control/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite + TS
8 |
9 |
10 |
11 |
12 |
13 | This maps shows the default
14 | layer
19 | and control provided by leaflet.offline. Click the buttons on the left
20 | side to download tiles from the visible area at zoom levels 13 & 16
21 | (see the script). Enable the offline tiles layer to see what is
22 | already offline available.
23 |
24 |
25 | Total in database:
26 | files
27 |
28 |
29 |
30 |
31 |
Download Progress
32 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/examples/map-layers-and-control/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "map-layers-and-control",
3 | "version": "0.0.0",
4 | "lockfileVersion": 3,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "map-layers-and-control",
9 | "version": "0.0.0",
10 | "dependencies": {
11 | "@fortawesome/fontawesome-free": "^6.6.0",
12 | "@fortawesome/free-solid-svg-icons": "^6.6.0",
13 | "debounce": "^2.2.0",
14 | "idb": "^8.0.0",
15 | "leaflet": "^1.9.4",
16 | "leaflet.offline": "^3.1.0"
17 | },
18 | "devDependencies": {
19 | "bootstrap": "4.3",
20 | "prettier": "^3.3.3",
21 | "typescript": "~5.6.2",
22 | "vite": "^5.4.12"
23 | }
24 | },
25 | "node_modules/@esbuild/aix-ppc64": {
26 | "version": "0.21.5",
27 | "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",
28 | "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==",
29 | "cpu": [
30 | "ppc64"
31 | ],
32 | "dev": true,
33 | "optional": true,
34 | "os": [
35 | "aix"
36 | ],
37 | "engines": {
38 | "node": ">=12"
39 | }
40 | },
41 | "node_modules/@esbuild/android-arm": {
42 | "version": "0.21.5",
43 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz",
44 | "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==",
45 | "cpu": [
46 | "arm"
47 | ],
48 | "dev": true,
49 | "optional": true,
50 | "os": [
51 | "android"
52 | ],
53 | "engines": {
54 | "node": ">=12"
55 | }
56 | },
57 | "node_modules/@esbuild/android-arm64": {
58 | "version": "0.21.5",
59 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz",
60 | "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==",
61 | "cpu": [
62 | "arm64"
63 | ],
64 | "dev": true,
65 | "optional": true,
66 | "os": [
67 | "android"
68 | ],
69 | "engines": {
70 | "node": ">=12"
71 | }
72 | },
73 | "node_modules/@esbuild/android-x64": {
74 | "version": "0.21.5",
75 | "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz",
76 | "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==",
77 | "cpu": [
78 | "x64"
79 | ],
80 | "dev": true,
81 | "optional": true,
82 | "os": [
83 | "android"
84 | ],
85 | "engines": {
86 | "node": ">=12"
87 | }
88 | },
89 | "node_modules/@esbuild/darwin-arm64": {
90 | "version": "0.21.5",
91 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz",
92 | "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==",
93 | "cpu": [
94 | "arm64"
95 | ],
96 | "dev": true,
97 | "optional": true,
98 | "os": [
99 | "darwin"
100 | ],
101 | "engines": {
102 | "node": ">=12"
103 | }
104 | },
105 | "node_modules/@esbuild/darwin-x64": {
106 | "version": "0.21.5",
107 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz",
108 | "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==",
109 | "cpu": [
110 | "x64"
111 | ],
112 | "dev": true,
113 | "optional": true,
114 | "os": [
115 | "darwin"
116 | ],
117 | "engines": {
118 | "node": ">=12"
119 | }
120 | },
121 | "node_modules/@esbuild/freebsd-arm64": {
122 | "version": "0.21.5",
123 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz",
124 | "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==",
125 | "cpu": [
126 | "arm64"
127 | ],
128 | "dev": true,
129 | "optional": true,
130 | "os": [
131 | "freebsd"
132 | ],
133 | "engines": {
134 | "node": ">=12"
135 | }
136 | },
137 | "node_modules/@esbuild/freebsd-x64": {
138 | "version": "0.21.5",
139 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz",
140 | "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==",
141 | "cpu": [
142 | "x64"
143 | ],
144 | "dev": true,
145 | "optional": true,
146 | "os": [
147 | "freebsd"
148 | ],
149 | "engines": {
150 | "node": ">=12"
151 | }
152 | },
153 | "node_modules/@esbuild/linux-arm": {
154 | "version": "0.21.5",
155 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz",
156 | "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==",
157 | "cpu": [
158 | "arm"
159 | ],
160 | "dev": true,
161 | "optional": true,
162 | "os": [
163 | "linux"
164 | ],
165 | "engines": {
166 | "node": ">=12"
167 | }
168 | },
169 | "node_modules/@esbuild/linux-arm64": {
170 | "version": "0.21.5",
171 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz",
172 | "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==",
173 | "cpu": [
174 | "arm64"
175 | ],
176 | "dev": true,
177 | "optional": true,
178 | "os": [
179 | "linux"
180 | ],
181 | "engines": {
182 | "node": ">=12"
183 | }
184 | },
185 | "node_modules/@esbuild/linux-ia32": {
186 | "version": "0.21.5",
187 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz",
188 | "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==",
189 | "cpu": [
190 | "ia32"
191 | ],
192 | "dev": true,
193 | "optional": true,
194 | "os": [
195 | "linux"
196 | ],
197 | "engines": {
198 | "node": ">=12"
199 | }
200 | },
201 | "node_modules/@esbuild/linux-loong64": {
202 | "version": "0.21.5",
203 | "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz",
204 | "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==",
205 | "cpu": [
206 | "loong64"
207 | ],
208 | "dev": true,
209 | "optional": true,
210 | "os": [
211 | "linux"
212 | ],
213 | "engines": {
214 | "node": ">=12"
215 | }
216 | },
217 | "node_modules/@esbuild/linux-mips64el": {
218 | "version": "0.21.5",
219 | "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz",
220 | "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==",
221 | "cpu": [
222 | "mips64el"
223 | ],
224 | "dev": true,
225 | "optional": true,
226 | "os": [
227 | "linux"
228 | ],
229 | "engines": {
230 | "node": ">=12"
231 | }
232 | },
233 | "node_modules/@esbuild/linux-ppc64": {
234 | "version": "0.21.5",
235 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz",
236 | "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==",
237 | "cpu": [
238 | "ppc64"
239 | ],
240 | "dev": true,
241 | "optional": true,
242 | "os": [
243 | "linux"
244 | ],
245 | "engines": {
246 | "node": ">=12"
247 | }
248 | },
249 | "node_modules/@esbuild/linux-riscv64": {
250 | "version": "0.21.5",
251 | "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz",
252 | "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==",
253 | "cpu": [
254 | "riscv64"
255 | ],
256 | "dev": true,
257 | "optional": true,
258 | "os": [
259 | "linux"
260 | ],
261 | "engines": {
262 | "node": ">=12"
263 | }
264 | },
265 | "node_modules/@esbuild/linux-s390x": {
266 | "version": "0.21.5",
267 | "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz",
268 | "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==",
269 | "cpu": [
270 | "s390x"
271 | ],
272 | "dev": true,
273 | "optional": true,
274 | "os": [
275 | "linux"
276 | ],
277 | "engines": {
278 | "node": ">=12"
279 | }
280 | },
281 | "node_modules/@esbuild/linux-x64": {
282 | "version": "0.21.5",
283 | "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz",
284 | "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==",
285 | "cpu": [
286 | "x64"
287 | ],
288 | "dev": true,
289 | "optional": true,
290 | "os": [
291 | "linux"
292 | ],
293 | "engines": {
294 | "node": ">=12"
295 | }
296 | },
297 | "node_modules/@esbuild/netbsd-x64": {
298 | "version": "0.21.5",
299 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",
300 | "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==",
301 | "cpu": [
302 | "x64"
303 | ],
304 | "dev": true,
305 | "optional": true,
306 | "os": [
307 | "netbsd"
308 | ],
309 | "engines": {
310 | "node": ">=12"
311 | }
312 | },
313 | "node_modules/@esbuild/openbsd-x64": {
314 | "version": "0.21.5",
315 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz",
316 | "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==",
317 | "cpu": [
318 | "x64"
319 | ],
320 | "dev": true,
321 | "optional": true,
322 | "os": [
323 | "openbsd"
324 | ],
325 | "engines": {
326 | "node": ">=12"
327 | }
328 | },
329 | "node_modules/@esbuild/sunos-x64": {
330 | "version": "0.21.5",
331 | "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz",
332 | "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==",
333 | "cpu": [
334 | "x64"
335 | ],
336 | "dev": true,
337 | "optional": true,
338 | "os": [
339 | "sunos"
340 | ],
341 | "engines": {
342 | "node": ">=12"
343 | }
344 | },
345 | "node_modules/@esbuild/win32-arm64": {
346 | "version": "0.21.5",
347 | "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz",
348 | "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==",
349 | "cpu": [
350 | "arm64"
351 | ],
352 | "dev": true,
353 | "optional": true,
354 | "os": [
355 | "win32"
356 | ],
357 | "engines": {
358 | "node": ">=12"
359 | }
360 | },
361 | "node_modules/@esbuild/win32-ia32": {
362 | "version": "0.21.5",
363 | "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz",
364 | "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==",
365 | "cpu": [
366 | "ia32"
367 | ],
368 | "dev": true,
369 | "optional": true,
370 | "os": [
371 | "win32"
372 | ],
373 | "engines": {
374 | "node": ">=12"
375 | }
376 | },
377 | "node_modules/@esbuild/win32-x64": {
378 | "version": "0.21.5",
379 | "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz",
380 | "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==",
381 | "cpu": [
382 | "x64"
383 | ],
384 | "dev": true,
385 | "optional": true,
386 | "os": [
387 | "win32"
388 | ],
389 | "engines": {
390 | "node": ">=12"
391 | }
392 | },
393 | "node_modules/@fortawesome/fontawesome-common-types": {
394 | "version": "6.6.0",
395 | "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.6.0.tgz",
396 | "integrity": "sha512-xyX0X9mc0kyz9plIyryrRbl7ngsA9jz77mCZJsUkLl+ZKs0KWObgaEBoSgQiYWAsSmjz/yjl0F++Got0Mdp4Rw==",
397 | "license": "MIT",
398 | "engines": {
399 | "node": ">=6"
400 | }
401 | },
402 | "node_modules/@fortawesome/fontawesome-free": {
403 | "version": "6.6.0",
404 | "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.6.0.tgz",
405 | "integrity": "sha512-60G28ke/sXdtS9KZCpZSHHkCbdsOGEhIUGlwq6yhY74UpTiToIh8np7A8yphhM4BWsvNFtIvLpi4co+h9Mr9Ow==",
406 | "license": "(CC-BY-4.0 AND OFL-1.1 AND MIT)",
407 | "engines": {
408 | "node": ">=6"
409 | }
410 | },
411 | "node_modules/@fortawesome/free-solid-svg-icons": {
412 | "version": "6.6.0",
413 | "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.6.0.tgz",
414 | "integrity": "sha512-IYv/2skhEDFc2WGUcqvFJkeK39Q+HyPf5GHUrT/l2pKbtgEIv1al1TKd6qStR5OIwQdN1GZP54ci3y4mroJWjA==",
415 | "license": "(CC-BY-4.0 AND MIT)",
416 | "dependencies": {
417 | "@fortawesome/fontawesome-common-types": "6.6.0"
418 | },
419 | "engines": {
420 | "node": ">=6"
421 | }
422 | },
423 | "node_modules/@rollup/rollup-android-arm-eabi": {
424 | "version": "4.24.3",
425 | "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.24.3.tgz",
426 | "integrity": "sha512-ufb2CH2KfBWPJok95frEZZ82LtDl0A6QKTa8MoM+cWwDZvVGl5/jNb79pIhRvAalUu+7LD91VYR0nwRD799HkQ==",
427 | "cpu": [
428 | "arm"
429 | ],
430 | "dev": true,
431 | "optional": true,
432 | "os": [
433 | "android"
434 | ]
435 | },
436 | "node_modules/@rollup/rollup-android-arm64": {
437 | "version": "4.24.3",
438 | "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.24.3.tgz",
439 | "integrity": "sha512-iAHpft/eQk9vkWIV5t22V77d90CRofgR2006UiCjHcHJFVI1E0oBkQIAbz+pLtthFw3hWEmVB4ilxGyBf48i2Q==",
440 | "cpu": [
441 | "arm64"
442 | ],
443 | "dev": true,
444 | "optional": true,
445 | "os": [
446 | "android"
447 | ]
448 | },
449 | "node_modules/@rollup/rollup-darwin-arm64": {
450 | "version": "4.24.3",
451 | "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.24.3.tgz",
452 | "integrity": "sha512-QPW2YmkWLlvqmOa2OwrfqLJqkHm7kJCIMq9kOz40Zo9Ipi40kf9ONG5Sz76zszrmIZZ4hgRIkez69YnTHgEz1w==",
453 | "cpu": [
454 | "arm64"
455 | ],
456 | "dev": true,
457 | "optional": true,
458 | "os": [
459 | "darwin"
460 | ]
461 | },
462 | "node_modules/@rollup/rollup-darwin-x64": {
463 | "version": "4.24.3",
464 | "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.24.3.tgz",
465 | "integrity": "sha512-KO0pN5x3+uZm1ZXeIfDqwcvnQ9UEGN8JX5ufhmgH5Lz4ujjZMAnxQygZAVGemFWn+ZZC0FQopruV4lqmGMshow==",
466 | "cpu": [
467 | "x64"
468 | ],
469 | "dev": true,
470 | "optional": true,
471 | "os": [
472 | "darwin"
473 | ]
474 | },
475 | "node_modules/@rollup/rollup-freebsd-arm64": {
476 | "version": "4.24.3",
477 | "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.24.3.tgz",
478 | "integrity": "sha512-CsC+ZdIiZCZbBI+aRlWpYJMSWvVssPuWqrDy/zi9YfnatKKSLFCe6fjna1grHuo/nVaHG+kiglpRhyBQYRTK4A==",
479 | "cpu": [
480 | "arm64"
481 | ],
482 | "dev": true,
483 | "optional": true,
484 | "os": [
485 | "freebsd"
486 | ]
487 | },
488 | "node_modules/@rollup/rollup-freebsd-x64": {
489 | "version": "4.24.3",
490 | "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.24.3.tgz",
491 | "integrity": "sha512-F0nqiLThcfKvRQhZEzMIXOQG4EeX61im61VYL1jo4eBxv4aZRmpin6crnBJQ/nWnCsjH5F6J3W6Stdm0mBNqBg==",
492 | "cpu": [
493 | "x64"
494 | ],
495 | "dev": true,
496 | "optional": true,
497 | "os": [
498 | "freebsd"
499 | ]
500 | },
501 | "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
502 | "version": "4.24.3",
503 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.24.3.tgz",
504 | "integrity": "sha512-KRSFHyE/RdxQ1CSeOIBVIAxStFC/hnBgVcaiCkQaVC+EYDtTe4X7z5tBkFyRoBgUGtB6Xg6t9t2kulnX6wJc6A==",
505 | "cpu": [
506 | "arm"
507 | ],
508 | "dev": true,
509 | "optional": true,
510 | "os": [
511 | "linux"
512 | ]
513 | },
514 | "node_modules/@rollup/rollup-linux-arm-musleabihf": {
515 | "version": "4.24.3",
516 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.24.3.tgz",
517 | "integrity": "sha512-h6Q8MT+e05zP5BxEKz0vi0DhthLdrNEnspdLzkoFqGwnmOzakEHSlXfVyA4HJ322QtFy7biUAVFPvIDEDQa6rw==",
518 | "cpu": [
519 | "arm"
520 | ],
521 | "dev": true,
522 | "optional": true,
523 | "os": [
524 | "linux"
525 | ]
526 | },
527 | "node_modules/@rollup/rollup-linux-arm64-gnu": {
528 | "version": "4.24.3",
529 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.24.3.tgz",
530 | "integrity": "sha512-fKElSyXhXIJ9pqiYRqisfirIo2Z5pTTve5K438URf08fsypXrEkVmShkSfM8GJ1aUyvjakT+fn2W7Czlpd/0FQ==",
531 | "cpu": [
532 | "arm64"
533 | ],
534 | "dev": true,
535 | "optional": true,
536 | "os": [
537 | "linux"
538 | ]
539 | },
540 | "node_modules/@rollup/rollup-linux-arm64-musl": {
541 | "version": "4.24.3",
542 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.24.3.tgz",
543 | "integrity": "sha512-YlddZSUk8G0px9/+V9PVilVDC6ydMz7WquxozToozSnfFK6wa6ne1ATUjUvjin09jp34p84milxlY5ikueoenw==",
544 | "cpu": [
545 | "arm64"
546 | ],
547 | "dev": true,
548 | "optional": true,
549 | "os": [
550 | "linux"
551 | ]
552 | },
553 | "node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
554 | "version": "4.24.3",
555 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.24.3.tgz",
556 | "integrity": "sha512-yNaWw+GAO8JjVx3s3cMeG5Esz1cKVzz8PkTJSfYzE5u7A+NvGmbVFEHP+BikTIyYWuz0+DX9kaA3pH9Sqxp69g==",
557 | "cpu": [
558 | "ppc64"
559 | ],
560 | "dev": true,
561 | "optional": true,
562 | "os": [
563 | "linux"
564 | ]
565 | },
566 | "node_modules/@rollup/rollup-linux-riscv64-gnu": {
567 | "version": "4.24.3",
568 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.24.3.tgz",
569 | "integrity": "sha512-lWKNQfsbpv14ZCtM/HkjCTm4oWTKTfxPmr7iPfp3AHSqyoTz5AgLemYkWLwOBWc+XxBbrU9SCokZP0WlBZM9lA==",
570 | "cpu": [
571 | "riscv64"
572 | ],
573 | "dev": true,
574 | "optional": true,
575 | "os": [
576 | "linux"
577 | ]
578 | },
579 | "node_modules/@rollup/rollup-linux-s390x-gnu": {
580 | "version": "4.24.3",
581 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.24.3.tgz",
582 | "integrity": "sha512-HoojGXTC2CgCcq0Woc/dn12wQUlkNyfH0I1ABK4Ni9YXyFQa86Fkt2Q0nqgLfbhkyfQ6003i3qQk9pLh/SpAYw==",
583 | "cpu": [
584 | "s390x"
585 | ],
586 | "dev": true,
587 | "optional": true,
588 | "os": [
589 | "linux"
590 | ]
591 | },
592 | "node_modules/@rollup/rollup-linux-x64-gnu": {
593 | "version": "4.24.3",
594 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.24.3.tgz",
595 | "integrity": "sha512-mnEOh4iE4USSccBOtcrjF5nj+5/zm6NcNhbSEfR3Ot0pxBwvEn5QVUXcuOwwPkapDtGZ6pT02xLoPaNv06w7KQ==",
596 | "cpu": [
597 | "x64"
598 | ],
599 | "dev": true,
600 | "optional": true,
601 | "os": [
602 | "linux"
603 | ]
604 | },
605 | "node_modules/@rollup/rollup-linux-x64-musl": {
606 | "version": "4.24.3",
607 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.24.3.tgz",
608 | "integrity": "sha512-rMTzawBPimBQkG9NKpNHvquIUTQPzrnPxPbCY1Xt+mFkW7pshvyIS5kYgcf74goxXOQk0CP3EoOC1zcEezKXhw==",
609 | "cpu": [
610 | "x64"
611 | ],
612 | "dev": true,
613 | "optional": true,
614 | "os": [
615 | "linux"
616 | ]
617 | },
618 | "node_modules/@rollup/rollup-win32-arm64-msvc": {
619 | "version": "4.24.3",
620 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.24.3.tgz",
621 | "integrity": "sha512-2lg1CE305xNvnH3SyiKwPVsTVLCg4TmNCF1z7PSHX2uZY2VbUpdkgAllVoISD7JO7zu+YynpWNSKAtOrX3AiuA==",
622 | "cpu": [
623 | "arm64"
624 | ],
625 | "dev": true,
626 | "optional": true,
627 | "os": [
628 | "win32"
629 | ]
630 | },
631 | "node_modules/@rollup/rollup-win32-ia32-msvc": {
632 | "version": "4.24.3",
633 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.24.3.tgz",
634 | "integrity": "sha512-9SjYp1sPyxJsPWuhOCX6F4jUMXGbVVd5obVpoVEi8ClZqo52ViZewA6eFz85y8ezuOA+uJMP5A5zo6Oz4S5rVQ==",
635 | "cpu": [
636 | "ia32"
637 | ],
638 | "dev": true,
639 | "optional": true,
640 | "os": [
641 | "win32"
642 | ]
643 | },
644 | "node_modules/@rollup/rollup-win32-x64-msvc": {
645 | "version": "4.24.3",
646 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.24.3.tgz",
647 | "integrity": "sha512-HGZgRFFYrMrP3TJlq58nR1xy8zHKId25vhmm5S9jETEfDf6xybPxsavFTJaufe2zgOGYJBskGlj49CwtEuFhWQ==",
648 | "cpu": [
649 | "x64"
650 | ],
651 | "dev": true,
652 | "optional": true,
653 | "os": [
654 | "win32"
655 | ]
656 | },
657 | "node_modules/@types/estree": {
658 | "version": "1.0.6",
659 | "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
660 | "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==",
661 | "dev": true
662 | },
663 | "node_modules/bootstrap": {
664 | "version": "4.3.1",
665 | "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.3.1.tgz",
666 | "integrity": "sha512-rXqOmH1VilAt2DyPzluTi2blhk17bO7ef+zLLPlWvG494pDxcM234pJ8wTc/6R40UWizAIIMgxjvxZg5kmsbag==",
667 | "dev": true,
668 | "license": "MIT",
669 | "engines": {
670 | "node": ">=6"
671 | },
672 | "peerDependencies": {
673 | "jquery": "1.9.1 - 3",
674 | "popper.js": "^1.14.7"
675 | }
676 | },
677 | "node_modules/debounce": {
678 | "version": "2.2.0",
679 | "resolved": "https://registry.npmjs.org/debounce/-/debounce-2.2.0.tgz",
680 | "integrity": "sha512-Xks6RUDLZFdz8LIdR6q0MTH44k7FikOmnh5xkSjMig6ch45afc8sjTjRQf3P6ax8dMgcQrYO/AR2RGWURrruqw==",
681 | "engines": {
682 | "node": ">=18"
683 | },
684 | "funding": {
685 | "url": "https://github.com/sponsors/sindresorhus"
686 | }
687 | },
688 | "node_modules/esbuild": {
689 | "version": "0.21.5",
690 | "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
691 | "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
692 | "dev": true,
693 | "hasInstallScript": true,
694 | "bin": {
695 | "esbuild": "bin/esbuild"
696 | },
697 | "engines": {
698 | "node": ">=12"
699 | },
700 | "optionalDependencies": {
701 | "@esbuild/aix-ppc64": "0.21.5",
702 | "@esbuild/android-arm": "0.21.5",
703 | "@esbuild/android-arm64": "0.21.5",
704 | "@esbuild/android-x64": "0.21.5",
705 | "@esbuild/darwin-arm64": "0.21.5",
706 | "@esbuild/darwin-x64": "0.21.5",
707 | "@esbuild/freebsd-arm64": "0.21.5",
708 | "@esbuild/freebsd-x64": "0.21.5",
709 | "@esbuild/linux-arm": "0.21.5",
710 | "@esbuild/linux-arm64": "0.21.5",
711 | "@esbuild/linux-ia32": "0.21.5",
712 | "@esbuild/linux-loong64": "0.21.5",
713 | "@esbuild/linux-mips64el": "0.21.5",
714 | "@esbuild/linux-ppc64": "0.21.5",
715 | "@esbuild/linux-riscv64": "0.21.5",
716 | "@esbuild/linux-s390x": "0.21.5",
717 | "@esbuild/linux-x64": "0.21.5",
718 | "@esbuild/netbsd-x64": "0.21.5",
719 | "@esbuild/openbsd-x64": "0.21.5",
720 | "@esbuild/sunos-x64": "0.21.5",
721 | "@esbuild/win32-arm64": "0.21.5",
722 | "@esbuild/win32-ia32": "0.21.5",
723 | "@esbuild/win32-x64": "0.21.5"
724 | }
725 | },
726 | "node_modules/fsevents": {
727 | "version": "2.3.3",
728 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
729 | "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
730 | "dev": true,
731 | "hasInstallScript": true,
732 | "optional": true,
733 | "os": [
734 | "darwin"
735 | ],
736 | "engines": {
737 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
738 | }
739 | },
740 | "node_modules/idb": {
741 | "version": "8.0.0",
742 | "resolved": "https://registry.npmjs.org/idb/-/idb-8.0.0.tgz",
743 | "integrity": "sha512-l//qvlAKGmQO31Qn7xdzagVPPaHTxXx199MhrAFuVBTPqydcPYBWjkrbv4Y0ktB+GmWOiwHl237UUOrLmQxLvw=="
744 | },
745 | "node_modules/jquery": {
746 | "version": "3.7.1",
747 | "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz",
748 | "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==",
749 | "dev": true,
750 | "license": "MIT",
751 | "peer": true
752 | },
753 | "node_modules/leaflet": {
754 | "version": "1.9.4",
755 | "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz",
756 | "integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA=="
757 | },
758 | "node_modules/leaflet.offline": {
759 | "version": "3.1.0",
760 | "resolved": "https://registry.npmjs.org/leaflet.offline/-/leaflet.offline-3.1.0.tgz",
761 | "integrity": "sha512-dl3mzTEl1SnmzvJtJ0hVFLvlFX2wut/srvRAZ3A3g7Ee/RQkOo5zQ6tfVNhKe8N+adGXqcdEqEY9kgUxXCnEAw==",
762 | "dependencies": {
763 | "idb": "^7.1.1",
764 | "leaflet": "^1.6.0"
765 | },
766 | "engines": {
767 | "node": ">=16"
768 | }
769 | },
770 | "node_modules/leaflet.offline/node_modules/idb": {
771 | "version": "7.1.1",
772 | "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz",
773 | "integrity": "sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ=="
774 | },
775 | "node_modules/nanoid": {
776 | "version": "3.3.7",
777 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
778 | "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
779 | "dev": true,
780 | "funding": [
781 | {
782 | "type": "github",
783 | "url": "https://github.com/sponsors/ai"
784 | }
785 | ],
786 | "bin": {
787 | "nanoid": "bin/nanoid.cjs"
788 | },
789 | "engines": {
790 | "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
791 | }
792 | },
793 | "node_modules/picocolors": {
794 | "version": "1.1.1",
795 | "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
796 | "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
797 | "dev": true
798 | },
799 | "node_modules/popper.js": {
800 | "version": "1.16.1",
801 | "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz",
802 | "integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==",
803 | "deprecated": "You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1",
804 | "dev": true,
805 | "license": "MIT",
806 | "peer": true,
807 | "funding": {
808 | "type": "opencollective",
809 | "url": "https://opencollective.com/popperjs"
810 | }
811 | },
812 | "node_modules/postcss": {
813 | "version": "8.4.47",
814 | "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz",
815 | "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==",
816 | "dev": true,
817 | "funding": [
818 | {
819 | "type": "opencollective",
820 | "url": "https://opencollective.com/postcss/"
821 | },
822 | {
823 | "type": "tidelift",
824 | "url": "https://tidelift.com/funding/github/npm/postcss"
825 | },
826 | {
827 | "type": "github",
828 | "url": "https://github.com/sponsors/ai"
829 | }
830 | ],
831 | "dependencies": {
832 | "nanoid": "^3.3.7",
833 | "picocolors": "^1.1.0",
834 | "source-map-js": "^1.2.1"
835 | },
836 | "engines": {
837 | "node": "^10 || ^12 || >=14"
838 | }
839 | },
840 | "node_modules/prettier": {
841 | "version": "3.3.3",
842 | "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
843 | "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
844 | "dev": true,
845 | "license": "MIT",
846 | "bin": {
847 | "prettier": "bin/prettier.cjs"
848 | },
849 | "engines": {
850 | "node": ">=14"
851 | },
852 | "funding": {
853 | "url": "https://github.com/prettier/prettier?sponsor=1"
854 | }
855 | },
856 | "node_modules/rollup": {
857 | "version": "4.24.3",
858 | "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.24.3.tgz",
859 | "integrity": "sha512-HBW896xR5HGmoksbi3JBDtmVzWiPAYqp7wip50hjQ67JbDz61nyoMPdqu1DvVW9asYb2M65Z20ZHsyJCMqMyDg==",
860 | "dev": true,
861 | "dependencies": {
862 | "@types/estree": "1.0.6"
863 | },
864 | "bin": {
865 | "rollup": "dist/bin/rollup"
866 | },
867 | "engines": {
868 | "node": ">=18.0.0",
869 | "npm": ">=8.0.0"
870 | },
871 | "optionalDependencies": {
872 | "@rollup/rollup-android-arm-eabi": "4.24.3",
873 | "@rollup/rollup-android-arm64": "4.24.3",
874 | "@rollup/rollup-darwin-arm64": "4.24.3",
875 | "@rollup/rollup-darwin-x64": "4.24.3",
876 | "@rollup/rollup-freebsd-arm64": "4.24.3",
877 | "@rollup/rollup-freebsd-x64": "4.24.3",
878 | "@rollup/rollup-linux-arm-gnueabihf": "4.24.3",
879 | "@rollup/rollup-linux-arm-musleabihf": "4.24.3",
880 | "@rollup/rollup-linux-arm64-gnu": "4.24.3",
881 | "@rollup/rollup-linux-arm64-musl": "4.24.3",
882 | "@rollup/rollup-linux-powerpc64le-gnu": "4.24.3",
883 | "@rollup/rollup-linux-riscv64-gnu": "4.24.3",
884 | "@rollup/rollup-linux-s390x-gnu": "4.24.3",
885 | "@rollup/rollup-linux-x64-gnu": "4.24.3",
886 | "@rollup/rollup-linux-x64-musl": "4.24.3",
887 | "@rollup/rollup-win32-arm64-msvc": "4.24.3",
888 | "@rollup/rollup-win32-ia32-msvc": "4.24.3",
889 | "@rollup/rollup-win32-x64-msvc": "4.24.3",
890 | "fsevents": "~2.3.2"
891 | }
892 | },
893 | "node_modules/source-map-js": {
894 | "version": "1.2.1",
895 | "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
896 | "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
897 | "dev": true,
898 | "engines": {
899 | "node": ">=0.10.0"
900 | }
901 | },
902 | "node_modules/typescript": {
903 | "version": "5.6.3",
904 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
905 | "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
906 | "dev": true,
907 | "bin": {
908 | "tsc": "bin/tsc",
909 | "tsserver": "bin/tsserver"
910 | },
911 | "engines": {
912 | "node": ">=14.17"
913 | }
914 | },
915 | "node_modules/vite": {
916 | "version": "5.4.12",
917 | "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.12.tgz",
918 | "integrity": "sha512-KwUaKB27TvWwDJr1GjjWthLMATbGEbeWYZIbGZ5qFIsgPP3vWzLu4cVooqhm5/Z2SPDUMjyPVjTztm5tYKwQxA==",
919 | "dev": true,
920 | "license": "MIT",
921 | "dependencies": {
922 | "esbuild": "^0.21.3",
923 | "postcss": "^8.4.43",
924 | "rollup": "^4.20.0"
925 | },
926 | "bin": {
927 | "vite": "bin/vite.js"
928 | },
929 | "engines": {
930 | "node": "^18.0.0 || >=20.0.0"
931 | },
932 | "funding": {
933 | "url": "https://github.com/vitejs/vite?sponsor=1"
934 | },
935 | "optionalDependencies": {
936 | "fsevents": "~2.3.3"
937 | },
938 | "peerDependencies": {
939 | "@types/node": "^18.0.0 || >=20.0.0",
940 | "less": "*",
941 | "lightningcss": "^1.21.0",
942 | "sass": "*",
943 | "sass-embedded": "*",
944 | "stylus": "*",
945 | "sugarss": "*",
946 | "terser": "^5.4.0"
947 | },
948 | "peerDependenciesMeta": {
949 | "@types/node": {
950 | "optional": true
951 | },
952 | "less": {
953 | "optional": true
954 | },
955 | "lightningcss": {
956 | "optional": true
957 | },
958 | "sass": {
959 | "optional": true
960 | },
961 | "sass-embedded": {
962 | "optional": true
963 | },
964 | "stylus": {
965 | "optional": true
966 | },
967 | "sugarss": {
968 | "optional": true
969 | },
970 | "terser": {
971 | "optional": true
972 | }
973 | }
974 | }
975 | }
976 | }
977 |
--------------------------------------------------------------------------------
/examples/map-layers-and-control/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "map-layers-and-control",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "tsc && vite build",
9 | "preview": "vite preview",
10 | "format": "prettier -w ."
11 | },
12 | "devDependencies": {
13 | "bootstrap": "4.3",
14 | "prettier": "^3.3.3",
15 | "typescript": "~5.6.2",
16 | "vite": "^5.4.12"
17 | },
18 | "dependencies": {
19 | "@fortawesome/fontawesome-free": "^6.6.0",
20 | "@fortawesome/free-solid-svg-icons": "^6.6.0",
21 | "debounce": "^2.2.0",
22 | "idb": "^8.0.0",
23 | "leaflet": "^1.9.4",
24 | "leaflet.offline": "^3.1.0"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/examples/map-layers-and-control/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/examples/map-layers-and-control/src/main.ts:
--------------------------------------------------------------------------------
1 | import {
2 | tileLayerOffline,
3 | savetiles,
4 | SaveStatus,
5 | } from 'leaflet.offline';
6 | import { Control, Map } from 'leaflet';
7 | import debounce from 'debounce';
8 | import storageLayer from './storageLayer';
9 | import './style.css'
10 |
11 | const urlTemplate = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
12 |
13 | const leafletMap = new Map('map');
14 |
15 | // offline baselayer, will use offline source if available
16 | const baseLayer = tileLayerOffline(urlTemplate, {
17 | attribution: 'Map data {attribution.OpenStreetMap}',
18 | subdomains: 'abc',
19 | minZoom: 13,
20 | }).addTo(leafletMap);
21 |
22 | // add buttons to save tiles in area viewed
23 | const saveControl = savetiles(baseLayer, {
24 | zoomlevels: [13, 16], // optional zoomlevels to save, default current zoomlevel
25 | alwaysDownload: false,
26 | confirm(status: SaveStatus, successCallback: Function) {
27 | // eslint-disable-next-line no-alert
28 | if (window.confirm(`Save ${status._tilesforSave.length}`)) {
29 | successCallback();
30 | }
31 | },
32 | confirmRemoval(status: SaveStatus, successCallback: Function) {
33 | // eslint-disable-next-line no-alert
34 | if (window.confirm('Remove all the tiles?')) {
35 | successCallback();
36 | }
37 | },
38 | saveText: ' ',
39 | rmText: ' ',
40 | });
41 | saveControl.addTo(leafletMap);
42 |
43 | leafletMap.setView(
44 | {
45 | lat: 52.09,
46 | lng: 5.118,
47 | },
48 | 16,
49 | );
50 | // layer switcher control
51 | const layerswitcher = new Control.Layers(
52 | {
53 | 'osm (offline)': baseLayer,
54 | },
55 | undefined,
56 | { collapsed: false },
57 | ).addTo(leafletMap);
58 | // add storage overlay
59 | storageLayer(baseLayer, layerswitcher);
60 |
61 | // events while saving a tile layer
62 | let progress: number;
63 | let total: number;
64 | const showProgress = debounce(() => {
65 | document.getElementById('progressbar')!.style.width = `${
66 | (progress / total) * 100
67 | }%`;
68 | document.getElementById('progressbar')!.innerHTML = progress.toString();
69 | if (progress === total) {
70 | setTimeout(
71 | () =>
72 | document.getElementById('progress-wrapper')!.classList.remove('show'),
73 | 1000,
74 | );
75 | }
76 | }, 10);
77 |
78 | baseLayer.on('savestart', (e) => {
79 | progress = 0;
80 | // @ts-ignore
81 | total = e._tilesforSave.length;
82 | document.getElementById('progress-wrapper')!.classList.add('show');
83 | document.getElementById('progressbar')!.style.width = '0%';
84 | });
85 | baseLayer.on('loadtileend', () => {
86 | progress += 1;
87 | showProgress();
88 | });
89 |
--------------------------------------------------------------------------------
/examples/map-layers-and-control/src/storageLayer.ts:
--------------------------------------------------------------------------------
1 | import { geoJSON } from 'leaflet';
2 | import { getStorageInfo, getStoredTilesAsJson } from 'leaflet.offline';
3 |
4 | const urlTemplate = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
5 |
6 | export default function storageLayer(baseLayer, layerswitcher) {
7 | let layer;
8 |
9 | const getGeoJsonData = () =>
10 | getStorageInfo(urlTemplate).then((tiles) =>
11 | getStoredTilesAsJson(baseLayer.getTileSize(), tiles),
12 | );
13 |
14 | const addStorageLayer = () => {
15 | getGeoJsonData().then((geojson) => {
16 | layer = geoJSON(geojson).bindPopup(
17 | (clickedLayer) => clickedLayer.feature.properties.key,
18 | );
19 | layerswitcher.addOverlay(layer, 'offline tiles');
20 | });
21 | };
22 |
23 | addStorageLayer();
24 |
25 | baseLayer.on('storagesize', (e) => {
26 | document.getElementById('storage').innerHTML = e.storagesize;
27 | if (layer) {
28 | layer.clearLayers();
29 | getGeoJsonData().then((data) => {
30 | layer.addData(data);
31 | });
32 | }
33 | });
34 | }
35 |
--------------------------------------------------------------------------------
/examples/map-layers-and-control/src/style.css:
--------------------------------------------------------------------------------
1 | @import "bootstrap/dist/css/bootstrap.css";
2 | @import "leaflet/dist/leaflet.css";
3 |
4 | @import '/node_modules/@fortawesome/fontawesome-free/css/all.min.css';
5 |
--------------------------------------------------------------------------------
/examples/map-layers-and-control/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/examples/map-layers-and-control/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "module": "ESNext",
6 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
7 | "skipLibCheck": true,
8 |
9 | /* Bundler mode */
10 | "moduleResolution": "Bundler",
11 | "allowImportingTsExtensions": true,
12 | "isolatedModules": true,
13 | "moduleDetection": "force",
14 | "noEmit": true,
15 |
16 | /* Linting */
17 | "strict": true,
18 | "noUnusedLocals": true,
19 | "noUnusedParameters": true,
20 | "noFallthroughCasesInSwitch": true,
21 | "noUncheckedSideEffectImports": true
22 | },
23 | "include": ["src"]
24 | }
25 |
--------------------------------------------------------------------------------
/examples/map-wmts/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/examples/map-wmts/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Custom Layer (WMTS)
7 |
8 |
9 |
10 |
11 |
12 | This leaflet WMTS layer uses the download & save methods from the
13 | API
18 | to save all viewed tiles for offline usage.
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/examples/map-wmts/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "map-wmts",
3 | "version": "0.0.0",
4 | "lockfileVersion": 3,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "map-wmts",
9 | "version": "0.0.0",
10 | "devDependencies": {
11 | "bootstrap": "^5.3.3",
12 | "idb": "^8.0.0",
13 | "leaflet": "^1.9.4",
14 | "leaflet.offline": "^3.1.0",
15 | "prettier": "^3.3.3",
16 | "typescript": "~5.6.2",
17 | "vite": "^5.4.19"
18 | }
19 | },
20 | "node_modules/@esbuild/aix-ppc64": {
21 | "version": "0.21.5",
22 | "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",
23 | "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==",
24 | "cpu": [
25 | "ppc64"
26 | ],
27 | "dev": true,
28 | "license": "MIT",
29 | "optional": true,
30 | "os": [
31 | "aix"
32 | ],
33 | "engines": {
34 | "node": ">=12"
35 | }
36 | },
37 | "node_modules/@esbuild/android-arm": {
38 | "version": "0.21.5",
39 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz",
40 | "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==",
41 | "cpu": [
42 | "arm"
43 | ],
44 | "dev": true,
45 | "license": "MIT",
46 | "optional": true,
47 | "os": [
48 | "android"
49 | ],
50 | "engines": {
51 | "node": ">=12"
52 | }
53 | },
54 | "node_modules/@esbuild/android-arm64": {
55 | "version": "0.21.5",
56 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz",
57 | "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==",
58 | "cpu": [
59 | "arm64"
60 | ],
61 | "dev": true,
62 | "license": "MIT",
63 | "optional": true,
64 | "os": [
65 | "android"
66 | ],
67 | "engines": {
68 | "node": ">=12"
69 | }
70 | },
71 | "node_modules/@esbuild/android-x64": {
72 | "version": "0.21.5",
73 | "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz",
74 | "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==",
75 | "cpu": [
76 | "x64"
77 | ],
78 | "dev": true,
79 | "license": "MIT",
80 | "optional": true,
81 | "os": [
82 | "android"
83 | ],
84 | "engines": {
85 | "node": ">=12"
86 | }
87 | },
88 | "node_modules/@esbuild/darwin-arm64": {
89 | "version": "0.21.5",
90 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz",
91 | "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==",
92 | "cpu": [
93 | "arm64"
94 | ],
95 | "dev": true,
96 | "license": "MIT",
97 | "optional": true,
98 | "os": [
99 | "darwin"
100 | ],
101 | "engines": {
102 | "node": ">=12"
103 | }
104 | },
105 | "node_modules/@esbuild/darwin-x64": {
106 | "version": "0.21.5",
107 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz",
108 | "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==",
109 | "cpu": [
110 | "x64"
111 | ],
112 | "dev": true,
113 | "license": "MIT",
114 | "optional": true,
115 | "os": [
116 | "darwin"
117 | ],
118 | "engines": {
119 | "node": ">=12"
120 | }
121 | },
122 | "node_modules/@esbuild/freebsd-arm64": {
123 | "version": "0.21.5",
124 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz",
125 | "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==",
126 | "cpu": [
127 | "arm64"
128 | ],
129 | "dev": true,
130 | "license": "MIT",
131 | "optional": true,
132 | "os": [
133 | "freebsd"
134 | ],
135 | "engines": {
136 | "node": ">=12"
137 | }
138 | },
139 | "node_modules/@esbuild/freebsd-x64": {
140 | "version": "0.21.5",
141 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz",
142 | "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==",
143 | "cpu": [
144 | "x64"
145 | ],
146 | "dev": true,
147 | "license": "MIT",
148 | "optional": true,
149 | "os": [
150 | "freebsd"
151 | ],
152 | "engines": {
153 | "node": ">=12"
154 | }
155 | },
156 | "node_modules/@esbuild/linux-arm": {
157 | "version": "0.21.5",
158 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz",
159 | "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==",
160 | "cpu": [
161 | "arm"
162 | ],
163 | "dev": true,
164 | "license": "MIT",
165 | "optional": true,
166 | "os": [
167 | "linux"
168 | ],
169 | "engines": {
170 | "node": ">=12"
171 | }
172 | },
173 | "node_modules/@esbuild/linux-arm64": {
174 | "version": "0.21.5",
175 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz",
176 | "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==",
177 | "cpu": [
178 | "arm64"
179 | ],
180 | "dev": true,
181 | "license": "MIT",
182 | "optional": true,
183 | "os": [
184 | "linux"
185 | ],
186 | "engines": {
187 | "node": ">=12"
188 | }
189 | },
190 | "node_modules/@esbuild/linux-ia32": {
191 | "version": "0.21.5",
192 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz",
193 | "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==",
194 | "cpu": [
195 | "ia32"
196 | ],
197 | "dev": true,
198 | "license": "MIT",
199 | "optional": true,
200 | "os": [
201 | "linux"
202 | ],
203 | "engines": {
204 | "node": ">=12"
205 | }
206 | },
207 | "node_modules/@esbuild/linux-loong64": {
208 | "version": "0.21.5",
209 | "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz",
210 | "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==",
211 | "cpu": [
212 | "loong64"
213 | ],
214 | "dev": true,
215 | "license": "MIT",
216 | "optional": true,
217 | "os": [
218 | "linux"
219 | ],
220 | "engines": {
221 | "node": ">=12"
222 | }
223 | },
224 | "node_modules/@esbuild/linux-mips64el": {
225 | "version": "0.21.5",
226 | "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz",
227 | "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==",
228 | "cpu": [
229 | "mips64el"
230 | ],
231 | "dev": true,
232 | "license": "MIT",
233 | "optional": true,
234 | "os": [
235 | "linux"
236 | ],
237 | "engines": {
238 | "node": ">=12"
239 | }
240 | },
241 | "node_modules/@esbuild/linux-ppc64": {
242 | "version": "0.21.5",
243 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz",
244 | "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==",
245 | "cpu": [
246 | "ppc64"
247 | ],
248 | "dev": true,
249 | "license": "MIT",
250 | "optional": true,
251 | "os": [
252 | "linux"
253 | ],
254 | "engines": {
255 | "node": ">=12"
256 | }
257 | },
258 | "node_modules/@esbuild/linux-riscv64": {
259 | "version": "0.21.5",
260 | "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz",
261 | "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==",
262 | "cpu": [
263 | "riscv64"
264 | ],
265 | "dev": true,
266 | "license": "MIT",
267 | "optional": true,
268 | "os": [
269 | "linux"
270 | ],
271 | "engines": {
272 | "node": ">=12"
273 | }
274 | },
275 | "node_modules/@esbuild/linux-s390x": {
276 | "version": "0.21.5",
277 | "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz",
278 | "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==",
279 | "cpu": [
280 | "s390x"
281 | ],
282 | "dev": true,
283 | "license": "MIT",
284 | "optional": true,
285 | "os": [
286 | "linux"
287 | ],
288 | "engines": {
289 | "node": ">=12"
290 | }
291 | },
292 | "node_modules/@esbuild/linux-x64": {
293 | "version": "0.21.5",
294 | "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz",
295 | "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==",
296 | "cpu": [
297 | "x64"
298 | ],
299 | "dev": true,
300 | "license": "MIT",
301 | "optional": true,
302 | "os": [
303 | "linux"
304 | ],
305 | "engines": {
306 | "node": ">=12"
307 | }
308 | },
309 | "node_modules/@esbuild/netbsd-x64": {
310 | "version": "0.21.5",
311 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",
312 | "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==",
313 | "cpu": [
314 | "x64"
315 | ],
316 | "dev": true,
317 | "license": "MIT",
318 | "optional": true,
319 | "os": [
320 | "netbsd"
321 | ],
322 | "engines": {
323 | "node": ">=12"
324 | }
325 | },
326 | "node_modules/@esbuild/openbsd-x64": {
327 | "version": "0.21.5",
328 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz",
329 | "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==",
330 | "cpu": [
331 | "x64"
332 | ],
333 | "dev": true,
334 | "license": "MIT",
335 | "optional": true,
336 | "os": [
337 | "openbsd"
338 | ],
339 | "engines": {
340 | "node": ">=12"
341 | }
342 | },
343 | "node_modules/@esbuild/sunos-x64": {
344 | "version": "0.21.5",
345 | "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz",
346 | "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==",
347 | "cpu": [
348 | "x64"
349 | ],
350 | "dev": true,
351 | "license": "MIT",
352 | "optional": true,
353 | "os": [
354 | "sunos"
355 | ],
356 | "engines": {
357 | "node": ">=12"
358 | }
359 | },
360 | "node_modules/@esbuild/win32-arm64": {
361 | "version": "0.21.5",
362 | "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz",
363 | "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==",
364 | "cpu": [
365 | "arm64"
366 | ],
367 | "dev": true,
368 | "license": "MIT",
369 | "optional": true,
370 | "os": [
371 | "win32"
372 | ],
373 | "engines": {
374 | "node": ">=12"
375 | }
376 | },
377 | "node_modules/@esbuild/win32-ia32": {
378 | "version": "0.21.5",
379 | "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz",
380 | "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==",
381 | "cpu": [
382 | "ia32"
383 | ],
384 | "dev": true,
385 | "license": "MIT",
386 | "optional": true,
387 | "os": [
388 | "win32"
389 | ],
390 | "engines": {
391 | "node": ">=12"
392 | }
393 | },
394 | "node_modules/@esbuild/win32-x64": {
395 | "version": "0.21.5",
396 | "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz",
397 | "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==",
398 | "cpu": [
399 | "x64"
400 | ],
401 | "dev": true,
402 | "license": "MIT",
403 | "optional": true,
404 | "os": [
405 | "win32"
406 | ],
407 | "engines": {
408 | "node": ">=12"
409 | }
410 | },
411 | "node_modules/@popperjs/core": {
412 | "version": "2.11.8",
413 | "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
414 | "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==",
415 | "dev": true,
416 | "license": "MIT",
417 | "peer": true,
418 | "funding": {
419 | "type": "opencollective",
420 | "url": "https://opencollective.com/popperjs"
421 | }
422 | },
423 | "node_modules/@rollup/rollup-android-arm-eabi": {
424 | "version": "4.27.2",
425 | "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.27.2.tgz",
426 | "integrity": "sha512-Tj+j7Pyzd15wAdSJswvs5CJzJNV+qqSUcr/aCD+jpQSBtXvGnV0pnrjoc8zFTe9fcKCatkpFpOO7yAzpO998HA==",
427 | "cpu": [
428 | "arm"
429 | ],
430 | "dev": true,
431 | "license": "MIT",
432 | "optional": true,
433 | "os": [
434 | "android"
435 | ]
436 | },
437 | "node_modules/@rollup/rollup-android-arm64": {
438 | "version": "4.27.2",
439 | "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.27.2.tgz",
440 | "integrity": "sha512-xsPeJgh2ThBpUqlLgRfiVYBEf/P1nWlWvReG+aBWfNv3XEBpa6ZCmxSVnxJgLgkNz4IbxpLy64h2gCmAAQLneQ==",
441 | "cpu": [
442 | "arm64"
443 | ],
444 | "dev": true,
445 | "license": "MIT",
446 | "optional": true,
447 | "os": [
448 | "android"
449 | ]
450 | },
451 | "node_modules/@rollup/rollup-darwin-arm64": {
452 | "version": "4.27.2",
453 | "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.27.2.tgz",
454 | "integrity": "sha512-KnXU4m9MywuZFedL35Z3PuwiTSn/yqRIhrEA9j+7OSkji39NzVkgxuxTYg5F8ryGysq4iFADaU5osSizMXhU2A==",
455 | "cpu": [
456 | "arm64"
457 | ],
458 | "dev": true,
459 | "license": "MIT",
460 | "optional": true,
461 | "os": [
462 | "darwin"
463 | ]
464 | },
465 | "node_modules/@rollup/rollup-darwin-x64": {
466 | "version": "4.27.2",
467 | "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.27.2.tgz",
468 | "integrity": "sha512-Hj77A3yTvUeCIx/Vi+4d4IbYhyTwtHj07lVzUgpUq9YpJSEiGJj4vXMKwzJ3w5zp5v3PFvpJNgc/J31smZey6g==",
469 | "cpu": [
470 | "x64"
471 | ],
472 | "dev": true,
473 | "license": "MIT",
474 | "optional": true,
475 | "os": [
476 | "darwin"
477 | ]
478 | },
479 | "node_modules/@rollup/rollup-freebsd-arm64": {
480 | "version": "4.27.2",
481 | "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.27.2.tgz",
482 | "integrity": "sha512-RjgKf5C3xbn8gxvCm5VgKZ4nn0pRAIe90J0/fdHUsgztd3+Zesb2lm2+r6uX4prV2eUByuxJNdt647/1KPRq5g==",
483 | "cpu": [
484 | "arm64"
485 | ],
486 | "dev": true,
487 | "license": "MIT",
488 | "optional": true,
489 | "os": [
490 | "freebsd"
491 | ]
492 | },
493 | "node_modules/@rollup/rollup-freebsd-x64": {
494 | "version": "4.27.2",
495 | "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.27.2.tgz",
496 | "integrity": "sha512-duq21FoXwQtuws+V9H6UZ+eCBc7fxSpMK1GQINKn3fAyd9DFYKPJNcUhdIKOrMFjLEJgQskoMoiuizMt+dl20g==",
497 | "cpu": [
498 | "x64"
499 | ],
500 | "dev": true,
501 | "license": "MIT",
502 | "optional": true,
503 | "os": [
504 | "freebsd"
505 | ]
506 | },
507 | "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
508 | "version": "4.27.2",
509 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.27.2.tgz",
510 | "integrity": "sha512-6npqOKEPRZkLrMcvyC/32OzJ2srdPzCylJjiTJT2c0bwwSGm7nz2F9mNQ1WrAqCBZROcQn91Fno+khFhVijmFA==",
511 | "cpu": [
512 | "arm"
513 | ],
514 | "dev": true,
515 | "license": "MIT",
516 | "optional": true,
517 | "os": [
518 | "linux"
519 | ]
520 | },
521 | "node_modules/@rollup/rollup-linux-arm-musleabihf": {
522 | "version": "4.27.2",
523 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.27.2.tgz",
524 | "integrity": "sha512-V9Xg6eXtgBtHq2jnuQwM/jr2mwe2EycnopO8cbOvpzFuySCGtKlPCI3Hj9xup/pJK5Q0388qfZZy2DqV2J8ftw==",
525 | "cpu": [
526 | "arm"
527 | ],
528 | "dev": true,
529 | "license": "MIT",
530 | "optional": true,
531 | "os": [
532 | "linux"
533 | ]
534 | },
535 | "node_modules/@rollup/rollup-linux-arm64-gnu": {
536 | "version": "4.27.2",
537 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.27.2.tgz",
538 | "integrity": "sha512-uCFX9gtZJoQl2xDTpRdseYuNqyKkuMDtH6zSrBTA28yTfKyjN9hQ2B04N5ynR8ILCoSDOrG/Eg+J2TtJ1e/CSA==",
539 | "cpu": [
540 | "arm64"
541 | ],
542 | "dev": true,
543 | "license": "MIT",
544 | "optional": true,
545 | "os": [
546 | "linux"
547 | ]
548 | },
549 | "node_modules/@rollup/rollup-linux-arm64-musl": {
550 | "version": "4.27.2",
551 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.27.2.tgz",
552 | "integrity": "sha512-/PU9P+7Rkz8JFYDHIi+xzHabOu9qEWR07L5nWLIUsvserrxegZExKCi2jhMZRd0ATdboKylu/K5yAXbp7fYFvA==",
553 | "cpu": [
554 | "arm64"
555 | ],
556 | "dev": true,
557 | "license": "MIT",
558 | "optional": true,
559 | "os": [
560 | "linux"
561 | ]
562 | },
563 | "node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
564 | "version": "4.27.2",
565 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.27.2.tgz",
566 | "integrity": "sha512-eCHmol/dT5odMYi/N0R0HC8V8QE40rEpkyje/ZAXJYNNoSfrObOvG/Mn+s1F/FJyB7co7UQZZf6FuWnN6a7f4g==",
567 | "cpu": [
568 | "ppc64"
569 | ],
570 | "dev": true,
571 | "license": "MIT",
572 | "optional": true,
573 | "os": [
574 | "linux"
575 | ]
576 | },
577 | "node_modules/@rollup/rollup-linux-riscv64-gnu": {
578 | "version": "4.27.2",
579 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.27.2.tgz",
580 | "integrity": "sha512-DEP3Njr9/ADDln3kNi76PXonLMSSMiCir0VHXxmGSHxCxDfQ70oWjHcJGfiBugzaqmYdTC7Y+8Int6qbnxPBIQ==",
581 | "cpu": [
582 | "riscv64"
583 | ],
584 | "dev": true,
585 | "license": "MIT",
586 | "optional": true,
587 | "os": [
588 | "linux"
589 | ]
590 | },
591 | "node_modules/@rollup/rollup-linux-s390x-gnu": {
592 | "version": "4.27.2",
593 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.27.2.tgz",
594 | "integrity": "sha512-NHGo5i6IE/PtEPh5m0yw5OmPMpesFnzMIS/lzvN5vknnC1sXM5Z/id5VgcNPgpD+wHmIcuYYgW+Q53v+9s96lQ==",
595 | "cpu": [
596 | "s390x"
597 | ],
598 | "dev": true,
599 | "license": "MIT",
600 | "optional": true,
601 | "os": [
602 | "linux"
603 | ]
604 | },
605 | "node_modules/@rollup/rollup-linux-x64-gnu": {
606 | "version": "4.27.2",
607 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.27.2.tgz",
608 | "integrity": "sha512-PaW2DY5Tan+IFvNJGHDmUrORadbe/Ceh8tQxi8cmdQVCCYsLoQo2cuaSj+AU+YRX8M4ivS2vJ9UGaxfuNN7gmg==",
609 | "cpu": [
610 | "x64"
611 | ],
612 | "dev": true,
613 | "license": "MIT",
614 | "optional": true,
615 | "os": [
616 | "linux"
617 | ]
618 | },
619 | "node_modules/@rollup/rollup-linux-x64-musl": {
620 | "version": "4.27.2",
621 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.27.2.tgz",
622 | "integrity": "sha512-dOlWEMg2gI91Qx5I/HYqOD6iqlJspxLcS4Zlg3vjk1srE67z5T2Uz91yg/qA8sY0XcwQrFzWWiZhMNERylLrpQ==",
623 | "cpu": [
624 | "x64"
625 | ],
626 | "dev": true,
627 | "license": "MIT",
628 | "optional": true,
629 | "os": [
630 | "linux"
631 | ]
632 | },
633 | "node_modules/@rollup/rollup-win32-arm64-msvc": {
634 | "version": "4.27.2",
635 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.27.2.tgz",
636 | "integrity": "sha512-euMIv/4x5Y2/ImlbGl88mwKNXDsvzbWUlT7DFky76z2keajCtcbAsN9LUdmk31hAoVmJJYSThgdA0EsPeTr1+w==",
637 | "cpu": [
638 | "arm64"
639 | ],
640 | "dev": true,
641 | "license": "MIT",
642 | "optional": true,
643 | "os": [
644 | "win32"
645 | ]
646 | },
647 | "node_modules/@rollup/rollup-win32-ia32-msvc": {
648 | "version": "4.27.2",
649 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.27.2.tgz",
650 | "integrity": "sha512-RsnE6LQkUHlkC10RKngtHNLxb7scFykEbEwOFDjr3CeCMG+Rr+cKqlkKc2/wJ1u4u990urRHCbjz31x84PBrSQ==",
651 | "cpu": [
652 | "ia32"
653 | ],
654 | "dev": true,
655 | "license": "MIT",
656 | "optional": true,
657 | "os": [
658 | "win32"
659 | ]
660 | },
661 | "node_modules/@rollup/rollup-win32-x64-msvc": {
662 | "version": "4.27.2",
663 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.27.2.tgz",
664 | "integrity": "sha512-foJM5vv+z2KQmn7emYdDLyTbkoO5bkHZE1oth2tWbQNGW7mX32d46Hz6T0MqXdWS2vBZhaEtHqdy9WYwGfiliA==",
665 | "cpu": [
666 | "x64"
667 | ],
668 | "dev": true,
669 | "license": "MIT",
670 | "optional": true,
671 | "os": [
672 | "win32"
673 | ]
674 | },
675 | "node_modules/@types/estree": {
676 | "version": "1.0.6",
677 | "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
678 | "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==",
679 | "dev": true,
680 | "license": "MIT"
681 | },
682 | "node_modules/bootstrap": {
683 | "version": "5.3.3",
684 | "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.3.tgz",
685 | "integrity": "sha512-8HLCdWgyoMguSO9o+aH+iuZ+aht+mzW0u3HIMzVu7Srrpv7EBBxTnrFlSCskwdY1+EOFQSm7uMJhNQHkdPcmjg==",
686 | "dev": true,
687 | "funding": [
688 | {
689 | "type": "github",
690 | "url": "https://github.com/sponsors/twbs"
691 | },
692 | {
693 | "type": "opencollective",
694 | "url": "https://opencollective.com/bootstrap"
695 | }
696 | ],
697 | "license": "MIT",
698 | "peerDependencies": {
699 | "@popperjs/core": "^2.11.8"
700 | }
701 | },
702 | "node_modules/esbuild": {
703 | "version": "0.21.5",
704 | "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
705 | "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
706 | "dev": true,
707 | "hasInstallScript": true,
708 | "license": "MIT",
709 | "bin": {
710 | "esbuild": "bin/esbuild"
711 | },
712 | "engines": {
713 | "node": ">=12"
714 | },
715 | "optionalDependencies": {
716 | "@esbuild/aix-ppc64": "0.21.5",
717 | "@esbuild/android-arm": "0.21.5",
718 | "@esbuild/android-arm64": "0.21.5",
719 | "@esbuild/android-x64": "0.21.5",
720 | "@esbuild/darwin-arm64": "0.21.5",
721 | "@esbuild/darwin-x64": "0.21.5",
722 | "@esbuild/freebsd-arm64": "0.21.5",
723 | "@esbuild/freebsd-x64": "0.21.5",
724 | "@esbuild/linux-arm": "0.21.5",
725 | "@esbuild/linux-arm64": "0.21.5",
726 | "@esbuild/linux-ia32": "0.21.5",
727 | "@esbuild/linux-loong64": "0.21.5",
728 | "@esbuild/linux-mips64el": "0.21.5",
729 | "@esbuild/linux-ppc64": "0.21.5",
730 | "@esbuild/linux-riscv64": "0.21.5",
731 | "@esbuild/linux-s390x": "0.21.5",
732 | "@esbuild/linux-x64": "0.21.5",
733 | "@esbuild/netbsd-x64": "0.21.5",
734 | "@esbuild/openbsd-x64": "0.21.5",
735 | "@esbuild/sunos-x64": "0.21.5",
736 | "@esbuild/win32-arm64": "0.21.5",
737 | "@esbuild/win32-ia32": "0.21.5",
738 | "@esbuild/win32-x64": "0.21.5"
739 | }
740 | },
741 | "node_modules/fsevents": {
742 | "version": "2.3.3",
743 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
744 | "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
745 | "dev": true,
746 | "hasInstallScript": true,
747 | "license": "MIT",
748 | "optional": true,
749 | "os": [
750 | "darwin"
751 | ],
752 | "engines": {
753 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
754 | }
755 | },
756 | "node_modules/idb": {
757 | "version": "8.0.0",
758 | "resolved": "https://registry.npmjs.org/idb/-/idb-8.0.0.tgz",
759 | "integrity": "sha512-l//qvlAKGmQO31Qn7xdzagVPPaHTxXx199MhrAFuVBTPqydcPYBWjkrbv4Y0ktB+GmWOiwHl237UUOrLmQxLvw==",
760 | "dev": true,
761 | "license": "ISC"
762 | },
763 | "node_modules/leaflet": {
764 | "version": "1.9.4",
765 | "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz",
766 | "integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==",
767 | "dev": true,
768 | "license": "BSD-2-Clause"
769 | },
770 | "node_modules/leaflet.offline": {
771 | "version": "3.1.0",
772 | "resolved": "https://registry.npmjs.org/leaflet.offline/-/leaflet.offline-3.1.0.tgz",
773 | "integrity": "sha512-dl3mzTEl1SnmzvJtJ0hVFLvlFX2wut/srvRAZ3A3g7Ee/RQkOo5zQ6tfVNhKe8N+adGXqcdEqEY9kgUxXCnEAw==",
774 | "dev": true,
775 | "license": "ISC",
776 | "dependencies": {
777 | "idb": "^7.1.1",
778 | "leaflet": "^1.6.0"
779 | },
780 | "engines": {
781 | "node": ">=16"
782 | }
783 | },
784 | "node_modules/leaflet.offline/node_modules/idb": {
785 | "version": "7.1.1",
786 | "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz",
787 | "integrity": "sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==",
788 | "dev": true,
789 | "license": "ISC"
790 | },
791 | "node_modules/nanoid": {
792 | "version": "3.3.7",
793 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
794 | "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
795 | "dev": true,
796 | "funding": [
797 | {
798 | "type": "github",
799 | "url": "https://github.com/sponsors/ai"
800 | }
801 | ],
802 | "license": "MIT",
803 | "bin": {
804 | "nanoid": "bin/nanoid.cjs"
805 | },
806 | "engines": {
807 | "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
808 | }
809 | },
810 | "node_modules/picocolors": {
811 | "version": "1.1.1",
812 | "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
813 | "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
814 | "dev": true,
815 | "license": "ISC"
816 | },
817 | "node_modules/postcss": {
818 | "version": "8.4.49",
819 | "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz",
820 | "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==",
821 | "dev": true,
822 | "funding": [
823 | {
824 | "type": "opencollective",
825 | "url": "https://opencollective.com/postcss/"
826 | },
827 | {
828 | "type": "tidelift",
829 | "url": "https://tidelift.com/funding/github/npm/postcss"
830 | },
831 | {
832 | "type": "github",
833 | "url": "https://github.com/sponsors/ai"
834 | }
835 | ],
836 | "license": "MIT",
837 | "dependencies": {
838 | "nanoid": "^3.3.7",
839 | "picocolors": "^1.1.1",
840 | "source-map-js": "^1.2.1"
841 | },
842 | "engines": {
843 | "node": "^10 || ^12 || >=14"
844 | }
845 | },
846 | "node_modules/prettier": {
847 | "version": "3.3.3",
848 | "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
849 | "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
850 | "dev": true,
851 | "license": "MIT",
852 | "bin": {
853 | "prettier": "bin/prettier.cjs"
854 | },
855 | "engines": {
856 | "node": ">=14"
857 | },
858 | "funding": {
859 | "url": "https://github.com/prettier/prettier?sponsor=1"
860 | }
861 | },
862 | "node_modules/rollup": {
863 | "version": "4.27.2",
864 | "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.27.2.tgz",
865 | "integrity": "sha512-KreA+PzWmk2yaFmZVwe6GB2uBD86nXl86OsDkt1bJS9p3vqWuEQ6HnJJ+j/mZi/q0920P99/MVRlB4L3crpF5w==",
866 | "dev": true,
867 | "license": "MIT",
868 | "dependencies": {
869 | "@types/estree": "1.0.6"
870 | },
871 | "bin": {
872 | "rollup": "dist/bin/rollup"
873 | },
874 | "engines": {
875 | "node": ">=18.0.0",
876 | "npm": ">=8.0.0"
877 | },
878 | "optionalDependencies": {
879 | "@rollup/rollup-android-arm-eabi": "4.27.2",
880 | "@rollup/rollup-android-arm64": "4.27.2",
881 | "@rollup/rollup-darwin-arm64": "4.27.2",
882 | "@rollup/rollup-darwin-x64": "4.27.2",
883 | "@rollup/rollup-freebsd-arm64": "4.27.2",
884 | "@rollup/rollup-freebsd-x64": "4.27.2",
885 | "@rollup/rollup-linux-arm-gnueabihf": "4.27.2",
886 | "@rollup/rollup-linux-arm-musleabihf": "4.27.2",
887 | "@rollup/rollup-linux-arm64-gnu": "4.27.2",
888 | "@rollup/rollup-linux-arm64-musl": "4.27.2",
889 | "@rollup/rollup-linux-powerpc64le-gnu": "4.27.2",
890 | "@rollup/rollup-linux-riscv64-gnu": "4.27.2",
891 | "@rollup/rollup-linux-s390x-gnu": "4.27.2",
892 | "@rollup/rollup-linux-x64-gnu": "4.27.2",
893 | "@rollup/rollup-linux-x64-musl": "4.27.2",
894 | "@rollup/rollup-win32-arm64-msvc": "4.27.2",
895 | "@rollup/rollup-win32-ia32-msvc": "4.27.2",
896 | "@rollup/rollup-win32-x64-msvc": "4.27.2",
897 | "fsevents": "~2.3.2"
898 | }
899 | },
900 | "node_modules/source-map-js": {
901 | "version": "1.2.1",
902 | "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
903 | "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
904 | "dev": true,
905 | "license": "BSD-3-Clause",
906 | "engines": {
907 | "node": ">=0.10.0"
908 | }
909 | },
910 | "node_modules/typescript": {
911 | "version": "5.6.3",
912 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
913 | "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
914 | "dev": true,
915 | "license": "Apache-2.0",
916 | "bin": {
917 | "tsc": "bin/tsc",
918 | "tsserver": "bin/tsserver"
919 | },
920 | "engines": {
921 | "node": ">=14.17"
922 | }
923 | },
924 | "node_modules/vite": {
925 | "version": "5.4.19",
926 | "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.19.tgz",
927 | "integrity": "sha512-qO3aKv3HoQC8QKiNSTuUM1l9o/XX3+c+VTgLHbJWHZGeTPVAg2XwazI9UWzoxjIJCGCV2zU60uqMzjeLZuULqA==",
928 | "dev": true,
929 | "license": "MIT",
930 | "dependencies": {
931 | "esbuild": "^0.21.3",
932 | "postcss": "^8.4.43",
933 | "rollup": "^4.20.0"
934 | },
935 | "bin": {
936 | "vite": "bin/vite.js"
937 | },
938 | "engines": {
939 | "node": "^18.0.0 || >=20.0.0"
940 | },
941 | "funding": {
942 | "url": "https://github.com/vitejs/vite?sponsor=1"
943 | },
944 | "optionalDependencies": {
945 | "fsevents": "~2.3.3"
946 | },
947 | "peerDependencies": {
948 | "@types/node": "^18.0.0 || >=20.0.0",
949 | "less": "*",
950 | "lightningcss": "^1.21.0",
951 | "sass": "*",
952 | "sass-embedded": "*",
953 | "stylus": "*",
954 | "sugarss": "*",
955 | "terser": "^5.4.0"
956 | },
957 | "peerDependenciesMeta": {
958 | "@types/node": {
959 | "optional": true
960 | },
961 | "less": {
962 | "optional": true
963 | },
964 | "lightningcss": {
965 | "optional": true
966 | },
967 | "sass": {
968 | "optional": true
969 | },
970 | "sass-embedded": {
971 | "optional": true
972 | },
973 | "stylus": {
974 | "optional": true
975 | },
976 | "sugarss": {
977 | "optional": true
978 | },
979 | "terser": {
980 | "optional": true
981 | }
982 | }
983 | }
984 | }
985 | }
986 |
--------------------------------------------------------------------------------
/examples/map-wmts/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "map-wmts",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "tsc && vite build",
9 | "preview": "vite preview"
10 | },
11 | "devDependencies": {
12 | "bootstrap": "^5.3.3",
13 | "idb": "^8.0.0",
14 | "leaflet": "^1.9.4",
15 | "leaflet.offline": "^3.1.0",
16 | "prettier": "^3.3.3",
17 | "typescript": "~5.6.2",
18 | "vite": "^5.4.19"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/examples/map-wmts/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/examples/map-wmts/src/main.ts:
--------------------------------------------------------------------------------
1 | import { Map, tileLayer } from 'leaflet';
2 | import { getBlobByKey, downloadTile, saveTile } from 'leaflet.offline';
3 |
4 | import './style.css'
5 |
6 | export const wmtsUrlTemplate =
7 | 'https://service.pdok.nl/brt/achtergrondkaart/wmts/v2_0?service=WMTS&request=GetTile&version=1.0.0&tilematrixset=EPSG:3857&layer=standaard&tilematrix={z}&tilerow={y}&tilecol={x}&format=image%2Fpng';
8 |
9 | const leafletMap = new Map('map');
10 |
11 | const brtLayer = tileLayer(wmtsUrlTemplate);
12 |
13 | brtLayer.addTo(leafletMap);
14 |
15 | brtLayer.on('tileloadstart', (event) => {
16 | const { tile } = event;
17 | const url = tile.src;
18 | // reset tile.src, to not start download yet
19 | tile.src = '';
20 | getBlobByKey(url).then((blob) => {
21 | if (blob) {
22 | tile.src = URL.createObjectURL(blob);
23 | console.debug(`Loaded ${url} from idb`);
24 | return;
25 | }
26 | tile.src = url;
27 | // create helper function for it?
28 | const { x, y, z } = event.coords;
29 | const { _url: urlTemplate } = event.target;
30 | const tileInfo = {
31 | key: url,
32 | url,
33 | x,
34 | y,
35 | z,
36 | urlTemplate,
37 | createdAt: Date.now(),
38 | };
39 | downloadTile(url)
40 | .then((dl) => saveTile(tileInfo, dl))
41 | .then(() => console.debug(`Saved ${url} in idb`));
42 | });
43 | });
44 |
45 | leafletMap.setView(
46 | {
47 | lat: 52.09,
48 | lng: 5.118,
49 | },
50 | 16
51 | );
--------------------------------------------------------------------------------
/examples/map-wmts/src/style.css:
--------------------------------------------------------------------------------
1 | @import "bootstrap/dist/css/bootstrap.css";
2 | @import "leaflet/dist/leaflet.css";
--------------------------------------------------------------------------------
/examples/map-wmts/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/examples/map-wmts/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "module": "ESNext",
6 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
7 | "skipLibCheck": true,
8 |
9 | /* Bundler mode */
10 | "moduleResolution": "Bundler",
11 | "allowImportingTsExtensions": true,
12 | "isolatedModules": true,
13 | "moduleDetection": "force",
14 | "noEmit": true,
15 |
16 | /* Linting */
17 | "strict": true,
18 | "noUnusedLocals": true,
19 | "noUnusedParameters": true,
20 | "noFallthroughCasesInSwitch": true,
21 | "noUncheckedSideEffectImports": true
22 | },
23 | "include": ["src"]
24 | }
25 |
--------------------------------------------------------------------------------
/karma.conf.ts:
--------------------------------------------------------------------------------
1 | const typescript = require('@rollup/plugin-typescript');
2 | const { nodeResolve } = require('@rollup/plugin-node-resolve');
3 | const commonjs = require('@rollup/plugin-commonjs');
4 | const istanbul = require('rollup-plugin-istanbul');
5 |
6 | const extensions = ['.js', '.ts'];
7 |
8 | module.exports = (config) => {
9 | config.set({
10 | // base path that will be used to resolve all patterns (eg. files, exclude)
11 | basePath: '',
12 |
13 | // frameworks to use
14 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
15 | frameworks: ['mocha', 'chai'],
16 |
17 | // list of files / patterns to load in the browser
18 | files: ['node_modules/sinon/pkg/sinon.js', 'test/*.ts'],
19 |
20 | // list of files to exclude
21 | exclude: [],
22 |
23 | // preprocess matching files before serving them to the browser
24 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
25 | preprocessors: {
26 | 'test/*.ts': ['rollup'],
27 | },
28 | rollupPreprocessor: {
29 | output: {
30 | format: 'iife',
31 | name: 'LeafletOffline',
32 | sourcemap: 'inline',
33 | },
34 | external: ['sinon'],
35 | plugins: [
36 | commonjs(),
37 | nodeResolve({ extensions }),
38 | typescript({ declaration: false, declarationDir: undefined }),
39 | istanbul({ exclude: ['test/*.ts', 'node_modules/**/*'] }),
40 | ],
41 | },
42 |
43 | // test results reporter to use
44 | // possible values: 'dots', 'progress'
45 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter
46 | reporters: ['mocha', 'progress', 'coverage'],
47 |
48 | // web server port
49 | port: 9876,
50 |
51 | // enable / disable colors in the output (reporters and logs)
52 | colors: true,
53 |
54 | // level of logging
55 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
56 | logLevel: config.LOG_INFO,
57 |
58 | // enable / disable watching file and executing tests whenever any file changes
59 | autoWatch: true,
60 |
61 | // start these browsers
62 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
63 | browsers: ['FirefoxHeadless'],
64 |
65 | // Continuous Integration mode
66 | // if true, Karma captures browsers, runs the tests and exits
67 | singleRun: true,
68 |
69 | // Concurrency level
70 | // how many browser should be started simultaneous
71 | concurrency: Infinity,
72 |
73 | // damn ubuntu snap https://github.com/karma-runner/karma-firefox-launcher/issues/183#issuecomment-1283875784
74 | customLaunchers: {
75 | FirefoxHeadless: {
76 | base: 'Firefox',
77 | flags: ['-headless'],
78 | profile: require('path').join(__dirname, 'tmp'),
79 | },
80 | },
81 | coverageReporter: {
82 | reporters: [
83 | {
84 | type: 'html',
85 | dir: 'coverage/',
86 | },
87 | { type: 'lcov' },
88 | ],
89 | },
90 | });
91 | };
92 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "leaflet.offline",
3 | "version": "3.0.1",
4 | "description": "Offline tilelayer for leaflet",
5 | "main": "dist/bundle.js",
6 | "engines": {
7 | "node": ">=16"
8 | },
9 | "types": "dist/types/src/index.d.ts",
10 | "scripts": {
11 | "type-check": "tsc --noEmit",
12 | "docs": "typedoc --plugin typedoc-plugin-markdown --out docs/typedoc src/index.ts",
13 | "build": "rm -rf dist && rollup -c",
14 | "lint": "eslint && prettier --check \"./(src|test)/**/*.ts\"",
15 | "lint:fix": "eslint --fix src test",
16 | "format": "eslint --fix src test && prettier -w \"./(src|test)/**/*.ts\"",
17 | "test": "karma start",
18 | "test:watch": "karma start --no-single-run",
19 | "watch": "rollup -c -w",
20 | "preversion": "./node_modules/karma/bin/karma start --single-run",
21 | "prepare": "husky || true",
22 | "prepublishOnly": "npm run build && npx husky install"
23 | },
24 | "repository": {
25 | "type": "git",
26 | "url": "git+https://github.com/allartk/leaflet.offline.git"
27 | },
28 | "keywords": [
29 | "leaflet",
30 | "offline"
31 | ],
32 | "author": "Allart Kooiman",
33 | "license": "ISC",
34 | "bugs": {
35 | "url": "https://github.com/allartk/leaflet.offline/issues"
36 | },
37 | "homepage": "https://github.com/allartk/leaflet.offline#readme",
38 | "devDependencies": {
39 | "@commitlint/cli": "^19.3.0",
40 | "@commitlint/config-conventional": "^19.2.2",
41 | "@rollup/plugin-commonjs": "^25.0.2",
42 | "@rollup/plugin-node-resolve": "^15.0.2",
43 | "@rollup/plugin-typescript": "^11.1.5",
44 | "@types/geojson": "^7946.0.8",
45 | "@types/karma-chai": "^0.1.3",
46 | "@types/karma-chai-sinon": "^0.1.16",
47 | "@types/leaflet": "^1.7.9",
48 | "@types/mocha": "^10.0.7",
49 | "@types/sinon": "^17.0.3",
50 | "@typescript-eslint/eslint-plugin": "^5.13.0",
51 | "@typescript-eslint/parser": "^5.13.0",
52 | "chai": "^4.2.0",
53 | "eslint": "^8.11.0",
54 | "eslint-config-airbnb-base": "^15.0.0",
55 | "eslint-config-airbnb-typescript": "^17.0.0",
56 | "eslint-config-prettier": "^10.0.1",
57 | "fetch-mock": "^9.11.0",
58 | "husky": "^9.0.11",
59 | "karma": "^6.4.2",
60 | "karma-chai": "^0.1.0",
61 | "karma-coverage": "^2.2.1",
62 | "karma-firefox-launcher": "^2.1.2",
63 | "karma-mocha": "^2.0.1",
64 | "karma-mocha-reporter": "^2.2.5",
65 | "karma-rollup-preprocessor": "^7.0.5",
66 | "leaflet": "^1.7.1",
67 | "leaflet.vectorgrid": "^1.1.0",
68 | "lint-staged": "^15.0.2",
69 | "mocha": "^10.6.0",
70 | "npm-run-all": "^4.1.5",
71 | "prettier": "^3.0.3",
72 | "rollup": "^3.20.2",
73 | "rollup-plugin-istanbul": "^5.0.0",
74 | "sinon": "^18.0.0",
75 | "typedoc": "^0.26.4",
76 | "typedoc-plugin-markdown": "^3.11.14",
77 | "typescript": "^5.0.4"
78 | },
79 | "lint-staged": {
80 | "src/**/*.js": [
81 | "eslint --cache --fix",
82 | "prettier --write"
83 | ]
84 | },
85 | "dependencies": {
86 | "idb": "^8.0.2",
87 | "leaflet": "^1.6.0"
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/rollup.config.mjs:
--------------------------------------------------------------------------------
1 | import resolve from '@rollup/plugin-node-resolve';
2 | import pkg from './package.json' assert { type: 'json' };
3 | import typescript from '@rollup/plugin-typescript';
4 |
5 | const extensions = ['.ts'];
6 |
7 | export default {
8 | input: 'src/index.ts',
9 | output: {
10 | file: pkg.main,
11 | format: 'umd',
12 | name: 'LeafletOffline',
13 | globals: {
14 | leaflet: 'L',
15 | idb: 'idb',
16 | },
17 | },
18 | plugins: [resolve({ extensions }), typescript()],
19 | external: ['leaflet', 'idb'],
20 | };
21 |
--------------------------------------------------------------------------------
/src/ControlSaveTiles.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Control,
3 | ControlOptions,
4 | DomEvent,
5 | DomUtil,
6 | LatLngBounds,
7 | bounds,
8 | Map,
9 | } from 'leaflet';
10 | import { TileLayerOffline } from './TileLayerOffline';
11 | import {
12 | truncate,
13 | getStorageLength,
14 | downloadTile,
15 | saveTile,
16 | TileInfo,
17 | hasTile,
18 | } from './TileManager';
19 |
20 | export interface SaveTileOptions extends ControlOptions {
21 | saveText: string;
22 | rmText: string;
23 | maxZoom: number;
24 | saveWhatYouSee: boolean;
25 | bounds: LatLngBounds | null;
26 | confirm: ((status: SaveStatus, successCallback: Function) => void) | null;
27 | confirmRemoval:
28 | | ((status: SaveStatus, successCallback: Function) => void)
29 | | null;
30 | parallel: number;
31 | zoomlevels?: number[];
32 | alwaysDownload: boolean;
33 | }
34 |
35 | export interface SaveStatus {
36 | _tilesforSave: TileInfo[];
37 | storagesize: number;
38 | lengthToBeSaved: number;
39 | lengthSaved: number;
40 | lengthLoaded: number;
41 | }
42 |
43 | export class ControlSaveTiles extends Control {
44 | _map!: Map;
45 |
46 | _refocusOnMap!: DomEvent.EventHandlerFn;
47 |
48 | _baseLayer!: TileLayerOffline;
49 |
50 | options: SaveTileOptions;
51 |
52 | status: SaveStatus = {
53 | storagesize: 0,
54 | lengthToBeSaved: 0,
55 | lengthSaved: 0,
56 | lengthLoaded: 0,
57 | _tilesforSave: [],
58 | };
59 |
60 | constructor(baseLayer: TileLayerOffline, options: Partial) {
61 | super(options);
62 | this._baseLayer = baseLayer;
63 | this.setStorageSize();
64 | this.options = {
65 | ...{
66 | position: 'topleft',
67 | saveText: '+',
68 | rmText: '-',
69 | maxZoom: 19,
70 | saveWhatYouSee: false,
71 | bounds: null,
72 | confirm: null,
73 | confirmRemoval: null,
74 | parallel: 50,
75 | zoomlevels: undefined,
76 | alwaysDownload: true,
77 | },
78 | ...options,
79 | };
80 | }
81 |
82 | setStorageSize() {
83 | if (this.status.storagesize) {
84 | return Promise.resolve(this.status.storagesize);
85 | }
86 | return getStorageLength()
87 | .then((numberOfKeys) => {
88 | this.status.storagesize = numberOfKeys;
89 | this._baseLayer.fire('storagesize', this.status);
90 | return numberOfKeys;
91 | })
92 | .catch(() => 0);
93 | }
94 |
95 | getStorageSize(callback: Function) {
96 | this.setStorageSize().then((result) => {
97 | if (callback) {
98 | callback(result);
99 | }
100 | });
101 | }
102 |
103 | setLayer(layer: TileLayerOffline) {
104 | this._baseLayer = layer;
105 | }
106 |
107 | onAdd() {
108 | const container = DomUtil.create('div', 'savetiles leaflet-bar');
109 | const { options } = this;
110 | this._createButton(
111 | options.saveText,
112 | 'savetiles',
113 | container,
114 | this._saveTiles,
115 | );
116 | this._createButton(options.rmText, 'rmtiles', container, this._rmTiles);
117 | return container;
118 | }
119 |
120 | _createButton(
121 | html: string,
122 | className: string,
123 | container: HTMLElement,
124 | fn: DomEvent.EventHandlerFn,
125 | ) {
126 | const link = DomUtil.create('a', className, container);
127 | link.innerHTML = html;
128 | link.href = '#';
129 | link.ariaRoleDescription = 'button';
130 |
131 | DomEvent.on(link, 'mousedown dblclick', DomEvent.stopPropagation)
132 | .on(link, 'click', DomEvent.stop)
133 | .on(link, 'click', fn, this)
134 | .on(link, 'click', this._refocusOnMap, this);
135 |
136 | return link;
137 | }
138 |
139 | _saveTiles() {
140 | const tiles = this._calculateTiles();
141 | this._resetStatus(tiles);
142 | const successCallback = async () => {
143 | this._baseLayer.fire('savestart', this.status);
144 | const loader = async (): Promise => {
145 | const tile = tiles.shift();
146 | if (tile === undefined) {
147 | return Promise.resolve();
148 | }
149 | const blob = await this._loadTile(tile);
150 | if (blob) {
151 | await this._saveTile(tile, blob);
152 | }
153 | return loader();
154 | };
155 | const parallel = Math.min(tiles.length, this.options.parallel);
156 | for (let i = 0; i < parallel; i += 1) {
157 | loader();
158 | }
159 | };
160 | if (this.options.confirm) {
161 | this.options.confirm(this.status, successCallback);
162 | } else {
163 | successCallback();
164 | }
165 | }
166 |
167 | _calculateTiles() {
168 | let tiles: TileInfo[] = [];
169 | // minimum zoom to prevent the user from saving the whole world
170 | const minZoom = 5;
171 | // current zoom or zoom options
172 | let zoomlevels = [];
173 |
174 | if (this.options.saveWhatYouSee) {
175 | const currentZoom = this._map.getZoom();
176 | if (currentZoom < minZoom) {
177 | throw new Error(
178 | `It's not possible to save with zoom below level ${minZoom}.`,
179 | );
180 | }
181 | const { maxZoom } = this.options;
182 |
183 | for (let zoom = currentZoom; zoom <= maxZoom; zoom += 1) {
184 | zoomlevels.push(zoom);
185 | }
186 | } else {
187 | zoomlevels = this.options.zoomlevels || [this._map.getZoom()];
188 | }
189 |
190 | const latlngBounds = this.options.bounds || this._map.getBounds();
191 |
192 | for (let i = 0; i < zoomlevels.length; i += 1) {
193 | const area = bounds(
194 | this._map.project(latlngBounds.getNorthWest(), zoomlevels[i]),
195 | this._map.project(latlngBounds.getSouthEast(), zoomlevels[i]),
196 | );
197 | tiles = tiles.concat(this._baseLayer.getTileUrls(area, zoomlevels[i]));
198 | }
199 | return tiles;
200 | }
201 |
202 | _resetStatus(tiles: TileInfo[]) {
203 | this.status = {
204 | lengthLoaded: 0,
205 | lengthToBeSaved: tiles.length,
206 | lengthSaved: 0,
207 | _tilesforSave: tiles,
208 | storagesize: this.status.storagesize,
209 | };
210 | }
211 |
212 | async _loadTile(tile: TileInfo) {
213 | let blob;
214 | if (
215 | this.options.alwaysDownload === true ||
216 | (await hasTile(tile.key)) === false
217 | ) {
218 | blob = await downloadTile(tile.url);
219 | this.status.lengthLoaded += 1;
220 | }
221 | this.status.lengthLoaded += 1;
222 |
223 | this._baseLayer.fire('loadtileend', this.status);
224 | if (this.status.lengthLoaded === this.status.lengthToBeSaved) {
225 | this._baseLayer.fire('loadend', this.status);
226 | }
227 | return blob;
228 | }
229 |
230 | async _saveTile(tile: TileInfo, blob: Blob): Promise {
231 | await saveTile(tile, blob);
232 | this.status.lengthSaved += 1;
233 | this._baseLayer.fire('savetileend', this.status);
234 | if (this.status.lengthSaved === this.status.lengthToBeSaved) {
235 | this._baseLayer.fire('saveend', this.status);
236 | this.setStorageSize();
237 | }
238 | }
239 |
240 | _rmTiles() {
241 | const successCallback = () => {
242 | truncate().then(() => {
243 | this.status.storagesize = 0;
244 | this._baseLayer.fire('tilesremoved');
245 | this._baseLayer.fire('storagesize', this.status);
246 | });
247 | };
248 | if (this.options.confirmRemoval) {
249 | this.options.confirmRemoval(this.status, successCallback);
250 | } else {
251 | successCallback();
252 | }
253 | }
254 | }
255 |
256 | export function savetiles(
257 | baseLayer: TileLayerOffline,
258 | options: Partial,
259 | ) {
260 | return new ControlSaveTiles(baseLayer, options);
261 | }
262 |
263 | /** @ts-ignore */
264 | if (window.L) {
265 | /** @ts-ignore */
266 | window.L.control.savetiles = savetiles;
267 | }
268 |
--------------------------------------------------------------------------------
/src/TileLayerOffline.ts:
--------------------------------------------------------------------------------
1 | import {
2 | Bounds,
3 | Coords,
4 | DomEvent,
5 | DoneCallback,
6 | TileLayer,
7 | TileLayerOptions,
8 | Util,
9 | } from 'leaflet';
10 | import {
11 | getTileUrl,
12 | TileInfo,
13 | getTilePoints,
14 | getTileImageSource,
15 | } from './TileManager';
16 |
17 | export class TileLayerOffline extends TileLayer {
18 | _url!: string;
19 |
20 | createTile(coords: Coords, done: DoneCallback): HTMLElement {
21 | const tile = document.createElement('img');
22 |
23 | DomEvent.on(tile, 'load', Util.bind(this._tileOnLoad, this, done, tile));
24 | DomEvent.on(tile, 'error', Util.bind(this._tileOnError, this, done, tile));
25 |
26 | if (this.options.crossOrigin || this.options.crossOrigin === '') {
27 | tile.crossOrigin =
28 | this.options.crossOrigin === true ? '' : this.options.crossOrigin;
29 | }
30 |
31 | tile.alt = '';
32 |
33 | tile.setAttribute('role', 'presentation');
34 |
35 | getTileImageSource(
36 | this._getStorageKey(coords),
37 | this.getTileUrl(coords),
38 | ).then((src) => (tile.src = src));
39 |
40 | return tile;
41 | }
42 |
43 | /**
44 | * get key to use for storage
45 | * @private
46 | * @param {string} url url used to load tile
47 | * @return {string} unique identifier.
48 | */
49 | _getStorageKey(coords: { x: number; y: number; z: number }) {
50 | return getTileUrl(this._url, {
51 | ...coords,
52 | ...this.options,
53 | // @ts-ignore: Possibly undefined
54 | s: this.options.subdomains['0'],
55 | });
56 | }
57 |
58 | /**
59 | * Get tileinfo for zoomlevel & bounds
60 | */
61 | getTileUrls(bounds: Bounds, zoom: number): TileInfo[] {
62 | const tiles: TileInfo[] = [];
63 | const tilePoints = getTilePoints(bounds, this.getTileSize());
64 | for (let index = 0; index < tilePoints.length; index += 1) {
65 | const tilePoint = tilePoints[index];
66 | const data = {
67 | ...this.options,
68 | x: tilePoint.x,
69 | y: tilePoint.y,
70 | z: zoom + (this.options.zoomOffset || 0),
71 | };
72 | tiles.push({
73 | key: getTileUrl(this._url, {
74 | ...data,
75 | s: this.options.subdomains?.[0],
76 | }),
77 | url: getTileUrl(this._url, {
78 | ...data,
79 | // @ts-ignore: Undefined
80 | s: this._getSubdomain(tilePoint),
81 | }),
82 | z: zoom,
83 | x: tilePoint.x,
84 | y: tilePoint.y,
85 | urlTemplate: this._url,
86 | createdAt: Date.now(),
87 | });
88 | }
89 | return tiles;
90 | }
91 | }
92 |
93 | export function tileLayerOffline(url: string, options: TileLayerOptions) {
94 | return new TileLayerOffline(url, options);
95 | }
96 |
97 | /** @ts-ignore */
98 | if (window.L) {
99 | /** @ts-ignore */
100 | window.L.tileLayer.offline = tileLayerOffline;
101 | }
102 |
--------------------------------------------------------------------------------
/src/TileManager.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Api methods used in control and layer
3 | * For advanced usage
4 | *
5 | * @module TileManager
6 | *
7 | */
8 |
9 | import { Bounds, Browser, CRS, Point, Util } from 'leaflet';
10 | import { openDB, deleteDB, IDBPDatabase } from 'idb';
11 | import { FeatureCollection, Polygon } from 'geojson';
12 |
13 | export type TileInfo = {
14 | key: string;
15 | url: string;
16 | urlTemplate: string;
17 | x: number;
18 | y: number;
19 | z: number;
20 | createdAt: number;
21 | };
22 |
23 | export type StoredTile = TileInfo & { blob: Blob };
24 |
25 | const tileStoreName = 'tileStore';
26 | const urlTemplateIndex = 'urlTemplate';
27 | let dbPromise: Promise | undefined;
28 |
29 | export function openTilesDataBase(): Promise {
30 | if (dbPromise) {
31 | return dbPromise;
32 | }
33 | dbPromise = openDB('leaflet.offline', 2, {
34 | upgrade(db, oldVersion) {
35 | deleteDB('leaflet_offline');
36 | deleteDB('leaflet_offline_areas');
37 |
38 | if (oldVersion < 1) {
39 | const tileStore = db.createObjectStore(tileStoreName, {
40 | keyPath: 'key',
41 | });
42 | tileStore.createIndex(urlTemplateIndex, 'urlTemplate');
43 | tileStore.createIndex('z', 'z');
44 | }
45 | },
46 | });
47 | return dbPromise;
48 | }
49 |
50 | /**
51 | * @example
52 | * ```js
53 | * import { getStorageLength } from 'leaflet.offline'
54 | * getStorageLength().then(i => console.log(i + 'tiles in storage'))
55 | * ```
56 | */
57 | export async function getStorageLength(): Promise {
58 | const db = await openTilesDataBase();
59 | return db.count(tileStoreName);
60 | }
61 |
62 | /**
63 | * @example
64 | * ```js
65 | * import { getStorageInfo } from 'leaflet.offline'
66 | * getStorageInfo('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png')
67 | * ```
68 | */
69 | export async function getStorageInfo(
70 | urlTemplate: string,
71 | ): Promise {
72 | const range = IDBKeyRange.only(urlTemplate);
73 | const db = await openTilesDataBase();
74 | return db.getAllFromIndex(tileStoreName, urlTemplateIndex, range);
75 | }
76 |
77 | /**
78 | * @example
79 | * ```js
80 | * import { downloadTile } from 'leaflet.offline'
81 | * downloadTile(tileInfo.url).then(blob => saveTile(tileInfo, blob))
82 | * ```
83 | */
84 | export async function downloadTile(tileUrl: string): Promise {
85 | const response = await fetch(tileUrl);
86 | if (!response.ok) {
87 | throw new Error(`Request failed with status ${response.statusText}`);
88 | }
89 | return response.blob();
90 | }
91 | /**
92 | * @example
93 | * ```js
94 | * saveTile(tileInfo, blob).then(() => console.log(`saved tile from ${tileInfo.url}`))
95 | * ```
96 | */
97 | export async function saveTile(
98 | tileInfo: TileInfo,
99 | blob: Blob,
100 | ): Promise {
101 | const db = await openTilesDataBase();
102 | return db.put(tileStoreName, {
103 | blob,
104 | ...tileInfo,
105 | });
106 | }
107 |
108 | export function getTileUrl(urlTemplate: string, data: any): string {
109 | return Util.template(urlTemplate, {
110 | ...data,
111 | r: Browser.retina ? '@2x' : '',
112 | });
113 | }
114 |
115 | export function getTilePoints(area: Bounds, tileSize: Point): Point[] {
116 | const points: Point[] = [];
117 | if (!area.min || !area.max) {
118 | return points;
119 | }
120 | const topLeftTile = area.min.divideBy(tileSize.x).floor();
121 | const bottomRightTile = area.max.divideBy(tileSize.x).floor();
122 |
123 | for (let j = topLeftTile.y; j <= bottomRightTile.y; j += 1) {
124 | for (let i = topLeftTile.x; i <= bottomRightTile.x; i += 1) {
125 | points.push(new Point(i, j));
126 | }
127 | }
128 | return points;
129 | }
130 | /**
131 | * Get a geojson of tiles from one resource
132 | *
133 | * @example
134 | * const urlTemplate = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
135 | * const getGeoJsonData = () => LeafletOffline.getStorageInfo(urlTemplate)
136 | * .then((data) => LeafletOffline.getStoredTilesAsJson(baseLayer, data));
137 | *
138 | * getGeoJsonData().then((geojson) => {
139 | * storageLayer = L.geoJSON(geojson).bindPopup(
140 | * (clickedLayer) => clickedLayer.feature.properties.key,
141 | * );
142 | * });
143 | *
144 | */
145 | export function getStoredTilesAsJson(
146 | tileSize: { x: number; y: number },
147 | tiles: TileInfo[],
148 | ): FeatureCollection {
149 | const featureCollection: FeatureCollection = {
150 | type: 'FeatureCollection',
151 | features: [],
152 | };
153 | for (let i = 0; i < tiles.length; i += 1) {
154 | const topLeftPoint = new Point(
155 | tiles[i].x * tileSize.x,
156 | tiles[i].y * tileSize.y,
157 | );
158 | const bottomRightPoint = new Point(
159 | topLeftPoint.x + tileSize.x,
160 | topLeftPoint.y + tileSize.y,
161 | );
162 |
163 | const topLeftlatlng = CRS.EPSG3857.pointToLatLng(topLeftPoint, tiles[i].z);
164 | const botRightlatlng = CRS.EPSG3857.pointToLatLng(
165 | bottomRightPoint,
166 | tiles[i].z,
167 | );
168 | featureCollection.features.push({
169 | type: 'Feature',
170 | properties: tiles[i],
171 | geometry: {
172 | type: 'Polygon',
173 | coordinates: [
174 | [
175 | [topLeftlatlng.lng, topLeftlatlng.lat],
176 | [botRightlatlng.lng, topLeftlatlng.lat],
177 | [botRightlatlng.lng, botRightlatlng.lat],
178 | [topLeftlatlng.lng, botRightlatlng.lat],
179 | [topLeftlatlng.lng, topLeftlatlng.lat],
180 | ],
181 | ],
182 | },
183 | });
184 | }
185 |
186 | return featureCollection;
187 | }
188 |
189 | /**
190 | * Remove tile by key
191 | */
192 | export async function removeTile(key: string): Promise {
193 | const db = await openTilesDataBase();
194 | return db.delete(tileStoreName, key);
195 | }
196 |
197 | /**
198 | * Get single tile blob
199 | */
200 | export async function getBlobByKey(key: string): Promise {
201 | return (await openTilesDataBase())
202 | .get(tileStoreName, key)
203 | .then((result) => result && result.blob);
204 | }
205 |
206 | export async function hasTile(key: string): Promise {
207 | const db = await openTilesDataBase();
208 | const result = await db.getKey(tileStoreName, key);
209 | return result !== undefined;
210 | }
211 |
212 | /**
213 | * Remove everything
214 | */
215 | export async function truncate(): Promise {
216 | return (await openTilesDataBase()).clear(tileStoreName);
217 | }
218 |
219 | export async function getTileImageSource(key: string, url: string) {
220 | const shouldUseUrl = !(await hasTile(key));
221 | if (shouldUseUrl) {
222 | return url;
223 | }
224 | const blob = await getBlobByKey(key);
225 | return URL.createObjectURL(blob);
226 | }
227 |
--------------------------------------------------------------------------------
/src/images/save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/allartk/leaflet.offline/c07f6bb7d91e94c3edcf901e2d34a3840044d4e2/src/images/save.png
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | export { tileLayerOffline } from './TileLayerOffline';
2 | export { savetiles } from './ControlSaveTiles';
3 | export type {
4 | SaveStatus,
5 | ControlSaveTiles,
6 | SaveTileOptions,
7 | } from './ControlSaveTiles';
8 | export type { TileInfo, StoredTile } from './TileManager';
9 | export type { TileLayerOffline } from './TileLayerOffline';
10 | export {
11 | getStorageInfo,
12 | getStorageLength,
13 | getStoredTilesAsJson,
14 | removeTile,
15 | truncate,
16 | downloadTile,
17 | saveTile,
18 | hasTile,
19 | getBlobByKey,
20 | getTilePoints,
21 | getTileUrl,
22 | getTileImageSource,
23 | } from './TileManager';
24 |
--------------------------------------------------------------------------------
/test/ControlSaveTilesTest.ts:
--------------------------------------------------------------------------------
1 | import { Map } from 'leaflet';
2 | import { ControlSaveTiles, savetiles } from '../src/ControlSaveTiles';
3 | import { TileLayerOffline } from '../src/TileLayerOffline';
4 |
5 | describe('control with defaults', () => {
6 | let saveControl: ControlSaveTiles;
7 | let baseLayer: TileLayerOffline;
8 | beforeEach(() => {
9 | const leafletMap = new Map(document.createElement('div'));
10 | leafletMap.setView(
11 | {
12 | lat: 51.985,
13 | lng: 5,
14 | },
15 | 16,
16 | );
17 | baseLayer = new TileLayerOffline(
18 | 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
19 | {
20 | subdomains: 'abc',
21 | },
22 | ).addTo(leafletMap);
23 | saveControl = savetiles(baseLayer, {});
24 | saveControl.addTo(leafletMap);
25 | saveControl._rmTiles();
26 | });
27 | it('exists', () => {
28 | assert.ok(savetiles);
29 | });
30 | it('adds button', () => {
31 | const div = saveControl.onAdd();
32 | assert.ok(div);
33 | assert.lengthOf(div.querySelectorAll('a'), 2);
34 | });
35 | it('calculates storagesize', () =>
36 | saveControl.setStorageSize().then((n) => {
37 | assert.equal(n, 0);
38 | }));
39 | it('_saveTiles sets status', () => {
40 | const stub = sinon
41 | .stub(saveControl, '_loadTile')
42 | .returns(Promise.resolve(new Blob()));
43 | const resetstub = sinon.stub(saveControl, '_resetStatus');
44 | saveControl._saveTiles();
45 | assert.isObject(saveControl.status);
46 | assert.isTrue(resetstub.calledOnce);
47 | stub.resetBehavior();
48 | resetstub.resetBehavior();
49 | });
50 | it('_saveTiles fires savestart with _tilesforSave prop', (done) => {
51 | const stub = sinon
52 | .stub(saveControl, '_loadTile')
53 | .returns(Promise.resolve(new Blob()));
54 | baseLayer.on('savestart', (status) => {
55 | // TODO
56 | // @ts-ignore
57 | assert.lengthOf(status._tilesforSave, 1);
58 | stub.resetBehavior();
59 | done();
60 | });
61 | saveControl._saveTiles();
62 | });
63 |
64 | it('_saveTiles calls loadTile for each tile', () => {
65 | const stub = sinon
66 | .stub(saveControl, '_loadTile')
67 | .returns(Promise.resolve(new Blob()));
68 | saveControl._saveTiles();
69 | assert.equal(
70 | stub.callCount,
71 | 1,
72 | `_loadTile has been called ${stub.callCount} times`,
73 | );
74 | stub.resetBehavior();
75 | });
76 | });
77 |
78 | describe('control with different options', () => {
79 | let leafletMap: Map;
80 | let baseLayer: TileLayerOffline;
81 | beforeEach(() => {
82 | leafletMap = new Map(document.createElement('div'));
83 | leafletMap.setView(
84 | {
85 | lat: 51.985,
86 | lng: 5,
87 | },
88 | 16,
89 | );
90 | baseLayer = new TileLayerOffline(
91 | 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
92 | {
93 | subdomains: 'abc',
94 | },
95 | ).addTo(leafletMap);
96 | });
97 | it('_saveTiles calculates tiles for 2 zoomlevels', () => {
98 | const c = savetiles(baseLayer, {
99 | zoomlevels: [16, 17],
100 | });
101 | c.addTo(leafletMap);
102 | c._rmTiles();
103 | const stub = sinon
104 | .stub(c, '_loadTile')
105 | .returns(Promise.resolve(new Blob()));
106 | c._saveTiles();
107 | assert.isObject(c.status);
108 | assert.isArray(c.status._tilesforSave);
109 | assert.isAbove(stub.callCount, 1);
110 | stub.resetBehavior();
111 | });
112 | it('_saveTiles calcs tiles for saveWhatYouSee', () => {
113 | const c = savetiles(baseLayer, {
114 | saveWhatYouSee: true,
115 | });
116 | c.addTo(leafletMap);
117 | c._rmTiles();
118 | const stub = sinon
119 | .stub(c, '_loadTile')
120 | .returns(Promise.resolve(new Blob()));
121 | c._saveTiles();
122 | assert.isObject(c.status);
123 | assert.isArray(c.status._tilesforSave);
124 | assert.equal(
125 | stub.callCount,
126 | 4,
127 | `_loadTile has been called ${stub.callCount} times`,
128 | );
129 | stub.resetBehavior();
130 | });
131 | it('calls confirm', () => {
132 | const callback = sinon.spy();
133 | const c = savetiles(baseLayer, {
134 | confirm: callback,
135 | });
136 | c.addTo(leafletMap);
137 | c._rmTiles();
138 | c._saveTiles();
139 | assert(callback.calledOnce);
140 | });
141 | });
142 |
--------------------------------------------------------------------------------
/test/TileLayerTest.ts:
--------------------------------------------------------------------------------
1 | import { Bounds, Point } from 'leaflet';
2 | import { TileLayerOffline } from '../src/TileLayerOffline';
3 |
4 | describe('TileLayer.Offline', () => {
5 | it('createTile', () => {
6 | const url = 'http://a.tile.openstreetmap.org/{z}/{x}/{y}.png';
7 | const layer = new TileLayerOffline(url);
8 | // @ts-ignore
9 | const tile = layer.createTile({ x: 123456, y: 456789, z: 16 }, () => {});
10 | assert.instanceOf(tile, HTMLElement);
11 | });
12 | it('get storagekey openstreetmap', () => {
13 | const layer = new TileLayerOffline(
14 | 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
15 | );
16 | const key = layer._getStorageKey({ z: 16, x: 123456, y: 456789 });
17 | assert.equal(key, 'http://a.tile.openstreetmap.org/16/123456/456789.png');
18 | });
19 | it('get storagekey cartodb', () => {
20 | const layer = new TileLayerOffline(
21 | 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
22 | );
23 | const key = layer._getStorageKey({ z: 16, x: 123456, y: 456789 });
24 | assert.equal(
25 | key,
26 | 'https://cartodb-basemaps-a.global.ssl.fastly.net/light_all/16/123456/456789.png',
27 | );
28 | });
29 | it('get storagekey mapbox with accessToken', () => {
30 | const layer = new TileLayerOffline(
31 | 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}',
32 | {
33 | id: 'mapbox.streets',
34 | accessToken: 'xyz',
35 | },
36 | );
37 | const key = layer._getStorageKey({ z: 16, x: 123456, y: 456789 });
38 | assert.equal(
39 | key,
40 | 'https://api.tiles.mapbox.com/v4/mapbox.streets/16/123456/456789.png?access_token=xyz',
41 | );
42 | });
43 | it('calculates tiles at level 16', () => {
44 | const layer = new TileLayerOffline(
45 | 'http://a.tile.openstreetmap.org/{z}/{x}/{y}.png',
46 | );
47 | const bounds = new Bounds(
48 | new Point(8621975, 5543267.999999999),
49 | new Point(8621275, 5542538),
50 | );
51 | const tiles = layer.getTileUrls(bounds, 16);
52 | assert.lengthOf(tiles, 16);
53 | const urls = tiles.map((t) => t.url);
54 | assert.include(urls, 'http://a.tile.openstreetmap.org/16/33677/21651.png');
55 | const keys = tiles.map((t) => t.key);
56 | assert.include(keys, 'http://a.tile.openstreetmap.org/16/33677/21651.png');
57 | });
58 |
59 | it('calculates tile urls,keys at level 16 with subdomains', () => {
60 | const layer = new TileLayerOffline(
61 | 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
62 | );
63 | const bounds = new Bounds(
64 | new Point(8621975, 5543267.999999999),
65 | new Point(8621275, 5542538),
66 | );
67 | const tiles = layer.getTileUrls(bounds, 16);
68 | assert.lengthOf(tiles, 16);
69 | const urls = tiles.map((t) => t.url.replace(/[abc]\./, ''));
70 | assert.include(urls, 'http://tile.openstreetmap.org/16/33677/21651.png');
71 | const keys = tiles.map((t) => t.key);
72 | assert.include(keys, 'http://a.tile.openstreetmap.org/16/33677/21651.png');
73 | });
74 |
75 | it('uses subdomains for url and not for key', () => {
76 | const layer = new TileLayerOffline(
77 | 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
78 | );
79 | const bounds = new Bounds(
80 | new Point(8621975, 5543267.999999999),
81 | new Point(8621275, 5542538),
82 | );
83 | const tiles = layer.getTileUrls(bounds, 16);
84 | const subs = tiles.map((t) => t.url.match(/([abc])\./)?.[1]);
85 | assert.include(subs, 'a');
86 | assert.include(subs, 'b');
87 | assert.include(subs, 'c');
88 | const subskeys = tiles.map((t) => t.key.match(/([abc])\./)?.[1]);
89 | assert.include(subskeys, 'a');
90 | assert.notInclude(subskeys, 'b');
91 | assert.notInclude(subskeys, 'c');
92 | });
93 |
94 | it('calculates openstreetmap tiles at level 16', () => {
95 | const layer = new TileLayerOffline(
96 | 'http://a.tile.openstreetmap.org/{z}/{x}/{y}.png',
97 | );
98 | const bounds = new Bounds(
99 | new Point(8621975, 5543267.999999999),
100 | new Point(8621275, 5542538),
101 | );
102 | const tiles = layer.getTileUrls(bounds, 16);
103 | assert.lengthOf(tiles, 16);
104 | const urls = tiles.map((t) => t.url);
105 | assert.include(urls, 'http://a.tile.openstreetmap.org/16/33677/21651.png');
106 | const keys = tiles.map((t) => t.key);
107 | assert.include(keys, 'http://a.tile.openstreetmap.org/16/33677/21651.png');
108 | });
109 |
110 | it('calculates mobox tiles at level 16', () => {
111 | const layer = new TileLayerOffline(
112 | 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}',
113 | {
114 | id: 'mapbox.streets',
115 | accessToken: 'xyz',
116 | },
117 | );
118 | const bounds = new Bounds(
119 | new Point(8621975, 5543267.999999999),
120 | new Point(8621275, 5542538),
121 | );
122 | const tiles = layer.getTileUrls(bounds, 16);
123 | assert.lengthOf(tiles, 16);
124 | const urls = tiles.map((t) => t.url);
125 | assert.include(
126 | urls,
127 | 'https://api.tiles.mapbox.com/v4/mapbox.streets/16/33677/21651.png?access_token=xyz',
128 | );
129 | const keys = tiles.map((t) => t.key);
130 | assert.include(
131 | keys,
132 | 'https://api.tiles.mapbox.com/v4/mapbox.streets/16/33677/21651.png?access_token=xyz',
133 | );
134 | });
135 | });
136 |
--------------------------------------------------------------------------------
/test/TileManagerTest.ts:
--------------------------------------------------------------------------------
1 | /* global describe, it, assert, beforeEach */
2 | import { point, bounds, gridLayer } from 'leaflet';
3 | import fetchMock from 'fetch-mock/esm/client';
4 | import {
5 | downloadTile,
6 | getStorageInfo,
7 | getStorageLength,
8 | getStoredTilesAsJson,
9 | getTileImageSource,
10 | getTilePoints,
11 | hasTile,
12 | removeTile,
13 | saveTile,
14 | truncate,
15 | } from '../src/TileManager';
16 |
17 | const testTileInfo = {
18 | url: 'https://api.tiles.mapbox.com/v4/mapbox.streets/16/33677/21651.png?access_token=xyz',
19 | key: 'https://api.tiles.mapbox.com/v4/mapbox.streets/16/33677/21651.png?access_token=xyz',
20 | x: 33677,
21 | y: 21651,
22 | z: 16,
23 | urlTemplate:
24 | 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}',
25 | createdAt: Date.now(),
26 | };
27 |
28 | describe('manage tile storage', () => {
29 | beforeEach(() => truncate());
30 |
31 | it('saves a tile', () =>
32 | saveTile(testTileInfo, new Blob()).then((r) => {
33 | assert.equal(
34 | r,
35 | 'https://api.tiles.mapbox.com/v4/mapbox.streets/16/33677/21651.png?access_token=xyz',
36 | );
37 | }));
38 |
39 | it('will return empty storageinfo when no tiles are stored', async () => {
40 | const info = await getStorageInfo(testTileInfo.urlTemplate);
41 | assert.lengthOf(info, 0);
42 | });
43 |
44 | it('will return storageinfo with single saved tile', async () => {
45 | await saveTile(testTileInfo, new Blob());
46 | const info = await getStorageInfo(testTileInfo.urlTemplate);
47 | assert.lengthOf(info, 1);
48 | const { blob, ...expectedInfo } = info[0];
49 | assert.deepEqual(expectedInfo, testTileInfo);
50 | });
51 |
52 | it('will return empty storageinfo for other url template', async () => {
53 | await saveTile(testTileInfo, new Blob());
54 | const info = await getStorageInfo(
55 | 'http://someotherexample/{z}/{x}/{y}.png',
56 | );
57 | assert.lengthOf(info, 0);
58 | });
59 |
60 | it('will return length 0 on an empty db', async () => {
61 | const length = await getStorageLength();
62 | assert.equal(length, 0);
63 | });
64 |
65 | it('will calc tile points', () => {
66 | const minBound = point(0, 0);
67 | const maxBound = point(200, 200);
68 | const tilebounds = bounds(minBound, maxBound);
69 | const tilePoints = getTilePoints(tilebounds, point(256, 256));
70 | assert.lengthOf(tilePoints, 1);
71 | });
72 |
73 | it('has tile finds tile by key', async () => {
74 | await saveTile(testTileInfo, new Blob());
75 | const result = await hasTile(testTileInfo.key);
76 | assert.isTrue(result);
77 | });
78 |
79 | it('deletes tile finds tile by key', async () => {
80 | await saveTile(testTileInfo, new Blob());
81 | await removeTile(testTileInfo.key);
82 | const result = await hasTile(testTileInfo.key);
83 | assert.isFalse(result);
84 | });
85 |
86 | it('Creates geojson with tiles', () => {
87 | const layer = gridLayer();
88 | const json = getStoredTilesAsJson(layer.getTileSize(), [testTileInfo]);
89 | assert.lengthOf(json.features, 1);
90 | const feature = json.features[0];
91 | assert.equal(feature.type, 'Feature');
92 | assert.equal(feature.geometry.type, 'Polygon');
93 | assert.lengthOf(feature.geometry.coordinates, 1);
94 | assert.lengthOf(feature.geometry.coordinates[0], 5);
95 | });
96 |
97 | it('downloads a tile', async () => {
98 | const url = 'https://tile.openstreetmap.org/16/33700/21621.png';
99 | fetchMock.once(url, new Blob(), { sendAsJson: false });
100 | const result = await downloadTile(url);
101 | assert.instanceOf(result, Blob);
102 | fetchMock.restore();
103 | });
104 |
105 | it('downloading a tile throws if response is not successful', async () => {
106 | const url = 'https://tile.openstreetmap.org/16/33700/21621.png';
107 | let err;
108 | fetchMock.once(url, 400);
109 | try {
110 | await downloadTile(url);
111 | } catch (error) {
112 | err = error;
113 | }
114 | assert.instanceOf(err, Error);
115 | fetchMock.restore();
116 | });
117 |
118 | it('get image src returns url if tile with key does not exist', async () => {
119 | const result = await getTileImageSource(testTileInfo.key, testTileInfo.url);
120 | assert.equal(result, testTileInfo.url);
121 | });
122 |
123 | it('get image src returns dataSource url if tile key does exist', async () => {
124 | await saveTile(testTileInfo, new Blob());
125 | const result = await getTileImageSource(
126 | testTileInfo.key,
127 | 'http://someurl/tile.png',
128 | );
129 | assert.isString(result);
130 | assert.isTrue(result.includes('blob:'));
131 | });
132 | });
133 |
--------------------------------------------------------------------------------
/tmp/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/allartk/leaflet.offline/c07f6bb7d91e94c3edcf901e2d34a3840044d4e2/tmp/.gitkeep
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es6",
4 | "module": "esnext",
5 | "strict": true,
6 | "moduleResolution":"bundler",
7 | "declaration": true,
8 | "declarationDir": "dist/types",
9 | },
10 | "include": ["./src/**/*","./test/**/*"]
11 | }
12 |
13 |
--------------------------------------------------------------------------------