{"_id":"@anil-labs/google-places-autocomplete-core","name":"@anil-labs/google-places-autocomplete-core","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@anil-labs/google-places-autocomplete-core","version":"0.2.0","type":"module","description":"Framework-agnostic engine for Google Places Autocomplete (New): debounced predictions, session-token billing, keyboard navigation and place-details resolution — zero runtime dependencies.","license":"MIT","author":"Er. Anil Kumar Thakur <anilkumarthakur60@gmail.com>","repository":{"type":"git","url":"git+https://github.com/anilkumarthakur60/google-places-autocomplete.git","directory":"packages/core"},"homepage":"https://github.com/anilkumarthakur60/google-places-autocomplete/tree/main/packages/core#readme","bugs":"https://github.com/anilkumarthakur60/google-places-autocomplete/issues","keywords":["google-places","places-api","autocomplete","address-autocomplete","headless"],"sideEffects":["*.css"],"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","unpkg":"./dist/index.global.js","jsdelivr":"./dist/index.global.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./styles.css":"./dist/styles.css"},"devDependencies":{"@vitest/coverage-v8":"^4.1.10","jsdom":"^29.0.2","tsup":"^8.5.1","typescript":"~6.0.0","vitest":"^4.1.10"},"publishConfig":{"access":"public"},"engines":{"node":">=20"},"scripts":{"clean":"rm -rf dist coverage","build":"tsup","dev":"tsup --watch","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","typecheck":"tsc --noEmit","lint":"eslint ."},"_nodeVersion":"24.18.0","_id":"@anil-labs/google-places-autocomplete-core@0.2.0","dist":{"integrity":"sha512-gmwLlOMDp6uLXTbm6TY3CNNhCyelMLqAoqw3EyIt3GcL8CQWjl5VYtevcynKZqU6V239B+fy6vX7XPaltYgGOQ==","shasum":"dfe358818304fe2d93754bfabe29efbe4596a51f","tarball":"https://registry.npmjs.org/@anil-labs/google-places-autocomplete-core/-/google-places-autocomplete-core-0.2.0.tgz","fileCount":12,"unpackedSize":187589,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFfLS7ZT1WFjQAuWU3yRns5Ckc14gwbdohPLhKobn9+BAiBsPWYOhS3J+MDsFq+u3wxC/hgAV67y2kNQzG6qaX9KVQ=="}]},"_npmUser":{"name":"anilkumarthakur","email":"anilkumarthakur60@gmail.com"},"directories":{},"maintainers":[{"name":"anilkumarthakur","email":"anilkumarthakur60@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/google-places-autocomplete-core_0.2.0_1785342372126_0.2983878396561519"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-29T16:26:11.780Z","0.2.0":"2026-07-29T16:26:12.357Z","modified":"2026-07-29T16:26:12.742Z"},"maintainers":[{"name":"anilkumarthakur","email":"anilkumarthakur60@gmail.com"}],"description":"Framework-agnostic engine for Google Places Autocomplete (New): debounced predictions, session-token billing, keyboard navigation and place-details resolution — zero runtime dependencies.","homepage":"https://github.com/anilkumarthakur60/google-places-autocomplete/tree/main/packages/core#readme","keywords":["google-places","places-api","autocomplete","address-autocomplete","headless"],"repository":{"type":"git","url":"git+https://github.com/anilkumarthakur60/google-places-autocomplete.git","directory":"packages/core"},"author":"Er. Anil Kumar Thakur <anilkumarthakur60@gmail.com>","bugs":"https://github.com/anilkumarthakur60/google-places-autocomplete/issues","license":"MIT","readme":"# @anil-labs/google-places-autocomplete-core\n\nFramework-agnostic engine for Google Places Autocomplete (New): debounced predictions, automatic session-token billing, keyboard navigation and place-details resolution. Zero runtime dependencies — talks to `places.googleapis.com` with plain `fetch`, no Maps JavaScript SDK, no global namespace.\n\nThis is the shared engine behind [`@anil-labs/google-places-autocomplete-vue`](https://www.npmjs.com/package/@anil-labs/google-places-autocomplete-vue), `-react`, `-svelte`, `-solid` and `-element`. Install one of those directly unless you're building your own binding.\n\n## Install\n\n```sh\nnpm install @anil-labs/google-places-autocomplete-core\n```\n\n## Usage\n\n```ts\nimport { createPlacesAutocomplete } from '@anil-labs/google-places-autocomplete-core'\n\nconst controller = createPlacesAutocomplete({\n  apiKey: 'YOUR_API_KEY',\n  onSelect: (place, suggestion) => console.log(place.formattedAddress),\n})\n\ncontroller.subscribe(() => {\n  const state = controller.getState()\n  // state.query, state.suggestions, state.status, state.isOpen, ...\n})\n\ncontroller.setQuery('1600 amphi')\n```\n\nSee the [full API reference](https://anilkumarthakur60.github.io/google-places-autocomplete/api/core) and the [getting started guide](https://anilkumarthakur60.github.io/google-places-autocomplete/guide/getting-started) (Google Cloud setup, key restriction).\n\n## CDN / no bundler\n\nA standalone build is published for plain `<script>`-tag use, exposing the engine as `window.GooglePlacesAutocompleteCore`:\n\n```html\n<script src=\"https://unpkg.com/@anil-labs/google-places-autocomplete-core\"></script>\n<link rel=\"stylesheet\" href=\"https://unpkg.com/@anil-labs/google-places-autocomplete-core/styles.css\" />\n<script>\n  const controller = GooglePlacesAutocompleteCore.createPlacesAutocomplete({ apiKey: 'YOUR_API_KEY' })\n</script>\n```\n\nFor a ready-made UI without wiring the engine yourself, prefer [`@anil-labs/google-places-autocomplete-element`](https://www.npmjs.com/package/@anil-labs/google-places-autocomplete-element), whose CDN build bundles this engine in and auto-registers a `<gpa-autocomplete>` tag.\n\n## Why this over the legacy Autocomplete widget?\n\n- **No Maps JS SDK** — plain `fetch`, works anywhere `fetch`/`AbortController`/`crypto.randomUUID()` exist.\n- **Correct session billing by default** — Autocomplete + Place Details share one session token automatically.\n- **Bring your own key handling** — pass `apiKey` directly, or override `fetcher` to proxy through your own backend.\n\nSee [Session tokens & billing](https://anilkumarthakur60.github.io/google-places-autocomplete/guide/session-tokens) for the full detail.\n\n## Styling\n\n`./styles.css` provides a minimal, CSS-custom-property-based baseline (`.gpa-root`, `.gpa-input`, `.gpa-panel`, `.gpa-listbox`, `.gpa-option`, `.gpa-status`, `.gpa-empty`) shared by every wrapper package:\n\n```ts\nimport '@anil-labs/google-places-autocomplete-core/styles.css'\n```\n\nOverride the custom properties (`--gpa-bg`, `--gpa-fg`, `--gpa-accent`, etc.) on `.gpa-root` to theme.\n\n## License\n\nMIT © Er. Anil Kumar Thakur\n","readmeFilename":"","_rev":"1-d935bab11b1e28a35ddc6f6292f4e631"}