mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 20:21:38 +00:00
* 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
100 lines
2.4 KiB
Lua
100 lines
2.4 KiB
Lua
local Rojo = script:FindFirstAncestor("Rojo")
|
|
local Plugin = Rojo.Plugin
|
|
local Packages = Rojo.Packages
|
|
|
|
local Roact = require(Packages.Roact)
|
|
|
|
local Dictionary = require(Plugin.Dictionary)
|
|
local Theme = require(Plugin.App.Theme)
|
|
|
|
local StudioPluginContext = require(script.Parent.StudioPluginContext)
|
|
|
|
local e = Roact.createElement
|
|
|
|
local StudioPluginGui = Roact.PureComponent:extend("StudioPluginGui")
|
|
|
|
StudioPluginGui.defaultProps = {
|
|
initDockState = Enum.InitialDockState.Right,
|
|
active = false,
|
|
overridePreviousState = false,
|
|
floatingSize = Vector2.new(0, 0),
|
|
minimumSize = Vector2.new(0, 0),
|
|
zIndexBehavior = Enum.ZIndexBehavior.Sibling,
|
|
}
|
|
|
|
function StudioPluginGui:init()
|
|
local floatingSize = self.props.floatingSize
|
|
local minimumSize = self.props.minimumSize
|
|
|
|
local dockWidgetPluginGuiInfo = DockWidgetPluginGuiInfo.new(
|
|
self.props.initDockState,
|
|
self.props.active,
|
|
self.props.overridePreviousState,
|
|
floatingSize.X,
|
|
floatingSize.Y,
|
|
minimumSize.X,
|
|
minimumSize.Y
|
|
)
|
|
|
|
local pluginGui = self.props.plugin:CreateDockWidgetPluginGui(self.props.id, dockWidgetPluginGuiInfo)
|
|
|
|
pluginGui.Name = self.props.id
|
|
pluginGui.Title = self.props.title
|
|
pluginGui.ZIndexBehavior = self.props.zIndexBehavior
|
|
|
|
if self.props.onInitialState then
|
|
self.props.onInitialState(pluginGui.Enabled)
|
|
end
|
|
|
|
pluginGui:BindToClose(function()
|
|
if self.props.onClose then
|
|
self.props.onClose()
|
|
else
|
|
pluginGui.Enabled = false
|
|
end
|
|
end)
|
|
|
|
self.pluginGui = pluginGui
|
|
end
|
|
|
|
function StudioPluginGui:render()
|
|
return e(Roact.Portal, {
|
|
target = self.pluginGui,
|
|
}, {
|
|
Background = Theme.with(function(theme)
|
|
return e("Frame", {
|
|
Size = UDim2.new(1, 0, 1, 0),
|
|
BackgroundColor3 = theme.BackgroundColor,
|
|
ZIndex = 0,
|
|
BorderSizePixel = 0,
|
|
}, self.props[Roact.Children])
|
|
end),
|
|
})
|
|
end
|
|
|
|
function StudioPluginGui:didUpdate(lastProps)
|
|
if self.props.active ~= lastProps.active then
|
|
-- This is intentionally in didUpdate to make sure the initial active state
|
|
-- (if the PluginGui is open initially) is preserved.
|
|
self.pluginGui.Enabled = self.props.active
|
|
end
|
|
end
|
|
|
|
function StudioPluginGui:willUnmount()
|
|
self.pluginGui:Destroy()
|
|
end
|
|
|
|
local function StudioPluginGuiWrapper(props)
|
|
return e(StudioPluginContext.Consumer, {
|
|
render = function(plugin)
|
|
return e(
|
|
StudioPluginGui,
|
|
Dictionary.merge(props, {
|
|
plugin = plugin,
|
|
})
|
|
)
|
|
end,
|
|
})
|
|
end
|
|
|
|
return StudioPluginGuiWrapper
|