wuira 0.1.1 → 0.1.3
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 +93 -0
- package/README.md +91 -0
- package/config/tsconfig.json +3 -1
- package/lib/datasources/Auras.d.ts +32 -0
- package/lib/datasources/Auras.lua +284 -0
- package/lib/datasources/GroupMembers.d.ts +18 -0
- package/lib/datasources/GroupMembers.lua +122 -0
- package/lib/datasources/Resources.d.ts +9 -8
- package/lib/datasources/Resources.lua +172 -11
- package/lib/datasources/UnitInfo.d.ts +45 -0
- package/lib/datasources/UnitInfo.lua +451 -0
- package/lib/datasources/UnitSource.d.ts +28 -0
- package/lib/datasources/UnitSource.lua +245 -0
- package/lib/datasources/index.d.ts +8 -0
- package/lib/datasources/index.lua +23 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.lua +1 -0
- package/lib/ui/Cell.d.ts +4 -1
- package/lib/ui/Cell.lua +1 -0
- package/lib/wuira.d.ts +2 -2
- package/lib/wuira.lua +8 -2
- package/package.json +2 -1
- package/templates/addon/src/index.tsx +1 -3
|
@@ -0,0 +1,245 @@
|
|
|
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__CloneDescriptor(____bindingPattern0)
|
|
11
|
+
local value
|
|
12
|
+
local writable
|
|
13
|
+
local set
|
|
14
|
+
local get
|
|
15
|
+
local configurable
|
|
16
|
+
local enumerable
|
|
17
|
+
enumerable = ____bindingPattern0.enumerable
|
|
18
|
+
configurable = ____bindingPattern0.configurable
|
|
19
|
+
get = ____bindingPattern0.get
|
|
20
|
+
set = ____bindingPattern0.set
|
|
21
|
+
writable = ____bindingPattern0.writable
|
|
22
|
+
value = ____bindingPattern0.value
|
|
23
|
+
local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
|
|
24
|
+
local hasGetterOrSetter = get ~= nil or set ~= nil
|
|
25
|
+
local hasValueOrWritableAttribute = writable ~= nil or value ~= nil
|
|
26
|
+
if hasGetterOrSetter and hasValueOrWritableAttribute then
|
|
27
|
+
error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
|
|
28
|
+
end
|
|
29
|
+
if get or set then
|
|
30
|
+
descriptor.get = get
|
|
31
|
+
descriptor.set = set
|
|
32
|
+
else
|
|
33
|
+
descriptor.value = value
|
|
34
|
+
descriptor.writable = writable == true
|
|
35
|
+
end
|
|
36
|
+
return descriptor
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
local __TS__DescriptorGet
|
|
40
|
+
do
|
|
41
|
+
local getmetatable = _G.getmetatable
|
|
42
|
+
local ____rawget = _G.rawget
|
|
43
|
+
function __TS__DescriptorGet(self, metatable, key)
|
|
44
|
+
while metatable do
|
|
45
|
+
local rawResult = ____rawget(metatable, key)
|
|
46
|
+
if rawResult ~= nil then
|
|
47
|
+
return rawResult
|
|
48
|
+
end
|
|
49
|
+
local descriptors = ____rawget(metatable, "_descriptors")
|
|
50
|
+
if descriptors then
|
|
51
|
+
local descriptor = descriptors[key]
|
|
52
|
+
if descriptor ~= nil then
|
|
53
|
+
if descriptor.get then
|
|
54
|
+
return descriptor.get(self)
|
|
55
|
+
end
|
|
56
|
+
return descriptor.value
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
metatable = getmetatable(metatable)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
local __TS__DescriptorSet
|
|
65
|
+
do
|
|
66
|
+
local getmetatable = _G.getmetatable
|
|
67
|
+
local ____rawget = _G.rawget
|
|
68
|
+
local rawset = _G.rawset
|
|
69
|
+
function __TS__DescriptorSet(self, metatable, key, value)
|
|
70
|
+
while metatable do
|
|
71
|
+
local descriptors = ____rawget(metatable, "_descriptors")
|
|
72
|
+
if descriptors then
|
|
73
|
+
local descriptor = descriptors[key]
|
|
74
|
+
if descriptor ~= nil then
|
|
75
|
+
if descriptor.set then
|
|
76
|
+
descriptor.set(self, value)
|
|
77
|
+
else
|
|
78
|
+
if descriptor.writable == false then
|
|
79
|
+
error(
|
|
80
|
+
((("Cannot assign to read only property '" .. key) .. "' of object '") .. tostring(self)) .. "'",
|
|
81
|
+
0
|
|
82
|
+
)
|
|
83
|
+
end
|
|
84
|
+
descriptor.value = value
|
|
85
|
+
end
|
|
86
|
+
return
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
metatable = getmetatable(metatable)
|
|
90
|
+
end
|
|
91
|
+
rawset(self, key, value)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
local __TS__SetDescriptor
|
|
96
|
+
do
|
|
97
|
+
local getmetatable = _G.getmetatable
|
|
98
|
+
local function descriptorIndex(self, key)
|
|
99
|
+
return __TS__DescriptorGet(
|
|
100
|
+
self,
|
|
101
|
+
getmetatable(self),
|
|
102
|
+
key
|
|
103
|
+
)
|
|
104
|
+
end
|
|
105
|
+
local function descriptorNewIndex(self, key, value)
|
|
106
|
+
return __TS__DescriptorSet(
|
|
107
|
+
self,
|
|
108
|
+
getmetatable(self),
|
|
109
|
+
key,
|
|
110
|
+
value
|
|
111
|
+
)
|
|
112
|
+
end
|
|
113
|
+
function __TS__SetDescriptor(target, key, desc, isPrototype)
|
|
114
|
+
if isPrototype == nil then
|
|
115
|
+
isPrototype = false
|
|
116
|
+
end
|
|
117
|
+
local ____isPrototype_0
|
|
118
|
+
if isPrototype then
|
|
119
|
+
____isPrototype_0 = target
|
|
120
|
+
else
|
|
121
|
+
____isPrototype_0 = getmetatable(target)
|
|
122
|
+
end
|
|
123
|
+
local metatable = ____isPrototype_0
|
|
124
|
+
if not metatable then
|
|
125
|
+
metatable = {}
|
|
126
|
+
setmetatable(target, metatable)
|
|
127
|
+
end
|
|
128
|
+
if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
|
|
129
|
+
local instanceMetatable = {}
|
|
130
|
+
instanceMetatable._isOwnDescriptorMetatable = true
|
|
131
|
+
setmetatable(instanceMetatable, metatable)
|
|
132
|
+
setmetatable(target, instanceMetatable)
|
|
133
|
+
metatable = instanceMetatable
|
|
134
|
+
end
|
|
135
|
+
local value = rawget(target, key)
|
|
136
|
+
if value ~= nil then
|
|
137
|
+
rawset(target, key, nil)
|
|
138
|
+
end
|
|
139
|
+
if not rawget(metatable, "_descriptors") then
|
|
140
|
+
metatable._descriptors = {}
|
|
141
|
+
end
|
|
142
|
+
metatable._descriptors[key] = __TS__CloneDescriptor(desc)
|
|
143
|
+
metatable.__index = descriptorIndex
|
|
144
|
+
metatable.__newindex = descriptorNewIndex
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
local function __TS__ClassExtends(target, base)
|
|
149
|
+
target.____super = base
|
|
150
|
+
local staticMetatable = setmetatable({__index = base}, base)
|
|
151
|
+
setmetatable(target, staticMetatable)
|
|
152
|
+
local baseMetatable = getmetatable(base)
|
|
153
|
+
if baseMetatable then
|
|
154
|
+
if type(baseMetatable.__index) == "function" then
|
|
155
|
+
staticMetatable.__index = baseMetatable.__index
|
|
156
|
+
end
|
|
157
|
+
if type(baseMetatable.__newindex) == "function" then
|
|
158
|
+
staticMetatable.__newindex = baseMetatable.__newindex
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
setmetatable(target.prototype, base.prototype)
|
|
162
|
+
if type(base.prototype.__index) == "function" then
|
|
163
|
+
target.prototype.__index = base.prototype.__index
|
|
164
|
+
end
|
|
165
|
+
if type(base.prototype.__newindex) == "function" then
|
|
166
|
+
target.prototype.__newindex = base.prototype.__newindex
|
|
167
|
+
end
|
|
168
|
+
if type(base.prototype.__tostring) == "function" then
|
|
169
|
+
target.prototype.__tostring = base.prototype.__tostring
|
|
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 ____DataSource = require("datasources.DataSource")
|
|
181
|
+
local DataSource = ____DataSource.DataSource
|
|
182
|
+
____exports.Unit = {Player = "player", Target = "target", Focus = "focus"}
|
|
183
|
+
____exports.UnitPredicates = __TS__Class()
|
|
184
|
+
local UnitPredicates = ____exports.UnitPredicates
|
|
185
|
+
UnitPredicates.name = "UnitPredicates"
|
|
186
|
+
function UnitPredicates.prototype.____constructor(self, token)
|
|
187
|
+
self.token = token
|
|
188
|
+
end
|
|
189
|
+
__TS__SetDescriptor(
|
|
190
|
+
UnitPredicates.prototype,
|
|
191
|
+
"PC",
|
|
192
|
+
{get = function(self)
|
|
193
|
+
local value = UnitIsPlayer(self.token)
|
|
194
|
+
local ____issecretvalue_result_0
|
|
195
|
+
if issecretvalue(value) then
|
|
196
|
+
____issecretvalue_result_0 = nil
|
|
197
|
+
else
|
|
198
|
+
____issecretvalue_result_0 = value
|
|
199
|
+
end
|
|
200
|
+
return ____issecretvalue_result_0
|
|
201
|
+
end},
|
|
202
|
+
true
|
|
203
|
+
)
|
|
204
|
+
__TS__SetDescriptor(
|
|
205
|
+
UnitPredicates.prototype,
|
|
206
|
+
"Self",
|
|
207
|
+
{get = function(self)
|
|
208
|
+
local value = UnitIsUnit(self.token, "player")
|
|
209
|
+
local ____issecretvalue_result_1
|
|
210
|
+
if issecretvalue(value) then
|
|
211
|
+
____issecretvalue_result_1 = nil
|
|
212
|
+
else
|
|
213
|
+
____issecretvalue_result_1 = value
|
|
214
|
+
end
|
|
215
|
+
return ____issecretvalue_result_1
|
|
216
|
+
end},
|
|
217
|
+
true
|
|
218
|
+
)
|
|
219
|
+
--- Shared live unit reference; identity is read again rather than cached by token.
|
|
220
|
+
____exports.UnitSource = __TS__Class()
|
|
221
|
+
local UnitSource = ____exports.UnitSource
|
|
222
|
+
UnitSource.name = "UnitSource"
|
|
223
|
+
__TS__ClassExtends(UnitSource, DataSource)
|
|
224
|
+
function UnitSource.prototype.____constructor(self, Token)
|
|
225
|
+
DataSource.prototype.____constructor(self, nil)
|
|
226
|
+
self.Token = Token
|
|
227
|
+
self.restricted = false
|
|
228
|
+
self.Is = __TS__New(____exports.UnitPredicates, Token)
|
|
229
|
+
end
|
|
230
|
+
function UnitSource.prototype.HasSecretFields(self)
|
|
231
|
+
return self.restricted
|
|
232
|
+
end
|
|
233
|
+
function UnitSource.prototype.GetValue(self)
|
|
234
|
+
local guid = UnitGUID(self.Token)
|
|
235
|
+
self.restricted = issecretvalue(guid)
|
|
236
|
+
if self.restricted or guid == nil then
|
|
237
|
+
return nil
|
|
238
|
+
end
|
|
239
|
+
return {token = self.Token, guid = guid}
|
|
240
|
+
end
|
|
241
|
+
--- Reuse explicit unit references; string inputs remain a convenience shorthand.
|
|
242
|
+
function ____exports.resolveUnit(self, unit)
|
|
243
|
+
return type(unit) == "string" and __TS__New(____exports.UnitSource, unit) or unit
|
|
244
|
+
end
|
|
245
|
+
return ____exports
|
|
@@ -2,3 +2,11 @@
|
|
|
2
2
|
export { DataSource } from "./DataSource";
|
|
3
3
|
export { ProgressSource } from "./ProgressSource";
|
|
4
4
|
export { HP, Mana, Unit, DataSources } from "./Resources";
|
|
5
|
+
export { Aura, AuraSource, Buffs, Debuffs } from "./Auras";
|
|
6
|
+
export type { AuraSourceStatus } from "./Auras";
|
|
7
|
+
export { GroupMembers, PartyMembers, RaidMembers } from "./GroupMembers";
|
|
8
|
+
export type { GroupScope } from "./GroupMembers";
|
|
9
|
+
export { ClassSource, SpecSource, Specializations } from "./UnitInfo";
|
|
10
|
+
export type { ClassInfo, SpecializationInfo, InspectStatus } from "./UnitInfo";
|
|
11
|
+
export { UnitSource } from "./UnitSource";
|
|
12
|
+
export type { UnitInput, UnitIdentity } from "./UnitSource";
|
|
@@ -15,4 +15,27 @@ do
|
|
|
15
15
|
____exports.Unit = ____Resources.Unit
|
|
16
16
|
____exports.DataSources = ____Resources.DataSources
|
|
17
17
|
end
|
|
18
|
+
do
|
|
19
|
+
local ____Auras = require("datasources.Auras")
|
|
20
|
+
____exports.Aura = ____Auras.Aura
|
|
21
|
+
____exports.AuraSource = ____Auras.AuraSource
|
|
22
|
+
____exports.Buffs = ____Auras.Buffs
|
|
23
|
+
____exports.Debuffs = ____Auras.Debuffs
|
|
24
|
+
end
|
|
25
|
+
do
|
|
26
|
+
local ____GroupMembers = require("datasources.GroupMembers")
|
|
27
|
+
____exports.GroupMembers = ____GroupMembers.GroupMembers
|
|
28
|
+
____exports.PartyMembers = ____GroupMembers.PartyMembers
|
|
29
|
+
____exports.RaidMembers = ____GroupMembers.RaidMembers
|
|
30
|
+
end
|
|
31
|
+
do
|
|
32
|
+
local ____UnitInfo = require("datasources.UnitInfo")
|
|
33
|
+
____exports.ClassSource = ____UnitInfo.ClassSource
|
|
34
|
+
____exports.SpecSource = ____UnitInfo.SpecSource
|
|
35
|
+
____exports.Specializations = ____UnitInfo.Specializations
|
|
36
|
+
end
|
|
37
|
+
do
|
|
38
|
+
local ____UnitSource = require("datasources.UnitSource")
|
|
39
|
+
____exports.UnitSource = ____UnitSource.UnitSource
|
|
40
|
+
end
|
|
18
41
|
return ____exports
|
package/lib/index.d.ts
CHANGED
package/lib/index.lua
CHANGED
package/lib/ui/Cell.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import type { Decorations } from "./decorations/Decorations";
|
|
|
3
3
|
import type { Position } from "../types/Position";
|
|
4
4
|
import type { Spacing } from "../types/Spacing";
|
|
5
5
|
export type Size = number | "inherit";
|
|
6
|
+
/** Common visual descriptor accepted by the mounting API. */
|
|
7
|
+
export interface Cell extends Element {
|
|
8
|
+
}
|
|
6
9
|
export type CellProps = {
|
|
7
10
|
width: Size;
|
|
8
11
|
height: Size;
|
|
@@ -18,4 +21,4 @@ export interface ICell extends Element {
|
|
|
18
21
|
}
|
|
19
22
|
export declare function Cell(props: Partial<CellProps> & {
|
|
20
23
|
child?: Element;
|
|
21
|
-
}, child?: Element):
|
|
24
|
+
}, child?: Element): Cell;
|
package/lib/ui/Cell.lua
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local ____jsx = require("ui.primitives.jsx")
|
|
4
4
|
local UI = ____jsx.UI
|
|
5
|
+
--- Common visual descriptor accepted by the mounting API.
|
|
5
6
|
function ____exports.Cell(self, props, child)
|
|
6
7
|
return UI:createElement("cell", props, props.child or child or ({}))
|
|
7
8
|
end
|
package/lib/wuira.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Cell } from "./ui/Cell";
|
|
2
2
|
import type { Anchor } from "./types/Position";
|
|
3
3
|
/** Public entry point for mounting JSX UI trees. */
|
|
4
4
|
export declare class wuira {
|
|
5
5
|
private constructor();
|
|
6
|
-
static Mount(frame:
|
|
6
|
+
static Mount(frame: Cell | void | (() => Cell | void), anchor?: Anchor, parent?: wuiraNativeFrame): wuiraNativeFrame | undefined;
|
|
7
7
|
static Unmount(frame: wuiraNativeFrame): void;
|
|
8
8
|
}
|
package/lib/wuira.lua
CHANGED
|
@@ -18,8 +18,14 @@ wuira.name = "wuira"
|
|
|
18
18
|
function wuira.prototype.____constructor(self)
|
|
19
19
|
end
|
|
20
20
|
function wuira.Mount(self, frame, anchor, parent)
|
|
21
|
-
local
|
|
22
|
-
if
|
|
21
|
+
local ____temp_0
|
|
22
|
+
if type(frame) == "function" then
|
|
23
|
+
____temp_0 = frame(nil)
|
|
24
|
+
else
|
|
25
|
+
____temp_0 = frame
|
|
26
|
+
end
|
|
27
|
+
local view = ____temp_0
|
|
28
|
+
if view == nil or view.kind == "empty" then
|
|
23
29
|
return nil
|
|
24
30
|
end
|
|
25
31
|
return mount(nil, view, parent, anchor)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wuira",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Kerim Cetinbas",
|
|
6
6
|
"email": "a.cetinbas@icloud.com"
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"tsconfig.json",
|
|
51
51
|
"tsconfig.lib.json",
|
|
52
52
|
"README.md",
|
|
53
|
+
"CHANGELOG.md",
|
|
53
54
|
"LICENSE"
|
|
54
55
|
],
|
|
55
56
|
"engines": {
|