@mailwoman/react 9.3.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/fonts.css +59 -0
  2. package/lib/common/About.tsx +105 -0
  3. package/lib/common/KindBadge.tsx +2 -7
  4. package/lib/common/confidence-tiers.ts +50 -0
  5. package/lib/common/index.ts +22 -0
  6. package/lib/common/text-tokens.ts +88 -0
  7. package/lib/index.ts +10 -103
  8. package/lib/map/BackendControl.tsx +7 -3
  9. package/lib/map/CompareToggle.tsx +5 -4
  10. package/lib/map/{GeocoderDemo.tsx → Geocoder.tsx} +81 -61
  11. package/lib/map/GeocoderControls.tsx +352 -0
  12. package/lib/map/{DemoMap.tsx → MapCanvas.tsx} +15 -15
  13. package/lib/map/MapChipRow.tsx +77 -0
  14. package/lib/map/MapCompass.tsx +77 -0
  15. package/lib/map/MapControlStack.tsx +98 -0
  16. package/lib/map/MapFooter.tsx +115 -0
  17. package/lib/map/MapProgressBar.tsx +58 -0
  18. package/lib/map/MapSearchBar.tsx +68 -0
  19. package/lib/map/MapSheet.tsx +62 -0
  20. package/lib/map/PlaceMarker.tsx +1 -1
  21. package/lib/map/ResolvedPlaceLayers.tsx +3 -3
  22. package/lib/map/ResultCamera.tsx +1 -1
  23. package/lib/map/ResultPanel.tsx +2 -2
  24. package/lib/map/VersionPicker.tsx +3 -3
  25. package/lib/map/fake-runtime.ts +122 -0
  26. package/lib/map/index.ts +35 -16
  27. package/lib/map/map-debug.ts +51 -0
  28. package/lib/map/place-render.ts +3 -2
  29. package/lib/map/types.ts +58 -42
  30. package/lib/map/{useDemoGeocode.ts → useGeocode.ts} +8 -8
  31. package/lib/map/useMapBearing.ts +56 -0
  32. package/lib/map/useMapLabelPick.ts +123 -0
  33. package/lib/pipeline/CandidatePicker.tsx +1 -1
  34. package/lib/pipeline/ComponentTable.tsx +1 -2
  35. package/lib/pipeline/ConfidenceCell.tsx +7 -19
  36. package/lib/pipeline/FailureDiagnostic.tsx +56 -0
  37. package/lib/pipeline/ResolvedPlace.tsx +17 -4
  38. package/lib/pipeline/SpanHighlight.tsx +97 -0
  39. package/lib/pipeline/TimingPanel.tsx +65 -0
  40. package/lib/pipeline/TreeView.tsx +55 -0
  41. package/lib/pipeline/copy.ts +1 -1
  42. package/lib/pipeline/index.ts +36 -0
  43. package/lib/pipeline/types.ts +2 -75
  44. package/lib/pipeline/useParsePipeline.ts +31 -19
  45. package/lib/poi/index.ts +39 -0
  46. package/lib/poi/types.ts +2 -1
  47. package/lib/runtime/index.ts +16 -0
  48. package/lib/runtime/{useDemoRuntime.ts → useReleaseRuntime.ts} +22 -24
  49. package/out/common/About.d.ts +21 -0
  50. package/out/common/About.d.ts.map +1 -0
  51. package/out/common/About.js +8 -0
  52. package/out/common/About.js.map +1 -0
  53. package/out/common/KindBadge.d.ts +2 -9
  54. package/out/common/KindBadge.d.ts.map +1 -1
  55. package/out/common/KindBadge.js.map +1 -1
  56. package/out/common/confidence-tiers.d.ts +36 -0
  57. package/out/common/confidence-tiers.d.ts.map +1 -0
  58. package/out/common/confidence-tiers.js +42 -0
  59. package/out/common/confidence-tiers.js.map +1 -0
  60. package/out/common/index.d.ts +22 -0
  61. package/out/common/index.d.ts.map +1 -0
  62. package/out/common/index.js +15 -0
  63. package/out/common/index.js.map +1 -0
  64. package/out/common/text-tokens.d.ts +46 -0
  65. package/out/common/text-tokens.d.ts.map +1 -0
  66. package/out/common/text-tokens.js +52 -0
  67. package/out/common/text-tokens.js.map +1 -0
  68. package/out/index.d.ts +5 -51
  69. package/out/index.d.ts.map +1 -1
  70. package/out/index.js +4 -30
  71. package/out/index.js.map +1 -1
  72. package/out/map/BackendControl.d.ts.map +1 -1
  73. package/out/map/BackendControl.js +1 -1
  74. package/out/map/BackendControl.js.map +1 -1
  75. package/out/map/CompareToggle.d.ts +2 -2
  76. package/out/map/CompareToggle.d.ts.map +1 -1
  77. package/out/map/CompareToggle.js +1 -1
  78. package/out/map/CompareToggle.js.map +1 -1
  79. package/out/map/Geocoder.d.ts +67 -0
  80. package/out/map/Geocoder.d.ts.map +1 -0
  81. package/out/map/Geocoder.js +98 -0
  82. package/out/map/Geocoder.js.map +1 -0
  83. package/out/map/GeocoderControls.d.ts +81 -0
  84. package/out/map/GeocoderControls.d.ts.map +1 -0
  85. package/out/map/GeocoderControls.js +79 -0
  86. package/out/map/GeocoderControls.js.map +1 -0
  87. package/out/map/{DemoMap.d.ts → MapCanvas.d.ts} +15 -15
  88. package/out/map/MapCanvas.d.ts.map +1 -0
  89. package/out/map/{DemoMap.js → MapCanvas.js} +2 -2
  90. package/out/map/MapCanvas.js.map +1 -0
  91. package/out/map/MapChipRow.d.ts +47 -0
  92. package/out/map/MapChipRow.d.ts.map +1 -0
  93. package/out/map/MapChipRow.js +12 -0
  94. package/out/map/MapChipRow.js.map +1 -0
  95. package/out/map/MapCompass.d.ts +42 -0
  96. package/out/map/MapCompass.d.ts.map +1 -0
  97. package/out/map/MapCompass.js +11 -0
  98. package/out/map/MapCompass.js.map +1 -0
  99. package/out/map/MapControlStack.d.ts +57 -0
  100. package/out/map/MapControlStack.d.ts.map +1 -0
  101. package/out/map/MapControlStack.js +15 -0
  102. package/out/map/MapControlStack.js.map +1 -0
  103. package/out/map/MapFooter.d.ts +40 -0
  104. package/out/map/MapFooter.d.ts.map +1 -0
  105. package/out/map/MapFooter.js +51 -0
  106. package/out/map/MapFooter.js.map +1 -0
  107. package/out/map/MapProgressBar.d.ts +34 -0
  108. package/out/map/MapProgressBar.d.ts.map +1 -0
  109. package/out/map/MapProgressBar.js +8 -0
  110. package/out/map/MapProgressBar.js.map +1 -0
  111. package/out/map/MapSearchBar.d.ts +49 -0
  112. package/out/map/MapSearchBar.d.ts.map +1 -0
  113. package/out/map/MapSearchBar.js +6 -0
  114. package/out/map/MapSearchBar.js.map +1 -0
  115. package/out/map/MapSheet.d.ts +32 -0
  116. package/out/map/MapSheet.d.ts.map +1 -0
  117. package/out/map/MapSheet.js +33 -0
  118. package/out/map/MapSheet.js.map +1 -0
  119. package/out/map/OverlayLayers.js +1 -1
  120. package/out/map/PlaceMarker.d.ts +1 -1
  121. package/out/map/ResolvedPlaceLayers.d.ts +3 -3
  122. package/out/map/ResolvedPlaceLayers.js +1 -1
  123. package/out/map/ResultCamera.d.ts +1 -1
  124. package/out/map/ResultCamera.js +1 -1
  125. package/out/map/ResultPanel.d.ts +2 -2
  126. package/out/map/ResultPanel.d.ts.map +1 -1
  127. package/out/map/ResultPanel.js +1 -1
  128. package/out/map/ResultPanel.js.map +1 -1
  129. package/out/map/VersionPicker.d.ts +3 -3
  130. package/out/map/VersionPicker.d.ts.map +1 -1
  131. package/out/map/fake-runtime.d.ts +38 -0
  132. package/out/map/fake-runtime.d.ts.map +1 -0
  133. package/out/map/fake-runtime.js +107 -0
  134. package/out/map/fake-runtime.js.map +1 -0
  135. package/out/map/index.d.ts +27 -10
  136. package/out/map/index.d.ts.map +1 -1
  137. package/out/map/index.js +16 -6
  138. package/out/map/index.js.map +1 -1
  139. package/out/map/map-debug.d.ts +31 -0
  140. package/out/map/map-debug.d.ts.map +1 -0
  141. package/out/map/map-debug.js +31 -0
  142. package/out/map/map-debug.js.map +1 -0
  143. package/out/map/place-render.d.ts +2 -2
  144. package/out/map/place-render.d.ts.map +1 -1
  145. package/out/map/place-render.js +1 -1
  146. package/out/map/place-render.js.map +1 -1
  147. package/out/map/types.d.ts +60 -42
  148. package/out/map/types.d.ts.map +1 -1
  149. package/out/map/types.js +5 -5
  150. package/out/map/{useDemoGeocode.d.ts → useGeocode.d.ts} +9 -9
  151. package/out/map/useGeocode.d.ts.map +1 -0
  152. package/out/map/{useDemoGeocode.js → useGeocode.js} +4 -4
  153. package/out/map/useGeocode.js.map +1 -0
  154. package/out/map/useMapBearing.d.ts +28 -0
  155. package/out/map/useMapBearing.d.ts.map +1 -0
  156. package/out/map/useMapBearing.js +35 -0
  157. package/out/map/useMapBearing.js.map +1 -0
  158. package/out/map/useMapLabelPick.d.ts +23 -0
  159. package/out/map/useMapLabelPick.d.ts.map +1 -0
  160. package/out/map/useMapLabelPick.js +104 -0
  161. package/out/map/useMapLabelPick.js.map +1 -0
  162. package/out/pipeline/CandidatePicker.d.ts +1 -1
  163. package/out/pipeline/CandidatePicker.d.ts.map +1 -1
  164. package/out/pipeline/CandidatePicker.js +1 -1
  165. package/out/pipeline/CandidatePicker.js.map +1 -1
  166. package/out/pipeline/ComponentTable.d.ts +1 -1
  167. package/out/pipeline/ComponentTable.d.ts.map +1 -1
  168. package/out/pipeline/ComponentTable.js.map +1 -1
  169. package/out/pipeline/ConfidenceCell.d.ts +2 -2
  170. package/out/pipeline/ConfidenceCell.d.ts.map +1 -1
  171. package/out/pipeline/ConfidenceCell.js +4 -16
  172. package/out/pipeline/ConfidenceCell.js.map +1 -1
  173. package/out/pipeline/FailureDiagnostic.d.ts +15 -0
  174. package/out/pipeline/FailureDiagnostic.d.ts.map +1 -0
  175. package/out/pipeline/FailureDiagnostic.js +21 -0
  176. package/out/pipeline/FailureDiagnostic.js.map +1 -0
  177. package/out/pipeline/PipelineExplorer.js +1 -1
  178. package/out/pipeline/QueryForm.js +1 -1
  179. package/out/pipeline/ResolvedPlace.d.ts +1 -1
  180. package/out/pipeline/ResolvedPlace.d.ts.map +1 -1
  181. package/out/pipeline/ResolvedPlace.js +4 -10
  182. package/out/pipeline/ResolvedPlace.js.map +1 -1
  183. package/out/pipeline/SpanHighlight.d.ts +23 -0
  184. package/out/pipeline/SpanHighlight.d.ts.map +1 -0
  185. package/out/pipeline/SpanHighlight.js +31 -0
  186. package/out/pipeline/SpanHighlight.js.map +1 -0
  187. package/out/pipeline/TimingPanel.d.ts +16 -0
  188. package/out/pipeline/TimingPanel.d.ts.map +1 -0
  189. package/out/pipeline/TimingPanel.js +20 -0
  190. package/out/pipeline/TimingPanel.js.map +1 -0
  191. package/out/pipeline/TreeView.d.ts +17 -0
  192. package/out/pipeline/TreeView.d.ts.map +1 -0
  193. package/out/pipeline/TreeView.js +15 -0
  194. package/out/pipeline/TreeView.js.map +1 -0
  195. package/out/pipeline/copy.d.ts +1 -1
  196. package/out/pipeline/copy.d.ts.map +1 -1
  197. package/out/pipeline/index.d.ts +33 -0
  198. package/out/pipeline/index.d.ts.map +1 -0
  199. package/out/pipeline/index.js +21 -0
  200. package/out/pipeline/index.js.map +1 -0
  201. package/out/pipeline/types.d.ts +2 -68
  202. package/out/pipeline/types.d.ts.map +1 -1
  203. package/out/pipeline/types.js +1 -1
  204. package/out/pipeline/useParsePipeline.d.ts +7 -3
  205. package/out/pipeline/useParsePipeline.d.ts.map +1 -1
  206. package/out/pipeline/useParsePipeline.js +6 -2
  207. package/out/pipeline/useParsePipeline.js.map +1 -1
  208. package/out/poi/LiveResultsBlock.js +1 -1
  209. package/out/poi/POIExplorer.js +1 -1
  210. package/out/poi/SubjectPanel.js +1 -1
  211. package/out/poi/index.d.ts +23 -0
  212. package/out/poi/index.d.ts.map +1 -0
  213. package/out/poi/index.js +15 -0
  214. package/out/poi/index.js.map +1 -0
  215. package/out/poi/runtime.d.ts.map +1 -1
  216. package/out/poi/types.d.ts +2 -1
  217. package/out/poi/types.d.ts.map +1 -1
  218. package/out/runtime/index.d.ts +9 -0
  219. package/out/runtime/index.d.ts.map +1 -0
  220. package/out/runtime/index.js +8 -0
  221. package/out/runtime/index.js.map +1 -0
  222. package/out/runtime/{useDemoRuntime.d.ts → useReleaseRuntime.d.ts} +18 -20
  223. package/out/runtime/useReleaseRuntime.d.ts.map +1 -0
  224. package/out/runtime/{useDemoRuntime.js → useReleaseRuntime.js} +4 -4
  225. package/out/runtime/useReleaseRuntime.js.map +1 -0
  226. package/package.json +222 -31
  227. package/styleframe.config.ts +329 -0
  228. package/styles.css +1995 -663
  229. package/tokens/index.css +116 -0
  230. package/tokens/tokens.json +528 -0
  231. package/tokens/tokens.resolver.json +185 -0
  232. package/lib/map/DemoControls.tsx +0 -194
  233. package/out/map/DemoControls.d.ts +0 -64
  234. package/out/map/DemoControls.d.ts.map +0 -1
  235. package/out/map/DemoControls.js +0 -30
  236. package/out/map/DemoControls.js.map +0 -1
  237. package/out/map/DemoMap.d.ts.map +0 -1
  238. package/out/map/DemoMap.js.map +0 -1
  239. package/out/map/GeocoderDemo.d.ts +0 -57
  240. package/out/map/GeocoderDemo.d.ts.map +0 -1
  241. package/out/map/GeocoderDemo.js +0 -98
  242. package/out/map/GeocoderDemo.js.map +0 -1
  243. package/out/map/useDemoGeocode.d.ts.map +0 -1
  244. package/out/map/useDemoGeocode.js.map +0 -1
  245. package/out/runtime/useDemoRuntime.d.ts.map +0 -1
  246. package/out/runtime/useDemoRuntime.js.map +0 -1
