{"id":"afrxo/compulse","name":"compulse","scope":"afrxo","platform":"roblox","description":"Class-based components made easy.","version":"1.3.0","latest":"1.3.0","versions":["1.0.0","1.1.0","1.2.0","1.3.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{},"integrity":"372a26e60d1122096578450be123c4669233c192b6f149158d5864a9d0187bce","likes":0,"downloads":0,"install":"forest install afrxo/compulse","url":"https://forest.dev/p/roblox/afrxo/compulse","files":"https://api.forest.dev/ai/package/roblox/afrxo/compulse/files","readme":"# Compulse\r\nAn open-source library for Roblox,\r\nenabling seamless creation of component-based classes with lifecycle. Simplify UI development and embrace modularity.\r\n\r\n## Installation\r\nAdd **Compulse** to your `wally.toml` dependency list:\r\n\r\n`Compulse = \"afrxo/compulse@^1.2\" `\r\n\r\n\r\n## Example\r\n```lua\r\nlocal Button, create = Compulse()\r\n\r\nfunction Button:Init(props)\r\n    self.Text = props.Text\r\nend\r\n\r\nfunction Button:Render()\r\n    return Fusion.New \"TextButton\" {\r\n        Text = self.Text,\r\n        Size = UDim2.fromOffset(200, 50),\r\n        [Fusion.OnEvent \"Activated\"] = self.Props.Activated\r\n    }\r\nend\r\n\r\nfunction Button:DidRender()\r\n    print('I was created ;)')\r\nend\r\n\r\nfunction Button:WillDestroy()\r\n    print('There I go.. :C')\r\nend\r\n\r\nreturn create\r\n```\r\n\r\n```lua\r\n-- [imports omitted]\r\n\r\nlocal instance = Button {\r\n    Text = \"Click me!\",\r\n    Activated = function()\r\n        print(\"Do something\")\r\n    end\r\n}\r\n\r\ninstance.Parent = Fusion.New \"ScreenGui\" {\r\n    Parent = Player.PlayerGui\r\n}\r\n\r\ntask.delay(3, instance.Destroy, instance)\r\n```\r\n\r\n## Strictly Typed\r\n```lua\r\nexport type Factory<props> = Compulse.Factory<props>\r\nexport type Component<props> = Compulse.Component<props>\r\n\r\nexport type Props = {\r\n\tText: string,\r\n\tActivated: () -> ()\r\n}\r\n\r\nlocal Component: Component<Props>, create: Factory<Props> = Compulse()\r\n\r\n-- The `props` type gets inferred automatically\r\nfunction Component:Init(props)\r\n\tself.Text = props.Text\r\nend\r\n\r\nfunction Component:Render()\r\n\treturn Fusion.New \"TextButton\" {\r\n\t\tSize = UDim2.fromOffset(200, 50),\r\n\t\tText = self.Text,\r\n\t\t[Fusion.OnEvent \"Activated\"] = self.Props.Activated\r\n\t}\r\nend\r\n\r\nreturn create\r\n```","readmeTruncated":false}