@mailwoman/react 9.3.0 → 10.0.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 (246) hide show
  1. package/fonts.css +59 -0
  2. package/lib/common/About.tsx +105 -0
  3. package/lib/common/KindBadge.tsx +2 -7
  4. package/lib/common/confidence-tiers.ts +50 -0
  5. package/lib/common/index.ts +22 -0
  6. package/lib/common/text-tokens.ts +88 -0
  7. package/lib/index.ts +10 -103
  8. package/lib/map/BackendControl.tsx +7 -3
  9. package/lib/map/CompareToggle.tsx +5 -4
  10. package/lib/map/{GeocoderDemo.tsx → Geocoder.tsx} +81 -61
  11. package/lib/map/GeocoderControls.tsx +352 -0
  12. package/lib/map/{DemoMap.tsx → MapCanvas.tsx} +15 -15
  13. package/lib/map/MapChipRow.tsx +77 -0
  14. package/lib/map/MapCompass.tsx +77 -0
  15. package/lib/map/MapControlStack.tsx +98 -0
  16. package/lib/map/MapFooter.tsx +115 -0
  17. package/lib/map/MapProgressBar.tsx +58 -0
  18. package/lib/map/MapSearchBar.tsx +68 -0
  19. package/lib/map/MapSheet.tsx +62 -0
  20. package/lib/map/PlaceMarker.tsx +1 -1
  21. package/lib/map/ResolvedPlaceLayers.tsx +3 -3
  22. package/lib/map/ResultCamera.tsx +1 -1
  23. package/lib/map/ResultPanel.tsx +2 -2
  24. package/lib/map/VersionPicker.tsx +3 -3
  25. package/lib/map/fake-runtime.ts +122 -0
  26. package/lib/map/index.ts +35 -16
  27. package/lib/map/map-debug.ts +51 -0
  28. package/lib/map/place-render.ts +3 -2
  29. package/lib/map/types.ts +58 -42
  30. package/lib/map/{useDemoGeocode.ts → useGeocode.ts} +8 -8
  31. package/lib/map/useMapBearing.ts +56 -0
  32. package/lib/map/useMapLabelPick.ts +123 -0
  33. package/lib/pipeline/CandidatePicker.tsx +1 -1
  34. package/lib/pipeline/ComponentTable.tsx +1 -2
  35. package/lib/pipeline/ConfidenceCell.tsx +7 -19
  36. package/lib/pipeline/FailureDiagnostic.tsx +56 -0
  37. package/lib/pipeline/ResolvedPlace.tsx +17 -4
  38. package/lib/pipeline/SpanHighlight.tsx +97 -0
  39. package/lib/pipeline/TimingPanel.tsx +65 -0
  40. package/lib/pipeline/TreeView.tsx +55 -0
  41. package/lib/pipeline/copy.ts +1 -1
  42. package/lib/pipeline/index.ts +36 -0
  43. package/lib/pipeline/types.ts +2 -75
  44. package/lib/pipeline/useParsePipeline.ts +31 -19
  45. package/lib/poi/index.ts +39 -0
  46. package/lib/poi/types.ts +2 -1
  47. package/lib/runtime/index.ts +16 -0
  48. package/lib/runtime/{useDemoRuntime.ts → useReleaseRuntime.ts} +22 -24
  49. package/out/common/About.d.ts +21 -0
  50. package/out/common/About.d.ts.map +1 -0
  51. package/out/common/About.js +8 -0
  52. package/out/common/About.js.map +1 -0
  53. package/out/common/KindBadge.d.ts +2 -9
  54. package/out/common/KindBadge.d.ts.map +1 -1
  55. package/out/common/KindBadge.js.map +1 -1
  56. package/out/common/confidence-tiers.d.ts +36 -0
  57. package/out/common/confidence-tiers.d.ts.map +1 -0
  58. package/out/common/confidence-tiers.js +42 -0
  59. package/out/common/confidence-tiers.js.map +1 -0
  60. package/out/common/index.d.ts +22 -0
  61. package/out/common/index.d.ts.map +1 -0
  62. package/out/common/index.js +15 -0
  63. package/out/common/index.js.map +1 -0
  64. package/out/common/text-tokens.d.ts +46 -0
  65. package/out/common/text-tokens.d.ts.map +1 -0
  66. package/out/common/text-tokens.js +52 -0
  67. package/out/common/text-tokens.js.map +1 -0
  68. package/out/index.d.ts +5 -51
  69. package/out/index.d.ts.map +1 -1
  70. package/out/index.js +4 -30
  71. package/out/index.js.map +1 -1
  72. package/out/map/BackendControl.d.ts.map +1 -1
  73. package/out/map/BackendControl.js +1 -1
  74. package/out/map/BackendControl.js.map +1 -1
  75. package/out/map/CompareToggle.d.ts +2 -2
  76. package/out/map/CompareToggle.d.ts.map +1 -1
  77. package/out/map/CompareToggle.js +1 -1
  78. package/out/map/CompareToggle.js.map +1 -1
  79. package/out/map/Geocoder.d.ts +67 -0
  80. package/out/map/Geocoder.d.ts.map +1 -0
  81. package/out/map/Geocoder.js +98 -0
  82. package/out/map/Geocoder.js.map +1 -0
  83. package/out/map/GeocoderControls.d.ts +81 -0
  84. package/out/map/GeocoderControls.d.ts.map +1 -0
  85. package/out/map/GeocoderControls.js +79 -0
  86. package/out/map/GeocoderControls.js.map +1 -0
  87. package/out/map/{DemoMap.d.ts → MapCanvas.d.ts} +15 -15
  88. package/out/map/MapCanvas.d.ts.map +1 -0
  89. package/out/map/{DemoMap.js → MapCanvas.js} +2 -2
  90. package/out/map/MapCanvas.js.map +1 -0
  91. package/out/map/MapChipRow.d.ts +47 -0
  92. package/out/map/MapChipRow.d.ts.map +1 -0
  93. package/out/map/MapChipRow.js +12 -0
  94. package/out/map/MapChipRow.js.map +1 -0
  95. package/out/map/MapCompass.d.ts +42 -0
  96. package/out/map/MapCompass.d.ts.map +1 -0
  97. package/out/map/MapCompass.js +11 -0
  98. package/out/map/MapCompass.js.map +1 -0
  99. package/out/map/MapControlStack.d.ts +57 -0
  100. package/out/map/MapControlStack.d.ts.map +1 -0
  101. package/out/map/MapControlStack.js +15 -0
  102. package/out/map/MapControlStack.js.map +1 -0
  103. package/out/map/MapFooter.d.ts +40 -0
  104. package/out/map/MapFooter.d.ts.map +1 -0
  105. package/out/map/MapFooter.js +51 -0
  106. package/out/map/MapFooter.js.map +1 -0
  107. package/out/map/MapProgressBar.d.ts +34 -0
  108. package/out/map/MapProgressBar.d.ts.map +1 -0
  109. package/out/map/MapProgressBar.js +8 -0
  110. package/out/map/MapProgressBar.js.map +1 -0
  111. package/out/map/MapSearchBar.d.ts +49 -0
  112. package/out/map/MapSearchBar.d.ts.map +1 -0
  113. package/out/map/MapSearchBar.js +6 -0
  114. package/out/map/MapSearchBar.js.map +1 -0
  115. package/out/map/MapSheet.d.ts +32 -0
  116. package/out/map/MapSheet.d.ts.map +1 -0
  117. package/out/map/MapSheet.js +33 -0
  118. package/out/map/MapSheet.js.map +1 -0
  119. package/out/map/OverlayLayers.js +1 -1
  120. package/out/map/PlaceMarker.d.ts +1 -1
  121. package/out/map/ResolvedPlaceLayers.d.ts +3 -3
  122. package/out/map/ResolvedPlaceLayers.js +1 -1
  123. package/out/map/ResultCamera.d.ts +1 -1
  124. package/out/map/ResultCamera.js +1 -1
  125. package/out/map/ResultPanel.d.ts +2 -2
  126. package/out/map/ResultPanel.d.ts.map +1 -1
  127. package/out/map/ResultPanel.js +1 -1
  128. package/out/map/ResultPanel.js.map +1 -1
  129. package/out/map/VersionPicker.d.ts +3 -3
  130. package/out/map/VersionPicker.d.ts.map +1 -1
  131. package/out/map/fake-runtime.d.ts +38 -0
  132. package/out/map/fake-runtime.d.ts.map +1 -0
  133. package/out/map/fake-runtime.js +107 -0
  134. package/out/map/fake-runtime.js.map +1 -0
  135. package/out/map/index.d.ts +27 -10
  136. package/out/map/index.d.ts.map +1 -1
  137. package/out/map/index.js +16 -6
  138. package/out/map/index.js.map +1 -1
  139. package/out/map/map-debug.d.ts +31 -0
  140. package/out/map/map-debug.d.ts.map +1 -0
  141. package/out/map/map-debug.js +31 -0
  142. package/out/map/map-debug.js.map +1 -0
  143. package/out/map/place-render.d.ts +2 -2
  144. package/out/map/place-render.d.ts.map +1 -1
  145. package/out/map/place-render.js +1 -1
  146. package/out/map/place-render.js.map +1 -1
  147. package/out/map/types.d.ts +60 -42
  148. package/out/map/types.d.ts.map +1 -1
  149. package/out/map/types.js +5 -5
  150. package/out/map/{useDemoGeocode.d.ts → useGeocode.d.ts} +9 -9
  151. package/out/map/useGeocode.d.ts.map +1 -0
  152. package/out/map/{useDemoGeocode.js → useGeocode.js} +4 -4
  153. package/out/map/useGeocode.js.map +1 -0
  154. package/out/map/useMapBearing.d.ts +28 -0
  155. package/out/map/useMapBearing.d.ts.map +1 -0
  156. package/out/map/useMapBearing.js +35 -0
  157. package/out/map/useMapBearing.js.map +1 -0
  158. package/out/map/useMapLabelPick.d.ts +23 -0
  159. package/out/map/useMapLabelPick.d.ts.map +1 -0
  160. package/out/map/useMapLabelPick.js +104 -0
  161. package/out/map/useMapLabelPick.js.map +1 -0
  162. package/out/pipeline/CandidatePicker.d.ts +1 -1
  163. package/out/pipeline/CandidatePicker.d.ts.map +1 -1
  164. package/out/pipeline/CandidatePicker.js +1 -1
  165. package/out/pipeline/CandidatePicker.js.map +1 -1
  166. package/out/pipeline/ComponentTable.d.ts +1 -1
  167. package/out/pipeline/ComponentTable.d.ts.map +1 -1
  168. package/out/pipeline/ComponentTable.js.map +1 -1
  169. package/out/pipeline/ConfidenceCell.d.ts +2 -2
  170. package/out/pipeline/ConfidenceCell.d.ts.map +1 -1
  171. package/out/pipeline/ConfidenceCell.js +4 -16
  172. package/out/pipeline/ConfidenceCell.js.map +1 -1
  173. package/out/pipeline/FailureDiagnostic.d.ts +15 -0
  174. package/out/pipeline/FailureDiagnostic.d.ts.map +1 -0
  175. package/out/pipeline/FailureDiagnostic.js +21 -0
  176. package/out/pipeline/FailureDiagnostic.js.map +1 -0
  177. package/out/pipeline/PipelineExplorer.js +1 -1
  178. package/out/pipeline/QueryForm.js +1 -1
  179. package/out/pipeline/ResolvedPlace.d.ts +1 -1
  180. package/out/pipeline/ResolvedPlace.d.ts.map +1 -1
  181. package/out/pipeline/ResolvedPlace.js +4 -10
  182. package/out/pipeline/ResolvedPlace.js.map +1 -1
  183. package/out/pipeline/SpanHighlight.d.ts +23 -0
  184. package/out/pipeline/SpanHighlight.d.ts.map +1 -0
  185. package/out/pipeline/SpanHighlight.js +31 -0
  186. package/out/pipeline/SpanHighlight.js.map +1 -0
  187. package/out/pipeline/TimingPanel.d.ts +16 -0
  188. package/out/pipeline/TimingPanel.d.ts.map +1 -0
  189. package/out/pipeline/TimingPanel.js +20 -0
  190. package/out/pipeline/TimingPanel.js.map +1 -0
  191. package/out/pipeline/TreeView.d.ts +17 -0
  192. package/out/pipeline/TreeView.d.ts.map +1 -0
  193. package/out/pipeline/TreeView.js +15 -0
  194. package/out/pipeline/TreeView.js.map +1 -0
  195. package/out/pipeline/copy.d.ts +1 -1
  196. package/out/pipeline/copy.d.ts.map +1 -1
  197. package/out/pipeline/index.d.ts +33 -0
  198. package/out/pipeline/index.d.ts.map +1 -0
  199. package/out/pipeline/index.js +21 -0
  200. package/out/pipeline/index.js.map +1 -0
  201. package/out/pipeline/types.d.ts +2 -68
  202. package/out/pipeline/types.d.ts.map +1 -1
  203. package/out/pipeline/types.js +1 -1
  204. package/out/pipeline/useParsePipeline.d.ts +7 -3
  205. package/out/pipeline/useParsePipeline.d.ts.map +1 -1
  206. package/out/pipeline/useParsePipeline.js +6 -2
  207. package/out/pipeline/useParsePipeline.js.map +1 -1
  208. package/out/poi/LiveResultsBlock.js +1 -1
  209. package/out/poi/POIExplorer.js +1 -1
  210. package/out/poi/SubjectPanel.js +1 -1
  211. package/out/poi/index.d.ts +23 -0
  212. package/out/poi/index.d.ts.map +1 -0
  213. package/out/poi/index.js +15 -0
  214. package/out/poi/index.js.map +1 -0
  215. package/out/poi/runtime.d.ts.map +1 -1
  216. package/out/poi/types.d.ts +2 -1
  217. package/out/poi/types.d.ts.map +1 -1
  218. package/out/runtime/index.d.ts +9 -0
  219. package/out/runtime/index.d.ts.map +1 -0
  220. package/out/runtime/index.js +8 -0
  221. package/out/runtime/index.js.map +1 -0
  222. package/out/runtime/{useDemoRuntime.d.ts → useReleaseRuntime.d.ts} +18 -20
  223. package/out/runtime/useReleaseRuntime.d.ts.map +1 -0
  224. package/out/runtime/{useDemoRuntime.js → useReleaseRuntime.js} +4 -4
  225. package/out/runtime/useReleaseRuntime.js.map +1 -0
  226. package/package.json +222 -31
  227. package/styleframe.config.ts +329 -0
  228. package/styles.css +1995 -663
  229. package/tokens/index.css +116 -0
  230. package/tokens/tokens.json +528 -0
  231. package/tokens/tokens.resolver.json +185 -0
  232. package/lib/map/DemoControls.tsx +0 -194
  233. package/out/map/DemoControls.d.ts +0 -64
  234. package/out/map/DemoControls.d.ts.map +0 -1
  235. package/out/map/DemoControls.js +0 -30
  236. package/out/map/DemoControls.js.map +0 -1
  237. package/out/map/DemoMap.d.ts.map +0 -1
  238. package/out/map/DemoMap.js.map +0 -1
  239. package/out/map/GeocoderDemo.d.ts +0 -57
  240. package/out/map/GeocoderDemo.d.ts.map +0 -1
  241. package/out/map/GeocoderDemo.js +0 -98
  242. package/out/map/GeocoderDemo.js.map +0 -1
  243. package/out/map/useDemoGeocode.d.ts.map +0 -1
  244. package/out/map/useDemoGeocode.js.map +0 -1
  245. package/out/runtime/useDemoRuntime.d.ts.map +0 -1
  246. package/out/runtime/useDemoRuntime.js.map +0 -1
