@mailwoman/react 10.0.0 → 10.2.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 (389) hide show
  1. package/README.md +18 -16
  2. package/fonts.css +97 -22
  3. package/lib/common/About.tsx +10 -10
  4. package/lib/common/ClientOnly.tsx +2 -14
  5. package/lib/common/CopyButton.tsx +9 -3
  6. package/lib/common/LoadingIndicator.tsx +13 -5
  7. package/lib/common/PresetChips.tsx +11 -8
  8. package/lib/common/confidence-tiers.ts +8 -7
  9. package/lib/common/cx.ts +3 -1
  10. package/lib/common/text-tokens.ts +10 -13
  11. package/lib/common/useBuildInfo.ts +54 -0
  12. package/lib/common/useClipboard.ts +2 -11
  13. package/lib/common.ts +22 -0
  14. package/lib/index.ts +27 -18
  15. package/lib/map/AppIdentity.tsx +89 -0
  16. package/lib/map/CompareToggle.tsx +8 -31
  17. package/lib/map/DebugInfo.tsx +75 -0
  18. package/lib/map/Geocoder.tsx +65 -50
  19. package/lib/map/GeocoderControls.tsx +425 -141
  20. package/lib/map/GraticuleLayer.tsx +56 -0
  21. package/lib/map/MapCanvas.tsx +26 -13
  22. package/lib/map/MapChipRow.tsx +4 -8
  23. package/lib/map/MapCompass.tsx +18 -25
  24. package/lib/map/MapControlStack.tsx +11 -10
  25. package/lib/map/MapFooter.tsx +5 -17
  26. package/lib/map/MapProgressBar.tsx +10 -13
  27. package/lib/map/MapSearchBar.tsx +31 -17
  28. package/lib/map/MapSheet.tsx +24 -15
  29. package/lib/map/OverlayLayers.tsx +14 -3
  30. package/lib/map/PlaceAutocomplete.tsx +12 -21
  31. package/lib/map/PlaceMarker.tsx +10 -4
  32. package/lib/map/ResolvedPlaceLayers.tsx +14 -15
  33. package/lib/map/ResultCamera.tsx +10 -31
  34. package/lib/map/ResultOverlay.tsx +14 -16
  35. package/lib/map/ResultPanel.tsx +1 -20
  36. package/lib/map/VersionPicker.tsx +10 -19
  37. package/lib/map/fake-runtime.ts +46 -19
  38. package/lib/map/geometry.ts +14 -47
  39. package/lib/map/graticule.ts +80 -0
  40. package/lib/map/map-debug.ts +4 -2
  41. package/lib/map/place-render.ts +30 -62
  42. package/lib/map/types.ts +57 -116
  43. package/lib/map/useCompareState.ts +5 -4
  44. package/lib/map/useGeocode.ts +7 -5
  45. package/lib/map/useMapBearing.ts +13 -13
  46. package/lib/map/useMapLabelPick.ts +21 -30
  47. package/lib/map/useMapPlaceRender.ts +3 -7
  48. package/lib/map/usePlaceAutocomplete.ts +44 -50
  49. package/lib/map.ts +92 -0
  50. package/lib/pipeline/CandidatePicker.tsx +13 -5
  51. package/lib/pipeline/ConfidenceCell.tsx +2 -2
  52. package/lib/pipeline/FailureDiagnostic.tsx +8 -2
  53. package/lib/pipeline/PipelineExplorer.tsx +6 -3
  54. package/lib/pipeline/QueryForm.tsx +5 -2
  55. package/lib/pipeline/ResolvedPlace.tsx +2 -2
  56. package/lib/pipeline/SpanHighlight.tsx +7 -5
  57. package/lib/pipeline/TimingPanel.tsx +1 -1
  58. package/lib/pipeline/TreeView.tsx +2 -2
  59. package/lib/pipeline/copy.ts +22 -25
  60. package/lib/pipeline/presets.ts +15 -13
  61. package/lib/pipeline/types.ts +20 -17
  62. package/lib/pipeline/useParsePipeline.ts +16 -13
  63. package/lib/pipeline.ts +36 -0
  64. package/lib/poi/AbstainPanel.tsx +1 -1
  65. package/lib/poi/LiveResultsBlock.tsx +2 -1
  66. package/lib/poi/POIExplorer.tsx +29 -17
  67. package/lib/poi/QueryInput.tsx +1 -1
  68. package/lib/poi/SubjectPanel.tsx +4 -3
  69. package/lib/poi/runtime.ts +14 -16
  70. package/lib/poi/types.ts +58 -47
  71. package/lib/poi/usePOISearch.ts +91 -82
  72. package/lib/poi.ts +40 -0
  73. package/lib/runtime/useReleaseRuntime.ts +122 -90
  74. package/lib/search/SearchModal.tsx +478 -0
  75. package/lib/search/search.css +282 -0
  76. package/lib/search/types.ts +68 -0
  77. package/lib/search.ts +11 -0
  78. package/out/common/About.d.ts +6 -6
  79. package/out/common/About.d.ts.map +1 -1
  80. package/out/common/About.js +1 -1
  81. package/out/common/About.js.map +1 -1
  82. package/out/common/ClientOnly.d.ts +2 -11
  83. package/out/common/ClientOnly.d.ts.map +1 -1
  84. package/out/common/ClientOnly.js +1 -13
  85. package/out/common/ClientOnly.js.map +1 -1
  86. package/out/common/CopyButton.d.ts +9 -3
  87. package/out/common/CopyButton.d.ts.map +1 -1
  88. package/out/common/CopyButton.js.map +1 -1
  89. package/out/common/LoadingIndicator.d.ts +13 -5
  90. package/out/common/LoadingIndicator.d.ts.map +1 -1
  91. package/out/common/LoadingIndicator.js.map +1 -1
  92. package/out/common/PresetChips.d.ts +11 -8
  93. package/out/common/PresetChips.d.ts.map +1 -1
  94. package/out/common/PresetChips.js.map +1 -1
  95. package/out/common/confidence-tiers.d.ts +8 -7
  96. package/out/common/confidence-tiers.d.ts.map +1 -1
  97. package/out/common/confidence-tiers.js +7 -6
  98. package/out/common/confidence-tiers.js.map +1 -1
  99. package/out/common/cx.d.ts +3 -1
  100. package/out/common/cx.d.ts.map +1 -1
  101. package/out/common/cx.js +3 -1
  102. package/out/common/cx.js.map +1 -1
  103. package/out/common/text-tokens.d.ts +6 -11
  104. package/out/common/text-tokens.d.ts.map +1 -1
  105. package/out/common/text-tokens.js +6 -3
  106. package/out/common/text-tokens.js.map +1 -1
  107. package/out/common/useBuildInfo.d.ts +27 -0
  108. package/out/common/useBuildInfo.d.ts.map +1 -0
  109. package/out/common/useBuildInfo.js +32 -0
  110. package/out/common/useBuildInfo.js.map +1 -0
  111. package/out/common/useClipboard.d.ts +1 -3
  112. package/out/common/useClipboard.d.ts.map +1 -1
  113. package/out/common/useClipboard.js +2 -11
  114. package/out/common/useClipboard.js.map +1 -1
  115. package/out/common.d.ts +22 -0
  116. package/out/common.d.ts.map +1 -0
  117. package/out/common.js +15 -0
  118. package/out/common.js.map +1 -0
  119. package/out/index.d.ts +26 -16
  120. package/out/index.d.ts.map +1 -1
  121. package/out/index.js +21 -15
  122. package/out/index.js.map +1 -1
  123. package/out/map/AppIdentity.d.ts +46 -0
  124. package/out/map/AppIdentity.d.ts.map +1 -0
  125. package/out/map/AppIdentity.js +16 -0
  126. package/out/map/AppIdentity.js.map +1 -0
  127. package/out/map/CompareToggle.d.ts +8 -31
  128. package/out/map/CompareToggle.d.ts.map +1 -1
  129. package/out/map/CompareToggle.js +4 -1
  130. package/out/map/CompareToggle.js.map +1 -1
  131. package/out/map/DebugInfo.d.ts +27 -0
  132. package/out/map/DebugInfo.d.ts.map +1 -0
  133. package/out/map/DebugInfo.js +36 -0
  134. package/out/map/DebugInfo.js.map +1 -0
  135. package/out/map/Geocoder.d.ts +41 -30
  136. package/out/map/Geocoder.d.ts.map +1 -1
  137. package/out/map/Geocoder.js +23 -37
  138. package/out/map/Geocoder.js.map +1 -1
  139. package/out/map/GeocoderControls.d.ts +15 -44
  140. package/out/map/GeocoderControls.d.ts.map +1 -1
  141. package/out/map/GeocoderControls.js +250 -39
  142. package/out/map/GeocoderControls.js.map +1 -1
  143. package/out/map/GraticuleLayer.d.ts +30 -0
  144. package/out/map/GraticuleLayer.d.ts.map +1 -0
  145. package/out/map/GraticuleLayer.js +25 -0
  146. package/out/map/GraticuleLayer.js.map +1 -0
  147. package/out/map/MapCanvas.d.ts +26 -13
  148. package/out/map/MapCanvas.d.ts.map +1 -1
  149. package/out/map/MapCanvas.js +5 -2
  150. package/out/map/MapCanvas.js.map +1 -1
  151. package/out/map/MapChipRow.d.ts +4 -8
  152. package/out/map/MapChipRow.d.ts.map +1 -1
  153. package/out/map/MapChipRow.js.map +1 -1
  154. package/out/map/MapCompass.d.ts +14 -21
  155. package/out/map/MapCompass.d.ts.map +1 -1
  156. package/out/map/MapCompass.js +5 -1
  157. package/out/map/MapCompass.js.map +1 -1
  158. package/out/map/MapControlStack.d.ts +11 -10
  159. package/out/map/MapControlStack.d.ts.map +1 -1
  160. package/out/map/MapControlStack.js +4 -1
  161. package/out/map/MapControlStack.js.map +1 -1
  162. package/out/map/MapFooter.d.ts +5 -16
  163. package/out/map/MapFooter.d.ts.map +1 -1
  164. package/out/map/MapFooter.js +0 -14
  165. package/out/map/MapFooter.js.map +1 -1
  166. package/out/map/MapProgressBar.d.ts +10 -13
  167. package/out/map/MapProgressBar.d.ts.map +1 -1
  168. package/out/map/MapProgressBar.js.map +1 -1
  169. package/out/map/MapSearchBar.d.ts +16 -17
  170. package/out/map/MapSearchBar.d.ts.map +1 -1
  171. package/out/map/MapSearchBar.js +6 -0
  172. package/out/map/MapSearchBar.js.map +1 -1
  173. package/out/map/MapSheet.d.ts +15 -12
  174. package/out/map/MapSheet.d.ts.map +1 -1
  175. package/out/map/MapSheet.js +8 -12
  176. package/out/map/MapSheet.js.map +1 -1
  177. package/out/map/OverlayLayers.d.ts +8 -2
  178. package/out/map/OverlayLayers.d.ts.map +1 -1
  179. package/out/map/OverlayLayers.js +3 -3
  180. package/out/map/OverlayLayers.js.map +1 -1
  181. package/out/map/PlaceAutocomplete.d.ts +12 -21
  182. package/out/map/PlaceAutocomplete.d.ts.map +1 -1
  183. package/out/map/PlaceAutocomplete.js +2 -1
  184. package/out/map/PlaceAutocomplete.js.map +1 -1
  185. package/out/map/PlaceMarker.d.ts +10 -4
  186. package/out/map/PlaceMarker.d.ts.map +1 -1
  187. package/out/map/PlaceMarker.js +3 -1
  188. package/out/map/PlaceMarker.js.map +1 -1
  189. package/out/map/ResolvedPlaceLayers.d.ts +14 -15
  190. package/out/map/ResolvedPlaceLayers.d.ts.map +1 -1
  191. package/out/map/ResolvedPlaceLayers.js +1 -1
  192. package/out/map/ResolvedPlaceLayers.js.map +1 -1
  193. package/out/map/ResultCamera.d.ts +10 -31
  194. package/out/map/ResultCamera.d.ts.map +1 -1
  195. package/out/map/ResultCamera.js +3 -28
  196. package/out/map/ResultCamera.js.map +1 -1
  197. package/out/map/ResultOverlay.d.ts +14 -16
  198. package/out/map/ResultOverlay.d.ts.map +1 -1
  199. package/out/map/ResultOverlay.js +1 -2
  200. package/out/map/ResultOverlay.js.map +1 -1
  201. package/out/map/ResultPanel.d.ts +1 -20
  202. package/out/map/ResultPanel.d.ts.map +1 -1
  203. package/out/map/ResultPanel.js.map +1 -1
  204. package/out/map/VersionPicker.d.ts +7 -19
  205. package/out/map/VersionPicker.d.ts.map +1 -1
  206. package/out/map/VersionPicker.js +5 -2
  207. package/out/map/VersionPicker.js.map +1 -1
  208. package/out/map/fake-runtime.d.ts +9 -11
  209. package/out/map/fake-runtime.d.ts.map +1 -1
  210. package/out/map/fake-runtime.js +45 -19
  211. package/out/map/fake-runtime.js.map +1 -1
  212. package/out/map/geometry.d.ts +13 -34
  213. package/out/map/geometry.d.ts.map +1 -1
  214. package/out/map/geometry.js +9 -34
  215. package/out/map/geometry.js.map +1 -1
  216. package/out/map/graticule.d.ts +17 -0
  217. package/out/map/graticule.d.ts.map +1 -0
  218. package/out/map/graticule.js +67 -0
  219. package/out/map/graticule.js.map +1 -0
  220. package/out/map/map-debug.d.ts +4 -2
  221. package/out/map/map-debug.d.ts.map +1 -1
  222. package/out/map/map-debug.js +1 -1
  223. package/out/map/map-debug.js.map +1 -1
  224. package/out/map/place-render.d.ts +25 -45
  225. package/out/map/place-render.d.ts.map +1 -1
  226. package/out/map/place-render.js +4 -39
  227. package/out/map/place-render.js.map +1 -1
  228. package/out/map/types.d.ts +57 -113
  229. package/out/map/types.d.ts.map +1 -1
  230. package/out/map/types.js +1 -10
  231. package/out/map/types.js.map +1 -1
  232. package/out/map/useCompareState.d.ts +5 -4
  233. package/out/map/useCompareState.d.ts.map +1 -1
  234. package/out/map/useCompareState.js +3 -3
  235. package/out/map/useCompareState.js.map +1 -1
  236. package/out/map/useGeocode.d.ts +5 -3
  237. package/out/map/useGeocode.d.ts.map +1 -1
  238. package/out/map/useGeocode.js +4 -4
  239. package/out/map/useGeocode.js.map +1 -1
  240. package/out/map/useMapBearing.d.ts +11 -11
  241. package/out/map/useMapBearing.d.ts.map +1 -1
  242. package/out/map/useMapBearing.js +6 -11
  243. package/out/map/useMapBearing.js.map +1 -1
  244. package/out/map/useMapLabelPick.d.ts +4 -14
  245. package/out/map/useMapLabelPick.d.ts.map +1 -1
  246. package/out/map/useMapLabelPick.js +21 -30
  247. package/out/map/useMapLabelPick.js.map +1 -1
  248. package/out/map/useMapPlaceRender.d.ts +3 -7
  249. package/out/map/useMapPlaceRender.d.ts.map +1 -1
  250. package/out/map/useMapPlaceRender.js +2 -6
  251. package/out/map/useMapPlaceRender.js.map +1 -1
  252. package/out/map/usePlaceAutocomplete.d.ts +30 -28
  253. package/out/map/usePlaceAutocomplete.d.ts.map +1 -1
  254. package/out/map/usePlaceAutocomplete.js +6 -33
  255. package/out/map/usePlaceAutocomplete.js.map +1 -1
  256. package/out/map.d.ts +67 -0
  257. package/out/map.d.ts.map +1 -0
  258. package/out/map.js +45 -0
  259. package/out/map.js.map +1 -0
  260. package/out/pipeline/CandidatePicker.d.ts +12 -2
  261. package/out/pipeline/CandidatePicker.d.ts.map +1 -1
  262. package/out/pipeline/CandidatePicker.js +1 -1
  263. package/out/pipeline/CandidatePicker.js.map +1 -1
  264. package/out/pipeline/ConfidenceCell.d.ts +2 -2
  265. package/out/pipeline/ConfidenceCell.d.ts.map +1 -1
  266. package/out/pipeline/ConfidenceCell.js +1 -1
  267. package/out/pipeline/FailureDiagnostic.d.ts +8 -2
  268. package/out/pipeline/FailureDiagnostic.d.ts.map +1 -1
  269. package/out/pipeline/FailureDiagnostic.js +3 -0
  270. package/out/pipeline/FailureDiagnostic.js.map +1 -1
  271. package/out/pipeline/PipelineExplorer.d.ts +6 -2
  272. package/out/pipeline/PipelineExplorer.d.ts.map +1 -1
  273. package/out/pipeline/PipelineExplorer.js +1 -1
  274. package/out/pipeline/PipelineExplorer.js.map +1 -1
  275. package/out/pipeline/QueryForm.d.ts +5 -2
  276. package/out/pipeline/QueryForm.d.ts.map +1 -1
  277. package/out/pipeline/QueryForm.js.map +1 -1
  278. package/out/pipeline/ResolvedPlace.d.ts +1 -1
  279. package/out/pipeline/ResolvedPlace.d.ts.map +1 -1
  280. package/out/pipeline/SpanHighlight.d.ts +4 -3
  281. package/out/pipeline/SpanHighlight.d.ts.map +1 -1
  282. package/out/pipeline/SpanHighlight.js +3 -2
  283. package/out/pipeline/SpanHighlight.js.map +1 -1
  284. package/out/pipeline/TimingPanel.d.ts +1 -1
  285. package/out/pipeline/TreeView.d.ts +1 -1
  286. package/out/pipeline/TreeView.js.map +1 -1
  287. package/out/pipeline/copy.d.ts +1 -1
  288. package/out/pipeline/copy.d.ts.map +1 -1
  289. package/out/pipeline/copy.js +4 -3
  290. package/out/pipeline/copy.js.map +1 -1
  291. package/out/pipeline/presets.d.ts +5 -4
  292. package/out/pipeline/presets.d.ts.map +1 -1
  293. package/out/pipeline/presets.js +15 -13
  294. package/out/pipeline/presets.js.map +1 -1
  295. package/out/pipeline/types.d.ts +20 -17
  296. package/out/pipeline/types.d.ts.map +1 -1
  297. package/out/pipeline/types.js +2 -4
  298. package/out/pipeline/types.js.map +1 -1
  299. package/out/pipeline/useParsePipeline.d.ts +14 -9
  300. package/out/pipeline/useParsePipeline.d.ts.map +1 -1
  301. package/out/pipeline/useParsePipeline.js +7 -8
  302. package/out/pipeline/useParsePipeline.js.map +1 -1
  303. package/out/pipeline.d.ts +33 -0
  304. package/out/pipeline.d.ts.map +1 -0
  305. package/out/pipeline.js +21 -0
  306. package/out/pipeline.js.map +1 -0
  307. package/out/poi/AbstainPanel.d.ts +1 -1
  308. package/out/poi/LiveResultsBlock.d.ts +2 -1
  309. package/out/poi/LiveResultsBlock.d.ts.map +1 -1
  310. package/out/poi/LiveResultsBlock.js.map +1 -1
  311. package/out/poi/POIExplorer.d.ts +22 -12
  312. package/out/poi/POIExplorer.d.ts.map +1 -1
  313. package/out/poi/POIExplorer.js +11 -10
  314. package/out/poi/POIExplorer.js.map +1 -1
  315. package/out/poi/QueryInput.d.ts +1 -1
  316. package/out/poi/SubjectPanel.d.ts +2 -2
  317. package/out/poi/SubjectPanel.d.ts.map +1 -1
  318. package/out/poi/SubjectPanel.js +2 -1
  319. package/out/poi/SubjectPanel.js.map +1 -1
  320. package/out/poi/runtime.d.ts +5 -14
  321. package/out/poi/runtime.d.ts.map +1 -1
  322. package/out/poi/runtime.js +14 -16
  323. package/out/poi/runtime.js.map +1 -1
  324. package/out/poi/types.d.ts +53 -45
  325. package/out/poi/types.d.ts.map +1 -1
  326. package/out/poi/types.js +2 -4
  327. package/out/poi/types.js.map +1 -1
  328. package/out/poi/usePOISearch.d.ts +30 -17
  329. package/out/poi/usePOISearch.d.ts.map +1 -1
  330. package/out/poi/usePOISearch.js +48 -64
  331. package/out/poi/usePOISearch.js.map +1 -1
  332. package/out/poi.d.ts +23 -0
  333. package/out/poi.d.ts.map +1 -0
  334. package/out/poi.js +15 -0
  335. package/out/poi.js.map +1 -0
  336. package/out/runtime/useReleaseRuntime.d.ts +63 -74
  337. package/out/runtime/useReleaseRuntime.d.ts.map +1 -1
  338. package/out/runtime/useReleaseRuntime.js +31 -32
  339. package/out/runtime/useReleaseRuntime.js.map +1 -1
  340. package/out/{runtime/index.d.ts → runtime.d.ts} +1 -1
  341. package/out/runtime.d.ts.map +1 -0
  342. package/out/{runtime/index.js → runtime.js} +1 -1
  343. package/out/runtime.js.map +1 -0
  344. package/out/search/SearchModal.d.ts +40 -0
  345. package/out/search/SearchModal.d.ts.map +1 -0
  346. package/out/search/SearchModal.js +255 -0
  347. package/out/search/SearchModal.js.map +1 -0
  348. package/out/search/types.d.ts +65 -0
  349. package/out/search/types.d.ts.map +1 -0
  350. package/out/search/types.js +13 -0
  351. package/out/search/types.js.map +1 -0
  352. package/out/search.d.ts +11 -0
  353. package/out/search.d.ts.map +1 -0
  354. package/out/search.js +9 -0
  355. package/out/search.js.map +1 -0
  356. package/package.json +73 -165
  357. package/styles.css +482 -266
  358. package/tokens/index.css +24 -6
  359. package/tokens/tokens.json +114 -6
  360. package/lib/common/index.ts +0 -22
  361. package/lib/map/BackendControl.tsx +0 -51
  362. package/lib/map/index.ts +0 -95
  363. package/lib/pipeline/index.ts +0 -36
  364. package/lib/poi/index.ts +0 -39
  365. package/out/common/index.d.ts +0 -22
  366. package/out/common/index.d.ts.map +0 -1
  367. package/out/common/index.js +0 -15
  368. package/out/common/index.js.map +0 -1
  369. package/out/map/BackendControl.d.ts +0 -32
  370. package/out/map/BackendControl.d.ts.map +0 -1
  371. package/out/map/BackendControl.js +0 -8
  372. package/out/map/BackendControl.js.map +0 -1
  373. package/out/map/index.d.ts +0 -69
  374. package/out/map/index.d.ts.map +0 -1
  375. package/out/map/index.js +0 -46
  376. package/out/map/index.js.map +0 -1
  377. package/out/pipeline/index.d.ts +0 -33
  378. package/out/pipeline/index.d.ts.map +0 -1
  379. package/out/pipeline/index.js +0 -21
  380. package/out/pipeline/index.js.map +0 -1
  381. package/out/poi/index.d.ts +0 -23
  382. package/out/poi/index.d.ts.map +0 -1
  383. package/out/poi/index.js +0 -15
  384. package/out/poi/index.js.map +0 -1
  385. package/out/runtime/index.d.ts.map +0 -1
  386. package/out/runtime/index.js.map +0 -1
  387. package/styleframe.config.ts +0 -329
  388. package/vitest.node.config.ts +0 -20
  389. /package/lib/{runtime/index.ts → runtime.ts} +0 -0
