wuira 0.1.5 → 0.1.7

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 (63) hide show
  1. package/CHANGELOG.md +70 -1
  2. package/README.md +242 -0
  3. package/lib/Spells.d.ts +11 -0
  4. package/lib/Spells.lua +22 -0
  5. package/lib/datasources/KnownSpells.d.ts +21 -0
  6. package/lib/datasources/KnownSpells.lua +794 -0
  7. package/lib/datasources/ManaRegenTimer.d.ts +29 -0
  8. package/lib/datasources/ManaRegenTimer.lua +674 -0
  9. package/lib/datasources/ProgressSource.lua +15 -2
  10. package/lib/datasources/Resources.d.ts +13 -1
  11. package/lib/datasources/Resources.lua +118 -39
  12. package/lib/datasources/SpellCooldown.d.ts +4 -2
  13. package/lib/datasources/SpellCooldown.lua +13 -2
  14. package/lib/datasources/SpellSource.d.ts +14 -0
  15. package/lib/datasources/SpellSource.lua +224 -0
  16. package/lib/datasources/TimerSource.d.ts +2 -0
  17. package/lib/datasources/TimerSource.lua +54 -0
  18. package/lib/datasources/TotemTimer.d.ts +10 -0
  19. package/lib/datasources/TotemTimer.lua +260 -0
  20. package/lib/datasources/index.d.ts +7 -0
  21. package/lib/datasources/index.lua +16 -0
  22. package/lib/index.d.ts +8 -0
  23. package/lib/index.lua +16 -0
  24. package/lib/platform/ActionBars.d.ts +27 -0
  25. package/lib/platform/ActionBars.lua +726 -0
  26. package/lib/platform/AddonSettings.d.ts +9 -0
  27. package/lib/platform/AddonSettings.lua +36 -0
  28. package/lib/platform/BlizzardUI.d.ts +5 -0
  29. package/lib/platform/BlizzardUI.lua +357 -20
  30. package/lib/platform/MicroMenu.d.ts +15 -0
  31. package/lib/platform/MicroMenu.lua +219 -0
  32. package/lib/platform/SecureButton.d.ts +5 -0
  33. package/lib/platform/SecureButton.lua +196 -0
  34. package/lib/platform/SlashCommands.d.ts +3 -0
  35. package/lib/platform/SlashCommands.lua +309 -0
  36. package/lib/platform/forever.d.ts +78 -3
  37. package/lib/skins/MicroBar.d.ts +8 -0
  38. package/lib/skins/MicroBar.lua +65 -0
  39. package/lib/skins/NativeSkin.d.ts +26 -0
  40. package/lib/skins/NativeSkin.lua +601 -0
  41. package/lib/skins/index.d.ts +3 -0
  42. package/lib/skins/index.lua +11 -0
  43. package/lib/store/index.lua +13 -0
  44. package/lib/ui/Button.d.ts +10 -0
  45. package/lib/ui/Button.lua +9 -0
  46. package/lib/ui/Cell.d.ts +5 -1
  47. package/lib/ui/FrameMover.d.ts +21 -0
  48. package/lib/ui/FrameMover.lua +123 -0
  49. package/lib/ui/HoverTracker.d.ts +20 -0
  50. package/lib/ui/HoverTracker.lua +88 -0
  51. package/lib/ui/KeybindCapture.d.ts +20 -0
  52. package/lib/ui/KeybindCapture.lua +488 -0
  53. package/lib/ui/SecureButton.d.ts +44 -0
  54. package/lib/ui/SecureButton.lua +9 -0
  55. package/lib/ui/index.d.ts +9 -0
  56. package/lib/ui/index.lua +20 -0
  57. package/lib/ui/layout/measureLayout.lua +4 -2
  58. package/lib/ui/mount.lua +500 -117
  59. package/lib/ui/primitives/jsx.d.ts +9 -1
  60. package/lib/wuira.d.ts +3 -0
  61. package/lib/wuira.lua +5 -0
  62. package/package.json +8 -1
  63. package/tools/build-library.mjs +1 -1
