wuira 0.1.0 → 0.1.1
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/README.md +202 -18
- package/cli/wuira.mjs +67 -0
- package/config/tsconfig.json +25 -0
- package/lib/Console.d.ts +5 -0
- package/lib/Console.lua +20 -0
- package/lib/console-polyfill.d.ts +9 -0
- package/lib/console-polyfill.lua +39 -0
- package/lib/datasources/DataSource.d.ts +17 -0
- package/lib/datasources/DataSource.lua +199 -0
- package/lib/datasources/NativeNumberSource.d.ts +7 -0
- package/lib/datasources/NativeNumberSource.lua +50 -0
- package/lib/datasources/ProgressSource.d.ts +23 -0
- package/lib/datasources/ProgressSource.lua +79 -0
- package/lib/datasources/Resources.d.ts +27 -0
- package/lib/datasources/Resources.lua +102 -0
- package/lib/datasources/index.d.ts +4 -0
- package/lib/datasources/index.lua +18 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.lua +11 -0
- package/{src → lib}/platform/forever.d.ts +17 -17
- package/{src/types/Anchor.ts → lib/types/Anchor.d.ts} +6 -7
- package/lib/types/Anchor.lua +8 -0
- package/lib/types/Color.lua +3 -0
- package/lib/types/Position.d.ts +21 -0
- package/lib/types/Position.lua +3 -0
- package/lib/types/Spacing.d.ts +14 -0
- package/lib/types/Spacing.lua +20 -0
- package/{src/types/Texture.ts → lib/types/Texture.d.ts} +0 -2
- package/lib/types/Texture.lua +3 -0
- package/{src/ui/Cell.tsx → lib/ui/Cell.d.ts} +3 -8
- package/lib/ui/Cell.lua +8 -0
- package/{src/ui/FlowLayout.tsx → lib/ui/FlowLayout.d.ts} +3 -8
- package/lib/ui/FlowLayout.lua +8 -0
- package/{src/ui/GridLayout.tsx → lib/ui/GridLayout.d.ts} +3 -8
- package/lib/ui/GridLayout.lua +8 -0
- package/{src/ui/Layout.ts → lib/ui/Layout.d.ts} +4 -3
- package/lib/ui/Layout.lua +3 -0
- package/{src/ui/ProgressBar.tsx → lib/ui/ProgressBar.d.ts} +4 -7
- package/lib/ui/ProgressBar.lua +8 -0
- package/lib/ui/decorations/Background.d.ts +10 -0
- package/lib/ui/decorations/Background.lua +76 -0
- package/lib/ui/decorations/Border.d.ts +18 -0
- package/lib/ui/decorations/Border.lua +188 -0
- package/lib/ui/decorations/Decoration.d.ts +13 -0
- package/lib/ui/decorations/Decoration.lua +81 -0
- package/{src/ui/decorations/Decorations.ts → lib/ui/decorations/Decorations.d.ts} +0 -1
- package/lib/ui/decorations/Decorations.lua +3 -0
- package/lib/ui/decorations/Glow.d.ts +14 -0
- package/lib/ui/decorations/Glow.lua +63 -0
- package/lib/ui/decorations/backgroundTextures.d.ts +25 -0
- package/lib/ui/decorations/backgroundTextures.lua +10 -0
- package/lib/ui/decorations/borderTextures.d.ts +41 -0
- package/lib/ui/decorations/borderTextures.lua +12 -0
- package/lib/ui/decorations/statusBarTextures.d.ts +12 -0
- package/lib/ui/decorations/statusBarTextures.lua +9 -0
- package/lib/ui/index.d.ts +11 -0
- package/lib/ui/index.lua +35 -0
- package/lib/ui/layout/calculateFlow.d.ts +12 -0
- package/lib/ui/layout/calculateFlow.lua +36 -0
- package/lib/ui/layout/calculateGrid.d.ts +9 -0
- package/lib/ui/layout/calculateGrid.lua +47 -0
- package/lib/ui/layout/measureLayout.d.ts +19 -0
- package/lib/ui/layout/measureLayout.lua +215 -0
- package/lib/ui/mount.d.ts +5 -0
- package/lib/ui/mount.lua +486 -0
- package/lib/ui/primitives/jsx.d.ts +38 -0
- package/lib/ui/primitives/jsx.lua +66 -0
- package/lib/wuira.d.ts +8 -0
- package/lib/wuira.lua +30 -0
- package/package.json +55 -5
- package/templates/addon/README.md +13 -0
- package/templates/addon/addon.toc.in +4 -0
- package/templates/addon/gitignore +3 -0
- package/templates/addon/package.json +11 -0
- package/templates/addon/src/index.tsx +9 -0
- package/templates/addon/tsconfig.json +8 -0
- package/templates/addon/wuira.config.mjs +4 -0
- package/tools/build-library.mjs +15 -0
- package/tools/module-loader.lua +3 -3
- package/tools/{wow-modules.cjs → wow-modules.mjs} +27 -11
- package/tsconfig.json +1 -1
- package/tsconfig.lib.json +8 -0
- package/addon.toc.in +0 -4
- package/cli/uira.cjs +0 -55
- package/src/Console.ts +0 -10
- package/src/UIra.ts +0 -18
- package/src/console-polyfill.ts +0 -25
- package/src/datasources/DataSource.ts +0 -42
- package/src/datasources/NativeNumberSource.ts +0 -7
- package/src/datasources/ProgressSource.ts +0 -46
- package/src/datasources/Resources.ts +0 -41
- package/src/examples/ProgressBars.tsx +0 -24
- package/src/index.tsx +0 -3
- package/src/playground/PlayerFrame.ts +0 -271
- package/src/types/Position.ts +0 -21
- package/src/types/Spacing.ts +0 -14
- package/src/ui/decorations/Background.ts +0 -29
- package/src/ui/decorations/Border.ts +0 -71
- package/src/ui/decorations/Decoration.ts +0 -59
- package/src/ui/decorations/Glow.ts +0 -25
- package/src/ui/decorations/backgroundTextures.ts +0 -10
- package/src/ui/decorations/borderTextures.ts +0 -13
- package/src/ui/decorations/statusBarTextures.ts +0 -11
- package/src/ui/layout/calculateFlow.ts +0 -33
- package/src/ui/layout/calculateGrid.ts +0 -22
- package/src/ui/layout/measureLayout.ts +0 -87
- package/src/ui/mount.ts +0 -138
- package/src/ui/primitives/jsx.ts +0 -75
- /package/{src/types/Color.ts → lib/types/Color.d.ts} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
-- End of Lua Library inline imports
|
|
35
|
+
local ____exports = {}
|
|
36
|
+
local ____DataSource = require("datasources.DataSource")
|
|
37
|
+
local DataSource = ____DataSource.DataSource
|
|
38
|
+
--- Read-only API value; no cached assignment or game-state mutation.
|
|
39
|
+
____exports.NativeNumberSource = __TS__Class()
|
|
40
|
+
local NativeNumberSource = ____exports.NativeNumberSource
|
|
41
|
+
NativeNumberSource.name = "NativeNumberSource"
|
|
42
|
+
__TS__ClassExtends(NativeNumberSource, DataSource)
|
|
43
|
+
function NativeNumberSource.prototype.____constructor(self, read)
|
|
44
|
+
DataSource.prototype.____constructor(self, 0)
|
|
45
|
+
self.read = read
|
|
46
|
+
end
|
|
47
|
+
function NativeNumberSource.prototype.GetValue(self)
|
|
48
|
+
return self:read()
|
|
49
|
+
end
|
|
50
|
+
return ____exports
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DataSource } from "./DataSource";
|
|
2
|
+
export interface ProgressOverrides {
|
|
3
|
+
min?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
current?: number;
|
|
6
|
+
}
|
|
7
|
+
/** Shared contract for health, power, cooldowns, and other progress values. */
|
|
8
|
+
export declare abstract class ProgressSource extends DataSource<number> {
|
|
9
|
+
private readonly readers;
|
|
10
|
+
readonly Min: DataSource<number>;
|
|
11
|
+
readonly Max: DataSource<number>;
|
|
12
|
+
readonly Percent: DataSource<number>;
|
|
13
|
+
protected constructor(readers: {
|
|
14
|
+
current: () => number;
|
|
15
|
+
min: () => number;
|
|
16
|
+
max: () => number;
|
|
17
|
+
percent: () => number;
|
|
18
|
+
});
|
|
19
|
+
protected GetValue(): number;
|
|
20
|
+
IsSecret(): boolean;
|
|
21
|
+
BindTo(frame: wuiraNativeStatusBar, options?: ProgressOverrides): void;
|
|
22
|
+
protected abstract Listen(frame: wuiraNativeFrame, refresh: () => void): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
-- End of Lua Library inline imports
|
|
41
|
+
local ____exports = {}
|
|
42
|
+
local ____DataSource = require("datasources.DataSource")
|
|
43
|
+
local DataSource = ____DataSource.DataSource
|
|
44
|
+
local ____NativeNumberSource = require("datasources.NativeNumberSource")
|
|
45
|
+
local NativeNumberSource = ____NativeNumberSource.NativeNumberSource
|
|
46
|
+
--- Shared contract for health, power, cooldowns, and other progress values.
|
|
47
|
+
____exports.ProgressSource = __TS__Class()
|
|
48
|
+
local ProgressSource = ____exports.ProgressSource
|
|
49
|
+
ProgressSource.name = "ProgressSource"
|
|
50
|
+
__TS__ClassExtends(ProgressSource, DataSource)
|
|
51
|
+
function ProgressSource.prototype.____constructor(self, readers)
|
|
52
|
+
DataSource.prototype.____constructor(self, 0)
|
|
53
|
+
self.readers = readers
|
|
54
|
+
self.Min = __TS__New(NativeNumberSource, readers.min)
|
|
55
|
+
self.Max = __TS__New(NativeNumberSource, readers.max)
|
|
56
|
+
self.Percent = __TS__New(NativeNumberSource, readers.percent)
|
|
57
|
+
end
|
|
58
|
+
function ProgressSource.prototype.GetValue(self)
|
|
59
|
+
return self.readers:current()
|
|
60
|
+
end
|
|
61
|
+
function ProgressSource.prototype.IsSecret(self)
|
|
62
|
+
return DataSource.prototype.IsSecret(self) or self.Min:IsSecret() or self.Max:IsSecret() or self.Percent:IsSecret()
|
|
63
|
+
end
|
|
64
|
+
function ProgressSource.prototype.BindTo(self, frame, options)
|
|
65
|
+
if options == nil then
|
|
66
|
+
options = {}
|
|
67
|
+
end
|
|
68
|
+
local function refresh()
|
|
69
|
+
local current = options.current ~= nil and options.current or self.readers:current()
|
|
70
|
+
frame:SetMinMaxValues(
|
|
71
|
+
options.min ~= nil and options.min or self.readers:min(),
|
|
72
|
+
options.max ~= nil and options.max or self.readers:max()
|
|
73
|
+
)
|
|
74
|
+
frame:SetValue(current)
|
|
75
|
+
end
|
|
76
|
+
self:Listen(frame, refresh)
|
|
77
|
+
refresh(nil)
|
|
78
|
+
end
|
|
79
|
+
return ____exports
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ProgressSource } from "./ProgressSource";
|
|
2
|
+
export declare const Unit: {
|
|
3
|
+
readonly Player: "player";
|
|
4
|
+
};
|
|
5
|
+
/** Direct API-to-widget binding; opaque values are never compared or calculated. */
|
|
6
|
+
declare abstract class Resource extends ProgressSource {
|
|
7
|
+
private readonly unitToken;
|
|
8
|
+
private readonly events;
|
|
9
|
+
protected constructor(current: () => number, maximum: () => number, percent: () => number, unitToken: string, events: string[]);
|
|
10
|
+
protected Listen(frame: wuiraNativeFrame, refresh: () => void): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class HP extends Resource {
|
|
13
|
+
readonly unit: string;
|
|
14
|
+
constructor(unit: string);
|
|
15
|
+
}
|
|
16
|
+
/** Explicit mana (power type 0), even while the unit uses rage/energy. */
|
|
17
|
+
export declare class Mana extends Resource {
|
|
18
|
+
readonly unit: string;
|
|
19
|
+
constructor(unit: string);
|
|
20
|
+
}
|
|
21
|
+
export declare const DataSources: {
|
|
22
|
+
Resources: {
|
|
23
|
+
HP: typeof HP;
|
|
24
|
+
Mana: typeof Mana;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
-- End of Lua Library inline imports
|
|
35
|
+
local ____exports = {}
|
|
36
|
+
local ____ProgressSource = require("datasources.ProgressSource")
|
|
37
|
+
local ProgressSource = ____ProgressSource.ProgressSource
|
|
38
|
+
____exports.Unit = {Player = "player"}
|
|
39
|
+
--- Direct API-to-widget binding; opaque values are never compared or calculated.
|
|
40
|
+
local Resource = __TS__Class()
|
|
41
|
+
Resource.name = "Resource"
|
|
42
|
+
__TS__ClassExtends(Resource, ProgressSource)
|
|
43
|
+
function Resource.prototype.____constructor(self, current, maximum, percent, unitToken, events)
|
|
44
|
+
ProgressSource.prototype.____constructor(
|
|
45
|
+
self,
|
|
46
|
+
{
|
|
47
|
+
current = current,
|
|
48
|
+
min = function() return 0 end,
|
|
49
|
+
max = maximum,
|
|
50
|
+
percent = percent
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
self.unitToken = unitToken
|
|
54
|
+
self.events = events
|
|
55
|
+
end
|
|
56
|
+
function Resource.prototype.Listen(self, frame, refresh)
|
|
57
|
+
frame:SetScript(
|
|
58
|
+
"OnEvent",
|
|
59
|
+
function(_frame, event, unit)
|
|
60
|
+
if event == "PLAYER_ENTERING_WORLD" or unit == self.unitToken then
|
|
61
|
+
refresh(nil)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
)
|
|
65
|
+
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
66
|
+
for ____, event in ipairs(self.events) do
|
|
67
|
+
frame:RegisterEvent(event)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
____exports.HP = __TS__Class()
|
|
71
|
+
local HP = ____exports.HP
|
|
72
|
+
HP.name = "HP"
|
|
73
|
+
__TS__ClassExtends(HP, Resource)
|
|
74
|
+
function HP.prototype.____constructor(self, unit)
|
|
75
|
+
Resource.prototype.____constructor(
|
|
76
|
+
self,
|
|
77
|
+
function() return UnitHealth(unit) end,
|
|
78
|
+
function() return UnitHealthMax(unit) end,
|
|
79
|
+
function() return UnitHealthPercent(unit, true, CurveConstants.ScaleTo100) end,
|
|
80
|
+
unit,
|
|
81
|
+
{"UNIT_HEALTH", "UNIT_MAXHEALTH"}
|
|
82
|
+
)
|
|
83
|
+
self.unit = unit
|
|
84
|
+
end
|
|
85
|
+
--- Explicit mana (power type 0), even while the unit uses rage/energy.
|
|
86
|
+
____exports.Mana = __TS__Class()
|
|
87
|
+
local Mana = ____exports.Mana
|
|
88
|
+
Mana.name = "Mana"
|
|
89
|
+
__TS__ClassExtends(Mana, Resource)
|
|
90
|
+
function Mana.prototype.____constructor(self, unit)
|
|
91
|
+
Resource.prototype.____constructor(
|
|
92
|
+
self,
|
|
93
|
+
function() return UnitPower(unit, 0) end,
|
|
94
|
+
function() return UnitPowerMax(unit, 0) end,
|
|
95
|
+
function() return UnitPowerPercent(unit, 0, true, CurveConstants.ScaleTo100) end,
|
|
96
|
+
unit,
|
|
97
|
+
{"UNIT_POWER_UPDATE", "UNIT_MAXPOWER", "UNIT_DISPLAYPOWER"}
|
|
98
|
+
)
|
|
99
|
+
self.unit = unit
|
|
100
|
+
end
|
|
101
|
+
____exports.DataSources = {Resources = {HP = ____exports.HP, Mana = ____exports.Mana}}
|
|
102
|
+
return ____exports
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
do
|
|
4
|
+
local ____DataSource = require("datasources.DataSource")
|
|
5
|
+
____exports.DataSource = ____DataSource.DataSource
|
|
6
|
+
end
|
|
7
|
+
do
|
|
8
|
+
local ____ProgressSource = require("datasources.ProgressSource")
|
|
9
|
+
____exports.ProgressSource = ____ProgressSource.ProgressSource
|
|
10
|
+
end
|
|
11
|
+
do
|
|
12
|
+
local ____Resources = require("datasources.Resources")
|
|
13
|
+
____exports.HP = ____Resources.HP
|
|
14
|
+
____exports.Mana = ____Resources.Mana
|
|
15
|
+
____exports.Unit = ____Resources.Unit
|
|
16
|
+
____exports.DataSources = ____Resources.DataSources
|
|
17
|
+
end
|
|
18
|
+
return ____exports
|
package/lib/index.d.ts
ADDED
package/lib/index.lua
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
do
|
|
4
|
+
local ____wuira = require("wuira")
|
|
5
|
+
____exports.wuira = ____wuira.wuira
|
|
6
|
+
end
|
|
7
|
+
do
|
|
8
|
+
local ____jsx = require("ui.primitives.jsx")
|
|
9
|
+
____exports.UI = ____jsx.UI
|
|
10
|
+
end
|
|
11
|
+
return ____exports
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Minimal API surface observed in locally installed Forever addons.
|
|
2
2
|
// Global functions use dot calls; widget methods use Lua's colon calls.
|
|
3
|
-
type
|
|
4
|
-
type
|
|
5
|
-
interface
|
|
6
|
-
SetAllPoints(frame:
|
|
3
|
+
type wuiraAnchor = import("../types/Position").Anchor;
|
|
4
|
+
type wuiraDrawLayer = "BACKGROUND" | "OVERLAY";
|
|
5
|
+
interface wuiraNativeTexture {
|
|
6
|
+
SetAllPoints(frame: wuiraNativeFrame): void;
|
|
7
7
|
SetColorTexture(red: number, green: number, blue: number, alpha: number): void;
|
|
8
8
|
SetTexture(path: string): void;
|
|
9
9
|
SetVertexColor(red: number, green: number, blue: number, alpha: number): void;
|
|
@@ -12,35 +12,35 @@ interface UiraNativeTexture {
|
|
|
12
12
|
SetVertTile(enabled: boolean): void;
|
|
13
13
|
SetTexCoord(left: number, right: number, top: number, bottom: number): void;
|
|
14
14
|
SetSize(width: number, height: number): void;
|
|
15
|
-
SetPoint(point:
|
|
16
|
-
SetParent(parent:
|
|
15
|
+
SetPoint(point: wuiraAnchor, relativeTo: wuiraNativeFrame, relativePoint: wuiraAnchor, x: number, y: number): void;
|
|
16
|
+
SetParent(parent: wuiraNativeFrame): void;
|
|
17
17
|
ClearAllPoints(): void;
|
|
18
18
|
Show(): void;
|
|
19
19
|
Hide(): void;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
interface
|
|
22
|
+
interface wuiraNativeFrame {
|
|
23
23
|
EnableMouse(enabled: boolean): void;
|
|
24
24
|
RegisterEvent(event: string): void;
|
|
25
25
|
UnregisterAllEvents(): void;
|
|
26
|
-
SetScript(script: "OnEvent", handler: ((this: void, frame:
|
|
26
|
+
SetScript(script: "OnEvent", handler: ((this: void, frame: wuiraNativeFrame, event: string, unit?: string) => void) | undefined): void;
|
|
27
27
|
GetWidth(): number;
|
|
28
28
|
GetHeight(): number;
|
|
29
29
|
SetSize(width: number, height: number): void;
|
|
30
|
-
SetPoint(point:
|
|
31
|
-
CreateTexture(name: undefined, layer:
|
|
30
|
+
SetPoint(point: wuiraAnchor, relativeTo: wuiraNativeFrame, relativePoint: wuiraAnchor, x: number, y: number): void;
|
|
31
|
+
CreateTexture(name: undefined, layer: wuiraDrawLayer): wuiraNativeTexture;
|
|
32
32
|
Show(): void;
|
|
33
33
|
Hide(): void;
|
|
34
|
-
SetParent(parent:
|
|
34
|
+
SetParent(parent: wuiraNativeFrame): void;
|
|
35
35
|
ClearAllPoints(): void;
|
|
36
|
-
SetAllPoints(frame:
|
|
36
|
+
SetAllPoints(frame: wuiraNativeFrame): void;
|
|
37
37
|
SetBackdrop(backdrop: { edgeFile: string; edgeSize: number }): void;
|
|
38
38
|
SetBackdropBorderColor(red: number, green: number, blue: number, alpha: number): void;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
declare const UIParent:
|
|
42
|
-
interface
|
|
43
|
-
GetStatusBarTexture():
|
|
41
|
+
declare const UIParent: wuiraNativeFrame;
|
|
42
|
+
interface wuiraNativeStatusBar extends wuiraNativeFrame {
|
|
43
|
+
GetStatusBarTexture(): wuiraNativeTexture;
|
|
44
44
|
SetMinMaxValues(min: number, max: number): void;
|
|
45
45
|
SetValue(value: number): void;
|
|
46
46
|
SetStatusBarTexture(path: string): void;
|
|
@@ -49,8 +49,8 @@ interface UiraNativeStatusBar extends UiraNativeFrame {
|
|
|
49
49
|
SetReverseFill(reverse: boolean): void;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
declare function CreateFrame(this: void, kind: "StatusBar", name: undefined, parent:
|
|
53
|
-
declare function CreateFrame(this: void, kind: "Frame", name: undefined, parent:
|
|
52
|
+
declare function CreateFrame(this: void, kind: "StatusBar", name: undefined, parent: wuiraNativeFrame): wuiraNativeStatusBar;
|
|
53
|
+
declare function CreateFrame(this: void, kind: "Frame", name: undefined, parent: wuiraNativeFrame, template?: "BackdropTemplate"): wuiraNativeFrame;
|
|
54
54
|
declare function error(this: void, message: string): never;
|
|
55
55
|
declare function issecretvalue(this: void, value: unknown): boolean;
|
|
56
56
|
declare function UnitHealth(this: void, unit: string): number;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
1
|
+
export declare enum Anchor {
|
|
2
|
+
Center = "Center",
|
|
3
|
+
Bottom = "Bottom",
|
|
4
|
+
BottomLeft = "BottomLeft",
|
|
5
|
+
BottomRight = "BottomRight"
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
____exports.Anchor = ____exports.Anchor or ({})
|
|
4
|
+
____exports.Anchor.Center = "Center"
|
|
5
|
+
____exports.Anchor.Bottom = "Bottom"
|
|
6
|
+
____exports.Anchor.BottomLeft = "BottomLeft"
|
|
7
|
+
____exports.Anchor.BottomRight = "BottomRight"
|
|
8
|
+
return ____exports
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type Anchor = "TOPLEFT" | "TOP" | "TOPRIGHT" | "LEFT" | "CENTER" | "RIGHT" | "BOTTOMLEFT" | "BOTTOM" | "BOTTOMRIGHT";
|
|
2
|
+
/** Defaults to TOPLEFT; positive y moves down from the selected anchor. */
|
|
3
|
+
export type Position<TReference> = {
|
|
4
|
+
anchor?: Anchor;
|
|
5
|
+
relativeAnchor?: Anchor;
|
|
6
|
+
} & ({
|
|
7
|
+
mode: "absolute";
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
offset?: never;
|
|
11
|
+
relativeTo?: never;
|
|
12
|
+
} | {
|
|
13
|
+
mode: "relative";
|
|
14
|
+
offset: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
};
|
|
18
|
+
relativeTo?: TReference;
|
|
19
|
+
x?: never;
|
|
20
|
+
y?: never;
|
|
21
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** A uniform spacing value or individually specified edges, in UI units. */
|
|
2
|
+
export type Spacing = number | {
|
|
3
|
+
top?: number;
|
|
4
|
+
right?: number;
|
|
5
|
+
bottom?: number;
|
|
6
|
+
left?: number;
|
|
7
|
+
};
|
|
8
|
+
export interface Insets {
|
|
9
|
+
top: number;
|
|
10
|
+
right: number;
|
|
11
|
+
bottom: number;
|
|
12
|
+
left: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function resolveSpacing(value?: Spacing): Insets;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
-- Lua Library inline imports
|
|
3
|
+
local function __TS__NumberIsFinite(value)
|
|
4
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
5
|
+
end
|
|
6
|
+
-- End of Lua Library inline imports
|
|
7
|
+
local ____exports = {}
|
|
8
|
+
function ____exports.resolveSpacing(self, value)
|
|
9
|
+
if value == nil then
|
|
10
|
+
value = 0
|
|
11
|
+
end
|
|
12
|
+
local result = type(value) == "number" and ({top = value, right = value, bottom = value, left = value}) or ({top = value.top or 0, right = value.right or 0, bottom = value.bottom or 0, left = value.left or 0})
|
|
13
|
+
for ____, edge in ipairs({result.top, result.right, result.bottom, result.left}) do
|
|
14
|
+
if not __TS__NumberIsFinite(edge) or edge < 0 then
|
|
15
|
+
error("Spacing must be finite and non-negative")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
return result
|
|
19
|
+
end
|
|
20
|
+
return ____exports
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { Element } from "./primitives/jsx";
|
|
2
|
-
import { UI } from "./primitives/jsx";
|
|
3
2
|
import type { Decorations } from "./decorations/Decorations";
|
|
4
3
|
import type { Position } from "../types/Position";
|
|
5
4
|
import type { Spacing } from "../types/Spacing";
|
|
6
|
-
|
|
7
5
|
export type Size = number | "inherit";
|
|
8
|
-
|
|
9
6
|
export type CellProps = {
|
|
10
7
|
width: Size;
|
|
11
8
|
height: Size;
|
|
@@ -15,12 +12,10 @@ export type CellProps = {
|
|
|
15
12
|
clickThrough?: boolean;
|
|
16
13
|
decorations?: Decorations;
|
|
17
14
|
} & Position<ICell>;
|
|
18
|
-
|
|
19
15
|
export interface ICell extends Element {
|
|
20
16
|
kind: "cell" | "flow" | "grid" | "progress";
|
|
21
17
|
props: CellProps;
|
|
22
18
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
19
|
+
export declare function Cell(props: Partial<CellProps> & {
|
|
20
|
+
child?: Element;
|
|
21
|
+
}, child?: Element): Element;
|
package/lib/ui/Cell.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.Cell(self, props, child)
|
|
6
|
+
return UI:createElement("cell", props, props.child or child or ({}))
|
|
7
|
+
end
|
|
8
|
+
return ____exports
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { LayoutProps, ILayout } from "./Layout";
|
|
2
2
|
import type { Element } from "./primitives/jsx";
|
|
3
|
-
import { UI } from "./primitives/jsx";
|
|
4
|
-
|
|
5
3
|
export interface FlowOptions {
|
|
6
4
|
direction: "horizontal" | "vertical";
|
|
7
5
|
/** Wrap to another row (horizontal) or column (vertical) when full. */
|
|
@@ -9,15 +7,12 @@ export interface FlowOptions {
|
|
|
9
7
|
/** Space between rows/columns; defaults to gap. */
|
|
10
8
|
lineGap?: number;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
10
|
export type FlowLayoutProps = LayoutProps & FlowOptions;
|
|
14
|
-
|
|
15
11
|
export interface IFlowLayout extends ILayout {
|
|
16
12
|
kind: "flow";
|
|
17
13
|
props: FlowLayoutProps;
|
|
18
14
|
children: Element[];
|
|
19
15
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
16
|
+
export declare function FlowLayout(props: Partial<FlowLayoutProps> & {
|
|
17
|
+
child?: Element | Element[];
|
|
18
|
+
}): Element;
|
|
@@ -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.FlowLayout(self, props)
|
|
6
|
+
return UI:createElement("flow", props, props.child or ({}))
|
|
7
|
+
end
|
|
8
|
+
return ____exports
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { LayoutProps, ILayout } from "./Layout";
|
|
2
2
|
import type { Element } from "./primitives/jsx";
|
|
3
|
-
import { UI } from "./primitives/jsx";
|
|
4
|
-
|
|
5
3
|
export interface GridOptions {
|
|
6
4
|
columns: number;
|
|
7
5
|
rowGap?: number;
|
|
@@ -10,15 +8,12 @@ export interface GridOptions {
|
|
|
10
8
|
cellWidth?: number;
|
|
11
9
|
cellHeight?: number;
|
|
12
10
|
}
|
|
13
|
-
|
|
14
11
|
export type GridLayoutProps = LayoutProps & GridOptions;
|
|
15
|
-
|
|
16
12
|
export interface IGridLayout extends ILayout {
|
|
17
13
|
kind: "grid";
|
|
18
14
|
props: GridLayoutProps;
|
|
19
15
|
children: Element[];
|
|
20
16
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
17
|
+
export declare function GridLayout(props: Partial<GridLayoutProps> & {
|
|
18
|
+
child?: Element | Element[];
|
|
19
|
+
}): Element;
|
|
@@ -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.GridLayout(self, props)
|
|
6
|
+
return UI:createElement("grid", props, props.child or ({}))
|
|
7
|
+
end
|
|
8
|
+
return ____exports
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ICell, CellProps } from "./Cell";
|
|
2
2
|
import type { Element } from "./primitives/jsx";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export type LayoutProps = CellProps & {
|
|
4
|
+
sizing?: "fixed" | "content";
|
|
5
|
+
gap?: number;
|
|
6
|
+
};
|
|
6
7
|
export interface ILayout extends ICell {
|
|
7
8
|
props: LayoutProps;
|
|
8
9
|
children: Element[];
|