Rip - a speed-optimized MVC library for UI (PTB)

Rip is currently a PTB, a public testing build, and should not be used in production. Please provide any feedback!

Rip 0.1;

Rip is a MVC (Model, View, Controller) library that separates the UI design of an app with the actual Lua functionality of an app. Using an incremental dom and signals, Rip’s declarative templates are designed for fast, efficient builds.

A plus of using this library is that, for teams, UI designers can simply create their design’s UI without having to impl. the actual code behind their UI.

Templates
Templates are functions that build components for your app. Simply call Rip.Template(...) as such:

	Rip.Template("TextLabel", {
			Size = UDim2.new(1, 0, 1, 0);
			Text = "Hello world!"
	})

then to add children, you pass a function as the third property calling the child component, as such:

Rip.Template("TextLabel", {
    Size = UDim2.new(1, 0, 1, 0);
    Text = "Hello world!"
}, function()
    Rip.Template("UIScale", {
		Scale = 0;
    }
end)

Controller
Simply call Rip.Controller.new(), and extend off of that class. The only function that Rip calls is yourController:init() on initiation.

Example code:

local cont = Rip.Controller.new();

function cont:init()
	print("Controller connected!")
end

To apply the controller to a template, simply call Rip.applyController().
To set a ref, accessible through self.target[targetName], use Rip.target(targetName).
To set data, accessible through self.data[dataName], use Rip.data(dataKey, dataValue).

For example,

Rip.Template("TextLabel", {
	Size = UDim2.new(1, 0, 1, 0);
}, function()
	Rip.applyController(clockController);
	Rip.target("text")
    Rip.data("timezone", "est")
end)

bootstrapApp(renderFunction, renderRoot)
Creates a Rip app. Usage:

Rip.bootstrapApp(function()
	appComponent();
end, root)

signals
Docs & info: Signal - a more advanced version of native Roblox signals

Latest update

SOURCE (Rip 0.1):
Rip.rbxm (6.1 KB)

2 Likes

Just based on what I see, what benefits does using this have over pre-established frameworks like React-lua or Fusion?

2 Likes

I want to preface this by distinguishing the difference between a framework and a library. Rip, and react-lua is not a framework. Rip, as well as react-lua, provides utilities for the creation and logic of app UI, but does not provide resources for the organization and for the app itself. Also, rip is nowhere near version 1.0.

Rip is especially useful for cases where separating the model, view, and controllers are beneficial, which is not applicable to React-lua or Fusion. Rip is designed to be fast by being the lightweight, targeted solution without providing bloated or potentially unnecessary features. It instead requires the developer to use Rip as the base of their app and build on top of Rip.

1 Like

Rip 0.2 release:

Fixes:

  • Fixed an incremental-dom issue where untracked elements were not destroyed

Features:

  • Signal.runOutsideRip(callback) allows you to do untracked work with signals (setting and accessing signals don’t trigger any changes)
  • Controller:viewChild(String id) and id(String id) replaces Controller.target and target(). View child returns a function that then returns the expected component.
  • Controller accepts properties, allowing you to delay controller initiation until after the app has been rendered, as well as accepting data properties expectations, making Controller.data.dataKey a signal that returns the value of inputted data().
  • Controller.renderRoot is the root element of the controller

Promised by Rip 0.3:

  • Utilities for events and changes
  • viewChild will eventually return a signal instead of a function
  • A new signals wrapper to prevent overflows and to increase performance
  • More (tbd, bug fixes and features)

Introducing material-rip!

Current version: 0.2

Material Design 3 components
Using actual Material Design 3 design tokens, theming, and JS code, rip-material using Rip 0.2, provides M3 components directly matching those of the web or Android implementations. Try it out and let me know what you think!

Current components:

  • Ripple
  • Text button
  • Many more soon

Docs coming soon, but it’s pretty self-explanatory

Rip 0.2 source:
Rip0.2.rbxm (6.9 KB)

Material Rip 0.2 source:
material-rip.rbxm (30.0 KB)

2 Likes