wuira 0.2.3 → 0.2.5

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 (38) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +62 -792
  3. package/data/icons/forever.json +90051 -0
  4. package/docs/icons.md +28 -0
  5. package/docs/source-converters.md +34 -0
  6. package/lib/datasources/DataSource.d.ts +8 -0
  7. package/lib/datasources/DataSource.lua +7 -0
  8. package/lib/datasources/GroupMembers.d.ts +6 -0
  9. package/lib/datasources/GroupMembers.lua +332 -0
  10. package/lib/datasources/GroupRoster.d.ts +28 -0
  11. package/lib/datasources/GroupRoster.lua +611 -0
  12. package/lib/datasources/MathConverter.d.ts +6 -0
  13. package/lib/datasources/MathConverter.lua +61 -0
  14. package/lib/datasources/MathExpression.d.ts +16 -0
  15. package/lib/datasources/MathExpression.lua +281 -0
  16. package/lib/datasources/Resources.d.ts +3 -2
  17. package/lib/datasources/Resources.lua +57 -48
  18. package/lib/datasources/SourceConverter.d.ts +39 -0
  19. package/lib/datasources/SourceConverter.lua +568 -0
  20. package/lib/datasources/UnitInfo.d.ts +6 -0
  21. package/lib/datasources/UnitInfo.lua +347 -15
  22. package/lib/datasources/UnitSource.d.ts +8 -3
  23. package/lib/datasources/UnitSource.lua +318 -5
  24. package/lib/datasources/index.d.ts +7 -1
  25. package/lib/datasources/index.lua +15 -0
  26. package/lib/icons/index.d.ts +45634 -0
  27. package/lib/icons/index.lua +3 -0
  28. package/lib/index.d.ts +1 -0
  29. package/lib/store/index.lua +20 -18
  30. package/lib/ui/Cell.d.ts +2 -0
  31. package/lib/ui/ForEach.d.ts +18 -4
  32. package/lib/ui/ForEach.lua +763 -13
  33. package/lib/ui/index.d.ts +1 -1
  34. package/package.json +20 -4
  35. package/tools/build-library.mjs +1 -1
  36. package/tools/generate-icons.mjs +10 -0
  37. package/tools/icon-data.mjs +59 -0
  38. package/tools/update-icons.mjs +36 -0
@@ -175,6 +175,283 @@ local function __TS__New(target, ...)
175
175
  instance:____constructor(...)
176
176
  return instance
177
177
  end
