@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMapBearing.d.ts","sourceRoot":"","sources":["../../lib/map/useMapBearing.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"useMapBearing.d.ts","sourceRoot":"","sources":["../../lib/map/useMapBearing.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,UAAU,EAAE,MAAM,IAAI,CAAA;CACtB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,GAAG,aAAa,CAyBpE"}
|
package/out/map/useMapBearing.js
CHANGED
|
@@ -3,17 +3,12 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* The map is an external store, so it is read through `useSyncExternalStore` rather than mirrored into state by an
|
|
9
|
-
* effect: the bearing is a number, which makes a stable snapshot, and React tears nothing during a concurrent
|
|
10
|
-
* render.
|
|
11
|
-
*
|
|
12
|
-
* It listens on `rotate` rather than `rotateend`, because the needle has to track the gesture rather than snap once
|
|
13
|
-
* the gesture is over. `move` is subscribed too: a `flyTo` or an `easeTo` carrying a bearing rotates the map without
|
|
14
|
-
* firing a rotate event, and a compass that misses those stays pointing north over a turned map.
|
|
6
|
+
* The map's rotation as React state, read through `useSyncExternalStore` and subscribed to `move` as well as `rotate`, since a `flyTo` or `easeTo` carrying a direction fires no rotate event.
|
|
15
7
|
*/
|
|
16
8
|
import { useCallback, useSyncExternalStore } from "react";
|
|
9
|
+
/**
|
|
10
|
+
* Reads the live map bearing and exposes `resetNorth`.
|
|
11
|
+
*/
|
|
17
12
|
export function useMapBearing(map) {
|
|
18
13
|
const subscribe = useCallback((onChange) => {
|
|
19
14
|
if (!map)
|
|
@@ -25,8 +20,8 @@ export function useMapBearing(map) {
|
|
|
25
20
|
map.off("move", onChange);
|
|
26
21
|
};
|
|
27
22
|
}, [map]);
|
|
28
|
-
// The server snapshot is the same reading:
|
|
29
|
-
// shows
|
|
23
|
+
// The server snapshot is the same reading: the server renders no map.
|
|
24
|
+
// and north is what a compass shows with no bearing to report.
|
|
30
25
|
const readBearing = useCallback(() => map?.getBearing() ?? 0, [map]);
|
|
31
26
|
const bearing = useSyncExternalStore(subscribe, readBearing, () => 0);
|
|
32
27
|
const resetNorth = useCallback(() => map?.easeTo({ bearing: 0, pitch: 0 }), [map]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMapBearing.js","sourceRoot":"","sources":["../../lib/map/useMapBearing.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"useMapBearing.js","sourceRoot":"","sources":["../../lib/map/useMapBearing.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAmBzD;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,GAAuB;IACpD,MAAM,SAAS,GAAG,WAAW,CAC5B,CAAC,QAAoB,EAAE,EAAE;QACxB,IAAI,CAAC,GAAG;YAAE,OAAO,GAAG,EAAE,CAAC,SAAS,CAAA;QAEhC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAC1B,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QAExB,OAAO,GAAG,EAAE;YACX,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YAC3B,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QAC1B,CAAC,CAAA;IACF,CAAC,EACD,CAAC,GAAG,CAAC,CACL,CAAA;IAED,sEAAsE;IACtE,+DAA+D;IAC/D,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;IAEpE,MAAM,OAAO,GAAG,oBAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IAErE,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;IAElF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAA;AAC/B,CAAC"}
|
|
@@ -3,21 +3,11 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* A label on a map looks like a link, so a visitor clicks it. Without this the click reaches the map's pan handler
|
|
9
|
-
* and nothing happens, which reads as the label being decoration.
|
|
10
|
-
*
|
|
11
|
-
* It reads the label's OWN name from the rendered feature rather than reverse-geocoding the click point: the name
|
|
12
|
-
* is what the visitor pointed at, and a lookup by coordinate answers whatever is nearest instead, which on a dense
|
|
13
|
-
* basemap is regularly not the thing under the cursor.
|
|
14
|
-
*
|
|
15
|
-
* THE QUERY IS SCOPED, AND THE HOVER QUERY IS THROTTLED. `queryRenderedFeatures` with no `layers` walks the whole
|
|
16
|
-
* style: measured at 64.3 ms per call returning 4,819 features over the 79-layer basemap at zoom 14 in Manhattan,
|
|
17
|
-
* against 4.9 ms and 44 features scoped to that style's 11 label layers. At one call per pointer move the unscoped
|
|
18
|
-
* form is the map's whole frame budget, so the layer list is resolved once per style and the hover query runs at
|
|
19
|
-
* most once per animation frame. The click query is not throttled — there is one of those per click.
|
|
6
|
+
* A place-label click searches for its own name. The hook resolves the layer list once per style and throttles the hover query to one per animation frame.
|
|
20
7
|
*/
|
|
21
8
|
import type { MapInstance } from "react-map-gl/maplibre";
|
|
9
|
+
/**
|
|
10
|
+
* Routes clicks on map labels to `onPick` with the clicked label's own name.
|
|
11
|
+
*/
|
|
22
12
|
export declare function useMapLabelPick(map: MapInstance | null, onPick: (name: string) => void): void;
|
|
23
13
|
//# sourceMappingURL=useMapLabelPick.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMapLabelPick.d.ts","sourceRoot":"","sources":["../../lib/map/useMapLabelPick.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"useMapLabelPick.d.ts","sourceRoot":"","sources":["../../lib/map/useMapLabelPick.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,uBAAuB,CAAA;AA2C5E;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CA0D7F"}
|
|
@@ -3,38 +3,26 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* A label on a map looks like a link, so a visitor clicks it. Without this the click reaches the map's pan handler
|
|
9
|
-
* and nothing happens, which reads as the label being decoration.
|
|
10
|
-
*
|
|
11
|
-
* It reads the label's OWN name from the rendered feature rather than reverse-geocoding the click point: the name
|
|
12
|
-
* is what the visitor pointed at, and a lookup by coordinate answers whatever is nearest instead, which on a dense
|
|
13
|
-
* basemap is regularly not the thing under the cursor.
|
|
14
|
-
*
|
|
15
|
-
* THE QUERY IS SCOPED, AND THE HOVER QUERY IS THROTTLED. `queryRenderedFeatures` with no `layers` walks the whole
|
|
16
|
-
* style: measured at 64.3 ms per call returning 4,819 features over the 79-layer basemap at zoom 14 in Manhattan,
|
|
17
|
-
* against 4.9 ms and 44 features scoped to that style's 11 label layers. At one call per pointer move the unscoped
|
|
18
|
-
* form is the map's whole frame budget, so the layer list is resolved once per style and the hover query runs at
|
|
19
|
-
* most once per animation frame. The click query is not throttled — there is one of those per click.
|
|
6
|
+
* A place-label click searches for its own name. The hook resolves the layer list once per style and throttles the hover query to one per animation frame.
|
|
20
7
|
*/
|
|
21
8
|
import { useEffect, useEffectEvent } from "react";
|
|
22
9
|
/**
|
|
23
|
-
* The
|
|
24
|
-
*
|
|
10
|
+
* The protomaps label layers (`<theme>_label`, `places_*`); other layers are geometry
|
|
11
|
+
* rather than readable place names.
|
|
25
12
|
*/
|
|
26
13
|
const LABEL_LAYER = /_label|^places_/;
|
|
27
14
|
/**
|
|
28
|
-
* Properties a label
|
|
29
|
-
*
|
|
15
|
+
* Properties that may contain a label's text, in trust order.
|
|
16
|
+
*
|
|
17
|
+
* `name` comes from Protomaps.
|
|
18
|
+
* Localized variants appear in script-specific styles.
|
|
30
19
|
*/
|
|
31
20
|
const NAME_KEYS = ["name", "name:en", "name_en"];
|
|
32
21
|
/**
|
|
33
|
-
* The style's label
|
|
22
|
+
* The style's label layer ids.
|
|
34
23
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* between "this style has no labels" and "query everything" is the 64 ms this hook exists to avoid.
|
|
24
|
+
* An empty result must stay unqueried, since an empty `layers` option is not the
|
|
25
|
+
* same as an absent one in `queryRenderedFeatures`.
|
|
38
26
|
*/
|
|
39
27
|
function labelLayerIDs(map) {
|
|
40
28
|
const layers = map.getStyle()?.layers ?? [];
|
|
@@ -43,8 +31,7 @@ function labelLayerIDs(map) {
|
|
|
43
31
|
function labelNameAt(map, point, layers) {
|
|
44
32
|
if (!layers.length)
|
|
45
33
|
return null;
|
|
46
|
-
// `queryRenderedFeatures` answers
|
|
47
|
-
// and therefore the one a click landed on.
|
|
34
|
+
// `queryRenderedFeatures` answers topmost-first, so the first feature with a label is the one the click landed on.
|
|
48
35
|
for (const feature of map.queryRenderedFeatures(point, { layers })) {
|
|
49
36
|
for (const key of NAME_KEYS) {
|
|
50
37
|
const value = feature.properties?.[key];
|
|
@@ -54,16 +41,19 @@ function labelNameAt(map, point, layers) {
|
|
|
54
41
|
}
|
|
55
42
|
return null;
|
|
56
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Routes clicks on map labels to `onPick` with the clicked label's own name.
|
|
46
|
+
*/
|
|
57
47
|
export function useMapLabelPick(map, onPick) {
|
|
58
|
-
// The subscription depends on the
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
// handler that always sees the latest props without being a reactive dependency.
|
|
48
|
+
// The subscription depends only on the map.
|
|
49
|
+
// `onPick` changes on every render.
|
|
50
|
+
// `useEffectEvent` reads the latest callback without adding it as a reactive dependency.
|
|
62
51
|
const pick = useEffectEvent((name) => onPick(name));
|
|
63
52
|
useEffect(() => {
|
|
64
53
|
if (!map)
|
|
65
54
|
return;
|
|
66
|
-
// Recomputed when the style swaps
|
|
55
|
+
// Recomputed when the style swaps.
|
|
56
|
+
// Pointer moves read the cached list.
|
|
67
57
|
let layers = labelLayerIDs(map);
|
|
68
58
|
const readLayers = () => {
|
|
69
59
|
layers = labelLayerIDs(map);
|
|
@@ -81,7 +71,8 @@ export function useMapLabelPick(map, onPick) {
|
|
|
81
71
|
frame = requestAnimationFrame(() => {
|
|
82
72
|
frame = 0;
|
|
83
73
|
const canvas = map.getCanvas();
|
|
84
|
-
// The drag cursor belongs to the pan gesture
|
|
74
|
+
// The drag cursor belongs to the pan gesture.
|
|
75
|
+
// An override mid-drag would fight the map for the pointer.
|
|
85
76
|
if (canvas.style.cursor === "grabbing")
|
|
86
77
|
return;
|
|
87
78
|
canvas.style.cursor = labelNameAt(map, event.point, layers) ? "pointer" : "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMapLabelPick.js","sourceRoot":"","sources":["../../lib/map/useMapLabelPick.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"useMapLabelPick.js","sourceRoot":"","sources":["../../lib/map/useMapLabelPick.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,C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CAAC;gBACX,oBAAoB,CAAC,KAAK,CAAC,CAAA;YAC5B,CAAC;YAED,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;YAChC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YACzB,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;YAC5B,GAAG,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAA;QAClC,CAAC,CAAA;IACF,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -3,15 +3,11 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* recomputes the render spec only when the resolved place changes, so the declarative overlays render a
|
|
8
|
-
* stable spec object. The MATH lives in `place-render.ts` (pure, node-tested); this file adds nothing
|
|
9
|
-
* but memoization, so it stays trivially correct. A `null` place (no result yet, or a result with no
|
|
10
|
-
* candidate) yields `null` — the overlays render nothing.
|
|
6
|
+
* The thin React memo wrapper over the pure {@link computeMapPlaceRenderSpec}; a `null` place yields `null`.
|
|
11
7
|
*/
|
|
12
8
|
import type { MapPlaceRenderSpec, ResolvedMapPlace } from "#map/place-render";
|
|
13
9
|
/**
|
|
14
|
-
* Memoize the render spec for a resolved place; `null` in → `null` out (
|
|
10
|
+
* Memoize the render spec for a resolved place; `null` in → `null` out (no geometry to draw).
|
|
15
11
|
*/
|
|
16
|
-
export declare function useMapPlaceRender(place: ResolvedMapPlace | null
|
|
12
|
+
export declare function useMapPlaceRender(place: ResolvedMapPlace | null): MapPlaceRenderSpec | null;
|
|
17
13
|
//# sourceMappingURL=useMapPlaceRender.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMapPlaceRender.d.ts","sourceRoot":"","sources":["../../lib/map/useMapPlaceRender.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"useMapPlaceRender.d.ts","sourceRoot":"","sources":["../../lib/map/useMapPlaceRender.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAE7E;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,kBAAkB,GAAG,IAAI,CAE3F"}
|
|
@@ -3,16 +3,12 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* recomputes the render spec only when the resolved place changes, so the declarative overlays render a
|
|
8
|
-
* stable spec object. The MATH lives in `place-render.ts` (pure, node-tested); this file adds nothing
|
|
9
|
-
* but memoization, so it stays trivially correct. A `null` place (no result yet, or a result with no
|
|
10
|
-
* candidate) yields `null` — the overlays render nothing.
|
|
6
|
+
* The thin React memo wrapper over the pure {@link computeMapPlaceRenderSpec}; a `null` place yields `null`.
|
|
11
7
|
*/
|
|
12
8
|
import { useMemo } from "react";
|
|
13
9
|
import { computeMapPlaceRenderSpec } from "#map/place-render";
|
|
14
10
|
/**
|
|
15
|
-
* Memoize the render spec for a resolved place; `null` in → `null` out (
|
|
11
|
+
* Memoize the render spec for a resolved place; `null` in → `null` out (no geometry to draw).
|
|
16
12
|
*/
|
|
17
13
|
export function useMapPlaceRender(place) {
|
|
18
14
|
return useMemo(() => (place ? computeMapPlaceRenderSpec(place) : null), [place]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMapPlaceRender.js","sourceRoot":"","sources":["../../lib/map/useMapPlaceRender.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"useMapPlaceRender.js","sourceRoot":"","sources":["../../lib/map/useMapPlaceRender.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAG7D;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA8B;IAC/D,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;AACjF,CAAC"}
|
|
@@ -2,44 +2,39 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* `usePlaceAutocomplete` — the headless "Did you mean" combobox lifted from the demo god component
|
|
7
|
-
* (`_app.tsx:820-900`). It walks the host-supplied `autocomplete` over the locality segment the visitor
|
|
8
|
-
* is typing (the text after the last comma), owns the suggestion list + keyboard-highlighted active
|
|
9
|
-
* descendant, and rewrites the input on pick (replacing just that segment). No FST, no fetch of its own
|
|
10
|
-
* — the `autocomplete` fetcher is INJECTED (the package never imports `@mailwoman/resolver-wof-sqlite`),
|
|
11
|
-
* so this stays node-safe and testable with a synchronous fake.
|
|
12
|
-
*
|
|
13
|
-
* Returns the `<input>` aria/combobox props to spread onto the reused {@link QueryForm} input plus an
|
|
14
|
-
* `onInputKeyDown` (↑/↓ move the highlight, Enter accepts it AND suppresses submit, Esc dismisses), and
|
|
15
|
-
* the presentational {@link PlaceAutocomplete} listbox renders `suggestions` / `activeIndex`.
|
|
16
5
|
*/
|
|
17
6
|
import { type KeyboardEvent } from "react";
|
|
18
7
|
import type { Suggestion } from "#map/types";
|
|
8
|
+
/**
|
|
9
|
+
* Options for {@linkcode usePlaceAutocomplete}.
|
|
10
|
+
*/
|
|
19
11
|
export interface UsePlaceAutocompleteOptions {
|
|
20
12
|
/**
|
|
21
|
-
* The
|
|
13
|
+
* The controlled input text.
|
|
14
|
+
* The segment after the last comma is the query.
|
|
22
15
|
*/
|
|
23
16
|
text: string;
|
|
24
17
|
/**
|
|
25
|
-
*
|
|
18
|
+
* Sets the input text.
|
|
19
|
+
* A pick calls it with the last segment replaced.
|
|
26
20
|
*/
|
|
27
21
|
setText: (text: string) => void;
|
|
28
22
|
/**
|
|
29
|
-
*
|
|
23
|
+
* Fetches suggestions for a query.
|
|
24
|
+
* Without it the hook never suggests anything.
|
|
30
25
|
*/
|
|
31
26
|
autocomplete?: (query: string) => Promise<Suggestion[]>;
|
|
32
27
|
/**
|
|
33
|
-
*
|
|
28
|
+
* @defaultValue `2`
|
|
34
29
|
*/
|
|
35
30
|
minChars?: number;
|
|
36
31
|
/**
|
|
37
|
-
*
|
|
32
|
+
* @defaultValue `150`
|
|
38
33
|
*/
|
|
39
34
|
debounceMs?: number;
|
|
40
35
|
}
|
|
41
36
|
/**
|
|
42
|
-
* The combobox
|
|
37
|
+
* The combobox ARIA props to spread onto the input.
|
|
43
38
|
*/
|
|
44
39
|
export interface AutocompleteInputProps {
|
|
45
40
|
role: "combobox";
|
|
@@ -49,43 +44,50 @@ export interface AutocompleteInputProps {
|
|
|
49
44
|
"aria-activedescendant": string | undefined;
|
|
50
45
|
autoComplete: "off";
|
|
51
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* The state and handlers that {@linkcode usePlaceAutocomplete} returns.
|
|
49
|
+
*/
|
|
52
50
|
export interface UsePlaceAutocomplete {
|
|
53
51
|
/**
|
|
54
|
-
* The current suggestions
|
|
52
|
+
* The current suggestions, empty when none match or the visitor dismissed the list.
|
|
55
53
|
*/
|
|
56
54
|
suggestions: Suggestion[];
|
|
57
55
|
/**
|
|
58
|
-
* The
|
|
56
|
+
* The index highlighted by the keyboard, or `-1` for none.
|
|
59
57
|
*/
|
|
60
58
|
activeIndex: number;
|
|
61
59
|
/**
|
|
62
|
-
*
|
|
60
|
+
* Sets the highlighted index, such as when the pointer enters an option.
|
|
63
61
|
*/
|
|
64
62
|
setActiveIndex: (index: number) => void;
|
|
65
63
|
/**
|
|
66
|
-
*
|
|
64
|
+
* Handles input keys: arrows move the highlight, Enter picks instead of submitting and Escape dismisses.
|
|
67
65
|
*/
|
|
68
66
|
onInputKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
69
67
|
/**
|
|
70
|
-
*
|
|
68
|
+
* Replaces the text after the last comma with the suggestion and closes the list.
|
|
71
69
|
*/
|
|
72
70
|
pick: (value: string) => void;
|
|
73
71
|
/**
|
|
74
|
-
*
|
|
72
|
+
* Closes the list without picking until the query changes.
|
|
75
73
|
*/
|
|
76
74
|
dismiss: () => void;
|
|
77
75
|
/**
|
|
78
|
-
*
|
|
76
|
+
* The combobox ARIA props to spread onto the input.
|
|
79
77
|
*/
|
|
80
78
|
inputProps: AutocompleteInputProps;
|
|
81
79
|
/**
|
|
82
|
-
* The listbox element
|
|
80
|
+
* The listbox element ID.
|
|
81
|
+
* It matches `inputProps["aria-controls"]`.
|
|
83
82
|
*/
|
|
84
83
|
listboxID: string;
|
|
85
|
-
/**
|
|
86
|
-
* Build the option element id for suggestion `index`.
|
|
87
|
-
*/
|
|
88
84
|
optionID: (index: number) => string;
|
|
89
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Fetches debounced place suggestions for the text after the input's last comma.
|
|
88
|
+
*
|
|
89
|
+
* A pick replaces only that segment.
|
|
90
|
+
* A digit-leading segment never reaches `autocomplete`.
|
|
91
|
+
*/
|
|
90
92
|
export declare function usePlaceAutocomplete({ text, setText, autocomplete, minChars, debounceMs, }: UsePlaceAutocompleteOptions): UsePlaceAutocomplete;
|
|
91
93
|
//# sourceMappingURL=usePlaceAutocomplete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlaceAutocomplete.d.ts","sourceRoot":"","sources":["../../lib/map/usePlaceAutocomplete.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"usePlaceAutocomplete.d.ts","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,UAAU,EAAE,sBAAsB,CAAA;IAElC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAA;IAEjB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CACnC;AAeD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACpC,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,QAAY,EACZ,UAAgB,GAChB,EAAE,2BAA2B,GAAG,oBAAoB,CAyGpD"}
|
|
@@ -2,52 +2,26 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* `usePlaceAutocomplete` — the headless "Did you mean" combobox lifted from the demo god component
|
|
7
|
-
* (`_app.tsx:820-900`). It walks the host-supplied `autocomplete` over the locality segment the visitor
|
|
8
|
-
* is typing (the text after the last comma), owns the suggestion list + keyboard-highlighted active
|
|
9
|
-
* descendant, and rewrites the input on pick (replacing just that segment). No FST, no fetch of its own
|
|
10
|
-
* — the `autocomplete` fetcher is INJECTED (the package never imports `@mailwoman/resolver-wof-sqlite`),
|
|
11
|
-
* so this stays node-safe and testable with a synchronous fake.
|
|
12
|
-
*
|
|
13
|
-
* Returns the `<input>` aria/combobox props to spread onto the reused {@link QueryForm} input plus an
|
|
14
|
-
* `onInputKeyDown` (↑/↓ move the highlight, Enter accepts it AND suppresses submit, Esc dismisses), and
|
|
15
|
-
* the presentational {@link PlaceAutocomplete} listbox renders `suggestions` / `activeIndex`.
|
|
16
5
|
*/
|
|
17
6
|
import { useCallback, useEffect, useState } from "react";
|
|
18
7
|
import { useDebouncedValue } from "#common/useDebouncedValue";
|
|
19
8
|
const LISTBOX_ID = "mw-demo-suggest-list";
|
|
20
|
-
/**
|
|
21
|
-
* Stable empty list for the derived no-suggestions state — a fresh `[]` per render would churn the identity every
|
|
22
|
-
* consumer and every useCallback dependency list sees.
|
|
23
|
-
*/
|
|
24
9
|
const NO_SUGGESTIONS = [];
|
|
25
10
|
const optionID = (index) => `mw-demo-suggest-${index}`;
|
|
26
|
-
/**
|
|
27
|
-
* Extract the locality segment being typed — the text after the last comma, trimmed.
|
|
28
|
-
*/
|
|
29
11
|
function localitySegment(text) {
|
|
30
12
|
return (text.includes(",") ? text.slice(text.lastIndexOf(",") + 1) : text).trim();
|
|
31
13
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Replace the locality segment (after the last comma) with `name`, preserving the address prefix.
|
|
34
|
-
*/
|
|
35
14
|
function replaceSegment(current, name) {
|
|
36
15
|
return current.includes(",") ? `${current.slice(0, current.lastIndexOf(",") + 1)} ${name}` : name;
|
|
37
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Fetches debounced place suggestions for the text after the input's last comma.
|
|
19
|
+
*
|
|
20
|
+
* A pick replaces only that segment.
|
|
21
|
+
* A digit-leading segment never reaches `autocomplete`.
|
|
22
|
+
*/
|
|
38
23
|
export function usePlaceAutocomplete({ text, setText, autocomplete, minChars = 2, debounceMs = 150, }) {
|
|
39
|
-
/**
|
|
40
|
-
* The last COMPLETED fetch, keyed by the query that produced it. Visibility is DERIVED from this during render rather
|
|
41
|
-
* than pushed through sync setStates in the effect — the effect's only job is the async fetch, so every state write
|
|
42
|
-
* in it happens after an await and the react(set-state-in-effect) rule is satisfied by structure, not by exception.
|
|
43
|
-
*/
|
|
44
24
|
const [fetched, setFetched] = useState(null);
|
|
45
|
-
/**
|
|
46
|
-
* The query whose list was dismissed or picked. Suppression as DATA, replacing the one-shot ref flag: a pick stores
|
|
47
|
-
* the query the rewritten text will produce, so the post-pick fetch is skipped and the place just chosen is never
|
|
48
|
-
* re-suggested. One divergence from the ref version, accepted and small: after Esc, retyping the exact same string
|
|
49
|
-
* keeps the list hidden until the query changes.
|
|
50
|
-
*/
|
|
51
25
|
const [dismissed, setDismissed] = useState(null);
|
|
52
26
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
53
27
|
const query = localitySegment(text);
|
|
@@ -82,7 +56,6 @@ export function usePlaceAutocomplete({ text, setText, autocomplete, minChars = 2
|
|
|
82
56
|
const pick = useCallback((value) => {
|
|
83
57
|
const next = replaceSegment(text, value);
|
|
84
58
|
setText(next);
|
|
85
|
-
// Suppress the fetch the rewritten text would trigger — the segment being typed IS the picked name.
|
|
86
59
|
setDismissed(localitySegment(next));
|
|
87
60
|
setFetched(null);
|
|
88
61
|
setActiveIndex(-1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlaceAutocomplete.js","sourceRoot":"","sources":["../../lib/map/usePlaceAutocomplete.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"usePlaceAutocomplete.js","sourceRoot":"","sources":["../../lib/map/usePlaceAutocomplete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAsB,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAgG7D,MAAM,UAAU,GAAG,sBAAsB,CAAA;AAEzC,MAAM,cAAc,GAAiB,EAAE,CAAA;AACvC,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,mBAAmB,KAAK,EAAE,CAAA;AAE9D,SAAS,eAAe,CAAC,IAAY;IACpC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;AAClF,CAAC;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,IAAY;IACpD,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,GA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.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `@mailwoman/react/map` — the geocoder map surface, kept behind its own subpath so `maplibre-gl`
|
|
7
|
+
* / `react-map-gl` (WebGL + DOM at import) never enter the package-root graph. This subpath import
|
|
8
|
+
* pulls the map deps. importing `@mailwoman/react` (root) does not. Consumers who only want the
|
|
9
|
+
* parse/POI explorers never pay for maplibre.
|
|
10
|
+
*
|
|
11
|
+
* The host must supply `maplibre-gl` + `react-map-gl` (peer deps) and import
|
|
12
|
+
* `maplibre-gl/dist/maplibre-gl.css` + `@mailwoman/react/styles.css` itself.
|
|
13
|
+
*/
|
|
14
|
+
export { MapCanvas } from "./map/MapCanvas.tsx";
|
|
15
|
+
export type { MapCanvasExtraProps, MapCanvasProps, MapCanvasStyle } from "./map/MapCanvas.tsx";
|
|
16
|
+
export { MapChipRow } from "./map/MapChipRow.tsx";
|
|
17
|
+
export type { MapChip, MapChipRowProps } from "./map/MapChipRow.tsx";
|
|
18
|
+
export { MapCompass } from "./map/MapCompass.tsx";
|
|
19
|
+
export type { MapCompassProps } from "./map/MapCompass.tsx";
|
|
20
|
+
export { useMapBearing } from "./map/useMapBearing.ts";
|
|
21
|
+
export type { UseMapBearing } from "./map/useMapBearing.ts";
|
|
22
|
+
export { useMapLabelPick } from "./map/useMapLabelPick.ts";
|
|
23
|
+
export { MapControlButton, MapControlGroup, MapControlStack } from "./map/MapControlStack.tsx";
|
|
24
|
+
export type { MapControlButtonProps, MapControlGroupProps, MapControlStackProps } from "./map/MapControlStack.tsx";
|
|
25
|
+
export { MapFooter } from "./map/MapFooter.tsx";
|
|
26
|
+
export type { MapFooterProps } from "./map/MapFooter.tsx";
|
|
27
|
+
export { MapProgressBar } from "./map/MapProgressBar.tsx";
|
|
28
|
+
export type { MapProgressBarProps } from "./map/MapProgressBar.tsx";
|
|
29
|
+
export { MapSheet, SheetClose } from "./map/MapSheet.tsx";
|
|
30
|
+
export type { MapSheetProps } from "./map/MapSheet.tsx";
|
|
31
|
+
export { MapSearchBar, SearchGlyph } from "./map/MapSearchBar.tsx";
|
|
32
|
+
export type { MapSearchBarProps } from "./map/MapSearchBar.tsx";
|
|
33
|
+
export type { CompareContext, GeocoderPanels, GeocoderRuntime, LngLatTuple, MapBias, OverlaySpec, ResultContext, Suggestion, VersionOption, } from "#map/types";
|
|
34
|
+
export { approxCircleGeometry, bboxToBounds, geomBounds, radiusCircleGeometry } from "#map/geometry";
|
|
35
|
+
export type { BoundsTuple, PlaceGeometry } from "#map/geometry";
|
|
36
|
+
export { cameraToViewState, computeMapPlaceRenderSpec } from "#map/place-render";
|
|
37
|
+
export type { LngLat, MapCameraTarget, MapPlaceRenderSpec, PlaceTier, ResolvedMapPlace } from "#map/place-render";
|
|
38
|
+
export { useMapPlaceRender } from "#map/useMapPlaceRender";
|
|
39
|
+
export { OverlayLayers } from "./map/OverlayLayers.tsx";
|
|
40
|
+
export type { OverlayLayersProps } from "./map/OverlayLayers.tsx";
|
|
41
|
+
export { PlaceMarker } from "./map/PlaceMarker.tsx";
|
|
42
|
+
export type { PlaceMarkerProps } from "./map/PlaceMarker.tsx";
|
|
43
|
+
export { ResolvedPlaceLayers } from "./map/ResolvedPlaceLayers.tsx";
|
|
44
|
+
export type { ResolvedPlaceLayersProps } from "./map/ResolvedPlaceLayers.tsx";
|
|
45
|
+
export { ResultCamera } from "./map/ResultCamera.tsx";
|
|
46
|
+
export type { ResultCameraProps } from "./map/ResultCamera.tsx";
|
|
47
|
+
export { ResultOverlay } from "./map/ResultOverlay.tsx";
|
|
48
|
+
export type { ResultOverlayProps } from "./map/ResultOverlay.tsx";
|
|
49
|
+
export { CompareToggle } from "./map/CompareToggle.tsx";
|
|
50
|
+
export type { CompareToggleProps } from "./map/CompareToggle.tsx";
|
|
51
|
+
export { Geocoder } from "./map/Geocoder.tsx";
|
|
52
|
+
export type { GeocoderProps } from "./map/Geocoder.tsx";
|
|
53
|
+
export { GeocoderControls } from "./map/GeocoderControls.tsx";
|
|
54
|
+
export type { GeocoderControlsProps } from "./map/GeocoderControls.tsx";
|
|
55
|
+
export { PlaceAutocomplete } from "./map/PlaceAutocomplete.tsx";
|
|
56
|
+
export type { PlaceAutocompleteProps } from "./map/PlaceAutocomplete.tsx";
|
|
57
|
+
export { ResultPanel } from "./map/ResultPanel.tsx";
|
|
58
|
+
export type { ResultPanelProps } from "./map/ResultPanel.tsx";
|
|
59
|
+
export { useCompareState } from "#map/useCompareState";
|
|
60
|
+
export type { UseCompareState } from "#map/useCompareState";
|
|
61
|
+
export { useGeocode } from "#map/useGeocode";
|
|
62
|
+
export type { UseGeocode, UseGeocodeOptions } from "#map/useGeocode";
|
|
63
|
+
export { usePlaceAutocomplete } from "#map/usePlaceAutocomplete";
|
|
64
|
+
export type { AutocompleteInputProps, UsePlaceAutocomplete, UsePlaceAutocompleteOptions, } from "#map/usePlaceAutocomplete";
|
|
65
|
+
export { VersionPicker } from "./map/VersionPicker.tsx";
|
|
66
|
+
export type { VersionPickerProps } from "./map/VersionPicker.tsx";
|
|
67
|
+
//# sourceMappingURL=map.d.ts.map
|
package/out/map.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../lib/map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAG9F,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,YAAY,E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AAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAEhE,YAAY,EACX,sBAAsB,EACtB,oBAAoB,EACpB,2BAA2B,GAC3B,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA"}
|
package/out/map.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `@mailwoman/react/map` — the geocoder map surface, kept behind its own subpath so `maplibre-gl`
|
|
7
|
+
* / `react-map-gl` (WebGL + DOM at import) never enter the package-root graph. This subpath import
|
|
8
|
+
* pulls the map deps. importing `@mailwoman/react` (root) does not. Consumers who only want the
|
|
9
|
+
* parse/POI explorers never pay for maplibre.
|
|
10
|
+
*
|
|
11
|
+
* The host must supply `maplibre-gl` + `react-map-gl` (peer deps) and import
|
|
12
|
+
* `maplibre-gl/dist/maplibre-gl.css` + `@mailwoman/react/styles.css` itself.
|
|
13
|
+
*/
|
|
14
|
+
export { MapCanvas } from "./map/MapCanvas.js";
|
|
15
|
+
// ── Map chrome (node-safe presentation. The host supplies the input and reads its own map) ──
|
|
16
|
+
export { MapChipRow } from "./map/MapChipRow.js";
|
|
17
|
+
export { MapCompass } from "./map/MapCompass.js";
|
|
18
|
+
export { useMapBearing } from "./map/useMapBearing.js";
|
|
19
|
+
export { useMapLabelPick } from "./map/useMapLabelPick.js";
|
|
20
|
+
export { MapControlButton, MapControlGroup, MapControlStack } from "./map/MapControlStack.js";
|
|
21
|
+
export { MapFooter } from "./map/MapFooter.js";
|
|
22
|
+
export { MapProgressBar } from "./map/MapProgressBar.js";
|
|
23
|
+
export { MapSheet, SheetClose } from "./map/MapSheet.js";
|
|
24
|
+
export { MapSearchBar, SearchGlyph } from "./map/MapSearchBar.js";
|
|
25
|
+
// ── Pure geometry + render spec (node-safe. No react-map-gl at runtime) ──────
|
|
26
|
+
export { approxCircleGeometry, bboxToBounds, geomBounds, radiusCircleGeometry } from "#map/geometry";
|
|
27
|
+
export { cameraToViewState, computeMapPlaceRenderSpec } from "#map/place-render";
|
|
28
|
+
export { useMapPlaceRender } from "#map/useMapPlaceRender";
|
|
29
|
+
// ── Declarative overlays (react-map-gl `<Marker>`/`<Source>`/`<Layer>`) ──────
|
|
30
|
+
export { OverlayLayers } from "./map/OverlayLayers.js";
|
|
31
|
+
export { PlaceMarker } from "./map/PlaceMarker.js";
|
|
32
|
+
export { ResolvedPlaceLayers } from "./map/ResolvedPlaceLayers.js";
|
|
33
|
+
export { ResultCamera } from "./map/ResultCamera.js";
|
|
34
|
+
export { ResultOverlay } from "./map/ResultOverlay.js";
|
|
35
|
+
// ── Geocoder controls + the composed geocoder ────────────────────────────────
|
|
36
|
+
export { CompareToggle } from "./map/CompareToggle.js";
|
|
37
|
+
export { Geocoder } from "./map/Geocoder.js";
|
|
38
|
+
export { GeocoderControls } from "./map/GeocoderControls.js";
|
|
39
|
+
export { PlaceAutocomplete } from "./map/PlaceAutocomplete.js";
|
|
40
|
+
export { ResultPanel } from "./map/ResultPanel.js";
|
|
41
|
+
export { useCompareState } from "#map/useCompareState";
|
|
42
|
+
export { useGeocode } from "#map/useGeocode";
|
|
43
|
+
export { usePlaceAutocomplete } from "#map/usePlaceAutocomplete";
|
|
44
|
+
export { VersionPicker } from "./map/VersionPicker.js";
|
|
45
|
+
//# sourceMappingURL=map.js.map
|
package/out/map.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.js","sourceRoot":"","sources":["../lib/map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;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AAE,MAAM,2BAA4B,CAAA;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA6B,CAAA;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAuB,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAQhE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAyB,CAAA"}
|
|
@@ -3,8 +3,18 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `CandidatePicker` — the ranked list of alternate gazetteer candidates
|
|
7
|
-
* Presentational
|
|
6
|
+
* `CandidatePicker` — the ranked list of alternate gazetteer candidates. clicking one selects it.
|
|
7
|
+
* Presentational. the selected index is owned by the caller (the pipeline hook).
|
|
8
|
+
*
|
|
9
|
+
* The row shows the rank rather than the score. `ResolvedPlaceView.score` is implementation-defined. Its type specifies
|
|
10
|
+
* "callers should treat as ordinal" — and the backends do not agree on a scale: the FTS regime is a negated bm25
|
|
11
|
+
* plus additive tiers, while the candidate regime is exactly `log10(population + 1)`. Both regimes put
|
|
12
|
+
* "New York · 6.95" (log10 of 8.9M) directly under "350 5th Ave · 1.00" from a bounded blend. That reads as one
|
|
13
|
+
* number beating another by a factor of seven rather than as two numbers that never shared a scale.
|
|
14
|
+
* `docs/records/reviews/2026-08-04-resolver-score-abstention.md` measures this in full.
|
|
15
|
+
*
|
|
16
|
+
* The raw value stays on the button's `title`, at full precision, because it is exactly the right thing to have
|
|
17
|
+
* when you are debugging a ranking and exactly the wrong thing to put in a visitor's eyeline.
|
|
8
18
|
*/
|
|
9
19
|
import type { ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result";
|
|
10
20
|
import type { ReactNode } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CandidatePicker.d.ts","sourceRoot":"","sources":["../../lib/pipeline/CandidatePicker.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"CandidatePicker.d.ts","sourceRoot":"","sources":["../../lib/pipeline/CandidatePicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,MAAM,WAAW,oBAAoB;IACpC,UAAU,EAAE,iBAAiB,EAAE,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACjC;AAED,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,oBAAoB,GAAG,SAAS,CAsBxG"}
|