@mailwoman/react 9.4.0 → 10.1.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 (370) hide show
  1. package/README.md +17 -16
  2. package/fonts.css +97 -22
  3. package/lib/common/About.tsx +87 -71
  4. package/lib/common/ClientOnly.tsx +2 -14
  5. package/lib/common/CopyButton.tsx +3 -1
  6. package/lib/common/LoadingIndicator.tsx +4 -2
  7. package/lib/common/PresetChips.tsx +9 -8
  8. package/lib/common/confidence-tiers.ts +7 -6
  9. package/lib/common/cx.ts +3 -1
  10. package/lib/common/text-tokens.ts +7 -4
  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 -112
  15. package/lib/map/AppIdentity.tsx +85 -0
  16. package/lib/map/BackendControl.tsx +16 -13
  17. package/lib/map/CompareToggle.tsx +11 -33
  18. package/lib/map/DebugInfo.tsx +88 -0
  19. package/lib/map/Geocoder.tsx +92 -58
  20. package/lib/map/GeocoderControls.tsx +582 -127
  21. package/lib/map/GraticuleLayer.tsx +54 -0
  22. package/lib/map/MapCanvas.tsx +23 -12
  23. package/lib/map/MapChipRow.tsx +73 -0
  24. package/lib/map/MapCompass.tsx +68 -0
  25. package/lib/map/MapControlStack.tsx +97 -0
  26. package/lib/map/MapFooter.tsx +101 -0
  27. package/lib/map/MapProgressBar.tsx +55 -0
  28. package/lib/map/MapSearchBar.tsx +82 -0
  29. package/lib/map/MapSheet.tsx +71 -0
  30. package/lib/map/OverlayLayers.tsx +1 -1
  31. package/lib/map/PlaceAutocomplete.tsx +10 -21
  32. package/lib/map/PlaceMarker.tsx +4 -2
  33. package/lib/map/ResolvedPlaceLayers.tsx +5 -14
  34. package/lib/map/ResultCamera.tsx +8 -31
  35. package/lib/map/ResultOverlay.tsx +2 -12
  36. package/lib/map/ResultPanel.tsx +1 -20
  37. package/lib/map/VersionPicker.tsx +10 -19
  38. package/lib/map/fake-runtime.ts +10 -12
  39. package/lib/map/geometry.ts +14 -47
  40. package/lib/map/graticule.ts +80 -0
  41. package/lib/map/map-debug.ts +1 -1
  42. package/lib/map/place-render.ts +28 -60
  43. package/lib/map/types.ts +65 -97
  44. package/lib/map/useCompareState.ts +5 -4
  45. package/lib/map/useGeocode.ts +7 -5
  46. package/lib/map/useMapBearing.ts +56 -0
  47. package/lib/map/useMapLabelPick.ts +114 -0
  48. package/lib/map/useMapPlaceRender.ts +2 -6
  49. package/lib/map/usePlaceAutocomplete.ts +44 -50
  50. package/lib/map.ts +95 -0
  51. package/lib/pipeline/CandidatePicker.tsx +13 -5
  52. package/lib/pipeline/ConfidenceCell.tsx +1 -1
  53. package/lib/pipeline/FailureDiagnostic.tsx +8 -2
  54. package/lib/pipeline/QueryForm.tsx +5 -2
  55. package/lib/pipeline/ResolvedPlace.tsx +1 -1
  56. package/lib/pipeline/SpanHighlight.tsx +7 -5
  57. package/lib/pipeline/TimingPanel.tsx +1 -1
  58. package/lib/pipeline/TreeView.tsx +1 -1
  59. package/lib/pipeline/copy.ts +22 -25
  60. package/lib/pipeline/presets.ts +15 -13
  61. package/lib/pipeline/types.ts +21 -14
  62. package/lib/pipeline/useParsePipeline.ts +38 -24
  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 +24 -15
  67. package/lib/poi/QueryInput.tsx +1 -1
  68. package/lib/poi/SubjectPanel.tsx +4 -3
  69. package/lib/poi/runtime.ts +5 -16
  70. package/lib/poi/types.ts +39 -27
  71. package/lib/poi/usePOISearch.ts +39 -44
  72. package/lib/poi.ts +39 -0
  73. package/lib/runtime/useReleaseRuntime.ts +125 -74
  74. package/lib/runtime.ts +16 -0
  75. package/lib/search/SearchModal.tsx +317 -0
  76. package/lib/search/search.css +144 -0
  77. package/lib/search/types.ts +67 -0
  78. package/lib/search.ts +11 -0
  79. package/out/common/About.d.ts +13 -4
  80. package/out/common/About.d.ts.map +1 -1
  81. package/out/common/About.js +5 -2
  82. package/out/common/About.js.map +1 -1
  83. package/out/common/ClientOnly.d.ts +2 -11
  84. package/out/common/ClientOnly.d.ts.map +1 -1
  85. package/out/common/ClientOnly.js +1 -13
  86. package/out/common/ClientOnly.js.map +1 -1
  87. package/out/common/CopyButton.d.ts +3 -1
  88. package/out/common/CopyButton.d.ts.map +1 -1
  89. package/out/common/CopyButton.js.map +1 -1
  90. package/out/common/LoadingIndicator.d.ts +4 -2
  91. package/out/common/LoadingIndicator.d.ts.map +1 -1
  92. package/out/common/LoadingIndicator.js.map +1 -1
  93. package/out/common/PresetChips.d.ts +9 -8
  94. package/out/common/PresetChips.d.ts.map +1 -1
  95. package/out/common/PresetChips.js.map +1 -1
  96. package/out/common/confidence-tiers.d.ts +7 -6
  97. package/out/common/confidence-tiers.d.ts.map +1 -1
  98. package/out/common/confidence-tiers.js +7 -6
  99. package/out/common/confidence-tiers.js.map +1 -1
  100. package/out/common/cx.d.ts +3 -1
  101. package/out/common/cx.d.ts.map +1 -1
  102. package/out/common/cx.js +3 -1
  103. package/out/common/cx.js.map +1 -1
  104. package/out/common/text-tokens.d.ts +4 -3
  105. package/out/common/text-tokens.d.ts.map +1 -1
  106. package/out/common/text-tokens.js +6 -3
  107. package/out/common/text-tokens.js.map +1 -1
  108. package/out/common/useBuildInfo.d.ts +27 -0
  109. package/out/common/useBuildInfo.d.ts.map +1 -0
  110. package/out/common/useBuildInfo.js +32 -0
  111. package/out/common/useBuildInfo.js.map +1 -0
  112. package/out/common/useClipboard.d.ts +1 -3
  113. package/out/common/useClipboard.d.ts.map +1 -1
  114. package/out/common/useClipboard.js +2 -11
  115. package/out/common/useClipboard.js.map +1 -1
  116. package/out/common.d.ts +22 -0
  117. package/out/common.d.ts.map +1 -0
  118. package/out/common.js +15 -0
  119. package/out/common.js.map +1 -0
  120. package/out/index.d.ts +26 -71
  121. package/out/index.d.ts.map +1 -1
  122. package/out/index.js +21 -47
  123. package/out/index.js.map +1 -1
  124. package/out/map/AppIdentity.d.ts +42 -0
  125. package/out/map/AppIdentity.d.ts.map +1 -0
  126. package/out/map/AppIdentity.js +16 -0
  127. package/out/map/AppIdentity.js.map +1 -0
  128. package/out/map/BackendControl.d.ts +9 -10
  129. package/out/map/BackendControl.d.ts.map +1 -1
  130. package/out/map/BackendControl.js +2 -2
  131. package/out/map/BackendControl.js.map +1 -1
  132. package/out/map/CompareToggle.d.ts +8 -31
  133. package/out/map/CompareToggle.d.ts.map +1 -1
  134. package/out/map/CompareToggle.js +5 -2
  135. package/out/map/CompareToggle.js.map +1 -1
  136. package/out/map/DebugInfo.d.ts +34 -0
  137. package/out/map/DebugInfo.d.ts.map +1 -0
  138. package/out/map/DebugInfo.js +39 -0
  139. package/out/map/DebugInfo.js.map +1 -0
  140. package/out/map/Geocoder.d.ts +47 -26
  141. package/out/map/Geocoder.d.ts.map +1 -1
  142. package/out/map/Geocoder.js +34 -50
  143. package/out/map/Geocoder.js.map +1 -1
  144. package/out/map/GeocoderControls.d.ts +23 -33
  145. package/out/map/GeocoderControls.d.ts.map +1 -1
  146. package/out/map/GeocoderControls.js +277 -16
  147. package/out/map/GeocoderControls.js.map +1 -1
  148. package/out/map/GraticuleLayer.d.ts +28 -0
  149. package/out/map/GraticuleLayer.d.ts.map +1 -0
  150. package/out/map/GraticuleLayer.js +25 -0
  151. package/out/map/GraticuleLayer.js.map +1 -0
  152. package/out/map/MapCanvas.d.ts +23 -12
  153. package/out/map/MapCanvas.d.ts.map +1 -1
  154. package/out/map/MapCanvas.js +5 -2
  155. package/out/map/MapCanvas.js.map +1 -1
  156. package/out/map/MapChipRow.d.ts +43 -0
  157. package/out/map/MapChipRow.d.ts.map +1 -0
  158. package/out/map/MapChipRow.js +12 -0
  159. package/out/map/MapChipRow.js.map +1 -0
  160. package/out/map/MapCompass.d.ts +33 -0
  161. package/out/map/MapCompass.d.ts.map +1 -0
  162. package/out/map/MapCompass.js +15 -0
  163. package/out/map/MapCompass.js.map +1 -0
  164. package/out/map/MapControlStack.d.ts +56 -0
  165. package/out/map/MapControlStack.d.ts.map +1 -0
  166. package/out/map/MapControlStack.js +18 -0
  167. package/out/map/MapControlStack.js.map +1 -0
  168. package/out/map/MapFooter.d.ts +27 -0
  169. package/out/map/MapFooter.d.ts.map +1 -0
  170. package/out/map/MapFooter.js +37 -0
  171. package/out/map/MapFooter.js.map +1 -0
  172. package/out/map/MapProgressBar.d.ts +31 -0
  173. package/out/map/MapProgressBar.d.ts.map +1 -0
  174. package/out/map/MapProgressBar.js +8 -0
  175. package/out/map/MapProgressBar.js.map +1 -0
  176. package/out/map/MapSearchBar.d.ts +48 -0
  177. package/out/map/MapSearchBar.d.ts.map +1 -0
  178. package/out/map/MapSearchBar.js +12 -0
  179. package/out/map/MapSearchBar.js.map +1 -0
  180. package/out/map/MapSheet.d.ts +35 -0
  181. package/out/map/MapSheet.d.ts.map +1 -0
  182. package/out/map/MapSheet.js +29 -0
  183. package/out/map/MapSheet.js.map +1 -0
  184. package/out/map/OverlayLayers.d.ts +1 -1
  185. package/out/map/OverlayLayers.js +2 -2
  186. package/out/map/PlaceAutocomplete.d.ts +10 -21
  187. package/out/map/PlaceAutocomplete.d.ts.map +1 -1
  188. package/out/map/PlaceAutocomplete.js +2 -1
  189. package/out/map/PlaceAutocomplete.js.map +1 -1
  190. package/out/map/PlaceMarker.d.ts +4 -2
  191. package/out/map/PlaceMarker.d.ts.map +1 -1
  192. package/out/map/PlaceMarker.js +3 -1
  193. package/out/map/PlaceMarker.js.map +1 -1
  194. package/out/map/ResolvedPlaceLayers.d.ts +5 -14
  195. package/out/map/ResolvedPlaceLayers.d.ts.map +1 -1
  196. package/out/map/ResolvedPlaceLayers.js +2 -2
  197. package/out/map/ResolvedPlaceLayers.js.map +1 -1
  198. package/out/map/ResultCamera.d.ts +8 -31
  199. package/out/map/ResultCamera.d.ts.map +1 -1
  200. package/out/map/ResultCamera.js +3 -28
  201. package/out/map/ResultCamera.js.map +1 -1
  202. package/out/map/ResultOverlay.d.ts +2 -12
  203. package/out/map/ResultOverlay.d.ts.map +1 -1
  204. package/out/map/ResultOverlay.js +1 -2
  205. package/out/map/ResultOverlay.js.map +1 -1
  206. package/out/map/ResultPanel.d.ts +1 -20
  207. package/out/map/ResultPanel.d.ts.map +1 -1
  208. package/out/map/ResultPanel.js +1 -1
  209. package/out/map/ResultPanel.js.map +1 -1
  210. package/out/map/VersionPicker.d.ts +7 -19
  211. package/out/map/VersionPicker.d.ts.map +1 -1
  212. package/out/map/VersionPicker.js +5 -2
  213. package/out/map/VersionPicker.js.map +1 -1
  214. package/out/map/fake-runtime.d.ts +9 -11
  215. package/out/map/fake-runtime.d.ts.map +1 -1
  216. package/out/map/fake-runtime.js +9 -12
  217. package/out/map/fake-runtime.js.map +1 -1
  218. package/out/map/geometry.d.ts +13 -34
  219. package/out/map/geometry.d.ts.map +1 -1
  220. package/out/map/geometry.js +9 -34
  221. package/out/map/geometry.js.map +1 -1
  222. package/out/map/graticule.d.ts +17 -0
  223. package/out/map/graticule.d.ts.map +1 -0
  224. package/out/map/graticule.js +67 -0
  225. package/out/map/graticule.js.map +1 -0
  226. package/out/map/map-debug.d.ts +1 -1
  227. package/out/map/map-debug.d.ts.map +1 -1
  228. package/out/map/map-debug.js +1 -1
  229. package/out/map/map-debug.js.map +1 -1
  230. package/out/map/place-render.d.ts +23 -43
  231. package/out/map/place-render.d.ts.map +1 -1
  232. package/out/map/place-render.js +4 -39
  233. package/out/map/place-render.js.map +1 -1
  234. package/out/map/types.d.ts +67 -95
  235. package/out/map/types.d.ts.map +1 -1
  236. package/out/map/types.js +1 -10
  237. package/out/map/types.js.map +1 -1
  238. package/out/map/useCompareState.d.ts +5 -4
  239. package/out/map/useCompareState.d.ts.map +1 -1
  240. package/out/map/useCompareState.js +3 -3
  241. package/out/map/useCompareState.js.map +1 -1
  242. package/out/map/useGeocode.d.ts +5 -3
  243. package/out/map/useGeocode.d.ts.map +1 -1
  244. package/out/map/useGeocode.js +4 -4
  245. package/out/map/useGeocode.js.map +1 -1
  246. package/out/map/useMapBearing.d.ts +28 -0
  247. package/out/map/useMapBearing.d.ts.map +1 -0
  248. package/out/map/useMapBearing.js +30 -0
  249. package/out/map/useMapBearing.js.map +1 -0
  250. package/out/map/useMapLabelPick.d.ts +13 -0
  251. package/out/map/useMapLabelPick.d.ts.map +1 -0
  252. package/out/map/useMapLabelPick.js +95 -0
  253. package/out/map/useMapLabelPick.js.map +1 -0
  254. package/out/map/useMapPlaceRender.d.ts +2 -6
  255. package/out/map/useMapPlaceRender.d.ts.map +1 -1
  256. package/out/map/useMapPlaceRender.js +2 -6
  257. package/out/map/useMapPlaceRender.js.map +1 -1
  258. package/out/map/usePlaceAutocomplete.d.ts +30 -28
  259. package/out/map/usePlaceAutocomplete.d.ts.map +1 -1
  260. package/out/map/usePlaceAutocomplete.js +6 -33
  261. package/out/map/usePlaceAutocomplete.js.map +1 -1
  262. package/out/map.d.ts +69 -0
  263. package/out/map.d.ts.map +1 -0
  264. package/out/map.js +46 -0
  265. package/out/map.js.map +1 -0
  266. package/out/pipeline/CandidatePicker.d.ts +12 -2
  267. package/out/pipeline/CandidatePicker.d.ts.map +1 -1
  268. package/out/pipeline/CandidatePicker.js +2 -2
  269. package/out/pipeline/CandidatePicker.js.map +1 -1
  270. package/out/pipeline/ConfidenceCell.d.ts +1 -1
  271. package/out/pipeline/ConfidenceCell.js +1 -1
  272. package/out/pipeline/FailureDiagnostic.d.ts +8 -2
  273. package/out/pipeline/FailureDiagnostic.d.ts.map +1 -1
  274. package/out/pipeline/FailureDiagnostic.js +3 -0
  275. package/out/pipeline/FailureDiagnostic.js.map +1 -1
  276. package/out/pipeline/PipelineExplorer.js +1 -1
  277. package/out/pipeline/QueryForm.d.ts +5 -2
  278. package/out/pipeline/QueryForm.d.ts.map +1 -1
  279. package/out/pipeline/QueryForm.js +1 -1
  280. package/out/pipeline/QueryForm.js.map +1 -1
  281. package/out/pipeline/ResolvedPlace.js +1 -1
  282. package/out/pipeline/SpanHighlight.d.ts +4 -3
  283. package/out/pipeline/SpanHighlight.d.ts.map +1 -1
  284. package/out/pipeline/SpanHighlight.js +3 -2
  285. package/out/pipeline/SpanHighlight.js.map +1 -1
  286. package/out/pipeline/TimingPanel.d.ts +1 -1
  287. package/out/pipeline/TimingPanel.js +1 -1
  288. package/out/pipeline/TreeView.d.ts +1 -1
  289. package/out/pipeline/copy.d.ts +1 -1
  290. package/out/pipeline/copy.d.ts.map +1 -1
  291. package/out/pipeline/copy.js +4 -3
  292. package/out/pipeline/copy.js.map +1 -1
  293. package/out/pipeline/presets.d.ts +5 -4
  294. package/out/pipeline/presets.d.ts.map +1 -1
  295. package/out/pipeline/presets.js +15 -13
  296. package/out/pipeline/presets.js.map +1 -1
  297. package/out/pipeline/types.d.ts +21 -14
  298. package/out/pipeline/types.d.ts.map +1 -1
  299. package/out/pipeline/types.js +2 -4
  300. package/out/pipeline/types.js.map +1 -1
  301. package/out/pipeline/useParsePipeline.d.ts +15 -7
  302. package/out/pipeline/useParsePipeline.d.ts.map +1 -1
  303. package/out/pipeline/useParsePipeline.js +10 -7
  304. package/out/pipeline/useParsePipeline.js.map +1 -1
  305. package/out/pipeline.d.ts +33 -0
  306. package/out/pipeline.d.ts.map +1 -0
  307. package/out/pipeline.js +21 -0
  308. package/out/pipeline.js.map +1 -0
  309. package/out/poi/AbstainPanel.d.ts +1 -1
  310. package/out/poi/LiveResultsBlock.d.ts +2 -1
  311. package/out/poi/LiveResultsBlock.d.ts.map +1 -1
  312. package/out/poi/LiveResultsBlock.js +1 -1
  313. package/out/poi/LiveResultsBlock.js.map +1 -1
  314. package/out/poi/POIExplorer.d.ts +22 -12
  315. package/out/poi/POIExplorer.d.ts.map +1 -1
  316. package/out/poi/POIExplorer.js +10 -9
  317. package/out/poi/POIExplorer.js.map +1 -1
  318. package/out/poi/QueryInput.d.ts +1 -1
  319. package/out/poi/SubjectPanel.d.ts +2 -2
  320. package/out/poi/SubjectPanel.d.ts.map +1 -1
  321. package/out/poi/SubjectPanel.js +3 -2
  322. package/out/poi/SubjectPanel.js.map +1 -1
  323. package/out/poi/runtime.d.ts +5 -14
  324. package/out/poi/runtime.d.ts.map +1 -1
  325. package/out/poi/runtime.js +5 -16
  326. package/out/poi/runtime.js.map +1 -1
  327. package/out/poi/types.d.ts +39 -27
  328. package/out/poi/types.d.ts.map +1 -1
  329. package/out/poi/types.js +2 -4
  330. package/out/poi/types.js.map +1 -1
  331. package/out/poi/usePOISearch.d.ts +28 -17
  332. package/out/poi/usePOISearch.d.ts.map +1 -1
  333. package/out/poi/usePOISearch.js +6 -32
  334. package/out/poi/usePOISearch.js.map +1 -1
  335. package/out/poi.d.ts +23 -0
  336. package/out/poi.d.ts.map +1 -0
  337. package/out/poi.js +15 -0
  338. package/out/poi.js.map +1 -0
  339. package/out/runtime/useReleaseRuntime.d.ts +64 -65
  340. package/out/runtime/useReleaseRuntime.d.ts.map +1 -1
  341. package/out/runtime/useReleaseRuntime.js +31 -26
  342. package/out/runtime/useReleaseRuntime.js.map +1 -1
  343. package/out/runtime.d.ts +9 -0
  344. package/out/runtime.d.ts.map +1 -0
  345. package/out/runtime.js +8 -0
  346. package/out/runtime.js.map +1 -0
  347. package/out/search/SearchModal.d.ts +33 -0
  348. package/out/search/SearchModal.d.ts.map +1 -0
  349. package/out/search/SearchModal.js +187 -0
  350. package/out/search/SearchModal.js.map +1 -0
  351. package/out/search/types.d.ts +64 -0
  352. package/out/search/types.d.ts.map +1 -0
  353. package/out/search/types.js +13 -0
  354. package/out/search/types.js.map +1 -0
  355. package/out/search.d.ts +11 -0
  356. package/out/search.d.ts.map +1 -0
  357. package/out/search.js +9 -0
  358. package/out/search.js.map +1 -0
  359. package/package.json +132 -133
  360. package/styles.css +1340 -202
  361. package/tokens/index.css +26 -7
  362. package/tokens/tokens.json +121 -6
  363. package/tokens/tokens.resolver.json +1 -1
  364. package/lib/map/index.ts +0 -76
  365. package/out/map/index.d.ts +0 -52
  366. package/out/map/index.d.ts.map +0 -1
  367. package/out/map/index.js +0 -36
  368. package/out/map/index.js.map +0 -1
  369. package/styleframe.config.ts +0 -321
  370. package/vitest.node.config.ts +0 -20
