@mailwoman/react 7.4.0 → 7.6.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.
Files changed (156) hide show
  1. package/common/PresetChips.tsx +4 -1
  2. package/index.ts +31 -0
  3. package/map/BackendControl.tsx +39 -0
  4. package/map/CompareToggle.tsx +81 -0
  5. package/map/DemoControls.tsx +173 -0
  6. package/map/DemoMap.tsx +98 -0
  7. package/map/GeocoderDemo.tsx +178 -0
  8. package/map/OverlayLayers.tsx +46 -0
  9. package/map/PlaceAutocomplete.tsx +69 -0
  10. package/map/PlaceMarker.tsx +40 -0
  11. package/map/ResolvedPlaceLayers.tsx +63 -0
  12. package/map/ResultCamera.tsx +60 -0
  13. package/map/ResultOverlay.tsx +61 -0
  14. package/map/ResultPanel.tsx +84 -0
  15. package/map/VersionPicker.tsx +62 -0
  16. package/map/geometry.ts +135 -0
  17. package/map/index.ts +73 -0
  18. package/map/place-render.ts +157 -0
  19. package/map/types.ts +207 -0
  20. package/map/useCompareState.ts +45 -0
  21. package/map/useDemoGeocode.ts +67 -0
  22. package/map/useMapPlaceRender.ts +21 -0
  23. package/map/usePlaceAutocomplete.ts +195 -0
  24. package/out/common/PresetChips.d.ts +3 -1
  25. package/out/common/PresetChips.d.ts.map +1 -1
  26. package/out/common/PresetChips.js +2 -2
  27. package/out/common/PresetChips.js.map +1 -1
  28. package/out/index.d.ts +4 -1
  29. package/out/index.d.ts.map +1 -1
  30. package/out/index.js +2 -0
  31. package/out/index.js.map +1 -1
  32. package/out/map/BackendControl.d.ts +24 -0
  33. package/out/map/BackendControl.d.ts.map +1 -0
  34. package/out/map/BackendControl.js +6 -0
  35. package/out/map/BackendControl.js.map +1 -0
  36. package/out/map/CompareToggle.d.ts +35 -0
  37. package/out/map/CompareToggle.d.ts.map +1 -0
  38. package/out/map/CompareToggle.js +9 -0
  39. package/out/map/CompareToggle.js.map +1 -0
  40. package/out/map/DemoControls.d.ts +44 -0
  41. package/out/map/DemoControls.d.ts.map +1 -0
  42. package/out/map/DemoControls.js +28 -0
  43. package/out/map/DemoControls.js.map +1 -0
  44. package/out/map/DemoMap.d.ts +59 -0
  45. package/out/map/DemoMap.d.ts.map +1 -0
  46. package/out/map/DemoMap.js +12 -0
  47. package/out/map/DemoMap.js.map +1 -0
  48. package/out/map/GeocoderDemo.d.ts +47 -0
  49. package/out/map/GeocoderDemo.d.ts.map +1 -0
  50. package/out/map/GeocoderDemo.js +73 -0
  51. package/out/map/GeocoderDemo.js.map +1 -0
  52. package/out/map/OverlayLayers.d.ts +23 -0
  53. package/out/map/OverlayLayers.d.ts.map +1 -0
  54. package/out/map/OverlayLayers.js +27 -0
  55. package/out/map/OverlayLayers.js.map +1 -0
  56. package/out/map/PlaceAutocomplete.d.ts +34 -0
  57. package/out/map/PlaceAutocomplete.d.ts.map +1 -0
  58. package/out/map/PlaceAutocomplete.js +9 -0
  59. package/out/map/PlaceAutocomplete.js.map +1 -0
  60. package/out/map/PlaceMarker.d.ts +27 -0
  61. package/out/map/PlaceMarker.d.ts.map +1 -0
  62. package/out/map/PlaceMarker.js +9 -0
  63. package/out/map/PlaceMarker.js.map +1 -0
  64. package/out/map/ResolvedPlaceLayers.d.ts +34 -0
  65. package/out/map/ResolvedPlaceLayers.d.ts.map +1 -0
  66. package/out/map/ResolvedPlaceLayers.js +11 -0
  67. package/out/map/ResolvedPlaceLayers.js.map +1 -0
  68. package/out/map/ResultCamera.d.ts +34 -0
  69. package/out/map/ResultCamera.d.ts.map +1 -0
  70. package/out/map/ResultCamera.js +43 -0
  71. package/out/map/ResultCamera.js.map +1 -0
  72. package/out/map/ResultOverlay.d.ts +34 -0
  73. package/out/map/ResultOverlay.d.ts.map +1 -0
  74. package/out/map/ResultOverlay.js +18 -0
  75. package/out/map/ResultOverlay.js.map +1 -0
  76. package/out/map/ResultPanel.d.ts +34 -0
  77. package/out/map/ResultPanel.d.ts.map +1 -0
  78. package/out/map/ResultPanel.js +12 -0
  79. package/out/map/ResultPanel.js.map +1 -0
  80. package/out/map/VersionPicker.d.ts +30 -0
  81. package/out/map/VersionPicker.d.ts.map +1 -0
  82. package/out/map/VersionPicker.js +8 -0
  83. package/out/map/VersionPicker.js.map +1 -0
  84. package/out/map/geometry.d.ts +55 -0
  85. package/out/map/geometry.d.ts.map +1 -0
  86. package/out/map/geometry.js +99 -0
  87. package/out/map/geometry.js.map +1 -0
  88. package/out/map/index.d.ts +52 -0
  89. package/out/map/index.d.ts.map +1 -0
  90. package/out/map/index.js +36 -0
  91. package/out/map/index.js.map +1 -0
  92. package/out/map/place-render.d.ts +85 -0
  93. package/out/map/place-render.d.ts.map +1 -0
  94. package/out/map/place-render.js +98 -0
  95. package/out/map/place-render.js.map +1 -0
  96. package/out/map/types.d.ts +193 -0
  97. package/out/map/types.d.ts.map +1 -0
  98. package/out/map/types.js +18 -0
  99. package/out/map/types.js.map +1 -0
  100. package/out/map/useCompareState.d.ts +25 -0
  101. package/out/map/useCompareState.d.ts.map +1 -0
  102. package/out/map/useCompareState.js +27 -0
  103. package/out/map/useCompareState.js.map +1 -0
  104. package/out/map/useDemoGeocode.d.ts +36 -0
  105. package/out/map/useDemoGeocode.d.ts.map +1 -0
  106. package/out/map/useDemoGeocode.js +44 -0
  107. package/out/map/useDemoGeocode.js.map +1 -0
  108. package/out/map/useMapPlaceRender.d.ts +15 -0
  109. package/out/map/useMapPlaceRender.d.ts.map +1 -0
  110. package/out/map/useMapPlaceRender.js +18 -0
  111. package/out/map/useMapPlaceRender.js.map +1 -0
  112. package/out/map/usePlaceAutocomplete.d.ts +61 -0
  113. package/out/map/usePlaceAutocomplete.d.ts.map +1 -0
  114. package/out/map/usePlaceAutocomplete.js +122 -0
  115. package/out/map/usePlaceAutocomplete.js.map +1 -0
  116. package/out/pipeline/QueryForm.d.ts +6 -2
  117. package/out/pipeline/QueryForm.d.ts.map +1 -1
  118. package/out/pipeline/QueryForm.js +2 -2
  119. package/out/pipeline/QueryForm.js.map +1 -1
  120. package/out/poi/LiveResultsBlock.d.ts +3 -3
  121. package/out/poi/LiveResultsBlock.d.ts.map +1 -1
  122. package/out/poi/LiveResultsBlock.js +2 -2
  123. package/out/poi/LiveResultsBlock.js.map +1 -1
  124. package/out/poi/POIExplorer.d.ts +7 -1
  125. package/out/poi/POIExplorer.d.ts.map +1 -1
  126. package/out/poi/POIExplorer.js +17 -5
  127. package/out/poi/POIExplorer.js.map +1 -1
  128. package/out/poi/SubjectPanel.d.ts +3 -2
  129. package/out/poi/SubjectPanel.d.ts.map +1 -1
  130. package/out/poi/SubjectPanel.js +8 -1
  131. package/out/poi/SubjectPanel.js.map +1 -1
  132. package/out/poi/runtime.d.ts +13 -4
  133. package/out/poi/runtime.d.ts.map +1 -1
  134. package/out/poi/runtime.js +36 -12
  135. package/out/poi/runtime.js.map +1 -1
  136. package/out/poi/types.d.ts +31 -4
  137. package/out/poi/types.d.ts.map +1 -1
  138. package/out/poi/usePOISearch.d.ts +8 -1
  139. package/out/poi/usePOISearch.d.ts.map +1 -1
  140. package/out/poi/usePOISearch.js +47 -12
  141. package/out/poi/usePOISearch.js.map +1 -1
  142. package/out/runtime/useDemoRuntime.d.ts +113 -0
  143. package/out/runtime/useDemoRuntime.d.ts.map +1 -0
  144. package/out/runtime/useDemoRuntime.js +135 -0
  145. package/out/runtime/useDemoRuntime.js.map +1 -0
  146. package/package.json +31 -10
  147. package/pipeline/QueryForm.tsx +17 -2
  148. package/poi/LiveResultsBlock.tsx +4 -4
  149. package/poi/POIExplorer.tsx +39 -8
  150. package/poi/SubjectPanel.tsx +47 -12
  151. package/poi/runtime.ts +35 -10
  152. package/poi/types.ts +34 -4
  153. package/poi/usePOISearch.ts +62 -11
  154. package/runtime/useDemoRuntime.ts +245 -0
  155. package/styles.css +166 -0
  156. package/vitest.node.config.ts +20 -0
