@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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Draws a grid of meridians and parallels under the basemap so that the globe is readable while
|
|
7
|
+
* tiles load. Loaded tiles cover the grid.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { type ReactNode, useMemo } from "react"
|
|
11
|
+
import { Layer, Source } from "react-map-gl/maplibre"
|
|
12
|
+
|
|
13
|
+
import { buildGraticule } from "./graticule.ts"
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Props for {@link GraticuleLayer}.
|
|
17
|
+
*/
|
|
18
|
+
export interface GraticuleLayerProps {
|
|
19
|
+
/**
|
|
20
|
+
* The basemap layer to draw the grid beneath.
|
|
21
|
+
* Without it, the grid is drawn on top.
|
|
22
|
+
*/
|
|
23
|
+
beforeID?: string
|
|
24
|
+
/**
|
|
25
|
+
* Hides the grid. @default false
|
|
26
|
+
*/
|
|
27
|
+
hidden?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Renders the graticule source and line layer.
|
|
32
|
+
*/
|
|
33
|
+
export function GraticuleLayer({ beforeID, hidden = false }: GraticuleLayerProps): ReactNode {
|
|
34
|
+
const data = useMemo(() => buildGraticule(), [])
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
<Source id="mw-graticule" type="geojson" data={data} />
|
|
39
|
+
<Layer
|
|
40
|
+
id="mw-graticule-line"
|
|
41
|
+
type="line"
|
|
42
|
+
source="mw-graticule"
|
|
43
|
+
{...(beforeID ? { beforeId: beforeID } : {})}
|
|
44
|
+
layout={{ visibility: hidden ? "none" : "visible", "line-cap": "round" }}
|
|
45
|
+
paint={{
|
|
46
|
+
"line-color": "#8aa0c8",
|
|
47
|
+
// The grid fades out by zoom 8, where map detail makes it unnecessary.
|
|
48
|
+
"line-opacity": ["interpolate", ["linear"], ["zoom"], 0, 0.3, 3, 0.2, 6, 0.09, 8, 0],
|
|
49
|
+
"line-width": ["interpolate", ["linear"], ["zoom"], 0, 0.5, 4, 0.75],
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
</>
|
|
53
|
+
)
|
|
54
|
+
}
|
package/lib/map/MapCanvas.tsx
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
*
|
|
6
6
|
* `<MapCanvas>` — the declarative map shell for the geocoder demo, over `react-map-gl/maplibre` (v8).
|
|
7
7
|
* Phase 1 is the shell only: a `<Map>` that takes a host-composed `mapStyle`, an initial (or
|
|
8
|
-
* controlled) view state
|
|
8
|
+
* controlled) view state and a `children` slot for overlays/markers from later phases.
|
|
9
9
|
* No overlay/marker/camera logic lives here yet.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
* + DOM at import) at module scope, so it is reachable
|
|
11
|
+
* node-import safety: this module imports `react-map-gl/maplibre` (which pulls `maplibre-gl` — WebGL
|
|
12
|
+
* + DOM at import) at module scope, so it is reachable only through the `@mailwoman/react/map`
|
|
13
13
|
* subpath, never from the package root (`index.ts`). The bare `import("@mailwoman/react")` a node
|
|
14
14
|
* consumer (or the CI smoke IMPORT_CHECK) runs must never transitively load this file. Keep it out of
|
|
15
15
|
* the root barrel.
|
|
16
16
|
*
|
|
17
17
|
* CSS: the package imports no CSS from its modules (the node-safe invariant), so a host that renders
|
|
18
18
|
* `<MapCanvas>` must import `maplibre-gl/dist/maplibre-gl.css` itself (plus `@mailwoman/react/styles.css`
|
|
19
|
-
* for the `.mw-demo-map` container). `<MapCanvas>` is intrinsically a client component
|
|
19
|
+
* for the `.mw-demo-map` container). `<MapCanvas>` is intrinsically a client component. A host that
|
|
20
20
|
* server-renders should wrap it in a client boundary (the package's `ClientOnly`), exactly as the
|
|
21
21
|
* composed `Geocoder` will in a later phase.
|
|
22
22
|
*/
|
|
@@ -31,8 +31,10 @@ import type { MapProps, MapRef, ViewStateChangeEvent } from "react-map-gl/maplib
|
|
|
31
31
|
export type MapCanvasStyle = NonNullable<MapProps["mapStyle"]>
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Override for the `<Map>` props `<MapCanvas>` does not surface explicitly
|
|
35
|
-
* `maplibreLogo`).
|
|
34
|
+
* Override for the `<Map>` props `<MapCanvas>` does not surface explicitly
|
|
35
|
+
* (e.g. `minZoom`, `attributionControl`, `maplibreLogo`).
|
|
36
|
+
*
|
|
37
|
+
* The controlled fields MapCanvas owns are omitted so they can't be set twice.
|
|
36
38
|
*/
|
|
37
39
|
export type MapCanvasExtraProps = Partial<
|
|
38
40
|
Omit<MapProps, "mapStyle" | "initialViewState" | "viewState" | "onMove" | "children" | "style" | "ref">
|
|
@@ -44,11 +46,15 @@ export interface MapCanvasProps {
|
|
|
44
46
|
*/
|
|
45
47
|
mapStyle: MapCanvasStyle
|
|
46
48
|
/**
|
|
47
|
-
* Uncontrolled initial camera.
|
|
49
|
+
* Uncontrolled initial camera.
|
|
50
|
+
*
|
|
51
|
+
* Use this or `viewState`, not both.
|
|
48
52
|
*/
|
|
49
53
|
initialViewState?: MapProps["initialViewState"]
|
|
50
54
|
/**
|
|
51
|
-
* Controlled camera.
|
|
55
|
+
* Controlled camera.
|
|
56
|
+
*
|
|
57
|
+
* Pair with `onMove` to persist it.
|
|
52
58
|
*/
|
|
53
59
|
viewState?: MapProps["viewState"]
|
|
54
60
|
/**
|
|
@@ -64,7 +70,9 @@ export interface MapCanvasProps {
|
|
|
64
70
|
*/
|
|
65
71
|
mapRef?: Ref<MapRef>
|
|
66
72
|
/**
|
|
67
|
-
* Overlays, markers
|
|
73
|
+
* Overlays, markers and controls — rendered as `<Map>` children.
|
|
74
|
+
*
|
|
75
|
+
* Empty in phase 1.
|
|
68
76
|
*/
|
|
69
77
|
children?: ReactNode
|
|
70
78
|
/**
|
|
@@ -76,7 +84,7 @@ export interface MapCanvasProps {
|
|
|
76
84
|
*/
|
|
77
85
|
style?: CSSProperties
|
|
78
86
|
/**
|
|
79
|
-
*
|
|
87
|
+
* Other `<Map>` props that MapCanvas does not surface explicitly.
|
|
80
88
|
*/
|
|
81
89
|
mapProps?: MapCanvasExtraProps
|
|
82
90
|
}
|
|
@@ -84,8 +92,11 @@ export interface MapCanvasProps {
|
|
|
84
92
|
const FILL: CSSProperties = { width: "100%", height: "100%" }
|
|
85
93
|
|
|
86
94
|
/**
|
|
87
|
-
* The controlled-viewport map shell.
|
|
88
|
-
*
|
|
95
|
+
* The controlled-viewport map shell.
|
|
96
|
+
*
|
|
97
|
+
* Renders a sized wrapper around a `react-map-gl/maplibre` `<Map>`; everything
|
|
98
|
+
* host-specific (the composed `mapStyle`, the initial center) is injected.
|
|
99
|
+
* Overlays arrive as `children`.
|
|
89
100
|
*/
|
|
90
101
|
export function MapCanvas({
|
|
91
102
|
mapStyle,
|
package/lib/map/MapChipRow.tsx
CHANGED
|
@@ -3,13 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* It SCROLLS horizontally and never wraps. Earth's twelve examples wrapped down five ragged rows (3/3/2/1/1/1) and
|
|
9
|
-
* took a third of the panel; one scrolling line is the shape the reference map apps use, and it costs a fixed
|
|
10
|
-
* height whatever the number of examples.
|
|
11
|
-
*
|
|
12
|
-
* NODE-SAFE: pure React, no maplibre.
|
|
6
|
+
* Render example-query chips in a single horizontally scrollable row.
|
|
13
7
|
*/
|
|
14
8
|
|
|
15
9
|
import type { ReactNode } from "react"
|
|
@@ -22,7 +16,9 @@ export interface MapChip {
|
|
|
22
16
|
*/
|
|
23
17
|
label: string
|
|
24
18
|
/**
|
|
25
|
-
* The query the chip stands for, handed back on press.
|
|
19
|
+
* The query the chip stands for, handed back on press.
|
|
20
|
+
*
|
|
21
|
+
* Defaults to the label.
|
|
26
22
|
*/
|
|
27
23
|
value?: string
|
|
28
24
|
/**
|
package/lib/map/MapCompass.tsx
CHANGED
|
@@ -3,24 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* It is a compass ROSE, the way the reference map apps draw it: a ringed dial carrying a two-tone needle whose red
|
|
9
|
-
* half points north and whose pale half points south. A single-color arrow cannot say which end is north, so a
|
|
10
|
-
* reader has to already know the convention to read it; two tones say it outright. There is no `N` on the dial —
|
|
11
|
-
* at this size the letter and the needle's north tip want the same few pixels, and the tip is the clearer of them.
|
|
12
|
-
*
|
|
13
|
-
* The whole dial counter-rotates the bearing, so the needle keeps pointing at true north while the map turns under
|
|
14
|
-
* it. Pressing it returns the map to north, which is why the control is a button rather than an ornament.
|
|
15
|
-
*
|
|
16
|
-
* It stays mounted through the fade rather than unmounting on the bearing crossing zero, because a control that
|
|
17
|
-
* vanishes mid-gesture is the thing that reads as a glitch. `HIDE_BELOW_DEGREES` is the dead zone: a map settled by
|
|
18
|
-
* a snap-to-north lands a fraction off zero, and a compass that lingers over that fraction never goes away.
|
|
19
|
-
*
|
|
20
|
-
* Under `prefers-reduced-motion` it appears and disappears with no transition, and the dial still rotates —
|
|
21
|
-
* rotation IS the information, not decoration.
|
|
22
|
-
*
|
|
23
|
-
* NODE-SAFE: pure React, no maplibre. The host reads the bearing off its own map and passes it in.
|
|
6
|
+
* Shows a compass that rotates with the map bearing and hides when the map faces north. A press
|
|
7
|
+
* it asks the host to reset the bearing.
|
|
24
8
|
*/
|
|
25
9
|
|
|
26
10
|
import type { ReactNode } from "react"
|
|
@@ -28,17 +12,22 @@ import type { ReactNode } from "react"
|
|
|
28
12
|
import { cx } from "#common/cx"
|
|
29
13
|
|
|
30
14
|
/**
|
|
31
|
-
*
|
|
15
|
+
* The compass counts as facing north below this bearing.
|
|
16
|
+
* It fades out below the same threshold.
|
|
32
17
|
*/
|
|
33
18
|
const HIDE_BELOW_DEGREES = 0.5
|
|
34
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Props for {@link MapCompass}.
|
|
22
|
+
*/
|
|
35
23
|
export interface MapCompassProps {
|
|
36
24
|
/**
|
|
37
|
-
* The map's bearing in degrees
|
|
25
|
+
* The map's bearing in degrees as MapLibre reports it, where 0 is north.
|
|
38
26
|
*/
|
|
39
27
|
bearing: number
|
|
40
28
|
/**
|
|
41
|
-
*
|
|
29
|
+
* Called when the compass is pressed.
|
|
30
|
+
* The host should reset its map to north.
|
|
42
31
|
*/
|
|
43
32
|
onResetNorth: () => void
|
|
44
33
|
/**
|
|
@@ -48,6 +37,9 @@ export interface MapCompassProps {
|
|
|
48
37
|
className?: string
|
|
49
38
|
}
|
|
50
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Renders the compass button.
|
|
42
|
+
*/
|
|
51
43
|
export function MapCompass({ bearing, onResetNorth, label, className }: MapCompassProps): ReactNode {
|
|
52
44
|
const facingNorth = Math.abs(bearing) < HIDE_BELOW_DEGREES
|
|
53
45
|
|
|
@@ -57,8 +49,7 @@ export function MapCompass({ bearing, onResetNorth, label, className }: MapCompa
|
|
|
57
49
|
className={cx("mw-map-compass", facingNorth && "mw-map-compass--north", className)}
|
|
58
50
|
aria-label={label ?? "Reset bearing to north"}
|
|
59
51
|
title={label ?? "Reset bearing to north"}
|
|
60
|
-
//
|
|
61
|
-
// the controls a pointer can see.
|
|
52
|
+
// The hidden compass leaves the tab order and the accessibility tree.
|
|
62
53
|
aria-hidden={facingNorth}
|
|
63
54
|
tabIndex={facingNorth ? -1 : 0}
|
|
64
55
|
onClick={onResetNorth}
|
|
@@ -67,7 +58,7 @@ export function MapCompass({ bearing, onResetNorth, label, className }: MapCompa
|
|
|
67
58
|
<g style={{ transform: `rotate(${-bearing}deg)`, transformOrigin: "16px 16px" }}>
|
|
68
59
|
<circle cx="16" cy="16" r="12.5" className="mw-map-compass__dial" />
|
|
69
60
|
|
|
70
|
-
{/*
|
|
61
|
+
{/* The north needle, then the south needle. */}
|
|
71
62
|
<path d="M16 5.5 L20.5 16 L16 16 Z M16 5.5 L11.5 16 L16 16 Z" className="mw-map-compass__north" />
|
|
72
63
|
<path d="M16 26.5 L20.5 16 L16 16 Z M16 26.5 L11.5 16 L16 16 Z" className="mw-map-compass__south" />
|
|
73
64
|
</g>
|
|
@@ -3,13 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Controls sit in GROUPS: a group is one glass capsule with hairlines between its buttons, and separate groups are
|
|
9
|
-
* separate capsules with a gap. That grouping is the whole layout idea — related controls read as one object, and
|
|
10
|
-
* an unrelated one (a compass that comes and goes) does not join a capsule it would resize.
|
|
11
|
-
*
|
|
12
|
-
* NODE-SAFE: pure React, no maplibre.
|
|
6
|
+
* Provide accessible map-control buttons arranged in grouped capsules.
|
|
13
7
|
*/
|
|
14
8
|
|
|
15
9
|
import type { ReactNode } from "react"
|
|
@@ -22,7 +16,9 @@ export interface MapControlButtonProps {
|
|
|
22
16
|
*/
|
|
23
17
|
children: ReactNode
|
|
24
18
|
/**
|
|
25
|
-
* The control's accessible name.
|
|
19
|
+
* The control's accessible name.
|
|
20
|
+
*
|
|
21
|
+
* Required: the visible content is a mark rather than a word.
|
|
26
22
|
*/
|
|
27
23
|
label: string
|
|
28
24
|
onPress: () => void
|
|
@@ -63,7 +59,10 @@ export interface MapControlGroupProps {
|
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
/**
|
|
66
|
-
* One capsule.
|
|
62
|
+
* One capsule.
|
|
63
|
+
*
|
|
64
|
+
* Put related controls in the same group.
|
|
65
|
+
* Give an unrelated one its own.
|
|
67
66
|
*/
|
|
68
67
|
export function MapControlGroup({ children, className }: MapControlGroupProps): ReactNode {
|
|
69
68
|
return <div className={cx("mw-map-control-group", className)}>{children}</div>
|
package/lib/map/MapFooter.tsx
CHANGED
|
@@ -2,19 +2,6 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* `<MapFooter>` — the strip along the bottom of a map: identity and load status on the left, an attribution button
|
|
7
|
-
* on the right.
|
|
8
|
-
*
|
|
9
|
-
* Attribution is a licence obligation for every source these apps draw, so it is a first-class slot rather than
|
|
10
|
-
* something an app remembers to add. It sits behind a button because the strip has to stay ONE line: spelled out, the
|
|
11
|
-
* credits ran three lines deep on a phone and covered the sheet above them. The button names the obligation, and
|
|
12
|
-
* pressing it shows every credit — which is the treatment the reference map apps use.
|
|
13
|
-
*
|
|
14
|
-
* The status slot is where the loader says WHAT it is fetching while the bar at the top of the viewport says how far
|
|
15
|
-
* along it is.
|
|
16
|
-
*
|
|
17
|
-
* NODE-SAFE: pure React, no maplibre.
|
|
18
5
|
*/
|
|
19
6
|
|
|
20
7
|
import { type ReactNode, useEffect, useId, useRef, useState } from "react"
|
|
@@ -27,11 +14,11 @@ export interface MapFooterProps {
|
|
|
27
14
|
*/
|
|
28
15
|
identity?: ReactNode
|
|
29
16
|
/**
|
|
30
|
-
*
|
|
17
|
+
* What is loading right now, beside the identity.
|
|
31
18
|
*/
|
|
32
19
|
status?: ReactNode
|
|
33
20
|
/**
|
|
34
|
-
* The credits, one entry per source
|
|
21
|
+
* The credits, one entry per source, shown in the popover the attribution button opens.
|
|
35
22
|
*/
|
|
36
23
|
attribution?: ReactNode[]
|
|
37
24
|
/**
|
|
@@ -52,7 +39,6 @@ export function MapFooter({
|
|
|
52
39
|
const popoverID = useId()
|
|
53
40
|
const root = useRef<HTMLElement>(null)
|
|
54
41
|
|
|
55
|
-
// A popover closes when the conversation moves elsewhere: a press outside it, or Escape.
|
|
56
42
|
useEffect(() => {
|
|
57
43
|
if (!open) return
|
|
58
44
|
|
|
@@ -3,16 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Loading a 38 MB model is a page-level event, not a control-level one, so it reports at the page's edge rather than
|
|
9
|
-
* inside the search field: a spinner in the field resizes the one control a visitor is trying to type into, and a
|
|
10
|
-
* staged list in the result sheet claims the space an answer will need.
|
|
11
|
-
*
|
|
12
|
-
* It reports a FRACTION when the loader names its steps and runs indeterminate when it does not, because a bar that
|
|
13
|
-
* invents a percentage is worse than one that admits it is only saying "still working".
|
|
14
|
-
*
|
|
15
|
-
* NODE-SAFE: pure React, no maplibre.
|
|
6
|
+
* Show loading progress at the top of the viewport.
|
|
7
|
+
* Use a determinate bar when progress is known, otherwise an indeterminate bar.
|
|
16
8
|
*/
|
|
17
9
|
|
|
18
10
|
import type { ReactNode } from "react"
|
|
@@ -21,15 +13,20 @@ import { cx } from "#common/cx"
|
|
|
21
13
|
|
|
22
14
|
export interface MapProgressBarProps {
|
|
23
15
|
/**
|
|
24
|
-
* Whether the bar is showing at all.
|
|
16
|
+
* Whether the bar is showing at all.
|
|
17
|
+
*
|
|
18
|
+
* It stays mounted through its fade rather than unmounting on the transition.
|
|
25
19
|
*/
|
|
26
20
|
active: boolean
|
|
27
21
|
/**
|
|
28
|
-
* Completed steps over total steps, in [0, 1].
|
|
22
|
+
* Completed steps over total steps, in [0, 1].
|
|
23
|
+
*
|
|
24
|
+
* Omit for work whose length is unknown.
|
|
29
25
|
*/
|
|
30
26
|
fraction?: number | null
|
|
31
27
|
/**
|
|
32
|
-
* The bar's accessible name
|
|
28
|
+
* The bar's accessible name.
|
|
29
|
+
* What is loading, in a few words.
|
|
33
30
|
*/
|
|
34
31
|
label: string
|
|
35
32
|
className?: string
|
package/lib/map/MapSearchBar.tsx
CHANGED
|
@@ -3,29 +3,38 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Earth searches an address through the geocoder runtime and the planetary apps search a nomenclature artifact, so
|
|
9
|
-
* nothing about the query belongs here.
|
|
10
|
-
*
|
|
11
|
-
* The slots are elements rather than icon names because a leading mark and a trailing control differ per app — a
|
|
12
|
-
* magnifier on one, a body glyph on another.
|
|
13
|
-
*
|
|
14
|
-
* BUSY IS A LINE, NOT A SLOT. A spinner placed in the trailing slot changed the pill's height on every submit,
|
|
15
|
-
* because a slot is laid out and an indicator is not part of the query. `busy` draws a hairline across the pill's
|
|
16
|
-
* lower edge instead, which costs no layout. A host that wants `type="search"` also gets the browser's own clear
|
|
17
|
-
* button in that corner, and two crosses side by side is one control too many.
|
|
18
|
-
*
|
|
19
|
-
* NODE-SAFE: pure React, no maplibre.
|
|
6
|
+
* Presentational search pill for map UIs. The host supplies the input and icons.
|
|
7
|
+
* Busy state uses a bottom-edge indicator to avoid changing the pill layout.
|
|
20
8
|
*/
|
|
21
9
|
|
|
22
10
|
import type { ReactNode } from "react"
|
|
23
11
|
|
|
24
12
|
import { cx } from "#common/cx"
|
|
25
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Draw a consistently sized magnifier for the leading slot.
|
|
16
|
+
*/
|
|
17
|
+
export function SearchGlyph(): ReactNode {
|
|
18
|
+
return (
|
|
19
|
+
<svg
|
|
20
|
+
viewBox="0 0 20 20"
|
|
21
|
+
width="18"
|
|
22
|
+
height="18"
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
focusable="false"
|
|
25
|
+
className="mw-map-searchbar__glyph"
|
|
26
|
+
>
|
|
27
|
+
<circle cx="8.75" cy="8.75" r="5.5" fill="none" stroke="currentColor" strokeWidth="1.8" />
|
|
28
|
+
<line x1="12.9" y1="12.9" x2="17" y2="17" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" />
|
|
29
|
+
</svg>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
export interface MapSearchBarProps {
|
|
27
34
|
/**
|
|
28
|
-
* The input (or combobox) the host owns.
|
|
35
|
+
* The input (or combobox) the host owns.
|
|
36
|
+
*
|
|
37
|
+
* Rendered between the two slots.
|
|
29
38
|
*/
|
|
30
39
|
children: ReactNode
|
|
31
40
|
/**
|
|
@@ -33,11 +42,16 @@ export interface MapSearchBarProps {
|
|
|
33
42
|
*/
|
|
34
43
|
leading?: ReactNode
|
|
35
44
|
/**
|
|
36
|
-
* Rendered after the input — a microphone, a menu.
|
|
45
|
+
* Rendered after the input — a microphone, a menu.
|
|
46
|
+
*
|
|
47
|
+
* Not a spinner: pass {@link busy} instead.
|
|
37
48
|
*/
|
|
38
49
|
trailing?: ReactNode
|
|
39
50
|
/**
|
|
40
|
-
* A query is running.
|
|
51
|
+
* A query is running.
|
|
52
|
+
*
|
|
53
|
+
* Draws a progress hairline along the pill's lower edge.
|
|
54
|
+
* The hairline takes no layout space.
|
|
41
55
|
*/
|
|
42
56
|
busy?: boolean
|
|
43
57
|
/**
|
package/lib/map/MapSheet.tsx
CHANGED
|
@@ -3,26 +3,37 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* The close button is not optional. On a wide screen the control that opened the sheet stays visible beside it and
|
|
9
|
-
* could close it again, but on a phone the sheet is the whole panel and covers that control — so a sheet without its
|
|
10
|
-
* own close is a sheet a phone cannot dismiss. One component carries it so the four sheets in these apps cannot
|
|
11
|
-
* disagree about that.
|
|
12
|
-
*
|
|
13
|
-
* Escape closes it too, because a panel over the whole screen is a modal in every way that matters to someone
|
|
14
|
-
* holding a keyboard.
|
|
15
|
-
*
|
|
16
|
-
* NODE-SAFE: pure React, no maplibre.
|
|
6
|
+
* Side panel over the map with a heading, close button and Escape dismissal.
|
|
17
7
|
*/
|
|
18
8
|
|
|
19
9
|
import { type ReactNode, useEffect } from "react"
|
|
20
10
|
|
|
21
11
|
import { cx } from "#common/cx"
|
|
22
12
|
|
|
13
|
+
export interface SheetCloseProps {
|
|
14
|
+
/**
|
|
15
|
+
* What is being closed, for the accessible name: "Close the result", "Close About".
|
|
16
|
+
*/
|
|
17
|
+
label: string
|
|
18
|
+
onClose: () => void
|
|
19
|
+
className?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Accessible button for dismissing a sheet.
|
|
24
|
+
*/
|
|
25
|
+
export function SheetClose({ label, onClose, className }: SheetCloseProps): ReactNode {
|
|
26
|
+
return (
|
|
27
|
+
<button type="button" className={cx("mw-map-sheet__close", className)} aria-label={label} onClick={onClose}>
|
|
28
|
+
<span aria-hidden="true">×</span>
|
|
29
|
+
</button>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
23
33
|
export interface MapSheetProps {
|
|
24
34
|
/**
|
|
25
|
-
* The sheet's heading
|
|
35
|
+
* The sheet's heading.
|
|
36
|
+
* It also supplies the accessible name.
|
|
26
37
|
*/
|
|
27
38
|
title: string
|
|
28
39
|
/**
|
|
@@ -51,9 +62,7 @@ export function MapSheet({ title, onClose, children, className }: MapSheetProps)
|
|
|
51
62
|
<div className="mw-map-sheet__header">
|
|
52
63
|
<h2 className="mw-map-sheet__title">{title}</h2>
|
|
53
64
|
|
|
54
|
-
<
|
|
55
|
-
<span aria-hidden="true">×</span>
|
|
56
|
-
</button>
|
|
65
|
+
<SheetClose label={`Close ${title}`} onClose={onClose} />
|
|
57
66
|
</div>
|
|
58
67
|
|
|
59
68
|
<div className="mw-map-sheet__body">{children}</div>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* the host composes the specs, the package renders them, react-map-gl owns the add/remove lifecycle.
|
|
10
10
|
*
|
|
11
11
|
* Each overlay's `visible` flag flips the layers' `visibility` layout property — the declarative control a
|
|
12
|
-
* layer-toggle control drives in a later phase.
|
|
12
|
+
* layer-toggle control drives in a later phase. node-import safety: imports `react-map-gl/maplibre` —
|
|
13
13
|
* reachable only via `@mailwoman/react/map`.
|
|
14
14
|
*/
|
|
15
15
|
|
|
@@ -3,13 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* a dumb presentational unit. It renders the current suggestions with the keyboard-highlighted active
|
|
8
|
-
* descendant; the state + keyboard nav live in {@link usePlaceAutocomplete}. Renders `null` when there
|
|
9
|
-
* is nothing to suggest, so the row only appears when useful. Wire the ids from the hook so the input's
|
|
10
|
-
* `aria-controls` / `aria-activedescendant` match this listbox.
|
|
11
|
-
*
|
|
12
|
-
* NODE-SAFE: pure React, no maplibre.
|
|
6
|
+
* The `usePlaceAutocomplete` hook owns the state and keyboard navigation.
|
|
13
7
|
*/
|
|
14
8
|
|
|
15
9
|
import type { ReactNode } from "react"
|
|
@@ -17,39 +11,34 @@ import type { ReactNode } from "react"
|
|
|
17
11
|
import { cx } from "#common/cx"
|
|
18
12
|
import type { Suggestion } from "#map/types"
|
|
19
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Props for {@link PlaceAutocomplete}.
|
|
16
|
+
*/
|
|
20
17
|
export interface PlaceAutocompleteProps {
|
|
21
|
-
/**
|
|
22
|
-
* The suggestions to render (from {@link usePlaceAutocomplete}).
|
|
23
|
-
*/
|
|
24
18
|
suggestions: Suggestion[]
|
|
25
19
|
/**
|
|
26
|
-
* The
|
|
20
|
+
* The index highlighted by the keyboard, or `-1` for none.
|
|
27
21
|
*/
|
|
28
22
|
activeIndex: number
|
|
29
|
-
/**
|
|
30
|
-
* Fired (with the suggestion `value`) when one is clicked.
|
|
31
|
-
*/
|
|
32
23
|
onPick: (value: string) => void
|
|
33
|
-
/**
|
|
34
|
-
* Fired with the index a pointer entered, so hover matches keyboard highlight.
|
|
35
|
-
*/
|
|
36
24
|
onHover?: (index: number) => void
|
|
37
25
|
/**
|
|
38
|
-
* The listbox element id
|
|
26
|
+
* The listbox element id, passed from the hook so it matches the input's `aria-controls`.
|
|
39
27
|
*/
|
|
40
28
|
listboxID: string
|
|
41
29
|
/**
|
|
42
|
-
*
|
|
30
|
+
* Pass `optionID` from the hook.
|
|
43
31
|
*/
|
|
44
32
|
optionID: (index: number) => string
|
|
45
33
|
/**
|
|
46
|
-
*
|
|
34
|
+
* The label before the suggestions. @default "Did you mean:"
|
|
47
35
|
*/
|
|
48
36
|
caption?: string
|
|
49
37
|
}
|
|
50
38
|
|
|
51
39
|
/**
|
|
52
|
-
*
|
|
40
|
+
* Renders the suggestion listbox when suggestions exist.
|
|
41
|
+
* It renders no listbox otherwise.
|
|
53
42
|
*/
|
|
54
43
|
export function PlaceAutocomplete({
|
|
55
44
|
suggestions,
|
package/lib/map/PlaceMarker.tsx
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* `markerRef.current.remove()` teardown) from the demo's redraw effect: mounting/unmounting the marker
|
|
9
9
|
* is now React's job, keyed on the resolved candidate. Renders as a child of `<MapCanvas>`.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* node-import safety: imports `react-map-gl/maplibre` at module scope, so it is reachable only through
|
|
12
12
|
* the `@mailwoman/react/map` subpath, never the package root.
|
|
13
13
|
*/
|
|
14
14
|
|
|
@@ -40,7 +40,9 @@ export interface PlaceMarkerProps {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* A single resolved-place marker.
|
|
43
|
+
* A single resolved-place marker.
|
|
44
|
+
*
|
|
45
|
+
* Wraps `react-map-gl`'s `<Marker>` with the demo's default color.
|
|
44
46
|
*/
|
|
45
47
|
export function PlaceMarker({
|
|
46
48
|
longitude,
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* `<ResolvedPlaceLayers>` — the drop-in that renders a whole {@link MapPlaceRenderSpec} as `<MapCanvas>`
|
|
7
|
-
* children: the marker(s), the outline, and (optionally) the camera move. This is the declarative
|
|
8
|
-
* replacement for the demo's imperative marker/bbox/camera redraw effect — a consumer computes the spec
|
|
9
|
-
* with `useMapPlaceRender(place)` and drops `<ResolvedPlaceLayers spec={spec} />` inside `<MapCanvas>`.
|
|
10
|
-
*
|
|
11
|
-
* `spec = null` (no result / no candidate) renders nothing, which also unmounts the previous marker +
|
|
12
|
-
* outline — the teardown the old effect did by hand (`markerRef.remove()`, `clearBbox`) is now just
|
|
13
|
-
* React unmounting. NODE-IMPORT SAFETY: pulls the map components — `@mailwoman/react/map` only.
|
|
14
5
|
*/
|
|
15
6
|
|
|
16
7
|
import type { ReactNode } from "react"
|
|
@@ -23,16 +14,16 @@ import { ResultOverlay } from "./ResultOverlay.tsx"
|
|
|
23
14
|
|
|
24
15
|
export interface ResolvedPlaceLayersProps {
|
|
25
16
|
/**
|
|
26
|
-
* The render spec (from {@link useMapPlaceRender}); `null` renders
|
|
17
|
+
* The render spec (from {@link useMapPlaceRender}); `null` renders no layers.
|
|
27
18
|
*/
|
|
28
19
|
spec: MapPlaceRenderSpec | null
|
|
29
20
|
/**
|
|
30
|
-
* Apply the computed camera target via {@link ResultCamera}
|
|
31
|
-
*
|
|
21
|
+
* Apply the computed camera target via {@link ResultCamera}; set false when the consumer drives the camera
|
|
22
|
+
* itself (e.g. a controlled `<MapCanvas viewState>` fed by {@link cameraToViewState}). @default true
|
|
32
23
|
*/
|
|
33
24
|
applyCamera?: boolean
|
|
34
25
|
/**
|
|
35
|
-
* Animate the camera move
|
|
26
|
+
* Animate the camera move, forwarded to {@link ResultCamera}. @default true
|
|
36
27
|
*/
|
|
37
28
|
animateCamera?: boolean
|
|
38
29
|
/**
|
|
@@ -46,7 +37,7 @@ export interface ResolvedPlaceLayersProps {
|
|
|
46
37
|
}
|
|
47
38
|
|
|
48
39
|
/**
|
|
49
|
-
* Render the marker(s), outline
|
|
40
|
+
* Render the marker(s), outline and optional camera move for one resolved place.
|
|
50
41
|
*/
|
|
51
42
|
export function ResolvedPlaceLayers({
|
|
52
43
|
spec,
|