@mailwoman/react 9.2.0 → 9.4.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 +1 -1
- package/fonts.css +59 -0
- package/lib/common/About.tsx +89 -0
- package/{common → lib/common}/CopyButton.tsx +1 -1
- package/{common → lib/common}/KindBadge.tsx +2 -7
- package/{common → lib/common}/LoadingIndicator.tsx +1 -1
- package/lib/common/confidence-tiers.ts +50 -0
- package/lib/common/text-tokens.ts +88 -0
- package/{index.ts → lib/index.ts} +44 -42
- package/{map → lib/map}/CompareToggle.tsx +2 -2
- package/{map/GeocoderDemo.tsx → lib/map/Geocoder.tsx} +45 -44
- package/{map/DemoControls.tsx → lib/map/GeocoderControls.tsx} +19 -19
- package/{map/DemoMap.tsx → lib/map/MapCanvas.tsx} +16 -16
- package/{map → lib/map}/OverlayLayers.tsx +3 -3
- package/{map → lib/map}/PlaceAutocomplete.tsx +2 -2
- package/{map → lib/map}/PlaceMarker.tsx +1 -1
- package/{map → lib/map}/ResolvedPlaceLayers.tsx +5 -4
- package/{map → lib/map}/ResultCamera.tsx +3 -3
- package/{map → lib/map}/ResultOverlay.tsx +2 -2
- package/{map → lib/map}/ResultPanel.tsx +4 -3
- package/{map → lib/map}/VersionPicker.tsx +3 -3
- package/lib/map/fake-runtime.ts +122 -0
- package/{map → lib/map}/index.ts +26 -26
- package/lib/map/map-debug.ts +51 -0
- package/{map → lib/map}/place-render.ts +5 -4
- package/{map → lib/map}/types.ts +51 -46
- package/{map/useDemoGeocode.ts → lib/map/useGeocode.ts} +11 -11
- package/{map → lib/map}/useMapPlaceRender.ts +2 -2
- package/{map → lib/map}/usePlaceAutocomplete.ts +2 -2
- package/{pipeline → lib/pipeline}/CandidatePicker.tsx +2 -2
- package/{pipeline → lib/pipeline}/ComponentTable.tsx +1 -1
- package/lib/pipeline/ConfidenceCell.tsx +31 -0
- package/lib/pipeline/FailureDiagnostic.tsx +56 -0
- package/{pipeline → lib/pipeline}/PipelineExplorer.tsx +5 -4
- package/{pipeline → lib/pipeline}/QueryForm.tsx +2 -2
- package/{pipeline → lib/pipeline}/ResolvedPlace.tsx +17 -4
- package/lib/pipeline/SpanHighlight.tsx +97 -0
- package/lib/pipeline/TimingPanel.tsx +65 -0
- package/lib/pipeline/TreeView.tsx +55 -0
- package/{pipeline → lib/pipeline}/copy.ts +1 -1
- package/{pipeline → lib/pipeline}/presets.ts +2 -1
- package/{pipeline → lib/pipeline}/types.ts +2 -75
- package/{pipeline → lib/pipeline}/useParsePipeline.ts +2 -1
- package/{poi → lib/poi}/LiveResultsBlock.tsx +2 -2
- package/{poi → lib/poi}/POIExplorer.tsx +4 -3
- package/{poi → lib/poi}/SubjectPanel.tsx +1 -1
- package/{poi → lib/poi}/runtime.ts +3 -3
- package/{poi → lib/poi}/types.ts +3 -2
- package/{poi → lib/poi}/usePOISearch.ts +5 -5
- package/{runtime/useDemoRuntime.ts → lib/runtime/useReleaseRuntime.ts} +24 -26
- package/out/common/About.d.ts +12 -0
- package/out/common/About.d.ts.map +1 -0
- package/out/common/About.js +5 -0
- package/out/common/About.js.map +1 -0
- package/out/common/ClientOnly.d.ts.map +1 -1
- package/out/common/ClientOnly.js.map +1 -1
- package/out/common/CopyButton.d.ts.map +1 -1
- package/out/common/CopyButton.js +1 -1
- package/out/common/CopyButton.js.map +1 -1
- package/out/common/KindBadge.d.ts +2 -9
- package/out/common/KindBadge.d.ts.map +1 -1
- package/out/common/KindBadge.js.map +1 -1
- package/out/common/LoadingIndicator.d.ts.map +1 -1
- package/out/common/LoadingIndicator.js +1 -1
- package/out/common/LoadingIndicator.js.map +1 -1
- package/out/common/PresetChips.d.ts.map +1 -1
- package/out/common/PresetChips.js.map +1 -1
- package/out/common/confidence-tiers.d.ts +36 -0
- package/out/common/confidence-tiers.d.ts.map +1 -0
- package/out/common/confidence-tiers.js +42 -0
- package/out/common/confidence-tiers.js.map +1 -0
- package/out/common/cx.d.ts.map +1 -1
- package/out/common/cx.js.map +1 -1
- package/out/common/text-tokens.d.ts +46 -0
- package/out/common/text-tokens.d.ts.map +1 -0
- package/out/common/text-tokens.js +52 -0
- package/out/common/text-tokens.js.map +1 -0
- package/out/common/useClipboard.d.ts.map +1 -1
- package/out/common/useClipboard.js.map +1 -1
- package/out/common/useDebouncedValue.d.ts.map +1 -1
- package/out/common/useDebouncedValue.js.map +1 -1
- package/out/index.d.ts +27 -18
- package/out/index.d.ts.map +1 -1
- package/out/index.js +16 -10
- package/out/index.js.map +1 -1
- package/out/map/BackendControl.d.ts.map +1 -1
- package/out/map/BackendControl.js.map +1 -1
- package/out/map/CompareToggle.d.ts +2 -2
- package/out/map/CompareToggle.d.ts.map +1 -1
- package/out/map/CompareToggle.js.map +1 -1
- package/out/map/{GeocoderDemo.d.ts → Geocoder.d.ts} +17 -17
- package/out/map/Geocoder.d.ts.map +1 -0
- package/out/map/{GeocoderDemo.js → Geocoder.js} +30 -30
- package/out/map/Geocoder.js.map +1 -0
- package/out/map/GeocoderControls.d.ts +63 -0
- package/out/map/GeocoderControls.d.ts.map +1 -0
- package/out/map/{DemoControls.js → GeocoderControls.js} +2 -2
- package/out/map/GeocoderControls.js.map +1 -0
- package/out/map/{DemoMap.d.ts → MapCanvas.d.ts} +16 -16
- package/out/map/MapCanvas.d.ts.map +1 -0
- package/out/map/{DemoMap.js → MapCanvas.js} +2 -2
- package/out/map/MapCanvas.js.map +1 -0
- package/out/map/OverlayLayers.d.ts +3 -3
- package/out/map/OverlayLayers.d.ts.map +1 -1
- package/out/map/OverlayLayers.js +2 -2
- package/out/map/OverlayLayers.js.map +1 -1
- package/out/map/PlaceAutocomplete.d.ts +1 -1
- package/out/map/PlaceAutocomplete.d.ts.map +1 -1
- package/out/map/PlaceAutocomplete.js +1 -1
- package/out/map/PlaceAutocomplete.js.map +1 -1
- package/out/map/PlaceMarker.d.ts +1 -1
- package/out/map/PlaceMarker.d.ts.map +1 -1
- package/out/map/PlaceMarker.js.map +1 -1
- package/out/map/ResolvedPlaceLayers.d.ts +4 -4
- package/out/map/ResolvedPlaceLayers.d.ts.map +1 -1
- package/out/map/ResolvedPlaceLayers.js.map +1 -1
- package/out/map/ResultCamera.d.ts +3 -3
- package/out/map/ResultCamera.d.ts.map +1 -1
- package/out/map/ResultCamera.js +2 -2
- package/out/map/ResultCamera.js.map +1 -1
- package/out/map/ResultOverlay.d.ts +2 -2
- package/out/map/ResultOverlay.d.ts.map +1 -1
- package/out/map/ResultOverlay.js.map +1 -1
- package/out/map/ResultPanel.d.ts +2 -2
- package/out/map/ResultPanel.d.ts.map +1 -1
- package/out/map/ResultPanel.js +1 -1
- package/out/map/ResultPanel.js.map +1 -1
- package/out/map/VersionPicker.d.ts +3 -3
- package/out/map/VersionPicker.d.ts.map +1 -1
- package/out/map/VersionPicker.js.map +1 -1
- package/out/map/fake-runtime.d.ts +38 -0
- package/out/map/fake-runtime.d.ts.map +1 -0
- package/out/map/fake-runtime.js +107 -0
- package/out/map/fake-runtime.js.map +1 -0
- package/out/map/geometry.d.ts.map +1 -1
- package/out/map/geometry.js.map +1 -1
- package/out/map/index.d.ts +19 -19
- package/out/map/index.d.ts.map +1 -1
- package/out/map/index.js +11 -11
- package/out/map/index.js.map +1 -1
- package/out/map/map-debug.d.ts +31 -0
- package/out/map/map-debug.d.ts.map +1 -0
- package/out/map/map-debug.js +31 -0
- package/out/map/map-debug.js.map +1 -0
- package/out/map/place-render.d.ts +3 -3
- package/out/map/place-render.d.ts.map +1 -1
- package/out/map/place-render.js +2 -2
- package/out/map/place-render.js.map +1 -1
- package/out/map/types.d.ts +50 -46
- package/out/map/types.d.ts.map +1 -1
- package/out/map/types.js +6 -6
- package/out/map/types.js.map +1 -1
- package/out/map/useCompareState.d.ts.map +1 -1
- package/out/map/useCompareState.js.map +1 -1
- package/out/map/{useDemoGeocode.d.ts → useGeocode.d.ts} +11 -11
- package/out/map/useGeocode.d.ts.map +1 -0
- package/out/map/{useDemoGeocode.js → useGeocode.js} +5 -5
- package/out/map/useGeocode.js.map +1 -0
- package/out/map/useMapPlaceRender.d.ts +1 -1
- package/out/map/useMapPlaceRender.d.ts.map +1 -1
- package/out/map/useMapPlaceRender.js +1 -1
- package/out/map/useMapPlaceRender.js.map +1 -1
- package/out/map/usePlaceAutocomplete.d.ts +1 -1
- package/out/map/usePlaceAutocomplete.d.ts.map +1 -1
- package/out/map/usePlaceAutocomplete.js +1 -1
- package/out/map/usePlaceAutocomplete.js.map +1 -1
- package/out/pipeline/CandidatePicker.d.ts +1 -1
- 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/ComponentTable.d.ts +1 -1
- package/out/pipeline/ComponentTable.d.ts.map +1 -1
- package/out/pipeline/ComponentTable.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 +5 -17
- package/out/pipeline/ConfidenceCell.js.map +1 -1
- package/out/pipeline/FailureDiagnostic.d.ts +15 -0
- package/out/pipeline/FailureDiagnostic.d.ts.map +1 -0
- package/out/pipeline/FailureDiagnostic.js +21 -0
- package/out/pipeline/FailureDiagnostic.js.map +1 -0
- package/out/pipeline/PipelineExplorer.d.ts +1 -1
- package/out/pipeline/PipelineExplorer.d.ts.map +1 -1
- package/out/pipeline/PipelineExplorer.js +3 -3
- package/out/pipeline/PipelineExplorer.js.map +1 -1
- package/out/pipeline/QueryForm.d.ts +2 -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/ResolvedPlace.js +4 -10
- package/out/pipeline/ResolvedPlace.js.map +1 -1
- package/out/pipeline/SpanHighlight.d.ts +23 -0
- package/out/pipeline/SpanHighlight.d.ts.map +1 -0
- package/out/pipeline/SpanHighlight.js +31 -0
- package/out/pipeline/SpanHighlight.js.map +1 -0
- package/out/pipeline/TimingPanel.d.ts +16 -0
- package/out/pipeline/TimingPanel.d.ts.map +1 -0
- package/out/pipeline/TimingPanel.js +20 -0
- package/out/pipeline/TimingPanel.js.map +1 -0
- package/out/pipeline/TreeView.d.ts +17 -0
- package/out/pipeline/TreeView.d.ts.map +1 -0
- package/out/pipeline/TreeView.js +15 -0
- package/out/pipeline/TreeView.js.map +1 -0
- package/out/pipeline/copy.d.ts +1 -1
- package/out/pipeline/copy.d.ts.map +1 -1
- package/out/pipeline/copy.js.map +1 -1
- package/out/pipeline/presets.d.ts.map +1 -1
- package/out/pipeline/presets.js +2 -1
- package/out/pipeline/presets.js.map +1 -1
- package/out/pipeline/types.d.ts +2 -68
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +1 -1
- package/out/pipeline/types.js.map +1 -1
- package/out/pipeline/useParsePipeline.d.ts +2 -1
- package/out/pipeline/useParsePipeline.d.ts.map +1 -1
- package/out/pipeline/useParsePipeline.js.map +1 -1
- package/out/poi/AbstainPanel.d.ts.map +1 -1
- package/out/poi/AbstainPanel.js.map +1 -1
- package/out/poi/LiveResultsBlock.d.ts +1 -1
- package/out/poi/LiveResultsBlock.d.ts.map +1 -1
- package/out/poi/LiveResultsBlock.js +1 -1
- package/out/poi/LiveResultsBlock.js.map +1 -1
- package/out/poi/OverpassBlock.d.ts.map +1 -1
- package/out/poi/OverpassBlock.js.map +1 -1
- package/out/poi/POIExplorer.d.ts +1 -1
- package/out/poi/POIExplorer.d.ts.map +1 -1
- package/out/poi/POIExplorer.js +2 -2
- package/out/poi/POIExplorer.js.map +1 -1
- package/out/poi/QueryInput.d.ts.map +1 -1
- package/out/poi/QueryInput.js.map +1 -1
- package/out/poi/SubjectPanel.d.ts +1 -1
- package/out/poi/SubjectPanel.d.ts.map +1 -1
- package/out/poi/SubjectPanel.js.map +1 -1
- package/out/poi/runtime.d.ts +1 -1
- package/out/poi/runtime.d.ts.map +1 -1
- package/out/poi/runtime.js.map +1 -1
- package/out/poi/types.d.ts +3 -2
- package/out/poi/types.d.ts.map +1 -1
- package/out/poi/types.js +1 -1
- package/out/poi/types.js.map +1 -1
- package/out/poi/usePOISearch.d.ts +1 -1
- package/out/poi/usePOISearch.d.ts.map +1 -1
- package/out/poi/usePOISearch.js +4 -4
- package/out/poi/usePOISearch.js.map +1 -1
- package/out/runtime/{useDemoRuntime.d.ts → useReleaseRuntime.d.ts} +20 -22
- package/out/runtime/useReleaseRuntime.d.ts.map +1 -0
- package/out/runtime/{useDemoRuntime.js → useReleaseRuntime.js} +6 -6
- package/out/runtime/useReleaseRuntime.js.map +1 -0
- package/package.json +221 -34
- package/styleframe.config.ts +321 -0
- package/styles.css +1074 -664
- package/tokens/index.css +115 -0
- package/tokens/tokens.json +521 -0
- package/tokens/tokens.resolver.json +185 -0
- package/out/map/DemoControls.d.ts +0 -64
- package/out/map/DemoControls.d.ts.map +0 -1
- package/out/map/DemoControls.js.map +0 -1
- package/out/map/DemoMap.d.ts.map +0 -1
- package/out/map/DemoMap.js.map +0 -1
- package/out/map/GeocoderDemo.d.ts.map +0 -1
- package/out/map/GeocoderDemo.js.map +0 -1
- package/out/map/useDemoGeocode.d.ts.map +0 -1
- package/out/map/useDemoGeocode.js.map +0 -1
- package/out/runtime/useDemoRuntime.d.ts.map +0 -1
- package/out/runtime/useDemoRuntime.js.map +0 -1
- package/pipeline/ConfidenceCell.tsx +0 -43
- /package/{common → lib/common}/ClientOnly.tsx +0 -0
- /package/{common → lib/common}/PresetChips.tsx +0 -0
- /package/{common → lib/common}/cx.ts +0 -0
- /package/{common → lib/common}/useClipboard.ts +0 -0
- /package/{common → lib/common}/useDebouncedValue.ts +0 -0
- /package/{map → lib/map}/BackendControl.tsx +0 -0
- /package/{map → lib/map}/geometry.ts +0 -0
- /package/{map → lib/map}/useCompareState.ts +0 -0
- /package/{poi → lib/poi}/AbstainPanel.tsx +0 -0
- /package/{poi → lib/poi}/OverpassBlock.tsx +0 -0
- /package/{poi → lib/poi}/QueryInput.tsx +0 -0
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `<
|
|
7
|
-
* and takes the SAME DI
|
|
8
|
-
* the composed map style) plus a {@link
|
|
6
|
+
* `<Geocoder>` — the WHOLE geocoder, composed. It is the map analogue of `PipelineExplorer`
|
|
7
|
+
* and takes the SAME DI shape: an injected {@link GeocoderRuntime} (the host owns ONNX / httpvfs / R2 /
|
|
8
|
+
* the composed map style) plus a {@link GeocoderPanels} bag (the host's ModelVisualizer / VersionCompare /
|
|
9
9
|
* About / Permalink). Everything here is composition + a `ClientOnly` boundary:
|
|
10
10
|
*
|
|
11
|
-
* - the floating {@link
|
|
12
|
-
* - the declarative {@link
|
|
11
|
+
* - the floating {@link GeocoderControls} panel (version / compare / backend / query+autocomplete / result),
|
|
12
|
+
* - the declarative {@link MapCanvas} with the phase-2 overlays ({@link OverlayLayers}) and the
|
|
13
13
|
* resolved-place marker/outline/camera ({@link ResolvedPlaceLayers}) driven by the parse state,
|
|
14
|
-
* - the hooks that wire them: {@link
|
|
14
|
+
* - the hooks that wire them: {@link useGeocode} (parse + viewport bias + map place),
|
|
15
15
|
* {@link usePlaceAutocomplete}, {@link useCompareState}.
|
|
16
16
|
*
|
|
17
|
-
* Because it pulls {@link
|
|
17
|
+
* Because it pulls {@link MapCanvas} (→ `react-map-gl` → `maplibre-gl`, WebGL + DOM at import), it lives on
|
|
18
18
|
* the `@mailwoman/react/map` subpath ONLY — never the package root. The whole thing renders in Storybook
|
|
19
19
|
* over a fake runtime (offline stub style + canned geocode) with no network, no ONNX, no gazetteer.
|
|
20
20
|
*/
|
|
@@ -22,27 +22,28 @@
|
|
|
22
22
|
import { type ReactNode, useCallback, useEffect, useRef } from "react"
|
|
23
23
|
import type { MapRef } from "react-map-gl/maplibre"
|
|
24
24
|
|
|
25
|
+
import type { GeocoderPanels, GeocoderRuntime, MapBias } from "#map/types"
|
|
26
|
+
import { useCompareState } from "#map/useCompareState"
|
|
27
|
+
import { useGeocode } from "#map/useGeocode"
|
|
28
|
+
import { useMapPlaceRender } from "#map/useMapPlaceRender"
|
|
29
|
+
import { usePlaceAutocomplete } from "#map/usePlaceAutocomplete"
|
|
30
|
+
|
|
25
31
|
import { ClientOnly } from "../common/ClientOnly.tsx"
|
|
26
32
|
import type { Preset } from "../common/PresetChips.tsx"
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
33
|
+
import { GeocoderControls } from "./GeocoderControls.tsx"
|
|
34
|
+
import { MapCanvas } from "./MapCanvas.tsx"
|
|
29
35
|
import { OverlayLayers } from "./OverlayLayers.tsx"
|
|
30
36
|
import { ResolvedPlaceLayers } from "./ResolvedPlaceLayers.tsx"
|
|
31
|
-
import type { DemoPanels, DemoRuntime, MapBias } from "./types.ts"
|
|
32
|
-
import { useCompareState } from "./useCompareState.ts"
|
|
33
|
-
import { useDemoGeocode } from "./useDemoGeocode.ts"
|
|
34
|
-
import { useMapPlaceRender } from "./useMapPlaceRender.ts"
|
|
35
|
-
import { usePlaceAutocomplete } from "./usePlaceAutocomplete.ts"
|
|
36
37
|
|
|
37
|
-
export interface
|
|
38
|
+
export interface GeocoderProps {
|
|
38
39
|
/**
|
|
39
|
-
* The injected
|
|
40
|
+
* The injected geocoder runtime (map style + overlays + parse + version/backend).
|
|
40
41
|
*/
|
|
41
|
-
runtime:
|
|
42
|
+
runtime: GeocoderRuntime
|
|
42
43
|
/**
|
|
43
44
|
* Host-injected panels (about, release blurb, compare, permalink, debug drawer, map controls, …).
|
|
44
45
|
*/
|
|
45
|
-
panels?:
|
|
46
|
+
panels?: GeocoderPanels
|
|
46
47
|
/**
|
|
47
48
|
* Address to pre-fill.
|
|
48
49
|
*/
|
|
@@ -53,54 +54,54 @@ export interface GeocoderDemoProps {
|
|
|
53
54
|
presets?: ReadonlyArray<Preset>
|
|
54
55
|
/**
|
|
55
56
|
* Only hint the viewport bias once the visitor has zoomed past the global view — a whole-globe center is noise.
|
|
56
|
-
* Matches the
|
|
57
|
+
* Matches the `map.getZoom() >= 4` threshold. @default 4
|
|
57
58
|
*/
|
|
58
59
|
minBiasZoom?: number
|
|
59
60
|
/**
|
|
60
61
|
* Fly/fit the map to the resolved place on each result (via {@link ResolvedPlaceLayers}). @default true. Set false
|
|
61
|
-
* for a host that drives the camera itself (a controlled `<
|
|
62
|
+
* for a host that drives the camera itself (a controlled `<MapCanvas viewState>`), or to keep a headless test
|
|
62
63
|
* deterministic — the marker + outline still render, only the animated camera move is skipped.
|
|
63
64
|
*/
|
|
64
65
|
applyResultCamera?: boolean
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
interface
|
|
68
|
-
Pick<
|
|
68
|
+
interface GeocoderInnerProps extends Required<
|
|
69
|
+
Pick<GeocoderProps, "runtime" | "defaultAddress" | "minBiasZoom" | "applyResultCamera">
|
|
69
70
|
> {
|
|
70
|
-
panels:
|
|
71
|
+
panels: GeocoderPanels
|
|
71
72
|
presets: ReadonlyArray<Preset>
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
function
|
|
75
|
+
function GeocoderInner({
|
|
75
76
|
runtime,
|
|
76
77
|
panels,
|
|
77
78
|
defaultAddress,
|
|
78
79
|
presets,
|
|
79
80
|
minBiasZoom,
|
|
80
81
|
applyResultCamera,
|
|
81
|
-
}:
|
|
82
|
+
}: GeocoderInnerProps): ReactNode {
|
|
82
83
|
const mapRef = useRef<MapRef>(null)
|
|
83
84
|
|
|
84
|
-
// TEST
|
|
85
|
+
// TEST INJECTION POINT: the e2e viewport-bias suite drives the REAL map (pan + zoom past the bias threshold)
|
|
85
86
|
// before submitting, and a browser test cannot reach a React ref — so the live map handle is
|
|
86
|
-
// republished on `globalThis.
|
|
87
|
-
//
|
|
88
|
-
//
|
|
87
|
+
// republished on `globalThis.__mailwomanMapCanvas`. The ref fills only after react-map-gl instantiates
|
|
88
|
+
// the map, hence the short poll; cleared on unmount so a torn-down geocoder never leaves a stale
|
|
89
|
+
// handle behind.
|
|
89
90
|
useEffect(() => {
|
|
90
|
-
const
|
|
91
|
+
const host = globalThis as { __mailwomanMapCanvas?: ReturnType<MapRef["getMap"]> }
|
|
91
92
|
|
|
92
93
|
const timer = setInterval(() => {
|
|
93
94
|
const map = mapRef.current?.getMap()
|
|
94
95
|
|
|
95
96
|
if (map) {
|
|
96
|
-
|
|
97
|
+
host.__mailwomanMapCanvas = map
|
|
97
98
|
clearInterval(timer)
|
|
98
99
|
}
|
|
99
100
|
}, 250)
|
|
100
101
|
|
|
101
102
|
return () => {
|
|
102
103
|
clearInterval(timer)
|
|
103
|
-
delete
|
|
104
|
+
delete host.__mailwomanMapCanvas
|
|
104
105
|
}
|
|
105
106
|
}, [])
|
|
106
107
|
|
|
@@ -118,7 +119,7 @@ function GeocoderDemoInner({
|
|
|
118
119
|
return { center: [center.lng, center.lat], zoom }
|
|
119
120
|
}, [minBiasZoom])
|
|
120
121
|
|
|
121
|
-
const geocode =
|
|
122
|
+
const geocode = useGeocode({ runtime, defaultText: defaultAddress, getBias })
|
|
122
123
|
const compare = useCompareState()
|
|
123
124
|
|
|
124
125
|
const autocomplete = usePlaceAutocomplete({
|
|
@@ -142,7 +143,7 @@ function GeocoderDemoInner({
|
|
|
142
143
|
return (
|
|
143
144
|
<div className="mw-geocoder-demo">
|
|
144
145
|
<div className="mw-geocoder-demo__map">
|
|
145
|
-
<
|
|
146
|
+
<MapCanvas
|
|
146
147
|
mapStyle={runtime.mapStyle}
|
|
147
148
|
mapRef={mapRef}
|
|
148
149
|
initialViewState={{
|
|
@@ -151,17 +152,17 @@ function GeocoderDemoInner({
|
|
|
151
152
|
zoom: runtime.initialZoom ?? 3,
|
|
152
153
|
}}
|
|
153
154
|
style={{ width: "100%", height: "100%" }}
|
|
154
|
-
//
|
|
155
|
-
//
|
|
155
|
+
// One compact attribution pill (the map's own default is a wide, always-open "MapLibre | © …" bar), no
|
|
156
|
+
// maplibre wordmark logo.
|
|
156
157
|
mapProps={{ attributionControl: { compact: true }, maplibreLogo: false }}
|
|
157
158
|
>
|
|
158
159
|
<OverlayLayers overlays={runtime.overlays} />
|
|
159
160
|
<ResolvedPlaceLayers spec={spec} applyCamera={applyResultCamera} />
|
|
160
161
|
{panels.mapControls}
|
|
161
|
-
</
|
|
162
|
+
</MapCanvas>
|
|
162
163
|
</div>
|
|
163
164
|
|
|
164
|
-
<
|
|
165
|
+
<GeocoderControls
|
|
165
166
|
runtime={runtime}
|
|
166
167
|
geocode={geocode}
|
|
167
168
|
autocomplete={autocomplete}
|
|
@@ -181,30 +182,30 @@ function GeocoderDemoInner({
|
|
|
181
182
|
/**
|
|
182
183
|
* Stable empty defaults — a fresh `{}`/`[]` per render would churn every downstream memo dep.
|
|
183
184
|
*/
|
|
184
|
-
const NO_PANELS:
|
|
185
|
+
const NO_PANELS: GeocoderPanels = {}
|
|
185
186
|
const NO_PRESETS: ReadonlyArray<Preset> = []
|
|
186
187
|
|
|
187
188
|
/**
|
|
188
|
-
* The composed geocoder
|
|
189
|
+
* The composed geocoder, behind a `ClientOnly` SSR boundary (the map is intrinsically a client component).
|
|
189
190
|
*/
|
|
190
|
-
export function
|
|
191
|
+
export function Geocoder({
|
|
191
192
|
runtime,
|
|
192
193
|
panels = NO_PANELS,
|
|
193
194
|
defaultAddress = "",
|
|
194
195
|
presets = NO_PRESETS,
|
|
195
196
|
minBiasZoom = 4,
|
|
196
197
|
applyResultCamera = true,
|
|
197
|
-
}:
|
|
198
|
+
}: GeocoderProps): ReactNode {
|
|
198
199
|
return (
|
|
199
200
|
<ClientOnly
|
|
200
201
|
fallback={
|
|
201
202
|
<div className="mw-geocoder-demo">
|
|
202
|
-
<p>Loading
|
|
203
|
+
<p>Loading the geocoder…</p>
|
|
203
204
|
</div>
|
|
204
205
|
}
|
|
205
206
|
>
|
|
206
207
|
{() => (
|
|
207
|
-
<
|
|
208
|
+
<GeocoderInner
|
|
208
209
|
runtime={runtime}
|
|
209
210
|
panels={panels}
|
|
210
211
|
defaultAddress={defaultAddress}
|
|
@@ -3,19 +3,23 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `<
|
|
6
|
+
* `<GeocoderControls>` — the geocoder's floating control panel, assembled from the geocoder-specific units
|
|
7
7
|
* (VersionPicker / CompareToggle / BackendControl / PlaceAutocomplete / ResultPanel) and the REUSED
|
|
8
|
-
* pipeline units (QueryForm / PresetChips / LoadingIndicator). It
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* + {@link useCompareState} hooks into the controls. Host-specific visualizers arrive via {@link DemoPanels}.
|
|
8
|
+
* pipeline units (QueryForm / PresetChips / LoadingIndicator). It reads the injected {@link GeocoderRuntime}
|
|
9
|
+
* for ready/version/backend/loading state and threads the {@link useGeocode} + {@link usePlaceAutocomplete}
|
|
10
|
+
* + {@link useCompareState} hooks into the controls. Host-specific visualizers arrive via {@link GeocoderPanels}.
|
|
12
11
|
*
|
|
13
|
-
* NODE-SAFE: pure React + the shared/
|
|
14
|
-
*
|
|
12
|
+
* NODE-SAFE: pure React + the shared/geocoder units, no maplibre. It rides `@mailwoman/react/map` as a
|
|
13
|
+
* geocoder-specific control, not for WebGL.
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
import type { ReactNode } from "react"
|
|
18
17
|
|
|
18
|
+
import type { GeocoderPanels, GeocoderRuntime } from "#map/types"
|
|
19
|
+
import type { UseCompareState } from "#map/useCompareState"
|
|
20
|
+
import type { UseGeocode } from "#map/useGeocode"
|
|
21
|
+
import type { UsePlaceAutocomplete } from "#map/usePlaceAutocomplete"
|
|
22
|
+
|
|
19
23
|
import { LoadingIndicator } from "../common/LoadingIndicator.tsx"
|
|
20
24
|
import { PresetChips, type Preset } from "../common/PresetChips.tsx"
|
|
21
25
|
import { QueryForm } from "../pipeline/QueryForm.tsx"
|
|
@@ -23,21 +27,17 @@ import { BackendControl } from "./BackendControl.tsx"
|
|
|
23
27
|
import { CompareToggle } from "./CompareToggle.tsx"
|
|
24
28
|
import { PlaceAutocomplete } from "./PlaceAutocomplete.tsx"
|
|
25
29
|
import { ResultPanel } from "./ResultPanel.tsx"
|
|
26
|
-
import type { DemoPanels, DemoRuntime } from "./types.ts"
|
|
27
|
-
import type { UseCompareState } from "./useCompareState.ts"
|
|
28
|
-
import type { UseDemoGeocode } from "./useDemoGeocode.ts"
|
|
29
|
-
import type { UsePlaceAutocomplete } from "./usePlaceAutocomplete.ts"
|
|
30
30
|
import { VersionPicker } from "./VersionPicker.tsx"
|
|
31
31
|
|
|
32
|
-
export interface
|
|
32
|
+
export interface GeocoderControlsProps {
|
|
33
33
|
/**
|
|
34
|
-
* The injected
|
|
34
|
+
* The injected geocoder runtime.
|
|
35
35
|
*/
|
|
36
|
-
runtime:
|
|
36
|
+
runtime: GeocoderRuntime
|
|
37
37
|
/**
|
|
38
38
|
* The parse+resolve state machine.
|
|
39
39
|
*/
|
|
40
|
-
geocode:
|
|
40
|
+
geocode: UseGeocode
|
|
41
41
|
/**
|
|
42
42
|
* The place-autocomplete combobox state.
|
|
43
43
|
*/
|
|
@@ -49,7 +49,7 @@ export interface DemoControlsProps {
|
|
|
49
49
|
/**
|
|
50
50
|
* Host-injected panels (about, release blurb, compare, permalink, extras, failure).
|
|
51
51
|
*/
|
|
52
|
-
panels:
|
|
52
|
+
panels: GeocoderPanels
|
|
53
53
|
/**
|
|
54
54
|
* Example chips.
|
|
55
55
|
*/
|
|
@@ -59,7 +59,7 @@ export interface DemoControlsProps {
|
|
|
59
59
|
*/
|
|
60
60
|
placeholder: string
|
|
61
61
|
/**
|
|
62
|
-
* Select a model version (the composed
|
|
62
|
+
* Select a model version (the composed geocoder also clears a now-colliding compare selection).
|
|
63
63
|
*/
|
|
64
64
|
onSelectVersion: (version: string) => void
|
|
65
65
|
/**
|
|
@@ -71,7 +71,7 @@ export interface DemoControlsProps {
|
|
|
71
71
|
/**
|
|
72
72
|
* The floating control panel.
|
|
73
73
|
*/
|
|
74
|
-
export function
|
|
74
|
+
export function GeocoderControls({
|
|
75
75
|
runtime,
|
|
76
76
|
geocode,
|
|
77
77
|
autocomplete,
|
|
@@ -81,7 +81,7 @@ export function DemoControls({
|
|
|
81
81
|
placeholder,
|
|
82
82
|
onSelectVersion,
|
|
83
83
|
onForceWASMChange,
|
|
84
|
-
}:
|
|
84
|
+
}: GeocoderControlsProps): ReactNode {
|
|
85
85
|
const versions = runtime.availableVersions ?? []
|
|
86
86
|
const { busy, result, selectedCandidate } = geocode
|
|
87
87
|
const loading = runtime.loading
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
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
8
|
* controlled) view state, and a `children` slot for the overlays/markers that land in later phases.
|
|
9
9
|
* No overlay/marker/camera logic lives here yet.
|
|
@@ -15,10 +15,10 @@
|
|
|
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
|
-
* `<
|
|
19
|
-
* for the `.mw-demo-map` container). `<
|
|
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 — a host that
|
|
20
20
|
* server-renders should wrap it in a client boundary (the package's `ClientOnly`), exactly as the
|
|
21
|
-
* composed `
|
|
21
|
+
* composed `Geocoder` will in a later phase.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import type { CSSProperties, ReactNode, Ref } from "react"
|
|
@@ -26,23 +26,23 @@ import { Map } from "react-map-gl/maplibre"
|
|
|
26
26
|
import type { MapProps, MapRef, ViewStateChangeEvent } from "react-map-gl/maplibre"
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* The style a `<
|
|
29
|
+
* The style a `<MapCanvas>` renders — a style URL or an inline/composed `StyleSpecification`.
|
|
30
30
|
*/
|
|
31
|
-
export type
|
|
31
|
+
export type MapCanvasStyle = NonNullable<MapProps["mapStyle"]>
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
* `maplibreLogo`). The controlled fields
|
|
34
|
+
* Override for the `<Map>` props `<MapCanvas>` does not surface explicitly (e.g. `minZoom`, `attributionControl`,
|
|
35
|
+
* `maplibreLogo`). The controlled fields MapCanvas owns are omitted so they can't be set twice.
|
|
36
36
|
*/
|
|
37
|
-
export type
|
|
37
|
+
export type MapCanvasExtraProps = Partial<
|
|
38
38
|
Omit<MapProps, "mapStyle" | "initialViewState" | "viewState" | "onMove" | "children" | "style" | "ref">
|
|
39
39
|
>
|
|
40
40
|
|
|
41
|
-
export interface
|
|
41
|
+
export interface MapCanvasProps {
|
|
42
42
|
/**
|
|
43
43
|
* The map style — host-composed `StyleSpecification` or a style URL.
|
|
44
44
|
*/
|
|
45
|
-
mapStyle:
|
|
45
|
+
mapStyle: MapCanvasStyle
|
|
46
46
|
/**
|
|
47
47
|
* Uncontrolled initial camera. Use this OR `viewState`, not both.
|
|
48
48
|
*/
|
|
@@ -52,7 +52,7 @@ export interface DemoMapProps {
|
|
|
52
52
|
*/
|
|
53
53
|
viewState?: MapProps["viewState"]
|
|
54
54
|
/**
|
|
55
|
-
* Fired on every camera change (drag/zoom/rotate) — the
|
|
55
|
+
* Fired on every camera change (drag/zoom/rotate) — the hook for viewport-bias persistence.
|
|
56
56
|
*/
|
|
57
57
|
onMove?: (event: ViewStateChangeEvent) => void
|
|
58
58
|
/**
|
|
@@ -76,9 +76,9 @@ export interface DemoMapProps {
|
|
|
76
76
|
*/
|
|
77
77
|
style?: CSSProperties
|
|
78
78
|
/**
|
|
79
|
-
* Remaining `<Map>` props
|
|
79
|
+
* Remaining `<Map>` props MapCanvas does not surface explicitly.
|
|
80
80
|
*/
|
|
81
|
-
mapProps?:
|
|
81
|
+
mapProps?: MapCanvasExtraProps
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
const FILL: CSSProperties = { width: "100%", height: "100%" }
|
|
@@ -87,7 +87,7 @@ const FILL: CSSProperties = { width: "100%", height: "100%" }
|
|
|
87
87
|
* The controlled-viewport map shell. Renders a sized wrapper around a `react-map-gl/maplibre` `<Map>`; everything
|
|
88
88
|
* host-specific (the composed `mapStyle`, the initial center) is injected, and overlays ride in as `children`.
|
|
89
89
|
*/
|
|
90
|
-
export function
|
|
90
|
+
export function MapCanvas({
|
|
91
91
|
mapStyle,
|
|
92
92
|
initialViewState,
|
|
93
93
|
viewState,
|
|
@@ -98,7 +98,7 @@ export function DemoMap({
|
|
|
98
98
|
className,
|
|
99
99
|
style,
|
|
100
100
|
mapProps,
|
|
101
|
-
}:
|
|
101
|
+
}: MapCanvasProps): ReactNode {
|
|
102
102
|
const wrapperClassName = className ? `mw-demo-map ${className}` : "mw-demo-map"
|
|
103
103
|
|
|
104
104
|
return (
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*
|
|
6
6
|
* `<OverlayLayers>` — renders the host-supplied {@link OverlaySpec}s (coverage "fog of war",
|
|
7
7
|
* race-dots, …) as declarative `<Source>` + `<Layer>`s. This replaces the demo's imperative
|
|
8
|
-
* `map.addSource` / `map.addLayer` overlay loops (and their `isStyleLoaded()` / `styledata`
|
|
8
|
+
* `map.addSource` / `map.addLayer` overlay loops (and their `isStyleLoaded()` / `styledata` guards):
|
|
9
9
|
* the host composes the specs, the package renders them, react-map-gl owns the add/remove lifecycle.
|
|
10
10
|
*
|
|
11
|
-
* Each overlay's `visible` flag flips the layers' `visibility` layout property — the declarative
|
|
11
|
+
* Each overlay's `visible` flag flips the layers' `visibility` layout property — the declarative control a
|
|
12
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
|
*/
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { Fragment, type ReactNode } from "react"
|
|
17
17
|
import { Layer, Source } from "react-map-gl/maplibre"
|
|
18
18
|
|
|
19
|
-
import type { OverlaySpec } from "
|
|
19
|
+
import type { OverlaySpec } from "#map/types"
|
|
20
20
|
|
|
21
21
|
export interface OverlayLayersProps {
|
|
22
22
|
/**
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
import type { ReactNode } from "react"
|
|
16
16
|
|
|
17
|
-
import { cx } from "
|
|
18
|
-
import type { Suggestion } from "
|
|
17
|
+
import { cx } from "#common/cx"
|
|
18
|
+
import type { Suggestion } from "#map/types"
|
|
19
19
|
|
|
20
20
|
export interface PlaceAutocompleteProps {
|
|
21
21
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* `<PlaceMarker>` — the resolved-place pin, as a declarative `react-map-gl/maplibre` `<Marker>`. This
|
|
7
7
|
* replaces the old imperative `new maplibre.Marker(...).setLngLat(...).addTo(map)` (+ the manual
|
|
8
8
|
* `markerRef.current.remove()` teardown) from the demo's redraw effect: mounting/unmounting the marker
|
|
9
|
-
* is now React's job, keyed on the resolved candidate. Renders as a child of `<
|
|
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.
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `<ResolvedPlaceLayers>` — the drop-in that renders a whole {@link MapPlaceRenderSpec} as `<
|
|
6
|
+
* `<ResolvedPlaceLayers>` — the drop-in that renders a whole {@link MapPlaceRenderSpec} as `<MapCanvas>`
|
|
7
7
|
* children: the marker(s), the outline, and (optionally) the camera move. This is the declarative
|
|
8
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 `<
|
|
9
|
+
* with `useMapPlaceRender(place)` and drops `<ResolvedPlaceLayers spec={spec} />` inside `<MapCanvas>`.
|
|
10
10
|
*
|
|
11
11
|
* `spec = null` (no result / no candidate) renders nothing, which also unmounts the previous marker +
|
|
12
12
|
* outline — the teardown the old effect did by hand (`markerRef.remove()`, `clearBbox`) is now just
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
import type { ReactNode } from "react"
|
|
17
17
|
|
|
18
|
-
import type { MapPlaceRenderSpec } from "
|
|
18
|
+
import type { MapPlaceRenderSpec } from "#map/place-render"
|
|
19
|
+
|
|
19
20
|
import { PlaceMarker } from "./PlaceMarker.tsx"
|
|
20
21
|
import { ResultCamera } from "./ResultCamera.tsx"
|
|
21
22
|
import { ResultOverlay } from "./ResultOverlay.tsx"
|
|
@@ -27,7 +28,7 @@ export interface ResolvedPlaceLayersProps {
|
|
|
27
28
|
spec: MapPlaceRenderSpec | null
|
|
28
29
|
/**
|
|
29
30
|
* Apply the computed camera target via {@link ResultCamera}. @default true. Set false when the consumer drives the
|
|
30
|
-
* camera itself (e.g. a controlled `<
|
|
31
|
+
* camera itself (e.g. a controlled `<MapCanvas viewState>` fed by {@link cameraToViewState}).
|
|
31
32
|
*/
|
|
32
33
|
applyCamera?: boolean
|
|
33
34
|
/**
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* `useMap()` (exactly as `DashboardMap`/`GeoJSONClipboardLayer` reach the map), never a threaded handle.
|
|
12
12
|
*
|
|
13
13
|
* A consumer that prefers a hard, declarative jump can instead feed the target through
|
|
14
|
-
* {@link cameraToViewState} into a controlled `<
|
|
14
|
+
* {@link cameraToViewState} into a controlled `<MapCanvas viewState>` and skip this component — the
|
|
15
15
|
* `center` case has that declarative path; only `bounds` strictly requires this. Renders nothing.
|
|
16
16
|
*
|
|
17
17
|
* `target` is expected to be the STABLE, memoized `camera` off a `useMapPlaceRender` spec, so listing it
|
|
@@ -23,13 +23,13 @@ import type { FitBoundsOptions } from "maplibre-gl"
|
|
|
23
23
|
import { type ReactNode, useEffect } from "react"
|
|
24
24
|
import { useMap } from "react-map-gl/maplibre"
|
|
25
25
|
|
|
26
|
-
import type { MapCameraTarget } from "
|
|
26
|
+
import type { MapCameraTarget } from "#map/place-render"
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* The `fitBounds` options for a `bounds` target — and the reason this is a named function rather than an object literal
|
|
30
30
|
* at the call site.
|
|
31
31
|
*
|
|
32
|
-
* `duration` is present ONLY on the non-animated path, and its ABSENCE on the animated one is
|
|
32
|
+
* `duration` is present ONLY on the non-animated path, and its ABSENCE on the animated one is required. maplibre's
|
|
33
33
|
* `Camera.flyTo` (which `fitBounds` funnels into via `_fitInternal`) branches on `'duration' in options`, not on the
|
|
34
34
|
* value: an explicitly-passed `duration: undefined` therefore survives the key test and is coerced with `+undefined` →
|
|
35
35
|
* `NaN`. Every ease frame then computes `k = easing(elapsed / NaN)` → `NaN`, the flight-path math yields a `NaN` world
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* `<ResultOverlay>` — the resolved-place outline (crisp admin polygon, or an approximate/exact-radius
|
|
7
7
|
* circle) as a declarative `<Source>` + fill/line `<Layer>`s. This replaces the demo's imperative
|
|
8
8
|
* `setPlaceOutline` / `drawApproxCircle` / `drawPlaceGeometry` / `clearBbox` helpers and their
|
|
9
|
-
* `whenStyleReady`
|
|
9
|
+
* `whenStyleReady` guard: react-map-gl owns the "add source/layer once the style is loaded, remove on
|
|
10
10
|
* unmount" lifecycle, so the hand-rolled `isStyleLoaded()` / `styledata` races disappear.
|
|
11
11
|
*
|
|
12
12
|
* Pass the `outline` straight from a {@link MapPlaceRenderSpec}; a `null` outline renders nothing (the
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import type { ReactNode } from "react"
|
|
17
17
|
import { Layer, Source } from "react-map-gl/maplibre"
|
|
18
18
|
|
|
19
|
-
import type { PlaceGeometry } from "
|
|
19
|
+
import type { PlaceGeometry } from "#map/geometry"
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The house pink, matched to {@link PlaceMarker}.
|
|
@@ -7,22 +7,23 @@
|
|
|
7
7
|
* presentational units (it does not re-implement any of them): `KindBadge`, `ComponentTable`,
|
|
8
8
|
* `ResolvedPlace`, `CandidatePicker`, plus the `CopyButton` + `buildParsePayload` copy affordance. This
|
|
9
9
|
* is the standalone, story-testable unit the demo's floating panel renders (the map analogue of the
|
|
10
|
-
* result block PipelineExplorer inlines), so `
|
|
10
|
+
* result block PipelineExplorer inlines), so `Geocoder` composes ONE panel instead of duplicating
|
|
11
11
|
* the marker/table/candidate glue. Heavy host visualizers (span highlight, tree, timing) slot in via
|
|
12
12
|
* `extras`; the no-resolve diagnostic via `failure`.
|
|
13
13
|
*
|
|
14
14
|
* NODE-SAFE: pure React + the shared units, no maplibre.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import type { ParseResult, ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result"
|
|
17
18
|
import type { ReactNode } from "react"
|
|
18
19
|
|
|
20
|
+
import { buildParsePayload } from "#pipeline/copy"
|
|
21
|
+
|
|
19
22
|
import { CopyButton } from "../common/CopyButton.tsx"
|
|
20
23
|
import { KindBadge } from "../common/KindBadge.tsx"
|
|
21
24
|
import { CandidatePicker } from "../pipeline/CandidatePicker.tsx"
|
|
22
25
|
import { ComponentTable } from "../pipeline/ComponentTable.tsx"
|
|
23
|
-
import { buildParsePayload } from "../pipeline/copy.ts"
|
|
24
26
|
import { ResolvedPlace } from "../pipeline/ResolvedPlace.tsx"
|
|
25
|
-
import type { ParseResult, ResolvedPlaceView } from "../pipeline/types.ts"
|
|
26
27
|
|
|
27
28
|
export interface ResultPanelProps {
|
|
28
29
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* `<VersionPicker>` — the model-version `<select>` from the demo's control panel (`_app.tsx:1230-1254`),
|
|
7
7
|
* as a dumb presentational unit: the available bundles + current selection come in as props, the choice
|
|
8
|
-
* goes out through `onSelect`. No load state, no manifest fetch — the host (via `
|
|
8
|
+
* goes out through `onSelect`. No load state, no manifest fetch — the host (via `useReleaseRuntime`) owns
|
|
9
9
|
* that. Renders nothing when there is fewer than two versions to choose between.
|
|
10
10
|
*
|
|
11
11
|
* NODE-SAFE: pure React + a `<select>`, no maplibre. It rides the `@mailwoman/react/map` subpath only
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
import type { ReactNode } from "react"
|
|
16
16
|
|
|
17
|
-
import type {
|
|
17
|
+
import type { VersionOption } from "#map/types"
|
|
18
18
|
|
|
19
19
|
export interface VersionPickerProps {
|
|
20
20
|
/**
|
|
21
21
|
* The selectable model bundles.
|
|
22
22
|
*/
|
|
23
|
-
versions: ReadonlyArray<
|
|
23
|
+
versions: ReadonlyArray<VersionOption>
|
|
24
24
|
/**
|
|
25
25
|
* The currently-selected version tag.
|
|
26
26
|
*/
|