diff --git a/dev.project.json b/dev.project.json index 9b4b31f..2d94d48 100644 --- a/dev.project.json +++ b/dev.project.json @@ -1,45 +1,17 @@ { - "name": "aegis-dev", + "emitLegacyScripts": false, + "name": "ui-framework", "tree": { "$className": "DataModel", - "Workspace": { - "$path": "tests/workspace" - }, - "Lighting": { - "$path": "tests/lighting", - "$properties": { - "Technology": "Voxel", - "Ambient": { - "Color3": [ - 0.470588, - 0.470588, - 0.470588 - ] - }, - "OutdoorAmbient": { - "Color3": [ - 0.470588, - 0.470588, - 0.470588 - ] - } - } - }, "ReplicatedStorage": { - "$path": "tests/shared", "Packages": { "$path": "Packages", "ui-framework": { "$path": "src" } - } - }, - "ServerScriptService": { - "$path": "tests/server" - }, - "StarterPlayer": { - "StarterPlayerScripts": { - "$path": "tests/client" + }, + "Tests": { + "$path": "tests" } } } diff --git a/src/Constructors/spring.luau b/src/Animation/Spring.luau similarity index 100% rename from src/Constructors/spring.luau rename to src/Animation/Spring.luau diff --git a/src/Animation/Tween.luau b/src/Animation/Tween.luau new file mode 100644 index 0000000..e69de29 diff --git a/src/Constructors/new.luau b/src/Constructors/new.luau deleted file mode 100644 index c081edb..0000000 --- a/src/Constructors/new.luau +++ /dev/null @@ -1,81 +0,0 @@ --- FOLDERS > -local Root = script.Parent.Parent -local Utility = Root.Utility - --- DEPENDENCIES > -local Debugger = require(Utility.Debugger) -local Utils = require(Utility.Utils) -local Types = require(Root.Types) - --- FUNCTIONS > ---[[ - ## `Aegis.new` - A constructor to create new instances. - #### Parameters - - **classOrComponent:** The class name of the instance or the component to create. - - **properties:** A table of properties to be applied to the parent instance. - - **children:** A table of descendant instances to be parented to the parent instance. - #### Returns - - [`Instance`](https://create.roblox.com/docs/reference/engine/classes/Instance) | [`Tutorial`](https://lumin-dev.github.io/Aegis/guide/new-instances) - #### Example - ```luau - local BackgroundComponent = require(path.to.BackgroundComponent) - - local MenuUI = Aegis.new("ScreenGui", { - Name = "MenuUI", - IgnoreGuiInset = true, - Parent = Player:WaitForChild("PlayerGui"), - }, { - Background = Aegis.new(BackgroundComponent, { - Color = Color3.fromRGB(24, 24, 24), - }), - }) - ``` -]] -return function( - classOrComponent: string | Types.Component, - properties: (T & Types.Properties)?, - children: Types.Children? -): Instance - local Component - if type(classOrComponent) == "string" then - local Success, Result = pcall(Instance.new, classOrComponent) -- Create the instance wrapped inside pcall - - if Success then - if properties then - for property, value in properties :: any do - if property == "Parent" then - continue - end - - Utils.ApplyProperty(Result, property, value) - end - - if (properties :: any).Parent then - Utils.ApplyProperty(Result, "Parent", (properties :: any).Parent) - end - end - - if children then - for name, value in children do - value.Parent = Result - value.Name = if type(name) == "string" then name else value.Name - end - end - - Component = Result - else -- If it wasn't successful, error it because instance creation has to be complete. - Debugger.Error("FailedToCreate", classOrComponent, Result) - end - else - if children then - if not properties then - properties = {} :: any - end - (properties :: any).Children = children - end - - Component = classOrComponent(properties :: any) - end - return Component -end diff --git a/src/Instances/Default.luau b/src/Instances/Default.luau new file mode 100644 index 0000000..9e70a0c --- /dev/null +++ b/src/Instances/Default.luau @@ -0,0 +1,186 @@ +-- Stores default properties for common items +-- Forked from Fusion 0.3 +return { + ScreenGui = { + ResetOnSpawn = false, + ZIndexBehavior = Enum.ZIndexBehavior.Sibling + }, + + BillboardGui = { + ResetOnSpawn = false, + ZIndexBehavior = Enum.ZIndexBehavior.Sibling, + Active = true + }, + + SurfaceGui = { + ResetOnSpawn = false, + ZIndexBehavior = Enum.ZIndexBehavior.Sibling, + + SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud, + PixelsPerStud = 50 + }, + + Frame = { + BackgroundColor3 = Color3.new(1, 1, 1), + BorderColor3 = Color3.new(0, 0, 0), + BorderSizePixel = 0 + }, + + ScrollingFrame = { + BackgroundColor3 = Color3.new(1, 1, 1), + BorderColor3 = Color3.new(0, 0, 0), + BorderSizePixel = 0, + + ScrollBarImageColor3 = Color3.new(0, 0, 0) + }, + + TextLabel = { + BackgroundColor3 = Color3.new(1, 1, 1), + BorderColor3 = Color3.new(0, 0, 0), + BorderSizePixel = 0, + + Font = Enum.Font.SourceSans, + Text = "", + TextColor3 = Color3.new(0, 0, 0), + TextSize = 14 + }, + + TextButton = { + BackgroundColor3 = Color3.new(1, 1, 1), + BorderColor3 = Color3.new(0, 0, 0), + BorderSizePixel = 0, + + AutoButtonColor = false, + + Font = Enum.Font.SourceSans, + Text = "", + TextColor3 = Color3.new(0, 0, 0), + TextSize = 14 + }, + + TextBox = { + BackgroundColor3 = Color3.new(1, 1, 1), + BorderColor3 = Color3.new(0, 0, 0), + BorderSizePixel = 0, + + ClearTextOnFocus = false, + + Font = Enum.Font.SourceSans, + Text = "", + TextColor3 = Color3.new(0, 0, 0), + TextSize = 14 + }, + + ImageLabel = { + BackgroundColor3 = Color3.new(1, 1, 1), + BorderColor3 = Color3.new(0, 0, 0), + BorderSizePixel = 0 + }, + + ImageButton = { + BackgroundColor3 = Color3.new(1, 1, 1), + BorderColor3 = Color3.new(0, 0, 0), + BorderSizePixel = 0, + + AutoButtonColor = false + }, + + ViewportFrame = { + BackgroundColor3 = Color3.new(1, 1, 1), + BorderColor3 = Color3.new(0, 0, 0), + BorderSizePixel = 0 + }, + + VideoFrame = { + BackgroundColor3 = Color3.new(1, 1, 1), + BorderColor3 = Color3.new(0, 0, 0), + BorderSizePixel = 0 + }, + + CanvasGroup = { + BackgroundColor3 = Color3.new(1, 1, 1), + BorderColor3 = Color3.new(0, 0, 0), + BorderSizePixel = 0 + }, + + SpawnLocation = { + Duration = 0 + }, + + BoxHandleAdornment = { + ZIndex = 0 + }, + ConeHandleAdornment = { + ZIndex = 0 + }, + CylinderHandleAdornment = { + ZIndex = 0 + }, + ImageHandleAdornment = { + ZIndex = 0 + }, + LineHandleAdornment = { + ZIndex = 0 + }, + SphereHandleAdornment = { + ZIndex = 0 + }, + WireframeHandleAdornment = { + ZIndex = 0 + }, + + Part = { + Anchored = true, + Size = Vector3.one, + FrontSurface = Enum.SurfaceType.Smooth, + BackSurface = Enum.SurfaceType.Smooth, + LeftSurface = Enum.SurfaceType.Smooth, + RightSurface = Enum.SurfaceType.Smooth, + TopSurface = Enum.SurfaceType.Smooth, + BottomSurface = Enum.SurfaceType.Smooth, + }, + + TrussPart = { + Anchored = true, + Size = Vector3.one * 2, + FrontSurface = Enum.SurfaceType.Smooth, + BackSurface = Enum.SurfaceType.Smooth, + LeftSurface = Enum.SurfaceType.Smooth, + RightSurface = Enum.SurfaceType.Smooth, + TopSurface = Enum.SurfaceType.Smooth, + BottomSurface = Enum.SurfaceType.Smooth, + }, + + MeshPart = { + Anchored = true, + Size = Vector3.one, + FrontSurface = Enum.SurfaceType.Smooth, + BackSurface = Enum.SurfaceType.Smooth, + LeftSurface = Enum.SurfaceType.Smooth, + RightSurface = Enum.SurfaceType.Smooth, + TopSurface = Enum.SurfaceType.Smooth, + BottomSurface = Enum.SurfaceType.Smooth, + }, + + CornerWedgePart = { + Anchored = true, + Size = Vector3.one, + FrontSurface = Enum.SurfaceType.Smooth, + BackSurface = Enum.SurfaceType.Smooth, + LeftSurface = Enum.SurfaceType.Smooth, + RightSurface = Enum.SurfaceType.Smooth, + TopSurface = Enum.SurfaceType.Smooth, + BottomSurface = Enum.SurfaceType.Smooth, + }, + + VehicleSeat = { + Anchored = true, + Size = Vector3.one, + FrontSurface = Enum.SurfaceType.Smooth, + BackSurface = Enum.SurfaceType.Smooth, + LeftSurface = Enum.SurfaceType.Smooth, + RightSurface = Enum.SurfaceType.Smooth, + TopSurface = Enum.SurfaceType.Smooth, + BottomSurface = Enum.SurfaceType.Smooth, + }, +} diff --git a/src/Instances/New.luau b/src/Instances/New.luau new file mode 100644 index 0000000..09716db --- /dev/null +++ b/src/Instances/New.luau @@ -0,0 +1,70 @@ +-- Variables +local Root = script.Parent.Parent +local Utility = Root.Utility +local Packages = script.Parent.Parent.Parent.Parent.Packages + +local Debugger = require(Packages.debugger) +local Utils = require(Utility.Utils) +local Types = require(Root.Types) +local Default = require(Root.Instances.Default) + +-- Module + +--[=[ + Creates a new instance or component with the provided children and props. + + [Learn More](https://luminlabsdev.github.io/ui-framework/api/#new) +]=] +return function( + component: string | Types.Component, + properties: (T & Types.Properties)?, + children: Types.Children? +): Instance + local Component + if type(component) == "string" then + local Success, Result = pcall(Instance.new, component) -- Create the instance wrapped inside pcall + + if Success then + if Default[component] then + for prop, value in Default[component] do + (Result :: any)[prop] = value + end + end + + if properties then + for property, value in properties :: any do + if property == "Parent" then + continue + end + + Utils.ApplyProperty(Result, property, value) + end + + if (properties :: any).Parent then + Utils.ApplyProperty(Result, "Parent", (properties :: any).Parent) + end + end + + if children then + for name, value in children do + value.Parent = Result + value.Name = if type(name) == "string" then name else value.Name + end + end + + Component = Result + else -- If it wasn't successful, error it because instance creation has to be complete. + Debugger.Fatal("FailedToCreate", component, Result) + end + else + if children then + if not properties then + properties = {} :: any + end + (properties :: any).Children = children + end + + Component = component(properties :: any) + end + return Component +end diff --git a/src/Functions/Update.luau b/src/Instances/Update.luau similarity index 50% rename from src/Functions/Update.luau rename to src/Instances/Update.luau index 6a62be4..077c8bd 100644 --- a/src/Functions/Update.luau +++ b/src/Instances/Update.luau @@ -1,27 +1,14 @@ --- DEPENDENCIES > +-- Variables local Utils = require(script.Parent.Parent.Utility.Utils) local Types = require(script.Parent.Parent.Types) --- FUNCTIONS > ---[[ - ## `Aegis.Update` - A function to update the passed instance. - #### Parameters - - **instance:** The instance to update the properties of. - - **propertyTable:** A table of properties to be applied to the parent instance. - - **childrenTable:** A table of descendant instances to be parented to the parent instance. - #### Returns - - [`Instance`](https://create.roblox.com/docs/reference/engine/classes/Instance) | [`Tutorial`](https://lumin-dev.github.io/Aegis/guide/updating-instances) - #### Example - ```luau - local UI = PlayerGui:WaitForChild("LoadingUI") +-- Module - Aegis.Update(UI, { - Name = "MenuGUI", - IgnoreGuiInset = true, - }) - ``` -]] +--[=[ + Updates an instance, adding properties or children. + + [Learn More](https://luminlabsdev.github.io/ui-framework/api/#update) +]=] return function(component: Instance, properties: Types.Properties?, children: Types.Children?): Instance if properties then for property, value in properties do diff --git a/src/Keys/Attributes.luau b/src/Keys/Attributes.luau deleted file mode 100644 index 4e2fe8e..0000000 --- a/src/Keys/Attributes.luau +++ /dev/null @@ -1,10 +0,0 @@ --- RETURNING > -return { - KeyName = "Attributes", - ApplyKey = function(instance: Instance, value: { [string]: any }) - for attributeName, val in value do - -- Loop over provided attributes and set it to instance - instance:SetAttribute(attributeName, val) - end - end, -} diff --git a/src/Keys/Changes.luau b/src/Keys/Changes.luau deleted file mode 100644 index 92ab780..0000000 --- a/src/Keys/Changes.luau +++ /dev/null @@ -1,12 +0,0 @@ --- RETURNING > -return { - KeyName = "Changes", - ApplyKey = function(instance: Instance, value: { [string]: () -> () }) - for propertyName, fn in value do - if type(propertyName) == "string" and type(fn) == "function" then - -- Check the types and connect - instance:GetPropertyChangedSignal(propertyName):Connect(fn) - end - end - end, -} diff --git a/src/Keys/Cleanup.luau b/src/Keys/Cleanup.luau deleted file mode 100644 index 1945f18..0000000 --- a/src/Keys/Cleanup.luau +++ /dev/null @@ -1,40 +0,0 @@ --- FOLDERS > -local Utility = script.Parent.Parent.Utility - --- DEPENDENCIES > -local Is = require(Utility.Is) -local Utils = require(Utility.Utils) -local Types = require(script.Parent.Parent.Types) - --- FUNCTIONS > -local function CleanupElement(value: any, type: string) - if Is.AegisConstructor(value) == true then - (value :: Types.Constructor):Destroy() - elseif type == "Instance" then - (value :: Instance):Destroy() - elseif type == "RBXScriptConnection" then - (value :: RBXScriptConnection):Disconnect() - elseif type == "function" then - Utils.Spawn(value) - end -end - --- RETURNING > -return { - KeyName = "Cleanup", - ApplyKey = function(instance: Instance, value: any): () - local Type = typeof(value) - - instance.Destroying:Connect(function(): () - if Type == "table" then - for _, v in value do - CleanupElement(v, Type) - end - - table.clear(value) - else - CleanupElement(value, Type) - end - end) - end, -} diff --git a/src/Keys/Events.luau b/src/Keys/Events.luau deleted file mode 100644 index 03761d0..0000000 --- a/src/Keys/Events.luau +++ /dev/null @@ -1,21 +0,0 @@ --- DEPENDENCIES > -local Debugger = require(script.Parent.Parent.Utility.Debugger) - --- RETURNING > -return { - KeyName = "Events", - ApplyKey = function(instance: Instance, value: { [string]: (...any) -> () }) - local CurrentType: string -- A variable so that same types do not take extra memory - - for eventName, fn in value do - CurrentType = typeof((instance :: any)[eventName]) - if CurrentType == "RBXScriptSignal" then -- Check type - (instance :: any)[eventName]:Connect(function(...: any) - fn(unpack({ ... })) - end) - else - Debugger.Warn("TypeMismatch", "RBXScriptSignal", CurrentType) -- else just warn it - end - end - end, -} diff --git a/src/Functions/Key.luau b/src/Keys/Key.luau similarity index 100% rename from src/Functions/Key.luau rename to src/Keys/Key.luau diff --git a/src/Keys/List/OnAttributeChange.luau b/src/Keys/List/OnAttributeChange.luau new file mode 100644 index 0000000..e69de29 diff --git a/src/Keys/List/OnChange.luau b/src/Keys/List/OnChange.luau new file mode 100644 index 0000000..b0ff7a9 --- /dev/null +++ b/src/Keys/List/OnChange.luau @@ -0,0 +1,28 @@ +-- Variables +local Packages = script.Parent.Parent.Parent.Parent.Parent.Packages +local Utility = script.Parent.Parent.Utility +local Keys = require(Utility.Keys) +local Debugger = require(Packages.debugger) + +-- Module + +--[=[ + Connects a callback to a certain property change event. + + [Learn More](https://luminlabsdev.github.io/ui-framework/api/keys/#onchange) +]=] +return function(propName: string) + if not Keys["OnChange"] then + Keys["OnChange"] = { + Name = "OnChange", + Apply = function(instance: Instance, callback: (...any) -> ()) + local Success, Event = pcall(instance.GetPropertyChangedSignal, instance :: any, propName :: any) + if not Success or type(callback) ~= "function" then + Debugger.Fatal("") + end + Event:Connect(callback) + end + } + end + return Keys["OnChange"] +end diff --git a/src/Keys/List/OnEvent.luau b/src/Keys/List/OnEvent.luau new file mode 100644 index 0000000..3f88b04 --- /dev/null +++ b/src/Keys/List/OnEvent.luau @@ -0,0 +1,29 @@ +-- Variables +local Packages = script.Parent.Parent.Parent.Parent.Packages +local Utility = script.Parent.Utility +local FindProp = require(Utility.FindProp) +local Keys = require(Utility.Keys) +local Debugger = require(Packages.debugger) + +-- Module + +--[=[ + Connects a callback to an event on the instance. + + [Learn More](https://luminlabsdev.github.io/ui-framework/api/keys/#onevent) +]=] +return function(eventName: string) + if not Keys["OnEvent"] then + Keys["OnEvent"] = { + Name = "OnEvent", + Apply = function(instance: Instance, callback: (...any) -> ()) + local Success, Event = pcall(FindProp, instance :: any, eventName :: any) + if not Success or type(callback) ~= "function" then + Debugger.Fatal("") + end + Event:Connect(callback) + end + } + end + return Keys["OnEvent"] +end diff --git a/src/Keys/Ref.luau b/src/Keys/Ref.luau deleted file mode 100644 index 9f12bd1..0000000 --- a/src/Keys/Ref.luau +++ /dev/null @@ -1,19 +0,0 @@ --- FOLDERS > -local Utility = script.Parent.Parent.Utility - --- DEPENDENCIES > -local Is = require(Utility.Is) -local Debugger = require(Utility.Debugger) -local Types = require(script.Parent.Parent.Types) - --- RETURNING > -return { - KeyName = "Ref", - ApplyKey = function(instance: Instance, value: any) - if Is.AegisConstructor(value) == true and (value :: Types.Constructor).ConstructorClass == "state" then - value:Set(instance) - else - Debugger.Warn("ServiceExpected", "state", typeof(value)) - end - end, -} diff --git a/src/Functions/RegisterKey.luau b/src/Keys/RegisterKey.luau similarity index 100% rename from src/Functions/RegisterKey.luau rename to src/Keys/RegisterKey.luau diff --git a/src/Keys/Tags.luau b/src/Keys/Tags.luau deleted file mode 100644 index b33fff5..0000000 --- a/src/Keys/Tags.luau +++ /dev/null @@ -1,10 +0,0 @@ --- RETURNING > -return { - KeyName = "Tags", - ApplyKey = function(instance: Instance, value: { string }) - for _, tag in value do - -- Loop over provided tags and add it to instance - instance:AddTag(tag) - end - end, -} diff --git a/src/Functions/UnregisterKey.luau b/src/Keys/UnregisterKey.luau similarity index 100% rename from src/Functions/UnregisterKey.luau rename to src/Keys/UnregisterKey.luau diff --git a/src/Keys/Utility/FindProp.luau b/src/Keys/Utility/FindProp.luau new file mode 100644 index 0000000..04cd31c --- /dev/null +++ b/src/Keys/Utility/FindProp.luau @@ -0,0 +1,4 @@ +-- Check if a property/event exists on an instance or not +return function(instance: Instance, property: string) + return (instance :: any)[property] +end diff --git a/src/Keys/Utility/Keys.luau b/src/Keys/Utility/Keys.luau new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/src/Keys/Utility/Keys.luau @@ -0,0 +1 @@ +return {} diff --git a/src/Logs.luau b/src/Logs.luau new file mode 100644 index 0000000..7eb06fa --- /dev/null +++ b/src/Logs.luau @@ -0,0 +1,3 @@ +return { + +} diff --git a/src/Constructors/compute.luau b/src/State/Compute.luau similarity index 79% rename from src/Constructors/compute.luau rename to src/State/Compute.luau index 0dbbefb..27c7960 100644 --- a/src/Constructors/compute.luau +++ b/src/State/Compute.luau @@ -112,31 +112,11 @@ function Class.Destroy(self: Types.Compute): nil return nil end ---[[ - ## `Aegis.compute` - A constructor that calculates the result while listening to the value of its dependencies. - #### Parameters - - **processor:** The processing function that will run everytime the value changes. - - **dependencies:** Table of dependencies whose values will be listened to. - #### Returns - - [`compute`](https://lumin-dev.github.io/Aegis/api/compute) | [`Tutorial`](https://lumin-dev.github.io/Aegis/guide/managing-computes) - #### Example - ```luau - local state = Aegis.state - local compute = Aegis.compute +--[=[ + Creates a new compute which is similar to a value but will compute the value on change. - local Coins = state(100) -- State object for coins - local Price = state(50) -- State object for price value - - local CalculateCoins = compute(function(get) - return get(Coins) - get(Price) - end, { Coins }) -- adding a dependency - - print(CalculateCoins:Get()) -- 50 - Coins:Set(200) -- changing the value - print(CalculateCoins:Get()) -- 150 - ``` -]] + [Learn More](https://luminlabsdev.github.io/ui-framework/api/#compute) +]=] return function( processor: (get: typeof(get)) -> (), dependencies: { Types.State | Types.Spring | Types.Constructor }? diff --git a/src/Constructors/state.luau b/src/State/Value.luau similarity index 82% rename from src/Constructors/state.luau rename to src/State/Value.luau index ee2a1c1..de8de92 100644 --- a/src/Constructors/state.luau +++ b/src/State/Value.luau @@ -145,37 +145,11 @@ function Class.Destroy(self: Types.State): nil return nil end ---[[ - ## `Aegis.state` - A constructor to create new state objects. - #### Parameters - - **initialValue:** The initial value of the state object. - - **protectType:** Whether to do type checking when setting value (default: true) - #### Returns - - [`state`](https://lumin-dev.github.io/Aegis/api/state) | [`Tutorial`](https://lumin-dev.github.io/Aegis/guide/managing-states) - #### Example - ```luau - local MyState = Aegis.state("Hello Aegis") +--[=[ + Creates a new value/state object that dynamically changes in UI whe changed itself. - MyState:Listen(function(newValue: string, oldValue: string) - print(`Before: {oldValue}`) - print(`After: {newValue}`) - print("-----") - end) - - MyState:Set("hi fellow developers") - MyState:Set("how are you guys") - ``` - - #### Output: - ```txt - Before: Hello Aegis - After: hi fellow developers - ----- - Before: hi fellow developers - After: how are you guys - ----- -]] + [Learn More](https://luminlabsdev.github.io/ui-framework/api/#value) +]=] return function(initialValue: any, protectType: boolean?): Types.State local Type = type(initialValue) diff --git a/src/Types.luau b/src/Types.luau index 281795b..f290f3a 100644 --- a/src/Types.luau +++ b/src/Types.luau @@ -1,4 +1,3 @@ --- EXTRA TYPES > export type Animatable = boolean | number @@ -41,7 +40,6 @@ export type SpringInfo = { Frequency: number?, } --- State types export type StateFunc = { _init: (self: State, prop: string, instance: Instance) -> (), Get: (self: State) -> any, @@ -59,7 +57,6 @@ export type StateProps = { export type State = typeof(setmetatable({} :: StateProps, {} :: { __index: StateFunc })) --- Spring types export type SpringFunc = { _init: (self: Spring, prop: string, instance: Instance) -> (), Get: (self: Spring) -> any, @@ -82,7 +79,6 @@ export type SpringProps = { export type Spring = typeof(setmetatable({} :: SpringProps, {} :: { __index: SpringFunc })) --- Compute types export type ComputeFunc = { _init: (self: Compute, prop: string, instance: Instance) -> (), Get: (self: Compute) -> any, diff --git a/src/init.luau b/src/init.luau index 7724e03..9b61d65 100644 --- a/src/init.luau +++ b/src/init.luau @@ -1,19 +1,19 @@ --- FOLDERS > -local Constructors = script.Constructors -local Functions = script.Functions +-- Variables +local Packages = script.Parent.Parent.Packages +local Instances = script.Instances +local Animation = script.Animation +local State = script.State +local Keys = script.Keys --- DEPENDENCIES > local Types = require(script.Types) +local Debugger = require(Packages.debugger) +local RegisterKey = require(Keys.RegisterKey) --- VARIABLES > -local RegisterKey = require(Functions.RegisterKey) - --- INITIALIZE > for _, key in script.Keys:GetChildren() do RegisterKey(require(key) :: Types.Key) end --- EXPORTING > +-- Types export type Key = Types.Key export type State = Types.State export type Spring = Types.Spring @@ -23,20 +23,24 @@ export type SpringInfo = Types.SpringInfo export type DefaultKeys = Types.DefaultKeys export type Component = Types.Component ---[[ - ## Aegis - A simple strictly typed UI framework made specifically for Roblox. -]] +-- Module +Debugger.SetMetadata({ + PackageURL = "https://github.com/luminlabsdev/ui-framework", + PackageName = "UI Framework", +}) + return table.freeze({ - -- CONSTRUCTORS > - new = require(Constructors.new), - state = require(Constructors.state), - spring = require(Constructors.spring), - compute = require(Constructors.compute), + New = require(Instances.New), + Update = require(Instances.Update), + Value = require(State.Value), + Compute = require(State.Compute), + Spring = require(Animation.Spring), + Tween = require(Animation.Tween), + + OnEvent = require(Keys.List.OnEvent), + OnChange = require(Keys.List.OnChange), - -- FUNCTIONS > - Update = require(Functions.Update), - Key = require(Functions.Key), - UnregisterKey = require(Functions.UnregisterKey), + Key = require(Keys.Key), + UnregisterKey = require(Keys.UnregisterKey), RegisterKey = RegisterKey, }) diff --git a/tests/client/UI.client.luau b/tests/Client/UI.client.luau similarity index 100% rename from tests/client/UI.client.luau rename to tests/Client/UI.client.luau diff --git a/tests/client/components/Background.luau b/tests/Client/components/Background.luau similarity index 100% rename from tests/client/components/Background.luau rename to tests/Client/components/Background.luau diff --git a/tests/client/useTheme.luau b/tests/Client/useTheme.luau similarity index 100% rename from tests/client/useTheme.luau rename to tests/Client/useTheme.luau diff --git a/tests/server/Test.server.luau b/tests/Server/Test.server.luau similarity index 100% rename from tests/server/Test.server.luau rename to tests/Server/Test.server.luau diff --git a/tests/shared/Theme.luau b/tests/Shared/Theme.luau similarity index 100% rename from tests/shared/Theme.luau rename to tests/Shared/Theme.luau diff --git a/tests/lighting/Atmosphere.rbxm b/tests/lighting/Atmosphere.rbxm deleted file mode 100644 index a407124..0000000 Binary files a/tests/lighting/Atmosphere.rbxm and /dev/null differ diff --git a/tests/lighting/Bloom.rbxm b/tests/lighting/Bloom.rbxm deleted file mode 100644 index 9293c5d..0000000 Binary files a/tests/lighting/Bloom.rbxm and /dev/null differ diff --git a/tests/lighting/DepthOfField.rbxm b/tests/lighting/DepthOfField.rbxm deleted file mode 100644 index 675f1cd..0000000 Binary files a/tests/lighting/DepthOfField.rbxm and /dev/null differ diff --git a/tests/lighting/Sky.rbxm b/tests/lighting/Sky.rbxm deleted file mode 100644 index d79dee7..0000000 Binary files a/tests/lighting/Sky.rbxm and /dev/null differ diff --git a/tests/lighting/SunRays.rbxm b/tests/lighting/SunRays.rbxm deleted file mode 100644 index 2d2e461..0000000 Binary files a/tests/lighting/SunRays.rbxm and /dev/null differ diff --git a/tests/workspace/Baseplate.rbxm b/tests/workspace/Baseplate.rbxm deleted file mode 100644 index e56d236..0000000 Binary files a/tests/workspace/Baseplate.rbxm and /dev/null differ diff --git a/tests/workspace/Spawn.rbxm b/tests/workspace/Spawn.rbxm deleted file mode 100644 index d3531b4..0000000 Binary files a/tests/workspace/Spawn.rbxm and /dev/null differ