@mailwoman/react 10.0.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.
- package/README.md +17 -16
- package/fonts.css +97 -22
- package/lib/common/About.tsx +7 -7
- package/lib/common/ClientOnly.tsx +2 -14
- package/lib/common/CopyButton.tsx +3 -1
- package/lib/common/LoadingIndicator.tsx +4 -2
- package/lib/common/PresetChips.tsx +9 -8
- package/lib/common/confidence-tiers.ts +7 -6
- package/lib/common/cx.ts +3 -1
- package/lib/common/text-tokens.ts +7 -4
- 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 -17
- package/lib/map/AppIdentity.tsx +85 -0
- package/lib/map/BackendControl.tsx +9 -10
- package/lib/map/CompareToggle.tsx +8 -31
- package/lib/map/DebugInfo.tsx +88 -0
- package/lib/map/Geocoder.tsx +60 -46
- package/lib/map/GeocoderControls.tsx +430 -134
- package/lib/map/GraticuleLayer.tsx +54 -0
- package/lib/map/MapCanvas.tsx +23 -12
- package/lib/map/MapChipRow.tsx +4 -8
- package/lib/map/MapCompass.tsx +15 -24
- package/lib/map/MapControlStack.tsx +8 -9
- package/lib/map/MapFooter.tsx +2 -16
- 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 +1 -1
- package/lib/map/PlaceAutocomplete.tsx +10 -21
- package/lib/map/PlaceMarker.tsx +4 -2
- package/lib/map/ResolvedPlaceLayers.tsx +5 -14
- package/lib/map/ResultCamera.tsx +8 -31
- package/lib/map/ResultOverlay.tsx +2 -12
- package/lib/map/ResultPanel.tsx +1 -20
- package/lib/map/VersionPicker.tsx +10 -19
- package/lib/map/fake-runtime.ts +10 -12
- package/lib/map/geometry.ts +14 -47
- package/lib/map/graticule.ts +80 -0
- package/lib/map/map-debug.ts +1 -1
- package/lib/map/place-render.ts +28 -60
- package/lib/map/types.ts +58 -104
- 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 +2 -6
- package/lib/map/usePlaceAutocomplete.ts +44 -50
- package/lib/map.ts +95 -0
- package/lib/pipeline/CandidatePicker.tsx +13 -5
- package/lib/pipeline/ConfidenceCell.tsx +1 -1
- package/lib/pipeline/FailureDiagnostic.tsx +8 -2
- package/lib/pipeline/QueryForm.tsx +5 -2
- package/lib/pipeline/ResolvedPlace.tsx +1 -1
- package/lib/pipeline/SpanHighlight.tsx +7 -5
- package/lib/pipeline/TimingPanel.tsx +1 -1
- package/lib/pipeline/TreeView.tsx +1 -1
- package/lib/pipeline/copy.ts +22 -25
- package/lib/pipeline/presets.ts +15 -13
- package/lib/pipeline/types.ts +21 -14
- 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 +24 -15
- package/lib/poi/QueryInput.tsx +1 -1
- package/lib/poi/SubjectPanel.tsx +4 -3
- package/lib/poi/runtime.ts +5 -16
- package/lib/poi/types.ts +39 -27
- package/lib/poi/usePOISearch.ts +39 -44
- package/lib/poi.ts +39 -0
- package/lib/runtime/useReleaseRuntime.ts +125 -74
- package/lib/search/SearchModal.tsx +317 -0
- package/lib/search/search.css +144 -0
- package/lib/search/types.ts +67 -0
- package/lib/search.ts +11 -0
- package/out/common/About.d.ts +5 -5
- 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 +3 -1
- package/out/common/CopyButton.d.ts.map +1 -1
- package/out/common/CopyButton.js.map +1 -1
- package/out/common/LoadingIndicator.d.ts +4 -2
- package/out/common/LoadingIndicator.d.ts.map +1 -1
- package/out/common/LoadingIndicator.js.map +1 -1
- package/out/common/PresetChips.d.ts +9 -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 +7 -6
- 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 +4 -3
- 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 +42 -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/BackendControl.d.ts +9 -10
- package/out/map/BackendControl.d.ts.map +1 -1
- package/out/map/BackendControl.js +1 -1
- package/out/map/BackendControl.js.map +1 -1
- 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 +34 -0
- package/out/map/DebugInfo.d.ts.map +1 -0
- package/out/map/DebugInfo.js +39 -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 +20 -36
- package/out/map/Geocoder.js.map +1 -1
- package/out/map/GeocoderControls.d.ts +14 -42
- package/out/map/GeocoderControls.d.ts.map +1 -1
- package/out/map/GeocoderControls.js +250 -38
- package/out/map/GeocoderControls.js.map +1 -1
- package/out/map/GraticuleLayer.d.ts +28 -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 +23 -12
- 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 +11 -20
- 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 +8 -9
- 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 +2 -15
- 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 +1 -1
- package/out/map/OverlayLayers.js +1 -1
- package/out/map/PlaceAutocomplete.d.ts +10 -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 +4 -2
- 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 +5 -14
- 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 +8 -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 +2 -12
- 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 +9 -12
- 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 +1 -1
- package/out/map/map-debug.js +1 -1
- package/out/map/place-render.d.ts +23 -43
- 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 +58 -102
- 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 +2 -6
- 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 +69 -0
- package/out/map.d.ts.map +1 -0
- package/out/map.js +46 -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 +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/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/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/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 +21 -14
- 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 +9 -8
- 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 +5 -16
- package/out/poi/runtime.js.map +1 -1
- package/out/poi/types.d.ts +39 -27
- 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 +28 -17
- package/out/poi/usePOISearch.d.ts.map +1 -1
- package/out/poi/usePOISearch.js +6 -32
- 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 +64 -65
- package/out/runtime/useReleaseRuntime.d.ts.map +1 -1
- package/out/runtime/useReleaseRuntime.js +31 -26
- 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 +33 -0
- package/out/search/SearchModal.d.ts.map +1 -0
- package/out/search/SearchModal.js +187 -0
- package/out/search/SearchModal.js.map +1 -0
- package/out/search/types.d.ts +64 -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 +60 -142
- 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/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/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
package/lib/pipeline/presets.ts
CHANGED
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Default query + example addresses for the pipeline explorer. Hosts can override via props
|
|
6
|
+
* Default query + example addresses for the pipeline explorer. Hosts can override via props. These
|
|
7
7
|
* mirror the docs demo's set so the extracted component looks identical out of the box.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { Preset } from "../common/PresetChips.tsx"
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Address the pipeline explorer opens on.
|
|
14
|
-
*
|
|
13
|
+
* Address the pipeline explorer opens on.
|
|
14
|
+
*
|
|
15
|
+
* It exercises every stage (house number, street, directional, locality and region) in one line.
|
|
15
16
|
*/
|
|
16
17
|
export const PIPELINE_DEFAULT_ADDRESS = "1600 Pennsylvania Ave NW, Washington, DC 20500"
|
|
17
18
|
|
|
18
|
-
// `country` mirrors the docs `EXAMPLE_ADDRESSES` set
|
|
19
|
-
//
|
|
20
|
-
// locale structural routing can't detect (NZ) still fires; free-typed input drops to structural detection.
|
|
19
|
+
// `country` mirrors the docs `EXAMPLE_ADDRESSES` set and is kept in parity.
|
|
20
|
+
// A host that wires the pair prior pins the country while the input equals the preset text.
|
|
21
21
|
/**
|
|
22
|
-
* Preset inputs offered in the explorer, each picked to show a different parse
|
|
22
|
+
* Preset inputs offered in the explorer, each picked to show a different parse behavior.
|
|
23
23
|
*/
|
|
24
24
|
export const PIPELINE_PRESETS: ReadonlyArray<Preset> = [
|
|
25
25
|
{ label: "White House", value: "1600 Pennsylvania Ave NW, Washington, DC 20500", country: "us" },
|
|
@@ -32,16 +32,18 @@ export const PIPELINE_PRESETS: ReadonlyArray<Preset> = [
|
|
|
32
32
|
{ label: "Berlin (native order)", value: "Straußstraße 27, 12623 Berlin", country: "de" },
|
|
33
33
|
{ label: "Berlin city-state (int'l order)", value: "5 Hauptstraße, Berlin, Berlin 10115", country: "de" },
|
|
34
34
|
{ label: "Paris (street fall-through)", value: "181 Rue du Chevaleret, Paris", country: "fr" },
|
|
35
|
-
//
|
|
36
|
-
//
|
|
35
|
+
// "Henbury" flips to dependent_locality via the en-gb pair-index prior.
|
|
36
|
+
// The UK postcode is structurally detectable, in parity with the docs EXAMPLE_ADDRESSES.
|
|
37
37
|
{
|
|
38
38
|
label: "Macclesfield (GB dependent_locality)",
|
|
39
39
|
value: "41 Hightree Drive, Henbury, Macclesfield, SK11 9PD",
|
|
40
40
|
country: "gb",
|
|
41
41
|
},
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
// "
|
|
45
|
-
//
|
|
42
|
+
// Plimmerton is a suburb (dependent_locality) of Porirua.
|
|
43
|
+
// The postcode is deliberately omitted, since a trailing "Porirua 5026" folds "porirua
|
|
44
|
+
// 5026" in segment mode and misses the index's bare "porirua" key.
|
|
45
|
+
// The `country: "nz"` pin is required, since locale-hint cannot structurally
|
|
46
|
+
// detect NZ (a 4-digit postcode is not distinctive).
|
|
47
|
+
// Only the pin selects the nz index.
|
|
46
48
|
{ label: "Plimmerton (NZ dependent_locality)", value: "35 Steyne Avenue, Plimmerton, Porirua", country: "nz" },
|
|
47
49
|
]
|
package/lib/pipeline/types.ts
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Types for the pipeline (parse + resolve) explorer. The
|
|
7
|
-
*
|
|
8
|
-
* (the docs site's RuntimeEmbed, or any app) owns loading ONNX/WOF and executing a parse. That keeps
|
|
9
|
-
* onnxruntime-web, sql.js-httpvfs, and node builtins entirely out of this package's browser graph.
|
|
6
|
+
* Types for the pipeline (parse + resolve) explorer. The runtime is injected as a {@link PipelineRuntime},
|
|
7
|
+
* keeping onnxruntime-web, sqlite-wasm and node builtins out of this package's browser graph.
|
|
10
8
|
*/
|
|
11
9
|
|
|
12
10
|
import type { ParseResult } from "@mailwoman/core/pipeline/client-result"
|
|
@@ -19,11 +17,20 @@ export interface PipelineLoadingState {
|
|
|
19
17
|
progress?: string
|
|
20
18
|
stepLabels: string[]
|
|
21
19
|
stepIndex: number
|
|
20
|
+
/**
|
|
21
|
+
* Bytes received over bytes expected for the asset being fetched right now, in [0, 1],
|
|
22
|
+
* or `null` when no download is in progress or the response declares no length.
|
|
23
|
+
*
|
|
24
|
+
* The step index cannot report this download because the model is fetched before the first step begins.
|
|
25
|
+
*/
|
|
26
|
+
byteFraction?: number | null
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
/**
|
|
25
|
-
* The injected parse runtime.
|
|
26
|
-
*
|
|
30
|
+
* The injected parse runtime.
|
|
31
|
+
*
|
|
32
|
+
* The host implements this interface and supplies the model and gazetteer,
|
|
33
|
+
* keeping both imports out of this package.
|
|
27
34
|
*/
|
|
28
35
|
export interface PipelineRuntime {
|
|
29
36
|
/**
|
|
@@ -31,7 +38,8 @@ export interface PipelineRuntime {
|
|
|
31
38
|
*/
|
|
32
39
|
ready: boolean
|
|
33
40
|
/**
|
|
34
|
-
* Execute a full parse+resolve, reporting stage progress via `onStage`
|
|
41
|
+
* Execute a full parse+resolve, reporting stage progress via `onStage`
|
|
42
|
+
* (0-based index into `parseStageLabels`).
|
|
35
43
|
*/
|
|
36
44
|
runParse: (input: string, hooks: { onStage: (stage: number) => void }) => Promise<ParseResult>
|
|
37
45
|
/**
|
|
@@ -49,17 +57,16 @@ export interface PipelineRuntime {
|
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
/**
|
|
52
|
-
* Optional host-injected panels
|
|
53
|
-
*
|
|
54
|
-
* components nor their heavy data types.
|
|
60
|
+
* Optional host-injected panels, kept as `ReactNode` thunks so this package needs
|
|
61
|
+
* neither the host's components nor their data types.
|
|
55
62
|
*/
|
|
56
63
|
export interface PipelinePanels {
|
|
57
64
|
/**
|
|
58
|
-
* Rendered above the form
|
|
65
|
+
* Rendered above the form.
|
|
59
66
|
*/
|
|
60
67
|
header?: ReactNode
|
|
61
68
|
/**
|
|
62
|
-
* Rendered below everything
|
|
69
|
+
* Rendered below everything.
|
|
63
70
|
*/
|
|
64
71
|
footer?: ReactNode
|
|
65
72
|
/**
|
|
@@ -67,7 +74,7 @@ export interface PipelinePanels {
|
|
|
67
74
|
*/
|
|
68
75
|
versionControl?: ReactNode
|
|
69
76
|
/**
|
|
70
|
-
* Backend indicator +
|
|
77
|
+
* Backend indicator + wasm toggle.
|
|
71
78
|
*/
|
|
72
79
|
backendControl?: ReactNode
|
|
73
80
|
/**
|
|
@@ -79,7 +86,7 @@ export interface PipelinePanels {
|
|
|
79
86
|
*/
|
|
80
87
|
extras?: (result: ParseResult) => ReactNode
|
|
81
88
|
/**
|
|
82
|
-
* Rendered in place of the resolved-place panel when
|
|
89
|
+
* Rendered in place of the resolved-place panel when no place resolved (host's FailureDiagnostic).
|
|
83
90
|
*/
|
|
84
91
|
failure?: (result: ParseResult) => ReactNode
|
|
85
92
|
}
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* to the injected {@link PipelineRuntime}. No model or gazetteer code lives here — it just drives the
|
|
9
|
-
* contract and shapes the UI state.
|
|
6
|
+
* The headless core of the pipeline explorer. It owns query text, busy/stage flags, result and candidate selection.
|
|
7
|
+
* It delegates parse and resolve to the injected {@link PipelineRuntime}.
|
|
10
8
|
*/
|
|
11
9
|
|
|
12
10
|
import type { ParseResult, ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result"
|
|
@@ -14,11 +12,17 @@ import { useCallback, useState } from "react"
|
|
|
14
12
|
|
|
15
13
|
import type { PipelineRuntime } from "#pipeline/types"
|
|
16
14
|
|
|
15
|
+
/**
|
|
16
|
+
* The runtime and starting text for {@link useParsePipeline}.
|
|
17
|
+
*/
|
|
17
18
|
export interface UseParsePipelineOptions {
|
|
18
19
|
runtime: PipelineRuntime
|
|
19
20
|
defaultText: string
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
/**
|
|
24
|
+
* The state and handlers that {@link useParsePipeline} returns.
|
|
25
|
+
*/
|
|
22
26
|
export interface UseParsePipeline {
|
|
23
27
|
text: string
|
|
24
28
|
setText: (text: string) => void
|
|
@@ -36,18 +40,19 @@ export interface UseParsePipeline {
|
|
|
36
40
|
*/
|
|
37
41
|
selectedCandidate: ResolvedPlaceView | null
|
|
38
42
|
/**
|
|
39
|
-
* Parse and resolve the current text
|
|
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.
|
|
43
|
+
* Parse and resolve the current text, safe to bind to a form's `onSubmit`;
|
|
44
|
+
* pass `query` to submit a value the field has not re-rendered with yet.
|
|
43
45
|
*/
|
|
44
46
|
submit: (query?: string) => Promise<void>
|
|
45
47
|
/**
|
|
46
|
-
* Clear the result
|
|
48
|
+
* Clear the result, used when a preset replaces the input.
|
|
47
49
|
*/
|
|
48
50
|
reset: () => void
|
|
49
51
|
}
|
|
50
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Drives the injected runtime and exposes the explorer's UI state.
|
|
55
|
+
*/
|
|
51
56
|
export function useParsePipeline({ runtime, defaultText }: UseParsePipelineOptions): UseParsePipeline {
|
|
52
57
|
const [text, setText] = useState(defaultText)
|
|
53
58
|
const [busy, setBusy] = useState(false)
|
|
@@ -56,9 +61,8 @@ export function useParsePipeline({ runtime, defaultText }: UseParsePipelineOptio
|
|
|
56
61
|
const [selectedCandidateIndex, setSelectedCandidateIndex] = useState(0)
|
|
57
62
|
const [parseError, setParseError] = useState<string | null>(null)
|
|
58
63
|
|
|
59
|
-
// `
|
|
60
|
-
//
|
|
61
|
-
// address before it. A caller that already knows the query passes it; the field's own submit passes nothing.
|
|
64
|
+
// `setText` does not reach this closure before the call after it runs,
|
|
65
|
+
// so a caller that already knows the query passes it.
|
|
62
66
|
const submit = useCallback(
|
|
63
67
|
async (query?: string) => {
|
|
64
68
|
if (!runtime.ready || busy) return
|
|
@@ -85,7 +89,6 @@ export function useParsePipeline({ runtime, defaultText }: UseParsePipelineOptio
|
|
|
85
89
|
|
|
86
90
|
const reset = useCallback(() => setResult(null), [])
|
|
87
91
|
|
|
88
|
-
// Derived during render — no effect needed.
|
|
89
92
|
const selectedCandidate = result ? (result.candidates[selectedCandidateIndex] ?? result.candidates[0] ?? null) : null
|
|
90
93
|
|
|
91
94
|
return {
|
package/lib/pipeline.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file Pipeline explorer components, visualizers, hooks and interfaces.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { About } from "./common/About.tsx"
|
|
9
|
+
export { FailureDiagnostic } from "./pipeline/FailureDiagnostic.tsx"
|
|
10
|
+
export type { FailureDiagnosticProps } from "./pipeline/FailureDiagnostic.tsx"
|
|
11
|
+
export { SpanHighlight } from "./pipeline/SpanHighlight.tsx"
|
|
12
|
+
export type { SpanHighlightProps } from "./pipeline/SpanHighlight.tsx"
|
|
13
|
+
export { TimingPanel } from "./pipeline/TimingPanel.tsx"
|
|
14
|
+
export type { TimingPanelProps } from "./pipeline/TimingPanel.tsx"
|
|
15
|
+
export { TreeView } from "./pipeline/TreeView.tsx"
|
|
16
|
+
export type { TreeViewProps } from "./pipeline/TreeView.tsx"
|
|
17
|
+
|
|
18
|
+
export { CandidatePicker } from "./pipeline/CandidatePicker.tsx"
|
|
19
|
+
export type { CandidatePickerProps } from "./pipeline/CandidatePicker.tsx"
|
|
20
|
+
export { ComponentTable } from "./pipeline/ComponentTable.tsx"
|
|
21
|
+
export type { ComponentTableProps } from "./pipeline/ComponentTable.tsx"
|
|
22
|
+
export { ConfidenceCell } from "./pipeline/ConfidenceCell.tsx"
|
|
23
|
+
export type { ConfidenceCellProps } from "./pipeline/ConfidenceCell.tsx"
|
|
24
|
+
export { buildParsePayload } from "#pipeline/copy"
|
|
25
|
+
export { PIPELINE_DEFAULT_ADDRESS, PIPELINE_PRESETS } from "#pipeline/presets"
|
|
26
|
+
export { PipelineExplorer } from "./pipeline/PipelineExplorer.tsx"
|
|
27
|
+
export type { PipelineExplorerProps } from "./pipeline/PipelineExplorer.tsx"
|
|
28
|
+
export { QueryForm } from "./pipeline/QueryForm.tsx"
|
|
29
|
+
export type { QueryFormProps } from "./pipeline/QueryForm.tsx"
|
|
30
|
+
export { ResolvedPlace } from "./pipeline/ResolvedPlace.tsx"
|
|
31
|
+
export type { ResolvedPlaceProps } from "./pipeline/ResolvedPlace.tsx"
|
|
32
|
+
|
|
33
|
+
export type { PipelineLoadingState, PipelinePanels, PipelineRuntime } from "#pipeline/types"
|
|
34
|
+
|
|
35
|
+
export { useParsePipeline } from "#pipeline/useParsePipeline"
|
|
36
|
+
export type { UseParsePipeline, UseParsePipelineOptions } from "#pipeline/useParsePipeline"
|
package/lib/poi/AbstainPanel.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `AbstainPanel` — shown when the query
|
|
6
|
+
* `AbstainPanel` — shown when the query has no POI intent (it parses as an address). Names the
|
|
7
7
|
* classifier's kind so the abstention is legible. Presentational.
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -15,7 +15,8 @@ import type { LiveSearchState } from "#poi/types"
|
|
|
15
15
|
|
|
16
16
|
export interface LiveResultsBlockProps {
|
|
17
17
|
/**
|
|
18
|
-
* Subject label for empty-state copy — a category ("No hospital results near …")
|
|
18
|
+
* Subject label for empty-state copy — a category ("No hospital results near …")
|
|
19
|
+
* or a brand ("No chevron results …").
|
|
19
20
|
*/
|
|
20
21
|
subjectLabel: string
|
|
21
22
|
/**
|
package/lib/poi/POIExplorer.tsx
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* `POIExplorer` — the composed POI-intent tester. Detects a POI subject in free text, shows the
|
|
7
|
-
* category + OverpassQL export, and (when a live-search probe is injected) searches the published
|
|
8
|
-
* poi.db layer. The intent path is self-contained — no weights, no network. All runtime concerns are
|
|
9
|
-
* in {@link usePOISearch}; this file is composition + a `ClientOnly` SSR boundary.
|
|
10
5
|
*/
|
|
11
6
|
|
|
12
7
|
import { type ReactNode, useState } from "react"
|
|
@@ -24,27 +19,35 @@ import { OverpassBlock } from "./OverpassBlock.tsx"
|
|
|
24
19
|
import { QueryInput } from "./QueryInput.tsx"
|
|
25
20
|
import { SubjectPanel } from "./SubjectPanel.tsx"
|
|
26
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Props for {@linkcode POIExplorer}.
|
|
24
|
+
*/
|
|
27
25
|
export interface POIExplorerProps {
|
|
28
26
|
/**
|
|
29
|
-
*
|
|
27
|
+
* The query that pre-fills the input.
|
|
30
28
|
*/
|
|
31
29
|
defaultText?: string
|
|
32
30
|
/**
|
|
33
|
-
*
|
|
31
|
+
* The example chips.
|
|
32
|
+
*
|
|
33
|
+
* @default POI_PRESETS
|
|
34
34
|
*/
|
|
35
35
|
presets?: ReadonlyArray<Preset>
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* A replacement loader for the taxonomy runtime, such as a mock in stories and tests.
|
|
38
38
|
*/
|
|
39
39
|
loadRuntime?: LoadPOIRuntime
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* The live poi.db search.
|
|
42
|
+
* Without it, the explorer shows only the detected intent.
|
|
42
43
|
*/
|
|
43
44
|
runLiveSearch?: POILiveSearch
|
|
44
45
|
/**
|
|
45
|
-
* Whether {@link runLiveSearch} can
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* Whether {@link runLiveSearch} can search brand subjects by Wikidata QID.
|
|
47
|
+
*
|
|
48
|
+
* When it is false, a brand subject shows its intent and QID chip without a live block.
|
|
49
|
+
* A byte-range probe over httpvfs should leave it off because a brand-wide
|
|
50
|
+
* lookup reads too much of the database.
|
|
48
51
|
*/
|
|
49
52
|
brandLiveSearch?: boolean
|
|
50
53
|
}
|
|
@@ -72,9 +75,8 @@ function POIExplorerInner({
|
|
|
72
75
|
|
|
73
76
|
const subject = result?.subject
|
|
74
77
|
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
// hint, so it must show one step earlier). Category: not build-local. Brand: brand-capable probe + a QID.
|
|
78
|
+
// A category is searchable unless it is build-local.
|
|
79
|
+
// A brand needs a QID and a brand-capable probe.
|
|
78
80
|
const showLiveBlock = Boolean(
|
|
79
81
|
runLiveSearch &&
|
|
80
82
|
subject &&
|
|
@@ -115,6 +117,13 @@ function POIExplorerInner({
|
|
|
115
117
|
)
|
|
116
118
|
}
|
|
117
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Renders a POI-intent tester that detects a POI subject in free text.
|
|
122
|
+
*
|
|
123
|
+
* It shows the matched category or brand and, for categories, an OverpassQL export.
|
|
124
|
+
* When `runLiveSearch` is set, it can also search the published poi.db.
|
|
125
|
+
* It renders only on the client.
|
|
126
|
+
*/
|
|
118
127
|
export function POIExplorer({
|
|
119
128
|
defaultText = POI_DEFAULT_TEXT,
|
|
120
129
|
presets = POI_PRESETS,
|
package/lib/poi/QueryInput.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `QueryInput` — the
|
|
6
|
+
* `QueryInput` — the labeled text field for the POI explorer. Controlled. presentational only.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { ReactNode } from "react"
|
package/lib/poi/SubjectPanel.tsx
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `SubjectPanel` — renders the detected POI subject. For a
|
|
7
|
-
* build-local badge + note. For a
|
|
6
|
+
* `SubjectPanel` — renders the detected POI subject. For a category: the category chip, the optional
|
|
7
|
+
* build-local badge + note. For a brand: the brand-name chip + a Wikidata QID chip (linked). Both
|
|
8
8
|
* share the match-detail list (matched phrase, confidence, anchor). Presentational.
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -17,7 +17,8 @@ export interface SubjectPanelProps {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* The shared match-detail list (matched phrase, confidence, anchor) —
|
|
20
|
+
* The shared match-detail list (matched phrase, confidence, anchor) —
|
|
21
|
+
* identical for category + brand subjects.
|
|
21
22
|
*/
|
|
22
23
|
function MatchDetail({ subject }: SubjectPanelProps): ReactNode {
|
|
23
24
|
return (
|
package/lib/poi/runtime.ts
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* The default POI runtime loader + presentation helpers. `loadPOIRuntime` dynamically imports the
|
|
7
|
-
* ~2k-record Overture taxonomy snapshot (so bundlers code-split it into its own chunk, fetched only
|
|
8
|
-
* when the explorer actually mounts) and wires the kind classifier over it. Pure + browser-safe: no
|
|
9
|
-
* network, no DOM — the whole intent path runs offline.
|
|
10
5
|
*/
|
|
11
6
|
|
|
12
7
|
import { createKindClassifier } from "@mailwoman/kind-classifier"
|
|
@@ -16,14 +11,10 @@ import { createPOIBrandLookup, createPOITaxonomyLookup } from "@mailwoman/poi-ta
|
|
|
16
11
|
import type { POIRuntime } from "#poi/types"
|
|
17
12
|
|
|
18
13
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
14
|
+
* Loads the browser POI runtime, importing the taxonomy and brand tables dynamically
|
|
15
|
+
* so they land in their own chunk instead of every consumer's bundle.
|
|
21
16
|
*
|
|
22
|
-
*
|
|
23
|
-
* matches a taxonomy CATEGORY wins (the curated set); only on a category miss does the chain-brand table fire,
|
|
24
|
-
* returning a `kind: "brand"` match carrying the brand's canonical name + Wikidata QID. (The Node path also chains
|
|
25
|
-
* `@mailwoman/variant-aliases` regional slang; the browser tester leaves that out — one fewer package + data table for
|
|
26
|
-
* a demo, and the QID-keyed brand table already covers the headline brands.)
|
|
17
|
+
* Its lexicon tries exact categories and then brands only, a subset of the Node `poiTaxonomyLookup` chain.
|
|
27
18
|
*/
|
|
28
19
|
export async function loadPOIRuntime(): Promise<POIRuntime> {
|
|
29
20
|
const [table, brandTable] = await Promise.all([
|
|
@@ -34,8 +25,6 @@ export async function loadPOIRuntime(): Promise<POIRuntime> {
|
|
|
34
25
|
const lookup = createPOITaxonomyLookup(table as Parameters<typeof createPOITaxonomyLookup>[0])
|
|
35
26
|
const brands = createPOIBrandLookup(brandTable as Parameters<typeof createPOIBrandLookup>[0])
|
|
36
27
|
|
|
37
|
-
// Adapt the taxonomy + brand lookups to the `POIPhraseLookup` shape the classifier expects: categories first, brands
|
|
38
|
-
// on a category miss.
|
|
39
28
|
const lexicon: POIPhraseLookup = (phrase, locale) => {
|
|
40
29
|
const categoryHits = lookup.lookupPOICategory(phrase, locale)
|
|
41
30
|
|
|
@@ -61,7 +50,7 @@ export async function loadPOIRuntime(): Promise<POIRuntime> {
|
|
|
61
50
|
}
|
|
62
51
|
|
|
63
52
|
/**
|
|
64
|
-
* Default example queries for the POI explorer — a mix of category, build-local
|
|
53
|
+
* Default example queries for the POI explorer — a mix of category, build-local and chain-brand subjects.
|
|
65
54
|
*/
|
|
66
55
|
export const POI_PRESETS = [
|
|
67
56
|
{ label: "Drinking fountain", value: "drinking fountain near Springfield" },
|
|
@@ -72,7 +61,7 @@ export const POI_PRESETS = [
|
|
|
72
61
|
] as const
|
|
73
62
|
|
|
74
63
|
/**
|
|
75
|
-
*
|
|
64
|
+
* Holds the query the POI explorer opens on, taken from the first preset so the two stay in step.
|
|
76
65
|
*/
|
|
77
66
|
export const POI_DEFAULT_TEXT = POI_PRESETS[0].value
|
|
78
67
|
|
package/lib/poi/types.ts
CHANGED
|
@@ -3,22 +3,26 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Types for the POI explorer.
|
|
7
|
-
*
|
|
8
|
-
* INJECTED async function ({@link POILiveSearch}) so the httpvfs/worker implementation stays out of this
|
|
9
|
-
* package's browser graph (it lives in the docs site, which knows where the layer is served).
|
|
6
|
+
* Types for the POI explorer. Live poi.db search is injected as {@link POILiveSearch} so the httpvfs
|
|
7
|
+
* worker stays out of this package's browser graph.
|
|
10
8
|
*/
|
|
11
9
|
|
|
12
10
|
import type { QueryKindResult } from "@mailwoman/core/pipeline"
|
|
13
11
|
import type { POIPhraseLookup, createKindClassifier } from "@mailwoman/kind-classifier"
|
|
14
12
|
import type { createPOITaxonomyLookup } from "@mailwoman/poi-taxonomy/table"
|
|
15
13
|
|
|
14
|
+
/**
|
|
15
|
+
* The POI taxonomy lookup that the explorer runtime loads.
|
|
16
|
+
*/
|
|
16
17
|
export type TaxonomyLookup = ReturnType<typeof createPOITaxonomyLookup>
|
|
17
18
|
|
|
19
|
+
/**
|
|
20
|
+
* One taxonomy category record.
|
|
21
|
+
*/
|
|
18
22
|
export type CategoryRecord = NonNullable<ReturnType<TaxonomyLookup["getPOICategory"]>>
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
|
-
* The lazily
|
|
25
|
+
* The lazily loaded POI runtime holds the taxonomy lookup, the lexicon and the kind classifier.
|
|
22
26
|
*/
|
|
23
27
|
export interface POIRuntime {
|
|
24
28
|
lookup: TaxonomyLookup
|
|
@@ -33,27 +37,27 @@ export interface POISubjectBase {
|
|
|
33
37
|
matchedPhrase: string
|
|
34
38
|
confidence: number
|
|
35
39
|
/**
|
|
36
|
-
* The
|
|
40
|
+
* The rest of the query after the subject, usually the location anchor such as "near Springfield".
|
|
37
41
|
*/
|
|
38
42
|
remainder: string
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
/**
|
|
42
|
-
* A resolved POI subject that
|
|
46
|
+
* A resolved POI subject that matched a taxonomy category such as `cafe` or `hospital`.
|
|
43
47
|
*/
|
|
44
48
|
export interface POICategorySubject extends POISubjectBase {
|
|
45
49
|
kind: "category"
|
|
46
50
|
category: CategoryRecord
|
|
47
51
|
/**
|
|
48
|
-
* Whether this category
|
|
52
|
+
* Whether this category requires the locally built OSM (ODbL) layer.
|
|
49
53
|
*/
|
|
50
54
|
buildLocal: boolean
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
/**
|
|
54
|
-
* A resolved POI subject that
|
|
55
|
-
*
|
|
56
|
-
*
|
|
58
|
+
* A resolved POI subject that matched a chain brand such as `chevron`.
|
|
59
|
+
*
|
|
60
|
+
* Live search looks up a brand by its Wikidata QID instead of by category k-ring.
|
|
57
61
|
*/
|
|
58
62
|
export interface POIBrandSubject extends POISubjectBase {
|
|
59
63
|
kind: "brand"
|
|
@@ -62,18 +66,21 @@ export interface POIBrandSubject extends POISubjectBase {
|
|
|
62
66
|
*/
|
|
63
67
|
name: string
|
|
64
68
|
/**
|
|
65
|
-
* Wikidata QID
|
|
69
|
+
* The brand's Wikidata QID.
|
|
70
|
+
* It is absent when the lexicon had no QID for the brand.
|
|
66
71
|
*/
|
|
67
72
|
wikidata?: string
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
/**
|
|
71
|
-
* A resolved POI subject
|
|
76
|
+
* A resolved POI subject, either a taxonomy category or a chain brand.
|
|
72
77
|
*/
|
|
73
78
|
export type POISubject = POICategorySubject | POIBrandSubject
|
|
74
79
|
|
|
75
80
|
/**
|
|
76
|
-
* The intent-only result
|
|
81
|
+
* The intent-only result.
|
|
82
|
+
*
|
|
83
|
+
* It holds the kind verdict and, when a category subject was detected, its OverpassQL export.
|
|
77
84
|
*/
|
|
78
85
|
export interface POIExplorerResult {
|
|
79
86
|
kindResult: QueryKindResult
|
|
@@ -95,8 +102,10 @@ export interface POISearchHit {
|
|
|
95
102
|
}
|
|
96
103
|
|
|
97
104
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
105
|
+
* The result of an injected live search.
|
|
106
|
+
*
|
|
107
|
+
* The `unplaced` and `unavailable` states stay separate so the UI can tell an
|
|
108
|
+
* unresolved anchor apart from an unreachable layer.
|
|
100
109
|
*/
|
|
101
110
|
export type POILiveSearchResult =
|
|
102
111
|
| { status: "success"; hits: POISearchHit[]; centerName: string }
|
|
@@ -104,28 +113,30 @@ export type POILiveSearchResult =
|
|
|
104
113
|
| { status: "unavailable" }
|
|
105
114
|
|
|
106
115
|
/**
|
|
107
|
-
* The injected live-search function.
|
|
108
|
-
*
|
|
116
|
+
* The injected live-search function.
|
|
117
|
+
*
|
|
118
|
+
* It probes the published poi.db for the resolved category, its Overture leaf
|
|
119
|
+
* categories and the anchor text.
|
|
120
|
+
* The explorer runs intent-only when this function is absent.
|
|
121
|
+
*
|
|
122
|
+
* For a brand subject, `brandWikidata` contains the QID and the probe fetches by it.
|
|
123
|
+
* In that case `categoryID` holds the brand name and `overtureCategoryIDs` is empty.
|
|
109
124
|
*
|
|
110
|
-
*
|
|
111
|
-
* fetches by that QID instead of a category k-ring (`categoryID`/`overtureCategoryIDs` are then the brand name / empty
|
|
112
|
-
* and unused). The category path is byte-identical to before. A probe that can't serve brands simply leaves brand live
|
|
113
|
-
* search unwired at the call site (see `usePOISearch`'s `brandLiveSearch` option) — the docs' httpvfs probe does
|
|
114
|
-
* exactly that, brand-wide row hydration being pathological over byte-range (measured; the brand path is server-side
|
|
115
|
-
* only).
|
|
125
|
+
* A probe that cannot serve brands should leave `usePOISearch`'s `brandLiveSearch` option unset.
|
|
116
126
|
*/
|
|
117
127
|
export type POILiveSearch = (params: {
|
|
118
128
|
categoryID: string
|
|
119
129
|
overtureCategoryIDs: string[]
|
|
120
130
|
anchor: string
|
|
121
131
|
/**
|
|
122
|
-
*
|
|
132
|
+
* The brand's Wikidata QID.
|
|
133
|
+
* It is present only when the subject is a chain brand.
|
|
123
134
|
*/
|
|
124
135
|
brandWikidata?: string
|
|
125
136
|
}) => Promise<POILiveSearchResult>
|
|
126
137
|
|
|
127
138
|
/**
|
|
128
|
-
* "Search live"
|
|
139
|
+
* The state of a "Search live" request.
|
|
129
140
|
*/
|
|
130
141
|
export type LiveSearchState =
|
|
131
142
|
| { status: "idle" }
|
|
@@ -134,6 +145,7 @@ export type LiveSearchState =
|
|
|
134
145
|
| { status: "success"; hits: POISearchHit[]; centerName: string }
|
|
135
146
|
|
|
136
147
|
/**
|
|
137
|
-
* A
|
|
148
|
+
* A runtime loader.
|
|
149
|
+
* Stories and tests inject one to substitute a mock taxonomy.
|
|
138
150
|
*/
|
|
139
151
|
export type LoadPOIRuntime = () => Promise<POIRuntime>
|