@@ -0,0 +1,195 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `usePlaceAutocomplete` — the headless "Did you mean" combobox lifted from the demo god component
7
+ * (`_app.tsx:820-900`). It walks the host-supplied `autocomplete` over the locality segment the visitor
8
+ * is typing (the text after the last comma), owns the suggestion list + keyboard-highlighted active
9
+ * descendant, and rewrites the input on pick (replacing just that segment). No FST, no fetch of its own
10
+ * — the `autocomplete` fetcher is INJECTED (the package never imports `@mailwoman/resolver-wof-sqlite`),
11
+ * so this stays node-safe and testable with a synchronous fake.
12
+ *
13
+ * Returns the `<input>` aria/combobox props to spread onto the reused {@link QueryForm} input plus an
14
+ * `onInputKeyDown` (↑/↓ move the highlight, Enter accepts it AND suppresses submit, Esc dismisses), and
15
+ * the presentational {@link PlaceAutocomplete} listbox renders `suggestions` / `activeIndex`.
16
+ */
17
+
18
+ import { type KeyboardEvent, useCallback, useEffect, useRef, useState } from "react"
19
+
20
+ import { useDebouncedValue } from "../common/useDebouncedValue.ts"
21
+ import type { Suggestion } from "./types.ts"
22
+
23
+ export interface UsePlaceAutocompleteOptions {
24
+ /** The current input text. */
25
+ text: string
26
+ /** Setter for the input text (a pick rewrites the last-comma segment). */
27
+ setText: (text: string) => void
28
+ /** The host's autocomplete fetcher (FST prefix-walk). Absent → the combobox is inert. */
29
+ autocomplete?: (query: string) => Promise<Suggestion[]>
30
+ /** Minimum query length before suggesting. @default 2 */
31
+ minChars?: number
32
+ /** Debounce before firing the fetcher. @default 150 */
33
+ debounceMs?: number
34
+ }
35
+
36
+ /** The combobox aria props to spread onto the input the suggestions describe. */
37
+ export interface AutocompleteInputProps {
38
+ role: "combobox"
39
+ "aria-expanded": boolean
40
+ "aria-controls": string
41
+ "aria-autocomplete": "list"
42
+ "aria-activedescendant": string | undefined
43
+ autoComplete: "off"
44
+ }
45
+
46
+ export interface UsePlaceAutocomplete {
47
+ /** The current suggestions (empty when nothing matches — the listbox then hides). */
48
+ suggestions: Suggestion[]
49
+ /** The keyboard-highlighted suggestion index; `-1` when none is highlighted. */
50
+ activeIndex: number
51
+ /** Set the highlighted index (the listbox calls this on mouse-enter). */
52
+ setActiveIndex: (index: number) => void
53
+ /** Keydown handler for the input: ↑/↓ highlight, Enter accepts (+ suppresses submit), Esc dismisses. */
54
+ onInputKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void
55
+ /** Accept a suggestion by value (rewrites the last-comma segment, closes the list). */
56
+ pick: (value: string) => void
57
+ /** Close the list without picking. */
58
+ dismiss: () => void
59
+ /** Aria/combobox props for the input the suggestions describe. */
60
+ inputProps: AutocompleteInputProps
61
+ /** The listbox element id (matches `inputProps["aria-controls"]`). */
62
+ listboxId: string
63
+ /** Build the option element id for suggestion `index`. */
64
+ optionId: (index: number) => string
65
+ }
66
+
67
+ const LISTBOX_ID = "mw-demo-suggest-list"
68
+ const optionId = (index: number) => `mw-demo-suggest-${index}`
69
+
70
+ /** Extract the locality segment being typed — the text after the last comma, trimmed. */
71
+ function localitySegment(text: string): string {
72
+ return (text.includes(",") ? text.slice(text.lastIndexOf(",") + 1) : text).trim()
73
+ }
74
+
75
+ /** Replace the locality segment (after the last comma) with `name`, preserving the address prefix. */
76
+ function replaceSegment(current: string, name: string): string {
77
+ return current.includes(",") ? `${current.slice(0, current.lastIndexOf(",") + 1)} ${name}` : name
78
+ }
79
+
80
+ export function usePlaceAutocomplete({
81
+ text,
82
+ setText,
83
+ autocomplete,
84
+ minChars = 2,
85
+ debounceMs = 150,
86
+ }: UsePlaceAutocompleteOptions): UsePlaceAutocomplete {
87
+ const [suggestions, setSuggestions] = useState<Suggestion[]>([])
88
+ const [activeIndex, setActiveIndex] = useState(-1)
89
+ // One-shot guard: a pick rewrites `text` to the chosen name, which would otherwise re-trigger the fetch and
90
+ // immediately re-suggest the place just chosen. Set on pick, consumed by the next effect run.
91
+ const suppressRef = useRef(false)
92
+
93
+ const query = localitySegment(text)
94
+ const debouncedQuery = useDebouncedValue(query, debounceMs)
95
+
96
+ useEffect(() => {
97
+ if (suppressRef.current) {
98
+ suppressRef.current = false
99
+ setSuggestions([])
100
+ setActiveIndex(-1)
101
+
102
+ return
103
+ }
104
+
105
+ if (!autocomplete || debouncedQuery.length < minChars || /^\d/.test(debouncedQuery)) {
106
+ setSuggestions([])
107
+ setActiveIndex(-1)
108
+
109
+ return
110
+ }
111
+
112
+ let cancelled = false
113
+
114
+ void (async () => {
115
+ try {
116
+ const next = await autocomplete(debouncedQuery)
117
+
118
+ if (cancelled) return
119
+ setSuggestions(next)
120
+ setActiveIndex(-1)
121
+ } catch {
122
+ if (cancelled) return
123
+ setSuggestions([])
124
+ setActiveIndex(-1)
125
+ }
126
+ })()
127
+
128
+ return () => {
129
+ cancelled = true
130
+ }
131
+ }, [debouncedQuery, autocomplete, minChars])
132
+
133
+ const pick = useCallback(
134
+ (value: string) => {
135
+ suppressRef.current = true
136
+ setText(replaceSegment(text, value))
137
+ setSuggestions([])
138
+ setActiveIndex(-1)
139
+ },
140
+ [text, setText]
141
+ )
142
+
143
+ const dismiss = useCallback(() => {
144
+ setSuggestions([])
145
+ setActiveIndex(-1)
146
+ }, [])
147
+
148
+ const onInputKeyDown = useCallback(
149
+ (event: KeyboardEvent<HTMLInputElement>) => {
150
+ if (suggestions.length === 0) return
151
+
152
+ switch (event.key) {
153
+ case "ArrowDown":
154
+ event.preventDefault()
155
+ setActiveIndex((i) => Math.min(i + 1, suggestions.length - 1))
156
+ break
157
+ case "ArrowUp":
158
+ event.preventDefault()
159
+ setActiveIndex((i) => Math.max(i - 1, 0))
160
+ break
161
+ case "Enter":
162
+ if (activeIndex >= 0 && activeIndex < suggestions.length) {
163
+ event.preventDefault()
164
+ pick(suggestions[activeIndex]!.value)
165
+ }
166
+
167
+ break
168
+ case "Escape":
169
+ event.preventDefault()
170
+ dismiss()
171
+ break
172
+ }
173
+ },
174
+ [suggestions, activeIndex, pick, dismiss]
175
+ )
176
+
177
+ return {
178
+ suggestions,
179
+ activeIndex,
180
+ setActiveIndex,
181
+ onInputKeyDown,
182
+ pick,
183
+ dismiss,
184
+ inputProps: {
185
+ role: "combobox",
186
+ "aria-expanded": suggestions.length > 0,
187
+ "aria-controls": LISTBOX_ID,
188
+ "aria-autocomplete": "list",
189
+ "aria-activedescendant": activeIndex >= 0 ? optionId(activeIndex) : undefined,
190
+ autoComplete: "off",
191
+ },
192
+ listboxId: LISTBOX_ID,
193
+ optionId,
194
+ }
195
+ }
@@ -17,6 +17,8 @@ export interface PresetChipsProps {
17
17
  disabled?: boolean;
18
18
  /** Leading label. @default "Try:" */
19
19
  caption?: string;
20
+ /** Optional trailing content rendered inside the chip row after the presets (e.g. an inline permalink button). */
21
+ trailing?: ReactNode;
20
22
  }
