Skip to main content

Source map

The client script lives in packages/script/src — 59 TypeScript modules, grouped by the feature they serve. This is a map for finding the code behind a behaviour, not an API reference; for that see Public API.

Entry point

index.ts runs on DOM ready. It reads the configuration, scans the document for wf-algolia-element attributes, initialises whichever features are present, attaches window.WfAlgolia, and emits ready.

The whole body is wrapped in a try/catch that logs [wf-algolia] Initialization failed:. That is why a misconfigured page degrades rather than breaking.

By folder

FolderHolds
core/Configuration reading, attribute resolution and inheritance
search/Query execution for search inputs
browse/Browse listings and their state
filters/Every filter variant, cascading, filter search, standalone groups
pagination/Load-more, numbered and infinite scroll
sort/Replica switching
render/Template cloning and field binding
elements/Element discovery and the role map
actions/Shared state mutations used by the public API
recommend/Algolia Recommend sections
tracking/Insights click and conversion events
static-list/Statically authored filter lists
api/The window.WfAlgolia surface
utils/Sanitisation and shared helpers
dev/The development linter

Where behaviours live

To changeLook in
How data-* options are read and defaultedcore/config.ts
How a result card is filledrender/template.ts
What HTML survives a wf-algolia-html bindingutils/sanitize.ts
Which markers land on a cardrender/template.ts
The public method surfaceapi/public-api.ts

The attribute sync guard

src/__tests__/attribute-sync.test.ts asserts in both directions that every wf-algolia-* attribute the runtime reads is documented in docs-v2, and that the docs name no attribute the runtime does not read.

It is the reason an undocumented attribute cannot ship. If you add one, the suite fails until it appears in the docs — usually automatically, because the reference is generated from the registry.

Two categories are excluded deliberately: retired names surfaced in the "Renamed attributes" table, and CSS class markers, which share the prefix but are never attributes.

Testing

pnpm --filter @candid-leap/wf-algolia test:unit # vitest
pnpm --filter @candid-leap/wf-algolia test # unit + Playwright

The full test script also runs browser tests, which need pnpm exec playwright install once.