@florasync/leaflet-geokit 0.11.1 → 0.12.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/README.md +4 -7
  3. package/dist/django/index.js +1044 -955
  4. package/dist/django/index.js.map +1 -1
  5. package/dist/geocoding-control.js +177 -0
  6. package/dist/geocoding-control.js.map +1 -0
  7. package/dist/geocoding.js +241 -0
  8. package/dist/geocoding.js.map +1 -0
  9. package/dist/leaflet-geokit.es.js +1155 -1064
  10. package/dist/leaflet-geokit.es.js.map +1 -1
  11. package/dist/leaflet-geokit.external.es.js +1583 -1492
  12. package/dist/leaflet-geokit.external.es.js.map +1 -1
  13. package/dist/leaflet-geokit.umd.js +23 -23
  14. package/dist/leaflet-geokit.umd.js.map +1 -1
  15. package/dist/preact/{index-CFFA4RWo.js → index-IL53Vgct.js} +745 -657
  16. package/dist/preact/index-IL53Vgct.js.map +1 -0
  17. package/dist/preact/index.js +8 -7
  18. package/dist/preact/index.js.map +1 -1
  19. package/dist/preact-bundled/index.js +2160 -2071
  20. package/dist/preact-bundled/index.js.map +1 -1
  21. package/dist/react/{index-CFFA4RWo.js → index-IL53Vgct.js} +745 -657
  22. package/dist/react/index-IL53Vgct.js.map +1 -0
  23. package/dist/react/index.js +18 -17
  24. package/dist/react/index.js.map +1 -1
  25. package/dist/react-bundled/index.js +2159 -2070
  26. package/dist/react-bundled/index.js.map +1 -1
  27. package/dist/types/components/LeafletDrawMapElement.d.ts +8 -2
  28. package/dist/types/geocoding.d.ts +5 -0
  29. package/dist/types/lib/MapController.d.ts +2 -0
  30. package/dist/types/lib/feature-credits.d.ts +12 -0
  31. package/dist/types/lib/geocoding-control.d.ts +4 -0
  32. package/dist/types/preact/core.d.ts +1 -1
  33. package/dist/types/react/core.d.ts +2 -2
  34. package/dist/types/react/index.d.ts +1 -1
  35. package/dist/types/react-bundled/index.d.ts +1 -1
  36. package/dist/types/types/events.d.ts +4 -0
  37. package/dist/types/types/geocoding.d.ts +36 -0
  38. package/dist/types/types/public.d.ts +4 -0
  39. package/docs/api-reference.md +41 -0
  40. package/docs/grower-geometry.md +1 -3
  41. package/docs/release-verification.md +6 -1
  42. package/docs/shims/django.md +1 -1
  43. package/docs/shims/preact.md +4 -2
  44. package/docs/shims/react.md +3 -1
  45. package/package.json +17 -12
  46. package/dist/preact/index-CFFA4RWo.js.map +0 -1
  47. package/dist/react/index-CFFA4RWo.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import type { Feature, FeatureCollection } from "geojson";
2
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";
3
+ import type { GeocodingProvider, GeoJSONImportOptions, GeoJSONExportOptions, LeafletDrawMapElementAPI, IntegratedToolEventEmitter, IntegratedToolHooks, MarkerIconConfig, MeasurementSystem, SnappingOptions, MeasurementOverlayOptions, ToolButtonConfig, ToolButtonName, ToolCapabilities, ToolToolbarGroupConfig, ToolTriggerOptions } from "../types/public.js";
4
4
  import { type StatusEventDetail } from "../types/events.js";
5
5
  import { type LogLevel } from "../utils/logger.js";
6
6
  import type { BasemapAdapter, ProviderDiagnostics } from "../lib/providers.js";
@@ -12,6 +12,7 @@ export declare class LeafletDrawMapElement extends HTMLElement implements Leafle
12
12
  private _latitude;
13
13
  private _longitude;
14
14
  private _zoom;
15
+ private _reflectingView;
15
16
  private _minZoom?;
