@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.
- package/README.md +18 -16
- package/fonts.css +97 -22
- package/lib/common/About.tsx +10 -10
- package/lib/common/ClientOnly.tsx +2 -14
- package/lib/common/CopyButton.tsx +9 -3
- package/lib/common/LoadingIndicator.tsx +13 -5
- package/lib/common/PresetChips.tsx +11 -8
- package/lib/common/confidence-tiers.ts +8 -7
- package/lib/common/cx.ts +3 -1
- package/lib/common/text-tokens.ts +10 -13
- package/lib/common/useBuildInfo.ts +54 -0
- package/lib/common/useClipboard.ts +2 -11
- package/lib/common.ts +22 -0
- package/lib/index.ts +27 -18
- package/lib/map/AppIdentity.tsx +89 -0
- package/lib/map/CompareToggle.tsx +8 -31
- package/lib/map/DebugInfo.tsx +75 -0
- package/lib/map/Geocoder.tsx +65 -50
- package/lib/map/GeocoderControls.tsx +425 -141
- package/lib/map/GraticuleLayer.tsx +56 -0
- package/lib/map/MapCanvas.tsx +26 -13
- package/lib/map/MapChipRow.tsx +4 -8
- package/lib/map/MapCompass.tsx +18 -25
- package/lib/map/MapControlStack.tsx +11 -10
- package/lib/map/MapFooter.tsx +5 -17
- package/lib/map/MapProgressBar.tsx +10 -13
- package/lib/map/MapSearchBar.tsx +31 -17
- package/lib/map/MapSheet.tsx +24 -15
- package/lib/map/OverlayLayers.tsx +14 -3
- package/lib/map/PlaceAutocomplete.tsx +12 -21
- package/lib/map/PlaceMarker.tsx +10 -4
- package/lib/map/ResolvedPlaceLayers.tsx +14 -15
- package/lib/map/ResultCamera.tsx +10 -31
- package/lib/map/ResultOverlay.tsx +14 -16
- package/lib/map/ResultPanel.tsx +1 -20
- package/lib/map/VersionPicker.tsx +10 -19
- package/lib/map/fake-runtime.ts +46 -19
- package/lib/map/geometry.ts +14 -47
- package/lib/map/graticule.ts +80 -0
- package/lib/map/map-debug.ts +4 -2
- package/lib/map/place-render.ts +30 -62
- package/lib/map/types.ts +57 -116
- package/lib/map/useCompareState.ts +5 -4
- package/lib/map/useGeocode.ts +7 -5
- package/lib/map/useMapBearing.ts +13 -13
- package/lib/map/useMapLabelPick.ts +21 -30
- package/lib/map/useMapPlaceRender.ts +3 -7
- package/lib/map/usePlaceAutocomplete.ts +44 -50
- package/lib/map.ts +92 -0
- package/lib/pipeline/CandidatePicker.tsx +13 -5
- package/lib/pipeline/ConfidenceCell.tsx +2 -2
- package/lib/pipeline/FailureDiagnostic.tsx +8 -2
- package/lib/pipeline/PipelineExplorer.tsx +6 -3
- package/lib/pipeline/QueryForm.tsx +5 -2
- package/lib/pipeline/ResolvedPlace.tsx +2 -2
- package/lib/pipeline/SpanHighlight.tsx +7 -5
- package/lib/pipeline/TimingPanel.tsx +1 -1
- package/lib/pipeline/TreeView.tsx +2 -2
- package/lib/pipeline/copy.ts +22 -25
- package/lib/pipeline/presets.ts +15 -13
- package/lib/pipeline/types.ts +20 -17
- package/lib/pipeline/useParsePipeline.ts +16 -13
- package/lib/pipeline.ts +36 -0
- package/lib/poi/AbstainPanel.tsx +1 -1
- package/lib/poi/LiveResultsBlock.tsx +2 -1
- package/lib/poi/POIExplorer.tsx +29 -17
- package/lib/poi/QueryInput.tsx +1 -1
- package/lib/poi/SubjectPanel.tsx +4 -3
- package/lib/poi/runtime.ts +14 -16
- package/lib/poi/types.ts +58 -47
- package/lib/poi/usePOISearch.ts +91 -82
- package/lib/poi.ts +40 -0
- package/lib/runtime/useReleaseRuntime.ts +122 -90
- package/lib/search/SearchModal.tsx +478 -0
- package/lib/search/search.css +282 -0
- package/lib/search/types.ts +68 -0
- package/lib/search.ts +11 -0
- package/out/common/About.d.ts +6 -6
- package/out/common/About.d.ts.map +1 -1
- package/out/common/About.js +1 -1
- package/out/common/About.js.map +1 -1
- package/out/common/ClientOnly.d.ts +2 -11
- package/out/common/ClientOnly.d.ts.map +1 -1
- package/out/common/ClientOnly.js +1 -13
- package/out/common/ClientOnly.js.map +1 -1
- package/out/common/CopyButton.d.ts +9 -3
- package/out/common/CopyButton.d.ts.map +1 -1
- package/out/common/CopyButton.js.map +1 -1
- package/out/common/LoadingIndicator.d.ts +13 -5
- package/out/common/LoadingIndicator.d.ts.map +1 -1
- package/out/common/LoadingIndicator.js.map +1 -1
- package/out/common/PresetChips.d.ts +11 -8
- package/out/common/PresetChips.d.ts.map +1 -1
- package/out/common/PresetChips.js.map +1 -1
- package/out/common/confidence-tiers.d.ts +8 -7
- package/out/common/confidence-tiers.d.ts.map +1 -1
- package/out/common/confidence-tiers.js +7 -6
- package/out/common/confidence-tiers.js.map +1 -1
- package/out/common/cx.d.ts +3 -1
- package/out/common/cx.d.ts.map +1 -1
- package/out/common/cx.js +3 -1
- package/out/common/cx.js.map +1 -1
- package/out/common/text-tokens.d.ts +6 -11
- package/out/common/text-tokens.d.ts.map +1 -1
- package/out/common/text-tokens.js +6 -3
- package/out/common/text-tokens.js.map +1 -1
- package/out/common/useBuildInfo.d.ts +27 -0
- package/out/common/useBuildInfo.d.ts.map +1 -0
- package/out/common/useBuildInfo.js +32 -0
- package/out/common/useBuildInfo.js.map +1 -0
- package/out/common/useClipboard.d.ts +1 -3
- package/out/common/useClipboard.d.ts.map +1 -1
- package/out/common/useClipboard.js +2 -11
- package/out/common/useClipboard.js.map +1 -1
- package/out/common.d.ts +22 -0
- package/out/common.d.ts.map +1 -0
- package/out/common.js +15 -0
- package/out/common.js.map +1 -0
- package/out/index.d.ts +26 -16
- package/out/index.d.ts.map +1 -1
- package/out/index.js +21 -15
- package/out/index.js.map +1 -1
- package/out/map/AppIdentity.d.ts +46 -0
- package/out/map/AppIdentity.d.ts.map +1 -0
- package/out/map/AppIdentity.js +16 -0
- package/out/map/AppIdentity.js.map +1 -0
- package/out/map/CompareToggle.d.ts +8 -31
- package/out/map/CompareToggle.d.ts.map +1 -1
- package/out/map/CompareToggle.js +4 -1
- package/out/map/CompareToggle.js.map +1 -1
- package/out/map/DebugInfo.d.ts +27 -0
- package/out/map/DebugInfo.d.ts.map +1 -0
- package/out/map/DebugInfo.js +36 -0
- package/out/map/DebugInfo.js.map +1 -0
- package/out/map/Geocoder.d.ts +41 -30
- package/out/map/Geocoder.d.ts.map +1 -1
- package/out/map/Geocoder.js +23 -37
- package/out/map/Geocoder.js.map +1 -1
- package/out/map/GeocoderControls.d.ts +15 -44
- package/out/map/GeocoderControls.d.ts.map +1 -1
- package/out/map/GeocoderControls.js +250 -39
- package/out/map/GeocoderControls.js.map +1 -1
- package/out/map/GraticuleLayer.d.ts +30 -0
- package/out/map/GraticuleLayer.d.ts.map +1 -0
- package/out/map/GraticuleLayer.js +25 -0
- package/out/map/GraticuleLayer.js.map +1 -0
- package/out/map/MapCanvas.d.ts +26 -13
- package/out/map/MapCanvas.d.ts.map +1 -1
- package/out/map/MapCanvas.js +5 -2
- package/out/map/MapCanvas.js.map +1 -1
- package/out/map/MapChipRow.d.ts +4 -8
- package/out/map/MapChipRow.d.ts.map +1 -1
- package/out/map/MapChipRow.js.map +1 -1
- package/out/map/MapCompass.d.ts +14 -21
- package/out/map/MapCompass.d.ts.map +1 -1
- package/out/map/MapCompass.js +5 -1
- package/out/map/MapCompass.js.map +1 -1
- package/out/map/MapControlStack.d.ts +11 -10
- package/out/map/MapControlStack.d.ts.map +1 -1
- package/out/map/MapControlStack.js +4 -1
- package/out/map/MapControlStack.js.map +1 -1
- package/out/map/MapFooter.d.ts +5 -16
- package/out/map/MapFooter.d.ts.map +1 -1
- package/out/map/MapFooter.js +0 -14
- package/out/map/MapFooter.js.map +1 -1
- package/out/map/MapProgressBar.d.ts +10 -13
- package/out/map/MapProgressBar.d.ts.map +1 -1
- package/out/map/MapProgressBar.js.map +1 -1
- package/out/map/MapSearchBar.d.ts +16 -17
- package/out/map/MapSearchBar.d.ts.map +1 -1
- package/out/map/MapSearchBar.js +6 -0
- package/out/map/MapSearchBar.js.map +1 -1
- package/out/map/MapSheet.d.ts +15 -12
- package/out/map/MapSheet.d.ts.map +1 -1
- package/out/map/MapSheet.js +8 -12
- package/out/map/MapSheet.js.map +1 -1
- package/out/map/OverlayLayers.d.ts +8 -2
- package/out/map/OverlayLayers.d.ts.map +1 -1
- package/out/map/OverlayLayers.js +3 -3
- package/out/map/OverlayLayers.js.map +1 -1
- package/out/map/PlaceAutocomplete.d.ts +12 -21
- package/out/map/PlaceAutocomplete.d.ts.map +1 -1
- package/out/map/PlaceAutocomplete.js +2 -1
- package/out/map/PlaceAutocomplete.js.map +1 -1
- package/out/map/PlaceMarker.d.ts +10 -4
- package/out/map/PlaceMarker.d.ts.map +1 -1
- package/out/map/PlaceMarker.js +3 -1
- package/out/map/PlaceMarker.js.map +1 -1
- package/out/map/ResolvedPlaceLayers.d.ts +14 -15
- package/out/map/ResolvedPlaceLayers.d.ts.map +1 -1
- package/out/map/ResolvedPlaceLayers.js +1 -1
- package/out/map/ResolvedPlaceLayers.js.map +1 -1
- package/out/map/ResultCamera.d.ts +10 -31
- package/out/map/ResultCamera.d.ts.map +1 -1
- package/out/map/ResultCamera.js +3 -28
- package/out/map/ResultCamera.js.map +1 -1
- package/out/map/ResultOverlay.d.ts +14 -16
- package/out/map/ResultOverlay.d.ts.map +1 -1
- package/out/map/ResultOverlay.js +1 -2
- package/out/map/ResultOverlay.js.map +1 -1
- package/out/map/ResultPanel.d.ts +1 -20
- package/out/map/ResultPanel.d.ts.map +1 -1
- package/out/map/ResultPanel.js.map +1 -1
- package/out/map/VersionPicker.d.ts +7 -19
- package/out/map/VersionPicker.d.ts.map +1 -1
- package/out/map/VersionPicker.js +5 -2
- package/out/map/VersionPicker.js.map +1 -1
- package/out/map/fake-runtime.d.ts +9 -11
- package/out/map/fake-runtime.d.ts.map +1 -1
- package/out/map/fake-runtime.js +45 -19
- package/out/map/fake-runtime.js.map +1 -1
- package/out/map/geometry.d.ts +13 -34
- package/out/map/geometry.d.ts.map +1 -1
- package/out/map/geometry.js +9 -34
- package/out/map/geometry.js.map +1 -1
- package/out/map/graticule.d.ts +17 -0
- package/out/map/graticule.d.ts.map +1 -0
- package/out/map/graticule.js +67 -0
- package/out/map/graticule.js.map +1 -0
- package/out/map/map-debug.d.ts +4 -2
- package/out/map/map-debug.d.ts.map +1 -1
- package/out/map/map-debug.js +1 -1
- package/out/map/map-debug.js.map +1 -1
- package/out/map/place-render.d.ts +25 -45
- package/out/map/place-render.d.ts.map +1 -1
- package/out/map/place-render.js +4 -39
- package/out/map/place-render.js.map +1 -1
- package/out/map/types.d.ts +57 -113
- package/out/map/types.d.ts.map +1 -1
- package/out/map/types.js +1 -10
- package/out/map/types.js.map +1 -1
- package/out/map/useCompareState.d.ts +5 -4
- package/out/map/useCompareState.d.ts.map +1 -1
- package/out/map/useCompareState.js +3 -3
- package/out/map/useCompareState.js.map +1 -1
- package/out/map/useGeocode.d.ts +5 -3
- package/out/map/useGeocode.d.ts.map +1 -1
- package/out/map/useGeocode.js +4 -4
- package/out/map/useGeocode.js.map +1 -1
- package/out/map/useMapBearing.d.ts +11 -11
- package/out/map/useMapBearing.d.ts.map +1 -1
- package/out/map/useMapBearing.js +6 -11
- package/out/map/useMapBearing.js.map +1 -1
- package/out/map/useMapLabelPick.d.ts +4 -14
- package/out/map/useMapLabelPick.d.ts.map +1 -1
- package/out/map/useMapLabelPick.js +21 -30
- package/out/map/useMapLabelPick.js.map +1 -1
- package/out/map/useMapPlaceRender.d.ts +3 -7
- package/out/map/useMapPlaceRender.d.ts.map +1 -1
- package/out/map/useMapPlaceRender.js +2 -6
- package/out/map/useMapPlaceRender.js.map +1 -1
- package/out/map/usePlaceAutocomplete.d.ts +30 -28
- package/out/map/usePlaceAutocomplete.d.ts.map +1 -1
- package/out/map/usePlaceAutocomplete.js +6 -33
- package/out/map/usePlaceAutocomplete.js.map +1 -1
- package/out/map.d.ts +67 -0
- package/out/map.d.ts.map +1 -0
- package/out/map.js +45 -0
- package/out/map.js.map +1 -0
- package/out/pipeline/CandidatePicker.d.ts +12 -2
- package/out/pipeline/CandidatePicker.d.ts.map +1 -1
- package/out/pipeline/CandidatePicker.js +1 -1
- package/out/pipeline/CandidatePicker.js.map +1 -1
- package/out/pipeline/ConfidenceCell.d.ts +2 -2
- package/out/pipeline/ConfidenceCell.d.ts.map +1 -1
- package/out/pipeline/ConfidenceCell.js +1 -1
- package/out/pipeline/FailureDiagnostic.d.ts +8 -2
- package/out/pipeline/FailureDiagnostic.d.ts.map +1 -1
- package/out/pipeline/FailureDiagnostic.js +3 -0
- package/out/pipeline/FailureDiagnostic.js.map +1 -1
- package/out/pipeline/PipelineExplorer.d.ts +6 -2
- package/out/pipeline/PipelineExplorer.d.ts.map +1 -1
- package/out/pipeline/PipelineExplorer.js +1 -1
- package/out/pipeline/PipelineExplorer.js.map +1 -1
- package/out/pipeline/QueryForm.d.ts +5 -2
- package/out/pipeline/QueryForm.d.ts.map +1 -1
- package/out/pipeline/QueryForm.js.map +1 -1
- package/out/pipeline/ResolvedPlace.d.ts +1 -1
- package/out/pipeline/ResolvedPlace.d.ts.map +1 -1
- package/out/pipeline/SpanHighlight.d.ts +4 -3
- package/out/pipeline/SpanHighlight.d.ts.map +1 -1
- package/out/pipeline/SpanHighlight.js +3 -2
- package/out/pipeline/SpanHighlight.js.map +1 -1
- package/out/pipeline/TimingPanel.d.ts +1 -1
- package/out/pipeline/TreeView.d.ts +1 -1
- package/out/pipeline/TreeView.js.map +1 -1
- package/out/pipeline/copy.d.ts +1 -1
- package/out/pipeline/copy.d.ts.map +1 -1
- package/out/pipeline/copy.js +4 -3
- package/out/pipeline/copy.js.map +1 -1
- package/out/pipeline/presets.d.ts +5 -4
- package/out/pipeline/presets.d.ts.map +1 -1
- package/out/pipeline/presets.js +15 -13
- package/out/pipeline/presets.js.map +1 -1
- package/out/pipeline/types.d.ts +20 -17
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +2 -4
- package/out/pipeline/types.js.map +1 -1
- package/out/pipeline/useParsePipeline.d.ts +14 -9
- package/out/pipeline/useParsePipeline.d.ts.map +1 -1
- package/out/pipeline/useParsePipeline.js +7 -8
- package/out/pipeline/useParsePipeline.js.map +1 -1
- package/out/pipeline.d.ts +33 -0
- package/out/pipeline.d.ts.map +1 -0
- package/out/pipeline.js +21 -0
- package/out/pipeline.js.map +1 -0
- package/out/poi/AbstainPanel.d.ts +1 -1
- package/out/poi/LiveResultsBlock.d.ts +2 -1
- package/out/poi/LiveResultsBlock.d.ts.map +1 -1
- package/out/poi/LiveResultsBlock.js.map +1 -1
- package/out/poi/POIExplorer.d.ts +22 -12
- package/out/poi/POIExplorer.d.ts.map +1 -1
- package/out/poi/POIExplorer.js +11 -10
- package/out/poi/POIExplorer.js.map +1 -1
- package/out/poi/QueryInput.d.ts +1 -1
- package/out/poi/SubjectPanel.d.ts +2 -2
- package/out/poi/SubjectPanel.d.ts.map +1 -1
- package/out/poi/SubjectPanel.js +2 -1
- package/out/poi/SubjectPanel.js.map +1 -1
- package/out/poi/runtime.d.ts +5 -14
- package/out/poi/runtime.d.ts.map +1 -1
- package/out/poi/runtime.js +14 -16
- package/out/poi/runtime.js.map +1 -1
- package/out/poi/types.d.ts +53 -45
- package/out/poi/types.d.ts.map +1 -1
- package/out/poi/types.js +2 -4
- package/out/poi/types.js.map +1 -1
- package/out/poi/usePOISearch.d.ts +30 -17
- package/out/poi/usePOISearch.d.ts.map +1 -1
- package/out/poi/usePOISearch.js +48 -64
- package/out/poi/usePOISearch.js.map +1 -1
- package/out/poi.d.ts +23 -0
- package/out/poi.d.ts.map +1 -0
- package/out/poi.js +15 -0
- package/out/poi.js.map +1 -0
- package/out/runtime/useReleaseRuntime.d.ts +63 -74
- package/out/runtime/useReleaseRuntime.d.ts.map +1 -1
- package/out/runtime/useReleaseRuntime.js +31 -32
- package/out/runtime/useReleaseRuntime.js.map +1 -1
- package/out/{runtime/index.d.ts → runtime.d.ts} +1 -1
- package/out/runtime.d.ts.map +1 -0
- package/out/{runtime/index.js → runtime.js} +1 -1
- package/out/runtime.js.map +1 -0
- package/out/search/SearchModal.d.ts +40 -0
- package/out/search/SearchModal.d.ts.map +1 -0
- package/out/search/SearchModal.js +255 -0
- package/out/search/SearchModal.js.map +1 -0
- package/out/search/types.d.ts +65 -0
- package/out/search/types.d.ts.map +1 -0
- package/out/search/types.js +13 -0
- package/out/search/types.js.map +1 -0
- package/out/search.d.ts +11 -0
- package/out/search.d.ts.map +1 -0
- package/out/search.js +9 -0
- package/out/search.js.map +1 -0
- package/package.json +73 -165
- package/styles.css +482 -266
- package/tokens/index.css +24 -6
- package/tokens/tokens.json +114 -6
- package/lib/common/index.ts +0 -22
- package/lib/map/BackendControl.tsx +0 -51
- package/lib/map/index.ts +0 -95
- package/lib/pipeline/index.ts +0 -36
- package/lib/poi/index.ts +0 -39
- package/out/common/index.d.ts +0 -22
- package/out/common/index.d.ts.map +0 -1
- package/out/common/index.js +0 -15
- package/out/common/index.js.map +0 -1
- package/out/map/BackendControl.d.ts +0 -32
- package/out/map/BackendControl.d.ts.map +0 -1
- package/out/map/BackendControl.js +0 -8
- package/out/map/BackendControl.js.map +0 -1
- package/out/map/index.d.ts +0 -69
- package/out/map/index.d.ts.map +0 -1
- package/out/map/index.js +0 -46
- package/out/map/index.js.map +0 -1
- package/out/pipeline/index.d.ts +0 -33
- package/out/pipeline/index.d.ts.map +0 -1
- package/out/pipeline/index.js +0 -21
- package/out/pipeline/index.js.map +0 -1
- package/out/poi/index.d.ts +0 -23
- package/out/poi/index.d.ts.map +0 -1
- package/out/poi/index.js +0 -15
- package/out/poi/index.js.map +0 -1
- package/out/runtime/index.d.ts.map +0 -1
- package/out/runtime/index.js.map +0 -1
- package/styleframe.config.ts +0 -329
- package/vitest.node.config.ts +0 -20
- /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
|
|
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
|
-
*
|
|
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
|
|
18
|
+
* The releases manifest that the host fetches.
|
|
34
19
|
*/
|
|
35
20
|
export interface ReleaseManifest<TRelease extends ReleaseBase = ReleaseBase> {
|
|
36
21
|
/**
|
|
37
|
-
* The version
|
|
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
|
|
47
|
-
*
|
|
48
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
44
|
+
* Sets the zero-based index of the current loader step.
|
|
69
45
|
*/
|
|
70
46
|
setStepIndex: (index: number) => void;
|
|
71
47
|
/**
|
|
72
|
-
*
|
|
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
|
|
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
|
-
*
|
|
82
|
-
*
|
|
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
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
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
|
-
*
|
|
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
|
|
97
|
+
* The release-loading state that {@link useReleaseRuntime} returns.
|
|
98
98
|
*
|
|
99
|
-
*
|
|
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,
|
|
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
|
|
107
|
+
* The selected version, `null` before the manifest loads.
|
|
110
108
|
*/
|
|
111
109
|
selectedVersion: string | null;
|
|
112
110
|
/**
|
|
113
|
-
* The
|
|
111
|
+
* The manifest entry that matches `selectedVersion`, or `null` when none matches.
|
|
114
112
|
*/
|
|
115
113
|
selectedRelease: TRelease | null;
|
|
116
114
|
/**
|
|
117
|
-
* The
|
|
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
|
-
*
|
|
120
|
+
* The load progress line, empty once loading finishes or fails.
|
|
126
121
|
*/
|
|
127
122
|
loadingProgress: string;
|
|
128
123
|
/**
|
|
129
|
-
*
|
|
124
|
+
* The zero-based loader step index, `-1` before the first step.
|
|
130
125
|
*/
|
|
131
126
|
loadingStepIndex: number;
|
|
127
|
+
loadingStepLabels: string[];
|
|
132
128
|
/**
|
|
133
|
-
*
|
|
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
|
-
|
|
132
|
+
loadingByteFraction: number | null;
|
|
136
133
|
/**
|
|
137
|
-
* A
|
|
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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
148
|
+
* Loads the release manifest on mount and the selected release's assets whenever the version changes.
|
|
159
149
|
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
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
|
|
1
|
+
{"version":3,"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AM,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEzD;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB,CAAC,OAAO,EAAE,QAAQ,SAAS,WAAW,GAAG,WAAW;IACtF;;OAEG;IACH,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;IAE1C;;OAEG;IACH,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAE9B;;OAEG;IACH,eAAe,EAAE,QAAQ,GAAG,IAAI,CAAA;IAEhC;;OAEG;IACH,MAAM,EAAE,OAAO,GAAG,IAAI,CAAA;IAEtB,KAAK,EAAE,OAAO,CAAA;IAEd;;OAEG;IACH,eAAe,EAAE,MAAM,CAAA;IAEvB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IAExB,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAE3B;;;OAGG;IACH,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAA;IAElC;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAE3B;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,QAAQ,SAAS,WAAW,GAAG,WAAW,EACpF,MAAM,EAAE,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,GAC7C,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAqJvC"}
|
|
@@ -2,27 +2,13 @@
|
|
|
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
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
20
7
|
/**
|
|
21
|
-
*
|
|
8
|
+
* Loads the release manifest on mount and the selected release's assets whenever the version changes.
|
|
22
9
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
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 [
|
|
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
|
-
|
|
43
|
-
|
|
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
|
|
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
|
|
1
|
+
{"version":3,"file":"useReleaseRuntime.js","sourceRoot":"","sources":["../../lib/runtime/useReleaseRuntime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAyKzE;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAChC,MAA+C;IAE/C,MAAM,EAAE,eAAe,GAAG,mBAAmB,EAAE,GAAG,MAAM,CAAA;IAExD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAmC,IAAI,CAAC,CAAA;IAChF,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAA;IAC3E,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC,CAAA;IAC1D,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAS,eAAe,CAAC,CAAA;IAC/E,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAA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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=
|
|
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"}
|
|
@@ -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"}
|