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.
Files changed (79) hide show
  1. package/CHANGELOG.md +102 -1
  2. package/README.md +347 -0
  3. package/lib/Spells.d.ts +21 -0
  4. package/lib/Spells.lua +41 -0
  5. package/lib/datasources/AuraTimer.d.ts +21 -0
  6. package/lib/datasources/AuraTimer.lua +322 -0
  7. package/lib/datasources/CastTimer.d.ts +9 -0
  8. package/lib/datasources/CastTimer.lua +240 -0
  9. package/lib/datasources/DataSource.d.ts +4 -0
  10. package/lib/datasources/DataSource.lua +24 -0
  11. package/lib/datasources/KnownSpells.d.ts +21 -0
  12. package/lib/datasources/KnownSpells.lua +794 -0
  13. package/lib/datasources/ManaRegenTimer.d.ts +29 -0
  14. package/lib/datasources/ManaRegenTimer.lua +674 -0
  15. package/lib/datasources/ProgressSource.d.ts +6 -2
  16. package/lib/datasources/ProgressSource.lua +34 -3
  17. package/lib/datasources/Resources.d.ts +33 -2
  18. package/lib/datasources/Resources.lua +562 -10
  19. package/lib/datasources/SpellCooldown.d.ts +12 -0
  20. package/lib/datasources/SpellCooldown.lua +218 -0
  21. package/lib/datasources/SpellSource.d.ts +14 -0
  22. package/lib/datasources/SpellSource.lua +224 -0
  23. package/lib/datasources/SwingTimer.d.ts +31 -0
  24. package/lib/datasources/SwingTimer.lua +641 -0
  25. package/lib/datasources/TextureSource.d.ts +10 -0
  26. package/lib/datasources/TextureSource.lua +83 -0
  27. package/lib/datasources/TimerSource.d.ts +20 -0
  28. package/lib/datasources/TimerSource.lua +338 -0
  29. package/lib/datasources/TotemTimer.d.ts +10 -0
  30. package/lib/datasources/TotemTimer.lua +260 -0
  31. package/lib/datasources/index.d.ts +16 -1
  32. package/lib/datasources/index.lua +43 -0
  33. package/lib/index.d.ts +11 -0
  34. package/lib/index.lua +24 -0
  35. package/lib/platform/ActionBars.d.ts +27 -0
  36. package/lib/platform/ActionBars.lua +726 -0
  37. package/lib/platform/AddonSettings.d.ts +9 -0
  38. package/lib/platform/AddonSettings.lua +36 -0
  39. package/lib/platform/BlizzardUI.d.ts +17 -0
  40. package/lib/platform/BlizzardUI.lua +689 -0
  41. package/lib/platform/MicroMenu.d.ts +15 -0
  42. package/lib/platform/MicroMenu.lua +219 -0
  43. package/lib/platform/SecureButton.d.ts +5 -0
  44. package/lib/platform/SecureButton.lua +196 -0
  45. package/lib/platform/SlashCommands.d.ts +3 -0
  46. package/lib/platform/SlashCommands.lua +309 -0
  47. package/lib/platform/forever.d.ts +115 -2
  48. package/lib/skins/MicroBar.d.ts +8 -0
  49. package/lib/skins/MicroBar.lua +65 -0
  50. package/lib/skins/NativeSkin.d.ts +26 -0
  51. package/lib/skins/NativeSkin.lua +601 -0
  52. package/lib/skins/index.d.ts +3 -0
  53. package/lib/skins/index.lua +11 -0
  54. package/lib/store/index.lua +13 -0
  55. package/lib/ui/Button.d.ts +10 -0
  56. package/lib/ui/Button.lua +9 -0
  57. package/lib/ui/Cell.d.ts +7 -1
  58. package/lib/ui/FrameMover.d.ts +21 -0
  59. package/lib/ui/FrameMover.lua +123 -0
  60. package/lib/ui/HoverTracker.d.ts +20 -0
  61. package/lib/ui/HoverTracker.lua +88 -0
  62. package/lib/ui/Icon.d.ts +8 -0
  63. package/lib/ui/Icon.lua +8 -0
  64. package/lib/ui/KeybindCapture.d.ts +20 -0
  65. package/lib/ui/KeybindCapture.lua +488 -0
  66. package/lib/ui/Label.d.ts +10 -0
  67. package/lib/ui/Label.lua +8 -0
  68. package/lib/ui/ProgressBar.d.ts +5 -1
  69. package/lib/ui/SecureButton.d.ts +44 -0
  70. package/lib/ui/SecureButton.lua +9 -0
  71. package/lib/ui/index.d.ts +13 -0
  72. package/lib/ui/index.lua +28 -0
  73. package/lib/ui/layout/measureLayout.lua +11 -2
  74. package/lib/ui/mount.lua +679 -74
  75. package/lib/ui/primitives/jsx.d.ts +15 -2
  76. package/lib/wuira.d.ts +3 -0
  77. package/lib/wuira.lua +5 -0
  78. package/package.json +8 -1
  79. package/tools/build-library.mjs +1 -1