16
17
  private _maxZoom?;
17
18
  private _tileUrl;
@@ -30,6 +31,11 @@ export declare class LeafletDrawMapElement extends HTMLElement implements Leafle
30
31
  private _themeLinkEl;
31
32
  private _themeStyleEl;
32
33
  private _controller;
34
+ private _geocodingProvider?;
35
+ private _geocodingLifetime?;
36
+ get geocodingProvider(): GeocodingProvider | null | undefined;
37
+ set geocodingProvider(value: GeocodingProvider | null | undefined);
38
+ private _syncGeocoding;
33
39
  private _useExternalLeaflet;
34
40
  private _skipLeafletStyles;
35
41
  private _leafletInstance;
@@ -56,7 +62,7 @@ export declare class LeafletDrawMapElement extends HTMLElement implements Leafle
56
62
  connectedCallback(): Promise<void>;
57
63
  disconnectedCallback(): Promise<void>;
58
64
  static get observedAttributes(): string[];
59
- attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
65
+ attributeChangedCallback(name: string, oldValue: string | null, value: string | null): void;
60
66
  private _updateTileLayer;
61
67
  private _handleTileProviderError;
62
68
  private _emitTileProviderChanged;
@@ -0,0 +1,5 @@
1
+ import type { GeocodingProvider, GeocodingResult, NominatimOptions } from "./types/geocoding.js";
2
+ export type * from "./types/geocoding.js";
3
+ /** @internal Take a detached snapshot of a provider row, not a reference to its data. */
4
+ export declare function normalizeResult(row: unknown): GeocodingResult | null;
5
+ export declare function createNominatimProvider(options: NominatimOptions): GeocodingProvider;
@@ -53,6 +53,8 @@ export interface MapControllerOptions {
53
53
  toolHooks?: IntegratedToolHooks;
54
54
  /** Optional event emitter for integrated tool lifecycle/events. */
55
55
  toolEventEmitter?: IntegratedToolEventEmitter;
56
+ /** The host element already dispatches canonical lifecycle events here. */
57
+ lifecycleEventTarget?: EventTarget;
56
58
  /** Optional normalized marker icon override. */
57
59
  markerIconConfig?: NormalizedMarkerIconConfig | null;
58
60
  /** Optional draw/ruler toolbar button customization. */
@@ -0,0 +1,12 @@
1
+ import type { Feature } from "geojson";
2
+ import type { Control, Layer } from "leaflet";
3
+ export declare const CREDIT_KEY = "geokit:credits";
4
+ type Credit = {
5
+ text: string;
6
+ url?: string;
7
+ };
8
+ /** Imported GeoJSON is untrusted. A bad URL must not suppress the credit text. */
9
+ export declare function featureCredits(features: Feature[]): Credit[];
10
+ /** Leaflet reference-counts credits; bind each source to the actual rendered layer. */
11
+ export declare function bindFeatureCredits(feature: Feature, layer: Layer, control?: Control.Attribution): void;
12
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { LeafletDrawMapElementAPI } from "../types/public.js";
2
+ type Host = HTMLElement & Pick<LeafletDrawMapElementAPI, "importGeoJSON" | "setView" | "geocodingProvider" | "readOnly">;
3
+ export declare function mountGeocoding(host: Host, lifetime: AbortSignal): void;
4
+ export {};
@@ -28,7 +28,7 @@ export interface PreactLeafletGeoKitProps {
28
28
  toolbarGroups?: ToolToolbarGroupConfig[] | null;
29
29
  /** Initial GeoJSON text to load once on ready. */
30
30
  initialGeoJSONText?: string;
31
- /** Called whenever draw/edit/delete/merge occurs, with latest serialized FeatureCollection. */
31
+ /** Called after draw/edit/delete/merge or a successful geocoding Add, with the latest serialized FeatureCollection. */
32
32
  onChangeText?: (text: string) => void;
33
33
  /** Called with parsed FeatureCollection after sync, if parsing is desired by host. */
34
34
  onChangeGeoJSON?: (geoJSON: unknown) => void;
@@ -29,7 +29,7 @@ export interface ReactLeafletGeoKitProps {
29
29
  toolbarGroups?: ToolToolbarGroupConfig[] | null;
30
30
  /** Initial GeoJSON text to load once on ready. */
31
31
  initialGeoJSONText?: string;
32
- /** Called whenever draw/edit/delete/merge occurs, with latest serialized FeatureCollection. */
32
+ /** Called after draw/edit/delete/merge or a successful geocoding Add, with the latest serialized FeatureCollection. */
33
33
  onChangeText?: (text: string) => void;
34
34
  /** Called with parsed FeatureCollection after sync, if parsing is desired by host. */
35
35
  onChangeGeoJSON?: (geoJSON: unknown) => void;
@@ -39,7 +39,7 @@ export interface ReactLeafletGeoKitProps {
39
39
  onReady?: (element: LeafletDrawMapElement) => void;
40
40
  }
41
41
  export declare function createReactLeafletGeoKit(defaultMode: LeafletMode): (props: ReactLeafletGeoKitProps) => React.ReactElement<{
42
- ref: React.MutableRefObject<LeafletDrawMapElement | null>;
42
+ ref: React.RefObject<LeafletDrawMapElement | null>;
43
43
  className: string | undefined;
44
44
  }, string | React.JSXElementConstructor<any>>;
45
45
  export {};
@@ -1,7 +1,7 @@
1
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("../index.js").LeafletDrawMapElement | null>;
4
+ ref: import("react").RefObject<import("../index.js").LeafletDrawMapElement | null>;
5
5
  className: string | undefined;
6
6
  }, string | import("react").JSXElementConstructor<any>>;
7
7
  export default ReactLeafletGeoKit;
@@ -2,7 +2,7 @@ import "../index.js";
2
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.js").LeafletDrawMapElement | null>;
5
+ ref: import("react").RefObject<import("../index.js").LeafletDrawMapElement | null>;
6
6
  className: string | undefined;
7
7
  }, string | import("react").JSXElementConstructor<any>>;
8
8
  export default ReactLeafletGeoKit;
@@ -95,6 +95,10 @@ export declare const DrawEvent: {
95
95
  };
96
96
  export declare const GeoKitEvent: {
97
97
  readonly Status: "leaflet-geokit:status";
98
+ readonly GeocodingStart: "leaflet-geokit:geocoding-start";
99
+ readonly GeocodingResults: "leaflet-geokit:geocoding-results";
100
+ readonly GeocodingAdded: "leaflet-geokit:geocoding-added";
101
+ readonly GeocodingError: "leaflet-geokit:geocoding-error";
98
102
  readonly Diagnostic: "leaflet-geokit:diagnostic";
99
103
  readonly ToolCommand: "leaflet-geokit:tool-command";
100
104
  readonly ToolCommanded: "leaflet-geokit:tool-commanded";
@@ -0,0 +1,36 @@
1
+ import type { Geometry } from "geojson";
2
+ export interface GeocodingResult {
3
+ label: string;
4
+ latitude: number;
5
+ longitude: number;
6
+ /** Without geometry the result can only be used to center the map. */
7
+ geometry?: Geometry;
8
+ }
9
+ export interface GeocodingProvider {
10
+ /** Visible plain-text credit for the search data (independent of the tiles). */
11
+ attribution: string;
12
+ attributionUrl?: string;
13
+ search(query: string, context: {
14
+ signal: AbortSignal;
15
+ }): Promise<readonly GeocodingResult[]>;
16
+ }
17
+ export interface NominatimOptions {
18
+ /** Full HTTP(S) search endpoint or same-origin path. No default. */
19
+ endpoint: string;
20
+ attribution?: string;
21
+ attributionUrl?: string;
22
+ }
23
+ export interface GeocodingStartDetail {
24
+ query: string;
25
+ }
26
+ export interface GeocodingResultsDetail extends GeocodingStartDetail {
27
+ results: GeocodingResult[];
28
+ }
29
+ /** Emitted only after an explicit Add appended one or more features. */
30
+ export interface GeocodingAddedDetail {
31
+ featureIds: string[];
32
+ }
33
+ export interface GeocodingErrorDetail {
34
+ query?: string;
35
+ code: "configuration" | "search" | "center" | "add" | "load";
36
+ }
@@ -5,6 +5,8 @@ import type { GeoJSONExportAdapter, GeoJSONExportOptions, GeoJSONImportBehavior,
5
5
  import type * as Leaflet from "leaflet";
6
6
  import type { MapLayer, LayerStyle, LayerCakeSession, LayerCakeSessionUpdate } from "./layers.js";
7
7
  export * from "./layers.js";
8
+ import type { GeocodingProvider } from "./geocoding.js";
9
+ export type * from "./geocoding.js";
8
10
  import type { BasemapAdapter, ProviderDiagnostics } from "../lib/providers.js";
9
11
  /**
10
12
  * Basic map configuration derived from element attributes.
@@ -336,6 +338,8 @@ export interface TileProviderChangedDetail {
336
338
  * This is provided for typing in TS consumers who may cast the element.
337
339
  */
338
340
  export interface LeafletDrawMapElementAPI {
341
+ /** Takes precedence over declarative geocoding-provider; geocoding must still be enabled. */
342
+ geocodingProvider?: GeocodingProvider | null;
339
343
  latitude: number;
340
344
  longitude: number;
341
345
  zoom: number;
@@ -82,6 +82,47 @@ zoom limits and runtime flags) serialize controller rebuilds. Tile configuration
82
82
  updates the basemap. Prefer configuration before connection over repeated
83
83
  structural changes. Do not infer new properties by camel-casing attributes.
84
84
 
85
+ ## Place search (opt-in geocoding)
86
+
87
+ Search is off by default. `geocoding` mounts a lazy control; it **does not select a service**. Choose a provider and deliberately configure where submitted addresses go. For a Nominatim-compatible deployment, configure the **search endpoint**, not the service root:
88
+
89
+ ```html
90
+ <leaflet-geokit
91
+ geocoding
92
+ geocoding-provider="nominatim"
93
+ geocoding-options='{"endpoint":"/my-geocoding-proxy/search"}'
94
+ geocoding-placeholder="Find a parcel"
95
+ geocoding-ingest
96
+ ></leaflet-geokit>
97
+ ```
98
+
99
+ Only form submission searches. The adapter sends a GET with `q`, `format=jsonv2`, `polygon_geojson=1`, and `limit=5`; it neither forwards browser credentials nor follows redirects. Configure CORS if cross-origin. Missing/invalid configuration disables the form; there is **no public fallback**. Update `geocoding-options` (JSON `NominatimOptions`: `endpoint`, optional plain-text `attribution` and HTTP(S) `attributionUrl`) to switch at runtime. Do not put secrets in browser configuration.
100
+
101
+ Result selection **centers only**. The separate **Add to map** button requires `geocoding-ingest`, a selected result with valid geometry, and a map that is not `read-only`. `leaflet-draw:ingest` is a synchronous **before-import** hook for transforming incoming data, not a change signal. Add validates the transformed collection before appending any features. If a hook produces invalid geometry or an ID already on the map, the entire Add is rejected: existing geometry, credits, and host bindings stay unchanged. The user can retry the selected result. Add never calls Save or replaces existing layers. Only after a nonempty Add succeeds, the element emits `leaflet-geokit:geocoding-added` with `{ featureIds: string[] }` (`GeocodingAddedDetail`). These are the actual editing feature IDs, including expanded multipart results. Django then updates its form field; React and Preact call `onChangeText` and `onChangeGeoJSON`. Selection, failed Adds and empty imports send no such notification. Nothing submits the host form. Absent geometry permits centering but not adding; malformed labels, coordinates, and geometries are discarded.
102
+
103
+ **Attribution on the map and in exports.** Search-panel attribution describes the active provider. Independently, added geometry carries `properties.name`, the plain-text `properties.attribution`, and `properties["geokit:credits"]` (an array of `{text, url?}`). GeoKit shows each distinct source in the map attribution control while its layer is shown, even if the search provider changes or search is disabled. Hiding/removing the last matching layer or replacing/clearing its data removes that credit, not the basemap credit. The map’s polygon merge retains the union of its source credits. Plain `attribution` fields alone are not interpreted as HTML or retroactively assigned a provider. GeoJSON with the credit properties intact restores those credits on import; when transforming, storing, or displaying exported data elsewhere, preserve the metadata and display the credit yourself. GeoKit does not persist a separate attribution registry or infer missing provenance.
104
+
105
+ Alternatively set `map.geocodingProvider` to a `GeocodingProvider`. This overrides the attributes; set it to `null` or `undefined` to return to them. The provider must supply visible `attribution` and `search(query, { signal })` returning a promise of `GeocodingResult[]` (or a readonly array). Return finite numeric WGS84 `latitude`/`longitude`, a nonblank `label`, and optionally a GeoJSON `geometry` in **longitude, latitude** order. Keep service keys on your server. For programmatic use of the built-in adapter:
106
+
107
+ ```ts
108
+ import type { LeafletDrawMapElementAPI } from "@florasync/leaflet-geokit";
109
+ import { createNominatimProvider } from "@florasync/leaflet-geokit/geocoding";
110
+
111
+ const map = document.querySelector<HTMLElement & LeafletDrawMapElementAPI>(
112
+ "leaflet-geokit",
113
+ )!;
114
+ map.geocodingProvider = createNominatimProvider({
115
+ endpoint: "/my-geocoding-proxy/search",
116
+ });
117
+ map.setAttribute("geocoding", "");
118
+ ```
119
+
120
+ Subscribe **on the element** to `leaflet-geokit:geocoding-start` (`{query}`), `leaflet-geokit:geocoding-results` (`{query, results}`; detached, possibly empty), and `leaflet-geokit:geocoding-error` (`{code, query?}`; `configuration`, `load`, `search`, `center`, or `add`). Treat event data as private; do not log user addresses by default. Editing the input, resubmitting, changing configuration, disabling or disconnecting invalidates the prior search. There is no autocomplete, retry, background query, or persistent result cache. Style `::part(geocoding)` or set `--geokit-geocoding-bg` and `--geokit-geocoding-color`. When serving the package directly, keep the emitted `dist` files at their relative paths so the optional chunks can load.
121
+
122
+ ### Public Nominatim is not a generic backend
123
+
124
+ The [OSMF Nominatim usage policy](https://operations.osmfoundation.org/policies/nominatim/) applies to its public server, **not** every Nominatim-compatible deployment. Public use requires a deliberate, informed decision by the application operator. It is limited to moderate, user-initiated use: **at most one request per second across the entire website/application**, not per browser, map, user, or proxy instance. Browser debouncing and aborts cannot enforce this. Where possible proxy and cache responses; enforce the aggregate limit at a shared upstream boundary and keep the upstream switchable without a software update. Identify the application by a valid HTTP Referer or identifying User-Agent; display OpenStreetMap attribution and respect the data's ODbL licence. Do not send personal or confidential material. Autocomplete and systematic querying are prohibited. Do not offer the public endpoint as a generic no-code/low-code/vibe-coding search service. Use a self-hosted or contracted provider if those restrictions do not fit. Custom providers must comply with their own terms.
125
+
85
126
  ## Object and property-only configuration
86
127
 
87
128
  | Property | Type / semantics |
@@ -40,9 +40,7 @@ them.
40
40
 
41
41
  ```ts
42
42
  type SupportedGeoJSON =
43
- | Geometry
44
- | Feature<Geometry>
45
- | FeatureCollection<Geometry>;
43
+ Geometry | Feature<Geometry> | FeatureCollection<Geometry>;
46
44
 
47
45
  function bufferGeoJSON(
48
46
  input: SupportedGeoJSON,
@@ -31,13 +31,14 @@ the installed tsc-alias version adds extensions. Missing relative declaration
31
31
  targets fail the build rather than ship unresolved imports.
32
32
 
33
33
  For a release candidate, use the lockfile and run the full gates, not just the
34
- focused smoke above. Both GitHub browser jobs use Ubuntu 24.04: the locked
34
+ focused smoke above. CI exercises Node 20 and 24. Type tooling against the lowest supported major (`@types/node@20`), not Node 25: declarations for newer APIs would let tooling compile even when it cannot run on Node 20. Both GitHub browser jobs use Ubuntu 24.04: the locked
35
35
  Playwright 1.58.2 cannot install Chromium on Ubuntu 26.04. Update the runner and
36
36
  browser together, with the existing screenshot baselines and assertions intact.
37
37
 
38
38
  ```sh
39
39
  npm ci
40
40
  npm audit --include=dev --audit-level=low
41
+ npm audit --omit=dev --audit-level=low
41
42
  npm run prettier:check && npm run lint
42
43
  npm run release:dry # typecheck, unit coverage, build, pack dry-run, strict packed consumer
43
44
  npm run e2e:install
@@ -49,6 +50,10 @@ npm run test:e2e:pmtiles
49
50
  [Release Candidate](https://github.com/FloraSync/leaflet-geokit/blob/main/.github/workflows/release-candidate.yml) packs the tested
50
51
  `dist/` without rebuilding it. Before upload, `node scripts/verify-browser-package.mjs <candidate.tgz>` loads the core and Django modules directly from those bytes in Chromium, draws markers, and reopens and synchronizes a saved GeoJSON field. This catches bundle-only failures that the Vite dev server and a declaration check cannot see.
51
52
 
53
+ `node scripts/verify-preact-peer.mjs <candidate.tgz>` checks strict npm resolution against the packed optional Preact peer: affected interval boundaries must conflict, unaffected hosts must resolve, and a framework-free host must not pull in Preact or React. This checks lockfiles only and never runs the probed framework versions.
54
+
55
+ `npm run test:geocoding:packed -- <candidate.tgz>` exercises the same archive with intercepted network traffic. It checks lazy loading, submit-only search, centering versus Add, and feature credits after a provider swap, disabling search, merging, and clearing. The Django case reads the submitted `FormData`; React and Preact use real peer runtimes and read the rendered text and GeoJSON callback state. For React, the gate installs the exact tarball into two fresh npm consumers (18.3.1 and the locked v19), with matching DOM and types, strict peer resolution and lifecycle scripts disabled. Both compile strict JSX for the external and bundled entrypoints, then build and run a host that imports its own installed bundled shim and React DOM client in Chromium. The install needs access to the public npm registry or a warm npm cache; browser searches remain offline. Each shim also retries an Add after a one-shot ingest hook invalidates its geometry: the failed Add must leave only the seed, and the retry must synchronize exactly one valid result without Save. A batch with a colliding feature ID must leave the original features and credits intact. These checks verify client bindings, not backend persistence.
56
+
52
57
  A PR run verifies the merge candidate; it cannot
53
58
  publish. After merge, use the successful `develop` push run, its promoted SHA
54
59
  and its tarball SHA-256 for [manual publication](https://github.com/FloraSync/leaflet-geokit/blob/main/.github/workflows/npm-publish.yml).
@@ -93,7 +93,7 @@ handles.forEach((handle) => handle.destroy());
93
93
  ## Data flow
94
94
 
95
95
  - The shim mounts `<leaflet-geokit>` above the textarea and hides the textarea.
96
- - GeoJSON edits emit custom events (`leaflet-draw:*`); the shim calls `getGeoJSON()` and writes the serialized value back into the textarea.
96
+ - After draw/edit/delete/merge or a successful **Add to map** (`leaflet-geokit:geocoding-added`), the shim calls `getGeoJSON()` and writes the serialized value back into the textarea. Selecting a search result only centers the map. Neither action submits the form.
97
97
  - Initial textarea JSON (if any) is loaded into the map on `leaflet-draw:ready`.
98
98
 
99
99
  ## Troubleshooting
@@ -10,10 +10,10 @@ There are **two entrypoints**:
10
10
  ## Install
11
11
 
12
12
  ```bash
13
- npm install @florasync/leaflet-geokit preact
13
+ npm install @florasync/leaflet-geokit 'preact@^10.29.8'
14
14
  ```
15
15
 
16
- `preact` is a consumer-provided peer dependency for these wrappers.
16
+ Only the Preact wrappers need `preact`; other consumers can omit it. Existing hosts can keep stable Preact 10 releases starting at 10.24.0, except **10.26.5–10.26.9**, **10.27.0–10.27.2**, and **10.28.0–10.28.1** ([GHSA-36hm-qxxp-pg3m](https://github.com/advisories/GHSA-36hm-qxxp-pg3m)). If your host pins one of those versions, update it before installing GeoKit.
17
17
 
18
18
  ## Import
19
19
 
@@ -55,6 +55,8 @@ export function MapEditor() {
55
55
  }
56
56
  ```
57
57
 
58
+ A successful geocoding **Add to map** updates `onChangeText` and `onChangeGeoJSON` with the full collection. Selecting a result only centers the map; neither action invokes Save.
59
+
58
60
  ## Choosing an entrypoint
59
61
 
60
62
  - Use [`@florasync/leaflet-geokit/preact`](../../package.json:9) when your app already owns Leaflet + Leaflet.draw runtime and CSS.
@@ -13,7 +13,7 @@ There are **two entrypoints**:
13
13
  npm install @florasync/leaflet-geokit react react-dom
14
14
  ```
15
15
 
16
- `react` and `react-dom` are consumer-provided peer dependencies for these wrappers.
16
+ Install matching `react` and `react-dom` versions: 18.3.1 or later in v18, or v19. TypeScript hosts should match their `@types/react` and `@types/react-dom` majors as well. The peers are optional for applications that do not use a React wrapper.
17
17
 
18
18
  ## Import
19
19
 
@@ -55,6 +55,8 @@ export function MapEditor() {
55
55
  }
56
56
  ```
57
57
 
58
+ A successful geocoding **Add to map** updates `onChangeText` and `onChangeGeoJSON` with the full collection. Selecting a result only centers the map; neither action invokes Save.
59
+
58
60
  ## Choosing an entrypoint
59
61
 
60
62
  - Use [`@florasync/leaflet-geokit/react`](../../package.json:9) when your app already owns Leaflet + Leaflet.draw runtime and CSS.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@florasync/leaflet-geokit",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "description": "Framework-agnostic Leaflet + Leaflet.draw web component with TypeScript, verbose logging, and tests.",
5
5
  "type": "module",
6
6
  "main": "./dist/leaflet-geokit.umd.js",
@@ -36,6 +36,10 @@
36
36
  "types": "./dist/types/react-bundled/index.d.ts",
37
37
  "import": "./dist/react-bundled/index.js"
38
38
  },
39
+ "./geocoding": {
40
+ "types": "./dist/types/geocoding.d.ts",
41
+ "import": "./dist/geocoding.js"
42
+ },
39
43
  "./pmtiles": {
40
44
  "types": "./dist/types/pmtiles.d.ts",
41
45
  "import": "./dist/leaflet-geokit.pmtiles.es.js"
@@ -84,7 +88,7 @@
84
88
  "homepage": "https://github.com/FloraSync/leaflet-geokit#readme",
85
89
  "scripts": {
86
90
  "dev": "vite",
87
- "build": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json --emitDeclarationOnly && tsc-alias -p tsconfig.build.json && node scripts/resolve-declaration-imports.mjs && vite build && vite build -c vite.config.external.ts && vite build -c vite.config.django.ts && vite build -c vite.config.preact.ts && vite build -c vite.config.preact-bundled.ts && vite build -c vite.config.react.ts && vite build -c vite.config.react-bundled.ts && vite build -c vite.config.pmtiles.ts",
91
+ "build": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json --emitDeclarationOnly && tsc-alias -p tsconfig.build.json && node scripts/resolve-declaration-imports.mjs && vite build && vite build -c vite.config.external.ts && vite build -c vite.config.django.ts && vite build -c vite.config.preact.ts && vite build -c vite.config.preact-bundled.ts && vite build -c vite.config.react.ts && vite build -c vite.config.react-bundled.ts && vite build -c vite.config.pmtiles.ts && vite build -c vite.config.geocoding.ts",
88
92
  "build:analyze": "npm run build:analyze:main && npm run build:analyze:external && npm run build:analyze:django && npm run build:analyze:preact && npm run build:analyze:preact-bundled && npm run build:analyze:react && npm run build:analyze:react-bundled",
89
93
  "build:analyze:main": "BUNDLE_ANALYZE=1 BUNDLE_ANALYZE_REPORT=dist/stats/main.html vite build",
90
94
  "build:analyze:external": "BUNDLE_ANALYZE=1 BUNDLE_ANALYZE_REPORT=dist/stats/external.html vite build -c vite.config.external.ts",
@@ -111,6 +115,7 @@
111
115
  "spec-kitty:doctor": "spec-kitty doctor",
112
116
  "prepack": "npm run build",
113
117
  "pack:dry": "npm pack --dry-run",
118
+ "test:geocoding:packed": "node scripts/verify-geocoding-package.mjs",
114
119
  "test:consumer": "node scripts/verify-package.mjs",
115
120
  "release:dry": "npm run typecheck && npm run test:unit && npm run build && npm pack --dry-run && npm run test:consumer",
116
121
  "test:e2e:snapping": "playwright test --config=playwright.snapping.config.ts",
@@ -152,9 +157,9 @@
152
157
  "@maplibre/maplibre-gl-leaflet": "^0.1.4",
153
158
  "maplibre-gl": "^5.24.1",
154
159
  "pmtiles": "^4.5.0",
155
- "preact": "^10.24.0",
156
- "react": "^18.3.1",
157
- "react-dom": "^18.3.1"
160
+ "preact": ">=10.24.0 <10.26.5 || >=10.26.10 <10.27.0 || >=10.27.3 <10.28.0 || >=10.28.2 <11",
161
+ "react": "^18.3.1 || ^19.0.0",
162
+ "react-dom": "^18.3.1 || ^19.0.0"
158
163
  },
159
164
  "peerDependenciesMeta": {
160
165
  "preact": {
@@ -187,9 +192,9 @@
187
192
  "@types/geojson": "^7946.0.14",
188
193
  "@types/leaflet": "^1.9.9",
189
194
  "@types/leaflet-draw": "^1.0.10",
190
- "@types/node": "^22.0.0",
191
- "@types/react": "^18.3.12",
192
- "@types/react-dom": "^18.3.1",
195
+ "@types/node": "^20.19.43",
196
+ "@types/react": "^19.3.3",
197
+ "@types/react-dom": "^19.3.0",
193
198
  "@typescript-eslint/eslint-plugin": "^8.56.0",
194
199
  "@typescript-eslint/parser": "^8.56.0",
195
200
  "@vitest/coverage-v8": "^4.1.12",
@@ -201,10 +206,10 @@
201
206
  "lint-staged": "^16.4.0",
202
207
  "maplibre-gl": "5.24.1",
203
208
  "pmtiles": "4.5.0",
204
- "preact": "^10.28.3",
205
- "prettier": "^3.3.2",
206
- "react": "^18.3.1",
207
- "react-dom": "^18.3.1",
209
+ "preact": "^10.29.8",
210
+ "prettier": "^3.10.2",
211
+ "react": "^19.3.1",
212
+ "react-dom": "^19.3.1",
208
213
  "rollup-plugin-visualizer": "^6.0.5",
209
214
  "tsc-alias": "^1.8.17",
210
215
  "typescript": "^5.5.4",