wuira 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/CHANGELOG.md +102 -1
  2. package/README.md +347 -0
  3. package/lib/Spells.d.ts +21 -0
  4. package/lib/Spells.lua +41 -0
  5. package/lib/datasources/AuraTimer.d.ts +21 -0
  6. package/lib/datasources/AuraTimer.lua +322 -0
  7. package/lib/datasources/CastTimer.d.ts +9 -0
  8. package/lib/datasources/CastTimer.lua +240 -0
  9. package/lib/datasources/DataSource.d.ts +4 -0
  10. package/lib/datasources/DataSource.lua +24 -0
  11. package/lib/datasources/KnownSpells.d.ts +21 -0
  12. package/lib/datasources/KnownSpells.lua +794 -0
  13. package/lib/datasources/ManaRegenTimer.d.ts +29 -0
  14. package/lib/datasources/ManaRegenTimer.lua +674 -0
  15. package/lib/datasources/ProgressSource.d.ts +6 -2
  16. package/lib/datasources/ProgressSource.lua +34 -3
  17. package/lib/datasources/Resources.d.ts +33 -2
  18. package/lib/datasources/Resources.lua +562 -10
  19. package/lib/datasources/SpellCooldown.d.ts +12 -0
  20. package/lib/datasources/SpellCooldown.lua +218 -0
  21. package/lib/datasources/SpellSource.d.ts +14 -0
  22. package/lib/datasources/SpellSource.lua +224 -0
  23. package/lib/datasources/SwingTimer.d.ts +31 -0
  24. package/lib/datasources/SwingTimer.lua +641 -0
  25. package/lib/datasources/TextureSource.d.ts +10 -0
  26. package/lib/datasources/TextureSource.lua +83 -0
  27. package/lib/datasources/TimerSource.d.ts +20 -0
  28. package/lib/datasources/TimerSource.lua +338 -0
  29. package/lib/datasources/TotemTimer.d.ts +10 -0
  30. package/lib/datasources/TotemTimer.lua +260 -0
  31. package/lib/datasources/index.d.ts +16 -1
  32. package/lib/datasources/index.lua +43 -0
  33. package/lib/index.d.ts +11 -0
  34. package/lib/index.lua +24 -0
  35. package/lib/platform/ActionBars.d.ts +27 -0
  36. package/lib/platform/ActionBars.lua +726 -0
  37. package/lib/platform/AddonSettings.d.ts +9 -0
  38. package/lib/platform/AddonSettings.lua +36 -0
  39. package/lib/platform/BlizzardUI.d.ts +17 -0
  40. package/lib/platform/BlizzardUI.lua +689 -0
  41. package/lib/platform/MicroMenu.d.ts +15 -0
  42. package/lib/platform/MicroMenu.lua +219 -0
  43. package/lib/platform/SecureButton.d.ts +5 -0
  44. package/lib/platform/SecureButton.lua +196 -0
  45. package/lib/platform/SlashCommands.d.ts +3 -0
  46. package/lib/platform/SlashCommands.lua +309 -0
  47. package/lib/platform/forever.d.ts +115 -2
  48. package/lib/skins/MicroBar.d.ts +8 -0
  49. package/lib/skins/MicroBar.lua +65 -0
  50. package/lib/skins/NativeSkin.d.ts +26 -0
  51. package/lib/skins/NativeSkin.lua +601 -0
  52. package/lib/skins/index.d.ts +3 -0
  53. package/lib/skins/index.lua +11 -0
  54. package/lib/store/index.lua +13 -0
  55. package/lib/ui/Button.d.ts +10 -0
  56. package/lib/ui/Button.lua +9 -0
  57. package/lib/ui/Cell.d.ts +7 -1
  58. package/lib/ui/FrameMover.d.ts +21 -0
  59. package/lib/ui/FrameMover.lua +123 -0
  60. package/lib/ui/HoverTracker.d.ts +20 -0
  61. package/lib/ui/HoverTracker.lua +88 -0
  62. package/lib/ui/Icon.d.ts +8 -0
  63. package/lib/ui/Icon.lua +8 -0
  64. package/lib/ui/KeybindCapture.d.ts +20 -0
  65. package/lib/ui/KeybindCapture.lua +488 -0
  66. package/lib/ui/Label.d.ts +10 -0
  67. package/lib/ui/Label.lua +8 -0
  68. package/lib/ui/ProgressBar.d.ts +5 -1
  69. package/lib/ui/SecureButton.d.ts +44 -0
  70. package/lib/ui/SecureButton.lua +9 -0
  71. package/lib/ui/index.d.ts +13 -0
  72. package/lib/ui/index.lua +28 -0
  73. package/lib/ui/layout/measureLayout.lua +11 -2
  74. package/lib/ui/mount.lua +679 -74
  75. package/lib/ui/primitives/jsx.d.ts +15 -2
  76. package/lib/wuira.d.ts +3 -0
  77. package/lib/wuira.lua +5 -0
  78. package/package.json +8 -1
  79. package/tools/build-library.mjs +1 -1
package/lib/ui/mount.lua CHANGED
@@ -237,6 +237,219 @@ local function __TS__New(target, ...)
237
237
  return instance
238
238
  end
239
239
 
