wuira 0.3.3 → 0.4.0

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 (52) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +15 -12
  3. package/docs/source-converters.md +5 -5
  4. package/docs/spells.md +1 -1
  5. package/lib/datasources/NativeApi.d.ts +319 -0
  6. package/lib/datasources/NativeApi.lua +1114 -0
  7. package/lib/datasources/UseSource.d.ts +41 -43
  8. package/lib/datasources/index.d.ts +3 -25
  9. package/lib/datasources/index.lua +45 -74
  10. package/lib/helpers/Auras.d.ts +5 -0
  11. package/lib/helpers/Auras.lua +47 -0
  12. package/lib/helpers/Range.d.ts +2 -0
  13. package/lib/helpers/Range.lua +30 -0
  14. package/lib/helpers/index.d.ts +2 -0
  15. package/lib/helpers/index.lua +12 -0
  16. package/lib/index.d.ts +1 -0
  17. package/lib/index.lua +6 -0
  18. package/lib/platform/forever.d.ts +3 -0
  19. package/lib/rendering/progress.lua +5 -150
  20. package/lib/ui/UnitPortrait.d.ts +1 -2
  21. package/lib/ui/UnitPortrait.lua +11 -18
  22. package/package.json +8 -1
  23. package/lib/datasources/AuraTimer.d.ts +0 -21
  24. package/lib/datasources/AuraTimer.lua +0 -334
  25. package/lib/datasources/Auras.d.ts +0 -32
  26. package/lib/datasources/Auras.lua +0 -300
  27. package/lib/datasources/CastTimer.d.ts +0 -9
  28. package/lib/datasources/CastTimer.lua +0 -255
  29. package/lib/datasources/EditModeLayouts.d.ts +0 -33
  30. package/lib/datasources/EditModeLayouts.lua +0 -698
  31. package/lib/datasources/GroupMembers.d.ts +0 -24
  32. package/lib/datasources/GroupMembers.lua +0 -477
  33. package/lib/datasources/GroupRoster.d.ts +0 -28
  34. package/lib/datasources/GroupRoster.lua +0 -622
  35. package/lib/datasources/KnownSpells.d.ts +0 -33
  36. package/lib/datasources/KnownSpells.lua +0 -1077
  37. package/lib/datasources/ManaRegenTimer.d.ts +0 -29
  38. package/lib/datasources/ManaRegenTimer.lua +0 -683
  39. package/lib/datasources/Resources.d.ts +0 -81
  40. package/lib/datasources/Resources.lua +0 -907
  41. package/lib/datasources/SpellCooldown.d.ts +0 -12
  42. package/lib/datasources/SpellCooldown.lua +0 -240
  43. package/lib/datasources/SpellSource.d.ts +0 -14
  44. package/lib/datasources/SpellSource.lua +0 -236
  45. package/lib/datasources/SwingTimer.d.ts +0 -31
  46. package/lib/datasources/SwingTimer.lua +0 -650
  47. package/lib/datasources/TotemTimer.d.ts +0 -10
  48. package/lib/datasources/TotemTimer.lua +0 -275
  49. package/lib/datasources/UnitInfo.d.ts +0 -51
  50. package/lib/datasources/UnitInfo.lua +0 -801
  51. package/lib/datasources/UnitSource.d.ts +0 -38
  52. package/lib/datasources/UnitSource.lua +0 -613
