@florasync/leaflet-geokit 0.9.0 → 0.10.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/ARCHITECTURE.md +195 -0
- package/CHANGELOG.md +5 -0
- package/README.md +7 -1
- package/custom-toolbar.html +165 -0
- package/dist/django/index.js +734 -734
- package/dist/django/index.js.map +1 -1
- package/dist/leaflet-geokit.es.js +1704 -1704
- package/dist/leaflet-geokit.es.js.map +1 -1
- package/dist/leaflet-geokit.external.es.js +1501 -1496
- package/dist/leaflet-geokit.external.es.js.map +1 -1
- package/dist/leaflet-geokit.umd.js +11 -14
- package/dist/leaflet-geokit.umd.js.map +1 -1
- package/dist/preact/{index-DCKj0r6a.js → index-Z22Un5Tg.js} +474 -469
- package/dist/preact/index-Z22Un5Tg.js.map +1 -0
- package/dist/preact/index.js +1 -1
- package/dist/preact-bundled/index.js +731 -731
- package/dist/preact-bundled/index.js.map +1 -1
- package/dist/react/{index-DCKj0r6a.js → index-Z22Un5Tg.js} +474 -469
- package/dist/react/index-Z22Un5Tg.js.map +1 -0
- package/dist/react/index.js +1 -1
- package/dist/react-bundled/index.js +731 -731
- package/dist/react-bundled/index.js.map +1 -1
- package/dist/types/components/LeafletDrawMapElement.d.ts +6 -6
- package/dist/types/django/index.d.ts +2 -2
- package/dist/types/external.d.ts +9 -9
- package/dist/types/index.d.ts +9 -9
- package/dist/types/lib/FeatureStore.d.ts +2 -2
- package/dist/types/lib/LayerRegistry.d.ts +1 -1
- package/dist/types/lib/MapController.d.ts +8 -8
- package/dist/types/lib/layer-cake/LayerCakeManager.d.ts +2 -2
- package/dist/types/lib/layer-style-panel.d.ts +1 -1
- package/dist/types/lib/marker-icons.d.ts +1 -1
- package/dist/types/lib/providers.d.ts +1 -1
- package/dist/types/lib/snapping.d.ts +1 -1
- package/dist/types/lib/tool-buttons.d.ts +1 -1
- package/dist/types/lib/tool-capabilities.d.ts +1 -1
- package/dist/types/lib/toolbar-layout.d.ts +1 -1
- package/dist/types/preact/core.d.ts +2 -2
- package/dist/types/preact/index.d.ts +2 -2
- package/dist/types/preact-bundled/index.d.ts +3 -3
- package/dist/types/react/core.d.ts +2 -2
- package/dist/types/react/index.d.ts +2 -2
- package/dist/types/react-bundled/index.d.ts +3 -3
- package/dist/types/types/events.d.ts +1 -1
- package/dist/types/types/public.d.ts +6 -6
- package/dist/types/utils/geojson-pipeline.d.ts +1 -1
- package/dist/types/utils/geojson.d.ts +1 -1
- package/docs/api-reference.md +249 -0
- package/docs/custom-toolbar.md +168 -0
- package/docs/diagnostics.md +216 -0
- package/docs/grower-measurement.md +23 -0
- package/docs/integration-recipes.md +301 -0
- package/docs/release-verification.md +75 -0
- package/docs/shims/django.md +102 -0
- package/docs/shims/preact.md +98 -0
- package/docs/shims/react.md +98 -0
- package/docs/toolbar-layout.md +158 -0
- package/docs/toolbar-styling.md +2 -2
- package/package.json +15 -4
- package/dist/preact/index-DCKj0r6a.js.map +0 -1
- package/dist/react/index-DCKj0r6a.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Feature, FeatureCollection } from "geojson";
|
|
2
|
-
import type { MapLayer, LayerStyle, LayerCakeSessionUpdate } from "../types/layers";
|
|
3
|
-
import type { GeoJSONImportOptions, GeoJSONExportOptions, LeafletDrawMapElementAPI, IntegratedToolEventEmitter, IntegratedToolHooks, MarkerIconConfig, MeasurementSystem, SnappingOptions, MeasurementOverlayOptions, ToolButtonConfig, ToolButtonName, ToolCapabilities, ToolToolbarGroupConfig, ToolTriggerOptions } from "../types/public";
|
|
4
|
-
import { type StatusEventDetail } from "../types/events";
|
|
5
|
-
import { type LogLevel } from "../utils/logger";
|
|
6
|
-
import type { BasemapAdapter, ProviderDiagnostics } from "../lib/providers";
|
|
2
|
+
import type { MapLayer, LayerStyle, LayerCakeSessionUpdate } from "../types/layers.js";
|
|
3
|
+
import type { GeoJSONImportOptions, GeoJSONExportOptions, LeafletDrawMapElementAPI, IntegratedToolEventEmitter, IntegratedToolHooks, MarkerIconConfig, MeasurementSystem, SnappingOptions, MeasurementOverlayOptions, ToolButtonConfig, ToolButtonName, ToolCapabilities, ToolToolbarGroupConfig, ToolTriggerOptions } from "../types/public.js";
|
|
4
|
+
import { type StatusEventDetail } from "../types/events.js";
|
|
5
|
+
import { type LogLevel } from "../utils/logger.js";
|
|
6
|
+
import type { BasemapAdapter, ProviderDiagnostics } from "../lib/providers.js";
|
|
7
7
|
import type * as LeafletNS from "leaflet";
|
|
8
8
|
export declare class LeafletDrawMapElement extends HTMLElement implements LeafletDrawMapElementAPI {
|
|
9
9
|
private _root;
|
|
@@ -166,7 +166,7 @@ export declare class LeafletDrawMapElement extends HTMLElement implements Leafle
|
|
|
166
166
|
reorderLayers(ids: readonly string[]): Promise<void>;
|
|
167
167
|
focusLayer(id: string): Promise<void>;
|
|
168
168
|
removeLayer(id: string): Promise<void>;
|
|
169
|
-
getLayerCakeSession(): import("../types/layers").LayerCakeSession | null;
|
|
169
|
+
getLayerCakeSession(): import("../types/layers.js").LayerCakeSession | null;
|
|
170
170
|
updateLayerCakeSession(update: LayerCakeSessionUpdate): Promise<void>;
|
|
171
171
|
saveLayerCakeSession(): Promise<void>;
|
|
172
172
|
cancelLayerCakeSession(): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../index";
|
|
2
|
-
import type { LeafletDrawMapElement } from "../components/LeafletDrawMapElement";
|
|
1
|
+
import "../index.js";
|
|
2
|
+
import type { LeafletDrawMapElement } from "../components/LeafletDrawMapElement.js";
|
|
3
3
|
export type DjangoShimPhase = "mount" | "parse" | "sync";
|
|
4
4
|
export interface DjangoShimErrorContext {
|
|
5
5
|
phase: DjangoShimPhase;
|
package/dist/types/external.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { LeafletDrawMapElement } from "./components/LeafletDrawMapElement";
|
|
1
|
+
import { LeafletDrawMapElement } from "./components/LeafletDrawMapElement.js";
|
|
2
2
|
export { LeafletDrawMapElement };
|
|
3
|
-
export * from "./types/public";
|
|
4
|
-
export * from "./types/events";
|
|
5
|
-
export * from "./utils/geojson-pipeline";
|
|
6
|
-
export * from "./lib/providers";
|
|
7
|
-
export { GROWER_PRESETS, boundingBoxGeoJSON, bufferGeoJSON, centroidGeoJSON, createBedWidthGuides, createIrrigationZones, createRowSpacingGuides, formatMeasurements, measureGeoJSON, mergeGeoJSON, simplifyGeoJSON, splitGeoJSON, } from "./utils/grower-geometry";
|
|
8
|
-
export type { AreaUnit, BufferedGeoJSON, DistanceUnit, FormattedGeoJSONMeasurements, FormattedQuantity, GeoJSONMeasurements, GrowerGeometryError, GrowerGeometryErrorCode, GrowerGeometryResult, IrrigationZoneOptions, MeasurementFormatOptions, RowSpacingGuideOptions, SimplifyGeoJSONOptions, SplitterGeometry, SupportedGeoJSON, } from "./utils/grower-geometry";
|
|
9
|
-
export { findSnap } from "./lib/snapping";
|
|
10
|
-
export type { SnapLatLng, SnapResult, SnapScreenPoint, SnapTarget, } from "./lib/snapping";
|
|
3
|
+
export * from "./types/public.js";
|
|
4
|
+
export * from "./types/events.js";
|
|
5
|
+
export * from "./utils/geojson-pipeline.js";
|
|
6
|
+
export * from "./lib/providers.js";
|
|
7
|
+
export { GROWER_PRESETS, boundingBoxGeoJSON, bufferGeoJSON, centroidGeoJSON, createBedWidthGuides, createIrrigationZones, createRowSpacingGuides, formatMeasurements, measureGeoJSON, mergeGeoJSON, simplifyGeoJSON, splitGeoJSON, } from "./utils/grower-geometry.js";
|
|
8
|
+
export type { AreaUnit, BufferedGeoJSON, DistanceUnit, FormattedGeoJSONMeasurements, FormattedQuantity, GeoJSONMeasurements, GrowerGeometryError, GrowerGeometryErrorCode, GrowerGeometryResult, IrrigationZoneOptions, MeasurementFormatOptions, RowSpacingGuideOptions, SimplifyGeoJSONOptions, SplitterGeometry, SupportedGeoJSON, } from "./utils/grower-geometry.js";
|
|
9
|
+
export { findSnap } from "./lib/snapping.js";
|
|
10
|
+
export type { SnapLatLng, SnapResult, SnapScreenPoint, SnapTarget, } from "./lib/snapping.js";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { LeafletDrawMapElement } from "./components/LeafletDrawMapElement";
|
|
1
|
+
import { LeafletDrawMapElement } from "./components/LeafletDrawMapElement.js";
|
|
2
2
|
export { LeafletDrawMapElement };
|
|
3
|
-
export * from "./types/public";
|
|
4
|
-
export * from "./types/events";
|
|
5
|
-
export * from "./utils/geojson-pipeline";
|
|
6
|
-
export * from "./lib/providers";
|
|
7
|
-
export { GROWER_PRESETS, boundingBoxGeoJSON, bufferGeoJSON, centroidGeoJSON, createBedWidthGuides, createIrrigationZones, createRowSpacingGuides, formatMeasurements, measureGeoJSON, mergeGeoJSON, simplifyGeoJSON, splitGeoJSON, } from "./utils/grower-geometry";
|
|
8
|
-
export type { AreaUnit, BufferedGeoJSON, DistanceUnit, FormattedGeoJSONMeasurements, FormattedQuantity, GeoJSONMeasurements, GrowerGeometryError, GrowerGeometryErrorCode, GrowerGeometryResult, IrrigationZoneOptions, MeasurementFormatOptions, RowSpacingGuideOptions, SimplifyGeoJSONOptions, SplitterGeometry, SupportedGeoJSON, } from "./utils/grower-geometry";
|
|
9
|
-
export { findSnap } from "./lib/snapping";
|
|
10
|
-
export type { SnapLatLng, SnapResult, SnapScreenPoint, SnapTarget, } from "./lib/snapping";
|
|
3
|
+
export * from "./types/public.js";
|
|
4
|
+
export * from "./types/events.js";
|
|
5
|
+
export * from "./utils/geojson-pipeline.js";
|
|
6
|
+
export * from "./lib/providers.js";
|
|
7
|
+
export { GROWER_PRESETS, boundingBoxGeoJSON, bufferGeoJSON, centroidGeoJSON, createBedWidthGuides, createIrrigationZones, createRowSpacingGuides, formatMeasurements, measureGeoJSON, mergeGeoJSON, simplifyGeoJSON, splitGeoJSON, } from "./utils/grower-geometry.js";
|
|
8
|
+
export type { AreaUnit, BufferedGeoJSON, DistanceUnit, FormattedGeoJSONMeasurements, FormattedQuantity, GeoJSONMeasurements, GrowerGeometryError, GrowerGeometryErrorCode, GrowerGeometryResult, IrrigationZoneOptions, MeasurementFormatOptions, RowSpacingGuideOptions, SimplifyGeoJSONOptions, SplitterGeometry, SupportedGeoJSON, } from "./utils/grower-geometry.js";
|
|
9
|
+
export { findSnap } from "./lib/snapping.js";
|
|
10
|
+
export type { SnapLatLng, SnapResult, SnapScreenPoint, SnapTarget, } from "./lib/snapping.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Feature, FeatureCollection } from "geojson";
|
|
2
|
-
import { type BoundsPair } from "../utils/geojson";
|
|
3
|
-
import { type Logger } from "../utils/logger";
|
|
2
|
+
import { type BoundsPair } from "../utils/geojson.js";
|
|
3
|
+
import { type Logger } from "../utils/logger.js";
|
|
4
4
|
/**
|
|
5
5
|
* FeatureStore
|
|
6
6
|
* - Maintains a stable, id-centric in-memory FeatureCollection
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LayerDefinition, LayerKind, LayerSnapshot, LayerStyle, MapLayer } from "../types/layers";
|
|
1
|
+
import type { LayerDefinition, LayerKind, LayerSnapshot, LayerStyle, MapLayer } from "../types/layers.js";
|
|
2
2
|
export declare function validateLayerStyle(value: LayerStyle): LayerStyle;
|
|
3
3
|
/** Framework- and renderer-independent registry. All returned values are detached. */
|
|
4
4
|
export declare class LayerRegistry {
|
|
@@ -2,13 +2,13 @@ import * as BundledL from "leaflet";
|
|
|
2
2
|
import "leaflet-draw";
|
|
3
3
|
import "leaflet-ruler";
|
|
4
4
|
import type { Feature, FeatureCollection } from "geojson";
|
|
5
|
-
import type { DrawControlsConfig, GeoJSONExportOptions, GeoJSONImportOptions, MapConfig, MeasurementSystem, SnappingOptions, MeasurementOverlayOptions, IntegratedToolEventEmitter, IntegratedToolHooks, ToolButtonConfig, ToolButtonName, ToolCapabilities, ToolProviderCapability, ToolCommandEventDetail, ToolEventDetail, ToolLifecycleEventName, ToolToolbarGroupConfig, ToolTriggerEventDetail, ToolTriggerOptions } from "../types/public";
|
|
6
|
-
import type { ErrorEventDetail } from "../types/events";
|
|
7
|
-
import { type Logger } from "../utils/logger";
|
|
8
|
-
import type { MapLayer, LayerStyle, LayerCakeSessionUpdate, LayerStyleRequestDetail } from "../types/layers";
|
|
9
|
-
import { type NormalizedMarkerIconConfig } from "
|
|
10
|
-
import type { TileURLTemplate } from "
|
|
11
|
-
import type { BasemapAdapter, ProviderDiagnostics } from "
|
|
5
|
+
import type { DrawControlsConfig, GeoJSONExportOptions, GeoJSONImportOptions, MapConfig, MeasurementSystem, SnappingOptions, MeasurementOverlayOptions, IntegratedToolEventEmitter, IntegratedToolHooks, ToolButtonConfig, ToolButtonName, ToolCapabilities, ToolProviderCapability, ToolCommandEventDetail, ToolEventDetail, ToolLifecycleEventName, ToolToolbarGroupConfig, ToolTriggerEventDetail, ToolTriggerOptions } from "../types/public.js";
|
|
6
|
+
import type { ErrorEventDetail } from "../types/events.js";
|
|
7
|
+
import { type Logger } from "../utils/logger.js";
|
|
8
|
+
import type { MapLayer, LayerStyle, LayerCakeSessionUpdate, LayerStyleRequestDetail } from "../types/layers.js";
|
|
9
|
+
import { type NormalizedMarkerIconConfig } from "./marker-icons.js";
|
|
10
|
+
import type { TileURLTemplate } from "./TileProviderFactory.js";
|
|
11
|
+
import type { BasemapAdapter, ProviderDiagnostics } from "./providers.js";
|
|
12
12
|
export interface MapControllerCallbacks {
|
|
13
13
|
onLayerEvent?: (name: string, detail: unknown) => void;
|
|
14
14
|
onLayerStyleRequested?: (detail: LayerStyleRequestDetail) => boolean;
|
|
@@ -170,7 +170,7 @@ export declare class MapController {
|
|
|
170
170
|
reorderLayers(ids: readonly string[]): void;
|
|
171
171
|
focusLayer(id: string): Promise<void>;
|
|
172
172
|
removeLayer(id: string): Promise<void>;
|
|
173
|
-
getLayerCakeSession(): import("../types/layers").LayerCakeSession | null;
|
|
173
|
+
getLayerCakeSession(): import("../types/layers.js").LayerCakeSession | null;
|
|
174
174
|
updateLayerCakeSession(update: LayerCakeSessionUpdate): void;
|
|
175
175
|
saveLayerCakeSession(): void;
|
|
176
176
|
cancelLayerCakeSession(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as L from "leaflet";
|
|
2
|
-
import type { MeasurementSystem } from "../../types/public";
|
|
3
|
-
import { type LayerCakeSession, type LayerCakeSessionUpdate } from "../../types/layers";
|
|
2
|
+
import type { MeasurementSystem } from "../../types/public.js";
|
|
3
|
+
import { type LayerCakeSession, type LayerCakeSessionUpdate } from "../../types/layers.js";
|
|
4
4
|
export declare class LayerCakeManager {
|
|
5
5
|
private onChange?;
|
|
6
6
|
private map;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type MapLayer, type LayerStyle } from "../types/layers";
|
|
1
|
+
import { type MapLayer, type LayerStyle } from "../types/layers.js";
|
|
2
2
|
/** Small default panel. Hosts can cancel the public request and render their own. */
|
|
3
3
|
export declare function openLayerStylePanel(root: HTMLElement, layers: MapLayer[], apply: (id: string, style: LayerStyle) => void): () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MarkerIconConfig, MarkerIconPoint } from "../types/public";
|
|
1
|
+
import type { MarkerIconConfig, MarkerIconPoint } from "../types/public.js";
|
|
2
2
|
export declare const DEFAULT_MARKER_ICON_SIZE: MarkerIconPoint;
|
|
3
3
|
export declare const DEFAULT_MARKER_ICON_ANCHOR: MarkerIconPoint;
|
|
4
4
|
export declare const DEFAULT_MARKER_POPUP_ANCHOR: MarkerIconPoint;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as Leaflet from "leaflet";
|
|
2
|
-
import type { TileProviderConfig, TileURLTemplate } from "./TileProviderFactory";
|
|
2
|
+
import type { TileProviderConfig, TileURLTemplate } from "./TileProviderFactory.js";
|
|
3
3
|
/** Technical potential is not a license to cache a vendor's data. */
|
|
4
4
|
export type OfflineSupport = "unsupported" | "host-managed" | "unknown";
|
|
5
5
|
export type ApiKeyRequirement = "none" | "required" | "host-defined";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolButtonConfig, ToolButtonName, ToolToolbarGroupConfig } from "../types/public";
|
|
1
|
+
import type { ToolButtonConfig, ToolButtonName, ToolToolbarGroupConfig } from "../types/public.js";
|
|
2
2
|
export interface ToolButtonTriggerContext {
|
|
3
3
|
source: "toolbar" | "leaflet-toolbar";
|
|
4
4
|
groupId?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DrawControlsConfig, ToolButtonConfig, ToolButtonName, ToolCapabilities, ToolCapability, ToolProviderCapability, ToolToolbarGroupConfig } from "../types/public";
|
|
1
|
+
import type { DrawControlsConfig, ToolButtonConfig, ToolButtonName, ToolCapabilities, ToolCapability, ToolProviderCapability, ToolToolbarGroupConfig } from "../types/public.js";
|
|
2
2
|
interface ToolDefinition {
|
|
3
3
|
control?: keyof DrawControlsConfig;
|
|
4
4
|
attribute?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolToolbarGroupConfig, ToolToolbarPosition, ToolToolbarZone } from "../types/public";
|
|
1
|
+
import type { ToolToolbarGroupConfig, ToolToolbarPosition, ToolToolbarZone } from "../types/public.js";
|
|
2
2
|
export declare function toolbarZone(position?: string): ToolToolbarZone;
|
|
3
3
|
export declare function usesToolbarLayout(group: ToolToolbarGroupConfig): boolean;
|
|
4
4
|
export declare function resolveToolbarPlacement(group: ToolToolbarGroupConfig, width: number): {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { LeafletDrawMapElement } from "../components/LeafletDrawMapElement";
|
|
2
|
-
import type { IntegratedToolEventEmitter, IntegratedToolHooks, ToolButtonConfig, ToolToolbarGroupConfig } from "../types/public";
|
|
1
|
+
import type { LeafletDrawMapElement } from "../components/LeafletDrawMapElement.js";
|
|
2
|
+
import type { IntegratedToolEventEmitter, IntegratedToolHooks, ToolButtonConfig, ToolToolbarGroupConfig } from "../types/public.js";
|
|
3
3
|
type Primitive = string | number | boolean | null | undefined;
|
|
4
4
|
type LeafletMode = "external" | "bundled";
|
|
5
5
|
export interface PreactLeafletGeoKitProps {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type PreactLeafletGeoKitProps } from "
|
|
1
|
+
import { type PreactLeafletGeoKitProps } from "./core.js";
|
|
2
2
|
export type { PreactLeafletGeoKitProps };
|
|
3
3
|
export declare const PreactLeafletGeoKit: (props: PreactLeafletGeoKitProps) => import("preact").VNode<import("preact").Attributes & {
|
|
4
|
-
ref: import("preact/hooks").MutableRef<import("
|
|
4
|
+
ref: import("preact/hooks").MutableRef<import("../index.js").LeafletDrawMapElement | null>;
|
|
5
5
|
className: string | undefined;
|
|
6
6
|
style: string;
|
|
7
7
|
}>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../index";
|
|
2
|
-
import { type PreactLeafletGeoKitProps } from "../preact/core";
|
|
1
|
+
import "../index.js";
|
|
2
|
+
import { type PreactLeafletGeoKitProps } from "../preact/core.js";
|
|
3
3
|
export type { PreactLeafletGeoKitProps };
|
|
4
4
|
export declare const PreactLeafletGeoKit: (props: PreactLeafletGeoKitProps) => import("preact").VNode<import("preact").Attributes & {
|
|
5
|
-
ref: import("preact/hooks").MutableRef<import("../index").LeafletDrawMapElement | null>;
|
|
5
|
+
ref: import("preact/hooks").MutableRef<import("../index.js").LeafletDrawMapElement | null>;
|
|
6
6
|
className: string | undefined;
|
|
7
7
|
style: string;
|
|
8
8
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { LeafletDrawMapElement } from "../components/LeafletDrawMapElement";
|
|
3
|
-
import type { IntegratedToolEventEmitter, IntegratedToolHooks, ToolButtonConfig, ToolToolbarGroupConfig } from "../types/public";
|
|
2
|
+
import type { LeafletDrawMapElement } from "../components/LeafletDrawMapElement.js";
|
|
3
|
+
import type { IntegratedToolEventEmitter, IntegratedToolHooks, ToolButtonConfig, ToolToolbarGroupConfig } from "../types/public.js";
|
|
4
4
|
type Primitive = string | number | boolean | null | undefined;
|
|
5
5
|
type LeafletMode = "external" | "bundled";
|
|
6
6
|
export interface ReactLeafletGeoKitProps {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type ReactLeafletGeoKitProps } from "
|
|
1
|
+
import { type ReactLeafletGeoKitProps } from "./core.js";
|
|
2
2
|
export type { ReactLeafletGeoKitProps };
|
|
3
3
|
export declare const ReactLeafletGeoKit: (props: ReactLeafletGeoKitProps) => import("react").ReactElement<{
|
|
4
|
-
ref: import("react").MutableRefObject<import("
|
|
4
|
+
ref: import("react").MutableRefObject<import("../index.js").LeafletDrawMapElement | null>;
|
|
5
5
|
className: string | undefined;
|
|
6
6
|
}, string | import("react").JSXElementConstructor<any>>;
|
|
7
7
|
export default ReactLeafletGeoKit;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../index";
|
|
2
|
-
import { type ReactLeafletGeoKitProps } from "../react/core";
|
|
1
|
+
import "../index.js";
|
|
2
|
+
import { type ReactLeafletGeoKitProps } from "../react/core.js";
|
|
3
3
|
export type { ReactLeafletGeoKitProps };
|
|
4
4
|
export declare const ReactLeafletGeoKit: (props: ReactLeafletGeoKitProps) => import("react").ReactElement<{
|
|
5
|
-
ref: import("react").MutableRefObject<import("../index").LeafletDrawMapElement | null>;
|
|
5
|
+
ref: import("react").MutableRefObject<import("../index.js").LeafletDrawMapElement | null>;
|
|
6
6
|
className: string | undefined;
|
|
7
7
|
}, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
export default ReactLeafletGeoKit;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Feature, FeatureCollection } from "geojson";
|
|
2
|
-
import type { GeoJSONExportAdapter } from "../utils/geojson";
|
|
2
|
+
import type { GeoJSONExportAdapter } from "../utils/geojson.js";
|
|
3
3
|
export type GeoKitStatusState = "uninitialized" | "initializing" | "ready" | "loading" | "error";
|
|
4
4
|
export interface GeoKitDiagnosticSummary {
|
|
5
5
|
code: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Feature, FeatureCollection, Geometry } from "geojson";
|
|
2
|
-
import type { LogLevel } from "../utils/logger";
|
|
3
|
-
import type { StatusEventDetail } from "
|
|
4
|
-
import type { GeoJSONExportAdapter, GeoJSONExportOptions, GeoJSONImportBehavior, GeoJSONImportOptions } from "../utils/geojson";
|
|
2
|
+
import type { LogLevel } from "../utils/logger.js";
|
|
3
|
+
import type { StatusEventDetail } from "./events.js";
|
|
4
|
+
import type { GeoJSONExportAdapter, GeoJSONExportOptions, GeoJSONImportBehavior, GeoJSONImportOptions } from "../utils/geojson.js";
|
|
5
5
|
import type * as Leaflet from "leaflet";
|
|
6
|
-
import type { MapLayer, LayerStyle, LayerCakeSession, LayerCakeSessionUpdate } from "
|
|
7
|
-
export * from "
|
|
8
|
-
import type { BasemapAdapter, ProviderDiagnostics } from "../lib/providers";
|
|
6
|
+
import type { MapLayer, LayerStyle, LayerCakeSession, LayerCakeSessionUpdate } from "./layers.js";
|
|
7
|
+
export * from "./layers.js";
|
|
8
|
+
import type { BasemapAdapter, ProviderDiagnostics } from "../lib/providers.js";
|
|
9
9
|
/**
|
|
10
10
|
* Basic map configuration derived from element attributes.
|
|
11
11
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Feature, FeatureCollection } from "geojson";
|
|
2
|
-
import { type GeoJSONExportOptions } from "./geojson";
|
|
2
|
+
import { type GeoJSONExportOptions } from "./geojson.js";
|
|
3
3
|
export interface GeoJSONDiagnostic {
|
|
4
4
|
severity: "error" | "warning" | "info";
|
|
5
5
|
code: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LayerDefinition } from "../types/layers";
|
|
1
|
+
import type { LayerDefinition } from "../types/layers.js";
|
|
2
2
|
import type { Feature, FeatureCollection, Geometry, Position, Polygon, MultiPolygon, GeoJsonProperties } from "geojson";
|
|
3
3
|
export type GeoJSONImportBehavior = "replace" | "add";
|
|
4
4
|
export interface GeoJSONImportOptions {
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# Public API reference
|
|
2
|
+
|
|
3
|
+
This reference describes the framework-independent `<leaflet-geokit>` custom element.
|
|
4
|
+
`<leaflet-draw-map>` remains a compatibility alias. Import
|
|
5
|
+
`@florasync/leaflet-geokit` to register the bundled element; the `/external`
|
|
6
|
+
entrypoint is for hosts supplying Leaflet/Draw. Registration requires browser
|
|
7
|
+
DOM globals: defer imports to the client in SSR applications.
|
|
8
|
+
|
|
9
|
+
Contracts: [public types](../src/types/public.ts), [event types](../src/types/events.ts),
|
|
10
|
+
[element implementation](../src/components/LeafletDrawMapElement.ts), and
|
|
11
|
+
[package exports](../src/index.ts). Framework wrappers are optional; see
|
|
12
|
+
[React](shims/react.md), [Preact](shims/preact.md), and [Django](shims/django.md).
|
|
13
|
+
|
|
14
|
+
## Readiness and sizing
|
|
15
|
+
|
|
16
|
+
Give the element a nonzero width and height. Subscribe directly on the element
|
|
17
|
+
before connecting it when initial events matter. `customElements.whenDefined()`
|
|
18
|
+
means the class is registered, not that its map is initialized. Observe
|
|
19
|
+
`leaflet-geokit:status` and read `status` for durable readiness; the legacy
|
|
20
|
+
`leaflet-draw:ready` callback fires before the asynchronous status synchronization
|
|
21
|
+
finishes. In particular, wait for `status.ready` before `setBasemapAdapter()`.
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import "@florasync/leaflet-geokit";
|
|
25
|
+
|
|
26
|
+
const map = document.createElement("leaflet-geokit");
|
|
27
|
+
map.style.cssText = "width:100%;height:400px";
|
|
28
|
+
map.setAttribute("draw-polygon", "");
|
|
29
|
+
map.addEventListener("leaflet-geokit:status", (event) => {
|
|
30
|
+
console.log(event.detail.state, event.detail.featureCount);
|
|
31
|
+
});
|
|
32
|
+
map.addEventListener("leaflet-draw:created", (event) => {
|
|
33
|
+
console.log(event.detail.id, event.detail.geoJSON);
|
|
34
|
+
});
|
|
35
|
+
document.body.append(map);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Do not use pre-ready mutation calls as a queue: many methods return empty results
|
|
39
|
+
or do nothing without a controller. Tool activation returns `false` with failure
|
|
40
|
+
events; `setBasemapAdapter()` throws when not ready. Disconnect destroys the map;
|
|
41
|
+
reapply host data and an optional adapter after reconnecting.
|
|
42
|
+
|
|
43
|
+
## Attributes and reflected properties
|
|
44
|
+
|
|
45
|
+
Boolean attributes use **presence**, not string values: `read-only="false"`
|
|
46
|
+
still enables read-only. Remove the attribute or set its boolean property to
|
|
47
|
+
`false`. A dash below means there is no corresponding scalar property; use
|
|
48
|
+
`setAttribute`/`removeAttribute` or the listed object configuration instead.
|
|
49
|
+
|
|
50
|
+
| Attribute | Property | Value / default / behavior |
|
|
51
|
+
| ------------------------------------------------------------------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
52
|
+
| `latitude`, `longitude` | `latitude`, `longitude` | Numbers; both default to `0`. Runtime changes update the view. |
|
|
53
|
+
| `zoom` | `zoom` | Number; default `2`. |
|
|
54
|
+
| `min-zoom`, `max-zoom` | `minZoom`, `maxZoom` | Optional numbers; unset by default. |
|
|
55
|
+
| `tile-url` | `tileUrl` | Default `https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`. Used when no named provider is configured. |
|
|
56
|
+
| `tile-attribution` | `tileAttribution` | Optional attribution string; trusted HTML passed to Leaflet. |
|
|
57
|
+
| `tile-provider` | `tileProvider` | Optional `osm` or `here`; trimmed/lowercased. Clear it to use `tile-url`. |
|
|
58
|
+
| `tile-style` | `tileStyle` | Optional provider style; HERE defaults to `lite.day`. |
|
|
59
|
+
| `api-key`, `here-api-key` | `apiKey` | Canonical key and legacy alias. Nonempty canonical value wins; setting `apiKey` removes the legacy attribute. Browser-visible, not secret storage. |
|
|
60
|
+
| `read-only` | `readOnly` | Boolean; default `false`. Restricts interactive mutating tools, not a server authorization boundary. |
|
|
61
|
+
| `log-level` | `logLevel` | `trace`, `debug`, `info`, `warn`, `error`, `silent`; default `debug`. |
|
|
62
|
+
| `dev-overlay` | `devOverlay` | Boolean; default `false`. Reserved compatibility flag, not an overlay UI. |
|
|
63
|
+
| `prefer-canvas` | `preferCanvas` | Boolean; initial default `true`. Presence is true even for `"false"`; set `map.preferCanvas = false` before connection to request SVG. This accessor exists on the concrete class, but is not declared in `LeafletDrawMapElementAPI`. |
|
|
64
|
+
| `use-external-leaflet` | `useExternalLeaflet` | Boolean; default `false`. Prefer supplied Leaflet/Draw runtime. |
|
|
65
|
+
| `skip-leaflet-styles` | `skipLeafletStyles` | Boolean; default `false`. Host takes responsibility for CSS/icon injection; global document CSS alone does not style shadow contents. |
|
|
66
|
+
| `theme-url` | — | Optional stylesheet URL inserted into the shadow root. |
|
|
67
|
+
| `marker-icon-url` | — | Custom marker URL; absent/invalid uses default marker. See `markerIconConfig`. |
|
|
68
|
+
| `marker-icon-retina-url` | — | Optional high-DPI URL; fallback is the regular icon URL. |
|
|
69
|
+
| `marker-shadow-url` | — | Optional shadow URL; absent/invalid omits shadow. |
|
|
70
|
+
| `marker-icon-size` | — | Comma-separated width,height in CSS pixels; default `25,41`. |
|
|
71
|
+
| `marker-icon-anchor` | — | Comma-separated x,y; default `12,41`. |
|
|
72
|
+
| `marker-popup-anchor` | — | Comma-separated x,y; default `1,-34`. |
|
|
73
|
+
| `tool-button-config` | `toolButtonConfig` (object override) | JSON object keyed by tool name; icons, accessible labels, popovers, disabled state, prerequisites. |
|
|
74
|
+
| `toolbar-groups` | `toolbarGroups` (object override) | JSON array of groups; default no custom groups. A group needs `id` and `tools`. |
|
|
75
|
+
| `draw-polygon`, `draw-polyline`, `draw-rectangle`, `draw-circle`, `draw-marker` | — | Boolean tool enables; absent by default. |
|
|
76
|
+
| `draw-layer-cake`, `draw-move`, `draw-ruler` | — | Boolean enables for `layerCake`, `move`, `ruler`; absent by default. |
|
|
77
|
+
| `edit-features`, `delete-features` | — | Boolean enables; absent by default. Delete also requires `edit-features`. |
|
|
78
|
+
| `polygon-allow-intersection` | — | Boolean; default `false`. Set before initialization; changing it alone does not trigger a controller rebuild. |
|
|
79
|
+
|
|
80
|
+
View changes are applied directly; structural changes (draw toggles, read-only,
|
|
81
|
+
zoom limits and runtime flags) serialize controller rebuilds. Tile configuration
|
|
82
|
+
updates the basemap. Prefer configuration before connection over repeated
|
|
83
|
+
structural changes. Do not infer new properties by camel-casing attributes.
|
|
84
|
+
|
|
85
|
+
## Object and property-only configuration
|
|
86
|
+
|
|
87
|
+
| Property | Type / semantics |
|
|
88
|
+
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
89
|
+
| `status` | Read-only detached `StatusEventDetail`; see [diagnostics](diagnostics.md). |
|
|
90
|
+
| `themeCss` | String; default empty. Injects inline CSS into the shadow root; does not reflect an attribute. |
|
|
91
|
+
| `markerIconConfig` | `MarkerIconConfig \| null \| undefined`; `undefined` uses attributes, `null` forces default markers. |
|
|
92
|
+
| `toolButtonConfig` | `ToolButtonConfig \| null \| undefined`; `undefined` uses JSON attribute, `null` clears customization. Functions/renderers require this property, not JSON. |
|
|
93
|
+
| `toolbarGroups` | `ToolToolbarGroupConfig[] \| null \| undefined`; `undefined` uses JSON attribute, `null` clears groups. |
|
|
94
|
+
| `snapping` | `SnappingOptions \| null \| undefined`; opt-in vertex/edge/grid/guide snapping. |
|
|
95
|
+
| `measurementOverlay` | `MeasurementOverlayOptions \| null \| undefined`; opt-in live measurements. |
|
|
96
|
+
| `leafletInstance` | Optional Leaflet namespace injection; set before connecting, with compatible Draw plugins attached. |
|
|
97
|
+
| `toolHooks` | `IntegratedToolHooks`; callbacks keyed by integrated event name. |
|
|
98
|
+
| `toolEventEmitter` | `IntegratedToolEventEmitter`; optional `emit(eventName, detail)` and/or `dispatchEvent(event)`. |
|
|
99
|
+
|
|
100
|
+
Configuration interfaces, including all callback signatures, are in
|
|
101
|
+
[public.ts](../src/types/public.ts). See [snapping and measurements](snapping-and-measurements.md)
|
|
102
|
+
for options/limits, [toolbar styling](toolbar-styling.md) for icons/popovers/slots,
|
|
103
|
+
and [responsive layout](toolbar-layout.md) for zones and map-width breakpoints.
|
|
104
|
+
Only trusted/sanitized host content belongs in `iconHtml`, popover `html`, CSS,
|
|
105
|
+
render callbacks, or attribution HTML.
|
|
106
|
+
|
|
107
|
+
## Methods
|
|
108
|
+
|
|
109
|
+
`FC` below means GeoJSON `FeatureCollection`; `Feature` and configuration types
|
|
110
|
+
are exported from the package. GeoJSON positions are `[longitude, latitude]`;
|
|
111
|
+
view/bounds methods use latitude first. Methods returning promises must be awaited
|
|
112
|
+
and may reject; see [diagnostics](diagnostics.md).
|
|
113
|
+
|
|
114
|
+
| Method | Return | Contract |
|
|
115
|
+
| ------------------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
116
|
+
| `getGeoJSON()` | `Promise<FC>` | Current editing collection. |
|
|
117
|
+
| `importGeoJSON(fc, options?)` | `Promise<string[]>` | Import with `GeoJSONImportOptions`; default behavior `replace`, `fitToData: false`. Opt into `validate: true` for preflight validation. |
|
|
118
|
+
| `loadGeoJSON(fc)` | `Promise<void>` | Compatibility replacement import. |
|
|
119
|
+
| `addFeatures(fc)` | `Promise<string[]>` | Compatibility additive import; returns assigned IDs. |
|
|
120
|
+
| `loadGeoJSONFromUrl(url, options?)` | `Promise<void>` | Fetch JSON then import; default replace, `fitToData: true`. |
|
|
121
|
+
| `loadGeoJSONFromText(text, options?)` | `Promise<void>` | Parse then import; default replace, `fitToData: true`. |
|
|
122
|
+
| `exportGeoJSON(options?)` | `Promise<FC>` | `GeoJSONExportOptions`; default adapter `editing`; emits `leaflet-draw:export`. |
|
|
123
|
+
| `clearLayers()` | `Promise<void>` | Clear stored/rendered features. |
|
|
124
|
+
| `updateFeature(id, feature)` | `Promise<void>` | Update by stable string ID. |
|
|
125
|
+
| `removeFeature(id)` | `Promise<void>` | Remove by ID. |
|
|
126
|
+
| `fitBoundsToData(padding?)` | `Promise<void>` | Fit stored data; padding ratio defaults to `0.05`. |
|
|
127
|
+
| `fitBounds(bounds, padding?)` | `Promise<void>` | Bounds `[[south, west], [north, east]]`; padding ratio defaults to `0.05`. |
|
|
128
|
+
| `setView(lat, lng, zoom?)` | `Promise<void>` | Set view and reflect coordinate/zoom properties. |
|
|
129
|
+
| `mergePolygons(options?)` | `Promise<string \| null>` | Merge visible polygon layers, replacing originals; optional `properties` record; emits merged event on success. |
|
|
130
|
+
| `getLayers()` | `MapLayer[]` | Layer inventory. |
|
|
131
|
+
| `setLayerVisibility(id, visible)` | `Promise<void>` | Change layer visibility. |
|
|
132
|
+
| `setLayerStyle(id, style)` | `Promise<void>` | Apply `LayerStyle`. |
|
|
133
|
+
| `reorderLayers(ids)` | `Promise<void>` | Reorder using readonly string IDs. |
|
|
134
|
+
| `focusLayer(id)` | `Promise<void>` | Focus a layer. |
|
|
135
|
+
| `removeLayer(id)` | `Promise<void>` | Remove a named layer. |
|
|
136
|
+
| `getLayerCakeSession()` | `LayerCakeSession \| null` | Current session snapshot. |
|
|
137
|
+
| `updateLayerCakeSession(update)` | `Promise<void>` | Apply `LayerCakeSessionUpdate`. |
|
|
138
|
+
| `saveLayerCakeSession()` | `Promise<void>` | Commit the current session. |
|
|
139
|
+
| `cancelLayerCakeSession()` | `Promise<void>` | Cancel the current session. |
|
|
140
|
+
| `getToolCapabilities()` | `ToolCapabilities` | Detached synchronous snapshot, including before readiness. |
|
|
141
|
+
| `setToolSelection(featureIds)` | `void` | Supply readonly host-selected IDs; unknown/deleted IDs excluded. |
|
|
142
|
+
| `activateTool(tool, options?)` | `Promise<boolean>` | Command accepted/handled, not proof of completed geometry. Options: `source`, `groupId`, `commandId`. |
|
|
143
|
+
| `triggerTool(tool, options?)` | `Promise<boolean>` | Compatibility alias of `activateTool`. |
|
|
144
|
+
| `deactivateTool(options?)` | `Promise<boolean>` | Return to select mode. |
|
|
145
|
+
| `setMeasurementUnits(system)` | `Promise<void>` | `metric` or `imperial`. |
|
|
146
|
+
| `getSnappingOptions()` | `SnappingOptions \| null` | Current snap configuration. |
|
|
147
|
+
| `getMeasurementOverlayOptions()` | `MeasurementOverlayOptions \| null` | Current overlay configuration. |
|
|
148
|
+
| `setBasemapAdapter(adapter)` | `void` | After ready, set `BasemapAdapter`; `null` restores raster configuration. |
|
|
149
|
+
| `getProviderDiagnostics()` | `ProviderDiagnostics \| null` | Configuration report, not service-health probe. |
|
|
150
|
+
|
|
151
|
+
Detailed data semantics: [GeoJSON pipelines](geojson-pipelines.md),
|
|
152
|
+
[layers and cake sessions](layers.md), [providers](providers.md).
|
|
153
|
+
The URL/text convenience methods currently forward `behavior` and `fitToData`,
|
|
154
|
+
not `validate`; for validated uploads use the pipeline helpers followed by
|
|
155
|
+
`importGeoJSON(data, { validate: true })`. Legacy source export and the diagnostic
|
|
156
|
+
`exportGeoJSONData` helper have different provenance guarantees; consult the
|
|
157
|
+
pipeline guide before persisting source geometry.
|
|
158
|
+
|
|
159
|
+
## Events
|
|
160
|
+
|
|
161
|
+
These are DOM `CustomEvent`s: payloads live in `event.detail`, not on the event
|
|
162
|
+
itself. Listen on the element for compatibility across every family. Legacy draw,
|
|
163
|
+
status, and diagnostic events are not bubbling/composed; public lifecycle,
|
|
164
|
+
capability, and layer events are bubbling/composed. Provider events bubble but
|
|
165
|
+
are not composed. Do not assume all events can be delegated across shadow roots.
|
|
166
|
+
|
|
167
|
+
| Event | Detail / use |
|
|
168
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
169
|
+
| `leaflet-draw:ready` | `ReadyEventDetail`: optional bounds. |
|
|
170
|
+
| `leaflet-draw:created` | `CreatedEventDetail`: `id`, `layerType`, `geoJSON` Feature. |
|
|
171
|
+
| `leaflet-draw:edited`, `leaflet-draw:deleted` | `EditedEventDetail` / `DeletedEventDetail`: `ids`, current `geoJSON` FC. |
|
|
172
|
+
| `leaflet-draw:ingest` | `IngestEventDetail`: mutable `fc`, `mode: "load" \| "add"`; synchronous pre-import transform hook. |
|
|
173
|
+
| `leaflet-draw:export` | `ExportEventDetail`: `geoJSON`, `featureCount`, `adapter`. |
|
|
174
|
+
| `leaflet-draw:merged` | `id`, `mergedFeatureCount`, resulting `geoJSON`. |
|
|
175
|
+
| `leaflet-draw:error` | `ErrorEventDetail`: code/message/recoverability/timestamp and optional cause. |
|
|
176
|
+
| `leaflet-geokit:status` | `StatusEventDetail`; same shape as `status`. |
|
|
177
|
+
| `leaflet-geokit:diagnostic` | `DiagnosticEventDetail`; severity/state plus error summary. |
|
|
178
|
+
| `tile-provider-error`, `tile-provider-changed` | `TileProviderErrorDetail` / `TileProviderChangedDetail`; see diagnostics/provider guide. |
|
|
179
|
+
| `leaflet-geokit:tool-command` | Input `ToolCommandEventDetail`, normalized to correlated `ToolEventDetail`. |
|
|
180
|
+
| `leaflet-geokit:tool-commanded`, `leaflet-geokit:tool-started`, `leaflet-geokit:tool-completed`, `leaflet-geokit:tool-cancelled`, `leaflet-geokit:tool-failed`, `leaflet-geokit:tool-state-changed` | `ToolEventDetail`; canonical lifecycle, command IDs, geometry and failure/cancel reason. |
|
|
181
|
+
| `leaflet-geokit:tool-capabilities-changed` | `ToolCapabilities`; change-deduplicated snapshot. Read initial snapshot after subscribing. |
|
|
182
|
+
| `leaflet-geokit:tool-trigger-requested`, `leaflet-geokit:tool-triggered`, `leaflet-geokit:tool-trigger-failed` | Compatibility `ToolTriggerEventDetail`; includes `handled` and optional `error`. |
|
|
183
|
+
| `leaflet-geokit:layers-changed` | Layer inventory change; [layer payload contract](layers.md). |
|
|
184
|
+
| `leaflet-geokit:layer-style-request` | Cancelable host style request; `preventDefault()` claims it instead of the fallback panel. |
|
|
185
|
+
| `tool:layer-cake:session-started`, `tool:layer-cake:session-changed`, `tool:layer-cake:saved`, `tool:layer-cake:cancelled` | Layer-cake session events; [layers](layers.md). |
|
|
186
|
+
|
|
187
|
+
Compatibility command inputs `leaflet-geokit:activate-tool`,
|
|
188
|
+
`leaflet-geokit:trigger-tool`, and `leaflet-geokit:deactivate-tool` remain supported.
|
|
189
|
+
The full lifecycle ordering and per-tool completion matrix are in
|
|
190
|
+
[tool lifecycle](tool-lifecycle.md). Additional integrated hook/emitter names
|
|
191
|
+
(`tool:polygon:created`, `tool:polyline:created`, `tool:rectangle:created`,
|
|
192
|
+
`tool:circle:created`, `tool:marker:created`, `tool:move:pending`,
|
|
193
|
+
`tool:move:confirmed`, `tool:move:cancelled`, `tool:edit:applied`,
|
|
194
|
+
`tool:delete:applied`, `tool:ruler:units-changed`, `tool:save`) are declared by
|
|
195
|
+
`IntegratedToolEventName` in the public types; do not confuse these observer hooks
|
|
196
|
+
with the canonical element lifecycle bus.
|
|
197
|
+
|
|
198
|
+
## Tool capability states
|
|
199
|
+
|
|
200
|
+
Tool names are `polygon`, `polyline`, `rectangle`, `circle`, `marker`, `layerCake`,
|
|
201
|
+
`move`, `select`, `edit`, `delete`, `ruler`, `measurementSettings`, `layerStyle`,
|
|
202
|
+
and `save`.
|
|
203
|
+
|
|
204
|
+
| State | Meaning |
|
|
205
|
+
| ------------- | ----------------------------------------------------------------------------- |
|
|
206
|
+
| `enabled` | Prerequisites met; `reason` is null. |
|
|
207
|
+
| `disabled` | Read-only, missing attribute/layers/selection, or host button restriction. |
|
|
208
|
+
| `unavailable` | Not ready, missing plugin, runtime failure, or unavailable required provider. |
|
|
209
|
+
|
|
210
|
+
Use `state` for button presentation and inspect `commandEnabled` for imperative
|
|
211
|
+
retry/compatibility behavior: host `disabled` does not block imperative calls.
|
|
212
|
+
Local geometry tools do not require a paid basemap. There are no built-in letter
|
|
213
|
+
hotkeys (`hotkey` is null). The exhaustive reason table, precedence, selection
|
|
214
|
+
rules and external-button example live in [tool capabilities](tool-capabilities.md).
|
|
215
|
+
|
|
216
|
+
## CSS parts, tokens, and slots
|
|
217
|
+
|
|
218
|
+
| Surface | Authoritative inventory |
|
|
219
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
220
|
+
| Base parts `host`, `map`, `toolbar-group`, `toolbar-button`, `icon`, `popover`, `active`, `disabled`, `badge`, `tooltip` | [Styling parts table](toolbar-styling.md#parts-and-states). Capability reflection also applies `disabled` for unmet prerequisites, not only host-disabled configuration. |
|
|
221
|
+
| Tool, toolbar, icon, popover, badge, tooltip custom properties | [Token/default table](toolbar-styling.md#css-custom-properties). |
|
|
222
|
+
| Layout parts `toolbar-layout`, `toolbar-zone`, `zone-top-start`, `zone-top-end`, `zone-center-end`, `zone-bottom-start`, `zone-bottom-end`, and zone-mode `toolbar-group-ID` | [Responsive host CSS](toolbar-layout.md#host-css-including-shadow-dom). |
|
|
223
|
+
| Layout tokens `--geokit-toolbar-zone`, `--geokit-toolbar-order`, `--geokit-toolbar-wrap`, `--geokit-zone-gap`, and `--geokit-safe-area-top/right/bottom/left` (one token per side) | [Layout CSS](toolbar-layout.md#host-css-including-shadow-dom) and [safe-area contract](toolbar-layout.md#collision-insets-and-overflow-contract). |
|
|
224
|
+
| Named icon/badge/tooltip slots | [Slot naming and examples](toolbar-styling.md#named-slots). |
|
|
225
|
+
|
|
226
|
+
The built-in layer style panel additionally exposes `layer-style-panel`,
|
|
227
|
+
`--geokit-panel-background` (default `white`) and `--geokit-panel-color`
|
|
228
|
+
(default `#222`); see [layer style panel](layers.md#style-panel-built-in-or-host-owned).
|
|
229
|
+
|
|
230
|
+
Tokens inherit from the element; use `::part` for exposed surfaces and
|
|
231
|
+
`themeCss`/`theme-url` for internal per-tool/group selectors. `--_geokit-*` values
|
|
232
|
+
are private. Responsive zones supplement the older styling guide's corner-only
|
|
233
|
+
placement discussion. See [accessibility](accessibility.md) before replacing
|
|
234
|
+
focus, disabled, keyboard, or touch affordances.
|
|
235
|
+
|
|
236
|
+
## Standalone helpers
|
|
237
|
+
|
|
238
|
+
The root and external entrypoints also export pure operation helpers, although
|
|
239
|
+
the entrypoints themselves register browser elements:
|
|
240
|
+
|
|
241
|
+
- [GeoJSON validation, normalization, import/export, diff and patch](geojson-pipelines.md).
|
|
242
|
+
- [Grower geometry](grower-geometry.md): buffer, merge, split, simplify, centroid,
|
|
243
|
+
bounding box, row/bed guides, irrigation zones and presets.
|
|
244
|
+
- [Measurement](grower-measurement.md): `measureGeoJSON`, `formatMeasurements`.
|
|
245
|
+
- [Snapping](snapping-and-measurements.md): `findSnap` and associated types.
|
|
246
|
+
- [Provider factories, diagnostics and injected basemap contracts](providers.md#public-api).
|
|
247
|
+
|
|
248
|
+
No private controller, feature store, or Leaflet handler access is required for
|
|
249
|
+
these public contracts.
|