@@ -0,0 +1,601 @@
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 __TS__Symbol, Symbol
11
+ do
12
+ local symbolMetatable = {__tostring = function(self)
13
+ return ("Symbol(" .. (self.description or "")) .. ")"
14
+ end}
15
+ function __TS__Symbol(description)
16
+ return setmetatable({description = description}, symbolMetatable)
17
+ end
18
+ Symbol = {
19
+ asyncDispose = __TS__Symbol("Symbol.asyncDispose"),
20
+ dispose = __TS__Symbol("Symbol.dispose"),
21
+ iterator = __TS__Symbol("Symbol.iterator"),
22
+ hasInstance = __TS__Symbol("Symbol.hasInstance"),
23
+ species = __TS__Symbol("Symbol.species"),
24
+ toStringTag = __TS__Symbol("Symbol.toStringTag")
25
+ }
26
+ end
27
+
28
+ local __TS__Iterator
29
+ do
30
+ local function iteratorGeneratorStep(self)
31
+ local co = self.____coroutine
32
+ local status, value = coroutine.resume(co)
33
+ if not status then
34
+ error(value, 0)
35
+ end
36
+ if coroutine.status(co) == "dead" then
37
+ return
38
+ end
39
+ return true, value
40
+ end
41
+ local function iteratorIteratorStep(self)
42
+ local result = self:next()
43
+ if result.done then
44
+ return
45
+ end
46
+ return true, result.value
47
+ end
48
+ local function iteratorStringStep(self, index)
49
+ index = index + 1
50
+ if index > #self then
51
+ return
52
+ end
53
+ return index, string.sub(self, index, index)
54
+ end
55
+ function __TS__Iterator(iterable)
56
+ if type(iterable) == "string" then
57
+ return iteratorStringStep, iterable, 0
58
+ elseif iterable.____coroutine ~= nil then
59
+ return iteratorGeneratorStep, iterable
60
+ elseif iterable[Symbol.iterator] then
61
+ local iterator = iterable[Symbol.iterator](iterable)
62
+ return iteratorIteratorStep, iterator
63
+ else
64
+ return ipairs(iterable)
65
+ end
66
+ end
67
+ end
68
+
69
+ local function __TS__New(target, ...)
70
+ local instance = setmetatable({}, target.prototype)
71
+ instance:____constructor(...)
72
+ return instance
73
+ end
74
+
75
+ local Set
76
+ do
77
+ Set = __TS__Class()
78
+ Set.name = "Set"
79
+ function Set.prototype.____constructor(self, values)
80
+ self[Symbol.toStringTag] = "Set"
81
+ self.size = 0
82
+ self.nextKey = {}
83
+ self.previousKey = {}
84
+ if values == nil then
85
+ return
86
+ end
87
+ local iterable = values
88
+ if iterable[Symbol.iterator] then
89
+ local iterator = iterable[Symbol.iterator](iterable)
90
+ while true do
91
+ local result = iterator:next()
92
+ if result.done then
93
+ break
94
+ end
95
+ self:add(result.value)
96
+ end
97
+ else
98
+ local array = values
99
+ for ____, value in ipairs(array) do
100
+ self:add(value)
101
+ end
102
+ end
103
+ end
104
+ function Set.prototype.add(self, value)
105
+ local isNewValue = not self:has(value)
106
+ if isNewValue then
107
+ self.size = self.size + 1
108
+ end
109
+ if self.firstKey == nil then
110
+ self.firstKey = value
111
+ self.lastKey = value
112
+ elseif isNewValue then
113
+ self.nextKey[self.lastKey] = value
114
+ self.previousKey[value] = self.lastKey
115
+ self.lastKey = value
116
+ end
117
+ return self
118
+ end
119
+ function Set.prototype.clear(self)
120
+ self.nextKey = {}
121
+ self.previousKey = {}
122
+ self.firstKey = nil
123
+ self.lastKey = nil
124
+ self.size = 0
125
+ end
126
+ function Set.prototype.delete(self, value)
127
+ local contains = self:has(value)
128
+ if contains then
129
+ self.size = self.size - 1
130
+ local next = self.nextKey[value]
131
+ local previous = self.previousKey[value]
132
+ if next ~= nil and previous ~= nil then
133
+ self.nextKey[previous] = next
134
+ self.previousKey[next] = previous
135
+ elseif next ~= nil then
136
+ self.firstKey = next
137
+ self.previousKey[next] = nil
138
+ elseif previous ~= nil then
139
+ self.lastKey = previous
140
+ self.nextKey[previous] = nil
141
+ else
142
+ self.firstKey = nil
143
+ self.lastKey = nil
144
+ end
145
+ self.nextKey[value] = nil
146
+ self.previousKey[value] = nil
147
+ end
148
+ return contains
149
+ end
150
+ function Set.prototype.forEach(self, callback)
151
+ for ____, key in __TS__Iterator(self:keys()) do
152
+ callback(nil, key, key, self)
153
+ end
154
+ end
155
+ function Set.prototype.has(self, value)
156
+ return self.nextKey[value] ~= nil or self.lastKey == value
157
+ end
158
+ Set.prototype[Symbol.iterator] = function(self)
159
+ return self:values()
160
+ end
161
+ function Set.prototype.entries(self)
162
+ local function getFirstKey()
163
+ return self.firstKey
164
+ end
165
+ local nextKey = self.nextKey
166
+ local key
167
+ local started = false
168
+ return {
169
+ [Symbol.iterator] = function(self)
170
+ return self
171
+ end,
172
+ next = function(self)
173
+ if not started then
174
+ started = true
175
+ key = getFirstKey(nil)
176
+ else
177
+ key = nextKey[key]
178
+ end
179
+ return {done = not key, value = {key, key}}
180
+ end
181
+ }
182
+ end
183
+ function Set.prototype.keys(self)
184
+ local function getFirstKey()
185
+ return self.firstKey
186
+ end
187
+ local nextKey = self.nextKey
188
+ local key
189
+ local started = false
190
+ return {
191
+ [Symbol.iterator] = function(self)
192
+ return self
193
+ end,
194
+ next = function(self)
195
+ if not started then
196
+ started = true
197
+ key = getFirstKey(nil)
198
+ else
199
+ key = nextKey[key]
200
+ end
201
+ return {done = not key, value = key}
202
+ end
203
+ }
204
+ end
205
+ function Set.prototype.values(self)
206
+ local function getFirstKey()
207
+ return self.firstKey
208
+ end
209
+ local nextKey = self.nextKey
210
+ local key
211
+ local started = false
212
+ return {
213
+ [Symbol.iterator] = function(self)
214
+ return self
215
+ end,
216
+ next = function(self)
217
+ if not started then
218
+ started = true
219
+ key = getFirstKey(nil)
220
+ else
221
+ key = nextKey[key]
222
+ end
223
+ return {done = not key, value = key}
224
+ end
225
+ }
226
+ end
227
+ function Set.prototype.union(self, other)
228
+ local result = __TS__New(Set, self)
229
+ for ____, item in __TS__Iterator(other) do
230
+ result:add(item)
231
+ end
232
+ return result
233
+ end
234
+ function Set.prototype.intersection(self, other)
235
+ local result = __TS__New(Set)
236
+ for ____, item in __TS__Iterator(self) do
237
+ if other:has(item) then
238
+ result:add(item)
239
+ end
240
+ end
241
+ return result
242
+ end
243
+ function Set.prototype.difference(self, other)
244
+ local result = __TS__New(Set, self)
245
+ for ____, item in __TS__Iterator(other) do
246
+ result:delete(item)
247
+ end
248
+ return result
249
+ end
250
+ function Set.prototype.symmetricDifference(self, other)
251
+ local result = __TS__New(Set, self)
252
+ for ____, item in __TS__Iterator(other) do
253
+ if self:has(item) then
254
+ result:delete(item)
255
+ else
256
+ result:add(item)
257
+ end
258
+ end
259
+ return result
260
+ end
261
+ function Set.prototype.isSubsetOf(self, other)
262
+ for ____, item in __TS__Iterator(self) do
263
+ if not other:has(item) then
264
+ return false
265
+ end
266
+ end
267
+ return true
268
+ end
269
+ function Set.prototype.isSupersetOf(self, other)
270
+ for ____, item in __TS__Iterator(other) do
271
+ if not self:has(item) then
272
+ return false
273
+ end
274
+ end
275
+ return true
276
+ end
277
+ function Set.prototype.isDisjointFrom(self, other)
278
+ for ____, item in __TS__Iterator(self) do
279
+ if other:has(item) then
280
+ return false
281
+ end
282
+ end
283
+ return true
284
+ end
285
+ Set[Symbol.species] = Set
286
+ end
287
+
288
+ local function __TS__ArraySetLength(self, length)
289
+ if length < 0 or length ~= length or length == math.huge or math.floor(length) ~= length then
290
+ error(
291
+ "invalid array length: " .. tostring(length),
292
+ 0
293
+ )
294
+ end
295
+ for i = length + 1, #self do
296
+ self[i] = nil
297
+ end
298
+ return length
299
+ end
300
+
301
+ local function __TS__CloneDescriptor(____bindingPattern0)
302
+ local value
303
+ local writable
304
+ local set
305
+ local get
306
+ local configurable
307
+ local enumerable
308
+ enumerable = ____bindingPattern0.enumerable
309
+ configurable = ____bindingPattern0.configurable
310
+ get = ____bindingPattern0.get
311
+ set = ____bindingPattern0.set
312
+ writable = ____bindingPattern0.writable
313
+ value = ____bindingPattern0.value
314
+ local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
315
+ local hasGetterOrSetter = get ~= nil or set ~= nil
316
+ local hasValueOrWritableAttribute = writable ~= nil or value ~= nil
317
+ if hasGetterOrSetter and hasValueOrWritableAttribute then
318
+ error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
319
+ end
320
+ if get or set then
321
+ descriptor.get = get
322
+ descriptor.set = set
323
+ else
324
+ descriptor.value = value
325
+ descriptor.writable = writable == true
326
+ end
327
+ return descriptor
328
+ end
329
+
330
+ local __TS__DescriptorGet
331
+ do
332
+ local getmetatable = _G.getmetatable
333
+ local ____rawget = _G.rawget
334
+ function __TS__DescriptorGet(self, metatable, key)
335
+ while metatable do
336
+ local rawResult = ____rawget(metatable, key)
337
+ if rawResult ~= nil then
338
+ return rawResult
339
+ end
340
+ local descriptors = ____rawget(metatable, "_descriptors")
341
+ if descriptors then
342
+ local descriptor = descriptors[key]
343
+ if descriptor ~= nil then
344
+ if descriptor.get then
345
+ return descriptor.get(self)
346
+ end
347
+ return descriptor.value
348
+ end
349
+ end
350
+ metatable = getmetatable(metatable)
351
+ end
352
+ end
353
+ end
354
+
355
+ local __TS__DescriptorSet
356
+ do
357
+ local getmetatable = _G.getmetatable
358
+ local ____rawget = _G.rawget
359
+ local rawset = _G.rawset
360
+ function __TS__DescriptorSet(self, metatable, key, value)
361
+ while metatable do
362
+ local descriptors = ____rawget(metatable, "_descriptors")
363
+ if descriptors then
364
+ local descriptor = descriptors[key]
365
+ if descriptor ~= nil then
366
+ if descriptor.set then
367
+ descriptor.set(self, value)
368
+ else
369
+ if descriptor.writable == false then
370
+ error(
371
+ ((("Cannot assign to read only property '" .. key) .. "' of object '") .. tostring(self)) .. "'",
372
+ 0
373
+ )
374
+ end
375
+ descriptor.value = value
376
+ end
377
+ return
378
+ end
379
+ end
380
+ metatable = getmetatable(metatable)
381
+ end
382
+ rawset(self, key, value)
383
+ end
384
+ end
385
+
386
+ local __TS__SetDescriptor
387
+ do
388
+ local getmetatable = _G.getmetatable
389
+ local function descriptorIndex(self, key)
390
+ return __TS__DescriptorGet(
391
+ self,
392
+ getmetatable(self),
393
+ key
394
+ )
395
+ end
396
+ local function descriptorNewIndex(self, key, value)
397
+ return __TS__DescriptorSet(
398
+ self,
399
+ getmetatable(self),
400
+ key,
401
+ value
402
+ )
403
+ end
404
+ function __TS__SetDescriptor(target, key, desc, isPrototype)
405
+ if isPrototype == nil then
406
+ isPrototype = false
407
+ end
408
+ local ____isPrototype_0
409
+ if isPrototype then
410
+ ____isPrototype_0 = target
411
+ else
412
+ ____isPrototype_0 = getmetatable(target)
413
+ end
414
+ local metatable = ____isPrototype_0
415
+ if not metatable then
416
+ metatable = {}
417
+ setmetatable(target, metatable)
418
+ end
419
+ if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
420
+ local instanceMetatable = {}
421
+ instanceMetatable._isOwnDescriptorMetatable = true
422
+ setmetatable(instanceMetatable, metatable)
423
+ setmetatable(target, instanceMetatable)
424
+ metatable = instanceMetatable
425
+ end
426
+ local value = rawget(target, key)
427
+ if value ~= nil then
428
+ rawset(target, key, nil)
429
+ end
430
+ if not rawget(metatable, "_descriptors") then
431
+ metatable._descriptors = {}
432
+ end
433
+ metatable._descriptors[key] = __TS__CloneDescriptor(desc)
434
+ metatable.__index = descriptorIndex
435
+ metatable.__newindex = descriptorNewIndex
436
+ end
437
+ end
438
+ -- End of Lua Library inline imports
439
+ local ____exports = {}
440
+ local ____wuira = require("wuira")
441
+ local wuira = ____wuira.wuira
442
+ --- A presentation adapter around a game-owned frame, not a replacement widget.
443
+ ____exports.NativeSkin = __TS__Class()
444
+ local NativeSkin = ____exports.NativeSkin
445
+ NativeSkin.name = "NativeSkin"
446
+ function NativeSkin.prototype.____constructor(self, name)
447
+ self.name = name
448
+ self.renderPending = false
449
+ self.rendering = false
450
+ self.disposed = false
451
+ self.disposing = false
452
+ self.hovered = false
453
+ self.views = {}
454
+ self.hoverListeners = __TS__New(Set)
455
+ self.hooked = __TS__New(Set)
456
+ end
457
+ function NativeSkin.prototype.render(self, renderer)
458
+ if self.disposed or self.disposing then
459
+ error("Skin is disposed")
460
+ end
461
+ for ____, view in ipairs(self.views) do
462
+ wuira:Unmount(view)
463
+ end
464
+ __TS__ArraySetLength(self.views, 0)
465
+ self.renderer = renderer
466
+ self.renderPending = true
467
+ self:watch()
468
+ return self
469
+ end
470
+ function NativeSkin.prototype.mount(self, view, anchor)
471
+ if self.disposed or self.disposing then
472
+ error("Skin is disposed")
473
+ end
474
+ if InCombatLockdown() then
475
+ error("Skin: mount native children outside combat")
476
+ end
477
+ local parent = self.Frame
478
+ if parent == nil then
479
+ error("Skin: mount inside render() after the native frame is ready")
480
+ end
481
+ local mounted = wuira:Mount(view, anchor, parent)
482
+ if mounted ~= nil then
483
+ local ____self_views_0 = self.views
484
+ ____self_views_0[#____self_views_0 + 1] = mounted
485
+ end
486
+ return mounted
487
+ end
488
+ function NativeSkin.prototype.OnHover(self, callback)
489
+ if self.disposed or self.disposing then
490
+ error("Skin is disposed")
491
+ end
492
+ self.hoverListeners:add(callback)
493
+ self:watch()
494
+ return function()
495
+ self.hoverListeners:delete(callback)
496
+ end
497
+ end
498
+ function NativeSkin.prototype.watch(self)
499
+ if self.listener == nil then
500
+ self.listener = CreateFrame("Frame", nil, UIParent)
501
+ self.listener:RegisterEvent("ADDON_LOADED")
502
+ self.listener:RegisterEvent("PLAYER_ENTERING_WORLD")
503
+ self.listener:RegisterEvent("PLAYER_REGEN_ENABLED")
504
+ self.listener:SetScript(
505
+ "OnEvent",
506
+ function() return self:apply() end
507
+ )
508
+ end
509
+ self:apply()
510
+ end
511
+ function NativeSkin.prototype.apply(self)
512
+ if self.disposing then
513
+ if not InCombatLockdown() then
514
+ self:Dispose()
515
+ end
516
+ return
517
+ end
518
+ if self.disposed or self.rendering or InCombatLockdown() then
519
+ return
520
+ end
521
+ local frame = self.Frame
522
+ if frame == nil then
523
+ return
524
+ end
525
+ if self.renderPending and self.renderer ~= nil then
526
+ self.renderPending = false
527
+ self.rendering = true
528
+ do
529
+ local ____try, ____error = pcall(function()
530
+ self.renderer(self)
531
+ end)
532
+ do
533
+ self.rendering = false
534
+ end
535
+ if not ____try then
536
+ error(____error, 0)
537
+ end
538
+ end
539
+ end
540
+ if self.hoverListeners.size == 0 then
541
+ return
542
+ end
543
+ local function notify()
544
+ if self.disposed or self.hoverListeners.size == 0 then
545
+ return
546
+ end
547
+ local hovered = frame:IsMouseOver()
548
+ if hovered == self.hovered then
549
+ return
550
+ end
551
+ self.hovered = hovered
552
+ for ____, callback in __TS__Iterator(self.hoverListeners) do
553
+ callback(hovered)
554
+ end
555
+ end
556
+ local visit
557
+ visit = function(____, target)
558
+ if not self.hooked:has(target) then
559
+ self.hooked:add(target)
560
+ target:HookScript("OnEnter", notify)
561
+ target:HookScript("OnLeave", notify)
562
+ end
563
+ for ____, child in ipairs({target:GetChildren()}) do
564
+ visit(nil, child)
565
+ end
566
+ end
567
+ visit(nil, frame)
568
+ end
569
+ function NativeSkin.prototype.Dispose(self)
570
+ if self.disposed then
571
+ return
572
+ end
573
+ if InCombatLockdown() then
574
+ self.disposing = true
575
+ self:watch()
576
+ return
577
+ end
578
+ self.disposed = true
579
+ self.hoverListeners:clear()
580
+ local ____opt_1 = self.listener
581
+ if ____opt_1 ~= nil then
582
+ ____opt_1:UnregisterAllEvents()
583
+ end
584
+ local ____opt_3 = self.listener
585
+ if ____opt_3 ~= nil then
586
+ ____opt_3:SetScript("OnEvent", nil)
587
+ end
588
+ for ____, view in ipairs(self.views) do
589
+ wuira:Unmount(view)
590
+ end
591
+ __TS__ArraySetLength(self.views, 0)
592
+ end
593
+ __TS__SetDescriptor(
594
+ NativeSkin.prototype,
595
+ "Frame",
596
+ {get = function(self)
597
+ return _G[self.name]
598
+ end},
599
+ true
600
+ )
601
+ return ____exports
@@ -0,0 +1,3 @@
1
+ /// <reference path="../platform/forever.d.ts" />
2
+ export { NativeSkin } from "./NativeSkin";
3
+ export { MicroBar } from "./MicroBar";
@@ -0,0 +1,11 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ do
4
+ local ____NativeSkin = require("skins.NativeSkin")
5
+ ____exports.NativeSkin = ____NativeSkin.NativeSkin
6
+ end
7
+ do
8
+ local ____MicroBar = require("skins.MicroBar")
9
+ ____exports.MicroBar = ____MicroBar.MicroBar
10
+ end
11
+ return ____exports
@@ -310,6 +310,16 @@ local function __TS__TypeOf(value)
310
310
  end
311
311
  end
312
312
 
313
+ local function __TS__ObjectKeys(obj)
314
+ local result = {}
315
+ local len = 0
316
+ for key in pairs(obj) do
317
+ len = len + 1
318
+ result[len] = key
319
+ end
320
+ return result
321
+ end
322
+
313
323
  local function __TS__ArrayIsArray(value)
314
324
  return type(value) == "table" and (value[1] ~= nil or next(value) == nil)
315
325
  end
@@ -687,6 +697,9 @@ local function restore(self, defaults, saved)
687
697
  if saved == nil or __TS__TypeOf(saved) ~= __TS__TypeOf(defaults) or saved == nil then
688
698
  return copy(nil, defaults)
689
699
  end
700
+ if type(defaults) == "table" and defaults ~= nil and #__TS__ObjectKeys(defaults) == 0 then
701
+ return copy(nil, saved)
702
+ end
690
703
  if __TS__ArrayIsArray(defaults) then
691
704
  local ____Array_isArray_result_0
692
705
  if __TS__ArrayIsArray(saved) then
@@ -0,0 +1,10 @@
1
+ import type { Cell, CellProps } from "./Cell";
2
+ import type { Element } from "./primitives/jsx";
3
+ export type ButtonProps = CellProps & {
4
+ onClick?: () => void;
5
+ clickThrough?: false;
6
+ };
7
+ /** A normal UI button for settings and editor controls. */
8
+ export declare function Button(props: Partial<ButtonProps> & {
9
+ child?: Element;
10
+ }, child?: Element): Cell;
@@ -0,0 +1,9 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local ____jsx = require("ui.primitives.jsx")
4
+ local UI = ____jsx.UI
5
+ --- A normal UI button for settings and editor controls.
6
+ function ____exports.Button(self, props, child)
7
+ return UI:createElement("button", props, props.child or child or ({}))
8
+ end
9
+ return ____exports
package/lib/ui/Cell.d.ts CHANGED
@@ -14,9 +14,15 @@ export type CellProps = {
14
14
  /** Defaults to true: visual cells do not intercept mouse input. */
15
15
  clickThrough?: boolean;
16
16
  decorations?: Decorations;
17
+ /** Visual opacity, including live callbacks; does not change secure actions. */
18
+ alpha?: number | (() => number);
19
+ /** Called after native configuration. The optional cleanup runs on unmount. */
20
+ onMount?: (frame: wuiraNativeFrame) => void | (() => void);
21
+ /** Visibility does not remove the cell's reserved layout slot. */
22
+ visible?: () => boolean;
17
23
  } & Position<ICell>;
18
24
  export interface ICell extends Element {
19
- kind: "cell" | "flow" | "grid" | "progress";
25
+ kind: "cell" | "flow" | "grid" | "progress" | "label" | "icon" | "button" | "secureButton";
20
26
  props: CellProps;
21
27
  }
22
28
  export declare function Cell(props: Partial<CellProps> & {
@@ -0,0 +1,21 @@
1
+ export interface FramePosition {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ export interface FrameMoverOptions {
6
+ label: string;
7
+ onMove: (position: FramePosition) => void;
8
+ }
9
+ /** A screen-space drag proxy. Protected targets are positioned only outside combat. */
10
+ export declare class FrameMover {
11
+ private readonly target;
12
+ private readonly options;
13
+ readonly Frame: wuiraNativeFrame;
14
+ private dragging;
15
+ private last?;
16
+ private disposed;
17
+ constructor(target: wuiraNativeFrame, options: FrameMoverOptions);
18
+ private Update;
19
+ private Stop;
20
+ Dispose(): void;
21
+ }