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.
- package/CHANGELOG.md +102 -1
- package/README.md +347 -0
- package/lib/Spells.d.ts +21 -0
- package/lib/Spells.lua +41 -0
- package/lib/datasources/AuraTimer.d.ts +21 -0
- package/lib/datasources/AuraTimer.lua +322 -0
- package/lib/datasources/CastTimer.d.ts +9 -0
- package/lib/datasources/CastTimer.lua +240 -0
- package/lib/datasources/DataSource.d.ts +4 -0
- package/lib/datasources/DataSource.lua +24 -0
- package/lib/datasources/KnownSpells.d.ts +21 -0
- package/lib/datasources/KnownSpells.lua +794 -0
- package/lib/datasources/ManaRegenTimer.d.ts +29 -0
- package/lib/datasources/ManaRegenTimer.lua +674 -0
- package/lib/datasources/ProgressSource.d.ts +6 -2
- package/lib/datasources/ProgressSource.lua +34 -3
- package/lib/datasources/Resources.d.ts +33 -2
- package/lib/datasources/Resources.lua +562 -10
- package/lib/datasources/SpellCooldown.d.ts +12 -0
- package/lib/datasources/SpellCooldown.lua +218 -0
- package/lib/datasources/SpellSource.d.ts +14 -0
- package/lib/datasources/SpellSource.lua +224 -0
- package/lib/datasources/SwingTimer.d.ts +31 -0
- package/lib/datasources/SwingTimer.lua +641 -0
- package/lib/datasources/TextureSource.d.ts +10 -0
- package/lib/datasources/TextureSource.lua +83 -0
- package/lib/datasources/TimerSource.d.ts +20 -0
- package/lib/datasources/TimerSource.lua +338 -0
- package/lib/datasources/TotemTimer.d.ts +10 -0
- package/lib/datasources/TotemTimer.lua +260 -0
- package/lib/datasources/index.d.ts +16 -1
- package/lib/datasources/index.lua +43 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.lua +24 -0
- package/lib/platform/ActionBars.d.ts +27 -0
- package/lib/platform/ActionBars.lua +726 -0
- package/lib/platform/AddonSettings.d.ts +9 -0
- package/lib/platform/AddonSettings.lua +36 -0
- package/lib/platform/BlizzardUI.d.ts +17 -0
- package/lib/platform/BlizzardUI.lua +689 -0
- package/lib/platform/MicroMenu.d.ts +15 -0
- package/lib/platform/MicroMenu.lua +219 -0
- package/lib/platform/SecureButton.d.ts +5 -0
- package/lib/platform/SecureButton.lua +196 -0
- package/lib/platform/SlashCommands.d.ts +3 -0
- package/lib/platform/SlashCommands.lua +309 -0
- package/lib/platform/forever.d.ts +115 -2
- package/lib/skins/MicroBar.d.ts +8 -0
- package/lib/skins/MicroBar.lua +65 -0
- package/lib/skins/NativeSkin.d.ts +26 -0
- package/lib/skins/NativeSkin.lua +601 -0
- package/lib/skins/index.d.ts +3 -0
- package/lib/skins/index.lua +11 -0
- package/lib/store/index.lua +13 -0
- package/lib/ui/Button.d.ts +10 -0
- package/lib/ui/Button.lua +9 -0
- package/lib/ui/Cell.d.ts +7 -1
- package/lib/ui/FrameMover.d.ts +21 -0
- package/lib/ui/FrameMover.lua +123 -0
- package/lib/ui/HoverTracker.d.ts +20 -0
- package/lib/ui/HoverTracker.lua +88 -0
- package/lib/ui/Icon.d.ts +8 -0
- package/lib/ui/Icon.lua +8 -0
- package/lib/ui/KeybindCapture.d.ts +20 -0
- package/lib/ui/KeybindCapture.lua +488 -0
- package/lib/ui/Label.d.ts +10 -0
- package/lib/ui/Label.lua +8 -0
- package/lib/ui/ProgressBar.d.ts +5 -1
- package/lib/ui/SecureButton.d.ts +44 -0
- package/lib/ui/SecureButton.lua +9 -0
- package/lib/ui/index.d.ts +13 -0
- package/lib/ui/index.lua +28 -0
- package/lib/ui/layout/measureLayout.lua +11 -2
- package/lib/ui/mount.lua +679 -74
- package/lib/ui/primitives/jsx.d.ts +15 -2
- package/lib/wuira.d.ts +3 -0
- package/lib/wuira.lua +5 -0
- package/package.json +8 -1
- package/tools/build-library.mjs +1 -1
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
-- End of Lua Library inline imports
|
|
10
|
+
local ____exports = {}
|
|
11
|
+
--- A screen-space drag proxy. Protected targets are positioned only outside combat.
|
|
12
|
+
____exports.FrameMover = __TS__Class()
|
|
13
|
+
local FrameMover = ____exports.FrameMover
|
|
14
|
+
FrameMover.name = "FrameMover"
|
|
15
|
+
function FrameMover.prototype.____constructor(self, target, options)
|
|
16
|
+
self.target = target
|
|
17
|
+
self.options = options
|
|
18
|
+
self.dragging = false
|
|
19
|
+
self.disposed = false
|
|
20
|
+
if InCombatLockdown() then
|
|
21
|
+
error("FrameMover: create outside combat")
|
|
22
|
+
end
|
|
23
|
+
local frame = CreateFrame("Frame", nil, UIParent)
|
|
24
|
+
self.Frame = frame
|
|
25
|
+
frame:SetFrameStrata("DIALOG")
|
|
26
|
+
frame:SetSize(
|
|
27
|
+
target:GetWidth(),
|
|
28
|
+
target:GetHeight()
|
|
29
|
+
)
|
|
30
|
+
frame:EnableMouse(true)
|
|
31
|
+
frame:SetMovable(true)
|
|
32
|
+
frame:SetClampedToScreen(true)
|
|
33
|
+
frame:RegisterForDrag("LeftButton")
|
|
34
|
+
local x, y = target:GetCenter()
|
|
35
|
+
local screenX, screenY = UIParent:GetCenter()
|
|
36
|
+
if x == nil or y == nil or screenX == nil or screenY == nil then
|
|
37
|
+
error("FrameMover: target has no screen position")
|
|
38
|
+
end
|
|
39
|
+
frame:SetPoint(
|
|
40
|
+
"CENTER",
|
|
41
|
+
UIParent,
|
|
42
|
+
"CENTER",
|
|
43
|
+
x - screenX,
|
|
44
|
+
y - screenY
|
|
45
|
+
)
|
|
46
|
+
local texture = frame:CreateTexture(nil, "BACKGROUND")
|
|
47
|
+
texture:SetAllPoints(frame)
|
|
48
|
+
texture:SetColorTexture(0.15, 0.5, 0.8, 0.45)
|
|
49
|
+
local label = frame:CreateFontString(nil, "OVERLAY")
|
|
50
|
+
label:SetAllPoints(frame)
|
|
51
|
+
label:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
|
|
52
|
+
label:SetText(options.label)
|
|
53
|
+
frame:SetScript(
|
|
54
|
+
"OnDragStart",
|
|
55
|
+
function()
|
|
56
|
+
if self.disposed or InCombatLockdown() then
|
|
57
|
+
return
|
|
58
|
+
end
|
|
59
|
+
self.dragging = true
|
|
60
|
+
frame:StartMoving()
|
|
61
|
+
frame:SetScript(
|
|
62
|
+
"OnUpdate",
|
|
63
|
+
function() return self:Update() end
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
)
|
|
67
|
+
frame:SetScript(
|
|
68
|
+
"OnDragStop",
|
|
69
|
+
function() return self:Stop(true) end
|
|
70
|
+
)
|
|
71
|
+
frame:RegisterEvent("PLAYER_REGEN_DISABLED")
|
|
72
|
+
frame:SetScript(
|
|
73
|
+
"OnEvent",
|
|
74
|
+
function() return self:Dispose() end
|
|
75
|
+
)
|
|
76
|
+
frame:Show()
|
|
77
|
+
end
|
|
78
|
+
function FrameMover.prototype.Update(self)
|
|
79
|
+
if not self.dragging or InCombatLockdown() then
|
|
80
|
+
return
|
|
81
|
+
end
|
|
82
|
+
local x, y = self.Frame:GetCenter()
|
|
83
|
+
local screenX, screenY = UIParent:GetCenter()
|
|
84
|
+
if x == nil or y == nil or screenX == nil or screenY == nil then
|
|
85
|
+
return
|
|
86
|
+
end
|
|
87
|
+
self.last = {x = x - screenX, y = screenY - y}
|
|
88
|
+
self.target:ClearAllPoints()
|
|
89
|
+
self.target:SetPoint(
|
|
90
|
+
"CENTER",
|
|
91
|
+
UIParent,
|
|
92
|
+
"CENTER",
|
|
93
|
+
self.last.x,
|
|
94
|
+
-self.last.y
|
|
95
|
+
)
|
|
96
|
+
end
|
|
97
|
+
function FrameMover.prototype.Stop(self, commit)
|
|
98
|
+
if not self.dragging then
|
|
99
|
+
return
|
|
100
|
+
end
|
|
101
|
+
self:Update()
|
|
102
|
+
self.dragging = false
|
|
103
|
+
self.Frame:StopMovingOrSizing()
|
|
104
|
+
self.Frame:SetScript("OnUpdate", nil)
|
|
105
|
+
if commit and self.last ~= nil then
|
|
106
|
+
self.options:onMove(self.last)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
function FrameMover.prototype.Dispose(self)
|
|
110
|
+
if self.disposed then
|
|
111
|
+
return
|
|
112
|
+
end
|
|
113
|
+
self.disposed = true
|
|
114
|
+
self:Stop(true)
|
|
115
|
+
self.Frame:UnregisterAllEvents()
|
|
116
|
+
self.Frame:SetScript("OnEvent", nil)
|
|
117
|
+
self.Frame:SetScript("OnDragStart", nil)
|
|
118
|
+
self.Frame:SetScript("OnDragStop", nil)
|
|
119
|
+
self.Frame:EnableMouse(false)
|
|
120
|
+
self.Frame:RegisterForDrag()
|
|
121
|
+
self.Frame:Hide()
|
|
122
|
+
end
|
|
123
|
+
return ____exports
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface HoverFrame extends wuiraNativeFrame {
|
|
2
|
+
SetFrameRef(name: string, frame: wuiraNativeFrame): void;
|
|
3
|
+
SetAttribute(name: string, value: string | number): void;
|
|
4
|
+
}
|
|
5
|
+
export interface HoverTrackerOptions {
|
|
6
|
+
hideDelay?: number;
|
|
7
|
+
regions?: readonly wuiraNativeFrame[];
|
|
8
|
+
}
|
|
9
|
+
/** Generic secure hover visibility. Callers own presentation, content and positioning. */
|
|
10
|
+
export declare class HoverTracker {
|
|
11
|
+
readonly Trigger: HoverFrame;
|
|
12
|
+
readonly Popup: HoverFrame;
|
|
13
|
+
private readonly listener;
|
|
14
|
+
private regionCount;
|
|
15
|
+
private disposing;
|
|
16
|
+
private disposed;
|
|
17
|
+
constructor(options?: HoverTrackerOptions);
|
|
18
|
+
AddRegion(frame: wuiraNativeFrame): this;
|
|
19
|
+
Dispose(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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__NumberIsFinite(value)
|
|
11
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
12
|
+
end
|
|
13
|
+
-- End of Lua Library inline imports
|
|
14
|
+
local ____exports = {}
|
|
15
|
+
--- Generic secure hover visibility. Callers own presentation, content and positioning.
|
|
16
|
+
____exports.HoverTracker = __TS__Class()
|
|
17
|
+
local HoverTracker = ____exports.HoverTracker
|
|
18
|
+
HoverTracker.name = "HoverTracker"
|
|
19
|
+
function HoverTracker.prototype.____constructor(self, options)
|
|
20
|
+
if options == nil then
|
|
21
|
+
options = {}
|
|
22
|
+
end
|
|
23
|
+
self.regionCount = 0
|
|
24
|
+
self.disposing = false
|
|
25
|
+
self.disposed = false
|
|
26
|
+
if InCombatLockdown() then
|
|
27
|
+
error("HoverTracker: create the tracker outside combat")
|
|
28
|
+
end
|
|
29
|
+
local delay = options.hideDelay or 0.25
|
|
30
|
+
if not __TS__NumberIsFinite(delay) or delay < 0 then
|
|
31
|
+
error("HoverTracker: hideDelay must be non-negative")
|
|
32
|
+
end
|
|
33
|
+
self.Trigger = CreateFrame("Frame", nil, UIParent, "SecureHandlerEnterLeaveTemplate")
|
|
34
|
+
self.Popup = CreateFrame("Frame", nil, UIParent, "SecureHandlerShowHideTemplate")
|
|
35
|
+
self.Trigger:EnableMouse(true)
|
|
36
|
+
self.Popup:EnableMouse(false)
|
|
37
|
+
self.Popup:SetFrameRef("trigger", self.Trigger)
|
|
38
|
+
self.Popup:SetAttribute("hide-delay", delay)
|
|
39
|
+
self.Popup:SetAttribute("region-count", 0)
|
|
40
|
+
self.Popup:SetAttribute("_onshow", "\n self:RegisterAutoHide(self:GetAttribute(\"hide-delay\"))\n self:AddToAutoHide(self:GetFrameRef(\"trigger\"))\n for index = 1, self:GetAttribute(\"region-count\") do\n self:AddToAutoHide(self:GetFrameRef(\"region\" .. index))\n end\n ")
|
|
41
|
+
self.Trigger:SetFrameRef("popup", self.Popup)
|
|
42
|
+
self.Trigger:SetAttribute("_onenter", "self:GetFrameRef(\"popup\"):Show()")
|
|
43
|
+
self.Popup:Hide()
|
|
44
|
+
for ____, region in ipairs(options.regions or ({})) do
|
|
45
|
+
self:AddRegion(region)
|
|
46
|
+
end
|
|
47
|
+
self.listener = CreateFrame("Frame", nil, UIParent)
|
|
48
|
+
self.listener:RegisterEvent("PLAYER_REGEN_ENABLED")
|
|
49
|
+
self.listener:SetScript(
|
|
50
|
+
"OnEvent",
|
|
51
|
+
function()
|
|
52
|
+
if self.disposing then
|
|
53
|
+
self:Dispose()
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
function HoverTracker.prototype.AddRegion(self, frame)
|
|
59
|
+
if self.disposing or self.disposed then
|
|
60
|
+
error("HoverTracker is disposed")
|
|
61
|
+
end
|
|
62
|
+
if InCombatLockdown() then
|
|
63
|
+
error("HoverTracker: configure regions outside combat")
|
|
64
|
+
end
|
|
65
|
+
self.regionCount = self.regionCount + 1
|
|
66
|
+
self.Popup:SetFrameRef(
|
|
67
|
+
"region" .. tostring(self.regionCount),
|
|
68
|
+
frame
|
|
69
|
+
)
|
|
70
|
+
self.Popup:SetAttribute("region-count", self.regionCount)
|
|
71
|
+
return self
|
|
72
|
+
end
|
|
73
|
+
function HoverTracker.prototype.Dispose(self)
|
|
74
|
+
if self.disposed then
|
|
75
|
+
return
|
|
76
|
+
end
|
|
77
|
+
self.disposing = true
|
|
78
|
+
if InCombatLockdown() then
|
|
79
|
+
return
|
|
80
|
+
end
|
|
81
|
+
self.Trigger:SetAttribute("_onenter", "")
|
|
82
|
+
self.Trigger:Hide()
|
|
83
|
+
self.Popup:Hide()
|
|
84
|
+
self.listener:UnregisterAllEvents()
|
|
85
|
+
self.listener:SetScript("OnEvent", nil)
|
|
86
|
+
self.disposed = true
|
|
87
|
+
end
|
|
88
|
+
return ____exports
|
package/lib/ui/Icon.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CellProps } from "./Cell";
|
|
2
|
+
import type { TextureSource } from "../datasources/TextureSource";
|
|
3
|
+
export type IconProps = CellProps & {
|
|
4
|
+
texture?: string | number;
|
|
5
|
+
textureSource?: TextureSource;
|
|
6
|
+
texCoords?: readonly [number, number, number, number];
|
|
7
|
+
};
|
|
8
|
+
export declare function Icon(props: Partial<IconProps>): import("..").Element;
|
package/lib/ui/Icon.lua
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local ____jsx = require("ui.primitives.jsx")
|
|
4
|
+
local UI = ____jsx.UI
|
|
5
|
+
function ____exports.Icon(self, props)
|
|
6
|
+
return UI:createElement("icon", props)
|
|
7
|
+
end
|
|
8
|
+
return ____exports
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface Target {
|
|
2
|
+
frame: wuiraNativeFrame;
|
|
3
|
+
overlay: wuiraNativeFrame;
|
|
4
|
+
onBinding: (key: string | undefined) => void;
|
|
5
|
+
}
|
|
6
|
+
/** Hover-to-bind input capture. It reports keys; the addon owns persistence and actions. */
|
|
7
|
+
export declare class KeybindCapture {
|
|
8
|
+
private readonly onCancel;
|
|
9
|
+
private readonly frame;
|
|
10
|
+
private readonly targets;
|
|
11
|
+
private hovered?;
|
|
12
|
+
private active;
|
|
13
|
+
constructor(onCancel: () => void);
|
|
14
|
+
/** Independent overlays block clicks without rewriting the secure button. */
|
|
15
|
+
AddTarget(frame: wuiraNativeFrame, onBinding: Target["onBinding"]): () => void;
|
|
16
|
+
SetActive(active: boolean): void;
|
|
17
|
+
private OnKey;
|
|
18
|
+
Dispose(): void;
|
|
19
|
+
}
|
|
20
|
+
export {};
|