@@ -0,0 +1,260 @@
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
+ --- Player-owned ground effects exposed by the game's totem API, across spell ranks.
177
+ ____exports.TotemTimer = __TS__Class()
178
+ local TotemTimer = ____exports.TotemTimer
179
+ TotemTimer.name = "TotemTimer"
180
+ __TS__ClassExtends(TotemTimer, TimerSource)
181
+ function TotemTimer.prototype.____constructor(self, spell)
182
+ TimerSource.prototype.____constructor(
183
+ self,
184
+ function() return self:ReadDuration() end,
185
+ {"PLAYER_TOTEM_UPDATE", "PLAYER_ENTERING_WORLD", "PLAYER_REGEN_ENABLED", "SPELLS_CHANGED"}
186
+ )
187
+ self.spell = spell
188
+ self.status = "inactive"
189
+ end
190
+ function TotemTimer.prototype.ReadDuration(self)
191
+ if GetTotemInfo == nil or GetTotemDuration == nil or GetNumTotemSlots == nil then
192
+ self.status = "unavailable"
193
+ return nil
194
+ end
195
+ local ____temp_4
196
+ if type(self.spell) == "string" then
197
+ ____temp_4 = self.spell
198
+ else
199
+ local ____opt_0 = C_Spell and C_Spell.GetSpellName
200
+ ____temp_4 = ____opt_0 and ____opt_0(self.spell)
201
+ end
202
+ local name = ____temp_4
203
+ if issecretvalue(name) then
204
+ self.status = "restricted"
205
+ return nil
206
+ end
207
+ local slots = GetNumTotemSlots()
208
+ if issecretvalue(slots) then
209
+ self.status = "restricted"
210
+ return nil
211
+ end
212
+ local restricted = false
213
+ do
214
+ local slot = 1
215
+ while slot <= slots do
216
+ do
217
+ local __continue9
218
+ repeat
219
+ local active, effectName, ____, ____, ____, ____, spellId = GetTotemInfo(slot)
220
+ if issecretvalue(active) then
221
+ restricted = true
222
+ __continue9 = true
223
+ break
224
+ end
225
+ if not active then
226
+ __continue9 = true
227
+ break
228
+ end
229
+ local sameId = not issecretvalue(spellId) and spellId == self.spell
230
+ local sameName = not issecretvalue(effectName) and name ~= nil and effectName == name
231
+ if not sameId and not sameName then
232
+ if issecretvalue(spellId) or issecretvalue(effectName) then
233
+ restricted = true
234
+ end
235
+ __continue9 = true
236
+ break
237
+ end
238
+ self.status = "active"
239
+ return GetTotemDuration(slot)
240
+ until true
241
+ if not __continue9 then
242
+ break
243
+ end
244
+ end
245
+ slot = slot + 1
246
+ end
247
+ end
248
+ self.status = restricted and "restricted" or "inactive"
249
+ return nil
250
+ end
251
+ __TS__SetDescriptor(
252
+ TotemTimer.prototype,
253
+ "Status",
254
+ {get = function(self)
255
+ self:ReadDuration()
256
+ return self.status
257
+ end},
258
+ true
259
+ )
260
+ return ____exports
@@ -12,9 +12,16 @@ export { UnitSource } from "./UnitSource";
12
12
  export type { UnitInput, UnitIdentity } from "./UnitSource";
13
13
  export { SwingTimer, SwingHand } from "./SwingTimer";
14
14
  export { TimerSource } from "./TimerSource";
15
+ export { TotemTimer } from "./TotemTimer";
16
+ export type { TotemTimerStatus } from "./TotemTimer";
15
17
  export type { NativeDuration } from "./TimerSource";
16
18
  export { TextureSource } from "./TextureSource";
17
19
  export { CastTimer } from "./CastTimer";
18
20
  export { AuraTimer } from "./AuraTimer";
19
21
  export type { AuraTimerOptions, AuraTimerStatus } from "./AuraTimer";
20
22
  export { SpellCooldown, GlobalCooldown } from "./SpellCooldown";
23
+ export { SpellSource } from "./SpellSource";
24
+ export { KnownSpells } from "./KnownSpells";
25
+ export type { KnownSpellsStatus } from "./KnownSpells";
26
+ export { ManaRegenTimer } from "./ManaRegenTimer";
27
+ export type { ManaRegenPhase } from "./ManaRegenTimer";
@@ -48,6 +48,10 @@ do
48
48
  local ____TimerSource = require("datasources.TimerSource")
49
49
  ____exports.TimerSource = ____TimerSource.TimerSource
50
50
  end
51
+ do
52
+ local ____TotemTimer = require("datasources.TotemTimer")
53
+ ____exports.TotemTimer = ____TotemTimer.TotemTimer
54
+ end
51
55
  do
52
56
  local ____TextureSource = require("datasources.TextureSource")
53
57
  ____exports.TextureSource = ____TextureSource.TextureSource
@@ -65,4 +69,16 @@ do
65
69
  ____exports.SpellCooldown = ____SpellCooldown.SpellCooldown
66
70
  ____exports.GlobalCooldown = ____SpellCooldown.GlobalCooldown
67
71
  end
