{"id":17914400,"url":"https://github.com/lawvs/fn-sphere","last_synced_at":"2025-12-28T13:58:18.548Z","repository":{"id":255959358,"uuid":"774809157","full_name":"lawvs/fn-sphere","owner":"lawvs","description":"⌛ Filter Sphere is a powerful and flexible library for creating dynamic filtering interfaces in your web applications.","archived":false,"fork":false,"pushed_at":"2025-03-17T03:15:32.000Z","size":2281,"stargazers_count":22,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T00:24:21.725Z","etag":null,"topics":["advanced-filter","filter","filter-builder","query","query-builder","zod"],"latest_commit_sha":null,"homepage":"http://www.waterwater.moe/fn-sphere/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lawvs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-03-20T08:22:17.000Z","updated_at":"2025-03-12T04:55:20.000Z","dependencies_parsed_at":"2024-12-03T05:25:23.496Z","dependency_job_id":"f0a36b97-ab72-4a29-9ca6-61b1ae16c49f","html_url":"https://github.com/lawvs/fn-sphere","commit_stats":null,"previous_names":["lawvs/fn-sphere"],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawvs%2Ffn-sphere","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawvs%2Ffn-sphere/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawvs%2Ffn-sphere/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lawvs%2Ffn-sphere/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lawvs","download_url":"https://codeload.github.com/lawvs/fn-sphere/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245186442,"owners_count":20574551,"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":["advanced-filter","filter","filter-builder","query","query-builder","zod"],"created_at":"2024-10-28T19:58:10.436Z","updated_at":"2025-12-28T13:58:18.513Z","avatar_url":"https://github.com/lawvs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fn Sphere\n\n[![Build](https://github.com/lawvs/fn-sphere/actions/workflows/build.yml/badge.svg)](https://github.com/lawvs/fn-sphere/actions/workflows/build.yml)\n[![npm](https://img.shields.io/npm/v/@fn-sphere/filter)](https://www.npmjs.com/package/@fn-sphere/filter)\n\nFn Sphere contains a set of libraries for filtering, sorting, and transforming data. Use it, you can easily integrate advanced filters, sorters, and transform functions to handle your data.\n\n## Filter Sphere\n\nWith Filter Sphere, you can easily integrate a filter system into your application.\n\n![demo](https://github.com/user-attachments/assets/5a5b9ebe-f37e-4944-8bf2-e29555dff138)\n\n![demo ui](https://github.com/user-attachments/assets/cbf689fd-029d-4f2b-8993-0363f2667e74)\n\n## Usage\n\nVisit [Filter Sphere Docs](https://lawvs.github.io/fn-sphere) to learn more.\n\n```sh\nnpm add @fn-sphere/filter\n```\n\n```tsx\nimport { useFilterSphere } from \"@fn-sphere/filter\";\nimport { z } from \"zod\";\n\nconst YOUR_DATA_SCHEMA = z.object({\n  name: z.string(),\n  age: z.number(),\n});\n\nconst YOUR_DATA: z.infer\u003ctypeof YOUR_DATA_SCHEMA\u003e[] = [\n  { name: \"Jack\", age: 18 },\n];\n\nconst Filter = () =\u003e {\n  const { filterRule, predicate, context } = useFilterSphere({\n    schema: YOUR_DATA_SCHEMA,\n    onRuleChange: ({ predicate }) =\u003e {\n      const filteredData = YOUR_DATA.filter(predicate);\n      console.log(filteredData);\n    },\n  });\n\n  return (\n    \u003cFilterSphereProvider context={context}\u003e\n      \u003cFilterBuilder /\u003e\n    \u003c/FilterSphereProvider\u003e\n  );\n};\n```\n\n## Acknowledgements\n\n- This project is inspired by the filter system in [toeverything/AFFiNE](https://github.com/toeverything/AFFiNE/tree/3e810eb043e62811ba3ab2e021c6f4b92fb4fe70/packages/frontend/core/src/components/page-list/filter)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flawvs%2Ffn-sphere","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flawvs%2Ffn-sphere","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flawvs%2Ffn-sphere/lists"}