Skip to content

Commit

Permalink
Migrate Utils and Thener to new structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ImAvafe committed Aug 19, 2024
1 parent bb65f06 commit 7484603
Show file tree
Hide file tree
Showing 39 changed files with 57 additions and 58 deletions.
2 changes: 1 addition & 1 deletion docs/in-production.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 5
sidebar_position: 6
---

# Use In Production
Expand Down
2 changes: 1 addition & 1 deletion docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ OnyxUI is structured as a collection of modules, separated by folders. This is u
local OnyxUI = require(path.to.OnyxUI)

-- Utils
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local Colors = require(OnyxUI.Utils.Color)

-- Components
Expand Down
2 changes: 1 addition & 1 deletion docs/styling-props.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 5
---

# Styling Props
Expand Down
20 changes: 20 additions & 0 deletions docs/themer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
sidebar_position: 3
---

# Themer

Themer allows you to customize components throughout OnyxUI, with support for things like colors, corner radiuses, paddings, etc. You'll also probably want to incorporate it within your own UI for a more consistent design.

## Sample themes

- [OnyxNight](https://github.com/ImAvafe/OnyxUI/blob/main/src/Utils/Themer/OnyxNight.lua)
- [BitCave](https://github.com/ImAvafe/OnyxUI/blob/main/src/Utils/Themer/BitCave.lua)

## Making your own theme

:::tip
Check out the [`ThemeTemplate`](https://github.com/ImAvafe/OnyxUI/blob/main/src/Utils/Themer/ThemeTemplate.lua) file for a reference of properties you can specify in your theme. Make sure to not include Fusion `Value`s in yours.
:::

Once you've created your own theme, you can load it into OnyxUI with `Themer:Set()`.
21 changes: 1 addition & 20 deletions docs/utils.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
---
sidebar_position: 3
sidebar_position: 4
---

# Utils

Important utilities for UI development. These are also used by OnyxUI itself!

## Themer

Themer allows you to customize components throughout OnyxUI, with support for things like colors, corner radiuses, paddings, etc. You'll also probably want to incorporate it within your own UI for a more consistent design.

### Default themes

Some themes are included by default, which can be seen here:

- [OnyxNight](https://github.com/ImAvafe/OnyxUI/blob/main/src/Utils/Themer/OnyxNight.lua)
- [BitCave](https://github.com/ImAvafe/OnyxUI/blob/main/src/Utils/Themer/BitCave.lua)

### Making your own theme

:::tip
Check out the [`ThemeTemplate`](https://github.com/ImAvafe/OnyxUI/blob/main/src/Utils/Themer/ThemeTemplate.lua) file for a reference of properties you can specify in your theme.
:::

Once you've created your own theme, you can load it into OnyxUI with `Themer:Set()`.

## EnsureValue

Want to ensure your component props are Fusion `Value`s? This makes it a one-line operation.
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Avatar.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local Colors = require(OnyxUI.Utils.Colors)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Avatar.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local Colors = require(OnyxUI.Utils.Colors)

local Children = Fusion.Children
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Badge.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local ColorUtils = require(OnyxUI.Parent.ColorUtils)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Badge.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local Colors = require(OnyxUI.Utils.Colors)

local Children = Fusion.Children
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Base.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)

local Children = Fusion.Children
local Computed = Fusion.Computed
Expand Down
2 changes: 1 addition & 1 deletion src/Components/BaseButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local SoundService = game:GetService("SoundService")
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)

Expand Down
2 changes: 1 addition & 1 deletion src/Components/Button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local ColorUtils = require(OnyxUI.Parent.ColorUtils)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)

Expand Down
2 changes: 1 addition & 1 deletion src/Components/Button.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)

local Children = Fusion.Children
local Computed = Fusion.Computed
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Card.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local CombineProps = require(OnyxUI.Utils.CombineProps)

local Computed = Fusion.Computed
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Card.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)

local New = Fusion.New
local Children = Fusion.Children
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Checkbox.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local ColorUtils = require(OnyxUI.Parent.ColorUtils)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Checkbox.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local Colors = require(OnyxUI.Utils.Colors)

local Children = Fusion.Children
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Divider.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local CombineProps = require(OnyxUI.Utils.CombineProps)
local PubTypes = require(OnyxUI.Utils.PubTypes)

Expand Down
2 changes: 1 addition & 1 deletion src/Components/IconButton.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local CombineProps = require(OnyxUI.Utils.CombineProps)
local PubTypes = require(OnyxUI.Utils.PubTypes)

Expand Down
2 changes: 1 addition & 1 deletion src/Components/IconButton.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local Colors = require(OnyxUI.Utils.Colors)

local Children = Fusion.Children
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Image.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)

