wuira 0.1.4 → 0.1.6
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 +102 -1
- package/README.md +347 -0
- package/lib/Spells.d.ts +21 -0
- package/lib/Spells.lua +41 -0
- package/lib/datasources/AuraTimer.d.ts +21 -0
- package/lib/datasources/AuraTimer.lua +322 -0
- package/lib/datasources/CastTimer.d.ts +9 -0
- package/lib/datasources/CastTimer.lua +240 -0
- package/lib/datasources/DataSource.d.ts +4 -0
- package/lib/datasources/DataSource.lua +24 -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.d.ts +6 -2
- package/lib/datasources/ProgressSource.lua +34 -3
- package/lib/datasources/Resources.d.ts +33 -2
- package/lib/datasources/Resources.lua +562 -10
- package/lib/datasources/SpellCooldown.d.ts +12 -0
- package/lib/datasources/SpellCooldown.lua +218 -0
- package/lib/datasources/SpellSource.d.ts +14 -0
- package/lib/datasources/SpellSource.lua +224 -0
- package/lib/datasources/SwingTimer.d.ts +31 -0
- package/lib/datasources/SwingTimer.lua +641 -0
- package/lib/datasources/TextureSource.d.ts +10 -0
- package/lib/datasources/TextureSource.lua +83 -0
- package/lib/datasources/TimerSource.d.ts +20 -0
- package/lib/datasources/TimerSource.lua +338 -0
- package/lib/datasources/TotemTimer.d.ts +10 -0
- package/lib/datasources/TotemTimer.lua +260 -0
- package/lib/datasources/index.d.ts +16 -1
- package/lib/datasources/index.lua +43 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.lua +24 -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 +17 -0
- package/lib/platform/BlizzardUI.lua +689 -0
- 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 +115 -2
- 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 +7 -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/Icon.d.ts +8 -0
- package/lib/ui/Icon.lua +8 -0
- package/lib/ui/KeybindCapture.d.ts +20 -0
- package/lib/ui/KeybindCapture.lua +488 -0
- package/lib/ui/Label.d.ts +10 -0
- package/lib/ui/Label.lua +8 -0
- package/lib/ui/ProgressBar.d.ts +5 -1
- package/lib/ui/SecureButton.d.ts +44 -0
- package/lib/ui/SecureButton.lua +9 -0
- package/lib/ui/index.d.ts +13 -0
- package/lib/ui/index.lua +28 -0
- package/lib/ui/layout/measureLayout.lua +11 -2
- package/lib/ui/mount.lua +679 -74
- package/lib/ui/primitives/jsx.d.ts +15 -2
- 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,488 @@
|
|
|
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 __TS__Symbol, Symbol
|
|
11
|
+
do
|
|
12
|
+
local symbolMetatable = {__tostring = function(self)
|
|
13
|
+
return ("Symbol(" .. (self.description or "")) .. ")"
|
|
14
|
+
end}
|
|
15
|
+
function __TS__Symbol(description)
|
|
16
|
+
return setmetatable({description = description}, symbolMetatable)
|
|
17
|
+
end
|
|
18
|
+
Symbol = {
|
|
19
|
+
asyncDispose = __TS__Symbol("Symbol.asyncDispose"),
|
|
20
|
+
dispose = __TS__Symbol("Symbol.dispose"),
|
|
21
|
+
iterator = __TS__Symbol("Symbol.iterator"),
|
|
22
|
+
hasInstance = __TS__Symbol("Symbol.hasInstance"),
|
|
23
|
+
species = __TS__Symbol("Symbol.species"),
|
|
24
|
+
toStringTag = __TS__Symbol("Symbol.toStringTag")
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
local __TS__Iterator
|
|
29
|
+
do
|
|
30
|
+
local function iteratorGeneratorStep(self)
|
|
31
|
+
local co = self.____coroutine
|
|
32
|
+
local status, value = coroutine.resume(co)
|
|
33
|
+
if not status then
|
|
34
|
+
error(value, 0)
|
|
35
|
+
end
|
|
36
|
+
if coroutine.status(co) == "dead" then
|
|
37
|
+
return
|
|
38
|
+
end
|
|
39
|
+
return true, value
|
|
40
|
+
end
|
|
41
|
+
local function iteratorIteratorStep(self)
|
|
42
|
+
local result = self:next()
|
|
43
|
+
if result.done then
|
|
44
|
+
return
|
|
45
|
+
end
|
|
46
|
+
return true, result.value
|
|
47
|
+
end
|
|
48
|
+
local function iteratorStringStep(self, index)
|
|
49
|
+
index = index + 1
|
|
50
|
+
if index > #self then
|
|
51
|
+
return
|
|
52
|
+
end
|
|
53
|
+
return index, string.sub(self, index, index)
|
|
54
|
+
end
|
|
55
|
+
function __TS__Iterator(iterable)
|
|
56
|
+
if type(iterable) == "string" then
|
|
57
|
+
return iteratorStringStep, iterable, 0
|
|
58
|
+
elseif iterable.____coroutine ~= nil then
|
|
59
|
+
return iteratorGeneratorStep, iterable
|
|
60
|
+
elseif iterable[Symbol.iterator] then
|
|
61
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
62
|
+
return iteratorIteratorStep, iterator
|
|
63
|
+
else
|
|
64
|
+
return ipairs(iterable)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
local function __TS__New(target, ...)
|
|
70
|
+
local instance = setmetatable({}, target.prototype)
|
|
71
|
+
instance:____constructor(...)
|
|
72
|
+
return instance
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
local Set
|
|
76
|
+
do
|
|
77
|
+
Set = __TS__Class()
|
|
78
|
+
Set.name = "Set"
|
|
79
|
+
function Set.prototype.____constructor(self, values)
|
|
80
|
+
self[Symbol.toStringTag] = "Set"
|
|
81
|
+
self.size = 0
|
|
82
|
+
self.nextKey = {}
|
|
83
|
+
self.previousKey = {}
|
|
84
|
+
if values == nil then
|
|
85
|
+
return
|
|
86
|
+
end
|
|
87
|
+
local iterable = values
|
|
88
|
+
if iterable[Symbol.iterator] then
|
|
89
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
90
|
+
while true do
|
|
91
|
+
local result = iterator:next()
|
|
92
|
+
if result.done then
|
|
93
|
+
break
|
|
94
|
+
end
|
|
95
|
+
self:add(result.value)
|
|
96
|
+
end
|
|
97
|
+
else
|
|
98
|
+
local array = values
|
|
99
|
+
for ____, value in ipairs(array) do
|
|
100
|
+
self:add(value)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
function Set.prototype.add(self, value)
|
|
105
|
+
local isNewValue = not self:has(value)
|
|
106
|
+
if isNewValue then
|
|
107
|
+
self.size = self.size + 1
|
|
108
|
+
end
|
|
109
|
+
if self.firstKey == nil then
|
|
110
|
+
self.firstKey = value
|
|
111
|
+
self.lastKey = value
|
|
112
|
+
elseif isNewValue then
|
|
113
|
+
self.nextKey[self.lastKey] = value
|
|
114
|
+
self.previousKey[value] = self.lastKey
|
|
115
|
+
self.lastKey = value
|
|
116
|
+
end
|
|
117
|
+
return self
|
|
118
|
+
end
|
|
119
|
+
function Set.prototype.clear(self)
|
|
120
|
+
self.nextKey = {}
|
|
121
|
+
self.previousKey = {}
|
|
122
|
+
self.firstKey = nil
|
|
123
|
+
self.lastKey = nil
|
|
124
|
+
self.size = 0
|
|
125
|
+
end
|
|
126
|
+
function Set.prototype.delete(self, value)
|
|
127
|
+
local contains = self:has(value)
|
|
128
|
+
if contains then
|
|
129
|
+
self.size = self.size - 1
|
|
130
|
+
local next = self.nextKey[value]
|
|
131
|
+
local previous = self.previousKey[value]
|
|
132
|
+
if next ~= nil and previous ~= nil then
|
|
133
|
+
self.nextKey[previous] = next
|
|
134
|
+
self.previousKey[next] = previous
|
|
135
|
+
elseif next ~= nil then
|
|
136
|
+
self.firstKey = next
|
|
137
|
+
self.previousKey[next] = nil
|
|
138
|
+
elseif previous ~= nil then
|
|
139
|
+
self.lastKey = previous
|
|
140
|
+
self.nextKey[previous] = nil
|
|
141
|
+
else
|
|
142
|
+
self.firstKey = nil
|
|
143
|
+
self.lastKey = nil
|
|
144
|
+
end
|
|
145
|
+
self.nextKey[value] = nil
|
|
146
|
+
self.previousKey[value] = nil
|
|
147
|
+
end
|
|
148
|
+
return contains
|
|
149
|
+
end
|
|
150
|
+
function Set.prototype.forEach(self, callback)
|
|
151
|
+
for ____, key in __TS__Iterator(self:keys()) do
|
|
152
|
+
callback(nil, key, key, self)
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
function Set.prototype.has(self, value)
|
|
156
|
+
return self.nextKey[value] ~= nil or self.lastKey == value
|
|
157
|
+
end
|
|
158
|
+
Set.prototype[Symbol.iterator] = function(self)
|
|
159
|
+
return self:values()
|
|
160
|
+
end
|
|
161
|
+
function Set.prototype.entries(self)
|
|
162
|
+
local function getFirstKey()
|
|
163
|
+
return self.firstKey
|
|
164
|
+
end
|
|
165
|
+
local nextKey = self.nextKey
|
|
166
|
+
local key
|
|
167
|
+
local started = false
|
|
168
|
+
return {
|
|
169
|
+
[Symbol.iterator] = function(self)
|
|
170
|
+
return self
|
|
171
|
+
end,
|
|
172
|
+
next = function(self)
|
|
173
|
+
if not started then
|
|
174
|
+
started = true
|
|
175
|
+
key = getFirstKey(nil)
|
|
176
|
+
else
|
|
177
|
+
key = nextKey[key]
|
|
178
|
+
end
|
|
179
|
+
return {done = not key, value = {key, key}}
|
|
180
|
+
end
|
|
181
|
+
}
|
|
182
|
+
end
|
|
183
|
+
function Set.prototype.keys(self)
|
|
184
|
+
local function getFirstKey()
|
|
185
|
+
return self.firstKey
|
|
186
|
+
end
|
|
187
|
+
local nextKey = self.nextKey
|
|
188
|
+
local key
|
|
189
|
+
local started = false
|
|
190
|
+
return {
|
|
191
|
+
[Symbol.iterator] = function(self)
|
|
192
|
+
return self
|
|
193
|
+
end,
|
|
194
|
+
next = function(self)
|
|
195
|
+
if not started then
|
|
196
|
+
started = true
|
|
197
|
+
key = getFirstKey(nil)
|
|
198
|
+
else
|
|
199
|
+
key = nextKey[key]
|
|
200
|
+
end
|
|
201
|
+
return {done = not key, value = key}
|
|
202
|
+
end
|
|
203
|
+
}
|
|
204
|
+
end
|
|
205
|
+
function Set.prototype.values(self)
|
|
206
|
+
local function getFirstKey()
|
|
207
|
+
return self.firstKey
|
|
208
|
+
end
|
|
209
|
+
local nextKey = self.nextKey
|
|
210
|
+
local key
|
|
211
|
+
local started = false
|
|
212
|
+
return {
|
|
213
|
+
[Symbol.iterator] = function(self)
|
|
214
|
+
return self
|
|
215
|
+
end,
|
|
216
|
+
next = function(self)
|
|
217
|
+
if not started then
|
|
218
|
+
started = true
|
|
219
|
+
key = getFirstKey(nil)
|
|
220
|
+
else
|
|
221
|
+
key = nextKey[key]
|
|
222
|
+
end
|
|
223
|
+
return {done = not key, value = key}
|
|
224
|
+
end
|
|
225
|
+
}
|
|
226
|
+
end
|
|
227
|
+
function Set.prototype.union(self, other)
|
|
228
|
+
local result = __TS__New(Set, self)
|
|
229
|
+
for ____, item in __TS__Iterator(other) do
|
|
230
|
+
result:add(item)
|
|
231
|
+
end
|
|
232
|
+
return result
|
|
233
|
+
end
|
|
234
|
+
function Set.prototype.intersection(self, other)
|
|
235
|
+
local result = __TS__New(Set)
|
|
236
|
+
for ____, item in __TS__Iterator(self) do
|
|
237
|
+
if other:has(item) then
|
|
238
|
+
result:add(item)
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
return result
|
|
242
|
+
end
|
|
243
|
+
function Set.prototype.difference(self, other)
|
|
244
|
+
local result = __TS__New(Set, self)
|
|
245
|
+
for ____, item in __TS__Iterator(other) do
|
|
246
|
+
result:delete(item)
|
|
247
|
+
end
|
|
248
|
+
return result
|
|
249
|
+
end
|
|
250
|
+
function Set.prototype.symmetricDifference(self, other)
|
|
251
|
+
local result = __TS__New(Set, self)
|
|
252
|
+
for ____, item in __TS__Iterator(other) do
|
|
253
|
+
if self:has(item) then
|
|
254
|
+
result:delete(item)
|
|
255
|
+
else
|
|
256
|
+
result:add(item)
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
return result
|
|
260
|
+
end
|
|
261
|
+
function Set.prototype.isSubsetOf(self, other)
|
|
262
|
+
for ____, item in __TS__Iterator(self) do
|
|
263
|
+
if not other:has(item) then
|
|
264
|
+
return false
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
return true
|
|
268
|
+
end
|
|
269
|
+
function Set.prototype.isSupersetOf(self, other)
|
|
270
|
+
for ____, item in __TS__Iterator(other) do
|
|
271
|
+
if not self:has(item) then
|
|
272
|
+
return false
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
return true
|
|
276
|
+
end
|
|
277
|
+
function Set.prototype.isDisjointFrom(self, other)
|
|
278
|
+
for ____, item in __TS__Iterator(self) do
|
|
279
|
+
if other:has(item) then
|
|
280
|
+
return false
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
return true
|
|
284
|
+
end
|
|
285
|
+
Set[Symbol.species] = Set
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
local function __TS__ArrayIncludes(self, searchElement, fromIndex)
|
|
289
|
+
if fromIndex == nil then
|
|
290
|
+
fromIndex = 0
|
|
291
|
+
end
|
|
292
|
+
local len = #self
|
|
293
|
+
local k = fromIndex
|
|
294
|
+
if fromIndex < 0 then
|
|
295
|
+
k = len + fromIndex
|
|
296
|
+
end
|
|
297
|
+
if k < 0 then
|
|
298
|
+
k = 0
|
|
299
|
+
end
|
|
300
|
+
for i = k + 1, len do
|
|
301
|
+
if self[i] == searchElement then
|
|
302
|
+
return true
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
return false
|
|
306
|
+
end
|
|
307
|
+
-- End of Lua Library inline imports
|
|
308
|
+
local ____exports = {}
|
|
309
|
+
--- Hover-to-bind input capture. It reports keys; the addon owns persistence and actions.
|
|
310
|
+
____exports.KeybindCapture = __TS__Class()
|
|
311
|
+
local KeybindCapture = ____exports.KeybindCapture
|
|
312
|
+
KeybindCapture.name = "KeybindCapture"
|
|
313
|
+
function KeybindCapture.prototype.____constructor(self, onCancel)
|
|
314
|
+
self.onCancel = onCancel
|
|
315
|
+
self.targets = __TS__New(Set)
|
|
316
|
+
self.active = false
|
|
317
|
+
self.frame = CreateFrame("Frame", nil, UIParent)
|
|
318
|
+
self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
|
319
|
+
self.frame:SetSize(1, 1)
|
|
320
|
+
self.frame:SetPoint(
|
|
321
|
+
"TOPLEFT",
|
|
322
|
+
UIParent,
|
|
323
|
+
"TOPLEFT",
|
|
324
|
+
0,
|
|
325
|
+
0
|
|
326
|
+
)
|
|
327
|
+
self.frame:EnableMouse(false)
|
|
328
|
+
self.frame:EnableKeyboard(false)
|
|
329
|
+
self.frame:Hide()
|
|
330
|
+
self.frame:SetScript(
|
|
331
|
+
"OnKeyDown",
|
|
332
|
+
function(_frame, key) return self:OnKey(key) end
|
|
333
|
+
)
|
|
334
|
+
self.frame:RegisterEvent("PLAYER_REGEN_DISABLED")
|
|
335
|
+
self.frame:SetScript(
|
|
336
|
+
"OnEvent",
|
|
337
|
+
function()
|
|
338
|
+
self:SetActive(false)
|
|
339
|
+
self:onCancel()
|
|
340
|
+
end
|
|
341
|
+
)
|
|
342
|
+
end
|
|
343
|
+
function KeybindCapture.prototype.AddTarget(self, frame, onBinding)
|
|
344
|
+
if InCombatLockdown() then
|
|
345
|
+
error("KeybindCapture: register targets outside combat")
|
|
346
|
+
end
|
|
347
|
+
local overlay = CreateFrame("Frame", nil, UIParent)
|
|
348
|
+
overlay:SetFrameStrata("DIALOG")
|
|
349
|
+
overlay:SetSize(
|
|
350
|
+
frame:GetWidth(),
|
|
351
|
+
frame:GetHeight()
|
|
352
|
+
)
|
|
353
|
+
local x, y = frame:GetCenter()
|
|
354
|
+
local screenX, screenY = UIParent:GetCenter()
|
|
355
|
+
if x == nil or y == nil or screenX == nil or screenY == nil then
|
|
356
|
+
error("KeybindCapture: target has no screen position")
|
|
357
|
+
end
|
|
358
|
+
overlay:SetPoint(
|
|
359
|
+
"CENTER",
|
|
360
|
+
UIParent,
|
|
361
|
+
"CENTER",
|
|
362
|
+
x - screenX,
|
|
363
|
+
y - screenY
|
|
364
|
+
)
|
|
365
|
+
overlay:EnableMouse(true)
|
|
366
|
+
local color = overlay:CreateTexture(nil, "OVERLAY")
|
|
367
|
+
color:SetAllPoints(overlay)
|
|
368
|
+
color:SetColorTexture(0.4, 0.75, 1, 0.14)
|
|
369
|
+
local target = {frame = frame, overlay = overlay, onBinding = onBinding}
|
|
370
|
+
overlay:SetScript(
|
|
371
|
+
"OnEnter",
|
|
372
|
+
function()
|
|
373
|
+
if not self.active then
|
|
374
|
+
return
|
|
375
|
+
end
|
|
376
|
+
self.hovered = target
|
|
377
|
+
color:SetColorTexture(0.4, 0.75, 1, 0.45)
|
|
378
|
+
end
|
|
379
|
+
)
|
|
380
|
+
overlay:SetScript(
|
|
381
|
+
"OnLeave",
|
|
382
|
+
function()
|
|
383
|
+
if self.hovered == target then
|
|
384
|
+
self.hovered = nil
|
|
385
|
+
end
|
|
386
|
+
color:SetColorTexture(0.4, 0.75, 1, 0.14)
|
|
387
|
+
end
|
|
388
|
+
)
|
|
389
|
+
self.targets:add(target)
|
|
390
|
+
if self.active then
|
|
391
|
+
overlay:Show()
|
|
392
|
+
else
|
|
393
|
+
overlay:Hide()
|
|
394
|
+
end
|
|
395
|
+
return function()
|
|
396
|
+
if self.hovered == target then
|
|
397
|
+
self.hovered = nil
|
|
398
|
+
end
|
|
399
|
+
self.targets:delete(target)
|
|
400
|
+
overlay:SetScript("OnEnter", nil)
|
|
401
|
+
overlay:SetScript("OnLeave", nil)
|
|
402
|
+
overlay:EnableMouse(false)
|
|
403
|
+
overlay:Hide()
|
|
404
|
+
end
|
|
405
|
+
end
|
|
406
|
+
function KeybindCapture.prototype.SetActive(self, active)
|
|
407
|
+
if active and InCombatLockdown() then
|
|
408
|
+
error("KeybindCapture: enable outside combat")
|
|
409
|
+
end
|
|
410
|
+
self.active = active
|
|
411
|
+
self.hovered = nil
|
|
412
|
+
self.frame:EnableKeyboard(active)
|
|
413
|
+
if active then
|
|
414
|
+
self.frame:SetPropagateKeyboardInput(true)
|
|
415
|
+
self.frame:Show()
|
|
416
|
+
else
|
|
417
|
+
self.frame:Hide()
|
|
418
|
+
end
|
|
419
|
+
for ____, target in __TS__Iterator(self.targets) do
|
|
420
|
+
if active then
|
|
421
|
+
local x, y = target.frame:GetCenter()
|
|
422
|
+
local screenX, screenY = UIParent:GetCenter()
|
|
423
|
+
if x ~= nil and y ~= nil and screenX ~= nil and screenY ~= nil then
|
|
424
|
+
target.overlay:ClearAllPoints()
|
|
425
|
+
target.overlay:SetPoint(
|
|
426
|
+
"CENTER",
|
|
427
|
+
UIParent,
|
|
428
|
+
"CENTER",
|
|
429
|
+
x - screenX,
|
|
430
|
+
y - screenY
|
|
431
|
+
)
|
|
432
|
+
end
|
|
433
|
+
target.overlay:Show()
|
|
434
|
+
else
|
|
435
|
+
target.overlay:Hide()
|
|
436
|
+
end
|
|
437
|
+
end
|
|
438
|
+
end
|
|
439
|
+
function KeybindCapture.prototype.OnKey(self, key)
|
|
440
|
+
if not self.active or InCombatLockdown() then
|
|
441
|
+
return
|
|
442
|
+
end
|
|
443
|
+
self.frame:SetPropagateKeyboardInput(true)
|
|
444
|
+
local chat = ChatEdit_GetActiveWindow and ChatEdit_GetActiveWindow()
|
|
445
|
+
if chat and chat:IsShown() then
|
|
446
|
+
return
|
|
447
|
+
end
|
|
448
|
+
if key == "ESCAPE" then
|
|
449
|
+
self.frame:SetPropagateKeyboardInput(false)
|
|
450
|
+
self:onCancel()
|
|
451
|
+
return
|
|
452
|
+
end
|
|
453
|
+
if self.hovered == nil or __TS__ArrayIncludes({
|
|
454
|
+
"LSHIFT",
|
|
455
|
+
"RSHIFT",
|
|
456
|
+
"LCTRL",
|
|
457
|
+
"RCTRL",
|
|
458
|
+
"LALT",
|
|
459
|
+
"RALT",
|
|
460
|
+
"ENTER",
|
|
461
|
+
"PRINTSCREEN"
|
|
462
|
+
}, key) then
|
|
463
|
+
return
|
|
464
|
+
end
|
|
465
|
+
self.frame:SetPropagateKeyboardInput(false)
|
|
466
|
+
local ____temp_4
|
|
467
|
+
if key == "BACKSPACE" or key == "DELETE" then
|
|
468
|
+
____temp_4 = nil
|
|
469
|
+
else
|
|
470
|
+
____temp_4 = (((IsControlKeyDown() and "CTRL-" or "") .. (IsAltKeyDown() and "ALT-" or "")) .. (IsShiftKeyDown() and "SHIFT-" or "")) .. key
|
|
471
|
+
end
|
|
472
|
+
local binding = ____temp_4
|
|
473
|
+
self.hovered:onBinding(binding)
|
|
474
|
+
self.frame:SetPropagateKeyboardInput(false)
|
|
475
|
+
end
|
|
476
|
+
function KeybindCapture.prototype.Dispose(self)
|
|
477
|
+
self:SetActive(false)
|
|
478
|
+
self.frame:UnregisterAllEvents()
|
|
479
|
+
self.frame:SetScript("OnEvent", nil)
|
|
480
|
+
self.frame:SetScript("OnKeyDown", nil)
|
|
481
|
+
for ____, target in __TS__Iterator(self.targets) do
|
|
482
|
+
target.overlay:SetScript("OnEnter", nil)
|
|
483
|
+
target.overlay:SetScript("OnLeave", nil)
|
|
484
|
+
target.overlay:EnableMouse(false)
|
|
485
|
+
end
|
|
486
|
+
self.targets:clear()
|
|
487
|
+
end
|
|
488
|
+
return ____exports
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CellProps } from "./Cell";
|
|
2
|
+
import type { Color } from "../types/Color";
|
|
3
|
+
export type LabelProps = CellProps & {
|
|
4
|
+
text: string | (() => string);
|
|
5
|
+
font?: string;
|
|
6
|
+
fontSize?: number;
|
|
7
|
+
color?: Color;
|
|
8
|
+
align?: "LEFT" | "CENTER" | "RIGHT";
|
|
9
|
+
};
|
|
10
|
+
export declare function Label(props: Partial<CellProps> & Omit<LabelProps, keyof CellProps>): import("..").Element;
|
package/lib/ui/Label.lua
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local ____jsx = require("ui.primitives.jsx")
|
|
4
|
+
local UI = ____jsx.UI
|
|
5
|
+
function ____exports.Label(self, props)
|
|
6
|
+
return UI:createElement("label", props)
|
|
7
|
+
end
|
|
8
|
+
return ____exports
|
package/lib/ui/ProgressBar.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CellProps, ICell } from "./Cell";
|
|
2
2
|
import type { Color } from "../types/Color";
|
|
3
3
|
import type { ProgressSource } from "../datasources/ProgressSource";
|
|
4
|
+
import type { TimerSource } from "../datasources/TimerSource";
|
|
4
5
|
import { Element } from "./primitives/jsx";
|
|
5
6
|
import type { TextureOptions } from "../types/Texture";
|
|
6
7
|
import type { BackgroundProps } from "./decorations/Background";
|
|
@@ -8,12 +9,15 @@ import type { BorderProps } from "./decorations/Border";
|
|
|
8
9
|
export type ProgressBarProps = CellProps & {
|
|
9
10
|
value?: number;
|
|
10
11
|
current?: number;
|
|
11
|
-
source?: ProgressSource;
|
|
12
|
+
source?: ProgressSource | TimerSource;
|
|
12
13
|
min?: number;
|
|
13
14
|
max?: number;
|
|
14
15
|
color?: Color;
|
|
15
16
|
/** Fill settings; explicit fields take priority over color/texture aliases. */
|
|
16
17
|
foreground?: TextureOptions;
|
|
18
|
+
/** Enabled HP channels render automatically; false suppresses their overlay. */
|
|
19
|
+
healPrediction?: TextureOptions | false;
|
|
20
|
+
absorbPrediction?: TextureOptions | false;
|
|
17
21
|
/** Full-size track behind the fill. false disables a decoration background. */
|
|
18
22
|
background?: BackgroundProps | false;
|
|
19
23
|
/** Backdrop edge texture; track/background is configured independently. */
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Cell, CellProps, ICell } from "./Cell";
|
|
2
|
+
import type { Element } from "./primitives/jsx";
|
|
3
|
+
import type { TimerSource } from "../datasources/TimerSource";
|
|
4
|
+
export type SecureAction = {
|
|
5
|
+
type: "spell";
|
|
6
|
+
spell: number | string;
|
|
7
|
+
unit?: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: "item";
|
|
10
|
+
item: number | string;
|
|
11
|
+
unit?: string;
|
|
12
|
+
} | {
|
|
13
|
+
type: "macro";
|
|
14
|
+
macro: number | string;
|
|
15
|
+
} | {
|
|
16
|
+
type: "action";
|
|
17
|
+
slot: number;
|
|
18
|
+
unit?: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: "target";
|
|
21
|
+
unit: string;
|
|
22
|
+
};
|
|
23
|
+
export type MouseButton = "LeftButton" | "RightButton" | "MiddleButton" | "Button4" | "Button5";
|
|
24
|
+
export type SecureButtonProps = CellProps & {
|
|
25
|
+
/** Static secure attributes, configured before combat. No action means an inert button. */
|
|
26
|
+
action?: SecureAction;
|
|
27
|
+
/** Defaults to LeftButton; actions execute on release. */
|
|
28
|
+
button?: MouseButton;
|
|
29
|
+
/** Temporary override while mounted; never saved to the user's binding configuration. */
|
|
30
|
+
binding?: string;
|
|
31
|
+
showHotkey?: boolean;
|
|
32
|
+
cooldown?: TimerSource;
|
|
33
|
+
/** Native short completion flash; requires cooldown. */
|
|
34
|
+
finishGlow?: boolean;
|
|
35
|
+
clickThrough?: false;
|
|
36
|
+
};
|
|
37
|
+
export interface ISecureButton extends ICell {
|
|
38
|
+
kind: "secureButton";
|
|
39
|
+
props: SecureButtonProps;
|
|
40
|
+
}
|
|
41
|
+
/** A Cell rendered as a native SecureActionButtonTemplate, with one presentation child. */
|
|
42
|
+
export declare function SecureButton(props: Partial<SecureButtonProps> & {
|
|
43
|
+
child?: Element;
|
|
44
|
+
}, child?: Element): Cell;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local ____jsx = require("ui.primitives.jsx")
|
|
4
|
+
local UI = ____jsx.UI
|
|
5
|
+
--- A Cell rendered as a native SecureActionButtonTemplate, with one presentation child.
|
|
6
|
+
function ____exports.SecureButton(self, props, child)
|
|
7
|
+
return UI:createElement("secureButton", props, props.child or child or ({}))
|
|
8
|
+
end
|
|
9
|
+
return ____exports
|
package/lib/ui/index.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
/// <reference path="../platform/forever.d.ts" />
|
|
2
2
|
export { UI } from "./primitives/jsx";
|
|
3
|
+
export { HoverTracker } from "./HoverTracker";
|
|
4
|
+
export { FrameMover } from "./FrameMover";
|
|
5
|
+
export type { FramePosition, FrameMoverOptions } from "./FrameMover";
|
|
6
|
+
export { KeybindCapture } from "./KeybindCapture";
|
|
7
|
+
export type { HoverTrackerOptions, HoverFrame } from "./HoverTracker";
|
|
3
8
|
export type { Element, Component } from "./primitives/jsx";
|
|
4
9
|
export { Cell } from "./Cell";
|
|
10
|
+
export { Button } from "./Button";
|
|
11
|
+
export type { ButtonProps } from "./Button";
|
|
12
|
+
export { SecureButton } from "./SecureButton";
|
|
13
|
+
export type { SecureAction, SecureButtonProps, MouseButton } from "./SecureButton";
|
|
5
14
|
export type { CellProps } from "./Cell";
|
|
6
15
|
export { FlowLayout } from "./FlowLayout";
|
|
7
16
|
export { GridLayout } from "./GridLayout";
|
|
@@ -9,3 +18,7 @@ export { ProgressBar } from "./ProgressBar";
|
|
|
9
18
|
export { Background } from "./decorations/Background";
|
|
10
19
|
export { Border } from "./decorations/Border";
|
|
11
20
|
export { Glow } from "./decorations/Glow";
|
|
21
|
+
export { Label } from "./Label";
|
|
22
|
+
export type { LabelProps } from "./Label";
|
|
23
|
+
export { Icon } from "./Icon";
|
|
24
|
+
export type { IconProps } from "./Icon";
|
package/lib/ui/index.lua
CHANGED
|
@@ -4,10 +4,30 @@ do
|
|
|
4
4
|
local ____jsx = require("ui.primitives.jsx")
|
|
5
5
|
____exports.UI = ____jsx.UI
|
|
6
6
|
end
|
|
7
|
+
do
|
|
8
|
+
local ____HoverTracker = require("ui.HoverTracker")
|
|
9
|
+
____exports.HoverTracker = ____HoverTracker.HoverTracker
|
|
10
|
+
end
|
|
11
|
+
do
|
|
12
|
+
local ____FrameMover = require("ui.FrameMover")
|
|
13
|
+
____exports.FrameMover = ____FrameMover.FrameMover
|
|
14
|
+
end
|
|
15
|
+
do
|
|
16
|
+
local ____KeybindCapture = require("ui.KeybindCapture")
|
|
17
|
+
____exports.KeybindCapture = ____KeybindCapture.KeybindCapture
|
|
18
|
+
end
|
|
7
19
|
do
|
|
8
20
|
local ____Cell = require("ui.Cell")
|
|
9
21
|
____exports.Cell = ____Cell.Cell
|
|
10
22
|
end
|
|
23
|
+
do
|
|
24
|
+
local ____Button = require("ui.Button")
|
|
25
|
+
____exports.Button = ____Button.Button
|
|
26
|
+
end
|
|
27
|
+
do
|
|
28
|
+
local ____SecureButton = require("ui.SecureButton")
|
|
29
|
+
____exports.SecureButton = ____SecureButton.SecureButton
|
|
30
|
+
end
|
|
11
31
|
do
|
|
12
32
|
local ____FlowLayout = require("ui.FlowLayout")
|
|
13
33
|
____exports.FlowLayout = ____FlowLayout.FlowLayout
|
|
@@ -32,4 +52,12 @@ do
|
|
|
32
52
|
local ____Glow = require("ui.decorations.Glow")
|
|
33
53
|
____exports.Glow = ____Glow.Glow
|
|
34
54
|
end
|
|
55
|
+
do
|
|
56
|
+
local ____Label = require("ui.Label")
|
|
57
|
+
____exports.Label = ____Label.Label
|
|
58
|
+
end
|
|
59
|
+
do
|
|
60
|
+
local ____Icon = require("ui.Icon")
|
|
61
|
+
____exports.Icon = ____Icon.Icon
|
|
62
|
+
end
|
|
35
63
|
return ____exports
|
|
@@ -102,7 +102,16 @@ function ____exports.measureLayout(self, element, available, ancestors)
|
|
|
102
102
|
if __TS__ArrayIncludes(ancestors, element) then
|
|
103
103
|
error("Layout children contain a cycle")
|
|
104
104
|
end
|
|
105
|
-
if
|
|
105
|
+
if not __TS__ArrayIncludes({
|
|
106
|
+
"cell",
|
|
107
|
+
"flow",
|
|
108
|
+
"grid",
|
|
109
|
+
"progress",
|
|
110
|
+
"label",
|
|
111
|
+
"icon",
|
|
112
|
+
"button",
|
|
113
|
+
"secureButton"
|
|
114
|
+
}, element.kind) then
|
|
106
115
|
error("Unsupported UI element: " .. element.kind)
|
|
107
116
|
end
|
|
108
117
|
local cell = element
|
|
@@ -199,7 +208,7 @@ function ____exports.measureLayout(self, element, available, ancestors)
|
|
|
199
208
|
end
|
|
200
209
|
elseif #children > 0 then
|
|
201
210
|
local position = children[1].cell.props
|
|
202
|
-
if position.mode == "relative" and position.relativeTo == nil then
|
|
211
|
+
if position.mode == "relative" and position.relativeTo == nil and (position.anchor == nil or position.anchor == "TOPLEFT") and (position.relativeAnchor == nil or position.relativeAnchor == "TOPLEFT") then
|
|
203
212
|
placements = {{x = padding.left + position.offset.x, y = padding.top + position.offset.y}}
|
|
204
213
|
end
|
|
205
214
|
end
|