{"id":13525223,"url":"https://github.com/developit/preact-cycle","last_synced_at":"2025-10-07T13:49:05.175Z","repository":{"id":57329478,"uuid":"51331689","full_name":"developit/preact-cycle","owner":"developit","description":":recycle: Minimal functional Virtual DOM rendering using Preact :bike:","archived":false,"fork":false,"pushed_at":"2018-07-08T20:18:53.000Z","size":65,"stargazers_count":141,"open_issues_count":2,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-06T18:41:02.858Z","etag":null,"topics":["preact","preact-components"],"latest_commit_sha":null,"homepage":"https://developit.github.io/preact-cycle/","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/developit.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":"2016-02-08T22:24:14.000Z","updated_at":"2025-09-13T15:53:22.000Z","dependencies_parsed_at":"2022-09-14T18:40:26.096Z","dependency_job_id":null,"html_url":"https://github.com/developit/preact-cycle","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/developit/preact-cycle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpreact-cycle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpreact-cycle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpreact-cycle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpreact-cycle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developit","download_url":"https://codeload.github.com/developit/preact-cycle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpreact-cycle/sbom","scorecard":{"id":337229,"data":{"date":"2025-08-11","repo":{"name":"github.com/developit/preact-cycle","commit":"fc7f1edae202887b6eaac2d9a0b31ba4a55aeb05"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/22 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T04:59:17.342Z","repository_id":57329478,"created_at":"2025-08-18T04:59:17.342Z","updated_at":"2025-08-18T04:59:17.342Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278786691,"owners_count":26045588,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["preact","preact-components"],"created_at":"2024-08-01T06:01:16.969Z","updated_at":"2025-10-07T13:49:05.137Z","avatar_url":"https://github.com/developit.png","language":"JavaScript","readme":"# preact-cycle\n\n[![NPM](https://img.shields.io/npm/v/preact-cycle.svg)](https://www.npmjs.com/package/preact-cycle)\n[![travis-ci](https://travis-ci.org/developit/preact-cycle.svg?branch=master)](https://travis-ci.org/developit/preact-cycle)\n\n\u003e Minimal functional _(-reactive)_ Virtual DOM rendering using [Preact].\n\n\n---\n\n\n### Simple Example\n\n[**View this example on esnextb.in**](http://esnextb.in/?gist=d804796c481218488309)\n\n```js\nimport { render, h } from 'preact-cycle';\n/** @jsx h */\n\nconst App = ({ value, mutation }) =\u003e (\n  \u003cdiv\u003e\n    \u003cp\u003eValue: { value }\u003c/p\u003e\n    \u003cbutton onClick={ mutation('value', v =\u003e v+1) }\u003eIncrement\u003c/button\u003e\n  \u003c/div\u003e\n);\n\nrender(App, { value: 0 });\n```\n\n\n---\n\n\n### To-Do List Example\n\nA simple example, where reducers are just pure functions.\nNote that `TOGGLE` mutates state in-place, which works fine but is discouraged.\n\n[**View this example on CodePen**](https://codepen.io/developit/pen/XYvQjr?editors=0110)\n\n```js\nimport { render, h } from 'preact-cycle';\n/** @jsx h */\n\nconst ADD = ({ text, todos, ...state }) =\u003e ({\n  todos: todos.concat({ text }),\n  text: '',\n  ...state\n});\n\nconst TOGGLE = (state, todo) =\u003e {\n  todo.done = !todo.done;\n  return state;\n};\n\nconst REMOVE = ({ todos, ...state }, todo) =\u003e ({\n  todos: todos.filter( t =\u003e t!==todo ),\n  ...state\n});\n\n\nconst TodoList = ({ text, todos, mutate, mutation }) =\u003e (\n  \u003cdiv\u003e\n    \u003cform onSubmit={mutation(ADD)} action=\"javascript:\"\u003e\n      \u003cinput value={text} onInput={e =\u003e mutate('text', e.target.value)} /\u003e\n      \u003cbutton action=\"submit\"\u003eAdd\u003c/button\u003e\n    \u003c/form\u003e\n    \u003cul\u003e\n      { todos.map( todo =\u003e (\n        \u003cli onClick={mutation(TOGGLE, todo)}\u003e\n          \u003cinput type=\"checkbox\" checked={todo.done} readonly /\u003e\n          \u003cp\u003e{ todo.text }\u003c/p\u003e\n          \u003ca onClick={mutation(REMOVE, todo)}\u003e✕\u003c/a\u003e\n        \u003c/li\u003e\n      ))}\n    \u003c/ul\u003e\n  \u003c/div\u003e\n);\n\nrender(TodoList, { todos: [] }, document.body);\n```\n\n\n---\n\n\n### Component-Based Example\n\nNormal [preact] components still work great with preact-cycle. As of `v0.4`, `mutate()` and `mutation()` are conveniently available as [context] properties, which means they are automatically passed down through the VDOM tree. For pure functional components, [context] is simply passed as a second argument.\n\nA component-based variant of the previous To-Do List example follows, using pure functions and context.\n\n```js\nimport { h, render } from 'preact-cycle';\n/** @jsx h */\n\n\n/** initial data to populate the store */\nconst INITIAL_DATA = {\n  todos: [\n    { text:'Type some text' },\n    { text:'...then hit [enter]' },\n    { text:'Now you\\'re productive!' }\n  ]\n};\n\n/** Appends a new todo item */\nconst ADD = ({ todos, text, ...state }) =\u003e ({\n  todos: todos.concat({ text }),\n  text: '',\n  ...state\n});\n\n/** Remove the given todo item */\nconst REMOVE = ({ todos, ...state }, todo) =\u003e ({\n  todos: todos.filter(t =\u003e t!==todo),\n  ...state\n});\n\n/** Toggles the given todo item as done */\nconst TOGGLE = (state, todo) =\u003e {\n  todo.done = !todo.done;\n};\n\n\n/** a simple helper to derive a mutated value from an event */\nlet fromEvent = (prev, e) =\u003e e.target.value;\n\n\n/** The todo list app */\nconst App = ({ text, todos }) =\u003e (\n  \u003cdiv id=\"app\"\u003e\n    \u003cForm text={text} /\u003e\n    \u003cul\u003e{ todos.map( todo =\u003e (\n      \u003cItem todo={todo} /\u003e\n    )) }\u003c/ul\u003e\n  \u003c/div\u003e\n);\n\n/** New todo entry form */\nconst Form = ({ text }, { mutation }) =\u003e (\n  \u003cform onSubmit={mutation(ADD)} action=\"javascript:\"\u003e\n    \u003cinput placeholder=\"New item...\"\n      value={text}\n      onInput={mutation('text', fromEvent)} /\u003e\n  \u003c/form\u003e\n);\n\n/** A single todo list item */\nconst Item = ({ todo }, { mutation }) =\u003e (\n  \u003cli onClick={mutation(TOGGLE, todo)} class={{ done: todo.done }}\u003e\n    \u003cinput type=\"checkbox\" checked={todo.done} readonly /\u003e\n    \u003ca onClick={mutation(REMOVE, todo)}\u003e✕\u003c/a\u003e\n    \u003cp\u003e{ todo.text }\u003c/p\u003e\n  \u003c/li\u003e\n);\n\n// Kick off the cycle!\nrender(App, INITIAL_DATA, document.body);\n```\n\n\n---\n\n\n### License\n\n[MIT]\n\n\n[Preact]: https://github.com/developit/preact\n[context]: https://facebook.github.io/react/docs/context.html\n[MIT]: http://choosealicense.com/licenses/mit/\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopit%2Fpreact-cycle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevelopit%2Fpreact-cycle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopit%2Fpreact-cycle/lists"}