@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 ADDED
@@ -0,0 +1,78 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@sakuzu/maplibre-gl-draw-ui` are recorded here.
4
+ The format follows
5
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the package
6
+ follows semantic versioning.
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [1.0.0] - 2026-10-01
11
+
12
+ The first release of the standard user interface of
13
+ `@sakuzu/maplibre-gl-draw`: the toolbar, the layer panel and the legend,
14
+ and the inspector, laid over the map with `createDrawUI` or put alone in
15
+ an element, built with kata and driven through a plain JavaScript API.
16
+ It works with `@sakuzu/maplibre-gl-draw` 2.x.
17
+
18
+ ### Added
19
+
20
+ - `createDrawUI(draw, options)` lays kata's Shell over the map, with the
21
+ toolbar at the bottom and the keyboard shortcuts.
22
+ - `createToolbar(draw, { target })` puts the toolbar alone in an element.
23
+ - The toolbar has the seven built-in tools (select, point, line,
24
+ polygon, circle, freehand and image), the delete button and the
25
+ snapping switch, and follows the mode and the selection of the draw
26
+ instance.
27
+ - `ui.tools.add`, `ui.tools.remove` and `ui.tools.list` change the tools
28
+ of the toolbar.
29
+ - The words come in English and Japanese, and any of them can be
30
+ replaced (`locale`, `ui.setLocale`).
31
+ - `style.css` keeps kata's tokens on the root element `.mgd-ui`.
32
+ - The left region of `createDrawUI` holds the layer panel and the
33
+ legend in two tabs (`layers`, `legend`), and Shift+L opens and closes
34
+ it. `ui.layers` and `ui.legend` remove them.
35
+ - `createLayerPanel(draw, { target })` puts the tree of the layers,
36
+ groups and features alone in an element: the eye, the lock, renaming,
37
+ reordering by dragging, and the add menu.
38
+ - `createLegend(draw, { target })` puts the legend of the style rules of
39
+ the layers alone in an element.
40
+ - The inspector on the right of `createDrawUI` (`inspector`, `units`):
41
+ the name, the style, the measurements and the attributes of a
42
+ feature; the shared fields and the operations of several features;
43
+ the settings of a layer and of a group. `createInspector(draw,
44
+ { target })` puts it alone in an element, and
45
+ `ui.inspector.sections.add` adds a section of the application.
46
+ - `createDrawUI` keeps the map's padding to the interface: the width of
47
+ a panel that stands beside the map on its side, and the toolbar's
48
+ height with its gap at the bottom, so that `fitBounds` and `easeTo`
49
+ keep clear of them. Floating panels and sheets leave the sides at 0,
50
+ and `destroy()` gives the map its padding back. `padding: false`
51
+ turns it off.
52
+ - The root element of the interface is kata's root in the page
53
+ (`data-kata-root`): the tooltips and the probes kata appends go into
54
+ it, where kata's tokens, the language and the theme apply.
55
+ - Built with kata 1.1.0. The Shell of `createDrawUI` lies over the map
56
+ with kata's `overlay`: the map takes the pointer everywhere but the
57
+ regions of the shell (the panels beside it, the toolbar, the scrim
58
+ and the floating panels, and the sheets).
59
+ - The `theme` option (`light`, `dark`, or `auto` to follow the system's
60
+ `prefers-color-scheme` as it changes; `auto` by default) of
61
+ `createDrawUI`, `createToolbar`, `createLayerPanel`, `createLegend`
62
+ and `createInspector`, and `ui.setTheme`. Light switches every token
63
+ of kata's light theme on the root element.
64
+ - While the left region of `createDrawUI` is closed, a button at the top
65
+ left of the map opens it again.
66
+ - The inspector of one feature shows its measurements and its
67
+ description (changed where it stands) under its name, before the
68
+ tabs; the Style tab has the fields of the style, the sections of the
69
+ application and the operations, and the Attributes tab the list of
70
+ the attributes. The line style and the shape of a point are selects.
71
+ - A button at the top right of `createDrawUI` switches between the
72
+ light and the dark look (`themeToggle: false` leaves it out). It
73
+ stands to the left of the inspector while the inspector is open.
74
+ - `createDrawUI` adds maplibre-gl's own controls to the map: the globe,
75
+ the compass and the zoom at the bottom right, the scale at the bottom
76
+ left (`mapControls`, true by default; false for none, or an object for
77
+ some of them). `destroy()` removes them. A bottom corner the toolbar
78
+ reaches across is lifted above the toolbar.