@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
@@ -2,164 +2,153 @@
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 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.
57
- */
58
- forceWASM: boolean;
59
- /**
60
- * Set the human-readable progress line (e.g. `Loading v7 model (~28 MB)…`).
39
+ * Sets the progress line, such as `Loading v7 model (~28 MB)…`.
61
40
  */
62
41
  setProgress: (progress: string) => void;
63
- /**
64
- * Set the staged-loader step labels (e.g. `["Loading classifier", "Loading FST gazetteer"]`).
65
- */
66
42
  setStepLabels: (labels: string[]) => void;
67
43
  /**
68
- * Advance the staged-loader step index (0-based).
44
+ * Sets the zero-based index of the current loader step.
69
45
  */
70
46
  setStepIndex: (index: number) => void;
71
47
  /**
72
- * Report the backend the neural runtime resolved to (e.g. `webgpu (27 MB int8)`).
48
+ * Reports the neural runtime's backend and model size, such as `wasm (27 MB int8)`.
73
49
  */
74
50
  setBackend: (backend: string) => void;
51
+ /**
52
+ * Reports the fraction of the current download received so far, in [0, 1], or `null`
53
+ * when no download is in progress or the response declares no length.
54
+ *
55
+ * The step index cannot show it because the model is fetched before the first step begins.
56
+ */
57
+ setByteFraction: (fraction: number | null) => void;
75
58
  }
76
59
  /**
77
- * The injected loaders the hook orchestrates. Nothing here is model- or map-aware — the host owns all that.
60
+ * The host's manifest loader, asset loader and optional asset disposer for {@link useReleaseRuntime}.
78
61
  */
79
62
  export interface ReleaseRuntimeConfig<TAssets, TRelease extends ReleaseBase = ReleaseBase> {
80
63
  /**
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.
64
+ * Fetches the releases manifest once on mount.
65
+ *
66
+ * It returns `null` when the manifest is unavailable.
67
+ * The hook reports a rejection through `errorMessage`.
83
68
  */
84
69
  loadManifest: (signal: AbortSignal) => Promise<ReleaseManifest<TRelease> | null>;
85
70
  /**
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.
71
+ * Loads the asset bundle for one release and reports progress through `ctx`.
72
+ *
73
+ * The hook calls it on every version change.
74
+ * It reports a rejection through `errorMessage`.
75
+ *
76
+ * It disposes a result that resolves after `ctx.signal` aborts.
89
77
  */
90
78
  loadAssets: (release: TRelease, ctx: AssetsLoadContext) => Promise<TAssets>;
91
79
  /**
92
- * The progress line shown before the manifest arrives. @default "Loading releases…"
80
+ * Releases resources the garbage collector does not own, such as an ONNX
81
+ * session's WASM heap or a GPU buffer.
82
+ *
83
+ * The hook calls it when replacing a bundle.
84
+ * It also calls it if a bundle resolves after abort or when unmounting.
85
+ *
86
+ * Without this function, each reload leaves the model resident.
87
+ */
88
+ disposeAssets?: (assets: TAssets) => void | Promise<void>;
89
+ /**
90
+ * The progress line shown before the manifest arrives.
91
+ *
92
+ * @defaultValue `"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 neural runtime's backend and model size, such as `wasm (27 MB int8)`;
139
+ * it is `""` before the model loads.
142
140
  */
143
141
  activeBackend: string;
144
142
  /**
145
- * Whether the CPU/WASM backend is currently forced.
146
- */
147
- forceWASM: boolean;
148
- /**
149
- * Switch to a different version (clears any error, then reloads the asset bundle).
143
+ * Switches to another version, clearing any error and reloading the asset bundle.
150
144
  */
151
145
  selectVersion: (version: string) => void;
152
- /**
153
- * Force (or unforce) the CPU/WASM backend — reloads the asset bundle.
154
- */
155
- setForceWASM: (forceWASM: boolean) => void;
156
146
  }
157
147
  /**
158
- * Drive the shared version → asset-bundle load state machine over a host-injected loader.
148
+ * Loads the release manifest on mount and the selected release's assets whenever the version changes.
159
149
  *
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`.
150
+ * Each reload aborts the previous load and disposes the old assets.
151
+ * `ready` becomes true after the new assets load.
163
152
  */
164
153
  export declare function useReleaseRuntime<TAssets, TRelease extends ReleaseBase = ReleaseBase>(config: ReleaseRuntimeConfig<TAssets, TRelease>): ReleaseLoaderState<TAssets, TRelease>;