@@ -2,59 +2,70 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * `usePOISearch` — the headless core of the POI explorer. Owns the taxonomy-runtime load, the
7
- * debounced classify → subject → OverpassQL derivation, and the "Search live" state machine. The
8
- * runtime loader and the live-search probe are both INJECTABLE, so stories/tests drive it with mocks
9
- * and no network or db. Presentation is entirely the caller's concern.
10
5
  */
11
6
  import type { LiveSearchState, LoadPOIRuntime, POIExplorerResult, POILiveSearch } from "#poi/types";
7
+ /**
8
+ * Options for {@link usePOISearch}.
9
+ */
12
10
  export interface UsePOISearchOptions {
13
11
  /**
14
- * The current query text (controlled by the caller).
12
+ * The current query text, owned and updated by the caller.
15
13
  */
16
14
  text: string;
17
15
  /**
18
- * Runtime loader. @default loadPOIRuntime
16
+ * The loader that the hook calls once on mount.
17
+ * It defaults to `loadPOIRuntime`.
19
18
  */
20
19
  loadRuntime?: LoadPOIRuntime;
21
20
  /**
22
- * Injected live-search probe. Absent ⇒ the live-results affordance is disabled.
21
+ * The live-search probe.
22
+ * Live search is unavailable when it is absent.
23
23
  */
24
24
  runLiveSearch?: POILiveSearch;
25
25
  /**
26
- * Whether the injected probe can serve BRAND subjects (fetch by Wikidata QID). Default false: brand subjects show the
27
- * intent + QID chip but no live-search affordance. The docs' httpvfs probe leaves this off — brand-wide row hydration
28
- * is pathological over byte-range (measured) — so brand live search is a server-side-backend capability. Category
29
- * live search is unaffected either way.
26
+ * Whether the probe can search for brand subjects by Wikidata ID, defaulting to
27
+ * false. enable it only for a server-side backend, since fetching every row for
28
+ * a brand over an HTTP range-request database is too slow.
30
29
  */
31
30
  brandLiveSearch?: boolean;
32
31
  /**
33
- * Debounce before (re)classifying. @default 250
32
+ * The delay in milliseconds before the text is classified.
33
+ * Defaults to 250.
34
34
  */
35
35
  debounceMs?: number;
36
36
  }
