@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
@@ -3,24 +3,17 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * `useClipboard` — headless copy-to-clipboard with the async Clipboard API and a legacy
7
- * `execCommand` fallback (for insecure contexts / older browsers), plus a transient "copied" flag
8
- * that auto-resets. Extracted from the two explorers' duplicated `onCopy` handlers.
6
+ * `useClipboard` — headless copy-to-clipboard with the async Clipboard API and a legacy `execCommand` fallback for insecure contexts, plus a transient "copied" flag that auto-resets.
9
7
  */
10
8
 
11
9
  import { useCallback, useEffect, useRef, useState } from "react"
12
10
 
13
- /**
14
- * Best-effort clipboard write: async Clipboard API first, hidden-textarea `execCommand` fallback.
15
- */
16
11
  async function writeToClipboard(value: string): Promise<void> {
17
12
  try {
18
13
  await navigator.clipboard.writeText(value)
19
14
 
20
15
  return
21
- } catch {
22
- // Fall through to the legacy path below.
23
- }
16
+ } catch {}
24
17
 
25
18
  const textarea = document.createElement("textarea")
26
19
  textarea.value = value
@@ -32,7 +25,6 @@ async function writeToClipboard(value: string): Promise<void> {
32
25
  try {
33
26
  document.execCommand("copy")
34
27
  } catch {
35
- // Nothing else to try — leave `copied` false via the caller's error path.
36
28
  } finally {
37
29
  document.body.removeChild(textarea)
38
30
  }
@@ -50,7 +42,6 @@ export function useClipboard(resetMs = 1500): UseClipboard {
50
42
  const [copied, setCopied] = useState(false)
51
43
  const timer = useRef<ReturnType<typeof setTimeout> | null>(null)
52
44
 
53
- // Clear a pending reset timer on unmount so it never fires against a torn-down component.
54
45
  useEffect(
55
46
  () => () => {
56
47
  if (timer.current) {
package/lib/common.ts ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Common React primitives.
6
+ */
7
+
8
+ export { ClientOnly } from "./common/ClientOnly.tsx"
9
+ export type { ClientOnlyProps } from "./common/ClientOnly.tsx"
10
+ export { CopyButton } from "./common/CopyButton.tsx"
11
+ export type { CopyButtonProps } from "./common/CopyButton.tsx"
12
+ export { cx } from "#common/cx"
13
+ export type { ClassValue } from "#common/cx"
14
+ export { KindBadge } from "./common/KindBadge.tsx"
15
+ export type { KindBadgeProps } from "./common/KindBadge.tsx"
16
+ export { LoadingIndicator } from "./common/LoadingIndicator.tsx"
17
+ export type { LoadingIndicatorProps, LoadingMode } from "./common/LoadingIndicator.tsx"
18
+ export { PresetChips } from "./common/PresetChips.tsx"
19
+ export type { Preset, PresetChipsProps } from "./common/PresetChips.tsx"
20
+ export { useClipboard } from "#common/useClipboard"
21
+ export type { UseClipboard } from "#common/useClipboard"
22
+ export { useDebouncedValue } from "#common/useDebouncedValue"
package/lib/index.ts CHANGED
@@ -2,120 +2,35 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * `@mailwoman/react` — React components + headless hooks for mailwoman.
7
- *
8
- * Two composed explorers plus the small presentational units and headless hooks they decompose into:
9
- *
10
- * - `POIExplorer` — a self-contained POI-intent tester (classify → subject → OverpassQL), with an
11
- * optional injected live poi.db search. No weights, no network on the intent path.
12
- * - `PipelineExplorer` — a parse+resolve tester driven by an INJECTED `PipelineRuntime`, so the
13
- * model/gazetteer plumbing (ONNX, httpvfs, node builtins) stays in the host, never in this graph.
14
- *
15
- * Styling ships separately as `@mailwoman/react/styles.css` (plain, `mw-`-prefixed, Infima-token
16
- * aware) — no CSS is imported by the component modules, so the bare package import is node-safe.
17
5
  */
18
6
 
19
- // ── Common primitives ──────────────────────────────────────────────────────
20
- export { ClientOnly } from "./common/ClientOnly.tsx"
21
- export type { ClientOnlyProps } from "./common/ClientOnly.tsx"
22
- export { CopyButton } from "./common/CopyButton.tsx"
23
- export type { CopyButtonProps } from "./common/CopyButton.tsx"
24
- export { cx } from "#common/cx"
25
- export type { ClassValue } from "#common/cx"
26
- export { KindBadge } from "./common/KindBadge.tsx"
27
- export type { KindBadgeProps } from "./common/KindBadge.tsx"
28
- export { LoadingIndicator } from "./common/LoadingIndicator.tsx"
29
- export type { LoadingIndicatorProps, LoadingMode } from "./common/LoadingIndicator.tsx"
30
- export { PresetChips } from "./common/PresetChips.tsx"
31
- export type { Preset, PresetChipsProps } from "./common/PresetChips.tsx"
32
- export { useClipboard } from "#common/useClipboard"
33
- export type { UseClipboard } from "#common/useClipboard"
34
- export { useDebouncedValue } from "#common/useDebouncedValue"
35
-
36
- // ── POI explorer ───────────────────────────────────────────────────────────
37
- export { AbstainPanel } from "./poi/AbstainPanel.tsx"
38
- export type { AbstainPanelProps } from "./poi/AbstainPanel.tsx"
39
- export { LiveResultsBlock } from "./poi/LiveResultsBlock.tsx"
40
- export type { LiveResultsBlockProps } from "./poi/LiveResultsBlock.tsx"
41
- export { OverpassBlock } from "./poi/OverpassBlock.tsx"
42
- export type { OverpassBlockProps } from "./poi/OverpassBlock.tsx"
43
- export { POIExplorer } from "./poi/POIExplorer.tsx"
44
- export type { POIExplorerProps } from "./poi/POIExplorer.tsx"
45
- export { QueryInput } from "./poi/QueryInput.tsx"
46
- export type { QueryInputProps } from "./poi/QueryInput.tsx"
47
- export { formatDistance, loadPOIRuntime, POI_DEFAULT_TEXT, POI_PRESETS } from "#poi/runtime"
48
- export { SubjectPanel } from "./poi/SubjectPanel.tsx"
49
- export type { SubjectPanelProps } from "./poi/SubjectPanel.tsx"
50
-
51
- export type {
52
- CategoryRecord,
53
- LiveSearchState,
54
- LoadPOIRuntime,
55
- POIBrandSubject,
56
- POICategorySubject,
57
- POIExplorerResult,
58
- POILiveSearch,
59
- POILiveSearchResult,
60
- POIRuntime,
61
- POISearchHit,
62
- POISubject,
63
- POISubjectBase,
64
- TaxonomyLookup,
65
- } from "#poi/types"
66
-
67
- export { usePOISearch } from "#poi/usePOISearch"
68
- export type { UsePOISearch, UsePOISearchOptions } from "#poi/usePOISearch"
69
-
70
- // ── Result visualizers ─────────────────────────────────────────────────────
71
-
72
- export { About } from "./common/About.tsx"
73
- export { FailureDiagnostic } from "./pipeline/FailureDiagnostic.tsx"
74
- export type { FailureDiagnosticProps } from "./pipeline/FailureDiagnostic.tsx"
75
- export { SpanHighlight } from "./pipeline/SpanHighlight.tsx"
76
- export type { SpanHighlightProps } from "./pipeline/SpanHighlight.tsx"
77
- export { TimingPanel } from "./pipeline/TimingPanel.tsx"
78
- export type { TimingPanelProps } from "./pipeline/TimingPanel.tsx"
79
- export { TreeView } from "./pipeline/TreeView.tsx"
80
- export type { TreeViewProps } from "./pipeline/TreeView.tsx"
81
-
82
- // ── Pipeline explorer ──────────────────────────────────────────────────────
83
- export { CandidatePicker } from "./pipeline/CandidatePicker.tsx"
84
- export type { CandidatePickerProps } from "./pipeline/CandidatePicker.tsx"
85
- export { ComponentTable } from "./pipeline/ComponentTable.tsx"
86
- export type { ComponentTableProps } from "./pipeline/ComponentTable.tsx"
87
- export { ConfidenceCell } from "./pipeline/ConfidenceCell.tsx"
88
- export type { ConfidenceCellProps } from "./pipeline/ConfidenceCell.tsx"
89
- export { buildParsePayload } from "#pipeline/copy"
90
- export { PIPELINE_DEFAULT_ADDRESS, PIPELINE_PRESETS } from "#pipeline/presets"
91
- export { PipelineExplorer } from "./pipeline/PipelineExplorer.tsx"
92
- export type { PipelineExplorerProps } from "./pipeline/PipelineExplorer.tsx"
93
- export { QueryForm } from "./pipeline/QueryForm.tsx"
94
- export type { QueryFormProps } from "./pipeline/QueryForm.tsx"
95
- export { ResolvedPlace } from "./pipeline/ResolvedPlace.tsx"
96
- export type { ResolvedPlaceProps } from "./pipeline/ResolvedPlace.tsx"
97
-
98
- export type { PipelineLoadingState, PipelinePanels, PipelineRuntime } from "#pipeline/types"
99
-
100
- export { useParsePipeline } from "#pipeline/useParsePipeline"
101
- export type { UseParsePipeline, UseParsePipelineOptions } from "#pipeline/useParsePipeline"
102
-
103
- // ── Release runtime (shared load orchestration; node-safe — no onnx/httpvfs/maplibre) ──
104
- export { useReleaseRuntime } from "#runtime/useReleaseRuntime"
105
-
106
- export type {
107
- AssetsLoadContext,
108
- ReleaseBase,
109
- ReleaseLoaderState,
110
- ReleaseManifest,
111
- ReleaseRuntimeConfig,
112
- } from "#runtime/useReleaseRuntime"
7
+ /**
8
+ * Re-exports the shared presentational components and hooks that both explorers are built from.
9
+ *
10
+ * No module in the root graph imports CSS, so the bare package import is Node-safe
11
+ * and hosts load `@mailwoman/react/styles.css` themselves.
12
+ */
13
+ export * from "#common"
14
+ /**
15
+ * Re-exports `POIExplorer`, a POI-intent tester that needs no weights or network, with its related exports.
16
+ */
17
+ export * from "#poi"
18
+ /**
19
+ * Re-exports `PipelineExplorer`, a parse-and-resolve tester with model
20
+ * and gazetteer access injected by the host.
21
+ * It also exports the explorer's related declarations.
22
+ */
23
+ export * from "#pipeline"
24
+ /**
25
+ * Re-exports `useReleaseRuntime`, the Node-safe hook that loads a release manifest
26
+ * and each selected version's assets through a host-injected loader.
27
+ */
28
+ export * from "#runtime"
113
29
 
114
- // ── Map (types only from root) ──────────────────────────────────────────────
115
- // The map SURFACE lives behind the `@mailwoman/react/map` subpath so `maplibre-gl` / `react-map-gl`
116
- // (WebGL + DOM at import) never enter the package-root graph — a bare `import("@mailwoman/react")` in node
117
- // must not pull them. Only the CONTRACT types are re-exported here (fully erased at compile time, so no
118
- // runtime linkage): the `MapCanvas` component + hooks are import-able solely via `@mailwoman/react/map`.
30
+ /**
31
+ * Re-exports the map surface's types only, because its runtime lives behind the
32
+ * `@mailwoman/react/map` subpath so that MapLibre stays out of the root import graph.
33
+ */
119
34
  export type {
120
35
  GeocoderRuntime,
121
36
  InferenceBackend,
@@ -127,4 +42,4 @@ export type {
127
42
  OverlaySpec,
128
43
  Suggestion,
129
44
  VersionOption,
130
- } from "#map/index"
45
+ } from "#map"
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Renders the footer identity with the app name, an optional documentation link and the build
7
+ * commit. This component does not depend on the map.
8
+ */
9
+
10
+ import type { ReactNode } from "react"
11
+
12
+ import { useBuildInfo } from "#common/useBuildInfo"
13
+
14
+ /**
15
+ * The number of commit characters shown in the footer.
16
+ */
17
+ const DISPLAYED_LENGTH = 6
18
+
19
+ /**
20
+ * Props for {@link AppIdentity}.
21
+ */
22
+ export interface AppIdentityProps {
23
+ /**
24
+ * The app's display name, such as `Mailwoman Earth`.
25
+ */
26
+ name: ReactNode
27
+ /**
28
+ * The documentation link's target.
29
+ * The link is omitted when this is unset.
30
+ */
31
+ docsURL?: string
32
+ /**
33
+ * The documentation link's text. @default "Developer Documentation"
34
+ */
35
+ docsLabel?: string
36
+ /**
37
+ * The URL of the build record. @default "/build.json"
38
+ */
39
+ buildInfoURL?: string
40
+ /**
41
+ * Builds the commit link.
42
+ * Without it, the commit is shown as plain text.
43
+ */
44
+ commitHref?: (commit: string) => string
45
+ }
46
+
47
+ /**
48
+ * Renders the app name, documentation link and short build commit.
49
+ * The commit is omitted when no build record loads.
50
+ */
51
+ export function AppIdentity({
52
+ name,
53
+ docsURL,
54
+ docsLabel = "Developer Documentation",
55
+ buildInfoURL,
56
+ commitHref,
57
+ }: AppIdentityProps): ReactNode {
58
+ const build = useBuildInfo(buildInfoURL)
59
+ const commit = build?.commit
60
+
61
+ return (
62
+ <>
63
+ <strong>{name}</strong>
64
+ {docsURL ? (
65
+ <>
66
+ {" "}
67
+ <a href={docsURL}>{docsLabel}</a>
68
+ </>
69
+ ) : null}
70
+ {commit ? (
71
+ <>
72
+ {" ("}
73
+ {commitHref ? (
74
+ <a href={commitHref(commit)} title={`Built from ${commit}`}>
75
+ <code>{commit.slice(0, DISPLAYED_LENGTH)}</code>
76
+ </a>
77
+ ) : (
78
+ <code title={`Built from ${commit}`}>{commit.slice(0, DISPLAYED_LENGTH)}</code>
79
+ )}
80
+ {")"}
81
+ </>
82
+ ) : null}
83
+ </>
84
+ )
85
+ }
@@ -3,44 +3,47 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * `<BackendControl>` — the neural-backend indicator + "Force WASM" checkbox from the demo's control
7
- * panel (`_app.tsx:1255-1280`), as a dumb presentational unit. It shows which backend the runtime
8
- * resolved to (WebGPU / WASM, with the int8 size the host formats into the label) and lets the visitor
9
- * opt out of WebGPU. Props in, one boolean event out — the host re-loads the bundle on the toggle.
10
- *
11
- * NODE-SAFE: pure React, no maplibre.
6
+ * Shows the active inference backend and a checkbox that forces WASM. The host applies the change.
12
7
  */
13
8
 
14
9
  import type { ReactNode } from "react"
15
10
 
11
+ /**
12
+ * Props for {@link BackendControl}.
13
+ */
16
14
  export interface BackendControlProps {
17
15
  /**
18
- * The backend the runtime resolved to (e.g. `webgpu (28 MB int8)`); empty before it is known.
16
+ * The backend the runtime chose, such as `webgpu (28 MB int8)`.
17
+ * It is empty until known.
19
18
  */
20
19
  activeBackend?: string
21
20
  /**
22
- * Whether the CPU/WASM backend is currently forced.
21
+ * Whether the WASM backend is forced.
23
22
  */
24
23
  forceWASM: boolean
25
24
  /**
26
- * Fired when the visitor toggles the "Force WASM" checkbox.
25
+ * Called when the visitor toggles the "Force WASM" checkbox.
27
26
  */
28
27
  onForceWASMChange: (forceWASM: boolean) => void
29
28
  }
30
29
 
31
30
  /**
32
- * The backend indicator + WASM opt-out.
31
+ * Renders the backend indicator and the "Force WASM" checkbox.
33
32
  */
34
33
  export function BackendControl({ activeBackend, forceWASM, onForceWASMChange }: BackendControlProps): ReactNode {
35
34
  return (
36
35
  <div className="mw-demo-backend">
36
+ <span className="mw-map-sheet__label">Inference backend</span>
37
+
37
38
  {activeBackend ? (
38
39
  <span className="mw-demo-backend__active">
39
- Backend: <code>{activeBackend}</code>
40
+ Running on <code>{activeBackend}</code>
40
41
  </span>
41
42
  ) : null}
42
- <label className="mw-demo-backend__toggle">
43
- <input type="checkbox" checked={forceWASM} onChange={(e) => onForceWASMChange(e.target.checked)} /> Force WASM
43
+
44
+ <label className="mw-map-sheet__check mw-demo-backend__toggle">
45
+ <input type="checkbox" checked={forceWASM} onChange={(event) => onForceWASMChange(event.target.checked)} />
46
+ Force WASM
44
47
  </label>
45
48
  </div>
46
49
  )
@@ -3,55 +3,32 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * `<CompareToggle>` — the "Compare" checkbox plus the compare-version `<select>` from the demo's
7
- * control panel (`_app.tsx:1281-1339`), as a dumb presentational unit. Turning it on reveals a second
8
- * version picker (the primary version filtered out); the actual second parse is a host concern the
9
- * composed demo surfaces through `panels.compare`. Props in, two events out.
10
- *
11
- * NODE-SAFE: pure React, no maplibre.
6
+ * Renders a compare-mode checkbox and a selector for the second model version, leaving the comparison itself to the host.
12
7
  */
13
8
 
14
9
  import type { ReactNode } from "react"
15
10
 
16
11
  import type { VersionOption } from "#map/types"
17
12
 
13
+ /**
14
+ * Props for {@link CompareToggle}.
15
+ */
18
16
  export interface CompareToggleProps {
19
- /**
20
- * The selectable model bundles (the primary version is filtered out of the compare list).
21
- */
22
17
  versions: ReadonlyArray<VersionOption>
23
- /**
24
- * The primary version, excluded from the compare options.
25
- */
26
18
  primaryVersion: string | null
27
- /**
28
- * Whether compare mode is on.
29
- */
30
19
  compareMode: boolean
31
- /**
32
- * Fired when the visitor flips compare mode.
33
- */
34
20
  onCompareModeChange: (compareMode: boolean) => void
35
- /**
36
- * The version chosen to compare against, or `null` when none is chosen.
37
- */
38
21
  compareVersion: string | null
39
- /**
40
- * Fired with the chosen compare version (or `null` when the empty option is picked).
41
- */
42
22
  onCompareVersionChange: (version: string | null) => void
43
- /**
44
- * Disable the compare-version select (e.g. while a parse or compare load runs).
45
- */
46
23
  disabled?: boolean
47
- /**
48
- * A status line rendered under the select (e.g. the compare backend, or a "Loading…" line).
49
- */
50
24
  status?: ReactNode
51
25
  }
52
26
 
53
27
  /**
54
- * The compare toggle + (when on) the compare-version selector. Renders `null` with fewer than two versions.
28
+ * Renders the compare checkbox.
29
+ *
30
+ * In compare mode, it also renders the version selector. and no control at all
31
+ * when fewer than two versions exist.
55
32
  */
56
33
  export function CompareToggle({
57
34
  versions,
@@ -69,8 +46,9 @@ export function CompareToggle({
69
46
 
70
47
  return (
71
48
  <div className="mw-demo-compare">
72
- <label className="mw-demo-compare__toggle">
73
- <input type="checkbox" checked={compareMode} onChange={(e) => onCompareModeChange(e.target.checked)} /> Compare
49
+ <label className="mw-map-sheet__check mw-demo-compare__toggle">
50
+ <input type="checkbox" checked={compareMode} onChange={(event) => onCompareModeChange(event.target.checked)} />
51
+ Compare two model versions
74
52
  </label>
75
53
  {compareMode ? (
76
54
  <div className="mw-demo-control">
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Display and log build, model and runtime details for bug reports.
7
+ * Report the actual execution backend because successful loading does not imply WebGPU ran.
8
+ */
9
+
10
+ import { type ReactNode, useEffect, useMemo } from "react"
11
+
12
+ import { useBuildInfo } from "#common/useBuildInfo"
13
+
14
+ export interface DebugInfoProps {
15
+ /**
16
+ * The backend the runtime resolved to (e.g. `webgpu (28 MB int8)`); empty before it is known.
17
+ */
18
+ activeBackend?: string
19
+ /**
20
+ * Whether the CPU/wasm backend is currently forced.
21
+ *
22
+ * This explains a `wasm` backend that would otherwise indicate a WebGPU failure.
23
+ */
24
+ forceWASM?: boolean
25
+ /**
26
+ * The model version the runtime loaded.
27
+ *
28
+ * The training series.
29
+ * It differs from the npm version.
30
+ */
31
+ selectedVersion?: string | null
32
+ /**
33
+ * Whether the asset bundle finished loading.
34
+ */
35
+ ready?: boolean
36
+ }
37
+
38
+ /**
39
+ * One row of the record, as a label and a value.
40
+ */
41
+ function Row({ label, value }: { label: string; value: string }): ReactNode {
42
+ return (
43
+ <div className="mw-debug-info__row">
44
+ <span className="mw-debug-info__label">{label}</span>
45
+ <code className="mw-debug-info__value">{value}</code>
46
+ </div>
47
+ )
48
+ }
49
+
50
+ export function DebugInfo({ activeBackend, forceWASM, selectedVersion, ready }: DebugInfoProps): ReactNode {
51
+ const build = useBuildInfo()
52
+
53
+ // Memoized on the primitives it reads, so the log below fires when a value changes
54
+ // rather than on every render.
55
+ // A record rebuilt each render would be a new object each time and log continuously.
56
+ const record = useMemo(
57
+ () => ({
58
+ app: build?.app ?? "—",
59
+ commit: build?.commit ?? build?.revision ?? "—",
60
+ buildTime: build?.buildTime ?? "—",
61
+ model: selectedVersion ?? "—",
62
+ backend: activeBackend || (ready ? "unknown" : "loading…"),
63
+ forceWASM: Boolean(forceWASM),
64
+ webgpuInBrowser: typeof navigator !== "undefined" && "gpu" in navigator,
65
+ userAgent: typeof navigator !== "undefined" ? navigator.userAgent : "—",
66
+ }),
67
+ [build?.app, build?.commit, build?.revision, build?.buildTime, selectedVersion, activeBackend, forceWASM, ready]
68
+ )
69
+
70
+ useEffect(() => {
71
+ // eslint-disable-next-line no-console -- this is the feature: the record has to reach the console a reporter copies.
72
+ console.info("[mailwoman] debug info", record)
73
+ }, [record])
74
+
75
+ return (
76
+ <div className="mw-debug-info">
77
+ <Row label="Build" value={record.app} />
78
+ <Row label="Commit" value={record.commit.slice(0, 12)} />
79
+ <Row label="Built" value={record.buildTime} />
80
+ <Row label="Model" value={record.model} />
81
+ <Row label="Backend" value={record.backend} />
82
+ {/* A browser with no WebGPU at all explains a `wasm` backend that is otherwise indistinguishable from a
83
+ WebGPU session that threw. */}
84
+ <Row label="WebGPU available" value={record.webgpuInBrowser ? "yes" : "no"} />
85
+ <Row label="Force WASM" value={record.forceWASM ? "on" : "off"} />
86
+ </div>
87
+ )
88
+ }