165
154
  //# sourceMappingURL=useReleaseRuntime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReleaseRuntime.d.ts","sourceRoot":"","sources":["../../lib/runtime/useReleaseRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,QAAQ,SAAS,WAAW,GAAG,WAAW;IAC1E;;OAEG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,QAAQ,EAAE,QAAQ,EAAE,CAAA;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,MAAM,EAAE,WAAW,CAAA;IACnB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC;;OAEG;IACH,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACzC;;OAEG;IACH,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC;;OAEG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,OAAO,EAAE,QAAQ,SAAS,WAAW,G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*
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
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
20
7
  /**
21
- * Drive the shared version → asset-bundle load state machine over a host-injected loader.
8
+ * Loads the release manifest on mount and the selected release's assets whenever the version changes.
22
9
  *
23
- * Sequence: on mount `loadManifest` runs and its `defaultVersion` becomes the selection; each version (or `forceWASM`)
24
- * change reloads the bundle via `loadAssets`, the previous load aborted first. The assets are revealed ATOMICALLY when
25
- * `loadAssets` resolves (so `ready` flips exactly once per load), and consumers wait on `ready`.
10
+ * Each reload aborts the previous load and disposes the old assets.
11
+ * `ready` becomes true after the new assets load.
26
12
  */
27
13
  export function useReleaseRuntime(config) {
28
14
  const { initialProgress = "Loading releases…" } = config;
@@ -34,21 +20,18 @@ export function useReleaseRuntime(config) {
34
20
  const [loadingStepLabels, setLoadingStepLabels] = useState([]);
35
21
  const [errorMessage, setErrorMessage] = useState(null);
36
22
  const [activeBackend, setActiveBackend] = useState("");
37
- const [forceWASM, setForceWASMState] = useState(false);
38
- // Latest-ref the injected loaders: a host that re-creates them each render (an inline arrow) must NOT retrigger the
39
- // load effects, which key ONLY on version/backend. The effects read `.current` at run time.
23
+ const [loadingByteFraction, setLoadingByteFraction] = useState(null);
40
24
  const loadManifestRef = useRef(config.loadManifest);
41
25
  const loadAssetsRef = useRef(config.loadAssets);
42
- // Latest manifest for the version-load effect, so it can resolve the release WITHOUT depending on `manifest`
43
- // identity — which would double-fire the load the instant the manifest first arrives (the selection transition
44
- // null → defaultVersion already fires it once).
26
+ const disposeAssetsRef = useRef(config.disposeAssets);
27
+ const liveAssetsRef = useRef(null);
45
28
  const manifestRef = useRef(null);
46
29
  useEffect(() => {
47
30
  loadManifestRef.current = config.loadManifest;
48
31
  loadAssetsRef.current = config.loadAssets;
32
+ disposeAssetsRef.current = config.disposeAssets;
49
33
  manifestRef.current = manifest;
50
- }, [config.loadAssets, config.loadManifest, manifest]);
51
- // Mount: fetch the manifest, then select the default version.
34
+ }, [config.disposeAssets, config.loadAssets, config.loadManifest, manifest]);
52
35
  useEffect(() => {
53
36
  const controller = new AbortController();
54
37
  void (async () => {
@@ -69,7 +52,6 @@ export function useReleaseRuntime(config) {
69
52
  })();
70
53
  return () => controller.abort();
71
54
  }, []);
72
- // Load the per-version asset bundle when the version (or the backend force) changes.
73
55
  useEffect(() => {
74
56
  if (!selectedVersion)
75
57
  return;
@@ -85,23 +67,33 @@ export function useReleaseRuntime(config) {
85
67
  };
86
68
  void (async () => {
87
69
  try {
70
+ const outgoing = liveAssetsRef.current;
71
+ liveAssetsRef.current = null;
72
+ if (outgoing) {
73
+ await disposeAssetsRef.current?.(outgoing);
74
+ }
88
75
  setAssets(null);
89
76
  setLoadingStepIndex(-1);
90
77
  setLoadingStepLabels([]);
91
78
  setActiveBackend("");
79
+ setLoadingByteFraction(null);
92
80
  const ctx = {
93
81
  signal,
94
- forceWASM,
95
82
  setProgress: (progress) => guard(() => setLoadingProgress(progress)),
96
83
  setStepLabels: (labels) => guard(() => setLoadingStepLabels(labels)),
97
84
  setStepIndex: (index) => guard(() => setLoadingStepIndex(index)),
98
85
  setBackend: (backend) => guard(() => setActiveBackend(backend)),
86
+ setByteFraction: (fraction) => guard(() => setLoadingByteFraction(fraction)),
99
87
  };
100
88
  const loaded = await loadAssetsRef.current(release, ctx);
101
- if (signal.aborted)
89
+ if (signal.aborted) {
90
+ await disposeAssetsRef.current?.(loaded);
102
91
  return;
92
+ }
93
+ liveAssetsRef.current = loaded;
103
94
  setAssets(loaded);
104
95
  setLoadingProgress("");
96
+ setLoadingByteFraction(null);
105
97
  }
106
98
  catch (error) {
107
99
  if (signal.aborted)
@@ -111,12 +103,20 @@ export function useReleaseRuntime(config) {
111
103
  }
112
104
  })();
113
105
  return () => controller.abort();
114
- }, [selectedVersion, forceWASM]);
106
+ }, [selectedVersion]);
107
+ useEffect(() => {
108
+ return () => {
109
+ const live = liveAssetsRef.current;
110
+ liveAssetsRef.current = null;
111
+ if (live) {
112
+ void disposeAssetsRef.current?.(live);
113
+ }
114
+ };
115
+ }, []);
115
116
  const selectVersion = useCallback((version) => {
116
117
  setSelectedVersion(version);
117
118
  setErrorMessage(null);
118
119
  }, []);
