@florasync/leaflet-geokit 0.7.0 → 0.8.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/README.md +122 -0
- package/dist/django/index.js +390 -294
- package/dist/django/index.js.map +1 -1
- package/dist/leaflet-geokit.es.js +786 -690
- package/dist/leaflet-geokit.es.js.map +1 -1
- package/dist/leaflet-geokit.external.es.js +284 -188
- package/dist/leaflet-geokit.external.es.js.map +1 -1
- package/dist/leaflet-geokit.umd.js +7 -7
- package/dist/leaflet-geokit.umd.js.map +1 -1
- package/dist/preact/{index-DagV_wwR.js → index-CudTfo4O.js} +283 -187
- package/dist/preact/index-CudTfo4O.js.map +1 -0
- package/dist/preact/index.js +40 -38
- package/dist/preact/index.js.map +1 -1
- package/dist/preact-bundled/index.js +278 -180
- package/dist/preact-bundled/index.js.map +1 -1
- package/dist/react/{index-DagV_wwR.js → index-CudTfo4O.js} +283 -187
- package/dist/react/index-CudTfo4O.js.map +1 -0
- package/dist/react/index.js +29 -27
- package/dist/react/index.js.map +1 -1
- package/dist/react-bundled/index.js +278 -180
- package/dist/react-bundled/index.js.map +1 -1
- package/dist/types/e2e/tool-events-harness.spec.d.ts +1 -0
- package/dist/types/e2e/tool-hooks.spec.d.ts +1 -0
- package/dist/types/src/components/LeafletDrawMapElement.d.ts +7 -1
- package/dist/types/src/lib/MapController.d.ts +10 -1
- package/dist/types/src/preact/core.d.ts +5 -0
- package/dist/types/src/react/core.d.ts +5 -0
- package/dist/types/src/types/public.d.ts +10 -0
- package/package.json +1 -1
- package/dist/preact/index-DagV_wwR.js.map +0 -1
- package/dist/react/index-DagV_wwR.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Feature, FeatureCollection } from "geojson";
|
|
2
|
-
import type { LeafletDrawMapElementAPI, MeasurementSystem } from "@src/types/public";
|
|
2
|
+
import type { LeafletDrawMapElementAPI, IntegratedToolEventEmitter, IntegratedToolHooks, MeasurementSystem } from "@src/types/public";
|
|
3
3
|
import { type LogLevel } from "@src/utils/logger";
|
|
4
4
|
import type * as LeafletNS from "leaflet";
|
|
5
5
|
export declare class LeafletDrawMapElement extends HTMLElement implements LeafletDrawMapElementAPI {
|
|
@@ -30,6 +30,8 @@ export declare class LeafletDrawMapElement extends HTMLElement implements Leafle
|
|
|
30
30
|
private _useExternalLeaflet;
|
|
31
31
|
private _skipLeafletStyles;
|
|
32
32
|
private _leafletInstance;
|
|
33
|
+
private _toolHooks;
|
|
34
|
+
private _toolEventEmitter;
|
|
33
35
|
constructor();
|
|
34
36
|
private _controlsFromAttributes;
|
|
35
37
|
private _mapConfig;
|
|
@@ -74,6 +76,10 @@ export declare class LeafletDrawMapElement extends HTMLElement implements Leafle
|
|
|
74
76
|
set skipLeafletStyles(v: boolean);
|
|
75
77
|
get leafletInstance(): typeof LeafletNS | undefined;
|
|
76
78
|
set leafletInstance(v: typeof LeafletNS | undefined);
|
|
79
|
+
get toolHooks(): IntegratedToolHooks | undefined;
|
|
80
|
+
set toolHooks(v: IntegratedToolHooks | undefined);
|
|
81
|
+
get toolEventEmitter(): IntegratedToolEventEmitter | undefined;
|
|
82
|
+
set toolEventEmitter(v: IntegratedToolEventEmitter | undefined);
|
|
77
83
|
get themeCss(): string;
|
|
78
84
|
set themeCss(v: string);
|
|
79
85
|
getGeoJSON(): Promise<FeatureCollection>;
|
|
@@ -2,7 +2,7 @@ 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, MapConfig, MeasurementSystem } from "@src/types/public";
|
|
5
|
+
import type { DrawControlsConfig, MapConfig, MeasurementSystem, IntegratedToolEventEmitter, IntegratedToolHooks } from "@src/types/public";
|
|
6
6
|
import { type Logger } from "@src/utils/logger";
|
|
7
7
|
import type { TileURLTemplate } from "@src/lib/TileProviderFactory";
|
|
8
8
|
export interface MapControllerCallbacks {
|
|
@@ -38,6 +38,10 @@ export interface MapControllerOptions {
|
|
|
38
38
|
leaflet?: typeof BundledL;
|
|
39
39
|
/** Prefer external Leaflet if available (falls back to bundled if missing/invalid). */
|
|
40
40
|
useExternalLeaflet?: boolean;
|
|
41
|
+
/** Optional hooks for integrated tool lifecycle/events. */
|
|
42
|
+
toolHooks?: IntegratedToolHooks;
|
|
43
|
+
/** Optional event emitter for integrated tool lifecycle/events. */
|
|
44
|
+
toolEventEmitter?: IntegratedToolEventEmitter;
|
|
41
45
|
}
|
|
42
46
|
interface TileLayerCallbacks {
|
|
43
47
|
onTileError?: (error: unknown) => void;
|
|
@@ -68,7 +72,12 @@ export declare class MapController {
|
|
|
68
72
|
private activeCakeSession;
|
|
69
73
|
private moveConfirmationUI;
|
|
70
74
|
private activeMoveHandler;
|
|
75
|
+
private emitToolEvent;
|
|
71
76
|
constructor(opts: MapControllerOptions);
|
|
77
|
+
setToolObservers(options: {
|
|
78
|
+
toolHooks?: IntegratedToolHooks;
|
|
79
|
+
toolEventEmitter?: IntegratedToolEventEmitter;
|
|
80
|
+
}): void;
|
|
72
81
|
private resolveLeaflet;
|
|
73
82
|
init(): Promise<void>;
|
|
74
83
|
destroy(): Promise<void>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LeafletDrawMapElement } from "@src/components/LeafletDrawMapElement";
|
|
2
|
+
import type { IntegratedToolEventEmitter, IntegratedToolHooks } from "@src/types/public";
|
|
2
3
|
type Primitive = string | number | boolean | null | undefined;
|
|
3
4
|
type LeafletMode = "external" | "bundled";
|
|
4
5
|
export interface PreactLeafletGeoKitProps {
|
|
@@ -17,6 +18,10 @@ export interface PreactLeafletGeoKitProps {
|
|
|
17
18
|
externalLeaflet?: boolean;
|
|
18
19
|
/** Optional explicit Leaflet namespace (window.L equivalent). */
|
|
19
20
|
leafletInstance?: any;
|
|
21
|
+
/** Optional integrated tool hooks map. */
|
|
22
|
+
toolHooks?: IntegratedToolHooks;
|
|
23
|
+
/** Optional integrated tool event emitter. */
|
|
24
|
+
toolEventEmitter?: IntegratedToolEventEmitter;
|
|
20
25
|
/** Initial GeoJSON text to load once on ready. */
|
|
21
26
|
initialGeoJSONText?: string;
|
|
22
27
|
/** Called whenever draw/edit/delete/merge occurs, with latest serialized FeatureCollection. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { LeafletDrawMapElement } from "@src/components/LeafletDrawMapElement";
|
|
3
|
+
import type { IntegratedToolEventEmitter, IntegratedToolHooks } from "@src/types/public";
|
|
3
4
|
type Primitive = string | number | boolean | null | undefined;
|
|
4
5
|
type LeafletMode = "external" | "bundled";
|
|
5
6
|
export interface ReactLeafletGeoKitProps {
|
|
@@ -18,6 +19,10 @@ export interface ReactLeafletGeoKitProps {
|
|
|
18
19
|
externalLeaflet?: boolean;
|
|
19
20
|
/** Optional explicit Leaflet namespace (window.L equivalent). */
|
|
20
21
|
leafletInstance?: any;
|
|
22
|
+
/** Optional integrated tool hooks map. */
|
|
23
|
+
toolHooks?: IntegratedToolHooks;
|
|
24
|
+
/** Optional integrated tool event emitter. */
|
|
25
|
+
toolEventEmitter?: IntegratedToolEventEmitter;
|
|
21
26
|
/** Initial GeoJSON text to load once on ready. */
|
|
22
27
|
initialGeoJSONText?: string;
|
|
23
28
|
/** Called whenever draw/edit/delete/merge occurs, with latest serialized FeatureCollection. */
|
|
@@ -31,6 +31,12 @@ export interface MapConfig {
|
|
|
31
31
|
skipLeafletStyles?: boolean;
|
|
32
32
|
}
|
|
33
33
|
export type MeasurementSystem = "metric" | "imperial";
|
|
34
|
+
export type IntegratedToolEventName = "tool:polygon:created" | "tool:polyline:created" | "tool:rectangle:created" | "tool:circle:created" | "tool:marker:created" | "tool:layer-cake:session-started" | "tool:layer-cake:saved" | "tool:move:pending" | "tool:move:confirmed" | "tool:move:cancelled" | "tool:edit:applied" | "tool:delete:applied" | "tool:ruler:units-changed";
|
|
35
|
+
export type IntegratedToolHooks = Partial<Record<IntegratedToolEventName, (detail: unknown) => void>>;
|
|
36
|
+
export interface IntegratedToolEventEmitter {
|
|
37
|
+
emit?: (eventName: IntegratedToolEventName, detail: unknown) => void;
|
|
38
|
+
dispatchEvent?: (event: Event) => boolean;
|
|
39
|
+
}
|
|
34
40
|
/**
|
|
35
41
|
* Draw controls toggles (presence = true on the element).
|
|
36
42
|
*/
|
|
@@ -122,6 +128,10 @@ export interface LeafletDrawMapElementAPI {
|
|
|
122
128
|
skipLeafletStyles?: boolean;
|
|
123
129
|
/** Optional injection of a pre-existing Leaflet namespace to use instead of bundled import. */
|
|
124
130
|
leafletInstance?: typeof Leaflet;
|
|
131
|
+
/** Optional per-tool hooks keyed by integrated tool event name. */
|
|
132
|
+
toolHooks?: IntegratedToolHooks;
|
|
133
|
+
/** Optional emitter for integrated tool events. */
|
|
134
|
+
toolEventEmitter?: IntegratedToolEventEmitter;
|
|
125
135
|
/** Tile provider identifier (e.g., "osm", "here") */
|
|
126
136
|
tileProvider?: "osm" | "here" | string;
|
|
127
137
|
/** Provider-specific style (e.g., "lite.day" for HERE) */
|
package/package.json
CHANGED