{"id":23773458,"url":"https://github.com/beenotung/lite-s","last_synced_at":"2025-10-29T10:22:59.883Z","repository":{"id":65030179,"uuid":"580971166","full_name":"beenotung/lite-s","owner":"beenotung","description":"A simple state manage library with pull-push based design.","archived":false,"fork":false,"pushed_at":"2022-12-22T01:30:47.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T20:03:26.489Z","etag":null,"topics":["cdn","composable","dependency-tracking","lite","reactive","s-js","state","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beenotung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-21T23:31:51.000Z","updated_at":"2023-09-17T12:14:19.000Z","dependencies_parsed_at":"2023-01-03T20:31:23.354Z","dependency_job_id":null,"html_url":"https://github.com/beenotung/lite-s","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Flite-s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Flite-s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Flite-s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Flite-s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beenotung","download_url":"https://codeload.github.com/beenotung/lite-s/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239960977,"owners_count":19725432,"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":["cdn","composable","dependency-tracking","lite","reactive","s-js","state","typescript"],"created_at":"2025-01-01T05:40:23.473Z","updated_at":"2025-10-29T10:22:54.832Z","avatar_url":"https://github.com/beenotung.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lite-s\n\nA simple state manage library with pull-push based design.\n\n[![npm Package Version](https://img.shields.io/npm/v/lite-s)](https://www.npmjs.com/package/lite-s)\n[![Minified Package Size](https://img.shields.io/bundlephobia/min/lite-s)](https://bundlephobia.com/package/lite-s)\n[![Minified and Gzipped Package Size](https://img.shields.io/bundlephobia/minzip/lite-s)](https://bundlephobia.com/package/lite-s)\n\nInspired from [S.js](https://github.com/adamhaile/S) and [a talk about SolidJS](https://www.youtube.com/watch?v=qB5jK-KeXOs)\n\n## Installation\n\n### Option 1: Import npm package\n\nInstall from npm:\n\n```bash\n# install with npm\nnpm i lite-s\n# or pnpm\npnpm i lite-s\n# or yarn\nyarn add lite-s\n```\n\nImport as typescript package / esm package:\n\n```typescript\n// using named import\nimport { S } from 'lite-s'\n// or using default import\nimport S from 'lite-s'\n```\n\nImport as commonjs package\n\n```javascript\nlet { S } = require('lite-s')\n```\n\n### Option 2: Import esm package over CDN\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { S } from 'https://cdn.jsdelivr.net/npm/lite-s@1.0.0/core.mjs'\n\u003c/script\u003e\n```\n\n### Option 3: Import iife library over CDN\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/lite-s@1.0.0/s.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  let state = S(1)\n\u003c/script\u003e\n```\n\n## Usage Example\n\n```javascript\nlet a = S(1)\nlet b = S(2)\nlet c = () =\u003e a.value + b.value\nlet text = S.map(() =\u003e `${a} + ${b} = ${c()}`)\n\nlet dom = {\n  a: document.createElement('input'),\n  b: document.createElement('input'),\n  c: document.createTextNode(text),\n}\n\ndom.a.type = 'number'\ndom.a.value = a.value\ndom.a.addEventListener('input', e =\u003e (a.value = e.target.valueAsNumber))\n\ndom.b.type = 'number'\ndom.b.value = b.value\ndom.b.addEventListener('input', e =\u003e (b.value = e.target.valueAsNumber))\n\nS.run(() =\u003e (dom.c.textContent = text))\n\ndocument.body.appendChild(dom.a)\ndocument.body.appendChild(dom.b)\ndocument.body.appendChild(dom.c)\n```\n\n## License\n\nThis project is licensed with [BSD-2-Clause](./LICENSE)\n\nThis is free, libre, and open-source software. It comes down to four essential freedoms [[ref]](https://seirdy.one/2021/01/27/whatsapp-and-the-domestication-of-users.html#fnref:2):\n\n- The freedom to run the program as you wish, for any purpose\n- The freedom to study how the program works, and change it so it does your computing as you wish\n- The freedom to redistribute copies so you can help others\n- The freedom to distribute copies of your modified versions to others\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeenotung%2Flite-s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeenotung%2Flite-s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeenotung%2Flite-s/lists"}