37
+ /**
38
+ * The state that {@link usePOISearch} returns.
39
+ */
37
40
  export interface UsePOISearch {
38
41
  /**
39
42
  * True once the taxonomy runtime has loaded.
40
43
  */
41
44
  runtimeReady: boolean;
42
45
  /**
43
- * The intent result for the current (debounced) query, or null for empty input.
46
+ * The classification for the current debounced text, `null` for empty text
47
+ * and while classification is pending.
44
48
  */
45
49
  result: POIExplorerResult | null;
46
50
  /**
47
- * State of the on-demand live poi.db search.
51
+ * The live-search state for the current debounced text, `idle` until a search runs.
48
52
  */
49
53
  liveSearch: LiveSearchState;
50
54
  /**
51
- * Whether a live search can run right now (a probe is wired + there's a resolved subject with an anchor).
55
+ * Whether a probe is wired and the subject supports live search with a non-empty place anchor.
52
56
  */
53
57
  canSearchLive: boolean;
54
58
  /**
55
- * Kick off a live search for the current subject. No-op when {@link canSearchLive} is false.
59
+ * Starts a live search for the current subject.
60
+ * It starts no search when `canSearchLive` is false.
56
61
  */
57
62
  searchLive: () => Promise<void>;
58
63
  }
64
+ /**
65
+ * Classifies debounced query text as a POI category or brand request and runs live searches on demand.
66
+ *
67
+ * Each result is keyed to the query that produced it, live search requires a non-empty anchor.
68
+ * Brands need `brandLiveSearch` plus a Wikidata ID.
69
+ */
59
70
  export declare function usePOISearch({ text, loadRuntime, runLiveSearch, brandLiveSearch, debounceMs, }: UsePOISearchOptions): UsePOISearch;
