@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/dist/index.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The standard user interface of `@sakuzu/maplibre-gl-draw`: a toolbar of the drawing tools at
|
|
3
|
+
* the bottom of the map, with keyboard shortcuts.
|
|
4
|
+
*
|
|
5
|
+
* The interface keeps nothing of the drawing. It reads the draw instance and follows its events
|
|
6
|
+
* (the current tool is `draw.getMode()`, the selection `draw.selection.get()`), and every button
|
|
7
|
+
* calls the public API of the draw instance, so an application can mix it with controls of its
|
|
8
|
+
* own and they never disagree.
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { createDraw } from '@sakuzu/maplibre-gl-draw';
|
|
12
|
+
* import { createDrawUI } from '@sakuzu/maplibre-gl-draw-ui';
|
|
13
|
+
* import '@sakuzu/maplibre-gl-draw-ui/style.css';
|
|
14
|
+
*
|
|
15
|
+
* const draw = createDraw(map);
|
|
16
|
+
* const ui = createDrawUI(draw, { locale: 'ja' });
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @module maplibre-gl-draw-ui
|
|
20
|
+
*/
|
|
21
|
+
import type { Draw } from '@sakuzu/maplibre-gl-draw';
|
|
22
|
+
import type { InspectorHandle, InspectorOptions } from './inspector/types.js';
|
|
23
|
+
import type { AloneOptions, DrawUI, DrawUIOptions, LayerPanelHandle, LayerPanelOptions, LegendHandle, ToolbarHandle, ToolbarOptions } from './types.js';
|
|
24
|
+
export type { InspectorField, InspectorFieldKind, InspectorHandle, InspectorOptions, InspectorSectionSpec, InspectorSectionsHandle, InspectorTab, Units, } from './inspector/types.js';
|
|
25
|
+
export type { Locale, Messages } from './messages.js';
|
|
26
|
+
export type { Theme } from './theme.js';
|
|
27
|
+
export type { AloneOptions, DrawUI, DrawUIOptions, LayerPanelHandle, LayerPanelOptions, LegendHandle, MapControlsOptions, ToolbarHandle, ToolbarOptions, ToolEntry, ToolId, ToolSpec, ToolsHandle, } from './types.js';
|
|
28
|
+
/**
|
|
29
|
+
* Lays the interface over the map of a draw instance: kata's Shell with the toolbar at the
|
|
30
|
+
* bottom and the keyboard shortcuts.
|
|
31
|
+
*
|
|
32
|
+
* It draws the toolbar, the shortcuts, the layer panel and the legend on the left, and the
|
|
33
|
+
* inspector on the right while something is selected. The map's padding follows the interface:
|
|
34
|
+
* the width of a panel that stands beside the map (on a wide container) and the toolbar's height
|
|
35
|
+
* at the bottom, so that `fitBounds` and `easeTo` keep clear of them; `destroy()` gives the map
|
|
36
|
+
* its padding back. A button at the top right switches between the light and the dark look, and
|
|
37
|
+
* maplibre-gl's own controls go to the bottom corners of the map (the globe, the compass and the
|
|
38
|
+
* zoom at the right, the scale at the left); `destroy()` removes them.
|
|
39
|
+
*
|
|
40
|
+
* @param draw - The draw instance
|
|
41
|
+
* @param options - What to show, the words and the keys
|
|
42
|
+
* @returns The interface, to change and to remove
|
|
43
|
+
* @throws Error when a tool of `options.toolbar.tools` is not valid, a tab of
|
|
44
|
+
* `options.inspector.tabs` is not `style` or `attributes`, or the theme is not `light`, `dark`
|
|
45
|
+
* or `auto`
|
|
46
|
+
*/
|
|
47
|
+
export declare function createDrawUI(draw: Draw, options?: DrawUIOptions): DrawUI;
|
|
48
|
+
/**
|
|
49
|
+
* Puts the toolbar alone in an element: the tools, the delete button and the snapping switch,
|
|
50
|
+
* without the keyboard shortcuts. The bar floats at the bottom centre of `target`, which must be
|
|
51
|
+
* positioned (the map's container, or a positioned box over the map).
|
|
52
|
+
*
|
|
53
|
+
* @param draw - The draw instance
|
|
54
|
+
* @param options - The element to put it in, what it shows, the words (`en` by default) and the
|
|
55
|
+
* theme (`auto` by default)
|
|
56
|
+
* @returns The toolbar, to remove
|
|
57
|
+
* @throws Error when a tool of `options.tools` is not valid, or the theme is not `light`, `dark`
|
|
58
|
+
* or `auto`
|
|
59
|
+
*/
|
|
60
|
+
export declare function createToolbar(draw: Draw, options: ToolbarOptions & AloneOptions): ToolbarHandle;
|
|
61
|
+
/**
|
|
62
|
+
* Puts the layer panel alone in an element: the tree of the layers, their groups and their
|
|
63
|
+
* features, from the front, with the eye, the lock, renaming, dragging and the add menu. It fills
|
|
64
|
+
* `target`, which gives it its size and its scrolling.
|
|
65
|
+
*
|
|
66
|
+
* @param draw - The draw instance
|
|
67
|
+
* @param options - The element to put it in, what it shows, the words (`en` by default) and the
|
|
68
|
+
* theme (`auto` by default)
|
|
69
|
+
* @returns The layer panel, to remove
|
|
70
|
+
* @throws Error when the theme is not `light`, `dark` or `auto`
|
|
71
|
+
*/
|
|
72
|
+
export declare function createLayerPanel(draw: Draw, options: LayerPanelOptions & AloneOptions): LayerPanelHandle;
|
|
73
|
+
/**
|
|
74
|
+
* Puts the legend alone in an element: the rows of the style rule of each layer that has one,
|
|
75
|
+
* from the front. It only reads; the rules change with `draw.layers.update`.
|
|
76
|
+
*
|
|
77
|
+
* @param draw - The draw instance
|
|
78
|
+
* @param options - The element to put it in, the words (`en` by default) and the theme (`auto` by
|
|
79
|
+
* default)
|
|
80
|
+
* @returns The legend, to remove
|
|
81
|
+
* @throws Error when the theme is not `light`, `dark` or `auto`
|
|
82
|
+
*/
|
|
83
|
+
export declare function createLegend(draw: Draw, options: AloneOptions): LegendHandle;
|
|
84
|
+
/**
|
|
85
|
+
* Puts the inspector alone in an element: the panel of what is selected (a feature, several
|
|
86
|
+
* features, a layer or a group), with an empty state while nothing is. The panel fills the height
|
|
87
|
+
* of `target`.
|
|
88
|
+
*
|
|
89
|
+
* @param draw - The draw instance
|
|
90
|
+
* @param options - The element to put it in, the tabs, the measurements, the operations, the
|
|
91
|
+
* units, the words (`en` by default) and the theme (`auto` by default)
|
|
92
|
+
* @returns The inspector, to add sections to and to remove
|
|
93
|
+
* @throws Error when a tab of `options.tabs` is not `style` or `attributes`, or the theme is not
|
|
94
|
+
* `light`, `dark` or `auto`
|
|
95
|
+
*/
|
|
96
|
+
export declare function createInspector(draw: Draw, options: InspectorOptions & AloneOptions): InspectorHandle;
|