240
+ local Set
241
+ do
242
+ Set = __TS__Class()
243
+ Set.name = "Set"
244
+ function Set.prototype.____constructor(self, values)
245
+ self[Symbol.toStringTag] = "Set"
246
+ self.size = 0
247
+ self.nextKey = {}
248
+ self.previousKey = {}
249
+ if values == nil then
250
+ return
251
+ end
252
+ local iterable = values
253
+ if iterable[Symbol.iterator] then
254
+ local iterator = iterable[Symbol.iterator](iterable)
255
+ while true do
256
+ local result = iterator:next()
257
+ if result.done then
258
+ break
259
+ end
260
+ self:add(result.value)
261
+ end
262
+ else
263
+ local array = values
264
+ for ____, value in ipairs(array) do
265
+ self:add(value)
266
+ end
267
+ end
268
+ end
269
+ function Set.prototype.add(self, value)
270
+ local isNewValue = not self:has(value)
271
+ if isNewValue then
272
+ self.size = self.size + 1
273
+ end
274
+ if self.firstKey == nil then
275
+ self.firstKey = value
276
+ self.lastKey = value
277
+ elseif isNewValue then
278
+ self.nextKey[self.lastKey] = value
279
+ self.previousKey[value] = self.lastKey
280
+ self.lastKey = value
281
+ end
282
+ return self
283
+ end
284
+ function Set.prototype.clear(self)
285
+ self.nextKey = {}
286
+ self.previousKey = {}
287
+ self.firstKey = nil
288
+ self.lastKey = nil
289
+ self.size = 0
290
+ end
291
+ function Set.prototype.delete(self, value)
292
+ local contains = self:has(value)
293
+ if contains then
294
+ self.size = self.size - 1
295
+ local next = self.nextKey[value]
296
+ local previous = self.previousKey[value]
297
+ if next ~= nil and previous ~= nil then
298
+ self.nextKey[previous] = next
299
+ self.previousKey[next] = previous
300
+ elseif next ~= nil then
301
+ self.firstKey = next
302
+ self.previousKey[next] = nil
303
+ elseif previous ~= nil then
304
+ self.lastKey = previous
305
+ self.nextKey[previous] = nil
306
+ else
307
+ self.firstKey = nil
308
+ self.lastKey = nil
309
+ end
310
+ self.nextKey[value] = nil
311
+ self.previousKey[value] = nil
312
+ end
313
+ return contains
314
+ end
315
+ function Set.prototype.forEach(self, callback)
316
+ for ____, key in __TS__Iterator(self:keys()) do
317
+ callback(nil, key, key, self)
318
+ end
319
+ end
320
+ function Set.prototype.has(self, value)
321
+ return self.nextKey[value] ~= nil or self.lastKey == value
322
+ end
323
+ Set.prototype[Symbol.iterator] = function(self)
324
+ return self:values()
325
+ end
326
+ function Set.prototype.entries(self)
327
+ local function getFirstKey()
328
+ return self.firstKey
329
+ end
330
+ local nextKey = self.nextKey
331
+ local key
332
+ local started = false
333
+ return {
334
+ [Symbol.iterator] = function(self)
335
+ return self
336
+ end,
337
+ next = function(self)
338
+ if not started then
339
+ started = true
340
+ key = getFirstKey(nil)
341
+ else
342
+ key = nextKey[key]
343
+ end
344
+ return {done = not key, value = {key, key}}
345
+ end
346
+ }
347
+ end
348
+ function Set.prototype.keys(self)
349
+ local function getFirstKey()
350
+ return self.firstKey
351
+ end
352
+ local nextKey = self.nextKey
353
+ local key
354
+ local started = false
355
+ return {
356
+ [Symbol.iterator] = function(self)
357
+ return self
358
+ end,
359
+ next = function(self)
360
+ if not started then
361
+ started = true
362
+ key = getFirstKey(nil)
363
+ else
364
+ key = nextKey[key]
365
+ end
366
+ return {done = not key, value = key}
367
+ end
368
+ }
369
+ end
370
+ function Set.prototype.values(self)
371
+ local function getFirstKey()
372
+ return self.firstKey
373
+ end
374
+ local nextKey = self.nextKey
375
+ local key
376
+ local started = false
377
+ return {
378
+ [Symbol.iterator] = function(self)
379
+ return self
380
+ end,
381
+ next = function(self)
382
+ if not started then
383
+ started = true
384
+ key = getFirstKey(nil)
385
+ else
386
+ key = nextKey[key]
387
+ end
388
+ return {done = not key, value = key}
389
+ end
390
+ }
391
+ end
392
+ function Set.prototype.union(self, other)
393
+ local result = __TS__New(Set, self)
394
+ for ____, item in __TS__Iterator(other) do
395
+ result:add(item)
396
+ end
397
+ return result
398
+ end
399
+ function Set.prototype.intersection(self, other)
400
+ local result = __TS__New(Set)
401
+ for ____, item in __TS__Iterator(self) do
402
+ if other:has(item) then
403
+ result:add(item)
404
+ end
405
+ end
406
+ return result
407
+ end
408
+ function Set.prototype.difference(self, other)
409
+ local result = __TS__New(Set, self)
410
+ for ____, item in __TS__Iterator(other) do
411
+ result:delete(item)
412
+ end
413
+ return result
414
+ end
415
+ function Set.prototype.symmetricDifference(self, other)
416
+ local result = __TS__New(Set, self)
417
+ for ____, item in __TS__Iterator(other) do
418
+ if self:has(item) then
419
+ result:delete(item)
420
+ else
421
+ result:add(item)
422
+ end
423
+ end
424
+ return result
425
+ end
426
+ function Set.prototype.isSubsetOf(self, other)
427
+ for ____, item in __TS__Iterator(self) do
428
+ if not other:has(item) then
429
+ return false
430
+ end
431
+ end
432
+ return true
433
+ end
434
+ function Set.prototype.isSupersetOf(self, other)
435
+ for ____, item in __TS__Iterator(other) do
436
+ if not self:has(item) then
437
+ return false
438
+ end
439
+ end
440
+ return true
441
+ end
442
+ function Set.prototype.isDisjointFrom(self, other)
443
+ for ____, item in __TS__Iterator(self) do
444
+ if other:has(item) then
445
+ return false
446
+ end
447
+ end
448
+ return true
449
+ end
450
+ Set[Symbol.species] = Set
451
+ end
452
+
240
453
  local function __TS__ArrayMap(self, callbackfn, thisArg)