21
- export declare function PresetChips({ presets, onPick, disabled, caption }: PresetChipsProps): ReactNode;
23
+ export declare function PresetChips({ presets, onPick, disabled, caption, trailing }: PresetChipsProps): ReactNode;
22
24
  //# sourceMappingURL=PresetChips.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PresetChips.d.ts","sourceRoot":"","sources":["../../common/PresetChips.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,MAAM;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAgB,EAAE,EAAE,gBAAgB,GAAG,SAAS,CAkBxG"}
1
+ {"version":3,"file":"PresetChips.d.ts","sourceRoot":"","sources":["../../common/PresetChips.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,MAAM;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kHAAkH;IAClH,QAAQ,CAAC,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAgB,EAAE,QAAQ,EAAE,EAAE,gBAAgB,GAAG,SAAS,CAmBlH"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export function PresetChips({ presets, onPick, disabled, caption = "Try:" }) {
3
- return (_jsxs("div", { className: "mw-presets", children: [_jsx("span", { className: "mw-presets__label", children: caption }), presets.map((preset) => (_jsx("button", { type: "button", className: "mw-chip", disabled: disabled, onClick: () => onPick(preset.value), title: preset.value, children: preset.label }, preset.label)))] }));
2
+ export function PresetChips({ presets, onPick, disabled, caption = "Try:", trailing }) {
3
+ return (_jsxs("div", { className: "mw-presets", children: [_jsx("span", { className: "mw-presets__label", children: caption }), presets.map((preset) => (_jsx("button", { type: "button", className: "mw-chip", disabled: disabled, onClick: () => onPick(preset.value), title: preset.value, children: preset.label }, preset.label))), trailing] }));
4
4
  }
5
5
  //# sourceMappingURL=PresetChips.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PresetChips.js","sourceRoot":"","sources":["../../common/PresetChips.tsx"],"names":[],"mappings":";AAwBA,MAAM,UAAU,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAoB;IAC5F,OAAO,CACN,eAAK,SAAS,EAAC,YAAY,aAC1B,eAAM,SAAS,EAAC,mBAAmB,YAAE,OAAO,GAAQ,EACnD,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACxB,iBAEC,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,SAAS,EACnB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EACnC,KAAK,EAAE,MAAM,CAAC,KAAK,YAElB,MAAM,CAAC,KAAK,IAPR,MAAM,CAAC,KAAK,CAQT,CACT,CAAC,IACG,CACN,CAAA;AACF,CAAC"}
1
+ {"version":3,"file":"PresetChips.js","sourceRoot":"","sources":["../../common/PresetChips.tsx"],"names":[],"mappings":";AA0BA,MAAM,UAAU,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAE,QAAQ,EAAoB;IACtG,OAAO,CACN,eAAK,SAAS,EAAC,YAAY,aAC1B,eAAM,SAAS,EAAC,mBAAmB,YAAE,OAAO,GAAQ,EACnD,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACxB,iBAEC,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,SAAS,EACnB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EACnC,KAAK,EAAE,MAAM,CAAC,KAAK,YAElB,MAAM,CAAC,KAAK,IAPR,MAAM,CAAC,KAAK,CAQT,CACT,CAAC,EACD,QAAQ,IACJ,CACN,CAAA;AACF,CAAC"}
package/out/index.d.ts CHANGED
@@ -43,7 +43,7 @@ export type { QueryInputProps } from "./poi/QueryInput.tsx";
43
43
  export { formatDistance, loadPOIRuntime, POI_DEFAULT_TEXT, POI_PRESETS } from "./poi/runtime.ts";
44
44
  export { SubjectPanel } from "./poi/SubjectPanel.tsx";
45
45
  export type { SubjectPanelProps } from "./poi/SubjectPanel.tsx";
46
- export type { CategoryRecord, LiveSearchState, LoadPOIRuntime, POIExplorerResult, POILiveSearch, POILiveSearchResult, POIRuntime, POISearchHit, POISubject, TaxonomyLookup, } from "./poi/types.ts";
46
+ export type { CategoryRecord, LiveSearchState, LoadPOIRuntime, POIBrandSubject, POICategorySubject, POIExplorerResult, POILiveSearch, POILiveSearchResult, POIRuntime, POISearchHit, POISubject, POISubjectBase, TaxonomyLookup, } from "./poi/types.ts";
47
47
  export { usePOISearch } from "./poi/usePOISearch.ts";
48
48
  export type { UsePOISearch, UsePOISearchOptions } from "./poi/usePOISearch.ts";
49
49
  export { CandidatePicker } from "./pipeline/CandidatePicker.tsx";
@@ -63,4 +63,7 @@ export type { ResolvedPlaceProps } from "./pipeline/ResolvedPlace.tsx";
63
63
  export type { DualRoleView, FSTProvenance, ParsedComponent, ParseResult, PipelineLoadingState, PipelinePanels, PipelineRuntime, ResolvedPlaceView, StageTiming, } from "./pipeline/types.ts";
64
64
  export { useParsePipeline } from "./pipeline/useParsePipeline.ts";
65
65
  export type { UseParsePipeline, UseParsePipelineOptions } from "./pipeline/useParsePipeline.ts";
66
+ export { useDemoRuntime } from "./runtime/useDemoRuntime.ts";
67
+ export type { DemoAssetsLoadContext, DemoLoaderState, DemoManifest, DemoReleaseBase, DemoRuntimeConfig, } from "./runtime/useDemoRuntime.ts";
68
+ export type { DemoBackend, DemoMapExtraProps, DemoMapProps, DemoMapStyle, DemoRuntime, DemoVersionOption, LngLatTuple, MapBias, OverlaySpec, Suggestion, } from "./map/index.ts";
66
69
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,YAAY,EAAE,eAAe,EA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YAAY,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,YAAY,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACtE,YAAY,EACX,YAAY,EACZ,aAAa,EACb,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,WAAW,GACX,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AAG/F,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,YAAY,EACX,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,iBAAiB,GACjB,MAAM,6BAA6B,CAAA;AAOpC,YAAY,EACX,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,WAAW,EACX,UAAU,GACV,MAAM,gBAAgB,CAAA"}
package/out/index.js CHANGED
@@ -43,4 +43,6 @@ export { PipelineExplorer } from "./pipeline/PipelineExplorer.js";
43
43
  export { QueryForm } from "./pipeline/QueryForm.js";
44
44
  export { ResolvedPlace } from "./pipeline/ResolvedPlace.js";
45
45
  export { useParsePipeline } from "./pipeline/useParsePipeline.js";
46
+ // ── Demo runtime (shared load orchestration; node-safe — no onnx/httpvfs/maplibre) ──
47
+ export { useDemoRuntime } from "./runtime/useDemoRuntime.js";
46
48
  //# sourceMappingURL=index.js.map
package/out/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,8EAA8E;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAyB,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAyB,CAAA;AAEpD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAwB,CAAA;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA+B,CAAA;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAA0B,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAEjE,8EAA8E;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAwB,CAAA;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA4B,CAAA;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAyB,CAAA;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAuB,CAAA;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAsB,CAAA;AAEjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAwB,CAAA;AAcrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAGpD,8EAA8E;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,+BAAgC,CAAA;AA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AAEjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAwB,CAAA;AAiBrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAGpD,8EAA8E;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,+BAAgC,CAAA;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA+B,CAAA;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA+B,CAAA;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAiC,CAAA;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAA0B,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA8B,CAAA;AAa5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAGjE,uFAAuF;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `<BackendControl>` — the neural-backend indicator + "Force WASM" checkbox from the demo's control
7
+ * panel (`_app.tsx:1255-1280`), as a dumb presentational unit. It shows which backend the runtime
8
+ * resolved to (WebGPU / WASM, with the int8 size the host formats into the label) and lets the visitor
9
+ * opt out of WebGPU. Props in, one boolean event out — the host re-loads the bundle on the toggle.
10
+ *
11
+ * NODE-SAFE: pure React, no maplibre.
12
+ */
13
+ import type { ReactNode } from "react";
14
+ export interface BackendControlProps {
15
+ /** The backend the runtime resolved to (e.g. `webgpu (28 MB int8)`); empty before it is known. */
16
+ activeBackend?: string;
17
+ /** Whether the CPU/WASM backend is currently forced. */
18
+ forceWASM: boolean;
19
+ /** Fired when the visitor toggles the "Force WASM" checkbox. */
20
+ onForceWASMChange: (forceWASM: boolean) => void;
21
+ }
22
+ /** The backend indicator + WASM opt-out. */
23
+ export declare function BackendControl({ activeBackend, forceWASM, onForceWASMChange }: BackendControlProps): ReactNode;
24
+ //# sourceMappingURL=BackendControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BackendControl.d.ts","sourceRoot":"","sources":["../../map/BackendControl.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,mBAAmB;IACnC,kGAAkG;IAClG,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,wDAAwD;IACxD,SAAS,EAAE,OAAO,CAAA;IAClB,gEAAgE;IAChE,iBAAiB,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;CAC/C;AAED,4CAA4C;AAC5C,wBAAgB,cAAc,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,mBAAmB,GAAG,SAAS,CAa9G"}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /** The backend indicator + WASM opt-out. */
3
+ export function BackendControl({ activeBackend, forceWASM, onForceWASMChange }) {
4
+ return (_jsxs("div", { className: "mw-demo-backend", children: [activeBackend ? (_jsxs("span", { className: "mw-demo-backend__active", children: ["Backend: ", _jsx("code", { children: activeBackend })] })) : null, _jsxs("label", { className: "mw-demo-backend__toggle", children: [_jsx("input", { type: "checkbox", checked: forceWASM, onChange: (e) => onForceWASMChange(e.target.checked) }), " Force WASM"] })] }));
5
+ }
6
+ //# sourceMappingURL=BackendControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BackendControl.js","sourceRoot":"","sources":["../../map/BackendControl.tsx"],"names":[],"mappings":";AAwBA,4CAA4C;AAC5C,MAAM,UAAU,cAAc,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,iBAAiB,EAAuB;IAClG,OAAO,CACN,eAAK,SAAS,EAAC,iBAAiB,aAC9B,aAAa,CAAC,CAAC,CAAC,CAChB,gBAAM,SAAS,EAAC,yBAAyB,0BAC/B,yBAAO,aAAa,GAAQ,IAC/B,CACP,CAAC,CAAC,CAAC,IAAI,EACR,iBAAO,SAAS,EAAC,yBAAyB,aACzC,gBAAO,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAI,mBAC5F,IACH,CACN,CAAA;AACF,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `<CompareToggle>` — the "Compare" checkbox plus the compare-version `<select>` from the demo's
7
+ * control panel (`_app.tsx:1281-1339`), as a dumb presentational unit. Turning it on reveals a second
8
+ * version picker (the primary version filtered out); the actual second parse is a host concern the
9
+ * composed demo surfaces through `panels.compare`. Props in, two events out.
10
+ *
11
+ * NODE-SAFE: pure React, no maplibre.
12
+ */
13
+ import type { ReactNode } from "react";
14
+ import type { DemoVersionOption } from "./types.ts";
15
+ export interface CompareToggleProps {
16
+ /** The selectable model bundles (the primary version is filtered out of the compare list). */
17
+ versions: ReadonlyArray<DemoVersionOption>;
18
+ /** The primary version, excluded from the compare options. */
19
+ primaryVersion: string | null;
20
+ /** Whether compare mode is on. */
21
+ compareMode: boolean;
22
+ /** Fired when the visitor flips compare mode. */
23
+ onCompareModeChange: (compareMode: boolean) => void;
24
+ /** The version chosen to compare against, or `null` when none is chosen. */
25
+ compareVersion: string | null;
26
+ /** Fired with the chosen compare version (or `null` when the empty option is picked). */
27
+ onCompareVersionChange: (version: string | null) => void;
28
+ /** Disable the compare-version select (e.g. while a parse or compare load runs). */
29
+ disabled?: boolean;
30
+ /** A status line rendered under the select (e.g. the compare backend, or a "Loading…" line). */
31
+ status?: ReactNode;
32
+ }
33
+ /** The compare toggle + (when on) the compare-version selector. Renders `null` with fewer than two versions. */
34
+ export declare function CompareToggle({ versions, primaryVersion, compareMode, onCompareModeChange, compareVersion, onCompareVersionChange, disabled, status, }: CompareToggleProps): ReactNode;
35
+ //# sourceMappingURL=CompareToggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompareToggle.d.ts","sourceRoot":"","sources":["../../map/CompareToggle.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD,MAAM,WAAW,kBAAkB;IAClC,8FAA8F;IAC9F,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAA;IAC1C,8DAA8D;IAC9D,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,kCAAkC;IAClC,WAAW,EAAE,OAAO,CAAA;IACpB,iDAAiD;IACjD,mBAAmB,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAA;IACnD,4EAA4E;IAC5E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,yFAAyF;IACzF,sBAAsB,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACxD,oFAAoF;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gGAAgG;IAChG,MAAM,CAAC,EAAE,SAAS,CAAA;CAClB;AAED,gHAAgH;AAChH,wBAAgB,aAAa,CAAC,EAC7B,QAAQ,EACR,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACR,MAAM,GACN,EAAE,kBAAkB,GAAG,SAAS,CAkChC"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /** The compare toggle + (when on) the compare-version selector. Renders `null` with fewer than two versions. */
3
+ export function CompareToggle({ versions, primaryVersion, compareMode, onCompareModeChange, compareVersion, onCompareVersionChange, disabled, status, }) {
4
+ if (versions.length < 2)
5
+ return null;
6
+ const options = versions.filter((v) => v.version !== primaryVersion);
7
+ return (_jsxs("div", { className: "mw-demo-compare", children: [_jsxs("label", { className: "mw-demo-compare__toggle", children: [_jsx("input", { type: "checkbox", checked: compareMode, onChange: (e) => onCompareModeChange(e.target.checked) }), " Compare"] }), compareMode ? (_jsxs("div", { className: "mw-demo-control", children: [_jsx("label", { className: "mw-demo-control__label", htmlFor: "mw-demo-compare-version", children: "Compare with" }), _jsxs("select", { id: "mw-demo-compare-version", className: "mw-demo-control__select", value: compareVersion ?? "", onChange: (e) => onCompareVersionChange(e.target.value || null), disabled: disabled, children: [_jsx("option", { value: "", children: "Select version\u2026" }), options.map((v) => (_jsx("option", { value: v.version, children: v.label ?? v.version }, v.version)))] }), status ? _jsx("p", { className: "mw-demo-compare__status", children: status }) : null] })) : null] }));
8
+ }
9
+ //# sourceMappingURL=CompareToggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompareToggle.js","sourceRoot":"","sources":["../../map/CompareToggle.tsx"],"names":[],"mappings":";AAoCA,gHAAgH;AAChH,MAAM,UAAU,aAAa,CAAC,EAC7B,QAAQ,EACR,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACR,MAAM,GACc;IACpB,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IAEpC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,cAAc,CAAC,CAAA;IAEpE,OAAO,CACN,eAAK,SAAS,EAAC,iBAAiB,aAC/B,iBAAO,SAAS,EAAC,yBAAyB,aACzC,gBAAO,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAI,gBAChG,EACP,WAAW,CAAC,CAAC,CAAC,CACd,eAAK,SAAS,EAAC,iBAAiB,aAC/B,gBAAO,SAAS,EAAC,wBAAwB,EAAC,OAAO,EAAC,yBAAyB,6BAEnE,EACR,kBACC,EAAE,EAAC,yBAAyB,EAC5B,SAAS,EAAC,yBAAyB,EACnC,KAAK,EAAE,cAAc,IAAI,EAAE,EAC3B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,EAC/D,QAAQ,EAAE,QAAQ,aAElB,iBAAQ,KAAK,EAAC,EAAE,qCAAyB,EACxC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACnB,iBAAwB,KAAK,EAAE,CAAC,CAAC,OAAO,YACtC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,IADT,CAAC,CAAC,OAAO,CAEb,CACT,CAAC,IACM,EACR,MAAM,CAAC,CAAC,CAAC,YAAG,SAAS,EAAC,yBAAyB,YAAE,MAAM,GAAK,CAAC,CAAC,CAAC,IAAI,IAC/D,CACN,CAAC,CAAC,CAAC,IAAI,IACH,CACN,CAAA;AACF,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `<DemoControls>` — the geocoder demo's floating control panel, assembled from the demo-specific units
7
+ * (VersionPicker / CompareToggle / BackendControl / PlaceAutocomplete / ResultPanel) and the REUSED
8
+ * pipeline units (QueryForm / PresetChips / LoadingIndicator). It is the presentational composition the
9
+ * `_app.tsx` control `<section>` (`:1222-1514`) becomes — it reads the injected {@link DemoRuntime} for
10
+ * ready/version/backend/loading state and threads the {@link useDemoGeocode} + {@link usePlaceAutocomplete}
11
+ * + {@link useCompareState} hooks into the controls. Host-specific visualizers arrive via {@link DemoPanels}.
12
+ *
13
+ * NODE-SAFE: pure React + the shared/demo units, no maplibre. It rides `@mailwoman/react/map` as a
14
+ * demo-specific control, not for WebGL.
15
+ */
16
+ import type { ReactNode } from "react";
17
+ import { type Preset } from "../common/PresetChips.tsx";
18
+ import type { DemoPanels, DemoRuntime } from "./types.ts";
19
+ import type { UseCompareState } from "./useCompareState.ts";
20
+ import type { UseDemoGeocode } from "./useDemoGeocode.ts";
21
+ import type { UsePlaceAutocomplete } from "./usePlaceAutocomplete.ts";
22
+ export interface DemoControlsProps {
23
+ /** The injected demo runtime. */
24
+ runtime: DemoRuntime;
25
+ /** The parse+resolve state machine. */
26
+ geocode: UseDemoGeocode;
27
+ /** The place-autocomplete combobox state. */
28
+ autocomplete: UsePlaceAutocomplete;
29
+ /** The compare-mode state. */
30
+ compare: UseCompareState;
31
+ /** Host-injected panels (about, release blurb, compare, permalink, extras, failure). */
32
+ panels: DemoPanels;
33
+ /** Example chips. */
34
+ presets: ReadonlyArray<Preset>;
35
+ /** Input placeholder. */
36
+ placeholder: string;
37
+ /** Select a model version (the composed demo also clears a now-colliding compare selection). */
38
+ onSelectVersion: (version: string) => void;
39
+ /** Toggle the forced WASM backend. */
40
+ onForceWASMChange: (forceWASM: boolean) => void;
41
+ }
42
+ /** The floating control panel. */
43
+ export declare function DemoControls({ runtime, geocode, autocomplete, compare, panels, presets, placeholder, onSelectVersion, onForceWASMChange, }: DemoControlsProps): ReactNode;
44
+ //# sourceMappingURL=DemoControls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DemoControls.d.ts","sourceRoot":"","sources":["../../map/DemoControls.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAMpE,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAGrE,MAAM,WAAW,iBAAiB;IACjC,iCAAiC;IACjC,OAAO,EAAE,WAAW,CAAA;IACpB,uCAAuC;IACvC,OAAO,EAAE,cAAc,CAAA;IACvB,6CAA6C;IAC7C,YAAY,EAAE,oBAAoB,CAAA;IAClC,8BAA8B;IAC9B,OAAO,EAAE,eAAe,CAAA;IACxB,wFAAwF;IACxF,MAAM,EAAE,UAAU,CAAA;IAClB,qBAAqB;IACrB,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC9B,yBAAyB;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,gGAAgG;IAChG,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,sCAAsC;IACtC,iBAAiB,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;CAC/C;AAED,kCAAkC;AAClC,wBAAgB,YAAY,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,YAAY,EACZ,OAAO,EACP,MAAM,EACN,OAAO,EACP,WAAW,EACX,eAAe,EACf,iBAAiB,GACjB,EAAE,iBAAiB,GAAG,SAAS,CA6G/B"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { LoadingIndicator } from "../common/LoadingIndicator.js";
3
+ import { PresetChips } from "../common/PresetChips.js";
4
+ import { QueryForm } from "../pipeline/QueryForm.js";
5
+ import { BackendControl } from "./BackendControl.js";
6
+ import { CompareToggle } from "./CompareToggle.js";
7
+ import { PlaceAutocomplete } from "./PlaceAutocomplete.js";
8
+ import { ResultPanel } from "./ResultPanel.js";
9
+ import { VersionPicker } from "./VersionPicker.js";
10
+ /** The floating control panel. */
11
+ export function DemoControls({ runtime, geocode, autocomplete, compare, panels, presets, placeholder, onSelectVersion, onForceWASMChange, }) {
12
+ const versions = runtime.availableVersions ?? [];
13
+ const { busy, result, selectedCandidate } = geocode;
14
+ const loading = runtime.loading;
15
+ const errorMessage = geocode.parseError ?? runtime.errorMessage ?? null;
16
+ return (_jsxs("section", { className: "mw-demo-controls", children: [panels.header, panels.releaseInfo, _jsx(VersionPicker, { versions: versions, selected: runtime.selectedVersion ?? null, onSelect: onSelectVersion, disabled: busy }), _jsx(BackendControl, { activeBackend: runtime.activeBackend, forceWASM: runtime.forceWASM ?? false, onForceWASMChange: onForceWASMChange }), _jsx(CompareToggle, { versions: versions, primaryVersion: runtime.selectedVersion ?? null, compareMode: compare.compareMode, onCompareModeChange: compare.setCompareMode, compareVersion: compare.compareVersion, onCompareVersionChange: compare.setCompareVersion, disabled: busy }), _jsx(QueryForm, { value: geocode.text, onChange: geocode.setText, onSubmit: geocode.submit, disabled: !runtime.ready, busy: busy, placeholder: placeholder, onKeyDown: autocomplete.onInputKeyDown, inputProps: autocomplete.inputProps }), panels.bias, _jsx(PlaceAutocomplete, { suggestions: autocomplete.suggestions, activeIndex: autocomplete.activeIndex, onPick: autocomplete.pick, onHover: autocomplete.setActiveIndex, listboxId: autocomplete.listboxId, optionId: autocomplete.optionId }), _jsx(PresetChips, { presets: presets, disabled: !runtime.ready || busy, onPick: (value) => {
17
+ geocode.setText(value);
18
+ geocode.reset();
19
+ }, trailing: panels.permalink ? panels.permalink(geocode.text) : null }), loading && !runtime.ready ? (_jsx(LoadingIndicator, { mode: "staged", steps: loading.stepLabels.length > 0 ? loading.stepLabels : undefined, activeStep: loading.stepIndex, label: loading.progress })) : null, errorMessage ? _jsx("p", { className: "mw-error", children: errorMessage }) : null, panels.aboveResult ? panels.aboveResult({ result }) : null, busy ? (_jsx("div", { className: "mw-result", children: _jsx(LoadingIndicator, { mode: "staged", steps: runtime.parseStageLabels, activeStep: geocode.parseStage }) })) : result ? (panels.result ? (panels.result({
20
+ result,
21
+ selectedCandidate,
22
+ selectedCandidateIndex: geocode.selectedCandidateIndex,
23
+ onSelectCandidate: geocode.selectCandidate,
24
+ })) : (_jsx(ResultPanel, { result: result, selectedCandidate: selectedCandidate, selectedCandidateIndex: geocode.selectedCandidateIndex, onSelectCandidate: geocode.selectCandidate, extras: panels.extras, failure: panels.failure }))) : null, panels.compare
25
+ ? panels.compare({ result, compareMode: compare.compareMode, compareVersion: compare.compareVersion })
26
+ : null, panels.footer] }));
27
+ }
28
+ //# sourceMappingURL=DemoControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DemoControls.js","sourceRoot":"","sources":["../../map/DemoControls.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAAgC,CAAA;AACjE,OAAO,EAAE,WAAW,EAAe,MAAM,0BAA2B,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA2B,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAA;AAK/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAA;AAuBnD,kCAAkC;AAClC,MAAM,UAAU,YAAY,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,YAAY,EACZ,OAAO,EACP,MAAM,EACN,OAAO,EACP,WAAW,EACX,eAAe,EACf,iBAAiB,GACE;IACnB,MAAM,QAAQ,GAAG,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AAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAE,OAAO,CAAC,gBAAgB,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,GAAI,GAC9F,CACN,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CACZ,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CACf,MAAM,CAAC,MAAM,CAAC;gBACb,MAAM;gBACN,iBAAiB;gBACjB,sBAAsB,EAAE,OAAO,CAAC,sBAAsB;gBACtD,iBAAiB,EAAE,OAAO,CAAC,eAAe;aAC1C,CAAC,CACF,CAAC,CAAC,CAAC,CACH,KAAC,WAAW,IACX,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,EACpC,sBAAsB,EAAE,OAAO,CAAC,sBAAsB,EACtD,iBAAiB,EAAE,OAAO,CAAC,eAAe,EAC1C,MAAM,EAAE,MAAM,CAAC,MAAM,EACrB,OAAO,EAAE,MAAM,CAAC,OAAO,GACtB,CACF,CACD,CAAC,CAAC,CAAC,IAAI,EAEP,MAAM,CAAC,OAAO;gBACd,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC;gBACtG,CAAC,CAAC,IAAI,EAEN,MAAM,CAAC,MAAM,IACL,CACV,CAAA;AACF,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `<DemoMap>` — the declarative map shell for the geocoder demo, over `react-map-gl/maplibre` (v8).
7
+ * Phase 1 is the shell only: a `<Map>` that takes a host-composed `mapStyle`, an initial (or
8
+ * controlled) view state, and a `children` slot for the overlays/markers that land in later phases.
9
+ * No overlay/marker/camera logic lives here yet.
10
+ *
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
+ * subpath, never from the package root (`index.ts`). The bare `import("@mailwoman/react")` a node
14
+ * consumer (or the CI smoke IMPORT_CHECK) runs must never transitively load this file. Keep it out of
15
+ * the root barrel.
16
+ *
17
+ * CSS: the package imports no CSS from its modules (the node-safe invariant), so a host that renders
18
+ * `<DemoMap>` must import `maplibre-gl/dist/maplibre-gl.css` itself (plus `@mailwoman/react/styles.css`
19
+ * for the `.mw-demo-map` container). `<DemoMap>` is intrinsically a client component — a host that
20
+ * server-renders should wrap it in a client boundary (the package's `ClientOnly`), exactly as the
21
+ * composed `GeocoderDemo` will in a later phase.
22
+ */
23
+ import type { CSSProperties, ReactNode, Ref } from "react";
24
+ import type { MapProps, MapRef, ViewStateChangeEvent } from "react-map-gl/maplibre";
25
+ /** The style a `<DemoMap>` renders — a style URL or an inline/composed `StyleSpecification`. */
26
+ export type DemoMapStyle = NonNullable<MapProps["mapStyle"]>;
27
+ /**
28
+ * Escape hatch for the `<Map>` props `<DemoMap>` does not surface explicitly (e.g. `minZoom`, `attributionControl`,
29
+ * `maplibreLogo`). The controlled fields DemoMap owns are omitted so they can't be set twice.
30
+ */
31
+ export type DemoMapExtraProps = Partial<Omit<MapProps, "mapStyle" | "initialViewState" | "viewState" | "onMove" | "children" | "style" | "ref">>;
32
+ export interface DemoMapProps {
33
+ /** The map style — host-composed `StyleSpecification` or a style URL. */
34
+ mapStyle: DemoMapStyle;
35
+ /** Uncontrolled initial camera. Use this OR `viewState`, not both. */
36
+ initialViewState?: MapProps["initialViewState"];
37
+ /** Controlled camera. Pair with `onMove` to persist it. */
38
+ viewState?: MapProps["viewState"];
39
+ /** Fired on every camera change (drag/zoom/rotate) — the seam for viewport-bias persistence. */
40
+ onMove?: (event: ViewStateChangeEvent) => void;
41
+ /** Map projection. @default "globe" (matches the docs `DashboardMap`). */
42
+ projection?: MapProps["projection"];
43
+ /** Forwarded to the underlying `<Map>` for imperative access (`useMap`/`flyTo` in later phases). */
44
+ mapRef?: Ref<MapRef>;
45
+ /** Overlays, markers, and controls — rendered as `<Map>` children. Empty in phase 1. */
46
+ children?: ReactNode;
47
+ /** Class on the wrapper element. */
48
+ className?: string;
49
+ /** Inline style on the wrapper element (sizing lives here or on `.mw-demo-map`). */
50
+ style?: CSSProperties;
51
+ /** Remaining `<Map>` props DemoMap does not surface explicitly. */
52
+ mapProps?: DemoMapExtraProps;
53
+ }
54
+ /**
55
+ * The controlled-viewport map shell. Renders a sized wrapper around a `react-map-gl/maplibre` `<Map>`; everything
56
+ * host-specific (the composed `mapStyle`, the initial center) is injected, and overlays ride in as `children`.
57
+ */
58
+ export declare function DemoMap({ mapStyle, initialViewState, viewState, onMove, projection, mapRef, children, className, style, mapProps, }: DemoMapProps): ReactNode;
59
+ //# sourceMappingURL=DemoMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DemoMap.d.ts","sourceRoot":"","sources":["../../map/DemoMap.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAE1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAEnF,gGAAgG;AAChG,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAA;AAE5D;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CACtC,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,kBAAkB,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC,CACvG,CAAA;AAED,MAAM,WAAW,YAAY;IAC5B,yEAAyE;IACzE,QAAQ,EAAE,YAAY,CAAA;IACtB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAA;IAC/C,2DAA2D;IAC3D,SAAS,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAA;IACjC,gGAAgG;IAChG,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAC9C,0EAA0E;IAC1E,UAAU,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAA;IACnC,oGAAoG;IACpG,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACpB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oFAAoF;IACpF,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC5B;AAID;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EACvB,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,MAAM,EACN,UAAoB,EACpB,MAAM,EACN,QAAQ,EACR,SAAS,EACT,KAAK,EACL,QAAQ,GACR,EAAE,YAAY,GAAG,SAAS,CAmB1B"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Map } from "react-map-gl/maplibre";
3
+ const FILL = { width: "100%", height: "100%" };
4
+ /**
5
+ * The controlled-viewport map shell. Renders a sized wrapper around a `react-map-gl/maplibre` `<Map>`; everything
6
+ * host-specific (the composed `mapStyle`, the initial center) is injected, and overlays ride in as `children`.
7
+ */
8
+ export function DemoMap({ mapStyle, initialViewState, viewState, onMove, projection = "globe", mapRef, children, className, style, mapProps, }) {
9
+ const wrapperClassName = className ? `mw-demo-map ${className}` : "mw-demo-map";
10
+ return (_jsx("div", { className: wrapperClassName, style: style, children: _jsx(Map, { ...mapProps, ref: mapRef, mapStyle: mapStyle, initialViewState: initialViewState, viewState: viewState, onMove: onMove, projection: projection, style: FILL, children: children }) }));
11
+ }
12
+ //# sourceMappingURL=DemoMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DemoMap.js","sourceRoot":"","sources":["../../map/DemoMap.tsx"],"names":[],"mappings":";AAwBA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAqC3C,MAAM,IAAI,GAAkB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AAE7D;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,EACvB,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,MAAM,EACN,UAAU,GAAG,OAAO,EACpB,MAAM,EACN,QAAQ,EACR,SAAS,EACT,KAAK,EACL,QAAQ,GACM;IACd,MAAM,gBAAgB,GAAG,SAAS,CAAC,CAAC,CAAC,eAAe,SAAS,EAAE,CAAC,CAAC,CAAC,aAAa,CAAA;IAE/E,OAAO,CACN,cAAK,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,YAC7C,KAAC,GAAG,OACC,QAAQ,EACZ,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,IAAI,YAEV,QAAQ,GACJ,GACD,CACN,CAAA;AACF,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `<GeocoderDemo>` — the WHOLE geocoder demo, composed. It is the map analogue of `PipelineExplorer`
7
+ * and takes the SAME DI seam shape: an injected {@link DemoRuntime} (the host owns ONNX / httpvfs / R2 /
8
+ * the composed map style) plus a {@link DemoPanels} bag (the host's ModelVisualizer / VersionCompare /
9
+ * About / Permalink). Everything here is composition + a `ClientOnly` boundary:
10
+ *
11
+ * - the floating {@link DemoControls} panel (version / compare / backend / query+autocomplete / result),
12
+ * - the declarative {@link DemoMap} with the phase-2 overlays ({@link OverlayLayers}) and the
13
+ * resolved-place marker/outline/camera ({@link ResolvedPlaceLayers}) driven by the parse state,
14
+ * - the hooks that wire them: {@link useDemoGeocode} (parse + viewport bias + map place),
15
+ * {@link usePlaceAutocomplete}, {@link useCompareState}.
16
+ *
17
+ * Because it pulls {@link DemoMap} (→ `react-map-gl` → `maplibre-gl`, WebGL + DOM at import), it lives on
18
+ * the `@mailwoman/react/map` subpath ONLY — never the package root. The whole thing renders in Storybook
19
+ * over a fake runtime (offline stub style + canned geocode) with no network, no ONNX, no gazetteer.
20
+ */
21
+ import { type ReactNode } from "react";
22
+ import { type Preset } from "../common/PresetChips.tsx";
23
+ import type { DemoPanels, DemoRuntime } from "./types.ts";
24
+ export interface GeocoderDemoProps {
25
+ /** The injected demo runtime (map style + overlays + parse + version/backend). */
26
+ runtime: DemoRuntime;
27
+ /** Host-injected panels (about, release blurb, compare, permalink, debug drawer, map controls, …). */
28
+ panels?: DemoPanels;
29
+ /** Address to pre-fill. */
30
+ defaultAddress?: string;
31
+ /** Example chips. @default the empty set (host supplies its own). */
32
+ presets?: ReadonlyArray<Preset>;
33
+ /**
34
+ * Only hint the viewport bias once the visitor has zoomed past the global view — a whole-globe center is noise.
35
+ * Matches the demo's `map.getZoom() >= 4` gate. @default 4
36
+ */
37
+ minBiasZoom?: number;
38
+ /**
39
+ * Fly/fit the map to the resolved place on each result (via {@link ResolvedPlaceLayers}). @default true. Set false
40
+ * for a host that drives the camera itself (a controlled `<DemoMap viewState>`), or to keep a headless test
41
+ * deterministic — the marker + outline still render, only the animated camera move is skipped.
42
+ */
43
+ applyResultCamera?: boolean;
44
+ }
45
+ /** The composed geocoder demo, behind a `ClientOnly` SSR boundary (the map is intrinsically a client component). */
46
+ export declare function GeocoderDemo({ runtime, panels, defaultAddress, presets, minBiasZoom, applyResultCamera, }: GeocoderDemoProps): ReactNode;
47
+ //# sourceMappingURL=GeocoderDemo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeocoderDemo.d.ts","sourceRoot":"","sources":["../../map/GeocoderDemo.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAA;AAI3D,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAKvD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAW,MAAM,YAAY,CAAA;AAMlE,MAAM,WAAW,iBAAiB;IACjC,kFAAkF;IAClF,OAAO,EAAE,WAAW,CAAA;IACpB,sGAAsG;IACtG,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,qEAAqE;IACrE,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC/B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC3B;AA4FD,oHAAoH;AACpH,wBAAgB,YAAY,CAAC,EAC5B,OAAO,EACP,MAAW,EACX,cAAmB,EACnB,OAAY,EACZ,WAAe,EACf,iBAAwB,GACxB,EAAE,iBAAiB,GAAG,SAAS,CAqB/B"}