@@ -9,9 +9,10 @@
9
9
  * contract and shapes the UI state.
10
10
  */
11
11
 
12
+ import type { ParseResult, ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result"
12
13
  import { useCallback, useState } from "react"
13
14
 
14
- import type { ParseResult, PipelineRuntime, ResolvedPlaceView } from "#pipeline/types"
15
+ import type { PipelineRuntime } from "#pipeline/types"
15
16
 
16
17
  export interface UseParsePipelineOptions {
17
18
  runtime: PipelineRuntime
@@ -35,9 +36,12 @@ export interface UseParsePipeline {
35
36
  */
36
37
  selectedCandidate: ResolvedPlaceView | null
37
38
  /**
38
- * Run a parse for the current text. Safe to bind to a form's `onSubmit`.
39
+ * Parse and resolve the current text. Safe to bind to a form's `onSubmit`.
40
+ *
41
+ * Pass `query` to submit a value the field has not re-rendered with yet — a preset press sets the text and submits in
42
+ * one handler, and that state update is not visible to this call.
39
43
  */
40
- submit: () => Promise<void>
44
+ submit: (query?: string) => Promise<void>
41
45
  /**
42
46
  * Clear the result (used when a preset replaces the input).
43
47
  */
@@ -52,24 +56,32 @@ export function useParsePipeline({ runtime, defaultText }: UseParsePipelineOptio
52
56
  const [selectedCandidateIndex, setSelectedCandidateIndex] = useState(0)
53
57
  const [parseError, setParseError] = useState<string | null>(null)
54
58
 
55
- const submit = useCallback(async () => {
56
- if (!runtime.ready || busy) return
59
+ // `query` exists because `setText` does not reach this closure before the call after it runs. A preset that called
60
+ // `setText(value)` then `submit()` parsed the PREVIOUS text — the field showed the preset and the map answered the
61
+ // address before it. A caller that already knows the query passes it; the field's own submit passes nothing.
62
+ const submit = useCallback(
63
+ async (query?: string) => {
64
+ if (!runtime.ready || busy) return
57
65
 
58
- setBusy(true)
59
- setParseStage(0)
60
- setParseError(null)
66
+ const input = query ?? text
61
67
 
62
- try {
63
- const parsed = await runtime.runParse(text, { onStage: setParseStage })
64
- setSelectedCandidateIndex(0)
65
- setResult(parsed)
66
- } catch (error) {
67
- setParseError(error instanceof Error ? error.message : String(error))
68
- } finally {
69
- setBusy(false)
70
- setParseStage(-1)
71
- }
72
- }, [runtime, text, busy])
68
+ setBusy(true)
69
+ setParseStage(0)
70
+ setParseError(null)
71
+
72
+ try {
73
+ const parsed = await runtime.runParse(input, { onStage: setParseStage })
74
+ setSelectedCandidateIndex(0)
75
+ setResult(parsed)
76
+ } catch (error) {
77
+ setParseError(error instanceof Error ? error.message : String(error))
78
+ } finally {
79
+ setBusy(false)
80
+ setParseStage(-1)
81
+ }
82
+ },
83
+ [runtime, text, busy]
84
+ )
73
85
 
74
86
  const reset = useCallback(() => setResult(null), [])
75
87
 
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file POI explorer components, hooks, runtime, and contracts.
6
+ */
7
+
8
+ export { AbstainPanel } from "./AbstainPanel.tsx"
9
+ export type { AbstainPanelProps } from "./AbstainPanel.tsx"
10
+ export { LiveResultsBlock } from "./LiveResultsBlock.tsx"
11
+ export type { LiveResultsBlockProps } from "./LiveResultsBlock.tsx"
12
+ export { OverpassBlock } from "./OverpassBlock.tsx"
13
+ export type { OverpassBlockProps } from "./OverpassBlock.tsx"
14
+ export { POIExplorer } from "./POIExplorer.tsx"
15
+ export type { POIExplorerProps } from "./POIExplorer.tsx"
16
+ export { QueryInput } from "./QueryInput.tsx"
17
+ export type { QueryInputProps } from "./QueryInput.tsx"
18
+ export { formatDistance, loadPOIRuntime, POI_DEFAULT_TEXT, POI_PRESETS } from "#poi/runtime"
19
+ export { SubjectPanel } from "./SubjectPanel.tsx"
20
+ export type { SubjectPanelProps } from "./SubjectPanel.tsx"
21
+
22
+ export type {
23
+ CategoryRecord,
24
+ LiveSearchState,
25
+ LoadPOIRuntime,
26
+ POIBrandSubject,
27
+ POICategorySubject,
28
+ POIExplorerResult,
29
+ POILiveSearch,
30
+ POILiveSearchResult,
31
+ POIRuntime,
32
+ POISearchHit,
33
+ POISubject,
34
+ POISubjectBase,
35
+ TaxonomyLookup,
36
+ } from "#poi/types"
37
+
38
+ export { usePOISearch } from "#poi/usePOISearch"
39
+ export type { UsePOISearch, UsePOISearchOptions } from "#poi/usePOISearch"
package/lib/poi/types.ts CHANGED
@@ -9,7 +9,8 @@
9
9
  * package's browser graph (it lives in the docs site, which knows where the layer is served).
10
10
  */
11
11
 
12
- import type { POIPhraseLookup, QueryKindResult, createKindClassifier } from "@mailwoman/kind-classifier"
12
+ import type { QueryKindResult } from "@mailwoman/core/pipeline"
13
+ import type { POIPhraseLookup, createKindClassifier } from "@mailwoman/kind-classifier"
13
14
  import type { createPOITaxonomyLookup } from "@mailwoman/poi-taxonomy/table"
14
15
 
15
16
  export type TaxonomyLookup = ReturnType<typeof createPOITaxonomyLookup>
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Node-safe release-runtime exports.
6
+ */
7
+
8
+ export { useReleaseRuntime } from "#runtime/useReleaseRuntime"
9
+
10
+ export type {
11
+ AssetsLoadContext,
12
+ ReleaseBase,
13
+ ReleaseLoaderState,
14
+ ReleaseManifest,
15
+ ReleaseRuntimeConfig,
16
+ } from "#runtime/useReleaseRuntime"
@@ -3,8 +3,8 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * `useDemoRuntime` — the headless load-orchestration hook shared by every mailwoman demo surface (the
7
- * inline doc-embeds via `DemoEmbed`, and the geocoder map page). It owns the version-selection state
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
8
  * machine, the per-version load SEQUENCING, cancellation, and the ready / loading / error state — but
9
9
  * NOTHING model- or map-specific. The actual asset fetchers (the ONNX classifier factory, the httpvfs
10
10
  * WOF opener, the FST fetch, the releases.json fetch) are INJECTED by the host as async functions, so
@@ -22,7 +22,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react"
22
22
  /**
23
23
  * The minimal contract a release-manifest entry must satisfy. Hosts extend this with their own fields.
24
24
  */
25
- export interface DemoReleaseBase {
25
+ export interface ReleaseBase {
26
26
  /**
27
27
  * The version tag this entry describes (matched against `selectedVersion`).
28
28
  */
@@ -36,7 +36,7 @@ export interface DemoReleaseBase {
36
36
  /**
37
37
  * The releases manifest the host fetches — the default version plus the selectable release entries.
38
38
  */
39
- export interface DemoManifest<TRelease extends DemoReleaseBase = DemoReleaseBase> {
39
+ export interface ReleaseManifest<TRelease extends ReleaseBase = ReleaseBase> {
40
40
  /**
41
41
  * The version selected on first load (before the user picks another).
42
42
  */
@@ -52,7 +52,7 @@ export interface DemoManifest<TRelease extends DemoReleaseBase = DemoReleaseBase
52
52
  * staged step labels/index THROUGH these setters (all no-op once the load is superseded/aborted), while the hook owns
53
53
  * the terminal state (revealing the assets + clearing progress on success, surfacing the error on failure).
54
54
  */
55
- export interface DemoAssetsLoadContext {
55
+ export interface AssetsLoadContext {
56
56
  /**
57
57
  * Aborts when this load is superseded (version/backend switch) or the provider unmounts.
58
58
  */
@@ -82,18 +82,18 @@ export interface DemoAssetsLoadContext {
82
82
  /**
83
83
  * The injected loaders the hook orchestrates. Nothing here is model- or map-aware — the host owns all that.
84
84
  */
85
- export interface DemoRuntimeConfig<TAssets, TRelease extends DemoReleaseBase = DemoReleaseBase> {
85
+ export interface ReleaseRuntimeConfig<TAssets, TRelease extends ReleaseBase = ReleaseBase> {
86
86
  /**
87
- * Fetch + normalize the releases manifest. Returns `null` when no manifest is available (the demo then shows nothing
88
- * selectable). Rejecting surfaces `errorMessage`. Runs once on mount.
87
+ * Fetch + normalize the releases manifest. Returns `null` when no manifest is available (the surface then shows
88
+ * nothing selectable). Rejecting surfaces `errorMessage`. Runs once on mount.
89
89
  */
90
- loadManifest: (signal: AbortSignal) => Promise<DemoManifest<TRelease> | null>
90
+ loadManifest: (signal: AbortSignal) => Promise<ReleaseManifest<TRelease> | null>
91
91
  /**
92
92
  * Load the full asset bundle for one release — the classifier, FST, WOF lookup, calibrator, whatever the host needs.
93
93
  * Runs on every version or `forceWASM` change. Report progress via `ctx`; return the bundle. Rejecting surfaces
94
94
  * `errorMessage`. Bail early when `ctx.signal.aborted` — the hook discards a superseded result regardless.
95
95
  */
96
- loadAssets: (release: TRelease, ctx: DemoAssetsLoadContext) => Promise<TAssets>
96
+ loadAssets: (release: TRelease, ctx: AssetsLoadContext) => Promise<TAssets>
97
97
  /**
98
98
  * The progress line shown before the manifest arrives. @default "Loading releases…"
99
99
  */
@@ -101,19 +101,17 @@ export interface DemoRuntimeConfig<TAssets, TRelease extends DemoReleaseBase = D
101
101
  }
102
102
 
103
103
  /**
104
- * The state `useDemoRuntime` produces — the load-orchestration state a demo surface renders + re-projects.
104
+ * The state `useReleaseRuntime` produces — the load-orchestration state a surface renders + re-projects.
105
105
  *
106
- * NAMING (phase 4): this is the LOADER STATE, deliberately distinct from {@link DemoRuntime} (the injected runtime
107
- * contract `<GeocoderDemo>` consumes). The two were same-stem before (`UseDemoRuntime` vs `DemoRuntime`); phase 4
108
- * disambiguates by renaming the loader-state type to `DemoLoaderState`. A host builds a {@link DemoRuntime} by pairing
109
- * this loader state (assets + backend + version) with the map surface (style, overlays, bias, parse) — see the map
110
- * subpath's `DemoRuntime`.
106
+ * This is the LOADER STATE, deliberately distinct from {@link GeocoderRuntime} (the injected runtime contract
107
+ * `<Geocoder>` consumes). A host builds a {@link GeocoderRuntime} by pairing this loader state (assets + backend +
108
+ * version) with the map surface (style, overlays, bias, parse) see the map subpath's `GeocoderRuntime`.
111
109
  */
112
- export interface DemoLoaderState<TAssets, TRelease extends DemoReleaseBase = DemoReleaseBase> {
110
+ export interface ReleaseLoaderState<TAssets, TRelease extends ReleaseBase = ReleaseBase> {
113
111
  /**
114
112
  * The releases manifest, once fetched.
115
113
  */
116
- manifest: DemoManifest<TRelease> | null
114
+ manifest: ReleaseManifest<TRelease> | null
117
115
  /**
118
116
  * The currently-selected version, or `null` before the manifest resolves.
119
117
  */
@@ -171,12 +169,12 @@ export interface DemoLoaderState<TAssets, TRelease extends DemoReleaseBase = Dem
171
169
  * change reloads the bundle via `loadAssets`, the previous load aborted first. The assets are revealed ATOMICALLY when
172
170
  * `loadAssets` resolves (so `ready` flips exactly once per load), and consumers wait on `ready`.
173
171
  */
174
- export function useDemoRuntime<TAssets, TRelease extends DemoReleaseBase = DemoReleaseBase>(
175
- config: DemoRuntimeConfig<TAssets, TRelease>
176
- ): DemoLoaderState<TAssets, TRelease> {
172
+ export function useReleaseRuntime<TAssets, TRelease extends ReleaseBase = ReleaseBase>(
173
+ config: ReleaseRuntimeConfig<TAssets, TRelease>
174
+ ): ReleaseLoaderState<TAssets, TRelease> {
177
175
  const { initialProgress = "Loading releases…" } = config
178
176
 
179
- const [manifest, setManifest] = useState<DemoManifest<TRelease> | null>(null)
177
+ const [manifest, setManifest] = useState<ReleaseManifest<TRelease> | null>(null)
180
178
  const [selectedVersion, setSelectedVersion] = useState<string | null>(null)
181
179
  const [assets, setAssets] = useState<TAssets | null>(null)
182
180
  const [loadingProgress, setLoadingProgress] = useState<string>(initialProgress)
@@ -194,7 +192,7 @@ export function useDemoRuntime<TAssets, TRelease extends DemoReleaseBase = DemoR
194
192
  // Latest manifest for the version-load effect, so it can resolve the release WITHOUT depending on `manifest`
195
193
  // identity — which would double-fire the load the instant the manifest first arrives (the selection transition
196
194
  // null → defaultVersion already fires it once).
197
- const manifestRef = useRef<DemoManifest<TRelease> | null>(null)
195
+ const manifestRef = useRef<ReleaseManifest<TRelease> | null>(null)
198
196
 
199
197
  useEffect(() => {
200
198
  loadManifestRef.current = config.loadManifest
@@ -249,7 +247,7 @@ export function useDemoRuntime<TAssets, TRelease extends DemoReleaseBase = DemoR
249
247
  setLoadingStepLabels([])
250
248
  setActiveBackend("")
251
249
 
252
- const ctx: DemoAssetsLoadContext = {
250
+ const ctx: AssetsLoadContext = {
253
251
  signal,
254
252
  forceWASM,
255
253
  setProgress: (progress) => guard(() => setLoadingProgress(progress)),
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `About` — the explainer for the browser geocoder: the neural model, the confidence colours, the gazetteer
7
+ * resolver, the byte-range database and the FST prior. Prose about the product a host places above or beside the
8
+ * geocoder; it renders nothing live.
9
+ */
10
+ import type { ReactNode } from "react";
11
+ export interface AboutProps {
12
+ /**
13
+ * Wrap the prose in its own `<details>` disclosure. Set false where the host is already the disclosure — inside a
14
+ * sheet opened by an About button, a summary repeating that button's words is one control too many.
15
+ *
16
+ * @default true
17
+ */
18
+ collapsible?: boolean;
19
+ }
20
+ export declare function About({ collapsible }?: AboutProps): ReactNode;
21
+ //# sourceMappingURL=About.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"About.d.ts","sourceRoot":"","sources":["../../lib/common/About.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,UAAU;IAC1B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,wBAAgB,KAAK,CAAC,EAAE,WAAkB,EAAE,GAAE,UAAe,GAAG,SAAS,CAkFxE"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export function About({ collapsible = true } = {}) {
3
+ const body = (_jsxs("div", { className: "mw-about__body", children: [_jsxs("section", { className: "mw-about__section", children: [_jsx("h3", { className: "mw-about__heading", children: "Neural model" }), _jsxs("p", { children: ["A ~29M-parameter BERT-style encoder classifies each token into one of 33 BIO labels covering 16 address components (street, house number, unit, locality, region, postcode, venue, country, intersection, etc.). It runs entirely in your browser via ", _jsx("strong", { children: "onnxruntime-web" }), " (WebGPU with WASM SIMD fallback). The model ships as a 37.6 MB int8-quantized ONNX bundle; fp32 weights are also available for higher accuracy."] })] }), _jsxs("section", { className: "mw-about__section", children: [_jsx("h3", { className: "mw-about__heading", children: "Confidence colors" }), _jsx("p", { children: "Every classified span carries a confidence score between 0 and 1. The colors in the results table give you a quick visual read:" }), _jsxs("ul", { className: "mw-about__legend", children: [_jsxs("li", { className: "mw-about__item", children: [_jsx("span", { className: "mw-about__swatch mw-about__swatch--high" }), _jsx("strong", { children: "Green" }), " (\u2265 0.8) \u2014 high confidence. The model is nearly certain."] }), _jsxs("li", { className: "mw-about__item", children: [_jsx("span", { className: "mw-about__swatch mw-about__swatch--mid" }), _jsx("strong", { children: "Amber" }), " (0.5\u20130.8) \u2014 moderate confidence. Worth verifying."] }), _jsxs("li", { className: "mw-about__item", children: [_jsx("span", { className: "mw-about__swatch mw-about__swatch--low" }), _jsx("strong", { children: "Red" }), " (< 0.5) \u2014 low confidence. The model is unsure \u2014 likely wrong."] })] }), _jsxs("p", { children: ["These are raw model scores. For calibrated probabilities, the library ships a per-locale isotonic calibrator (", _jsx("code", { children: "calibration.json" }), ") that maps the raw scores to well-calibrated probability estimates."] })] }), _jsxs("section", { className: "mw-about__section", children: [_jsx("h3", { className: "mw-about__heading", children: "WOF resolver" }), _jsxs("p", { children: ["After classification, the resolver queries a ", _jsx("strong", { children: "Who's On First" }), " (WOF) SQLite gazetteer to match the parsed components \u2014 locality, region, and postcode \u2014 against real-world places with coordinates. The cascade tries postcode first (most precise), then locality, then the raw input text. The result is a sorted list of candidate places with WOF IDs, placetypes, lat/lon, and bounding boxes."] })] }), _jsxs("section", { className: "mw-about__section", children: [_jsx("h3", { className: "mw-about__heading", children: "Byte-range gazetteer" }), _jsxs("p", { children: ["The gazetteer is a multi-gigabyte SQLite file served from a public bucket. It loads via", " ", _jsx("strong", { children: "sql.js-httpvfs" }), ", which range-requests only the pages a lookup touches, so your browser fetches a few hundred kilobytes per session instead of the whole file."] })] }), _jsxs("section", { className: "mw-about__section", children: [_jsx("h3", { className: "mw-about__heading", children: "FST prior" }), _jsxs("p", { children: ["A ", _jsx("strong", { children: "finite-state transducer" }), " (FST) built from ~94K US place names runs before the neural classifier. It pre-annotates known locality, region, and postcode spans in the input \u2014 places like \"Springfield\" or \"Cook County\" that the FST can match exactly. These \"FST prior\" hits feed the classifier as strong hints, improving locality and region recall on addresses where the neural model alone might miss them. The FST is active whenever the selected release includes it."] })] })] }));
4
+ if (!collapsible)
5
+ return body;
6
+ return (_jsxs("details", { className: "mw-about", children: [_jsxs("summary", { className: "mw-about__summary", children: [_jsx("span", { className: "mw-about__icon", children: "\u2139\uFE0F" }), "About this geocoder"] }), body] }));
7
+ }
8
+ //# sourceMappingURL=About.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"About.js","sourceRoot":"","sources":["../../lib/common/About.tsx"],"names":[],"mappings":";AAsBA,MAAM,UAAU,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,EAAE,GAAe,EAAE;IAC5D,MAAM,IAAI,GAAG,CACZ,eAAK,SAAS,EAAC,gBAAgB,aAC9B,mBAAS,SAAS,EAAC,mBAAmB,aACrC,aAAI,SAAS,EAAC,mBAAmB,6BAAkB,EACnD,kRAGmC,+CAAgC,wJAE/D,IACK,EAEV,mBAAS,SAAS,EAAC,mBAAmB,aACrC,aAAI,SAAS,EAAC,mBAAmB,kCAAuB,EACxD,0JAGI,EACJ,cAAI,SAAS,EAAC,kBAAkB,aAC/B,cAAI,SAAS,EAAC,gBAAgB,aAC7B,eAAM,SAAS,EAAC,yCAAyC,GAAG,EAC5D,qCAAsB,0EAClB,EACL,cAAI,SAAS,EAAC,gBAAgB,aAC7B,eAAM,SAAS,EAAC,wCAAwC,GAAG,EAC3D,qCAAsB,oEAClB,EACL,cAAI,SAAS,EAAC,gBAAgB,aAC7B,eAAM,SAAS,EAAC,wCAAwC,GAAG,EAC3D,mCAAoB,gFAChB,IACD,EACL,0IAEC,8CAA6B,4EAC1B,IACK,EAEV,mBAAS,SAAS,EAAC,mBAAmB,aACrC,aAAI,SAAS,EAAC,mBAAmB,6BAAkB,EACnD,yEAC8C,8CAAoC,uVAI9E,IACK,EAEV,mBAAS,SAAS,EAAC,mBAAmB,aACrC,aAAI,SAAS,EAAC,mBAAmB,qCAA0B,EAC3D,mHACyF,GAAG,EAC3F,8CAA+B,sJAE5B,IACK,EAEV,mBAAS,SAAS,EAAC,mBAAmB,aACrC,aAAI,SAAS,EAAC,mBAAmB,0BAAe,EAChD,8BACG,uDAAwC,0cAKvC,IACK,IACL,CACN,CAAA;IAED,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAA;IAE7B,OAAO,CACN,mBAAS,SAAS,EAAC,UAAU,aAC5B,mBAAS,SAAS,EAAC,mBAAmB,aACrC,eAAM,SAAS,EAAC,gBAAgB,6BAAU,2BAEjC,EACT,IAAI,IACI,CACV,CAAA;AACF,CAAC"}
@@ -8,17 +8,10 @@
8
8
  * kept structural (`kind: string`) so both the POI query classifier's `QueryKindResult` and the
9
9
  * pipeline's projection satisfy it without a hard type dependency.
10
10
  */
11
+ import type { KindView } from "@mailwoman/core/pipeline/client-result";
11
12
  import type { ReactNode } from "react";
12
- export interface KindBadgeResult {
13
- kind: string;
14
- confidence: number;
15
- alternatives: ReadonlyArray<{
16
- kind: string;
17
- confidence: number;
18
- }>;
19
- }
20
13
  export interface KindBadgeProps {
21
- kindResult: KindBadgeResult;
14
+ kindResult: KindView;
22
15
  }
23
16
  export declare function KindBadge({ kindResult }: KindBadgeProps): ReactNode;
24
17
  //# sourceMappingURL=KindBadge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"KindBadge.d.ts","sourceRoot":"","sources":["../../lib/common/KindBadge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACjE;AAED,MAAM,WAAW,cAAc;IAC9B,UAAU,EAAE,eAAe,CAAA;CAC3B;AAID,wBAAgB,SAAS,CAAC,EAAE,UAAU,EAAE,EAAE,cAAc,GAAG,SAAS,CAkBnE"}
1
+ {"version":3,"file":"KindBadge.d.ts","sourceRoot":"","sources":["../../lib/common/KindBadge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAA;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,cAAc;IAC9B,UAAU,EAAE,QAAQ,CAAA;CACpB;AAID,wBAAgB,SAAS,CAAC,EAAE,UAAU,EAAE,EAAE,cAAc,GAAG,SAAS,CAkBnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"KindBadge.js","sourceRoot":"","sources":["../../lib/common/KindBadge.tsx"],"names":[],"mappings":";AAuBA,MAAM,SAAS,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAA;AAElE,MAAM,UAAU,SAAS,CAAC,EAAE,UAAU,EAAkB;IACvD,OAAO,CACN,mBAAS,SAAS,EAAC,SAAS,aAC3B,mBAAS,SAAS,EAAC,kBAAkB,aACpC,qCAAsB,OAAC,yBAAO,UAAU,CAAC,IAAI,GAAQ,EAAC,GAAG,EACzD,gBAAM,SAAS,EAAC,qBAAqB,kBAAG,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,IACxE,EACT,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CACjC,aAAI,SAAS,EAAC,uBAAuB,YACnC,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACrC,yBACC,yBAAO,GAAG,CAAC,IAAI,GAAQ,OAAC,gBAAM,SAAS,EAAC,qBAAqB,kBAAG,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,KAD1F,GAAG,CAAC,IAAI,CAEZ,CACL,CAAC,GACE,CACL,CAAC,CAAC,CAAC,IAAI,IACC,CACV,CAAA;AACF,CAAC"}
1
+ {"version":3,"file":"KindBadge.js","sourceRoot":"","sources":["../../lib/common/KindBadge.tsx"],"names":[],"mappings":";AAkBA,MAAM,SAAS,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAA;AAElE,MAAM,UAAU,SAAS,CAAC,EAAE,UAAU,EAAkB;IACvD,OAAO,CACN,mBAAS,SAAS,EAAC,SAAS,aAC3B,mBAAS,SAAS,EAAC,kBAAkB,aACpC,qCAAsB,OAAC,yBAAO,UAAU,CAAC,IAAI,GAAQ,EAAC,GAAG,EACzD,gBAAM,SAAS,EAAC,qBAAqB,kBAAG,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,IACxE,EACT,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CACjC,aAAI,SAAS,EAAC,uBAAuB,YACnC,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACrC,yBACC,yBAAO,GAAG,CAAC,IAAI,GAAQ,OAAC,gBAAM,SAAS,EAAC,qBAAqB,kBAAG,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,KAD1F,GAAG,CAAC,IAAI,CAEZ,CACL,CAAC,GACE,CACL,CAAC,CAAC,CAAC,IAAI,IACC,CACV,CAAA;AACF,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Confidence banding shared by every component that colours a span by confidence.
6
+ *
7
+ * It is a presentation choice, not a model one: the parser emits a continuous confidence and these
8
+ * bounds only decide which colour a span is drawn in, so they live here rather than anywhere the
9
+ * pipeline can see them.
10
+ */
11
+ /**
12
+ * At or above this the span is drawn as high-confidence.
13
+ */
14
+ export declare const HIGH_CONFIDENCE_MIN = 0.8;
15
+ /**
16
+ * At or above this the span is drawn as medium-confidence; below it, low.
17
+ */
18
+ export declare const MID_CONFIDENCE_MIN = 0.5;
19
+ /**
20
+ * The banding a component applies to a span's confidence.
21
+ */
22
+ export type ConfidenceTier = "high" | "mid" | "low";
23
+ /**
24
+ * Bands a continuous confidence into the three tiers the demo styles against.
25
+ *
26
+ * @param confidence A parser confidence in `[0, 1]`.
27
+ *
28
+ * @returns The tier to style with.
29
+ */
30
+ export declare function confidenceTier(confidence: number): ConfidenceTier;
31
+ /**
32
+ * {@link confidenceTier} for a possibly-absent confidence: an unmeasured span is drawn as `mid` rather than `low`, so an
33
+ * older model that emits no confidence never reads as uniformly wrong.
34
+ */
35
+ export declare function confidenceTierOrMid(confidence?: number): ConfidenceTier;
36
+ //# sourceMappingURL=confidence-tiers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confidence-tiers.d.ts","sourceRoot":"","sources":["../../lib/common/confidence-tiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC;;GAEG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAA;AAErC;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAA;AAEnD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAMjE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,cAAc,CAIvE"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Confidence banding shared by every component that colours a span by confidence.
6
+ *
7
+ * It is a presentation choice, not a model one: the parser emits a continuous confidence and these
8
+ * bounds only decide which colour a span is drawn in, so they live here rather than anywhere the
9
+ * pipeline can see them.
10
+ */
11
+ /**
12
+ * At or above this the span is drawn as high-confidence.
13
+ */
14
+ export const HIGH_CONFIDENCE_MIN = 0.8;
15
+ /**
16
+ * At or above this the span is drawn as medium-confidence; below it, low.
17
+ */
18
+ export const MID_CONFIDENCE_MIN = 0.5;
19
+ /**
20
+ * Bands a continuous confidence into the three tiers the demo styles against.
21
+ *
22
+ * @param confidence A parser confidence in `[0, 1]`.
23
+ *
24
+ * @returns The tier to style with.
25
+ */
26
+ export function confidenceTier(confidence) {
27
+ if (confidence >= HIGH_CONFIDENCE_MIN)
28
+ return "high";
29
+ if (confidence >= MID_CONFIDENCE_MIN)
30
+ return "mid";
31
+ return "low";
32
+ }
33
+ /**
34
+ * {@link confidenceTier} for a possibly-absent confidence: an unmeasured span is drawn as `mid` rather than `low`, so an
35
+ * older model that emits no confidence never reads as uniformly wrong.
36
+ */
37
+ export function confidenceTierOrMid(confidence) {
38
+ if (confidence == null)
39
+ return "mid";
40
+ return confidenceTier(confidence);
41
+ }
42
+ //# sourceMappingURL=confidence-tiers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confidence-tiers.js","sourceRoot":"","sources":["../../lib/common/confidence-tiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAA;AAOrC;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,UAAkB;IAChD,IAAI,UAAU,IAAI,mBAAmB;QAAE,OAAO,MAAM,CAAA;IAEpD,IAAI,UAAU,IAAI,kBAAkB;QAAE,OAAO,KAAK,CAAA;IAElD,OAAO,KAAK,CAAA;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAmB;IACtD,IAAI,UAAU,IAAI,IAAI;QAAE,OAAO,KAAK,CAAA;IAEpC,OAAO,cAAc,CAAC,UAAU,CAAC,CAAA;AAClC,CAAC"}
@@ -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
+ export { ClientOnly } from "./ClientOnly.tsx";
8
+ export type { ClientOnlyProps } from "./ClientOnly.tsx";
9
+ export { CopyButton } from "./CopyButton.tsx";
10
+ export type { CopyButtonProps } from "./CopyButton.tsx";
11
+ export { cx } from "#common/cx";
12
+ export type { ClassValue } from "#common/cx";
13
+ export { KindBadge } from "./KindBadge.tsx";
14
+ export type { KindBadgeProps } from "./KindBadge.tsx";
15
+ export { LoadingIndicator } from "./LoadingIndicator.tsx";
16
+ export type { LoadingIndicatorProps, LoadingMode } from "./LoadingIndicator.tsx";
17
+ export { PresetChips } from "./PresetChips.tsx";
18
+ export type { Preset, PresetChipsProps } from "./PresetChips.tsx";
19
+ export { useClipboard } from "#common/useClipboard";
20
+ export type { UseClipboard } from "#common/useClipboard";
21
+ export { useDebouncedValue } from "#common/useDebouncedValue";
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/common/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAC/B,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,YAAY,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Common React primitives.
6
+ */
7
+ export { ClientOnly } from "./ClientOnly.js";
8
+ export { CopyButton } from "./CopyButton.js";
9
+ export { cx } from "#common/cx";
10
+ export { KindBadge } from "./KindBadge.js";
11
+ export { LoadingIndicator } from "./LoadingIndicator.js";
12
+ export { PresetChips } from "./PresetChips.js";
13
+ export { useClipboard } from "#common/useClipboard";
14
+ export { useDebouncedValue } from "#common/useDebouncedValue";
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/common/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAA;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAA;AAE7C,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAA;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAA;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Word tokenization + span ownership shared by the word-level visualizers.
6
+ *
7
+ * A word-level panel splits the raw input on whitespace and assigns each word to its most specific
8
+ * covering span (the shortest-span owner, the same rule a character-level highlight applies per
9
+ * character). Two panels must agree for the BIO labels to line up between them, so the split and
10
+ * the owner walk live here.
11
+ */
12
+ export interface WordToken {
13
+ /**
14
+ * The word text as it appears in the input.
15
+ */
16
+ text: string;
17
+ /**
18
+ * Leading whitespace before this word.
19
+ */
20
+ whitespace: string;
21
+ /**
22
+ * Start offset in the input string.
23
+ */
24
+ start: number;
25
+ /**
26
+ * End offset in the input string (exclusive).
27
+ */
28
+ end: number;
29
+ }
30
+ /**
31
+ * Tokenize the raw input into words, preserving leading whitespace for each token.
32
+ */
33
+ export declare function tokenizeWords(input: string): WordToken[];
34
+ /**
35
+ * A half-open `[start, end)` character range into the input.
36
+ */
37
+ export interface CharSpan {
38
+ start: number;
39
+ end: number;
40
+ }
41
+ /**
42
+ * Per-word index of the most specific (shortest) span covering it, or `-1` when no span overlaps the word. A word is
43
+ * covered when any part of it falls within the span.
44
+ */
45
+ export declare function shortestSpanOwners(words: readonly CharSpan[], spans: readonly CharSpan[]): number[];
46
+ //# sourceMappingURL=text-tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-tokens.d.ts","sourceRoot":"","sources":["../../lib/common/text-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;CACX;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,CAyBxD;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACX;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,EAAE,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,MAAM,EAAE,CAcnG"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Word tokenization + span ownership shared by the word-level visualizers.
6
+ *
7
+ * A word-level panel splits the raw input on whitespace and assigns each word to its most specific
8
+ * covering span (the shortest-span owner, the same rule a character-level highlight applies per
9
+ * character). Two panels must agree for the BIO labels to line up between them, so the split and
10
+ * the owner walk live here.
11
+ */
12
+ /**
13
+ * Tokenize the raw input into words, preserving leading whitespace for each token.
14
+ */
15
+ export function tokenizeWords(input) {
16
+ const words = [];
17
+ let i = 0;
18
+ // `charAt` answers "" past the end, which no whitespace test matches, so both walks stop at the input's length.
19
+ while (i < input.length) {
20
+ let ws = "";
21
+ while (/\s/.test(input.charAt(i))) {
22
+ ws += input.charAt(i);
23
+ i++;
24
+ }
25
+ if (i >= input.length)
26
+ break;
27
+ const start = i;
28
+ while (i < input.length && !/\s/.test(input.charAt(i))) {
29
+ i++;
30
+ }
31
+ words.push({ text: input.slice(start, i), start, end: i, whitespace: ws });
32
+ }
33
+ return words;
34
+ }
35
+ /**
36
+ * Per-word index of the most specific (shortest) span covering it, or `-1` when no span overlaps the word. A word is
37
+ * covered when any part of it falls within the span.
38
+ */
39
+ export function shortestSpanOwners(words, spans) {
40
+ return words.map((word) => {
41
+ let best = -1;
42
+ let bestLen = Infinity;
43
+ for (const [s, sp] of spans.entries()) {
44
+ if (word.start < sp.end && word.end > sp.start && sp.end - sp.start < bestLen) {
45
+ bestLen = sp.end - sp.start;
46
+ best = s;
47
+ }
48
+ }
49
+ return best;
50
+ });
51
+ }
52
+ //# sourceMappingURL=text-tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-tokens.js","sourceRoot":"","sources":["../../lib/common/text-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqBH;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IAC1C,MAAM,KAAK,GAAgB,EAAE,CAAA;IAC7B,IAAI,CAAC,GAAG,CAAC,CAAA;IAET,gHAAgH;IAChH,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACzB,IAAI,EAAE,GAAG,EAAE,CAAA;QAEX,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACnC,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;YAErB,CAAC,EAAE,CAAA;QACJ,CAAC;QAED,IAAI,CAAC,IAAI,KAAK,CAAC,MAAM;YAAE,MAAK;QAC5B,MAAM,KAAK,GAAG,CAAC,CAAA;QAEf,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACxD,CAAC,EAAE,CAAA;QACJ,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAA;IAC3E,CAAC;IAED,OAAO,KAAK,CAAA;AACb,CAAC;AAUD;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAA0B,EAAE,KAA0B;IACxF,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,IAAI,IAAI,GAAG,CAAC,CAAC,CAAA;QACb,IAAI,OAAO,GAAG,QAAQ,CAAA;QAEtB,KAAK,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YACvC,IAAI,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,KAAK,GAAG,OAAO,EAAE,CAAC;gBAC/E,OAAO,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,KAAK,CAAA;gBAC3B,IAAI,GAAG,CAAC,CAAA;YACT,CAAC;QACF,CAAC;QAED,OAAO,IAAI,CAAA;IACZ,CAAC,CAAC,CAAA;AACH,CAAC"}