241
454
  local result = {}
242
455
  for i = 1, #self do
@@ -244,8 +457,45 @@ local function __TS__ArrayMap(self, callbackfn, thisArg)
244
457
  end
245
458
  return result
246
459
  end
460
+
461
+ local function __TS__NumberIsFinite(value)
462
+ return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
463
+ end
464
+
465
+ local function __TS__InstanceOf(obj, classTbl)
466
+ if type(classTbl) ~= "table" then
467
+ error("Right-hand side of 'instanceof' is not an object", 0)
468
+ end
469
+ if classTbl[Symbol.hasInstance] ~= nil then
470
+ return not not classTbl[Symbol.hasInstance](classTbl, obj)
471
+ end
472
+ if type(obj) == "table" then
473
+ local luaClass = obj.constructor
474
+ while luaClass ~= nil do
475
+ if luaClass == classTbl then
476
+ return true
477
+ end
478
+ luaClass = luaClass.____super
479
+ end
480
+ end
481
+ return false
482
+ end
483
+
484
+ local function __TS__ObjectAssign(target, ...)
485
+ local sources = {...}
486
+ for i = 1, #sources do
487
+ local source = sources[i]
488
+ if type(source) == "table" then
489
+ for key in pairs(source) do
490
+ target[key] = source[key]
491
+ end
492
+ end
493
+ end
494
+ return target
495
+ end
247
496
  -- End of Lua Library inline imports
248
497
  local ____exports = {}
498
+ local protect, mountedFrames, mountedTrees
249
499
  local ____measureLayout = require("ui.layout.measureLayout")
250
500
  local measureLayout = ____measureLayout.measureLayout
251
501
  local ____Background = require("ui.decorations.Background")
@@ -254,19 +504,64 @@ local ____Border = require("ui.decorations.Border")
254
504
  local Border = ____Border.Border
255
505
  local ____statusBarTextures = require("ui.decorations.statusBarTextures")
256
506
  local resolveStatusBarTexture = ____statusBarTextures.resolveStatusBarTexture
