From e1e0626ca61384e831616bc422ec8068f1e801d6 Mon Sep 17 00:00:00 2001 From: alice <166900055+alicesaidhi@users.noreply.github.com> Date: Sat, 29 Jun 2024 09:45:30 +0200 Subject: [PATCH] vide setup --- .gitignore | 4 +- .vscode/settings.json | 12 + sourcemap.json | 1 - src/Components/Controls/AppBarButton.luau | 24 - src/Components/Controls/AppTabBarButton.luau | 49 -- src/Components/Controls/BaseButton.luau | 78 --- src/Components/Controls/Checkbox.luau | 67 --- src/Components/Controls/ColorPicker.luau | 124 ----- src/Components/Controls/IconButton.luau | 43 -- src/Components/Controls/IconTextButton.luau | 76 --- src/Components/Controls/Icons.luau | 502 ------------------ src/Components/Controls/Slider.luau | 139 ----- src/Components/Controls/TextButton.luau | 34 -- src/Components/Controls/TextField.luau | 166 ------ src/Components/Controls/Toggle.luau | 88 --- src/Components/Divider.luau | 35 -- src/Components/Shadow.luau | 272 ---------- src/Components/Views/AppTabBar.luau | 31 -- src/Components/Views/BottomAppBar.luau | 56 -- src/Components/Views/ToolTip.luau | 86 --- src/Components/Views/TopAppBar.luau | 159 ------ src/Components/Views/Window.luau | 75 --- src/Components/init.luau | 27 - src/Modules/Constants.luau | 38 +- src/Modules/EnumList.luau | 77 --- src/Modules/Icons.luau | 2 +- src/Modules/Scheme/Schemes/Dark.luau | 3 +- src/Modules/Scheme/Schemes/Light.luau | 2 +- src/Modules/Scheme/Schemes/SolarizedDark.luau | 2 +- src/Modules/Scheme/init.luau | 105 +--- src/Modules/SharedStates.luau | 4 - src/Modules/init.luau | 9 +- src/modules/context.luau | 57 ++ src/modules/delay.luau | 26 + src/modules/store.luau | 101 ++++ src/modules/tween.luau | 138 +++++ src/stories/window.story.luau | 64 +++ wally.lock | 8 +- wally.toml | 4 +- 39 files changed, 450 insertions(+), 2338 deletions(-) delete mode 100644 sourcemap.json delete mode 100644 src/Components/Controls/AppBarButton.luau delete mode 100644 src/Components/Controls/AppTabBarButton.luau delete mode 100644 src/Components/Controls/BaseButton.luau delete mode 100644 src/Components/Controls/Checkbox.luau delete mode 100644 src/Components/Controls/ColorPicker.luau delete mode 100644 src/Components/Controls/IconButton.luau delete mode 100644 src/Components/Controls/IconTextButton.luau delete mode 100644 src/Components/Controls/Icons.luau delete mode 100644 src/Components/Controls/Slider.luau delete mode 100644 src/Components/Controls/TextButton.luau delete mode 100644 src/Components/Controls/TextField.luau delete mode 100644 src/Components/Controls/Toggle.luau delete mode 100644 src/Components/Divider.luau delete mode 100644 src/Components/Shadow.luau delete mode 100644 src/Components/Views/AppTabBar.luau delete mode 100644 src/Components/Views/BottomAppBar.luau delete mode 100644 src/Components/Views/ToolTip.luau delete mode 100644 src/Components/Views/TopAppBar.luau delete mode 100644 src/Components/Views/Window.luau delete mode 100644 src/Components/init.luau delete mode 100644 src/Modules/EnumList.luau delete mode 100644 src/Modules/SharedStates.luau create mode 100644 src/modules/context.luau create mode 100644 src/modules/delay.luau create mode 100644 src/modules/store.luau create mode 100644 src/modules/tween.luau create mode 100644 src/stories/window.story.luau diff --git a/.gitignore b/.gitignore index e0eeff3..24f1b86 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ Packages site -.DS_Store \ No newline at end of file +.DS_Store + +/sourcemap.json \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 96f1ae1..52f96f3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,17 @@ { "luau-lsp.sourcemap.rojoProjectFile": "test.project.json", + "luau-lsp.completion.imports.requireStyle": "alwaysRelative", + "luau-lsp.fflags.override": { + "LuauTypeInferIterationLimit": "0", + "LuauCheckRecursionLimit": "0", + "LuauTypeInferRecursionLimit": "0", + "LuauTarjanChildLimit": "0", + "LuauTypeInferTypePackLoopLimit": "0", + "LuauVisitRecursionLimit": "0", + "LuauParseDeclareClassIndexer": "true", + "LuauLoopControlFlowAnalysis": "true" + }, + "yaml.schemas": { "https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml" }, diff --git a/sourcemap.json b/sourcemap.json deleted file mode 100644 index 96196d4..0000000 --- a/sourcemap.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"Lydie","className":"DataModel","filePaths":["test.project.json"],"children":[{"name":"ReplicatedStorage","className":"ReplicatedStorage","children":[{"name":"Packages","className":"Folder","children":[{"name":"Fusion","className":"ModuleScript","filePaths":["Packages/Fusion.lua"]},{"name":"_Index","className":"Folder","children":[{"name":"elttob_fusion@0.2.0","className":"Folder","children":[{"name":"fusion","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/init.lua","Packages/_Index/elttob_fusion@0.2.0/fusion/default.project.json"],"children":[{"name":"Animation","className":"Folder","children":[{"name":"Spring","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Animation/Spring.lua"]},{"name":"SpringScheduler","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Animation/SpringScheduler.lua"]},{"name":"Tween","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Animation/Tween.lua"]},{"name":"TweenScheduler","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Animation/TweenScheduler.lua"]},{"name":"getTweenRatio","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Animation/getTweenRatio.lua"]},{"name":"lerpType","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Animation/lerpType.lua"]},{"name":"packType","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Animation/packType.lua"]},{"name":"springCoefficients","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Animation/springCoefficients.lua"]},{"name":"unpackType","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Animation/unpackType.lua"]}]},{"name":"Colour","className":"Folder","children":[{"name":"Oklab","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Colour/Oklab.lua"]}]},{"name":"Dependencies","className":"Folder","children":[{"name":"captureDependencies","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Dependencies/captureDependencies.lua"]},{"name":"initDependency","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Dependencies/initDependency.lua"]},{"name":"sharedState","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Dependencies/sharedState.lua"]},{"name":"updateAll","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Dependencies/updateAll.lua"]},{"name":"useDependency","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Dependencies/useDependency.lua"]}]},{"name":"Instances","className":"Folder","children":[{"name":"Children","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Instances/Children.lua"]},{"name":"Cleanup","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Instances/Cleanup.lua"]},{"name":"Hydrate","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Instances/Hydrate.lua"]},{"name":"New","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Instances/New.lua"]},{"name":"OnChange","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Instances/OnChange.lua"]},{"name":"OnEvent","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Instances/OnEvent.lua"]},{"name":"Out","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Instances/Out.lua"]},{"name":"Ref","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Instances/Ref.lua"]},{"name":"applyInstanceProps","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Instances/applyInstanceProps.lua"]},{"name":"defaultProps","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Instances/defaultProps.lua"]}]},{"name":"Logging","className":"Folder","children":[{"name":"logError","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Logging/logError.lua"]},{"name":"logErrorNonFatal","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Logging/logErrorNonFatal.lua"]},{"name":"logWarn","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Logging/logWarn.lua"]},{"name":"messages","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Logging/messages.lua"]},{"name":"parseError","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Logging/parseError.lua"]}]},{"name":"PubTypes","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/PubTypes.lua"]},{"name":"State","className":"Folder","children":[{"name":"Computed","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/State/Computed.lua"]},{"name":"ForKeys","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/State/ForKeys.lua"]},{"name":"ForPairs","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/State/ForPairs.lua"]},{"name":"ForValues","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/State/ForValues.lua"]},{"name":"Observer","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/State/Observer.lua"]},{"name":"Value","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/State/Value.lua"]},{"name":"unwrap","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/State/unwrap.lua"]}]},{"name":"Types","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Types.lua"]},{"name":"Utility","className":"Folder","children":[{"name":"None","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Utility/None.lua"]},{"name":"cleanup","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Utility/cleanup.lua"]},{"name":"doNothing","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Utility/doNothing.lua"]},{"name":"isSimilar","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Utility/isSimilar.lua"]},{"name":"needsDestruction","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Utility/needsDestruction.lua"]},{"name":"restrictRead","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Utility/restrictRead.lua"]},{"name":"xtypeof","className":"ModuleScript","filePaths":["Packages/_Index/elttob_fusion@0.2.0/fusion/src/Utility/xtypeof.lua"]}]}]}]}]},{"name":"Lydie","className":"ModuleScript","filePaths":["src/init.luau"],"children":[{"name":"Components","className":"ModuleScript","filePaths":["src/Components/init.luau"],"children":[{"name":"Controls","className":"Folder","children":[{"name":"AppBarButton","className":"ModuleScript","filePaths":["src/Components/Controls/AppBarButton.luau"]},{"name":"AppTabBarButton","className":"ModuleScript","filePaths":["src/Components/Controls/AppTabBarButton.luau"]},{"name":"BaseButton","className":"ModuleScript","filePaths":["src/Components/Controls/BaseButton.luau"]},{"name":"Checkbox","className":"ModuleScript","filePaths":["src/Components/Controls/Checkbox.luau"]},{"name":"IconButton","className":"ModuleScript","filePaths":["src/Components/Controls/IconButton.luau"]},{"name":"IconTextButton","className":"ModuleScript","filePaths":["src/Components/Controls/IconTextButton.luau"]},{"name":"Icons","className":"ModuleScript","filePaths":["src/Components/Controls/Icons.luau"]},{"name":"Slider","className":"ModuleScript","filePaths":["src/Components/Controls/Slider.luau"]},{"name":"TextButton","className":"ModuleScript","filePaths":["src/Components/Controls/TextButton.luau"]},{"name":"TextField","className":"ModuleScript","filePaths":["src/Components/Controls/TextField.luau"]},{"name":"Toggle","className":"ModuleScript","filePaths":["src/Components/Controls/Toggle.luau"]}]},{"name":"Divider","className":"ModuleScript","filePaths":["src/Components/Divider.luau"]},{"name":"Shadow","className":"ModuleScript","filePaths":["src/Components/Shadow.luau"]},{"name":"Views","className":"Folder","children":[{"name":"AppTabBar","className":"ModuleScript","filePaths":["src/Components/Views/AppTabBar.luau"]},{"name":"BottomAppBar","className":"ModuleScript","filePaths":["src/Components/Views/BottomAppBar.luau"]},{"name":"ToolTip","className":"ModuleScript","filePaths":["src/Components/Views/ToolTip.luau"]},{"name":"TopAppBar","className":"ModuleScript","filePaths":["src/Components/Views/TopAppBar.luau"]},{"name":"Window","className":"ModuleScript","filePaths":["src/Components/Views/Window.luau"]}]}]},{"name":"Modules","className":"ModuleScript","filePaths":["src/Modules/init.luau"],"children":[{"name":"Constants","className":"ModuleScript","filePaths":["src/Modules/Constants.luau"]},{"name":"EnumList","className":"ModuleScript","filePaths":["src/Modules/EnumList.luau"]},{"name":"Icons","className":"ModuleScript","filePaths":["src/Modules/Icons.luau"]},{"name":"Scheme","className":"ModuleScript","filePaths":["src/Modules/Scheme/init.luau"],"children":[{"name":"Schemes","className":"Folder","children":[{"name":"Dark","className":"ModuleScript","filePaths":["src/Modules/Scheme/Schemes/Dark.luau"]},{"name":"Light","className":"ModuleScript","filePaths":["src/Modules/Scheme/Schemes/Light.luau"]},{"name":"SolarizedDark","className":"ModuleScript","filePaths":["src/Modules/Scheme/Schemes/SolarizedDark.luau"]}]}]},{"name":"SharedStates","className":"ModuleScript","filePaths":["src/Modules/SharedStates.luau"]}]}]}]}]},{"name":"StarterPlayer","className":"StarterPlayer","children":[{"name":"StarterPlayerScripts","className":"StarterPlayerScripts","children":[{"name":"Demo","className":"LocalScript","filePaths":["Tests/Demo.client.luau"]}]}]}]} \ No newline at end of file diff --git a/src/Components/Controls/AppBarButton.luau b/src/Components/Controls/AppBarButton.luau deleted file mode 100644 index 7c80c7e..0000000 --- a/src/Components/Controls/AppBarButton.luau +++ /dev/null @@ -1,24 +0,0 @@ --- 7kayoh --- AppBarButton.lua --- 20 February 2022 - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules - -local Icons = require(Modules.Icons) -local Scheme = require(Modules.Scheme) -local IconButton = require(Components.Controls.IconButton) - -return function(props) - return IconButton({ - _iconSize = UDim2.fromScale(0.5, 0.5), - BackgroundOpacity = 1, - Icon = props.Icon or Icons["loader-2"], - LayoutOrder = props.LayoutOrder, - ForegroundColor = Scheme.GetAnimated(Scheme.Color.Text.Secondary), - - Size = UDim2.fromScale(0.8, 0.8), - - OnClick = props.OnClick, - }) -end diff --git a/src/Components/Controls/AppTabBarButton.luau b/src/Components/Controls/AppTabBarButton.luau deleted file mode 100644 index 2df5605..0000000 --- a/src/Components/Controls/AppTabBarButton.luau +++ /dev/null @@ -1,49 +0,0 @@ --- 7kayoh --- AppTabBarButton.lua --- 21 February 2022 - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Constants = require(Modules.Constants) -local Icons = require(Modules.Icons) -local Scheme = require(Modules.Scheme) -local IconButton = require(Components.Controls.IconButton) - -return function(props) - props.State = props.State or Fusion.Value(false) - return IconButton({ - _iconSize = UDim2.fromScale(0.5, 0.5), - BackgroundOpacity = 1, - Icon = props.Icon or Icons["loader-2"], - LayoutOrder = props.LayoutOrder, - ForegroundColor = Scheme.GetAnimated(Fusion.Computed(function() - return props.State:get() and Scheme.Accent:get() or Scheme.Color.Text.Secondary:get() - end)), - - Size = UDim2.fromScale(0.8, 0.8), - - OnClick = function() - if props.OnClick then - props.OnClick(props.State) - end - end, - - [Fusion.Children] = { - Fusion.New("ImageLabel")({ - BackgroundTransparency = 1, - Image = Constants.Rounded.Id, - ImageColor3 = Scheme.GetAnimated(Scheme.Accent), - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Constants.Rounded.Center, - SliceScale = Constants.RoundedValues[8], - Visible = props.State, - - Position = UDim2.new(0, 0, 1.2, -6), - Size = UDim2.new(1, 0, 0, 8), - }), - }, - }) -end diff --git a/src/Components/Controls/BaseButton.luau b/src/Components/Controls/BaseButton.luau deleted file mode 100644 index fd9b262..0000000 --- a/src/Components/Controls/BaseButton.luau +++ /dev/null @@ -1,78 +0,0 @@ --- 7kayoh --- TextButton.lua --- 10 February 2022 - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Constants = require(Modules.Constants) -local Scheme = require(Modules.Scheme) - -local Children = Fusion.Children -local New = Fusion.New -local OnEvent = Fusion.OnEvent - -return function(props) - local layerOpacity = Fusion.Value(1) - - return New("ImageButton")({ - BackgroundTransparency = 1, - Image = Constants.Rounded.Id, - ImageColor3 = props.BackgroundColor or Scheme.GetAnimated(Scheme.Color.Text.Primary), - ImageTransparency = props.BackgroundOpacity or 0.85, - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Constants.Rounded.Center, - SliceScale = props.RoundedValue or Constants.RoundedValues[8], - LayoutOrder = props.LayoutOrder or 0, - ZIndex = props.ZIndex, - - AnchorPoint = props.AnchorPoint or Vector2.new(0, 0), - Position = props.Position or UDim2.fromScale(0, 0), - Size = props.Size or UDim2.fromOffset(200, 50), - - [Children] = { - New("ImageLabel")({ - BackgroundTransparency = 1, - Image = Constants.Rounded.Id, - ImageColor3 = Color3.new(), - ImageTransparency = Fusion.Tween(layerOpacity, TweenInfo.new(0.15)), - LayoutOrder = props.LayoutOrder or 1, - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Constants.Rounded.Center, - SliceScale = props.RoundedValue or Constants.RoundedValues[8], - Visible = true, - ZIndex = 2, - - Size = UDim2.fromScale(1, 1), - }), - - props[Children], - }, - - [OnEvent("MouseEnter")] = function() - layerOpacity:set(0.85) - end, - - [OnEvent("MouseLeave")] = function() - layerOpacity:set(1) - end, - - [OnEvent("MouseButton1Down")] = function() - layerOpacity:set(0.7) - if props.OnClickDown then - props.OnClickDown() - end - end, - - [OnEvent("InputEnded")] = function(input) - if table.find({Enum.UserInputType.MouseButton1, Enum.UserInputType.Touch}, input.UserInputType) then - layerOpacity:set(1) - if props.OnClick then - props.OnClick() - end - end - end, - }) -end diff --git a/src/Components/Controls/Checkbox.luau b/src/Components/Controls/Checkbox.luau deleted file mode 100644 index fb03fb6..0000000 --- a/src/Components/Controls/Checkbox.luau +++ /dev/null @@ -1,67 +0,0 @@ --- 7kayoh --- Checkbox.lua --- 24 March 2022 - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Icons = require(Modules.Icons) -local Scheme = require(Modules.Scheme) -local BaseButton = require(Components.Controls.BaseButton) - -local Children = Fusion.Children -local New = Fusion.New -local Value = Fusion.Value -local Computed = Fusion.Computed - -return function(props) - props.Toggled = Value(false) - - local component = BaseButton({ - BackgroundColor = Scheme.GetAnimated(Computed(function() - if props.Toggled:get() then - return Scheme.Accent:get() - else - return Scheme.Color.Text.Primary:get() - end - end)), - BackgroundOpacity = Scheme.GetAnimated(Computed(function() - if props.Toggled:get() then - return 0 - else - return 0.6 - end - end)), - ZIndex = props.ZIndex or 1, - - Size = UDim2.fromOffset(24, 24), - Position = props.Position or UDim2.fromOffset(0, 0), - - [Children] = { - New("ImageLabel")({ - BackgroundTransparency = 1, - Image = Icons.check, - ImageColor3 = Scheme.GetAnimated(Scheme.Elevation[2]), - ImageTransparency = Scheme.GetAnimated(Fusion.Computed(function() - return props.Toggled:get() and 0 or 1 - end)), - - AnchorPoint = Vector2.new(0.5, 0.5), - Position = UDim2.fromScale(0.5, 0.5), - Size = UDim2.fromScale(0.7, 0.7), - }), - }, - - OnClick = function() - if props.OnClick then - props.OnClick(props.Toggled) - else - props.Toggled:set(not props.Toggled:get()) - end - end, - }) - - return component -end diff --git a/src/Components/Controls/ColorPicker.luau b/src/Components/Controls/ColorPicker.luau deleted file mode 100644 index b98c00e..0000000 --- a/src/Components/Controls/ColorPicker.luau +++ /dev/null @@ -1,124 +0,0 @@ --- 7kayoh --- ColorPicker.lua --- 24 Apr 2024 - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Slider = require(Components.Controls.Slider) -local Constants = require(Modules.Constants) -local Scheme = require(Modules.Scheme) - -local Children = Fusion.Children -local Computed = Fusion.Computed -local Hydrate = Fusion.Hydrate -local New = Fusion.New -local Value = Fusion.Value - -return function(props) - local hueValue = props.HueValue or Value(0) - local satValue = props.SatValue or Value(0) - local briValue = props.BriValue or Value(0) - local colorValue = Computed(function() - return Color3.fromHSV(hueValue:get(), satValue:get(), briValue:get()) - end) - - local function pickerSlider(text, color, value, layoutOrder) - local sliderComp = Slider { - GradientColor = color, - Value = value, - Stepper = Value(1), - } - - return New "Frame" { - BackgroundTransparency = 1, - AutomaticSize = Enum.AutomaticSize.Y, - Size = UDim2.fromScale(1, 0), - LayoutOrder = layoutOrder, - - [Children] = { - New "UIListLayout" { - Padding = UDim.new(0, 20), - FillDirection = Enum.FillDirection.Horizontal, - SortOrder = Enum.SortOrder.LayoutOrder, - VerticalAlignment = Enum.VerticalAlignment.Center, - HorizontalAlignment = Enum.HorizontalAlignment.Center, - }, - - New "UIPadding" { - PaddingRight = UDim.new(0, 5), - }, - - New "TextLabel" { - BackgroundTransparency = 1, - AutomaticSize = Enum.AutomaticSize.XY, - Font = Scheme.Typography.Secondary.Font, - Text = text, - TextColor3 = Scheme.GetAnimated(Scheme.Color.Text.Secondary), - TextXAlignment = Enum.TextXAlignment.Right, - TextSize = Scheme.Typography.Secondary.Size, - LayoutOrder = 1, - }, - - Hydrate(sliderComp) { - ImageColor3 = Color3.new(1, 1, 1), - ImageTransparency = 0, - Size = UDim2.new(1, -45, 0, 8), - LayoutOrder = 2 - } - } - } - end - - return New "Frame" { - AutomaticSize = Enum.AutomaticSize.Y, - BackgroundTransparency = 1, - - [Children] = { - New "UIListLayout" { - Padding = UDim.new(0, 15), - SortOrder = Enum.SortOrder.LayoutOrder, - }, - - New "ImageLabel" { - BackgroundTransparency = 1, - Image = Constants.Rounded.Id, - ImageColor3 = colorValue, - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Constants.Rounded.Center, - SliceScale = Constants.RoundedValues[8], - - Size = UDim2.new(1, 0, 0, 80), - LayoutOrder = 1, - }, - - pickerSlider("H", Computed(function() - return ColorSequence.new({ - ColorSequenceKeypoint.new(0, Color3.fromHSV(0, satValue:get(), briValue:get())), - ColorSequenceKeypoint.new(0.166, Color3.fromHSV(0.166, satValue:get(), briValue:get())), - ColorSequenceKeypoint.new(0.333, Color3.fromHSV(0.333, satValue:get(), briValue:get())), - ColorSequenceKeypoint.new(0.5, Color3.fromHSV(0.5, satValue:get(), briValue:get())), - ColorSequenceKeypoint.new(0.666, Color3.fromHSV(0.666, satValue:get(), briValue:get())), - ColorSequenceKeypoint.new(0.833, Color3.fromHSV(0.833, satValue:get(), briValue:get())), - ColorSequenceKeypoint.new(1, Color3.fromHSV(1, satValue:get(), briValue:get())) - }) - end), hueValue, 2), - - pickerSlider("S", Computed(function() - return ColorSequence.new({ - ColorSequenceKeypoint.new(0, Color3.fromHSV(0, 0, briValue:get())), - ColorSequenceKeypoint.new(1, Color3.fromHSV(hueValue:get(), 1, briValue:get())), - }) - end), satValue, 3), - - pickerSlider("V", Computed(function() - return ColorSequence.new({ - ColorSequenceKeypoint.new(0, Color3.fromHSV(0, 0, 0)), - ColorSequenceKeypoint.new(1, Color3.fromHSV(hueValue:get(), satValue:get(), 1)), - }) - end), briValue, 4), - } - } -end \ No newline at end of file diff --git a/src/Components/Controls/IconButton.luau b/src/Components/Controls/IconButton.luau deleted file mode 100644 index 4679801..0000000 --- a/src/Components/Controls/IconButton.luau +++ /dev/null @@ -1,43 +0,0 @@ --- 7kayoh --- IconButton.lua --- 17 March 2022 - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Scheme = require(Modules.Scheme) - -local BaseButton = require(Components.Controls.BaseButton) - -local New = Fusion.New -local Children = Fusion.Children - -return function(props) - props[Children] = props[Children] or {} - - table.insert( - props[Children], - New("UIAspectRatioConstraint")({ - AspectRatio = 1, - }) - ) - - table.insert( - props[Children], - New("ImageLabel")({ - BackgroundTransparency = 1, - Image = props.Icon, - ImageColor3 = props.ForegroundColor or props.BackgroundColor or Scheme.GetAnimated( - Scheme.Color.Text.Primary - ), - - AnchorPoint = Vector2.new(0.5, 0.5), - Position = UDim2.fromScale(0.5, 0.5), - Size = props._iconSize or UDim2.fromScale(0.45, 0.45), - }) - ) - - return BaseButton(props) -end diff --git a/src/Components/Controls/IconTextButton.luau b/src/Components/Controls/IconTextButton.luau deleted file mode 100644 index de19d3c..0000000 --- a/src/Components/Controls/IconTextButton.luau +++ /dev/null @@ -1,76 +0,0 @@ --- 7kayoh --- IconTextButton.lua --- 17 March 2022 -local TextService = game:GetService("TextService") - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Scheme = require(Modules.Scheme) -local BaseButton = require(Components.Controls.BaseButton) - -local New = Fusion.New -local Children = Fusion.Children - -return function(props) - props[Children] = { - New("Frame")({ - BackgroundTransparency = 1, - - Size = UDim2.fromScale(1, 1), - - [Children] = { - New("UIListLayout")({ - Padding = UDim.new(0, 10), - FillDirection = Enum.FillDirection.Horizontal, - HorizontalAlignment = Enum.HorizontalAlignment.Center, - VerticalAlignment = Enum.VerticalAlignment.Center, - SortOrder = Enum.SortOrder.LayoutOrder, - }), - - New("ImageLabel")({ - BackgroundTransparency = 1, - Image = props.Icon, - ImageColor3 = props.ForegroundColor or props.BackgroundColor or Scheme.GetAnimated( - Scheme.Color.Text.Primary - ), - LayoutOrder = props.IconLayoutOrder or 0, - - Size = UDim2.fromScale(0.45, 0.45), - - [Children] = { - New("UIAspectRatioConstraint")({ - AspectRatio = 1, - }), - }, - }), - - New("TextLabel")({ - BackgroundTransparency = 1, - Font = Scheme.Typography.Button.Font, - LayoutOrder = 1, - Text = props.Text, - TextColor3 = props.ForegroundColor or props.BackgroundColor or Scheme.GetAnimated( - Scheme.Color.Text.Primary - ), - TextSize = Scheme.Typography.Button.Size, - - Size = Fusion.Computed(function() - local textSize = TextService:GetTextSize( - props.Text:get(), - Scheme.Typography.Button.Size:get(), - Scheme.Typography.Button.Font:get(), - Vector2.new(math.huge, math.huge) - ) - - return UDim2.fromOffset(textSize.X, textSize.Y) - end), - }), - }, - }), - } - - return BaseButton(props) -end diff --git a/src/Components/Controls/Icons.luau b/src/Components/Controls/Icons.luau deleted file mode 100644 index 865d2fe..0000000 --- a/src/Components/Controls/Icons.luau +++ /dev/null @@ -1,502 +0,0 @@ --- This file was @generated by Tarmac. It is not intended for manual editing. -return { - icons = { - CD = "rbxassetid://7734110220", - activity = "rbxassetid://7733655755", - airplay = "rbxassetid://7733655834", - ["alarm-check"] = "rbxassetid://7733655912", - ["alarm-clock"] = "rbxassetid://7733656100", - ["alarm-clock-off"] = "rbxassetid://7733656003", - ["alarm-minus"] = "rbxassetid://7733656164", - ["alarm-plus"] = "rbxassetid://7733658066", - album = "rbxassetid://7733658133", - ["alert-circle"] = "rbxassetid://7733658271", - ["alert-octagon"] = "rbxassetid://7733658335", - ["alert-triangle"] = "rbxassetid://7733658504", - ["align-center"] = "rbxassetid://7733909776", - ["align-justify"] = "rbxassetid://7733661326", - ["align-left"] = "rbxassetid://7733911357", - ["align-right"] = "rbxassetid://7733663582", - anchor = "rbxassetid://7733911490", - aperture = "rbxassetid://7733666258", - archive = "rbxassetid://7733911621", - ["arrow-big-down"] = "rbxassetid://7733668653", - ["arrow-big-left"] = "rbxassetid://7733911731", - ["arrow-big-right"] = "rbxassetid://7733671493", - ["arrow-big-up"] = "rbxassetid://7733671663", - ["arrow-down"] = "rbxassetid://7733672933", - ["arrow-down-circle"] = "rbxassetid://7733671763", - ["arrow-down-left"] = "rbxassetid://7733672282", - ["arrow-down-right"] = "rbxassetid://7733672831", - ["arrow-left"] = "rbxassetid://7733673136", - ["arrow-left-circle"] = "rbxassetid://7733673056", - ["arrow-right"] = "rbxassetid://7733673345", - ["arrow-right-circle"] = "rbxassetid://7733673229", - ["arrow-up"] = "rbxassetid://7733673717", - ["arrow-up-circle"] = "rbxassetid://7733673466", - ["arrow-up-left"] = "rbxassetid://7733673539", - ["arrow-up-right"] = "rbxassetid://7733673646", - asterisk = "rbxassetid://7733673800", - ["at-sign"] = "rbxassetid://7733673907", - award = "rbxassetid://7733673987", - axe = "rbxassetid://7733674079", - banknote = "rbxassetid://7733674153", - ["bar-chart"] = "rbxassetid://7733674319", - ["bar-chart-2"] = "rbxassetid://7733674239", - battery = "rbxassetid://7733674820", - ["battery-charging"] = "rbxassetid://7733674402", - ["battery-full"] = "rbxassetid://7733674503", - ["battery-low"] = "rbxassetid://7733674589", - ["battery-medium"] = "rbxassetid://7733674731", - beaker = "rbxassetid://7733674922", - bell = "rbxassetid://7733911828", - ["bell-minus"] = "rbxassetid://7733675028", - ["bell-off"] = "rbxassetid://7733675107", - ["bell-plus"] = "rbxassetid://7733675181", - ["bell-ring"] = "rbxassetid://7733675275", - bike = "rbxassetid://7733678330", - binary = "rbxassetid://7733678388", - bluetooth = "rbxassetid://7733687147", - ["bluetooth-connected"] = "rbxassetid://7734110952", - ["bluetooth-off"] = "rbxassetid://7733914252", - ["bluetooth-searching"] = "rbxassetid://7733914320", - bold = "rbxassetid://7733687211", - book = "rbxassetid://7733914390", - ["book-open"] = "rbxassetid://7733687281", - bookmark = "rbxassetid://7733692043", - ["bookmark-minus"] = "rbxassetid://7733689754", - ["bookmark-plus"] = "rbxassetid://7734111084", - bot = "rbxassetid://7733916988", - box = "rbxassetid://7733917120", - ["box-select"] = "rbxassetid://7733696665", - briefcase = "rbxassetid://7733919017", - brush = "rbxassetid://7733701455", - bug = "rbxassetid://7733701545", - building = "rbxassetid://7733701625", - bus = "rbxassetid://7733701715", - calculator = "rbxassetid://7733919105", - calendar = "rbxassetid://7733919198", - camera = "rbxassetid://7733708692", - ["camera-off"] = "rbxassetid://7733919260", - car = "rbxassetid://7733708835", - cast = "rbxassetid://7733919326", - check = "rbxassetid://7733715400", - ["check-circle"] = "rbxassetid://7733919427", - ["check-circle-2"] = "rbxassetid://7733710700", - ["check-square"] = "rbxassetid://7733919526", - ["chevron-down"] = "rbxassetid://7733717447", - ["chevron-left"] = "rbxassetid://7733717651", - ["chevron-right"] = "rbxassetid://7733717755", - ["chevron-up"] = "rbxassetid://7733919605", - ["chevrons-down"] = "rbxassetid://7733720604", - ["chevrons-down-up"] = "rbxassetid://7733720483", - ["chevrons-left"] = "rbxassetid://7733720701", - ["chevrons-right"] = "rbxassetid://7733919682", - ["chevrons-up"] = "rbxassetid://7733723433", - ["chevrons-up-down"] = "rbxassetid://7733723321", - chrome = "rbxassetid://7733919783", - circle = "rbxassetid://7733919881", - clipboard = "rbxassetid://7733734762", - ["clipboard-check"] = "rbxassetid://7733919947", - ["clipboard-copy"] = "rbxassetid://7733920037", - ["clipboard-list"] = "rbxassetid://7733920117", - ["clipboard-x"] = "rbxassetid://7733734668", - clock = "rbxassetid://7733734848", - cloud = "rbxassetid://7733746980", - ["cloud-drizzle"] = "rbxassetid://7733920226", - ["cloud-fog"] = "rbxassetid://7733920317", - ["cloud-hail"] = "rbxassetid://7733920444", - ["cloud-lightning"] = "rbxassetid://7733741741", - ["cloud-moon"] = "rbxassetid://7733920519", - ["cloud-off"] = "rbxassetid://7733745572", - ["cloud-rain"] = "rbxassetid://7733746651", - ["cloud-rain-wind"] = "rbxassetid://7733746456", - ["cloud-snow"] = "rbxassetid://7733746798", - ["cloud-sun"] = "rbxassetid://7733746880", - cloudy = "rbxassetid://7733747106", - clover = "rbxassetid://7733747233", - code = "rbxassetid://7733749837", - ["code-2"] = "rbxassetid://7733920644", - codepen = "rbxassetid://7733920768", - codesandbox = "rbxassetid://7733752575", - coffee = "rbxassetid://7733752630", - coins = "rbxassetid://7743866529", - columns = "rbxassetid://7733757178", - command = "rbxassetid://7733924046", - compass = "rbxassetid://7733924216", - contact = "rbxassetid://7743866666", - contrast = "rbxassetid://7733764005", - copy = "rbxassetid://7733764083", - copyleft = "rbxassetid://7733764196", - copyright = "rbxassetid://7733764275", - ["corner-down-left"] = "rbxassetid://7733764327", - ["corner-down-right"] = "rbxassetid://7733764385", - ["corner-left-down"] = "rbxassetid://7733764448", - ["corner-left-up"] = "rbxassetid://7733764536", - ["corner-right-down"] = "rbxassetid://7733764605", - ["corner-right-up"] = "rbxassetid://7733764680", - ["corner-up-left"] = "rbxassetid://7733764800", - ["corner-up-right"] = "rbxassetid://7733764915", - cpu = "rbxassetid://7733765045", - crop = "rbxassetid://7733765140", - cross = "rbxassetid://7733765224", - crosshair = "rbxassetid://7733765307", - crown = "rbxassetid://7733765398", - currency = "rbxassetid://7733765592", - database = "rbxassetid://7743866778", - delete = "rbxassetid://7733768142", - divide = "rbxassetid://7733769365", - ["divide-circle"] = "rbxassetid://7733769152", - ["divide-square"] = "rbxassetid://7733769261", - ["dollar-sign"] = "rbxassetid://7733770599", - download = "rbxassetid://7733770755", - ["download-cloud"] = "rbxassetid://7733770689", - dribbble = "rbxassetid://7733770843", - droplet = "rbxassetid://7733770982", - droplets = "rbxassetid://7733771078", - edit = "rbxassetid://7733771472", - ["edit-2"] = "rbxassetid://7733771217", - ["edit-3"] = "rbxassetid://7733771361", - electricity = "rbxassetid://7733771628", - ["electricity-off"] = "rbxassetid://7733771563", - equal = "rbxassetid://7733771811", - ["equal-not"] = "rbxassetid://7733771726", - euro = "rbxassetid://7733771891", - expand = "rbxassetid://7733771982", - ["external-link"] = "rbxassetid://7743866903", - eye = "rbxassetid://7733774602", - ["eye-off"] = "rbxassetid://7733774495", - ["fast-forward"] = "rbxassetid://7743867090", - feather = "rbxassetid://7733777166", - figma = "rbxassetid://7743867310", - file = "rbxassetid://7733793319", - ["file-check"] = "rbxassetid://7733779668", - ["file-check-2"] = "rbxassetid://7733779610", - ["file-code"] = "rbxassetid://7733779730", - ["file-digit"] = "rbxassetid://7733935829", - ["file-input"] = "rbxassetid://7733935917", - ["file-minus"] = "rbxassetid://7733936115", - ["file-minus-2"] = "rbxassetid://7733936010", - ["file-output"] = "rbxassetid://7733788742", - ["file-plus"] = "rbxassetid://7733788885", - ["file-plus-2"] = "rbxassetid://7733788816", - ["file-search"] = "rbxassetid://7733788966", - ["file-text"] = "rbxassetid://7733789088", - ["file-x"] = "rbxassetid://7733938136", - ["file-x-2"] = "rbxassetid://7743867554", - files = "rbxassetid://7743867811", - film = "rbxassetid://7733942579", - filter = "rbxassetid://7733798407", - flag = "rbxassetid://7733798691", - ["flag-triangle-left"] = "rbxassetid://7733798509", - ["flag-triangle-right"] = "rbxassetid://7733798634", - flame = "rbxassetid://7733798747", - flashlight = "rbxassetid://7733798851", - ["flashlight-off"] = "rbxassetid://7733798799", - ["flask-conical"] = "rbxassetid://7733798901", - ["flask-round"] = "rbxassetid://7733798957", - folder = "rbxassetid://7733799185", - ["folder-minus"] = "rbxassetid://7733799022", - ["folder-plus"] = "rbxassetid://7733799092", - ["form-input"] = "rbxassetid://7733799275", - forward = "rbxassetid://7733799371", - framer = "rbxassetid://7733799486", - frown = "rbxassetid://7733799591", - ["function-square"] = "rbxassetid://7733799682", - gamepad = "rbxassetid://7733799901", - ["gamepad-2"] = "rbxassetid://7733799795", - gauge = "rbxassetid://7733799969", - gavel = "rbxassetid://7733800044", - gem = "rbxassetid://7733942651", - ghost = "rbxassetid://7743868000", - gift = "rbxassetid://7733946818", - ["gift-card"] = "rbxassetid://7733945018", - ["git-branch"] = "rbxassetid://7733949149", - ["git-branch-plus"] = "rbxassetid://7743868200", - ["git-commit"] = "rbxassetid://7743868360", - ["git-merge"] = "rbxassetid://7733952195", - ["git-pull-request"] = "rbxassetid://7733952287", - github = "rbxassetid://7733954058", - gitlab = "rbxassetid://7733954246", - glasses = "rbxassetid://7733954403", - globe = "rbxassetid://7733954760", - ["globe-2"] = "rbxassetid://7733954611", - grab = "rbxassetid://7733954884", - ["graduation-cap"] = "rbxassetid://7733955058", - grid = "rbxassetid://7733955179", - ["grip-horizontal"] = "rbxassetid://7733955302", - ["grip-vertical"] = "rbxassetid://7733955410", - hammer = "rbxassetid://7733955511", - hand = "rbxassetid://7733955740", - ["hand-metal"] = "rbxassetid://7733955664", - ["hard-drive"] = "rbxassetid://7733955793", - ["hard-hat"] = "rbxassetid://7733955850", - hash = "rbxassetid://7733955906", - haze = "rbxassetid://7733955969", - headphones = "rbxassetid://7733956063", - heart = "rbxassetid://7733956134", - ["help-circle"] = "rbxassetid://7733956210", - hexagon = "rbxassetid://7743868527", - highlighter = "rbxassetid://7743868648", - history = "rbxassetid://7733960880", - home = "rbxassetid://7733960981", - image = "rbxassetid://7733964126", - ["image-minus"] = "rbxassetid://7733963797", - ["image-off"] = "rbxassetid://7733963907", - ["image-plus"] = "rbxassetid://7733964016", - import = "rbxassetid://7733964240", - inbox = "rbxassetid://7733964370", - indent = "rbxassetid://7733964452", - ["indian-rupee"] = "rbxassetid://7733964536", - infinity = "rbxassetid://7733964640", - info = "rbxassetid://7733964719", - inspect = "rbxassetid://7733964808", - italic = "rbxassetid://7733964917", - ["jersey-pound"] = "rbxassetid://7733965029", - key = "rbxassetid://7733965118", - landmark = "rbxassetid://7733965184", - languages = "rbxassetid://7733965249", - laptop = "rbxassetid://7733965386", - ["laptop-2"] = "rbxassetid://7733965313", - lasso = "rbxassetid://7733967892", - ["lasso-select"] = "rbxassetid://7743868832", - layers = "rbxassetid://7743868936", - layout = "rbxassetid://7733970543", - ["layout-dashboard"] = "rbxassetid://7733970318", - ["layout-grid"] = "rbxassetid://7733970390", - ["layout-list"] = "rbxassetid://7733970442", - ["layout-template"] = "rbxassetid://7733970494", - library = "rbxassetid://7743869054", - ["life-buoy"] = "rbxassetid://7733973479", - lightbulb = "rbxassetid://7733975185", - ["lightbulb-off"] = "rbxassetid://7733975123", - link = "rbxassetid://7733978098", - ["link-2"] = "rbxassetid://7743869163", - ["link-2-off"] = "rbxassetid://7733975283", - list = "rbxassetid://7743869612", - ["list-checks"] = "rbxassetid://7743869317", - ["list-minus"] = "rbxassetid://7733980795", - ["list-ordered"] = "rbxassetid://7743869411", - ["list-plus"] = "rbxassetid://7733984995", - ["list-x"] = "rbxassetid://7743869517", - loader = "rbxassetid://7733992358", - ["loader-2"] = "rbxassetid://7733989869", - locate = "rbxassetid://7733992469", - ["locate-fixed"] = "rbxassetid://7733992424", - lock = "rbxassetid://7733992528", - ["log-in"] = "rbxassetid://7733992604", - ["log-out"] = "rbxassetid://7733992677", - mail = "rbxassetid://7733992732", - map = "rbxassetid://7733992829", - ["map-pin"] = "rbxassetid://7733992789", - maximize = "rbxassetid://7733992982", - ["maximize-2"] = "rbxassetid://7733992901", - megaphone = "rbxassetid://7733993049", - meh = "rbxassetid://7733993147", - menu = "rbxassetid://7733993211", - ["message-circle"] = "rbxassetid://7733993311", - ["message-square"] = "rbxassetid://7733993369", - mic = "rbxassetid://7743869805", - ["mic-off"] = "rbxassetid://7743869714", - minimize = "rbxassetid://7733997941", - ["minimize-2"] = "rbxassetid://7733997870", - minus = "rbxassetid://7734000129", - ["minus-circle"] = "rbxassetid://7733998053", - ["minus-square"] = "rbxassetid://7743869899", - monitor = "rbxassetid://7734002839", - ["monitor-off"] = "rbxassetid://7734000184", - ["monitor-speaker"] = "rbxassetid://7743869988", - moon = "rbxassetid://7743870134", - ["more-horizontal"] = "rbxassetid://7734006080", - ["more-vertical"] = "rbxassetid://7734006187", - mountain = "rbxassetid://7734008868", - ["mountain-snow"] = "rbxassetid://7743870286", - ["mouse-pointer"] = "rbxassetid://7743870392", - ["mouse-pointer-2"] = "rbxassetid://7734010405", - ["mouse-pointer-click"] = "rbxassetid://7734010488", - move = "rbxassetid://7743870731", - ["move-diagonal"] = "rbxassetid://7743870505", - ["move-diagonal-2"] = "rbxassetid://7734013178", - ["move-horizontal"] = "rbxassetid://7734016210", - ["move-vertical"] = "rbxassetid://7743870608", - music = "rbxassetid://7734020554", - navigation = "rbxassetid://7734020989", - ["navigation-2"] = "rbxassetid://7734020942", - network = "rbxassetid://7734021047", - no_entry = "rbxassetid://7734021118", - octagon = "rbxassetid://7734021165", - ["on-charge"] = "rbxassetid://7734021231", - option = "rbxassetid://7734021300", - outdent = "rbxassetid://7734021384", - package = "rbxassetid://7734021469", - palette = "rbxassetid://7734021595", - paperclip = "rbxassetid://7734021680", - pause = "rbxassetid://7734021897", - ["pause-circle"] = "rbxassetid://7734021767", - ["pause-octagon"] = "rbxassetid://7734021827", - ["pen-tool"] = "rbxassetid://7734022041", - pencil = "rbxassetid://7734022107", - percent = "rbxassetid://7743870852", - ["person-standing"] = "rbxassetid://7743871002", - phone = "rbxassetid://7734032056", - ["phone-call"] = "rbxassetid://7734027264", - ["phone-forwarded"] = "rbxassetid://7734027345", - ["phone-incoming"] = "rbxassetid://7743871120", - ["phone-missed"] = "rbxassetid://7734029465", - ["phone-off"] = "rbxassetid://7734029534", - ["phone-outgoing"] = "rbxassetid://7743871253", - ["pie-chart"] = "rbxassetid://7734034378", - ["piggy-bank"] = "rbxassetid://7734034513", - pipette = "rbxassetid://7743871384", - plane = "rbxassetid://7734037723", - play = "rbxassetid://7743871480", - ["play-circle"] = "rbxassetid://7734037784", - plus = "rbxassetid://7734042071", - ["plus-circle"] = "rbxassetid://7734040271", - ["plus-square"] = "rbxassetid://7734040369", - pocket = "rbxassetid://7734042139", - podcast = "rbxassetid://7734042234", - pointer = "rbxassetid://7734042307", - ["pound-sterling"] = "rbxassetid://7734042354", - power = "rbxassetid://7734042493", - ["power-off"] = "rbxassetid://7734042423", - printer = "rbxassetid://7734042580", - ["qr-code"] = "rbxassetid://7743871575", - quote = "rbxassetid://7734045100", - radio = "rbxassetid://7743871662", - ["radio-receiver"] = "rbxassetid://7734045155", - redo = "rbxassetid://7743871739", - ["refresh-ccw"] = "rbxassetid://7734050715", - ["refresh-cw"] = "rbxassetid://7734051052", - regex = "rbxassetid://7734051188", - ["repeat"] = "rbxassetid://7734051454", - ["repeat-1"] = "rbxassetid://7734051342", - reply = "rbxassetid://7734051594", - ["reply-all"] = "rbxassetid://7734051524", - rewind = "rbxassetid://7734051670", - ["rocking-chair"] = "rbxassetid://7734051769", - ["rotate-ccw"] = "rbxassetid://7734051861", - ["rotate-cw"] = "rbxassetid://7734051957", - rss = "rbxassetid://7734052075", - ruler = "rbxassetid://7734052157", - ["russian-ruble"] = "rbxassetid://7734052248", - save = "rbxassetid://7734052335", - scale = "rbxassetid://7734052454", - scissors = "rbxassetid://7734052570", - ["screen-share"] = "rbxassetid://7734052814", - ["screen-share-off"] = "rbxassetid://7734052653", - search = "rbxassetid://7734052925", - send = "rbxassetid://7734053039", - ["separator-horizontal"] = "rbxassetid://7734053146", - ["separator-vertical"] = "rbxassetid://7734053213", - server = "rbxassetid://7734053426", - ["server-crash"] = "rbxassetid://7734053281", - ["server-off"] = "rbxassetid://7734053361", - settings = "rbxassetid://7734053495", - share = "rbxassetid://7734053697", - ["share-2"] = "rbxassetid://7734053595", - sheet = "rbxassetid://7743871876", - shield = "rbxassetid://7734056608", - ["shield-alert"] = "rbxassetid://7734056326", - ["shield-check"] = "rbxassetid://7734056411", - ["shield-close"] = "rbxassetid://7734056470", - ["shield-off"] = "rbxassetid://7734056540", - shirt = "rbxassetid://7734056672", - ["shopping-bag"] = "rbxassetid://7734056747", - ["shopping-cart"] = "rbxassetid://7734056813", - shovel = "rbxassetid://7734056878", - shrink = "rbxassetid://7734056971", - shuffle = "rbxassetid://7734057059", - sidebar = "rbxassetid://7734058260", - ["sidebar-close"] = "rbxassetid://7734058092", - ["sidebar-open"] = "rbxassetid://7734058165", - sigma = "rbxassetid://7734058345", - ["skip-back"] = "rbxassetid://7734058404", - ["skip-forward"] = "rbxassetid://7734058495", - skull = "rbxassetid://7734058599", - sliders = "rbxassetid://7734058803", - smartphone = "rbxassetid://7734058979", - ["smartphone-charging"] = "rbxassetid://7734058894", - smile = "rbxassetid://7734059095", - snowflake = "rbxassetid://7734059180", - ["sort-asc"] = "rbxassetid://7734060715", - ["sort-desc"] = "rbxassetid://7743871973", - speaker = "rbxassetid://7734063416", - sprout = "rbxassetid://7743872071", - square = "rbxassetid://7743872181", - star = "rbxassetid://7734068321", - ["star-half"] = "rbxassetid://7734068258", - ["stop-circle"] = "rbxassetid://7734068379", - strikethrough = "rbxassetid://7734068425", - sun = "rbxassetid://7734068495", - sunrise = "rbxassetid://7743872365", - sunset = "rbxassetid://7734070982", - ["swiss-franc"] = "rbxassetid://7734071038", - ["switch-camera"] = "rbxassetid://7743872492", - table = "rbxassetid://7734073253", - tablet = "rbxassetid://7743872620", - tag = "rbxassetid://7734075797", - target = "rbxassetid://7743872758", - tent = "rbxassetid://7734078943", - terminal = "rbxassetid://7743872929", - ["terminal-square"] = "rbxassetid://7734079055", - thermometer = "rbxassetid://7734084149", - ["thermometer-snowflake"] = "rbxassetid://7743873074", - ["thermometer-sun"] = "rbxassetid://7734084018", - ["thumbs-down"] = "rbxassetid://7734084236", - ["thumbs-up"] = "rbxassetid://7743873212", - ticket = "rbxassetid://7734086558", - timer = "rbxassetid://7743873443", - ["timer-reset"] = "rbxassetid://7743873336", - ["toggle-left"] = "rbxassetid://7734091286", - ["toggle-right"] = "rbxassetid://7743873539", - tornado = "rbxassetid://7743873633", - trash = "rbxassetid://7743873871", - ["trash-2"] = "rbxassetid://7743873772", - trello = "rbxassetid://7743873996", - ["trending-down"] = "rbxassetid://7743874143", - ["trending-up"] = "rbxassetid://7743874262", - triangle = "rbxassetid://7743874367", - truck = "rbxassetid://7743874482", - tv = "rbxassetid://7743874674", - ["tv-2"] = "rbxassetid://7743874599", - type = "rbxassetid://7743874740", - umbrella = "rbxassetid://7743874820", - underline = "rbxassetid://7743874904", - undo = "rbxassetid://7743874974", - unlink = "rbxassetid://7743875149", - ["unlink-2"] = "rbxassetid://7743875069", - unlock = "rbxassetid://7743875263", - upload = "rbxassetid://7743875428", - ["upload-cloud"] = "rbxassetid://7743875358", - user = "rbxassetid://7743875962", - ["user-check"] = "rbxassetid://7743875503", - ["user-minus"] = "rbxassetid://7743875629", - ["user-plus"] = "rbxassetid://7743875759", - ["user-x"] = "rbxassetid://7743875879", - users = "rbxassetid://7743876054", - verified = "rbxassetid://7743876142", - vibrate = "rbxassetid://7743876302", - video = "rbxassetid://7743876610", - ["video-off"] = "rbxassetid://7743876466", - view = "rbxassetid://7743876754", - voicemail = "rbxassetid://7743876916", - volume = "rbxassetid://7743877487", - ["volume-1"] = "rbxassetid://7743877081", - ["volume-2"] = "rbxassetid://7743877250", - ["volume-x"] = "rbxassetid://7743877381", - wallet = "rbxassetid://7743877573", - watch = "rbxassetid://7743877668", - webcam = "rbxassetid://7743877896", - wifi = "rbxassetid://7743878148", - ["wifi-off"] = "rbxassetid://7743878056", - wind = "rbxassetid://7743878264", - wrench = "rbxassetid://7743878358", - x = "rbxassetid://7743878857", - ["x-circle"] = "rbxassetid://7743878496", - ["x-octagon"] = "rbxassetid://7743878618", - ["x-square"] = "rbxassetid://7743878737", - ["zoom-in"] = "rbxassetid://7743878977", - ["zoom-out"] = "rbxassetid://7743879082", - }, -} diff --git a/src/Components/Controls/Slider.luau b/src/Components/Controls/Slider.luau deleted file mode 100644 index 39045b4..0000000 --- a/src/Components/Controls/Slider.luau +++ /dev/null @@ -1,139 +0,0 @@ --- 7kayoh --- Slider.lua --- 2 Apr 2022 - -local UserInputService = game:GetService("UserInputService") - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Scheme = require(Modules.Scheme) -local Constants = require(Modules.Constants) -local BaseButton = require(Components.Controls.BaseButton) -local ToolTip = require(Components.Views.ToolTip) - -local New = Fusion.New -local Children = Fusion.Children -local Value = Fusion.Value -local Computed = Fusion.Computed -local Observer = Fusion.Observer -local Tween = Fusion.Tween - -return function(props) - local isListening = Value(false) - props.Value = props.Value or Value(0) - props.Stepper = props.Stepper or Value(5) - local bar = BaseButton({ - Size = UDim2.new(0, 200, 0, 8), - RoundedValue = 1, - - [Children] = { - New "UISizeConstraint" { - MaxSize = Vector2.new(math.huge, 8), - MinSize = Vector2.new(0, 8), - }, - - New "UIGradient" { - Color = props.GradientColor, - }, - - BaseButton({ - BackgroundColor = Scheme.GetAnimated(Scheme.Accent), - BackgroundOpacity = 0, - ZIndex = 3, - - AnchorPoint = Vector2.new(0.5, 0.5), - Position = Computed(function() - return UDim2.fromScale(props.Value:get(), 0.5) - end), - Size = UDim2.new(3, 0, 3, 0), - RoundedValue = 1, - - [Children] = { - New("UIAspectRatioConstraint")({ - AspectRatio = 1, - }), - - New("ImageLabel")({ - BackgroundTransparency = 1, - ImageColor3 = Scheme.GetAnimated(Scheme.Elevation[4]), - Image = Constants.Rounded.Id, - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Constants.Rounded.Center, - SliceScale = 1, - - AnchorPoint = Vector2.new(0.5, 0.5), - Position = UDim2.fromScale(0.5, 0.5), - Size = Tween(Computed(function() - if isListening:get() then - return UDim2.fromScale(0.6, 0.6) - else - return UDim2.fromScale(0.7, 0.7) - end - end), TweenInfo.new(0.3, Enum.EasingStyle.Back)), - }), - - ToolTip({ - Text = props.Value, - Visible = isListening, - }), - }, - - OnClickDown = function() - isListening:set(true) - end, - OnClick = function() - isListening:set(false) - end, - }), - }, - - OnClickDown = function() - isListening:set(true) - end, - OnClick = function() - isListening:set(false) - end, - }) - - local function getClosestStep(value) - local step = props.Stepper:get() - local closest = math.floor(value / step) * step - return closest / 100 - end - - local function update(input) - if isListening:get() then - local percentage - if - table.find( - { Enum.UserInputType.MouseMovement, Enum.UserInputType.Touch, Enum.UserInputType.MouseButton1 }, - input.UserInputType - ) - then - local delta = input.Position.X - bar.AbsolutePosition.X - percentage = delta / bar.AbsoluteSize.X - end - if percentage then - percentage = getClosestStep(math.clamp(percentage, 0, 1) * 100) - props.Value:set(percentage) - end - end - end - - local connection = UserInputService.InputChanged:Connect(update) - local connection2 = UserInputService.InputBegan:Connect(update) - local disconnectObserver = Observer(props.Value):onChange(function() - props.Value:set(getClosestStep(math.clamp(props.Value:get(), 0, 1) * 100)) - end) - - bar.Destroying:Connect(function() - connection:Disconnect() - connection2:Disconnect() - disconnectObserver() - end) - - return bar -end diff --git a/src/Components/Controls/TextButton.luau b/src/Components/Controls/TextButton.luau deleted file mode 100644 index 1440b40..0000000 --- a/src/Components/Controls/TextButton.luau +++ /dev/null @@ -1,34 +0,0 @@ --- 7kayoh --- TextButton.lua --- 17 March 2022 - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Scheme = require(Modules.Scheme) -local BaseButton = require(Components.Controls.BaseButton) - -local New = Fusion.New -local Children = Fusion.Children - -return function(props) - props[Children] = { - New("TextLabel")({ - BackgroundTransparency = 1, - Font = Scheme.Typography.Button.Font, - Text = props.Text, - TextColor3 = props.ForegroundColor or props.BackgroundColor or Scheme.GetAnimated( - Scheme.Color.Text.Primary - ), - TextSize = Scheme.Typography.Button.Size, - - AnchorPoint = Vector2.new(0.5, 0.5), - Position = UDim2.fromScale(0.5, 0.5), - Size = UDim2.fromScale(0, 1), - }), - } - - return BaseButton(props) -end diff --git a/src/Components/Controls/TextField.luau b/src/Components/Controls/TextField.luau deleted file mode 100644 index 99161e2..0000000 --- a/src/Components/Controls/TextField.luau +++ /dev/null @@ -1,166 +0,0 @@ -local TextService = game:GetService("TextService") -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Constants = require(Modules.Constants) -local Scheme = require(Modules.Scheme) - -local Children = Fusion.Children -local Computed = Fusion.Computed -local New = Fusion.New -local OnEvent = Fusion.OnEvent -local OnChange = Fusion.OnChange -local Value = Fusion.Value - -return function(props) - local buttonState = Value(0) - local canvasPosition = Value(Vector2.new(0, 0)) - props.ObservedText = props.ObservedText or Value(props.Text or "") - - local padding = Computed(function() - if buttonState:get() == 2 then - return UDim.new(0, 2) - else - return UDim.new(0, 1) - end - end) - - local textBox = Value(New("TextBox")({ - BackgroundTransparency = 1, - ClearTextOnFocus = false, - Font = Scheme.Typography.Body.Font, - PlaceholderText = props.Placeholder or "Click to type", - Text = props.Text or "", - TextColor3 = Scheme.GetAnimated(Scheme.Color.Text.Primary), - TextSize = Scheme.Typography.Body.Size, - TextXAlignment = Enum.TextXAlignment.Left, - PlaceholderColor3 = Scheme.GetAnimated(Scheme.Color.Text.Tertiary), - - Size = UDim2.new(1, 0, 1, 0), - - [OnChange("Text")] = function(text) - props.ObservedText:set(text) - if props.OnTextChanged then - props.OnTextChanged(text) - end - end, - - [OnChange("CursorPosition")] = function(value) - canvasPosition:set( - TextService:GetTextSize( - string.sub(props.ObservedText:get(), 1, value), - Scheme.Typography.Body.Size:get(), - Scheme.Typography.Body.Font:get(), - Vector2.new(math.huge, math.huge) - ) - ) - end, - - [OnEvent("FocusLost")] = function() - buttonState:set(0) - end, - - [OnEvent("Focused")] = function() - buttonState:set(2) - end, - })) - - return New("ImageButton")({ - BackgroundTransparency = 1, - Image = Constants.Rounded.Id, - ImageColor3 = Scheme.GetAnimated(Computed(function() - if buttonState:get() == 1 then - return Scheme.Color.Text.Secondary:get() - elseif buttonState:get() == 2 then - return props.ForegroundColor and props.ForegroundColor:get() or Scheme.Accent:get() - else - return Scheme.Color.Text.Tertiary:get() - end - end)), - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Constants.Rounded.Center, - SliceScale = Constants.RoundedValues[8], - ZIndex = props.ZIndex or 1, - LayoutOrder = props.LayoutOrder or 1, - - Size = props.Size or UDim2.fromOffset(200, 42), - Position = props.Position or UDim2.fromScale(0, 0), - - [Children] = { - New("UIPadding")({ - PaddingTop = padding, - PaddingLeft = padding, - PaddingRight = padding, - PaddingBottom = padding, - }), - - New("ImageLabel")({ - BackgroundTransparency = 1, - Image = Constants.Rounded.Id, - ImageColor3 = Scheme.GetAnimated(Scheme.Elevation[2]), - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Constants.Rounded.Center, - SliceScale = Computed(function() - if buttonState:get() == 2 then - return Constants.RoundedValues[6] - else - return Constants.RoundedValues[7] - end - end), - ClipsDescendants = true, - - Size = UDim2.new(1, 0, 1, 0), - - [Children] = { - New("ScrollingFrame")({ - BackgroundTransparency = 1, - ScrollBarThickness = 0, - ScrollingDirection = Enum.ScrollingDirection.X, - ClipsDescendants = false, - - CanvasPosition = Fusion.Tween(canvasPosition, TweenInfo.new(0.1, Enum.EasingStyle.Quint)), - CanvasSize = Fusion.Tween( - Computed(function() - return UDim2.fromOffset(canvasPosition:get().X, canvasPosition:get().Y) - end), - TweenInfo.new(0.1, Enum.EasingStyle.Quint) - ), - Position = Computed(function() - return UDim2.fromOffset(Scheme.Typography.Body.Size:get(), 0) - end), - Size = Computed(function() - return UDim2.new(1, -Scheme.Typography.Body.Size:get() * 2, 1, 0) - end), - - [Children] = textBox, - }), - }, - }), - }, - - [OnEvent("MouseEnter")] = function() - if not textBox:get():IsFocused() then - buttonState:set(1) - end - end, - - [OnEvent("MouseLeave")] = function() - if not textBox:get():IsFocused() then - buttonState:set(0) - end - end, - - [OnEvent("MouseButton1Up")] = function() - if not textBox:get():IsFocused() then - textBox:get():CaptureFocus() - else - buttonState:set(0) - end - if props.OnClick then - props.OnClick() - end - end, - }) -end diff --git a/src/Components/Controls/Toggle.luau b/src/Components/Controls/Toggle.luau deleted file mode 100644 index f20137a..0000000 --- a/src/Components/Controls/Toggle.luau +++ /dev/null @@ -1,88 +0,0 @@ --- 7kayoh --- Toggle.lua --- 18 February 2022 - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Constants = require(Modules.Constants) -local Scheme = require(Modules.Scheme) -local BaseButton = require(Components.Controls.BaseButton) - -local Children = Fusion.Children -local New = Fusion.New -local Value = Fusion.Value -local Computed = Fusion.Computed -local Tween = Fusion.Tween - -return function(props) - props.Toggled = Value(false) - - local component = BaseButton({ - BackgroundColor = Scheme.GetAnimated(Computed(function() - if props.Toggled:get() then - return Scheme.Accent:get() - else - return Scheme.Color.Text.Primary:get() - end - end)), - BackgroundOpacity = Scheme.GetAnimated(Computed(function() - if props.Toggled:get() then - return 0 - else - return 0.6 - end - end)), - RoundedValue = 1, - ZIndex = props.ZIndex or 1, - - Size = UDim2.fromOffset(41, 24), - Position = props.Position or UDim2.fromOffset(0, 0), - - [Children] = { - New("Frame")({ - BackgroundTransparency = 1, - - Size = UDim2.fromScale(1, 1), - - [Children] = { - New("ImageLabel")({ - BackgroundTransparency = 1, - Image = Constants.Rounded.Id, - ImageColor3 = Scheme.GetAnimated(Scheme.Elevation[2]), - - Size = UDim2.new(1, -6, 1, -6), - Position = Tween( - Computed(function() - if props.Toggled:get() then - return UDim2.new(0.5, 0, 0, 3) - else - return UDim2.new(0, 3, 0, 3) - end - end), - TweenInfo.new(0.15, Enum.EasingStyle.Quint) - ), - - [Children] = { - New("UIAspectRatioConstraint")({ - AspectRatio = 1, - }), - }, - }), - }, - }), - }, - - OnClick = function() - if props.OnClick then - props.OnClick(props.Toggled) - else - props.Toggled:set(not props.Toggled:get()) - end - end, - }) - - return component -end diff --git a/src/Components/Divider.luau b/src/Components/Divider.luau deleted file mode 100644 index ea1fa04..0000000 --- a/src/Components/Divider.luau +++ /dev/null @@ -1,35 +0,0 @@ --- 7kayoh --- Divider.lua --- 03 February 2022 - ---[[ - - Divider { - AnchorPoint: Vector2?, - Size: UDim2?, - Position: UDim2?, - ZIndex: number? - } -> Frame - ---]] -local Components = script.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Scheme = require(Modules.Scheme) - -local New = Fusion.New - -return function(props) - return New("Frame")({ - Name = "Divider", - - BackgroundColor3 = Scheme.GetAnimated(Scheme.Color.Divider), - ZIndex = props.ZIndex or 1, - - Size = props.Size or UDim2.new(1, 0, 0, 1), - Position = props.Position or UDim2.new(0, 0, 0, 0), - AnchorPoint = props.AnchorPoint or Vector2.new(0, 0), - }) -end diff --git a/src/Components/Shadow.luau b/src/Components/Shadow.luau deleted file mode 100644 index d21291a..0000000 --- a/src/Components/Shadow.luau +++ /dev/null @@ -1,272 +0,0 @@ --- 7kayoh --- Shadow.lua --- 29 January 2022 - --- This component uses code from AmaranthineCodices's Shadow component for roact-material, hosted at --- https://github.com/AmaranthineCodices/roact-material/blob/master/src/Components/Shadow.lua, licensed under --- the MIT license - ---[[ - - Shadow { - Elevation: Value|number, - Size: number?, - ZIndex: number? - } -> Frame - ---]] -local Components = script.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Constants = require(Modules.Constants) - -local Children = Fusion.Children -local ForValues = Fusion.ForValues -local New = Fusion.New -local Value = Fusion.Value - -local shadowData = { - [0] = { - Ambient = { - Opacity = 0, - Blur = 0, - }, - - Penumbra = { - Opacity = 0, - Blur = 0, - }, - - Umbra = { - Opacity = 0, - Blur = 0, - }, - }, - - [1] = { - Ambient = { - Opacity = 0.2, - Blur = 3, - Offset = UDim2.new(0, 0, 0, 1), - }, - - Penumbra = { - Opacity = 0.12, - Blur = 2, - Offset = UDim2.new(0, 0, 0, 2), - }, - - Umbra = { - Opacity = 0.14, - Blur = 2, - }, - }, - - [2] = { - Ambient = { - Opacity = 0.2, - Blur = 5, - Offset = UDim2.new(0, 0, 0, 1), - }, - - Penumbra = { - Opacity = 0.12, - Blur = 4, - Offset = UDim2.new(0, 0, 0, 3), - }, - - Umbra = { - Opacity = 0.14, - Blur = 4, - }, - }, - - [3] = { - Ambient = { - Opacity = 0.2, - Blur = 8, - Offset = UDim2.new(0, 0, 0, 1), - }, - - Penumbra = { - Opacity = 0.12, - Blur = 4, - Offset = UDim2.new(0, 0, 0, 3), - }, - - Umbra = { - Opacity = 0.14, - Blur = 3, - Offset = UDim2.new(0, 0, 0, 3), - }, - }, - - [4] = { - Ambient = { - Opacity = 0.2, - Blur = 10, - Offset = UDim2.new(0, 0, 0, 1), - }, - - Penumbra = { - Opacity = 0.12, - Blur = 5, - Offset = UDim2.new(0, 0, 0, 4), - }, - - Umbra = { - Opacity = 0.14, - Blur = 4, - Offset = UDim2.new(0, 0, 0, 2), - }, - }, - - [6] = { - Ambient = { - Opacity = 0.2, - Blur = 5, - Offset = UDim2.new(0, 0, 0, 3), - }, - - Penumbra = { - Opacity = 0.12, - Blur = 18, - Offset = UDim2.new(0, 0, 0, 1), - }, - - Umbra = { - Opacity = 0.14, - Blur = 10, - Offset = UDim2.new(0, 0, 0, 6), - }, - }, - - [8] = { - Ambient = { - Opacity = 0.2, - Blur = 15, - Offset = UDim2.new(0, 0, 0, 4), - }, - - Penumbra = { - Opacity = 0.12, - Blur = 14, - Offset = UDim2.new(0, 0, 0, 3), - }, - - Umbra = { - Opacity = 0.14, - Blur = 10, - Offset = UDim2.new(0, 0, 0, 8), - }, - }, - - [9] = { - Ambient = { - Opacity = 0.2, - Blur = 6, - Offset = UDim2.new(0, 0, 0, 5), - }, - - Penumbra = { - Opacity = 0.12, - Blur = 16, - Offset = UDim2.new(0, 0, 0, 3), - }, - - Umbra = { - Opacity = 0.14, - Blur = 12, - Offset = UDim2.new(0, 0, 0, 9), - }, - }, - - [12] = { - Ambient = { - Opacity = 0.2, - Blur = 8, - Offset = UDim2.new(0, 0, 0, 7), - }, - - Penumbra = { - Opacity = 0.12, - Blur = 22, - Offset = UDim2.new(0, 0, 0, 5), - }, - - Umbra = { - Opacity = 0.14, - Blur = 17, - Offset = UDim2.new(0, 0, 0, 12), - }, - }, - - [16] = { - Ambient = { - Opacity = 0.2, - Blur = 10, - Offset = UDim2.new(0, 0, 0, 8), - }, - - Penumbra = { - Opacity = 0.12, - Blur = 30, - Offset = UDim2.new(0, 0, 0, 6), - }, - - Umbra = { - Opacity = 0.14, - Blur = 24, - Offset = UDim2.new(0, 0, 0, 16), - }, - }, -} - -for _, elevation in pairs(shadowData) do - for _, data in pairs(elevation) do - data.Size = UDim2.new(1, data.Blur, 1, data.Blur) - data.Position = UDim2.new(0.5, 0, 0.5, 0) + (data.Offset or UDim2.new()) - data.ImageTransparency = 1 - data.Opacity - - data.Blur = nil - data.Offset = nil - data.Opacity = nil - end -end - -return function(props) - if type(props.Elevation) == "number" then - props.Elevation = Value(props.Elevation) - end - - local shadows = ForValues({ "Penumbra", "Umbra", "Ambient" }, function(value) - local data = shadowData[props.Elevation:get()] or shadowData[0] - data = data[value] - - return New("ImageLabel")({ - BackgroundTransparency = 1, - Image = Constants.ShadowImage, - ImageColor3 = Color3.new(0, 0, 0), - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Rect.new(10, 10, 118, 118), - ImageTransparency = data.ImageTransparency, - - AnchorPoint = Vector2.new(0.5, 0.5), - Size = data.Size, - Position = data.Position, - }) - end, function(obj) - obj:Destroy() - end) - - return New("Frame")({ - BackgroundTransparency = 1, - ZIndex = props.ZIndex or 1, - - Size = props.Size or UDim2.fromScale(1, 1), - - [Children] = shadows, - }) -end diff --git a/src/Components/Views/AppTabBar.luau b/src/Components/Views/AppTabBar.luau deleted file mode 100644 index 1042008..0000000 --- a/src/Components/Views/AppTabBar.luau +++ /dev/null @@ -1,31 +0,0 @@ --- 7kayoh --- BottomAppTabBar.lua --- 21 February 2022 - -local Components = script.Parent.Parent -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) - -local Children = Fusion.Children -local New = Fusion.New - -return function(props) - return New("Frame")({ - BackgroundTransparency = 1, - ZIndex = props.ZIndex or 1, - - Size = UDim2.fromScale(1, 1), - ClipsDescendants = true, - - [Children] = { - New("UIListLayout")({ - FillDirection = Enum.FillDirection.Horizontal, - HorizontalAlignment = Enum.HorizontalAlignment.Center, - VerticalAlignment = Enum.VerticalAlignment.Center, - }), - - props[Children], - }, - }) -end diff --git a/src/Components/Views/BottomAppBar.luau b/src/Components/Views/BottomAppBar.luau deleted file mode 100644 index 5bca8b4..0000000 --- a/src/Components/Views/BottomAppBar.luau +++ /dev/null @@ -1,56 +0,0 @@ --- 7kayoh --- BottomAppBar.lua --- 07 February 2022 - ---[[ - - BottomAppBar { - ZIndex: number?, - - [Fusion.Children]: {Instances} - } -> Frame - ---]] - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) - -local Constants = require(Modules.Constants) -local Scheme = require(Modules.Scheme) -local Divider = require(Components.Divider) - -local Children = Fusion.Children -local New = Fusion.New - -return function(props) - return New("Frame")({ - BackgroundTransparency = 1, - ZIndex = props.ZIndex or 1, - - AnchorPoint = Vector2.new(0, 1), - Position = UDim2.fromScale(0, 1), - Size = UDim2.new(1, 0, 0, 50), - - [Children] = { - Divider({ - ZIndex = 2, - }), - - Content = New("ImageLabel")({ - BackgroundTransparency = 1, - Image = Constants.BottomRounded.Id, - ImageColor3 = Scheme.GetAnimated(Scheme.Elevation[4]), - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Constants.BottomRounded.Center, - SliceScale = Constants.RoundedValues[8], - - Size = UDim2.fromScale(1, 1), - - [Children] = props[Children], - }), - }, - }) -end diff --git a/src/Components/Views/ToolTip.luau b/src/Components/Views/ToolTip.luau deleted file mode 100644 index 5f923e8..0000000 --- a/src/Components/Views/ToolTip.luau +++ /dev/null @@ -1,86 +0,0 @@ --- 7kayoh --- ToolTip.lua --- 4 April 2022 - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Constants = require(Modules.Constants) -local Scheme = require(Modules.Scheme) -local Shadow = require(Components.Shadow) - -local Children = Fusion.Children -local New = Fusion.New -local Value = Fusion.Value -local Computed = Fusion.Computed -local OnChange = Fusion.OnChange - -return function(props) - local textSize = Value(Vector2.new(0, 0)) - local component = New("Frame")({ - BackgroundTransparency = 1, - Visible = props.Visible or true, - - AnchorPoint = props.AnchorPoint or Vector2.new(0.5, 1), - Position = props.Position or UDim2.new(0.5, 0, 0, -6), - Size = Computed(function() - return UDim2.fromOffset(textSize:get().X + 14, textSize:get().Y + 8) - end), - - [Children] = { - New("ImageLabel")({ - BackgroundTransparency = 1, - Image = Constants.Rounded.Id, - ImageColor3 = Scheme.GetAnimated(Scheme.Color.Divider), - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Constants.Rounded.Center, - SliceScale = Constants.RoundedValues[8], - - Size = UDim2.fromScale(1, 1), - - [Children] = { - New("ImageLabel")({ - BackgroundTransparency = 1, - Image = Constants.Rounded.Id, - ImageColor3 = Scheme.GetAnimated(Scheme.Elevation[4]), - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Constants.Rounded.Center, - SliceScale = Constants.RoundedValues[7], - - AnchorPoint = Vector2.new(0.5, 0.5), - Position = UDim2.fromScale(0.5, 0.5), - Size = UDim2.new(1, -2, 1, -2), - }), - - New("TextLabel")({ - BackgroundTransparency = 1, - Font = Scheme.Typography.Secondary.Font, - Text = props.Text, - TextColor3 = Scheme.GetAnimated(Scheme.Color.Text.Primary), - TextSize = Scheme.Typography.Secondary.Size, - TextWrapped = false, - TextXAlignment = Enum.TextXAlignment.Center, - TextYAlignment = Enum.TextYAlignment.Center, - ZIndex = 2, - - Size = UDim2.fromScale(1, 1), - - [OnChange("TextBounds")] = function(newValue) - textSize:set(Vector2.new(newValue.X, newValue.Y)) - end, - }), - }, - }), - - Shadow({ - Elevation = Value(Constants.Elevation[2]), - ZIndex = 0, - }), - }, - }) - - textSize:set(component.ImageLabel.TextLabel.TextBounds) - return component -end diff --git a/src/Components/Views/TopAppBar.luau b/src/Components/Views/TopAppBar.luau deleted file mode 100644 index c51626e..0000000 --- a/src/Components/Views/TopAppBar.luau +++ /dev/null @@ -1,159 +0,0 @@ --- 7kayoh --- TopAppbar.lua --- 03 February 2022 - ---[[ - - TopAppBar { - Icon: Value|string, - Title: Value|string, - Subtitle: Value|string, - ZIndex: number?, - - [Fusion.Children]: {Instances} - } -> Frame - ---]] - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Constants = require(Modules.Constants) -local Scheme = require(Modules.Scheme) -local Divider = require(Components.Divider) - -local Children = Fusion.Children -local Computed = Fusion.Computed -local New = Fusion.New - -return function(props) - props.Subtitle = props.Subtitle or Fusion.Value("") - - return New("Frame")({ - BackgroundTransparency = 1, - ZIndex = props.ZIndex or 1, - - Size = UDim2.new(1, 0, 0, 50), - - [Children] = { - Divider({ - ZIndex = 2, - - AnchorPoint = Vector2.new(0, 1), - Position = UDim2.fromScale(0, 1), - }), - - Content = New("ImageLabel")({ - BackgroundTransparency = 1, - Image = Constants.TopRounded.Id, - ImageColor3 = Scheme.GetAnimated(Scheme.Elevation[4]), - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Constants.TopRounded.Center, - SliceScale = Constants.RoundedValues[8], - - Size = UDim2.fromScale(1, 1), - - [Children] = { - Left = New("Frame")({ - BackgroundTransparency = 1, - - Size = UDim2.fromScale(1, 1), - - [Children] = { - New("UIListLayout")({ - FillDirection = Enum.FillDirection.Horizontal, - SortOrder = Enum.SortOrder.LayoutOrder, - }), - - Icon = New("Frame")({ - BackgroundTransparency = 1, - - Size = UDim2.fromScale(1, 1), - - [Children] = { - New("UIAspectRatioConstraint")({ - AspectRatio = 1, - }), - - New("ImageLabel")({ - BackgroundTransparency = 1, - Image = props.Icon, - ImageColor3 = Scheme.GetAnimated(Scheme.Color.Text.Primary), - ScaleType = Enum.ScaleType.Fit, - - AnchorPoint = Vector2.new(0.5, 0.5), - Position = UDim2.fromScale(0.5, 0.5), - Size = UDim2.fromScale(0.4, 0.4), - }), - }, - }), - - Text = New("Frame")({ - BackgroundTransparency = 1, - LayoutOrder = 2, - - Size = UDim2.fromScale(0, 1), - - [Children] = { - New("UIListLayout")({ - FillDirection = Enum.FillDirection.Vertical, - VerticalAlignment = Enum.VerticalAlignment.Center, - }), - - Title = New("TextLabel")({ - BackgroundTransparency = 1, - Font = Scheme.Typography.Header.Font, - Text = props.Title, - TextColor3 = Scheme.GetAnimated(Scheme.Color.Text.Primary), - TextSize = Scheme.Typography.Header.Size, - TextXAlignment = Enum.TextXAlignment.Left, - - Size = Computed(function() - return UDim2.fromOffset(0, Scheme.Typography.Header.Size:get()) - end), - }), - - Subtitle = New("TextLabel")({ - BackgroundTransparency = 1, - Font = Scheme.Typography.Subheader.Font, - LayoutOrder = 2, - Text = props.Subtitle, - TextColor3 = Scheme.GetAnimated(Scheme.Color.Text.Primary), - TextSize = Scheme.Typography.Subheader.Size, - TextXAlignment = Enum.TextXAlignment.Left, - Visible = Computed(function() - return props.Subtitle:get() ~= "" - end), - - Size = Computed(function() - return UDim2.fromOffset(0, Scheme.Typography.Subheader.Size:get()) - end), - }), - }, - }), - }, - }), - - Right = New("Frame")({ - BackgroundTransparency = 1, - - Size = UDim2.fromScale(1, 1), - - [Children] = { - New("UIListLayout")({ - FillDirection = Enum.FillDirection.Horizontal, - HorizontalAlignment = Enum.HorizontalAlignment.Right, - VerticalAlignment = Enum.VerticalAlignment.Center, - SortOrder = Enum.SortOrder.LayoutOrder, - }), - - props[Children], - }, - }), - }, - }), - }, - }) -end diff --git a/src/Components/Views/Window.luau b/src/Components/Views/Window.luau deleted file mode 100644 index b9dd425..0000000 --- a/src/Components/Views/Window.luau +++ /dev/null @@ -1,75 +0,0 @@ --- 7kayoh --- Window.lua --- 03 February 2022 - ---[[ - - Window { - Size: Value|UDim2?, - Position: Value|UDim2?, - ZIndex: Value|number?, - Visible: Value|boolean?, - - [Fusion.Children]: {Instances} - } -> Frame - ---]] - -local Components = script.Parent.Parent -local Modules = Components.Parent.Modules -local Lydie = Components.Parent - -local Fusion = require(Lydie.Parent.Fusion) -local Constants = require(Modules.Constants) -local Scheme = require(Modules.Scheme) -local Shadow = require(Components.Shadow) - -local Children = Fusion.Children -local New = Fusion.New -local Value = Fusion.Value - -return function(props) - return New("Frame")({ - Name = "Window", - - BackgroundTransparency = 1, - ZIndex = props.ZIndex or 1, - Visible = props.Visible or true, - - AnchorPoint = Vector2.new(0.5, 0.5), - Position = props.Position or UDim2.fromScale(0.5, 0.5), - Size = props.Size or UDim2.fromOffset(700, 700), - - [Children] = { - Fusion.Computed(function() - if props.AspectRatio and props.AspectRatio:get() > 0 then - return New("UIAspectRatioConstraint")({ - AspectRatio = props.AspectRatio:get() or 1.5, - AspectType = Enum.AspectType.ScaleWithParentSize, - DominantAxis = Enum.DominantAxis.Width, - }) - else - return nil - end - end), - - New("ImageLabel")({ - BackgroundTransparency = 1, - Image = Constants.Rounded.Id, - ImageColor3 = Scheme.GetAnimated(Scheme.Elevation[2]), - ScaleType = Enum.ScaleType.Slice, - SliceCenter = Constants.Rounded.Center, - SliceScale = Constants.RoundedValues[8], - - Size = UDim2.fromScale(1, 1), - - [Children] = props[Children], - }), - - Shadow({ - Elevation = Value(Constants.Elevation[4]), - ZIndex = 0, - }), - }, - }) -end diff --git a/src/Components/init.luau b/src/Components/init.luau deleted file mode 100644 index 408d69e..0000000 --- a/src/Components/init.luau +++ /dev/null @@ -1,27 +0,0 @@ -return { - Controls = { - AppBarButton = require(script.Controls.AppBarButton), - AppTabBarButton = require(script.Controls.AppTabBarButton), - BaseButton = require(script.Controls.BaseButton), - Checkbox = require(script.Controls.Checkbox), - ColorPicker = require(script.Controls.ColorPicker), - IconButton = require(script.Controls.IconButton), - Icons = require(script.Controls.Icons), - IconTextButton = require(script.Controls.IconTextButton), - Slider = require(script.Controls.Slider), - TextButton = require(script.Controls.TextButton), - TextField = require(script.Controls.TextField), - Toggle = require(script.Controls.Toggle), - }, - - Views = { - AppTabBar = require(script.Views.AppTabBar), - BottomAppBar = require(script.Views.BottomAppBar), - ToolTip = require(script.Views.ToolTip), - TopAppBar = require(script.Views.TopAppBar), - Window = require(script.Views.Window) - }, - - Divider = require(script.Divider), - Shadow = require(script.Shadow), -} \ No newline at end of file diff --git a/src/Modules/Constants.luau b/src/Modules/Constants.luau index 7be673c..edffd1d 100644 --- a/src/Modules/Constants.luau +++ b/src/Modules/Constants.luau @@ -1,30 +1,28 @@ -local EnumList = require(script.Parent.EnumList) - local rect256 = Rect.new(Vector2.new(256, 256), Vector2.new(256, 256)) return { - BottomRounded = EnumList.new("BottomRounded", { - Center = rect256, - Id = "rbxassetid://8858987793", - }), + bottom_rounded = { + center = rect256, + id = "rbxassetid://8858987793", + }, - Rounded = EnumList.new("Rounded", { - Center = rect256, - Id = "rbxassetid://8858983293", - }), + rounded = { + center = rect256, + id = "rbxassetid://8858983293", + }, - TopRounded = EnumList.new("TopRounded", { - Center = rect256, - Id = "rbxassetid://8858987141", - }), + top_rounded = { + center = rect256, + id = "rbxassetid://8858987141", + }, - RoundedValues = EnumList.new("RoundedValues", { + rounded_values = { [8] = 0.03, [7] = 0.025, [6] = 0.02, - }), + }, - Elevation = EnumList.new("Elevation", { + elevation = { [0] = 0, [1] = 1, [2] = 2, @@ -35,7 +33,7 @@ return { [9] = 9, [12] = 12, [16] = 16, - }), + }, - ShadowImage = "rbxassetid://1316045217", -} + shadow_image = "rbxassetid://1316045217", +} \ No newline at end of file diff --git a/src/Modules/EnumList.luau b/src/Modules/EnumList.luau deleted file mode 100644 index dd0083f..0000000 --- a/src/Modules/EnumList.luau +++ /dev/null @@ -1,77 +0,0 @@ --- bubba_biga --- EnumList.lua --- 17 January 2022 - ---[[ - EnumList.new(name: string, enumTable: table {[string]: any}) --> Enum - EnumList.IsA(self: any) --> boolean - EnumList.GetEnums() --> table - [EnumList instance only]: - EnumList:IsEnumItem(enumItem: any) --> boolean - EnumList:GetEnumItems() --> table {[string]: any} - EnumList:Destroy() --> void -]] - -local EnumList = { _enums = {} } - -function EnumList._createEnumItems(self, enumsTable) - local enumItems = {} - - for enumItem, value in pairs(enumsTable) do - enumItems[enumItem] = { - Name = enumItem, - Value = value, - Enum = self, - } - end - - return enumItems -end - -function EnumList.new(name, enumsTable) - local self = setmetatable({ - Name = name, - _index = #EnumList._enums + 1, - }, EnumList) - - self._enumItems = EnumList._createEnumItems(self, enumsTable) - table.insert(EnumList._enums, self._index) - return self -end - -function EnumList.IsA(self) - return getmetatable(self) == EnumList -end - -function EnumList.GetEnums() - return EnumList._enums -end - -function EnumList:IsEnumItem(enumItem) - return typeof(enumItem) == "table" and enumItem.Enum == self -end - -function EnumList:GetEnumItems() - return self._enumItems -end - -function EnumList:Destroy() - table.remove(EnumList._enums, self._index) - setmetatable(self, nil) -end - -function EnumList:__index(key) - if EnumList[key] then - return EnumList[key] - end - - local value = self._enumItems[key] - - if value then - return value.Value - else - error(("\"%s\" is not a valid EnumItem of Enum \"%s\""):format(tostring(key), self.Name)) - end -end - -return EnumList diff --git a/src/Modules/Icons.luau b/src/Modules/Icons.luau index bc665aa..6bd092e 100644 --- a/src/Modules/Icons.luau +++ b/src/Modules/Icons.luau @@ -497,4 +497,4 @@ return { ["x-square"] = "rbxassetid://7743878737", ["zoom-in"] = "rbxassetid://7743878977", ["zoom-out"] = "rbxassetid://7743879082", -} +} \ No newline at end of file diff --git a/src/Modules/Scheme/Schemes/Dark.luau b/src/Modules/Scheme/Schemes/Dark.luau index f3ec005..f0caccc 100644 --- a/src/Modules/Scheme/Schemes/Dark.luau +++ b/src/Modules/Scheme/Schemes/Dark.luau @@ -47,4 +47,5 @@ return { }, Divider = Color3.fromRGB(60, 60, 60), }, -} + Accent = Color3.fromRGB(255, 134, 200), +} \ No newline at end of file diff --git a/src/Modules/Scheme/Schemes/Light.luau b/src/Modules/Scheme/Schemes/Light.luau index 7c2cf05..0b1172d 100644 --- a/src/Modules/Scheme/Schemes/Light.luau +++ b/src/Modules/Scheme/Schemes/Light.luau @@ -47,4 +47,4 @@ return { }, Divider = Color3.fromRGB(200, 200, 200), }, -} +} \ No newline at end of file diff --git a/src/Modules/Scheme/Schemes/SolarizedDark.luau b/src/Modules/Scheme/Schemes/SolarizedDark.luau index 1234dd1..f36924b 100644 --- a/src/Modules/Scheme/Schemes/SolarizedDark.luau +++ b/src/Modules/Scheme/Schemes/SolarizedDark.luau @@ -47,4 +47,4 @@ return { }, Divider = Color3.fromHex("657b83"), }, -} +} \ No newline at end of file diff --git a/src/Modules/Scheme/init.luau b/src/Modules/Scheme/init.luau index a8b23e3..7f0f83e 100644 --- a/src/Modules/Scheme/init.luau +++ b/src/Modules/Scheme/init.luau @@ -1,95 +1,22 @@ --- bubba_biga --- Scheme.lua --- 03 February 2022 +local context = require(script.Parent.context) +local store = require(script.Parent.store) +local tween = require(script.Parent.tween) +local Dark = require(script.schemes.Dark) ---[[ - Scheme.Schemes: EnumList - Scheme.Current: string - - Scheme.Switch(enumScheme: string) --> void -]] +--todo: figure out a cleaner way to handle this +local scheme_cascade = context(store.new_deep( + Dark, + function(state) --- :( why wally -local Scheme = {} :: { - Switch: (string) -> (), - SetAccent: (Color3|Fusion.Value) -> (), - _updateScheme: ({ any }, { any }) -> (), - _initializeStates: ({ any }, { any }) -> (), - GetAnimated: (Fusion.Value) -> (Tween>), - _initialize: () -> (), - [any]: any, -} + return { + + } -local Modules = script.Parent -local Lydie = Modules.Parent + end +)) -local Fusion = require(Lydie.Parent.Fusion) -local EnumList = require(Modules.EnumList) - -local Value = Fusion.Value -local Computed = Fusion.Computed - -local schemes = script.Schemes:GetChildren() - -function Scheme.Switch(enumTheme) - for _, theme in ipairs(schemes) do - if theme.Name ~= enumTheme then - continue - end - - Scheme.Current = enumTheme - Scheme._updateStates(require(theme), Scheme) - end -end - -function Scheme.SetAccent(value) - Scheme.Accent = typeof(value) == "Color3" and Value(value) or value -end - -function Scheme._updateStates(newScheme, tabl) - for key, data in pairs(newScheme) do - if typeof(data) == "table" then - Scheme._updateStates(data, tabl[key]) - else - tabl[key]:set(data) - end - end -end - -function Scheme._initializeStates(scheme, tabl) - for key, data in pairs(scheme) do - if typeof(data) == "table" then - tabl[key] = {} - Scheme._initializeStates(data, tabl[key]) - else - tabl[key] = Value(data) - end - end -end - -function Scheme.GetAnimated(state) - return Fusion.Tween(state, TweenInfo.new(0.15, Enum.EasingStyle.Linear)) +function scheme_cascade:tween(callback: () -> T): () -> T + return tween(callback, TweenInfo.new(0.15, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut)) end -function Scheme._initialize() - local schemeEnumItems = {} - - for _, scheme in ipairs(schemes) do - schemeEnumItems[scheme.Name] = scheme.Name - end - - Scheme.Schemes = EnumList.new("Scheme", schemeEnumItems) - Scheme._initializeStates(require(schemes[1]), Scheme) - - -- Switch to light theme as that is the default theme, we still want - -- our states to represent some theme! - Scheme.Switch(Scheme.Schemes.Light) - Scheme.AccentName = Value("Pink") - Scheme.Accent = Computed(function() - return Scheme.Color[Scheme.AccentName:get()]:get() - end) -end - -Scheme._initialize() - -return Scheme +return scheme_cascade :: typeof(scheme_cascade) & {tween: (callback: () -> T) -> () -> T} \ No newline at end of file diff --git a/src/Modules/SharedStates.luau b/src/Modules/SharedStates.luau deleted file mode 100644 index 0d45a36..0000000 --- a/src/Modules/SharedStates.luau +++ /dev/null @@ -1,4 +0,0 @@ --- SharedStates.lua --- 09 February 2022 - -return {} diff --git a/src/Modules/init.luau b/src/Modules/init.luau index 39580ce..d39f29e 100644 --- a/src/Modules/init.luau +++ b/src/Modules/init.luau @@ -1,7 +1,6 @@ return { - Scheme = require(script.Scheme), - Constants = require(script.Constants), - EnumList = require(script.EnumList), - Icons = require(script.Icons), - SharedStates = require(script.SharedStates) + scheme = require(script.scheme), + constants = require(script.constants), + icons = require(script.icons), + context = require(script.context) } \ No newline at end of file diff --git a/src/modules/context.luau b/src/modules/context.luau new file mode 100644 index 0000000..04ec471 --- /dev/null +++ b/src/modules/context.luau @@ -0,0 +1,57 @@ +--[[ + +Implements a form of dependency injection to save the need from passing data +as props through intermediate components. + +]] + +export type Context = { + default_value: T, + _values: {[thread]: T}, + + provide: (Context, callback: () -> U) -> (new: T) -> U, + consume: (Context) -> T +} + +type ContextNoDefault = { + _values: {[thread]: T}, + + provide: (Context, callback: () -> U) -> (new: T) -> U, + consume: (Context) -> T? +} + +local function provide(context: Context, callback: () -> U) + return function(new: T): U + local thread = coroutine.running() + local old = context._values[thread] + + context._values[thread] = new + + local ok, value = pcall(callback) + + context._values[thread] = old + + if not ok then + error(`provided callback errored with "{value}"`, 2) + end + + return value + end :: (new: T) -> U +end + +local function consume(context: Context): T + local thread = coroutine.running() + return context._values[thread] or context.default_value +end + +local function create_context(default_value: T?): Context + return { + default_value = default_value, + _values = {}, + + provide = provide :: any, + consume = consume + } +end + +return create_context :: ((default_value: T) -> Context) & (() -> ContextNoDefault) \ No newline at end of file diff --git a/src/modules/delay.luau b/src/modules/delay.luau new file mode 100644 index 0000000..92c0b42 --- /dev/null +++ b/src/modules/delay.luau @@ -0,0 +1,26 @@ +local RunService = game:GetService("RunService") + +local vide = require(script.Parent.Parent.Parent.vide) + +local source = vide.source +local effect = vide.effect +local cleanup = vide.cleanup + +return function(delay: number, input: () -> T): () -> T + local output = source(input()) + + effect(function() + local v = input() + local t = delay + + cleanup(RunService.Heartbeat:Connect(function(dt) + t -= dt + if t > 0 then return end + output(v) + + end)) + + end) + + return output +end \ No newline at end of file diff --git a/src/modules/store.luau b/src/modules/store.luau new file mode 100644 index 0000000..fae4334 --- /dev/null +++ b/src/modules/store.luau @@ -0,0 +1,101 @@ +-------------------------------------------------------------------------------- +-- videx/store.luau +-------------------------------------------------------------------------------- + +local vide = require(script.Parent.Parent.Parent.vide) +local source = vide.source + +local NULL = newproxy() + +local Store = {} + +--[=[ +Creates a new store object that receives some initial state and then returns +a table with the same structure, but all keys of the given table will be reactive. + +When accessed inside a reactive scope, the reactive scope will update whenever +the key that is accessed is changed. + +@param initial_state `T : {[string]: any}` The initial state the store will start in. +@param mutations `() -> {[string]: (T, ...any) -> ...any}?` A list of functions that mutate the data. +@return `T & U` A resulting table that +]=] +function Store.new( + initial_state: T & {}, + mutations: (T & U) -> U +): T & U + local sources = {} + + for i, v in initial_state :: any do + local src = source(v ~= NULL and v or nil) + sources[i] = src + end + + local internal_proxy = {} + + setmetatable(internal_proxy, { + __index = function(_, index) + return sources[index]() + end, + __newindex = function(_, index, value) + sources[index](value) + end + }) + + local external_proxy = {} + + setmetatable(external_proxy :: any, { + __index = function(_, index) + local src = sources[index] + if src == nil then error(`invalid index {index}`, 2) end + return src() + end, + + __newindex = function(_, index, value) + sources[index](value) + end + }) + + for i, v in next, mutations(internal_proxy :: any) :: any do + if rawget(external_proxy, i) then + error(`duplicate field "{i}"`, 2) + end + rawset(external_proxy, i, v) + end + + return external_proxy :: T & U & {} +end + + +--[=[ +Creates a new store object that receives some initial state and then returns +a table with the same structure, but all keys of the given table will be reactive. + +When accessed inside a reactive scope, the reactive scope will update whenever +the key that is accessed is changed. + +@param initial_state `T : {[string]: any}` The initial state the store will start in. +@param mutations `() -> {[string]: (T, ...any) -> ...any}?` A list of functions that mutate the data. +@return `T & U` A resulting table that +]=] +function Store.new_deep( + initial_state: T & {}, + mutations: (T & U) -> U +): T & U + + local main = Store.new(initial_state, mutations) + + for key, value in initial_state :: any do + if type(value) == "table" then + main[key] = Store.new_deep(value, mutations :: any) + end + end + + return main + +end + +--- A special symbol used to indicate that a value should be nil within a Store. +Store.null = NULL :: nil + +return Store \ No newline at end of file diff --git a/src/modules/tween.luau b/src/modules/tween.luau new file mode 100644 index 0000000..dccc956 --- /dev/null +++ b/src/modules/tween.luau @@ -0,0 +1,138 @@ +local RunService = game:GetService("RunService") +local TweenService = game:GetService("TweenService") + +local vide = require(script.Parent.Parent.Parent.vide) + +local cleanup = vide.cleanup +local effect = vide.effect +local source = vide.source + +local updating_tweens = {} +local clock = 0 + +local function tween(goal: () -> T, tween_info: TweenInfo): () -> T + + local output = source(goal()) + + local tween = { + start = goal(), + goal = goal(), + started_at = os.clock(), + output = output, + tween_info = tween_info, + } + + effect(function() + local new_goal = goal() + + if new_goal == tween.goal then return end + + tween.start = output() + tween.goal = goal() + tween.started_at = clock + + updating_tweens[tween] = true + end) + + cleanup(function() + updating_tweens[tween] = nil + end) + + return output + +end + +local function lerp(a: T, b: T, t: number) + + assert(typeof(a) == typeof(b), `start and goal are not the same type. ({typeof(a)}, {typeof(b)})`) + + if typeof(a) == "number" then + return a + (b - a) * t + elseif typeof(a) == "boolean" then + local a_ = if a == true then 1 else 0 + local b_ = if b == true then 1 else 0 + local v: number = lerp(a_, b_, t) + + return if v < 0.5 then false else true + elseif typeof(a) == "CFrame" then + return a:Lerp(b, t) + elseif typeof(a) == "Rect" and typeof(b) == "Rect" then + return Rect.new( + lerp(a.Min.X, b.Min.X, t), + lerp(a.Min.Y, b.Min.Y, t), + lerp(a.Max.X, b.Max.X, t), + lerp(a.Max.Y, b.Max.Y, t) + ) + elseif typeof(a) == "Color3" then + return a:Lerp(b, t) + elseif typeof(a) == "UDim" and typeof(b) == "UDim" then + return UDim.new(lerp(a.Scale, b.Scale, t), lerp(a.Offset, b.Offset, t)) + elseif typeof(a) == "UDim2" then + return a:Lerp(b, t) + elseif typeof(a) == "Vector2" then + return a + (b - a) * t + elseif typeof(a) == "Vector2int16" then + return a + (b - a) * t + elseif typeof(a) == "Vector3" then + return a + (b - a) * t + elseif typeof(a) == "Vector3int16" then + return a + (b - a) * t + end + + error(`cannot tween {typeof(a)}`) + +end + +local function get_alpha(starts_at: number, tween_info: TweenInfo) + + local offset = clock - starts_at + if offset < 0 then return 0 end + + local duration = tween_info.DelayTime + tween_info.Time * (tween_info.Reverses and 2 or 1) + local repeat_count = offset // duration + + if repeat_count > tween_info.RepeatCount then + return if tween_info.Reverses then 0 else 1 + end + + local local_offset = offset - duration * repeat_count - tween_info.DelayTime + + if local_offset < 0 then + return 0 + elseif local_offset < tween_info.Time then + return TweenService:GetValue( + local_offset / tween_info.Time, + tween_info.EasingStyle, + tween_info.EasingDirection + ) + else + return 1 - TweenService:GetValue( + (local_offset - tween_info.Time) / tween_info.Time, + tween_info.EasingStyle, + tween_info.EasingDirection + ) + end + +end + +local function update_tweens(dt: number) + + debug.profilebegin("update tween") + clock += dt + + for tween in updating_tweens do + local alpha = get_alpha(tween.started_at, tween.tween_info) + + tween.output(lerp(tween.start, tween.goal, alpha)) + + if alpha == 1 then + updating_tweens[tween] = nil + end + end + debug.profileend() + +end + +RunService.RenderStepped:Connect(update_tweens) + +return tween \ No newline at end of file diff --git a/src/stories/window.story.luau b/src/stories/window.story.luau new file mode 100644 index 0000000..33ba8f1 --- /dev/null +++ b/src/stories/window.story.luau @@ -0,0 +1,64 @@ +local vide = require(script.Parent.Parent.Parent.vide) +local app_bar_button = require(script.Parent.Parent.components.controls.app_bar_button) +local app_tab_bar_button = require(script.Parent.Parent.components.controls.app_tab_bar_button) +local app_tab_bar = require(script.Parent.Parent.components.views.app_tab_bar) +local bottom_app_bar = require(script.Parent.Parent.components.views.bottom_app_bar) +local top_app_bar = require(script.Parent.Parent.components.views.top_app_bar) +local window = require(script.Parent.Parent.components.views.window) +local icons = require(script.Parent.Parent.modules.icons) +local safe_story = require(script.Parent.safe_story) + +local create = vide.create +local source = vide.source + +return function(target) + + local s = source(1) + + return safe_story(function() + + return window { + + top_app_bar { + icon = "", + title = "gorp", + subtitle = "Registry Editor", + + app_bar_button { + icon = icons["sunset"], + } + }, + + bottom_app_bar { + + app_tab_bar { + + app_tab_bar_button { + icon = icons["CD"], + state = function() + return s() == 1 + end, + + activated = function() + s(1) + end + }, + + app_tab_bar_button { + icon = icons["alarm-clock-off"], + state = function() + return s() == 2 + end, + + activated = function() + s(2) + end + } + + } + } + + } + + end, target) +end \ No newline at end of file diff --git a/wally.lock b/wally.lock index dd2d37b..cd052b3 100644 --- a/wally.lock +++ b/wally.lock @@ -3,11 +3,11 @@ registry = "test" [[package]] -name = "7kayoh/lydie" +name = "alicesaidhi/kibble" version = "0.1.0" -dependencies = [["Fusion", "elttob/fusion@0.2.0"]] +dependencies = [["vide", "aloroid/vide-with-types@0.2.3"]] [[package]] -name = "elttob/fusion" -version = "0.2.0" +name = "aloroid/vide-with-types" +version = "0.2.3" dependencies = [] diff --git a/wally.toml b/wally.toml index 4ee8755..97f0469 100644 --- a/wally.toml +++ b/wally.toml @@ -1,5 +1,5 @@ [package] -name = "7kayoh/lydie" +name = "alicesaidhi/kibble" version = "0.1.0" registry = "https://github.com/UpliftGames/wally-index" realm = "shared" @@ -8,4 +8,4 @@ exclude = ["**"] include = ["src", "src/*", "default.project.json", "wally.lock", "wally.toml"] [dependencies] -Fusion = "elttob/fusion@0.2.0" \ No newline at end of file +vide = "aloroid/vide-with-types@0.2.3" \ No newline at end of file