Skip to content

Commit

Permalink
push structure changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmesrje committed Nov 9, 2024
1 parent 31ddb91 commit 1ab3819
Show file tree
Hide file tree
Showing 38 changed files with 367 additions and 326 deletions.
38 changes: 5 additions & 33 deletions dev.project.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
Expand Down
File renamed without changes.
Empty file added src/Animation/Tween.luau
Empty file.
81 changes: 0 additions & 81 deletions src/Constructors/new.luau

This file was deleted.

186 changes: 186 additions & 0 deletions src/Instances/Default.luau
Original file line number Diff line number Diff line change
@@ -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,
},
}
70 changes: 70 additions & 0 deletions src/Instances/New.luau
Original file line number Diff line number Diff line change
@@ -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<T>(
component: string | Types.Component<T>,
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
Loading

0 comments on commit 1ab3819

Please sign in to comment.