@@ -1,12 +0,0 @@
1
- import { TimerSource } from "./TimerSource";
2
- /** Native cooldown duration, including opaque timings during combat. */
3
- export declare class SpellCooldown extends TimerSource {
4
- readonly spellId: number | string;
5
- protected constructor(spellId: number | string, options?: {
6
- ignoreGCD?: boolean;
7
- });
8
- get IsAvailable(): boolean;
9
- }
10
- export declare class GlobalCooldown extends SpellCooldown {
11
- protected constructor();
12
- }
@@ -1,240 +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 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__CloneDescriptor(____bindingPattern0)
36
- local value
37
- local writable
38
- local set
39
- local get
40
- local configurable
41
- local enumerable
42
- enumerable = ____bindingPattern0.enumerable
43
- configurable = ____bindingPattern0.configurable
44
- get = ____bindingPattern0.get
45
- set = ____bindingPattern0.set
46
- writable = ____bindingPattern0.writable
47
- value = ____bindingPattern0.value
48
- local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
49
- local hasGetterOrSetter = get ~= nil or set ~= nil
50
- local hasValueOrWritableAttribute = writable ~= nil or value ~= nil
51
- if hasGetterOrSetter and hasValueOrWritableAttribute then
52
- error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
53
- end
54
- if get or set then
55
- descriptor.get = get
56
- descriptor.set = set
57
- else
58
- descriptor.value = value
59
- descriptor.writable = writable == true
60
- end
61
- return descriptor
62
- end
63
-
64
- local __TS__DescriptorGet
65
- do
66
- local getmetatable = _G.getmetatable
67
- local ____rawget = _G.rawget
68
- function __TS__DescriptorGet(self, metatable, key)
69
- while metatable do
70
- local rawResult = ____rawget(metatable, key)
71
- if rawResult ~= nil then
72
- return rawResult
73
- end
74
- local descriptors = ____rawget(metatable, "_descriptors")
75
- if descriptors then
76
- local descriptor = descriptors[key]
77
- if descriptor ~= nil then
78
- if descriptor.get then
79
- return descriptor.get(self)
80
- end
81
- return descriptor.value
82
- end
83
- end
84
- metatable = getmetatable(metatable)
85
- end
86
- end
87
- end
88
-
89
- local __TS__DescriptorSet
90
- do
91
- local getmetatable = _G.getmetatable
92
- local ____rawget = _G.rawget
93
- local rawset = _G.rawset
94
- function __TS__DescriptorSet(self, metatable, key, value)
95
- while metatable do
96
- local descriptors = ____rawget(metatable, "_descriptors")
97
- if descriptors then
98
- local descriptor = descriptors[key]
99
- if descriptor ~= nil then
100
- if descriptor.set then
101
- descriptor.set(self, value)
102
- else
103
- if descriptor.writable == false then
104
- error(
105
- ((("Cannot assign to read only property '" .. key) .. "' of object '") .. tostring(self)) .. "'",
106
- 0
107
- )
108
- end
109
- descriptor.value = value
110
- end
111
- return
112
- end
113
- end
114
- metatable = getmetatable(metatable)
115
- end
116
- rawset(self, key, value)
117
- end
118
- end
119
-
120
- local __TS__SetDescriptor
121
- do
122
- local getmetatable = _G.getmetatable
123
- local function descriptorIndex(self, key)
124
- return __TS__DescriptorGet(
125
- self,
126
- getmetatable(self),
127
- key
128
- )
129
- end
130
- local function descriptorNewIndex(self, key, value)
131
- return __TS__DescriptorSet(
132
- self,
133
- getmetatable(self),
134
- key,
135
- value
136
- )
137
- end
138
- function __TS__SetDescriptor(target, key, desc, isPrototype)
139
- if isPrototype == nil then
140
- isPrototype = false
141
- end
142
- local ____isPrototype_0
143
- if isPrototype then
144
- ____isPrototype_0 = target
145
- else
146
- ____isPrototype_0 = getmetatable(target)
147
- end
148
- local metatable = ____isPrototype_0
149
- if not metatable then
150
- metatable = {}
151
- setmetatable(target, metatable)
152
- end
153
- if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
154
- local instanceMetatable = {}
155
- instanceMetatable._isOwnDescriptorMetatable = true
156
- setmetatable(instanceMetatable, metatable)
157
- setmetatable(target, instanceMetatable)
158
- metatable = instanceMetatable
159
- end
160
- local value = rawget(target, key)
161
- if value ~= nil then
162
- rawset(target, key, nil)
163
- end
164
- if not rawget(metatable, "_descriptors") then
165
- metatable._descriptors = {}
166
- end
167
- metatable._descriptors[key] = __TS__CloneDescriptor(desc)
168
- metatable.__index = descriptorIndex
169
- metatable.__newindex = descriptorNewIndex
170
- end
171
- end
172
-
173
- local function __TS__New(target, ...)
174
- local instance = setmetatable({}, target.prototype)
175
- instance:____constructor(...)
176
- return instance
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 ____Source = require("datasources.Source")
183
- local registerSource = ____Source.registerSource
184
- --- Native cooldown duration, including opaque timings during combat.
185
- ____exports.SpellCooldown = __TS__Class()
186
- local SpellCooldown = ____exports.SpellCooldown
187
- SpellCooldown.name = "SpellCooldown"
188
- __TS__ClassExtends(SpellCooldown, TimerSource)
189
- function SpellCooldown.prototype.____constructor(self, spellId, options)
190
- if options == nil then
191
- options = {}
192
- end
193
- TimerSource.prototype.____constructor(
194
- self,
195
- function()
196
- local ____opt_0 = C_Spell and C_Spell.GetSpellCooldownDuration
197
- if ____opt_0 ~= nil then
198
- local ____spellId_2 = spellId
199
- local ____options_ignoreGCD_1 = options.ignoreGCD
200
- if ____options_ignoreGCD_1 == nil then
201
- ____options_ignoreGCD_1 = false
202
- end
203
- ____opt_0 = ____opt_0(____spellId_2, ____options_ignoreGCD_1)
204
- end
205
- return ____opt_0
206
- end,
207
- {"SPELL_UPDATE_COOLDOWN", "PLAYER_ENTERING_WORLD", "SPELLS_CHANGED"}
208
- )
209
- self.spellId = spellId
210
- end
211
- __TS__SetDescriptor(
212
- SpellCooldown.prototype,
213
- "IsAvailable",
214
- {get = function(self)
215
- return (C_Spell and C_Spell.GetSpellCooldownDuration) ~= nil
216
- end},
217
- true
218
- );
219
- (function(self)
220
- registerSource(
221
- nil,
222
- ____exports.SpellCooldown,
223
- function(____, props) return __TS__New(____exports.SpellCooldown, props[1], props[2]) end
224
- )
225
- end)(SpellCooldown)
226
- ____exports.GlobalCooldown = __TS__Class()
227
- local GlobalCooldown = ____exports.GlobalCooldown
228
- GlobalCooldown.name = "GlobalCooldown"
229
- __TS__ClassExtends(GlobalCooldown, ____exports.SpellCooldown)
230
- function GlobalCooldown.prototype.____constructor(self)
231
- GlobalCooldown.____super.prototype.____constructor(self, 61304)
232
- end;
233
- (function(self)
234
- registerSource(
235
- nil,
236
- ____exports.GlobalCooldown,
237
- function() return __TS__New(____exports.GlobalCooldown) end
238
- )
239
- end)(GlobalCooldown)
240
- return ____exports
@@ -1,14 +0,0 @@
1
- import { DataSource } from "./DataSource";
2
- import { TextureSource } from "./TextureSource";
3
- import { SpellCooldown } from "./SpellCooldown";
4
- import type { SecureAction } from "../ui/SecureButton";
5
- /** Localized spell identity, texture and native cooldown, independent of action slots. */
6
- export declare class SpellSource extends DataSource<string | undefined> {
7
- readonly spellId: number;
8
- readonly Texture: TextureSource;
9
- readonly Cooldown: SpellCooldown;
10
- protected constructor(spellId: number);
11
- protected GetValue(): string | undefined;
12
- get Identifier(): number | string;
13
- get Action(): SecureAction;
14
- }
@@ -1,236 +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 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 ____DataSource = require("datasources.DataSource")
181
- local DataSource = ____DataSource.DataSource
182
- local ____Source = require("datasources.Source")
183
- local registerSource = ____Source.registerSource
184
- local ____UseSource = require("datasources.UseSource")
185
- local UseSource = ____UseSource.UseSource
186
- local ____TextureSource = require("datasources.TextureSource")
187
- local TextureSource = ____TextureSource.TextureSource
188
- local ____SpellCooldown = require("datasources.SpellCooldown")
189
- local SpellCooldown = ____SpellCooldown.SpellCooldown
190
- --- Localized spell identity, texture and native cooldown, independent of action slots.
191
- ____exports.SpellSource = __TS__Class()
192
- local SpellSource = ____exports.SpellSource
193
- SpellSource.name = "SpellSource"
194
- __TS__ClassExtends(SpellSource, DataSource)
195
- function SpellSource.prototype.____constructor(self, spellId)
196
- DataSource.prototype.____constructor(self, nil)
197
- self.spellId = spellId
198
- self.Texture = UseSource(
199
- nil,
200
- TextureSource,
201
- function()
202
- local ____opt_0 = C_Spell and C_Spell.GetSpellTexture
203
- return ____opt_0 and ____opt_0(spellId)
204
- end,
205
- {"SPELLS_CHANGED", "PLAYER_ENTERING_WORLD"}
206
- )
207
- self.Cooldown = UseSource(nil, SpellCooldown, self.Identifier, {ignoreGCD = true})
208
- end
209
- function SpellSource.prototype.GetValue(self)
210
- local ____opt_4 = C_Spell and C_Spell.GetSpellName
211
- return ____opt_4 and ____opt_4(self.spellId)
212
- end;
213
- (function(self)
214
- registerSource(
215
- nil,
216
- ____exports.SpellSource,
217
- function(____, props) return __TS__New(____exports.SpellSource, props[1]) end
218
- )
219
- end)(SpellSource)
220
- __TS__SetDescriptor(
221
- SpellSource.prototype,
222
- "Identifier",
223
- {get = function(self)
224
- return self.Value or self.spellId
225
- end},
226
- true
227
- )
228
- __TS__SetDescriptor(
229
- SpellSource.prototype,
230
- "Action",
231
- {get = function(self)
232
- return {type = "spell", spell = self.Identifier}
233
- end},
234
- true
235
- )
236
- return ____exports
@@ -1,31 +0,0 @@
1
- import { ProgressSource } from "./ProgressSource";
2
- import type { ProgressOverrides } from "./ProgressSource";
3
- export declare const SwingHand: {
4
- readonly MainHand: "MainHand";
5
- readonly OffHand: "OffHand";
6
- readonly Ranged: "Ranged";
7
- };
8
- export type SwingHand = typeof SwingHand[keyof typeof SwingHand];
9
- /** Player-only countdown driven by Forever's native PLAYER_SWING event. */
10
- export declare class SwingTimer extends ProgressSource {
11
- readonly hand: SwingHand;
12
- private duration;
13
- private endTime;
14
- private known;
15
- private restricted;
16
- private events?;
17
- private readonly bindings;
18
- protected constructor(hand?: SwingHand);
19
- /** False until a readable swing event is received, including after reload/reset. */
20
- get HasTiming(): boolean;
21
- get IsActive(): boolean;
22
- protected HasSecretFields(): boolean;
23
- private Remaining;
24
- Start(): void;
25
- private Reset;
26
- private Notify;
27
- BindTo(frame: wuiraNativeStatusBar, options?: ProgressOverrides): () => void;
28
- protected Listen(): void;
29
- /** Dispose when the owning feature is removed; unmount only detaches its bars. */
30
- Dispose(): void;
31
- }