72
+ do
73
+ local ____SpellSource = require("datasources.SpellSource")
74
+ ____exports.SpellSource = ____SpellSource.SpellSource
75
+ end
76
+ do
77
+ local ____KnownSpells = require("datasources.KnownSpells")
78
+ ____exports.KnownSpells = ____KnownSpells.KnownSpells
79
+ end
80
+ do
81
+ local ____ManaRegenTimer = require("datasources.ManaRegenTimer")
82
+ ____exports.ManaRegenTimer = ____ManaRegenTimer.ManaRegenTimer
83
+ end
68
84
  return ____exports
package/lib/index.d.ts CHANGED
@@ -1,10 +1,18 @@
1
1
  /// <reference path="./platform/forever.d.ts" />
2
2
  import "./console-polyfill";
3
3
  export { wuira } from "./wuira";
4
+ export type { CommandCallback } from "./platform/SlashCommands";
5
+ export { AddonSettings } from "./platform/AddonSettings";
4
6
  export { Spells } from "./Spells";
5
7
  export { BlizzardUI } from "./platform/BlizzardUI";
8
+ export { ActionBars } from "./platform/ActionBars";
9
+ export type { ActionSlot, EmptyActionBarsOptions } from "./platform/ActionBars";
6
10
  export type { BlizzardUIOptions } from "./platform/BlizzardUI";
11
+ export type { MicroMenuSkinOptions } from "./platform/MicroMenu";
7
12
  export { UI } from "./ui/primitives/jsx";
13
+ export { HoverTracker } from "./ui/HoverTracker";
14
+ export type { HoverTrackerOptions, HoverFrame } from "./ui/HoverTracker";
15
+ export { MicroBar } from "./skins/MicroBar";
8
16
  export type { Element, Component } from "./ui/primitives/jsx";
9
17
  export type { Cell } from "./ui/Cell";
10
18
  export { Store, StoreRegistry } from "./store";
package/lib/index.lua CHANGED
@@ -5,6 +5,10 @@ do
5
5
  local ____wuira = require("wuira")
6
6
  ____exports.wuira = ____wuira.wuira
7
7
  end
8
+ do
9
+ local ____AddonSettings = require("platform.AddonSettings")
10
+ ____exports.AddonSettings = ____AddonSettings.AddonSettings
11
+ end
8
12
  do
9
13
  local ____Spells = require("Spells")
10
14
  ____exports.Spells = ____Spells.Spells
@@ -13,10 +17,22 @@ do
13
17
  local ____BlizzardUI = require("platform.BlizzardUI")
14
18
  ____exports.BlizzardUI = ____BlizzardUI.BlizzardUI
15
19
  end
20
+ do
21
+ local ____ActionBars = require("platform.ActionBars")
22
+ ____exports.ActionBars = ____ActionBars.ActionBars
23
+ end
16
24
  do
17
25
  local ____jsx = require("ui.primitives.jsx")
18
26
  ____exports.UI = ____jsx.UI
19
27
  end
28
+ do
29
+ local ____HoverTracker = require("ui.HoverTracker")
30
+ ____exports.HoverTracker = ____HoverTracker.HoverTracker
31
+ end
32
+ do
33
+ local ____MicroBar = require("skins.MicroBar")
34
+ ____exports.MicroBar = ____MicroBar.MicroBar
35
+ end
20
36
  do
21
37
  local ____store = require("store.index")
22
38
  ____exports.Store = ____store.Store
@@ -0,0 +1,27 @@
1
+ import type { SavedStoreOptions } from "../store";
2
+ export interface ActionSlot {
3
+ slot: number;
4
+ type: "spell" | "item" | "macro";
5
+ id: number;
6
+ subtype?: string;
7
+ }
8
+ export interface EmptyActionBarsOptions extends SavedStoreOptions {
9
+ clearCommand: string;
10
+ restoreCommand: string;
11
+ }
12
+ /** Explicit destructive action-slot operations. Persist Capture() before Clear(). */
13
+ export declare class ActionBars {
14
+ private constructor();
15
+ static readonly SlotCount = 180;
16
+ private static AssertReady;
17
+ private static Pickup;
18
+ private static Validate;
19
+ static Capture(): ActionSlot[];
20
+ static Clear(backup: readonly Readonly<ActionSlot>[]): void;
21
+ /** Restore only into empty or identical slots; never replace newly assigned actions. */
22
+ static Restore(backup: readonly Readonly<ActionSlot>[]): void;
23
+ /** Hide stock bars independently of slot changes. Clear/restore run only from slash commands.
24
+ * Declare options.variable in SavedVariablesPerCharacter in the addon's TOC.
25
+ */
26
+ static InstallEmptyMode(options: EmptyActionBarsOptions): () => void;
27
+ }