257
- local mountedFrames = __TS__New(Map)
258
- local mountedTrees = __TS__New(Map)
507
+ local ____Resources = require("datasources.Resources")
508
+ local HP = ____Resources.HP
509
+ local ____SecureButton = require("platform.SecureButton")
510
+ local createSecureButton = ____SecureButton.createSecureButton
511
+ local configureSecureButton = ____SecureButton.configureSecureButton
512
+ local validateSecureButton = ____SecureButton.validateSecureButton
513
+ function protect(self, root, tree)
514
+ local ____temp_2 = not tree.protected
515
+ if ____temp_2 then
516
+ local ____this_1
517
+ ____this_1 = root
518
+ local ____opt_0 = ____this_1.IsProtected
519
+ ____temp_2 = (____opt_0 and ____opt_0(____this_1)) ~= true
520
+ end
521
+ if ____temp_2 then
522
+ return false
523
+ end
524
+ tree.protected = true
525
+ if tree.listener == nil then
526
+ local listener = CreateFrame("Frame", nil, UIParent)
527
+ tree.listener = listener
528
+ local ____tree_frames_3 = tree.frames
529
+ ____tree_frames_3[#____tree_frames_3 + 1] = listener
530
+ listener:RegisterEvent("PLAYER_REGEN_ENABLED")
531
+ listener:SetScript(
532
+ "OnEvent",
533
+ function()
534
+ if tree.pendingUnmount then
535
+ ____exports.unmount(nil, root)
536
+ else
537
+ for ____, refresh in ipairs(tree.visibility) do
538
+ refresh(nil)
539
+ end
540
+ end
541
+ end
542
+ )
543
+ end
544
+ return true
545
+ end
259
546
  function ____exports.unmount(self, frame)
260
547
  local tree = mountedTrees:get(frame)
261
548
  if tree == nil then
262
549
  return
263
550
  end
551
+ if protect(nil, frame, tree) and InCombatLockdown() then
552
+ tree.pendingUnmount = true
553
+ return
554
+ end
555
+ for ____, dispose in ipairs(tree.bindings) do
556
+ dispose(nil)
557
+ end
264
558
  for ____, decoration in ipairs(tree.decorations) do
265
559
  decoration:dispose()
266
560
  end
267
561
  for ____, child in ipairs(tree.frames) do
268
562
  child:UnregisterAllEvents()
269
563
  child:SetScript("OnEvent", nil)
564
+ child:SetScript("OnUpdate", nil)
270
565
  child:Hide()
271
566
  end
272
567
  for ____, cell in ipairs(tree.cells) do
@@ -274,6 +569,8 @@ function ____exports.unmount(self, frame)
274
569
  end
275
570
  mountedTrees:delete(frame)
276
571
  end
572
+ mountedFrames = __TS__New(Map)
573
+ mountedTrees = __TS__New(Map)
277
574
  --- Creates the tree before resolving anchors. Positive y moves down.
278
575
  function ____exports.mount(self, element, parent, rootAnchor)
279
576
  if parent == nil then
@@ -281,22 +578,65 @@ function ____exports.mount(self, element, parent, rootAnchor)
281
578
  end
282
579
  local frames = __TS__New(Map)
283
580
  local pending = {}
581
+ local rootProps = element.props
582
+ local measured = measureLayout(
583
+ nil,
584
+ element,
585
+ {
586
+ width = rootProps.width == "inherit" and parent:GetWidth() or nil,
587
+ height = rootProps.height == "inherit" and parent:GetHeight() or nil
588
+ }
589
+ )
590
+ local ____temp_7 = parent ~= UIParent
591
+ if ____temp_7 then
592
+ local ____this_5
593
+ ____this_5 = parent
594
+ local ____opt_4 = ____this_5.IsProtected
595
+ local ____temp_6 = ____opt_4 and ____opt_4(____this_5)
596
+ if ____temp_6 == nil then
597
+ ____temp_6 = false
598
+ end
599
+ ____temp_7 = ____temp_6
600
+ end
601
+ local protectedTree = ____temp_7
602
+ local seen = __TS__New(Set)
603
+ local function validate(self, item)
604
+ if seen:has(item.cell.props) or mountedFrames:has(item.cell.props) then
605
+ error("A Cell can only be mounted once at a time")
606
+ end
607
+ seen:add(item.cell.props)
608
+ if item.cell.kind == "secureButton" then
609
+ protectedTree = true
610
+ validateSecureButton(nil, item.cell.props)
611
+ end
612
+ for ____, child in ipairs(item.children) do
613
+ validate(nil, child)
614
+ end
615
+ end
616
+ validate(nil, measured)
617
+ if protectedTree and InCombatLockdown() then
618
+ error("SecureButton: mount protected UI outside combat")
619
+ end
284
620
  local function create(self, measured, parent, placement)
285
- local ____measured_0 = measured
286
- local cell = ____measured_0.cell
287
- local width = ____measured_0.width
288
- local height = ____measured_0.height
621
+ local ____measured_8 = measured
622
+ local cell = ____measured_8.cell
623
+ local width = ____measured_8.width
624
+ local height = ____measured_8.height
289
625
  if frames:has(cell.props) or mountedFrames:has(cell.props) then
290
626
  error("A Cell can only be mounted once at a time")
291
627
  end
292
- local frame = cell.kind == "progress" and CreateFrame("StatusBar", nil, parent) or CreateFrame("Frame", nil, parent)
628
+ local frame = cell.kind == "progress" and CreateFrame("StatusBar", nil, parent) or (cell.kind == "secureButton" and createSecureButton(nil, parent, cell.props) or (cell.kind == "button" and CreateFrame("Button", nil, parent) or CreateFrame("Frame", nil, parent)))
293
629
  frame:Hide()
294
- local ____frame_EnableMouse_2 = frame.EnableMouse
295
- local ____cell_props_clickThrough_1 = cell.props.clickThrough
296
- if ____cell_props_clickThrough_1 == nil then
297
- ____cell_props_clickThrough_1 = true
630
+ local ____frame_EnableMouse_11 = frame.EnableMouse
631
+ local ____temp_10 = cell.kind == "secureButton" or cell.kind == "button"
632
+ if not ____temp_10 then
633
+ local ____cell_props_clickThrough_9 = cell.props.clickThrough
634
+ if ____cell_props_clickThrough_9 == nil then
635
+ ____cell_props_clickThrough_9 = true
636
+ end
637
+ ____temp_10 = not ____cell_props_clickThrough_9
298
638
  end
299
- ____frame_EnableMouse_2(frame, not ____cell_props_clickThrough_1)
639
+ ____frame_EnableMouse_11(frame, ____temp_10)
300
640
  frames:set(cell.props, frame)
301
641
  pending[#pending + 1] = {
302
642
  cell = cell,
@@ -311,28 +651,16 @@ function ____exports.mount(self, element, parent, rootAnchor)
311
651
  do
312
652
  local index = 0
313
653
  while index < #measured.children do
314
- local ____create_6 = create
315
- local ____measured_children_index_5 = measured.children[index + 1]
316
- local ____opt_3 = measured.placements
317
- ____create_6(nil, ____measured_children_index_5, frame, ____opt_3 and ____opt_3[index + 1])
654
+ local ____create_15 = create
655
+ local ____measured_children_index_14 = measured.children[index + 1]
656
+ local ____opt_12 = measured.placements
657
+ ____create_15(nil, ____measured_children_index_14, frame, ____opt_12 and ____opt_12[index + 1])
318
658
  index = index + 1
319
659
  end
320
660
  end
321
661
  return frame
322
662
  end
323
- local rootProps = element.props
324
- local root = create(
325
- nil,
326
- measureLayout(
327
- nil,
328
- element,
329
- {
330
- width = rootProps.width == "inherit" and parent:GetWidth() or nil,
331
- height = rootProps.height == "inherit" and parent:GetHeight() or nil
332
- }
333
- ),
334
- parent
335
- )
663
+ local root = create(nil, measured, parent)
336
664
  local anchors = __TS__New(Map)
337
665
  for ____, item in ipairs(pending) do
338
666
  local position = item.cell.props
@@ -369,7 +697,11 @@ function ____exports.mount(self, element, parent, rootAnchor)
369
697
  pending,
370
698
  function(____, item) return item.cell end
371
699
  ),
372
- decorations = {}
700
+ decorations = {},
701
+ bindings = {},
702
+ protected = protectedTree,
703
+ pendingUnmount = false,
704
+ visibility = {}
373
705
  }
