{"id":16226226,"url":"https://github.com/ghostdevv/svelte-reduced-motion","last_synced_at":"2025-03-19T13:30:34.687Z","repository":{"id":41852126,"uuid":"437334122","full_name":"ghostdevv/svelte-reduced-motion","owner":"ghostdevv","description":"A collection of utilities for working with reduced motion in svelte!","archived":false,"fork":false,"pushed_at":"2025-01-22T07:42:13.000Z","size":302,"stargazers_count":10,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T00:14:28.356Z","etag":null,"topics":["hacktoberfest","svelte"],"latest_commit_sha":null,"homepage":"https://svelte-reduced-motion.willow.codes","language":"TypeScript","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/ghostdevv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"patreon":"onlyspaceghost","custom":"https://ghostdev.xyz/donate"}},"created_at":"2021-12-11T16:35:03.000Z","updated_at":"2024-11-19T19:45:35.000Z","dependencies_parsed_at":"2024-10-22T11:37:48.248Z","dependency_job_id":null,"html_url":"https://github.com/ghostdevv/svelte-reduced-motion","commit_stats":{"total_commits":76,"total_committers":2,"mean_commits":38.0,"dds":0.5,"last_synced_commit":"b6db263d42a5d382bd5a796641b758a84cadde8f"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostdevv%2Fsvelte-reduced-motion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostdevv%2Fsvelte-reduced-motion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostdevv%2Fsvelte-reduced-motion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostdevv%2Fsvelte-reduced-motion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghostdevv","download_url":"https://codeload.github.com/ghostdevv/svelte-reduced-motion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243989576,"owners_count":20379647,"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":["hacktoberfest","svelte"],"created_at":"2024-10-10T12:48:31.323Z","updated_at":"2025-03-19T13:30:32.405Z","avatar_url":"https://github.com/ghostdevv.png","language":"TypeScript","readme":"# Svelte Reduced Motion\n\nA library for working with reduced motion and Svelte transitions. Read more about [why reduced motion is important](https://ghostdev.xyz/posts/working-with-reduced-motion-in-svelte/). Please [create an issue](https://github.com/ghostdevv/svelte-reduced-motion/issues/new) if something is missing/wrong.\n\n# Installing\n\n```sh\nnpm install svelte-reduced-motion -D\n```\n\nThis library works with Svelte 5 only, [checkout v1](https://www.npmjs.com/package/svelte-reduced-motion/v/1.1.1) for Svelte 3/4 support.\n\n# Usage\n\nBelow is some use cases for the library, checkout the [full docs here](https://svelte-reduced-motion.willow.codes).\n\n## Transitions\n\nThe easiest way to get started is with the `svelte/transition` wrapper. This wraps all official transitions with our `createTransition` api, which will automatically use fade when reduced motion is requested.\n\n```diff\n\u003cscript\u003e\n-\timport { fly } from 'svelte/transition';\n+\timport { fly } from 'svelte-reduced-motion/transition';\n\u003c/script\u003e\n```\n\nYou can provide your own fallback transition with the `createTransition` api. We'll import the regular fly and blur transitions for this. The first argument is the target transition, with the second being the fallback.\n\n```svelte\n\u003cscript\u003e\n\timport { createTransition } from 'svelte-reduced-motion';\n\timport { fly, blur } from 'svelte/transition';\n\n\tconst accessibleFly = createTransition(fly, blur);\n\u003c/script\u003e\n```\n\nIf we want to specify options per transition, you can do that in the createTransition fn. Any options passed to the final transition will overwrite them, and still cause a merge.\n\n```svelte\n\u003cscript\u003e\n\timport { createTransition } from 'svelte-reduced-motion';\n\timport { fly, blur } from 'svelte/transition';\n\n\tconst accessibleFly = createTransition(\n\t\t[fly, { y: -20, duration: 200 }],\n\t\t[blur, { duration: 500 }],\n\t);\n\u003c/script\u003e\n\n\u003cdiv use:accessibleFly\u003e\u003c/div\u003e\n```\n\n## Store\n\nYou can also import the `prefersReducedMotion` store to make checks for yourself.\n\n```svelte\n\u003cscript\u003e\n\timport { prefersReducedMotion } from 'svelte-reduced-motion';\n\u003c/script\u003e\n\n{#if $prefersReducedMotion}\n\t\u003cp\u003eThe user prefers reduced motion!\u003c/p\u003e\n{/if}\n```\n\n# Migrating from v1 to v2\n\n-   Requires Svelte 5\n-   The `reducedMotion` store is now called `prefersReducedMotion` to match the media query\n-   The types have been tweaked to be more compatible, please let me know if there any issues.\n\n# Support\n\n-   Create a issue on the [github](https://github.com/ghostdevv/svelte-reduced-motion/issues/new)\n-   Join the [discord](https://discord.gg/2Vd4wAjJnm)\u003cbr\u003e\n","funding_links":["https://patreon.com/onlyspaceghost","https://ghostdev.xyz/donate"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghostdevv%2Fsvelte-reduced-motion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghostdevv%2Fsvelte-reduced-motion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghostdevv%2Fsvelte-reduced-motion/lists"}