wuira 0.2.8 → 0.3.2
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 +29 -0
- package/README.md +6 -2
- package/docs/icons.md +1 -1
- package/docs/nameplates.md +1 -1
- package/lib/index.d.ts +0 -15
- package/lib/index.lua +0 -26
- package/lib/platform/forever.d.ts +2 -1
- package/lib/platform/index.d.ts +5 -0
- package/lib/platform/index.lua +11 -0
- package/lib/rendering/layout.lua +2 -2
- package/lib/rendering/progress.lua +9 -3
- package/lib/rendering/widgets.lua +8 -1
- package/lib/ui/Cell.d.ts +1 -1
- package/lib/ui/FlowLayout.d.ts +16 -4
- package/lib/ui/GridLayout.d.ts +10 -1
- package/lib/ui/ScrollHost.lua +9 -4
- package/lib/ui/UnitPortrait.d.ts +3 -0
- package/lib/ui/UnitPortrait.lua +233 -0
- package/lib/ui/decorations/backgroundTextures.d.ts +2 -22
- package/lib/ui/decorations/backgroundTextures.lua +3 -7
- package/lib/ui/decorations/borderTextures.d.ts +2 -37
- package/lib/ui/decorations/borderTextures.lua +3 -9
- package/lib/ui/decorations/statusBarTextures.d.ts +5 -12
- package/lib/ui/decorations/statusBarTextures.lua +83 -4
- package/lib/ui/index.d.ts +6 -0
- package/lib/ui/index.lua +19 -0
- package/lib/ui/layout/calculateFlow.d.ts +16 -4
- package/lib/ui/layout/calculateFlow.lua +153 -46
- package/lib/ui/layout/calculateGrid.d.ts +6 -5
- package/lib/ui/layout/calculateGrid.lua +80 -6
- package/lib/ui/layout/measureLayout.lua +118 -39
- package/lib/ui/media/clientMedia.d.ts +177 -0
- package/lib/ui/media/clientMedia.lua +49 -0
- package/lib/ui/overlayGlow.d.ts +21 -0
- package/lib/ui/overlayGlow.lua +350 -0
- package/package.json +8 -1
|
@@ -0,0 +1,350 @@
|
|
|
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
|
+
local function finite(self, value, fallback)
|
|
9
|
+
return type(value) == "number" and __TS__NumberIsFinite(value) and value or fallback
|
|
10
|
+
end
|
|
11
|
+
local function count(self, value, fallback, limit)
|
|
12
|
+
local number = math.floor(finite(nil, value, fallback))
|
|
13
|
+
if number < 1 then
|
|
14
|
+
return 1
|
|
15
|
+
end
|
|
16
|
+
return number > limit and limit or number
|
|
17
|
+
end
|
|
18
|
+
local function quad(self, parent)
|
|
19
|
+
local texture = parent:CreateTexture(nil, "OVERLAY")
|
|
20
|
+
if texture.SetColorTexture ~= nil then
|
|
21
|
+
texture:SetColorTexture(1, 1, 1, 1)
|
|
22
|
+
else
|
|
23
|
+
texture:SetTexture("Interface\\Buttons\\WHITE8X8")
|
|
24
|
+
end
|
|
25
|
+
texture:SetBlendMode("ADD")
|
|
26
|
+
return texture
|
|
27
|
+
end
|
|
28
|
+
--- Additive overlay. Addon code cannot install a shader, so each style is drawn with colored textures.
|
|
29
|
+
function ____exports.startOverlayGlow(self, frame, options)
|
|
30
|
+
local kind = options.kind
|
|
31
|
+
if kind ~= "buttonOverlay" and kind ~= "Pixel" and kind ~= "ACShine" and kind ~= "Proc" then
|
|
32
|
+
return function()
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
local host
|
|
36
|
+
do
|
|
37
|
+
local function ____catch()
|
|
38
|
+
return true, function()
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
local ____try, ____hasReturned, ____returnValue = pcall(function()
|
|
42
|
+
host = CreateFrame("Frame", nil, frame)
|
|
43
|
+
end)
|
|
44
|
+
if not ____try then
|
|
45
|
+
____hasReturned, ____returnValue = ____catch()
|
|
46
|
+
end
|
|
47
|
+
if ____hasReturned then
|
|
48
|
+
return ____returnValue
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
host:SetAllPoints(frame)
|
|
52
|
+
local level = frame:GetFrameLevel()
|
|
53
|
+
if type(level) == "number" then
|
|
54
|
+
host:SetFrameLevel(level + 6)
|
|
55
|
+
end
|
|
56
|
+
host:EnableMouse(false)
|
|
57
|
+
host:Show()
|
|
58
|
+
local color = options.color
|
|
59
|
+
local red = finite(nil, color and color.r, 0.95)
|
|
60
|
+
local green = finite(nil, color and color.g, 0.95)
|
|
61
|
+
local blue = finite(nil, color and color.b, 0.32)
|
|
62
|
+
local alpha = finite(nil, color and color.a, 1)
|
|
63
|
+
local frequency = finite(nil, options.frequency, 0.25)
|
|
64
|
+
local xOffset = finite(nil, options.x, 0)
|
|
65
|
+
local yOffset = finite(nil, options.y, 0)
|
|
66
|
+
local pieces = {}
|
|
67
|
+
local phase = 0
|
|
68
|
+
local running = true
|
|
69
|
+
local function paint(____, texture, amount)
|
|
70
|
+
return texture:SetVertexColor(red, green, blue, alpha * amount)
|
|
71
|
+
end
|
|
72
|
+
if kind == "buttonOverlay" then
|
|
73
|
+
local thickness = math.max(
|
|
74
|
+
1,
|
|
75
|
+
finite(nil, options.thickness, 3)
|
|
76
|
+
)
|
|
77
|
+
do
|
|
78
|
+
local index = 0
|
|
79
|
+
while index < 4 do
|
|
80
|
+
pieces[#pieces + 1] = quad(nil, host)
|
|
81
|
+
index = index + 1
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
host:SetScript(
|
|
85
|
+
"OnUpdate",
|
|
86
|
+
function(_host, elapsed)
|
|
87
|
+
if not running then
|
|
88
|
+
return
|
|
89
|
+
end
|
|
90
|
+
phase = phase + elapsed * frequency
|
|
91
|
+
local pulse = 0.35 + 0.65 * (0.5 + 0.5 * math.sin(phase * 6.28318))
|
|
92
|
+
local width = host:GetWidth()
|
|
93
|
+
local height = host:GetHeight()
|
|
94
|
+
if width <= 0 or height <= 0 then
|
|
95
|
+
return
|
|
96
|
+
end
|
|
97
|
+
local top = pieces[1]
|
|
98
|
+
local bottom = pieces[2]
|
|
99
|
+
local left = pieces[3]
|
|
100
|
+
local right = pieces[4]
|
|
101
|
+
top:ClearAllPoints()
|
|
102
|
+
top:SetSize(width + xOffset * 2, thickness)
|
|
103
|
+
top:SetPoint(
|
|
104
|
+
"TOPLEFT",
|
|
105
|
+
host,
|
|
106
|
+
"TOPLEFT",
|
|
107
|
+
-xOffset,
|
|
108
|
+
yOffset
|
|
109
|
+
)
|
|
110
|
+
bottom:ClearAllPoints()
|
|
111
|
+
bottom:SetSize(width + xOffset * 2, thickness)
|
|
112
|
+
bottom:SetPoint(
|
|
113
|
+
"BOTTOMLEFT",
|
|
114
|
+
host,
|
|
115
|
+
"BOTTOMLEFT",
|
|
116
|
+
-xOffset,
|
|
117
|
+
-yOffset
|
|
118
|
+
)
|
|
119
|
+
left:ClearAllPoints()
|
|
120
|
+
left:SetSize(thickness, height)
|
|
121
|
+
left:SetPoint(
|
|
122
|
+
"TOPLEFT",
|
|
123
|
+
host,
|
|
124
|
+
"TOPLEFT",
|
|
125
|
+
-xOffset,
|
|
126
|
+
yOffset
|
|
127
|
+
)
|
|
128
|
+
right:ClearAllPoints()
|
|
129
|
+
right:SetSize(thickness, height)
|
|
130
|
+
right:SetPoint(
|
|
131
|
+
"TOPRIGHT",
|
|
132
|
+
host,
|
|
133
|
+
"TOPRIGHT",
|
|
134
|
+
xOffset,
|
|
135
|
+
yOffset
|
|
136
|
+
)
|
|
137
|
+
for ____, texture in ipairs(pieces) do
|
|
138
|
+
paint(nil, texture, pulse)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
)
|
|
142
|
+
elseif kind == "Pixel" then
|
|
143
|
+
local lines = count(nil, options.lines, 8, 24)
|
|
144
|
+
local length = math.max(
|
|
145
|
+
2,
|
|
146
|
+
finite(nil, options.length, 10)
|
|
147
|
+
)
|
|
148
|
+
local thickness = math.max(
|
|
149
|
+
1,
|
|
150
|
+
finite(nil, options.thickness, 2)
|
|
151
|
+
)
|
|
152
|
+
do
|
|
153
|
+
local index = 0
|
|
154
|
+
while index < lines do
|
|
155
|
+
pieces[#pieces + 1] = quad(nil, host)
|
|
156
|
+
index = index + 1
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
local edges = options.border == true and ({
|
|
160
|
+
quad(nil, host),
|
|
161
|
+
quad(nil, host),
|
|
162
|
+
quad(nil, host),
|
|
163
|
+
quad(nil, host)
|
|
164
|
+
}) or ({})
|
|
165
|
+
host:SetScript(
|
|
166
|
+
"OnUpdate",
|
|
167
|
+
function(_host, elapsed)
|
|
168
|
+
if not running then
|
|
169
|
+
return
|
|
170
|
+
end
|
|
171
|
+
phase = phase + elapsed * frequency
|
|
172
|
+
local width = host:GetWidth() + xOffset * 2
|
|
173
|
+
local height = host:GetHeight() + yOffset * 2
|
|
174
|
+
local perimeter = (width + height) * 2
|
|
175
|
+
if perimeter <= 0 then
|
|
176
|
+
return
|
|
177
|
+
end
|
|
178
|
+
if #edges == 4 then
|
|
179
|
+
local edge = math.max(1, thickness)
|
|
180
|
+
edges[1]:ClearAllPoints()
|
|
181
|
+
edges[1]:SetSize(width, edge)
|
|
182
|
+
edges[1]:SetPoint(
|
|
183
|
+
"TOPLEFT",
|
|
184
|
+
host,
|
|
185
|
+
"TOPLEFT",
|
|
186
|
+
-xOffset,
|
|
187
|
+
yOffset
|
|
188
|
+
)
|
|
189
|
+
edges[2]:ClearAllPoints()
|
|
190
|
+
edges[2]:SetSize(width, edge)
|
|
191
|
+
edges[2]:SetPoint(
|
|
192
|
+
"BOTTOMLEFT",
|
|
193
|
+
host,
|
|
194
|
+
"BOTTOMLEFT",
|
|
195
|
+
-xOffset,
|
|
196
|
+
-yOffset
|
|
197
|
+
)
|
|
198
|
+
edges[3]:ClearAllPoints()
|
|
199
|
+
edges[3]:SetSize(edge, height)
|
|
200
|
+
edges[3]:SetPoint(
|
|
201
|
+
"TOPLEFT",
|
|
202
|
+
host,
|
|
203
|
+
"TOPLEFT",
|
|
204
|
+
-xOffset,
|
|
205
|
+
yOffset
|
|
206
|
+
)
|
|
207
|
+
edges[4]:ClearAllPoints()
|
|
208
|
+
edges[4]:SetSize(edge, height)
|
|
209
|
+
edges[4]:SetPoint(
|
|
210
|
+
"TOPRIGHT",
|
|
211
|
+
host,
|
|
212
|
+
"TOPRIGHT",
|
|
213
|
+
xOffset,
|
|
214
|
+
yOffset
|
|
215
|
+
)
|
|
216
|
+
for ____, texture in ipairs(edges) do
|
|
217
|
+
paint(nil, texture, 0.35)
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
do
|
|
221
|
+
local index = 0
|
|
222
|
+
while index < lines do
|
|
223
|
+
local distance = ((phase + index / lines) % 1 + 1) % 1 * perimeter
|
|
224
|
+
local x = 0
|
|
225
|
+
local y = 0
|
|
226
|
+
local horizontal = true
|
|
227
|
+
if distance <= width then
|
|
228
|
+
x = distance
|
|
229
|
+
y = 0
|
|
230
|
+
horizontal = true
|
|
231
|
+
elseif distance <= width + height then
|
|
232
|
+
x = width
|
|
233
|
+
y = distance - width
|
|
234
|
+
horizontal = false
|
|
235
|
+
elseif distance <= width * 2 + height then
|
|
236
|
+
x = width - (distance - width - height)
|
|
237
|
+
y = height
|
|
238
|
+
horizontal = true
|
|
239
|
+
else
|
|
240
|
+
x = 0
|
|
241
|
+
y = height - (distance - width * 2 - height)
|
|
242
|
+
horizontal = false
|
|
243
|
+
end
|
|
244
|
+
local texture = pieces[index + 1]
|
|
245
|
+
texture:ClearAllPoints()
|
|
246
|
+
texture:SetSize(horizontal and length or thickness, horizontal and thickness or length)
|
|
247
|
+
texture:SetPoint(
|
|
248
|
+
"CENTER",
|
|
249
|
+
host,
|
|
250
|
+
"TOPLEFT",
|
|
251
|
+
x - xOffset,
|
|
252
|
+
-(y - yOffset)
|
|
253
|
+
)
|
|
254
|
+
paint(nil, texture, 1)
|
|
255
|
+
index = index + 1
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
)
|
|
260
|
+
elseif kind == "ACShine" then
|
|
261
|
+
local lines = count(nil, options.lines, 4, 16)
|
|
262
|
+
local scale = math.max(
|
|
263
|
+
0.2,
|
|
264
|
+
finite(nil, options.scale, 1)
|
|
265
|
+
)
|
|
266
|
+
local size = 6 * scale
|
|
267
|
+
do
|
|
268
|
+
local index = 0
|
|
269
|
+
while index < lines do
|
|
270
|
+
pieces[#pieces + 1] = quad(nil, host)
|
|
271
|
+
index = index + 1
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
host:SetScript(
|
|
275
|
+
"OnUpdate",
|
|
276
|
+
function(_host, elapsed)
|
|
277
|
+
if not running then
|
|
278
|
+
return
|
|
279
|
+
end
|
|
280
|
+
phase = phase + elapsed * frequency
|
|
281
|
+
local radiusX = host:GetWidth() / 2 + xOffset
|
|
282
|
+
local radiusY = host:GetHeight() / 2 + yOffset
|
|
283
|
+
if radiusX == 0 and radiusY == 0 then
|
|
284
|
+
return
|
|
285
|
+
end
|
|
286
|
+
do
|
|
287
|
+
local index = 0
|
|
288
|
+
while index < lines do
|
|
289
|
+
local angle = phase * 6.28318 + index * 6.28318 / lines
|
|
290
|
+
local spark = 0.35 + 0.65 * (0.5 + 0.5 * math.sin(angle * 2))
|
|
291
|
+
local texture = pieces[index + 1]
|
|
292
|
+
texture:ClearAllPoints()
|
|
293
|
+
texture:SetSize(size, size)
|
|
294
|
+
texture:SetPoint(
|
|
295
|
+
"CENTER",
|
|
296
|
+
host,
|
|
297
|
+
"CENTER",
|
|
298
|
+
math.cos(angle) * radiusX,
|
|
299
|
+
math.sin(angle) * radiusY
|
|
300
|
+
)
|
|
301
|
+
paint(nil, texture, spark)
|
|
302
|
+
index = index + 1
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
)
|
|
307
|
+
else
|
|
308
|
+
local duration = math.max(
|
|
309
|
+
0.2,
|
|
310
|
+
finite(nil, options.duration, 1)
|
|
311
|
+
)
|
|
312
|
+
local burst = quad(nil, host)
|
|
313
|
+
pieces[#pieces + 1] = burst
|
|
314
|
+
host:SetScript(
|
|
315
|
+
"OnUpdate",
|
|
316
|
+
function(_host, elapsed)
|
|
317
|
+
if not running then
|
|
318
|
+
return
|
|
319
|
+
end
|
|
320
|
+
phase = phase + elapsed
|
|
321
|
+
local cycle = phase % duration / duration
|
|
322
|
+
local width = host:GetWidth()
|
|
323
|
+
local height = host:GetHeight()
|
|
324
|
+
if width <= 0 or height <= 0 then
|
|
325
|
+
return
|
|
326
|
+
end
|
|
327
|
+
local grow = 0.85 + cycle * 0.5
|
|
328
|
+
burst:ClearAllPoints()
|
|
329
|
+
burst:SetSize((width + xOffset * 2) * grow, (height + yOffset * 2) * grow)
|
|
330
|
+
burst:SetPoint(
|
|
331
|
+
"CENTER",
|
|
332
|
+
host,
|
|
333
|
+
"CENTER",
|
|
334
|
+
0,
|
|
335
|
+
0
|
|
336
|
+
)
|
|
337
|
+
paint(nil, burst, 1 - cycle)
|
|
338
|
+
end
|
|
339
|
+
)
|
|
340
|
+
end
|
|
341
|
+
return function()
|
|
342
|
+
running = false
|
|
343
|
+
host:SetScript("OnUpdate", nil)
|
|
344
|
+
for ____, texture in ipairs(pieces) do
|
|
345
|
+
texture:Hide()
|
|
346
|
+
end
|
|
347
|
+
host:Hide()
|
|
348
|
+
end
|
|
349
|
+
end
|
|
350
|
+
return ____exports
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "git",
|
|
5
5
|
"url": "git+https://github.com/KerimCETINBAS/wuira.git"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.2
|
|
7
|
+
"version": "0.3.2",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "Kerim Cetinbas",
|
|
10
10
|
"email": "a.cetinbas@icloud.com"
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
"types": "./lib/skins/index.d.ts",
|
|
33
33
|
"default": "./lib/skins/index.lua"
|
|
34
34
|
},
|
|
35
|
+
"./platform": {
|
|
36
|
+
"types": "./lib/platform/index.d.ts",
|
|
37
|
+
"default": "./lib/platform/index.lua"
|
|
38
|
+
},
|
|
35
39
|
"./spells": {
|
|
36
40
|
"types": "./lib/spells/index.d.ts",
|
|
37
41
|
"default": "./lib/spells/index.lua"
|
|
@@ -66,6 +70,9 @@
|
|
|
66
70
|
"skins": [
|
|
67
71
|
"lib/skins/index.d.ts"
|
|
68
72
|
],
|
|
73
|
+
"platform": [
|
|
74
|
+
"lib/platform/index.d.ts"
|
|
75
|
+
],
|
|
69
76
|
"spells": [
|
|
70
77
|
"lib/spells/index.d.ts"
|
|
71
78
|
],
|