@sakuzu/maplibre-gl-draw-ui 1.2.0 → 1.3.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 +46 -0
- package/README.md +38 -10
- package/dist/controls.d.ts +24 -7
- package/dist/index.d.ts +5 -2
- package/dist/index.js +893 -350
- package/dist/index.js.map +1 -1
- package/dist/maplibre-gl-draw-ui.js +5835 -5494
- package/dist/maplibre-gl-draw-ui.js.map +1 -1
- package/dist/reveal.d.ts +48 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +4 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,52 @@ follows semantic versioning.
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.3.0] - 2026-10-04
|
|
11
|
+
|
|
12
|
+
From the review of the standard UI on kata 1.8: the map at a narrow
|
|
13
|
+
width, the actions card, the attribution and a selection under a pane.
|
|
14
|
+
|
|
15
|
+
### Added in 1.3.0
|
|
16
|
+
|
|
17
|
+
- A selection of drawn features that the panes hide is revealed: when
|
|
18
|
+
its box on the screen is not inside the part of the map left visible
|
|
19
|
+
(the container less the panes, the bottom sheet, the toolbar's band
|
|
20
|
+
and the attribution), the map pans its centre there, without changing
|
|
21
|
+
the zoom. A selection made on the map is visible and does not move it
|
|
22
|
+
(#15).
|
|
23
|
+
- At a narrow width the attribution comes folded to its (i) button and
|
|
24
|
+
the globe and compass controls are left out; zoom stays. A wide width
|
|
25
|
+
is unchanged (#23).
|
|
26
|
+
|
|
27
|
+
### Changed in 1.3.0
|
|
28
|
+
|
|
29
|
+
- Each action of the actions card is one pressable row (a kata
|
|
30
|
+
ListItem) with its name and its key at the end; the switch rows use
|
|
31
|
+
the same columns, so the keys line up (#16).
|
|
32
|
+
- The attribution has the box of the corner controls in both forms: the
|
|
33
|
+
line of a control group, square corners, and the corner's margin, so
|
|
34
|
+
it no longer touches the map's edges or the toolbar (#18).
|
|
35
|
+
- kata ^1.8.1: the panes show kata's scrollbar when they scroll, so a
|
|
36
|
+
layer pane above an open actions card shows that it scrolls (#20);
|
|
37
|
+
disabled shapes have no hue.
|
|
38
|
+
|
|
39
|
+
### Fixed in 1.3.0
|
|
40
|
+
|
|
41
|
+
- A layer panel or a legend mounted alone paints the panel's surface
|
|
42
|
+
and declares it, so what covers part of a row matches it.
|
|
43
|
+
|
|
44
|
+
## [1.2.1] - 2026-10-02
|
|
45
|
+
|
|
46
|
+
### Fixed in 1.2.1
|
|
47
|
+
|
|
48
|
+
- In a sheet the inspector passes the sheet's height to its panel, so
|
|
49
|
+
the content scrolls and the foot stays in view (#14).
|
|
50
|
+
- The delete button of the toolbar is off while the draw is read-only,
|
|
51
|
+
as the Delete of the inspector is (#19).
|
|
52
|
+
- The bottom corners and the actions card write what their observers
|
|
53
|
+
measure in the next frame, so WebKit reports no ResizeObserver loop
|
|
54
|
+
(#21).
|
|
55
|
+
|
|
10
56
|
## [1.2.0] - 2026-10-02
|
|
11
57
|
|
|
12
58
|
The narrow screen and the stage, from the visual review: the map's
|
package/README.md
CHANGED
|
@@ -257,6 +257,16 @@ the controls of the bottom right move out of its way instead (see
|
|
|
257
257
|
[Map controls](#map-controls)). `padding: false` leaves the map's
|
|
258
258
|
padding alone.
|
|
259
259
|
|
|
260
|
+
When the selection of drawn features changes, the map pans once, after
|
|
261
|
+
the panels have opened for it, so that the selection shows in the part
|
|
262
|
+
of the map the interface leaves visible: the map less the left and the
|
|
263
|
+
right panels, the sheets at the bottom, and the band of the toolbar
|
|
264
|
+
and of the attribution's box. A selection already inside that part, as
|
|
265
|
+
one clicked on the map is, does not move the map. The pan moves the
|
|
266
|
+
centre only (`easeTo`): the zoom never changes, and a selection larger
|
|
267
|
+
than that part is centred in it. A row of a dataset is not a selection
|
|
268
|
+
of the draw instance and is left to the application.
|
|
269
|
+
|
|
260
270
|
On the left, the layer panel and the legend share a panel, in two tabs.
|
|
261
271
|
The layer panel has two sections, Stack and Basemap. Stack is the tree
|
|
262
272
|
of the layers, their groups and their features, from the front, with
|
|
@@ -296,6 +306,9 @@ const ui = createDrawUI(draw, {
|
|
|
296
306
|
|
|
297
307
|
Each goes alone into an element with
|
|
298
308
|
`createLayerPanel(draw, { target })` and `createLegend(draw, { target })`.
|
|
309
|
+
Alone, its root element paints the surface of a panel
|
|
310
|
+
(`--kata-color-panel`) and declares it (`--kata-color-surface`), as the
|
|
311
|
+
panel of the left region does around them.
|
|
299
312
|
|
|
300
313
|
A tool for a mode of your own (added with `draw.extensions.modes.add`):
|
|
301
314
|
|
|
@@ -381,7 +394,11 @@ maplibre-gl's control container (`.maplibregl-control-container`) has
|
|
|
381
394
|
`data-color-mode` of the root. The groups of buttons, the lines between
|
|
382
395
|
them, the attribution and the scale are painted with the tokens, and
|
|
383
396
|
maplibre-gl's icons, which are dark images, are inverted in the dark
|
|
384
|
-
look (`filter: invert(1)`).
|
|
397
|
+
look (`filter: invert(1)`). The attribution is a box as the groups
|
|
398
|
+
are, in both of maplibre-gl's forms (the wide band and the compact one):
|
|
399
|
+
square, with their line, and at the bottom right the margin of the
|
|
400
|
+
other controls of that corner (10px from the right and from the
|
|
401
|
+
bottom). Set the tokens on
|
|
385
402
|
`[data-mgd-ui-controls]` to change their look. `destroy()` removes both
|
|
386
403
|
attributes.
|
|
387
404
|
|
|
@@ -401,11 +418,12 @@ action of the application (see [Actions](#actions)).
|
|
|
401
418
|
### Actions
|
|
402
419
|
|
|
403
420
|
An action of the application, such as saving the drawing or turning a
|
|
404
|
-
setting on and off, is a row of a card at the bottom left of
|
|
405
|
-
above maplibre-gl's scale and, where its box reaches the card
|
|
406
|
-
attribution: a switch (`kind: 'toggle'`) or
|
|
407
|
-
(`kind: 'action'`), with its key
|
|
408
|
-
|
|
421
|
+
setting on and off, is a row of the list in a card at the bottom left of
|
|
422
|
+
the map, above maplibre-gl's scale and, where its box reaches the card
|
|
423
|
+
across, the attribution: its name and a switch (`kind: 'toggle'`), or
|
|
424
|
+
its name in a row pressed as one button (`kind: 'action'`), with its key
|
|
425
|
+
at the end of the row, so that the keys line up. A press on the row and
|
|
426
|
+
its key both call `run`; a switch shows what `checked` returns, read again
|
|
409
427
|
after each run and on `ui.actions.refresh()`, so the state stays with
|
|
410
428
|
the application. `disabled` dims the row and turns its key off, and
|
|
411
429
|
`hint` is a caption under it. The keys are listed with `?` under the
|
|
@@ -505,6 +523,16 @@ also resets the pitch) and the zoom; at the bottom left, the scale
|
|
|
505
523
|
maplibre-gl's style sheet, which the page imports itself
|
|
506
524
|
(`import 'maplibre-gl/dist/maplibre-gl.css'`).
|
|
507
525
|
|
|
526
|
+
On a narrow map (below 48rem, kata's Shell's narrow) the globe and the
|
|
527
|
+
compass are left out, and only the zoom stays; they come back above it
|
|
528
|
+
on a wider map. The attribution of a narrow map is folded to its (i)
|
|
529
|
+
button: maplibre-gl builds its compact attribution open (until the
|
|
530
|
+
first drag), and each time it does so (when the attribution first
|
|
531
|
+
fills, when the map's width brings the compact form back, or when the
|
|
532
|
+
page adds it again) the interface folds it, as maplibre-gl's own fold
|
|
533
|
+
on a drag does. The (i) button opens it. Wider maps are left as they
|
|
534
|
+
are. With `mapControls: false` the attribution is left alone too.
|
|
535
|
+
|
|
508
536
|
```ts
|
|
509
537
|
const ui = createDrawUI(draw, {
|
|
510
538
|
mapControls: { globe: false, scale: true }, // or false for none
|
|
@@ -519,10 +547,10 @@ bottom corners of the map are kept clear of the interface:
|
|
|
519
547
|
toolbar
|
|
520
548
|
- while the right panel covers the bottom right of the map, the controls
|
|
521
549
|
there (not the attribution) move to the left of it, gap-md apart
|
|
522
|
-
- where the attribution's box reaches the scale across, as
|
|
523
|
-
attribution
|
|
524
|
-
|
|
525
|
-
|
|
550
|
+
- where the attribution's box reaches the scale across, as a two-line
|
|
551
|
+
attribution does, the bottom left corner is lifted above it, but on a
|
|
552
|
+
narrow map, where the attribution is folded: the band its (i) button
|
|
553
|
+
opens is not lifted for
|
|
526
554
|
|
|
527
555
|
These are the rules of the style sheet outside the root element: they
|
|
528
556
|
apply to the map's container while the interface is on it.
|
package/dist/controls.d.ts
CHANGED
|
@@ -5,10 +5,16 @@ import type { MapControlsOptions } from './types.js';
|
|
|
5
5
|
export interface ControlsMap {
|
|
6
6
|
addControl(control: IControl, position?: ControlPosition): unknown;
|
|
7
7
|
removeControl(control: IControl): unknown;
|
|
8
|
+
getContainer(): HTMLElement;
|
|
8
9
|
}
|
|
9
|
-
/** The controls added to a map, to remove */
|
|
10
|
+
/** The controls added to a map, to follow the shell's narrow and to remove */
|
|
10
11
|
export interface MapControls {
|
|
11
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Follows the shell's narrow: on a narrow map, removes the globe and the compass and folds the
|
|
14
|
+
* attribution; on a wider one, adds the globe and the compass back
|
|
15
|
+
*/
|
|
16
|
+
setNarrow(narrow: boolean): void;
|
|
17
|
+
/** Removes the controls from the map and stops following the attribution. A second call does nothing */
|
|
12
18
|
destroy(): void;
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
@@ -16,7 +22,15 @@ export interface MapControls {
|
|
|
16
22
|
* those not set to false with an object.
|
|
17
23
|
*
|
|
18
24
|
* maplibre-gl puts a control added to a bottom corner above those already there, so the controls
|
|
19
|
-
* of the bottom right are added from the bottom: the zoom, the compass, then the globe.
|
|
25
|
+
* of the bottom right are added from the bottom: the zoom, the compass, then the globe. The globe
|
|
26
|
+
* and the compass come back the same way, above the zoom.
|
|
27
|
+
*
|
|
28
|
+
* While the map is narrow (`setNarrow`), the globe and the compass are removed, and the
|
|
29
|
+
* attribution is folded to its (i) button: maplibre-gl builds its compact attribution open (until
|
|
30
|
+
* the first drag), when it first fills, when the map's width brings the compact form back, and
|
|
31
|
+
* when a page adds it again; each time, its open class is removed, as maplibre-gl's own fold on a
|
|
32
|
+
* drag does. The (i) button opens it still. With `false`, nothing is added and the attribution is
|
|
33
|
+
* left alone.
|
|
20
34
|
*/
|
|
21
35
|
export declare function mapControls(map: ControlsMap, option: boolean | MapControlsOptions | undefined): MapControls;
|
|
22
36
|
/** The attribute on the map's container while the interface lifts its bottom corners */
|
|
@@ -25,9 +39,9 @@ export declare const LIFT_ATTRIBUTE = "data-mgd-ui-lift";
|
|
|
25
39
|
export interface CornerLift {
|
|
26
40
|
/**
|
|
27
41
|
* Measures again after the toolbar came, went or changed, or the regions of the shell moved;
|
|
28
|
-
* with the inset the shell reported, which
|
|
42
|
+
* with the inset the shell reported and whether it is narrow, which are kept until the next ones
|
|
29
43
|
*/
|
|
30
|
-
update(inset?: ShellInset): void;
|
|
44
|
+
update(inset?: ShellInset, narrow?: boolean): void;
|
|
31
45
|
/** Stops following and puts the corners back */
|
|
32
46
|
destroy(): void;
|
|
33
47
|
}
|
|
@@ -44,9 +58,12 @@ export interface CornerLift {
|
|
|
44
58
|
* while the right region covers the stage (the inset's right) and they are under it up and
|
|
45
59
|
* down: by the inset and gap-md
|
|
46
60
|
* - --mgd-ui-lift-left also lifts the bottom left corner above the attribution's box while that
|
|
47
|
-
* box reaches the corner across
|
|
61
|
+
* box reaches the corner across, but on a narrow map: there the attribution is folded to its
|
|
62
|
+
* (i) button (mapControls), and the band the button opens is not lifted for
|
|
48
63
|
*
|
|
49
64
|
* The boxes are measured where maplibre-gl places them, without what this moved. The attribution
|
|
50
|
-
* and the right region are followed with a ResizeObserver, as the toolbar and the corners are
|
|
65
|
+
* and the right region are followed with a ResizeObserver, as the toolbar and the corners are:
|
|
66
|
+
* the boxes are read in the observer's delivery and the custom properties are written in the next
|
|
67
|
+
* frame, so that what they move is not measured again in the same delivery.
|
|
51
68
|
*/
|
|
52
69
|
export declare function cornerLift(container: HTMLElement, root: HTMLElement): CornerLift;
|
package/dist/index.d.ts
CHANGED
|
@@ -33,12 +33,15 @@ export type { ActionSpec, ActionsHandle, AloneOptions, Basemap, BasemapOptions,
|
|
|
33
33
|
* inspector on the right while something is selected. The map's padding follows the interface:
|
|
34
34
|
* the room the left panel takes (beside the map or floating over it) at the left and the sheets
|
|
35
35
|
* at the bottom, so that `fitBounds` and `easeTo` keep clear of them; `destroy()` gives the map
|
|
36
|
-
* its padding back.
|
|
36
|
+
* its padding back. When the selection of drawn features changes, the map pans once (the zoom
|
|
37
|
+
* stays) so that it shows clear of the panels, the sheets, the toolbar and the attribution,
|
|
38
|
+
* unless it shows there already. The last section of the layer panel is the basemap, whose row opens the
|
|
37
39
|
* basemaps of `options.basemaps` to choose from on the right, in the place of the inspector, when
|
|
38
40
|
* there are two or more. A button at the top right switches between the
|
|
39
41
|
* light and the dark look, and maplibre-gl's own controls go to the bottom corners of the map (the
|
|
40
42
|
* globe, the compass and the zoom at the right, the scale at the left), which move out of the way
|
|
41
|
-
* of the toolbar, the right panel and the attribution;
|
|
43
|
+
* of the toolbar, the right panel and the attribution; a narrow map (below 48rem) shows no globe
|
|
44
|
+
* and no compass, and its attribution folded to its (i) button; `destroy()` removes them. The actions of
|
|
42
45
|
* the application (`options.actions`, `ui.actions`) are rows of a card at the bottom left, above
|
|
43
46
|
* the scale and the attribution, each with its key.
|
|
44
47
|
*
|