wuira 0.3.2 → 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 (64) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +27 -9
  3. package/docs/source-converters.md +6 -6
  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/NativeNumberSource.d.ts +1 -1
  8. package/lib/datasources/NativeNumberSource.lua +16 -1
  9. package/lib/datasources/ProgressSource.lua +5 -9
  10. package/lib/datasources/Source.d.ts +18 -0
  11. package/lib/datasources/Source.lua +300 -0
  12. package/lib/datasources/SourceConverter.d.ts +1 -1
  13. package/lib/datasources/SourceConverter.lua +10 -1
  14. package/lib/datasources/TextureSource.d.ts +1 -1
  15. package/lib/datasources/TextureSource.lua +16 -1
  16. package/lib/datasources/TimerSource.d.ts +1 -1
  17. package/lib/datasources/TimerSource.lua +16 -1
  18. package/lib/datasources/UseSource.d.ts +49 -0
  19. package/lib/datasources/UseSource.lua +9 -0
  20. package/lib/datasources/index.d.ts +5 -25
  21. package/lib/datasources/index.lua +49 -69
  22. package/lib/helpers/Auras.d.ts +5 -0
  23. package/lib/helpers/Auras.lua +47 -0
  24. package/lib/helpers/Range.d.ts +2 -0
  25. package/lib/helpers/Range.lua +30 -0
  26. package/lib/helpers/index.d.ts +2 -0
  27. package/lib/helpers/index.lua +12 -0
  28. package/lib/index.d.ts +1 -0
  29. package/lib/index.lua +6 -0
  30. package/lib/platform/forever.d.ts +3 -0
  31. package/lib/rendering/progress.lua +5 -150
  32. package/lib/ui/UnitPortrait.d.ts +1 -2
  33. package/lib/ui/UnitPortrait.lua +11 -18
  34. package/package.json +8 -1
  35. package/lib/datasources/AuraTimer.d.ts +0 -21
  36. package/lib/datasources/AuraTimer.lua +0 -322
  37. package/lib/datasources/Auras.d.ts +0 -32
  38. package/lib/datasources/Auras.lua +0 -284
  39. package/lib/datasources/CastTimer.d.ts +0 -9
  40. package/lib/datasources/CastTimer.lua +0 -240
  41. package/lib/datasources/EditModeLayouts.d.ts +0 -33
  42. package/lib/datasources/EditModeLayouts.lua +0 -689
  43. package/lib/datasources/GroupMembers.d.ts +0 -24
  44. package/lib/datasources/GroupMembers.lua +0 -454
  45. package/lib/datasources/GroupRoster.d.ts +0 -28
  46. package/lib/datasources/GroupRoster.lua +0 -611
  47. package/lib/datasources/KnownSpells.d.ts +0 -33
  48. package/lib/datasources/KnownSpells.lua +0 -1068
  49. package/lib/datasources/ManaRegenTimer.d.ts +0 -29
  50. package/lib/datasources/ManaRegenTimer.lua +0 -674
  51. package/lib/datasources/Resources.d.ts +0 -60
  52. package/lib/datasources/Resources.lua +0 -824
  53. package/lib/datasources/SpellCooldown.d.ts +0 -12
  54. package/lib/datasources/SpellCooldown.lua +0 -218
  55. package/lib/datasources/SpellSource.d.ts +0 -14
  56. package/lib/datasources/SpellSource.lua +0 -224
  57. package/lib/datasources/SwingTimer.d.ts +0 -31
  58. package/lib/datasources/SwingTimer.lua +0 -641
  59. package/lib/datasources/TotemTimer.d.ts +0 -10
  60. package/lib/datasources/TotemTimer.lua +0 -260
  61. package/lib/datasources/UnitInfo.d.ts +0 -51
  62. package/lib/datasources/UnitInfo.lua +0 -783
  63. package/lib/datasources/UnitSource.d.ts +0 -38
  64. package/lib/datasources/UnitSource.lua +0 -602
