diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e309355 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,46 @@ +{ + "Lua.diagnostics.globals": [ + "TooltipBackdropTemplateMixin", + "Settings", + "NORMAL_FONT_COLOR_CODE", + "HIGHLIGHT_FONT_COLOR_CODE", + "DISABLED_FONT_COLOR_CODE", + "FONT_COLOR_CODE_CLOSE", + "ToggleFriendsFrame", + "ToggleGuildFrame", + "ToggleDropDownMenu", + "UnitPopup_ShowMenu", + "CHAT_FLAG_AFK", + "CHAT_FLAG_DND", + "TravelPassDropDown", + "ChatFrame_SendBNetTell", + "BNET_CLIENT_APP", + "BNET_CLIENT_WOW", + "FRIENDS_TEXTURE_AFK", + "FRIENDS_TEXTURE_DND", + "ChatFrame_SendTell", + "CanGroupWithAccount", + "REMOTE_CHAT", + "BNet_GetClientEmbeddedAtlas", + "FRIENDS_LIST_PLAYING", + "SELECTED_CHAT_FRAME", + "DEFAULT_CHAT_FRAME", + "NORMAL_FONT_COLOR", + "ACCEPT", + "CANCEL", + "InterfaceOptions_AddCategory", + "SlashCmdList", + "hash_SlashCmdList", + "CLOSE", + "SetDesaturation", + "ColorPickerFrame", + "OpacitySliderFrame", + "OKAY", + "NOT_BOUND", + "AddonCompartmentFrame", + "InterfaceOptionsFramePanelContainer" + ], + "Lua.diagnostics.disable": [ + "deprecated" + ] +} diff --git a/Socialite.lua b/Socialite.lua index 77e223e..0b80a1f 100644 --- a/Socialite.lua +++ b/Socialite.lua @@ -1,4 +1,8 @@ -local addonName, addon = ... +local + ---@class string + addonName, + ---@class ns + addon = ... local L = addon.L local ldb = LibStub:GetLibrary("LibDataBroker-1.1") local ldbi = LibStub:GetLibrary('LibDBIcon-1.0') @@ -34,6 +38,7 @@ do minimap={hide=true}, showInAddonCompartment=true, DisableUsageText=false, + TooltipWidth=0, } end local sv = SocialiteSettings if type(sv.minimap) ~= "table" then sv.minimap = {hide=true} end @@ -62,6 +67,7 @@ do if type(sv.ShowGroupMembers) ~= "boolean" then sv.ShowGroupMembers = true end if type(sv.ShowStatus) ~= "string" then sv.ShowStatus = "icon" end if type(sv.TooltipInteraction) ~= "string" then sv.TooltipInteraction = "always" end + if type(sv.TooltipWidth) ~= "number" then sv.TooltipWidth = 0 end addon.db = sv diff --git a/config.lua b/config.lua index e11917f..d8edbe6 100644 --- a/config.lua +++ b/config.lua @@ -1,4 +1,8 @@ -local addonName, addon = ... +local +---@class string +addonName, +---@class ns +addon = ... local L = addon.L local ldbi = LibStub('LibDBIcon-1.0', true) @@ -7,7 +11,7 @@ local function buildCheckbox(key, order) type = 'toggle', name = L[key], order = order or 0, - desc = L[key.."Description"], + desc = L[key .. "Description"], } end @@ -22,12 +26,14 @@ local function buildDropdown(label, opts, order) end local function build() + ---@type AceConfig.OptionsTable local t = { name = "Socialite", type = 'group', get = function(info) return addon.db[info[#info]] end, set = function(info, value) return addon:setDB(info[#info], value) end, args = { + ---@diagnostic disable-next-line: missing-fields showMinimapIcon = { type = 'toggle', name = L['Show minimap button'], @@ -38,9 +44,10 @@ local function build() local config = addon.db.minimap config.hide = not value addon:setDB("minimap", config) - ldbi:Refresh(addonName) + ldbi:Refresh(addonName, config) end, }, + ---@diagnostic disable-next-line: missing-fields showInAddonCompartment = { type = 'toggle', name = L.showInAddonCompartment, @@ -53,7 +60,7 @@ local function build() else ldbi:RemoveButtonFromCompartment(addonName) end - end + end, }, DisableUsageText = buildCheckbox("DisableUsageText", 2), battleNetFriends = { @@ -90,7 +97,6 @@ local function build() name = L["Tooltip Settings"], order = 30, args = { - -- @todo review these, they don't seem to work! ShowStatus = buildDropdown(L.MENU_STATUS, { icon = L.MENU_STATUS_ICON, text = L.MENU_STATUS_TEXT, @@ -102,6 +108,14 @@ local function build() never = L.MENU_INTERACTION_NEVER, }, 32), ShowGroupMembers = buildCheckbox("ShowGroupMembers", 33), + ---@diagnostic disable-next-line: missing-fields + TooltipWidth = { + name = L["Tooltip Width"], + type = "range", + min = 0, + max = 1, + step = 0.1, + }, }, }, guild = { @@ -114,13 +128,13 @@ local function build() ShowGuildNote = buildCheckbox("ShowGuildNote", 43), ShowGuildONote = buildCheckbox("ShowGuildONote", 44), ShowSplitRemoteChat = buildCheckbox("ShowSplitRemoteChat", 45), + ---@diagnostic disable-next-line: missing-fields GuildSorting = { type = 'header', name = L["Guild Sorting"], order = 46, }, GuildSort = buildCheckbox("GuildSort", 47), - -- @todo GuildSortKey = buildDropdown(L.MENU_GUILD_SORT, { name = L.MENU_GUILD_SORT_NAME, rank = L.MENU_GUILD_SORT_RANK, diff --git a/functions.lua b/functions.lua index 0642e6f..0859160 100644 --- a/functions.lua +++ b/functions.lua @@ -1,4 +1,8 @@ -local addonName, addon = ... +local + ---@class string + addonName, + ---@class ns + addon = ... local L = addon.L local tooltip = addon.tooltip diff --git a/i18n/enUS.lua b/i18n/enUS.lua index 85f73fc..d8088b5 100644 --- a/i18n/enUS.lua +++ b/i18n/enUS.lua @@ -1,5 +1,9 @@ -- @todo pull from localization -local addonName, addon = ... +local + ---@class string + addonName, + ---@class ns + addon = ... local L = {} @@ -19,6 +23,7 @@ L["ShowRealIDNotesDescription"] = "Show your friends' note" L["showInAddonCompartment"] = "Show in compartment" L["showInAddonCompartmentDescription"] = "Toggles the display of Socialite within the addon compartment." L["Data text"] = "Data text" +L["Tooltip Width"] = "Extra Tooltip Width" L["Character Friends"] = "Character Friends" L["ShowFriends"] = "Show friends" diff --git a/i18n/esES.lua b/i18n/esES.lua index dd5f2db..3e568db 100644 --- a/i18n/esES.lua +++ b/i18n/esES.lua @@ -1,5 +1,9 @@ +local + ---@class string + addonName, + ---@class ns + addon = ... -local addonName, addon = ... local locale = GetLocale() if locale == "esES" then diff --git a/tooltip.lua b/tooltip.lua index d30d60b..6e72dd0 100644 --- a/tooltip.lua +++ b/tooltip.lua @@ -1,13 +1,20 @@ -local addonName, addonTable = ... +local + ---@class string + addonName, + ---@class ns + addon = ... local tooltip = {} -addonTable.tooltip = tooltip +addon.tooltip = tooltip local CreateFrame = _G.CreateFrame local UIParent = _G.UIParent local GameTooltip = _G.GameTooltip -local NORMAL_FONT_COLOR, HIGHLIGHT_FONT_COLOR = _G.NORMAL_FONT_COLOR, _G.HIGHLIGHT_FONT_COLOR - +local NORMAL_FONT_COLOR, HIGHLIGHT_FONT_COLOR +for i, item in ipairs(C_UIColor.GetColors()) do + if (item.baseTag == "NORMAL_FONT_COLOR") then NORMAL_FONT_COLOR = item.color end + if (item.baseTag == "HIGHLIGHT_FONT_COLOR") then HIGHLIGHT_FONT_COLOR = item.color end +end local H_PADDING = 6 local V_PADDING = 3 local H_MARGIN = 10 @@ -79,13 +86,13 @@ do tframe.scroller = slider end -if IsAddOnLoaded("ElvUI") or IsAddOnLoaded("Tukui") then if tframe.StripTextures then tframe:StripTextures() end if tframe.CreateBackdrop then tframe:CreateBackdrop("Transparent") end +if C_AddOns.IsAddOnLoaded("ElvUI") or C_AddOns.IsAddOnLoaded("Tukui") then end local acquireCell, releaseCell, acquireColumn, releaseColumn, acquireLine, releaseLine @@ -311,12 +318,13 @@ end -- local function SetTooltipSize(width, height) - tframe.width = width + tframe.width = width + (addon.db.TooltipWidth or 0) tframe.scrollchild:SetWidth(width) tframe.height = height tframe.scrollchild:SetHeight(height) tframe:SetScript("OnUpdate", tooltip_OnUpdate) + -- DevTools_Dump(tframe) end local _AddLine