{"id":"piquu/rotai","name":"rotai","scope":"piquu","platform":"roblox","description":"Mirrored from the Wally registry.","version":"0.1.6","latest":"0.1.6","versions":["0.1.0","0.1.1","0.1.2","0.1.3","0.1.4","0.1.5","0.1.6"],"license":"MIT","licenseRating":"safe","licenseCaveats":["The package archive does not include its license text; the license is declared in its manifest metadata."],"licenseVerified":false,"dependencies":{},"integrity":"10c004104350f5fd690001b725d3067fffb4279042cd5c54edf1402cb963ddbc","likes":0,"downloads":0,"install":"forest install piquu/rotai","url":"https://forest.dev/p/roblox/piquu/rotai","files":"https://api.forest.dev/ai/package/roblox/piquu/rotai/files","readme":"# Rotai\r\n\r\nA [Jotai](https://github.com/pmndrs/jotai) like state management library for [Roact](https://github.com/Roblox/roact), [Roact Hooks](https://github.com/Kampfkarren/roact-hooks) and [React Lua](https://github.com/jsdotlua/react-lua/)\r\n\r\n> [!WARNING]  \r\n> This library is wip. Breaking changes may occur.\r\n\r\n## Installation\r\n\r\n### Method 1: File (Roblox Studio)\r\n- Download the `rbxm` model file from the [Github release page](https://github.com/piquu/Rotai/releases/tag/0.1.0).\r\n- Insert the model into Roblox Studio into a place like `ReplicatedStorage`\r\n\r\n### Method 2: Wally\r\n- Add this like to your `wally.toml` file\r\n```toml\r\nrotai = \"piquu/rotai@0.1.0\"\r\n```\r\n\r\n## Todo\r\n- [x] Add support for [react lua](https://github.com/jsdotlua/react-lua/)\r\n- [ ] Write better [Documentation](/Documentation.md)\r\n- [x] Optimize `useAtom` for Roact\r\n- [ ] Add support for [Roblox Ts](https://roblox-ts.com/)\r\n\r\n## [Documentation](/Documentation.md)\r\n```lua\r\nlocal Roact = require(path.to.roact)\r\nlocal Rotai = require(path.to.rotai)\r\n\r\nlocal Component = require(path.to.component)\r\n\r\nlocal atom = Rotai.atom(0)\r\n\r\nlocal app = Roact.createElement(Rotai.Roact.Provider(Roact), {\r\n\tstore = atom,\r\n}, {\r\n\tRoact.createElement('ScreenGui', nil, {\r\n\t\tRoact.createElement(Component),\r\n\t})\r\n})\r\n\r\nRoact.mount(app, game.Players.LocalPlayer.PlayerGui)\r\n```\r\nComponent:\r\n```lua\r\nlocal Roact = require(path.to.roact)\r\nlocal Rotai = require(path.to.rotai)\r\n\r\nlocal Component = Roact.Component:extend('Component')\r\n\r\nfunction Component:init()\r\n\tself.count, self.setCount = Rotai.Roact.useAtom(self)\r\nend\r\n\r\nfunction Component:render()\r\n\treturn Roact.createElement('TextButton', {\r\n\t\tAnchorPoint = Vector2.new(.5, .5),\r\n\t\tSize = UDim2.new(0, 100, 0, 100),\r\n\t\tPosition = UDim2.new(.5, 0, .5, 0),\r\n\t\tText = tostring(self.value()),\r\n\t\t[Roact.Event.MouseButton1Click] = function(_)\r\n\t\t\tself.setValue(self.value() + 1)\r\n\t\tend,\r\n\t})\r\nend\r\n\r\nreturn Rotai.roact.Consumer(Roact)(Component)\r\n```\r\n\r\n## License\r\nRotai is available under the MIT license. See [LICENSE](LICENSE) for details.\r\n","readmeBorrowedFrom":{"version":"0.1.4","source":"wally"},"readmeTruncated":false}