{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "filters", "registryDependencies": [ "https://powui.dev/r/theme.json" ], "files": [ { "path": "src/components/ui/filters.tsx", "content": "\"use client\";\n\nimport { useEffect, useRef, type PropsWithChildren } from \"react\";\n\nlet filterId = 0;\nconst useCreateFilterId = () => {\n const mounted = useRef(false);\n const id = useRef(filterId);\n if (!mounted.current) {\n filterId += 1;\n }\n useEffect(() => {\n mounted.current = true;\n }, []);\n return `pow-filter-${id.current}`;\n};\n\nconst SVGWithFilterDefs = (\n props: PropsWithChildren<{\n filterBody: React.ReactNode;\n className?: string;\n containerClassName?: string;\n }>,\n) => {\n const {\n children,\n filterBody,\n className = \"\",\n containerClassName = \"\",\n } = props;\n const filterId = useCreateFilterId();\n return (\n
\n \n \n {filterBody}\n \n \n
\n {children}\n
\n
\n );\n};\n\nconst Displacement = (\n props: PropsWithChildren<{\n scale?: number;\n frequency?: number;\n className?: string;\n containerClassName?: string;\n }>,\n) => {\n const {\n scale = 2,\n className = \"\",\n containerClassName = \"\",\n frequency = 0.1,\n children,\n } = props;\n return (\n \n \n \n \n }\n >\n {children}\n \n );\n};\n\nconst ChromaAberr = (\n props: PropsWithChildren<{\n offset?: number;\n className?: string;\n containerClassName?: string;\n }>,\n) => {\n const {\n offset = 0.7,\n className = \"\",\n containerClassName = \"\",\n children,\n } = props;\n return (\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n }\n >\n {children}\n \n );\n};\n\nconst Posterize = (\n props: PropsWithChildren<{\n className?: string;\n containerClassName?: string;\n buckets?: number;\n }>,\n) => {\n const {\n buckets = 5,\n className = \"\",\n containerClassName = \"\",\n children,\n } = props;\n const range = Array.from(\n { length: buckets },\n (_, idx) => idx / (buckets - 1),\n ).join(\" \");\n\n return (\n \n \n \n \n \n }\n >\n {children}\n \n );\n};\n\nexport const Filters = {\n Displacement,\n ChromaAberr,\n Posterize,\n};\n", "type": "registry:ui" } ], "type": "registry:ui" }