{"id":18091349,"url":"https://github.com/wildlyinaccurate/plait","last_synced_at":"2025-04-13T06:09:17.626Z","repository":{"id":3085907,"uuid":"48396936","full_name":"wildlyinaccurate/plait","owner":"wildlyinaccurate","description":"A fast, minimal JavaScript framework for building isomorphic reactive web components.","archived":false,"fork":false,"pushed_at":"2022-01-13T16:06:27.000Z","size":1884,"stargazers_count":29,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T06:09:06.558Z","etag":null,"topics":["elm","functional-reactive-programming","immutability","javascript-framework","jsx","plait","redux"],"latest_commit_sha":null,"homepage":"https://plait.js.org/","language":"JavaScript","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/wildlyinaccurate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-21T22:14:09.000Z","updated_at":"2024-01-02T16:02:25.000Z","dependencies_parsed_at":"2022-08-06T13:01:09.050Z","dependency_job_id":null,"html_url":"https://github.com/wildlyinaccurate/plait","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildlyinaccurate%2Fplait","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildlyinaccurate%2Fplait/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildlyinaccurate%2Fplait/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildlyinaccurate%2Fplait/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wildlyinaccurate","download_url":"https://codeload.github.com/wildlyinaccurate/plait/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670435,"owners_count":21142904,"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":["elm","functional-reactive-programming","immutability","javascript-framework","jsx","plait","redux"],"created_at":"2024-10-31T18:11:28.513Z","updated_at":"2025-04-13T06:09:17.608Z","avatar_url":"https://github.com/wildlyinaccurate.png","language":"JavaScript","funding_links":[],"categories":["Marks"],"sub_categories":["[React - A JavaScript library for building user interfaces](http://facebook.github.io/react)"],"readme":"# [Plait](https://plait.js.org/)\n\nPlait is a minimal JavaScript framework for building isomorphic reactive web components. It is loosely based on \u003ca href=\"https://github.com/evancz/elm-architecture-tutorial/\"\u003eThe Elm Architecture\u003c/a\u003e and Elm's \u003ca href=\"https://github.com/evancz/start-app\"\u003e\u003ccode\u003eStartApp\u003c/code\u003e\u003c/a\u003e.\n\n![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/plait.svg?style=for-the-badge)\n[![Build Status](https://img.shields.io/travis/wildlyinaccurate/plait.svg?style=for-the-badge)](https://travis-ci.org/wildlyinaccurate/plait)\n![stability-unstable](https://img.shields.io/badge/stability-unstable-yellow.svg?style=for-the-badge)\n\n## The Basic Idea\n\nInspired by the experience of writing reactive applications in [Elm](http://elm-lang.org/), Plait is an attempt at achieving a similar application architecture with a minimal amount of JavaScript.\n\nIn Plait, an application is composed of one or more encapsulated components. A component is made up of 3 functions: `init`, which provides the component's initial state; `view`, which renders the component at a given state and attaches actions to the UI elements; and `update`, which modifies the component's state based on actions dispatched from the UI.\n\nComponent state is implemented as an immutable map. Behind the scenes, the state is contained \u0026 managed by [Redux](https://github.com/rackt/redux). A component's `update` function is just a Redux [reducer](http://rackt.org/redux/docs/basics/Reducers.html).\n\nComponent views are written in [virtual-hyperscript](https://github.com/Matt-Esch/virtual-dom/blob/master/virtual-hyperscript/README.md) and rendered by [virtual-dom](https://github.com/Matt-Esch/virtual-dom). DOM events are transparently handled by [dom-delegator](https://github.com/Raynos/dom-delegator).\n\nWith minimal effort, component views can be written in JSX and compiled to virtual-hyperscript using [jsx-transform](https://github.com/alexmingoia/jsx-transform).\n\n## An Example Application\n\nThe following is an example of an application composed of a single counter component. [View the demo](https://plait.js.org/examples/Counter.html)\n\n\u003e _Note: For more complex example applications, see [the Plait documentation](https://plait.js.org/examples/index.html)._\n\n```jsx\nimport h from 'virtual-dom/h'\nimport Plait from 'plait'\n\nconst app = Plait.start({ init, update, view })\n\nPlait.render(document.getElementById('app'), app)\n\nfunction init () {\n  return {\n    count: 0\n  }\n}\n\nfunction update (state, action) {\n  switch (action.type) {\n    case 'DECREMENT':\n      return state.update('count', x =\u003e x - 1)\n\n    case 'INCREMENT':\n      return state.update('count', x =\u003e x + 1)\n  }\n}\n\nfunction view (state, dispatch) {\n  return (\n    \u003cdiv\u003e\n      \u003cbutton ev-click={dispatch({ type: 'DECREMENT' })}\u003e-\u003c/button\u003e\n      \u003cspan\u003e{state.get('count')}\u003c/span\u003e\n      \u003cbutton ev-click={dispatch({ type: 'INCREMENT' })}\u003e+\u003c/button\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\n## Plait is Fast\n\nPlait is extremely fast compared to other popular JavaScript frameworks. Like [Mercury](https://github.com/Raynos/mercury) and [Elm](http://elm-lang.org/), this is in large part due to the use of [virtual-dom](https://github.com/Matt-Esch/virtual-dom) as well as a focus on **immutability** and **purity**.\n\nUsing the [TodoMVC app](https://plait.js.org/examples/TodoMVC.html) as a benchmark, Plait performs better than Elm and almost as well as Mercury. You can [run the benchmark](https://wildlyinaccurate.com/todomvc-perf-comparison/) yourself to see.\n\n![](./performance-comparison.png)\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 Joseph Wynn\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwildlyinaccurate%2Fplait","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwildlyinaccurate%2Fplait","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwildlyinaccurate%2Fplait/lists"}