jaspr_search 0.2.0 copy "jaspr_search: ^0.2.0" to clipboard
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 @client annotation. Unannotated classes are never inspected by that builder, so this one can accept components and callbacks freely. It takes everything SearchDialog takes, plus five structural hooks: trigger, emptyState, noResults, resultContent and footer. Use it inside a one-line @client wrapper of your own.

  • SearchDialog is now a primitives-only drop-in that constructs a SearchDialogView internally. 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 custom resultContent can 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, jaspr and jaspr_content both flooring at 3.8.0. This widens the set of workspaces that can adopt jaspr_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_search itself rather than the history of the sites it was extracted from.

0.1.0 #

  • Initial release: a SearchDialog client component, a buildSearchIndex build-time indexer plus a jaspr_search CLI for the zero-config case, and the ranking model shared between them. Extracted from the Zonai and Revali documentation sites.
4
likes
160
points
180
downloads

Documentation

API reference

Publisher

verified publishermrgnhnt.com

Weekly Downloads

Client-side full-text search for static Jaspr sites — a search dialog component plus a build-time indexer, with no backend to query.

Repository (GitHub)
View/report issues

Topics

#jaspr #search #static-site #documentation

License

MIT (license)

Dependencies

args, jaspr, jaspr_content, universal_web

More

Packages that depend on jaspr_search