{"id":"jaylers/fable","name":"fable","scope":"jaylers","platform":"roblox","description":"Fine-grained reactive UI framework for Roblox with built-in responsive scaling","version":"0.1.0","latest":"0.1.0","versions":["0.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"38ffac0f1795a2a58afe5de9e7bcb2cda4fde0b7d0393b3fc861a96ee48b6204","likes":0,"downloads":0,"install":"forest install jaylers/fable","url":"https://forest.dev/p/roblox/jaylers/fable","files":"https://api.forest.dev/ai/package/roblox/jaylers/fable/files","readme":"# Fable UI Roblox\n\n**Fine-grained reactive UI for Roblox (Luau), with responsive scaling built in.** Bind a property to state and\nonly that property is rewritten when the state changes: no virtual tree, no diffing.\n\nEnglish | [ไทย](README.th.md)\n\n```lua check\nlocal Players = game:GetService(\"Players\")\nlocal ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\nlocal Fable = require(ReplicatedStorage.Fable)\n\nlocal scope = Fable.scoped() -- owns everything below; scope:destroy() cleans it all up\nlocal clicks = scope:Value(0)\n\nscope:New \"ScreenGui\" {\n\tParent = Players.LocalPlayer:WaitForChild(\"PlayerGui\"),\n\t[Fable.Children] = {\n\t\tscope:New \"TextButton\" {\n\t\t\tSize = UDim2.fromOffset(240, 60),\n\t\t\tText = scope:Computed(function(use)\n\t\t\t\treturn `Clicked {use(clicks)} times` -- follows `clicks`\n\t\t\tend),\n\t\t\t[Fable.OnEvent \"Activated\"] = function()\n\t\t\t\tclicks:set(clicks:get() + 1)\n\t\t\tend,\n\t\t},\n\t},\n}\n```\n\n## Why Fable\n\n* **Responsive in the box.** Design once on a 1920x1080 canvas (`scope:ResponsiveGui`), size text and buttons in real\n  pixels (`scope:Px`), change the layout per device (`scope:Breakpoint`). The example inventory passes on nine\n  emulated devices, from a 1920x1080 desktop to phones: nothing overflows, text is at least 12 px and buttons at\n  least 44 px. See the [responsive guide](docs/responsive-guide.md).\n* **Fast, measured.** Numbers from Roblox Studio on an M1 Pro, against hand-written code doing the same work\n  ([full page](docs/performance.md)):\n  * a state change costs about 0.43 microseconds more than writing the property yourself: 1.02x for an expensive\n    property such as `Text`, about 2x for the cheapest (`Rotation`, `Size`), where the whole write is under a microsecond;\n  * many changes in one frame are written once: 3 to 4 times faster than writing each, 150 times for `Text`;\n  * a 500-item list (add, remove, reorder) is 0.85x to 1.48x of a hand-written loop and creates no Instance when only\n    values change;\n  * 200 animations run in one loop (one scope per frame in the MicroProfiler);\n  * building and destroying a UI 1,000 times leaves nothing behind, and a 30-minute run with 500 live slots shows flat memory.\n* **No leaks by construction.** Everything is created through a scope, and `scope:destroy()` removes every Instance,\n  binding and connection.\n* **No runtime dependencies.** One ModuleScript tree, client first, strictly typed (`--!strict`).\n\nPhase 1 is the core plus responsive UI. There is no ready-made component set (Button, Dialog...), no theme system\nand no server state sync; they may come later.\n\n## Install\n\nFable is a ModuleScript named `Fable` in `ReplicatedStorage`. Two ways (the steps are in\n[getting-started.md](docs/getting-started.md)):\n\n* **Drag a file in:** insert `Fable.rbxm` into Studio and put the `Fable` ModuleScript in ReplicatedStorage. Build the\n  file yourself with `rojo build default.project.json -o Fable.rbxm` until a release is published.\n* **Rojo / Wally:** map `src/` into `ReplicatedStorage.Fable` in your Rojo project. The Wally package\n  (`jaylers/fable`) will be available with the first release.\n\n## Learn it\n\n| | |\n|---|---|\n| [Getting started](docs/getting-started.md) | Install and build your first UI that follows state |\n| [API reference](docs/api.md) | Every call, with checked examples |\n| [Responsive guide](docs/responsive-guide.md) | `ResponsiveGui`, `Px`, `Breakpoint`: when to use which |\n| [Examples](examples/README.md) | Hello counter, animated window, responsive inventory, 500-slot stress test |\n| Deep dives | [core reactivity](docs/core-reactivity.md), [instances](docs/instances.md), [lists](docs/lists.md), [animation](docs/animation.md), [responsive details](docs/responsive.md), [performance](docs/performance.md), [known issues](docs/known-issues.md) |\n\n## Status\n\nPhase 1 is complete; version 0.1.0 is prepared for release (see [CHANGELOG.md](CHANGELOG.md) and [docs/releasing.md](docs/releasing.md)). The spec is\n[FABLE_SPEC.md](FABLE_SPEC.md) (in Thai).\n\n## Development setup\n\n```bash\nrokit install              # rojo, wally, stylua, selene, luau-lsp, lune\nwally install              # installs dev dependencies (Jest-Lua) into DevPackages/\nrojo sourcemap dev.project.json -o sourcemap.json\n```\n\n> Apple Silicon: Wally 0.3.2 ships no arm64 macOS binary, so `rokit install` cannot run it\n> (needs Rosetta). Build it once with\n> `cargo install --git https://github.com/UpliftGames/wally --tag v0.3.2 --locked wally`\n> and make sure `~/.cargo/bin` comes before `~/.rokit/bin` on PATH.\n\nGenerated, git-ignored helpers used by the checks below:\n\n```bash\nselene generate-roblox-std\ncurl -sSfLO https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/main/scripts/globalTypes.d.luau\n```\n\n### Checks\n\n```bash\nstylua --check src tests scripts examples\nselene src tests scripts examples\nluau-lsp analyze --definitions=globalTypes.d.luau --sourcemap=sourcemap.json src tests examples\nlune run scripts/check-docs     # runs the code samples of the documentation\n```\n\n### Tests\n\n- Reactive core: `lune run scripts/run-tests`\n- Core micro-benchmarks (Lune): `lune run scripts/bench`\n- Everything, in the real engine: sync the code into a throwaway Studio place with Rojo\n  (`rojo serve dev.project.json` + the Rojo plugin) and run `scripts/studio/run-tests.luau` with the\n  Roblox_Studio MCP tool `execute_luau`. Details: [docs/testing.md](docs/testing.md).\n","readmeTruncated":false}