@mailwoman/react 8.1.0 → 8.3.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/common/ClientOnly.tsx +6 -2
- package/common/CopyButton.tsx +9 -3
- package/common/KindBadge.tsx +1 -1
- package/common/LoadingIndicator.tsx +22 -7
- package/common/PresetChips.tsx +6 -2
- package/common/cx.ts +3 -1
- package/common/useClipboard.ts +7 -2
- package/index.ts +5 -0
- package/map/BackendControl.tsx +12 -4
- package/map/CompareToggle.tsx +27 -9
- package/map/DemoControls.tsx +31 -11
- package/map/DemoMap.tsx +33 -11
- package/map/GeocoderDemo.tsx +25 -8
- package/map/OverlayLayers.tsx +7 -3
- package/map/PlaceAutocomplete.tsx +25 -9
- package/map/PlaceMarker.tsx +18 -6
- package/map/ResolvedPlaceLayers.tsx +15 -5
- package/map/ResultCamera.tsx +6 -2
- package/map/ResultOverlay.tsx +18 -6
- package/map/ResultPanel.tsx +21 -7
- package/map/VersionPicker.tsx +18 -6
- package/map/geometry.ts +28 -8
- package/map/index.ts +3 -0
- package/map/place-render.ts +36 -12
- package/map/types.ts +132 -44
- package/map/useCompareState.ts +15 -5
- package/map/useDemoGeocode.ts +12 -4
- package/map/useMapPlaceRender.ts +3 -1
- package/map/usePlaceAutocomplete.ts +52 -18
- package/out/common/ClientOnly.d.ts +6 -2
- package/out/common/ClientOnly.d.ts.map +1 -1
- 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/KindBadge.js +1 -1
- package/out/common/KindBadge.js.map +1 -1
- package/out/common/LoadingIndicator.d.ts +21 -6
- package/out/common/LoadingIndicator.d.ts.map +1 -1
- package/out/common/LoadingIndicator.js +4 -1
- package/out/common/LoadingIndicator.js.map +1 -1
- package/out/common/PresetChips.d.ts +6 -2
- package/out/common/PresetChips.d.ts.map +1 -1
- package/out/common/PresetChips.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/useClipboard.d.ts +3 -1
- package/out/common/useClipboard.d.ts.map +1 -1
- package/out/common/useClipboard.js +6 -2
- package/out/common/useClipboard.js.map +1 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js.map +1 -1
- package/out/map/BackendControl.d.ts +12 -4
- package/out/map/BackendControl.d.ts.map +1 -1
- package/out/map/BackendControl.js +3 -1
- package/out/map/BackendControl.js.map +1 -1
- package/out/map/CompareToggle.d.ts +27 -9
- package/out/map/CompareToggle.d.ts.map +1 -1
- package/out/map/CompareToggle.js +3 -1
- package/out/map/CompareToggle.js.map +1 -1
- package/out/map/DemoControls.d.ts +30 -10
- package/out/map/DemoControls.d.ts.map +1 -1
- package/out/map/DemoControls.js +4 -2
- package/out/map/DemoControls.js.map +1 -1
- package/out/map/DemoMap.d.ts +33 -11
- package/out/map/DemoMap.d.ts.map +1 -1
- package/out/map/DemoMap.js.map +1 -1
- package/out/map/GeocoderDemo.d.ts +16 -6
- package/out/map/GeocoderDemo.d.ts.map +1 -1
- package/out/map/GeocoderDemo.js +9 -3
- package/out/map/GeocoderDemo.js.map +1 -1
- package/out/map/OverlayLayers.d.ts +6 -2
- package/out/map/OverlayLayers.d.ts.map +1 -1
- package/out/map/OverlayLayers.js +4 -2
- package/out/map/OverlayLayers.js.map +1 -1
- package/out/map/PlaceAutocomplete.d.ts +24 -8
- package/out/map/PlaceAutocomplete.d.ts.map +1 -1
- package/out/map/PlaceAutocomplete.js +4 -2
- package/out/map/PlaceAutocomplete.js.map +1 -1
- package/out/map/PlaceMarker.d.ts +15 -5
- package/out/map/PlaceMarker.d.ts.map +1 -1
- package/out/map/PlaceMarker.js +6 -2
- package/out/map/PlaceMarker.js.map +1 -1
- package/out/map/ResolvedPlaceLayers.d.ts +15 -5
- package/out/map/ResolvedPlaceLayers.d.ts.map +1 -1
- package/out/map/ResolvedPlaceLayers.js +3 -1
- package/out/map/ResolvedPlaceLayers.js.map +1 -1
- package/out/map/ResultCamera.d.ts +6 -2
- package/out/map/ResultCamera.d.ts.map +1 -1
- package/out/map/ResultCamera.js +3 -1
- package/out/map/ResultCamera.js.map +1 -1
- package/out/map/ResultOverlay.d.ts +15 -5
- package/out/map/ResultOverlay.d.ts.map +1 -1
- package/out/map/ResultOverlay.js +3 -1
- package/out/map/ResultOverlay.js.map +1 -1
- package/out/map/ResultPanel.d.ts +21 -7
- package/out/map/ResultPanel.d.ts.map +1 -1
- package/out/map/ResultPanel.js +3 -1
- package/out/map/ResultPanel.js.map +1 -1
- package/out/map/VersionPicker.d.ts +18 -6
- package/out/map/VersionPicker.d.ts.map +1 -1
- package/out/map/VersionPicker.js +3 -1
- package/out/map/VersionPicker.js.map +1 -1
- package/out/map/geometry.d.ts +12 -4
- package/out/map/geometry.d.ts.map +1 -1
- package/out/map/geometry.js +17 -5
- package/out/map/geometry.js.map +1 -1
- package/out/map/index.d.ts.map +1 -1
- package/out/map/index.js.map +1 -1
- package/out/map/place-render.d.ts +27 -9
- package/out/map/place-render.d.ts.map +1 -1
- package/out/map/place-render.js +9 -3
- package/out/map/place-render.js.map +1 -1
- package/out/map/types.d.ts +132 -44
- package/out/map/types.d.ts.map +1 -1
- package/out/map/useCompareState.d.ts +15 -5
- package/out/map/useCompareState.d.ts.map +1 -1
- package/out/map/useCompareState.js.map +1 -1
- package/out/map/useDemoGeocode.d.ts +12 -4
- package/out/map/useDemoGeocode.d.ts.map +1 -1
- package/out/map/useDemoGeocode.js.map +1 -1
- package/out/map/useMapPlaceRender.d.ts +3 -1
- package/out/map/useMapPlaceRender.d.ts.map +1 -1
- package/out/map/useMapPlaceRender.js +3 -1
- package/out/map/useMapPlaceRender.js.map +1 -1
- package/out/map/usePlaceAutocomplete.d.ts +45 -15
- package/out/map/usePlaceAutocomplete.d.ts.map +1 -1
- package/out/map/usePlaceAutocomplete.js +7 -3
- package/out/map/usePlaceAutocomplete.js.map +1 -1
- package/out/pipeline/ConfidenceCell.d.ts.map +1 -1
- package/out/pipeline/ConfidenceCell.js +9 -1
- package/out/pipeline/ConfidenceCell.js.map +1 -1
- package/out/pipeline/PipelineExplorer.d.ts +12 -4
- package/out/pipeline/PipelineExplorer.d.ts.map +1 -1
- package/out/pipeline/PipelineExplorer.js +6 -2
- package/out/pipeline/PipelineExplorer.js.map +1 -1
- package/out/pipeline/QueryForm.d.ts +6 -2
- package/out/pipeline/QueryForm.d.ts.map +1 -1
- package/out/pipeline/QueryForm.js +1 -1
- package/out/pipeline/QueryForm.js.map +1 -1
- package/out/pipeline/ResolvedPlace.js +1 -1
- package/out/pipeline/ResolvedPlace.js.map +1 -1
- package/out/pipeline/presets.d.ts +7 -0
- package/out/pipeline/presets.d.ts.map +1 -1
- package/out/pipeline/presets.js +7 -0
- package/out/pipeline/presets.js.map +1 -1
- package/out/pipeline/types.d.ts +60 -20
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/useParsePipeline.d.ts +12 -4
- package/out/pipeline/useParsePipeline.d.ts.map +1 -1
- package/out/pipeline/useParsePipeline.js +2 -2
- package/out/pipeline/useParsePipeline.js.map +1 -1
- package/out/poi/LiveResultsBlock.d.ts +6 -2
- 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/POIExplorer.d.ts +12 -4
- package/out/poi/POIExplorer.d.ts.map +1 -1
- package/out/poi/POIExplorer.js.map +1 -1
- package/out/poi/SubjectPanel.d.ts.map +1 -1
- package/out/poi/SubjectPanel.js +4 -2
- package/out/poi/SubjectPanel.js.map +1 -1
- package/out/poi/runtime.d.ts +9 -2
- package/out/poi/runtime.d.ts.map +1 -1
- package/out/poi/runtime.js +10 -3
- package/out/poi/runtime.js.map +1 -1
- package/out/poi/types.d.ts +40 -15
- package/out/poi/types.d.ts.map +1 -1
- package/out/poi/usePOISearch.d.ts +27 -9
- package/out/poi/usePOISearch.d.ts.map +1 -1
- package/out/poi/usePOISearch.js +5 -3
- package/out/poi/usePOISearch.js.map +1 -1
- package/out/runtime/useDemoRuntime.d.ts +81 -27
- package/out/runtime/useDemoRuntime.d.ts.map +1 -1
- package/out/runtime/useDemoRuntime.js.map +1 -1
- package/package.json +4 -4
- package/pipeline/ConfidenceCell.tsx +11 -1
- package/pipeline/PipelineExplorer.tsx +19 -6
- package/pipeline/QueryForm.tsx +7 -3
- package/pipeline/ResolvedPlace.tsx +2 -2
- package/pipeline/presets.ts +7 -0
- package/pipeline/types.ts +60 -20
- package/pipeline/useParsePipeline.ts +14 -6
- package/poi/LiveResultsBlock.tsx +7 -3
- package/poi/POIExplorer.tsx +14 -4
- package/poi/SubjectPanel.tsx +4 -2
- package/poi/runtime.ts +11 -3
- package/poi/types.ts +41 -15
- package/poi/usePOISearch.ts +34 -12
- package/runtime/useDemoRuntime.ts +82 -27
|
@@ -19,19 +19,31 @@
|
|
|
19
19
|
|
|
20
20
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
|
21
21
|
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* The minimal contract a release-manifest entry must satisfy. Hosts extend this with their own fields.
|
|
24
|
+
*/
|
|
23
25
|
export interface DemoReleaseBase {
|
|
24
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* The version tag this entry describes (matched against `selectedVersion`).
|
|
28
|
+
*/
|
|
25
29
|
version: string
|
|
26
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Optional display label a version picker shows; falls back to `version`.
|
|
32
|
+
*/
|
|
27
33
|
label?: string
|
|
28
34
|
}
|
|
29
35
|
|
|
30
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* The releases manifest the host fetches — the default version plus the selectable release entries.
|
|
38
|
+
*/
|
|
31
39
|
export interface DemoManifest<TRelease extends DemoReleaseBase = DemoReleaseBase> {
|
|
32
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* The version selected on first load (before the user picks another).
|
|
42
|
+
*/
|
|
33
43
|
defaultVersion: string
|
|
34
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Every selectable release.
|
|
46
|
+
*/
|
|
35
47
|
releases: TRelease[]
|
|
36
48
|
}
|
|
37
49
|
|
|
@@ -41,21 +53,35 @@ export interface DemoManifest<TRelease extends DemoReleaseBase = DemoReleaseBase
|
|
|
41
53
|
* the terminal state (revealing the assets + clearing progress on success, surfacing the error on failure).
|
|
42
54
|
*/
|
|
43
55
|
export interface DemoAssetsLoadContext {
|
|
44
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Aborts when this load is superseded (version/backend switch) or the provider unmounts.
|
|
58
|
+
*/
|
|
45
59
|
signal: AbortSignal
|
|
46
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Whether the host should force the CPU/WASM backend (opt out of WebGPU) for this load.
|
|
62
|
+
*/
|
|
47
63
|
forceWASM: boolean
|
|
48
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Set the human-readable progress line (e.g. `Loading v7 model (~28 MB)…`).
|
|
66
|
+
*/
|
|
49
67
|
setProgress: (progress: string) => void
|
|
50
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Set the staged-loader step labels (e.g. `["Loading classifier", "Loading FST gazetteer"]`).
|
|
70
|
+
*/
|
|
51
71
|
setStepLabels: (labels: string[]) => void
|
|
52
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Advance the staged-loader step index (0-based).
|
|
74
|
+
*/
|
|
53
75
|
setStepIndex: (index: number) => void
|
|
54
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* Report the backend the neural runtime resolved to (e.g. `webgpu (27 MB int8)`).
|
|
78
|
+
*/
|
|
55
79
|
setBackend: (backend: string) => void
|
|
56
80
|
}
|
|
57
81
|
|
|
58
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* The injected loaders the hook orchestrates. Nothing here is model- or map-aware — the host owns all that.
|
|
84
|
+
*/
|
|
59
85
|
export interface DemoRuntimeConfig<TAssets, TRelease extends DemoReleaseBase = DemoReleaseBase> {
|
|
60
86
|
/**
|
|
61
87
|
* Fetch + normalize the releases manifest. Returns `null` when no manifest is available (the demo then shows nothing
|
|
@@ -68,7 +94,9 @@ export interface DemoRuntimeConfig<TAssets, TRelease extends DemoReleaseBase = D
|
|
|
68
94
|
* `errorMessage`. Bail early when `ctx.signal.aborted` — the hook discards a superseded result regardless.
|
|
69
95
|
*/
|
|
70
96
|
loadAssets: (release: TRelease, ctx: DemoAssetsLoadContext) => Promise<TAssets>
|
|
71
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* The progress line shown before the manifest arrives. @default "Loading releases…"
|
|
99
|
+
*/
|
|
72
100
|
initialProgress?: string
|
|
73
101
|
}
|
|
74
102
|
|
|
@@ -82,31 +110,57 @@ export interface DemoRuntimeConfig<TAssets, TRelease extends DemoReleaseBase = D
|
|
|
82
110
|
* subpath's `DemoRuntime`.
|
|
83
111
|
*/
|
|
84
112
|
export interface DemoLoaderState<TAssets, TRelease extends DemoReleaseBase = DemoReleaseBase> {
|
|
85
|
-
/**
|
|
113
|
+
/**
|
|
114
|
+
* The releases manifest, once fetched.
|
|
115
|
+
*/
|
|
86
116
|
manifest: DemoManifest<TRelease> | null
|
|
87
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* The currently-selected version, or `null` before the manifest resolves.
|
|
119
|
+
*/
|
|
88
120
|
selectedVersion: string | null
|
|
89
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* The release entry matching `selectedVersion` (convenience over `manifest.releases.find`).
|
|
123
|
+
*/
|
|
90
124
|
selectedRelease: TRelease | null
|
|
91
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* The loaded asset bundle for the selected version, or `null` while (re)loading.
|
|
127
|
+
*/
|
|
92
128
|
assets: TAssets | null
|
|
93
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* Whether the asset bundle is loaded and ready to use.
|
|
131
|
+
*/
|
|
94
132
|
ready: boolean
|
|
95
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* Human-readable load progress (`""` when idle/ready).
|
|
135
|
+
*/
|
|
96
136
|
loadingProgress: string
|
|
97
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* Staged-loader step index (0-based; `-1` before the first step).
|
|
139
|
+
*/
|
|
98
140
|
loadingStepIndex: number
|
|
99
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* Staged-loader step labels.
|
|
143
|
+
*/
|
|
100
144
|
loadingStepLabels: string[]
|
|
101
|
-
/**
|
|
145
|
+
/**
|
|
146
|
+
* A load error (manifest or asset), distinct from any per-parse error a consumer tracks separately.
|
|
147
|
+
*/
|
|
102
148
|
errorMessage: string | null
|
|
103
|
-
/**
|
|
149
|
+
/**
|
|
150
|
+
* The backend the neural runtime resolved to (e.g. `webgpu (27 MB int8)`), or `""` before it's known.
|
|
151
|
+
*/
|
|
104
152
|
activeBackend: string
|
|
105
|
-
/**
|
|
153
|
+
/**
|
|
154
|
+
* Whether the CPU/WASM backend is currently forced.
|
|
155
|
+
*/
|
|
106
156
|
forceWASM: boolean
|
|
107
|
-
/**
|
|
157
|
+
/**
|
|
158
|
+
* Switch to a different version (clears any error, then reloads the asset bundle).
|
|
159
|
+
*/
|
|
108
160
|
selectVersion: (version: string) => void
|
|
109
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* Force (or unforce) the CPU/WASM backend — reloads the asset bundle.
|
|
163
|
+
*/
|
|
110
164
|
setForceWASM: (forceWASM: boolean) => void
|
|
111
165
|
}
|
|
112
166
|
|
|
@@ -178,6 +232,7 @@ export function useDemoRuntime<TAssets, TRelease extends DemoReleaseBase = DemoR
|
|
|
178
232
|
|
|
179
233
|
const controller = new AbortController()
|
|
180
234
|
const { signal } = controller
|
|
235
|
+
|
|
181
236
|
const guard = (fn: () => void) => {
|
|
182
237
|
if (!signal.aborted) {
|
|
183
238
|
fn()
|