@@ -3,22 +3,23 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Types for the geocoder-demo map surface. Mirrors the pipeline boundary: the package owns the UI state
7
- * machine + the declarative map, while the host injects a {@link DemoRuntime} that owns ONNX / httpvfs
8
- * / R2 and the composed map style. {@link DemoRuntime} EXTENDS {@link PipelineRuntime} so the shared
6
+ * Types for the geocoder map surface. Mirrors the pipeline boundary: the package owns the UI state
7
+ * machine + the declarative map, while the host injects a {@link GeocoderRuntime} that owns ONNX / httpvfs
8
+ * / R2 and the composed map style. {@link GeocoderRuntime} EXTENDS {@link PipelineRuntime} so the shared
9
9
  * `runParse` / `parseStageLabels` / `loading` contract is reused, and adds the map-specific surface
10
10
  * (style, overlays, initial center, viewport bias, backend/version selection). Phase 4 adds the
11
- * `resolveMapPlace` enricher, the {@link DemoPanels} injection bag, and the {@link DemoCompareContext}.
11
+ * `resolveMapPlace` enricher, the {@link GeocoderPanels} injection bag, and the {@link CompareContext}.
12
12
  *
13
13
  * The map-spec types are imported type-only from `react-map-gl/maplibre`; nothing here loads maplibre at
