-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add user confirmation to initial sync * Use "Accept" instead of "Confirm" * Draw tree alphabetically for determinism * Add diff table dropdown * Add diff table to newly added objects * Unblock keybind workflow * Only show reject button when two way is enabled * Try to patch back to the files when changes are rejected * Improve text spacing of the prop diff table * Skip user confirmation of perfect syncs * Give instances names for debugging UI * Optimize tree building * Efficiency: dynamic virtual scrolling & lazy rendering * Simplify virtual scroller logic and avoid wasteful rerenders * Remove debug print * Consistent naming * Move new patch applied callback into accept * Pcall archivable * Keybinds open popup diff window * Theme rows in diff * Remove relic of prototype * Color value visuals and better component name * changeBatcher is not needed when no sync is active * Simplify popup roact entrypoint * Alphabetical prop lists and refactor * Add a stroke to color blot for contrast * Make color blots animate transparency with the rest of the page * StyLua formatting on newly added files * Remove wasteful table * Fix diffing custom properties * Display tables more meaningfully * Allow children in the button components * Create a rough tooltip component * Add tooltips to buttons * Use provider+trigger schema to avoid tooltip ZIndex issues * Add triangle point to tooltip * Tooltip underneath instead of covering * Cancel hovers when unmounting * Allow multiple canvases from one provider * Display above or below depending on available space * Move patch equality to PatchSet.isEqual * Use Container * Remove old submodules * Reduce false positives in diff * Add debug log * Fuzzy equals CFrame in diffs to avoid floating point in * Fix decodeValue usage * Support the .changedName patches * Fix content overlapping border * Fix tooltip tail alignment * Fix tooltip text fit * Whoops, fix it properly * Move PatchVisualizer to Components * Provide Connected info with full patch data * Avoid implicit nil return * Add patch visualizer to connected page * Make Current column invisible when visualizing applied patches * Avoid floating point diffs in a numbers and vectors
- Loading branch information
1 parent
7994bc4
commit b5ed952
Showing
19 changed files
with
1,616 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
181 changes: 181 additions & 0 deletions
181
plugin/src/App/Components/PatchVisualizer/ChangeList.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
local Rojo = script:FindFirstAncestor("Rojo") | ||
local Plugin = Rojo.Plugin | ||
local Packages = Rojo.Packages | ||
|
||
local Roact = require(Packages.Roact) | ||
|
||
local Theme = require(Plugin.App.Theme) | ||
local ScrollingFrame = require(Plugin.App.Components.ScrollingFrame) | ||
local DisplayValue = require(script.Parent.DisplayValue) | ||
|
||
local e = Roact.createElement | ||
|
||
local ChangeList = Roact.Component:extend("ChangeList") | ||
|
||
function ChangeList:init() | ||
self.contentSize, self.setContentSize = Roact.createBinding(Vector2.new(0, 0)) | ||
end | ||
|
||
function ChangeList:render() | ||
return Theme.with(function(theme) | ||
local props = self.props | ||
local changes = props.changes | ||
|
||
-- Color alternating rows for readability | ||
local rowTransparency = props.transparency:map(function(t) | ||
return 0.93 + (0.07 * t) | ||
end) | ||
|
||
local columnVisibility = props.columnVisibility | ||
|
||
local rows = {} | ||
local pad = { | ||
PaddingLeft = UDim.new(0, 5), | ||
PaddingRight = UDim.new(0, 5), | ||
} | ||
|
||
local headers = e("Frame", { | ||
Size = UDim2.new(1, 0, 0, 30), | ||
BackgroundTransparency = rowTransparency, | ||
BackgroundColor3 = theme.Diff.Row, | ||
LayoutOrder = 0, | ||
}, { | ||
Padding = e("UIPadding", pad), | ||
Layout = e("UIListLayout", { | ||
FillDirection = Enum.FillDirection.Horizontal, | ||
SortOrder = Enum.SortOrder.LayoutOrder, | ||
HorizontalAlignment = Enum.HorizontalAlignment.Left, | ||
VerticalAlignment = Enum.VerticalAlignment.Center, | ||
}), | ||
A = e("TextLabel", { | ||
Visible = columnVisibility[1], | ||
Text = tostring(changes[1][1]), | ||
BackgroundTransparency = 1, | ||
Font = Enum.Font.GothamBold, | ||
TextSize = 14, | ||
TextColor3 = theme.Settings.Setting.DescriptionColor, | ||
TextXAlignment = Enum.TextXAlignment.Left, | ||
TextTransparency = props.transparency, | ||
TextTruncate = Enum.TextTruncate.AtEnd, | ||
Size = UDim2.new(0.3, 0, 1, 0), | ||
LayoutOrder = 1, | ||
}), | ||
B = e("TextLabel", { | ||
Visible = columnVisibility[2], | ||
Text = tostring(changes[1][2]), | ||
BackgroundTransparency = 1, | ||
Font = Enum.Font.GothamBold, | ||
TextSize = 14, | ||
TextColor3 = theme.Settings.Setting.DescriptionColor, | ||
TextXAlignment = Enum.TextXAlignment.Left, | ||
TextTransparency = props.transparency, | ||
TextTruncate = Enum.TextTruncate.AtEnd, | ||
Size = UDim2.new(0.35, 0, 1, 0), | ||
LayoutOrder = 2, | ||
}), | ||
C = e("TextLabel", { | ||
Visible = columnVisibility[3], | ||
Text = tostring(changes[1][3]), | ||
BackgroundTransparency = 1, | ||
Font = Enum.Font.GothamBold, | ||
TextSize = 14, | ||
TextColor3 = theme.Settings.Setting.DescriptionColor, | ||
TextXAlignment = Enum.TextXAlignment.Left, | ||
TextTransparency = props.transparency, | ||
TextTruncate = Enum.TextTruncate.AtEnd, | ||
Size = UDim2.new(0.35, 0, 1, 0), | ||
LayoutOrder = 3, | ||
}), | ||
}) | ||
|
||
for row, values in changes do | ||
if row == 1 then | ||
continue -- Skip headers, already handled above | ||
end | ||
|
||
rows[row] = e("Frame", { | ||
Size = UDim2.new(1, 0, 0, 30), | ||
BackgroundTransparency = row % 2 ~= 0 and rowTransparency or 1, | ||
BackgroundColor3 = theme.Diff.Row, | ||
BorderSizePixel = 0, | ||
LayoutOrder = row, | ||
}, { | ||
Padding = e("UIPadding", pad), | ||
Layout = e("UIListLayout", { | ||
FillDirection = Enum.FillDirection.Horizontal, | ||
SortOrder = Enum.SortOrder.LayoutOrder, | ||
HorizontalAlignment = Enum.HorizontalAlignment.Left, | ||
VerticalAlignment = Enum.VerticalAlignment.Center, | ||
}), | ||
A = e("TextLabel", { | ||
Visible = columnVisibility[1], | ||
Text = tostring(values[1]), | ||
BackgroundTransparency = 1, | ||
Font = Enum.Font.GothamMedium, | ||
TextSize = 14, | ||
TextColor3 = theme.Settings.Setting.DescriptionColor, | ||
TextXAlignment = Enum.TextXAlignment.Left, | ||
TextTransparency = props.transparency, | ||
TextTruncate = Enum.TextTruncate.AtEnd, | ||
Size = UDim2.new(0.3, 0, 1, 0), | ||
LayoutOrder = 1, | ||
}), | ||
B = e( | ||
"Frame", | ||
{ | ||
Visible = columnVisibility[2], | ||
BackgroundTransparency = 1, | ||
Size = UDim2.new(0.35, 0, 1, 0), | ||
LayoutOrder = 2, | ||
}, | ||
e(DisplayValue, { | ||
value = values[2], | ||
transparency = props.transparency, | ||
}) | ||
), | ||
C = e( | ||
"Frame", | ||
{ | ||
Visible = columnVisibility[3], | ||
BackgroundTransparency = 1, | ||
Size = UDim2.new(0.35, 0, 1, 0), | ||
LayoutOrder = 3, | ||
}, | ||
e(DisplayValue, { | ||
value = values[3], | ||
transparency = props.transparency, | ||
}) | ||
), | ||
}) | ||
end | ||
|
||
table.insert( | ||
rows, | ||
e("UIListLayout", { | ||
FillDirection = Enum.FillDirection.Vertical, | ||
SortOrder = Enum.SortOrder.LayoutOrder, | ||
HorizontalAlignment = Enum.HorizontalAlignment.Right, | ||
VerticalAlignment = Enum.VerticalAlignment.Top, | ||
|
||
[Roact.Change.AbsoluteContentSize] = function(object) | ||
self.setContentSize(object.AbsoluteContentSize) | ||
end, | ||
}) | ||
) | ||
|
||
return e("Frame", { | ||
Size = UDim2.new(1, 0, 1, 0), | ||
BackgroundTransparency = 1, | ||
}, { | ||
Headers = headers, | ||
Values = e(ScrollingFrame, { | ||
size = UDim2.new(1, 0, 1, -30), | ||
position = UDim2.new(0, 0, 0, 30), | ||
contentSize = self.contentSize, | ||
transparency = props.transparency, | ||
}, rows), | ||
}) | ||
end) | ||
end | ||
|
||
return ChangeList |
107 changes: 107 additions & 0 deletions
107
plugin/src/App/Components/PatchVisualizer/DisplayValue.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
local Rojo = script:FindFirstAncestor("Rojo") | ||
local Plugin = Rojo.Plugin | ||
local Packages = Rojo.Packages | ||
|
||
local Roact = require(Packages.Roact) | ||
|
||
local Theme = require(Plugin.App.Theme) | ||
|
||
local e = Roact.createElement | ||
|
||
local function DisplayValue(props) | ||
return Theme.with(function(theme) | ||
local t = typeof(props.value) | ||
if t == "Color3" then | ||
-- Colors get a blot that shows the color | ||
return Roact.createFragment({ | ||
Blot = e("Frame", { | ||
BackgroundTransparency = props.transparency, | ||
BackgroundColor3 = props.value, | ||
Size = UDim2.new(0, 20, 0, 20), | ||
Position = UDim2.new(0, 0, 0.5, 0), | ||
AnchorPoint = Vector2.new(0, 0.5), | ||
}, { | ||
Corner = e("UICorner", { | ||
CornerRadius = UDim.new(0, 4), | ||
}), | ||
Stroke = e("UIStroke", { | ||
Color = theme.BorderedContainer.BorderColor, | ||
Transparency = props.transparency, | ||
}), | ||
}), | ||
Label = e("TextLabel", { | ||
Text = string.format("%d,%d,%d", props.value.R * 255, props.value.G * 255, props.value.B * 255), | ||
BackgroundTransparency = 1, | ||
Font = Enum.Font.GothamMedium, | ||
TextSize = 14, | ||
TextColor3 = theme.Settings.Setting.DescriptionColor, | ||
TextXAlignment = Enum.TextXAlignment.Left, | ||
TextTransparency = props.transparency, | ||
TextTruncate = Enum.TextTruncate.AtEnd, | ||
Size = UDim2.new(1, -25, 1, 0), | ||
Position = UDim2.new(0, 25, 0, 0), | ||
}), | ||
}) | ||
|
||
elseif t == "table" then | ||
-- Showing a memory address for tables is useless, so we want to show the best we can | ||
local textRepresentation = nil | ||
|
||
local meta = getmetatable(props.value) | ||
if meta and meta.__tostring then | ||
-- If the table has a tostring metamethod, use that | ||
textRepresentation = tostring(props.value) | ||
elseif next(props.value) == nil then | ||
-- If it's empty, show empty braces | ||
textRepresentation = "{}" | ||
else | ||
-- If it has children, list them out | ||
local out, i = {}, 0 | ||
for k, v in pairs(props.value) do | ||
i += 1 | ||
|
||
-- Wrap strings in quotes | ||
if type(k) == "string" then | ||
k = "\"" .. k .. "\"" | ||
end | ||
if type(v) == "string" then | ||
v = "\"" .. v .. "\"" | ||
end | ||
|
||
out[i] = string.format("[%s] = %s", tostring(k), tostring(v)) | ||
end | ||
textRepresentation = "{ " .. table.concat(out, ", ") .. " }" | ||
end | ||
|
||
return e("TextLabel", { | ||
Text = textRepresentation, | ||
BackgroundTransparency = 1, | ||
Font = Enum.Font.GothamMedium, | ||
TextSize = 14, | ||
TextColor3 = theme.Settings.Setting.DescriptionColor, | ||
TextXAlignment = Enum.TextXAlignment.Left, | ||
TextTransparency = props.transparency, | ||
TextTruncate = Enum.TextTruncate.AtEnd, | ||
Size = UDim2.new(1, 0, 1, 0), | ||
}) | ||
end | ||
|
||
-- TODO: Maybe add visualizations to other datatypes? | ||
-- Or special text handling tostring for some? | ||
-- Will add as needed, let's see what cases arise. | ||
|
||
return e("TextLabel", { | ||
Text = string.gsub(tostring(props.value), "%s", " "), | ||
BackgroundTransparency = 1, | ||
Font = Enum.Font.GothamMedium, | ||
TextSize = 14, | ||
TextColor3 = theme.Settings.Setting.DescriptionColor, | ||
TextXAlignment = Enum.TextXAlignment.Left, | ||
TextTransparency = props.transparency, | ||
TextTruncate = Enum.TextTruncate.AtEnd, | ||
Size = UDim2.new(1, 0, 1, 0), | ||
}) | ||
end) | ||
end | ||
|
||
return DisplayValue |
Oops, something went wrong.