60
71
  //# sourceMappingURL=usePOISearch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePOISearch.d.ts","sourceRoot":"","sources":["../../lib/poi/usePOISearch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAc,MAAM,YAAY,CAAA;AAE/G,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAC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CAAA;IAEhC;;OAEG;IACH,UAAU,EAAE,eAAe,CAAA;IAE3B;;OAEG;IACH,aAAa,EAAE,OAAO,CAAA;IAEtB;;;OAGG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC/B;AA0BD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAC5B,IAAI,EACJ,WAA4B,EAC5B,aAAa,EACb,eAAuB,EACvB,UAAgB,GAChB,EAAE,mBAAmB,GAAG,YAAY,CA6JpC"}
@@ -2,11 +2,6 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * `usePOISearch` — the headless core of the POI explorer. Owns the taxonomy-runtime load, the
7
- * debounced classify → subject → OverpassQL derivation, and the "Search live" state machine. The
8
- * runtime loader and the live-search probe are both INJECTABLE, so stories/tests drive it with mocks
9
- * and no network or db. Presentation is entirely the caller's concern.
10
5
  */
11
6
  import { matchPOISubject } from "@mailwoman/kind-classifier";
12
7
  import { emitOverpassQL } from "@mailwoman/poi-taxonomy/overpass";
