@element-editor/adapter-maplibre 0.0.0-stage → 0.2.1
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/AGENTS.md +119 -0
- package/LICENSE +21 -0
- package/README.md +82 -2
- package/basemaps/sprite.json +1 -0
- package/basemaps/sprite.png +0 -0
- package/basemaps/sprite@2x.json +1 -0
- package/basemaps/sprite@2x.png +0 -0
- package/basemaps/thumbs/dark.webp +0 -0
- package/basemaps/thumbs/light.webp +0 -0
- package/basemaps/thumbs/osm.webp +0 -0
- package/basemaps/thumbs/streets.webp +0 -0
- package/basemaps/thumbs/terrain.webp +0 -0
- package/dist/adapter-maplibre.css +1 -0
- package/dist/basemapIds-2GdXIJS1.cjs +1 -0
- package/dist/basemapIds-CVTxeXkr.js +11 -0
- package/dist/basemaps.cjs +1 -0
- package/dist/basemaps.d.cts +2 -0
- package/dist/basemaps.d.ts +2 -0
- package/dist/basemaps.es.js +10 -0
- package/dist/catalog-Cnqi23GZ.cjs +1 -0
- package/dist/catalog-gI-xABuu.js +10 -0
- package/dist/dark-C5d5FijX.cjs +1 -0
- package/dist/dark-CcJT_yHE.js +13 -0
- package/dist/index.cjs +26 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +3792 -0
- package/dist/light-Cf5tUOoP.js +13 -0
- package/dist/light-DCtd1z4V.cjs +1 -0
- package/dist/src/BasemapControl.d.cts +47 -0
- package/dist/src/BasemapControl.d.ts +47 -0
- package/dist/src/ElementEditorControls.d.cts +113 -0
- package/dist/src/ElementEditorControls.d.ts +113 -0
- package/dist/src/basemapIds.d.cts +10 -0
- package/dist/src/basemapIds.d.ts +10 -0
- package/dist/src/basemaps/catalog.d.cts +7 -0
- package/dist/src/basemaps/catalog.d.ts +7 -0
- package/dist/src/basemaps/index.d.cts +3 -0
- package/dist/src/basemaps/index.d.ts +3 -0
- package/dist/src/basemaps/style.d.cts +61 -0
- package/dist/src/basemaps/style.d.ts +61 -0
- package/dist/src/components/BoundaryLayer.d.cts +11 -0
- package/dist/src/components/BoundaryLayer.d.ts +11 -0
- package/dist/src/components/BoxSelectHandler.d.cts +13 -0
- package/dist/src/components/BoxSelectHandler.d.ts +13 -0
- package/dist/src/components/DrawingLayer.d.cts +8 -0
- package/dist/src/components/DrawingLayer.d.ts +8 -0
- package/dist/src/components/DrawingPreviewLayer.d.cts +8 -0
- package/dist/src/components/DrawingPreviewLayer.d.ts +8 -0
- package/dist/src/components/FeatureInteractionLayer.d.cts +8 -0
- package/dist/src/components/FeatureInteractionLayer.d.ts +8 -0
- package/dist/src/components/FeatureLayer.d.cts +15 -0
- package/dist/src/components/FeatureLayer.d.ts +15 -0
- package/dist/src/components/GeometryProcessingPreview.d.cts +8 -0
- package/dist/src/components/GeometryProcessingPreview.d.ts +8 -0
- package/dist/src/components/MeasurePreviewLayer.d.cts +9 -0
- package/dist/src/components/MeasurePreviewLayer.d.ts +9 -0
- package/dist/src/components/MeasurementTooltip.d.cts +6 -0
- package/dist/src/components/MeasurementTooltip.d.ts +6 -0
- package/dist/src/components/OsmTraceHandler.d.cts +8 -0
- package/dist/src/components/OsmTraceHandler.d.ts +8 -0
- package/dist/src/components/PreciseCoordsOverlay.d.cts +10 -0
- package/dist/src/components/PreciseCoordsOverlay.d.ts +10 -0
- package/dist/src/components/SnapController.d.cts +9 -0
- package/dist/src/components/SnapController.d.ts +9 -0
- package/dist/src/components/TextEditOverlay.d.cts +9 -0
- package/dist/src/components/TextEditOverlay.d.ts +9 -0
- package/dist/src/components/TransformControls.d.cts +8 -0
- package/dist/src/components/TransformControls.d.ts +8 -0
- package/dist/src/components/VertexEditor.d.cts +15 -0
- package/dist/src/components/VertexEditor.d.ts +15 -0
- package/dist/src/contexts/FeatureStyleContext.d.cts +9 -0
- package/dist/src/contexts/FeatureStyleContext.d.ts +9 -0
- package/dist/src/contexts/MapControllerContext.d.cts +2 -0
- package/dist/src/contexts/MapControllerContext.d.ts +2 -0
- package/dist/src/contexts/StyleEpochContext.d.cts +7 -0
- package/dist/src/contexts/StyleEpochContext.d.ts +7 -0
- package/dist/src/elementLayers.d.cts +17 -0
- package/dist/src/elementLayers.d.ts +17 -0
- package/dist/src/hooks/lastPointer.d.cts +18 -0
- package/dist/src/hooks/lastPointer.d.ts +18 -0
- package/dist/src/hooks/useCursorWhileMode.d.cts +20 -0
- package/dist/src/hooks/useCursorWhileMode.d.ts +20 -0
- package/dist/src/hooks/useModifierDragCursor.d.cts +8 -0
- package/dist/src/hooks/useModifierDragCursor.d.ts +8 -0
- package/dist/src/index.d.cts +30 -0
- package/dist/src/index.d.ts +30 -0
- package/dist/src/store/StoreContext.d.cts +1 -0
- package/dist/src/store/StoreContext.d.ts +1 -0
- package/dist/src/utils/accentPaint.d.cts +13 -0
- package/dist/src/utils/accentPaint.d.ts +13 -0
- package/dist/src/utils/boxSelect.d.cts +4 -0
- package/dist/src/utils/boxSelect.d.ts +4 -0
- package/dist/src/utils/darkStyle.d.cts +8 -0
- package/dist/src/utils/darkStyle.d.ts +8 -0
- package/dist/src/utils/featureTooltip.d.cts +16 -0
- package/dist/src/utils/featureTooltip.d.ts +16 -0
- package/dist/src/utils/findPartAtPoint.d.cts +2 -0
- package/dist/src/utils/findPartAtPoint.d.ts +2 -0
- package/dist/src/utils/freehandCommitFlag.d.cts +2 -0
- package/dist/src/utils/freehandCommitFlag.d.ts +2 -0
- package/dist/src/utils/freshFeature.d.cts +3 -0
- package/dist/src/utils/freshFeature.d.ts +3 -0
- package/dist/src/utils/geojson.d.cts +10 -0
- package/dist/src/utils/geojson.d.ts +10 -0
- package/dist/src/utils/liveFeatureSource.d.cts +6 -0
- package/dist/src/utils/liveFeatureSource.d.ts +6 -0
- package/dist/src/utils/measureClickFlag.d.cts +2 -0
- package/dist/src/utils/measureClickFlag.d.ts +2 -0
- package/dist/src/utils/modifierDragFlag.d.cts +2 -0
- package/dist/src/utils/modifierDragFlag.d.ts +2 -0
- package/dist/src/utils/rafThrottle.d.cts +11 -0
- package/dist/src/utils/rafThrottle.d.ts +11 -0
- package/dist/src/utils/snapping.d.cts +25 -0
- package/dist/src/utils/snapping.d.ts +25 -0
- package/dist/src/utils/toolCursor.d.cts +3 -0
- package/dist/src/utils/toolCursor.d.ts +3 -0
- package/dist/streets-Bakdn2nG.cjs +1 -0
- package/dist/streets-D0l2l7xn.js +13 -0
- package/dist/style-Db7kunP9.cjs +1 -0
- package/dist/style-Di9c4u-c.js +75 -0
- package/dist/terrain-CUJe0pn4.cjs +1 -0
- package/dist/terrain-CZOhjFPd.js +13 -0
- package/package.json +128 -3
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Map as MapLibreMap, StyleSpecification } from 'maplibre-gl';
|
|
2
|
+
import { BasemapIds } from '../basemapIds.cjs';
|
|
3
|
+
import { NetworkConfig } from '@element-editor/core';
|
|
4
|
+
/** The map-tile part of `config.network` (what the basemap styles read). */
|
|
5
|
+
export type BasemapNetwork = Pick<NetworkConfig, 'vectorTiles' | 'dem' | 'osmRaster' | 'glyphs' | 'sprite'>;
|
|
6
|
+
export type BuiltinBasemapId = 'streets' | 'terrain' | 'light' | 'dark' | 'osm';
|
|
7
|
+
/**
|
|
8
|
+
* A built-in id, `'auto'`, a MapLibre style (URL or object) or a raster `{ url }`. `id` names a
|
|
9
|
+
* custom entry in the picker and in the remembered pick; give every style object one (two
|
|
10
|
+
* id-less style objects can't be told apart).
|
|
11
|
+
*/
|
|
12
|
+
export type BasemapInput = BuiltinBasemapId | 'auto' | {
|
|
13
|
+
style: string | StyleSpecification;
|
|
14
|
+
id?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
thumbnail?: string;
|
|
17
|
+
} | {
|
|
18
|
+
url: string;
|
|
19
|
+
attribution: string;
|
|
20
|
+
maxZoom?: number;
|
|
21
|
+
id?: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
thumbnail?: string;
|
|
24
|
+
};
|
|
25
|
+
type Theme = 'light' | 'dark';
|
|
26
|
+
type Resolved = Exclude<BasemapInput, 'auto'>;
|
|
27
|
+
/** Only `'auto'` changes: light theme -> streets, dark theme -> dark. */
|
|
28
|
+
export declare function resolveBasemap(input: BasemapInput, theme: Theme): Resolved;
|
|
29
|
+
export declare const DEFAULT_GLYPHS_URL = "https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf";
|
|
30
|
+
/** Default sprite (custom `*-badge` icons OpenFreeMap lacks), served from jsDelivr at the package's own version. */
|
|
31
|
+
export declare const DEFAULT_SPRITE_URL: string;
|
|
32
|
+
/**
|
|
33
|
+
* Raw style JSON (sources + layers) -> full MapLibre style, on the servers `network` names
|
|
34
|
+
* (`vectorTiles` → the `openmaptiles` source, `dem` → `terrain-dem`, `glyphs`, `sprite`). Exported for tests.
|
|
35
|
+
*/
|
|
36
|
+
export declare function finishStyle(json: any, network?: BasemapNetwork): StyleSpecification;
|
|
37
|
+
/**
|
|
38
|
+
* The MapLibre style for `input`. Built-ins use the servers `opts.network` names (the editor's
|
|
39
|
+
* `config.network`: `vectorTiles`, `dem`, `glyphs`, `sprite`, `osmRaster`); a style URL is returned as-is.
|
|
40
|
+
*/
|
|
41
|
+
export declare function loadBasemapStyle(input: BasemapInput, opts?: {
|
|
42
|
+
theme?: Theme;
|
|
43
|
+
network?: BasemapNetwork;
|
|
44
|
+
}): Promise<StyleSpecification | string>;
|
|
45
|
+
/**
|
|
46
|
+
* Carries everything that isn't the old basemap from the previous style over to the new one:
|
|
47
|
+
* Element's `elm-*` sources and layers and, when `basemap` (the previous basemap's ids) is known,
|
|
48
|
+
* the host's own sources and layers too. Carried layers keep their order relative to each other
|
|
49
|
+
* and sit above the new basemap's layers. A carried source whose id the new basemap also uses is
|
|
50
|
+
* dropped (the new basemap's wins). Without `basemap` only `elm-*` is carried.
|
|
51
|
+
*/
|
|
52
|
+
export declare function carryOverElm(prev: StyleSpecification | undefined, next: StyleSpecification, basemap?: BasemapIds): StyleSpecification;
|
|
53
|
+
/**
|
|
54
|
+
* Loads the basemap and applies it, keeping Element's layers and the host's own layers and sources
|
|
55
|
+
* (those that weren't part of the previous basemap). The latest call wins.
|
|
56
|
+
*/
|
|
57
|
+
export declare function setBasemap(map: MapLibreMap, input: BasemapInput, opts?: {
|
|
58
|
+
theme?: Theme;
|
|
59
|
+
network?: BasemapNetwork;
|
|
60
|
+
}): Promise<void>;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Map as MapLibreMap, StyleSpecification } from 'maplibre-gl';
|
|
2
|
+
import { BasemapIds } from '../basemapIds.js';
|
|
3
|
+
import { NetworkConfig } from '@element-editor/core';
|
|
4
|
+
/** The map-tile part of `config.network` (what the basemap styles read). */
|
|
5
|
+
export type BasemapNetwork = Pick<NetworkConfig, 'vectorTiles' | 'dem' | 'osmRaster' | 'glyphs' | 'sprite'>;
|
|
6
|
+
export type BuiltinBasemapId = 'streets' | 'terrain' | 'light' | 'dark' | 'osm';
|
|
7
|
+
/**
|
|
8
|
+
* A built-in id, `'auto'`, a MapLibre style (URL or object) or a raster `{ url }`. `id` names a
|
|
9
|
+
* custom entry in the picker and in the remembered pick; give every style object one (two
|
|
10
|
+
* id-less style objects can't be told apart).
|
|
11
|
+
*/
|
|
12
|
+
export type BasemapInput = BuiltinBasemapId | 'auto' | {
|
|
13
|
+
style: string | StyleSpecification;
|
|
14
|
+
id?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
thumbnail?: string;
|
|
17
|
+
} | {
|
|
18
|
+
url: string;
|
|
19
|
+
attribution: string;
|
|
20
|
+
maxZoom?: number;
|
|
21
|
+
id?: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
thumbnail?: string;
|
|
24
|
+
};
|
|
25
|
+
type Theme = 'light' | 'dark';
|
|
26
|
+
type Resolved = Exclude<BasemapInput, 'auto'>;
|
|
27
|
+
/** Only `'auto'` changes: light theme -> streets, dark theme -> dark. */
|
|
28
|
+
export declare function resolveBasemap(input: BasemapInput, theme: Theme): Resolved;
|
|
29
|
+
export declare const DEFAULT_GLYPHS_URL = "https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf";
|
|
30
|
+
/** Default sprite (custom `*-badge` icons OpenFreeMap lacks), served from jsDelivr at the package's own version. */
|
|
31
|
+
export declare const DEFAULT_SPRITE_URL: string;
|
|
32
|
+
/**
|
|
33
|
+
* Raw style JSON (sources + layers) -> full MapLibre style, on the servers `network` names
|
|
34
|
+
* (`vectorTiles` → the `openmaptiles` source, `dem` → `terrain-dem`, `glyphs`, `sprite`). Exported for tests.
|
|
35
|
+
*/
|
|
36
|
+
export declare function finishStyle(json: any, network?: BasemapNetwork): StyleSpecification;
|
|
37
|
+
/**
|
|
38
|
+
* The MapLibre style for `input`. Built-ins use the servers `opts.network` names (the editor's
|
|
39
|
+
* `config.network`: `vectorTiles`, `dem`, `glyphs`, `sprite`, `osmRaster`); a style URL is returned as-is.
|
|
40
|
+
*/
|
|
41
|
+
export declare function loadBasemapStyle(input: BasemapInput, opts?: {
|
|
42
|
+
theme?: Theme;
|
|
43
|
+
network?: BasemapNetwork;
|
|
44
|
+
}): Promise<StyleSpecification | string>;
|
|
45
|
+
/**
|
|
46
|
+
* Carries everything that isn't the old basemap from the previous style over to the new one:
|
|
47
|
+
* Element's `elm-*` sources and layers and, when `basemap` (the previous basemap's ids) is known,
|
|
48
|
+
* the host's own sources and layers too. Carried layers keep their order relative to each other
|
|
49
|
+
* and sit above the new basemap's layers. A carried source whose id the new basemap also uses is
|
|
50
|
+
* dropped (the new basemap's wins). Without `basemap` only `elm-*` is carried.
|
|
51
|
+
*/
|
|
52
|
+
export declare function carryOverElm(prev: StyleSpecification | undefined, next: StyleSpecification, basemap?: BasemapIds): StyleSpecification;
|
|
53
|
+
/**
|
|
54
|
+
* Loads the basemap and applies it, keeping Element's layers and the host's own layers and sources
|
|
55
|
+
* (those that weren't part of the previous basemap). The latest call wins.
|
|
56
|
+
*/
|
|
57
|
+
export declare function setBasemap(map: MapLibreMap, input: BasemapInput, opts?: {
|
|
58
|
+
theme?: Theme;
|
|
59
|
+
network?: BasemapNetwork;
|
|
60
|
+
}): Promise<void>;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
interface Props {
|
|
3
|
+
map: MapLibreMap;
|
|
4
|
+
}
|
|
5
|
+
/** Fits the map bounds to the loaded features once on mount if initialData had content. */
|
|
6
|
+
export declare function FitBounds({ map }: Props): null;
|
|
7
|
+
/** One-shot autofit from URL boundary param. Store convention is [S, N, W, E]
|
|
8
|
+
* (shared with adapter-leaflet). MapLibre's `fitBounds` wants
|
|
9
|
+
* `[[west, south], [east, north]]` so we reorder. */
|
|
10
|
+
export default function BoundaryLayer({ map }: Props): null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
interface Props {
|
|
3
|
+
map: MapLibreMap;
|
|
4
|
+
}
|
|
5
|
+
/** Fits the map bounds to the loaded features once on mount if initialData had content. */
|
|
6
|
+
export declare function FitBounds({ map }: Props): null;
|
|
7
|
+
/** One-shot autofit from URL boundary param. Store convention is [S, N, W, E]
|
|
8
|
+
* (shared with adapter-leaflet). MapLibre's `fitBounds` wants
|
|
9
|
+
* `[[west, south], [east, north]]` so we reorder. */
|
|
10
|
+
export default function BoundaryLayer({ map }: Props): null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
interface Props {
|
|
3
|
+
map: MapLibreMap;
|
|
4
|
+
/**
|
|
5
|
+
* Called when the drag ends without matching any features but a single
|
|
6
|
+
* line/polygon is already selected — supplies indices of vertices that
|
|
7
|
+
* fell inside the rubber band. Parent can choose whether to enter vertex
|
|
8
|
+
* edit mode with those pre-selected.
|
|
9
|
+
*/
|
|
10
|
+
onVertexBoxSelect?: (featureId: string, indices: number[]) => void;
|
|
11
|
+
}
|
|
12
|
+
export default function BoxSelectHandler({ map, onVertexBoxSelect }: Props): null;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
interface Props {
|
|
3
|
+
map: MapLibreMap;
|
|
4
|
+
/**
|
|
5
|
+
* Called when the drag ends without matching any features but a single
|
|
6
|
+
* line/polygon is already selected — supplies indices of vertices that
|
|
7
|
+
* fell inside the rubber band. Parent can choose whether to enter vertex
|
|
8
|
+
* edit mode with those pre-selected.
|
|
9
|
+
*/
|
|
10
|
+
onVertexBoxSelect?: (featureId: string, indices: number[]) => void;
|
|
11
|
+
}
|
|
12
|
+
export default function BoxSelectHandler({ map, onVertexBoxSelect }: Props): null;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
interface Props {
|
|
3
|
+
map: MapLibreMap;
|
|
4
|
+
/** Deprecated `routingApiKey` prop of the controls (`config.network.routing.apiKey` wins). */
|
|
5
|
+
routingApiKey?: string;
|
|
6
|
+
}
|
|
7
|
+
export default function DrawingLayer({ map, routingApiKey }: Props): null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
interface Props {
|
|
3
|
+
map: MapLibreMap;
|
|
4
|
+
/** Deprecated `routingApiKey` prop of the controls (`config.network.routing.apiKey` wins). */
|
|
5
|
+
routingApiKey?: string;
|
|
6
|
+
}
|
|
7
|
+
export default function DrawingLayer({ map, routingApiKey }: Props): null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare function initPreviewLayers(map: MapLibreMap): void;
|
|
3
|
+
export declare function cleanupPreviewLayers(map: MapLibreMap): void;
|
|
4
|
+
interface Props {
|
|
5
|
+
map: MapLibreMap;
|
|
6
|
+
}
|
|
7
|
+
export default function DrawingPreviewLayer({ map }: Props): null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare function initPreviewLayers(map: MapLibreMap): void;
|
|
3
|
+
export declare function cleanupPreviewLayers(map: MapLibreMap): void;
|
|
4
|
+
interface Props {
|
|
5
|
+
map: MapLibreMap;
|
|
6
|
+
}
|
|
7
|
+
export default function DrawingPreviewLayer({ map }: Props): null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare function initDragGhostLayers(map: MapLibreMap): void;
|
|
3
|
+
export declare function cleanupDragGhostLayers(map: MapLibreMap): void;
|
|
4
|
+
interface Props {
|
|
5
|
+
map: MapLibreMap;
|
|
6
|
+
}
|
|
7
|
+
export default function FeatureInteractionLayer({ map }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare function initDragGhostLayers(map: MapLibreMap): void;
|
|
3
|
+
export declare function cleanupDragGhostLayers(map: MapLibreMap): void;
|
|
4
|
+
interface Props {
|
|
5
|
+
map: MapLibreMap;
|
|
6
|
+
}
|
|
7
|
+
export default function FeatureInteractionLayer({ map }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare function initFeatureLayers(map: MapLibreMap): void;
|
|
3
|
+
export declare function cleanupFeatureLayers(map: MapLibreMap): void;
|
|
4
|
+
export declare const INTERACTIVE_FEATURE_LAYERS: string[];
|
|
5
|
+
interface Props {
|
|
6
|
+
map: MapLibreMap;
|
|
7
|
+
}
|
|
8
|
+
export default function FeatureLayer({ map }: Props): null;
|
|
9
|
+
declare module 'maplibre-gl' {
|
|
10
|
+
interface GeoJSONSource {
|
|
11
|
+
setData(data: GeoJSON.FeatureCollection | string): void;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare function setHoverState(map: MapLibreMap, id: string | null, prevId: string | null): void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare function initFeatureLayers(map: MapLibreMap): void;
|
|
3
|
+
export declare function cleanupFeatureLayers(map: MapLibreMap): void;
|
|
4
|
+
export declare const INTERACTIVE_FEATURE_LAYERS: string[];
|
|
5
|
+
interface Props {
|
|
6
|
+
map: MapLibreMap;
|
|
7
|
+
}
|
|
8
|
+
export default function FeatureLayer({ map }: Props): null;
|
|
9
|
+
declare module 'maplibre-gl' {
|
|
10
|
+
interface GeoJSONSource {
|
|
11
|
+
setData(data: GeoJSON.FeatureCollection | string): void;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare function setHoverState(map: MapLibreMap, id: string | null, prevId: string | null): void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare function initProcessingPreviewLayers(map: MapLibreMap): void;
|
|
3
|
+
export declare function cleanupProcessingPreviewLayers(map: MapLibreMap): void;
|
|
4
|
+
interface Props {
|
|
5
|
+
map: MapLibreMap;
|
|
6
|
+
}
|
|
7
|
+
export default function GeometryProcessingPreview({ map }: Props): null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare function initProcessingPreviewLayers(map: MapLibreMap): void;
|
|
3
|
+
export declare function cleanupProcessingPreviewLayers(map: MapLibreMap): void;
|
|
4
|
+
interface Props {
|
|
5
|
+
map: MapLibreMap;
|
|
6
|
+
}
|
|
7
|
+
export default function GeometryProcessingPreview({ map }: Props): null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare const MEASURE_INTERACTIVE_LAYERS: string[];
|
|
3
|
+
export declare function initMeasurePreviewLayers(map: MapLibreMap): void;
|
|
4
|
+
export declare function cleanupMeasurePreviewLayers(map: MapLibreMap): void;
|
|
5
|
+
interface Props {
|
|
6
|
+
map: MapLibreMap;
|
|
7
|
+
}
|
|
8
|
+
export default function MeasurePreviewLayer({ map }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare const MEASURE_INTERACTIVE_LAYERS: string[];
|
|
3
|
+
export declare function initMeasurePreviewLayers(map: MapLibreMap): void;
|
|
4
|
+
export declare function cleanupMeasurePreviewLayers(map: MapLibreMap): void;
|
|
5
|
+
interface Props {
|
|
6
|
+
map: MapLibreMap;
|
|
7
|
+
}
|
|
8
|
+
export default function MeasurePreviewLayer({ map }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare function initOverlayLayers(map: MapLibreMap): void;
|
|
3
|
+
export declare function cleanupOverlayLayers(map: MapLibreMap): void;
|
|
4
|
+
interface Props {
|
|
5
|
+
map: MapLibreMap;
|
|
6
|
+
}
|
|
7
|
+
export declare function OsmTraceHandler({ map }: Props): import('react').ReactPortal | null;
|
|
8
|
+
export default OsmTraceHandler;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare function initOverlayLayers(map: MapLibreMap): void;
|
|
3
|
+
export declare function cleanupOverlayLayers(map: MapLibreMap): void;
|
|
4
|
+
interface Props {
|
|
5
|
+
map: MapLibreMap;
|
|
6
|
+
}
|
|
7
|
+
export declare function OsmTraceHandler({ map }: Props): import('react').ReactPortal | null;
|
|
8
|
+
export default OsmTraceHandler;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
interface Props {
|
|
3
|
+
map: MapLibreMap;
|
|
4
|
+
coords: [number, number];
|
|
5
|
+
/** Commit the new coordinate (take an undo snapshot first). */
|
|
6
|
+
onSave: (coord: [number, number]) => void;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
export default function PreciseCoordsOverlay({ map, coords, onSave, onClose }: Props): import('react').ReactPortal;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
interface Props {
|
|
3
|
+
map: MapLibreMap;
|
|
4
|
+
coords: [number, number];
|
|
5
|
+
/** Commit the new coordinate (take an undo snapshot first). */
|
|
6
|
+
onSave: (coord: [number, number]) => void;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
export default function PreciseCoordsOverlay({ map, coords, onSave, onClose }: Props): import('react').ReactPortal;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare function initSnapLayers(map: MapLibreMap): void;
|
|
3
|
+
export declare function cleanupSnapLayers(map: MapLibreMap): void;
|
|
4
|
+
export declare function ensureDiamondIcon(map: MapLibreMap, color: string): void;
|
|
5
|
+
interface Props {
|
|
6
|
+
map: MapLibreMap;
|
|
7
|
+
}
|
|
8
|
+
export default function SnapController({ map }: Props): null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
export declare function initSnapLayers(map: MapLibreMap): void;
|
|
3
|
+
export declare function cleanupSnapLayers(map: MapLibreMap): void;
|
|
4
|
+
export declare function ensureDiamondIcon(map: MapLibreMap, color: string): void;
|
|
5
|
+
interface Props {
|
|
6
|
+
map: MapLibreMap;
|
|
7
|
+
}
|
|
8
|
+
export default function SnapController({ map }: Props): null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
import { GeoJSONFeature } from '@element-editor/core';
|
|
3
|
+
interface Props {
|
|
4
|
+
map: MapLibreMap;
|
|
5
|
+
feature: GeoJSONFeature;
|
|
6
|
+
onDone: () => void;
|
|
7
|
+
}
|
|
8
|
+
export default function TextEditOverlay({ map, feature, onDone }: Props): import('react').ReactPortal;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
import { GeoJSONFeature } from '@element-editor/core';
|
|
3
|
+
interface Props {
|
|
4
|
+
map: MapLibreMap;
|
|
5
|
+
feature: GeoJSONFeature;
|
|
6
|
+
onDone: () => void;
|
|
7
|
+
}
|
|
8
|
+
export default function TextEditOverlay({ map, feature, onDone }: Props): import('react').ReactPortal;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
import { GeoJSONFeature } from '@element-editor/core';
|
|
3
|
+
interface Props {
|
|
4
|
+
map: MapLibreMap;
|
|
5
|
+
features: GeoJSONFeature[];
|
|
6
|
+
}
|
|
7
|
+
export default function TransformControls({ map, features }: Props): null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
import { GeoJSONFeature } from '@element-editor/core';
|
|
3
|
+
interface Props {
|
|
4
|
+
map: MapLibreMap;
|
|
5
|
+
features: GeoJSONFeature[];
|
|
6
|
+
}
|
|
7
|
+
export default function TransformControls({ map, features }: Props): null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
import { GeoJSONFeature } from '@element-editor/core';
|
|
3
|
+
interface Props {
|
|
4
|
+
map: MapLibreMap;
|
|
5
|
+
feature: GeoJSONFeature;
|
|
6
|
+
/**
|
|
7
|
+
* Pre-selected vertex indices (ring 0 only) — used by box-select-while-
|
|
8
|
+
* a-feature-is-selected to drop the user straight into vertex edit with
|
|
9
|
+
* those vertices ready for bulk delete/simplify. Parent is responsible
|
|
10
|
+
* for clearing this the turn after we consume it.
|
|
11
|
+
*/
|
|
12
|
+
initialSelectedIndices?: number[];
|
|
13
|
+
}
|
|
14
|
+
export default function VertexEditor({ map, feature, initialSelectedIndices }: Props): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
import { GeoJSONFeature } from '@element-editor/core';
|
|
3
|
+
interface Props {
|
|
4
|
+
map: MapLibreMap;
|
|
5
|
+
feature: GeoJSONFeature;
|
|
6
|
+
/**
|
|
7
|
+
* Pre-selected vertex indices (ring 0 only) — used by box-select-while-
|
|
8
|
+
* a-feature-is-selected to drop the user straight into vertex edit with
|
|
9
|
+
* those vertices ready for bulk delete/simplify. Parent is responsible
|
|
10
|
+
* for clearing this the turn after we consume it.
|
|
11
|
+
*/
|
|
12
|
+
initialSelectedIndices?: number[];
|
|
13
|
+
}
|
|
14
|
+
export default function VertexEditor({ map, feature, initialSelectedIndices }: Props): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FeatureStyle, GeoJSONFeature } from '@element-editor/core';
|
|
3
|
+
export type { FeatureStyle };
|
|
4
|
+
export type FeatureStyleFn = (feature: GeoJSONFeature) => FeatureStyle | undefined | null;
|
|
5
|
+
export declare function FeatureStyleProvider({ getFeatureStyle, children, }: {
|
|
6
|
+
getFeatureStyle?: FeatureStyleFn;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function useFeatureStyle(): FeatureStyleFn | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FeatureStyle, GeoJSONFeature } from '@element-editor/core';
|
|
3
|
+
export type { FeatureStyle };
|
|
4
|
+
export type FeatureStyleFn = (feature: GeoJSONFeature) => FeatureStyle | undefined | null;
|
|
5
|
+
export declare function FeatureStyleProvider({ getFeatureStyle, children, }: {
|
|
6
|
+
getFeatureStyle?: FeatureStyleFn;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function useFeatureStyle(): FeatureStyleFn | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bumped each time Element (re)created its `elm-*` sources on the map's current style: the first
|
|
3
|
+
* init and every repair after a `map.setStyle`. Effects that push data into an `elm-*` source list
|
|
4
|
+
* it as a dependency, so they refill the new, empty sources.
|
|
5
|
+
*/
|
|
6
|
+
export declare const StyleEpochContext: import('react').Context<number>;
|
|
7
|
+
export declare const useStyleEpoch: () => number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bumped each time Element (re)created its `elm-*` sources on the map's current style: the first
|
|
3
|
+
* init and every repair after a `map.setStyle`. Effects that push data into an `elm-*` source list
|
|
4
|
+
* it as a dependency, so they refill the new, empty sources.
|
|
5
|
+
*/
|
|
6
|
+
export declare const StyleEpochContext: import('react').Context<number>;
|
|
7
|
+
export declare const useStyleEpoch: () => number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
/**
|
|
3
|
+
* Adds whatever of Element's sources, layers and images the map's style lacks, on top of the
|
|
4
|
+
* style. Idempotent. Throws while the style is still loading ("Style is not done loading").
|
|
5
|
+
*/
|
|
6
|
+
export declare function ensureElementLayers(map: MapLibreMap): void;
|
|
7
|
+
export declare function cleanupElementLayers(map: MapLibreMap): void;
|
|
8
|
+
/**
|
|
9
|
+
* Keeps Element's layers on `map`: adds them now (or once the style can take them) and again
|
|
10
|
+
* whenever the style is replaced — anyone's `map.setStyle`, full rebuild or diff (both drop
|
|
11
|
+
* `elm-*`), or a full rebuild in our own `setBasemap` (which carries the layers over, but as new
|
|
12
|
+
* sources without their feature-state). The trigger: `elm-features` is missing or isn't the source
|
|
13
|
+
* object last synced. Nothing gates on `isStyleLoaded()` / `loaded()` (both lie under StrictMode):
|
|
14
|
+
* a still-loading style throws, and the next `styledata` / `style.load` / `load` retries.
|
|
15
|
+
* `onSynced` runs after each (re)add, so callers refill the new, empty sources. Returns the unsubscribe.
|
|
16
|
+
*/
|
|
17
|
+
export declare function watchElementLayers(map: MapLibreMap, onSynced: () => void): () => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
/**
|
|
3
|
+
* Adds whatever of Element's sources, layers and images the map's style lacks, on top of the
|
|
4
|
+
* style. Idempotent. Throws while the style is still loading ("Style is not done loading").
|
|
5
|
+
*/
|
|
6
|
+
export declare function ensureElementLayers(map: MapLibreMap): void;
|
|
7
|
+
export declare function cleanupElementLayers(map: MapLibreMap): void;
|
|
8
|
+
/**
|
|
9
|
+
* Keeps Element's layers on `map`: adds them now (or once the style can take them) and again
|
|
10
|
+
* whenever the style is replaced — anyone's `map.setStyle`, full rebuild or diff (both drop
|
|
11
|
+
* `elm-*`), or a full rebuild in our own `setBasemap` (which carries the layers over, but as new
|
|
12
|
+
* sources without their feature-state). The trigger: `elm-features` is missing or isn't the source
|
|
13
|
+
* object last synced. Nothing gates on `isStyleLoaded()` / `loaded()` (both lie under StrictMode):
|
|
14
|
+
* a still-loading style throws, and the next `styledata` / `style.load` / `load` retries.
|
|
15
|
+
* `onSynced` runs after each (re)add, so callers refill the new, empty sources. Returns the unsubscribe.
|
|
16
|
+
*/
|
|
17
|
+
export declare function watchElementLayers(map: MapLibreMap, onSynced: () => void): () => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module-level pointer tracker. Parallel to `adapter-leaflet/src/hooks/lastPointer.ts`.
|
|
3
|
+
* Used by `FeatureInteractionLayer` to synthesise a `mousemove` on MapLibre's
|
|
4
|
+
* internal event pipeline when a new feature lands under a stationary cursor —
|
|
5
|
+
* the user's mouse didn't move, so no hover hit-test fires on its own and
|
|
6
|
+
* modifier-cursor affordances (Cmd/Alt) never activate on the fresh feature.
|
|
7
|
+
*
|
|
8
|
+
* Listeners are installed **eagerly at module load** (never lazily), so state
|
|
9
|
+
* reflects every `mousemove` that happened before the first consumer runs.
|
|
10
|
+
*/
|
|
11
|
+
export type PointerState = {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
ctrlKey: boolean;
|
|
15
|
+
metaKey: boolean;
|
|
16
|
+
altKey: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function getLastPointer(): PointerState;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module-level pointer tracker. Parallel to `adapter-leaflet/src/hooks/lastPointer.ts`.
|
|
3
|
+
* Used by `FeatureInteractionLayer` to synthesise a `mousemove` on MapLibre's
|
|
4
|
+
* internal event pipeline when a new feature lands under a stationary cursor —
|
|
5
|
+
* the user's mouse didn't move, so no hover hit-test fires on its own and
|
|
6
|
+
* modifier-cursor affordances (Cmd/Alt) never activate on the fresh feature.
|
|
7
|
+
*
|
|
8
|
+
* Listeners are installed **eagerly at module load** (never lazily), so state
|
|
9
|
+
* reflects every `mousemove` that happened before the first consumer runs.
|
|
10
|
+
*/
|
|
11
|
+
export type PointerState = {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
ctrlKey: boolean;
|
|
15
|
+
metaKey: boolean;
|
|
16
|
+
altKey: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function getLastPointer(): PointerState;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
2
|
+
/**
|
|
3
|
+
* Tracks the latest map cursor lng/lat while a caller-specified mode is active
|
|
4
|
+
* and resets on every `editingMode` transition so exiting-and-re-entering the
|
|
5
|
+
* same tool (e.g. press R → off → R from a new cursor position) doesn't leak
|
|
6
|
+
* the previous session's coordinates on the first frame.
|
|
7
|
+
*
|
|
8
|
+
* React's "set state during render" reset pattern is used intentionally — it
|
|
9
|
+
* produces a synchronous re-render with cleared state before the browser
|
|
10
|
+
* paints, so there's no stale-coord flash.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
*
|
|
14
|
+
* const mouse = useCursorWhileMode(map, editingMode, editingMode === 'draw-rect')
|
|
15
|
+
*
|
|
16
|
+
* Pass a predicate that's true whenever cursor updates should flow into state.
|
|
17
|
+
* On mouseout (cursor leaves the map canvas) the value resets to null, so
|
|
18
|
+
* tooltips / previews that depend on it disappear.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useCursorWhileMode(map: MapLibreMap, editingMode: string, isActive: boolean): [number, number] | null;
|