-- Compiled with roblox-ts v3.0.0 local TS = _G[script] local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src) local Vide = _vide local derive = _vide.derive local read = _vide.read local source = _vide.source local spring = _vide.spring local _text = TS.import(script, script.Parent.Parent.Parent, "constants", "text") local SUGGESTION_TEXT_SIZE = _text.SUGGESTION_TEXT_SIZE local SUGGESTION_TITLE_TEXT_SIZE = _text.SUGGESTION_TITLE_TEXT_SIZE local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px local _store = TS.import(script, script.Parent.Parent.Parent, "store") local mouseOverInterface = _store.mouseOverInterface local options = _store.options local Frame = TS.import(script, script.Parent.Parent, "ui", "frame").Frame local Padding = TS.import(script, script.Parent.Parent, "ui", "padding").Padding local Text = TS.import(script, script.Parent.Parent, "ui", "text").Text local highlightMatching = TS.import(script, script.Parent, "util").highlightMatching local MAX_WIDTH = 180 local function MainSuggestion(_param) local suggestion = _param.suggestion local currentText = _param.currentText local action = _param.action local onSizeChanged = _param.onSizeChanged local titleBounds = source(Vector2.new()) local descriptionBounds = source(Vector2.new()) local errorBounds = source(Vector2.new()) local badgeBounds = source(Vector2.new()) local errorText = derive(function() local currentSuggestion = read(suggestion) local _result = currentSuggestion if _result ~= nil then _result = _result.type end return if _result == "argument" then currentSuggestion.error else nil end) local windowSize = derive(function() if read(suggestion) == nil then local size = UDim2.new() local _result = onSizeChanged if _result ~= nil then _result(size) end return size end local titleSize = read(titleBounds) local descriptionSize = read(descriptionBounds) local errorSize = read(errorBounds) local width = math.max(titleSize.X, descriptionSize.X, errorSize.X) + badgeBounds().X local height = titleSize.Y + descriptionSize.Y + errorSize.Y local size = UDim2.fromOffset(width + px(8) * 2, height + px(8) * 2) local _result = onSizeChanged if _result ~= nil then _result(size) end return size end) return Vide.jsx(Frame, { action = action, size = spring(windowSize, 0.2), backgroundColor = function() return options().palette.background end, backgroundTransparency = function() local _condition = options().backgroundTransparency if _condition == nil then _condition = 0 end return _condition end, cornerRadius = function() return UDim.new(0, px(8)) end, native = { MouseEnter = function() return mouseOverInterface(true) end, MouseLeave = function() return mouseOverInterface(false) end, }, }, Vide.jsx(Padding, { all = function() return UDim.new(0, px(8)) end, }), Vide.jsx(Text, { text = function() local currentSuggestion = read(suggestion) local _result = currentSuggestion if _result ~= nil then _result = _result.type end local _result_1 if _result == "argument" then _result_1 = currentSuggestion.title else local _exp = options().palette.highlight local _result_2 = currentSuggestion if _result_2 ~= nil then _result_2 = _result_2.title end _result_1 = highlightMatching(_exp, _result_2, read(currentText)) end return _result_1 end, textSize = function() return px(SUGGESTION_TITLE_TEXT_SIZE) end, textColor = function() return options().palette.text end, textXAlignment = "Left", textYAlignment = "Top", font = function() return options().font.bold end, richText = true, size = function() return UDim2.fromOffset(titleBounds().X, px(SUGGESTION_TITLE_TEXT_SIZE)) end, native = { TextBoundsChanged = function(bounds) return titleBounds(bounds) end, }, }), Vide.jsx(Text, { text = function() local _result = read(suggestion) if _result ~= nil then _result = _result.description end local _condition = _result if _condition == nil then _condition = "" end return _condition end, textSize = function() return px(SUGGESTION_TEXT_SIZE) end, textColor = function() return options().palette.subtext end, textXAlignment = "Left", textYAlignment = "Top", textWrapped = true, richText = true, position = function() return UDim2.fromOffset(0, px(SUGGESTION_TITLE_TEXT_SIZE)) end, size = function() return UDim2.fromOffset(px(MAX_WIDTH), math.max(descriptionBounds().Y, px(SUGGESTION_TEXT_SIZE))) end, native = { TextBoundsChanged = function(rbx) return descriptionBounds(rbx) end, }, }), Vide.jsx(Text, { text = function() local _condition = errorText() if _condition == nil then _condition = "" end return _condition end, textColor = function() return options().palette.error end, textSize = function() return px(SUGGESTION_TEXT_SIZE) end, textTransparency = spring(function() return if errorText() ~= nil then 0 else 1 end, 0.2), textXAlignment = "Left", textWrapped = true, automaticSize = "Y", anchor = Vector2.new(0, 1), position = UDim2.fromScale(0, 1), size = function() return UDim2.fromOffset(px(MAX_WIDTH), 0) end, native = { TextBoundsChanged = function(bounds) errorBounds(if errorText() ~= nil then bounds else Vector2.zero) end, }, }), Vide.jsx(Frame, { backgroundColor = function() return options().palette.highlight end, cornerRadius = function() return UDim.new(0, px(4)) end, clipsDescendants = true, visible = function() local currentSuggestion = read(suggestion) return currentSuggestion ~= nil and currentSuggestion.type == "argument" end, anchor = Vector2.new(1, 0), position = UDim2.fromScale(1, 0), size = spring(function() return UDim2.fromOffset(badgeBounds().X + px(4), px(SUGGESTION_TITLE_TEXT_SIZE)) end, 0.2), }, Vide.jsx(Text, { text = function() local currentSuggestion = read(suggestion) return if currentSuggestion ~= nil and currentSuggestion.type == "argument" then currentSuggestion.dataType else "" end, textColor = function() return options().palette.surface end, textSize = function() return px(SUGGESTION_TEXT_SIZE) end, textXAlignment = "Center", font = function() return options().font.bold end, size = UDim2.fromScale(1, 1), native = { TextBoundsChanged = function(bounds) return badgeBounds(bounds) end, }, }))) end return { MainSuggestion = MainSuggestion, }