@sakuzu/maplibre-gl-draw-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -0
- package/LICENSE +661 -0
- package/README.md +267 -0
- package/THIRD_PARTY_NOTICES.md +350 -0
- package/dist/controls.d.ts +36 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.js +15336 -0
- package/dist/index.js.map +1 -0
- package/dist/inspector/attributes.d.ts +46 -0
- package/dist/inspector/measure.d.ts +25 -0
- package/dist/inspector/operations.d.ts +44 -0
- package/dist/inspector/sections.d.ts +20 -0
- package/dist/inspector/style.d.ts +57 -0
- package/dist/inspector/types.d.ts +121 -0
- package/dist/inspector/view.d.ts +84 -0
- package/dist/layers/legend.d.ts +36 -0
- package/dist/layers/move.d.ts +30 -0
- package/dist/layers/tree.d.ts +87 -0
- package/dist/locales/en.d.ts +3 -0
- package/dist/locales/ja.d.ts +3 -0
- package/dist/maplibre-gl-draw-ui.js +13988 -0
- package/dist/maplibre-gl-draw-ui.js.map +1 -0
- package/dist/messages.d.ts +211 -0
- package/dist/padding.d.ts +33 -0
- package/dist/shortcuts.d.ts +7 -0
- package/dist/store.d.ts +21 -0
- package/dist/style.css +3 -0
- package/dist/theme.d.ts +23 -0
- package/dist/tools.d.ts +56 -0
- package/dist/types.d.ts +237 -0
- package/package.json +88 -0
package/README.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# @sakuzu/maplibre-gl-draw-ui
|
|
2
|
+
|
|
3
|
+
The standard user interface of
|
|
4
|
+
[`@sakuzu/maplibre-gl-draw`](https://github.com/sakuzu/maplibre-gl-draw):
|
|
5
|
+
a toolbar of the drawing tools at the bottom of the map, with keyboard
|
|
6
|
+
shortcuts. It is built with the components of
|
|
7
|
+
[kata](https://github.com/sakuzu/kata) and used through a plain
|
|
8
|
+
JavaScript API, from any framework or none.
|
|
9
|
+
|
|
10
|
+
The interface keeps nothing of the drawing. The current tool is
|
|
11
|
+
`draw.getMode()`, the selection is `draw.selection.get()`, and every
|
|
12
|
+
button calls the public API of the draw instance, so the interface can be
|
|
13
|
+
mixed with controls of your own.
|
|
14
|
+
|
|
15
|
+
The documentation of core, its guides and its API reference, is at
|
|
16
|
+
<https://sakuzu.github.io/maplibre-gl-draw/>.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install @sakuzu/maplibre-gl-draw @sakuzu/maplibre-gl-draw-ui maplibre-gl
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`@sakuzu/maplibre-gl-draw` (2.x) and `maplibre-gl` are peer
|
|
25
|
+
dependencies: the application installs them, and the interface uses the
|
|
26
|
+
same copies as the application. Svelte is a dependency, and kata is
|
|
27
|
+
compiled into the package.
|
|
28
|
+
|
|
29
|
+
The package loads in two ways.
|
|
30
|
+
|
|
31
|
+
- With a bundler, as ES modules: `dist/index.js` imports `svelte`, core
|
|
32
|
+
and `maplibre-gl`, which the bundler resolves, and
|
|
33
|
+
`@sakuzu/maplibre-gl-draw-ui/style.css` is the style sheet.
|
|
34
|
+
- Without a bundler: `dist/maplibre-gl-draw-ui.js` is one module with
|
|
35
|
+
Svelte and kata in it. It loads with `<script type="module">` and an
|
|
36
|
+
import map that names `@sakuzu/maplibre-gl-draw` and `maplibre-gl`,
|
|
37
|
+
together with `dist/style.css`.
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<link rel="stylesheet" href="/vendor/maplibre-gl.css" />
|
|
41
|
+
<link rel="stylesheet" href="/vendor/maplibre-gl-draw-ui/style.css" />
|
|
42
|
+
<script type="importmap">
|
|
43
|
+
{
|
|
44
|
+
"imports": {
|
|
45
|
+
"maplibre-gl": "/vendor/maplibre-gl.mjs",
|
|
46
|
+
"@sakuzu/maplibre-gl-draw": "/vendor/maplibre-gl-draw.js"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
<script type="module">
|
|
51
|
+
import { Map } from 'maplibre-gl';
|
|
52
|
+
import { createDraw } from '@sakuzu/maplibre-gl-draw';
|
|
53
|
+
import { createDrawUI } from '/vendor/maplibre-gl-draw-ui/maplibre-gl-draw-ui.js';
|
|
54
|
+
|
|
55
|
+
const map = new Map({ container: 'map', style: '/style.json' });
|
|
56
|
+
createDrawUI(createDraw(map));
|
|
57
|
+
</script>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The paths stand for where the page serves the files: maplibre-gl's
|
|
61
|
+
`dist/maplibre-gl.mjs`, the `dist/` of this package, and a module of core
|
|
62
|
+
with its own dependencies in it that imports `maplibre-gl` by that name.
|
|
63
|
+
|
|
64
|
+
## Use
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { createDraw } from '@sakuzu/maplibre-gl-draw';
|
|
68
|
+
import { createDrawUI } from '@sakuzu/maplibre-gl-draw-ui';
|
|
69
|
+
import '@sakuzu/maplibre-gl-draw-ui/style.css';
|
|
70
|
+
|
|
71
|
+
const draw = createDraw(map);
|
|
72
|
+
const ui = createDrawUI(draw, {
|
|
73
|
+
toolbar: { tools: ['select', 'point', 'line', 'polygon', 'circle'] },
|
|
74
|
+
locale: 'ja', // 'en' (the default), 'ja', or words laid over English
|
|
75
|
+
shortcuts: true, // V P L A C F I, Delete, and ? for the list
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
ui.setLocale('en');
|
|
79
|
+
ui.destroy();
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The options of `createDrawUI`, all optional:
|
|
83
|
+
|
|
84
|
+
| Option | What it sets | Default |
|
|
85
|
+
| --- | --- | --- |
|
|
86
|
+
| `container` | The positioned element it lies over | the map's container |
|
|
87
|
+
| `toolbar` | `false`, or the `tools`, `delete` and `snapping` | `true` |
|
|
88
|
+
| `inspector` | `false`, or the `tabs` and `operations` | `true` |
|
|
89
|
+
| `layers` | `false`, or the `features`, `add` and `reorder` | `true` |
|
|
90
|
+
| `legend` | The legend beside the layer panel | `true` |
|
|
91
|
+
| `locale` | `en`, `ja`, or words laid over English | `en` |
|
|
92
|
+
| `theme` | `light`, `dark` or `auto` (follows the system) | `auto` |
|
|
93
|
+
| `units` | The measurements in `metric` or `imperial` | `metric` |
|
|
94
|
+
| `shortcuts` | The keyboard shortcuts | `true` |
|
|
95
|
+
| `padding` | Whether the map's padding follows the interface | `true` |
|
|
96
|
+
| `side` | The side panels `floating` over the map or `beside` it | `floating` |
|
|
97
|
+
| `themeToggle` | The button that switches the look | `true` |
|
|
98
|
+
| `mapControls` | maplibre-gl's globe, compass, zoom and scale | `true` |
|
|
99
|
+
|
|
100
|
+
Each part also goes alone into an element of the page, with its own
|
|
101
|
+
options and `target`, `locale` and `theme`: `createToolbar`,
|
|
102
|
+
`createLayerPanel`, `createLegend` and `createInspector`.
|
|
103
|
+
|
|
104
|
+
The interface is laid over the map's container. The toolbar alone goes
|
|
105
|
+
into any positioned element with `createToolbar(draw, { target })`.
|
|
106
|
+
The side panels float over the map, gap-md from its edges and as tall
|
|
107
|
+
as their content; `side: 'beside'` docks them beside the map on a wide
|
|
108
|
+
one instead. The map's padding follows the interface, the width of a
|
|
109
|
+
panel that stands beside the map and the toolbar's height at the bottom,
|
|
110
|
+
so that `fitBounds` and `easeTo` keep clear of them; `padding: false`
|
|
111
|
+
leaves the map's padding alone.
|
|
112
|
+
|
|
113
|
+
On the left, the layer panel and the legend share a panel, in two tabs.
|
|
114
|
+
The layer panel is the tree of the layers, their groups and their
|
|
115
|
+
features, from the front, with the eye, the lock, renaming in place (F2
|
|
116
|
+
or a double click), reordering by dragging and an add menu (a new layer,
|
|
117
|
+
a new group from the selected features). A feature is named by its
|
|
118
|
+
`properties.name`, or by its type when it has none. The legend shows
|
|
119
|
+
the rows of the style rule (`styleRule`) of each layer that has one.
|
|
120
|
+
Shift+L opens and closes the panel, and while it is closed a button at
|
|
121
|
+
the top left of the map opens it again.
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
const ui = createDrawUI(draw, {
|
|
125
|
+
layers: { features: true, add: true, reorder: true }, // or false for none
|
|
126
|
+
legend: true,
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Each goes alone into an element with
|
|
131
|
+
`createLayerPanel(draw, { target })` and `createLegend(draw, { target })`.
|
|
132
|
+
|
|
133
|
+
A tool for a mode of your own (added with `draw.extensions.modes.add`):
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
ui.tools.add({
|
|
137
|
+
id: 'ring',
|
|
138
|
+
mode: 'draw_ring',
|
|
139
|
+
label: 'Ring',
|
|
140
|
+
icon: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">…</svg>',
|
|
141
|
+
shortcut: 'R',
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Inspector
|
|
146
|
+
|
|
147
|
+
The inspector is the panel on the right of `createDrawUI`. It opens
|
|
148
|
+
while something is selected and closes, clearing the selection, with its
|
|
149
|
+
close button. For one feature it shows its name (`properties.name`,
|
|
150
|
+
changed where it stands); under it, its measurements and its description
|
|
151
|
+
(`properties.description`, changed where it stands); then a Style tab
|
|
152
|
+
with the fields its type reads and an Attributes tab with its other
|
|
153
|
+
attributes. Several features
|
|
154
|
+
show the fields they share, a field whose values differ being mixed, and
|
|
155
|
+
the operations that apply to them (union, intersection, difference,
|
|
156
|
+
split and buffer). A layer and a group show their name, whether they are
|
|
157
|
+
visible and whether they are locked.
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
const ui = createDrawUI(draw, {
|
|
161
|
+
inspector: { tabs: ['style', 'attributes'], operations: true },
|
|
162
|
+
units: 'imperial', // ft, mi, ac; metric by default
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
A value typed into an attribute is kept as the string typed. The
|
|
167
|
+
inspector alone goes into any element with
|
|
168
|
+
`createInspector(draw, { target })`, and an application adds a section
|
|
169
|
+
of its own for the features it applies to:
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
ui.inspector?.sections.add({
|
|
173
|
+
id: 'survey',
|
|
174
|
+
title: 'Survey',
|
|
175
|
+
appliesTo: (features) => features.every((f) => f.type === 'Point'),
|
|
176
|
+
fields: ([first]) => [
|
|
177
|
+
{
|
|
178
|
+
key: 'checked',
|
|
179
|
+
kind: 'toggle',
|
|
180
|
+
label: 'Checked',
|
|
181
|
+
value: first.properties.checked === true,
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
onchange: (key, value, features) => {
|
|
185
|
+
const patch = { properties: { [key]: value } };
|
|
186
|
+
draw.features.updateMany(features.map((f) => ({ id: f.id, patch })));
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Customize
|
|
192
|
+
|
|
193
|
+
Everything the interface draws is inside its root element, which has the
|
|
194
|
+
class `mgd-ui`, and its style sheet reaches nothing outside it. kata's
|
|
195
|
+
tokens (the CSS custom properties `--kata-*`) are set on that element;
|
|
196
|
+
set them on `.mgd-ui` to change the look. The `theme` option of
|
|
197
|
+
`createDrawUI` and of each part put alone is `light`, `dark` or `auto`
|
|
198
|
+
(the default, which follows the system's `prefers-color-scheme` as it
|
|
199
|
+
changes), and `ui.setTheme` changes it. kata's theme is dark;
|
|
200
|
+
`data-color-mode="light"` on the root element, which `light` sets, or on
|
|
201
|
+
any element around it, turns it light.
|
|
202
|
+
|
|
203
|
+
A button at the top right of the map switches the look: a sun while it
|
|
204
|
+
is dark, a moon while it is light. It sets the theme to the look that is
|
|
205
|
+
not shown, so from `auto` it keeps the one the system does not prefer;
|
|
206
|
+
`ui.setTheme('auto')` follows the system again. While the inspector is
|
|
207
|
+
open over the map or beside it, the button stands to the left of it.
|
|
208
|
+
`themeToggle: false` leaves it out.
|
|
209
|
+
|
|
210
|
+
Beyond the look, the options above choose the parts and what each shows,
|
|
211
|
+
`ui.tools.add` adds a tool for a mode of the application (see
|
|
212
|
+
[Use](#use)), and `ui.inspector.sections.add` adds a section to the
|
|
213
|
+
inspector (see [Inspector](#inspector)).
|
|
214
|
+
|
|
215
|
+
## Map controls
|
|
216
|
+
|
|
217
|
+
`createDrawUI` adds maplibre-gl's own controls to the map, as
|
|
218
|
+
maplibre-gl draws them: at the bottom right, from the top, the globe
|
|
219
|
+
(`GlobeControl`), the compass (`NavigationControl` without zoom, which
|
|
220
|
+
also resets the pitch) and the zoom; at the bottom left, the scale
|
|
221
|
+
(`ScaleControl`). `destroy()` removes them. Their look comes from
|
|
222
|
+
maplibre-gl's style sheet, which the page imports itself
|
|
223
|
+
(`import 'maplibre-gl/dist/maplibre-gl.css'`).
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
const ui = createDrawUI(draw, {
|
|
227
|
+
mapControls: { globe: false, scale: true }, // or false for none
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
A page that adds controls of its own passes `mapControls: false`. Where
|
|
232
|
+
the toolbar reaches a bottom corner of the map across, as on a narrow
|
|
233
|
+
map, that corner (its controls and the attribution) is lifted above the
|
|
234
|
+
toolbar. This is the one rule of the style sheet outside the root
|
|
235
|
+
element: it applies to the map's container while the interface is on
|
|
236
|
+
it.
|
|
237
|
+
|
|
238
|
+
## Development
|
|
239
|
+
|
|
240
|
+
The interface takes core from the root of this repository as an
|
|
241
|
+
application takes it from npm, through core's build. Build core first,
|
|
242
|
+
then work on the interface:
|
|
243
|
+
|
|
244
|
+
```sh
|
|
245
|
+
npm run build # core, at the root
|
|
246
|
+
npm run ui:typecheck # tsc and svelte-check
|
|
247
|
+
npm run ui:test
|
|
248
|
+
npm run ui:test:e2e # on a real map in headless Chromium
|
|
249
|
+
npm run ui:build # dist/index.js, dist/maplibre-gl-draw-ui.js, dist/style.css
|
|
250
|
+
npm run ui:dev # the development page on http://localhost:3100
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## License
|
|
254
|
+
|
|
255
|
+
Copyright (C) 2026 SAKAIDA Atsushi.
|
|
256
|
+
|
|
257
|
+
Licensed under the GNU Affero General Public License version 3
|
|
258
|
+
(`AGPL-3.0-only`), the same terms as `@sakuzu/maplibre-gl-draw`. See
|
|
259
|
+
`LICENSE` in the package, the same text as the
|
|
260
|
+
[LICENSE](https://github.com/sakuzu/maplibre-gl-draw/blob/main/LICENSE)
|
|
261
|
+
of the repository.
|
|
262
|
+
|
|
263
|
+
If the AGPL does not fit your product, a commercial license is available
|
|
264
|
+
from Kasika, Inc. (可視化技研株式会社): <https://www.kasika.xyz/>.
|
|
265
|
+
|
|
266
|
+
The notices of the software included in the build (Svelte, kata and its
|
|
267
|
+
icons) are in `THIRD_PARTY_NOTICES.md`.
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
`@sakuzu/maplibre-gl-draw-ui` is distributed under the GNU Affero General
|
|
4
|
+
Public License version 3 (AGPL-3.0-only) (see `LICENSE`). Its build
|
|
5
|
+
includes the third-party software listed here, under licenses compatible
|
|
6
|
+
with AGPL-3.0. This file reproduces their notices and license texts.
|
|
7
|
+
|
|
8
|
+
| Software | License | In `dist/index.js` | In `dist/maplibre-gl-draw-ui.js` |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| kata (`@sakuzu/kata`) | Apache-2.0 | Yes | Yes |
|
|
11
|
+
| Lucide (`@lucide/svelte`) | ISC (MIT for the Feather icons) | Yes | Yes |
|
|
12
|
+
| Svelte (`svelte`) | MIT | No (a dependency) | Yes |
|
|
13
|
+
|
|
14
|
+
`dist/style.css` includes kata's tokens and the styles of its
|
|
15
|
+
components. `@sakuzu/maplibre-gl-draw` and `maplibre-gl` are peer
|
|
16
|
+
dependencies and are not included.
|
|
17
|
+
|
|
18
|
+
The font tokens of kata name typefaces (IBM Plex Sans, IBM Plex Sans JP,
|
|
19
|
+
IBM Plex Mono, Noto Sans SC and Noto Sans TC). The package does not
|
|
20
|
+
bundle or load these fonts; without them, the browser falls back to the
|
|
21
|
+
system fonts named at the end of each list.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 1. kata (Apache License 2.0)
|
|
26
|
+
|
|
27
|
+
The components, the icons of the drawing shapes, the tokens and the
|
|
28
|
+
styles of kata are compiled into the build.
|
|
29
|
+
|
|
30
|
+
Upstream: <https://github.com/sakuzu/kata>
|
|
31
|
+
|
|
32
|
+
The NOTICE file of kata:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
kata
|
|
36
|
+
Copyright 2026 Kasika, Inc.
|
|
37
|
+
|
|
38
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
39
|
+
|
|
40
|
+
The numeric scale follows ideas from LiftKit (Chainlift); no code or text
|
|
41
|
+
from it is included.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The license of kata:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
|
|
48
|
+
Apache License
|
|
49
|
+
Version 2.0, January 2004
|
|
50
|
+
http://www.apache.org/licenses/
|
|
51
|
+
|
|
52
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
53
|
+
|
|
54
|
+
1. Definitions.
|
|
55
|
+
|
|
56
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
57
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
58
|
+
|
|
59
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
60
|
+
the copyright owner that is granting the License.
|
|
61
|
+
|
|
62
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
63
|
+
other entities that control, are controlled by, or are under common
|
|
64
|
+
control with that entity. For the purposes of this definition,
|
|
65
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
66
|
+
direction or management of such entity, whether by contract or
|
|
67
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
68
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
69
|
+
|
|
70
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
71
|
+
exercising permissions granted by this License.
|
|
72
|
+
|
|
73
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
74
|
+
including but not limited to software source code, documentation
|
|
75
|
+
source, and configuration files.
|
|
76
|
+
|
|
77
|
+
"Object" form shall mean any form resulting from mechanical
|
|
78
|
+
transformation or translation of a Source form, including but
|
|
79
|
+
not limited to compiled object code, generated documentation,
|
|
80
|
+
and conversions to other media types.
|
|
81
|
+
|
|
82
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
83
|
+
Object form, made available under the License, as indicated by a
|
|
84
|
+
copyright notice that is included in or attached to the work
|
|
85
|
+
(an example is provided in the Appendix below).
|
|
86
|
+
|
|
87
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
88
|
+
form, that is based on (or derived from) the Work and for which the
|
|
89
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
90
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
91
|
+
of this License, Derivative Works shall not include works that remain
|
|
92
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
93
|
+
the Work and Derivative Works thereof.
|
|
94
|
+
|
|
95
|
+
"Contribution" shall mean any work of authorship, including
|
|
96
|
+
the original version of the Work and any modifications or additions
|
|
97
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
98
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
99
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
100
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
101
|
+
means any form of electronic, verbal, or written communication sent
|
|
102
|
+
to the Licensor or its representatives, including but not limited to
|
|
103
|
+
communication on electronic mailing lists, source code control systems,
|
|
104
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
105
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
106
|
+
excluding communication that is conspicuously marked or otherwise
|
|
107
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
108
|
+
|
|
109
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
110
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
111
|
+
subsequently incorporated within the Work.
|
|
112
|
+
|
|
113
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
114
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
115
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
116
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
117
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
118
|
+
Work and such Derivative Works in Source or Object form.
|
|
119
|
+
|
|
120
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
121
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
122
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
123
|
+
(except as stated in this section) patent license to make, have made,
|
|
124
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
125
|
+
where such license applies only to those patent claims licensable
|
|
126
|
+
by such Contributor that are necessarily infringed by their
|
|
127
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
128
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
129
|
+
institute patent litigation against any entity (including a
|
|
130
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
131
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
132
|
+
or contributory patent infringement, then any patent licenses
|
|
133
|
+
granted to You under this License for that Work shall terminate
|
|
134
|
+
as of the date such litigation is filed.
|
|
135
|
+
|
|
136
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
137
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
138
|
+
modifications, and in Source or Object form, provided that You
|
|
139
|
+
meet the following conditions:
|
|
140
|
+
|
|
141
|
+
(a) You must give any other recipients of the Work or
|
|
142
|
+
Derivative Works a copy of this License; and
|
|
143
|
+
|
|
144
|
+
(b) You must cause any modified files to carry prominent notices
|
|
145
|
+
stating that You changed the files; and
|
|
146
|
+
|
|
147
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
148
|
+
that You distribute, all copyright, patent, trademark, and
|
|
149
|
+
attribution notices from the Source form of the Work,
|
|
150
|
+
excluding those notices that do not pertain to any part of
|
|
151
|
+
the Derivative Works; and
|
|
152
|
+
|
|
153
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
154
|
+
distribution, then any Derivative Works that You distribute must
|
|
155
|
+
include a readable copy of the attribution notices contained
|
|
156
|
+
within such NOTICE file, excluding those notices that do not
|
|
157
|
+
pertain to any part of the Derivative Works, in at least one
|
|
158
|
+
of the following places: within a NOTICE text file distributed
|
|
159
|
+
as part of the Derivative Works; within the Source form or
|
|
160
|
+
documentation, if provided along with the Derivative Works; or,
|
|
161
|
+
within a display generated by the Derivative Works, if and
|
|
162
|
+
wherever such third-party notices normally appear. The contents
|
|
163
|
+
of the NOTICE file are for informational purposes only and
|
|
164
|
+
do not modify the License. You may add Your own attribution
|
|
165
|
+
notices within Derivative Works that You distribute, alongside
|
|
166
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
167
|
+
that such additional attribution notices cannot be construed
|
|
168
|
+
as modifying the License.
|
|
169
|
+
|
|
170
|
+
You may add Your own copyright statement to Your modifications and
|
|
171
|
+
may provide additional or different license terms and conditions
|
|
172
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
173
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
174
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
175
|
+
the conditions stated in this License.
|
|
176
|
+
|
|
177
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
178
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
179
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
180
|
+
this License, without any additional terms or conditions.
|
|
181
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
182
|
+
the terms of any separate license agreement you may have executed
|
|
183
|
+
with Licensor regarding such Contributions.
|
|
184
|
+
|
|
185
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
186
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
187
|
+
except as required for reasonable and customary use in describing the
|
|
188
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
189
|
+
|
|
190
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
191
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
192
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
193
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
194
|
+
implied, including, without limitation, any warranties or conditions
|
|
195
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
196
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
197
|
+
appropriateness of using or redistributing the Work and assume any
|
|
198
|
+
risks associated with Your exercise of permissions under this License.
|
|
199
|
+
|
|
200
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
201
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
202
|
+
unless required by applicable law (such as deliberate and grossly
|
|
203
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
204
|
+
liable to You for damages, including any direct, indirect, special,
|
|
205
|
+
incidental, or consequential damages of any character arising as a
|
|
206
|
+
result of this License or out of the use or inability to use the
|
|
207
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
208
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
209
|
+
other commercial damages or losses), even if such Contributor
|
|
210
|
+
has been advised of the possibility of such damages.
|
|
211
|
+
|
|
212
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
213
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
214
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
215
|
+
or other liability obligations and/or rights consistent with this
|
|
216
|
+
License. However, in accepting such obligations, You may act only
|
|
217
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
218
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
219
|
+
defend, and hold each Contributor harmless for any liability
|
|
220
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
221
|
+
of your accepting any such warranty or additional liability.
|
|
222
|
+
|
|
223
|
+
END OF TERMS AND CONDITIONS
|
|
224
|
+
|
|
225
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
226
|
+
|
|
227
|
+
To apply the Apache License to your work, attach the following
|
|
228
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
229
|
+
replaced with your own identifying information. (Don't include
|
|
230
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
231
|
+
comment syntax for the file format. We also recommend that a
|
|
232
|
+
file or class name and description of purpose be included on the
|
|
233
|
+
same "printed page" as the copyright notice for easier
|
|
234
|
+
identification within third-party archives.
|
|
235
|
+
|
|
236
|
+
Copyright [yyyy] [name of copyright owner]
|
|
237
|
+
|
|
238
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
239
|
+
you may not use this file except in compliance with the License.
|
|
240
|
+
You may obtain a copy of the License at
|
|
241
|
+
|
|
242
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
243
|
+
|
|
244
|
+
Unless required by applicable law or agreed to in writing, software
|
|
245
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
246
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
247
|
+
See the License for the specific language governing permissions and
|
|
248
|
+
limitations under the License.
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## 2. Lucide (ISC License, and MIT License for the icons from Feather)
|
|
252
|
+
|
|
253
|
+
The icons that the interface uses (`circle`, `magnet` and
|
|
254
|
+
`mouse-pointer-2`) and those that kata uses are compiled into the build.
|
|
255
|
+
Some of them are derived from the Feather project, whose license follows
|
|
256
|
+
the ISC License below for the icons it lists.
|
|
257
|
+
|
|
258
|
+
Upstream: <https://github.com/lucide-icons/lucide>
|
|
259
|
+
|
|
260
|
+
```text
|
|
261
|
+
ISC License
|
|
262
|
+
|
|
263
|
+
Copyright (c) 2026 Lucide Icons and Contributors
|
|
264
|
+
|
|
265
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
266
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
267
|
+
copyright notice and this permission notice appear in all copies.
|
|
268
|
+
|
|
269
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
270
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
271
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
272
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
273
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
274
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
275
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
The following Lucide icons are derived from the Feather project:
|
|
280
|
+
|
|
281
|
+
airplay, alert-circle, alert-octagon, alert-triangle, aperture,
|
|
282
|
+
arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down,
|
|
283
|
+
arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle,
|
|
284
|
+
arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check,
|
|
285
|
+
chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down,
|
|
286
|
+
chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code,
|
|
287
|
+
columns, command, compass, corner-down-left, corner-down-right,
|
|
288
|
+
corner-left-down, corner-left-up, corner-right-down, corner-right-up,
|
|
289
|
+
corner-up-left, corner-up-right, crosshair, database, divide-circle,
|
|
290
|
+
divide-square, dollar-sign, download, external-link, feather, frown, hash,
|
|
291
|
+
headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link,
|
|
292
|
+
loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2,
|
|
293
|
+
minus-circle, minus-square, minus, monitor, moon, more-horizontal,
|
|
294
|
+
more-vertical, move, music, navigation-2, navigation, octagon, pause-circle,
|
|
295
|
+
percent, plus-circle, plus-square, plus, power, radio, rss, search, server,
|
|
296
|
+
share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet,
|
|
297
|
+
target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle,
|
|
298
|
+
x-octagon, x-square, x, zoom-in, zoom-out
|
|
299
|
+
|
|
300
|
+
The MIT License (MIT) (for the icons listed above)
|
|
301
|
+
|
|
302
|
+
Copyright (c) 2013-present Cole Bemis
|
|
303
|
+
|
|
304
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
305
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
306
|
+
in the Software without restriction, including without limitation the rights
|
|
307
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
308
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
309
|
+
furnished to do so, subject to the following conditions:
|
|
310
|
+
|
|
311
|
+
The above copyright notice and this permission notice shall be included in all
|
|
312
|
+
copies or substantial portions of the Software.
|
|
313
|
+
|
|
314
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
315
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
316
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
317
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
318
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
319
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
320
|
+
SOFTWARE.
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## 3. Svelte (MIT License)
|
|
324
|
+
|
|
325
|
+
The run-time of Svelte is included in `dist/maplibre-gl-draw-ui.js`.
|
|
326
|
+
`dist/index.js` imports it from the `svelte` package, a dependency.
|
|
327
|
+
|
|
328
|
+
Upstream: <https://github.com/sveltejs/svelte>
|
|
329
|
+
|
|
330
|
+
```text
|
|
331
|
+
Copyright (c) 2016-2025 [Svelte
|
|
332
|
+
Contributors](https://github.com/sveltejs/svelte/graphs/contributors)
|
|
333
|
+
|
|
334
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
335
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
336
|
+
the Software without restriction, including without limitation the rights to
|
|
337
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
338
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
339
|
+
subject to the following conditions:
|
|
340
|
+
|
|
341
|
+
The above copyright notice and this permission notice shall be included in all
|
|
342
|
+
copies or substantial portions of the Software.
|
|
343
|
+
|
|
344
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
345
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
346
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
347
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
348
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
349
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
350
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ControlPosition, type IControl } from 'maplibre-gl';
|
|
2
|
+
import type { MapControlsOptions } from './types.js';
|
|
3
|
+
/** The members of the map the controls use */
|
|
4
|
+
export interface ControlsMap {
|
|
5
|
+
addControl(control: IControl, position?: ControlPosition): unknown;
|
|
6
|
+
removeControl(control: IControl): unknown;
|
|
7
|
+
}
|
|
8
|
+
/** The controls added to a map, to remove */
|
|
9
|
+
export interface MapControls {
|
|
10
|
+
/** Removes the controls from the map. A second call does nothing */
|
|
11
|
+
destroy(): void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Adds maplibre-gl's controls to a map: all four with `true` or `undefined`, none with `false`,
|
|
15
|
+
* those not set to false with an object.
|
|
16
|
+
*
|
|
17
|
+
* maplibre-gl puts a control added to a bottom corner above those already there, so the controls
|
|
18
|
+
* of the bottom right are added from the bottom: the zoom, the compass, then the globe.
|
|
19
|
+
*/
|
|
20
|
+
export declare function mapControls(map: ControlsMap, option: boolean | MapControlsOptions | undefined): MapControls;
|
|
21
|
+
/** The attribute on the map's container while the interface lifts its bottom corners */
|
|
22
|
+
export declare const LIFT_ATTRIBUTE = "data-mgd-ui-lift";
|
|
23
|
+
/** The bottom corners of the map, lifted above the toolbar while it reaches them */
|
|
24
|
+
export interface CornerLift {
|
|
25
|
+
/** Measures again after the toolbar came, went or changed */
|
|
26
|
+
update(): void;
|
|
27
|
+
/** Stops following and puts the corners back */
|
|
28
|
+
destroy(): void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Lifts the bottom corners of maplibre-gl's controls in `container` (the map's container) above
|
|
32
|
+
* the toolbar of the interface in `root`, each while the toolbar reaches it across: by the
|
|
33
|
+
* distance from the top of the toolbar to the bottom of the map. root.css moves the corners by
|
|
34
|
+
* the custom properties this sets on the container (--mgd-ui-lift-left and --mgd-ui-lift-right).
|
|
35
|
+
*/
|
|
36
|
+
export declare function cornerLift(container: HTMLElement, root: HTMLElement): CornerLift;
|