repo stringclasses 341
values | file_path stringlengths 29 173 | language stringclasses 2
values | file_type stringclasses 4
values | code stringlengths 2 1.66M | tokens int64 2 598k |
|---|---|---|---|---|---|
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/src/Dimensions/init.luau | luau | .luau | local Dimensions = {}
export type Dimensions<T> =
{
type: "getter",
callback: (value: T, index: number) -> UDimRect,
}
| {
type: "consistentSize",
size: number,
}
| {
type: "consistentUDim2",
udim2: UDim2,
}
| {
type: "spaced",
spacing: number,
inner: Dimensions<T>,
}
export type UDimRect = ... | 344 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/src/Renderers/ReactBindingsRenderer.luau | luau | .luau | local Src = script:FindFirstAncestor("ultimate-list")
local Dimensions = require(Src.Dimensions)
local DimensionsMethods = require(Src.Dimensions.DimensionsMethods)
local React = require(Src.Parent.React)
local adjustPositionToScrollAxis = require(Src.Dimensions.adjustPositionToScrollAxis)
local createDebugLogger = re... | 1,816 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/src/Renderers/ReactStateRenderer.luau | luau | .luau | local Src = script:FindFirstAncestor("ultimate-list")
local Dimensions = require(Src.Dimensions)
local DimensionsMethods = require(Src.Dimensions.DimensionsMethods)
local React = require(Src.Parent.React)
local Renderers = require(Src.Renderers)
local adjustPositionToScrollAxis = require(Src.Dimensions.adjustPositionT... | 664 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/src/Renderers/init.luau | luau | .luau | local Src = script:FindFirstAncestor("ultimate-list")
local React = require(Src.Parent.React)
local Renderers = {}
export type Renderer<T> = {
type: "byState",
callback: (T) -> React.Node,
config: StateRendererConfig,
} | {
type: "byBinding",
callback: (React.Binding<T?>) -> React.Node,
}
export type StateRend... | 187 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/src/Util/createDebugLogger.luau | luau | .luau | -- Intentionally using string formatting instead of taking strings directly to avoid
-- expensive string formatting in production.
local Src = script:FindFirstAncestor("ultimate-list")
local DebugFlags = require(Src.DebugFlags)
local function createDebugLogger(key: string): <A...>(format: string | (A...) -> (string, ... | 145 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/src/Util/exhaustiveMatch.luau | luau | .luau | local function exhaustiveMatch(value: never): never
error(`Unknown value in exhaustive match: {value}`)
end
return exhaustiveMatch
| 27 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/src/Util/joinAndMapBindings.luau | luau | .luau | local Src = script:FindFirstAncestor("ultimate-list")
local React = require(Src.Parent.React)
-- A version of React.joinBindings(data):map(fn) that preserves types.
local function joinAndMapBindings<Ret, T1, T2, T3>(
fn: (T1, T2, T3) -> Ret,
binding1: React.Binding<T1>,
binding2: React.Binding<T2>,
binding3: Reac... | 146 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/src/createVirtualizedListController/binarySearchIndexRangeInView.lua | luau | .lua | local Src = script:FindFirstAncestor("ultimate-list")
local DataSourceMethods = require(Src.DataSources.DataSourceMethods)
local DataSources = require(Src.DataSources)
local Dimensions = require(Src.Dimensions)
local exhaustiveMatch = require(Src.Util.exhaustiveMatch)
local function binarySearchIndexRangeInView<T>(
... | 631 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/src/createVirtualizedListController/init.luau | luau | .luau | local Src = script:FindFirstAncestor("ultimate-list")
local DataSourceMethods = require(Src.DataSources.DataSourceMethods)
local DataSources = require(Src.DataSources)
local Dimensions = require(Src.Dimensions)
local DimensionsMethods = require(Src.Dimensions.DimensionsMethods)
local binarySearchIndexRangeInView = req... | 2,055 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/src/init.luau | luau | .luau | local Components = require(script.Components)
local DataSources = require(script.DataSources)
local DebugFlags = require(script.DebugFlags)
local Dimensions = require(script.Dimensions)
local Renderers = require(script.Renderers)
export type Dimensions<T> = Dimensions.Dimensions<T>
export type UDimRect = Dimensions.UD... | 182 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/BindingStateSideBySideStressTest.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
local function Demo()
... | 592 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/Demos/ChatDemo.story.luau | luau | .luau | -- An example of an efficient chat
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TextService = game:GetService("TextService")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStor... | 1,214 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/Demos/MultipleItems.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
type Item =
{
type: ... | 729 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayConsistentHeightBinding.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
return function(target)... | 327 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayConsistentHeightBindingStressTest.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
return function(target)... | 306 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayConsistentHeightState.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
return function(target)... | 297 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayConsistentHeightStateStressTest.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
return function(target)... | 290 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayConsistentHeightStateUpdates.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
local function Demo()
... | 386 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayConsistentHeightStateWithSpacing.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
return function(target)... | 309 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayConsistentUDim2Binding.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
return function(target)... | 331 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayConsistentUDim2State.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
return function(target)... | 315 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayConsistentUDim2StateWithSpacing.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
return function(target)... | 333 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayConsistentUDim2WithOffsetState.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
return function(target)... | 315 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayConsistentUDim2WithOffsetStateAndSpacing.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
return function(target)... | 333 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayConsistentWidthState.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
return function(target)... | 297 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayGetterDimensionsBinding.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
type Letter = {
text: ... | 477 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/ImmutableArrayGetterDimensionsState.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
local e = React.createElement
type Letter = {
text: ... | 454 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/MutableStateConsistentHeightState.story.luau | luau | .luau | local HttpService = game:GetService("HttpService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"])
loc... | 451 |
Kampfkarren/ultimate-list | Kampfkarren-ultimate-list-d166119/stories/StyledScrollingFrame.story.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StylingService = game:GetService("StylingService")
local React = require(ReplicatedStorage.Packages.React)
local ReactRoblox = require(ReplicatedStorage.DevPackages.ReactRoblox)
local UltimateList = require(ReplicatedStorage.Packages["ultimate-list"]... | 431 |
latte-soft/maui | latte-soft-maui-99e1d35/src/Tarmac/Assets.lua | luau | .lua | -- This file was @generated by Tarmac. It is not intended for manual editing.
return {
["MauiLogo-DarkMode"] = "rbxassetid://12558365376",
["MauiLogo-LightMode"] = "rbxassetid://12558365512",
} | 63 |
latte-soft/maui | latte-soft-maui-99e1d35/tests/CustomFlags/init.server.lua | luau | .lua | print("Should be running on the server, but we removed context checks via the flag!") | 18 |
latte-soft/maui | latte-soft-maui-99e1d35/tests/CustomPath/UsingFunction/.maui.lua | luau | .lua | return {
FormatVersion = 1,
Output = {
Directory = function()
return script.Parent
end,
ScriptName = "MauiGeneratedOutput"
}
} | 39 |
latte-soft/maui | latte-soft-maui-99e1d35/tests/CustomPath/UsingInstance/.maui.lua | luau | .lua | return {
FormatVersion = 1,
Output = {
Directory = script.Parent,
ScriptName = "MauiGeneratedOutput"
}
} | 32 |
latte-soft/maui | latte-soft-maui-99e1d35/tests/MainModuleBehavior/MainModule/init.lua | luau | .lua | return "Hello, from a Maui module!" | 9 |
latte-soft/maui | latte-soft-maui-99e1d35/tests/MainModuleBehavior/init.server.lua | luau | .lua | print(require(script.MainModulePacked)) | 8 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/.lute/build-rbxm.luau | luau | .luau | local process = require("@lute/process")
-- stylua: ignore
process.run(
"rojo",
{ "build", "--output", "fluid.rbxm" },
{ stdio = "forward" }
)
| 48 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/.lute/build-test-place.luau | luau | .luau | local process = require("@lute/process")
process.run("rojo", { "build", "roblox-tests.project.json", "--output", "test-file.rbxl" }, { stdio = "forward" })
| 45 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/.lute/dev.luau | luau | .luau | local process = require("@lute/process")
local task = require("@lute/task")
task.spawn(function()
process.run("rojo", {
"sourcemap",
"roblox-tests.project.json",
"--output",
"sourcemap.json",
"--watch",
"--include-non-scripts",
}, {
stdio = "forward",
})
end)
task.spawn(function()
-- stylua: ignore
... | 132 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/.lute/fuzz-test.luau | luau | .luau | require("@tests/").fuzz()
| 8 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/.lute/run-tests.luau | luau | .luau | local task = require("@lute/task")
local tests = require("@tests/").unit_tests
task.spawn(tests)
| 25 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/.lute/styling.luau | luau | .luau | local process = require("@lute/process")
local cmd = { "stylua", ".lute", "src", "tests" }
-- kinda cursed but, easiest way to do this.
table.insert(cmd, "--check")
local result = process.run(cmd, {
stdio = "inherit",
})
process.exit(result.exitcode)
| 67 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/anim/lerp.luau | luau | .luau | local graph = require("../reactive/graph")
local oklab = require("../utils/oklab")
local read = require("../utils/read")
local types = require("../reactive/types")
local active_animations = {}
local function vector_lerp(a: vector, b: vector, t: number): vector
return a + (b - a) * t
end
local function general_lerp(... | 637 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/anim/spring/coefficients.luau | luau | .luau | local function under_dampened(t: number, speed: number, damping: number): (number, number, number, number)
local alpha = speed * math.sqrt(1 - damping ^ 2)
local over_alpha = 1 / alpha
local exp = math.exp(-1 * t * speed * damping)
local exp_sin = exp * math.sin(alpha * t)
local exp_cos = exp * math.cos(alpha * t)... | 547 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/anim/spring/spring_file.luau | luau | .luau | local coefficients = require("./coefficients")
local graph = require("../../reactive/graph")
local oklab = require("../../utils/oklab")
local read = require("../../utils/read")
local types = require("../../reactive/types")
local SLEEP_VELOCITY = 1e-3
local SLEEP_DISTANCE = 1e-5
type AnimatableDataTypeEnum = "color" |... | 1,596 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/init.luau | luau | .luau | local action = require("@self/instances/action")
local async = require("@self/reactive/async")
local bind = require("@self/instances/bind")
local changed = require("@self/instances/changed")
local cleanup = require("@self/reactive/cleanup")
local create = require("@self/instances/create")
local deferred = require("@sel... | 679 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/instances/action.luau | luau | .luau | local action_metatable_symbol = table.freeze({})
export type Identity = {
callback: (inst: Instance) -> (),
__ACTION_SYMBOL: {},
}
local action = {
symbol = action_metatable_symbol,
}
function action.is_action(action): boolean
return type(action) == "table" and action.__ACTION_SYMBOL ~= nil
end
function action... | 111 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/instances/bind.luau | luau | .luau | local action = require("./action")
local graph = require("../reactive/graph")
local types = require("../reactive/types")
local function set_property(inst: Instance, property: string, value: any)
(inst :: any)[property] = value
end
local function get_property(inst: Instance, property: string): any
return (inst :: an... | 851 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/instances/changed.luau | luau | .luau | local action = require("./action")
local graph = require("../reactive/graph")
local function changed(property: string, fn: (any) -> ())
return action.create(function(instance: Instance)
fn((instance :: any)[property])
local con = instance:GetPropertyChangedSignal(property):Connect(function()
fn((instance :: a... | 97 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/instances/create.luau | luau | .luau | local action = require("./action")
local bind = require("./bind")
type Instances = {
PyramidHandleAdornment: PyramidHandleAdornment,
AudioChannelSplitter: AudioChannelSplitter,
AudioPitchShifter: AudioPitchShifter,
AudioDeviceOutput: AudioDeviceOutput,
AudioChannelMixer: AudioChannelMixer,
AudioTextToSpeech: Aud... | 1,509 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/instances/for_keys.luau | luau | .luau | local graph = require("../reactive/graph")
local read = require("../utils/read")
local scheduler = require("../scheduler")
local types = require("../reactive/types")
local function indexes<K, VI, VO>(
input: types.UsedAs<{ read [K]: VI }>,
transform: (() -> VI, K, active: types.Readable<boolean>) -> (VO, number?)
):... | 1,000 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/instances/for_values.luau | luau | .luau | local graph = require("../reactive/graph")
local read = require("../utils/read")
local scheduler = require("../scheduler")
local types = require("../reactive/types")
local function values<V, KI, KO>(
input: types.UsedAs<{ read [KI]: V }>,
transform: (
value: V,
key: () -> KI,
active: types.Readable<boolean>
)... | 1,078 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/instances/mount.luau | luau | .luau | local bind = require("./bind")
local root = require("../reactive/root")
local function mount(fn: () -> { [any]: any }, inst: Instance): () -> ()
return root(function()
bind(inst, {
fn(),
})
end)
end
return mount
| 59 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/logging.luau | luau | .luau | --!optimize 1
local dev_mode = true
local function format(text: string): string
return (string.format("[fluid]: %*", text))
end
local function warn_facade(text: string)
(warn or print)(text)
end
local logging = {
__warn_facade = warn_facade,
errors = {},
}
function logging.fmt(text: string): string
return for... | 656 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/reactive/async.luau | luau | .luau | local graph = require("./graph")
local logging = require("../logging")
local scheduler = require("../scheduler")
local task = task or require("@lute/task")
type State = "busy" | "ok"
--[[
async nodes creates a source node for the latest valid value and for the state.
it also creates a reactive node which spawns a new... | 417 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/reactive/cleanup.luau | luau | .luau | local graph = require("./graph")
local get_scope = graph.get_scope
local push_cleanup = graph.push_cleanup
local function helper(obj: any)
return if typeof(obj) == "RBXScriptConnection"
then function()
obj:Disconnect()
end
elseif type(obj) == "thread" then function()
task.cancel(obj)
end
elseif typeof... | 337 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/reactive/deferred.luau | luau | .luau | local graph = require("./graph")
local types = require("./types")
local function deferred<T>(callback: types.Effect<T>, initial_value: T)
local node = graph.create_reactive_node(graph.assert_stable_parent(), callback, "deferred", initial_value)
graph.evaluate_node(node)
end
-- cover effect(function() end) and effe... | 110 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/reactive/derive.luau | luau | .luau | local graph = require("./graph")
local types = require("./types")
local function derive<T>(source: types.Effect<T>): types.Readable<T>
local node = graph.create_reactive_node(graph.assert_stable_parent(), source, "lazy")
local function evaluate()
return graph.evaluate_node(node)
end
return evaluate
end
return... | 71 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/reactive/effect.luau | luau | .luau | local graph = require("./graph")
local types = require("./types")
local function effect<T>(callback: types.Effect<T>, initial_value: T)
local node = graph.create_reactive_node(graph.assert_stable_parent(), callback, "eager", initial_value)
graph.evaluate_node(node)
end
-- cover effect(function() end) and effect(fu... | 110 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/reactive/graph.luau | luau | .luau | local exception = require("../utils/exception")
local logging = require("../logging")
local reactive_fn_calls = require("../utils/reactive_fn_calls")
local scheduler = require("../scheduler")
local types = require("./types")
local dev_mode = true
local deferred_thread: thread? = nil
local pending_eval: { ReactiveNode<... | 3,062 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/reactive/root.luau | luau | .luau | local graph = require("./graph")
local types = require("./types")
local refs: { [graph.Node<any>]: true? } = {}
local function root<T...>(fn: (destroy: types.Cleanup) -> T...): (types.Cleanup, T...)
local node = graph.create_stable_node(graph.get_scope())
-- prevent gc of root node
refs[node] = true
local funct... | 188 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/reactive/source.luau | luau | .luau | local graph = require("./graph")
local types = require("./types")
local function get_argument_from<T>(...: T): (boolean, T)
if select("#", ...) == 0 then
return false, nil
end
local first_value = ...
return true, first_value
end
local function source<T>(initial_value: T): types.Source<T>
local node = graph.cr... | 209 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/reactive/types.luau | luau | .luau | export type Readable<T> = () -> T
export type Callable<T> = (value: T) -> ()
export type Effect<T> = (value: T) -> T
export type Source<T> = ((T) -> T) & Readable<T>
export type UsedAs<T> = T | Readable<T>
export type Cleanup = () -> ()
return nil
| 78 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/reactive/untrack.luau | luau | .luau | local graph = require("./graph")
local function untrack<T>(source: () -> T): T
local scope = graph.get_scope()
if (not scope) or (scope and not scope.effect) then
return source()
end
-- temporarily unbind effect
local effect = scope.effect
scope.effect = false :: any
local value = source()
scope.effect = ... | 88 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/scheduler.luau | luau | .luau | local task = (task or require("@lute/task")) :: typeof(task)
type RenderCallback = (delta_time: number) -> ()
local cancel = task.cancel or coroutine.close
local connections: { RenderCallback } = {}
local scheduler = {
connections = connections,
}
function scheduler.step(delta_time: number)
for _, callback in co... | 227 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/utils/exception.luau | luau | .luau | export type YieldException = {
kind: "yielded",
trace: string,
}
export type FluidException = {
kind: "fluid",
trace: string,
}
export type InvokedException = {
kind: "invoked",
err: string,
trace: string,
}
export type UncaughtException = {
kind: "uncaught",
err: string,
trace: string,
}
export type ... | 153 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/utils/interval.luau | luau | .luau | local exception = require("./exception")
local graph = require("../reactive/graph")
local logging = require("../logging")
local reactive_fn_calls = require("./reactive_fn_calls")
local scheduler = require("../scheduler")
local function interval_err_handler(err: unknown): exception.Identity
if exception.is(err) then
... | 727 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/utils/oklab.luau | luau | .luau | local X_CONST = vector.create(0.4122214708, 0.5363325363, 0.0514459929)
local Y_CONST = vector.create(0.2119034982, 0.6806995451, 0.1073969566)
local Z_CONST = vector.create(0.0883024619, 0.2817188376, 0.6299787005)
local oklab = {}
function oklab.from_srgb(color: vector): vector
local l = vector.dot(color, X_CONST)... | 506 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/utils/reactive_fn_calls.luau | luau | .luau | local exception = require("./exception")
local scheduler = require("../scheduler")
local reactive_fn_calls = {}
function reactive_fn_calls.no_yield_call<U..., T...>(
func: (T...) -> U...,
err_handler: (unknown) -> exception.Identity,
yield_handler: (thread) -> exception.Identity,
...: T...
): (boolean, U...)
loc... | 212 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/utils/read.luau | luau | .luau | export type function CastIntoValue(value: type)
local function get_return_for_fn(t: type)
local values = t:returns()
local head = values.head
local tail = values.tail
if head then
local first = head[1]
return first
elseif tail then
return tail
else
return types.singleton(nil)
end
end
if v... | 284 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/utils/show.luau | luau | .luau | local derive = require("../reactive/derive")
local read = require("./read")
local types = require("../reactive/types")
local untrack = require("../reactive/untrack")
local function show<T, U>(condition: () -> any, truthy: types.UsedAs<T>, falsy: types.UsedAs<U>?): () -> T | U
return derive(function()
if condition()... | 209 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/utils/show_delay.luau | luau | .luau | local reat = require("./read")
local switch_delay = require("./switch_delay")
local types = require("../reactive/types")
local function show<T, U>(
condition: () -> any,
truthy: (active: types.Readable<boolean>) -> (T, number?),
falsy: ((active: types.Readable<boolean>) -> (U, number?))?
): () -> { T | U }
return ... | 196 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/utils/switch.luau | luau | .luau | local derive = require("../reactive/derive")
local read = require("./read")
local types = require("../reactive/types")
local untrack = require("../reactive/untrack")
local function switch<T, U>(condition: () -> T)
return function(options: { [T]: types.UsedAs<U> }): () -> read.CastIntoValue<U>?
return derive(functio... | 129 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/utils/switch_delay.luau | luau | .luau | local derive = require("../reactive/derive")
local graph = require("../reactive/graph")
local scheduler = require("../scheduler")
local types = require("../reactive/types")
type Condition<T> = (types.Readable<boolean>) -> (T, number?)
type SwitchGraph<Result> = {
previous_effect: Condition<Result>?,
scopes: { [Cond... | 871 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/src/utils/tags.luau | luau | .luau | local action = require("../instances/action")
local cleanup = require("../reactive/cleanup")
local graph = require("../reactive/graph")
local function bind_tag(instance: Instance, tag: string)
instance:AddTag(tag)
cleanup(function()
instance:RemoveTag(tag)
end)
end
local function tags(tags: { string | () -> str... | 169 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/tests/fuzz_tests/colors.fuzz.luau | luau | .luau | local oklab = require("@src/utils/oklab")
local function within(epsilon: number)
return function(value1: vector, value2: vector): boolean
return vector.magnitude(value1 - value2) <= epsilon
end
end
local colors_within = within(0.01)
local function oklab_fuzz()
for r = 1, 256 do
for g = 1, 256 do
for b = 1,... | 151 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/tests/hooks/init.luau | luau | .luau | --[[
hooks to improve developer experience
]]
return {
scheduler = require("@self/scheduler"),
logging = require("@self/logging"),
}
| 29 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/tests/hooks/logging.luau | luau | .luau | --[[
hook onto when fluid warns
used if you wanna catch a logging.warn/logging.warn_supressed this will allow you to hook onto that
]]
local logging = require("@src/logging")
type OnWarn = (text: string) -> ()
-- user callback for when fluid warns to the stdio
-- if nothing is specified, fluid will output to the st... | 269 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/tests/hooks/scheduler.luau | luau | .luau | --[[
hooks wait/delay in fluid
this allows you to timeskip forward in tests
]]
local fluid = require("@src")
local logging = require("@src/logging")
local task = require("@lute/task")
local scheduler_interface = fluid.__SCHEDULER_INTERFACE
local step_fluid = fluid.provide_scheduler()
local step_tick = 0
local wait... | 501 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/tests/init.luau | luau | .luau | local _, _, _, FINISH = require("@vendor/testkit").test()
local function call_tests(fn: () -> ())
xpcall(fn, function(err)
print(debug.traceback(tostring(err)))
end)
end
local tests = {}
function tests.fuzz()
require("@self/fuzz_tests/colors.fuzz")()
end
function tests.unit_tests()
require("@self/unit_tests/l... | 166 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/tests/roblox_tests/client/creating_instances.client.luau | luau | .luau | local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TextService = game:GetService("TextService")
local fluid = require(ReplicatedStorage.fluid)
local random_words = fluid.source({ "hi", "bye", "meow", "mrrp" })
local function label()
return fluid.create("T... | 910 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/tests/roblox_tests/client/inbetween_state.client.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local fluid = require(ReplicatedStorage.fluid)
local create = fluid.create
local scale = UDim2.fromScale
local px = UDim2.fromOffset
fluid.mount(function()
local color = fluid.source(Color3.new())
local size = fluid.source(px(60, 60))
fluid.effect(fu... | 270 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/tests/roblox_tests/client/show.client.luau | luau | .luau | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local fluid = require(ReplicatedStorage.fluid)
local mount = fluid.mount
local source = fluid.source
local show = fluid.show
local show_delay = fluid.show_delay
local create = fluid.create
local scale = UDim2.fromScale
local px = UDim2.fromOffset
mount(f... | 589 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/tests/roblox_tests/client/show_delay.client.luau | luau | .luau | local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TextService = game:GetService("TextService")
local fluid = require(ReplicatedStorage.fluid)
local function main()
local active = fluid.source(false)
return fluid.create("ScreenGui" :: "ScreenGui")({
fl... | 251 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/tests/roblox_tests/client/springs.client.luau | luau | .luau | local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local fluid = require(ReplicatedStorage.fluid)
local create = fluid.create
local mount = fluid.mount
local parent_screen = create("ScreenGui")({
Name = "ParentScreen",
ResetOnSpawn = false,
Parent = Players.Lo... | 272 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/tests/roblox_tests/client/testing_delay.client.luau | luau | .luau | local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local fluid = require(ReplicatedStorage.fluid)
local create = fluid.create
local keys = fluid.for_keys
local mount = fluid.mount
local source = fluid.source
local parent_screen = create("ScreenGui")({
Name = "Pa... | 253 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/types/globals.d.luau | luau | .luau | declare _G: {
__DEV__: boolean?
} | 12 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/vendor/signal.luau | luau | .luau | --!optimize 2
--!native
local task = task or require("@lute/task")
local tspawn = task.spawn
local cyield = coroutine.yield
local freeThread: thread? = nil
local function deletedSignalError()
error("Cannot fire a deleted signal", 2)
end
local errorTable = {
fire = deletedSignalError,
connect = deletedSignalError... | 1,341 |
ffrostfall/fluid | ffrostfall-fluid-a93f33a/vendor/testkit.luau | luau | .luau | --!nocheck
--!nolint
-------------------------------------------------------------------------------
-- testkit.luau
-- v0.7.3
--------------------------------------------------------------------------------
local color = {
white_underline = function(s: string)
return `\27[1;4m{s}\27[0m`
end,
white = function(s... | 2,796 |
Roblox/jest-roblox | Roblox-jest-roblox-ba9d684/.config.luau | luau | .luau | return {
luau = {
languagemode = "strict",
lint = {
["*"] = true,
-- Luau has no first-class type-narrowing syntax. The idiomatic
-- workaround is to shadow the outer name with a narrower
-- binding inside a runtime-checked branch, as in
-- src/jest-mock/src/init.lua:
--
-- local object:... | 146 |
Roblox/jest-roblox | Roblox-jest-roblox-ba9d684/.lute/analyze.luau | luau | .luau | local fs = require("@std/fs")
local run = require("./utils/run")
print("Running static analysis...")
-- The Roblox API definitions are committed rather than fetched per run; see
-- .lute/update-types.luau for what they are and when to refresh them. Checked
-- up front so a fresh clone doesn't wait through an install ... | 652 |
Roblox/jest-roblox | Roblox-jest-roblox-ba9d684/.lute/utils/patchErrorPolyfill.luau | luau | .luau | local fs = require("@std/fs")
local OPTIMIZE_DIRECTIVE = "--!optimize 1"
-- Prepend `--!optimize 1` to `path` if not already present. The directive is
-- a performance hint, not a correctness requirement — if the file doesn't
-- exist (e.g. LuauPolyfill was installed under a different layout than the
-- caller expect... | 218 |
Roblox/jest-roblox | Roblox-jest-roblox-ba9d684/.lute/utils/run.luau | luau | .luau | local process = require("@lute/process")
return function(cmd)
print(`> {table.concat(cmd, " ")}`)
local ok, result = pcall(function()
return process.run(cmd, { stdio = "inherit", env = { PATH = `{process.cwd()}:{process.env.PATH}` } })
end)
if not ok then
error(result)
end
if result.ok then
print(result... | 110 |
Roblox/jest-roblox | Roblox-jest-roblox-ba9d684/DevLinks/ChalkLua.lua | luau | .lua | return require(script.Parent.Parent.ChalkLua)
| 9 |
Roblox/jest-roblox | Roblox-jest-roblox-ba9d684/DevLinks/JestConfig.lua | luau | .lua | return require(script.Parent.Parent.JestConfig)
| 9 |
Roblox/jest-roblox | Roblox-jest-roblox-ba9d684/DevLinks/JestEnvironmentLuau.lua | luau | .lua | return require(script.Parent.Parent.JestEnvironmentLuau)
| 11 |
Roblox/jest-roblox | Roblox-jest-roblox-ba9d684/DevLinks/JestGlobals.lua | luau | .lua | local REQUIRED_MODULE = require(script.Parent.Parent.JestGlobals)
export type MatcherState = REQUIRED_MODULE.MatcherState
export type ExpectExtended<E, State = MatcherState> = REQUIRED_MODULE.ExpectExtended<E, State >
return REQUIRED_MODULE
| 46 |
Roblox/jest-roblox | Roblox-jest-roblox-ba9d684/DevLinks/JestMock.lua | luau | .lua | local REQUIRED_MODULE = require(script.Parent.Parent.JestMock)
export type MaybeMockedDeep<T> = REQUIRED_MODULE.MaybeMockedDeep<T>
export type MaybeMocked<T> = REQUIRED_MODULE.MaybeMocked<T>
export type UnknownFunction = REQUIRED_MODULE.UnknownFunction
export type Mock<T = UnknownFunction> = REQUIRED_MODULE.Mock<T >
e... | 127 |
Roblox/jest-roblox | Roblox-jest-roblox-ba9d684/DevLinks/JestSnapshotSerializerRaw.lua | luau | .lua | local REQUIRED_MODULE = require(script.Parent.Parent.JestSnapshotSerializerRaw)
export type Wrapper = REQUIRED_MODULE.Wrapper
return REQUIRED_MODULE
| 27 |
Roblox/jest-roblox | Roblox-jest-roblox-ba9d684/DevLinks/PrettyFormat.lua | luau | .lua | local REQUIRED_MODULE = require(script.Parent.Parent.PrettyFormat)
export type Colors = REQUIRED_MODULE.Colors
export type CompareKeys = REQUIRED_MODULE.CompareKeys
export type Config = REQUIRED_MODULE.Config
export type Options = REQUIRED_MODULE.Options
export type OptionsReceived = REQUIRED_MODULE.OptionsReceived... | 139 |
Roblox/jest-roblox | Roblox-jest-roblox-ba9d684/DevLinks/Promise.lua | luau | .lua | return require(script.Parent.Parent.Promise)
| 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.