feat(search): coordinates and bundled presets resolve keyless (#572)

Supersedes #388 by @KuraPiee, ported onto the current component layout with fixes from review.

Verified before merge: format, package boundaries, unit suite, build, and the browser tracking suite; a browser harness for the change where one applies; adversarial review applied.

Co-authored-by: KuraPiee <[email protected]>
This commit is contained in:
Bilawal SidhuandKuraPiee authored and GitHub committed 2026-09-14 21:18:07 -05:00
1 parent d9fac6d88e
commit cca6442997
13 files changed
+672 -14

No files matched your search

+14 -1
View File
@@ -3,18 +3,31 @@ import { createHttpGeospatialProvider } from './http.js';
import { createPlaceSearch } from './placeSearch.js';
import { createGoogleGeocoder } from './google.js';
import { createPhotonGeocoder } from '../keylessGeocoder.js';
import { createCoordinateGeocoder } from './coordinateGeocoder.js';
import { createPresetGeocoder } from './presetGeocoder.js';
/** Google first when configured, then keyless Photon; transport stays local to setup. */
/**
* Coordinates and bundled names first — both answer offline and with no key —
* then Google when configured, then keyless Photon. Transport stays local to
* setup.
*
* `presets` is the caller's bundled place data. It is passed in rather than
* imported so this package keeps reading no application state; with none
* supplied there is simply no bundled-name provider.
*/
export function createDefaultPlaceSearch({
resolveApiKey,
fetchImpl = (...args) => fetch(...args),
signal,
endpoints = {},
providers = {},
presets = null,
} = {}) {
const forward = createPlaceSearch({
signal,
providers: providers.geocode || [
createCoordinateGeocoder(),
...(presets ? [createPresetGeocoder({ presets })] : []),
createGoogleGeocoder({
request(query, { bias, signal }) {
const key = resolveApiKey?.();