{"id":16791978,"url":"https://github.com/metonym/svelte-style","last_synced_at":"2026-04-29T10:01:46.032Z","repository":{"id":98413226,"uuid":"423035289","full_name":"metonym/svelte-style","owner":"metonym","description":"Style utilities as Svelte actions","archived":false,"fork":false,"pushed_at":"2021-10-31T17:26:04.000Z","size":43,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-14T03:56:29.451Z","etag":null,"topics":["style","svelte","svelte-action","utility"],"latest_commit_sha":null,"homepage":"https://metonym.github.io/svelte-style","language":"JavaScript","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":"2021-10-31T02:31:12.000Z","updated_at":"2021-10-31T20:47:41.000Z","dependencies_parsed_at":"2023-05-06T01:32:55.731Z","dependency_job_id":null,"html_url":"https://github.com/metonym/svelte-style","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"a3935f985abafa37af1520bb2473ba805d295fd8"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/metonym/svelte-style","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metonym%2Fsvelte-style","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metonym%2Fsvelte-style/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metonym%2Fsvelte-style/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metonym%2Fsvelte-style/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metonym","download_url":"https://codeload.github.com/metonym/svelte-style/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metonym%2Fsvelte-style/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32420356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["style","svelte","svelte-action","utility"],"created_at":"2024-10-13T08:43:44.010Z","updated_at":"2026-04-29T10:01:46.004Z","avatar_url":"https://github.com/metonym.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svelte-style\n\n[![NPM][npm]][npm-url]\n\n\u003e Style utilities as Svelte actions\n\n\u003c!-- REPO_URL --\u003e\n\n`svelte-style` provides Svelte actions that conditionally apply styles as an alternative to writing CSS.\n\nTry it in the [Svelte REPL](https://svelte.dev/repl/f759197ad49348b1bb4e181e735e08bc).\n\n---\n\n\u003c!-- TOC --\u003e\n\n## Installation\n\n**Yarn**\n\n```bash\nyarn add -D svelte-style\n```\n\n**NPM**\n\n```bash\nnpm i -D svelte-style\n```\n\n**pnpm**\n\n```bash\npnpm i -D svelte-style\n```\n\n## Available actions\n\n### Visually hidden\n\nUse the `visuallyHidden` action to hide content without breaking screen readers.\n\n```svelte\n\u003cscript\u003e\n  import { visuallyHidden } from \"svelte-style\";\n\u003c/script\u003e\n\n\u003cdiv use:visuallyHidden\u003eText\u003c/div\u003e\n```\n\nThe action accepts an argument that conditionally toggles the style.\n\n```svelte\n\u003cscript\u003e\n  import { visuallyHidden } from \"svelte-style\";\n\n  let toggled = false;\n\u003c/script\u003e\n\n\u003cbutton on:click={() =\u003e (toggled = !toggled)}\u003e\n  Toggle \u003cspan style=\"color: red\" use:visuallyHidden={toggled}\u003eText\u003c/span\u003e\n\u003c/button\u003e\n```\n\n## API\n\n### Style class\n\nCreate your own Svelte action that conditionally applies styles using the `Style` class.\n\n**JavaScript**\n\n```svelte no-eval\n\u003cscript\u003e\n  import { Style } from \"svelte-style\";\n\n  const style = \"color: red\";\n\n  const colorRed = (node, enabled) =\u003e new Style(node, enabled, style).init();\n\u003c/script\u003e\n\n\u003cdiv use:colorRed\u003eRed text\u003c/div\u003e\n```\n\n**TypeScript**\n\nIf your set-up includes TypeScript, use `UseStyleType` to statically type the action.\n\n```ts\nimport { Style } from \"svelte-style\";\nimport { UseStyleType } from \"svelte-style/src/Style\";\n\nconst style = \"color: red\";\n\nconst colorRed: UseStyleType = (node, enabled) =\u003e new Style(node, enabled, style).init();\n```\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.md](CHANGELOG.md)\n\n## License\n\n[MIT](LICENSE)\n\n[npm]: https://img.shields.io/npm/v/svelte-style.svg?style=for-the-badge\u0026color=%23ff3e00\n[npm-url]: https://npmjs.com/package/svelte-style\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetonym%2Fsvelte-style","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetonym%2Fsvelte-style","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetonym%2Fsvelte-style/lists"}