wuira 0.3.2 → 0.3.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +20 -5
  3. package/docs/source-converters.md +5 -5
  4. package/lib/datasources/AuraTimer.d.ts +1 -1
  5. package/lib/datasources/AuraTimer.lua +14 -2
  6. package/lib/datasources/Auras.d.ts +2 -2
  7. package/lib/datasources/Auras.lua +18 -2
  8. package/lib/datasources/CastTimer.d.ts +1 -1
  9. package/lib/datasources/CastTimer.lua +16 -1
  10. package/lib/datasources/EditModeLayouts.d.ts +1 -1
  11. package/lib/datasources/EditModeLayouts.lua +10 -1
  12. package/lib/datasources/GroupMembers.d.ts +3 -3
  13. package/lib/datasources/GroupMembers.lua +26 -3
  14. package/lib/datasources/GroupRoster.d.ts +1 -1
  15. package/lib/datasources/GroupRoster.lua +19 -8
  16. package/lib/datasources/KnownSpells.d.ts +1 -1
  17. package/lib/datasources/KnownSpells.lua +10 -1
  18. package/lib/datasources/ManaRegenTimer.d.ts +1 -1
  19. package/lib/datasources/ManaRegenTimer.lua +10 -1
  20. package/lib/datasources/NativeNumberSource.d.ts +1 -1
  21. package/lib/datasources/NativeNumberSource.lua +16 -1
  22. package/lib/datasources/ProgressSource.lua +5 -9
  23. package/lib/datasources/Resources.d.ts +35 -14
  24. package/lib/datasources/Resources.lua +141 -58
  25. package/lib/datasources/Source.d.ts +18 -0
  26. package/lib/datasources/Source.lua +300 -0
  27. package/lib/datasources/SourceConverter.d.ts +1 -1
  28. package/lib/datasources/SourceConverter.lua +10 -1
  29. package/lib/datasources/SpellCooldown.d.ts +2 -2
  30. package/lib/datasources/SpellCooldown.lua +24 -2
  31. package/lib/datasources/SpellSource.d.ts +1 -1
  32. package/lib/datasources/SpellSource.lua +15 -3
  33. package/lib/datasources/SwingTimer.d.ts +1 -1
  34. package/lib/datasources/SwingTimer.lua +10 -1
  35. package/lib/datasources/TextureSource.d.ts +1 -1
  36. package/lib/datasources/TextureSource.lua +16 -1
  37. package/lib/datasources/TimerSource.d.ts +1 -1
  38. package/lib/datasources/TimerSource.lua +16 -1
  39. package/lib/datasources/TotemTimer.d.ts +1 -1
  40. package/lib/datasources/TotemTimer.lua +16 -1
  41. package/lib/datasources/UnitInfo.d.ts +2 -2
  42. package/lib/datasources/UnitInfo.lua +21 -3
  43. package/lib/datasources/UnitSource.d.ts +1 -1
  44. package/lib/datasources/UnitSource.lua +13 -2
  45. package/lib/datasources/UseSource.d.ts +51 -0
  46. package/lib/datasources/UseSource.lua +9 -0
  47. package/lib/datasources/index.d.ts +3 -1
  48. package/lib/datasources/index.lua +10 -1
  49. package/lib/rendering/progress.lua +2 -2
  50. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,22 @@ with the release date and highlight breaking changes explicitly.
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.3.3 — 2026-10-19
11
+
12
+ ### Breaking
13
+
14
+ - Datasource classes open through `UseSource`. `new HP()`, `new Mana()`, `new SourceConverter()`, and the other datasource constructors are not part of the TypeScript API.
15
+
16
+ ### Added
17
+
18
+ - `Absorb` reads `UnitGetTotalAbsorbs`. `Prediction` reads `UnitGetIncomingHeals`. Both are standalone sources.
19
+ - `UseSource(HP, unit).UseAbsorb().UsePrediction()` appends those sources for the same unit. `hp.Absorb` and `hp.Prediction` stay empty until requested.
20
+ - `Source` stores the query props and passes them back on each read.
21
+
22
+ ### Changed
23
+
24
+ - `UseHealPrediction`, `UseAbsorbPrediction`, `HealPrediction`, and `AbsorbPrediction` forward to the new methods and getters.
25
+
10
26
  ## 0.3.2 — 2026-10-19
