wuira 0.2.0 → 0.2.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/CHANGELOG.md +10 -0
- package/README.md +15 -15
- package/lib/WuiraApp.d.ts +12 -0
- package/lib/WuiraApp.lua +425 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.lua +5 -0
- package/lib/rendering/decorations.d.ts +2 -0
- package/lib/rendering/decorations.lua +42 -0
- package/lib/rendering/layout.d.ts +16 -0
- package/lib/rendering/layout.lua +594 -0
- package/lib/rendering/progress.d.ts +2 -0
- package/lib/rendering/progress.lua +196 -0
- package/lib/rendering/secureButton.d.ts +2 -0
- package/lib/rendering/secureButton.lua +46 -0
- package/lib/rendering/types.d.ts +25 -0
- package/lib/rendering/types.lua +3 -0
- package/lib/rendering/updates.d.ts +3 -0
- package/lib/rendering/updates.lua +30 -0
- package/lib/rendering/visibility.d.ts +6 -0
- package/lib/rendering/visibility.lua +85 -0
- package/lib/rendering/widgets.d.ts +4 -0
- package/lib/rendering/widgets.lua +83 -0
- package/lib/wuira.d.ts +8 -4
- package/lib/wuira.lua +215 -27
- package/package.json +1 -1
- package/templates/addon/src/index.tsx +2 -2
- package/lib/ui/mount.d.ts +0 -5
- package/lib/ui/mount.lua +0 -1107
package/lib/wuira.lua
CHANGED
|
@@ -6,36 +6,224 @@ local function __TS__Class(self)
|
|
|
6
6
|
c.prototype.constructor = c
|
|
7
7
|
return c
|
|
8
8
|
end
|
|
9
|
-
|
|
10
|
-
local
|
|
11
|
-
local
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
local
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
|
|
10
|
+
local function __TS__New(target, ...)
|
|
11
|
+
local instance = setmetatable({}, target.prototype)
|
|
12
|
+
instance:____constructor(...)
|
|
13
|
+
return instance
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
local function __TS__CloneDescriptor(____bindingPattern0)
|
|
17
|
+
local value
|
|
18
|
+
local writable
|
|
19
|
+
local set
|
|
20
|
+
local get
|
|
21
|
+
local configurable
|
|
22
|
+
local enumerable
|
|
23
|
+
enumerable = ____bindingPattern0.enumerable
|
|
24
|
+
configurable = ____bindingPattern0.configurable
|
|
25
|
+
get = ____bindingPattern0.get
|
|
26
|
+
set = ____bindingPattern0.set
|
|
27
|
+
writable = ____bindingPattern0.writable
|
|
28
|
+
value = ____bindingPattern0.value
|
|
29
|
+
local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
|
|
30
|
+
local hasGetterOrSetter = get ~= nil or set ~= nil
|
|
31
|
+
local hasValueOrWritableAttribute = writable ~= nil or value ~= nil
|
|
32
|
+
if hasGetterOrSetter and hasValueOrWritableAttribute then
|
|
33
|
+
error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
|
|
34
|
+
end
|
|
35
|
+
if get or set then
|
|
36
|
+
descriptor.get = get
|
|
37
|
+
descriptor.set = set
|
|
29
38
|
else
|
|
30
|
-
|
|
39
|
+
descriptor.value = value
|
|
40
|
+
descriptor.writable = writable == true
|
|
41
|
+
end
|
|
42
|
+
return descriptor
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
local __TS__DescriptorGet
|
|
46
|
+
do
|
|
47
|
+
local getmetatable = _G.getmetatable
|
|
48
|
+
local ____rawget = _G.rawget
|
|
49
|
+
function __TS__DescriptorGet(self, metatable, key)
|
|
50
|
+
while metatable do
|
|
51
|
+
local rawResult = ____rawget(metatable, key)
|
|
52
|
+
if rawResult ~= nil then
|
|
53
|
+
return rawResult
|
|
54
|
+
end
|
|
55
|
+
local descriptors = ____rawget(metatable, "_descriptors")
|
|
56
|
+
if descriptors then
|
|
57
|
+
local descriptor = descriptors[key]
|
|
58
|
+
if descriptor ~= nil then
|
|
59
|
+
if descriptor.get then
|
|
60
|
+
return descriptor.get(self)
|
|
61
|
+
end
|
|
62
|
+
return descriptor.value
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
metatable = getmetatable(metatable)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
local __TS__DescriptorSet
|
|
71
|
+
do
|
|
72
|
+
local getmetatable = _G.getmetatable
|
|
73
|
+
local ____rawget = _G.rawget
|
|
74
|
+
local rawset = _G.rawset
|
|
75
|
+
function __TS__DescriptorSet(self, metatable, key, value)
|
|
76
|
+
while metatable do
|
|
77
|
+
local descriptors = ____rawget(metatable, "_descriptors")
|
|
78
|
+
if descriptors then
|
|
79
|
+
local descriptor = descriptors[key]
|
|
80
|
+
if descriptor ~= nil then
|
|
81
|
+
if descriptor.set then
|
|
82
|
+
descriptor.set(self, value)
|
|
83
|
+
else
|
|
84
|
+
if descriptor.writable == false then
|
|
85
|
+
error(
|
|
86
|
+
((("Cannot assign to read only property '" .. key) .. "' of object '") .. tostring(self)) .. "'",
|
|
87
|
+
0
|
|
88
|
+
)
|
|
89
|
+
end
|
|
90
|
+
descriptor.value = value
|
|
91
|
+
end
|
|
92
|
+
return
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
metatable = getmetatable(metatable)
|
|
96
|
+
end
|
|
97
|
+
rawset(self, key, value)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
local __TS__SetDescriptor
|
|
102
|
+
do
|
|
103
|
+
local getmetatable = _G.getmetatable
|
|
104
|
+
local function descriptorIndex(self, key)
|
|
105
|
+
return __TS__DescriptorGet(
|
|
106
|
+
self,
|
|
107
|
+
getmetatable(self),
|
|
108
|
+
key
|
|
109
|
+
)
|
|
31
110
|
end
|
|
32
|
-
local
|
|
33
|
-
|
|
34
|
-
|
|
111
|
+
local function descriptorNewIndex(self, key, value)
|
|
112
|
+
return __TS__DescriptorSet(
|
|
113
|
+
self,
|
|
114
|
+
getmetatable(self),
|
|
115
|
+
key,
|
|
116
|
+
value
|
|
117
|
+
)
|
|
35
118
|
end
|
|
36
|
-
|
|
119
|
+
function __TS__SetDescriptor(target, key, desc, isPrototype)
|
|
120
|
+
if isPrototype == nil then
|
|
121
|
+
isPrototype = false
|
|
122
|
+
end
|
|
123
|
+
local ____isPrototype_0
|
|
124
|
+
if isPrototype then
|
|
125
|
+
____isPrototype_0 = target
|
|
126
|
+
else
|
|
127
|
+
____isPrototype_0 = getmetatable(target)
|
|
128
|
+
end
|
|
129
|
+
local metatable = ____isPrototype_0
|
|
130
|
+
if not metatable then
|
|
131
|
+
metatable = {}
|
|
132
|
+
setmetatable(target, metatable)
|
|
133
|
+
end
|
|
134
|
+
if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
|
|
135
|
+
local instanceMetatable = {}
|
|
136
|
+
instanceMetatable._isOwnDescriptorMetatable = true
|
|
137
|
+
setmetatable(instanceMetatable, metatable)
|
|
138
|
+
setmetatable(target, instanceMetatable)
|
|
139
|
+
metatable = instanceMetatable
|
|
140
|
+
end
|
|
141
|
+
local value = rawget(target, key)
|
|
142
|
+
if value ~= nil then
|
|
143
|
+
rawset(target, key, nil)
|
|
144
|
+
end
|
|
145
|
+
if not rawget(metatable, "_descriptors") then
|
|
146
|
+
metatable._descriptors = {}
|
|
147
|
+
end
|
|
148
|
+
metatable._descriptors[key] = __TS__CloneDescriptor(desc)
|
|
149
|
+
metatable.__index = descriptorIndex
|
|
150
|
+
metatable.__newindex = descriptorNewIndex
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
local function __TS__ObjectDefineProperty(target, key, desc)
|
|
155
|
+
local luaKey = type(key) == "number" and key + 1 or key
|
|
156
|
+
local value = rawget(target, luaKey)
|
|
157
|
+
local hasGetterOrSetter = desc.get ~= nil or desc.set ~= nil
|
|
158
|
+
local descriptor
|
|
159
|
+
if hasGetterOrSetter then
|
|
160
|
+
if value ~= nil then
|
|
161
|
+
error(
|
|
162
|
+
"Cannot redefine property: " .. tostring(key),
|
|
163
|
+
0
|
|
164
|
+
)
|
|
165
|
+
end
|
|
166
|
+
descriptor = desc
|
|
167
|
+
else
|
|
168
|
+
local valueExists = value ~= nil
|
|
169
|
+
local ____desc_set_4 = desc.set
|
|
170
|
+
local ____desc_get_5 = desc.get
|
|
171
|
+
local ____desc_configurable_0 = desc.configurable
|
|
172
|
+
if ____desc_configurable_0 == nil then
|
|
173
|
+
____desc_configurable_0 = valueExists
|
|
174
|
+
end
|
|
175
|
+
local ____desc_enumerable_1 = desc.enumerable
|
|
176
|
+
if ____desc_enumerable_1 == nil then
|
|
177
|
+
____desc_enumerable_1 = valueExists
|
|
178
|
+
end
|
|
179
|
+
local ____desc_writable_2 = desc.writable
|
|
180
|
+
if ____desc_writable_2 == nil then
|
|
181
|
+
____desc_writable_2 = valueExists
|
|
182
|
+
end
|
|
183
|
+
local ____temp_3
|
|
184
|
+
if desc.value ~= nil then
|
|
185
|
+
____temp_3 = desc.value
|
|
186
|
+
else
|
|
187
|
+
____temp_3 = value
|
|
188
|
+
end
|
|
189
|
+
descriptor = {
|
|
190
|
+
set = ____desc_set_4,
|
|
191
|
+
get = ____desc_get_5,
|
|
192
|
+
configurable = ____desc_configurable_0,
|
|
193
|
+
enumerable = ____desc_enumerable_1,
|
|
194
|
+
writable = ____desc_writable_2,
|
|
195
|
+
value = ____temp_3
|
|
196
|
+
}
|
|
197
|
+
end
|
|
198
|
+
__TS__SetDescriptor(target, luaKey, descriptor)
|
|
199
|
+
return target
|
|
200
|
+
end
|
|
201
|
+
-- End of Lua Library inline imports
|
|
202
|
+
local ____exports = {}
|
|
203
|
+
local ____WuiraApp = require("WuiraApp")
|
|
204
|
+
local WuiraApp = ____WuiraApp.WuiraApp
|
|
205
|
+
--- Static access to the current addon's application. Each addon owns its module instance.
|
|
206
|
+
____exports.Wuira = __TS__Class()
|
|
207
|
+
local Wuira = ____exports.Wuira
|
|
208
|
+
Wuira.name = "Wuira"
|
|
209
|
+
function Wuira.prototype.____constructor(self)
|
|
210
|
+
end
|
|
211
|
+
function Wuira.registerCommand(self, command, callback)
|
|
212
|
+
return ____exports.Wuira.App:registerCommand(command, callback)
|
|
213
|
+
end
|
|
214
|
+
function Wuira.Mount(self, component, anchor, parent)
|
|
215
|
+
return ____exports.Wuira.App:Mount(component, anchor, parent)
|
|
37
216
|
end
|
|
38
|
-
function
|
|
39
|
-
|
|
217
|
+
function Wuira.Unmount(self, frame)
|
|
218
|
+
____exports.Wuira.App:Unmount(frame)
|
|
40
219
|
end
|
|
220
|
+
Wuira.application = __TS__New(WuiraApp)
|
|
221
|
+
__TS__ObjectDefineProperty(
|
|
222
|
+
Wuira,
|
|
223
|
+
"App",
|
|
224
|
+
{get = function(self)
|
|
225
|
+
return ____exports.Wuira.application
|
|
226
|
+
end}
|
|
227
|
+
)
|
|
228
|
+
____exports.wuira = ____exports.Wuira
|
|
41
229
|
return ____exports
|
package/package.json
CHANGED
package/lib/ui/mount.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Element } from "./primitives/jsx";
|
|
2
|
-
import type { Anchor } from "../types/Position";
|
|
3
|
-
export declare function unmount(frame: wuiraNativeFrame): void;
|
|
4
|
-
/** Creates the tree before resolving anchors. Positive y moves down. */
|
|
5
|
-
export declare function mount(element: Element, parent?: wuiraNativeFrame, rootAnchor?: Anchor): wuiraNativeFrame;
|