374
706
  mountedTrees:set(root, tree)
375
707
  do
@@ -378,20 +710,75 @@ function ____exports.mount(self, element, parent, rootAnchor)
378
710
  error(failure, 0)
379
711
  end
380
712
  local ____try, ____hasReturned = pcall(function()
713
+ local updates = {}
714
+ protect(nil, root, tree)
381
715
  for ____, item in ipairs(pending) do
716
+ local sourceActive = true
717
+ local lastVisible
718
+ local visible = item.cell.props.visible
719
+ local function refreshVisibility()
720
+ if protect(nil, root, tree) and InCombatLockdown() then
721
+ return
722
+ end
723
+ local ____sourceActive_19 = sourceActive
724
+ if ____sourceActive_19 then
725
+ local ____temp_18 = visible and visible(nil)
726
+ if ____temp_18 == nil then
727
+ ____temp_18 = true
728
+ end
729
+ ____sourceActive_19 = ____temp_18
730
+ end
731
+ local value = ____sourceActive_19
732
+ if value == lastVisible then
733
+ return
734
+ end
735
+ lastVisible = value
736
+ if value then
737
+ item.frame:Show()
738
+ else
739
+ item.frame:Hide()
740
+ end
741
+ end
742
+ local ____tree_visibility_20 = tree.visibility
743
+ ____tree_visibility_20[#____tree_visibility_20 + 1] = refreshVisibility
744
+ local function onActiveChange(____, active)
745
+ sourceActive = active
746
+ refreshVisibility(nil)
747
+ end
382
748
  local position = item.cell.props
749
+ if position.alpha ~= nil then
750
+ local alpha = position.alpha
751
+ local previous
752
+ local function refreshAlpha()
753
+ local value = type(alpha) == "function" and alpha(nil) or alpha
754
+ if issecretvalue(value) then
755
+ return
756
+ end
757
+ if not __TS__NumberIsFinite(value) or value < 0 or value > 1 then
758
+ error("Cell alpha must be between 0 and 1")
759
+ end
760
+ if value ~= previous then
761
+ item.frame:SetAlpha(value)
762
+ end
763
+ previous = value
764
+ end
765
+ refreshAlpha(nil)
766
+ if type(alpha) == "function" then
767
+ updates[#updates + 1] = refreshAlpha
768
+ end
769
+ end
383
770
  local target = anchors:get(item.frame)
384
- local ____opt_7 = item.placement
385
- local x = ____opt_7 and ____opt_7.x or (position.mode == "absolute" and position.x or position.offset.x)
386
- local ____opt_9 = item.placement
387
- local y = ____opt_9 and ____opt_9.y or (position.mode == "absolute" and position.y or position.offset.y)
388
- local ____temp_11
771
+ local ____opt_21 = item.placement
772
+ local x = ____opt_21 and ____opt_21.x or (position.mode == "absolute" and position.x or position.offset.x)
773
+ local ____opt_23 = item.placement
774
+ local y = ____opt_23 and ____opt_23.y or (position.mode == "absolute" and position.y or position.offset.y)
775
+ local ____temp_25
389
776
  if item.frame == root then
390
- ____temp_11 = rootAnchor
777
+ ____temp_25 = rootAnchor
391
778
  else
392
- ____temp_11 = nil
779
+ ____temp_25 = nil
393
780
  end
394
- local overrideAnchor = ____temp_11
781
+ local overrideAnchor = ____temp_25
395
782
  local anchor = overrideAnchor or (item.placement ~= nil and "TOPLEFT" or (position.anchor or "TOPLEFT"))
396
783
  local relativeAnchor = overrideAnchor or (item.placement ~= nil and "TOPLEFT" or (position.relativeAnchor or anchor))
397
784
  item.frame:SetPoint(
@@ -401,48 +788,232 @@ function ____exports.mount(self, element, parent, rootAnchor)
401
788
  x + item.margin.left,
402
789
  -(y + item.margin.top)
403
790
  )
791
+ if item.cell.kind == "secureButton" then
792
+ local props = item.cell.props
793
+ local ____tree_bindings_26 = tree.bindings
794
+ ____tree_bindings_26[#____tree_bindings_26 + 1] = configureSecureButton(nil, item.frame, props)
795
+ if props.cooldown ~= nil then
796
+ local cooldown = CreateFrame("Cooldown", nil, item.frame, "CooldownFrameTemplate")
797
+ local ____tree_frames_27 = tree.frames
798
+ ____tree_frames_27[#____tree_frames_27 + 1] = cooldown
799
+ cooldown:EnableMouse(false)
800
+ cooldown:SetAllPoints(item.frame)
801
+ cooldown:SetFrameLevel(item.frame:GetFrameLevel() + 2)
802
+ cooldown:SetDrawSwipe(true)
803
+ cooldown:SetDrawEdge(false)
804
+ local ____cooldown_SetDrawBling_29 = cooldown.SetDrawBling
805
+ local ____props_finishGlow_28 = props.finishGlow
806
+ if ____props_finishGlow_28 == nil then
807
+ ____props_finishGlow_28 = false
808
+ end
809
+ ____cooldown_SetDrawBling_29(cooldown, ____props_finishGlow_28)
810
+ cooldown:SetHideCountdownNumbers(false)
811
+ cooldown:SetSwipeColor(0, 0, 0, 0.7)
812
+ cooldown:GetCountdownFontString():SetFont("Fonts\\FRIZQT__.TTF", 13, "OUTLINE")
813
+ local ____tree_bindings_30 = tree.bindings
814
+ ____tree_bindings_30[#____tree_bindings_30 + 1] = props.cooldown:BindCooldown(cooldown)
815
+ end
816
+ if props.binding ~= nil and props.showHotkey ~= false then
817
+ local overlay = CreateFrame("Frame", nil, item.frame)
818
+ local ____tree_frames_31 = tree.frames
819
+ ____tree_frames_31[#____tree_frames_31 + 1] = overlay
820
+ overlay:EnableMouse(false)
821
+ overlay:SetAllPoints(item.frame)
822
+ overlay:SetFrameLevel(item.frame:GetFrameLevel() + 3)
823
+ local hotkey = overlay:CreateFontString(nil, "OVERLAY")
824
+ hotkey:SetAllPoints(overlay)
825
+ hotkey:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE")
826
+ hotkey:SetJustifyH("RIGHT")
827
+ hotkey:SetJustifyV("TOP")
828
+ hotkey:SetTextColor(1, 1, 1, 1)
829
+ hotkey:SetText(props.binding)
830
+ end
831
+ end
832
+ if item.cell.kind == "button" then
833
+ local onClick = item.cell.props.onClick
834
+ local ____self_33 = item.frame
835
+ local ____self_33_SetScript_34 = ____self_33.SetScript
836
+ local ____temp_32
837
+ if onClick == nil then
838
+ ____temp_32 = nil
839
+ else
840
+ ____temp_32 = function() return onClick(nil) end
841
+ end
842
+ ____self_33_SetScript_34(____self_33, "OnClick", ____temp_32)
843
+ local ____tree_bindings_35 = tree.bindings
844
+ ____tree_bindings_35[#____tree_bindings_35 + 1] = function() return item.frame:SetScript("OnClick", nil) end
845
+ end
846
+ if item.cell.kind == "label" then
847
+ local props = item.cell.props
848
+ local label = item.frame:CreateFontString(nil, "OVERLAY")
849
+ label:SetAllPoints(item.frame)
850
+ label:SetFont(props.font or "Fonts\\FRIZQT__.TTF", props.fontSize or 12, "OUTLINE")
851
+ label:SetJustifyH(props.align or "LEFT")
852
+ label:SetJustifyV("MIDDLE")
853
+ local color = props.color
854
+ label:SetTextColor(color and color.r or 1, color and color.g or 1, color and color.b or 1, color and color.a or 1)
855
+ local text = props.text
856
+ if type(text) == "function" then
857
+ local previous
858
+ updates[#updates + 1] = function()
859
+ local value = text(nil)
860
+ if issecretvalue(value) or value ~= previous then
861
+ label:SetText(value)
862
+ end
863
+ if not issecretvalue(value) then
864
+ previous = value
865
+ end
866
+ end
867
+ else
868
+ label:SetText(text)
869
+ end
870
+ end
871
+ if item.cell.kind == "icon" then
872
+ local props = item.cell.props
873
+ local texture = item.frame:CreateTexture(nil, "OVERLAY")
874
+ texture:SetAllPoints(item.frame)
875
+ local uv = props.texCoords or ({0, 1, 0, 1})
876
+ texture:SetTexCoord(uv[1], uv[2], uv[3], uv[4])
877
+ texture:SetTexture(props.texture)
878
+ local ____opt_44 = props.textureSource
879
+ if ____opt_44 ~= nil then
880
+ ____opt_44:BindTo(item.frame, texture, onActiveChange)
881
+ end
882
+ end
404
883
  if item.cell.kind == "progress" then
405
884
  local props = item.cell.props
406
885
  local bar = item.frame
407
- local ____opt_12 = props.foreground
408
- local color = ____opt_12 and ____opt_12.color or props.color
409
- local ____bar_SetStatusBarTexture_17 = bar.SetStatusBarTexture
410
- local ____resolveStatusBarTexture_16 = resolveStatusBarTexture
411
- local ____opt_14 = props.foreground
412
- ____bar_SetStatusBarTexture_17(
886
+ local ____opt_46 = props.foreground
887
+ local color = ____opt_46 and ____opt_46.color or props.color
888
+ local ____bar_SetStatusBarTexture_51 = bar.SetStatusBarTexture
889
+ local ____resolveStatusBarTexture_50 = resolveStatusBarTexture
890
+ local ____opt_48 = props.foreground
891
+ ____bar_SetStatusBarTexture_51(
413
892
  bar,
414
- ____resolveStatusBarTexture_16(nil, ____opt_14 and ____opt_14.texture or props.texture or "solid")
893
+ ____resolveStatusBarTexture_50(nil, ____opt_48 and ____opt_48.texture or props.texture or "solid")
415
894
  )
416
895
  bar:SetStatusBarColor(color and color.r or 1, color and color.g or 1, color and color.b or 1, color and color.a or 1)
417
896
  if props.foreground ~= nil then
418
897
  local fill = bar:GetStatusBarTexture()
419
- local ____fill_SetHorizTile_27 = fill.SetHorizTile
420
- local ____props_foreground_tileX_26 = props.foreground.tileX
421
- if ____props_foreground_tileX_26 == nil then
422
- ____props_foreground_tileX_26 = false
898
+ local ____fill_SetHorizTile_61 = fill.SetHorizTile
899
+ local ____props_foreground_tileX_60 = props.foreground.tileX
900
+ if ____props_foreground_tileX_60 == nil then
901
+ ____props_foreground_tileX_60 = false
423
902
  end
424
- ____fill_SetHorizTile_27(fill, ____props_foreground_tileX_26)
425
- local ____fill_SetVertTile_29 = fill.SetVertTile
426
- local ____props_foreground_tileY_28 = props.foreground.tileY
427
- if ____props_foreground_tileY_28 == nil then
428
- ____props_foreground_tileY_28 = false
903
+ ____fill_SetHorizTile_61(fill, ____props_foreground_tileX_60)
904
+ local ____fill_SetVertTile_63 = fill.SetVertTile
905
+ local ____props_foreground_tileY_62 = props.foreground.tileY
906
+ if ____props_foreground_tileY_62 == nil then
907
+ ____props_foreground_tileY_62 = false
429
908
  end
430
- ____fill_SetVertTile_29(fill, ____props_foreground_tileY_28)
909
+ ____fill_SetVertTile_63(fill, ____props_foreground_tileY_62)
431
910
  fill:SetBlendMode(props.foreground.blendMode or "BLEND")
432
911
  local uv = props.foreground.texCoords or ({0, 1, 0, 1})
433
912
  fill:SetTexCoord(uv[1], uv[2], uv[3], uv[4])
434
913
  end
435
914
  bar:SetOrientation(props.orientation == "vertical" and "VERTICAL" or "HORIZONTAL")
436
- local ____bar_SetReverseFill_31 = bar.SetReverseFill
437
- local ____props_reverse_30 = props.reverse
438
- if ____props_reverse_30 == nil then
439
- ____props_reverse_30 = false
915
+ local ____bar_SetReverseFill_65 = bar.SetReverseFill
916
+ local ____props_reverse_64 = props.reverse
917
+ if ____props_reverse_64 == nil then
918
+ ____props_reverse_64 = false
440
919
  end
441
- ____bar_SetReverseFill_31(bar, ____props_reverse_30)
920
+ ____bar_SetReverseFill_65(bar, ____props_reverse_64)
442
921
  bar:SetMinMaxValues(props.min or 0, props.max or 100)
443
922
  local source = item.cell.source or props.source
444
923
  if source ~= nil then
445
- source:BindTo(bar, {min = props.min, max = props.max, current = props.current or props.value})
924
+ local healPredictionBar
925
+ local absorbPredictionBar
926
+ if __TS__InstanceOf(source, HP) then
927
+ local function overlay(____, style, heal)
928
+ bar:SetClipsChildren(true)
929
+ local layer = CreateFrame("StatusBar", nil, bar)
930
+ local ____tree_frames_66 = tree.frames
931
+ ____tree_frames_66[#____tree_frames_66 + 1] = layer
932
+ layer:EnableMouse(false)
933
+ layer:SetFrameLevel(bar:GetFrameLevel())
934
+ layer:SetSize(item.width, item.height)
935
+ layer:SetStatusBarTexture(resolveStatusBarTexture(nil, style.texture or "solid"))
936
+ local tint = style.color
937
+ layer:SetStatusBarColor(tint.r, tint.g, tint.b, tint.a or 0.5)
938
+ local texture = layer:GetStatusBarTexture()
939
+ texture:SetBlendMode(style.blendMode or "BLEND")
940
+ local ____texture_SetHorizTile_68 = texture.SetHorizTile
941
+ local ____style_tileX_67 = style.tileX
942
+ if ____style_tileX_67 == nil then
943
+ ____style_tileX_67 = false
944
+ end
945
+ ____texture_SetHorizTile_68(texture, ____style_tileX_67)
946
+ local ____texture_SetVertTile_70 = texture.SetVertTile
947
+ local ____style_tileY_69 = style.tileY
948
+ if ____style_tileY_69 == nil then
949
+ ____style_tileY_69 = false
950
+ end
951
+ ____texture_SetVertTile_70(texture, ____style_tileY_69)
952
+ local uv = style.texCoords or ({0, 1, 0, 1})
953
+ texture:SetTexCoord(uv[1], uv[2], uv[3], uv[4])
954
+ local vertical = props.orientation == "vertical"
955
+ local ____props_reverse_71 = props.reverse
956
+ if ____props_reverse_71 == nil then
957
+ ____props_reverse_71 = false
958
+ end
959
+ local reverse = ____props_reverse_71
960
+ layer:SetOrientation(vertical and "VERTICAL" or "HORIZONTAL")
961
+ local ____layer_SetReverseFill_73 = layer.SetReverseFill
962
+ local ____heal_72
963
+ if heal then
964
+ ____heal_72 = reverse
965
+ else
966
+ ____heal_72 = not reverse
967
+ end
968
+ ____layer_SetReverseFill_73(layer, ____heal_72)
969
+ if heal then
970
+ local point = vertical and (reverse and "TOPLEFT" or "BOTTOMLEFT") or (reverse and "TOPRIGHT" or "TOPLEFT")
971
+ local relative = vertical and (reverse and "BOTTOMLEFT" or "TOPLEFT") or (reverse and "TOPLEFT" or "TOPRIGHT")
972
+ layer:SetPoint(
973
+ point,
974
+ bar:GetStatusBarTexture(),
975
+ relative,
976
+ 0,
977
+ 0
978
+ )
979
+ else
980
+ layer:SetAllPoints(bar)
981
+ end
982
+ return layer
983
+ end
984
+ local ____opt_74 = source.HealPrediction
985
+ if (____opt_74 and ____opt_74.IsAvailable) == true and props.healPrediction ~= false then
986
+ local ____props_healPrediction_78 = props.healPrediction
987
+ local ____opt_76 = props.healPrediction
988
+ healPredictionBar = overlay(
989
+ nil,
990
+ __TS__ObjectAssign({}, ____props_healPrediction_78, {color = ____opt_76 and ____opt_76.color or ({r = 0.4, g = 1, b = 0.5, a = 0.5})}),
991
+ true
992
+ )
993
+ end
994
+ local ____opt_79 = source.AbsorbPrediction
995
+ if (____opt_79 and ____opt_79.IsAvailable) == true and props.absorbPrediction ~= false then
996
+ local ____props_absorbPrediction_83 = props.absorbPrediction
997
+ local ____opt_81 = props.absorbPrediction
998
+ absorbPredictionBar = overlay(
999
+ nil,
1000
+ __TS__ObjectAssign({}, ____props_absorbPrediction_83, {color = ____opt_81 and ____opt_81.color or ({r = 0.8, g = 0.9, b = 1, a = 0.55})}),
1001
+ false
1002
+ )
1003
+ end
1004
+ end
1005
+ local dispose = source:BindTo(bar, {
1006
+ min = props.min,
1007
+ max = props.max,
1008
+ current = props.current or props.value,
1009
+ onActiveChange = onActiveChange,
1010
+ healPredictionBar = healPredictionBar,
1011
+ absorbPredictionBar = absorbPredictionBar
1012
+ })
1013
+ if dispose ~= nil then
1014
+ local ____tree_bindings_84 = tree.bindings
1015
+ ____tree_bindings_84[#____tree_bindings_84 + 1] = dispose
1016
+ end
446
1017
  else
447
1018
  bar:SetValue(props.current or props.value or 0)
448
1019
  end
@@ -451,30 +1022,64 @@ function ____exports.mount(self, element, parent, rootAnchor)
451
1022
  local function attach(self, decoration)
452
1023
  if decoration ~= nil then
453
1024
  decoration:mount(item.frame, item.width, item.height)
454
- local ____tree_decorations_32 = tree.decorations
455
- ____tree_decorations_32[#____tree_decorations_32 + 1] = decoration
1025
+ local ____tree_decorations_85 = tree.decorations
1026
+ ____tree_decorations_85[#____tree_decorations_85 + 1] = decoration
456
1027
  end
457
1028
  end
458
1029
  local progress = item.cell.kind == "progress" and item.cell.props or nil
459
- local ____attach_40 = attach
460
- local ____temp_39
1030
+ local ____attach_93 = attach
1031
+ local ____temp_92
461
1032
  if (progress and progress.background) == false then
462
- ____temp_39 = nil
1033
+ ____temp_92 = nil
463
1034
  else
464
- ____temp_39 = (progress and progress.background) ~= nil and __TS__New(Background, progress.background) or decorations and decorations.background
1035
+ ____temp_92 = (progress and progress.background) ~= nil and __TS__New(Background, progress.background) or decorations and decorations.background
465
1036
  end
466
- ____attach_40(nil, ____temp_39)
467
- local ____attach_48 = attach
468
- local ____temp_47
1037
+ ____attach_93(nil, ____temp_92)
1038
+ local ____attach_101 = attach
1039
+ local ____temp_100
469
1040
  if (progress and progress.backdrop) == false then
470
- ____temp_47 = nil
1041
+ ____temp_100 = nil
471
1042
  else
472
- ____temp_47 = (progress and progress.backdrop) ~= nil and __TS__New(Border, progress.backdrop) or decorations and decorations.border
1043
+ ____temp_100 = (progress and progress.backdrop) ~= nil and __TS__New(Border, progress.backdrop) or decorations and decorations.border
473
1044
  end
474
- ____attach_48(nil, ____temp_47)
1045
+ ____attach_101(nil, ____temp_100)
475
1046
  attach(nil, decorations and decorations.glow)
476
1047
  mountedFrames:set(item.cell.props, item.frame)
477
- item.frame:Show()
1048
+ refreshVisibility(nil)
1049
+ local ____this_105
1050
+ ____this_105 = item.cell.props
1051
+ local ____opt_104 = ____this_105.onMount
1052
+ local cleanup = ____opt_104 and ____opt_104(____this_105, item.frame)
1053
+ if cleanup ~= nil then
1054
+ local ____tree_bindings_106 = tree.bindings
1055
+ ____tree_bindings_106[#____tree_bindings_106 + 1] = cleanup
1056
+ end
1057
+ if visible ~= nil then
1058
+ updates[#updates + 1] = refreshVisibility
1059
+ end
1060
+ end
1061
+ if #updates > 0 then
1062
+ local driver = CreateFrame("Frame", nil, parent)
1063
+ local ____tree_frames_107 = tree.frames
1064
+ ____tree_frames_107[#____tree_frames_107 + 1] = driver
1065
+ local elapsed = 0
1066
+ driver:SetScript(
1067
+ "OnUpdate",
1068
+ function(_frame, delta)
1069
+ elapsed = elapsed + delta
1070
+ if elapsed < 0.05 then
1071
+ return
1072
+ end
1073
+ elapsed = 0
1074
+ for ____, update in ipairs(updates) do
1075
+ update(nil)
1076
+ end
1077
+ end
1078
+ )
1079
+ for ____, update in ipairs(updates) do
1080
+ update(nil)
1081
+ end
1082
+ driver:Show()
478
1083
  end
479
1084
  end)
480
1085
  if not ____try then