wuira 0.1.7 → 0.1.9
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 +47 -0
- package/README.md +66 -0
- package/lib/Spells.d.ts +20 -0
- package/lib/Spells.lua +40 -0
- package/lib/datasources/KnownSpells.d.ts +13 -1
- package/lib/datasources/KnownSpells.lua +323 -49
- package/lib/datasources/index.d.ts +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.lua +4 -0
- package/lib/platform/Encoding.d.ts +6 -0
- package/lib/platform/Encoding.lua +58 -0
- package/lib/platform/forever.d.ts +15 -2
- package/lib/ui/Cell.d.ts +2 -0
- package/lib/ui/FlowLayout.d.ts +4 -2
- package/lib/ui/ForEach.d.ts +7 -0
- package/lib/ui/ForEach.lua +30 -0
- package/lib/ui/GridLayout.d.ts +2 -2
- package/lib/ui/ScrollHost.d.ts +19 -0
- package/lib/ui/ScrollHost.lua +67 -0
- package/lib/ui/TextInput.d.ts +26 -0
- package/lib/ui/TextInput.lua +206 -0
- package/lib/ui/Window.d.ts +21 -0
- package/lib/ui/Window.lua +300 -0
- package/lib/ui/index.d.ts +7 -1
- package/lib/ui/index.lua +16 -0
- package/lib/ui/layout/calculateFlow.lua +26 -0
- package/lib/ui/mount.lua +133 -117
- package/lib/ui/primitives/jsx.d.ts +6 -3
- package/lib/ui/primitives/jsx.lua +334 -7
- package/package.json +1 -1
|
@@ -310,6 +310,49 @@ do
|
|
|
310
310
|
Set[Symbol.species] = Set
|
|
311
311
|
end
|
|
312
312
|
|
|
313
|
+
local function __TS__StringIncludes(self, searchString, position)
|
|
314
|
+
if not position then
|
|
315
|
+
position = 1
|
|
316
|
+
else
|
|
317
|
+
position = position + 1
|
|
318
|
+
end
|
|
319
|
+
local index = string.find(self, searchString, position, true)
|
|
320
|
+
return index ~= nil
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
local function __TS__ObjectAssign(target, ...)
|
|
324
|
+
local sources = {...}
|
|
325
|
+
for i = 1, #sources do
|
|
326
|
+
local source = sources[i]
|
|
327
|
+
if type(source) == "table" then
|
|
328
|
+
for key in pairs(source) do
|
|
329
|
+
target[key] = source[key]
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
return target
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
local function __TS__ArrayFilter(self, callbackfn, thisArg)
|
|
337
|
+
local result = {}
|
|
338
|
+
local len = 0
|
|
339
|
+
for i = 1, #self do
|
|
340
|
+
if callbackfn(thisArg, self[i], i - 1, self) then
|
|
341
|
+
len = len + 1
|
|
342
|
+
result[len] = self[i]
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
return result
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
local function __TS__ArrayMap(self, callbackfn, thisArg)
|
|
349
|
+
local result = {}
|
|
350
|
+
for i = 1, #self do
|
|
351
|
+
result[i] = callbackfn(thisArg, self[i], i - 1, self)
|
|
352
|
+
end
|
|
353
|
+
return result
|
|
354
|
+
end
|
|
355
|
+
|
|
313
356
|
local function __TS__ArraySlice(self, first, last)
|
|
314
357
|
local len = #self
|
|
315
358
|
first = first or 0
|
|
@@ -346,24 +389,179 @@ local function __TS__ArraySlice(self, first, last)
|
|
|
346
389
|
return out
|
|
347
390
|
end
|
|
348
391
|
|
|
349
|
-
local function
|
|
350
|
-
|
|
351
|
-
|
|
392
|
+
local function __TS__ArrayFind(self, predicate, thisArg)
|
|
393
|
+
for i = 1, #self do
|
|
394
|
+
local elem = self[i]
|
|
395
|
+
if predicate(thisArg, elem, i - 1, self) then
|
|
396
|
+
return elem
|
|
397
|
+
end
|
|
352
398
|
end
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
399
|
+
return nil
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
local Map
|
|
403
|
+
do
|
|
404
|
+
Map = __TS__Class()
|
|
405
|
+
Map.name = "Map"
|
|
406
|
+
function Map.prototype.____constructor(self, entries)
|
|
407
|
+
self[Symbol.toStringTag] = "Map"
|
|
408
|
+
self.items = {}
|
|
409
|
+
self.size = 0
|
|
410
|
+
self.nextKey = {}
|
|
411
|
+
self.previousKey = {}
|
|
412
|
+
if entries == nil then
|
|
413
|
+
return
|
|
414
|
+
end
|
|
415
|
+
local iterable = entries
|
|
416
|
+
if iterable[Symbol.iterator] then
|
|
417
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
418
|
+
while true do
|
|
419
|
+
local result = iterator:next()
|
|
420
|
+
if result.done then
|
|
421
|
+
break
|
|
422
|
+
end
|
|
423
|
+
local value = result.value
|
|
424
|
+
self:set(value[1], value[2])
|
|
425
|
+
end
|
|
426
|
+
else
|
|
427
|
+
local array = entries
|
|
428
|
+
for ____, kvp in ipairs(array) do
|
|
429
|
+
self:set(kvp[1], kvp[2])
|
|
430
|
+
end
|
|
431
|
+
end
|
|
432
|
+
end
|
|
433
|
+
function Map.prototype.clear(self)
|
|
434
|
+
self.items = {}
|
|
435
|
+
self.nextKey = {}
|
|
436
|
+
self.previousKey = {}
|
|
437
|
+
self.firstKey = nil
|
|
438
|
+
self.lastKey = nil
|
|
439
|
+
self.size = 0
|
|
440
|
+
end
|
|
441
|
+
function Map.prototype.delete(self, key)
|
|
442
|
+
local contains = self:has(key)
|
|
443
|
+
if contains then
|
|
444
|
+
self.size = self.size - 1
|
|
445
|
+
local next = self.nextKey[key]
|
|
446
|
+
local previous = self.previousKey[key]
|
|
447
|
+
if next ~= nil and previous ~= nil then
|
|
448
|
+
self.nextKey[previous] = next
|
|
449
|
+
self.previousKey[next] = previous
|
|
450
|
+
elseif next ~= nil then
|
|
451
|
+
self.firstKey = next
|
|
452
|
+
self.previousKey[next] = nil
|
|
453
|
+
elseif previous ~= nil then
|
|
454
|
+
self.lastKey = previous
|
|
455
|
+
self.nextKey[previous] = nil
|
|
456
|
+
else
|
|
457
|
+
self.firstKey = nil
|
|
458
|
+
self.lastKey = nil
|
|
459
|
+
end
|
|
460
|
+
self.nextKey[key] = nil
|
|
461
|
+
self.previousKey[key] = nil
|
|
462
|
+
end
|
|
463
|
+
self.items[key] = nil
|
|
464
|
+
return contains
|
|
465
|
+
end
|
|
466
|
+
function Map.prototype.forEach(self, callback)
|
|
467
|
+
for ____, key in __TS__Iterator(self:keys()) do
|
|
468
|
+
callback(nil, self.items[key], key, self)
|
|
469
|
+
end
|
|
470
|
+
end
|
|
471
|
+
function Map.prototype.get(self, key)
|
|
472
|
+
return self.items[key]
|
|
357
473
|
end
|
|
358
|
-
|
|
359
|
-
|
|
474
|
+
function Map.prototype.has(self, key)
|
|
475
|
+
return self.nextKey[key] ~= nil or self.lastKey == key
|
|
360
476
|
end
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
477
|
+
function Map.prototype.set(self, key, value)
|
|
478
|
+
local isNewValue = not self:has(key)
|
|
479
|
+
if isNewValue then
|
|
480
|
+
self.size = self.size + 1
|
|
481
|
+
end
|
|
482
|
+
self.items[key] = value
|
|
483
|
+
if self.firstKey == nil then
|
|
484
|
+
self.firstKey = key
|
|
485
|
+
self.lastKey = key
|
|
486
|
+
elseif isNewValue then
|
|
487
|
+
self.nextKey[self.lastKey] = key
|
|
488
|
+
self.previousKey[key] = self.lastKey
|
|
489
|
+
self.lastKey = key
|
|
364
490
|
end
|
|
491
|
+
return self
|
|
492
|
+
end
|
|
493
|
+
Map.prototype[Symbol.iterator] = function(self)
|
|
494
|
+
return self:entries()
|
|
365
495
|
end
|
|
366
|
-
|
|
496
|
+
function Map.prototype.entries(self)
|
|
497
|
+
local function getFirstKey()
|
|
498
|
+
return self.firstKey
|
|
499
|
+
end
|
|
500
|
+
local items = self.items
|
|
501
|
+
local nextKey = self.nextKey
|
|
502
|
+
local key
|
|
503
|
+
local started = false
|
|
504
|
+
return {
|
|
505
|
+
[Symbol.iterator] = function(self)
|
|
506
|
+
return self
|
|
507
|
+
end,
|
|
508
|
+
next = function(self)
|
|
509
|
+
if not started then
|
|
510
|
+
started = true
|
|
511
|
+
key = getFirstKey(nil)
|
|
512
|
+
else
|
|
513
|
+
key = nextKey[key]
|
|
514
|
+
end
|
|
515
|
+
return {done = not key, value = {key, items[key]}}
|
|
516
|
+
end
|
|
517
|
+
}
|
|
518
|
+
end
|
|
519
|
+
function Map.prototype.keys(self)
|
|
520
|
+
local function getFirstKey()
|
|
521
|
+
return self.firstKey
|
|
522
|
+
end
|
|
523
|
+
local nextKey = self.nextKey
|
|
524
|
+
local key
|
|
525
|
+
local started = false
|
|
526
|
+
return {
|
|
527
|
+
[Symbol.iterator] = function(self)
|
|
528
|
+
return self
|
|
529
|
+
end,
|
|
530
|
+
next = function(self)
|
|
531
|
+
if not started then
|
|
532
|
+
started = true
|
|
533
|
+
key = getFirstKey(nil)
|
|
534
|
+
else
|
|
535
|
+
key = nextKey[key]
|
|
536
|
+
end
|
|
537
|
+
return {done = not key, value = key}
|
|
538
|
+
end
|
|
539
|
+
}
|
|
540
|
+
end
|
|
541
|
+
function Map.prototype.values(self)
|
|
542
|
+
local function getFirstKey()
|
|
543
|
+
return self.firstKey
|
|
544
|
+
end
|
|
545
|
+
local items = self.items
|
|
546
|
+
local nextKey = self.nextKey
|
|
547
|
+
local key
|
|
548
|
+
local started = false
|
|
549
|
+
return {
|
|
550
|
+
[Symbol.iterator] = function(self)
|
|
551
|
+
return self
|
|
552
|
+
end,
|
|
553
|
+
next = function(self)
|
|
554
|
+
if not started then
|
|
555
|
+
started = true
|
|
556
|
+
key = getFirstKey(nil)
|
|
557
|
+
else
|
|
558
|
+
key = nextKey[key]
|
|
559
|
+
end
|
|
560
|
+
return {done = not key, value = items[key]}
|
|
561
|
+
end
|
|
562
|
+
}
|
|
563
|
+
end
|
|
564
|
+
Map[Symbol.species] = Map
|
|
367
565
|
end
|
|
368
566
|
|
|
369
567
|
local __TS__ArrayFrom
|
|
@@ -563,7 +761,7 @@ __TS__ClassExtends(KnownSpells, DataSource)
|
|
|
563
761
|
function KnownSpells.prototype.____constructor(self)
|
|
564
762
|
DataSource.prototype.____constructor(self, {})
|
|
565
763
|
self.ids = {}
|
|
566
|
-
self.
|
|
764
|
+
self.entries = {}
|
|
567
765
|
self.status = "unavailable"
|
|
568
766
|
self.listeners = __TS__New(Set)
|
|
569
767
|
self.disposed = false
|
|
@@ -588,6 +786,32 @@ function KnownSpells.prototype.____constructor(self)
|
|
|
588
786
|
)
|
|
589
787
|
self:Refresh()
|
|
590
788
|
end
|
|
789
|
+
function KnownSpells.prototype.Filter(self, pattern)
|
|
790
|
+
if issecretvalue(pattern) or type(pattern) ~= "string" then
|
|
791
|
+
error("KnownSpells.Filter requires a public name pattern")
|
|
792
|
+
end
|
|
793
|
+
local glob = "^"
|
|
794
|
+
for ____, character in __TS__Iterator(string.lower(pattern)) do
|
|
795
|
+
if character == "*" then
|
|
796
|
+
glob = glob .. ".*"
|
|
797
|
+
elseif character == "?" then
|
|
798
|
+
glob = glob .. "."
|
|
799
|
+
else
|
|
800
|
+
glob = glob .. (__TS__StringIncludes("^$()%.[]+-", character) and "%" or "") .. character
|
|
801
|
+
end
|
|
802
|
+
end
|
|
803
|
+
glob = glob .. "$"
|
|
804
|
+
return __TS__ArrayMap(
|
|
805
|
+
__TS__ArrayFilter(
|
|
806
|
+
self.entries,
|
|
807
|
+
function(____, entry) return entry.name ~= nil and string.match(
|
|
808
|
+
string.lower(entry.name),
|
|
809
|
+
glob
|
|
810
|
+
) ~= nil end
|
|
811
|
+
),
|
|
812
|
+
function(____, entry) return __TS__ObjectAssign({}, entry) end
|
|
813
|
+
)
|
|
814
|
+
end
|
|
591
815
|
function KnownSpells.prototype.GetValue(self)
|
|
592
816
|
return __TS__ArraySlice(self.ids)
|
|
593
817
|
end
|
|
@@ -595,11 +819,18 @@ function KnownSpells.prototype.HasSecretFields(self)
|
|
|
595
819
|
return self.status == "restricted"
|
|
596
820
|
end
|
|
597
821
|
function KnownSpells.prototype.Has(self, spell)
|
|
822
|
+
return self:Find(spell) ~= nil
|
|
823
|
+
end
|
|
824
|
+
function KnownSpells.prototype.Find(self, spell)
|
|
598
825
|
if self.status ~= "ready" or issecretvalue(spell) then
|
|
599
|
-
return
|
|
826
|
+
return nil
|
|
600
827
|
end
|
|
601
|
-
|
|
602
|
-
|
|
828
|
+
local exact = __TS__ArrayFind(
|
|
829
|
+
self.entries,
|
|
830
|
+
function(____, entry) return entry.id == spell end
|
|
831
|
+
)
|
|
832
|
+
if exact ~= nil then
|
|
833
|
+
return __TS__ObjectAssign({}, exact)
|
|
603
834
|
end
|
|
604
835
|
local ____temp_4
|
|
605
836
|
if type(spell) == "string" then
|
|
@@ -609,7 +840,20 @@ function KnownSpells.prototype.Has(self, spell)
|
|
|
609
840
|
____temp_4 = ____opt_0 and ____opt_0(spell)
|
|
610
841
|
end
|
|
611
842
|
local name = ____temp_4
|
|
612
|
-
|
|
843
|
+
if issecretvalue(name) or name == nil then
|
|
844
|
+
return nil
|
|
845
|
+
end
|
|
846
|
+
local entry = __TS__ArrayFind(
|
|
847
|
+
self.entries,
|
|
848
|
+
function(____, entry) return entry.name == name end
|
|
849
|
+
)
|
|
850
|
+
local ____temp_5
|
|
851
|
+
if entry == nil then
|
|
852
|
+
____temp_5 = nil
|
|
853
|
+
else
|
|
854
|
+
____temp_5 = __TS__ObjectAssign({}, entry)
|
|
855
|
+
end
|
|
856
|
+
return ____temp_5
|
|
613
857
|
end
|
|
614
858
|
function KnownSpells.prototype.onChange(self, listener)
|
|
615
859
|
if self.disposed then
|
|
@@ -621,14 +865,20 @@ function KnownSpells.prototype.onChange(self, listener)
|
|
|
621
865
|
end
|
|
622
866
|
end
|
|
623
867
|
function KnownSpells.prototype.Refresh(self)
|
|
624
|
-
local
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
868
|
+
local function signature()
|
|
869
|
+
return (self.status .. ":") .. table.concat(
|
|
870
|
+
__TS__ArrayMap(
|
|
871
|
+
self.entries,
|
|
872
|
+
function(____, entry) return (((tostring(entry.id) .. ":") .. (entry.name or "")) .. ":") .. tostring(entry.isPassive) end
|
|
873
|
+
),
|
|
874
|
+
"|"
|
|
875
|
+
)
|
|
876
|
+
end
|
|
877
|
+
local previous = signature(nil)
|
|
628
878
|
local ids = __TS__New(Set)
|
|
629
|
-
local
|
|
879
|
+
local entries = __TS__New(Map)
|
|
630
880
|
self.status = "ready"
|
|
631
|
-
local function add(____, id, name)
|
|
881
|
+
local function add(____, id, name, passive)
|
|
632
882
|
if issecretvalue(id) or issecretvalue(name) then
|
|
633
883
|
self.status = "restricted"
|
|
634
884
|
return
|
|
@@ -637,25 +887,33 @@ function KnownSpells.prototype.Refresh(self)
|
|
|
637
887
|
return
|
|
638
888
|
end
|
|
639
889
|
ids:add(id)
|
|
640
|
-
local
|
|
641
|
-
if
|
|
642
|
-
local
|
|
643
|
-
|
|
890
|
+
local ____name_10 = name
|
|
891
|
+
if ____name_10 == nil then
|
|
892
|
+
local ____opt_6 = C_Spell and C_Spell.GetSpellName
|
|
893
|
+
____name_10 = ____opt_6 and ____opt_6(id)
|
|
644
894
|
end
|
|
645
|
-
local resolved =
|
|
895
|
+
local resolved = ____name_10
|
|
646
896
|
if issecretvalue(resolved) then
|
|
647
897
|
self.status = "restricted"
|
|
648
898
|
return
|
|
649
899
|
end
|
|
650
|
-
|
|
651
|
-
|
|
900
|
+
local ____passive_15 = passive
|
|
901
|
+
if ____passive_15 == nil then
|
|
902
|
+
local ____opt_11 = C_Spell and C_Spell.IsSpellPassive
|
|
903
|
+
____passive_15 = ____opt_11 and ____opt_11(id)
|
|
652
904
|
end
|
|
905
|
+
local isPassive = ____passive_15
|
|
906
|
+
if issecretvalue(isPassive) then
|
|
907
|
+
self.status = "restricted"
|
|
908
|
+
return
|
|
909
|
+
end
|
|
910
|
+
entries:set(id, {id = id, name = resolved, isPassive = isPassive})
|
|
653
911
|
end
|
|
654
912
|
local book = C_SpellBook
|
|
655
|
-
local
|
|
656
|
-
local bank =
|
|
657
|
-
local
|
|
658
|
-
local spellType =
|
|
913
|
+
local ____opt_16 = Enum and Enum.SpellBookSpellBank
|
|
914
|
+
local bank = ____opt_16 and ____opt_16.Player
|
|
915
|
+
local ____opt_20 = Enum and Enum.SpellBookItemType
|
|
916
|
+
local spellType = ____opt_20 and ____opt_20.Spell
|
|
659
917
|
if (book and book.GetNumSpellBookSkillLines) ~= nil and book.GetSpellBookSkillLineInfo ~= nil and book.GetSpellBookItemInfo ~= nil and bank ~= nil and spellType ~= nil then
|
|
660
918
|
local count = book.GetNumSpellBookSkillLines()
|
|
661
919
|
if issecretvalue(count) then
|
|
@@ -665,7 +923,7 @@ function KnownSpells.prototype.Refresh(self)
|
|
|
665
923
|
local line = 1
|
|
666
924
|
while line <= count do
|
|
667
925
|
do
|
|
668
|
-
local
|
|
926
|
+
local __continue40
|
|
669
927
|
repeat
|
|
670
928
|
local info = book.GetSpellBookSkillLineInfo(line)
|
|
671
929
|
if issecretvalue(info) then
|
|
@@ -673,7 +931,7 @@ function KnownSpells.prototype.Refresh(self)
|
|
|
673
931
|
break
|
|
674
932
|
end
|
|
675
933
|
if info == nil then
|
|
676
|
-
|
|
934
|
+
__continue40 = true
|
|
677
935
|
break
|
|
678
936
|
end
|
|
679
937
|
if issecretvalue(info.itemIndexOffset) or issecretvalue(info.numSpellBookItems) then
|
|
@@ -684,7 +942,7 @@ function KnownSpells.prototype.Refresh(self)
|
|
|
684
942
|
local slot = info.itemIndexOffset + 1
|
|
685
943
|
while slot <= info.itemIndexOffset + info.numSpellBookItems do
|
|
686
944
|
do
|
|
687
|
-
local
|
|
945
|
+
local __continue45
|
|
688
946
|
repeat
|
|
689
947
|
local item = book.GetSpellBookItemInfo(slot, bank)
|
|
690
948
|
if issecretvalue(item) then
|
|
@@ -692,7 +950,7 @@ function KnownSpells.prototype.Refresh(self)
|
|
|
692
950
|
break
|
|
693
951
|
end
|
|
694
952
|
if item == nil then
|
|
695
|
-
|
|
953
|
+
__continue45 = true
|
|
696
954
|
break
|
|
697
955
|
end
|
|
698
956
|
if issecretvalue(item.itemType) or issecretvalue(item.isOffSpec) then
|
|
@@ -700,20 +958,20 @@ function KnownSpells.prototype.Refresh(self)
|
|
|
700
958
|
break
|
|
701
959
|
end
|
|
702
960
|
if item.itemType == spellType and not item.isOffSpec then
|
|
703
|
-
add(nil, item.spellID, item.name)
|
|
961
|
+
add(nil, item.spellID, item.name, item.isPassive)
|
|
704
962
|
end
|
|
705
|
-
|
|
963
|
+
__continue45 = true
|
|
706
964
|
until true
|
|
707
|
-
if not
|
|
965
|
+
if not __continue45 then
|
|
708
966
|
break
|
|
709
967
|
end
|
|
710
968
|
end
|
|
711
969
|
slot = slot + 1
|
|
712
970
|
end
|
|
713
971
|
end
|
|
714
|
-
|
|
972
|
+
__continue40 = true
|
|
715
973
|
until true
|
|
716
|
-
if not
|
|
974
|
+
if not __continue40 then
|
|
717
975
|
break
|
|
718
976
|
end
|
|
719
977
|
end
|
|
@@ -743,7 +1001,12 @@ function KnownSpells.prototype.Refresh(self)
|
|
|
743
1001
|
break
|
|
744
1002
|
end
|
|
745
1003
|
if kind == "SPELL" then
|
|
746
|
-
add(
|
|
1004
|
+
add(
|
|
1005
|
+
nil,
|
|
1006
|
+
id,
|
|
1007
|
+
nil,
|
|
1008
|
+
IsPassiveSpell and IsPassiveSpell(slot, "spell")
|
|
1009
|
+
)
|
|
747
1010
|
end
|
|
748
1011
|
slot = slot + 1
|
|
749
1012
|
end
|
|
@@ -759,11 +1022,11 @@ function KnownSpells.prototype.Refresh(self)
|
|
|
759
1022
|
__TS__ArrayFrom(ids),
|
|
760
1023
|
function(____, a, b) return a - b end
|
|
761
1024
|
) or ({})
|
|
762
|
-
self.
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
"|"
|
|
1025
|
+
self.entries = __TS__ArrayMap(
|
|
1026
|
+
self.ids,
|
|
1027
|
+
function(____, id) return entries:get(id) end
|
|
766
1028
|
)
|
|
1029
|
+
local next = signature(nil)
|
|
767
1030
|
if next ~= previous and self.status == "ready" and self:CanEmit(self.ids) then
|
|
768
1031
|
for ____, listener in __TS__Iterator(self.listeners) do
|
|
769
1032
|
listener(
|
|
@@ -791,4 +1054,15 @@ __TS__SetDescriptor(
|
|
|
791
1054
|
end},
|
|
792
1055
|
true
|
|
793
1056
|
)
|
|
1057
|
+
__TS__SetDescriptor(
|
|
1058
|
+
KnownSpells.prototype,
|
|
1059
|
+
"Entries",
|
|
1060
|
+
{get = function(self)
|
|
1061
|
+
return __TS__ArrayMap(
|
|
1062
|
+
self.entries,
|
|
1063
|
+
function(____, entry) return __TS__ObjectAssign({}, entry) end
|
|
1064
|
+
)
|
|
1065
|
+
end},
|
|
1066
|
+
true
|
|
1067
|
+
)
|
|
794
1068
|
return ____exports
|
|
@@ -22,6 +22,6 @@ export type { AuraTimerOptions, AuraTimerStatus } from "./AuraTimer";
|
|
|
22
22
|
export { SpellCooldown, GlobalCooldown } from "./SpellCooldown";
|
|
23
23
|
export { SpellSource } from "./SpellSource";
|
|
24
24
|
export { KnownSpells } from "./KnownSpells";
|
|
25
|
-
export type { KnownSpellsStatus } from "./KnownSpells";
|
|
25
|
+
export type { KnownSpellsStatus, KnownSpell } from "./KnownSpells";
|
|
26
26
|
export { ManaRegenTimer } from "./ManaRegenTimer";
|
|
27
27
|
export type { ManaRegenPhase } from "./ManaRegenTimer";
|
package/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import "./console-polyfill";
|
|
|
3
3
|
export { wuira } from "./wuira";
|
|
4
4
|
export type { CommandCallback } from "./platform/SlashCommands";
|
|
5
5
|
export { AddonSettings } from "./platform/AddonSettings";
|
|
6
|
+
export { Encoding } from "./platform/Encoding";
|
|
6
7
|
export { Spells } from "./Spells";
|
|
7
8
|
export { BlizzardUI } from "./platform/BlizzardUI";
|
|
8
9
|
export { ActionBars } from "./platform/ActionBars";
|
package/lib/index.lua
CHANGED
|
@@ -9,6 +9,10 @@ do
|
|
|
9
9
|
local ____AddonSettings = require("platform.AddonSettings")
|
|
10
10
|
____exports.AddonSettings = ____AddonSettings.AddonSettings
|
|
11
11
|
end
|
|
12
|
+
do
|
|
13
|
+
local ____Encoding = require("platform.Encoding")
|
|
14
|
+
____exports.Encoding = ____Encoding.Encoding
|
|
15
|
+
end
|
|
12
16
|
do
|
|
13
17
|
local ____Spells = require("Spells")
|
|
14
18
|
____exports.Spells = ____Spells.Spells
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Native CBOR, compression and Base64 transport for serializable data. */
|
|
2
|
+
export declare class Encoding {
|
|
3
|
+
static Encode(value: unknown): string;
|
|
4
|
+
/** Returns unvalidated data; the size bound is also checked after decompression. */
|
|
5
|
+
static Decode(value: string, maxBytes?: number): unknown;
|
|
6
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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__NumberIsFinite(value)
|
|
11
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
12
|
+
end
|
|
13
|
+
-- End of Lua Library inline imports
|
|
14
|
+
local ____exports = {}
|
|
15
|
+
--- Native CBOR, compression and Base64 transport for serializable data.
|
|
16
|
+
____exports.Encoding = __TS__Class()
|
|
17
|
+
local Encoding = ____exports.Encoding
|
|
18
|
+
Encoding.name = "Encoding"
|
|
19
|
+
function Encoding.prototype.____constructor(self)
|
|
20
|
+
end
|
|
21
|
+
function Encoding.Encode(self, value)
|
|
22
|
+
if C_EncodingUtil == nil then
|
|
23
|
+
error("Encoding: native codec is unavailable")
|
|
24
|
+
end
|
|
25
|
+
local compressed = C_EncodingUtil.CompressString(C_EncodingUtil.SerializeCBOR(value))
|
|
26
|
+
if compressed == nil then
|
|
27
|
+
error("Encoding: compression failed")
|
|
28
|
+
end
|
|
29
|
+
local encoded = C_EncodingUtil.EncodeBase64(compressed)
|
|
30
|
+
if encoded == nil then
|
|
31
|
+
error("Encoding: encoding failed")
|
|
32
|
+
end
|
|
33
|
+
return encoded
|
|
34
|
+
end
|
|
35
|
+
function Encoding.Decode(self, value, maxBytes)
|
|
36
|
+
if maxBytes == nil then
|
|
37
|
+
maxBytes = 262144
|
|
38
|
+
end
|
|
39
|
+
if not __TS__NumberIsFinite(maxBytes) or maxBytes < 1 then
|
|
40
|
+
error("Encoding: invalid size limit")
|
|
41
|
+
end
|
|
42
|
+
if type(value) ~= "string" or issecretvalue(value) or #value > maxBytes then
|
|
43
|
+
error("Encoding: invalid encoded data")
|
|
44
|
+
end
|
|
45
|
+
if C_EncodingUtil == nil then
|
|
46
|
+
error("Encoding: native codec is unavailable")
|
|
47
|
+
end
|
|
48
|
+
local decoded = C_EncodingUtil.DecodeBase64(value)
|
|
49
|
+
if decoded == nil then
|
|
50
|
+
error("Encoding: invalid encoding")
|
|
51
|
+
end
|
|
52
|
+
local decompressed = C_EncodingUtil.DecompressString(decoded)
|
|
53
|
+
if decompressed == nil or #decompressed > maxBytes then
|
|
54
|
+
error("Encoding: invalid or oversized compressed data")
|
|
55
|
+
end
|
|
56
|
+
return C_EncodingUtil.DeserializeCBOR(decompressed)
|
|
57
|
+
end
|
|
58
|
+
return ____exports
|
|
@@ -30,14 +30,16 @@ interface wuiraNativeFrame {
|
|
|
30
30
|
StopMovingOrSizing(): void;
|
|
31
31
|
EnableKeyboard(enabled: boolean): void;
|
|
32
32
|
SetPropagateKeyboardInput(propagate: boolean): void;
|
|
33
|
-
SetScript(script: "OnClick" | "OnDragStart" | "OnDragStop" | "OnEnter" | "OnLeave", handler: ((this: void, frame: wuiraNativeFrame) => void) | undefined): void;
|
|
33
|
+
SetScript(script: "OnClick" | "OnDragStart" | "OnDragStop" | "OnEnter" | "OnLeave" | "OnEscapePressed", handler: ((this: void, frame: wuiraNativeFrame) => void) | undefined): void;
|
|
34
34
|
SetScript(script: "OnKeyDown", handler: ((this: void, frame: wuiraNativeFrame, key: string) => void) | undefined): void;
|
|
35
|
+
SetScript(script: "OnMouseWheel", handler: ((this: void, frame: wuiraNativeFrame, delta: number) => void) | undefined): void;
|
|
35
36
|
GetName(): string | undefined;
|
|
36
37
|
IsProtected?(): boolean;
|
|
37
38
|
GetParent(): wuiraNativeFrame;
|
|
38
39
|
GetNumPoints(): number;
|
|
39
40
|
GetPoint(index: number): wuiraNativeReturns<[wuiraAnchor, wuiraNativeFrame, wuiraAnchor, number, number]>;
|
|
40
41
|
GetScale(): number;
|
|
42
|
+
SetScale(scale: number): void;
|
|
41
43
|
GetChildren(): wuiraNativeFrame[] & { readonly __tstlMultiReturn: unknown };
|
|
42
44
|
IsMouseOver(): boolean;
|
|
43
45
|
SetFrameStrata(strata: "BACKGROUND" | "LOW" | "MEDIUM" | "HIGH" | "DIALOG" | "FULLSCREEN" | "FULLSCREEN_DIALOG" | "TOOLTIP"): void;
|
|
@@ -139,6 +141,7 @@ declare const C_UnitAuras: {
|
|
|
139
141
|
GetAuraDuration?: (this: void, unit: string, id: number) => import("../datasources/TimerSource").NativeDuration | undefined;
|
|
140
142
|
} | undefined;
|
|
141
143
|
declare const C_Spell: {
|
|
144
|
+
IsSpellPassive?: (this: void, id: number | string) => boolean;
|
|
142
145
|
PickupSpell?: (this: void, id: number) => void;
|
|
143
146
|
GetSpellPowerCost?: (this: void, id: number) => { type: number; cost?: number }[] | undefined;
|
|
144
147
|
GetSpellName?: (this: void, id: number | string) => string | undefined;
|
|
@@ -154,12 +157,13 @@ declare const C_SpellBook: {
|
|
|
154
157
|
itemIndexOffset: number; numSpellBookItems: number;
|
|
155
158
|
} | undefined;
|
|
156
159
|
GetSpellBookItemInfo?: (this: void, slot: number, bank: number) => {
|
|
157
|
-
itemType: number; spellID?: number; name?: string; isOffSpec?: boolean;
|
|
160
|
+
itemType: number; spellID?: number; name?: string; isOffSpec?: boolean; isPassive?: boolean;
|
|
158
161
|
} | undefined;
|
|
159
162
|
} | undefined;
|
|
160
163
|
declare const GetNumSpellTabs: ((this: void) => number) | undefined;
|
|
161
164
|
declare const GetSpellTabInfo: ((this: void, tab: number) => wuiraNativeReturns<[string, number, number, number]>) | undefined;
|
|
162
165
|
declare const GetSpellBookItemInfo: ((this: void, slot: number, bank: "spell") => wuiraNativeReturns<[string | undefined, number | undefined]>) | undefined;
|
|
166
|
+
declare const IsPassiveSpell: ((this: void, slot: number, bank: "spell") => boolean) | undefined;
|
|
163
167
|
declare const C_DurationUtil: {
|
|
164
168
|
CreateDuration(this: void): import("../datasources/TimerSource").NativeDuration & {
|
|
165
169
|
SetTimeFromStart(start: number, duration: number): void;
|
|
@@ -173,3 +177,12 @@ declare const GetTotemInfo: ((this: void, slot: number) => wuiraNativeReturns<[
|
|
|
173
177
|
number | undefined, number | undefined, number | undefined,
|
|
174
178
|
]>) | undefined;
|
|
175
179
|
declare const GetTotemDuration: ((this: void, slot: number) => import("../datasources/TimerSource").NativeDuration) | undefined;
|
|
180
|
+
|
|
181
|
+
declare const C_EncodingUtil: {
|
|
182
|
+
SerializeCBOR(this: void, value: unknown): string;
|
|
183
|
+
DeserializeCBOR(this: void, value: string): unknown;
|
|
184
|
+
CompressString(this: void, value: string): string | undefined;
|
|
185
|
+
DecompressString(this: void, value: string): string | undefined;
|
|
186
|
+
EncodeBase64(this: void, value: string): string | undefined;
|
|
187
|
+
DecodeBase64(this: void, value: string): string | undefined;
|
|
188
|
+
} | undefined;
|
package/lib/ui/Cell.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export type CellProps = {
|
|
|
18
18
|
alpha?: number | (() => number);
|
|
19
19
|
/** Called after native configuration. The optional cleanup runs on unmount. */
|
|
20
20
|
onMount?: (frame: wuiraNativeFrame) => void | (() => void);
|
|
21
|
+
/** Visibility condition. Hidden cells keep their reserved layout slot. */
|
|
22
|
+
condition?: boolean | (() => boolean);
|
|
21
23
|
/** Visibility does not remove the cell's reserved layout slot. */
|
|
22
24
|
visible?: () => boolean;
|
|
23
25
|
} & Position<ICell>;
|