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
@@ -0,0 +1,322 @@
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__ClassExtends(target, base)
11
+ target.____super = base
12
+ local staticMetatable = setmetatable({__index = base}, base)
13
+ setmetatable(target, staticMetatable)
14
+ local baseMetatable = getmetatable(base)
15
+ if baseMetatable then
16
+ if type(baseMetatable.__index) == "function" then
17
+ staticMetatable.__index = baseMetatable.__index
18
+ end
19
+ if type(baseMetatable.__newindex) == "function" then
20
+ staticMetatable.__newindex = baseMetatable.__newindex
21
+ end
22
+ end
23
+ setmetatable(target.prototype, base.prototype)
24
+ if type(base.prototype.__index) == "function" then
25
+ target.prototype.__index = base.prototype.__index
26
+ end
27
+ if type(base.prototype.__newindex) == "function" then
28
+ target.prototype.__newindex = base.prototype.__newindex
29
+ end
30
+ if type(base.prototype.__tostring) == "function" then
31
+ target.prototype.__tostring = base.prototype.__tostring
32
+ end
33
+ end
34
+
35
+ local function __TS__New(target, ...)
36
+ local instance = setmetatable({}, target.prototype)
37
+ instance:____constructor(...)
38
+ return instance
39
+ end
40
+
41
+ local function __TS__CloneDescriptor(____bindingPattern0)
42
+ local value
43
+ local writable
44
+ local set
45
+ local get
46
+ local configurable
47
+ local enumerable
48
+ enumerable = ____bindingPattern0.enumerable
49
+ configurable = ____bindingPattern0.configurable
50
+ get = ____bindingPattern0.get
51
+ set = ____bindingPattern0.set
52
+ writable = ____bindingPattern0.writable
53
+ value = ____bindingPattern0.value
54
+ local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
55
+ local hasGetterOrSetter = get ~= nil or set ~= nil
56
+ local hasValueOrWritableAttribute = writable ~= nil or value ~= nil
57
+ if hasGetterOrSetter and hasValueOrWritableAttribute then
58
+ error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
59
+ end
60
+ if get or set then
61
+ descriptor.get = get
62
+ descriptor.set = set
63
+ else
64
+ descriptor.value = value
65
+ descriptor.writable = writable == true
66
+ end
67
+ return descriptor
68
+ end
69
+
70
+ local __TS__DescriptorGet
71
+ do
72
+ local getmetatable = _G.getmetatable
73
+ local ____rawget = _G.rawget
74
+ function __TS__DescriptorGet(self, metatable, key)
75
+ while metatable do
76
+ local rawResult = ____rawget(metatable, key)
77
+ if rawResult ~= nil then
78
+ return rawResult
79
+ end
80
+ local descriptors = ____rawget(metatable, "_descriptors")
81
+ if descriptors then
82
+ local descriptor = descriptors[key]
83
+ if descriptor ~= nil then
84
+ if descriptor.get then
85
+ return descriptor.get(self)
86
+ end
87
+ return descriptor.value
88
+ end
89
+ end
90
+ metatable = getmetatable(metatable)
91
+ end
92
+ end
93
+ end
94
+
95
+ local __TS__DescriptorSet
96
+ do
97
+ local getmetatable = _G.getmetatable
98
+ local ____rawget = _G.rawget
99
+ local rawset = _G.rawset
100
+ function __TS__DescriptorSet(self, metatable, key, value)
101
+ while metatable do
102
+ local descriptors = ____rawget(metatable, "_descriptors")
103
+ if descriptors then
104
+ local descriptor = descriptors[key]
105
+ if descriptor ~= nil then
106
+ if descriptor.set then
107
+ descriptor.set(self, value)
108
+ else
109
+ if descriptor.writable == false then
110
+ error(
111
+ ((("Cannot assign to read only property '" .. key) .. "' of object '") .. tostring(self)) .. "'",
112
+ 0
113
+ )
114
+ end
115
+ descriptor.value = value
116
+ end
117
+ return
118
+ end
119
+ end
120
+ metatable = getmetatable(metatable)
121
+ end
122
+ rawset(self, key, value)
123
+ end
124
+ end
125
+
126
+ local __TS__SetDescriptor
127
+ do
128
+ local getmetatable = _G.getmetatable
129
+ local function descriptorIndex(self, key)
130
+ return __TS__DescriptorGet(
131
+ self,
132
+ getmetatable(self),
133
+ key
134
+ )
135
+ end
136
+ local function descriptorNewIndex(self, key, value)
137
+ return __TS__DescriptorSet(
138
+ self,
139
+ getmetatable(self),
140
+ key,
141
+ value
142
+ )
143
+ end
144
+ function __TS__SetDescriptor(target, key, desc, isPrototype)
145
+ if isPrototype == nil then
146
+ isPrototype = false
147
+ end
148
+ local ____isPrototype_0
149
+ if isPrototype then
150
+ ____isPrototype_0 = target
151
+ else
152
+ ____isPrototype_0 = getmetatable(target)
153
+ end
154
+ local metatable = ____isPrototype_0
155
+ if not metatable then
156
+ metatable = {}
157
+ setmetatable(target, metatable)
158
+ end
159
+ if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
160
+ local instanceMetatable = {}
161
+ instanceMetatable._isOwnDescriptorMetatable = true
162
+ setmetatable(instanceMetatable, metatable)
163
+ setmetatable(target, instanceMetatable)
164
+ metatable = instanceMetatable
165
+ end
166
+ local value = rawget(target, key)
167
+ if value ~= nil then
168
+ rawset(target, key, nil)
169
+ end
170
+ if not rawget(metatable, "_descriptors") then
171
+ metatable._descriptors = {}
172
+ end
173
+ metatable._descriptors[key] = __TS__CloneDescriptor(desc)
174
+ metatable.__index = descriptorIndex
175
+ metatable.__newindex = descriptorNewIndex
176
+ end
177
+ end
178
+ -- End of Lua Library inline imports
179
+ local ____exports = {}
180
+ local ____TimerSource = require("datasources.TimerSource")
181
+ local TimerSource = ____TimerSource.TimerSource
182
+ local ____TextureSource = require("datasources.TextureSource")
183
+ local TextureSource = ____TextureSource.TextureSource
184
+ local ____UnitSource = require("datasources.UnitSource")
185
+ local resolveUnit = ____UnitSource.resolveUnit
186
+ --- Selected aura duration and icon; selection policy belongs to the application.
187
+ ____exports.AuraTimer = __TS__Class()
188
+ local AuraTimer = ____exports.AuraTimer
189
+ AuraTimer.name = "AuraTimer"
190
+ __TS__ClassExtends(AuraTimer, TimerSource)
191
+ function AuraTimer.prototype.____constructor(self, unit, options)
192
+ local target = resolveUnit(nil, unit)
193
+ local events = {
194
+ "UNIT_AURA",
195
+ "PLAYER_ENTERING_WORLD",
196
+ "PLAYER_TARGET_CHANGED",
197
+ "PLAYER_FOCUS_CHANGED",
198
+ "SPELLS_CHANGED"
199
+ }
200
+ TimerSource.prototype.____constructor(
201
+ self,
202
+ function() return self:ReadDuration() end,
203
+ events,
204
+ target.Token
205
+ )
206
+ self.options = options
207
+ self.status = "inactive"
208
+ self.target = target
209
+ self.Texture = __TS__New(
210
+ TextureSource,
211
+ function()
212
+ local ____opt_0 = self:ReadAura()
213
+ return ____opt_0 and ____opt_0.icon
214
+ end,
215
+ events,
216
+ target.Token
217
+ )
218
+ end
219
+ function AuraTimer.prototype.ReadAura(self)
220
+ local query = C_UnitAuras and C_UnitAuras.GetAuraDataBySpellName
221
+ local getName = C_Spell and C_Spell.GetSpellName
222
+ if query == nil or getName == nil then
223
+ self.status = "unavailable"
224
+ return nil
225
+ end
226
+ do
227
+ local function ____catch()
228
+ self.status = "unavailable"
229
+ end
230
+ local ____try, ____hasReturned, ____returnValue = pcall(function()
231
+ for ____, id in ipairs(self.options.spellIds) do
232
+ do
233
+ local __continue8
234
+ repeat
235
+ local name = getName(id)
236
+ if issecretvalue(name) then
237
+ self.status = "restricted"
238
+ return true, nil
239
+ end
240
+ if name == nil then
241
+ __continue8 = true
242
+ break
243
+ end
244
+ local aura = query(self.target.Token, name, self.options.filter or "HELPFUL")
245
+ if issecretvalue(aura) then
246
+ self.status = "restricted"
247
+ return true, nil
248
+ end
249
+ if aura ~= nil then
250
+ self.status = "active"
251
+ return true, aura
252
+ end
253
+ __continue8 = true
254
+ until true
255
+ if not __continue8 then
256
+ break
257
+ end
258
+ end
259
+ end
260
+ local ____opt_6 = C_Secrets and C_Secrets.ShouldAurasBeSecret
261
+ local restricted = ____opt_6 and ____opt_6()
262
+ self.status = (issecretvalue(restricted) or restricted == true) and "restricted" or "inactive"
263
+ end)
264
+ if not ____try then
265
+ ____hasReturned, ____returnValue = ____catch()
266
+ end
267
+ if ____hasReturned then
268
+ return ____returnValue
269
+ end
270
+ end
271
+ return nil
272
+ end
273
+ function AuraTimer.prototype.ReadDuration(self)
274
+ local aura = self:ReadAura()
275
+ if aura == nil then
276
+ return nil
277
+ end
278
+ do
279
+ local function ____catch()
280
+ self.status = "unavailable"
281
+ return true, nil
282
+ end
283
+ local ____try, ____hasReturned, ____returnValue = pcall(function()
284
+ local id = aura.auraInstanceID
285
+ if (C_UnitAuras and C_UnitAuras.GetAuraDuration) ~= nil and (issecretvalue(id) or id ~= nil) then
286
+ return true, C_UnitAuras.GetAuraDuration(self.target.Token, id)
287
+ end
288
+ local total = aura.duration
289
+ local ____end = aura.expirationTime
290
+ if issecretvalue(total) or issecretvalue(____end) then
291
+ self.status = "restricted"
292
+ return true, nil
293
+ end
294
+ if total == nil or ____end == nil or total <= 0 then
295
+ return true, nil
296
+ end
297
+ if C_DurationUtil == nil then
298
+ self.status = "unavailable"
299
+ return true, nil
300
+ end
301
+ local timer = C_DurationUtil.CreateDuration()
302
+ timer:SetTimeFromStart(____end - total, total)
303
+ return true, timer
304
+ end)
305
+ if not ____try then
306
+ ____hasReturned, ____returnValue = ____catch()
307
+ end
308
+ if ____hasReturned then
309
+ return ____returnValue
310
+ end
311
+ end
312
+ end
313
+ __TS__SetDescriptor(
314
+ AuraTimer.prototype,
315
+ "Status",
316
+ {get = function(self)
317
+ self:ReadAura()
318
+ return self.status
319
+ end},
320
+ true
321
+ )
322
+ return ____exports
@@ -0,0 +1,9 @@
1
+ import { TimerSource } from "./TimerSource";
2
+ import { UnitSource } from "./UnitSource";
3
+ import type { UnitInput } from "./UnitSource";
4
+ /** Remaining cast/channel time using the native duration object. */
5
+ export declare class CastTimer extends TimerSource {
6
+ readonly target: UnitSource;
7
+ get SpellName(): string;
8
+ constructor(unit?: UnitInput);
9
+ }
@@ -0,0 +1,240 @@
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__ClassExtends(target, base)
11
+ target.____super = base
12
+ local staticMetatable = setmetatable({__index = base}, base)
13
+ setmetatable(target, staticMetatable)
14
+ local baseMetatable = getmetatable(base)
15
+ if baseMetatable then
16
+ if type(baseMetatable.__index) == "function" then
17
+ staticMetatable.__index = baseMetatable.__index
18
+ end
19
+ if type(baseMetatable.__newindex) == "function" then
20
+ staticMetatable.__newindex = baseMetatable.__newindex
21
+ end
22
+ end
23
+ setmetatable(target.prototype, base.prototype)
24
+ if type(base.prototype.__index) == "function" then
25
+ target.prototype.__index = base.prototype.__index
26
+ end
27
+ if type(base.prototype.__newindex) == "function" then
28
+ target.prototype.__newindex = base.prototype.__newindex
29
+ end
30
+ if type(base.prototype.__tostring) == "function" then
31
+ target.prototype.__tostring = base.prototype.__tostring
32
+ end
33
+ end
34
+
35
+ local __TS__Unpack = table.unpack or unpack
36
+
37
+ local function __TS__CloneDescriptor(____bindingPattern0)
38
+ local value
39
+ local writable
40
+ local set
41
+ local get
42
+ local configurable
43
+ local enumerable
44
+ enumerable = ____bindingPattern0.enumerable
45
+ configurable = ____bindingPattern0.configurable
46
+ get = ____bindingPattern0.get
47
+ set = ____bindingPattern0.set
48
+ writable = ____bindingPattern0.writable
49
+ value = ____bindingPattern0.value
50
+ local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
51
+ local hasGetterOrSetter = get ~= nil or set ~= nil
52
+ local hasValueOrWritableAttribute = writable ~= nil or value ~= nil
53
+ if hasGetterOrSetter and hasValueOrWritableAttribute then
54
+ error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
55
+ end
56
+ if get or set then
57
+ descriptor.get = get
58
+ descriptor.set = set
59
+ else
60
+ descriptor.value = value
61
+ descriptor.writable = writable == true
62
+ end
63
+ return descriptor
64
+ end
65
+
66
+ local __TS__DescriptorGet
67
+ do
68
+ local getmetatable = _G.getmetatable
69
+ local ____rawget = _G.rawget
70
+ function __TS__DescriptorGet(self, metatable, key)
71
+ while metatable do
72
+ local rawResult = ____rawget(metatable, key)
73
+ if rawResult ~= nil then
74
+ return rawResult
75
+ end
76
+ local descriptors = ____rawget(metatable, "_descriptors")
77
+ if descriptors then
78
+ local descriptor = descriptors[key]
79
+ if descriptor ~= nil then
80
+ if descriptor.get then
81
+ return descriptor.get(self)
82
+ end
83
+ return descriptor.value
84
+ end
85
+ end
86
+ metatable = getmetatable(metatable)
87
+ end
88
+ end
89
+ end
90
+
91
+ local __TS__DescriptorSet
92
+ do
93
+ local getmetatable = _G.getmetatable
94
+ local ____rawget = _G.rawget
95
+ local rawset = _G.rawset
96
+ function __TS__DescriptorSet(self, metatable, key, value)
97
+ while metatable do
98
+ local descriptors = ____rawget(metatable, "_descriptors")
99
+ if descriptors then
100
+ local descriptor = descriptors[key]
101
+ if descriptor ~= nil then
102
+ if descriptor.set then
103
+ descriptor.set(self, value)
104
+ else
105
+ if descriptor.writable == false then
106
+ error(
107
+ ((("Cannot assign to read only property '" .. key) .. "' of object '") .. tostring(self)) .. "'",
108
+ 0
109
+ )
110
+ end
111
+ descriptor.value = value
112
+ end
113
+ return
114
+ end
115
+ end
116
+ metatable = getmetatable(metatable)
117
+ end
118
+ rawset(self, key, value)
119
+ end
120
+ end
121
+
122
+ local __TS__SetDescriptor
123
+ do
124
+ local getmetatable = _G.getmetatable
125
+ local function descriptorIndex(self, key)
126
+ return __TS__DescriptorGet(
127
+ self,
128
+ getmetatable(self),
129
+ key
130
+ )
131
+ end
132
+ local function descriptorNewIndex(self, key, value)
133
+ return __TS__DescriptorSet(
134
+ self,
135
+ getmetatable(self),
136
+ key,
137
+ value
138
+ )
139
+ end
140
+ function __TS__SetDescriptor(target, key, desc, isPrototype)
141
+ if isPrototype == nil then
142
+ isPrototype = false
143
+ end
144
+ local ____isPrototype_0
145
+ if isPrototype then
146
+ ____isPrototype_0 = target
147
+ else
148
+ ____isPrototype_0 = getmetatable(target)
149
+ end
150
+ local metatable = ____isPrototype_0
151
+ if not metatable then
152
+ metatable = {}
153
+ setmetatable(target, metatable)
154
+ end
155
+ if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
156
+ local instanceMetatable = {}
157
+ instanceMetatable._isOwnDescriptorMetatable = true
158
+ setmetatable(instanceMetatable, metatable)
159
+ setmetatable(target, instanceMetatable)
160
+ metatable = instanceMetatable
161
+ end
162
+ local value = rawget(target, key)
163
+ if value ~= nil then
164
+ rawset(target, key, nil)
165
+ end
166
+ if not rawget(metatable, "_descriptors") then
167
+ metatable._descriptors = {}
168
+ end
169
+ metatable._descriptors[key] = __TS__CloneDescriptor(desc)
170
+ metatable.__index = descriptorIndex
171
+ metatable.__newindex = descriptorNewIndex
172
+ end
173
+ end
174
+ -- End of Lua Library inline imports
175
+ local ____exports = {}
176
+ local ____TimerSource = require("datasources.TimerSource")
177
+ local TimerSource = ____TimerSource.TimerSource
178
+ local ____UnitSource = require("datasources.UnitSource")
179
+ local Unit = ____UnitSource.Unit
180
+ local resolveUnit = ____UnitSource.resolveUnit
181
+ --- Remaining cast/channel time using the native duration object.
182
+ ____exports.CastTimer = __TS__Class()
183
+ local CastTimer = ____exports.CastTimer
184
+ CastTimer.name = "CastTimer"
185
+ __TS__ClassExtends(CastTimer, TimerSource)
186
+ function CastTimer.prototype.____constructor(self, unit)
187
+ if unit == nil then
188
+ unit = Unit.Player
189
+ end
190
+ local target = resolveUnit(nil, unit)
191
+ if UnitCastingDuration == nil or UnitChannelDuration == nil then
192
+ error("CastTimer: native cast/channel durations are unavailable")
193
+ end
194
+ TimerSource.prototype.____constructor(
195
+ self,
196
+ function()
197
+ local casting = UnitCastingDuration(target.Token)
198
+ if issecretvalue(casting) or casting ~= nil then
199
+ return casting
200
+ end
201
+ return UnitChannelDuration(target.Token)
202
+ end,
203
+ {
204
+ "UNIT_SPELLCAST_START",
205
+ "UNIT_SPELLCAST_STOP",
206
+ "UNIT_SPELLCAST_DELAYED",
207
+ "UNIT_SPELLCAST_INTERRUPTED",
208
+ "UNIT_SPELLCAST_FAILED",
209
+ "UNIT_SPELLCAST_SUCCEEDED",
210
+ "UNIT_SPELLCAST_CHANNEL_START",
211
+ "UNIT_SPELLCAST_CHANNEL_UPDATE",
212
+ "UNIT_SPELLCAST_CHANNEL_STOP",
213
+ "PLAYER_ENTERING_WORLD",
214
+ "PLAYER_TARGET_CHANGED",
215
+ "PLAYER_FOCUS_CHANGED"
216
+ },
217
+ target.Token
218
+ )
219
+ self.target = target
220
+ end
221
+ __TS__SetDescriptor(
222
+ CastTimer.prototype,
223
+ "SpellName",
224
+ {get = function(self)
225
+ local casting = __TS__Unpack(UnitCastingInfo ~= nil and ({UnitCastingInfo(self.target.Token)}) or ({nil}))
226
+ if issecretvalue(casting) then
227
+ return casting
228
+ end
229
+ if casting ~= nil then
230
+ return casting
231
+ end
232
+ local channel = __TS__Unpack(UnitChannelInfo ~= nil and ({UnitChannelInfo(self.target.Token)}) or ({nil}))
233
+ if issecretvalue(channel) then
234
+ return channel
235
+ end
236
+ return channel or ""
237
+ end},
238
+ true
239
+ )
240
+ return ____exports
@@ -2,12 +2,16 @@
2
2
  export declare abstract class DataSource<T> {
3
3
  private value;
4
4
  private secret;
5
+ private conditions?;
5
6
  protected constructor(value: T, secret?: boolean);
6
7
  /** Checked when consumed, rather than inferred from combat state. */
7
8
  IsSecret(): boolean;
8
9
  get Value(): T;
9
10
  Compute<TResult>(compute: (value: T) => TResult): TResult;
10
11
  protected GetValue(): T;
12
+ /** Filters native binding emissions; Value remains a checked, fresh snapshot. */
13
+ When(condition: (value: T) => boolean): this;
14
+ protected CanEmit(value: T): boolean;
11
15
  private IsValueSecret;
12
16
  /** Replace the value and its explicit restriction together, clearing stale flags. */
13
17
  protected SetValue(value: T, secret?: boolean): void;
@@ -168,6 +168,30 @@ end
168
168
  function DataSource.prototype.GetValue(self)
169
169
  return self.value
170
170
  end
171
+ function DataSource.prototype.When(self, condition)
172
+ local ____self_0, ____conditions_1 = self, "conditions"
173
+ if ____self_0[____conditions_1] == nil then
174
+ ____self_0[____conditions_1] = {}
175
+ end
176
+ local ____self_conditions_3 = self.conditions
177
+ ____self_conditions_3[#____self_conditions_3 + 1] = condition
178
+ return self
179
+ end
180
+ function DataSource.prototype.CanEmit(self, value)
181
+ if self.conditions == nil then
182
+ return true
183
+ end
184
+ if self:IsValueSecret(value) then
185
+ return false
186
+ end
187
+ for ____, condition in ipairs(self.conditions) do
188
+ local result = condition(nil, value)
189
+ if issecretvalue(result) or not result then
190
+ return false
191
+ end
192
+ end
193
+ return true
194
+ end
171
195
  function DataSource.prototype.IsValueSecret(self, value)
172
196
  return issecretvalue(value) or self.secret or self:HasSecretFields(value)
173
197
  end
@@ -0,0 +1,21 @@
1
+ import { DataSource } from "./DataSource";
2
+ export type KnownSpellsStatus = "ready" | "unavailable" | "restricted";
3
+ /** Cached learned player spellbook IDs. Native events refresh the snapshot; no polling. */
4
+ export declare class KnownSpells extends DataSource<readonly number[]> {
5
+ private ids;
6
+ private names;
7
+ private status;
8
+ private readonly listeners;
9
+ private readonly frame;
10
+ private disposed;
11
+ constructor();
12
+ get Status(): KnownSpellsStatus;
13
+ protected GetValue(): readonly number[];
14
+ protected HasSecretFields(): boolean;
15
+ /** Representative enum IDs match any learned rank through its localized name. */
16
+ Has(spell: number | string): boolean;
17
+ /** No initial emission; only changed, readable snapshots reach observers. */
18
+ onChange(listener: (spells: readonly number[]) => void): () => void;
19
+ private Refresh;
20
+ Dispose(): void;
21
+ }