@@ -14,9 +9,6 @@ import { computeQueryShape } from "@mailwoman/query-shape";
14
9
  import { useCallback, useEffect, useEffectEvent, useState } from "react";
15
10
  import { useDebouncedValue } from "#common/useDebouncedValue";
16
11
  import { loadPOIRuntime } from "#poi/runtime";
17
- /**
18
- * Compute the OverpassQL export for a matched subject, capturing any emitter error rather than throwing.
19
- */
20
12
  function buildOverpass(runtime, categoryID, matchedPhrase, remainder) {
21
13
  const category = runtime.lookup.getPOICategory(categoryID);
22
14
  if (!category) {
@@ -33,25 +25,18 @@ function buildOverpass(runtime, categoryID, matchedPhrase, remainder) {
33
25
  return { overpassError: error instanceof Error ? error.message : String(error) };
34
26
  }
35
27
  }
28
+ /**
29
+ * Classifies debounced query text as a POI category or brand request and runs live searches on demand.
30
+ *
31
+ * Each result is keyed to the query that produced it, live search requires a non-empty anchor.
32
+ * Brands need `brandLiveSearch` plus a Wikidata ID.
33
+ */
36
34
  export function usePOISearch({ text, loadRuntime = loadPOIRuntime, runLiveSearch, brandLiveSearch = false, debounceMs = 250, }) {
37
35
  const [runtime, setRuntime] = useState(null);
38
- /**
39
- * The classify result KEYED BY the query that produced it. The visible result is derived during render
40
- * (`storedResult.query === trimmedText ? … : null`), so a new query invalidates the old answer by derivation — the
41
- * effect never writes state synchronously to "reset", which is the react(set-state-in-effect) shape the lint bump
42
- * rightly flags.
43
- */
44
36
  const [storedResult, setStoredResult] = useState(null);
45
- /**
46
- * Live-search state, keyed the same way: launched FOR a query, visible only while that query stands.
47
- */
48
37
  const [storedLive, setStoredLive] = useState(null);
49
38
  const debouncedText = useDebouncedValue(text, debounceMs);
50
39
  const trimmedText = debouncedText.trim();
51
- // The load fires exactly ONCE on mount regardless of whether the caller passes a fresh `loadRuntime`
52
- // closure each render (an inline `async () => …` would otherwise retrigger the effect → reload →
53
- // re-render loop). `useEffectEvent` reads the LATEST closure without joining the dependency list —
54
- // the runtime is a load-once resource.
55
40
  const loadRuntimeEvent = useEffectEvent(() => loadRuntime());
56
41
  useEffect(() => {
57
42
  let cancelled = false;
@@ -64,9 +49,6 @@ export function usePOISearch({ text, loadRuntime = loadPOIRuntime, runLiveSearch
64
49
  cancelled = true;
65
50
  };
66
51
  }, []);
67
- // Classify the debounced query and derive the subject + OverpassQL (async, so it lives in an effect).
68
- // Every state write below happens after an await — invalidation on query change is handled by the
69
- // key derivation above, not by a synchronous reset here.
70
52
  useEffect(() => {
71
53
  if (!runtime)
72
54
  return;
@@ -84,8 +66,6 @@ export function usePOISearch({ text, loadRuntime = loadPOIRuntime, runLiveSearch
84
66
  setStoredResult({ query: trimmed, value: { kindResult } });
85
67
  return;
86
68
  }
87
- // Brand subject: the lexicon carries the brand's canonical name as `categoryID` + its Wikidata QID. No category
88
- // record, no OverpassQL (brands are searched by QID against the layer's `brand_wikidata` index, not OSM tags).
89
69
  if ((matched.match.kind ?? "category") === "brand") {
90
70
  setStoredResult({
91
71
  query: trimmed,
@@ -128,14 +108,9 @@ export function usePOISearch({ text, loadRuntime = loadPOIRuntime, runLiveSearch
128
108
  cancelled = true;
129
109
  };
130
110
  }, [trimmedText, runtime]);
131
- // Derived visibility: an answer stands only while its query does. A new query reads as null/idle
132
- // with no reset write anywhere.
133
111
  const result = storedResult?.query === trimmedText ? storedResult.value : null;
134
112
  const liveSearch = storedLive?.query === trimmedText ? storedLive.state : { status: "idle" };
135
113
  const subject = result?.subject;
136
- // A subject is live-searchable when a probe is wired, it has an anchor, and: a CATEGORY that isn't build-local, or a
137
- // BRAND with a QID AND a brand-capable probe (`brandLiveSearch`). Brands without a QID / without a brand probe show
138
- // the intent + QID chip but no live affordance.
139
114
  const subjectLiveCapable = subject !== undefined &&
140
115
  (subject.kind === "brand" ? brandLiveSearch && subject.wikidata !== undefined : !subject.buildLocal);
141
116
  const canSearchLive = Boolean(runLiveSearch && runtime && subject && subjectLiveCapable && subject.remainder.trim().length > 0);
@@ -155,7 +130,6 @@ export function usePOISearch({ text, loadRuntime = loadPOIRuntime, runLiveSearch
155
130
  }
156
131
  : {
157
132
  categoryID: subject.category.id,
158
- // Fan the canonical seed id out over its Overture leaves — the same translation the Node reader uses.
159
133
  overtureCategoryIDs: runtime.lookup.resolveOvertureCategories(subject.category.id),
160
134
  anchor: subject.remainder,
161
135
  });
@@ -1 +1 @@
1
- {"version":3,"file":"usePOISearch.js","sourceRoot":"","sources":["../../lib/poi/usePOISearch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAEjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;A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Aa,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,OAAO,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC,CAAA;YACjH,CAAC;iBAAM,CAAC;gBACP,aAAa,CAAC;oBACb,KAAK,EAAE,WAAW;oBAClB,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,yCAAyC,EAAE;iBAC9E,CAAC,CAAA;YACH,CAAC;QACF,CAAC;QAAC,MAAM,CAAC;YACR,aAAa,CAAC;gBACb,KAAK,EAAE,WAAW;gBAClB,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,yCAAyC,EAAE;aAC9E,CAAC,CAAA;QACH,CAAC;IACF,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC,CAAA;IAEnE,OAAO,EAAE,YAAY,EAAE,OAAO,KAAK,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,CAAA;AACzF,CAAC"}
package/out/poi.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file POI explorer components, hooks, runtime and interfaces.
6
+ */
7
+ export { AbstainPanel } from "./poi/AbstainPanel.tsx";
8
+ export type { AbstainPanelProps } from "./poi/AbstainPanel.tsx";
9
+ export { LiveResultsBlock } from "./poi/LiveResultsBlock.tsx";
10
+ export type { LiveResultsBlockProps } from "./poi/LiveResultsBlock.tsx";
11
+ export { OverpassBlock } from "./poi/OverpassBlock.tsx";
12
+ export type { OverpassBlockProps } from "./poi/OverpassBlock.tsx";
13
+ export { POIExplorer } from "./poi/POIExplorer.tsx";
14
+ export type { POIExplorerProps } from "./poi/POIExplorer.tsx";
15
+ export { QueryInput } from "./poi/QueryInput.tsx";
16
+ export type { QueryInputProps } from "./poi/QueryInput.tsx";
17
+ export { formatDistance, loadPOIRuntime, POI_DEFAULT_TEXT, POI_PRESETS } from "#poi/runtime";
18
+ export { SubjectPanel } from "./poi/SubjectPanel.tsx";
19
+ export type { SubjectPanelProps } from "./poi/SubjectPanel.tsx";
20
+ export type { CategoryRecord, LiveSearchState, LoadPOIRuntime, POIBrandSubject, POICategorySubject, POIExplorerResult, POILiveSearch, POILiveSearchResult, POIRuntime, POISearchHit, POISubject, POISubjectBase, TaxonomyLookup, } from "#poi/types";
21
+ export { usePOISearch } from "#poi/usePOISearch";
22
+ export type { UsePOISearch, UsePOISearchOptions } from "#poi/usePOISearch";
23
+ //# sourceMappingURL=poi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poi.d.ts","sourceRoot":"","sources":["../lib/poi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,YAAY,EACX,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,UAAU,EACV,cAAc,EACd,cAAc,GACd,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA"}
package/out/poi.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file POI explorer components, hooks, runtime and interfaces.
6
+ */
7
+ export { AbstainPanel } from "./poi/AbstainPanel.js";
8
+ export { LiveResultsBlock } from "./poi/LiveResultsBlock.js";
9
+ export { OverpassBlock } from "./poi/OverpassBlock.js";
10
+ export { POIExplorer } from "./poi/POIExplorer.js";
11
+ export { QueryInput } from "./poi/QueryInput.js";
12
+ export { formatDistance, loadPOIRuntime, POI_DEFAULT_TEXT, POI_PRESETS } from "#poi/runtime";
13
+ export { SubjectPanel } from "./poi/SubjectPanel.js";
14
+ export { usePOISearch } from "#poi/usePOISearch";
15
+ //# sourceMappingURL=poi.js.map
package/out/poi.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poi.js","sourceRoot":"","sources":["../lib/poi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAwB,CAAA;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA4B,CAAA;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAyB,CAAA;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAuB,CAAA;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAsB,CAAA;AAEjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAwB,CAAA;AAmBrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA"}
@@ -2,164 +2,163 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * `useReleaseRuntime` — the headless load-orchestration hook shared by every mailwoman browser surface (the
7
- * inline doc-embeds via `RuntimeEmbed`, and the geocoder). It owns the version-selection state
8
- * machine, the per-version load SEQUENCING, cancellation, and the ready / loading / error state — but
9
- * NOTHING model- or map-specific. The actual asset fetchers (the ONNX classifier factory, the httpvfs
10
- * WOF opener, the FST fetch, the releases.json fetch) are INJECTED by the host as async functions, so
11
- * this module imports only React: no `onnxruntime-web`, no `sql.js-httpvfs`, no `maplibre-gl`, no
12
- * `fetch`-specific plumbing. That keeps it node-import-safe and root-exportable from
13
- * `@mailwoman/react` — the exact interface `PipelineRuntime` established, generalized to the loader itself.
14
- *
15
- * The hook is generic over `TAssets` (the opaque bundle the host's `loadAssets` returns — classifier,
16
- * FST, WOF lookup, calibrator, …) and `TRelease` (the host's release-manifest entry). The package
17
- * never inspects either; it just holds, reveals, and re-loads them across version/backend switches.
18
5
  */
19
6
  /**
20
- * The minimal contract a release-manifest entry must satisfy. Hosts extend this with their own fields.
7
+ * The minimal fields of a release-manifest entry.
8
+ * Hosts can add their own fields.
21
9
  */
22
10
  export interface ReleaseBase {
23
- /**
24
- * The version tag this entry describes (matched against `selectedVersion`).
25
- */
26
11
  version: string;
27
12
  /**
28
- * Optional display label a version picker shows; falls back to `version`.
13
+ * The version picker's display label, falling back to `version`.
29
14
  */
30
15
  label?: string;
31
16
  }
32
17
  /**
33
- * The releases manifest the host fetches — the default version plus the selectable release entries.
18
+ * The releases manifest that the host fetches.
34
19
  */
35
20
  export interface ReleaseManifest<TRelease extends ReleaseBase = ReleaseBase> {
36
21
  /**
37
- * The version selected on first load (before the user picks another).
22
+ * The version that the hook selects when the manifest first loads.
38
23
  */
39
24
  defaultVersion: string;
40
- /**
41
- * Every selectable release.
42
- */
43
25
  releases: TRelease[];
44
26
  }
45
27
  /**
46
- * The progress channel handed to the host's `loadAssets`. The host reports load progress + the resolved backend + the
47
- * staged step labels/index THROUGH these setters (all no-op once the load is superseded/aborted), while the hook owns
48
- * the terminal state (revealing the assets + clearing progress on success, surfacing the error on failure).
28
+ * The abort signal and progress setters that the hook passes to a host's `loadAssets`.
29
+ *
30
+ * The setters stop affecting state after abort or supersession.
31
+ * The hook sets the final ready or error state.
49
32
  */
50
33
  export interface AssetsLoadContext {
51
34
  /**
52
- * Aborts when this load is superseded (version/backend switch) or the provider unmounts.
35
+ * The signal aborts when a version or backend switch supersedes this load or when the component unmounts.
53
36
  */
54
37
  signal: AbortSignal;
55
38
  /**
56
- * Whether the host should force the CPU/WASM backend (opt out of WebGPU) for this load.
39
+ * Whether this load should use the CPU WASM backend instead of WebGPU.
57
40
  */
58
41
  forceWASM: boolean;
59
42
  /**
60
- * Set the human-readable progress line (e.g. `Loading v7 model (~28 MB)…`).
43
+ * Sets the progress line, such as `Loading v7 model (~28 MB)…`.
61
44
  */
62
45
  setProgress: (progress: string) => void;
63
- /**
64
- * Set the staged-loader step labels (e.g. `["Loading classifier", "Loading FST gazetteer"]`).
65
- */
66
46
  setStepLabels: (labels: string[]) => void;
67
47
  /**
68
- * Advance the staged-loader step index (0-based).
48
+ * Sets the zero-based index of the current loader step.
69
49
  */
70
50
  setStepIndex: (index: number) => void;
71
51
  /**
72
- * Report the backend the neural runtime resolved to (e.g. `webgpu (27 MB int8)`).
52
+ * Reports the backend that the neural runtime resolved to, such as `webgpu (27 MB int8)`.
73
53
  */
74
54
  setBackend: (backend: string) => void;
55
+ /**
56
+ * Reports the fraction of the current download received so far, in [0, 1], or `null`
57
+ * when no download is in progress or the response declares no length.
58
+ *
59
+ * The step index cannot show it because the model is fetched before the first step begins.
60
+ */
61
+ setByteFraction: (fraction: number | null) => void;
75
62
  }
76
63
  /**
77
- * The injected loaders the hook orchestrates. Nothing here is model- or map-aware — the host owns all that.
64
+ * The host's manifest loader, asset loader and optional asset disposer for {@link useReleaseRuntime}.
78
65
  */
79
66
  export interface ReleaseRuntimeConfig<TAssets, TRelease extends ReleaseBase = ReleaseBase> {
80
67
  /**
81
- * Fetch + normalize the releases manifest. Returns `null` when no manifest is available (the surface then shows
82
- * nothing selectable). Rejecting surfaces `errorMessage`. Runs once on mount.
68
+ * Fetches the releases manifest once on mount.
69
+ *
70
+ * It returns `null` when the manifest is unavailable.
71
+ * The hook reports a rejection through `errorMessage`.
83
72
  */
84
73
  loadManifest: (signal: AbortSignal) => Promise<ReleaseManifest<TRelease> | null>;
85
74
  /**
86
- * Load the full asset bundle for one release — the classifier, FST, WOF lookup, calibrator, whatever the host needs.
87
- * Runs on every version or `forceWASM` change. Report progress via `ctx`; return the bundle. Rejecting surfaces
88
- * `errorMessage`. Bail early when `ctx.signal.aborted` — the hook discards a superseded result regardless.
75
+ * Loads the asset bundle for one release and reports progress through `ctx`;
76
+ * the hook calls it on every version or `forceWASM` change, reports a rejection through
77
+ * `errorMessage`, and disposes a result that resolves after `ctx.signal` aborts.
89
78
  */
90
79
  loadAssets: (release: TRelease, ctx: AssetsLoadContext) => Promise<TAssets>;
91
80
  /**
92
- * The progress line shown before the manifest arrives. @default "Loading releases…"
81
+ * Releases resources the garbage collector does not own, such as an ONNX
82
+ * session's WASM heap or a GPU buffer.
83
+ *
84
+ * The hook calls it when replacing a bundle.
85
+ * It also calls it if a bundle resolves after abort or when unmounting.
86
+ *
87
+ * Without this function, each reload leaves the model resident.
88
+ */
89
+ disposeAssets?: (assets: TAssets) => void | Promise<void>;
90
+ /**
91
+ * The progress line shown before the manifest arrives.
92
+ * Defaults to `Loading releases…`.
93
93
  */
94
94
  initialProgress?: string;
95
95
  }
96
96
  /**
97
- * The state `useReleaseRuntime` produces — the load-orchestration state a surface renders + re-projects.
97
+ * The release-loading state that {@link useReleaseRuntime} returns.
98
98
  *
99
- * This is the LOADER STATE, deliberately distinct from {@link GeocoderRuntime} (the injected runtime contract
100
- * `<Geocoder>` consumes). A host builds a {@link GeocoderRuntime} by pairing this loader state (assets + backend +
101
- * version) with the map surface (style, overlays, bias, parse) — see the map subpath's `GeocoderRuntime`.
99
+ * A host pairs it with its map surface to build a `GeocoderRuntime`.
102
100
  */
103
101
  export interface ReleaseLoaderState<TAssets, TRelease extends ReleaseBase = ReleaseBase> {
104
102
  /**
105
- * The releases manifest, once fetched.
103
+ * The releases manifest, `null` until it loads or when none is available.
106
104
  */
107
105
  manifest: ReleaseManifest<TRelease> | null;
108
106
  /**
109
- * The currently-selected version, or `null` before the manifest resolves.
107
+ * The selected version, `null` before the manifest loads.
110
108
  */
111
109
  selectedVersion: string | null;
112
110
  /**
113
- * The release entry matching `selectedVersion` (convenience over `manifest.releases.find`).
111
+ * The manifest entry that matches `selectedVersion`, or `null` when none matches.
114
112
  */
115
113
  selectedRelease: TRelease | null;
116
114
  /**
117
- * The loaded asset bundle for the selected version, or `null` while (re)loading.
115
+ * The asset bundle for the selected version, `null` while it loads.
118
116
  */
119
117
  assets: TAssets | null;
120
- /**
121
- * Whether the asset bundle is loaded and ready to use.
122
- */
123
118
  ready: boolean;
124
119
  /**
125
- * Human-readable load progress (`""` when idle/ready).
120
+ * The load progress line, empty once loading finishes or fails.
126
121
  */
127
122
  loadingProgress: string;
128
123
  /**
129
- * Staged-loader step index (0-based; `-1` before the first step).
124
+ * The zero-based loader step index, `-1` before the first step.
130
125
  */
131
126
  loadingStepIndex: number;
127
+ loadingStepLabels: string[];
132
128
  /**
133
- * Staged-loader step labels.
129
+ * The fraction of the current download received so far, in [0, 1], or `null`
130
+ * when no download is in progress or the length is unknown.
134
131
  */
135
- loadingStepLabels: string[];
132
+ loadingByteFraction: number | null;
136
133
  /**
137
- * A load error (manifest or asset), distinct from any per-parse error a consumer tracks separately.
134
+ * A manifest or asset load error, separate from any parse error a consumer tracks.
138
135
  */
139
136
  errorMessage: string | null;
140
137
  /**
141
- * The backend the neural runtime resolved to (e.g. `webgpu (27 MB int8)`), or `""` before it's known.
138
+ * The backend the neural runtime resolved to, such as `webgpu (27 MB int8)`;
139
+ * it is `""` before the backend is known.
142
140
  */
143
141
  activeBackend: string;
144
142
  /**
145
- * Whether the CPU/WASM backend is currently forced.
143
+ * Whether the CPU WASM backend is forced instead of WebGPU.
146
144
  */
147
145
  forceWASM: boolean;
148
146
  /**
149
- * Switch to a different version (clears any error, then reloads the asset bundle).
147
+ * Switches to another version, clearing any error and reloading the asset bundle.
150
148
  */
151
149
  selectVersion: (version: string) => void;
152
150
  /**
153
- * Force (or unforce) the CPU/WASM backend — reloads the asset bundle.
151
+ * Forces or releases the CPU WASM backend.
152
+ * Either change reloads the asset bundle.
154
153
  */
155
154
  setForceWASM: (forceWASM: boolean) => void;
156
155
  }
157
156
  /**
158
- * Drive the shared version → asset-bundle load state machine over a host-injected loader.
157
+ * Loads the release manifest on mount and the selected release's assets whenever
158
+ * the version or `forceWASM` changes.
159
159
  *
160
- * Sequence: on mount `loadManifest` runs and its `defaultVersion` becomes the selection; each version (or `forceWASM`)
161
- * change reloads the bundle via `loadAssets`, the previous load aborted first. The assets are revealed ATOMICALLY when
162
- * `loadAssets` resolves (so `ready` flips exactly once per load), and consumers wait on `ready`.
160
+ * Each reload aborts the previous load and disposes the old assets.
161
+ * `ready` becomes true after the new assets load.
163
162
  */
164
163
  export declare function useReleaseRuntime<TAssets, TRelease extends ReleaseBase = ReleaseBase>(config: ReleaseRuntimeConfig<TAssets, TRelease>): ReleaseLoaderState<TAssets, TRelease>;
165
164
  //# sourceMappingURL=useReleaseRuntime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReleaseRuntime.d.ts","sourceRoot":"","sources":["../../lib/runtime/useReleaseRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAi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