{"id":16791965,"url":"https://github.com/metonym/svelte-fuzzy","last_synced_at":"2025-06-10T14:33:21.491Z","repository":{"id":35448564,"uuid":"217771977","full_name":"metonym/svelte-fuzzy","owner":"metonym","description":"Fuse.js binding for fuzzy text match highlighting","archived":false,"fork":false,"pushed_at":"2023-05-07T03:10:57.000Z","size":934,"stargazers_count":31,"open_issues_count":6,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-19T23:44:25.248Z","etag":null,"topics":["fuse-js","fuzzy","fuzzy-search","highlight","highlight-words","match","svelte","text-highlighter"],"latest_commit_sha":null,"homepage":"https://metonym.github.io/svelte-fuzzy","language":"Svelte","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metonym.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-26T21:35:36.000Z","updated_at":"2025-01-07T17:15:06.000Z","dependencies_parsed_at":"2024-10-28T12:31:18.298Z","dependency_job_id":null,"html_url":"https://github.com/metonym/svelte-fuzzy","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metonym%2Fsvelte-fuzzy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metonym%2Fsvelte-fuzzy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metonym%2Fsvelte-fuzzy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metonym%2Fsvelte-fuzzy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metonym","download_url":"https://codeload.github.com/metonym/svelte-fuzzy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metonym%2Fsvelte-fuzzy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259093063,"owners_count":22804118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fuse-js","fuzzy","fuzzy-search","highlight","highlight-words","match","svelte","text-highlighter"],"created_at":"2024-10-13T08:43:40.996Z","updated_at":"2025-06-10T14:33:21.466Z","avatar_url":"https://github.com/metonym.png","language":"Svelte","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svelte-fuzzy\n\n[![NPM][npm]][npm-url]\n\n\u003e [Fuse.js](https://github.com/krisk/Fuse) binding for fuzzy text match highlighting.\n\n\u003c!-- REPO_URL --\u003e\n\n---\n\n\u003c!-- TOC --\u003e\n\n## Installation\n\n**Yarn**\n\n```bash\nyarn add -D svelte-fuzzy\n```\n\n**NPM**\n\n```bash\nnpm i -D svelte-fuzzy\n```\n\n## Usage\n\n```svelte\n\u003cscript\u003e\n  import Fuzzy from \"svelte-fuzzy\";\n\n  let query = \"old\";\n\n  // Fuse.js options\n  let options = { keys: [\"title\"] };\n\n  // Fuse.js data\n  let data = [\n    {\n      title: \"Frankenstein; Or, The Modern Prometheus\",\n      author: \"Mary Wollstonecraft Shelley\",\n    },\n    {\n      title: \"A Christmas Carol in Prose; Being a Ghost Story of Christmas\",\n      author: \"Charles Dickens\",\n    },\n    { title: \"Pride and Prejudice\", author: \"Jane Austen\" },\n    { title: \"The Scarlet Letter\", author: \"Nathaniel Hawthorne\" },\n    { title: \"Alice's Adventures in Wonderland\", author: \"Lewis Carroll\" },\n  ];\n\n  let formatted = [];\n\u003c/script\u003e\n\n\u003cinput bind:value={query} /\u003e\n\n\u003cbr /\u003e\n\n\u003cbutton on:click={() =\u003e (query = \"carol\")}\u003eSearch \"carol\"\u003c/button\u003e\n\u003cbutton on:click={() =\u003e (query = \"\")}\u003eClear\u003c/button\u003e\n\n\u003cFuzzy {query} {data} {options} bind:formatted /\u003e\n\n{#each formatted as item}\n  {#each item as line}\n    \u003cli\u003e\n      {#each line as { matches, text }}\n        {#if matches}\n          \u003cmark\u003e{text}\u003c/mark\u003e\n        {:else}\n          {text}\n        {/if}\n      {/each}\n    \u003c/li\u003e\n  {/each}\n{/each}\n```\n\n### `Highlighter`\n\nYou can use the `Highlighter` component for fuzzy text highlighting. Matching characters are wrapped in a `mark` element.\n\n```svelte\n\u003cscript\u003e\n  import { Highlighter } from \"svelte-fuzzy\";\n\u003c/script\u003e\n\n{#each formatted as item}\n  {#each item as line}\n    \u003cli\u003e\n      \u003cHighlighter {line} /\u003e\n    \u003c/li\u003e\n  {/each}\n{/each}\n```\n\n## API\n\n### Props\n\n#### `Fuzzy`\n\n| Prop name | Value                                                                                                                  |\n| :-------- | :--------------------------------------------------------------------------------------------------------------------- |\n| query     | `string` (default: `\"\"`)                                                                                               |\n| data      | [FuzzyData](https://github.com/metonym/svelte-fuzzy/blob/master/types/Fuzzy.svelte.d.ts#L19) (default: `[]`)           |\n| options   | [FuzzyOptions](https://github.com/metonym/svelte-fuzzy/blob/master/types/Fuzzy.svelte.d.ts#L25)                        |\n| result    | [FuzzyResult](https://github.com/metonym/svelte-fuzzy/blob/master/types/Fuzzy.svelte.d.ts#L31) (default: `[]`)         |\n| formatted | [FuzzyFormattedResult](https://github.com/metonym/svelte-fuzzy/blob/master/types/Fuzzy.svelte.d.ts#L4) (default: `[]`) |\n\n#### `Highlighter`\n\n| Prop name | Value                                                                                                                   |\n| :-------- | :---------------------------------------------------------------------------------------------------------------------- |\n| line      | [HighlighterLine](https://github.com/metonym/svelte-fuzzy/blob/master/types/Highlighter.svelte.d.ts#L4) (default: `[]`) |\n\n## TypeScript\n\nSvelte version 3.31 or greater is required to use this component with TypeScript.\n\nTypeScript definitions are located in the [types folder](./types).\n\n## Changelog\n\n[Changelog](CHANGELOG.md)\n\n## License\n\n[MIT](LICENSE)\n\n[npm]: https://img.shields.io/npm/v/svelte-fuzzy.svg?style=for-the-badge\u0026color=%23ff3e00\n[npm-url]: https://npmjs.com/package/svelte-fuzzy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetonym%2Fsvelte-fuzzy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetonym%2Fsvelte-fuzzy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetonym%2Fsvelte-fuzzy/lists"}