package/lib/index.ts CHANGED
@@ -2,28 +2,37 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * `@mailwoman/react` — React components + headless hooks for mailwoman.
7
- *
8
- * Two composed explorers plus the small presentational units and headless hooks they decompose into:
9
- *
10
- * - `POIExplorer` — a self-contained POI-intent tester (classify → subject → OverpassQL), with an
11
- * optional injected live poi.db search. No weights, no network on the intent path.
12
- * - `PipelineExplorer` — a parse+resolve tester driven by an INJECTED `PipelineRuntime`, so the
13
- * model/gazetteer plumbing (ONNX, httpvfs, node builtins) stays in the host, never in this graph.
14
- *
15
- * Styling ships separately as `@mailwoman/react/styles.css` (plain, `mw-`-prefixed, Infima-token
16
- * aware) — no CSS is imported by the component modules, so the bare package import is node-safe.
17
5
  */
18
6
 
19
- export * from "#common/index"
20
- export * from "#poi/index"
21
- export * from "#pipeline/index"
22
- export * from "#runtime/index"
7
+ /**
8
+ * Re-exports the shared presentational components and hooks that both explorers are built from.
9
+ *
10
+ * No module in the root graph imports CSS, so the bare package import is Node-safe
11
+ * and hosts load `@mailwoman/react/styles.css` themselves.
12
+ */
13
+ export * from "#common"
14
+ /**
15
+ * Re-exports `POIExplorer`, a POI-intent tester that needs no weights or network, with its related exports.
16
+ */
17
+ export * from "#poi"
18
+ /**
19
+ * Re-exports `PipelineExplorer`, a parse-and-resolve tester with model
20
+ * and gazetteer access injected by the host.
21
+ * It also exports the explorer's related declarations.
22
+ */
23
+ export * from "#pipeline"
24
+ /**
25
+ * Re-exports `useReleaseRuntime`, the Node-safe hook that loads a release manifest
26
+ * and each selected version's assets through a host-injected loader.
27
+ */
28
+ export * from "#runtime"
23
29
 