119
- const setForceWASM = useCallback((next) => setForceWASMState(next), []);
120
120
  const selectedRelease = useMemo(() => manifest?.releases.find((r) => r.version === selectedVersion) ?? null, [manifest, selectedVersion]);
121
121
  return {
122
122
  manifest,
@@ -127,11 +127,10 @@ export function useReleaseRuntime(config) {
127
127
  loadingProgress,
128
128
  loadingStepIndex,
129
129
  loadingStepLabels,
130
+ loadingByteFraction,
130
131
  errorMessage,
131
132
  activeBackend,
132
- forceWASM,
133
133
  selectVersion,
134
- setForceWASM,
135
134
  };
136
135
  }
137
136
  //# sourceMappingURL=useReleaseRuntime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReleaseRuntime.js","sourceRoot":"","sources":["../../lib/runtime/useReleaseRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE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AAG,IAAI,CAAA;YAE5B,IAAI,IAAI,EAAE,CAAC;gBACV,KAAK,gBAAgB,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAA;YACtC,CAAC;QACF,CAAC,CAAA;IACF,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,aAAa,GAAG,WAAW,CAAC,CAAC,OAAe,EAAE,EAAE;QACrD,kBAAkB,CAAC,OAAO,CAAC,CAAA;QAC3B,eAAe,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,eAAe,GAAG,OAAO,CAC9B,GAAG,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,eAAe,CAAC,IAAI,IAAI,EAC3E,CAAC,QAAQ,EAAE,eAAe,CAAC,CAC3B,CAAA;IAED,OAAO;QACN,QAAQ;QACR,eAAe;QACf,eAAe;QACf,MAAM;QACN,KAAK,EAAE,MAAM,KAAK,IAAI;QACtB,eAAe;QACf,gBAAgB;QAChB,iBAAiB;QACjB,mBAAmB;QACnB,YAAY;QACZ,aAAa;QACb,aAAa;KACb,CAAA;AACF,CAAC"}
@@ -6,4 +6,4 @@
6
6
  */
7
7
  export { useReleaseRuntime } from "#runtime/useReleaseRuntime";
8
8
  export type { AssetsLoadContext, ReleaseBase, ReleaseLoaderState, ReleaseManifest, ReleaseRuntimeConfig, } from "#runtime/useReleaseRuntime";
9
- //# sourceMappingURL=index.d.ts.map
9
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../lib/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAE9D,YAAY,EACX,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,oBAAoB,GACpB,MAAM,4BAA4B,CAAA"}
@@ -5,4 +5,4 @@
5
5
  * @file Node-safe release-runtime exports.
6
6
  */
7
7
  export { useReleaseRuntime } from "#runtime/useReleaseRuntime";
8
- //# sourceMappingURL=index.js.map
8
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../lib/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The docs search modal. A native `<dialog>` opened with `showModal()` supplies the focus trap, the inert
7
+ * background, the backdrop, the close on Escape and the return of focus to the opener. The query field is an
8
+ * `<input type="search">` with the ARIA combobox role. DOM focus stays on the input, and
9
+ * `aria-activedescendant` identifies the selected hit. The component owns no data access: `search` is
10
+ * passed in. Recent queries are a per-viewer convenience in `localStorage`; the modal renders the same
11
+ * without them.
12
+ */
13
+ import type { SearchHit, SearchResponse } from "./types.ts";
14
+ export interface SearchModalProps {
15
+ open: boolean;
16
+ onClose: () => void;
17
+ /**
18
+ * Called with the hit's site-relative link on Enter or on an unmodified click.
19
+ * Absent, the link navigates as an ordinary anchor.
20
+ */
21
+ onNavigate?: (href: string) => void;
22
+ /**
23
+ * Runs the query.
24
+ *
25
+ * The function must keep a stable identity across renders (for example through `useCallback`),
26
+ * because a new identity refires the request for the current query.
27
+ */
28
+ search: (q: string, signal: AbortSignal) => Promise<SearchResponse>;
29
+ /**
30
+ * The `localStorage` key under which recent queries are kept.
31
+ * Absent, recent queries are not kept.
32
+ */
33
+ recentKey?: string;
34
+ }
35
+ /**
36
+ * The site-relative link for a hit.
37
+ */
38
+ export declare function hitHref(hit: Pick<SearchHit, "url" | "anchor">): string;
39
+ export declare function SearchModal({ open, onClose, onNavigate, search, recentKey }: SearchModalProps): import("react").JSX.Element;
40
+ //# sourceMappingURL=SearchModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchModal.d.ts","sourceRoot":"","sources":["../../lib/search/SearchModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3D,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC;;;;;OAKG;IACH,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,cAAc,CAAC,CAAA;IACnE;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAkBD;;GAEG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAC,GAAG,MAAM,CAEtE;AA6GD,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,gBAAgB,+BAiT7F"}