11
27
 
12
28
  ### Fixed
package/README.md CHANGED
@@ -54,18 +54,33 @@ npm run build
54
54
 
55
55
  ## Data sources
56
56
 
57
+ Open every datasource with `UseSource`. Those classes have no public constructor.
58
+
57
59
  ```tsx
58
- import { HP, Mana, Unit } from "wuira/datasources";
60
+ import { UseSource, HP, Mana, Unit } from "wuira/datasources";
59
61
 
60
- const hp = new HP(Unit.Player).UseHealPrediction().UseAbsorbPrediction();
61
- const mana = new Mana(Unit.Player).UseRegenTimer();
62
+ const hp = UseSource(HP, Unit.Player).UsePrediction().UseAbsorb();
63
+ const mana = UseSource(Mana, Unit.Player).UseRegenTimer();
62
64
 
63
65
  <progress height={24} source={hp} />
64
66
  <progress height={24} source={mana} />
65
67
  ```
66
68
 
69
+ `UsePrediction()` and `UseAbsorb()` append the same `Prediction` and `Absorb` sources for that unit. Read them as `hp.Prediction` and `hp.Absorb`. Incoming heals are `UnitGetIncomingHeals`. Absorbs are `UnitGetTotalAbsorbs`. `hp.Value`, `hp.Max`, and `hp.Percent` stay the three health reads.
70
+
67
71
  Other sources include `AuraTimer`, `GlobalCooldown`, `CastTimer`, `SpellCooldown`, `SwingTimer`, `GroupMembers`, `PartyMembers`, `RaidMembers`, `Buffs`, `Debuffs`, `KnownSpells`, `Spells`, `UnitSource`, `ClassSource`, `SpecSource`, and `SpellSource`.
68
72
 
73
+ ## Layout
74
+
75
+ `width` and `height` accept a number, `"inherit"`, or `"fill"`. Fill siblings share the space left after fixed children. `columnGap` is horizontal space. `rowGap` is vertical space.
76
+
77
+ ```tsx
78
+ <flow width={200} height={40} direction="ltr" columnGap={4} rowGap={2} alignY="center">
79
+ <cell width="fill" height={12} />
80
+ <cell width={40} height={12} />
81
+ </flow>
82
+ ```
83
+
69
84
  ## Secure buttons
70
85
 
71
86
  ```tsx
@@ -82,14 +97,14 @@ Supported action types: `spell`, `item`, `macro`, `action`, and `target`. Action
82
97
  ```tsx
83
98
  import { UI } from "wuira/ui";
84
99
  import { Nameplates } from "wuira/skins";
85
- import { HP } from "wuira/datasources";
100
+ import { UseSource, HP } from "wuira/datasources";
86
101
 
87
102
  const plates = Nameplates
88
103
  .Apply(p => p.GUID === configuredGUID, p => {
89
104
  if (p.Native.healthBar) p.Size(p.Native.healthBar, 140, 12);
90
105
  })
91
106
  .Replace(() => true, p => (
92
- <progress width={140} height={12} source={new HP(p.Unit)} />
107
+ <progress width={140} height={12} source={UseSource(HP, p.Unit)} />
93
108
  ));
94
109
 
95
110
  // plates.Dispose();
@@ -3,12 +3,12 @@
3
3
  `SourceConverter` transforms a readable source with a typed callback. It consumes change notifications, shares one upstream subscription across observers, and does not create a timer or dispose the shared input. Sources without notifications remain available as checked one-time reads.
4
4
 