178
+
179
+ local __TS__Symbol, Symbol
180
+ do
181
+ local symbolMetatable = {__tostring = function(self)
182
+ return ("Symbol(" .. (self.description or "")) .. ")"
183
+ end}
184
+ function __TS__Symbol(description)
185
+ return setmetatable({description = description}, symbolMetatable)
186
+ end
187
+ Symbol = {
188
+ asyncDispose = __TS__Symbol("Symbol.asyncDispose"),
189
+ dispose = __TS__Symbol("Symbol.dispose"),
190
+ iterator = __TS__Symbol("Symbol.iterator"),
191
+ hasInstance = __TS__Symbol("Symbol.hasInstance"),
192
+ species = __TS__Symbol("Symbol.species"),
193
+ toStringTag = __TS__Symbol("Symbol.toStringTag")
194
+ }
195
+ end
196
+
197
+ local __TS__Iterator
198
+ do
199
+ local function iteratorGeneratorStep(self)
200
+ local co = self.____coroutine
201
+ local status, value = coroutine.resume(co)
202
+ if not status then
203
+ error(value, 0)
204
+ end
205
+ if coroutine.status(co) == "dead" then
206
+ return
207
+ end
208
+ return true, value
209
+ end
210
+ local function iteratorIteratorStep(self)
211
+ local result = self:next()
212
+ if result.done then
213
+ return
214
+ end
215
+ return true, result.value
216
+ end
217
+ local function iteratorStringStep(self, index)
218
+ index = index + 1
219
+ if index > #self then
220
+ return
221
+ end
222
+ return index, string.sub(self, index, index)
223
+ end
224
+ function __TS__Iterator(iterable)
225
+ if type(iterable) == "string" then
226
+ return iteratorStringStep, iterable, 0
227
+ elseif iterable.____coroutine ~= nil then
228
+ return iteratorGeneratorStep, iterable
229
+ elseif iterable[Symbol.iterator] then
230
+ local iterator = iterable[Symbol.iterator](iterable)
231
+ return iteratorIteratorStep, iterator
232
+ else
233
+ return ipairs(iterable)
234
+ end
235
+ end
236
+ end
237
+
238
+ local Set
239
+ do
240
+ Set = __TS__Class()
241
+ Set.name = "Set"
242
+ function Set.prototype.____constructor(self, values)
243
+ self[Symbol.toStringTag] = "Set"
244
+ self.size = 0
245
+ self.nextKey = {}
246
+ self.previousKey = {}
247
+ if values == nil then
248
+ return
249
+ end
250
+ local iterable = values
251
+ if iterable[Symbol.iterator] then
252
+ local iterator = iterable[Symbol.iterator](iterable)
253
+ while true do
254
+ local result = iterator:next()
255
+ if result.done then
256
+ break
257
+ end
258
+ self:add(result.value)
259
+ end
260
+ else
261
+ local array = values
262
+ for ____, value in ipairs(array) do
263
+ self:add(value)
264
+ end
265
+ end
266
+ end
267
+ function Set.prototype.add(self, value)
268
+ local isNewValue = not self:has(value)
269
+ if isNewValue then
270
+ self.size = self.size + 1
271
+ end
272
+ if self.firstKey == nil then
273
+ self.firstKey = value
274
+ self.lastKey = value
275
+ elseif isNewValue then
276
+ self.nextKey[self.lastKey] = value
277
+ self.previousKey[value] = self.lastKey
278
+ self.lastKey = value
279
+ end
280
+ return self
281
+ end
282
+ function Set.prototype.clear(self)
283
+ self.nextKey = {}
284
+ self.previousKey = {}
285
+ self.firstKey = nil
286
+ self.lastKey = nil
287
+ self.size = 0
288
+ end
289
+ function Set.prototype.delete(self, value)
290
+ local contains = self:has(value)
291
+ if contains then
292
+ self.size = self.size - 1
293
+ local next = self.nextKey[value]
294
+ local previous = self.previousKey[value]
295
+ if next ~= nil and previous ~= nil then
296
+ self.nextKey[previous] = next
297
+ self.previousKey[next] = previous
298
+ elseif next ~= nil then
299
+ self.firstKey = next
300
+ self.previousKey[next] = nil
301
+ elseif previous ~= nil then
302
+ self.lastKey = previous
303
+ self.nextKey[previous] = nil
304
+ else
305
+ self.firstKey = nil
306
+ self.lastKey = nil
307
+ end
308
+ self.nextKey[value] = nil
309
+ self.previousKey[value] = nil
310
+ end
311
+ return contains
312
+ end
313
+ function Set.prototype.forEach(self, callback)
314
+ for ____, key in __TS__Iterator(self:keys()) do
315
+ callback(nil, key, key, self)
316
+ end
317
+ end
318
+ function Set.prototype.has(self, value)
319
+ return self.nextKey[value] ~= nil or self.lastKey == value
320
+ end
321
+ Set.prototype[Symbol.iterator] = function(self)
322
+ return self:values()
323
+ end
324
+ function Set.prototype.entries(self)
325
+ local function getFirstKey()
326
+ return self.firstKey
327
+ end
328
+ local nextKey = self.nextKey
329
+ local key
330
+ local started = false
331
+ return {
332
+ [Symbol.iterator] = function(self)
333
+ return self
334
+ end,
335
+ next = function(self)
336
+ if not started then
337
+ started = true
338
+ key = getFirstKey(nil)
339
+ else
340
+ key = nextKey[key]
341
+ end
342
+ return {done = not key, value = {key, key}}
343
+ end
344
+ }
345
+ end
346
+ function Set.prototype.keys(self)
347
+ local function getFirstKey()
348
+ return self.firstKey
349
+ end
350
+ local nextKey = self.nextKey
351
+ local key
352
+ local started = false
353
+ return {
354
+ [Symbol.iterator] = function(self)
355
+ return self
356
+ end,
357
+ next = function(self)
358
+ if not started then
359
+ started = true
360
+ key = getFirstKey(nil)
361
+ else
362
+ key = nextKey[key]
363
+ end
364
+ return {done = not key, value = key}
365
+ end
366
+ }
367
+ end
368
+ function Set.prototype.values(self)
369
+ local function getFirstKey()
370
+ return self.firstKey
371
+ end
372
+ local nextKey = self.nextKey
373
+ local key
374
+ local started = false
375
+ return {
376
+ [Symbol.iterator] = function(self)
377
+ return self
378
+ end,
379
+ next = function(self)
380
+ if not started then
381
+ started = true
382
+ key = getFirstKey(nil)
383
+ else
384
+ key = nextKey[key]
385
+ end
386
+ return {done = not key, value = key}
387
+ end
388
+ }
389
+ end
390
+ function Set.prototype.union(self, other)
391
+ local result = __TS__New(Set, self)
392
+ for ____, item in __TS__Iterator(other) do
393
+ result:add(item)
394
+ end
395
+ return result
396
+ end
397
+ function Set.prototype.intersection(self, other)
398
+ local result = __TS__New(Set)
399
+ for ____, item in __TS__Iterator(self) do
400
+ if other:has(item) then
401
+ result:add(item)
402
+ end
403
+ end
404
+ return result
405
+ end
406
+ function Set.prototype.difference(self, other)
407
+ local result = __TS__New(Set, self)
408
+ for ____, item in __TS__Iterator(other) do
409
+ result:delete(item)
410
+ end
411
+ return result
412
+ end
413
+ function Set.prototype.symmetricDifference(self, other)
414
+ local result = __TS__New(Set, self)
415
+ for ____, item in __TS__Iterator(other) do
416
+ if self:has(item) then
417
+ result:delete(item)
418
+ else
419
+ result:add(item)
420
+ end
421
+ end
422
+ return result
423
+ end
424
+ function Set.prototype.isSubsetOf(self, other)
425
+ for ____, item in __TS__Iterator(self) do
426
+ if not other:has(item) then
427
+ return false
428
+ end
429
+ end
430
+ return true
431
+ end
432
+ function Set.prototype.isSupersetOf(self, other)
433
+ for ____, item in __TS__Iterator(other) do
434
+ if not self:has(item) then
435
+ return false
436
+ end
437
+ end
438
+ return true
439
+ end
440
+ function Set.prototype.isDisjointFrom(self, other)
441
+ for ____, item in __TS__Iterator(self) do
442
+ if other:has(item) then
443
+ return false
444
+ end
445
+ end
446
+ return true
447
+ end
448
+ Set[Symbol.species] = Set
449
+ end
450
+
451
+ local function __TS__StringTrim(self)
452
+ local result = string.gsub(self, "^[%s ]*(.-)[%s ]*$", "%1")
453
+ return result
454
+ end
178
455
  -- End of Lua Library inline imports
