repo
stringclasses
350 values
file_path
stringlengths
29
200
language
stringclasses
2 values
file_type
stringclasses
4 values
code
stringlengths
2
1.01M
tokens
int64
2
598k
matter-ecs/matter
matter-ecs-matter-f31981b/example/src/shared/components.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Matter = require(ReplicatedStorage.Lib.Matter) local COMPONENTS = { "Roomba", "Model", "Charge", "Health", "Target", "Transform", "Mothership", "Lasering", "DebugLabel", "Spinner", } local components = {} for _, name in ipairs(COMPONENTS)...
106
matter-ecs/matter
matter-ecs-matter-f31981b/example/src/shared/start.luau
luau
.luau
local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Packages = ReplicatedStorage.Packages local Matter = require(ReplicatedStorage.Lib.Matter) local Plasma = require(Packages.plasma) local HotR...
572
matter-ecs/matter
matter-ecs-matter-f31981b/example/src/shared/systems/updateModelAttribute.luau
luau
.luau
local RunService = game:GetService("RunService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Components = require(ReplicatedStorage.Shared.components) local name = RunService:IsServer() and "serverEntityId" or "clientEntityId" local function updateModelAttribute(world) for id, record in worl...
103
matter-ecs/matter
matter-ecs-matter-f31981b/lib/Archetype.luau
luau
.luau
export type EntityId = number export type ComponentId = number export type ComponentIds = { ComponentId } export type Component = { [any]: any } export type ComponentInstance = { [any]: any } export type ArchetypeId = string export type Archetype = { entities: { EntityId }, componentIds: { ComponentId }, idToIndex...
278
matter-ecs/matter
matter-ecs-matter-f31981b/lib/Loop.luau
luau
.luau
local RunService = game:GetService("RunService") local World = require(script.Parent.World) local rollingAverage = require(script.Parent.rollingAverage) local topoRuntime = require(script.Parent.topoRuntime) local recentErrors = {} local recentErrorLastTime = 0 local systemNames: { [any]: string } = {} local functi...
3,852
matter-ecs/matter
matter-ecs-matter-f31981b/lib/Queue.luau
luau
.luau
local Queue = {} Queue.__index = Queue function Queue.new() return setmetatable({ _head = nil, _tail = nil, }, Queue) end function Queue:pushBack(value) local entry = { value = value, next = nil, } if self._tail ~= nil then self._tail.next = entry end self._tail = entry if self._head == nil then ...
147
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/EventBridge.luau
luau
.luau
local RunService = game:GetService("RunService") local EventBridge = {} EventBridge.__index = EventBridge local debouncedEvents = { InputChanged = true, } local debounce = {} local function serialize(...) local first = ... if first and typeof(first) == "Instance" and first:IsA("InputObject") then return { D...
1,121
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/clientBindings.luau
luau
.luau
local UserInputService = game:GetService("UserInputService") local CollectionService = game:GetService("CollectionService") local tags = { system = "MatterDebuggerTooltip_System", altHover = "MatterDebuggerTooltip_AltHover", } local function getOffset(mousePos: Vector2, tag: string): UDim2 if tag == tags.altHover ...
370
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/formatTable.luau
luau
.luau
local stringColor = "#dcdcaa" local numberColor = "#b0c4de" local keywordColor = "#c586c0" local dimmedColor = "#808080" function colorize(value, color) if type(value) == "number" then value = string.format("%.1f", value) end return `<font color="{color}">{value}</font>` end function colorizeMany(color, ...) l...
1,158
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/getAllComponentData.luau
luau
.luau
local function getAllComponentData(world, entity: number): { [{ [any]: any }]: { [any]: any } } local componentToData = {} local location = world.allEntities[entity] local archetype = location.archetype local indexInArchetype = location.indexInArchetype for index, field in archetype.fields do local componentId...
126
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/hookWidgets.luau
luau
.luau
local useCurrentSystem = require(script.Parent.Parent.topoRuntime).useCurrentSystem local widgets = { "arrow", "blur", "button", "checkbox", "error", "portal", "row", "slider", "spinner", "window", "label", "heading", "space", "table", } local dummyHandles = { checkbox = { clicked = function() ret...
454
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/mouseHighlight.luau
luau
.luau
local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local defaultRaycastParams = RaycastParams.new() defaultRaycastParams.IgnoreWater = true function getInstanceOnMouse(params: RaycastParams) local camera = workspace.CurrentCamera if not camera then return...
479
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/ui.luau
luau
.luau
local RunService = game:GetService("RunService") local rollingAverage = require(script.Parent.Parent.rollingAverage) local World = require(script.Parent.Parent.World) local function systemName(system) local systemFn = if type(system) == "table" then system.system else system local name = debug.info(systemFn, "n") ...
2,369
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/widgets/codeText.luau
luau
.luau
return function(Plasma) local create = Plasma.create return Plasma.widget(function(text, options) options = options or {} local refs = Plasma.useInstance(function(ref) return create("TextButton", { [ref] = "label", BackgroundTransparency = 1, Text = "", AutomaticSize = Enum.AutomaticSize.Y, ...
252
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/widgets/container.luau
luau
.luau
return function(Plasma) local create = Plasma.create return Plasma.widget(function(fn, options) options = options or {} local padding = options.padding or 5 local refs = Plasma.useInstance(function(ref) return create("Frame", { [ref] = "frame", BackgroundTransparency = 1, Position = UDim2.new(...
234
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/widgets/errorInspect.luau
luau
.luau
return function(plasma) return plasma.widget(function(debugger, custom) local loop = debugger.loop plasma.window("\xf0\x9f\x92\xa5 Errors", function() local text, setText = plasma.useState("") custom.codeText(text) local items = {} for index, errorData in loop._systemErrors[debugger.debugSystem] do ...
267
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/widgets/frame.luau
luau
.luau
return function(Plasma) return Plasma.widget(function() local refs = Plasma.useInstance(function(ref) local style = Plasma.useStyle() local Frame = Instance.new("Frame") Frame.BackgroundColor3 = style.bg2 Frame.Position = UDim2.new(0.5, 0, 0.5, 0) Frame.AnchorPoint = Vector2.new(0.5, 0.5) Frame.Si...
367
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/widgets/hoverInspect.luau
luau
.luau
local formatTableModule = require(script.Parent.Parent.formatTable) local getAllComponentData = require(script.Parent.Parent.getAllComponentData) local formatTable = formatTableModule.formatTable local FormatMode = formatTableModule.FormatMode return function(plasma) return plasma.widget(function(world, id, custom) ...
200
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/widgets/link.luau
luau
.luau
return function(Plasma) local create = Plasma.create return Plasma.widget(function(text, options) options = options or {} local clicked, setClicked = Plasma.useState(false) local style = Plasma.useStyle() local refs = Plasma.useInstance(function(ref) local colorHover = style.textColor local darker =...
619
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/widgets/panel.luau
luau
.luau
return function(Plasma) local create = Plasma.create return Plasma.widget(function(children, options) options = options or {} Plasma.useInstance(function() local style = Plasma.useStyle() local frame = create("Frame", { Name = "Panel", BackgroundColor3 = style.bg2, Position = UDim2.new(0, 0, 0...
520
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/widgets/realmSwitch.luau
luau
.luau
local CollectionService = game:GetService("CollectionService") return function(Plasma) local create = Plasma.create return Plasma.widget(function(options) local style = Plasma.useStyle() options = options or {} local left = options.left local right = options.right local isRight = options.isRight local...
575
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/widgets/selectionList.luau
luau
.luau
return function(Plasma) local create = Plasma.create local Item = Plasma.widget(function(text, selected, icon, sideText, barWidth, index) local clicked, setClicked = Plasma.useState(false) local rightClicked, setRightClicked = Plasma.useState(false) local hovered, setHovered = Plasma.useState(false) local st...
1,549
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/widgets/tooltip.luau
luau
.luau
local CollectionService = game:GetService("CollectionService") type Options = { tag: string, backgroundTransparency: number?, } return function(plasma) local create = plasma.create return plasma.widget(function(text, options: Options) local refs = plasma.useInstance(function(ref) local style = plasma.useSty...
337
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/widgets/valueInspect.luau
luau
.luau
local formatTableModule = require(script.Parent.Parent.formatTable) local formatTable = formatTableModule.formatTable return function(plasma) return plasma.widget(function(objectStack, custom) local closed = plasma .window({ title = "Inspect", closable = true, }, function() plasma.row({ padding = ...
432
matter-ecs/matter
matter-ecs-matter-f31981b/lib/debugger/widgets/worldInspect.luau
luau
.luau
local formatTableModule = require(script.Parent.Parent.formatTable) local getAllComponentData = require(script.Parent.Parent.getAllComponentData) local formatTable = formatTableModule.formatTable local BY_COMPONENT_NAME = "ComponentName" local BY_ENTITY_COUNT = "EntityCount" return function(plasma) return plasma.wid...
1,325
matter-ecs/matter
matter-ecs-matter-f31981b/lib/hooks/log.luau
luau
.luau
local topoRuntime = require(script.Parent.Parent.topoRuntime) local format = require(script.Parent.Parent.debugger.formatTable) --[=[ @within Matter :::info Topologically-aware function This function is only usable if called within the context of [`Loop:begin`](/api/Loop#begin). ::: @param ... any Logs some t...
212
matter-ecs/matter
matter-ecs-matter-f31981b/lib/hooks/useDeltaTime.luau
luau
.luau
local topoRuntime = require(script.Parent.Parent.topoRuntime) --[=[ @within Matter :::info Topologically-aware function This function is only usable if called within the context of [`Loop:begin`](/api/Loop#begin). ::: Returns the `os.clock()` time delta between the start of this and last frame. ]=] local functi...
99
matter-ecs/matter
matter-ecs-matter-f31981b/lib/hooks/useEvent.luau
luau
.luau
local topoRuntime = require(script.Parent.Parent.topoRuntime) local Queue = require(script.Parent.Parent.Queue) local EVENT_CONNECT_METHODS = { "Connect", "on", "connect" } local CONNECTION_DISCONNECT_METHODS = { "Disconnect", "Destroy", "disconnect", "destroy" } local function connect(object, callback, event) local...
1,389
matter-ecs/matter
matter-ecs-matter-f31981b/lib/hooks/useThrottle.luau
luau
.luau
local topoRuntime = require(script.Parent.Parent.topoRuntime) local function cleanup(storage) return os.clock() < storage.expiry end --[=[ @within Matter :::info Topologically-aware function This function is only usable if called within the context of [`Loop:begin`](/api/Loop#begin). ::: Utility for easy time...
374
matter-ecs/matter
matter-ecs-matter-f31981b/lib/init.luau
luau
.luau
--[=[ @class Matter Matter. It's what everything is made out of. ]=] --[=[ @within Matter @prop World World ]=] --[=[ @within Matter @prop Loop Loop ]=] --[=[ @within Matter @prop Debugger Debugger ]=] --[=[ @within Matter @prop None None A value should be interpreted as nil when merging dictionaries. ...
467
matter-ecs/matter
matter-ecs-matter-f31981b/lib/rollingAverage.luau
luau
.luau
local MAX_SAMPLES = 60 local function addSample(samples, value) samples[samples.index or 1] = value samples.index = if samples.index then (samples.index % MAX_SAMPLES) + 1 else 1 end local function getAverage(samples) local sum = 0 for i = 1, #samples do sum += samples[i] end return sum / #samples end retu...
104
matter-ecs/matter
matter-ecs-matter-f31981b/lib/topoRuntime.luau
luau
.luau
local stack = {} local function newStackFrame(node) return { node = node, accessedKeys = {}, } end local function cleanup() local currentFrame = stack[#stack] for baseKey, state in pairs(currentFrame.node.system) do for key, value in pairs(state.storage) do if not currentFrame.accessedKeys[baseKey] or n...
1,192
matter-ecs/matter
matter-ecs-matter-f31981b/tests.server.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") require(ReplicatedStorage.TestEZ).TestBootstrap:run({ ReplicatedStorage.Matter, nil, { noXpcallByDefault = true, }, })
50
matter-ecs/matter
matter-ecs-matter-f31981b/tests/stressTest.client.luau
luau
.luau
local RunService = game:GetService("RunService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Matter = require(ReplicatedStorage.Matter) local immutable = require(ReplicatedStorage.Matter.immutable) -- 500 entities -- 2-30 components on each entity -- 300 unique components -- 200 systems -- 1-1...
761
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/.lune/build-rbxm.luau
luau
.luau
local process = require("@lune/process") process.exec("rojo", { "build", "--output", "crunchyroll.rbxm" }, { stdio = "forward" })
40
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/.lune/clone-mirrors.luau
luau
.luau
local fs = require("@lune/fs") local process = require("@lune/process") local serde = require("@lune/serde") local mirror_configs = fs.readDir("./benches/mirror_list") -- thank you nick from lute local function get_git_version(): { major: number, minor: number, path: number } local git_ver_string = process.exec("git...
557
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/.lune/dev.luau
luau
.luau
local process = require("@lune/process") local task = require("@lune/task") task.spawn(function() process.exec("rojo", { "sourcemap", "roblox-tests.project.json", "--output", "sourcemap.json", "--watch", "--include-non-scripts", }, { stdio = "forward", }) end) task.spawn(function() process.exec("roj...
116
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/.lune/styling.luau
luau
.luau
local process = require("@lune/process") local directories = { ".lune", "src", "tests" } -- kinda cursed but, easiest way to do this. table.insert(directories, "--check") local result = process.exec("stylua", directories, { stdio = "forward", }) process.exit(result.code)
68
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/.lune/test.luau
luau
.luau
require("@tests/").unit_tests()
8
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/benches/create_bench.luau
luau
.luau
export type Profiler = { Begin: (label: string) -> (), stop: () -> () } local function create_bench<T...>( parameter_generator: () -> T..., bench_table: { [string]: (profiler: Profiler, T...) -> (), } ): any return { Functions = bench_table, ParameterGenerator = parameter_generator, } end return create_ben...
89
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/benches/create_entry.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local create_bench = require(ReplicatedStorage.benches.create_bench) local rig_template = require(ReplicatedStorage.client.rig) :: any local SAMPLES = 500 local ANIMATION_TEMPLATE = ReplicatedStorage.benches.assets.orange_justice type Rig = { __symbol: "...
363
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/benches/solver.bench.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local create_bench = require(ReplicatedStorage.benches.create_bench) local create_entry = require(ReplicatedStorage.benches.create_entry) type Crunchyroll = create_entry.Crunchyroll local entries = { latest = create_entry(require(ReplicatedStorage.crunc...
176
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/src/animation_solver.luau
luau
.luau
local animation_asset = require("./roblox/animation_asset") local create_rig = require("./rig") export type AnimationTrack = { -- 0-1 alpha: number, -- 0-1 start_fade_time: number, stop_fade_time: number, weight: number, -- arbitrary number priority: number, } local function quat_dot(a_vector: vector, a_sca...
1,439
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/src/easings.luau
luau
.luau
--!native local function linear(value: number): number return value end local function cubic_in(alpha: number): number return alpha ^ 3 end local function cubic_out(alpha: number): number return 1 - ((1 - alpha) ^ 3) end local function cubic_in_out(alpha: number): number if alpha < 0.5 then return 4 * (alpha ^...
1,286
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/src/init.luau
luau
.luau
local animation_asset = require("@self/roblox/animation_asset") local animation_solver = require("@self/animation_solver") local rig = require("@self/rig") --[=[ @class Crunchyroll The root module. ]=] --[=[ @function load_keyframe_sequence @within Crunchyroll Load a keyframe sequence from Roblox. This will ...
579
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/src/rig.luau
luau
.luau
export type LimbInfo = { c0: CFrame, c1: CFrame, name: string, children: { LimbInfo }?, } export type Limb = { name: string, c0: CFrame, c1: CFrame, depends_on: string, } export type LimbTransform = { priority: number, position: vector, quat_vector: vector, quat_scalar: number, } export type Identity = {...
462
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/src/roblox/animation_asset.luau
luau
.luau
local easing = require("../easings") local easing_enum_map = require("./easing_enum_map") local rig = require("../rig") export type PoseNode = { position: vector, quat_vector: vector, quat_scalar: number, easing_function: (alpha: number) -> number, } --- [1] = previous keyframe index --- [2] = (next keyframe inde...
1,274
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/src/roblox/easing_enum_map.luau
luau
.luau
local Enum = Enum or (require("@lune/roblox").Enum :: any) :: typeof(Enum) local easings = require("../easings") local EASING_IN = Enum.PoseEasingDirection.In local EASING_OUT = Enum.PoseEasingDirection.Out local EASING_IN_OUT = Enum.PoseEasingDirection.InOut local LINEAR = Enum.PoseEasingStyle.Linear local CUBIC = ...
396
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/tests/init.luau
luau
.luau
local tests = {} function tests.unit_tests() require("@self/unit_tests/fade_time.spec") end return tests
24
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/tests/roblox/client/rig.luau
luau
.luau
return { name = "HumanoidRootPart", c0 = CFrame.identity, c1 = CFrame.identity, children = { { name = "Torso", c0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0), c1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0), children = { { name = "Head", c0 = CFrame.new(0, 1, 0, -1, 0, 0, ...
685
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/tests/roblox/client/runner.client.luau
luau
.luau
local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider") local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local crunchyroll = require(ReplicatedStorage.crunchyroll) local rig_template = require("./rig") :: any local TEST_TRANSFORM = CF...
1,278
ffrostfall/crunchyroll
ffrostfall-crunchyroll-736bdb0/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
nezuo/lapis
nezuo-lapis-e217a22/examples/developer-product-handling/src/server/init.server.luau
luau
.luau
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Lapis = require(ReplicatedStorage.Packages.Lapis) local Sift = require(ReplicatedStorage.Packages.Sift) local t = require(ReplicatedStorage.Pa...
811
nezuo/lapis
nezuo-lapis-e217a22/examples/player-data/src/server/init.server.luau
luau
.luau
local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Lapis = require(ReplicatedStorage.Packages.Lapis) local t = require(ReplicatedStorage.Packages.t) local DEFAULT_DATA = { coins = 100 } local collection = Lapis.createCollection("PlayerData", { defaultData...
394
nezuo/lapis
nezuo-lapis-e217a22/src/AutoSave.luau
luau
.luau
local RunService = game:GetService("RunService") local Promise = require(script.Parent.Parent.Promise) local UPDATE_INTERVAL = 5 * 60 local AutoSave = {} AutoSave.__index = AutoSave function AutoSave.new(data) return setmetatable({ documents = {}, data = data, gameClosed = false, ongoingLoads = 0, ongoin...
399
nezuo/lapis
nezuo-lapis-e217a22/src/Collection.luau
luau
.luau
local HttpService = game:GetService("HttpService") local Document = require(script.Parent.Document) local Error = require(script.Parent.Error) local freezeDeep = require(script.Parent.freezeDeep) local Migration = require(script.Parent.Migration) local Promise = require(script.Parent.Parent.Promise) local copyDeep = r...
1,539
nezuo/lapis
nezuo-lapis-e217a22/src/Config.luau
luau
.luau
local DataStoreService = game:GetService("DataStoreService") local Config = {} Config.__index = Config function Config.new() return setmetatable({ config = { saveAttempts = 5, loadAttempts = 20, loadRetryDelay = 1, showRetryWarnings = true, dataStoreService = DataStoreService, }, }, Config) end ...
148
nezuo/lapis
nezuo-lapis-e217a22/src/Data/Throttle.luau
luau
.luau
local RunService = game:GetService("RunService") local Error = require(script.Parent.Parent.Error) local Promise = require(script.Parent.Parent.Parent.Promise) local GET_ASYNC_RETRY_ATTEMPTS = 5 local GET_ASYNC_RETRY_DELAY = 1 local REMOVE_ASYNC_RETRY_ATTEMPTS = 5 local REMOVE_ASYNC_RETRY_DELAY = 1 local getAsyncOp...
1,598
nezuo/lapis
nezuo-lapis-e217a22/src/Data/init.luau
luau
.luau
local Error = require(script.Parent.Error) local Promise = require(script.Parent.Parent.Promise) local Throttle = require(script.Throttle) local Data = {} Data.__index = Data function Data.new(config) local throttle = Throttle.new(config) throttle:start() return setmetatable({ config = config, throttle = thr...
842
nezuo/lapis
nezuo-lapis-e217a22/src/Document.luau
luau
.luau
local Error = require(script.Parent.Error) local freezeDeep = require(script.Parent.freezeDeep) local Promise = require(script.Parent.Parent.Promise) local noYield = require(script.Parent.noYield) local function runCallback(document, name, callback) if callback == nil then return Promise.resolve() end document.c...
1,928
nezuo/lapis
nezuo-lapis-e217a22/src/Document.test.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Promise = require(ReplicatedStorage.Packages.Promise) local function defaultOptions() return { validate = function(data) return typeof(data.foo) == "string", "foo must be a string" end, defaultData = { foo = "bar" }, } end return functio...
3,181
nezuo/lapis
nezuo-lapis-e217a22/src/Error.luau
luau
.luau
type ErrorKind = "RobloxApiError" | "DefaultDataThrew" | "SessionLocked" | "MigrationError" | "BeforeSaveCloseCallbackThrew" | "DocumentRemoved" | "SessionLockStolen" | "ValidateThrew" | "ValidateFailed" local Error = {} function Error.new(kind: ErrorKind, message: string) return { kind = kind, message ...
104
nezuo/lapis
nezuo-lapis-e217a22/src/Internal.luau
luau
.luau
local AutoSave = require(script.Parent.AutoSave) local Collection = require(script.Parent.Collection) local Config = require(script.Parent.Config) local Data = require(script.Parent.Data) local Internal = {} function Internal.new(enableAutoSave) local config = Config.new() local data = Data.new(config) local autoS...
193
nezuo/lapis
nezuo-lapis-e217a22/src/Migration.luau
luau
.luau
local Migration = {} function Migration.getLastCompatibleVersion(migrations) local serverVersion = #migrations for version = serverVersion, 1, -1 do local migration = migrations[version] if migration.backwardsCompatible ~= true then return version end end return 0 end function Migration.migrate(migrat...
321
nezuo/lapis
nezuo-lapis-e217a22/src/PromiseTypes.luau
luau
.luau
export type Status = "Started" | "Resolved" | "Rejected" | "Cancelled" export type Promise = { andThen: ( self: Promise, successHandler: (...any) -> ...any, failureHandler: ((...any) -> ...any)? ) -> Promise, andThenCall: <T...>(self: Promise, callback: (T...) -> ...any, T...) -> any, andThenReturn: (self: P...
583
nezuo/lapis
nezuo-lapis-e217a22/src/copyDeep.luau
luau
.luau
local function copyDeep(value) if typeof(value) ~= "table" then return value end local new = table.clone(value) for k, v in value do if type(v) == "table" then new[k] = copyDeep(v) end end return new end return copyDeep
71
nezuo/lapis
nezuo-lapis-e217a22/src/freezeDeep.luau
luau
.luau
local function freezeDeep(value) if typeof(value) ~= "table" then return end if not table.isfrozen(value) then table.freeze(value) end for _, innerValue in value do freezeDeep(innerValue) end end return freezeDeep
61
nezuo/lapis
nezuo-lapis-e217a22/src/init.test.luau
luau
.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local DataStoreServiceMock = require(ReplicatedStorage.DevPackages.DataStoreServiceMock) local Internal = require(script.Parent.Internal) local Promise = require(script.Parent.Parent.Promise) local function...
7,547
nezuo/lapis
nezuo-lapis-e217a22/src/noYield.luau
luau
.luau
local function noYield(callback) for _ in function() callback() end do break end end return noYield
34
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/CommonProps.luau
luau
.luau
--[=[ @class CommonProps @private The props listed here are accepted by every component except where explicitly noted. These props are accepted in addition to the props specified by components on their API pages. :::info This file is not exported and serves only to host an internal type and documentation. ::: ...
172
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/Background.luau
luau
.luau
--[=[ @class Background A borderless frame matching the default background color of Studio widgets. | Dark | Light | | - | - | | ![Dark](/StudioComponents/components/background/dark.png) | ![Light](/StudioComponents/components/background/light.png) | Any children passed will be parented to the frame, which ma...
317
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/Button.luau
luau
.luau
--[=[ @class Button A basic button that supports text, an icon, or both. This should be used as a standalone button or as a secondary button alongside a [MainButton] for the primary action in a group of options. | Dark | Light | | - | - | | ![Dark](/StudioComponents/components/button/dark.png) | ![Light](/Studio...
602
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/ColorPicker.luau
luau
.luau
--[=[ @class ColorPicker An interface for selecting a color with a Hue / Saturation box and a Value slider. Individual RGB and HSV values can also be modified manually. | Dark | Light | | - | - | | ![Dark](/StudioComponents/components/colorpicker/dark.png) | ![Light](/StudioComponents/components/colorpicker/ligh...
3,822
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/DatePicker.luau
luau
.luau
--[=[ @class DatePicker An interface for selecting a date from a calendar. | Dark | Light | | - | - | | ![Dark](/StudioComponents/components/datepicker/dark.png) | ![Light](/StudioComponents/components/datepicker/light.png) | This is a controlled component, which means you should pass in an initial date to the...
3,041
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/DropShadowFrame.luau
luau
.luau
--[=[ @class DropShadowFrame A container frame equivalent in appearance to a [Background] with a drop shadow in the lower right sides and corner. This matches the appearance of some built-in Roblox Studio elements such as tooltips. It is useful for providing contrast against a background. | Dark | Light | | -...
798
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/Dropdown/ClearButton.luau
luau
.luau
local React = require("@pkg/@jsdotlua/react") local useTheme = require("../../Hooks/useTheme") type ClearButtonProps = { Size: UDim2, Position: UDim2, AnchorPoint: Vector2, OnActivated: () -> (), } local function ClearButton(props: ClearButtonProps) local theme = useTheme() local hovered, setHovered = React.us...
369
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/Dropdown/DropdownItem.luau
luau
.luau
local React = require("@pkg/@jsdotlua/react") local Constants = require("../../Constants") local useTheme = require("../../Hooks/useTheme") local BaseIcon = require("../Foundation/BaseIcon") local DropdownTypes = require("./Types") type DropdownItemProps = { Id: string, Text: string, Icon: DropdownTypes.Dropdown...
806
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/Dropdown/Types.luau
luau
.luau
--[=[ @within Dropdown @type DropdownItem string | DropdownItemDetail ]=] export type DropdownItem = string | DropdownItemDetail --[=[ @within Dropdown @interface DropdownItemDetail @field Id string @field Text string @field Icon DropdownItemIcon? ]=] export type DropdownItemDetail = { Id: string, Text: st...
223
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/Foundation/BaseButton.luau
luau
.luau
local React = require("@pkg/@jsdotlua/react") local CommonProps = require("../../CommonProps") local Constants = require("../../Constants") local getTextSize = require("../../getTextSize") local useTheme = require("../../Hooks/useTheme") local BaseIcon = require("./BaseIcon") local PADDING_X = 8 local PADDING_Y = 4...
1,208
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/Foundation/BaseIcon.luau
luau
.luau
local React = require("@pkg/@jsdotlua/react") local CommonProps = require("../../CommonProps") export type BaseIconConsumerProps = CommonProps.T & { Image: string, Transparency: number?, Color: Color3?, ResampleMode: Enum.ResamplerMode?, RectOffset: Vector2?, RectSize: Vector2?, } export type BaseIconProps = B...
234
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/Foundation/BaseLabelledToggle.luau
luau
.luau
local React = require("@pkg/@jsdotlua/react") local CommonProps = require("../../CommonProps") local Constants = require("../../Constants") local getTextSize = require("../../getTextSize") local useTheme = require("../../Hooks/useTheme") local DEFAULT_HEIGHT = Constants.DefaultToggleHeight local BOX_SIZE = 16 local ...
852
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/Foundation/BaseTextInput.luau
luau
.luau
local React = require("@pkg/@jsdotlua/react") local CommonProps = require("../../CommonProps") local Constants = require("../../Constants") local getTextSize = require("../../getTextSize") local useTheme = require("../../Hooks/useTheme") local PLACEHOLDER_TEXT_COLOR = Color3.fromRGB(102, 102, 102) local EDGE_PADDING...
1,581
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/Label.luau
luau
.luau
--[=[ @class Label A basic text label with default styling to match built-in labels as closely as possible. | Dark | Light | | - | - | | ![Dark](/StudioComponents/components/label/dark.png) | ![Light](/StudioComponents/components/label/light.png) | By default, text color matches the current theme's MainText co...
921
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/LoadingDots.luau
luau
.luau
--[=[ @class LoadingDots A basic animated loading indicator. This matches similar indicators used in various places around Studio. This should be used for short processes where the user does not need to see information about how complete the loading is. For longer or more detailed loading processes, consider us...
740
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/MainButton.luau
luau
.luau
--[=[ @class MainButton A variant of a [Button] used to indicate a primary action, for example an 'OK/Accept' button in a modal. | Dark | Light | | - | - | | ![Dark](/StudioComponents/components/mainbutton/dark.png) | ![Light](/StudioComponents/components/mainbutton/light.png) | See the docs for [Button] fo...
344
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/NumberSequencePicker/AxisLabel.luau
luau
.luau
local React = require("@pkg/@jsdotlua/react") local Constants = require("../../Constants") local useTheme = require("../../Hooks/useTheme") local function AxisLabel(props: { AnchorPoint: Vector2?, Position: UDim2?, TextXAlignment: Enum.TextXAlignment?, Value: number, Disabled: boolean?, }) local theme = useThem...
206
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/NumberSequencePicker/Constants.luau
luau
.luau
return { EnvelopeTransparency = 0.65, EnvelopeColorStyle = Enum.StudioStyleGuideColor.DialogMainButton, EnvelopeHandleHeight = 16, }
36
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/NumberSequencePicker/DashedLine.luau
luau
.luau
local React = require("@pkg/@jsdotlua/react") local useTheme = require("../../Hooks/useTheme") local TEX_HORIZONTAL = "rbxassetid://15431624045" local TEX_VERTICAL = "rbxassetid://15431692101" local function DashedLine(props: { AnchorPoint: Vector2?, Position: UDim2?, Size: UDim2, Direction: Enum.FillDirection, ...
293
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/NumberSequencePicker/FreeLine.luau
luau
.luau
local React = require("@pkg/@jsdotlua/react") local TEX = "rbxassetid://15434098501" local function FreeLine(props: { Pos0: Vector2, Pos1: Vector2, Color: Color3, Transparency: number?, ZIndex: number?, Disabled: boolean?, }) local mid = (props.Pos0 + props.Pos1) / 2 local vector = props.Pos1 - props.Pos0 lo...
286
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/NumberSequencePicker/LabelledNumericInput.luau
luau
.luau
local React = require("@pkg/@jsdotlua/react") local Label = require("../Label") local NumericInput = require("../NumericInput") local TextInput = require("../TextInput") local getTextSize = require("../../getTextSize") local PADDING = 5 local INPUT_WIDTH = 40 local function format(n: number) return string.format(`...
461
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/NumberSequencePicker/SequenceNode.luau
luau
.luau
local React = require("@pkg/@jsdotlua/react") local useMouseDrag = require("../../Hooks/useMouseDrag") local useMouseIcon = require("../../Hooks/useMouseIcon") local useTheme = require("../../Hooks/useTheme") local PickerConstants = require("./Constants") local CATCHER_SIZE = 15 local ENVELOPE_GRAB_HEIGHT = PickerCo...
2,425
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/NumberSequencePicker/init.luau
luau
.luau
--[=[ @class NumberSequencePicker An interface for modifying [NumberSequence](https://create.roblox.com/docs/reference/engine/datatypes/NumberSequence) values. This closely resembles the built-in NumberSequence picker for editing properties, with minor adjustments for improved readability. | Dark | Light | | - ...
3,976
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/NumericInput.luau
luau
.luau
--[=[ @class NumericInput An input field matching the appearance of a [TextInput] but which filters inputted text to only allow numeric values, optionally with arrow and slider controls. | Dark | Light | | - | - | | ![Dark](/StudioComponents/components/numericinput/dark.png) | ![Light](/StudioComponents/compo...
2,800
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/PluginProvider.luau
luau
.luau
--[=[ @class PluginProvider This component provides an interface to plugin apis for other components in the tree. It should be provided with a single `Plugin` prop that must point to `plugin` (your plugin's root instance). You do not have to use this component unless you want custom mouse icons via the [useMouse...
563
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/ProgressBar.luau
luau
.luau
--[=[ @class ProgressBar A basic progress indicator. This should be used for longer or more detailed loading processes. For shorter loading processes, consider using a [LoadingDots] component. | Dark | Light | | - | - | | ![Dark](/StudioComponents/components/progressbar/dark.png) | ![Light](/StudioComponents/c...
1,018
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/RadioButton.luau
luau
.luau
--[=[ @class RadioButton An input element similar to a [Checkbox] which can either be selected or not selected. This should be used for an option in a mutually exclusive group of options (the user can only select one out of the group). This grouping behavior is not included and must be implemented separately. ...
817
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/ScrollFrame/Constants.luau
luau
.luau
return { ScrollBarThickness = 16, WheelScrollAmount = 48, ArrowScrollAmount = 16, }
26
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/ScrollFrame/ScrollBar.luau
luau
.luau
local React = require("@pkg/@jsdotlua/react") local useMouseDrag = require("../../Hooks/useMouseDrag") local useTheme = require("../../Hooks/useTheme") local Constants = require("./Constants") local ScrollBarArrow = require("./ScrollBarArrow") local Types = require("./Types") local SCROLLBAR_THICKNESS = Constants.Sc...
1,588
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/ScrollFrame/ScrollBarArrow.luau
luau
.luau
local RunService = game:GetService("RunService") local React = require("@pkg/@jsdotlua/react") local useFreshCallback = require("../../Hooks/useFreshCallback") local useTheme = require("../../Hooks/useTheme") local Constants = require("./Constants") local Types = require("./Types") local ARROW_IMAGE = "rbxassetid:/...
970
sircfenner/StudioComponents
sircfenner-StudioComponents-ceb9d45/src/Components/ScrollFrame/Types.luau
luau
.luau
export type ScrollData = { ContentSize: Vector2, WindowSize: Vector2, InnerBarSize: Vector2, BarVisible: { X: boolean, Y: boolean }, BarSize: Vector2, BarPosition: Vector2, } export type BarOrientation = "Horizontal" | "Vertical" return {}
68