-- Compiled with roblox-ts v1.2.7 local TS = _G[script] local Maid = TS.import(script, TS.getModule(script, "@rbxts", "maid").Maid) local Roact = TS.import(script, TS.getModule(script, "@rbxts", "roact").src) local _snapdragon = TS.import(script, TS.getModule(script, "@rbxts", "snapdragon").src) local Snapdragon = _snapdragon local SnapdragonController = _snapdragon.SnapdragonController local _Titlebar = TS.import(script, script.Parent, "Titlebar") local ZirconTitlebar = _Titlebar.default local TITLEBAR_SIZE = _Titlebar.TITLEBAR_SIZE local ZirconWindow do ZirconWindow = Roact.Component:extend("ZirconWindow") function ZirconWindow:init() self.dragRef = Snapdragon.createRef() self.windowRef = Roact.createRef() self.maid = Maid.new() end function ZirconWindow:didMount() local _binding = self.props local TitlebarEnabled = _binding.TitlebarEnabled if TitlebarEnabled == nil then TitlebarEnabled = false end local IsDraggable = _binding.IsDraggable if IsDraggable == nil then IsDraggable = false end local SnapEnabled = _binding.SnapEnabled if SnapEnabled == nil then SnapEnabled = true end local SnapMargin = _binding.SnapMargin local SnapThreshold = _binding.SnapThresholdMargin local windowRef = self.windowRef:getValue() if windowRef ~= nil then self.dragRef:Update(windowRef) self.dragController = SnapdragonController.new(self.dragRef, { SnapEnabled = SnapEnabled, SnapThreshold = SnapThreshold, SnapMargin = SnapMargin, }) if TitlebarEnabled == false and IsDraggable == true then self.dragController:Connect() if self.props.DragBegan ~= nil then self.maid:GiveTask(self.dragController.DragBegan:Connect(function(began) local _result = self.props.DragBegan if _result ~= nil then _result(began.InputPosition) end end)) end if self.props.DragEnded ~= nil then self.maid:GiveTask(self.dragController.DragBegan:Connect(function(ended) local _result = self.props.DragEnded if _result ~= nil then _result(ended.InputPosition) end end)) end end self.maid:GiveTask(self.dragController) self.maid:GiveTask(windowRef:GetPropertyChangedSignal("Position"):Connect(function() local _result = self.props.PositionChanged if _result ~= nil then _result(windowRef.Position) end end)) end end function ZirconWindow:willUnmount() self.maid:DoCleaning() end function ZirconWindow:render() local props = self.props local _binding = props local NativeWindow = _binding.NativeWindow if NativeWindow == nil then NativeWindow = true end local IsDraggable = _binding.IsDraggable if IsDraggable == nil then IsDraggable = false end local TitlebarEnabled = _binding.TitlebarEnabled if TitlebarEnabled == nil then TitlebarEnabled = false end local SnapEnabled = _binding.SnapEnabled local SnapIgnoresOffset = _binding.SnapIgnoresOffset local SnapThresholdMargin = _binding.SnapThresholdMargin local SnapMargin = _binding.SnapMargin local ZIndexBehaviour = _binding.ZIndexBehaviour if ZIndexBehaviour == nil then ZIndexBehaviour = Enum.ZIndexBehavior.Global end local TitlebarButtons = _binding.TitlebarButtons if TitlebarButtons == nil then TitlebarButtons = {} end local TitlebarCloseAction = _binding.TitlebarCloseAction local DragBegan = _binding.DragBegan local DragEnded = _binding.DragEnded if TitlebarCloseAction ~= nil then local _arg0 = { Alignment = "right", Icon = "Close", OnClick = TitlebarCloseAction, Color = Color3.fromRGB(170, 0, 0), } -- ▼ Array.push ▼ TitlebarButtons[#TitlebarButtons + 1] = _arg0 -- ▲ Array.push ▲ end local childComponents = {} local children = self.props[Roact.Children] if children and (next(children)) ~= nil then local _attributes = { Size = UDim2.new(1, 0, 1, TitlebarEnabled and -TITLEBAR_SIZE or 0), Position = UDim2.new(0, 0, 0, TitlebarEnabled and TITLEBAR_SIZE or 0), BackgroundTransparency = 1, } local _children = {} local _length = #_children for _k, _v in pairs(children) do if type(_k) == "number" then _children[_length + _k] = _v else _children[_k] = _v end end local frame = (Roact.createElement("Frame", _attributes, _children)) -- ▼ Array.push ▼ childComponents[#childComponents + 1] = frame -- ▲ Array.push ▲ end if TitlebarEnabled then local _arg0 = Roact.createElement(ZirconTitlebar, { SnapThresholdMargin = SnapThresholdMargin, SnapEnabled = SnapEnabled, SnapIgnoresOffset = SnapIgnoresOffset, SnapMargin = SnapMargin, Draggable = IsDraggable, DragBegan = DragBegan, DragEnded = DragEnded, Text = props.TitleText, Buttons = TitlebarButtons, }) -- ▼ Array.push ▼ childComponents[#childComponents + 1] = _arg0 -- ▲ Array.push ▲ end local _attributes = { Active = true, } local _condition = self.props.Size if _condition == nil then _condition = UDim2.new(0, 200, 0, 200) end _attributes.Size = _condition _attributes.Position = self.props.Position _attributes.BorderColor3 = Color3.fromRGB(33, 37, 43) _attributes.BackgroundColor3 = Color3.fromRGB(24, 26, 31) _attributes[Roact.Ref] = self.windowRef local _children = {} local _length = #_children for _k, _v in ipairs(childComponents) do _children[_length + _k] = _v end local hostFrame = (Roact.createElement("Frame", _attributes, _children)) return NativeWindow and (Roact.createElement("ScreenGui", { ZIndexBehavior = ZIndexBehaviour, DisplayOrder = props.DisplayOrder, IgnoreGuiInset = SnapIgnoresOffset, }, { hostFrame, })) or hostFrame end end return { default = ZirconWindow, }