14
- * runtime, so this module stays node-safe (its concrete-value CONSUMERS — `DemoMap`, `GeocoderDemo` —
14
+ * runtime, so this module stays node-safe (its concrete-value CONSUMERS — `MapCanvas`, `Geocoder` —
15
15
  * are the ones behind the `@mailwoman/react/map` subpath).
16
16
  */
17
+ import type { ParseResult, ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result";
17
18
  import type { ReactNode } from "react";
18
- import type { LayerSpecification, SourceSpecification } from "react-map-gl/maplibre";
19
+ import type { LayerSpecification, MapInstance, SourceSpecification } from "react-map-gl/maplibre";
19
20
  import type { LngLat, ResolvedMapPlace } from "#map/place-render";
20
- import type { ParseResult, PipelineRuntime, ResolvedPlaceView } from "#pipeline/types";
21
- import type { DemoMapStyle } from "./DemoMap.tsx";
21
+ import type { PipelineRuntime } from "#pipeline/types";
22
+ import type { MapCanvasStyle } from "./MapCanvas.tsx";
22
23
  /**
23
24
  * `[longitude, latitude]`.
24
25
  *
@@ -84,7 +85,7 @@ export interface Suggestion {
84
85
  /**
85
86
  * A selectable model bundle (version tag + a display label the picker shows).
86
87
  */
87
- export interface DemoVersionOption {
88
+ export interface VersionOption {
88
89
  /**
89
90
  * The version tag (e.g. a git tag or model-card version).
90
91
  */
@@ -95,21 +96,21 @@ export interface DemoVersionOption {
95
96
  label?: string;
96
97
  }
97
98
  /**
98
- * Which neural backend the demo is currently running on.
99
+ * Which neural backend the geocoder is currently running on.
99
100
  */
100
- export type DemoBackend = "webgpu" | "wasm";
101
+ export type InferenceBackend = "webgpu" | "wasm";
101
102
  /**
102
- * The injected demo runtime. Extends {@link PipelineRuntime} (shared `runParse` / `parseStageLabels` / `loading` /
103
- * `ready`) with the map + version/backend surface the demo needs. The host composes `mapStyle` (via cartographer's
103
+ * The injected geocoder runtime. Extends {@link PipelineRuntime} (shared `runParse` / `parseStageLabels` / `loading` /
104
+ * `ready`) with the map + version/backend surface the geocoder needs. The host composes `mapStyle` (via cartographer's
104
105
  * `StyleSpecificationComposer` + the tile-worker TileJSON), supplies the overlay specs, the initial center (from
105
106
  * geolocation), the FST autocomplete, and the calibrator — nothing in the package imports `@mailwoman/cartographer`,
106
- * `@mailwoman/neural-web`, httpvfs, or Docusaurus.
107
+ * `@mailwoman/neural`'s web loader, httpvfs, or Docusaurus.
107
108
  */
108
- export interface DemoRuntime extends PipelineRuntime {
109
+ export interface GeocoderRuntime extends PipelineRuntime {
109
110
  /**
110
111
  * The composed basemap style (URL or `StyleSpecification`).
111
112
  */
112
- mapStyle: DemoMapStyle;
113
+ mapStyle: MapCanvasStyle;
113
114
  /**
114
115
  * Host-supplied overlays (coverage, race-dots, …).
115
116
  */
@@ -123,7 +124,7 @@ export interface DemoRuntime extends PipelineRuntime {
123
124
  */
124
125
  initialZoom?: number;
125
126
  /**
126
- * A bias-aware parse. The map demo feeds the current viewport center as a soft prior; when absent the host falls back
127
+ * A bias-aware parse. The geocoder feeds the current viewport center as a soft prior; when absent the host falls back
127
128
  * to the base {@link PipelineRuntime.runParse}. Kept separate so the shared `runParse` contract is unchanged.
128
129
  */
129
130
  runParseWithBias?: (input: string, bias: MapBias | null, hooks: {
@@ -139,16 +140,16 @@ export interface DemoRuntime extends PipelineRuntime {
139
140
  calibrator?: (raw: number) => number | null;
140
141
  /**
141
142
  * Enrich the selected candidate into the richer {@link ResolvedMapPlace} the declarative map render consumes (bbox,
142
- * street tier + uncertainty, a pre-fetched crisp polygon) — the fields that live on the demo's `ResolvedHit` but not
143
+ * street tier + uncertainty, a pre-fetched crisp polygon) — the fields that live on the host's `ResolvedHit` but not
143
144
  * on the shared {@link ResolvedPlaceView}. The host owns this because those extras (and the async polygon fetch in the
144
- * real demo) are host/gazetteer concerns; the package keeps {@link ParseResult} unpolluted. Absent → the candidate
145
+ * real runtime) are host/gazetteer concerns; the package keeps {@link ParseResult} unpolluted. Absent → the candidate
145
146
  * renders as a bare point (marker + a mid-zoom fly-to). Returning `null` also renders nothing.
146
147
  */
147
148
  resolveMapPlace?: (candidate: ResolvedPlaceView, result: ParseResult) => ResolvedMapPlace | null;
148
149
  /**
149
150
  * The selectable model bundles the version picker offers.
150
151
  */
151
- availableVersions?: DemoVersionOption[];
152
+ availableVersions?: VersionOption[];
152
153
  /**
153
154
  * The currently-selected model version.
154
155
  */
@@ -171,9 +172,10 @@ export interface DemoRuntime extends PipelineRuntime {
171
172
  setForceWASM?: (forceWASM: boolean) => void;
172
173
  }
173
174
  /**
174
- * The compare-mode state a {@link DemoPanels.compare} render-prop receives (the second parse itself stays host-side).
175
+ * The compare-mode state a {@link GeocoderPanels.compare} render-prop receives (the second parse itself stays
176
+ * host-side).
175
177
  */
176
- export interface DemoCompareContext {
178
+ export interface CompareContext {
177
179
  /**
178
180
  * The current primary parse result, or `null` before the first submit.
179
181
  */
@@ -188,12 +190,12 @@ export interface DemoCompareContext {
188
190
  compareVersion: string | null;
189
191
  }
190
192
  /**
191
- * The state a {@link DemoPanels.result} render-prop receives, so a host can render its OWN result block (the docs
193
+ * The state a {@link GeocoderPanels.result} render-prop receives, so a host can render its OWN result block (a
192
194
  * `<ResultPanel>` with its span-highlight / timing / hierarchy / precision detail) in place of the package's default
193
195
  * {@link ResultPanel}. Everything the default panel needs is passed through; the candidate-selection state stays owned
194
- * by the package (`useDemoGeocode`).
196
+ * by the package (`useGeocode`).
195
197
  */
196
- export interface DemoResultContext {
198
+ export interface ResultContext {
197
199
  /**
198
200
  * The current parse+resolve result.
199
201
  */
@@ -212,14 +214,14 @@ export interface DemoResultContext {
212
214
  onSelectCandidate: (index: number) => void;
213
215
  }
214
216
  /**
215
- * Host-injected panels for {@link GeocoderDemo}, the map analogue of `PipelinePanels`. Each is an already-rendered
216
- * `ReactNode` (or a thunk of the parse result / compare state) so the package needs neither the heavy docs visualizers
217
- * (ModelVisualizer, VersionCompare, AboutDemo, PermalinkButton) nor their data types. Every field is optional — the
218
- * fake-runtime Storybook stories pass none and still render the whole demo.
217
+ * Host-injected panels for {@link Geocoder}, the map analogue of `PipelinePanels`. Each is an already-rendered
218
+ * `ReactNode` (or a thunk of the parse result / compare state) so the package needs neither the heavy host visualizers
219
+ * (ModelVisualizer, VersionCompare, About, PermalinkButton) nor their data types. Every field is optional — the
220
+ * fake-runtime Storybook stories pass none and still render the whole geocoder.
219
221
  */
220
- export interface DemoPanels {
222
+ export interface GeocoderPanels {
221
223
  /**
222
- * Rendered at the top of the control panel (e.g. the docs "About this demo").
224
+ * Rendered at the top of the control panel (e.g. the host's "About this geocoder").
223
225
  */
224
226
  header?: ReactNode;
225
227
  /**
@@ -231,9 +233,9 @@ export interface DemoPanels {
231
233
  */
232
234
  footer?: ReactNode;
233
235
  /**
234
- * A device-location / proximity-bias control, rendered between the query form and the autocomplete list (the demo's
235
- * "📍 Use my location" row). Host-owned so the geolocation permission + the bias it feeds into the host's
236
- * {@link DemoRuntime.runParseWithBias} stay a host concern.
236
+ * A device-location / proximity-bias control, rendered between the query form and the autocomplete list (the "📍 Use
237
+ * my location" row). Host-owned so the geolocation permission + the bias it feeds into the host's
238
+ * {@link GeocoderRuntime.runParseWithBias} stay a host concern.
237
239
  */
238
240
  bias?: ReactNode;
239
241
  /**
@@ -241,19 +243,25 @@ export interface DemoPanels {
241
243
  */
242
244
  extras?: (result: ParseResult) => ReactNode;
243
245
  /**
244
- * Rendered just above the result block (present or empty). The demo's opt-in display toggles live here — calibrated
245
- * confidence + dev-mode — because the host owns both the toggle state AND the {@link result} / {@link debugDrawer}
246
- * renderers those toggles drive.
246
+ * Rendered just above the result block (present or empty), for content that reads on THIS answer.
247
+ *
248
+ * A control that reads on the model rather than on an address belongs in {@link developerExtras}: above the result it
249
+ * is the first thing a visitor meets, and on a phone it pushes the answer below the fold.
247
250
  */
248
251
  aboveResult?: (context: {
249
252
  result: ParseResult | null;
250
253
  }) => ReactNode;
254
+ /**
255
+ * Host controls appended to the Developer sheet — the opt-in display toggles, whose state and the renderers they
256
+ * drive both belong to the host.
257
+ */
258
+ developerExtras?: ReactNode;
251
259
  /**
252
260
  * Replace the package's default {@link ResultPanel} entirely. When provided, the host renders its own result block
253
- * (the docs `<ResultPanel>` — span highlight, timing, hierarchy, precision detail, calibrated confidences) from the
254
- * {@link DemoResultContext}. Absent → the built-in panel renders.
261
+ * (span highlight, timing, hierarchy, precision detail, calibrated confidences) from the {@link ResultContext}. Absent
262
+ * → the built-in panel renders.
255
263
  */
256
- result?: (context: DemoResultContext) => ReactNode;
264
+ result?: (context: ResultContext) => ReactNode;
257
265
  /**
258
266
  * Rendered in place of the resolved-place panel when nothing resolved (host's FailureDiagnostic). Ignored when
259
267
  * {@link result} is set.
@@ -262,7 +270,7 @@ export interface DemoPanels {
262
270
  /**
263
271
  * The version-compare view — the host renders its own diff from the compare state it owns.
264
272
  */
265
- compare?: (context: DemoCompareContext) => ReactNode;
273
+ compare?: (context: CompareContext) => ReactNode;
266
274
  /**
267
275
  * The model-visualizer / debug drawer, mounted beside the map (host's ModelVisualizer). A render-prop so the host can
268
276
  * trace the CURRENT result (its input) — the package passes the live parse result; the host decides on its own
@@ -272,9 +280,19 @@ export interface DemoPanels {
272
280
  result: ParseResult | null;
273
281
  }) => ReactNode;
274
282
  /**
275
- * Extra map controls mounted as `<DemoMap>` children (host's DebugControl / LayerToggle via `useControl`).
283
+ * Extra map controls mounted as `<MapCanvas>` children (host's DebugControl / LayerToggle via `useControl`).
276
284
  */
277
285
  mapControls?: ReactNode;
286
+ /**
287
+ * A layer control, rendered in the chrome's top column under the example chips rather than in a MapLibre corner.
288
+ *
289
+ * A render-prop taking the live map handle, because a layer control reads `getStyle().layers` and writes
290
+ * `setLayoutProperty` — it cannot be a static node. The handle is `null` until the map instantiates, so the host
291
+ * returns `null` for that first frame rather than rendering an empty control.
292
+ */
293
+ layers?: (context: {
294
+ map: MapInstance | null;
295
+ }) => ReactNode;
278
296
  /**
279
297
  * A permalink control for the current address (host's PermalinkButton).
280
298
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../lib/map/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAEpF,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AAE,WAAW,GAAG,IAAI,CAAA;KAAE,KAAK,SAAS,CAAA;IACpE;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAAA;KAAE,KAAK,SAAS,CAAA;IAC5D;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,CAAA;CACvC"}
package/out/map/types.js CHANGED
@@ -3,15 +3,15 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Types for the geocoder-demo map surface. Mirrors the pipeline boundary: the package owns the UI state
7
- * machine + the declarative map, while the host injects a {@link DemoRuntime} that owns ONNX / httpvfs
8
- * / R2 and the composed map style. {@link DemoRuntime} EXTENDS {@link PipelineRuntime} so the shared
6
+ * Types for the geocoder map surface. Mirrors the pipeline boundary: the package owns the UI state
7
+ * machine + the declarative map, while the host injects a {@link GeocoderRuntime} that owns ONNX / httpvfs
8
+ * / R2 and the composed map style. {@link GeocoderRuntime} EXTENDS {@link PipelineRuntime} so the shared
9
9
  * `runParse` / `parseStageLabels` / `loading` contract is reused, and adds the map-specific surface
10
10
  * (style, overlays, initial center, viewport bias, backend/version selection). Phase 4 adds the
11
- * `resolveMapPlace` enricher, the {@link DemoPanels} injection bag, and the {@link DemoCompareContext}.
11
+ * `resolveMapPlace` enricher, the {@link GeocoderPanels} injection bag, and the {@link CompareContext}.
12
12
  *
13
13
  * The map-spec types are imported type-only from `react-map-gl/maplibre`; nothing here loads maplibre at
14
- * runtime, so this module stays node-safe (its concrete-value CONSUMERS — `DemoMap`, `GeocoderDemo` —
14
+ * runtime, so this module stays node-safe (its concrete-value CONSUMERS — `MapCanvas`, `Geocoder` —
15
15
  * are the ones behind the `@mailwoman/react/map` subpath).
16
16
  */
17
17
  export {};
@@ -3,9 +3,9 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * `useDemoGeocode` — the parse+resolve state machine for the geocoder map demo. It REUSES the pipeline's
6
+ * `useGeocode` — the parse+resolve state machine for the geocoder map. It REUSES the pipeline's
7
7
  * `useParsePipeline` (text / busy / stage / result / candidate selection) and layers on the two map-only
8
- * concerns the demo adds over the base explorer:
8
+ * concerns the geocoder adds over the base explorer:
9
9
  *
10
10
  * 1. Viewport bias — when the runtime exposes `runParseWithBias`, the current map center (read through
11
11
  * an injected `getBias`, itself reading the `MapRef`) rides along as a soft proximity prior. The
@@ -18,13 +18,13 @@
18
18
  * callback, so this hook stays independent of the map binding.
19
19
  */
20
20
  import type { ResolvedMapPlace } from "#map/place-render";
21
- import type { DemoRuntime, MapBias } from "#map/types";
21
+ import type { GeocoderRuntime, MapBias } from "#map/types";
22
22
  import { type UseParsePipeline } from "#pipeline/useParsePipeline";
23
- export interface UseDemoGeocodeOptions {
23
+ export interface UseGeocodeOptions {
24
24
  /**
25
- * The injected demo runtime (extends `PipelineRuntime` with the map + bias surface).
25
+ * The injected geocoder runtime (extends `PipelineRuntime` with the map + bias surface).
26
26
  */
27
- runtime: DemoRuntime;
27
+ runtime: GeocoderRuntime;
28
28
  /**
29
29
  * Address to pre-fill.
30
30
  */
@@ -34,11 +34,11 @@ export interface UseDemoGeocodeOptions {
34
34
  */
35
35
  getBias?: () => MapBias | null;
36
36
  }
37
- export interface UseDemoGeocode extends UseParsePipeline {
37
+ export interface UseGeocode extends UseParsePipeline {
38
38
  /**
39
39
  * The selected candidate enriched into the map-render shape (bbox / tier / polygon), or `null`.
40
40
  */
41
41
  mapPlace: ResolvedMapPlace | null;
42
42
  }
43
- export declare function useDemoGeocode({ runtime, defaultText, getBias }: UseDemoGeocodeOptions): UseDemoGeocode;
44
- //# sourceMappingURL=useDemoGeocode.d.ts.map
43
+ export declare function useGeocode({ runtime, defaultText, getBias }: UseGeocodeOptions): UseGeocode;
44
+ //# sourceMappingURL=useGeocode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGeocode.d.ts","sourceRoot":"","sources":["../../lib/map/useGeocode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE1D,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAEpF,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,OAAO,EAAE,eAAe,CAAA;IACxB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,OAAO,GAAG,IAAI,CAAA;CAC9B;AAED,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IACnD;;OAEG;IACH,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAA;CACjC;AAED,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,iBAAiB,GAAG,UAAU,CAyB3F"}
@@ -3,9 +3,9 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * `useDemoGeocode` — the parse+resolve state machine for the geocoder map demo. It REUSES the pipeline's
6
+ * `useGeocode` — the parse+resolve state machine for the geocoder map. It REUSES the pipeline's
7
7
  * `useParsePipeline` (text / busy / stage / result / candidate selection) and layers on the two map-only
8
- * concerns the demo adds over the base explorer:
8
+ * concerns the geocoder adds over the base explorer:
9
9
  *
10
10
  * 1. Viewport bias — when the runtime exposes `runParseWithBias`, the current map center (read through
11
11
  * an injected `getBias`, itself reading the `MapRef`) rides along as a soft proximity prior. The
@@ -19,7 +19,7 @@
19
19
  */
20
20
  import { useMemo } from "react";
21
21
  import { useParsePipeline } from "#pipeline/useParsePipeline";
22
- export function useDemoGeocode({ runtime, defaultText, getBias }) {
22
+ export function useGeocode({ runtime, defaultText, getBias }) {
23
23
  // Bind the viewport bias into a derived `runParse` so `useParsePipeline` is reused unchanged. When the runtime has no
24
24
  // bias-aware parse, pass it straight through.
25
25
  const geoRuntime = useMemo(() => {
@@ -41,4 +41,4 @@ export function useDemoGeocode({ runtime, defaultText, getBias }) {
41
41
  }, [pipeline.selectedCandidate, pipeline.result, runtime]);
42
42
  return { ...pipeline, mapPlace };
43
43
  }
44
- //# sourceMappingURL=useDemoGeocode.js.map
44
+ //# sourceMappingURL=useGeocode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGeocode.js","sourceRoot":"","sources":["../../lib/map/useGeocode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAK/B,OAAO,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAA;AAwBpF,MAAM,UAAU,UAAU,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAqB;IAC9E,sHAAsH;IACtH,8CAA8C;IAC9C,MAAM,UAAU,GAAG,OAAO,CAAkB,GAAG,EAAE;QAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAA;QAEzC,IAAI,CAAC,QAAQ;YAAE,OAAO,OAAO,CAAA;QAE7B,OAAO;YACN,GAAG,OAAO;YACV,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,KAAK,CAAC;SACvE,CAAA;IACF,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;IAEtB,MAAM,QAAQ,GAAG,gBAAgB,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAA;IAEvE,MAAM,QAAQ,GAAG,OAAO,CAA0B,GAAG,EAAE;QACtD,IAAI,CAAC,QAAQ,CAAC,iBAAiB,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,IAAI,CAAA;QAEhE,OAAO,OAAO,CAAC,eAAe;YAC7B,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC;YACtE,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAA;IAC9B,CAAC,EAAE,CAAC,QAAQ,CAAC,iBAAiB,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAE1D,OAAO,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,CAAA;AACjC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `useMapBearing` — the map's rotation as React state, for a compass that appears off north and fades back.
7
+ *
8
+ * The map is an external store, so it is read through `useSyncExternalStore` rather than mirrored into state by an
9
+ * effect: the bearing is a number, which makes a stable snapshot, and React tears nothing during a concurrent
10
+ * render.
11
+ *
12
+ * It listens on `rotate` rather than `rotateend`, because the needle has to track the gesture rather than snap once
13
+ * the gesture is over. `move` is subscribed too: a `flyTo` or an `easeTo` carrying a bearing rotates the map without
14
+ * firing a rotate event, and a compass that misses those stays pointing north over a turned map.
15
+ */
16
+ import type { MapInstance } from "react-map-gl/maplibre";
17
+ export interface UseMapBearing {
18
+ /**
19
+ * Degrees off north, as MapLibre reports it. Zero while there is no map.
20
+ */
21
+ bearing: number;
22
+ /**
23
+ * Rotate the map back to north. A no-op while there is no map.
24
+ */
25
+ resetNorth: () => void;
26
+ }
27
+ export declare function useMapBearing(map: MapInstance | null): UseMapBearing;
28
+ //# sourceMappingURL=useMapBearing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMapBearing.d.ts","sourceRoot":"","sources":["../../lib/map/useMapBearing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,UAAU,EAAE,MAAM,IAAI,CAAA;CACtB;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,GAAG,aAAa,CAyBpE"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `useMapBearing` — the map's rotation as React state, for a compass that appears off north and fades back.
7
+ *
8
+ * The map is an external store, so it is read through `useSyncExternalStore` rather than mirrored into state by an
9
+ * effect: the bearing is a number, which makes a stable snapshot, and React tears nothing during a concurrent
10
+ * render.
11
+ *
12
+ * It listens on `rotate` rather than `rotateend`, because the needle has to track the gesture rather than snap once
13
+ * the gesture is over. `move` is subscribed too: a `flyTo` or an `easeTo` carrying a bearing rotates the map without
14
+ * firing a rotate event, and a compass that misses those stays pointing north over a turned map.
15
+ */
16
+ import { useCallback, useSyncExternalStore } from "react";
17
+ export function useMapBearing(map) {
18
+ const subscribe = useCallback((onChange) => {
19
+ if (!map)
20
+ return () => undefined;
21
+ map.on("rotate", onChange);
22
+ map.on("move", onChange);
23
+ return () => {
24
+ map.off("rotate", onChange);
25
+ map.off("move", onChange);
26
+ };
27
+ }, [map]);
28
+ // The server snapshot is the same reading: there is no map during a server render, and north is what a compass
29
+ // shows when it has nothing to report.
30
+ const readBearing = useCallback(() => map?.getBearing() ?? 0, [map]);
31
+ const bearing = useSyncExternalStore(subscribe, readBearing, () => 0);
32
+ const resetNorth = useCallback(() => map?.easeTo({ bearing: 0, pitch: 0 }), [map]);
33
+ return { bearing, resetNorth };
34
+ }
35
+ //# sourceMappingURL=useMapBearing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMapBearing.js","sourceRoot":"","sources":["../../lib/map/useM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place label on the map searches for it, the way the reference map apps behave.
7
+ *
8
+ * A label on a map looks like a link, so a visitor clicks it. Without this the click reaches the map's pan handler
9
+ * and nothing happens, which reads as the label being decoration.
10
+ *
11
+ * It reads the label's OWN name from the rendered feature rather than reverse-geocoding the click point: the name
12
+ * is what the visitor pointed at, and a lookup by coordinate answers whatever is nearest instead, which on a dense
13
+ * basemap is regularly not the thing under the cursor.
14
+ *
15
+ * THE QUERY IS SCOPED, AND THE HOVER QUERY IS THROTTLED. `queryRenderedFeatures` with no `layers` walks the whole
16
+ * style: measured at 64.3 ms per call returning 4,819 features over the 79-layer basemap at zoom 14 in Manhattan,
17
+ * against 4.9 ms and 44 features scoped to that style's 11 label layers. At one call per pointer move the unscoped
18
+ * form is the map's whole frame budget, so the layer list is resolved once per style and the hover query runs at
19
+ * most once per animation frame. The click query is not throttled — there is one of those per click.
20
+ */
21
+ import type { MapInstance } from "react-map-gl/maplibre";
22
+ export declare function useMapLabelPick(map: MapInstance | null, onPick: (name: string) => void): void;
23
+ //# sourceMappingURL=useMapLabelPick.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMapLabelPick.d.ts","sourceRoot":"","sources":["../../lib/map/useMapLabelPick.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,uBAAuB,CAAA;AA2C5E,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAyD7F"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `useMapLabelPick` — clicking a place label on the map searches for it, the way the reference map apps behave.
7
+ *
8
+ * A label on a map looks like a link, so a visitor clicks it. Without this the click reaches the map's pan handler
9
+ * and nothing happens, which reads as the label being decoration.
10
+ *
11
+ * It reads the label's OWN name from the rendered feature rather than reverse-geocoding the click point: the name
12
+ * is what the visitor pointed at, and a lookup by coordinate answers whatever is nearest instead, which on a dense
13
+ * basemap is regularly not the thing under the cursor.
14
+ *
15
+ * THE QUERY IS SCOPED, AND THE HOVER QUERY IS THROTTLED. `queryRenderedFeatures` with no `layers` walks the whole
16
+ * style: measured at 64.3 ms per call returning 4,819 features over the 79-layer basemap at zoom 14 in Manhattan,
17
+ * against 4.9 ms and 44 features scoped to that style's 11 label layers. At one call per pointer move the unscoped
18
+ * form is the map's whole frame budget, so the layer list is resolved once per style and the hover query runs at
19
+ * most once per animation frame. The click query is not throttled — there is one of those per click.
20
+ */
21
+ import { useEffect, useEffectEvent } from "react";
22
+ /**
23
+ * The layers whose features carry a place name. Protomaps names its label layers `<theme>_label` and its settlement
24
+ * layers `places_*`; anything else in the style is geometry, not a label a visitor can read and point at.
25
+ */
26
+ const LABEL_LAYER = /_label|^places_/;
27
+ /**
28
+ * Properties a label carries its text under, in the order they are trusted. `name` is protomaps' own; the localized
29
+ * variants appear on styles built for a specific script.
30
+ */
31
+ const NAME_KEYS = ["name", "name:en", "name_en"];
32
+ /**
33
+ * The style's label layers, by id.
34
+ *
35
+ * A style with none answers an EMPTY ARRAY, and the caller must treat that as "no labels to pick" rather than passing
36
+ * it to `queryRenderedFeatures` — an empty `layers` option is not the same as an absent one there, and the difference
37
+ * between "this style has no labels" and "query everything" is the 64 ms this hook exists to avoid.
38
+ */
39
+ function labelLayerIDs(map) {
40
+ const layers = map.getStyle()?.layers ?? [];
41
+ return layers.map((layer) => layer.id).filter((id) => LABEL_LAYER.test(id));
42
+ }
43
+ function labelNameAt(map, point, layers) {
44
+ if (!layers.length)
45
+ return null;
46
+ // `queryRenderedFeatures` answers in paint order with the topmost first, which is the label drawn over the others
47
+ // and therefore the one a click landed on.
48
+ for (const feature of map.queryRenderedFeatures(point, { layers })) {
49
+ for (const key of NAME_KEYS) {
50
+ const value = feature.properties?.[key];
51
+ if (typeof value === "string" && value.trim())
52
+ return value;
53
+ }
54
+ }
55
+ return null;
56
+ }
57
+ export function useMapLabelPick(map, onPick) {
58
+ // The subscription depends on the MAP alone. `useGeocode` returns a fresh object every render, so a callback built
59
+ // from it is new every render too — with `onPick` in the dependency list these map listeners were torn down and
60
+ // re-added on every keystroke in the search field. `useEffectEvent` is the shape for exactly this: an event
61
+ // handler that always sees the latest props without being a reactive dependency.
62
+ const pick = useEffectEvent((name) => onPick(name));
63
+ useEffect(() => {
64
+ if (!map)
65
+ return;
66
+ // Recomputed when the style swaps (a theme change, a version switch) and not once per pointer move.
67
+ let layers = labelLayerIDs(map);
68
+ const readLayers = () => {
69
+ layers = labelLayerIDs(map);
70
+ };
71
+ const onClick = (event) => {
72
+ const name = labelNameAt(map, event.point, layers);
73
+ if (name) {
74
+ pick(name);
75
+ }
76
+ };
77
+ let frame = 0;
78
+ const onMove = (event) => {
79
+ if (frame)
80
+ return;
81
+ frame = requestAnimationFrame(() => {
82
+ frame = 0;
83
+ const canvas = map.getCanvas();
84
+ // The drag cursor belongs to the pan gesture; overriding it mid-drag would fight the map for the pointer.
85
+ if (canvas.style.cursor === "grabbing")
86
+ return;
87
+ canvas.style.cursor = labelNameAt(map, event.point, layers) ? "pointer" : "";
88
+ });
89
+ };
90
+ map.on("styledata", readLayers);
91
+ map.on("click", onClick);
92
+ map.on("mousemove", onMove);
93
+ return () => {
94
+ if (frame) {
95
+ cancelAnimationFrame(frame);
96
+ }
97
+ map.off("styledata", readLayers);
98
+ map.off("click", onClick);
99
+ map.off("mousemove", onMove);
100
+ map.getCanvas().style.cursor = "";
101
+ };
102
+ }, [map]);
103
+ }
104
+ //# sourceMappingURL=useMapLabelPick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMapLabelPick.js","sourceRoot":"","sources":["../../lib/map/useMapLabelPick.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,cAAc,E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AE,CAAC;gBACX,oBAAoB,CAAC,KAAK,CAAC,CAAA;YAC5B,CAAC;YAED,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;YAChC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YACzB,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;YAC5B,GAAG,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAA;QAClC,CAAC,CAAA;IACF,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;AACV,CAAC"}
@@ -6,8 +6,8 @@
6
6
  * `CandidatePicker` — the ranked list of alternate gazetteer candidates; clicking one selects it.
7
7
  * Presentational; the selected index is owned by the caller (the pipeline hook).
8
8
  */
9
+ import type { ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result";
9
10
  import type { ReactNode } from "react";
10
- import type { ResolvedPlaceView } from "#pipeline/types";
11
11
  export interface CandidatePickerProps {
12
12
  candidates: ResolvedPlaceView[];
13
13
  selectedIndex: number;
@@ -1 +1 @@
1
- {"version":3,"file":"CandidatePicker.d.ts","sourceRoot":"","sources":["../../lib/pipeline/CandidatePicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD,MAAM,WAAW,oBAAoB;IACpC,UAAU,EAAE,iBAAiB,EAAE,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACjC;AAED,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,oBAAoB,GAAG,SAAS,CAwBxG"}
1
+ {"version":3,"file":"CandidatePicker.d.ts","sourceRoot":"","sources":["../../lib/pipeline/CandidatePicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,MAAM,WAAW,oBAAoB;IACpC,UAAU,EAAE,iBAAiB,EAAE,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACjC;AAED,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,oBAAoB,GAAG,SAAS,CAwBxG"}
@@ -1,4 +1,4 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cx } from "#common/cx";
3
3
  export function CandidatePicker({ candidates, selectedIndex, onSelect }) {
4
4
  return (_jsxs("div", { className: "mw-candidates", children: [_jsxs("h2", { children: ["Other candidates (", candidates.length - 1, ")"] }), _jsx("ol", { className: "mw-candidates__list", children: candidates.map((candidate, i) => (_jsx("li", { children: _jsxs("button", { type: "button", className: cx("mw-candidates__btn", { "mw-candidates__btn--active": i === selectedIndex }), onClick: () => onSelect(i), title: `${candidate.placetype} • WOF ${candidate.id} • score ${candidate.score.toFixed(3)}`, children: [_jsxs("span", { className: "mw-candidates__rank", children: ["#", i + 1] }), _jsx("span", { className: "mw-candidates__name", children: candidate.name }), _jsxs("span", { className: "mw-candidates__meta", children: [candidate.placetype, " \u00B7 ", candidate.score.toFixed(2)] })] }) }, `${candidate.id}-${i}`))) })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"CandidatePicker.js","sourceRoot":"","sources":["../../lib/pipeline/CandidatePicker.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAS/B,MAAM,UA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C,SAAO,EACnD,aAAI,SAAS,EAAC,qBAAqB,YACjC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,CACjC,uBACC,kBACC,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,EAAE,4BAA4B,EAAE,CAAC,KAAK,aAAa,EAAE,CAAC,EAC1F,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,EAC1B,KAAK,EAAE,GAAG,SAAS,CAAC,SAAS,UAAU,SAAS,CAAC,EAAE,YAAY,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,aAE3F,gBAAM,SAAS,EAAC,qBAAqB,kBAAG,CAAC,GAAG,CAAC,IAAQ,EACrD,eAAM,SAAS,EAAC,qBAAqB,YAAE,SAAS,CAAC,IAAI,GAAQ,EAC7D,gBAAM,SAAS,EAAC,qBAAqB,aACnC,SAAS,CAAC,SAAS,cAAK,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAC7C,IACC,IAZD,GAAG,SAAS,CAAC,EAAE,IAAI,CAAC,EAAE,CAa1B,CACL,CAAC,GACE,IACA,CACN,CAAA;AACF,CAAC"}
@@ -5,8 +5,8 @@
5
5
  *
6
6
  * `ComponentTable` — the tag / value / confidence table of decoded components. Presentational.
7
7
  */
8
+ import type { ParsedComponent } from "@mailwoman/core/pipeline/client-result";
8
9
  import type { ReactNode } from "react";
9
- import type { ParsedComponent } from "#pipeline/types";
10
10
  export interface ComponentTableProps {
11
11
  nodes: ParsedComponent[];
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentTable.d.ts","sourceRoot":"","sources":["../../lib/pipeline/ComponentTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAItD,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,eAAe,EAAE,CAAA;CACxB;AAED,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,EAAE,mBAAmB,GAAG,SAAS,CAuBxE"}
1
+ {"version":3,"file":"ComponentTable.d.ts","sourceRoot":"","sources":["../../lib/pipeline/ComponentTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,eAAe,EAAE,CAAA;CACxB;AAED,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,EAAE,mBAAmB,GAAG,SAAS,CAuBxE"}
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentTable.js","sourceRoot":"","sources":["../../lib/pipeline/ComponentTable.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAA;AAMrD,MAAM,UAAU,cAAc,CAAC,EAAE,KAAK,EAAuB;IAC5D,OAAO,CACN,iBAAO,SAAS,EAAC,eAAe,aAC/B,0BACC,yBACC,+BAAY,EACZ,iCAAc,EACd,sCAAmB,IACf,GACE,EACR,0BACE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACvB,yBACC,uBAAK,IAAI,CAAC,GAAG,GAAM,EACnB,uBAAK,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,GAAM,EACnC,uBACC,KAAC,cAAc,IAAC,UAAU,EAAE,IAAI,CAAC,UAAU,GAAI,GAC3C,KALG,CAAC,CAML,CACL,CAAC,GACK,IACD,CACR,CAAA;AACF,CAAC"}
1
+ {"version":3,"file":"ComponentTable.js","sourceRoot":"","sources":["../../lib/pipeline/ComponentTable.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAA;AAMrD,MAAM,UAAU,cAAc,CAAC,EAAE,KAAK,EAAuB;IAC5D,OAAO,CACN,iBAAO,SAAS,EAAC,eAAe,aAC/B,0BACC,yBACC,+BAAY,EACZ,iCAAc,EACd,sCAAmB,IACf,GACE,EACR,0BACE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACvB,yBACC,uBAAK,IAAI,CAAC,GAAG,GAAM,EACnB,uBAAK,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,GAAM,EACnC,uBACC,KAAC,cAAc,IAAC,UAAU,EAAE,IAAI,CAAC,UAAU,GAAI,GAC3C,KALG,CAAC,CAML,CACL,CAAC,GACK,IACD,CACR,CAAA;AACF,CAAC"}