@@ -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
- constructor(spellId: number | string, options?: {
6
- ignoreGCD?: boolean;
7
- });
8
- get IsAvailable(): boolean;
9
- }
10
- export declare class GlobalCooldown extends SpellCooldown {
11
- constructor();
12
- }
@@ -1,218 +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
- -- End of Lua Library inline imports
173
- local ____exports = {}
174
- local ____TimerSource = require("datasources.TimerSource")
175
- local TimerSource = ____TimerSource.TimerSource
176
- --- Native cooldown duration, including opaque timings during combat.
177
- ____exports.SpellCooldown = __TS__Class()
178
- local SpellCooldown = ____exports.SpellCooldown
179
- SpellCooldown.name = "SpellCooldown"
180
- __TS__ClassExtends(SpellCooldown, TimerSource)
181
- function SpellCooldown.prototype.____constructor(self, spellId, options)
182
- if options == nil then
183
- options = {}
184
- end
185
- TimerSource.prototype.____constructor(
186
- self,
187
- function()
188
- local ____opt_0 = C_Spell and C_Spell.GetSpellCooldownDuration
189
- if ____opt_0 ~= nil then
190
- local ____spellId_2 = spellId
191
- local ____options_ignoreGCD_1 = options.ignoreGCD
192
- if ____options_ignoreGCD_1 == nil then
193
- ____options_ignoreGCD_1 = false
194
- end
195
- ____opt_0 = ____opt_0(____spellId_2, ____options_ignoreGCD_1)
196
- end
197
- return ____opt_0
198
- end,
199
- {"SPELL_UPDATE_COOLDOWN", "PLAYER_ENTERING_WORLD", "SPELLS_CHANGED"}
200
- )
201
- self.spellId = spellId
202
- end
203
- __TS__SetDescriptor(
204
- SpellCooldown.prototype,
205
- "IsAvailable",
206
- {get = function(self)
207
- return (C_Spell and C_Spell.GetSpellCooldownDuration) ~= nil
208
- end},
209
- true
210
- )
211
- ____exports.GlobalCooldown = __TS__Class()
212
- local GlobalCooldown = ____exports.GlobalCooldown
213
- GlobalCooldown.name = "GlobalCooldown"
214
- __TS__ClassExtends(GlobalCooldown, ____exports.SpellCooldown)
215
- function GlobalCooldown.prototype.____constructor(self)
216
- GlobalCooldown.____super.prototype.____constructor(self, 61304)
217
- end
218
- 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
- constructor(spellId: number);
11
- protected GetValue(): string | undefined;
12
- get Identifier(): number | string;
13
- get Action(): SecureAction;
14
- }
@@ -1,224 +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 ____TextureSource = require("datasources.TextureSource")
183
- local TextureSource = ____TextureSource.TextureSource
184
- local ____SpellCooldown = require("datasources.SpellCooldown")
185
- local SpellCooldown = ____SpellCooldown.SpellCooldown
186
- --- Localized spell identity, texture and native cooldown, independent of action slots.
187
- ____exports.SpellSource = __TS__Class()
188
- local SpellSource = ____exports.SpellSource
189
- SpellSource.name = "SpellSource"
190
- __TS__ClassExtends(SpellSource, DataSource)
191
- function SpellSource.prototype.____constructor(self, spellId)
192
- DataSource.prototype.____constructor(self, nil)
193
- self.spellId = spellId
194
- self.Texture = __TS__New(
195
- TextureSource,
196
- function()
197
- local ____opt_0 = C_Spell and C_Spell.GetSpellTexture
198
- return ____opt_0 and ____opt_0(spellId)
199
- end,
200
- {"SPELLS_CHANGED", "PLAYER_ENTERING_WORLD"}
201
- )
202
- self.Cooldown = __TS__New(SpellCooldown, self.Identifier, {ignoreGCD = true})
203
- end
204
- function SpellSource.prototype.GetValue(self)
205
- local ____opt_4 = C_Spell and C_Spell.GetSpellName
206
- return ____opt_4 and ____opt_4(self.spellId)
207
- end
208
- __TS__SetDescriptor(
209
- SpellSource.prototype,
210
- "Identifier",
211
- {get = function(self)
212
- return self.Value or self.spellId
213
- end},
214
- true
215
- )
216
- __TS__SetDescriptor(
217
- SpellSource.prototype,
218
- "Action",
219
- {get = function(self)
220
- return {type = "spell", spell = self.Identifier}
221
- end},
222
- true
223
- )
224
- 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
- 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
- }