-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
367 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.