wuira 0.2.0 → 0.2.1

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/lib/ui/mount.lua DELETED
@@ -1,1107 +0,0 @@
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 __TS__Symbol, Symbol
11
- do
12
- local symbolMetatable = {__tostring = function(self)
13
- return ("Symbol(" .. (self.description or "")) .. ")"
14
- end}
15
- function __TS__Symbol(description)
16
- return setmetatable({description = description}, symbolMetatable)
17
- end
18
- Symbol = {
19
- asyncDispose = __TS__Symbol("Symbol.asyncDispose"),
20
- dispose = __TS__Symbol("Symbol.dispose"),
21
- iterator = __TS__Symbol("Symbol.iterator"),
22
- hasInstance = __TS__Symbol("Symbol.hasInstance"),
23
- species = __TS__Symbol("Symbol.species"),
24
- toStringTag = __TS__Symbol("Symbol.toStringTag")
25
- }
26
- end
27
-
28
- local __TS__Iterator
29
- do
30
- local function iteratorGeneratorStep(self)
31
- local co = self.____coroutine
32
- local status, value = coroutine.resume(co)
33
- if not status then
34
- error(value, 0)
35
- end
36
- if coroutine.status(co) == "dead" then
37
- return
38
- end
39
- return true, value
40
- end
41
- local function iteratorIteratorStep(self)
42
- local result = self:next()
43
- if result.done then
44
- return
45
- end
46
- return true, result.value
47
- end
48
- local function iteratorStringStep(self, index)
49
- index = index + 1
50
- if index > #self then
51
- return
52
- end
53
- return index, string.sub(self, index, index)
54
- end
55
- function __TS__Iterator(iterable)
56
- if type(iterable) == "string" then
57
- return iteratorStringStep, iterable, 0
58
- elseif iterable.____coroutine ~= nil then
59
- return iteratorGeneratorStep, iterable
60
- elseif iterable[Symbol.iterator] then
61
- local iterator = iterable[Symbol.iterator](iterable)
62
- return iteratorIteratorStep, iterator
63
- else
64
- return ipairs(iterable)
65
- end
66
- end
67
- end
68
-
69
- local Map
70
- do
71
- Map = __TS__Class()
72
- Map.name = "Map"
73
- function Map.prototype.____constructor(self, entries)
74
- self[Symbol.toStringTag] = "Map"
75
- self.items = {}
76
- self.size = 0
77
- self.nextKey = {}
78
- self.previousKey = {}
79
- if entries == nil then
80
- return
81
- end
82
- local iterable = entries
83
- if iterable[Symbol.iterator] then
84
- local iterator = iterable[Symbol.iterator](iterable)
85
- while true do
86
- local result = iterator:next()
87
- if result.done then
88
- break
89
- end
90
- local value = result.value
91
- self:set(value[1], value[2])
92
- end
93
- else
94
- local array = entries
95
- for ____, kvp in ipairs(array) do
96
- self:set(kvp[1], kvp[2])
97
- end
98
- end
99
- end
100
- function Map.prototype.clear(self)
101
- self.items = {}
102
- self.nextKey = {}
103
- self.previousKey = {}
104
- self.firstKey = nil
105
- self.lastKey = nil
106
- self.size = 0
107
- end
108
- function Map.prototype.delete(self, key)
109
- local contains = self:has(key)
110
- if contains then
111
- self.size = self.size - 1
112
- local next = self.nextKey[key]
113
- local previous = self.previousKey[key]
114
- if next ~= nil and previous ~= nil then
115
- self.nextKey[previous] = next
116
- self.previousKey[next] = previous
117
- elseif next ~= nil then
118
- self.firstKey = next
119
- self.previousKey[next] = nil
120
- elseif previous ~= nil then
121
- self.lastKey = previous
122
- self.nextKey[previous] = nil
123
- else
124
- self.firstKey = nil
125
- self.lastKey = nil
126
- end
127
- self.nextKey[key] = nil
128
- self.previousKey[key] = nil
129
- end
130
- self.items[key] = nil
131
- return contains
132
- end
133
- function Map.prototype.forEach(self, callback)
134
- for ____, key in __TS__Iterator(self:keys()) do
135
- callback(nil, self.items[key], key, self)
136
- end
137
- end
138
- function Map.prototype.get(self, key)
139
- return self.items[key]
140
- end
141
- function Map.prototype.has(self, key)
142
- return self.nextKey[key] ~= nil or self.lastKey == key
143
- end
144
- function Map.prototype.set(self, key, value)
145
- local isNewValue = not self:has(key)
146
- if isNewValue then
147
- self.size = self.size + 1
148
- end
149
- self.items[key] = value
150
- if self.firstKey == nil then
151
- self.firstKey = key
152
- self.lastKey = key
153
- elseif isNewValue then
154
- self.nextKey[self.lastKey] = key
155
- self.previousKey[key] = self.lastKey
156
- self.lastKey = key
157
- end
158
- return self
159
- end
160
- Map.prototype[Symbol.iterator] = function(self)
161
- return self:entries()
162
- end
163
- function Map.prototype.entries(self)
164
- local function getFirstKey()
165
- return self.firstKey
166
- end
167
- local items = self.items
168
- local nextKey = self.nextKey
169
- local key
170
- local started = false
171
- return {
172
- [Symbol.iterator] = function(self)
173
- return self
174
- end,
175
- next = function(self)
176
- if not started then
177
- started = true
178
- key = getFirstKey(nil)
179
- else
180
- key = nextKey[key]
181
- end
182
- return {done = not key, value = {key, items[key]}}
183
- end
184
- }
185
- end
186
- function Map.prototype.keys(self)
187
- local function getFirstKey()
188
- return self.firstKey
189
- end
190
- local nextKey = self.nextKey
191
- local key
192
- local started = false
193
- return {
194
- [Symbol.iterator] = function(self)
195
- return self
196
- end,
197
- next = function(self)
198
- if not started then
199
- started = true
200
- key = getFirstKey(nil)
201
- else
202
- key = nextKey[key]
203
- end
204
- return {done = not key, value = key}
205
- end
206
- }
207
- end
208
- function Map.prototype.values(self)
209
- local function getFirstKey()
210
- return self.firstKey
211
- end
212
- local items = self.items
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 = items[key]}
228
- end
229
- }
230
- end
231
- Map[Symbol.species] = Map
232
- end
233
-
234
- local function __TS__New(target, ...)
235
- local instance = setmetatable({}, target.prototype)
236
- instance:____constructor(...)
237
- return instance
238
- end
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
-
453
- local function __TS__ArrayMap(self, callbackfn, thisArg)
454
- local result = {}
455
- for i = 1, #self do
456
- result[i] = callbackfn(thisArg, self[i], i - 1, self)
457
- end
458
- return result
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
496
- -- End of Lua Library inline imports
497
- local ____exports = {}
498
- local protect, mountedFrames, mountedTrees
499
- local ____measureLayout = require("ui.layout.measureLayout")
500
- local measureLayout = ____measureLayout.measureLayout
501
- local ____Background = require("ui.decorations.Background")
502
- local Background = ____Background.Background
503
- local ____Border = require("ui.decorations.Border")
504
- local Border = ____Border.Border
505
- local ____statusBarTextures = require("ui.decorations.statusBarTextures")
506
- local resolveStatusBarTexture = ____statusBarTextures.resolveStatusBarTexture
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
546
- function ____exports.unmount(self, frame)
547
- local tree = mountedTrees:get(frame)
548
- if tree == nil then
549
- return
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
558
- for ____, decoration in ipairs(tree.decorations) do
559
- decoration:dispose()
560
- end
561
- for ____, child in ipairs(tree.frames) do
562
- child:UnregisterAllEvents()
563
- child:SetScript("OnEvent", nil)
564
- child:SetScript("OnUpdate", nil)
565
- child:Hide()
566
- end
567
- for ____, cell in ipairs(tree.cells) do
568
- mountedFrames:delete(cell.props)
569
- end
570
- mountedTrees:delete(frame)
571
- end
572
- mountedFrames = __TS__New(Map)
573
- mountedTrees = __TS__New(Map)
574
- --- Creates the tree before resolving anchors. Positive y moves down.
575
- function ____exports.mount(self, element, parent, rootAnchor)
576
- if parent == nil then
577
- parent = UIParent
578
- end
579
- local frames = __TS__New(Map)
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
620
- local function create(self, measured, parent, placement)
621
- local ____measured_8 = measured
622
- local cell = ____measured_8.cell
623
- local width = ____measured_8.width
624
- local height = ____measured_8.height
625
- if frames:has(cell.props) or mountedFrames:has(cell.props) then
626
- error("A Cell can only be mounted once at a time")
627
- end
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)))
629
- frame:Hide()
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
638
- end
639
- ____frame_EnableMouse_11(frame, ____temp_10)
640
- frames:set(cell.props, frame)
641
- pending[#pending + 1] = {
642
- cell = cell,
643
- width = width,
644
- height = height,
645
- margin = measured.margin,
646
- frame = frame,
647
- parent = parent,
648
- placement = placement
649
- }
650
- frame:SetSize(width, height)
651
- do
652
- local index = 0
653
- while index < #measured.children do
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])
658
- index = index + 1
659
- end
660
- end
661
- return frame
662
- end
663
- local root = create(nil, measured, parent)
664
- local anchors = __TS__New(Map)
665
- for ____, item in ipairs(pending) do
666
- local position = item.cell.props
667
- if item.placement ~= nil then
668
- anchors:set(item.frame, item.parent)
669
- elseif position.mode == "absolute" then
670
- anchors:set(item.frame, UIParent)
671
- else
672
- local target = position.relativeTo == nil and item.parent or frames:get(position.relativeTo.props)
673
- if target == nil then
674
- error("relativeTo must reference a Cell in the same mounted tree")
675
- end
676
- if target == item.frame then
677
- error("A Cell cannot anchor to itself")
678
- end
679
- anchors:set(item.frame, target)
680
- end
681
- end
682
- for ____, item in ipairs(pending) do
683
- local target = anchors:get(item.frame)
684
- while target ~= nil do
685
- if target == item.frame then
686
- error("Cell positioning contains an anchor cycle")
687
- end
688
- target = anchors:get(target)
689
- end
690
- end
691
- local tree = {
692
- frames = __TS__ArrayMap(
693
- pending,
694
- function(____, item) return item.frame end
695
- ),
696
- cells = __TS__ArrayMap(
697
- pending,
698
- function(____, item) return item.cell end
699
- ),
700
- decorations = {},
701
- bindings = {},
702
- protected = protectedTree,
703
- pendingUnmount = false,
704
- visibility = {}
705
- }
706
- mountedTrees:set(root, tree)
707
- do
708
- local function ____catch(failure)
709
- ____exports.unmount(nil, root)
710
- error(failure, 0)
711
- end
712
- local ____try, ____hasReturned = pcall(function()
713
- local updates = {}
714
- protect(nil, root, tree)
715
- for ____, item in ipairs(pending) do
716
- local sourceActive = true
717
- local lastVisible
718
- local visible = item.cell.props.visible
719
- local condition = item.cell.props.condition
720
- local function refreshVisibility()
721
- if protect(nil, root, tree) and InCombatLockdown() then
722
- return
723
- end
724
- local ____sourceActive_18 = sourceActive
725
- if ____sourceActive_18 then
726
- local ____temp_17
727
- if type(condition) == "function" then
728
- ____temp_17 = condition(nil)
729
- else
730
- local ____condition_16 = condition
731
- if ____condition_16 == nil then
732
- ____condition_16 = true
733
- end
734
- ____temp_17 = ____condition_16
735
- end
736
- ____sourceActive_18 = ____temp_17
737
- end
738
- local allowed = ____sourceActive_18
739
- local ____temp_22 = not issecretvalue(allowed) and allowed
740
- if ____temp_22 then
741
- local ____temp_21 = visible and visible(nil)
742
- if ____temp_21 == nil then
743
- ____temp_21 = true
744
- end
745
- ____temp_22 = ____temp_21
746
- end
747
- local value = ____temp_22
748
- if value == lastVisible then
749
- return
750
- end
751
- lastVisible = value
752
- if value then
753
- item.frame:Show()
754
- else
755
- item.frame:Hide()
756
- end
757
- end
758
- local ____tree_visibility_23 = tree.visibility
759
- ____tree_visibility_23[#____tree_visibility_23 + 1] = refreshVisibility
760
- local function onActiveChange(____, active)
761
- sourceActive = active
762
- refreshVisibility(nil)
763
- end
764
- local position = item.cell.props
765
- if position.alpha ~= nil then
766
- local alpha = position.alpha
767
- local previous
768
- local function refreshAlpha()
769
- local value = type(alpha) == "function" and alpha(nil) or alpha
770
- if issecretvalue(value) then
771
- return
772
- end
773
- if not __TS__NumberIsFinite(value) or value < 0 or value > 1 then
774
- error("Cell alpha must be between 0 and 1")
775
- end
776
- if value ~= previous then
777
- item.frame:SetAlpha(value)
778
- end
779
- previous = value
780
- end
781
- refreshAlpha(nil)
782
- if type(alpha) == "function" then
783
- updates[#updates + 1] = refreshAlpha
784
- end
785
- end
786
- local target = anchors:get(item.frame)
787
- local ____opt_24 = item.placement
788
- local x = ____opt_24 and ____opt_24.x or (position.mode == "absolute" and position.x or position.offset.x)
789
- local ____opt_26 = item.placement
790
- local y = ____opt_26 and ____opt_26.y or (position.mode == "absolute" and position.y or position.offset.y)
791
- local ____temp_28
792
- if item.frame == root then
793
- ____temp_28 = rootAnchor
794
- else
795
- ____temp_28 = nil
796
- end
797
- local overrideAnchor = ____temp_28
798
- local anchor = overrideAnchor or (item.placement ~= nil and "TOPLEFT" or (position.anchor or "TOPLEFT"))
799
- local relativeAnchor = overrideAnchor or (item.placement ~= nil and "TOPLEFT" or (position.relativeAnchor or anchor))
800
- item.frame:SetPoint(
801
- anchor,
802
- target,
803
- relativeAnchor,
804
- x + item.margin.left,
805
- -(y + item.margin.top)
806
- )
807
- if item.cell.kind == "secureButton" then
808
- local props = item.cell.props
809
- local ____tree_bindings_29 = tree.bindings
810
- ____tree_bindings_29[#____tree_bindings_29 + 1] = configureSecureButton(nil, item.frame, props)
811
- if props.cooldown ~= nil then
812
- local cooldown = CreateFrame("Cooldown", nil, item.frame, "CooldownFrameTemplate")
813
- local ____tree_frames_30 = tree.frames
814
- ____tree_frames_30[#____tree_frames_30 + 1] = cooldown
815
- cooldown:EnableMouse(false)
816
- cooldown:SetAllPoints(item.frame)
817
- cooldown:SetFrameLevel(item.frame:GetFrameLevel() + 2)
818
- cooldown:SetDrawSwipe(true)
819
- cooldown:SetDrawEdge(false)
820
- local ____cooldown_SetDrawBling_32 = cooldown.SetDrawBling
821
- local ____props_finishGlow_31 = props.finishGlow
822
- if ____props_finishGlow_31 == nil then
823
- ____props_finishGlow_31 = false
824
- end
825
- ____cooldown_SetDrawBling_32(cooldown, ____props_finishGlow_31)
826
- cooldown:SetHideCountdownNumbers(false)
827
- cooldown:SetSwipeColor(0, 0, 0, 0.7)
828
- cooldown:GetCountdownFontString():SetFont("Fonts\\FRIZQT__.TTF", 13, "OUTLINE")
829
- local ____tree_bindings_33 = tree.bindings
830
- ____tree_bindings_33[#____tree_bindings_33 + 1] = props.cooldown:BindCooldown(cooldown)
831
- end
832
- if props.binding ~= nil and props.showHotkey ~= false then
833
- local overlay = CreateFrame("Frame", nil, item.frame)
834
- local ____tree_frames_34 = tree.frames
835
- ____tree_frames_34[#____tree_frames_34 + 1] = overlay
836
- overlay:EnableMouse(false)
837
- overlay:SetAllPoints(item.frame)
838
- overlay:SetFrameLevel(item.frame:GetFrameLevel() + 3)
839
- local hotkey = overlay:CreateFontString(nil, "OVERLAY")
840
- hotkey:SetAllPoints(overlay)
841
- hotkey:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE")
842
- hotkey:SetJustifyH("RIGHT")
843
- hotkey:SetJustifyV("TOP")
844
- hotkey:SetTextColor(1, 1, 1, 1)
845
- hotkey:SetText(props.binding)
846
- end
847
- end
848
- if item.cell.kind == "button" then
849
- local onClick = item.cell.props.onClick
850
- local ____self_36 = item.frame
851
- local ____self_36_SetScript_37 = ____self_36.SetScript
852
- local ____temp_35
853
- if onClick == nil then
854
- ____temp_35 = nil
855
- else
856
- ____temp_35 = function() return onClick(nil) end
857
- end
858
- ____self_36_SetScript_37(____self_36, "OnClick", ____temp_35)
859
- local ____tree_bindings_38 = tree.bindings
860
- ____tree_bindings_38[#____tree_bindings_38 + 1] = function() return item.frame:SetScript("OnClick", nil) end
861
- end
862
- if item.cell.kind == "label" then
863
- local props = item.cell.props
864
- local label = item.frame:CreateFontString(nil, "OVERLAY")
865
- label:SetAllPoints(item.frame)
866
- label:SetFont(props.font or "Fonts\\FRIZQT__.TTF", props.fontSize or 12, "OUTLINE")
867
- label:SetJustifyH(props.align or "LEFT")
868
- label:SetJustifyV("MIDDLE")
869
- local color = props.color
870
- 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)
871
- local text = props.text
872
- if type(text) == "function" then
873
- local previous
874
- updates[#updates + 1] = function()
875
- local value = text(nil)
876
- if issecretvalue(value) or value ~= previous then
877
- label:SetText(value)
878
- end
879
- if not issecretvalue(value) then
880
- previous = value
881
- end
882
- end
883
- else
884
- label:SetText(text)
885
- end
886
- end
887
- if item.cell.kind == "icon" then
888
- local props = item.cell.props
889
- local texture = item.frame:CreateTexture(nil, "OVERLAY")
890
- texture:SetAllPoints(item.frame)
891
- local uv = props.texCoords or ({0, 1, 0, 1})
892
- texture:SetTexCoord(uv[1], uv[2], uv[3], uv[4])
893
- texture:SetTexture(props.texture)
894
- local ____opt_47 = props.textureSource
895
- if ____opt_47 ~= nil then
896
- ____opt_47:BindTo(item.frame, texture, onActiveChange)
897
- end
898
- end
899
- if item.cell.kind == "progress" then
900
- local props = item.cell.props
901
- local bar = item.frame
902
- local ____opt_49 = props.foreground
903
- local color = ____opt_49 and ____opt_49.color or props.color
904
- local ____bar_SetStatusBarTexture_54 = bar.SetStatusBarTexture
905
- local ____resolveStatusBarTexture_53 = resolveStatusBarTexture
906
- local ____opt_51 = props.foreground
907
- ____bar_SetStatusBarTexture_54(
908
- bar,
909
- ____resolveStatusBarTexture_53(nil, ____opt_51 and ____opt_51.texture or props.texture or "solid")
910
- )
911
- 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)
912
- if props.foreground ~= nil then
913
- local fill = bar:GetStatusBarTexture()
914
- local ____fill_SetHorizTile_64 = fill.SetHorizTile
915
- local ____props_foreground_tileX_63 = props.foreground.tileX
916
- if ____props_foreground_tileX_63 == nil then
917
- ____props_foreground_tileX_63 = false
918
- end
919
- ____fill_SetHorizTile_64(fill, ____props_foreground_tileX_63)
920
- local ____fill_SetVertTile_66 = fill.SetVertTile
921
- local ____props_foreground_tileY_65 = props.foreground.tileY
922
- if ____props_foreground_tileY_65 == nil then
923
- ____props_foreground_tileY_65 = false
924
- end
925
- ____fill_SetVertTile_66(fill, ____props_foreground_tileY_65)
926
- fill:SetBlendMode(props.foreground.blendMode or "BLEND")
927
- local uv = props.foreground.texCoords or ({0, 1, 0, 1})
928
- fill:SetTexCoord(uv[1], uv[2], uv[3], uv[4])
929
- end
930
- bar:SetOrientation(props.orientation == "vertical" and "VERTICAL" or "HORIZONTAL")
931
- local ____bar_SetReverseFill_68 = bar.SetReverseFill
932
- local ____props_reverse_67 = props.reverse
933
- if ____props_reverse_67 == nil then
934
- ____props_reverse_67 = false
935
- end
936
- ____bar_SetReverseFill_68(bar, ____props_reverse_67)
937
- bar:SetMinMaxValues(props.min or 0, props.max or 100)
938
- local source = item.cell.source or props.source
939
- if source ~= nil then
940
- local healPredictionBar
941
- local absorbPredictionBar
942
- if __TS__InstanceOf(source, HP) then
943
- local function overlay(____, style, heal)
944
- bar:SetClipsChildren(true)
945
- local layer = CreateFrame("StatusBar", nil, bar)
946
- local ____tree_frames_69 = tree.frames
947
- ____tree_frames_69[#____tree_frames_69 + 1] = layer
948
- layer:EnableMouse(false)
949
- layer:SetFrameLevel(bar:GetFrameLevel())
950
- layer:SetSize(item.width, item.height)
951
- layer:SetStatusBarTexture(resolveStatusBarTexture(nil, style.texture or "solid"))
952
- local tint = style.color
953
- layer:SetStatusBarColor(tint.r, tint.g, tint.b, tint.a or 0.5)
954
- local texture = layer:GetStatusBarTexture()
955
- texture:SetBlendMode(style.blendMode or "BLEND")
956
- local ____texture_SetHorizTile_71 = texture.SetHorizTile
957
- local ____style_tileX_70 = style.tileX
958
- if ____style_tileX_70 == nil then
959
- ____style_tileX_70 = false
960
- end
961
- ____texture_SetHorizTile_71(texture, ____style_tileX_70)
962
- local ____texture_SetVertTile_73 = texture.SetVertTile
963
- local ____style_tileY_72 = style.tileY
964
- if ____style_tileY_72 == nil then
965
- ____style_tileY_72 = false
966
- end
967
- ____texture_SetVertTile_73(texture, ____style_tileY_72)
968
- local uv = style.texCoords or ({0, 1, 0, 1})
969
- texture:SetTexCoord(uv[1], uv[2], uv[3], uv[4])
970
- local vertical = props.orientation == "vertical"
971
- local ____props_reverse_74 = props.reverse
972
- if ____props_reverse_74 == nil then
973
- ____props_reverse_74 = false
974
- end
975
- local reverse = ____props_reverse_74
976
- layer:SetOrientation(vertical and "VERTICAL" or "HORIZONTAL")
977
- local ____layer_SetReverseFill_76 = layer.SetReverseFill
978
- local ____heal_75
979
- if heal then
980
- ____heal_75 = reverse
981
- else
982
- ____heal_75 = not reverse
983
- end
984
- ____layer_SetReverseFill_76(layer, ____heal_75)
985
- if heal then
986
- local point = vertical and (reverse and "TOPLEFT" or "BOTTOMLEFT") or (reverse and "TOPRIGHT" or "TOPLEFT")
987
- local relative = vertical and (reverse and "BOTTOMLEFT" or "TOPLEFT") or (reverse and "TOPLEFT" or "TOPRIGHT")
988
- layer:SetPoint(
989
- point,
990
- bar:GetStatusBarTexture(),
991
- relative,
992
- 0,
993
- 0
994
- )
995
- else
996
- layer:SetAllPoints(bar)
997
- end
998
- return layer
999
- end
1000
- local ____opt_77 = source.HealPrediction
1001
- if (____opt_77 and ____opt_77.IsAvailable) == true and props.healPrediction ~= false then
1002
- local ____props_healPrediction_81 = props.healPrediction
1003
- local ____opt_79 = props.healPrediction
1004
- healPredictionBar = overlay(
1005
- nil,
1006
- __TS__ObjectAssign({}, ____props_healPrediction_81, {color = ____opt_79 and ____opt_79.color or ({r = 0.4, g = 1, b = 0.5, a = 0.5})}),
1007
- true
1008
- )
1009
- end
1010
- local ____opt_82 = source.AbsorbPrediction
1011
- if (____opt_82 and ____opt_82.IsAvailable) == true and props.absorbPrediction ~= false then
1012
- local ____props_absorbPrediction_86 = props.absorbPrediction
1013
- local ____opt_84 = props.absorbPrediction
1014
- absorbPredictionBar = overlay(
1015
- nil,
1016
- __TS__ObjectAssign({}, ____props_absorbPrediction_86, {color = ____opt_84 and ____opt_84.color or ({r = 0.8, g = 0.9, b = 1, a = 0.55})}),
1017
- false
1018
- )
1019
- end
1020
- end
1021
- local dispose = source:BindTo(bar, {
1022
- min = props.min,
1023
- max = props.max,
1024
- current = props.current or props.value,
1025
- onActiveChange = onActiveChange,
1026
- healPredictionBar = healPredictionBar,
1027
- absorbPredictionBar = absorbPredictionBar
1028
- })
1029
- if dispose ~= nil then
1030
- local ____tree_bindings_87 = tree.bindings
1031
- ____tree_bindings_87[#____tree_bindings_87 + 1] = dispose
1032
- end
1033
- else
1034
- bar:SetValue(props.current or props.value or 0)
1035
- end
1036
- end
1037
- local decorations = item.cell.props.decorations
1038
- local function attach(self, decoration)
1039
- if decoration ~= nil then
1040
- decoration:mount(item.frame, item.width, item.height)
1041
- local ____tree_decorations_88 = tree.decorations
1042
- ____tree_decorations_88[#____tree_decorations_88 + 1] = decoration
1043
- end
1044
- end
1045
- local progress = item.cell.kind == "progress" and item.cell.props or nil
1046
- local ____attach_96 = attach
1047
- local ____temp_95
1048
- if (progress and progress.background) == false then
1049
- ____temp_95 = nil
1050
- else
1051
- ____temp_95 = (progress and progress.background) ~= nil and __TS__New(Background, progress.background) or decorations and decorations.background
1052
- end
1053
- ____attach_96(nil, ____temp_95)
1054
- local ____attach_104 = attach
1055
- local ____temp_103
1056
- if (progress and progress.backdrop) == false then
1057
- ____temp_103 = nil
1058
- else
1059
- ____temp_103 = (progress and progress.backdrop) ~= nil and __TS__New(Border, progress.backdrop) or decorations and decorations.border
1060
- end
1061
- ____attach_104(nil, ____temp_103)
1062
- attach(nil, decorations and decorations.glow)
1063
- mountedFrames:set(item.cell.props, item.frame)
1064
- refreshVisibility(nil)
1065
- local ____this_108
1066
- ____this_108 = item.cell.props
1067
- local ____opt_107 = ____this_108.onMount
1068
- local cleanup = ____opt_107 and ____opt_107(____this_108, item.frame)
1069
- if cleanup ~= nil then
1070
- local ____tree_bindings_109 = tree.bindings
1071
- ____tree_bindings_109[#____tree_bindings_109 + 1] = cleanup
1072
- end
1073
- if visible ~= nil or type(condition) == "function" then
1074
- updates[#updates + 1] = refreshVisibility
1075
- end
1076
- end
1077
- if #updates > 0 then
1078
- local driver = CreateFrame("Frame", nil, parent)
1079
- local ____tree_frames_110 = tree.frames
1080
- ____tree_frames_110[#____tree_frames_110 + 1] = driver
1081
- local elapsed = 0
1082
- driver:SetScript(
1083
- "OnUpdate",
1084
- function(_frame, delta)
1085
- elapsed = elapsed + delta
1086
- if elapsed < 0.05 then
1087
- return
1088
- end
1089
- elapsed = 0
1090
- for ____, update in ipairs(updates) do
1091
- update(nil)
1092
- end
1093
- end
1094
- )
1095
- for ____, update in ipairs(updates) do
1096
- update(nil)
1097
- end
1098
- driver:Show()
1099
- end
1100
- end)
1101
- if not ____try then
1102
- ____catch(____hasReturned)
1103
- end
1104
- end
1105
- return root
1106
- end
1107
- return ____exports