@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
@@ -4,34 +4,31 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
6
  * Builds the "Copy JSON" payload for a parse result — the components + the selected resolved place,
7
- * pretty-printed. Pure; shared by the explorer's copy button.
7
+ * pretty-printed. Pure. shared by the explorer's copy button.
8
8
  */
9
9
 
10
+ import { prettyJSON } from "@mailwoman/core/json"
10
11
  import type { ParseResult, ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result"
11
12
 
12
13
  export function buildParsePayload(result: ParseResult, selected: ResolvedPlaceView | null): string {
13
- return JSON.stringify(
14
- {
15
- input: result.input,
16
- components: result.nodes.map((node) => ({
17
- tag: node.tag,
18
- value: node.value ?? null,
19
- confidence: node.confidence ?? null,
20
- start: node.start ?? null,
21
- end: node.end ?? null,
22
- })),
23
- resolved: selected
24
- ? {
25
- name: selected.name,
26
- placetype: selected.placetype,
27
- id: selected.id,
28
- lat: selected.lat,
29
- lon: selected.lon,
30
- score: selected.score,
31
- }
32
- : null,
33
- },
34
- null,
35
- 2
36
- )
14
+ return prettyJSON({
15
+ input: result.input,
16
+ components: result.nodes.map((node) => ({
17
+ tag: node.tag,
18
+ value: node.value ?? null,
19
+ confidence: node.confidence ?? null,
20
+ start: node.start ?? null,
21
+ end: node.end ?? null,
22
+ })),
23
+ resolved: selected
24
+ ? {
25
+ name: selected.name,
26
+ placetype: selected.placetype,
27
+ id: selected.id,
28
+ lat: selected.lat,
29
+ lon: selected.lon,
30
+ score: selected.score,
31
+ }
32
+ : null,
33
+ })
37
34
  }
@@ -3,23 +3,23 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Default query + example addresses for the pipeline explorer. Hosts can override via props; these
6
+ * Default query + example addresses for the pipeline explorer. Hosts can override via props. These
7
7
  * mirror the docs demo's set so the extracted component looks identical out of the box.
8
8
  */
9
9
 
10
10
  import type { Preset } from "../common/PresetChips.tsx"
11
11
 
12
12
  /**
13
- * Address the pipeline explorer opens on. Chosen because it exercises every stage — house number, street, directional,
14
- * locality and region — in one line.
13
+ * Address the pipeline explorer opens on.
14
+ *
15
+ * It exercises every stage (house number, street, directional, locality and region) in one line.
15
16
  */
16
17
  export const PIPELINE_DEFAULT_ADDRESS = "1600 Pennsylvania Ave NW, Washington, DC 20500"
17
18
 
18
- // `country` mirrors the docs `EXAMPLE_ADDRESSES` set (kept in parity) — the placetype-pair country pin (#1278 phase 2's
19
- // `{country}` override). A host that wires the pair prior pins the country while the input equals the preset text, so a
20
- // locale structural routing can't detect (NZ) still fires; free-typed input drops to structural detection.
19
+ // `country` mirrors the docs `EXAMPLE_ADDRESSES` set and is kept in parity.
20
+ // A host that wires the pair prior pins the country while the input equals the preset text.
21
21
  /**
22
- * Preset inputs offered in the explorer, each picked to show a different parse behaviour.
22
+ * Preset inputs offered in the explorer, each picked to show a different parse behavior.
23
23
  */
24
24
  export const PIPELINE_PRESETS: ReadonlyArray<Preset> = [
25
25
  { label: "White House", value: "1600 Pennsylvania Ave NW, Washington, DC 20500", country: "us" },
@@ -32,16 +32,18 @@ export const PIPELINE_PRESETS: ReadonlyArray<Preset> = [
32
32
  { label: "Berlin (native order)", value: "Straußstraße 27, 12623 Berlin", country: "de" },
33
33
  { label: "Berlin city-state (int'l order)", value: "5 Hauptstraße, Berlin, Berlin 10115", country: "de" },
34
34
  { label: "Paris (street fall-through)", value: "181 Rue du Chevaleret, Paris", country: "fr" },
35
- // GB dependent_locality (placetype-pair-prior arc) — "Henbury" flips to dependent_locality via the en-gb pair-index
36
- // prior; the UK postcode is also structurally detectable (parity with docs EXAMPLE_ADDRESSES).
35
+ // "Henbury" flips to dependent_locality via the en-gb pair-index prior.
36
+ // The UK postcode is structurally detectable, in parity with the docs EXAMPLE_ADDRESSES.
37
37
  {
38
38
  label: "Macclesfield (GB dependent_locality)",
39
39
  value: "41 Hightree Drive, Henbury, Macclesfield, SK11 9PD",
40
40
  country: "gb",
41
41
  },
42
- // NZ dependent_locality (en-nz pair-prior arc) — Plimmerton is a suburb (dependent_locality) of Porirua. Postcode
43
- // DELIBERATELY OMITTED: a trailing "Porirua 5026" folds "porirua 5026" in segment mode and misses the index's bare
44
- // "porirua" key (tracked as #1308). The `country: "nz"` pin is required — locale-hint can't structurally detect
45
- // NZ (4-digit postcode isn't distinctive), so only the pin selects the nz index; free-typed NZ stays unfired.
42
+ // Plimmerton is a suburb (dependent_locality) of Porirua.
43
+ // The postcode is deliberately omitted, since a trailing "Porirua 5026" folds "porirua
44
+ // 5026" in segment mode and misses the index's bare "porirua" key.
45
+ // The `country: "nz"` pin is required, since locale-hint cannot structurally
46
+ // detect NZ (a 4-digit postcode is not distinctive).
47
+ // Only the pin selects the nz index.
46
48
  { label: "Plimmerton (NZ dependent_locality)", value: "35 Steyne Avenue, Plimmerton, Porirua", country: "nz" },
47
49
  ]
@@ -3,10 +3,8 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Types for the pipeline (parse + resolve) explorer. The model/gazetteer runtime is INJECTED as a
7
- * {@link PipelineRuntime}: this package owns the UI state machine + presentation, while the host
8
- * (the docs site's RuntimeEmbed, or any app) owns loading ONNX/WOF and executing a parse. That keeps
9
- * onnxruntime-web, sql.js-httpvfs, and node builtins entirely out of this package's browser graph.
6
+ * Types for the pipeline (parse + resolve) explorer. The runtime is injected as a {@link PipelineRuntime},
7
+ * keeping onnxruntime-web, sqlite-wasm and node builtins out of this package's browser graph.
10
8
  */
11
9
 
12
10
  import type { ParseResult } from "@mailwoman/core/pipeline/client-result"
@@ -19,11 +17,20 @@ export interface PipelineLoadingState {
19
17
  progress?: string
20
18
  stepLabels: string[]
21
19
  stepIndex: number
20
+ /**
21
+ * Bytes received over bytes expected for the asset being fetched right now, in [0, 1],
22
+ * or `null` when no download is in progress or the response declares no length.
23
+ *
24
+ * The step index cannot report this download because the model is fetched before the first step begins.
25
+ */
26
+ byteFraction?: number | null
22
27
  }
23
28
 
24
29
  /**
25
- * The injected parse runtime. The host implements `runParse` (compute shape → classify → resolve) and reports load
26
- * progress + errors. This package never imports the model or gazetteer — it only calls this contract.
30
+ * The injected parse runtime.
31
+ *
32
+ * The host implements this interface and supplies the model and gazetteer,
33
+ * keeping both imports out of this package.
27
34
  */
28
35
  export interface PipelineRuntime {
29
36
  /**
@@ -31,7 +38,8 @@ export interface PipelineRuntime {
31
38
  */
32
39
  ready: boolean
33
40
  /**
34
- * Execute a full parse+resolve, reporting stage progress via `onStage` (0-based index into `parseStageLabels`).
41
+ * Execute a full parse+resolve, reporting stage progress via `onStage`
42
+ * (0-based index into `parseStageLabels`).
35
43
  */
36
44
  runParse: (input: string, hooks: { onStage: (stage: number) => void }) => Promise<ParseResult>
37
45
  /**
@@ -49,27 +57,22 @@ export interface PipelineRuntime {
49
57
  }
50
58
 
51
59
  /**
52
- * Optional host-injected panels. Each is a function of the current parse result returning already-rendered content (the
53
- * docs site's SpanHighlight, TreeView, TimingPanel, …). Kept as `ReactNode` thunks so this package needs neither those
54
- * components nor their heavy data types.
60
+ * Optional host-injected panels, kept as `ReactNode` thunks so this package needs
61
+ * neither the host's components nor their data types.
55
62
  */
56
63
  export interface PipelinePanels {
57
64
  /**
58
- * Rendered above the form (e.g. the docs "About this demo").
65
+ * Rendered above the form.
59
66
  */
60
67
  header?: ReactNode
61
68
  /**
62
- * Rendered below everything (e.g. a guided tour).
69
+ * Rendered below everything.
63
70
  */
64
71
  footer?: ReactNode
65
72
  /**
66
73
  * Model-version selector, wired to the host's bundle state.
67
74
  */
68
75
  versionControl?: ReactNode
69
- /**
70
- * Backend indicator + WASM toggle.
71
- */
72
- backendControl?: ReactNode
73
76
  /**
74
77
  * One-line release blurb.
75
78
  */
@@ -79,7 +82,7 @@ export interface PipelinePanels {
79
82
  */
80
83
  extras?: (result: ParseResult) => ReactNode
81
84
  /**
82
- * Rendered in place of the resolved-place panel when nothing resolved (host's FailureDiagnostic).
85
+ * Rendered in place of the resolved-place panel when no place resolved (host's FailureDiagnostic).
83
86
  */
84
87
  failure?: (result: ParseResult) => ReactNode
85
88
  }
@@ -3,10 +3,8 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * `useParsePipeline` — the headless core of the pipeline explorer. Owns the query text, the
7
- * busy/stage flags, the parse result, and the candidate selection; delegates the actual parse+resolve
8
- * to the injected {@link PipelineRuntime}. No model or gazetteer code lives here — it just drives the
9
- * contract and shapes the UI state.
6
+ * The headless core of the pipeline explorer. It owns query text, busy/stage flags, result and candidate selection.
7
+ * It delegates parse and resolve to the injected {@link PipelineRuntime}.
10
8
  */
11
9
 
12
10
  import type { ParseResult, ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result"
@@ -14,11 +12,17 @@ import { useCallback, useState } from "react"
14
12
 
15
13
  import type { PipelineRuntime } from "#pipeline/types"
16
14
 
15
+ /**
16
+ * The runtime and starting text for {@link useParsePipeline}.
17
+ */
17
18
  export interface UseParsePipelineOptions {
18
19
  runtime: PipelineRuntime
19
20
  defaultText: string
20
21
  }
21
22
 
23
+ /**
24
+ * The state and handlers that {@link useParsePipeline} returns.
25
+ */
22
26
  export interface UseParsePipeline {
23
27
  text: string
24
28
  setText: (text: string) => void
@@ -36,18 +40,19 @@ export interface UseParsePipeline {
36
40
  */
37
41
  selectedCandidate: ResolvedPlaceView | null
38
42
  /**
39
- * Parse and resolve the current text. Safe to bind to a form's `onSubmit`.
40
- *
41
- * Pass `query` to submit a value the field has not re-rendered with yet — a preset press sets the text and submits in
42
- * one handler, and that state update is not visible to this call.
43
+ * Parse and resolve the current text, safe to bind to a form's `onSubmit`;
44
+ * pass `query` to submit a value the field has not re-rendered with yet.
43
45
  */
44
46
  submit: (query?: string) => Promise<void>
45
47
  /**
46
- * Clear the result (used when a preset replaces the input).
48
+ * Clear the result, used when a preset replaces the input.
47
49
  */
48
50
  reset: () => void
49
51
  }
50
52
 
53
+ /**
54
+ * Drives the injected runtime and exposes the explorer's UI state.
55
+ */
51
56
  export function useParsePipeline({ runtime, defaultText }: UseParsePipelineOptions): UseParsePipeline {
52
57
  const [text, setText] = useState(defaultText)
53
58
  const [busy, setBusy] = useState(false)
@@ -56,9 +61,8 @@ export function useParsePipeline({ runtime, defaultText }: UseParsePipelineOptio
56
61
  const [selectedCandidateIndex, setSelectedCandidateIndex] = useState(0)
57
62
  const [parseError, setParseError] = useState<string | null>(null)
58
63
 
59
- // `query` exists because `setText` does not reach this closure before the call after it runs. A preset that called
60
- // `setText(value)` then `submit()` parsed the PREVIOUS text — the field showed the preset and the map answered the
61
- // address before it. A caller that already knows the query passes it; the field's own submit passes nothing.
64
+ // `setText` does not reach this closure before the call after it runs,
65
+ // so a caller that already knows the query passes it.
62
66
  const submit = useCallback(
63
67
  async (query?: string) => {
64
68
  if (!runtime.ready || busy) return
@@ -85,7 +89,6 @@ export function useParsePipeline({ runtime, defaultText }: UseParsePipelineOptio
85
89
 
86
90
  const reset = useCallback(() => setResult(null), [])
87
91
 
88
- // Derived during render — no effect needed.
89
92
  const selectedCandidate = result ? (result.candidates[selectedCandidateIndex] ?? result.candidates[0] ?? null) : null
90
93
 
91
94
  return {
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Pipeline explorer components, visualizers, hooks and interfaces.
6
+ */
7
+
8
+ export { About } from "./common/About.tsx"
9
+ export { FailureDiagnostic } from "./pipeline/FailureDiagnostic.tsx"
10
+ export type { FailureDiagnosticProps } from "./pipeline/FailureDiagnostic.tsx"
11
+ export { SpanHighlight } from "./pipeline/SpanHighlight.tsx"
12
+ export type { SpanHighlightProps } from "./pipeline/SpanHighlight.tsx"
13
+ export { TimingPanel } from "./pipeline/TimingPanel.tsx"
14
+ export type { TimingPanelProps } from "./pipeline/TimingPanel.tsx"
15
+ export { TreeView } from "./pipeline/TreeView.tsx"
16
+ export type { TreeViewProps } from "./pipeline/TreeView.tsx"
17
+
18
+ export { CandidatePicker } from "./pipeline/CandidatePicker.tsx"
19
+ export type { CandidatePickerProps } from "./pipeline/CandidatePicker.tsx"
20
+ export { ComponentTable } from "./pipeline/ComponentTable.tsx"
21
+ export type { ComponentTableProps } from "./pipeline/ComponentTable.tsx"
22
+ export { ConfidenceCell } from "./pipeline/ConfidenceCell.tsx"
23
+ export type { ConfidenceCellProps } from "./pipeline/ConfidenceCell.tsx"
24
+ export { buildParsePayload } from "#pipeline/copy"
25
+ export { PIPELINE_DEFAULT_ADDRESS, PIPELINE_PRESETS } from "#pipeline/presets"
26
+ export { PipelineExplorer } from "./pipeline/PipelineExplorer.tsx"
27
+ export type { PipelineExplorerProps } from "./pipeline/PipelineExplorer.tsx"
28
+ export { QueryForm } from "./pipeline/QueryForm.tsx"
29
+ export type { QueryFormProps } from "./pipeline/QueryForm.tsx"
30
+ export { ResolvedPlace } from "./pipeline/ResolvedPlace.tsx"
31
+ export type { ResolvedPlaceProps } from "./pipeline/ResolvedPlace.tsx"
32
+
33
+ export type { PipelineLoadingState, PipelinePanels, PipelineRuntime } from "#pipeline/types"
34
+
35
+ export { useParsePipeline } from "#pipeline/useParsePipeline"
36
+ export type { UseParsePipeline, UseParsePipelineOptions } from "#pipeline/useParsePipeline"
@@ -3,7 +3,7 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * `AbstainPanel` — shown when the query carries no POI intent (it parses as an address). Names the
6
+ * `AbstainPanel` — shown when the query has no POI intent (it parses as an address). Names the
7
7
  * classifier's kind so the abstention is legible. Presentational.
8
8
  */
9
9
 
@@ -15,7 +15,8 @@ import type { LiveSearchState } from "#poi/types"
15
15
 
16
16
  export interface LiveResultsBlockProps {
17
17
  /**
18
- * Subject label for empty-state copy — a category ("No hospital results near …") or a brand ("No chevron results …").
18
+ * Subject label for empty-state copy — a category ("No hospital results near …")
19
+ * or a brand ("No chevron results …").
19
20
  */
20
21
  subjectLabel: string
21
22
  /**
@@ -2,11 +2,6 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * `POIExplorer` — the composed POI-intent tester. Detects a POI subject in free text, shows the
7
- * category + OverpassQL export, and (when a live-search probe is injected) searches the published
8
- * poi.db layer. The intent path is self-contained — no weights, no network. All runtime concerns are
9
- * in {@link usePOISearch}; this file is composition + a `ClientOnly` SSR boundary.
10
5
  */
11
6
 
12
7
  import { type ReactNode, useState } from "react"
@@ -24,27 +19,35 @@ import { OverpassBlock } from "./OverpassBlock.tsx"
24
19
  import { QueryInput } from "./QueryInput.tsx"
25
20
  import { SubjectPanel } from "./SubjectPanel.tsx"
26
21
 
22
+ /**
23
+ * Props for {@linkcode POIExplorer}.
24
+ */
27
25
  export interface POIExplorerProps {
28
26
  /**
29
- * Query to pre-fill in the input.
27
+ * The query that pre-fills the input.
30
28
  */
31
29
  defaultText?: string
32
30
  /**
33
- * Example chips. @default the built-in POI presets
31
+ * The example chips.
32
+ *
33
+ * @defaultValue POI_PRESETS
34
34
  */
35
35
  presets?: ReadonlyArray<Preset>
36
36
  /**
37
- * Override the taxonomy-runtime loader (stories/tests inject a mock).
37
+ * A replacement loader for the taxonomy runtime, such as a mock in stories and tests.
38
38
  */
39
39
  loadRuntime?: LoadPOIRuntime
40
40
  /**
41
- * Live poi.db probe. Absent ⇒ intent-only (no live-results affordance).
41
+ * The live poi.db search.
42
+ * Without it, the explorer shows only the detected intent.
42
43
  */
43
44
  runLiveSearch?: POILiveSearch
44
45
  /**
45
- * Whether {@link runLiveSearch} can serve BRAND subjects (fetch by QID). Default false: a brand subject shows the
46
- * intent + QID chip but no live block. The docs' httpvfs probe leaves this off (brand-wide byte-range hydration is
47
- * pathological — measured); a server-side backend can enable it.
46
+ * Whether {@link runLiveSearch} can search brand subjects by Wikidata QID.
47
+ *
48
+ * When it is false, a brand subject shows its intent and QID chip without a live block.
49
+ * A byte-range probe over httpvfs should leave it off because a brand-wide
50
+ * lookup reads too much of the database.
48
51
  */
49
52
  brandLiveSearch?: boolean
50
53
  }
@@ -72,13 +75,12 @@ function POIExplorerInner({
72
75
 
73
76
  const subject = result?.subject
74
77
 
75
- // The live block appears whenever the subject COULD be live-searched with an anchor — i.e. capable minus the
76
- // anchor-present requirement (`canSearchLive` also requires an anchor; the block itself renders the "add an anchor"
77
- // hint, so it must show one step earlier). Category: not build-local. Brand: brand-capable probe + a QID.
78
+ // A category is searchable unless it is build-local.
79
+ // A brand needs a QID and a brand-capable probe.
78
80
  const showLiveBlock = Boolean(
79
81
  runLiveSearch &&
80
82
  subject &&
81
- (subject.kind === "brand" ? brandLiveSearch && subject.wikidata !== undefined : !subject.buildLocal)
83
+ (subject.kind === "brand" ? brandLiveSearch && subject.wikidata !== null : !subject.buildLocal)
82
84
  )
83
85
 
84
86
  return (
@@ -94,7 +96,10 @@ function POIExplorerInner({
94
96
  <>
95
97
  <SubjectPanel subject={subject} />
96
98
  {subject.kind === "category" ? (
97
- <OverpassBlock overpassQL={result.overpassQL} overpassError={result.overpassError} />
99
+ <OverpassBlock
100
+ overpassQL={result.overpassQL ?? undefined}
101
+ overpassError={result.overpassError ?? undefined}
102
+ />
98
103
  ) : null}
99
104
 
100
105
  {showLiveBlock ? (
@@ -115,6 +120,13 @@ function POIExplorerInner({
115
120
  )
116
121
  }
117
122
 
123
+ /**
124
+ * Renders a POI-intent tester that detects a POI subject in free text.
125
+ *
126
+ * It shows the matched category or brand and, for categories, an OverpassQL export.
127
+ * When `runLiveSearch` is set, it can also search the published poi.db.
128
+ * It renders only on the client.
129
+ */
118
130
  export function POIExplorer({
119
131
  defaultText = POI_DEFAULT_TEXT,
120
132
  presets = POI_PRESETS,
@@ -3,7 +3,7 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * `QueryInput` — the labelled text field for the POI explorer. Controlled; presentational only.
6
+ * `QueryInput` — the labeled text field for the POI explorer. Controlled. presentational only.
7
7
  */
8
8
 
9
9
  import type { ReactNode } from "react"
@@ -3,8 +3,8 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * `SubjectPanel` — renders the detected POI subject. For a CATEGORY: the category chip, the optional
7
- * build-local badge + note. For a BRAND: the brand-name chip + a Wikidata QID chip (linked). Both
6
+ * `SubjectPanel` — renders the detected POI subject. For a category: the category chip, the optional
7
+ * build-local badge + note. For a brand: the brand-name chip + a Wikidata QID chip (linked). Both
8
8
  * share the match-detail list (matched phrase, confidence, anchor). Presentational.
9
9
  */
10
10
 
@@ -17,7 +17,8 @@ export interface SubjectPanelProps {
17
17
  }
18
18
 
19
19
  /**
20
- * The shared match-detail list (matched phrase, confidence, anchor) — identical for category + brand subjects.
20
+ * The shared match-detail list (matched phrase, confidence, anchor) —
21
+ * identical for category + brand subjects.
21
22
  */
22
23
  function MatchDetail({ subject }: SubjectPanelProps): ReactNode {
23
24
  return (
@@ -2,11 +2,6 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * The default POI runtime loader + presentation helpers. `loadPOIRuntime` dynamically imports the
7
- * ~2k-record Overture taxonomy snapshot (so bundlers code-split it into its own chunk, fetched only
8
- * when the explorer actually mounts) and wires the kind classifier over it. Pure + browser-safe: no
9
- * network, no DOM — the whole intent path runs offline.
10
5
  */
11
6
 
12
7
  import { createKindClassifier } from "@mailwoman/kind-classifier"
@@ -16,14 +11,10 @@ import { createPOIBrandLookup, createPOITaxonomyLookup } from "@mailwoman/poi-ta
16
11
  import type { POIRuntime } from "#poi/types"
17
12
 
18
13
  /**
19
- * Build the POI runtime, dynamically importing the taxonomy + brand JSON so the tables land in their own chunk. A
20
- * static import would inline the whole snapshot into every consumer's bundle.
14
+ * Loads the browser POI runtime, importing the taxonomy and brand tables dynamically
15
+ * so they land in their own chunk instead of every consumer's bundle.
21
16
  *
22
- * The lexicon unions categories then brands, mirroring the Node runtime's `poiTaxonomyLookup` precedence: a phrase that
23
- * matches a taxonomy CATEGORY wins (the curated set); only on a category miss does the chain-brand table fire,
24
- * returning a `kind: "brand"` match carrying the brand's canonical name + Wikidata QID. (The Node path also chains
25
- * `@mailwoman/variant-aliases` regional slang; the browser tester leaves that out — one fewer package + data table for
26
- * a demo, and the QID-keyed brand table already covers the headline brands.)
17
+ * Its lexicon tries exact categories and then brands only, a subset of the Node `poiTaxonomyLookup` chain.
27
18
  */
28
19
  export async function loadPOIRuntime(): Promise<POIRuntime> {
29
20
  const [table, brandTable] = await Promise.all([
@@ -34,8 +25,6 @@ export async function loadPOIRuntime(): Promise<POIRuntime> {
34
25
  const lookup = createPOITaxonomyLookup(table as Parameters<typeof createPOITaxonomyLookup>[0])
35
26
  const brands = createPOIBrandLookup(brandTable as Parameters<typeof createPOIBrandLookup>[0])
36
27
 
37
- // Adapt the taxonomy + brand lookups to the `POIPhraseLookup` shape the classifier expects: categories first, brands
38
- // on a category miss.
39
28
  const lexicon: POIPhraseLookup = (phrase, locale) => {
40
29
  const categoryHits = lookup.lookupPOICategory(phrase, locale)
41
30
 
@@ -45,6 +34,11 @@ export async function loadPOIRuntime(): Promise<POIRuntime> {
45
34
  categoryID: match.category.id,
46
35
  matchedPhrase: match.matchedPhrase,
47
36
  confidence: match.confidence,
37
+ mechanism: "exact",
38
+ inputPhrase: phrase,
39
+ wikidata: null,
40
+ reading: "preference",
41
+ countryScope: null,
48
42
  }))
49
43
  }
50
44
 
@@ -54,6 +48,10 @@ export async function loadPOIRuntime(): Promise<POIRuntime> {
54
48
  wikidata: match.brand.wikidata,
55
49
  matchedPhrase: match.matchedPhrase,
56
50
  confidence: match.confidence,
51
+ mechanism: "exact",
52
+ inputPhrase: phrase,
53
+ reading: "preference",
54
+ countryScope: null,
57
55
  }))
58
56
  }
59
57
 
@@ -61,7 +59,7 @@ export async function loadPOIRuntime(): Promise<POIRuntime> {
61
59
  }
62
60
 
63
61
  /**
64
- * Default example queries for the POI explorer — a mix of category, build-local, and chain-brand subjects.
62
+ * Default example queries for the POI explorer — a mix of category, build-local and chain-brand subjects.
65
63
  */
66
64
  export const POI_PRESETS = [
67
65
  { label: "Drinking fountain", value: "drinking fountain near Springfield" },
@@ -72,7 +70,7 @@ export const POI_PRESETS = [
72
70
  ] as const
73
71
 
74
72
  /**
75
- * Query the POI explorer opens on — the first preset, so the two stay in step.
73
+ * Holds the query the POI explorer opens on, taken from the first preset so the two stay in step.
76
74
  */
77
75
  export const POI_DEFAULT_TEXT = POI_PRESETS[0].value
78
76