5
5
  ```ts
6
- import { SourceConverter, HP, ClassSource, Unit } from "wuira/datasources";
6
+ import { UseSource, SourceConverter, HP, ClassSource, Unit } from "wuira/datasources";
7
7
 
8
- const hp = new HP(Unit.Player);
9
- const doubled = new SourceConverter(hp, value => value * 2);
10
- const characterClass = new ClassSource(Unit.Player);
11
- const token = new SourceConverter(characterClass, info => info?.token);
8
+ const hp = UseSource(HP, Unit.Player);
9
+ const doubled = UseSource(SourceConverter, hp, value => value * 2);
10
+ const characterClass = UseSource(ClassSource, Unit.Player);
11
+ const token = UseSource(SourceConverter, characterClass, info => info?.token);
12
12
  const stop = doubled.BindTo(value => console.log(value));
13
13
 
14
14
  // On removal:
@@ -14,7 +14,7 @@ export declare class AuraTimer extends TimerSource {
14
14
  readonly target: UnitSource;
15
15
  readonly Texture: TextureSource;
16
16
  private status;
17
- constructor(unit: UnitInput, options: AuraTimerOptions);
17
+ protected constructor(unit: UnitInput, options: AuraTimerOptions);
18
18
  get Status(): AuraTimerStatus;
19
19
  private ReadAura;
20
20
  private ReadDuration;
@@ -179,6 +179,10 @@ end
179
179
  local ____exports = {}
180
180
  local ____TimerSource = require("datasources.TimerSource")
181
181
  local TimerSource = ____TimerSource.TimerSource
182
+ local ____Source = require("datasources.Source")
183
+ local registerSource = ____Source.registerSource
184
+ local ____UseSource = require("datasources.UseSource")
185
+ local UseSource = ____UseSource.UseSource
182
186
  local ____TextureSource = require("datasources.TextureSource")
183
187
  local TextureSource = ____TextureSource.TextureSource
184
188
  local ____UnitSource = require("datasources.UnitSource")
@@ -206,7 +210,8 @@ function AuraTimer.prototype.____constructor(self, unit, options)
206
210
  self.options = options
207
211
  self.status = "inactive"
208
212
  self.target = target
209
- self.Texture = __TS__New(
213
+ self.Texture = UseSource(
214
+ nil,
210
215
  TextureSource,
211
216
  function()
212
217
  local ____opt_0 = self:ReadAura()
@@ -309,7 +314,14 @@ function AuraTimer.prototype.ReadDuration(self)
309
314
  return ____returnValue
310
315
  end
311
316
  end
312
- end
317
+ end;
318
+ (function(self)
319
+ registerSource(
320
+ nil,
321
+ ____exports.AuraTimer,
322
+ function(____, props) return __TS__New(____exports.AuraTimer, props[1], props[2]) end
323
+ )
324
+ end)(AuraTimer)
313
325
  __TS__SetDescriptor(
314
326
  AuraTimer.prototype,
315
327
  "Status",
@@ -25,8 +25,8 @@ export declare abstract class AuraSource extends DataSource<readonly Aura[]> {
25
25
  protected GetValue(): readonly Aura[];
26
26
  }
27
27
  export declare class Buffs extends AuraSource {
28
- constructor(unit: UnitInput);
28
+ protected constructor(unit: UnitInput);
29
29
  }
30
30
  export declare class Debuffs extends AuraSource {
31
- constructor(unit: UnitInput);
31
+ protected constructor(unit: UnitInput);
32
32
  }
@@ -179,6 +179,8 @@ end
179
179
  local ____exports = {}
180
180
  local ____DataSource = require("datasources.DataSource")
181
181
  local DataSource = ____DataSource.DataSource
182
+ local ____Source = require("datasources.Source")
183
+ local registerSource = ____Source.registerSource
182
184
  local ____UnitSource = require("datasources.UnitSource")
183
185
  local resolveUnit = ____UnitSource.resolveUnit
184
186
  --- Readable aura snapshot. Unit tokens describe the source at snapshot time.
@@ -273,12 +275,26 @@ Buffs.name = "Buffs"
273
275
  __TS__ClassExtends(Buffs, ____exports.AuraSource)
274
276
  function Buffs.prototype.____constructor(self, unit)
275
277
  Buffs.____super.prototype.____constructor(self, unit, "HELPFUL")
276
- end
278
+ end;
279
+ (function(self)
280
+ registerSource(
281
+ nil,
282
+ ____exports.Buffs,
283
+ function(____, props) return __TS__New(____exports.Buffs, props[1]) end
284
+ )
285
+ end)(Buffs)
277
286
  ____exports.Debuffs = __TS__Class()
278
287
  local Debuffs = ____exports.Debuffs
279
288
  Debuffs.name = "Debuffs"
280
289
  __TS__ClassExtends(Debuffs, ____exports.AuraSource)
281
290
  function Debuffs.prototype.____constructor(self, unit)
282
291
  Debuffs.____super.prototype.____constructor(self, unit, "HARMFUL")
283
- end
292
+ end;
293
+ (function(self)
294
+ registerSource(
295
+ nil,
296
+ ____exports.Debuffs,
297
+ function(____, props) return __TS__New(____exports.Debuffs, props[1]) end
298
+ )
299
+ end)(Debuffs)
284
300
  return ____exports
@@ -5,5 +5,5 @@ import type { UnitInput } from "./UnitSource";
5
5
  export declare class CastTimer extends TimerSource {
6
6
  readonly target: UnitSource;
7
7
  get SpellName(): string;
8
- constructor(unit?: UnitInput);
8
+ protected constructor(unit?: UnitInput);
9
9
  }
@@ -171,10 +171,18 @@ do
171
171
  metatable.__newindex = descriptorNewIndex
172
172
  end
173
173
  end
174
+
175
+ local function __TS__New(target, ...)
176
+ local instance = setmetatable({}, target.prototype)
177
+ instance:____constructor(...)
178
+ return instance
179
+ end
174
180
  -- End of Lua Library inline imports
175
181
  local ____exports = {}
176
182
  local ____TimerSource = require("datasources.TimerSource")
177
183
  local TimerSource = ____TimerSource.TimerSource
184
+ local ____Source = require("datasources.Source")
185
+ local registerSource = ____Source.registerSource
178
186
  local ____UnitSource = require("datasources.UnitSource")
179
187
  local Unit = ____UnitSource.Unit
180
188
  local resolveUnit = ____UnitSource.resolveUnit
@@ -236,5 +244,12 @@ __TS__SetDescriptor(
236
244
  return channel or ""
237
245
  end},
238
246
  true
239
- )
247
+ );
248
+ (function(self)
249
+ registerSource(
250
+ nil,
251
+ ____exports.CastTimer,
252
+ function(____, props) return __TS__New(____exports.CastTimer, props[1]) end
253
+ )
254
+ end)(CastTimer)
240
255
  return ____exports
@@ -20,7 +20,7 @@ export declare class EditModeLayouts extends DataSource<EditModeLayoutSnapshot>
20
20
  private readonly listeners;
21
21
  private readonly frame;
22
22
  private disposed;
23
- constructor();
23
+ protected constructor();
24
24
  get Status(): EditModeLayoutsStatus;
25
25
  get Layouts(): readonly EditModeLayout[];
26
26
  get Active(): EditModeLayout | undefined;
@@ -520,6 +520,8 @@ end
520
520
  local ____exports = {}
521
521
  local ____DataSource = require("datasources.DataSource")
522
522
  local DataSource = ____DataSource.DataSource
523
+ local ____Source = require("datasources.Source")
524
+ local registerSource = ____Source.registerSource
523
525
  --- Read-only native Edit Mode layouts, refreshed by events without polling.
524
526
  ____exports.EditModeLayouts = __TS__Class()
525
527
  local EditModeLayouts = ____exports.EditModeLayouts
@@ -661,7 +663,14 @@ function EditModeLayouts.prototype.Dispose(self)
661
663
  self.frame:UnregisterAllEvents()
662
664
  self.frame:SetScript("OnEvent", nil)
663
665
  self.frame:Hide()
664
- end
666
+ end;
667
+ (function(self)
668
+ registerSource(
669
+ nil,
670
+ ____exports.EditModeLayouts,
671
+ function() return __TS__New(____exports.EditModeLayouts) end
672
+ )
673
+ end)(EditModeLayouts)
665
674
  __TS__SetDescriptor(
666
675
  EditModeLayouts.prototype,
667
676
  "Status",
@@ -6,7 +6,7 @@ export declare class GroupMembers extends DataSource<readonly string[]> {
6
6
  private restricted;
7
7
  private readonly listeners;
8
8
  private frame?;
9
- constructor(scope?: GroupScope);
9
+ protected constructor(scope?: GroupScope);
10
10
  /** Roster/connection events, with one listener frame while observed. No polling. */
11
11
  onChange(listener: (units: readonly string[]) => void): () => void;
12
12
  private StopListening;
@@ -16,9 +16,9 @@ export declare class GroupMembers extends DataSource<readonly string[]> {
16
16
  }
17
17
  /** Includes the player in a party; empty when solo or in a raid. */
18
18
  export declare class PartyMembers extends GroupMembers {
19
- constructor();
19
+ protected constructor();
20
20
  }
21
21
  /** Includes the player through their raidN token; empty outside a raid. */
22
22
  export declare class RaidMembers extends GroupMembers {
23
- constructor();
23
+ protected constructor();
24
24
  }
@@ -321,6 +321,8 @@ end
321
321
  local ____exports = {}
322
322
  local ____DataSource = require("datasources.DataSource")
323
323
  local DataSource = ____DataSource.DataSource
324
+ local ____Source = require("datasources.Source")
325
+ local registerSource = ____Source.registerSource
324
326
  --- Fresh roster tokens, including offline members. Tokens are not persistent identities.
325
327
  ____exports.GroupMembers = __TS__Class()
326
328
  local GroupMembers = ____exports.GroupMembers
@@ -434,7 +436,14 @@ function GroupMembers.prototype.GetValue(self)
434
436
  end
435
437
  end
436
438
  return units
437
- end
439
+ end;
440
+ (function(self)
441
+ registerSource(
442
+ nil,
443
+ ____exports.GroupMembers,
444
+ function(____, props) return __TS__New(____exports.GroupMembers, props[1]) end
445
+ )
446
+ end)(GroupMembers)
438
447
  --- Includes the player in a party; empty when solo or in a raid.
439
448
  ____exports.PartyMembers = __TS__Class()
440
449
  local PartyMembers = ____exports.PartyMembers
@@ -442,7 +451,14 @@ PartyMembers.name = "PartyMembers"
442
451
  __TS__ClassExtends(PartyMembers, ____exports.GroupMembers)
443
452
  function PartyMembers.prototype.____constructor(self)
444
453
  PartyMembers.____super.prototype.____constructor(self, "party")
445
- end
454
+ end;
455
+ (function(self)
456
+ registerSource(
457
+ nil,
458
+ ____exports.PartyMembers,
459
+ function() return __TS__New(____exports.PartyMembers) end
460
+ )
461
+ end)(PartyMembers)
446
462
  --- Includes the player through their raidN token; empty outside a raid.
447
463
  ____exports.RaidMembers = __TS__Class()
448
464
  local RaidMembers = ____exports.RaidMembers
@@ -450,5 +466,12 @@ RaidMembers.name = "RaidMembers"
450
466
  __TS__ClassExtends(RaidMembers, ____exports.GroupMembers)
451
467
  function RaidMembers.prototype.____constructor(self)
452
468
  RaidMembers.____super.prototype.____constructor(self, "raid")
453
- end
469
+ end;
470
+ (function(self)
471
+ registerSource(
472
+ nil,
473
+ ____exports.RaidMembers,
474
+ function() return __TS__New(____exports.RaidMembers) end
475
+ )
476
+ end)(RaidMembers)
454
477
  return ____exports
@@ -17,7 +17,7 @@ export declare class GroupRoster extends DataSource<readonly GroupRosterMember[]
17
17
  private snapshot;
18
18
  private restricted;
19
19
  get Status(): "ready" | "restricted";
20
- constructor(scope?: GroupScope, options?: {
20
+ protected constructor(scope?: GroupScope, options?: {
21
21
  pets?: boolean;
22
22
  includeSelfWhenSolo?: boolean;
23
23
  });
@@ -47,12 +47,6 @@ local function __TS__ClassExtends(target, base)
47
47
  end
48
48
  end
49
49
 
50
- local function __TS__New(target, ...)
51
- local instance = setmetatable({}, target.prototype)
52
- instance:____constructor(...)
53
- return instance
54
- end
55
-
56
50
  local __TS__Symbol, Symbol
57
51
  do
58
52
  local symbolMetatable = {__tostring = function(self)
@@ -277,6 +271,12 @@ do
277
271
  Map[Symbol.species] = Map
278
272
  end
279
273
 
274
+ local function __TS__New(target, ...)
275
+ local instance = setmetatable({}, target.prototype)
276
+ instance:____constructor(...)
277
+ return instance
278
+ end
279
+
280
280
  local __TS__Unpack = table.unpack or unpack
281
281
 
282
282
  local function __TS__ArrayMap(self, callbackfn, thisArg)
@@ -474,6 +474,10 @@ end
474
474
  local ____exports = {}
475
475
  local ____DataSource = require("datasources.DataSource")
476
476
  local DataSource = ____DataSource.DataSource
477
+ local ____Source = require("datasources.Source")
478
+ local registerSource = ____Source.registerSource
479
+ local ____UseSource = require("datasources.UseSource")
480
+ local UseSource = ____UseSource.UseSource
477
481
  local ____GroupMembers = require("datasources.GroupMembers")
478
482
  local GroupMembers = ____GroupMembers.GroupMembers
479
483
  function ____exports.getPetUnitToken(self, unit)
@@ -504,7 +508,7 @@ function GroupRoster.prototype.____constructor(self, scope, options)
504
508
  self.knownNames = __TS__New(Map)
505
509
  self.snapshot = {}
506
510
  self.restricted = false
507
- self.roster = __TS__New(GroupMembers, scope)
511
+ self.roster = UseSource(nil, GroupMembers, scope)
508
512
  end
509
513
  function GroupRoster.prototype.GetValue(self)
510
514
  self.restricted = self.roster:IsSecret()
@@ -607,5 +611,12 @@ __TS__SetDescriptor(
607
611
  return self.restricted and "restricted" or "ready"
608
612
  end},
609
613
  true
610
- )
614
+ );
615
+ (function(self)
616
+ registerSource(
617
+ nil,
618
+ ____exports.GroupRoster,
619
+ function(____, props) return __TS__New(____exports.GroupRoster, props[1], props[2]) end
620
+ )
621
+ end)(GroupRoster)
611
622
  return ____exports
@@ -14,7 +14,7 @@ export declare class KnownSpells extends DataSource<readonly number[]> {
14
14
  private readonly listeners;
15
15
  private readonly frame;
16
16
  private disposed;
17
- constructor();
17
+ protected constructor();
18
18
  get Status(): KnownSpellsStatus;
19
19
  /** Detached cached metadata, with no native reads. Unreadable books return no entries. */
20
20
  get Entries(): readonly KnownSpell[];
@@ -753,6 +753,8 @@ end
753
753
  local ____exports = {}
754
754
  local ____DataSource = require("datasources.DataSource")
755
755
  local DataSource = ____DataSource.DataSource
756
+ local ____Source = require("datasources.Source")
757
+ local registerSource = ____Source.registerSource
756
758
  --- Cached learned player spellbook IDs. Native events refresh the snapshot; no polling.
757
759
  ____exports.KnownSpells = __TS__Class()
758
760
  local KnownSpells = ____exports.KnownSpells
@@ -1045,7 +1047,14 @@ function KnownSpells.prototype.Dispose(self)
1045
1047
  self.frame:SetScript("OnEvent", nil)
1046
1048
  self.frame:Hide()
1047
1049
  self.listeners:clear()
1048
- end
1050
+ end;
1051
+ (function(self)
1052
+ registerSource(
1053
+ nil,
1054
+ ____exports.KnownSpells,
1055
+ function() return __TS__New(____exports.KnownSpells) end
1056
+ )
1057
+ end)(KnownSpells)
1049
1058
  __TS__SetDescriptor(
1050
1059
  KnownSpells.prototype,
1051
1060
  "Status",
@@ -14,7 +14,7 @@ export declare class ManaRegenTimer extends ProgressSource {
14
14
  private readonly bindings;
15
15
  private alphaCurve?;
16
16
  private disposed;
17
- constructor(observe: ObserveMana);
17
+ protected constructor(observe: ObserveMana);
18
18
  get Phase(): ManaRegenPhase;
19
19
  get IsActive(): boolean;
20
20
  private Remaining;
@@ -451,6 +451,8 @@ end
451
451
  local ____exports = {}
452
452
  local ____ProgressSource = require("datasources.ProgressSource")
453
453
  local ProgressSource = ____ProgressSource.ProgressSource
454
+ local ____Source = require("datasources.Source")
455
+ local registerSource = ____Source.registerSource
454
456
  --- Owned by Mana.UseRegenTimer(). The two-second phase is an estimate, not a server clock.
455
457
  ____exports.ManaRegenTimer = __TS__Class()
456
458
  local ManaRegenTimer = ____exports.ManaRegenTimer
@@ -654,7 +656,14 @@ function ManaRegenTimer.prototype.Dispose(self)
654
656
  ____opt_12(self)
655
657
  end
656
658
  self.unsubscribe = nil
657
- end
659
+ end;
660
+ (function(self)
661
+ registerSource(
662
+ nil,
663
+ ____exports.ManaRegenTimer,
664
+ function(____, props) return __TS__New(____exports.ManaRegenTimer, props[1]) end
665
+ )
666
+ end)(ManaRegenTimer)
658
667
  __TS__SetDescriptor(
659
668
  ManaRegenTimer.prototype,
660
669
  "Phase",
@@ -2,6 +2,6 @@ import { DataSource } from "./DataSource";
2
2
  /** Read-only API value; no cached assignment or game-state mutation. */
3
3
  export declare class NativeNumberSource extends DataSource<number> {
4
4
  private readonly read;
5
- constructor(read: () => number);
5
+ protected constructor(read: () => number);
6
6
  protected GetValue(): number;
7
7
  }
@@ -31,10 +31,18 @@ local function __TS__ClassExtends(target, base)
31
31
  target.prototype.__tostring = base.prototype.__tostring
32
32
  end
33
33
  end
34
+
35
+ local function __TS__New(target, ...)
36
+ local instance = setmetatable({}, target.prototype)
37
+ instance:____constructor(...)
38
+ return instance
39
+ end
34
40
  -- End of Lua Library inline imports
35
41
  local ____exports = {}
36
42
  local ____DataSource = require("datasources.DataSource")
37
43
  local DataSource = ____DataSource.DataSource
44
+ local ____Source = require("datasources.Source")
45
+ local registerSource = ____Source.registerSource
38
46
  --- Read-only API value; no cached assignment or game-state mutation.
39
47
  ____exports.NativeNumberSource = __TS__Class()
40
48
  local NativeNumberSource = ____exports.NativeNumberSource
@@ -46,5 +54,12 @@ function NativeNumberSource.prototype.____constructor(self, read)
46
54
  end
47
55
  function NativeNumberSource.prototype.GetValue(self)
48
56
  return self:read()
49
- end
57
+ end;
58
+ (function(self)
59
+ registerSource(
60
+ nil,
61
+ ____exports.NativeNumberSource,
62
+ function(____, props) return __TS__New(____exports.NativeNumberSource, props[1]) end
63
+ )
64
+ end)(NativeNumberSource)
50
65
  return ____exports
@@ -31,18 +31,14 @@ local function __TS__ClassExtends(target, base)
31
31
  target.prototype.__tostring = base.prototype.__tostring
32
32
  end
33
33
  end
34
-
35
- local function __TS__New(target, ...)
36
- local instance = setmetatable({}, target.prototype)
37
- instance:____constructor(...)
38
- return instance
39
- end
40
34
  -- End of Lua Library inline imports
41
35
  local ____exports = {}
42
36
  local ____DataSource = require("datasources.DataSource")
43
37
  local DataSource = ____DataSource.DataSource
44
38
  local ____NativeNumberSource = require("datasources.NativeNumberSource")
45
39
  local NativeNumberSource = ____NativeNumberSource.NativeNumberSource
40
+ local ____UseSource = require("datasources.UseSource")
41
+ local UseSource = ____UseSource.UseSource
46
42
  --- Shared contract for health, power, cooldowns, and other progress values.
47
43
  ____exports.ProgressSource = __TS__Class()
48
44
  local ProgressSource = ____exports.ProgressSource
@@ -51,9 +47,9 @@ __TS__ClassExtends(ProgressSource, DataSource)
51
47
  function ProgressSource.prototype.____constructor(self, readers)
52
48
  DataSource.prototype.____constructor(self, 0)
53
49
  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)
50
+ self.Min = UseSource(nil, NativeNumberSource, readers.min)
51
+ self.Max = UseSource(nil, NativeNumberSource, readers.max)
52
+ self.Percent = UseSource(nil, NativeNumberSource, readers.percent)
57
53
  end
58
54
  function ProgressSource.prototype.GetValue(self)
59
55
  return self.readers:current()
@@ -1,9 +1,9 @@
1
1
  import { ProgressSource } from "./ProgressSource";
2
2
  import { UnitSource } from "./UnitSource";
3
3
  import type { UnitInput } from "./UnitSource";
4
- import { DataSource } from "./DataSource";
5
4
  import type { ProgressOverrides } from "./ProgressSource";
6
5
  import { ManaRegenTimer } from "./ManaRegenTimer";
6
+ import { Source } from "./Source";
7
7
  export { Unit } from "./UnitSource";
8
8
  /** Direct API-to-widget binding; opaque values are never compared or calculated. */
9
9
  declare abstract class Resource extends ProgressSource {
@@ -23,25 +23,46 @@ declare abstract class Resource extends ProgressSource {
23
23
  protected Observe(listener: (event: string, payload: unknown[], value: number) => void): () => void;
24
24
  protected Listen(_frame: wuiraNativeFrame, refresh: () => void): () => void;
25
25
  }
26
- /** Live optional prediction channel. Secret amounts only travel to native sinks. */
27
- export declare class HealthPrediction extends DataSource<number> {
28
- private readonly read;
29
- constructor(read: (() => number | undefined) | undefined);
30
- get IsAvailable(): boolean;
31
- protected GetValue(): number;
26
+ /** One optional unit amount. A missing native function stays unavailable and is never called. */
27
+ declare abstract class UnitAmount extends Source<number, [UnitInput]> {
28
+ readonly target: UnitSource;
29
+ abstract get IsAvailable(): boolean;
30
+ protected constructor(unit: UnitInput);
32
31
  ApplyTo(frame: wuiraNativeStatusBar, maximum: number): void;
33
32
  }
33
+ /** Total absorbs on a unit. `UnitGetTotalAbsorbs`. */
34
+ export declare class Absorb extends UnitAmount {
35
+ get IsAvailable(): boolean;
36
+ protected constructor(unit: UnitInput);
37
+ protected read(props: [UnitInput]): number;
38
+ }
39
+ /** Incoming heals on a unit. `UnitGetIncomingHeals`. */
40
+ export declare class Prediction extends UnitAmount {
41
+ get IsAvailable(): boolean;
42
+ protected constructor(unit: UnitInput);
43
+ protected read(props: [UnitInput]): number;
44
+ }
34
45
  export declare class HP extends Resource {
35
- private healPrediction?;
36
- private absorbPrediction?;
37
- get HealPrediction(): HealthPrediction | undefined;
38
- get AbsorbPrediction(): HealthPrediction | undefined;
39
- UseHealPrediction(): this;
46
+ private absorb?;
47
+ private prediction?;
48
+ /** Same object as `UseSource(Absorb, unit)`. Absent until `UseAbsorb`. */
49
+ get Absorb(): Absorb | undefined;
50
+ /** Same object as `UseSource(Prediction, unit)`. Absent until `UsePrediction`. */
51
+ get Prediction(): Prediction | undefined;
52
+ /** @deprecated Use Absorb. */
53
+ get AbsorbPrediction(): Absorb | undefined;
54
+ /** @deprecated Use Prediction. */
55
+ get HealPrediction(): Prediction | undefined;
56
+ UseAbsorb(): this;
57
+ UsePrediction(): this;
58
+ /** @deprecated Use UseAbsorb. */
40
59
  UseAbsorbPrediction(): this;
60
+ /** @deprecated Use UsePrediction. */
61
+ UseHealPrediction(): this;
41
62
  BindTo(frame: wuiraNativeStatusBar, options?: ProgressOverrides): () => void;
42
63
  readonly target: UnitSource;
43
64
  get unit(): string;
44
- constructor(unit?: UnitInput);
65
+ protected constructor(unit?: UnitInput);
45
66
  }
46
67
  /** Explicit mana (power type 0), even while the unit uses rage/energy. */
47
68
  export declare class Mana extends Resource {
@@ -50,7 +71,7 @@ export declare class Mana extends Resource {
50
71
  UseRegenTimer(): this;
51
72
  readonly target: UnitSource;
52
73
  get unit(): string;
53
- constructor(unit: UnitInput);
74
+ protected constructor(unit: UnitInput);
54
75
  }
55
76
  export declare const DataSources: {
56
77
  Resources: {