30
+ /**
31
+ * Re-exports the map surface's types only, because its runtime lives behind the
32
+ * `@mailwoman/react/map` subpath so that MapLibre stays out of the root import graph.
33
+ */
24
34
  export type {
25
35
  GeocoderRuntime,
26
- InferenceBackend,
27
36
  LngLatTuple,
28
37
  MapBias,
29
38
  MapCanvasExtraProps,
@@ -32,4 +41,4 @@ export type {
32
41
  OverlaySpec,
33
42
  Suggestion,
34
43
  VersionOption,
35
- } from "#map/index"
44
+ } from "#map"
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Renders the footer identity with the app name, an optional documentation link and the build
7
+ * commit. This component does not depend on the map.
8
+ */
9
+
10
+ import type { ReactNode } from "react"
11
+
12
+ import { useBuildInfo } from "#common/useBuildInfo"
13
+
14
+ /**
15
+ * The number of commit characters shown in the footer.
16
+ */
17
+ const DISPLAYED_LENGTH = 6
18
+
19
+ /**
20
+ * Props for {@link AppIdentity}.
21
+ */
22
+ export interface AppIdentityProps {
23
+ /**
24
+ * The app's display name, such as `Mailwoman Earth`.
25
+ */
26
+ name: ReactNode
27
+ /**
28
+ * The documentation link's target.
29
+ * The link is omitted when this is unset.
30
+ */
31
+ docsURL?: string
32
+ /**
33
+ * The documentation link's text.
34
+ *
35
+ * @defaultValue `"Developer Documentation"`
36
+ */
37
+ docsLabel?: string
38
+ /**
39
+ * The URL of the build record.
40
+ *
41
+ * @defaultValue `"/build.json"`
42
+ */
43
+ buildInfoURL?: string
44
+ /**
45
+ * Builds the commit link.
46
+ * Without it, the commit is shown as plain text.
47
+ */
48
+ commitHref?: (commit: string) => string
49
+ }
50
+
51
+ /**
52
+ * Renders the app name, documentation link and short build commit.
53
+ * The commit is omitted when no build record loads.
54
+ */
55
+ export function AppIdentity({
56
+ name,
57
+ docsURL,
58
+ docsLabel = "Developer Documentation",
59
+ buildInfoURL,
60
+ commitHref,
61
+ }: AppIdentityProps): ReactNode {
62
+ const build = useBuildInfo(buildInfoURL)
63
+ const commit = build?.commit
64
+
65
+ return (
66
+ <>
67
+ <strong>{name}</strong>
68
+ {docsURL ? (
69
+ <>
70
+ {" "}
71
+ <a href={docsURL}>{docsLabel}</a>
72
+ </>
73
+ ) : null}
74
+ {commit ? (
75
+ <>
76
+ {" ("}
77
+ {commitHref ? (
78
+ <a href={commitHref(commit)} title={`Built from ${commit}`}>
79
+ <code>{commit.slice(0, DISPLAYED_LENGTH)}</code>
80
+ </a>
81
+ ) : (
82
+ <code title={`Built from ${commit}`}>{commit.slice(0, DISPLAYED_LENGTH)}</code>
83
+ )}
84
+ {")"}
85
+ </>
86
+ ) : null}
87
+ </>
88
+ )
89
+ }
@@ -3,55 +3,32 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * `<CompareToggle>` — the "Compare" checkbox plus the compare-version `<select>` from the demo's
7
- * control panel (`_app.tsx:1281-1339`), as a dumb presentational unit. Turning it on reveals a second
8
- * version picker (the primary version filtered out); the actual second parse is a host concern the
9
- * composed demo surfaces through `panels.compare`. Props in, two events out.
10
- *
11
- * NODE-SAFE: pure React, no maplibre.
6
+ * Renders a compare-mode checkbox and a selector for the second model version, leaving the comparison itself to the host.
12
7
  */
