wuira 0.2.6 → 0.2.8
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 +26 -0
- package/README.md +24 -1
- package/docs/nameplates.md +89 -0
- package/lib/WuiraApp.lua +42 -6
- package/lib/datasources/UnitSource.d.ts +5 -0
- package/lib/datasources/UnitSource.lua +47 -3
- package/lib/index.d.ts +2 -0
- package/lib/index.lua +6 -0
- package/lib/platform/forever.d.ts +3 -0
- package/lib/skins/Nameplates.d.ts +56 -0
- package/lib/skins/Nameplates.lua +1119 -0
- package/lib/skins/index.d.ts +2 -0
- package/lib/skins/index.lua +6 -0
- package/package.json +3 -2
|
@@ -0,0 +1,1119 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
-- Lua Library inline imports
|
|
3
|
+
local function __TS__NumberIsFinite(value)
|
|
4
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
local function __TS__Class(self)
|
|
8
|
+
local c = {prototype = {}}
|
|
9
|
+
c.prototype.__index = c.prototype
|
|
10
|
+
c.prototype.constructor = c
|
|
11
|
+
return c
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
local __TS__Symbol, Symbol
|
|
15
|
+
do
|
|
16
|
+
local symbolMetatable = {__tostring = function(self)
|
|
17
|
+
return ("Symbol(" .. (self.description or "")) .. ")"
|
|
18
|
+
end}
|
|
19
|
+
function __TS__Symbol(description)
|
|
20
|
+
return setmetatable({description = description}, symbolMetatable)
|
|
21
|
+
end
|
|
22
|
+
Symbol = {
|
|
23
|
+
asyncDispose = __TS__Symbol("Symbol.asyncDispose"),
|
|
24
|
+
dispose = __TS__Symbol("Symbol.dispose"),
|
|
25
|
+
iterator = __TS__Symbol("Symbol.iterator"),
|
|
26
|
+
hasInstance = __TS__Symbol("Symbol.hasInstance"),
|
|
27
|
+
species = __TS__Symbol("Symbol.species"),
|
|
28
|
+
toStringTag = __TS__Symbol("Symbol.toStringTag")
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
local __TS__Iterator
|
|
33
|
+
do
|
|
34
|
+
local function iteratorGeneratorStep(self)
|
|
35
|
+
local co = self.____coroutine
|
|
36
|
+
local status, value = coroutine.resume(co)
|
|
37
|
+
if not status then
|
|
38
|
+
error(value, 0)
|
|
39
|
+
end
|
|
40
|
+
if coroutine.status(co) == "dead" then
|
|
41
|
+
return
|
|
42
|
+
end
|
|
43
|
+
return true, value
|
|
44
|
+
end
|
|
45
|
+
local function iteratorIteratorStep(self)
|
|
46
|
+
local result = self:next()
|
|
47
|
+
if result.done then
|
|
48
|
+
return
|
|
49
|
+
end
|
|
50
|
+
return true, result.value
|
|
51
|
+
end
|
|
52
|
+
local function iteratorStringStep(self, index)
|
|
53
|
+
index = index + 1
|
|
54
|
+
if index > #self then
|
|
55
|
+
return
|
|
56
|
+
end
|
|
57
|
+
return index, string.sub(self, index, index)
|
|
58
|
+
end
|
|
59
|
+
function __TS__Iterator(iterable)
|
|
60
|
+
if type(iterable) == "string" then
|
|
61
|
+
return iteratorStringStep, iterable, 0
|
|
62
|
+
elseif iterable.____coroutine ~= nil then
|
|
63
|
+
return iteratorGeneratorStep, iterable
|
|
64
|
+
elseif iterable[Symbol.iterator] then
|
|
65
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
66
|
+
return iteratorIteratorStep, iterator
|
|
67
|
+
else
|
|
68
|
+
return ipairs(iterable)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
local function __TS__New(target, ...)
|
|
74
|
+
local instance = setmetatable({}, target.prototype)
|
|
75
|
+
instance:____constructor(...)
|
|
76
|
+
return instance
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
local Set
|
|
80
|
+
do
|
|
81
|
+
Set = __TS__Class()
|
|
82
|
+
Set.name = "Set"
|
|
83
|
+
function Set.prototype.____constructor(self, values)
|
|
84
|
+
self[Symbol.toStringTag] = "Set"
|
|
85
|
+
self.size = 0
|
|
86
|
+
self.nextKey = {}
|
|
87
|
+
self.previousKey = {}
|
|
88
|
+
if values == nil then
|
|
89
|
+
return
|
|
90
|
+
end
|
|
91
|
+
local iterable = values
|
|
92
|
+
if iterable[Symbol.iterator] then
|
|
93
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
94
|
+
while true do
|
|
95
|
+
local result = iterator:next()
|
|
96
|
+
if result.done then
|
|
97
|
+
break
|
|
98
|
+
end
|
|
99
|
+
self:add(result.value)
|
|
100
|
+
end
|
|
101
|
+
else
|
|
102
|
+
local array = values
|
|
103
|
+
for ____, value in ipairs(array) do
|
|
104
|
+
self:add(value)
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
function Set.prototype.add(self, value)
|
|
109
|
+
local isNewValue = not self:has(value)
|
|
110
|
+
if isNewValue then
|
|
111
|
+
self.size = self.size + 1
|
|
112
|
+
end
|
|
113
|
+
if self.firstKey == nil then
|
|
114
|
+
self.firstKey = value
|
|
115
|
+
self.lastKey = value
|
|
116
|
+
elseif isNewValue then
|
|
117
|
+
self.nextKey[self.lastKey] = value
|
|
118
|
+
self.previousKey[value] = self.lastKey
|
|
119
|
+
self.lastKey = value
|
|
120
|
+
end
|
|
121
|
+
return self
|
|
122
|
+
end
|
|
123
|
+
function Set.prototype.clear(self)
|
|
124
|
+
self.nextKey = {}
|
|
125
|
+
self.previousKey = {}
|
|
126
|
+
self.firstKey = nil
|
|
127
|
+
self.lastKey = nil
|
|
128
|
+
self.size = 0
|
|
129
|
+
end
|
|
130
|
+
function Set.prototype.delete(self, value)
|
|
131
|
+
local contains = self:has(value)
|
|
132
|
+
if contains then
|
|
133
|
+
self.size = self.size - 1
|
|
134
|
+
local next = self.nextKey[value]
|
|
135
|
+
local previous = self.previousKey[value]
|
|
136
|
+
if next ~= nil and previous ~= nil then
|
|
137
|
+
self.nextKey[previous] = next
|
|
138
|
+
self.previousKey[next] = previous
|
|
139
|
+
elseif next ~= nil then
|
|
140
|
+
self.firstKey = next
|
|
141
|
+
self.previousKey[next] = nil
|
|
142
|
+
elseif previous ~= nil then
|
|
143
|
+
self.lastKey = previous
|
|
144
|
+
self.nextKey[previous] = nil
|
|
145
|
+
else
|
|
146
|
+
self.firstKey = nil
|
|
147
|
+
self.lastKey = nil
|
|
148
|
+
end
|
|
149
|
+
self.nextKey[value] = nil
|
|
150
|
+
self.previousKey[value] = nil
|
|
151
|
+
end
|
|
152
|
+
return contains
|
|
153
|
+
end
|
|
154
|
+
function Set.prototype.forEach(self, callback)
|
|
155
|
+
for ____, key in __TS__Iterator(self:keys()) do
|
|
156
|
+
callback(nil, key, key, self)
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
function Set.prototype.has(self, value)
|
|
160
|
+
return self.nextKey[value] ~= nil or self.lastKey == value
|
|
161
|
+
end
|
|
162
|
+
Set.prototype[Symbol.iterator] = function(self)
|
|
163
|
+
return self:values()
|
|
164
|
+
end
|
|
165
|
+
function Set.prototype.entries(self)
|
|
166
|
+
local function getFirstKey()
|
|
167
|
+
return self.firstKey
|
|
168
|
+
end
|
|
169
|
+
local nextKey = self.nextKey
|
|
170
|
+
local key
|
|
171
|
+
local started = false
|
|
172
|
+
return {
|
|
173
|
+
[Symbol.iterator] = function(self)
|
|
174
|
+
return self
|
|
175
|
+
end,
|
|
176
|
+
next = function(self)
|
|
177
|
+
if not started then
|
|
178
|
+
started = true
|
|
179
|
+
key = getFirstKey(nil)
|
|
180
|
+
else
|
|
181
|
+
key = nextKey[key]
|
|
182
|
+
end
|
|
183
|
+
return {done = not key, value = {key, key}}
|
|
184
|
+
end
|
|
185
|
+
}
|
|
186
|
+
end
|
|
187
|
+
function Set.prototype.keys(self)
|
|
188
|
+
local function getFirstKey()
|
|
189
|
+
return self.firstKey
|
|
190
|
+
end
|
|
191
|
+
local nextKey = self.nextKey
|
|
192
|
+
local key
|
|
193
|
+
local started = false
|
|
194
|
+
return {
|
|
195
|
+
[Symbol.iterator] = function(self)
|
|
196
|
+
return self
|
|
197
|
+
end,
|
|
198
|
+
next = function(self)
|
|
199
|
+
if not started then
|
|
200
|
+
started = true
|
|
201
|
+
key = getFirstKey(nil)
|
|
202
|
+
else
|
|
203
|
+
key = nextKey[key]
|
|
204
|
+
end
|
|
205
|
+
return {done = not key, value = key}
|
|
206
|
+
end
|
|
207
|
+
}
|
|
208
|
+
end
|
|
209
|
+
function Set.prototype.values(self)
|
|
210
|
+
local function getFirstKey()
|
|
211
|
+
return self.firstKey
|
|
212
|
+
end
|
|
213
|
+
local nextKey = self.nextKey
|
|
214
|
+
local key
|
|
215
|
+
local started = false
|
|
216
|
+
return {
|
|
217
|
+
[Symbol.iterator] = function(self)
|
|
218
|
+
return self
|
|
219
|
+
end,
|
|
220
|
+
next = function(self)
|
|
221
|
+
if not started then
|
|
222
|
+
started = true
|
|
223
|
+
key = getFirstKey(nil)
|
|
224
|
+
else
|
|
225
|
+
key = nextKey[key]
|
|
226
|
+
end
|
|
227
|
+
return {done = not key, value = key}
|
|
228
|
+
end
|
|
229
|
+
}
|
|
230
|
+
end
|
|
231
|
+
function Set.prototype.union(self, other)
|
|
232
|
+
local result = __TS__New(Set, self)
|
|
233
|
+
for ____, item in __TS__Iterator(other) do
|
|
234
|
+
result:add(item)
|
|
235
|
+
end
|
|
236
|
+
return result
|
|
237
|
+
end
|
|
238
|
+
function Set.prototype.intersection(self, other)
|
|
239
|
+
local result = __TS__New(Set)
|
|
240
|
+
for ____, item in __TS__Iterator(self) do
|
|
241
|
+
if other:has(item) then
|
|
242
|
+
result:add(item)
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
return result
|
|
246
|
+
end
|
|
247
|
+
function Set.prototype.difference(self, other)
|
|
248
|
+
local result = __TS__New(Set, self)
|
|
249
|
+
for ____, item in __TS__Iterator(other) do
|
|
250
|
+
result:delete(item)
|
|
251
|
+
end
|
|
252
|
+
return result
|
|
253
|
+
end
|
|
254
|
+
function Set.prototype.symmetricDifference(self, other)
|
|
255
|
+
local result = __TS__New(Set, self)
|
|
256
|
+
for ____, item in __TS__Iterator(other) do
|
|
257
|
+
if self:has(item) then
|
|
258
|
+
result:delete(item)
|
|
259
|
+
else
|
|
260
|
+
result:add(item)
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
return result
|
|
264
|
+
end
|
|
265
|
+
function Set.prototype.isSubsetOf(self, other)
|
|
266
|
+
for ____, item in __TS__Iterator(self) do
|
|
267
|
+
if not other:has(item) then
|
|
268
|
+
return false
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
return true
|
|
272
|
+
end
|
|
273
|
+
function Set.prototype.isSupersetOf(self, other)
|
|
274
|
+
for ____, item in __TS__Iterator(other) do
|
|
275
|
+
if not self:has(item) then
|
|
276
|
+
return false
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
return true
|
|
280
|
+
end
|
|
281
|
+
function Set.prototype.isDisjointFrom(self, other)
|
|
282
|
+
for ____, item in __TS__Iterator(self) do
|
|
283
|
+
if other:has(item) then
|
|
284
|
+
return false
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
return true
|
|
288
|
+
end
|
|
289
|
+
Set[Symbol.species] = Set
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
local function __TS__ArraySome(self, callbackfn, thisArg)
|
|
293
|
+
for i = 1, #self do
|
|
294
|
+
if callbackfn(thisArg, self[i], i - 1, self) then
|
|
295
|
+
return true
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
return false
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
local function __TS__ArraySetLength(self, length)
|
|
302
|
+
if length < 0 or length ~= length or length == math.huge or math.floor(length) ~= length then
|
|
303
|
+
error(
|
|
304
|
+
"invalid array length: " .. tostring(length),
|
|
305
|
+
0
|
|
306
|
+
)
|
|
307
|
+
end
|
|
308
|
+
for i = length + 1, #self do
|
|
309
|
+
self[i] = nil
|
|
310
|
+
end
|
|
311
|
+
return length
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
local Map
|
|
315
|
+
do
|
|
316
|
+
Map = __TS__Class()
|
|
317
|
+
Map.name = "Map"
|
|
318
|
+
function Map.prototype.____constructor(self, entries)
|
|
319
|
+
self[Symbol.toStringTag] = "Map"
|
|
320
|
+
self.items = {}
|
|
321
|
+
self.size = 0
|
|
322
|
+
self.nextKey = {}
|
|
323
|
+
self.previousKey = {}
|
|
324
|
+
if entries == nil then
|
|
325
|
+
return
|
|
326
|
+
end
|
|
327
|
+
local iterable = entries
|
|
328
|
+
if iterable[Symbol.iterator] then
|
|
329
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
330
|
+
while true do
|
|
331
|
+
local result = iterator:next()
|
|
332
|
+
if result.done then
|
|
333
|
+
break
|
|
334
|
+
end
|
|
335
|
+
local value = result.value
|
|
336
|
+
self:set(value[1], value[2])
|
|
337
|
+
end
|
|
338
|
+
else
|
|
339
|
+
local array = entries
|
|
340
|
+
for ____, kvp in ipairs(array) do
|
|
341
|
+
self:set(kvp[1], kvp[2])
|
|
342
|
+
end
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
function Map.prototype.clear(self)
|
|
346
|
+
self.items = {}
|
|
347
|
+
self.nextKey = {}
|
|
348
|
+
self.previousKey = {}
|
|
349
|
+
self.firstKey = nil
|
|
350
|
+
self.lastKey = nil
|
|
351
|
+
self.size = 0
|
|
352
|
+
end
|
|
353
|
+
function Map.prototype.delete(self, key)
|
|
354
|
+
local contains = self:has(key)
|
|
355
|
+
if contains then
|
|
356
|
+
self.size = self.size - 1
|
|
357
|
+
local next = self.nextKey[key]
|
|
358
|
+
local previous = self.previousKey[key]
|
|
359
|
+
if next ~= nil and previous ~= nil then
|
|
360
|
+
self.nextKey[previous] = next
|
|
361
|
+
self.previousKey[next] = previous
|
|
362
|
+
elseif next ~= nil then
|
|
363
|
+
self.firstKey = next
|
|
364
|
+
self.previousKey[next] = nil
|
|
365
|
+
elseif previous ~= nil then
|
|
366
|
+
self.lastKey = previous
|
|
367
|
+
self.nextKey[previous] = nil
|
|
368
|
+
else
|
|
369
|
+
self.firstKey = nil
|
|
370
|
+
self.lastKey = nil
|
|
371
|
+
end
|
|
372
|
+
self.nextKey[key] = nil
|
|
373
|
+
self.previousKey[key] = nil
|
|
374
|
+
end
|
|
375
|
+
self.items[key] = nil
|
|
376
|
+
return contains
|
|
377
|
+
end
|
|
378
|
+
function Map.prototype.forEach(self, callback)
|
|
379
|
+
for ____, key in __TS__Iterator(self:keys()) do
|
|
380
|
+
callback(nil, self.items[key], key, self)
|
|
381
|
+
end
|
|
382
|
+
end
|
|
383
|
+
function Map.prototype.get(self, key)
|
|
384
|
+
return self.items[key]
|
|
385
|
+
end
|
|
386
|
+
function Map.prototype.has(self, key)
|
|
387
|
+
return self.nextKey[key] ~= nil or self.lastKey == key
|
|
388
|
+
end
|
|
389
|
+
function Map.prototype.set(self, key, value)
|
|
390
|
+
local isNewValue = not self:has(key)
|
|
391
|
+
if isNewValue then
|
|
392
|
+
self.size = self.size + 1
|
|
393
|
+
end
|
|
394
|
+
self.items[key] = value
|
|
395
|
+
if self.firstKey == nil then
|
|
396
|
+
self.firstKey = key
|
|
397
|
+
self.lastKey = key
|
|
398
|
+
elseif isNewValue then
|
|
399
|
+
self.nextKey[self.lastKey] = key
|
|
400
|
+
self.previousKey[key] = self.lastKey
|
|
401
|
+
self.lastKey = key
|
|
402
|
+
end
|
|
403
|
+
return self
|
|
404
|
+
end
|
|
405
|
+
Map.prototype[Symbol.iterator] = function(self)
|
|
406
|
+
return self:entries()
|
|
407
|
+
end
|
|
408
|
+
function Map.prototype.entries(self)
|
|
409
|
+
local function getFirstKey()
|
|
410
|
+
return self.firstKey
|
|
411
|
+
end
|
|
412
|
+
local items = self.items
|
|
413
|
+
local nextKey = self.nextKey
|
|
414
|
+
local key
|
|
415
|
+
local started = false
|
|
416
|
+
return {
|
|
417
|
+
[Symbol.iterator] = function(self)
|
|
418
|
+
return self
|
|
419
|
+
end,
|
|
420
|
+
next = function(self)
|
|
421
|
+
if not started then
|
|
422
|
+
started = true
|
|
423
|
+
key = getFirstKey(nil)
|
|
424
|
+
else
|
|
425
|
+
key = nextKey[key]
|
|
426
|
+
end
|
|
427
|
+
return {done = not key, value = {key, items[key]}}
|
|
428
|
+
end
|
|
429
|
+
}
|
|
430
|
+
end
|
|
431
|
+
function Map.prototype.keys(self)
|
|
432
|
+
local function getFirstKey()
|
|
433
|
+
return self.firstKey
|
|
434
|
+
end
|
|
435
|
+
local nextKey = self.nextKey
|
|
436
|
+
local key
|
|
437
|
+
local started = false
|
|
438
|
+
return {
|
|
439
|
+
[Symbol.iterator] = function(self)
|
|
440
|
+
return self
|
|
441
|
+
end,
|
|
442
|
+
next = function(self)
|
|
443
|
+
if not started then
|
|
444
|
+
started = true
|
|
445
|
+
key = getFirstKey(nil)
|
|
446
|
+
else
|
|
447
|
+
key = nextKey[key]
|
|
448
|
+
end
|
|
449
|
+
return {done = not key, value = key}
|
|
450
|
+
end
|
|
451
|
+
}
|
|
452
|
+
end
|
|
453
|
+
function Map.prototype.values(self)
|
|
454
|
+
local function getFirstKey()
|
|
455
|
+
return self.firstKey
|
|
456
|
+
end
|
|
457
|
+
local items = self.items
|
|
458
|
+
local nextKey = self.nextKey
|
|
459
|
+
local key
|
|
460
|
+
local started = false
|
|
461
|
+
return {
|
|
462
|
+
[Symbol.iterator] = function(self)
|
|
463
|
+
return self
|
|
464
|
+
end,
|
|
465
|
+
next = function(self)
|
|
466
|
+
if not started then
|
|
467
|
+
started = true
|
|
468
|
+
key = getFirstKey(nil)
|
|
469
|
+
else
|
|
470
|
+
key = nextKey[key]
|
|
471
|
+
end
|
|
472
|
+
return {done = not key, value = items[key]}
|
|
473
|
+
end
|
|
474
|
+
}
|
|
475
|
+
end
|
|
476
|
+
Map[Symbol.species] = Map
|
|
477
|
+
end
|
|
478
|
+
|
|
479
|
+
local function __TS__CountVarargs(...)
|
|
480
|
+
return select("#", ...)
|
|
481
|
+
end
|
|
482
|
+
|
|
483
|
+
local function __TS__ArraySplice(self, ...)
|
|
484
|
+
local args = {...}
|
|
485
|
+
local len = #self
|
|
486
|
+
local actualArgumentCount = __TS__CountVarargs(...)
|
|
487
|
+
local start = args[1]
|
|
488
|
+
local deleteCount = args[2]
|
|
489
|
+
if start < 0 then
|
|
490
|
+
start = len + start
|
|
491
|
+
if start < 0 then
|
|
492
|
+
start = 0
|
|
493
|
+
end
|
|
494
|
+
elseif start > len then
|
|
495
|
+
start = len
|
|
496
|
+
end
|
|
497
|
+
local itemCount = actualArgumentCount - 2
|
|
498
|
+
if itemCount < 0 then
|
|
499
|
+
itemCount = 0
|
|
500
|
+
end
|
|
501
|
+
local actualDeleteCount
|
|
502
|
+
if actualArgumentCount == 0 then
|
|
503
|
+
actualDeleteCount = 0
|
|
504
|
+
elseif actualArgumentCount == 1 then
|
|
505
|
+
actualDeleteCount = len - start
|
|
506
|
+
else
|
|
507
|
+
actualDeleteCount = deleteCount or 0
|
|
508
|
+
if actualDeleteCount < 0 then
|
|
509
|
+
actualDeleteCount = 0
|
|
510
|
+
end
|
|
511
|
+
if actualDeleteCount > len - start then
|
|
512
|
+
actualDeleteCount = len - start
|
|
513
|
+
end
|
|
514
|
+
end
|
|
515
|
+
local out = {}
|
|
516
|
+
for k = 1, actualDeleteCount do
|
|
517
|
+
local from = start + k
|
|
518
|
+
if self[from] ~= nil then
|
|
519
|
+
out[k] = self[from]
|
|
520
|
+
end
|
|
521
|
+
end
|
|
522
|
+
if itemCount < actualDeleteCount then
|
|
523
|
+
for k = start + 1, len - actualDeleteCount do
|
|
524
|
+
local from = k + actualDeleteCount
|
|
525
|
+
local to = k + itemCount
|
|
526
|
+
if self[from] then
|
|
527
|
+
self[to] = self[from]
|
|
528
|
+
else
|
|
529
|
+
self[to] = nil
|
|
530
|
+
end
|
|
531
|
+
end
|
|
532
|
+
for k = len - actualDeleteCount + itemCount + 1, len do
|
|
533
|
+
self[k] = nil
|
|
534
|
+
end
|
|
535
|
+
elseif itemCount > actualDeleteCount then
|
|
536
|
+
for k = len - actualDeleteCount, start + 1, -1 do
|
|
537
|
+
local from = k + actualDeleteCount
|
|
538
|
+
local to = k + itemCount
|
|
539
|
+
if self[from] then
|
|
540
|
+
self[to] = self[from]
|
|
541
|
+
else
|
|
542
|
+
self[to] = nil
|
|
543
|
+
end
|
|
544
|
+
end
|
|
545
|
+
end
|
|
546
|
+
local j = start + 1
|
|
547
|
+
for i = 3, actualArgumentCount do
|
|
548
|
+
self[j] = args[i]
|
|
549
|
+
j = j + 1
|
|
550
|
+
end
|
|
551
|
+
for k = #self, len - actualDeleteCount + itemCount + 1, -1 do
|
|
552
|
+
self[k] = nil
|
|
553
|
+
end
|
|
554
|
+
return out
|
|
555
|
+
end
|
|
556
|
+
-- End of Lua Library inline imports
|
|
557
|
+
local ____exports = {}
|
|
558
|
+
local ____wuira = require("wuira")
|
|
559
|
+
local wuira = ____wuira.wuira
|
|
560
|
+
local function report(self, failure)
|
|
561
|
+
do
|
|
562
|
+
pcall(function()
|
|
563
|
+
if geterrorhandler ~= nil then
|
|
564
|
+
geterrorhandler()(failure)
|
|
565
|
+
end
|
|
566
|
+
end)
|
|
567
|
+
end
|
|
568
|
+
end
|
|
569
|
+
local function safe(self, frame)
|
|
570
|
+
if issecretvalue(frame) then
|
|
571
|
+
return false
|
|
572
|
+
end
|
|
573
|
+
local ____this_3
|
|
574
|
+
____this_3 = frame
|
|
575
|
+
local ____opt_2 = ____this_3.IsForbidden
|
|
576
|
+
local forbidden = ____opt_2 and ____opt_2(____this_3)
|
|
577
|
+
if issecretvalue(forbidden) or forbidden == true then
|
|
578
|
+
return false
|
|
579
|
+
end
|
|
580
|
+
local ____this_5
|
|
581
|
+
____this_5 = frame
|
|
582
|
+
local ____opt_4 = ____this_5.IsProtected
|
|
583
|
+
local protectedFrame = ____opt_4 and ____opt_4(____this_5)
|
|
584
|
+
return not issecretvalue(protectedFrame) and protectedFrame ~= true
|
|
585
|
+
end
|
|
586
|
+
local function publicNumber(self, value)
|
|
587
|
+
if issecretvalue(value) or type(value) ~= "number" or not __TS__NumberIsFinite(value) then
|
|
588
|
+
error("Nameplates: expected a public finite number")
|
|
589
|
+
end
|
|
590
|
+
end
|
|
591
|
+
--- One unit binding. Use the reversible methods; direct native writes are not tracked.
|
|
592
|
+
____exports.NameplateContext = __TS__Class()
|
|
593
|
+
local NameplateContext = ____exports.NameplateContext
|
|
594
|
+
NameplateContext.name = "NameplateContext"
|
|
595
|
+
function NameplateContext.prototype.____constructor(self, Unit, GUID, Frame, Native)
|
|
596
|
+
self.Unit = Unit
|
|
597
|
+
self.GUID = GUID
|
|
598
|
+
self.Frame = Frame
|
|
599
|
+
self.Native = Native
|
|
600
|
+
self.active = true
|
|
601
|
+
self.cleanup = {}
|
|
602
|
+
end
|
|
603
|
+
function NameplateContext.prototype.OnDispose(self, cleanup)
|
|
604
|
+
if not self.active then
|
|
605
|
+
error("Nameplate binding is disposed")
|
|
606
|
+
end
|
|
607
|
+
local ____self_cleanup_6 = self.cleanup
|
|
608
|
+
____self_cleanup_6[#____self_cleanup_6 + 1] = cleanup
|
|
609
|
+
end
|
|
610
|
+
function NameplateContext.prototype.check(self, frame)
|
|
611
|
+
if not self.active then
|
|
612
|
+
error("Nameplate binding is disposed")
|
|
613
|
+
end
|
|
614
|
+
local current = frame
|
|
615
|
+
local seen = __TS__New(Set)
|
|
616
|
+
while current ~= self.Native do
|
|
617
|
+
if not safe(nil, current) or seen:has(current) or current == self.Frame or current == UIParent then
|
|
618
|
+
error("Nameplates: expected an accessible native visual descendant")
|
|
619
|
+
end
|
|
620
|
+
seen:add(current)
|
|
621
|
+
current = current:GetParent()
|
|
622
|
+
end
|
|
623
|
+
if not safe(nil, current) then
|
|
624
|
+
error("Nameplates: restricted native visual")
|
|
625
|
+
end
|
|
626
|
+
end
|
|
627
|
+
function NameplateContext.prototype.Alpha(self, frame, value)
|
|
628
|
+
self:check(frame)
|
|
629
|
+
publicNumber(nil, value)
|
|
630
|
+
local previous = frame:GetAlpha()
|
|
631
|
+
publicNumber(nil, previous)
|
|
632
|
+
self:OnDispose(function()
|
|
633
|
+
local current = frame:GetAlpha()
|
|
634
|
+
if not issecretvalue(current) and current == value then
|
|
635
|
+
frame:SetAlpha(previous)
|
|
636
|
+
end
|
|
637
|
+
end)
|
|
638
|
+
frame:SetAlpha(value)
|
|
639
|
+
end
|
|
640
|
+
function NameplateContext.prototype.Scale(self, frame, value)
|
|
641
|
+
self:check(frame)
|
|
642
|
+
publicNumber(nil, value)
|
|
643
|
+
if value <= 0 then
|
|
644
|
+
error("Nameplates: scale must be positive")
|
|
645
|
+
end
|
|
646
|
+
local previous = frame:GetScale()
|
|
647
|
+
publicNumber(nil, previous)
|
|
648
|
+
self:OnDispose(function()
|
|
649
|
+
local current = frame:GetScale()
|
|
650
|
+
if not issecretvalue(current) and current == value then
|
|
651
|
+
frame:SetScale(previous)
|
|
652
|
+
end
|
|
653
|
+
end)
|
|
654
|
+
frame:SetScale(value)
|
|
655
|
+
end
|
|
656
|
+
function NameplateContext.prototype.Size(self, frame, width, height)
|
|
657
|
+
self:check(frame)
|
|
658
|
+
publicNumber(nil, width)
|
|
659
|
+
publicNumber(nil, height)
|
|
660
|
+
if width < 0 or height < 0 then
|
|
661
|
+
error("Nameplates: size must be nonnegative")
|
|
662
|
+
end
|
|
663
|
+
local w = frame:GetWidth()
|
|
664
|
+
local h = frame:GetHeight()
|
|
665
|
+
publicNumber(nil, w)
|
|
666
|
+
publicNumber(nil, h)
|
|
667
|
+
self:OnDispose(function()
|
|
668
|
+
local cw = frame:GetWidth()
|
|
669
|
+
local ch = frame:GetHeight()
|
|
670
|
+
if not issecretvalue(cw) and not issecretvalue(ch) and cw == width and ch == height then
|
|
671
|
+
frame:SetSize(w, h)
|
|
672
|
+
end
|
|
673
|
+
end)
|
|
674
|
+
frame:SetSize(width, height)
|
|
675
|
+
end
|
|
676
|
+
function NameplateContext.prototype.BarColor(self, bar, r, g, b, a)
|
|
677
|
+
if a == nil then
|
|
678
|
+
a = 1
|
|
679
|
+
end
|
|
680
|
+
self:check(bar)
|
|
681
|
+
for ____, n in ipairs({r, g, b, a}) do
|
|
682
|
+
publicNumber(nil, n)
|
|
683
|
+
end
|
|
684
|
+
local pr, pg, pb, pa = bar:GetStatusBarColor()
|
|
685
|
+
for ____, n in ipairs({pr, pg, pb, pa}) do
|
|
686
|
+
publicNumber(nil, n)
|
|
687
|
+
end
|
|
688
|
+
self:OnDispose(function()
|
|
689
|
+
local cr, cg, cb, ca = bar:GetStatusBarColor()
|
|
690
|
+
if __TS__ArraySome(
|
|
691
|
+
{cr, cg, cb, ca},
|
|
692
|
+
function(____, n) return issecretvalue(n) end
|
|
693
|
+
) then
|
|
694
|
+
return
|
|
695
|
+
end
|
|
696
|
+
if cr == r and cg == g and cb == b and ca == a then
|
|
697
|
+
bar:SetStatusBarColor(pr, pg, pb, pa)
|
|
698
|
+
end
|
|
699
|
+
end)
|
|
700
|
+
bar:SetStatusBarColor(r, g, b, a)
|
|
701
|
+
end
|
|
702
|
+
function NameplateContext.prototype.Dispose(self)
|
|
703
|
+
if not self.active then
|
|
704
|
+
return
|
|
705
|
+
end
|
|
706
|
+
self.active = false
|
|
707
|
+
do
|
|
708
|
+
local i = #self.cleanup - 1
|
|
709
|
+
while i >= 0 do
|
|
710
|
+
do
|
|
711
|
+
local function ____catch(failure)
|
|
712
|
+
report(nil, failure)
|
|
713
|
+
end
|
|
714
|
+
local ____try, ____hasReturned = pcall(function()
|
|
715
|
+
local ____self_7 = self.cleanup
|
|
716
|
+
____self_7[i + 1](____self_7)
|
|
717
|
+
end)
|
|
718
|
+
if not ____try then
|
|
719
|
+
____catch(____hasReturned)
|
|
720
|
+
end
|
|
721
|
+
end
|
|
722
|
+
i = i - 1
|
|
723
|
+
end
|
|
724
|
+
end
|
|
725
|
+
__TS__ArraySetLength(self.cleanup, 0)
|
|
726
|
+
end
|
|
727
|
+
local rules = {}
|
|
728
|
+
local bindings = __TS__New(Map)
|
|
729
|
+
local listener
|
|
730
|
+
local reconciling = false
|
|
731
|
+
local suppressions = __TS__New(Map)
|
|
732
|
+
local function suppress(self, context)
|
|
733
|
+
local native = context.Native
|
|
734
|
+
local state = suppressions:get(native)
|
|
735
|
+
if state == nil then
|
|
736
|
+
state = {active = false, writing = false, alpha = 1}
|
|
737
|
+
suppressions:set(native, state)
|
|
738
|
+
local record = state
|
|
739
|
+
hooksecurefunc(
|
|
740
|
+
native,
|
|
741
|
+
"SetAlpha",
|
|
742
|
+
function()
|
|
743
|
+
if not record.active or record.writing or not safe(nil, native) then
|
|
744
|
+
return
|
|
745
|
+
end
|
|
746
|
+
local alpha = native:GetAlpha()
|
|
747
|
+
if issecretvalue(alpha) then
|
|
748
|
+
return
|
|
749
|
+
end
|
|
750
|
+
record.alpha = alpha
|
|
751
|
+
record.writing = true
|
|
752
|
+
do
|
|
753
|
+
local ____try, ____error = pcall(function()
|
|
754
|
+
native:SetAlpha(0)
|
|
755
|
+
end)
|
|
756
|
+
do
|
|
757
|
+
record.writing = false
|
|
758
|
+
end
|
|
759
|
+
if not ____try then
|
|
760
|
+
error(____error, 0)
|
|
761
|
+
end
|
|
762
|
+
end
|
|
763
|
+
end
|
|
764
|
+
)
|
|
765
|
+
end
|
|
766
|
+
local record = state
|
|
767
|
+
local alpha = native:GetAlpha()
|
|
768
|
+
publicNumber(nil, alpha)
|
|
769
|
+
record.alpha = alpha
|
|
770
|
+
context:OnDispose(function()
|
|
771
|
+
record.active = false
|
|
772
|
+
if not issecretvalue(native:GetAlpha()) and native:GetAlpha() == 0 then
|
|
773
|
+
native:SetAlpha(record.alpha)
|
|
774
|
+
end
|
|
775
|
+
end)
|
|
776
|
+
record.active = true
|
|
777
|
+
record.writing = true
|
|
778
|
+
do
|
|
779
|
+
local ____try, ____error = pcall(function()
|
|
780
|
+
native:SetAlpha(0)
|
|
781
|
+
end)
|
|
782
|
+
do
|
|
783
|
+
record.writing = false
|
|
784
|
+
end
|
|
785
|
+
if not ____try then
|
|
786
|
+
error(____error, 0)
|
|
787
|
+
end
|
|
788
|
+
end
|
|
789
|
+
end
|
|
790
|
+
local function visualOnly(self, element, seen)
|
|
791
|
+
if seen == nil then
|
|
792
|
+
seen = __TS__New(Set)
|
|
793
|
+
end
|
|
794
|
+
if seen:has(element) then
|
|
795
|
+
error("Nameplates: cyclic or shared JSX tree")
|
|
796
|
+
end
|
|
797
|
+
seen:add(element)
|
|
798
|
+
if element.kind == "secureButton" then
|
|
799
|
+
error("Nameplates: secure controls require a separate lifecycle")
|
|
800
|
+
end
|
|
801
|
+
if element.child ~= nil then
|
|
802
|
+
visualOnly(nil, element.child, seen)
|
|
803
|
+
end
|
|
804
|
+
for ____, child in ipairs(element.children or ({})) do
|
|
805
|
+
visualOnly(nil, child, seen)
|
|
806
|
+
end
|
|
807
|
+
end
|
|
808
|
+
local function clear(self, unit)
|
|
809
|
+
local binding = bindings:get(unit)
|
|
810
|
+
bindings:delete(unit)
|
|
811
|
+
local ____opt_8 = binding and binding.context
|
|
812
|
+
if ____opt_8 ~= nil then
|
|
813
|
+
____opt_8:Dispose()
|
|
814
|
+
end
|
|
815
|
+
end
|
|
816
|
+
local function update(self, unit, force)
|
|
817
|
+
if issecretvalue(unit) or type(unit) ~= "string" then
|
|
818
|
+
return
|
|
819
|
+
end
|
|
820
|
+
local frame = C_NamePlate and C_NamePlate.GetNamePlateForUnit(unit)
|
|
821
|
+
local ____temp_14
|
|
822
|
+
if frame ~= nil and safe(nil, frame) then
|
|
823
|
+
____temp_14 = frame.UnitFrame
|
|
824
|
+
else
|
|
825
|
+
____temp_14 = nil
|
|
826
|
+
end
|
|
827
|
+
local native = ____temp_14
|
|
828
|
+
local guid = UnitGUID(unit)
|
|
829
|
+
if frame == nil or native == nil or not safe(nil, native) or issecretvalue(guid) or guid == nil then
|
|
830
|
+
clear(nil, unit)
|
|
831
|
+
return
|
|
832
|
+
end
|
|
833
|
+
for ____, ____value in __TS__Iterator(bindings) do
|
|
834
|
+
local other = ____value[1]
|
|
835
|
+
local binding = ____value[2]
|
|
836
|
+
if other ~= unit and (binding.info.Frame == frame or binding.info.Native == native) then
|
|
837
|
+
clear(nil, other)
|
|
838
|
+
end
|
|
839
|
+
end
|
|
840
|
+
local info = {Unit = unit, GUID = guid, Frame = frame, Native = native}
|
|
841
|
+
local previous = bindings:get(unit)
|
|
842
|
+
if previous ~= nil and (previous.info.GUID ~= guid or previous.info.Frame ~= frame or previous.info.Native ~= native) then
|
|
843
|
+
clear(nil, unit)
|
|
844
|
+
end
|
|
845
|
+
local winner
|
|
846
|
+
do
|
|
847
|
+
local function ____catch(failure)
|
|
848
|
+
clear(nil, unit)
|
|
849
|
+
report(nil, failure)
|
|
850
|
+
return true
|
|
851
|
+
end
|
|
852
|
+
local ____try, ____hasReturned, ____returnValue = pcall(function()
|
|
853
|
+
for ____, rule in ipairs(rules) do
|
|
854
|
+
local matches = rule.selector(info)
|
|
855
|
+
if issecretvalue(matches) then
|
|
856
|
+
error("Nameplates: selector returned a secret value")
|
|
857
|
+
end
|
|
858
|
+
if matches == true then
|
|
859
|
+
winner = rule
|
|
860
|
+
break
|
|
861
|
+
end
|
|
862
|
+
end
|
|
863
|
+
end)
|
|
864
|
+
if not ____try then
|
|
865
|
+
____hasReturned, ____returnValue = ____catch(____hasReturned)
|
|
866
|
+
end
|
|
867
|
+
if ____hasReturned then
|
|
868
|
+
return ____returnValue
|
|
869
|
+
end
|
|
870
|
+
end
|
|
871
|
+
local existing = bindings:get(unit)
|
|
872
|
+
if not force and existing ~= nil and existing.rule == winner then
|
|
873
|
+
return
|
|
874
|
+
end
|
|
875
|
+
clear(nil, unit)
|
|
876
|
+
local binding = {info = info, rule = winner}
|
|
877
|
+
bindings:set(unit, binding)
|
|
878
|
+
if winner == nil then
|
|
879
|
+
return
|
|
880
|
+
end
|
|
881
|
+
local context = __TS__New(
|
|
882
|
+
____exports.NameplateContext,
|
|
883
|
+
unit,
|
|
884
|
+
guid,
|
|
885
|
+
frame,
|
|
886
|
+
native
|
|
887
|
+
)
|
|
888
|
+
binding.context = context
|
|
889
|
+
do
|
|
890
|
+
local function ____catch(failure)
|
|
891
|
+
context:Dispose()
|
|
892
|
+
binding.context = nil
|
|
893
|
+
report(nil, failure)
|
|
894
|
+
end
|
|
895
|
+
local ____try, ____hasReturned = pcall(function()
|
|
896
|
+
if winner.customize ~= nil then
|
|
897
|
+
winner.customize(context)
|
|
898
|
+
elseif winner.render ~= nil then
|
|
899
|
+
local view = winner.render(context)
|
|
900
|
+
visualOnly(nil, view)
|
|
901
|
+
local mounted = wuira:Mount(view, "CENTER", frame)
|
|
902
|
+
if mounted == nil then
|
|
903
|
+
error("Nameplates: Replace must return a visual element")
|
|
904
|
+
end
|
|
905
|
+
context:OnDispose(function() return wuira:Unmount(mounted) end)
|
|
906
|
+
suppress(nil, context)
|
|
907
|
+
end
|
|
908
|
+
end)
|
|
909
|
+
if not ____try then
|
|
910
|
+
____catch(____hasReturned)
|
|
911
|
+
end
|
|
912
|
+
end
|
|
913
|
+
end
|
|
914
|
+
local function reconcile(self, force)
|
|
915
|
+
if force == nil then
|
|
916
|
+
force = false
|
|
917
|
+
end
|
|
918
|
+
if reconciling then
|
|
919
|
+
error("Nameplates: cannot change rules during a callback")
|
|
920
|
+
end
|
|
921
|
+
reconciling = true
|
|
922
|
+
do
|
|
923
|
+
local ____try, ____error = pcall(function()
|
|
924
|
+
local visible = __TS__New(Set)
|
|
925
|
+
for ____, plate in ipairs(C_NamePlate and C_NamePlate.GetNamePlates() or ({})) do
|
|
926
|
+
do
|
|
927
|
+
local __continue85
|
|
928
|
+
repeat
|
|
929
|
+
if not safe(nil, plate) then
|
|
930
|
+
__continue85 = true
|
|
931
|
+
break
|
|
932
|
+
end
|
|
933
|
+
local ____opt_15 = plate.GetUnit
|
|
934
|
+
local nativeUnit = ____opt_15 and ____opt_15(plate)
|
|
935
|
+
if issecretvalue(nativeUnit) then
|
|
936
|
+
__continue85 = true
|
|
937
|
+
break
|
|
938
|
+
end
|
|
939
|
+
local unit = nativeUnit or plate.namePlateUnitToken
|
|
940
|
+
if issecretvalue(unit) or type(unit) ~= "string" then
|
|
941
|
+
__continue85 = true
|
|
942
|
+
break
|
|
943
|
+
end
|
|
944
|
+
visible:add(unit)
|
|
945
|
+
update(nil, unit, force)
|
|
946
|
+
__continue85 = true
|
|
947
|
+
until true
|
|
948
|
+
if not __continue85 then
|
|
949
|
+
break
|
|
950
|
+
end
|
|
951
|
+
end
|
|
952
|
+
end
|
|
953
|
+
for ____, ____value in __TS__Iterator(bindings) do
|
|
954
|
+
local unit = ____value[1]
|
|
955
|
+
if not visible:has(unit) then
|
|
956
|
+
clear(nil, unit)
|
|
957
|
+
end
|
|
958
|
+
end
|
|
959
|
+
end)
|
|
960
|
+
do
|
|
961
|
+
reconciling = false
|
|
962
|
+
end
|
|
963
|
+
if not ____try then
|
|
964
|
+
error(____error, 0)
|
|
965
|
+
end
|
|
966
|
+
end
|
|
967
|
+
end
|
|
968
|
+
local function watch(self)
|
|
969
|
+
if listener ~= nil then
|
|
970
|
+
return
|
|
971
|
+
end
|
|
972
|
+
listener = CreateFrame("Frame", nil, UIParent)
|
|
973
|
+
for ____, event in ipairs({
|
|
974
|
+
"NAME_PLATE_UNIT_ADDED",
|
|
975
|
+
"NAME_PLATE_UNIT_REMOVED",
|
|
976
|
+
"PLAYER_ENTERING_WORLD",
|
|
977
|
+
"PLAYER_REGEN_ENABLED",
|
|
978
|
+
"UNIT_NAME_UPDATE",
|
|
979
|
+
"UNIT_FACTION",
|
|
980
|
+
"PLAYER_TARGET_CHANGED"
|
|
981
|
+
}) do
|
|
982
|
+
listener:RegisterEvent(event)
|
|
983
|
+
end
|
|
984
|
+
listener:SetScript(
|
|
985
|
+
"OnEvent",
|
|
986
|
+
function(_frame, event, unit)
|
|
987
|
+
if reconciling then
|
|
988
|
+
return
|
|
989
|
+
end
|
|
990
|
+
if event == "NAME_PLATE_UNIT_REMOVED" then
|
|
991
|
+
reconciling = true
|
|
992
|
+
do
|
|
993
|
+
local ____try, ____error = pcall(function()
|
|
994
|
+
if unit ~= nil and not issecretvalue(unit) then
|
|
995
|
+
clear(nil, unit)
|
|
996
|
+
end
|
|
997
|
+
end)
|
|
998
|
+
do
|
|
999
|
+
reconciling = false
|
|
1000
|
+
end
|
|
1001
|
+
if not ____try then
|
|
1002
|
+
error(____error, 0)
|
|
1003
|
+
end
|
|
1004
|
+
end
|
|
1005
|
+
return
|
|
1006
|
+
end
|
|
1007
|
+
if unit ~= nil and not issecretvalue(unit) then
|
|
1008
|
+
if event ~= "NAME_PLATE_UNIT_ADDED" and not bindings:has(unit) then
|
|
1009
|
+
return
|
|
1010
|
+
end
|
|
1011
|
+
reconciling = true
|
|
1012
|
+
do
|
|
1013
|
+
local ____try, ____error = pcall(function()
|
|
1014
|
+
update(nil, unit, event ~= "NAME_PLATE_UNIT_ADDED")
|
|
1015
|
+
end)
|
|
1016
|
+
do
|
|
1017
|
+
reconciling = false
|
|
1018
|
+
end
|
|
1019
|
+
if not ____try then
|
|
1020
|
+
error(____error, 0)
|
|
1021
|
+
end
|
|
1022
|
+
end
|
|
1023
|
+
else
|
|
1024
|
+
reconcile(nil, true)
|
|
1025
|
+
end
|
|
1026
|
+
end
|
|
1027
|
+
)
|
|
1028
|
+
end
|
|
1029
|
+
--- An independently disposable ordered registration group. First matching rule wins globally.
|
|
1030
|
+
____exports.NameplateRules = __TS__Class()
|
|
1031
|
+
local NameplateRules = ____exports.NameplateRules
|
|
1032
|
+
NameplateRules.name = "NameplateRules"
|
|
1033
|
+
function NameplateRules.prototype.____constructor(self)
|
|
1034
|
+
self.disposed = false
|
|
1035
|
+
end
|
|
1036
|
+
function NameplateRules.prototype.add(self, rule)
|
|
1037
|
+
if reconciling then
|
|
1038
|
+
error("Nameplates: cannot change rules during a callback")
|
|
1039
|
+
end
|
|
1040
|
+
if self.disposed then
|
|
1041
|
+
error("Nameplate rules are disposed")
|
|
1042
|
+
end
|
|
1043
|
+
rules[#rules + 1] = rule
|
|
1044
|
+
watch(nil)
|
|
1045
|
+
reconcile(nil)
|
|
1046
|
+
return self
|
|
1047
|
+
end
|
|
1048
|
+
function NameplateRules.prototype.Apply(self, selector, customize)
|
|
1049
|
+
return self:add({owner = self, selector = selector, customize = customize})
|
|
1050
|
+
end
|
|
1051
|
+
function NameplateRules.prototype.Replace(self, selector, render)
|
|
1052
|
+
return self:add({owner = self, selector = selector, render = render})
|
|
1053
|
+
end
|
|
1054
|
+
function NameplateRules.prototype.Refresh(self)
|
|
1055
|
+
if self.disposed then
|
|
1056
|
+
error("Nameplate rules are disposed")
|
|
1057
|
+
end
|
|
1058
|
+
reconcile(nil, true)
|
|
1059
|
+
end
|
|
1060
|
+
function NameplateRules.prototype.Dispose(self)
|
|
1061
|
+
if reconciling then
|
|
1062
|
+
error("Nameplates: cannot change rules during a callback")
|
|
1063
|
+
end
|
|
1064
|
+
if self.disposed then
|
|
1065
|
+
return
|
|
1066
|
+
end
|
|
1067
|
+
self.disposed = true
|
|
1068
|
+
do
|
|
1069
|
+
local i = #rules - 1
|
|
1070
|
+
while i >= 0 do
|
|
1071
|
+
if rules[i + 1].owner == self then
|
|
1072
|
+
__TS__ArraySplice(rules, i, 1)
|
|
1073
|
+
end
|
|
1074
|
+
i = i - 1
|
|
1075
|
+
end
|
|
1076
|
+
end
|
|
1077
|
+
if #rules ~= 0 then
|
|
1078
|
+
reconcile(nil)
|
|
1079
|
+
return
|
|
1080
|
+
end
|
|
1081
|
+
reconciling = true
|
|
1082
|
+
do
|
|
1083
|
+
local ____try, ____error = pcall(function()
|
|
1084
|
+
for ____, ____value in __TS__Iterator(bindings) do
|
|
1085
|
+
local unit = ____value[1]
|
|
1086
|
+
clear(nil, unit)
|
|
1087
|
+
end
|
|
1088
|
+
end)
|
|
1089
|
+
do
|
|
1090
|
+
reconciling = false
|
|
1091
|
+
end
|
|
1092
|
+
if not ____try then
|
|
1093
|
+
error(____error, 0)
|
|
1094
|
+
end
|
|
1095
|
+
end
|
|
1096
|
+
if listener ~= nil then
|
|
1097
|
+
listener:UnregisterAllEvents()
|
|
1098
|
+
end
|
|
1099
|
+
if listener ~= nil then
|
|
1100
|
+
listener:SetScript("OnEvent", nil)
|
|
1101
|
+
end
|
|
1102
|
+
listener = nil
|
|
1103
|
+
end
|
|
1104
|
+
--- Each entry call creates a new group; chained calls append to that group.
|
|
1105
|
+
____exports.Nameplates = __TS__Class()
|
|
1106
|
+
local Nameplates = ____exports.Nameplates
|
|
1107
|
+
Nameplates.name = "Nameplates"
|
|
1108
|
+
function Nameplates.prototype.____constructor(self)
|
|
1109
|
+
end
|
|
1110
|
+
function Nameplates.Apply(self, selector, customize)
|
|
1111
|
+
return __TS__New(____exports.NameplateRules):Apply(selector, customize)
|
|
1112
|
+
end
|
|
1113
|
+
function Nameplates.Replace(self, selector, render)
|
|
1114
|
+
return __TS__New(____exports.NameplateRules):Replace(selector, render)
|
|
1115
|
+
end
|
|
1116
|
+
function Nameplates.Create(self)
|
|
1117
|
+
return __TS__New(____exports.NameplateRules)
|
|
1118
|
+
end
|
|
1119
|
+
return ____exports
|