179
456
  local ____exports = {}
180
457
  local ____DataSource = require("datasources.DataSource")
@@ -190,7 +467,7 @@ __TS__SetDescriptor(
190
467
  UnitPredicates.prototype,
191
468
  "PC",
192
469
  {get = function(self)
193
- local value = UnitIsPlayer(self.token)
470
+ local value = UnitIsPlayer(self:token())
194
471
  local ____issecretvalue_result_0
195
472
  if issecretvalue(value) then
196
473
  ____issecretvalue_result_0 = nil
@@ -205,7 +482,10 @@ __TS__SetDescriptor(
205
482
  UnitPredicates.prototype,
206
483
  "Self",
207
484
  {get = function(self)
208
- local value = UnitIsUnit(self.token, "player")
485
+ local value = UnitIsUnit(
486
+ self:token(),
487
+ "player"
488
+ )
209
489
  local ____issecretvalue_result_1
210
490
  if issecretvalue(value) then
211
491
  ____issecretvalue_result_1 = nil
@@ -221,11 +501,36 @@ ____exports.UnitSource = __TS__Class()
221
501
  local UnitSource = ____exports.UnitSource
222
502
  UnitSource.name = "UnitSource"
223
503
  __TS__ClassExtends(UnitSource, DataSource)
224
- function UnitSource.prototype.____constructor(self, Token)
504
+ function UnitSource.prototype.____constructor(self, token)
225
505
  DataSource.prototype.____constructor(self, nil)
226
- self.Token = Token
506
+ self.token = token
227
507
  self.restricted = false
228
- self.Is = __TS__New(____exports.UnitPredicates, Token)
508
+ self.listeners = __TS__New(Set)
509
+ self.Is = __TS__New(
510
+ ____exports.UnitPredicates,
511
+ function() return self.Token end
512
+ )
513
+ end
514
+ function UnitSource.prototype.Retarget(self, token)
515
+ if token == self.token then
516
+ return
517
+ end
518
+ if InCombatLockdown() then
519
+ error("UnitSource: retarget after combat so secure actions and displayed data stay aligned")
520
+ end
521
+ if issecretvalue(token) or type(token) ~= "string" or __TS__StringTrim(token) == "" then
522
+ error("UnitSource: expected a public unit token")
523
+ end
524
+ self.token = token
525
+ for ____, listener in __TS__Iterator(self.listeners) do
526
+ listener(nil)
527
+ end
528
+ end
529
+ function UnitSource.prototype.onChange(self, listener)
530
+ self.listeners:add(listener)
531
+ return function()
532
+ self.listeners:delete(listener)
533
+ end
229
534
  end
230
535
  function UnitSource.prototype.HasSecretFields(self)
231
536
  return self.restricted
@@ -238,6 +543,14 @@ function UnitSource.prototype.GetValue(self)
238
543
  end
239
544
  return {token = self.Token, guid = guid}
240
545
  end
546
+ __TS__SetDescriptor(
547
+ UnitSource.prototype,
548
+ "Token",
549
+ {get = function(self)
550
+ return self.token
551
+ end},
552
+ true
553
+ )
241
554
  --- Reuse explicit unit references; string inputs remain a convenience shorthand.
242
555
  function ____exports.resolveUnit(self, unit)
243
556
  return type(unit) == "string" and __TS__New(____exports.UnitSource, unit) or unit
@@ -1,5 +1,9 @@
1
1
  /// <reference path="../platform/forever.d.ts" />
2
2
  export { DataSource } from "./DataSource";
3
+ export type { ReadResult } from "./DataSource";
4
+ export { SourceConverter, CaseConverter } from "./SourceConverter";
5
+ export type { ValueSource, CaseKey, SourceCase } from "./SourceConverter";
6
+ export { MathConverter } from "./MathConverter";
3
7
  export { EditModeLayouts } from "./EditModeLayouts";
4
8
  export type { EditModeLayout, EditModeLayoutSnapshot, EditModeLayoutsStatus } from "./EditModeLayouts";
5
9
  export { ProgressSource } from "./ProgressSource";
@@ -8,9 +12,11 @@ export { Aura, AuraSource, Buffs, Debuffs } from "./Auras";
8
12
  export type { AuraSourceStatus } from "./Auras";
9
13
  export { GroupMembers, PartyMembers, RaidMembers } from "./GroupMembers";
10
14
  export type { GroupScope } from "./GroupMembers";
15
+ export { GroupRoster, getPetUnitToken } from "./GroupRoster";
16
+ export type { GroupRosterMember } from "./GroupRoster";
11
17
  export { ClassSource, SpecSource, Specializations } from "./UnitInfo";
12
18
  export type { ClassInfo, SpecializationInfo, InspectStatus } from "./UnitInfo";
13
- export { UnitSource } from "./UnitSource";
19
+ export { UnitSource, resolveUnit } from "./UnitSource";
14
20
  export type { UnitInput, UnitIdentity } from "./UnitSource";
15
21
  export { SwingTimer, SwingHand } from "./SwingTimer";
16
22
  export { TimerSource } from "./TimerSource";
@@ -4,6 +4,15 @@ do
4
4
  local ____DataSource = require("datasources.DataSource")
5
5
  ____exports.DataSource = ____DataSource.DataSource
6
6
  end
7
+ do
8
+ local ____SourceConverter = require("datasources.SourceConverter")
9
+ ____exports.SourceConverter = ____SourceConverter.SourceConverter
10
+ ____exports.CaseConverter = ____SourceConverter.CaseConverter
11
+ end
12
+ do
13
+ local ____MathConverter = require("datasources.MathConverter")
14
+ ____exports.MathConverter = ____MathConverter.MathConverter
15
+ end
7
16
  do
8
17
  local ____EditModeLayouts = require("datasources.EditModeLayouts")
9
18
  ____exports.EditModeLayouts = ____EditModeLayouts.EditModeLayouts
@@ -33,6 +42,11 @@ do
33
42
  ____exports.PartyMembers = ____GroupMembers.PartyMembers
34
43
  ____exports.RaidMembers = ____GroupMembers.RaidMembers
35
44
  end
45
+ do
46
+ local ____GroupRoster = require("datasources.GroupRoster")
47
+ ____exports.GroupRoster = ____GroupRoster.GroupRoster
48
+ ____exports.getPetUnitToken = ____GroupRoster.getPetUnitToken
49
+ end
36
50
  do
37
51
  local ____UnitInfo = require("datasources.UnitInfo")
38
52
  ____exports.ClassSource = ____UnitInfo.ClassSource
@@ -42,6 +56,7 @@ end
42
56
  do
43
57
  local ____UnitSource = require("datasources.UnitSource")
44
58
  ____exports.UnitSource = ____UnitSource.UnitSource
59
+ ____exports.resolveUnit = ____UnitSource.resolveUnit
45
60
  end
46
61
  do
47
62
  local ____SwingTimer = require("datasources.SwingTimer")