13
8
 
14
9
  import type { ReactNode } from "react"
15
10
 
16
11
  import type { VersionOption } from "#map/types"
17
12
 
13
+ /**
14
+ * Props for {@link CompareToggle}.
15
+ */
18
16
  export interface CompareToggleProps {
19
- /**
20
- * The selectable model bundles (the primary version is filtered out of the compare list).
21
- */
22
17
  versions: ReadonlyArray<VersionOption>
23
- /**
24
- * The primary version, excluded from the compare options.
25
- */
26
18
  primaryVersion: string | null
27
- /**
28
- * Whether compare mode is on.
29
- */
30
19
  compareMode: boolean
31
- /**
32
- * Fired when the visitor flips compare mode.
33
- */
34
20
  onCompareModeChange: (compareMode: boolean) => void
35
- /**
36
- * The version chosen to compare against, or `null` when none is chosen.
37
- */
38
21
  compareVersion: string | null
39
- /**
40
- * Fired with the chosen compare version (or `null` when the empty option is picked).
41
- */
42
22
  onCompareVersionChange: (version: string | null) => void
43
- /**
44
- * Disable the compare-version select (e.g. while a parse or compare load runs).
45
- */
46
23
  disabled?: boolean
47
- /**
48
- * A status line rendered under the select (e.g. the compare backend, or a "Loading…" line).
49
- */
50
24
  status?: ReactNode
51
25
  }