local New = Fusion.New
local Children = Fusion.Children
Expand Down
2 changes: 1 addition & 1 deletion src/Components/MenuFrame.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local CombineProps = require(OnyxUI.Utils.CombineProps)

local Computed = Fusion.Computed
Expand Down
2 changes: 1 addition & 1 deletion src/Components/MenuFrame.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)

local Children = Fusion.Children
local Computed = Fusion.Computed
Expand Down
2 changes: 1 addition & 1 deletion src/Components/NumberSpinner/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local NumberSpinner = require(script.NumberSpinner)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)

Expand Down
2 changes: 1 addition & 1 deletion src/Components/ProgressBar.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)

Expand Down
2 changes: 1 addition & 1 deletion src/Components/ProgressBar.story.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local OnyxUI = script.Parent.Parent
local Colors = require(ReplicatedStorage.OnyxUI.Packages.OnyxUI.Utils.Colors)
local Fusion = require(OnyxUI.Parent.Fusion)
local ColorUtils = require(OnyxUI.Parent.ColorUtils)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)

local Children = Fusion.Children
local Value = Fusion.Value
Expand Down
2 changes: 1 addition & 1 deletion src/Components/ScrollingFrame.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
Expand Down
2 changes: 1 addition & 1 deletion src/Components/SwitchGroup.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local CombineProps = require(OnyxUI.Utils.CombineProps)

local BaseButton = require(script.Parent.BaseButton)
Expand Down
2 changes: 1 addition & 1 deletion src/Components/SwitchInput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)

local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)
local ColorUtils = require(OnyxUI.Parent.ColorUtils)
Expand Down
2 changes: 1 addition & 1 deletion src/Components/SwitchInput.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)

local Children = Fusion.Children
local Computed = Fusion.Computed
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Text.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)

local Computed = Fusion.Computed
local Hydrate = Fusion.Hydrate
Expand Down
2 changes: 1 addition & 1 deletion src/Components/TextArea.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)

local Children = Fusion.Children
local Computed = Fusion.Computed
Expand Down
2 changes: 1 addition & 1 deletion src/Components/TextInput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local SoundService = game:GetService("SoundService")
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)

Expand Down
2 changes: 1 addition & 1 deletion src/Components/TextInput.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)

local Children = Fusion.Children
local Computed = Fusion.Computed
Expand Down
2 changes: 1 addition & 1 deletion src/Components/TitleBar.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local EnsureValue = require(OnyxUI.Utils.EnsureValue)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local PubTypes = require(OnyxUI.Utils.PubTypes)
local CombineProps = require(OnyxUI.Utils.CombineProps)

Expand Down
2 changes: 1 addition & 1 deletion src/Components/TitleBar.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)

local Children = Fusion.Children
local Computed = Fusion.Computed
Expand Down
2 changes: 1 addition & 1 deletion src/Examples/SettingsMenu.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)
local CombineProps = require(OnyxUI.Utils.CombineProps)

local Children = Fusion.Children
Expand Down
2 changes: 1 addition & 1 deletion src/Examples/SettingsMenu.story.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local OnyxUI = script.Parent.Parent
local Fusion = require(OnyxUI.Parent.Fusion)
local Themer = require(OnyxUI.Utils.Themer)
local Themer = require(OnyxUI.Themer)

local New = Fusion.New
local Children = Fusion.Children
Expand Down
2 changes: 0 additions & 2 deletions src/Utils/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
]=]

local Colors = require(script.Colors)
local Themer = require(script.Themer)
local EnsureValue = require(script.EnsureValue)
local CombineProp = require(script.CombineProps)
local ReconcileValues = require(script.ReconcileValues)
local GetValue = require(script.GetValue)

return {
Colors = Colors,
Themer = Themer,
EnsureValue = EnsureValue,
CombineProp = CombineProp,
ReconcileValues = ReconcileValues,
Expand Down

0 comments on commit 7484603

Please sign in to comment.