wuira 0.2.3 → 0.2.5
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 +38 -0
- package/README.md +62 -792
- package/data/icons/forever.json +90051 -0
- package/docs/icons.md +28 -0
- package/docs/source-converters.md +34 -0
- package/lib/datasources/DataSource.d.ts +8 -0
- package/lib/datasources/DataSource.lua +7 -0
- package/lib/datasources/GroupMembers.d.ts +6 -0
- package/lib/datasources/GroupMembers.lua +332 -0
- package/lib/datasources/GroupRoster.d.ts +28 -0
- package/lib/datasources/GroupRoster.lua +611 -0
- package/lib/datasources/MathConverter.d.ts +6 -0
- package/lib/datasources/MathConverter.lua +61 -0
- package/lib/datasources/MathExpression.d.ts +16 -0
- package/lib/datasources/MathExpression.lua +281 -0
- package/lib/datasources/Resources.d.ts +3 -2
- package/lib/datasources/Resources.lua +57 -48
- package/lib/datasources/SourceConverter.d.ts +39 -0
- package/lib/datasources/SourceConverter.lua +568 -0
- package/lib/datasources/UnitInfo.d.ts +6 -0
- package/lib/datasources/UnitInfo.lua +347 -15
- package/lib/datasources/UnitSource.d.ts +8 -3
- package/lib/datasources/UnitSource.lua +318 -5
- package/lib/datasources/index.d.ts +7 -1
- package/lib/datasources/index.lua +15 -0
- package/lib/icons/index.d.ts +45634 -0
- package/lib/icons/index.lua +3 -0
- package/lib/index.d.ts +1 -0
- package/lib/store/index.lua +20 -18
- package/lib/ui/Cell.d.ts +2 -0
- package/lib/ui/ForEach.d.ts +18 -4
- package/lib/ui/ForEach.lua +763 -13
- package/lib/ui/index.d.ts +1 -1
- package/package.json +20 -4
- package/tools/build-library.mjs +1 -1
- package/tools/generate-icons.mjs +10 -0
- package/tools/icon-data.mjs +59 -0
- package/tools/update-icons.mjs +36 -0
|
@@ -0,0 +1,281 @@
|
|
|
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__StringAccess(self, index)
|
|
11
|
+
if index >= 0 and index < #self then
|
|
12
|
+
return string.sub(self, index + 1, index + 1)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
local function __TS__StringIncludes(self, searchString, position)
|
|
17
|
+
if not position then
|
|
18
|
+
position = 1
|
|
19
|
+
else
|
|
20
|
+
position = position + 1
|
|
21
|
+
end
|
|
22
|
+
local index = string.find(self, searchString, position, true)
|
|
23
|
+
return index ~= nil
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
local function __TS__StringSlice(self, start, ____end)
|
|
27
|
+
if start == nil or start ~= start then
|
|
28
|
+
start = 0
|
|
29
|
+
end
|
|
30
|
+
if ____end ~= ____end then
|
|
31
|
+
____end = 0
|
|
32
|
+
end
|
|
33
|
+
if start >= 0 then
|
|
34
|
+
start = start + 1
|
|
35
|
+
end
|
|
36
|
+
if ____end ~= nil and ____end < 0 then
|
|
37
|
+
____end = ____end - 1
|
|
38
|
+
end
|
|
39
|
+
return string.sub(self, start, ____end)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
local function __TS__Number(value)
|
|
43
|
+
local valueType = type(value)
|
|
44
|
+
if valueType == "number" then
|
|
45
|
+
return value
|
|
46
|
+
elseif valueType == "string" then
|
|
47
|
+
local numberValue = tonumber(value)
|
|
48
|
+
if numberValue then
|
|
49
|
+
return numberValue
|
|
50
|
+
end
|
|
51
|
+
if value == "Infinity" then
|
|
52
|
+
return math.huge
|
|
53
|
+
end
|
|
54
|
+
if value == "-Infinity" then
|
|
55
|
+
return -math.huge
|
|
56
|
+
end
|
|
57
|
+
local stringWithoutSpaces = string.gsub(value, "%s", "")
|
|
58
|
+
if stringWithoutSpaces == "" then
|
|
59
|
+
return 0
|
|
60
|
+
end
|
|
61
|
+
return 0 / 0
|
|
62
|
+
elseif valueType == "boolean" then
|
|
63
|
+
return value and 1 or 0
|
|
64
|
+
else
|
|
65
|
+
return 0 / 0
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
local function __TS__NumberIsFinite(value)
|
|
70
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
local function __TS__ArrayIncludes(self, searchElement, fromIndex)
|
|
74
|
+
if fromIndex == nil then
|
|
75
|
+
fromIndex = 0
|
|
76
|
+
end
|
|
77
|
+
local len = #self
|
|
78
|
+
local k = fromIndex
|
|
79
|
+
if fromIndex < 0 then
|
|
80
|
+
k = len + fromIndex
|
|
81
|
+
end
|
|
82
|
+
if k < 0 then
|
|
83
|
+
k = 0
|
|
84
|
+
end
|
|
85
|
+
for i = k + 1, len do
|
|
86
|
+
if self[i] == searchElement then
|
|
87
|
+
return true
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
return false
|
|
91
|
+
end
|
|
92
|
+
-- End of Lua Library inline imports
|
|
93
|
+
local ____exports = {}
|
|
94
|
+
--- Small bounded arithmetic grammar. Expressions cannot call functions or execute Lua.
|
|
95
|
+
____exports.MathExpression = __TS__Class()
|
|
96
|
+
local MathExpression = ____exports.MathExpression
|
|
97
|
+
MathExpression.name = "MathExpression"
|
|
98
|
+
function MathExpression.prototype.____constructor(self, text)
|
|
99
|
+
self.text = text
|
|
100
|
+
self.offset = 0
|
|
101
|
+
self.token = ""
|
|
102
|
+
self.tokens = 0
|
|
103
|
+
if issecretvalue(text) or type(text) ~= "string" or #text == 0 or #text > 256 then
|
|
104
|
+
error("MathConverter: expression must contain 1–256 characters")
|
|
105
|
+
end
|
|
106
|
+
self:Next()
|
|
107
|
+
self.tree = self:Add(0)
|
|
108
|
+
if self.token ~= "" then
|
|
109
|
+
error("MathConverter: unexpected token " .. self.token)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
function MathExpression.prototype.Next(self)
|
|
113
|
+
local ____self_0, ____tokens_1 = self, "tokens"
|
|
114
|
+
local ____self_tokens_2 = ____self_0[____tokens_1] + 1
|
|
115
|
+
____self_0[____tokens_1] = ____self_tokens_2
|
|
116
|
+
if ____self_tokens_2 > 128 then
|
|
117
|
+
error("MathConverter: expression is too complex")
|
|
118
|
+
end
|
|
119
|
+
while __TS__StringIncludes(
|
|
120
|
+
" \t\r\n",
|
|
121
|
+
__TS__StringAccess(self.text, self.offset) or "\0"
|
|
122
|
+
) do
|
|
123
|
+
self.offset = self.offset + 1
|
|
124
|
+
end
|
|
125
|
+
local char = __TS__StringAccess(self.text, self.offset)
|
|
126
|
+
if char == nil then
|
|
127
|
+
self.token = ""
|
|
128
|
+
return
|
|
129
|
+
end
|
|
130
|
+
if __TS__StringSlice(self.text, self.offset, self.offset + 5) == "input" then
|
|
131
|
+
self.offset = self.offset + 5
|
|
132
|
+
self.token = "input"
|
|
133
|
+
return
|
|
134
|
+
end
|
|
135
|
+
if __TS__StringIncludes("0123456789.", char) then
|
|
136
|
+
local ____self_3, ____offset_4 = self, "offset"
|
|
137
|
+
local ____self_offset_5 = ____self_3[____offset_4]
|
|
138
|
+
____self_3[____offset_4] = ____self_offset_5 + 1
|
|
139
|
+
local start = ____self_offset_5
|
|
140
|
+
while __TS__StringIncludes(
|
|
141
|
+
"0123456789.",
|
|
142
|
+
__TS__StringAccess(self.text, self.offset) or "\0"
|
|
143
|
+
) do
|
|
144
|
+
self.offset = self.offset + 1
|
|
145
|
+
end
|
|
146
|
+
if __TS__StringAccess(self.text, self.offset) == "e" or __TS__StringAccess(self.text, self.offset) == "E" then
|
|
147
|
+
self.offset = self.offset + 1
|
|
148
|
+
if __TS__StringAccess(self.text, self.offset) == "+" or __TS__StringAccess(self.text, self.offset) == "-" then
|
|
149
|
+
self.offset = self.offset + 1
|
|
150
|
+
end
|
|
151
|
+
while __TS__StringIncludes(
|
|
152
|
+
"0123456789",
|
|
153
|
+
__TS__StringAccess(self.text, self.offset) or "\0"
|
|
154
|
+
) do
|
|
155
|
+
self.offset = self.offset + 1
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
self.token = __TS__StringSlice(self.text, start, self.offset)
|
|
159
|
+
if not __TS__NumberIsFinite(__TS__Number(self.token)) then
|
|
160
|
+
error("MathConverter: invalid number")
|
|
161
|
+
end
|
|
162
|
+
return
|
|
163
|
+
end
|
|
164
|
+
if __TS__StringIncludes("+-*/%^()", char) then
|
|
165
|
+
self.offset = self.offset + 1
|
|
166
|
+
self.token = char
|
|
167
|
+
if char == "*" and __TS__StringAccess(self.text, self.offset) == "*" then
|
|
168
|
+
self.offset = self.offset + 1
|
|
169
|
+
self.token = "^"
|
|
170
|
+
end
|
|
171
|
+
return
|
|
172
|
+
end
|
|
173
|
+
error("MathConverter: only input, numbers and arithmetic operators are allowed")
|
|
174
|
+
end
|
|
175
|
+
function MathExpression.prototype.Depth(self, depth)
|
|
176
|
+
if depth > 32 then
|
|
177
|
+
error("MathConverter: expression nesting is too deep")
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
function MathExpression.prototype.Add(self, depth)
|
|
181
|
+
local left = self:Multiply(depth)
|
|
182
|
+
while self.token == "+" or self.token == "-" do
|
|
183
|
+
local operator = self.token
|
|
184
|
+
self:Next()
|
|
185
|
+
left = {
|
|
186
|
+
kind = "binary",
|
|
187
|
+
operator = operator,
|
|
188
|
+
left = left,
|
|
189
|
+
right = self:Multiply(depth)
|
|
190
|
+
}
|
|
191
|
+
end
|
|
192
|
+
return left
|
|
193
|
+
end
|
|
194
|
+
function MathExpression.prototype.Multiply(self, depth)
|
|
195
|
+
local left = self:Unary(depth)
|
|
196
|
+
while __TS__ArrayIncludes({"*", "/", "%"}, self.token) do
|
|
197
|
+
local operator = self.token
|
|
198
|
+
self:Next()
|
|
199
|
+
left = {
|
|
200
|
+
kind = "binary",
|
|
201
|
+
operator = operator,
|
|
202
|
+
left = left,
|
|
203
|
+
right = self:Unary(depth)
|
|
204
|
+
}
|
|
205
|
+
end
|
|
206
|
+
return left
|
|
207
|
+
end
|
|
208
|
+
function MathExpression.prototype.Unary(self, depth)
|
|
209
|
+
self:Depth(depth)
|
|
210
|
+
if self.token == "+" or self.token == "-" then
|
|
211
|
+
local sign = self.token == "-" and -1 or 1
|
|
212
|
+
self:Next()
|
|
213
|
+
return {
|
|
214
|
+
kind = "unary",
|
|
215
|
+
sign = sign,
|
|
216
|
+
child = self:Unary(depth + 1)
|
|
217
|
+
}
|
|
218
|
+
end
|
|
219
|
+
local left = self:Primary(depth)
|
|
220
|
+
if self.token == "^" then
|
|
221
|
+
self:Next()
|
|
222
|
+
left = {
|
|
223
|
+
kind = "binary",
|
|
224
|
+
operator = "^",
|
|
225
|
+
left = left,
|
|
226
|
+
right = self:Unary(depth + 1)
|
|
227
|
+
}
|
|
228
|
+
end
|
|
229
|
+
return left
|
|
230
|
+
end
|
|
231
|
+
function MathExpression.prototype.Primary(self, depth)
|
|
232
|
+
self:Depth(depth)
|
|
233
|
+
if self.token == "input" then
|
|
234
|
+
self:Next()
|
|
235
|
+
return {kind = "input"}
|
|
236
|
+
end
|
|
237
|
+
if self.token == "(" then
|
|
238
|
+
self:Next()
|
|
239
|
+
local value = self:Add(depth + 1)
|
|
240
|
+
if self.token ~= ")" then
|
|
241
|
+
error("MathConverter: missing closing parenthesis")
|
|
242
|
+
end
|
|
243
|
+
self:Next()
|
|
244
|
+
return value
|
|
245
|
+
end
|
|
246
|
+
if self.token ~= "" and __TS__NumberIsFinite(__TS__Number(self.token)) then
|
|
247
|
+
local value = __TS__Number(self.token)
|
|
248
|
+
self:Next()
|
|
249
|
+
return {kind = "number", value = value}
|
|
250
|
+
end
|
|
251
|
+
error("MathConverter: expected input, a number or parentheses")
|
|
252
|
+
end
|
|
253
|
+
function MathExpression.prototype.Evaluate(self, input)
|
|
254
|
+
if issecretvalue(input) or type(input) ~= "number" or not __TS__NumberIsFinite(input) then
|
|
255
|
+
error("MathConverter: input must be a readable finite number")
|
|
256
|
+
end
|
|
257
|
+
local read
|
|
258
|
+
read = function(____, node)
|
|
259
|
+
if node.kind == "input" then
|
|
260
|
+
return input
|
|
261
|
+
end
|
|
262
|
+
if node.kind == "number" then
|
|
263
|
+
return node.value
|
|
264
|
+
end
|
|
265
|
+
if node.kind == "unary" then
|
|
266
|
+
return node.sign * read(nil, node.child)
|
|
267
|
+
end
|
|
268
|
+
local left = read(nil, node.left)
|
|
269
|
+
local right = read(nil, node.right)
|
|
270
|
+
if (node.operator == "/" or node.operator == "%") and right == 0 then
|
|
271
|
+
error("MathConverter: division by zero")
|
|
272
|
+
end
|
|
273
|
+
local result = node.operator == "+" and left + right or (node.operator == "-" and left - right or (node.operator == "*" and left * right or (node.operator == "/" and left / right or (node.operator == "%" and left % right or left ^ right))))
|
|
274
|
+
if not __TS__NumberIsFinite(result) then
|
|
275
|
+
error("MathConverter: result must be finite")
|
|
276
|
+
end
|
|
277
|
+
return result
|
|
278
|
+
end
|
|
279
|
+
return read(nil, self.tree)
|
|
280
|
+
end
|
|
281
|
+
return ____exports
|
|
@@ -7,13 +7,14 @@ import { ManaRegenTimer } from "./ManaRegenTimer";
|
|
|
7
7
|
export { Unit } from "./UnitSource";
|
|
8
8
|
/** Direct API-to-widget binding; opaque values are never compared or calculated. */
|
|
9
9
|
declare abstract class Resource extends ProgressSource {
|
|
10
|
-
private readonly
|
|
10
|
+
private readonly unitReference;
|
|
11
11
|
private readonly events;
|
|
12
12
|
private readonly listeners;
|
|
13
13
|
private eventFrame?;
|
|
14
14
|
private dispatching;
|
|
15
15
|
private eventValue;
|
|
16
|
-
|
|
16
|
+
private stopUnit?;
|
|
17
|
+
protected constructor(current: () => number, maximum: () => number, percent: () => number, unitReference: UnitSource, events: string[]);
|
|
17
18
|
protected AddEvents(...events: string[]): void;
|
|
18
19
|
protected GetValue(): number;
|
|
19
20
|
/** Future readable value changes only. Unsubscribe when the consumer is removed. */
|
|
@@ -499,7 +499,7 @@ end
|
|
|
499
499
|
local Resource = __TS__Class()
|
|
500
500
|
Resource.name = "Resource"
|
|
501
501
|
__TS__ClassExtends(Resource, ProgressSource)
|
|
502
|
-
function Resource.prototype.____constructor(self, current, maximum, percent,
|
|
502
|
+
function Resource.prototype.____constructor(self, current, maximum, percent, unitReference, events)
|
|
503
503
|
ProgressSource.prototype.____constructor(
|
|
504
504
|
self,
|
|
505
505
|
{
|
|
@@ -509,7 +509,7 @@ function Resource.prototype.____constructor(self, current, maximum, percent, uni
|
|
|
509
509
|
percent = percent
|
|
510
510
|
}
|
|
511
511
|
)
|
|
512
|
-
self.
|
|
512
|
+
self.unitReference = unitReference
|
|
513
513
|
self.events = events
|
|
514
514
|
self.listeners = __TS__New(Set)
|
|
515
515
|
self.dispatching = false
|
|
@@ -566,30 +566,34 @@ function Resource.prototype.Observe(self, listener)
|
|
|
566
566
|
self.eventFrame = CreateFrame("Frame", nil, UIParent)
|
|
567
567
|
end
|
|
568
568
|
local frame = self.eventFrame
|
|
569
|
+
local function dispatch(____, event, payload)
|
|
570
|
+
self.eventValue = ProgressSource.prototype.GetValue(self)
|
|
571
|
+
self.dispatching = true
|
|
572
|
+
do
|
|
573
|
+
local ____try, ____error = pcall(function()
|
|
574
|
+
for ____, callback in __TS__Iterator(self.listeners) do
|
|
575
|
+
callback(nil, event, payload, self.eventValue)
|
|
576
|
+
end
|
|
577
|
+
end)
|
|
578
|
+
do
|
|
579
|
+
self.dispatching = false
|
|
580
|
+
end
|
|
581
|
+
if not ____try then
|
|
582
|
+
error(____error, 0)
|
|
583
|
+
end
|
|
584
|
+
end
|
|
585
|
+
end
|
|
569
586
|
frame:SetScript(
|
|
570
587
|
"OnEvent",
|
|
571
588
|
function(_frame, event, ...)
|
|
572
589
|
local payload = {...}
|
|
573
|
-
if event ~= "PLAYER_ENTERING_WORLD" and (issecretvalue(payload[1]) or payload[1] ~= self.
|
|
590
|
+
if event ~= "PLAYER_ENTERING_WORLD" and (issecretvalue(payload[1]) or payload[1] ~= self.unitReference.Token) then
|
|
574
591
|
return
|
|
575
592
|
end
|
|
576
|
-
|
|
577
|
-
self.dispatching = true
|
|
578
|
-
do
|
|
579
|
-
local ____try, ____error = pcall(function()
|
|
580
|
-
for ____, callback in __TS__Iterator(self.listeners) do
|
|
581
|
-
callback(nil, event, payload, self.eventValue)
|
|
582
|
-
end
|
|
583
|
-
end)
|
|
584
|
-
do
|
|
585
|
-
self.dispatching = false
|
|
586
|
-
end
|
|
587
|
-
if not ____try then
|
|
588
|
-
error(____error, 0)
|
|
589
|
-
end
|
|
590
|
-
end
|
|
593
|
+
dispatch(nil, event, payload)
|
|
591
594
|
end
|
|
592
595
|
)
|
|
596
|
+
self.stopUnit = self.unitReference:onChange(function() return dispatch(nil, "UNIT_IDENTITY_CHANGED", {self.unitReference.Token}) end)
|
|
593
597
|
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
594
598
|
for ____, event in ipairs(self.events) do
|
|
595
599
|
frame:RegisterEvent(event)
|
|
@@ -598,13 +602,18 @@ function Resource.prototype.Observe(self, listener)
|
|
|
598
602
|
return function()
|
|
599
603
|
self.listeners:delete(listener)
|
|
600
604
|
if self.listeners.size == 0 then
|
|
601
|
-
local ____opt_3 = self.
|
|
605
|
+
local ____opt_3 = self.stopUnit
|
|
602
606
|
if ____opt_3 ~= nil then
|
|
603
|
-
____opt_3
|
|
607
|
+
____opt_3(self)
|
|
604
608
|
end
|
|
609
|
+
self.stopUnit = nil
|
|
605
610
|
local ____opt_5 = self.eventFrame
|
|
606
611
|
if ____opt_5 ~= nil then
|
|
607
|
-
____opt_5:
|
|
612
|
+
____opt_5:UnregisterAllEvents()
|
|
613
|
+
end
|
|
614
|
+
local ____opt_7 = self.eventFrame
|
|
615
|
+
if ____opt_7 ~= nil then
|
|
616
|
+
____opt_7:SetScript("OnEvent", nil)
|
|
608
617
|
end
|
|
609
618
|
end
|
|
610
619
|
end
|
|
@@ -622,8 +631,8 @@ function HealthPrediction.prototype.____constructor(self, read)
|
|
|
622
631
|
self.read = read
|
|
623
632
|
end
|
|
624
633
|
function HealthPrediction.prototype.GetValue(self)
|
|
625
|
-
local
|
|
626
|
-
local value =
|
|
634
|
+
local ____opt_9 = self.read
|
|
635
|
+
local value = ____opt_9 and ____opt_9(self)
|
|
627
636
|
if issecretvalue(value) then
|
|
628
637
|
return value
|
|
629
638
|
end
|
|
@@ -665,21 +674,21 @@ function HP.prototype.____constructor(self, unit)
|
|
|
665
674
|
function() return UnitHealth(target.Token) end,
|
|
666
675
|
function() return UnitHealthMax(target.Token) end,
|
|
667
676
|
function() return UnitHealthPercent(target.Token, true, CurveConstants.ScaleTo100) end,
|
|
668
|
-
target
|
|
669
|
-
{"UNIT_HEALTH", "UNIT_MAXHEALTH"}
|
|
677
|
+
target,
|
|
678
|
+
{"UNIT_HEALTH", "UNIT_MAXHEALTH", "UNIT_CONNECTION"}
|
|
670
679
|
)
|
|
671
680
|
self.target = target
|
|
672
681
|
end
|
|
673
682
|
function HP.prototype.UseHealPrediction(self)
|
|
674
683
|
if self.healPrediction == nil then
|
|
675
|
-
local
|
|
676
|
-
local
|
|
684
|
+
local ____exports_HealthPrediction_12 = ____exports.HealthPrediction
|
|
685
|
+
local ____temp_11
|
|
677
686
|
if UnitGetIncomingHeals == nil then
|
|
678
|
-
|
|
687
|
+
____temp_11 = nil
|
|
679
688
|
else
|
|
680
|
-
|
|
689
|
+
____temp_11 = function() return UnitGetIncomingHeals(self.unit) end
|
|
681
690
|
end
|
|
682
|
-
self.healPrediction = __TS__New(
|
|
691
|
+
self.healPrediction = __TS__New(____exports_HealthPrediction_12, ____temp_11)
|
|
683
692
|
if self.healPrediction.IsAvailable then
|
|
684
693
|
self:AddEvents("UNIT_HEAL_PREDICTION")
|
|
685
694
|
end
|
|
@@ -688,14 +697,14 @@ function HP.prototype.UseHealPrediction(self)
|
|
|
688
697
|
end
|
|
689
698
|
function HP.prototype.UseAbsorbPrediction(self)
|
|
690
699
|
if self.absorbPrediction == nil then
|
|
691
|
-
local
|
|
692
|
-
local
|
|
700
|
+
local ____exports_HealthPrediction_14 = ____exports.HealthPrediction
|
|
701
|
+
local ____temp_13
|
|
693
702
|
if UnitGetTotalAbsorbs == nil then
|
|
694
|
-
|
|
703
|
+
____temp_13 = nil
|
|
695
704
|
else
|
|
696
|
-
|
|
705
|
+
____temp_13 = function() return UnitGetTotalAbsorbs(self.unit) end
|
|
697
706
|
end
|
|
698
|
-
self.absorbPrediction = __TS__New(
|
|
707
|
+
self.absorbPrediction = __TS__New(____exports_HealthPrediction_14, ____temp_13)
|
|
699
708
|
if self.absorbPrediction.IsAvailable then
|
|
700
709
|
self:AddEvents("UNIT_ABSORB_AMOUNT_CHANGED")
|
|
701
710
|
end
|
|
@@ -719,23 +728,23 @@ function HP.prototype.BindTo(self, frame, options)
|
|
|
719
728
|
if options.healPredictionBar ~= nil or options.absorbPredictionBar ~= nil then
|
|
720
729
|
local maximum = UnitHealthMax(self.unit)
|
|
721
730
|
if options.healPredictionBar ~= nil then
|
|
722
|
-
local
|
|
723
|
-
if
|
|
724
|
-
|
|
731
|
+
local ____opt_15 = self.healPrediction
|
|
732
|
+
if ____opt_15 ~= nil then
|
|
733
|
+
____opt_15:ApplyTo(options.healPredictionBar, maximum)
|
|
725
734
|
end
|
|
726
735
|
end
|
|
727
736
|
if options.absorbPredictionBar ~= nil then
|
|
728
|
-
local
|
|
729
|
-
if
|
|
730
|
-
|
|
737
|
+
local ____opt_17 = self.absorbPrediction
|
|
738
|
+
if ____opt_17 ~= nil then
|
|
739
|
+
____opt_17:ApplyTo(options.absorbPredictionBar, maximum)
|
|
731
740
|
end
|
|
732
741
|
end
|
|
733
742
|
end
|
|
734
|
-
local
|
|
735
|
-
|
|
736
|
-
local
|
|
737
|
-
if
|
|
738
|
-
|
|
743
|
+
local ____this_20
|
|
744
|
+
____this_20 = options
|
|
745
|
+
local ____opt_19 = ____this_20.onRefresh
|
|
746
|
+
if ____opt_19 ~= nil then
|
|
747
|
+
____opt_19(____this_20)
|
|
739
748
|
end
|
|
740
749
|
end}
|
|
741
750
|
)
|
|
@@ -777,8 +786,8 @@ function Mana.prototype.____constructor(self, unit)
|
|
|
777
786
|
function() return UnitPower(target.Token, 0) end,
|
|
778
787
|
function() return UnitPowerMax(target.Token, 0) end,
|
|
779
788
|
function() return UnitPowerPercent(target.Token, 0, true, CurveConstants.ScaleTo100) end,
|
|
780
|
-
target
|
|
781
|
-
{"UNIT_POWER_UPDATE", "UNIT_MAXPOWER", "UNIT_DISPLAYPOWER"}
|
|
789
|
+
target,
|
|
790
|
+
{"UNIT_POWER_UPDATE", "UNIT_MAXPOWER", "UNIT_DISPLAYPOWER", "UNIT_CONNECTION"}
|
|
782
791
|
)
|
|
783
792
|
self.target = target
|
|
784
793
|
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DataSource } from "./DataSource";
|
|
2
|
+
import type { ReadResult } from "./DataSource";
|
|
3
|
+
/** Structural contract: converters can consume a shared source without owning it. */
|
|
4
|
+
export interface ValueSource<T> {
|
|
5
|
+
readonly Value: T;
|
|
6
|
+
IsSecret(): boolean;
|
|
7
|
+
TryCompute?<TResult>(compute: (value: T) => TResult): ReadResult<TResult>;
|
|
8
|
+
onChange?(listener: (value: T) => void): () => void;
|
|
9
|
+
}
|
|
10
|
+
/** Checked value transformation. No timers, native widgets or ownership of the input. */
|
|
11
|
+
export declare class SourceConverter<TInput, TOutput> extends DataSource<TOutput> {
|
|
12
|
+
private readonly input;
|
|
13
|
+
private readonly convert;
|
|
14
|
+
private readonly listeners;
|
|
15
|
+
private stop?;
|
|
16
|
+
private disposed;
|
|
17
|
+
private blocked;
|
|
18
|
+
private previous?;
|
|
19
|
+
private readable;
|
|
20
|
+
constructor(input: ValueSource<TInput>, convert: (value: TInput) => TOutput);
|
|
21
|
+
protected GetValue(): TOutput;
|
|
22
|
+
private Convert;
|
|
23
|
+
protected HasSecretFields(value: TOutput): boolean;
|
|
24
|
+
/** Future readable changes. The first observer attaches one upstream subscription. */
|
|
25
|
+
onChange(listener: (value: TOutput) => void): () => void;
|
|
26
|
+
private Refresh;
|
|
27
|
+
/** One immediate readable value, followed by event-driven changes when supported. */
|
|
28
|
+
BindTo(apply: (value: TOutput) => void): () => void;
|
|
29
|
+
Dispose(): void;
|
|
30
|
+
}
|
|
31
|
+
export type CaseKey = string | number | boolean;
|
|
32
|
+
export interface SourceCase<T> {
|
|
33
|
+
readonly equals: CaseKey;
|
|
34
|
+
readonly value: T;
|
|
35
|
+
}
|
|
36
|
+
/** Strict equality, first matching case, then the optional default value. */
|
|
37
|
+
export declare class CaseConverter<TInput, TOutput> extends SourceConverter<TInput, TOutput | undefined> {
|
|
38
|
+
constructor(input: ValueSource<TInput>, cases: readonly SourceCase<TOutput>[], fallback?: TOutput);
|
|
39
|
+
}
|