jaspr_search 0.2.0
jaspr_search: ^0.2.0 copied to clipboard
Client-side full-text search for static Jaspr sites — a search dialog component plus a build-time indexer, with no backend to query.
0.2.0 #
Breaking. SearchDialog no longer takes emptyState. It moved, along
with four new customisation hooks, to a second component — see below.
SearchDialog could never be built into a real site. Its emptyState
parameter was a Component Function(int)?, and jaspr_builder serializes
every constructor parameter of an @client component across the
server/client boundary, so a function type is rejected outright. Because that
builder is auto_apply: all_packages, dart run build_runner build failed
for the entire app — even one that never imported this package.
-
Added
SearchDialogView— the whole dialog, with no@clientannotation. Unannotated classes are never inspected by that builder, so this one can accept components and callbacks freely. It takes everythingSearchDialogtakes, plus five structural hooks:trigger,emptyState,noResults,resultContentandfooter. Use it inside a one-line@clientwrapper of your own. -
SearchDialogis now a primitives-only drop-in that constructs aSearchDialogViewinternally.const SearchDialog()and every other string/bool/int argument work exactly as before, and it still needs no client entrypoint of your own. -
Removed
SearchDialog.emptyState. Callers get a compile error naming the parameter. Replace:// before — never built SearchDialog(emptyState: (n) => Component.text('$n pages')) // after @client class DocsSearch extends StatelessComponent { const DocsSearch({super.key}); @override Component build(BuildContext context) => SearchDialogView( emptyState: (n) => Component.text('$n pages'), ); } -
Exported
highlightQuery, so a customresultContentcan render the same<mark>highlighting the default rows use. -
More addressable markup, for customising from CSS without touching Dart: the status panel carries
data-state(loading,idle,no-results,error) instead of being one undifferentiated.jaspr-search-empty; each result<li>carries.jaspr-search-hit-item; the magnifier<svg>carries.jaspr-search-icon. The README lists every selector. -
Lowered the Dart SDK floor to
>=3.8.0(from>=3.10.0). The old floor dated to the initial release and nothing in the package required it; 3.8.0 is what the runtime dependencies actually ask for,jasprandjaspr_contentboth flooring at 3.8.0. This widens the set of workspaces that can adoptjaspr_search— a single package pinning a high floor gates everything resolved alongside it. It is a constraint change only, and not a claim that the package has been exercised on a 3.8 toolchain.
Notes on two jaspr_builder bugs found while working this out, recorded but
not yet reported upstream, are in doc/upstream-notes.md.
0.1.1 #
- Trim the README to focus on
jaspr_searchitself rather than the history of the sites it was extracted from.
0.1.0 #
- Initial release: a
SearchDialogclient component, abuildSearchIndexbuild-time indexer plus ajaspr_searchCLI for the zero-config case, and the ranking model shared between them. Extracted from the Zonai and Revali documentation sites.