wuira 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -1
- package/README.md +242 -0
- package/lib/Spells.d.ts +11 -0
- package/lib/Spells.lua +22 -0
- package/lib/datasources/KnownSpells.d.ts +21 -0
- package/lib/datasources/KnownSpells.lua +794 -0
- package/lib/datasources/ManaRegenTimer.d.ts +29 -0
- package/lib/datasources/ManaRegenTimer.lua +674 -0
- package/lib/datasources/ProgressSource.lua +15 -2
- package/lib/datasources/Resources.d.ts +13 -1
- package/lib/datasources/Resources.lua +118 -39
- package/lib/datasources/SpellCooldown.d.ts +4 -2
- package/lib/datasources/SpellCooldown.lua +13 -2
- package/lib/datasources/SpellSource.d.ts +14 -0
- package/lib/datasources/SpellSource.lua +224 -0
- package/lib/datasources/TimerSource.d.ts +2 -0
- package/lib/datasources/TimerSource.lua +54 -0
- package/lib/datasources/TotemTimer.d.ts +10 -0
- package/lib/datasources/TotemTimer.lua +260 -0
- package/lib/datasources/index.d.ts +7 -0
- package/lib/datasources/index.lua +16 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.lua +16 -0
- package/lib/platform/ActionBars.d.ts +27 -0
- package/lib/platform/ActionBars.lua +726 -0
- package/lib/platform/AddonSettings.d.ts +9 -0
- package/lib/platform/AddonSettings.lua +36 -0
- package/lib/platform/BlizzardUI.d.ts +5 -0
- package/lib/platform/BlizzardUI.lua +357 -20
- package/lib/platform/MicroMenu.d.ts +15 -0
- package/lib/platform/MicroMenu.lua +219 -0
- package/lib/platform/SecureButton.d.ts +5 -0
- package/lib/platform/SecureButton.lua +196 -0
- package/lib/platform/SlashCommands.d.ts +3 -0
- package/lib/platform/SlashCommands.lua +309 -0
- package/lib/platform/forever.d.ts +78 -3
- package/lib/skins/MicroBar.d.ts +8 -0
- package/lib/skins/MicroBar.lua +65 -0
- package/lib/skins/NativeSkin.d.ts +26 -0
- package/lib/skins/NativeSkin.lua +601 -0
- package/lib/skins/index.d.ts +3 -0
- package/lib/skins/index.lua +11 -0
- package/lib/store/index.lua +13 -0
- package/lib/ui/Button.d.ts +10 -0
- package/lib/ui/Button.lua +9 -0
- package/lib/ui/Cell.d.ts +5 -1
- package/lib/ui/FrameMover.d.ts +21 -0
- package/lib/ui/FrameMover.lua +123 -0
- package/lib/ui/HoverTracker.d.ts +20 -0
- package/lib/ui/HoverTracker.lua +88 -0
- package/lib/ui/KeybindCapture.d.ts +20 -0
- package/lib/ui/KeybindCapture.lua +488 -0
- package/lib/ui/SecureButton.d.ts +44 -0
- package/lib/ui/SecureButton.lua +9 -0
- package/lib/ui/index.d.ts +9 -0
- package/lib/ui/index.lua +20 -0
- package/lib/ui/layout/measureLayout.lua +4 -2
- package/lib/ui/mount.lua +500 -117
- package/lib/ui/primitives/jsx.d.ts +9 -1
- package/lib/wuira.d.ts +3 -0
- package/lib/wuira.lua +5 -0
- package/package.json +8 -1
- package/tools/build-library.mjs +1 -1
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
-- Lua Library inline imports
|
|
3
|
+
local function __TS__StringCharAt(self, pos)
|
|
4
|
+
if pos ~= pos then
|
|
5
|
+
pos = 0
|
|
6
|
+
end
|
|
7
|
+
if pos < 0 then
|
|
8
|
+
return ""
|
|
9
|
+
end
|
|
10
|
+
return string.sub(self, pos + 1, pos + 1)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
local function __TS__StringStartsWith(self, searchString, position)
|
|
14
|
+
if position == nil or position < 0 then
|
|
15
|
+
position = 0
|
|
16
|
+
end
|
|
17
|
+
return string.sub(self, position + 1, #searchString + position) == searchString
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
local function __TS__ObjectEntries(obj)
|
|
21
|
+
local result = {}
|
|
22
|
+
local len = 0
|
|
23
|
+
for key in pairs(obj) do
|
|
24
|
+
len = len + 1
|
|
25
|
+
result[len] = {key, obj[key]}
|
|
26
|
+
end
|
|
27
|
+
return result
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
local __TS__Unpack = table.unpack or unpack
|
|
31
|
+
|
|
32
|
+
local function __TS__StringIncludes(self, searchString, position)
|
|
33
|
+
if not position then
|
|
34
|
+
position = 1
|
|
35
|
+
else
|
|
36
|
+
position = position + 1
|
|
37
|
+
end
|
|
38
|
+
local index = string.find(self, searchString, position, true)
|
|
39
|
+
return index ~= nil
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
local function __TS__New(target, ...)
|
|
43
|
+
local instance = setmetatable({}, target.prototype)
|
|
44
|
+
instance:____constructor(...)
|
|
45
|
+
return instance
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
local function __TS__Class(self)
|
|
49
|
+
local c = {prototype = {}}
|
|
50
|
+
c.prototype.__index = c.prototype
|
|
51
|
+
c.prototype.constructor = c
|
|
52
|
+
return c
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
local function __TS__ClassExtends(target, base)
|
|
56
|
+
target.____super = base
|
|
57
|
+
local staticMetatable = setmetatable({__index = base}, base)
|
|
58
|
+
setmetatable(target, staticMetatable)
|
|
59
|
+
local baseMetatable = getmetatable(base)
|
|
60
|
+
if baseMetatable then
|
|
61
|
+
if type(baseMetatable.__index) == "function" then
|
|
62
|
+
staticMetatable.__index = baseMetatable.__index
|
|
63
|
+
end
|
|
64
|
+
if type(baseMetatable.__newindex) == "function" then
|
|
65
|
+
staticMetatable.__newindex = baseMetatable.__newindex
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
setmetatable(target.prototype, base.prototype)
|
|
69
|
+
if type(base.prototype.__index) == "function" then
|
|
70
|
+
target.prototype.__index = base.prototype.__index
|
|
71
|
+
end
|
|
72
|
+
if type(base.prototype.__newindex) == "function" then
|
|
73
|
+
target.prototype.__newindex = base.prototype.__newindex
|
|
74
|
+
end
|
|
75
|
+
if type(base.prototype.__tostring) == "function" then
|
|
76
|
+
target.prototype.__tostring = base.prototype.__tostring
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
local Error, RangeError, ReferenceError, SyntaxError, TypeError, URIError
|
|
81
|
+
do
|
|
82
|
+
local function getErrorStack(self, constructor)
|
|
83
|
+
if debug == nil then
|
|
84
|
+
return nil
|
|
85
|
+
end
|
|
86
|
+
local level = 1
|
|
87
|
+
while true do
|
|
88
|
+
local info = debug.getinfo(level, "f")
|
|
89
|
+
level = level + 1
|
|
90
|
+
if not info then
|
|
91
|
+
level = 1
|
|
92
|
+
break
|
|
93
|
+
elseif info.func == constructor then
|
|
94
|
+
break
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
if __TS__StringIncludes(_VERSION, "Lua 5.0") then
|
|
98
|
+
return debug.traceback(("[Level " .. tostring(level)) .. "]")
|
|
99
|
+
elseif _VERSION == "Lua 5.1" then
|
|
100
|
+
return string.sub(
|
|
101
|
+
debug.traceback("", level),
|
|
102
|
+
2
|
|
103
|
+
)
|
|
104
|
+
else
|
|
105
|
+
return debug.traceback(nil, level)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
local function wrapErrorToString(self, getDescription)
|
|
109
|
+
return function(self)
|
|
110
|
+
local description = getDescription(self)
|
|
111
|
+
local caller = debug.getinfo(3, "f")
|
|
112
|
+
local isClassicLua = __TS__StringIncludes(_VERSION, "Lua 5.0")
|
|
113
|
+
if isClassicLua or caller and caller.func ~= error then
|
|
114
|
+
return description
|
|
115
|
+
else
|
|
116
|
+
return (description .. "\n") .. tostring(self.stack)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
local function initErrorClass(self, Type, name)
|
|
121
|
+
Type.name = name
|
|
122
|
+
return setmetatable(
|
|
123
|
+
Type,
|
|
124
|
+
{__call = function(____, _self, message) return __TS__New(Type, message) end}
|
|
125
|
+
)
|
|
126
|
+
end
|
|
127
|
+
local ____initErrorClass_1 = initErrorClass
|
|
128
|
+
local ____class_0 = __TS__Class()
|
|
129
|
+
____class_0.name = ""
|
|
130
|
+
function ____class_0.prototype.____constructor(self, message)
|
|
131
|
+
if message == nil then
|
|
132
|
+
message = ""
|
|
133
|
+
end
|
|
134
|
+
self.message = message
|
|
135
|
+
self.name = "Error"
|
|
136
|
+
self.stack = getErrorStack(nil, __TS__New)
|
|
137
|
+
local metatable = getmetatable(self)
|
|
138
|
+
if metatable and not metatable.__errorToStringPatched then
|
|
139
|
+
metatable.__errorToStringPatched = true
|
|
140
|
+
metatable.__tostring = wrapErrorToString(nil, metatable.__tostring)
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
function ____class_0.prototype.__tostring(self)
|
|
144
|
+
return self.message ~= "" and (self.name .. ": ") .. self.message or self.name
|
|
145
|
+
end
|
|
146
|
+
Error = ____initErrorClass_1(nil, ____class_0, "Error")
|
|
147
|
+
local function createErrorClass(self, name)
|
|
148
|
+
local ____initErrorClass_3 = initErrorClass
|
|
149
|
+
local ____class_2 = __TS__Class()
|
|
150
|
+
____class_2.name = ____class_2.name
|
|
151
|
+
__TS__ClassExtends(____class_2, Error)
|
|
152
|
+
function ____class_2.prototype.____constructor(self, ...)
|
|
153
|
+
____class_2.____super.prototype.____constructor(self, ...)
|
|
154
|
+
self.name = name
|
|
155
|
+
end
|
|
156
|
+
return ____initErrorClass_3(nil, ____class_2, name)
|
|
157
|
+
end
|
|
158
|
+
RangeError = createErrorClass(nil, "RangeError")
|
|
159
|
+
ReferenceError = createErrorClass(nil, "ReferenceError")
|
|
160
|
+
SyntaxError = createErrorClass(nil, "SyntaxError")
|
|
161
|
+
TypeError = createErrorClass(nil, "TypeError")
|
|
162
|
+
URIError = createErrorClass(nil, "URIError")
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
local function __TS__ObjectGetOwnPropertyDescriptors(object)
|
|
166
|
+
local metatable = getmetatable(object)
|
|
167
|
+
if not metatable then
|
|
168
|
+
return {}
|
|
169
|
+
end
|
|
170
|
+
return rawget(metatable, "_descriptors") or ({})
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
local function __TS__Delete(target, key)
|
|
174
|
+
local descriptors = __TS__ObjectGetOwnPropertyDescriptors(target)
|
|
175
|
+
local descriptor = descriptors[key]
|
|
176
|
+
if descriptor then
|
|
177
|
+
if not descriptor.configurable then
|
|
178
|
+
error(
|
|
179
|
+
__TS__New(
|
|
180
|
+
TypeError,
|
|
181
|
+
((("Cannot delete property " .. tostring(key)) .. " of ") .. tostring(target)) .. "."
|
|
182
|
+
),
|
|
183
|
+
0
|
|
184
|
+
)
|
|
185
|
+
end
|
|
186
|
+
descriptors[key] = nil
|
|
187
|
+
return true
|
|
188
|
+
end
|
|
189
|
+
target[key] = nil
|
|
190
|
+
return true
|
|
191
|
+
end
|
|
192
|
+
-- End of Lua Library inline imports
|
|
193
|
+
local ____exports = {}
|
|
194
|
+
--- Whitespace separates arguments; quotes preserve spaces and empty values.
|
|
195
|
+
local function parseArguments(self, message)
|
|
196
|
+
local args = {}
|
|
197
|
+
local value = ""
|
|
198
|
+
local quote
|
|
199
|
+
local started = false
|
|
200
|
+
do
|
|
201
|
+
local index = 0
|
|
202
|
+
while index < #message do
|
|
203
|
+
local character = __TS__StringCharAt(message, index)
|
|
204
|
+
if quote ~= nil then
|
|
205
|
+
local next = __TS__StringCharAt(message, index + 1)
|
|
206
|
+
if character == "\\" and (next == quote or next == "\\") then
|
|
207
|
+
value = value .. next
|
|
208
|
+
index = index + 1
|
|
209
|
+
elseif character == quote then
|
|
210
|
+
quote = nil
|
|
211
|
+
else
|
|
212
|
+
value = value .. character
|
|
213
|
+
end
|
|
214
|
+
elseif character == "\"" or character == "'" then
|
|
215
|
+
quote = character
|
|
216
|
+
started = true
|
|
217
|
+
elseif string.match(character, "%s") ~= nil then
|
|
218
|
+
if started then
|
|
219
|
+
args[#args + 1] = value
|
|
220
|
+
end
|
|
221
|
+
value = ""
|
|
222
|
+
started = false
|
|
223
|
+
else
|
|
224
|
+
value = value .. character
|
|
225
|
+
started = true
|
|
226
|
+
end
|
|
227
|
+
index = index + 1
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
if quote ~= nil then
|
|
231
|
+
error("wuira.registerCommand: unterminated quoted argument")
|
|
232
|
+
end
|
|
233
|
+
if started then
|
|
234
|
+
args[#args + 1] = value
|
|
235
|
+
end
|
|
236
|
+
return args
|
|
237
|
+
end
|
|
238
|
+
--- Native slash registration, with an idempotent cleanup and no shared module state.
|
|
239
|
+
function ____exports.registerCommand(self, command, callback)
|
|
240
|
+
if issecretvalue(command) or type(command) ~= "string" or string.match(command, "^/%a[%w_-]*$") == nil then
|
|
241
|
+
error("wuira.registerCommand: use a slash followed by a command name, without arguments")
|
|
242
|
+
end
|
|
243
|
+
if type(callback) ~= "function" then
|
|
244
|
+
error("wuira.registerCommand: callback must be a function")
|
|
245
|
+
end
|
|
246
|
+
local normalized = string.lower(command)
|
|
247
|
+
local lookup = string.upper(normalized)
|
|
248
|
+
local hash = _G.hash_SlashCmdList
|
|
249
|
+
local chatTypes = _G.hash_ChatTypeInfoList
|
|
250
|
+
if IsSecureCmd and IsSecureCmd(lookup) or (hash and hash[lookup]) ~= nil or (chatTypes and chatTypes[lookup]) ~= nil then
|
|
251
|
+
error("wuira.registerCommand: command already registered: " .. normalized)
|
|
252
|
+
end
|
|
253
|
+
for ____, ____value in ipairs(__TS__ObjectEntries(_G)) do
|
|
254
|
+
local key = ____value[1]
|
|
255
|
+
local value = ____value[2]
|
|
256
|
+
if __TS__StringStartsWith(key, "SLASH_") and not issecretvalue(value) and type(value) == "string" and string.upper(value) == lookup then
|
|
257
|
+
error("wuira.registerCommand: command already registered: " .. normalized)
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
local sequence = type(_G.__wuiraCommandSequence) == "number" and _G.__wuiraCommandSequence or 0
|
|
261
|
+
local id
|
|
262
|
+
repeat
|
|
263
|
+
do
|
|
264
|
+
sequence = sequence + 1
|
|
265
|
+
id = "WUIRA_COMMAND_" .. tostring(sequence)
|
|
266
|
+
end
|
|
267
|
+
until not (SlashCmdList[id] ~= nil or _G[("SLASH_" .. id) .. "1"] ~= nil)
|
|
268
|
+
_G.__wuiraCommandSequence = sequence
|
|
269
|
+
local globalKey = ("SLASH_" .. id) .. "1"
|
|
270
|
+
local current = callback
|
|
271
|
+
local function handler(message)
|
|
272
|
+
if current ~= nil then
|
|
273
|
+
current(__TS__Unpack(parseArguments(nil, message)))
|
|
274
|
+
end
|
|
275
|
+
end
|
|
276
|
+
_G[globalKey] = normalized
|
|
277
|
+
SlashCmdList[id] = handler
|
|
278
|
+
local disposed = false
|
|
279
|
+
return function()
|
|
280
|
+
if disposed then
|
|
281
|
+
return
|
|
282
|
+
end
|
|
283
|
+
disposed = true
|
|
284
|
+
current = nil
|
|
285
|
+
local currentHash = _G.hash_SlashCmdList
|
|
286
|
+
local currentChatTypes = _G.hash_ChatTypeInfoList
|
|
287
|
+
local ownsEntry = SlashCmdList[id] == handler
|
|
288
|
+
if ownsEntry then
|
|
289
|
+
__TS__Delete(SlashCmdList, id)
|
|
290
|
+
if _G[globalKey] == normalized then
|
|
291
|
+
__TS__Delete(_G, globalKey)
|
|
292
|
+
end
|
|
293
|
+
local meta = getmetatable(SlashCmdList)
|
|
294
|
+
if type(meta) == "table" and meta ~= nil then
|
|
295
|
+
local proxy = meta.__index
|
|
296
|
+
if type(proxy) == "table" and proxy ~= nil and proxy[id] == handler then
|
|
297
|
+
__TS__Delete(proxy, id)
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
if (currentChatTypes and currentChatTypes[lookup]) == id then
|
|
301
|
+
__TS__Delete(currentChatTypes, lookup)
|
|
302
|
+
end
|
|
303
|
+
end
|
|
304
|
+
if (currentHash and currentHash[lookup]) == handler then
|
|
305
|
+
__TS__Delete(currentHash, lookup)
|
|
306
|
+
end
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
return ____exports
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Global functions use dot calls; widget methods use Lua's colon calls.
|
|
3
3
|
type wuiraAnchor = import("../types/Position").Anchor;
|
|
4
4
|
type wuiraDrawLayer = "BACKGROUND" | "OVERLAY";
|
|
5
|
+
type wuiraNativeReturns<T extends unknown[]> = T & { readonly __tstlMultiReturn: unknown };
|
|
5
6
|
interface wuiraNativeTexture {
|
|
6
7
|
SetAllPoints(frame: wuiraNativeFrame): void;
|
|
7
8
|
SetColorTexture(red: number, green: number, blue: number, alpha: number): void;
|
|
@@ -20,6 +21,28 @@ interface wuiraNativeTexture {
|
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
interface wuiraNativeFrame {
|
|
24
|
+
GetCenter(): wuiraNativeReturns<[number | undefined, number | undefined]>;
|
|
25
|
+
IsShown(): boolean;
|
|
26
|
+
SetMovable(movable: boolean): void;
|
|
27
|
+
SetClampedToScreen(clamped: boolean): void;
|
|
28
|
+
RegisterForDrag(...buttons: string[]): void;
|
|
29
|
+
StartMoving(): void;
|
|
30
|
+
StopMovingOrSizing(): void;
|
|
31
|
+
EnableKeyboard(enabled: boolean): void;
|
|
32
|
+
SetPropagateKeyboardInput(propagate: boolean): void;
|
|
33
|
+
SetScript(script: "OnClick" | "OnDragStart" | "OnDragStop" | "OnEnter" | "OnLeave", handler: ((this: void, frame: wuiraNativeFrame) => void) | undefined): void;
|
|
34
|
+
SetScript(script: "OnKeyDown", handler: ((this: void, frame: wuiraNativeFrame, key: string) => void) | undefined): void;
|
|
35
|
+
GetName(): string | undefined;
|
|
36
|
+
IsProtected?(): boolean;
|
|
37
|
+
GetParent(): wuiraNativeFrame;
|
|
38
|
+
GetNumPoints(): number;
|
|
39
|
+
GetPoint(index: number): wuiraNativeReturns<[wuiraAnchor, wuiraNativeFrame, wuiraAnchor, number, number]>;
|
|
40
|
+
GetScale(): number;
|
|
41
|
+
GetChildren(): wuiraNativeFrame[] & { readonly __tstlMultiReturn: unknown };
|
|
42
|
+
IsMouseOver(): boolean;
|
|
43
|
+
SetFrameStrata(strata: "BACKGROUND" | "LOW" | "MEDIUM" | "HIGH" | "DIALOG" | "FULLSCREEN" | "FULLSCREEN_DIALOG" | "TOOLTIP"): void;
|
|
44
|
+
HookScript(script: "OnEnter" | "OnLeave" | "OnShow" | "OnHide" | "OnSizeChanged", handler: (this: void, frame: wuiraNativeFrame) => void): void;
|
|
45
|
+
SetAlpha(alpha: number): void;
|
|
23
46
|
SetClipsChildren(clips: boolean): void;
|
|
24
47
|
GetFrameLevel(): number;
|
|
25
48
|
SetFrameLevel(level: number): void;
|
|
@@ -49,10 +72,23 @@ interface wuiraNativeFontString {
|
|
|
49
72
|
SetText(text: string): void;
|
|
50
73
|
SetTextColor(r: number, g: number, b: number, a: number): void;
|
|
51
74
|
SetJustifyH(align: "LEFT" | "CENTER" | "RIGHT"): void;
|
|
52
|
-
SetJustifyV(align: "MIDDLE"): void;
|
|
75
|
+
SetJustifyV(align: "MIDDLE" | "TOP" | "BOTTOM"): void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface wuiraNativeCooldown extends wuiraNativeFrame {
|
|
79
|
+
SetCooldownFromDurationObject(duration: import("../datasources/TimerSource").NativeDuration, clearIfZero?: boolean): void;
|
|
80
|
+
SetDrawSwipe(draw: boolean): void;
|
|
81
|
+
SetDrawEdge(draw: boolean): void;
|
|
82
|
+
SetDrawBling(draw: boolean): void;
|
|
83
|
+
SetHideCountdownNumbers(hide: boolean): void;
|
|
84
|
+
SetSwipeColor(r: number, g: number, b: number, a: number): void;
|
|
85
|
+
GetCountdownFontString(): wuiraNativeFontString;
|
|
86
|
+
Clear(): void;
|
|
53
87
|
}
|
|
54
88
|
|
|
55
89
|
declare const UIParent: wuiraNativeFrame;
|
|
90
|
+
declare const _G: Record<string, unknown>;
|
|
91
|
+
declare const SlashCmdList: Record<string, (this: void, message: string) => void>;
|
|
56
92
|
interface wuiraNativeStatusBar extends wuiraNativeFrame {
|
|
57
93
|
GetStatusBarTexture(): wuiraNativeTexture;
|
|
58
94
|
SetMinMaxValues(min: number, max: number): void;
|
|
@@ -62,10 +98,24 @@ interface wuiraNativeStatusBar extends wuiraNativeFrame {
|
|
|
62
98
|
SetOrientation(orientation: "HORIZONTAL" | "VERTICAL"): void;
|
|
63
99
|
SetReverseFill(reverse: boolean): void;
|
|
64
100
|
}
|
|
101
|
+
type wuiraMouseClick = "LeftButtonUp" | "RightButtonUp" | "MiddleButtonUp" | "Button4Up" | "Button5Up";
|
|
102
|
+
interface wuiraNativeSecureButton extends wuiraNativeFrame {
|
|
103
|
+
RegisterForClicks(...clicks: wuiraMouseClick[]): void;
|
|
104
|
+
SetAttribute(name: string, value: string | number | boolean | undefined): void;
|
|
105
|
+
SetID(id: number): void;
|
|
106
|
+
}
|
|
65
107
|
|
|
66
108
|
declare function CreateFrame(this: void, kind: "StatusBar", name: undefined, parent: wuiraNativeFrame): wuiraNativeStatusBar;
|
|
67
109
|
declare function CreateFrame(this: void, kind: "Frame", name: undefined, parent: wuiraNativeFrame, template?: "BackdropTemplate"): wuiraNativeFrame;
|
|
110
|
+
declare function CreateFrame(this: void, kind: "Button", name: string | undefined, parent: wuiraNativeFrame, template: "SecureActionButtonTemplate"): wuiraNativeSecureButton;
|
|
111
|
+
declare function CreateFrame(this: void, kind: "Button", name: undefined, parent: wuiraNativeFrame): wuiraNativeFrame;
|
|
112
|
+
declare function CreateFrame(this: void, kind: "Cooldown", name: undefined, parent: wuiraNativeFrame, template: "CooldownFrameTemplate"): wuiraNativeCooldown;
|
|
113
|
+
declare function SetOverrideBindingClick(this: void, owner: wuiraNativeFrame, priority: boolean, key: string, buttonName: string, mouseButton: string): void;
|
|
114
|
+
declare function ClearOverrideBindings(this: void, owner: wuiraNativeFrame): void;
|
|
68
115
|
declare function error(this: void, message: string): never;
|
|
116
|
+
declare function InCombatLockdown(this: void): boolean;
|
|
117
|
+
declare function hooksecurefunc(this: void, name: string, callback: (this: void) => void): void;
|
|
118
|
+
declare function hooksecurefunc(this: void, frame: wuiraNativeFrame, method: string, callback: (this: void) => void): void;
|
|
69
119
|
declare function issecretvalue(this: void, value: unknown): boolean;
|
|
70
120
|
declare function UnitHealth(this: void, unit: string): number;
|
|
71
121
|
declare function UnitHealthMax(this: void, unit: string): number;
|
|
@@ -89,12 +139,37 @@ declare const C_UnitAuras: {
|
|
|
89
139
|
GetAuraDuration?: (this: void, unit: string, id: number) => import("../datasources/TimerSource").NativeDuration | undefined;
|
|
90
140
|
} | undefined;
|
|
91
141
|
declare const C_Spell: {
|
|
92
|
-
|
|
93
|
-
|
|
142
|
+
PickupSpell?: (this: void, id: number) => void;
|
|
143
|
+
GetSpellPowerCost?: (this: void, id: number) => { type: number; cost?: number }[] | undefined;
|
|
144
|
+
GetSpellName?: (this: void, id: number | string) => string | undefined;
|
|
145
|
+
GetSpellTexture?: (this: void, id: number | string) => number | undefined;
|
|
146
|
+
GetSpellCooldownDuration?: (this: void, id: number | string, ignoreGCD?: boolean) => import("../datasources/TimerSource").NativeDuration | undefined;
|
|
94
147
|
} | undefined;
|
|
148
|
+
|
|
149
|
+
declare const C_Item: { PickupItem?: (this: void, id: number) => void } | undefined;
|
|
150
|
+
|
|
151
|
+
declare const C_SpellBook: {
|
|
152
|
+
GetNumSpellBookSkillLines?: (this: void) => number;
|
|
153
|
+
GetSpellBookSkillLineInfo?: (this: void, line: number) => {
|
|
154
|
+
itemIndexOffset: number; numSpellBookItems: number;
|
|
155
|
+
} | undefined;
|
|
156
|
+
GetSpellBookItemInfo?: (this: void, slot: number, bank: number) => {
|
|
157
|
+
itemType: number; spellID?: number; name?: string; isOffSpec?: boolean;
|
|
158
|
+
} | undefined;
|
|
159
|
+
} | undefined;
|
|
160
|
+
declare const GetNumSpellTabs: ((this: void) => number) | undefined;
|
|
161
|
+
declare const GetSpellTabInfo: ((this: void, tab: number) => wuiraNativeReturns<[string, number, number, number]>) | undefined;
|
|
162
|
+
declare const GetSpellBookItemInfo: ((this: void, slot: number, bank: "spell") => wuiraNativeReturns<[string | undefined, number | undefined]>) | undefined;
|
|
95
163
|
declare const C_DurationUtil: {
|
|
96
164
|
CreateDuration(this: void): import("../datasources/TimerSource").NativeDuration & {
|
|
97
165
|
SetTimeFromStart(start: number, duration: number): void;
|
|
98
166
|
};
|
|
99
167
|
} | undefined;
|
|
100
168
|
declare const C_Secrets: { ShouldAurasBeSecret?: (this: void) => boolean } | undefined;
|
|
169
|
+
|
|
170
|
+
declare const GetNumTotemSlots: ((this: void) => number) | undefined;
|
|
171
|
+
declare const GetTotemInfo: ((this: void, slot: number) => wuiraNativeReturns<[
|
|
172
|
+
boolean | undefined, string | undefined, number | undefined, number | undefined,
|
|
173
|
+
number | undefined, number | undefined, number | undefined,
|
|
174
|
+
]>) | undefined;
|
|
175
|
+
declare const GetTotemDuration: ((this: void, slot: number) => import("../datasources/TimerSource").NativeDuration) | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NativeSkin } from "./NativeSkin";
|
|
2
|
+
import type { MicroMenuSkinOptions } from "../platform/MicroMenu";
|
|
3
|
+
export declare class MicroBar extends NativeSkin {
|
|
4
|
+
private stopStyling?;
|
|
5
|
+
constructor();
|
|
6
|
+
Style(options: MicroMenuSkinOptions): this;
|
|
7
|
+
Dispose(): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
-- Lua Library inline imports
|
|
3
|
+
local function __TS__Class(self)
|
|
4
|
+
local c = {prototype = {}}
|
|
5
|
+
c.prototype.__index = c.prototype
|
|
6
|
+
c.prototype.constructor = c
|
|
7
|
+
return c
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
local function __TS__ClassExtends(target, base)
|
|
11
|
+
target.____super = base
|
|
12
|
+
local staticMetatable = setmetatable({__index = base}, base)
|
|
13
|
+
setmetatable(target, staticMetatable)
|
|
14
|
+
local baseMetatable = getmetatable(base)
|
|
15
|
+
if baseMetatable then
|
|
16
|
+
if type(baseMetatable.__index) == "function" then
|
|
17
|
+
staticMetatable.__index = baseMetatable.__index
|
|
18
|
+
end
|
|
19
|
+
if type(baseMetatable.__newindex) == "function" then
|
|
20
|
+
staticMetatable.__newindex = baseMetatable.__newindex
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
setmetatable(target.prototype, base.prototype)
|
|
24
|
+
if type(base.prototype.__index) == "function" then
|
|
25
|
+
target.prototype.__index = base.prototype.__index
|
|
26
|
+
end
|
|
27
|
+
if type(base.prototype.__newindex) == "function" then
|
|
28
|
+
target.prototype.__newindex = base.prototype.__newindex
|
|
29
|
+
end
|
|
30
|
+
if type(base.prototype.__tostring) == "function" then
|
|
31
|
+
target.prototype.__tostring = base.prototype.__tostring
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
-- End of Lua Library inline imports
|
|
35
|
+
local ____exports = {}
|
|
36
|
+
local ____NativeSkin = require("skins.NativeSkin")
|
|
37
|
+
local NativeSkin = ____NativeSkin.NativeSkin
|
|
38
|
+
local ____MicroMenu = require("platform.MicroMenu")
|
|
39
|
+
local skinMicroMenu = ____MicroMenu.skinMicroMenu
|
|
40
|
+
____exports.MicroBar = __TS__Class()
|
|
41
|
+
local MicroBar = ____exports.MicroBar
|
|
42
|
+
MicroBar.name = "MicroBar"
|
|
43
|
+
__TS__ClassExtends(MicroBar, NativeSkin)
|
|
44
|
+
function MicroBar.prototype.____constructor(self)
|
|
45
|
+
NativeSkin.prototype.____constructor(self, "MicroMenu")
|
|
46
|
+
end
|
|
47
|
+
function MicroBar.prototype.Style(self, options)
|
|
48
|
+
local ____opt_0 = self.stopStyling
|
|
49
|
+
if ____opt_0 ~= nil then
|
|
50
|
+
____opt_0(self)
|
|
51
|
+
end
|
|
52
|
+
self.stopStyling = skinMicroMenu(nil, options)
|
|
53
|
+
return self
|
|
54
|
+
end
|
|
55
|
+
function MicroBar.prototype.Dispose(self)
|
|
56
|
+
if not InCombatLockdown() then
|
|
57
|
+
local ____opt_2 = self.stopStyling
|
|
58
|
+
if ____opt_2 ~= nil then
|
|
59
|
+
____opt_2(self)
|
|
60
|
+
end
|
|
61
|
+
self.stopStyling = nil
|
|
62
|
+
end
|
|
63
|
+
NativeSkin.prototype.Dispose(self)
|
|
64
|
+
end
|
|
65
|
+
return ____exports
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Cell } from "../ui/Cell";
|
|
2
|
+
import type { Anchor } from "../types/Position";
|
|
3
|
+
/** A presentation adapter around a game-owned frame, not a replacement widget. */
|
|
4
|
+
export declare abstract class NativeSkin {
|
|
5
|
+
private readonly name;
|
|
6
|
+
private renderer?;
|
|
7
|
+
private renderPending;
|
|
8
|
+
private rendering;
|
|
9
|
+
private listener?;
|
|
10
|
+
private disposed;
|
|
11
|
+
private disposing;
|
|
12
|
+
private hovered;
|
|
13
|
+
private readonly views;
|
|
14
|
+
private readonly hoverListeners;
|
|
15
|
+
private readonly hooked;
|
|
16
|
+
protected constructor(name: string);
|
|
17
|
+
get Frame(): wuiraNativeFrame | undefined;
|
|
18
|
+
/** Runs once the native frame exists. The callback receives this adapter, including mount(). */
|
|
19
|
+
render(renderer: (this: void, bar: this) => this | void): this;
|
|
20
|
+
mount(view: Cell | (() => Cell | void) | void, anchor?: Anchor): wuiraNativeFrame | undefined;
|
|
21
|
+
/** Observe pointer presence over the frame and its descendants without replacing native scripts. */
|
|
22
|
+
OnHover(callback: (this: void, hovered: boolean) => void): () => void;
|
|
23
|
+
private watch;
|
|
24
|
+
private apply;
|
|
25
|
+
Dispose(): void;
|
|
26
|
+
}
|