52
26
 
53
27
  /**
54
- * The compare toggle + (when on) the compare-version selector. Renders `null` with fewer than two versions.
28
+ * Renders the compare checkbox.
29
+ *
30
+ * In compare mode, it also renders the version selector. and no control at all
31
+ * when fewer than two versions exist.
55
32
  */
56
33
  export function CompareToggle({
57
34
  versions,
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Display and log build, model and runtime details for bug reports.
7
+ */
8
+
9
+ import { type ReactNode, useEffect, useMemo } from "react"
10
+
11
+ import { useBuildInfo } from "#common/useBuildInfo"
12
+
13
+ export interface DebugInfoProps {
14
+ /**
15
+ * The runtime's backend and model size (e.g. `wasm (28 MB int8)`); empty before the model loads.
16
+ */
17
+ activeBackend?: string
18
+ /**
19
+ * The model version the runtime loaded.
20
+ *
21
+ * The training series.
22
+ * It differs from the npm version.
23
+ */
24
+ selectedVersion?: string | null
25
+ /**
26
+ * Whether the asset bundle finished loading.
27
+ */
28
+ ready?: boolean
29
+ }
30
+
31
+ /**
32
+ * One row of the record, as a label and a value.
33
+ */
34
+ function Row({ label, value }: { label: string; value: string }): ReactNode {
35
+ return (
36
+ <div className="mw-debug-info__row">
37
+ <span className="mw-debug-info__label">{label}</span>
38
+ <code className="mw-debug-info__value">{value}</code>
39
+ </div>
40
+ )
41
+ }
42
+
43
+ export function DebugInfo({ activeBackend, selectedVersion, ready }: DebugInfoProps): ReactNode {
44
+ const build = useBuildInfo()
45
+
46
+ // Memoized on the primitives it reads, so the log below fires when a value changes
47
+ // rather than on every render.
48
+ // A record rebuilt each render would be a new object each time and log continuously.
49
+ const record = useMemo(
50
+ () => ({
51
+ app: build?.app ?? "—",
52
+ commit: build?.commit ?? build?.revision ?? "—",
53
+ buildTime: build?.buildTime ?? "—",
54
+ model: selectedVersion ?? "—",
55
+ backend: activeBackend || (ready ? "unknown" : "loading…"),
56
+ userAgent: typeof navigator !== "undefined" ? navigator.userAgent : "—",
57
+ }),
58
+ [build?.app, build?.commit, build?.revision, build?.buildTime, selectedVersion, activeBackend, ready]
59
+ )
60
+
61
+ useEffect(() => {
62
+ // eslint-disable-next-line no-console -- this is the feature: the record has to reach the console a reporter copies.
63
+ console.info("[mailwoman] debug info", record)
64
+ }, [record])
65
+
66
+ return (
67
+ <div className="mw-debug-info">
68
+ <Row label="Build" value={record.app} />
69
+ <Row label="Commit" value={record.commit.slice(0, 12)} />
70
+ <Row label="Built" value={record.buildTime} />
71
+ <Row label="Model" value={record.model} />
72
+ <Row label="Backend" value={record.backend} />
73
+ </div>
74
+ )
75
+ }
@@ -2,21 +2,6 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * `<Geocoder>` — the WHOLE geocoder, composed. It is the map analogue of `PipelineExplorer`
7
- * and takes the SAME DI shape: an injected {@link GeocoderRuntime} (the host owns ONNX / httpvfs / R2 /
8
- * the composed map style) plus a {@link GeocoderPanels} bag (the host's ModelVisualizer / VersionCompare /
9
- * About / Permalink). Everything here is composition + a `ClientOnly` boundary:
10
- *
11
- * - the floating {@link GeocoderControls} panel (version / compare / backend / query+autocomplete / result),
12
- * - the declarative {@link MapCanvas} with the phase-2 overlays ({@link OverlayLayers}) and the
13
- * resolved-place marker/outline/camera ({@link ResolvedPlaceLayers}) driven by the parse state,
14
- * - the hooks that wire them: {@link useGeocode} (parse + viewport bias + map place),
15
- * {@link usePlaceAutocomplete}, {@link useCompareState}.
16
- *
17
- * Because it pulls {@link MapCanvas} (→ `react-map-gl` → `maplibre-gl`, WebGL + DOM at import), it lives on
18
- * the `@mailwoman/react/map` subpath ONLY — never the package root. The whole thing renders in Storybook
19
- * over a fake runtime (offline stub style + canned geocode) with no network, no ONNX, no gazetteer.
20
5
  */
21
6
 
22
7
  import { type ReactNode, useCallback, useEffect, useRef, useState } from "react"
@@ -31,46 +16,69 @@ import { usePlaceAutocomplete } from "#map/usePlaceAutocomplete"
31
16
  import { ClientOnly } from "../common/ClientOnly.tsx"
32
17
  import type { Preset } from "../common/PresetChips.tsx"
33
18
  import { GeocoderControls } from "./GeocoderControls.tsx"
19
+ import { GraticuleLayer } from "./GraticuleLayer.tsx"
34
20
  import { MapCanvas } from "./MapCanvas.tsx"
35
21
  import { OverlayLayers } from "./OverlayLayers.tsx"
36
22
  import { ResolvedPlaceLayers } from "./ResolvedPlaceLayers.tsx"
37
23
 
24
+ /**
25
+ * Props for {@linkcode Geocoder}.
26
+ */
38
27
  export interface GeocoderProps {
39
28
  /**
40
- * The injected geocoder runtime (map style + overlays + parse + version/backend).
29
+ * The geocoder runtime supplies the map style and overlays.
30
+ *
31
+ * It also supplies the parser and version and backend controls.
41
32
  */
42
33
  runtime: GeocoderRuntime
43
34
  /**
44
- * Host-injected panels (about, release blurb, compare, permalink, debug drawer, map controls, …).
35
+ * Panels supplied by the host.
45
36
  */
46
37
  panels?: GeocoderPanels
47
38
  /**
48
- * Address to pre-fill.
39
+ * The address that pre-fills the search field.
40
+ * It is not run automatically.
49
41
  */
50
42
  defaultAddress?: string
51
43
  /**
52
- * Example chips. @default the empty set (host supplies its own).
44
+ * A query to run once when the runtime is ready, such as a permalink's `?q=` value.
45
+ *
46
+ * Unlike {@link GeocoderProps.defaultAddress}, this query is submitted,
47
+ * so a shared link reproduces its result.
48
+ */
49
+ initialQuery?: string | null
50
+ /**
51
+ * The example chips.
52
+ *
53
+ * @defaultValue []
53
54
  */
54
55
  presets?: ReadonlyArray<Preset>
55
56
  /**
56
- * Open the developer disclosure on mount — the model version, the backend readout and compare. Collapsed by default
57
- * so the address field is the first thing a visitor meets. @default false
57
+ * Whether the developer panel starts open.
58
+ *
59
+ * @defaultValue `false`
58
60
  */
59
61
  developer?: boolean
60
62
  /**
61
- * Fired with the query each time one is submitted. The host writes it into its own URL — this package never touches
62
- * `location`, because which parameter carries a query is the app's decision.
63
+ * Called with each user-submitted query.
64
+ *
65
+ * The host decides how to write the query to its URL.
66
+ * This package never touches `location`.
63
67
  */
64
68
  onSubmitQuery?: (query: string) => void
65
69
  /**
66
- * Only hint the viewport bias once the visitor has zoomed past the global view — a whole-globe center is noise.
67
- * Matches the `map.getZoom() >= 4` threshold. @default 4
70
+ * The minimum map zoom at which the viewport is sent as a location bias.
71
+ *
72
+ * @defaultValue `4`
68
73
  */
69
74
  minBiasZoom?: number
70
75
  /**
71
- * Fly/fit the map to the resolved place on each result (via {@link ResolvedPlaceLayers}). @default true. Set false
72
- * for a host that drives the camera itself (a controlled `<MapCanvas viewState>`), or to keep a headless test
73
- * deterministic — the marker + outline still render, only the animated camera move is skipped.
76
+ * Whether the map moves to each resolved place.
77
+ *
78
+ * Set it to false when the host controls the camera or a test needs a fixed view.
79
+ * The marker and outline render either way.
80
+ *
81
+ * @defaultValue `true`
74
82
  */
75
83
  applyResultCamera?: boolean
76
84
  }
@@ -80,6 +88,7 @@ interface GeocoderInnerProps extends Required<
80
88
  > {
81
89
  panels: GeocoderPanels
82
90
  presets: ReadonlyArray<Preset>
91
+ initialQuery: string | null
83
92
  onSubmitQuery?: (query: string) => void
84
93
  }
85
94
 
@@ -91,23 +100,29 @@ function GeocoderInner({
91
100
  minBiasZoom,
92
101
  applyResultCamera,
93
102
  developer,
103
+ initialQuery,
94
104
  onSubmitQuery,
95
105
  }: GeocoderInnerProps): ReactNode {
96
106
  const mapRef = useRef<MapRef>(null)
97
- // The chrome sits OUTSIDE `<MapCanvas>`, so it cannot take the handle from `useMap()`. A ref alone does not
98
- // re-render the compass or the layer control when the map arrives, so the same poll that publishes the test
99
- // handle also puts it in state — one poll, two consumers.
107
+ // The controls render outside `<MapCanvas>` and cannot call `useMap()`.
108
+ // The map is kept in state so they re-render when it loads.
100
109
  const [map, setMap] = useState<ReturnType<MapRef["getMap"]> | null>(null)
101
110
 
102
- // The map announces itself; nothing polls for it. `onLoad` carries the instance, so the compass and the layer
103
- // control render on the frame the map is ready rather than up to an interval later.
104
- //
105
- // TEST INJECTION POINT: the e2e viewport-bias suite drives the REAL map (pan + zoom past the bias threshold)
106
- // before submitting, and a browser test cannot reach a React ref — so the same handle is republished on
107
- // `globalThis.__mailwomanMapCanvas`, and cleared on unmount so a torn-down geocoder leaves no stale handle.
111
+ // The graticule is inserted before the first non-background layer, so it draws under the data layers.
112
+ const [baseLayerID, setBaseLayerID] = useState<string | undefined>(undefined)
113
+
114
+ // Overlays are inserted before the first label layer, so place names stay readable over a fill.
115
+ const [labelLayerID, setLabelLayerID] = useState<string | undefined>(undefined)
116
+
108
117
  const onMapLoad = useCallback((event: { target: ReturnType<MapRef["getMap"]> }) => {
118
+ // Browser tests read the map from this global.
109
119
  ;(globalThis as { __mailwomanMapCanvas?: ReturnType<MapRef["getMap"]> }).__mailwomanMapCanvas = event.target
110
120
  setMap(event.target)
121
+
122
+ const layers = event.target.getStyle()?.layers ?? []
123
+
124
+ setBaseLayerID(layers.find((layer) => layer.type !== "background")?.id)
125
+ setLabelLayerID(layers.find((layer) => layer.type === "symbol")?.id)
111
126
  }, [])
112
127
 
113
128
  useEffect(
@@ -118,8 +133,6 @@ function GeocoderInner({
118
133
  []
119
134
  )
120
135
 
121
- // Read the viewport bias at submit time — through the map handle, never a threaded state value, so granting/zooming
122
- // mid-session doesn't re-create the parse callback. Below the min-bias zoom, a whole-globe center is noise → null.
123
136
  const getBias = useCallback((): MapBias | null => {
124
137
  const live = mapRef.current?.getMap()
125
138
 
@@ -151,8 +164,6 @@ function GeocoderInner({
151
164
  [runtime, compare]
152
165
  )
153
166
 
154
- const onForceWASMChange = useCallback((forceWASM: boolean) => runtime.setForceWASM?.(forceWASM), [runtime])
155
-
156
167
  return (
157
168
  <div className="mw-geocoder-demo">
158
169
  <div className="mw-geocoder-demo__map">
@@ -165,11 +176,12 @@ function GeocoderInner({
165
176
  zoom: runtime.initialZoom ?? 3,
166
177
  }}
167
178
  style={{ width: "100%", height: "100%" }}
168
- // One compact attribution pill (the map's own default is a wide, always-open "MapLibre | © …" bar), no
169
- // maplibre wordmark logo.
179
+ // The attribution is compact.
180
+ // The MapLibre logo is hidden.
170
181
  mapProps={{ attributionControl: { compact: true }, maplibreLogo: false, onLoad: onMapLoad }}
171
182
  >
172
- <OverlayLayers overlays={runtime.overlays} />
183
+ <GraticuleLayer beforeID={baseLayerID} />
184
+ <OverlayLayers overlays={runtime.overlays} beforeID={labelLayerID} />
173
185
  <ResolvedPlaceLayers spec={spec} applyCamera={applyResultCamera} />
174
186
  {panels.mapControls}
175
187
  </MapCanvas>
@@ -183,26 +195,27 @@ function GeocoderInner({
183
195
  panels={panels}
184
196
  presets={presets}
185
197
  placeholder={defaultAddress}
198
+ initialQuery={initialQuery}
186
199
  map={map}
187
200
  onSubmitQuery={onSubmitQuery}
188
201
  onSelectVersion={onSelectVersion}
189
- onForceWASMChange={onForceWASMChange}
190
202
  developer={developer}
191
203
  />
192
-
193
204
  {panels.debugDrawer ? panels.debugDrawer({ result: geocode.result }) : null}
194
205
  </div>
195
206
  )
196
207
  }
197
208
 
198
- /**
199
- * Stable empty defaults — a fresh `{}`/`[]` per render would churn every downstream memo dep.
200
- */
209
+ // These defaults are module constants so each render sees the same reference and memo dependencies stay stable.
201
210
  const NO_PANELS: GeocoderPanels = {}
202
211
  const NO_PRESETS: ReadonlyArray<Preset> = []
203
212
 
204
213
  /**
205
- * The composed geocoder, behind a `ClientOnly` SSR boundary (the map is intrinsically a client component).
214
+ * Renders the map and search controls as one geocoder.
215
+ * It also renders host panels.
216
+ *
217
+ * It renders only on the client because MapLibre needs browser APIs.
218
+ * Import it from `@mailwoman/react/map`.
206
219
  */
207
220
  export function Geocoder({
208
221
  runtime,
@@ -212,6 +225,7 @@ export function Geocoder({
212
225
  minBiasZoom = 4,
213
226
  applyResultCamera = true,
214
227
  developer = false,
228
+ initialQuery = null,
215
229
  onSubmitQuery,
216
230
  }: GeocoderProps): ReactNode {
217
231
  return (
@@ -231,6 +245,7 @@ export function Geocoder({
231
245
  minBiasZoom={minBiasZoom}
232
246
  applyResultCamera={applyResultCamera}
233
247
  developer={developer}
248
+ initialQuery={initialQuery}
234
249
  onSubmitQuery={onSubmitQuery}
235
250
  />
236
251
  )}