{"id":23107915,"url":"https://github.com/ryu-man/svelte-tools","last_synced_at":"2025-06-15T18:35:04.082Z","repository":{"id":37958695,"uuid":"476025964","full_name":"ryu-man/svelte-tools","owner":"ryu-man","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-21T15:27:37.000Z","size":68,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T10:41:55.305Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ryu-man.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}},"created_at":"2022-03-30T19:36:52.000Z","updated_at":"2022-10-26T09:15:12.000Z","dependencies_parsed_at":"2023-01-17T17:49:05.887Z","dependency_job_id":null,"html_url":"https://github.com/ryu-man/svelte-tools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu-man%2Fsvelte-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu-man%2Fsvelte-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu-man%2Fsvelte-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu-man%2Fsvelte-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryu-man","download_url":"https://codeload.github.com/ryu-man/svelte-tools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247092373,"owners_count":20882217,"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":[],"created_at":"2024-12-17T01:16:26.594Z","updated_at":"2025-04-03T22:44:20.990Z","avatar_url":"https://github.com/ryu-man.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svelte-tools\n\n**svelte-tools** is a collection of utilities that helps developers writing better cleaner codes\n\n## Install\n\n```bash\nnpm i svelte-tools\n```\n\n## Accessible stores (writable / readable / derived)\n\nan accessible writable / readable / derived is a svelte store designed to let the user access the data without subscribing\n\n```js\nimport { writable, readable, derived } from 'svelte-tools'\n\n// create an accessible store\nconst store$ = writable(\"Hello world!\")\n\n// can access the data on demamnde\nconsole.log(store$.value)\n\n// set the data will trigger the store to react\nstore.set(\"JavaScript is the best\")\n```\n\n## Memorable store\n\nmemorable store lets you access old memories of the current value\n\n```js\nimport { memorable } from 'svelte-tools'\n\n// create an accessible store\nconst [current, old, older, oldest] = memorable(new Date().getSeconds(), 3)\n\nsetInterval(()=\u003e current.set(new Date().getSeconds()), 1000)\n\n// can access the data on demamnde\n$: console.log($current, $old, $older, $oldest)\n```\n\n## Colorable store\n\na colorable store generates colors as you provide values, there are two colorable store: `rgbColorable` \u0026 `hslColorable`\n\n```js\nimport { rgbColorable, hslColorable } from 'svelte-tools'\n\n// create an accessible store\n// can subscribe to individuel stores\n// rgb$ is the color store\n// red$, green$, blue$, alpha$ are stores of what color is made of\nconst { rgb$, red$, green$, blue$, alpha$} = rgbColorable();\n\nconst { hsl$, hue$, saturation$, lightness$, alpha$} = hslColorable();\n\n// Note: stores will have a trailing '$' ex: hsl$\n```\n\nBy default colorable stores will use `spring` to animate changes, but it can be configurable to use `tweened` store instead, for that you need to specify tweened options , see the example below\n\n```js\nimport { rgbColorable } from 'svelte-tools'\n\n# create colorable rgb store\nconst { rgb$ } = rgbColorable({}, {duration:400});\n```\n\nyou can use a simple object for data binding\n\n```js\n\u003cscript\u003e\n    import { rgbColorable } from 'svelte-tools'\n\n    # create colorable rgb store\n    const { rgb$, data } = rgbColorable();\n\n    // data.red\n    // data.green\n    // data.blue\n    // data.alpha\n\u003c/script\u003e\n\n\u003cinput type=\"number\" bind:value={data.red} min=\"0\" max=\"255\"\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryu-man%2Fsvelte-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryu-man%2Fsvelte-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryu-man%2Fsvelte-tools/lists"}