wuira 0.2.3 → 0.2.4
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 +18 -0
- package/README.md +45 -6
- 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/Resources.d.ts +3 -2
- package/lib/datasources/Resources.lua +57 -48
- package/lib/datasources/UnitSource.d.ts +8 -3
- package/lib/datasources/UnitSource.lua +318 -5
- package/lib/datasources/index.d.ts +3 -1
- package/lib/datasources/index.lua +6 -0
- 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 +1 -1
|
@@ -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
|
|
@@ -10,16 +10,21 @@ export interface UnitIdentity {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class UnitPredicates {
|
|
12
12
|
private readonly token;
|
|
13
|
-
constructor(token: string);
|
|
13
|
+
constructor(token: () => string);
|
|
14
14
|
get PC(): boolean | undefined;
|
|
15
15
|
get Self(): boolean | undefined;
|
|
16
16
|
}
|
|
17
17
|
/** Shared live unit reference; identity is read again rather than cached by token. */
|
|
18
18
|
export declare class UnitSource extends DataSource<UnitIdentity | undefined> {
|
|
19
|
-
|
|
19
|
+
private token;
|
|
20
20
|
readonly Is: UnitPredicates;
|
|
21
21
|
private restricted;
|
|
22
|
-
|
|
22
|
+
private readonly listeners;
|
|
23
|
+
constructor(token: string);
|
|
24
|
+
get Token(): string;
|
|
25
|
+
/** Keep source objects/subscriptions while a stable identity moves to another unit slot. */
|
|
26
|
+
Retarget(token: string): void;
|
|
27
|
+
onChange(listener: () => void): () => void;
|
|
23
28
|
protected HasSecretFields(): boolean;
|
|
24
29
|
protected GetValue(): UnitIdentity | undefined;
|
|
25
30
|
}
|
|
@@ -175,6 +175,283 @@ local function __TS__New(target, ...)
|
|
|
175
175
|
instance:____constructor(...)
|
|
176
176
|
return instance
|
|
177
177
|
end
|
|
178
|
+
|
|
179
|
+
local __TS__Symbol, Symbol
|
|
180
|
+
do
|
|
181
|
+
local symbolMetatable = {__tostring = function(self)
|
|
182
|
+
return ("Symbol(" .. (self.description or "")) .. ")"
|
|
183
|
+
end}
|
|
184
|
+
function __TS__Symbol(description)
|
|
185
|
+
return setmetatable({description = description}, symbolMetatable)
|
|
186
|
+
end
|
|
187
|
+
Symbol = {
|
|
188
|
+
asyncDispose = __TS__Symbol("Symbol.asyncDispose"),
|
|
189
|
+
dispose = __TS__Symbol("Symbol.dispose"),
|
|
190
|
+
iterator = __TS__Symbol("Symbol.iterator"),
|
|
191
|
+
hasInstance = __TS__Symbol("Symbol.hasInstance"),
|
|
192
|
+
species = __TS__Symbol("Symbol.species"),
|
|
193
|
+
toStringTag = __TS__Symbol("Symbol.toStringTag")
|
|
194
|
+
}
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
local __TS__Iterator
|
|
198
|
+
do
|
|
199
|
+
local function iteratorGeneratorStep(self)
|
|
200
|
+
local co = self.____coroutine
|
|
201
|
+
local status, value = coroutine.resume(co)
|
|
202
|
+
if not status then
|
|
203
|
+
error(value, 0)
|
|
204
|
+
end
|
|
205
|
+
if coroutine.status(co) == "dead" then
|
|
206
|
+
return
|
|
207
|
+
end
|
|
208
|
+
return true, value
|
|
209
|
+
end
|
|
210
|
+
local function iteratorIteratorStep(self)
|
|
211
|
+
local result = self:next()
|
|
212
|
+
if result.done then
|
|
213
|
+
return
|
|
214
|
+
end
|
|
215
|
+
return true, result.value
|
|
216
|
+
end
|
|
217
|
+
local function iteratorStringStep(self, index)
|
|
218
|
+
index = index + 1
|
|
219
|
+
if index > #self then
|
|
220
|
+
return
|
|
221
|
+
end
|
|
222
|
+
return index, string.sub(self, index, index)
|
|
223
|
+
end
|
|
224
|
+
function __TS__Iterator(iterable)
|
|
225
|
+
if type(iterable) == "string" then
|
|
226
|
+
return iteratorStringStep, iterable, 0
|
|
227
|
+
elseif iterable.____coroutine ~= nil then
|
|
228
|
+
return iteratorGeneratorStep, iterable
|
|
229
|
+
elseif iterable[Symbol.iterator] then
|
|
230
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
231
|
+
return iteratorIteratorStep, iterator
|
|
232
|
+
else
|
|
233
|
+
return ipairs(iterable)
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
local Set
|
|
239
|
+
do
|
|
240
|
+
Set = __TS__Class()
|
|
241
|
+
Set.name = "Set"
|
|
242
|
+
function Set.prototype.____constructor(self, values)
|
|
243
|
+
self[Symbol.toStringTag] = "Set"
|
|
244
|
+
self.size = 0
|
|
245
|
+
self.nextKey = {}
|
|
246
|
+
self.previousKey = {}
|
|
247
|
+
if values == nil then
|
|
248
|
+
return
|
|
249
|
+
end
|
|
250
|
+
local iterable = values
|
|
251
|
+
if iterable[Symbol.iterator] then
|
|
252
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
253
|
+
while true do
|
|
254
|
+
local result = iterator:next()
|
|
255
|
+
if result.done then
|
|
256
|
+
break
|
|
257
|
+
end
|
|
258
|
+
self:add(result.value)
|
|
259
|
+
end
|
|
260
|
+
else
|
|
261
|
+
local array = values
|
|
262
|
+
for ____, value in ipairs(array) do
|
|
263
|
+
self:add(value)
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
function Set.prototype.add(self, value)
|
|
268
|
+
local isNewValue = not self:has(value)
|
|
269
|
+
if isNewValue then
|
|
270
|
+
self.size = self.size + 1
|
|
271
|
+
end
|
|
272
|
+
if self.firstKey == nil then
|
|
273
|
+
self.firstKey = value
|
|
274
|
+
self.lastKey = value
|
|
275
|
+
elseif isNewValue then
|
|
276
|
+
self.nextKey[self.lastKey] = value
|
|
277
|
+
self.previousKey[value] = self.lastKey
|
|
278
|
+
self.lastKey = value
|
|
279
|
+
end
|
|
280
|
+
return self
|
|
281
|
+
end
|
|
282
|
+
function Set.prototype.clear(self)
|
|
283
|
+
self.nextKey = {}
|
|
284
|
+
self.previousKey = {}
|
|
285
|
+
self.firstKey = nil
|
|
286
|
+
self.lastKey = nil
|
|
287
|
+
self.size = 0
|
|
288
|
+
end
|
|
289
|
+
function Set.prototype.delete(self, value)
|
|
290
|
+
local contains = self:has(value)
|
|
291
|
+
if contains then
|
|
292
|
+
self.size = self.size - 1
|
|
293
|
+
local next = self.nextKey[value]
|
|
294
|
+
local previous = self.previousKey[value]
|
|
295
|
+
if next ~= nil and previous ~= nil then
|
|
296
|
+
self.nextKey[previous] = next
|
|
297
|
+
self.previousKey[next] = previous
|
|
298
|
+
elseif next ~= nil then
|
|
299
|
+
self.firstKey = next
|
|
300
|
+
self.previousKey[next] = nil
|
|
301
|
+
elseif previous ~= nil then
|
|
302
|
+
self.lastKey = previous
|
|
303
|
+
self.nextKey[previous] = nil
|
|
304
|
+
else
|
|
305
|
+
self.firstKey = nil
|
|
306
|
+
self.lastKey = nil
|
|
307
|
+
end
|
|
308
|
+
self.nextKey[value] = nil
|
|
309
|
+
self.previousKey[value] = nil
|
|
310
|
+
end
|
|
311
|
+
return contains
|
|
312
|
+
end
|
|
313
|
+
function Set.prototype.forEach(self, callback)
|
|
314
|
+
for ____, key in __TS__Iterator(self:keys()) do
|
|
315
|
+
callback(nil, key, key, self)
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
function Set.prototype.has(self, value)
|
|
319
|
+
return self.nextKey[value] ~= nil or self.lastKey == value
|
|
320
|
+
end
|
|
321
|
+
Set.prototype[Symbol.iterator] = function(self)
|
|
322
|
+
return self:values()
|
|
323
|
+
end
|
|
324
|
+
function Set.prototype.entries(self)
|
|
325
|
+
local function getFirstKey()
|
|
326
|
+
return self.firstKey
|
|
327
|
+
end
|
|
328
|
+
local nextKey = self.nextKey
|
|
329
|
+
local key
|
|
330
|
+
local started = false
|
|
331
|
+
return {
|
|
332
|
+
[Symbol.iterator] = function(self)
|
|
333
|
+
return self
|
|
334
|
+
end,
|
|
335
|
+
next = function(self)
|
|
336
|
+
if not started then
|
|
337
|
+
started = true
|
|
338
|
+
key = getFirstKey(nil)
|
|
339
|
+
else
|
|
340
|
+
key = nextKey[key]
|
|
341
|
+
end
|
|
342
|
+
return {done = not key, value = {key, key}}
|
|
343
|
+
end
|
|
344
|
+
}
|
|
345
|
+
end
|
|
346
|
+
function Set.prototype.keys(self)
|
|
347
|
+
local function getFirstKey()
|
|
348
|
+
return self.firstKey
|
|
349
|
+
end
|
|
350
|
+
local nextKey = self.nextKey
|
|
351
|
+
local key
|
|
352
|
+
local started = false
|
|
353
|
+
return {
|
|
354
|
+
[Symbol.iterator] = function(self)
|
|
355
|
+
return self
|
|
356
|
+
end,
|
|
357
|
+
next = function(self)
|
|
358
|
+
if not started then
|
|
359
|
+
started = true
|
|
360
|
+
key = getFirstKey(nil)
|
|
361
|
+
else
|
|
362
|
+
key = nextKey[key]
|
|
363
|
+
end
|
|
364
|
+
return {done = not key, value = key}
|
|
365
|
+
end
|
|
366
|
+
}
|
|
367
|
+
end
|
|
368
|
+
function Set.prototype.values(self)
|
|
369
|
+
local function getFirstKey()
|
|
370
|
+
return self.firstKey
|
|
371
|
+
end
|
|
372
|
+
local nextKey = self.nextKey
|
|
373
|
+
local key
|
|
374
|
+
local started = false
|
|
375
|
+
return {
|
|
376
|
+
[Symbol.iterator] = function(self)
|
|
377
|
+
return self
|
|
378
|
+
end,
|
|
379
|
+
next = function(self)
|
|
380
|
+
if not started then
|
|
381
|
+
started = true
|
|
382
|
+
key = getFirstKey(nil)
|
|
383
|
+
else
|
|
384
|
+
key = nextKey[key]
|
|
385
|
+
end
|
|
386
|
+
return {done = not key, value = key}
|
|
387
|
+
end
|
|
388
|
+
}
|
|
389
|
+
end
|
|
390
|
+
function Set.prototype.union(self, other)
|
|
391
|
+
local result = __TS__New(Set, self)
|
|
392
|
+
for ____, item in __TS__Iterator(other) do
|
|
393
|
+
result:add(item)
|
|
394
|
+
end
|
|
395
|
+
return result
|
|
396
|
+
end
|
|
397
|
+
function Set.prototype.intersection(self, other)
|
|
398
|
+
local result = __TS__New(Set)
|
|
399
|
+
for ____, item in __TS__Iterator(self) do
|
|
400
|
+
if other:has(item) then
|
|
401
|
+
result:add(item)
|
|
402
|
+
end
|
|
403
|
+
end
|
|
404
|
+
return result
|
|
405
|
+
end
|
|
406
|
+
function Set.prototype.difference(self, other)
|
|
407
|
+
local result = __TS__New(Set, self)
|
|
408
|
+
for ____, item in __TS__Iterator(other) do
|
|
409
|
+
result:delete(item)
|
|
410
|
+
end
|
|
411
|
+
return result
|
|
412
|
+
end
|
|
413
|
+
function Set.prototype.symmetricDifference(self, other)
|
|
414
|
+
local result = __TS__New(Set, self)
|
|
415
|
+
for ____, item in __TS__Iterator(other) do
|
|
416
|
+
if self:has(item) then
|
|
417
|
+
result:delete(item)
|
|
418
|
+
else
|
|
419
|
+
result:add(item)
|
|
420
|
+
end
|
|
421
|
+
end
|
|
422
|
+
return result
|
|
423
|
+
end
|
|
424
|
+
function Set.prototype.isSubsetOf(self, other)
|
|
425
|
+
for ____, item in __TS__Iterator(self) do
|
|
426
|
+
if not other:has(item) then
|
|
427
|
+
return false
|
|
428
|
+
end
|
|
429
|
+
end
|
|
430
|
+
return true
|
|
431
|
+
end
|
|
432
|
+
function Set.prototype.isSupersetOf(self, other)
|
|
433
|
+
for ____, item in __TS__Iterator(other) do
|
|
434
|
+
if not self:has(item) then
|
|
435
|
+
return false
|
|
436
|
+
end
|
|
437
|
+
end
|
|
438
|
+
return true
|
|
439
|
+
end
|
|
440
|
+
function Set.prototype.isDisjointFrom(self, other)
|
|
441
|
+
for ____, item in __TS__Iterator(self) do
|
|
442
|
+
if other:has(item) then
|
|
443
|
+
return false
|
|
444
|
+
end
|
|
445
|
+
end
|
|
446
|
+
return true
|
|
447
|
+
end
|
|
448
|
+
Set[Symbol.species] = Set
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
local function __TS__StringTrim(self)
|
|
452
|
+
local result = string.gsub(self, "^[%s ]*(.-)[%s ]*$", "%1")
|
|
453
|
+
return result
|
|
454
|
+
end
|
|
178
455
|
-- End of Lua Library inline imports
|
|
179
456
|
local ____exports = {}
|
|
180
457
|
local ____DataSource = require("datasources.DataSource")
|
|
@@ -190,7 +467,7 @@ __TS__SetDescriptor(
|
|
|
190
467
|
UnitPredicates.prototype,
|
|
191
468
|
"PC",
|
|
192
469
|
{get = function(self)
|
|
193
|
-
local value = UnitIsPlayer(self
|
|
470
|
+
local value = UnitIsPlayer(self:token())
|
|
194
471
|
local ____issecretvalue_result_0
|
|
195
472
|
if issecretvalue(value) then
|
|
196
473
|
____issecretvalue_result_0 = nil
|
|
@@ -205,7 +482,10 @@ __TS__SetDescriptor(
|
|
|
205
482
|
UnitPredicates.prototype,
|
|
206
483
|
"Self",
|
|
207
484
|
{get = function(self)
|
|
208
|
-
local value = UnitIsUnit(
|
|
485
|
+
local value = UnitIsUnit(
|
|
486
|
+
self:token(),
|
|
487
|
+
"player"
|
|
488
|
+
)
|
|
209
489
|
local ____issecretvalue_result_1
|
|
210
490
|
if issecretvalue(value) then
|
|
211
491
|
____issecretvalue_result_1 = nil
|
|
@@ -221,11 +501,36 @@ ____exports.UnitSource = __TS__Class()
|
|
|
221
501
|
local UnitSource = ____exports.UnitSource
|
|
222
502
|
UnitSource.name = "UnitSource"
|
|
223
503
|
__TS__ClassExtends(UnitSource, DataSource)
|
|
224
|
-
function UnitSource.prototype.____constructor(self,
|
|
504
|
+
function UnitSource.prototype.____constructor(self, token)
|
|
225
505
|
DataSource.prototype.____constructor(self, nil)
|
|
226
|
-
self.
|
|
506
|
+
self.token = token
|
|
227
507
|
self.restricted = false
|
|
228
|
-
self.
|
|
508
|
+
self.listeners = __TS__New(Set)
|
|
509
|
+
self.Is = __TS__New(
|
|
510
|
+
____exports.UnitPredicates,
|
|
511
|
+
function() return self.Token end
|
|
512
|
+
)
|
|
513
|
+
end
|
|
514
|
+
function UnitSource.prototype.Retarget(self, token)
|
|
515
|
+
if token == self.token then
|
|
516
|
+
return
|
|
517
|
+
end
|
|
518
|
+
if InCombatLockdown() then
|
|
519
|
+
error("UnitSource: retarget after combat so secure actions and displayed data stay aligned")
|
|
520
|
+
end
|
|
521
|
+
if issecretvalue(token) or type(token) ~= "string" or __TS__StringTrim(token) == "" then
|
|
522
|
+
error("UnitSource: expected a public unit token")
|
|
523
|
+
end
|
|
524
|
+
self.token = token
|
|
525
|
+
for ____, listener in __TS__Iterator(self.listeners) do
|
|
526
|
+
listener(nil)
|
|
527
|
+
end
|
|
528
|
+
end
|
|
529
|
+
function UnitSource.prototype.onChange(self, listener)
|
|
530
|
+
self.listeners:add(listener)
|
|
531
|
+
return function()
|
|
532
|
+
self.listeners:delete(listener)
|
|
533
|
+
end
|
|
229
534
|
end
|
|
230
535
|
function UnitSource.prototype.HasSecretFields(self)
|
|
231
536
|
return self.restricted
|
|
@@ -238,6 +543,14 @@ function UnitSource.prototype.GetValue(self)
|
|
|
238
543
|
end
|
|
239
544
|
return {token = self.Token, guid = guid}
|
|
240
545
|
end
|
|
546
|
+
__TS__SetDescriptor(
|
|
547
|
+
UnitSource.prototype,
|
|
548
|
+
"Token",
|
|
549
|
+
{get = function(self)
|
|
550
|
+
return self.token
|
|
551
|
+
end},
|
|
552
|
+
true
|
|
553
|
+
)
|
|
241
554
|
--- Reuse explicit unit references; string inputs remain a convenience shorthand.
|
|
242
555
|
function ____exports.resolveUnit(self, unit)
|
|
243
556
|
return type(unit) == "string" and __TS__New(____exports.UnitSource, unit) or unit
|
|
@@ -8,9 +8,11 @@ export { Aura, AuraSource, Buffs, Debuffs } from "./Auras";
|
|
|
8
8
|
export type { AuraSourceStatus } from "./Auras";
|
|
9
9
|
export { GroupMembers, PartyMembers, RaidMembers } from "./GroupMembers";
|
|
10
10
|
export type { GroupScope } from "./GroupMembers";
|
|
11
|
+
export { GroupRoster, getPetUnitToken } from "./GroupRoster";
|
|
12
|
+
export type { GroupRosterMember } from "./GroupRoster";
|
|
11
13
|
export { ClassSource, SpecSource, Specializations } from "./UnitInfo";
|
|
12
14
|
export type { ClassInfo, SpecializationInfo, InspectStatus } from "./UnitInfo";
|
|
13
|
-
export { UnitSource } from "./UnitSource";
|
|
15
|
+
export { UnitSource, resolveUnit } from "./UnitSource";
|
|
14
16
|
export type { UnitInput, UnitIdentity } from "./UnitSource";
|
|
15
17
|
export { SwingTimer, SwingHand } from "./SwingTimer";
|
|
16
18
|
export { TimerSource } from "./TimerSource";
|
|
@@ -33,6 +33,11 @@ do
|
|
|
33
33
|
____exports.PartyMembers = ____GroupMembers.PartyMembers
|
|
34
34
|
____exports.RaidMembers = ____GroupMembers.RaidMembers
|
|
35
35
|
end
|
|
36
|
+
do
|
|
37
|
+
local ____GroupRoster = require("datasources.GroupRoster")
|
|
38
|
+
____exports.GroupRoster = ____GroupRoster.GroupRoster
|
|
39
|
+
____exports.getPetUnitToken = ____GroupRoster.getPetUnitToken
|
|
40
|
+
end
|
|
36
41
|
do
|
|
37
42
|
local ____UnitInfo = require("datasources.UnitInfo")
|
|
38
43
|
____exports.ClassSource = ____UnitInfo.ClassSource
|
|
@@ -42,6 +47,7 @@ end
|
|
|
42
47
|
do
|
|
43
48
|
local ____UnitSource = require("datasources.UnitSource")
|
|
44
49
|
____exports.UnitSource = ____UnitSource.UnitSource
|
|
50
|
+
____exports.resolveUnit = ____UnitSource.resolveUnit
|
|
45
51
|
end
|
|
46
52
|
do
|
|
47
53
|
local ____SwingTimer = require("datasources.SwingTimer")
|
package/lib/ui/Cell.d.ts
CHANGED
package/lib/ui/ForEach.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import type { Element } from "./primitives/jsx";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { CellProps } from "./Cell";
|
|
3
|
+
export interface ForEachSource<T> {
|
|
4
|
+
readonly Value: readonly T[];
|
|
5
|
+
onChange(listener: (items: readonly T[]) => void): () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface ForEachProps<T> extends Omit<Partial<CellProps>, "key" | "onMount"> {
|
|
8
|
+
items: readonly T[] | ForEachSource<T>;
|
|
9
|
+
key?: (item: T) => string | number;
|
|
4
10
|
child: (item: T, index: number) => Element;
|
|
11
|
+
/** Called for an existing key. The view and its native widgets are retained. */
|
|
12
|
+
onUpdate?: (view: Element, item: T, previous: T) => void;
|
|
13
|
+
onDispose?: (view: Element, item: T) => void;
|
|
14
|
+
direction?: "horizontal" | "vertical";
|
|
15
|
+
gap?: number;
|
|
16
|
+
lineGap?: number;
|
|
17
|
+
wrapAfter?: number;
|
|
18
|
+
groupBy?: (item: T) => string | number;
|
|
5
19
|
}
|
|
6
|
-
/**
|
|
7
|
-
export declare function ForEach<T>(
|
|
20
|
+
/** Arrays expand once; observable lists keep one mounted tree per stable key. */
|
|
21
|
+
export declare function ForEach<T>(props: ForEachProps<T>): Element;
|