diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4679f8ac..3a1f5f04 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,33 @@ The format is based on [Keep a Changelog][kac], and this project adheres to
- Deprecated the return type of `World:remove()` because it can now be inaccurate.
- Deprecated `World:optimizeQueries()` because it no longer does anything.
+## [0.8.4] - 2024-08-15
+
+### Added
+
+- Better assertions / error messages added to `World` methods that accept
+ variadic component arguments. At least 1 component must be provided. These
+ assertions have been added to `get` `insert` `replace` `remove`
+- Ability to sort the world inspect table by clicking the table headers (entity
+ count and component name)
+- Ability to disable systems in the debugger list by right clicking them.
+
+### Changed
+
+- The alt-hover tooltip's text is smaller and the background is slightly darker
+ for improved legibility.
+- Component data now has syntax highlighting applied. This is present in the
+ **alt-hover tooltip** and the **entity inspector panel** in the debugger.
+
+### Fixed
+
+- The alt-hover tooltip now displays component data properly, with each
+ component being displayed on a new line.
+- Removed extra new-lines in component data strings within the debugger entity
+ inspect tables.
+- Fixed alt-hover erroring when hovered entity is despawned.
+- Fixed flashing buttons ("View queries" and "View logs") in system inspect panel
+
## [0.8.3] - 2024-07-02
### Fixed
@@ -301,7 +328,8 @@ The format is based on [Keep a Changelog][kac], and this project adheres to
- Initial release
-[unreleased]: https://github.com/matter-ecs/matter/compare/v0.8.3...HEAD
+[unreleased]: https://github.com/matter-ecs/matter/compare/v0.8.4...HEAD
+[0.8.4]: https://github.com/matter-ecs/matter/releases/tag/v0.8.4
[0.8.3]: https://github.com/matter-ecs/matter/releases/tag/v0.8.3
[0.8.2]: https://github.com/matter-ecs/matter/releases/tag/v0.8.2
[0.8.1]: https://github.com/matter-ecs/matter/releases/tag/v0.8.1
diff --git a/README.md b/README.md
index b79836b3..a4332b2b 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ Matter can be installed with [Wally] by including it as a dependency in your
`wally.toml` file.
```toml
-Matter = "matter-ecs/matter@0.8.3"
+Matter = "matter-ecs/matter@0.8.4"
```
## Migration
diff --git a/docs/Guides/Migration.md b/docs/Guides/Migration.md
index 2044fb04..f8205d8a 100644
--- a/docs/Guides/Migration.md
+++ b/docs/Guides/Migration.md
@@ -4,5 +4,5 @@ Migrating from `evaera/matter` to `matter-ecs/matter` is easy! The only thing yo
```toml title="wally.toml"
[dependencies]
- matter = "matter-ecs/matter@0.8.3"
+ matter = "matter-ecs/matter@0.8.4"
```
diff --git a/docs/Installation.md b/docs/Installation.md
index 3f4c83a4..02eb87c1 100644
--- a/docs/Installation.md
+++ b/docs/Installation.md
@@ -25,7 +25,7 @@ wally = "UpliftGames/wally@x.x.x"
```toml title="wally.toml"
[dependencies]
-matter = "matter-ecs/matter@0.8.3"
+matter = "matter-ecs/matter@0.8.4"
```
6. Run `wally install`.
diff --git a/lib/debugger/clientBindings.luau b/lib/debugger/clientBindings.luau
index 405aed41..fdac1a05 100644
--- a/lib/debugger/clientBindings.luau
+++ b/lib/debugger/clientBindings.luau
@@ -1,5 +1,21 @@
local UserInputService = game:GetService("UserInputService")
local CollectionService = game:GetService("CollectionService")
+
+local tags = {
+ system = "MatterDebuggerTooltip_System",
+ altHover = "MatterDebuggerTooltip_AltHover",
+}
+
+local function getOffset(mousePos: Vector2, tag: string): UDim2
+ if tag == tags.altHover then
+ return UDim2.fromOffset(mousePos.X + 20, mousePos.Y)
+ elseif tag == tags.system then
+ return UDim2.fromOffset(mousePos.X + 20, mousePos.Y + 10)
+ end
+
+ return UDim2.fromOffset(mousePos.X, mousePos.Y + 10)
+end
+
local function clientBindings(debugger)
local connections = {}
@@ -21,20 +37,23 @@ local function clientBindings(debugger)
local mousePosition = UserInputService:GetMouseLocation()
- for _, gui in CollectionService:GetTagged("MatterDebuggerTooltip") do
- gui.Position = UDim2.new(0, mousePosition.X + 20, 0, mousePosition.Y)
+ for _, tag in tags do
+ for _, gui in CollectionService:GetTagged(tag) do
+ gui.Position = getOffset(mousePosition, tag)
+ end
end
end)
)
- table.insert(
- connections,
- CollectionService:GetInstanceAddedSignal("MatterDebuggerTooltip"):Connect(function(gui)
- local mousePosition = UserInputService:GetMouseLocation()
-
- gui.Position = UDim2.new(0, mousePosition.X + 20, 0, mousePosition.Y)
- end)
- )
+ for _, tag in tags do
+ table.insert(
+ connections,
+ CollectionService:GetInstanceAddedSignal(tag):Connect(function(gui)
+ local mousePosition = UserInputService:GetMouseLocation()
+ gui.Position = getOffset(mousePosition, tag)
+ end)
+ )
+ end
return connections
end
diff --git a/lib/debugger/ui.luau b/lib/debugger/ui.luau
index af4f968e..aa671a1d 100644
--- a/lib/debugger/ui.luau
+++ b/lib/debugger/ui.luau
@@ -29,10 +29,12 @@ end
local IS_SERVER = RunService:IsServer()
local IS_CLIENT = RunService:IsClient()
+local LONG_SYSTEM_NAME = 24
local function ui(debugger, loop)
local plasma = debugger.plasma
local custom = debugger._customWidgets
+ local skipSystems = loop._skipSystems
plasma.setStyle({
primaryColor = Color3.fromHex("bd515c"),
@@ -48,6 +50,8 @@ local function ui(debugger, loop)
end
end
+ local hoveredSystem
+
custom.container(function()
if debugger:_isServerView() then
return
@@ -141,7 +145,7 @@ local function ui(debugger, loop)
})
plasma.space(5)
- local items = {}
+ local listOfSystems = {}
for _, system in systems do
local samples = loop.profiling[system]
@@ -168,23 +172,48 @@ local function ui(debugger, loop)
icon = "\xf0\x9f\x92\xa5"
end
- table.insert(items, {
- text = systemName(system),
- sideText = averageFrameTime,
+ local barWidth
+ if longestDuration == 0 then
+ barWidth = 0
+ else
+ barWidth = duration / longestDuration
+ end
+
+ local systemIsDisabled = skipSystems[system]
+ local systemName = systemName(system)
+ local length = string.len(systemName)
+
+ if systemIsDisabled then
+ length += 4
+ end
+
+ table.insert(listOfSystems, {
+ text = if systemIsDisabled then `{systemName}` else systemName,
+ sideText = if systemIsDisabled then `{"(disabled)"}` else averageFrameTime,
selected = debugger.debugSystem == system,
system = system,
icon = icon,
- barWidth = duration / longestDuration,
+ barWidth = barWidth,
index = index,
})
end
- local selected = custom.selectionList(items):selected()
+ local systemList = custom.selectionList(listOfSystems, custom)
+ local selected = systemList:selected()
+ local rightClicked = systemList:rightClicked()
+ hoveredSystem = systemList:hovered()
+
if selected then
- if selected.system == debugger.debugSystem then
+ local selectedSystem = selected.system
+ if selectedSystem == debugger.debugSystem then
debugger.debugSystem = nil
else
- debugger.debugSystem = selected.system
+ debugger.debugSystem = selectedSystem
+ end
+ elseif rightClicked then
+ local rightClickedSystem = rightClicked.system
+ if rightClickedSystem then
+ skipSystems[rightClickedSystem] = not skipSystems[rightClickedSystem]
end
end
@@ -234,28 +263,26 @@ local function ui(debugger, loop)
}, function()
plasma.useKey(name)
- plasma.row(function()
- if plasma.button(string.format("View queries (%d)", #debugger._queries)):clicked() then
- setQueriesOpen(true)
- end
+ if plasma.button(string.format("View queries (%d)", #debugger._queries)):clicked() then
+ setQueriesOpen(true)
+ end
- if numLogs > 0 then
- if plasma.button(string.format("View logs (%d)", numLogs)):clicked() then
- setLogsOpen(true)
- end
+ if numLogs > 0 then
+ if plasma.button(string.format("View logs (%d)", numLogs)):clicked() then
+ setLogsOpen(true)
end
- end)
+ end
- local currentlyDisabled = loop._skipSystems[debugger.debugSystem]
+ local currentlyDisabled = skipSystems[debugger.debugSystem]
if
plasma
- .checkbox("Disable system", {
+ .checkbox("Disable System", {
checked = currentlyDisabled,
})
:clicked()
then
- loop._skipSystems[debugger.debugSystem] = not currentlyDisabled
+ skipSystems[debugger.debugSystem] = not currentlyDisabled
end
end)
:closed()
@@ -311,6 +338,23 @@ local function ui(debugger, loop)
direction = Enum.FillDirection.Horizontal,
padding = 0,
})
+
+ if hoveredSystem and hoveredSystem.system then
+ local hoveredSystemName = systemName(hoveredSystem.system)
+ local length = string.len(hoveredSystemName)
+ local systemDisabled = skipSystems[hoveredSystem.system]
+
+ if systemDisabled then
+ length += 2
+ end
+
+ if length >= LONG_SYSTEM_NAME then
+ custom.tooltip(`{hoveredSystemName}{if systemDisabled then " (disabled)" else ""}`, {
+ tag = "MatterDebuggerTooltip_System",
+ backgroundTransparency = 0,
+ })
+ end
+ end
end
return ui
diff --git a/lib/debugger/widgets/hoverInspect.luau b/lib/debugger/widgets/hoverInspect.luau
index d9b5daa3..c0c10d88 100644
--- a/lib/debugger/widgets/hoverInspect.luau
+++ b/lib/debugger/widgets/hoverInspect.luau
@@ -18,6 +18,9 @@ return function(plasma)
end
end
- custom.tooltip(str)
+ custom.tooltip(str, {
+ tag = "MatterDebuggerTooltip_AltHover",
+ backgroundTransparency = 0.15,
+ })
end)
end
diff --git a/lib/debugger/widgets/selectionList.luau b/lib/debugger/widgets/selectionList.luau
index 5842b00f..9d44a774 100644
--- a/lib/debugger/widgets/selectionList.luau
+++ b/lib/debugger/widgets/selectionList.luau
@@ -1,13 +1,16 @@
return function(Plasma)
local create = Plasma.create
- local Item = Plasma.widget(function(text, selected, icon, sideText, _, barWidth, index)
+ local Item = Plasma.widget(function(text, selected, icon, sideText, barWidth, index)
local clicked, setClicked = Plasma.useState(false)
+ local rightClicked, setRightClicked = Plasma.useState(false)
+ local hovered, setHovered = Plasma.useState(false)
local style = Plasma.useStyle()
local refs = Plasma.useInstance(function(ref)
local button = create("TextButton", {
[ref] = "button",
+ AutoButtonColor = false,
Size = UDim2.new(1, 0, 0, 25),
Text = "",
@@ -34,6 +37,7 @@ return function(Plasma)
}),
create("TextLabel", {
+ [ref] = "index",
Name = "index",
AutomaticSize = Enum.AutomaticSize.X,
Size = UDim2.new(0, 0, 1, 0),
@@ -58,10 +62,12 @@ return function(Plasma)
}),
create("TextLabel", {
+ [ref] = "mainText",
AutomaticSize = Enum.AutomaticSize.X,
BackgroundTransparency = 1,
Size = UDim2.new(0, 0, 1, 0),
Text = text,
+ RichText = true,
TextXAlignment = Enum.TextXAlignment.Left,
TextSize = 13,
TextColor3 = style.textColor,
@@ -81,6 +87,7 @@ return function(Plasma)
Text = "",
TextXAlignment = Enum.TextXAlignment.Left,
TextSize = 11,
+ RichText = true,
TextColor3 = style.mutedTextColor,
Font = Enum.Font.Gotham,
}),
@@ -98,8 +105,20 @@ return function(Plasma)
ZIndex = 2,
}),
- Activated = function()
- setClicked(true)
+ InputBegan = function(input: InputObject)
+ if input.UserInputType == Enum.UserInputType.MouseButton1 then
+ setClicked(true)
+ elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
+ setRightClicked(true)
+ end
+ end,
+
+ MouseEnter = function()
+ setHovered(true)
+ end,
+
+ MouseLeave = function()
+ setHovered(false)
end,
})
@@ -107,7 +126,7 @@ return function(Plasma)
end)
Plasma.useEffect(function()
- refs.button.container.TextLabel.Text = text
+ refs.mainText.Text = text
refs.button.container.Icon.Text = icon or ""
refs.button.container.Icon.Visible = icon ~= nil
end, text, icon)
@@ -115,13 +134,18 @@ return function(Plasma)
refs.button.container.sideText.Visible = sideText ~= nil
refs.button.container.sideText.Text = if sideText ~= nil then sideText else ""
refs.button.container.sideText.TextColor3 = if selected then style.textColor else style.mutedTextColor
- refs.button.container.TextLabel.TextTruncate = sideText and Enum.TextTruncate.AtEnd or Enum.TextTruncate.None
+ refs.mainText.TextTruncate = sideText and Enum.TextTruncate.AtEnd or Enum.TextTruncate.None
refs.button.bar.Size = UDim2.new(barWidth or 0, 0, 0, 1)
Plasma.useEffect(function()
- refs.button.BackgroundColor3 = if selected then style.primaryColor else style.bg2
- end, selected)
+ refs.button.BackgroundColor3 = if selected
+ then style.primaryColor
+ elseif hovered then style.bg1
+ else style.bg2
+
+ refs.index.TextColor3 = if selected or hovered then style.textColor else style.mutedTextColor
+ end, selected, hovered)
return {
clicked = function()
@@ -132,19 +156,29 @@ return function(Plasma)
return false
end,
+ rightClicked = function()
+ if rightClicked then
+ setRightClicked(false)
+ return true
+ end
+
+ return false
+ end,
+ hovered = function()
+ return hovered
+ end,
}
end)
- return Plasma.widget(function(items, options)
- options = options or {}
-
+ return Plasma.widget(function(items)
Plasma.useInstance(function()
local frame = create("Frame", {
BackgroundTransparency = 1,
- Size = options.width and UDim2.new(0, options.width, 0, 0) or UDim2.new(1, 0, 0, 0),
+ Size = UDim2.new(1, 0, 0, 0),
create("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
+ Padding = UDim.new(0, 2),
}),
})
@@ -156,19 +190,35 @@ return function(Plasma)
end)
local selected
+ local rightClicked
+ local hovered
for _, item in items do
- if
- Item(item.text, item.selected, item.icon, item.sideText, options.width, item.barWidth, item.index):clicked()
- then
+ local buttonInList = Item(item.text, item.selected, item.icon, item.sideText, item.barWidth, item.index)
+
+ if buttonInList:clicked() then
selected = item
end
+
+ if buttonInList:rightClicked() then
+ rightClicked = item
+ end
+
+ if buttonInList:hovered() then
+ hovered = item
+ end
end
return {
selected = function()
return selected
end,
+ rightClicked = function()
+ return rightClicked
+ end,
+ hovered = function()
+ return hovered
+ end,
}
end)
end
diff --git a/lib/debugger/widgets/tooltip.luau b/lib/debugger/widgets/tooltip.luau
index a99f969a..499479df 100644
--- a/lib/debugger/widgets/tooltip.luau
+++ b/lib/debugger/widgets/tooltip.luau
@@ -1,8 +1,14 @@
local CollectionService = game:GetService("CollectionService")
+
+type Options = {
+ tag: string,
+ backgroundTransparency: number?,
+}
+
return function(plasma)
local create = plasma.create
- return plasma.widget(function(text)
+ return plasma.widget(function(text, options: Options)
local refs = plasma.useInstance(function(ref)
local style = plasma.useStyle()
@@ -16,9 +22,10 @@ return function(plasma)
Font = Enum.Font.Code,
TextStrokeTransparency = 0.5,
TextColor3 = Color3.new(1, 1, 1),
- BackgroundTransparency = 0.2,
+ BackgroundTransparency = options.backgroundTransparency or 0.2,
BackgroundColor3 = style.bg1,
AutomaticSize = Enum.AutomaticSize.XY,
+ ZIndex = 100,
create("UIPadding", {
PaddingBottom = UDim.new(0, 4),
@@ -34,7 +41,7 @@ return function(plasma)
}),
})
- CollectionService:AddTag(ref.label, "MatterDebuggerTooltip")
+ CollectionService:AddTag(ref.label, options.tag)
return ref.label
end)
diff --git a/wally.toml b/wally.toml
index d3139569..ae150483 100644
--- a/wally.toml
+++ b/wally.toml
@@ -1,7 +1,7 @@
[package]
name = "matter-ecs/matter"
description = "A modern ECS library for Roblox"
-version = "0.8.3"
+version = "0.8.4"
license = "MIT"
authors = [
"Eryn L. K.",