wuira 0.2.4 → 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.
- package/CHANGELOG.md +20 -0
- package/README.md +62 -831
- package/data/icons/forever.json +90051 -0
- package/docs/icons.md +28 -0
- package/docs/source-converters.md +34 -0
- package/lib/datasources/DataSource.d.ts +8 -0
- package/lib/datasources/DataSource.lua +7 -0
- package/lib/datasources/MathConverter.d.ts +6 -0
- package/lib/datasources/MathConverter.lua +61 -0
- package/lib/datasources/MathExpression.d.ts +16 -0
- package/lib/datasources/MathExpression.lua +281 -0
- package/lib/datasources/SourceConverter.d.ts +39 -0
- package/lib/datasources/SourceConverter.lua +568 -0
- package/lib/datasources/UnitInfo.d.ts +6 -0
- package/lib/datasources/UnitInfo.lua +347 -15
- package/lib/datasources/index.d.ts +4 -0
- package/lib/datasources/index.lua +9 -0
- package/lib/icons/index.d.ts +45634 -0
- package/lib/icons/index.lua +3 -0
- package/lib/index.d.ts +1 -0
- package/lib/store/index.lua +20 -18
- package/package.json +20 -4
- package/tools/build-library.mjs +1 -1
- package/tools/generate-icons.mjs +10 -0
- package/tools/icon-data.mjs +59 -0
- package/tools/update-icons.mjs +36 -0
|
@@ -0,0 +1,568 @@
|
|
|
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__ObjectValues(obj)
|
|
289
|
+
local result = {}
|
|
290
|
+
local len = 0
|
|
291
|
+
for key in pairs(obj) do
|
|
292
|
+
len = len + 1
|
|
293
|
+
result[len] = obj[key]
|
|
294
|
+
end
|
|
295
|
+
return result
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
local function __TS__ClassExtends(target, base)
|
|
299
|
+
target.____super = base
|
|
300
|
+
local staticMetatable = setmetatable({__index = base}, base)
|
|
301
|
+
setmetatable(target, staticMetatable)
|
|
302
|
+
local baseMetatable = getmetatable(base)
|
|
303
|
+
if baseMetatable then
|
|
304
|
+
if type(baseMetatable.__index) == "function" then
|
|
305
|
+
staticMetatable.__index = baseMetatable.__index
|
|
306
|
+
end
|
|
307
|
+
if type(baseMetatable.__newindex) == "function" then
|
|
308
|
+
staticMetatable.__newindex = baseMetatable.__newindex
|
|
309
|
+
end
|
|
310
|
+
end
|
|
311
|
+
setmetatable(target.prototype, base.prototype)
|
|
312
|
+
if type(base.prototype.__index) == "function" then
|
|
313
|
+
target.prototype.__index = base.prototype.__index
|
|
314
|
+
end
|
|
315
|
+
if type(base.prototype.__newindex) == "function" then
|
|
316
|
+
target.prototype.__newindex = base.prototype.__newindex
|
|
317
|
+
end
|
|
318
|
+
if type(base.prototype.__tostring) == "function" then
|
|
319
|
+
target.prototype.__tostring = base.prototype.__tostring
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
local function __TS__ObjectAssign(target, ...)
|
|
324
|
+
local sources = {...}
|
|
325
|
+
for i = 1, #sources do
|
|
326
|
+
local source = sources[i]
|
|
327
|
+
if type(source) == "table" then
|
|
328
|
+
for key in pairs(source) do
|
|
329
|
+
target[key] = source[key]
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
return target
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
local function __TS__ArrayMap(self, callbackfn, thisArg)
|
|
337
|
+
local result = {}
|
|
338
|
+
for i = 1, #self do
|
|
339
|
+
result[i] = callbackfn(thisArg, self[i], i - 1, self)
|
|
340
|
+
end
|
|
341
|
+
return result
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
local function __TS__TypeOf(value)
|
|
345
|
+
local luaType = type(value)
|
|
346
|
+
if luaType == "table" then
|
|
347
|
+
return "object"
|
|
348
|
+
elseif luaType == "nil" then
|
|
349
|
+
return "undefined"
|
|
350
|
+
else
|
|
351
|
+
return luaType
|
|
352
|
+
end
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
local function __TS__ArrayIncludes(self, searchElement, fromIndex)
|
|
356
|
+
if fromIndex == nil then
|
|
357
|
+
fromIndex = 0
|
|
358
|
+
end
|
|
359
|
+
local len = #self
|
|
360
|
+
local k = fromIndex
|
|
361
|
+
if fromIndex < 0 then
|
|
362
|
+
k = len + fromIndex
|
|
363
|
+
end
|
|
364
|
+
if k < 0 then
|
|
365
|
+
k = 0
|
|
366
|
+
end
|
|
367
|
+
for i = k + 1, len do
|
|
368
|
+
if self[i] == searchElement then
|
|
369
|
+
return true
|
|
370
|
+
end
|
|
371
|
+
end
|
|
372
|
+
return false
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
local function __TS__NumberIsFinite(value)
|
|
376
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
377
|
+
end
|
|
378
|
+
-- End of Lua Library inline imports
|
|
379
|
+
local ____exports = {}
|
|
380
|
+
local ____DataSource = require("datasources.DataSource")
|
|
381
|
+
local DataSource = ____DataSource.DataSource
|
|
382
|
+
local function restricted(self, value, seen, depth)
|
|
383
|
+
if seen == nil then
|
|
384
|
+
seen = __TS__New(Set)
|
|
385
|
+
end
|
|
386
|
+
if depth == nil then
|
|
387
|
+
depth = 0
|
|
388
|
+
end
|
|
389
|
+
if issecretvalue(value) or depth > 32 then
|
|
390
|
+
return true
|
|
391
|
+
end
|
|
392
|
+
if type(value) ~= "table" or value == nil or seen:has(value) then
|
|
393
|
+
return false
|
|
394
|
+
end
|
|
395
|
+
seen:add(value)
|
|
396
|
+
for ____, child in ipairs(__TS__ObjectValues(value)) do
|
|
397
|
+
if restricted(nil, child, seen, depth + 1) then
|
|
398
|
+
return true
|
|
399
|
+
end
|
|
400
|
+
end
|
|
401
|
+
return false
|
|
402
|
+
end
|
|
403
|
+
--- Checked value transformation. No timers, native widgets or ownership of the input.
|
|
404
|
+
____exports.SourceConverter = __TS__Class()
|
|
405
|
+
local SourceConverter = ____exports.SourceConverter
|
|
406
|
+
SourceConverter.name = "SourceConverter"
|
|
407
|
+
__TS__ClassExtends(SourceConverter, DataSource)
|
|
408
|
+
function SourceConverter.prototype.____constructor(self, input, convert)
|
|
409
|
+
DataSource.prototype.____constructor(self, nil)
|
|
410
|
+
self.input = input
|
|
411
|
+
self.convert = convert
|
|
412
|
+
self.listeners = __TS__New(Set)
|
|
413
|
+
self.disposed = false
|
|
414
|
+
self.blocked = false
|
|
415
|
+
self.readable = false
|
|
416
|
+
end
|
|
417
|
+
function SourceConverter.prototype.GetValue(self)
|
|
418
|
+
if self.disposed then
|
|
419
|
+
error("SourceConverter is disposed")
|
|
420
|
+
end
|
|
421
|
+
if self.input.TryCompute ~= nil then
|
|
422
|
+
local result = self.input:TryCompute(function(____, value) return self:Convert(value) end)
|
|
423
|
+
if not result.readable then
|
|
424
|
+
self.blocked = true
|
|
425
|
+
return nil
|
|
426
|
+
end
|
|
427
|
+
return result.value
|
|
428
|
+
end
|
|
429
|
+
self.blocked = self.input:IsSecret()
|
|
430
|
+
if self.blocked then
|
|
431
|
+
return nil
|
|
432
|
+
end
|
|
433
|
+
return self:Convert(self.input.Value)
|
|
434
|
+
end
|
|
435
|
+
function SourceConverter.prototype.Convert(self, value)
|
|
436
|
+
self.blocked = restricted(nil, value)
|
|
437
|
+
local ____table_blocked_0
|
|
438
|
+
if self.blocked then
|
|
439
|
+
____table_blocked_0 = nil
|
|
440
|
+
else
|
|
441
|
+
____table_blocked_0 = self:convert(value)
|
|
442
|
+
end
|
|
443
|
+
return ____table_blocked_0
|
|
444
|
+
end
|
|
445
|
+
function SourceConverter.prototype.HasSecretFields(self, value)
|
|
446
|
+
return self.blocked or restricted(nil, value)
|
|
447
|
+
end
|
|
448
|
+
function SourceConverter.prototype.onChange(self, listener)
|
|
449
|
+
if self.disposed then
|
|
450
|
+
error("SourceConverter is disposed")
|
|
451
|
+
end
|
|
452
|
+
if self.listeners.size == 0 then
|
|
453
|
+
local value = self:GetValue()
|
|
454
|
+
self.readable = not self:HasSecretFields(value)
|
|
455
|
+
local ____table_readable_1
|
|
456
|
+
if self.readable then
|
|
457
|
+
____table_readable_1 = value
|
|
458
|
+
else
|
|
459
|
+
____table_readable_1 = nil
|
|
460
|
+
end
|
|
461
|
+
self.previous = ____table_readable_1
|
|
462
|
+
end
|
|
463
|
+
self.listeners:add(listener)
|
|
464
|
+
if self.listeners.size == 1 then
|
|
465
|
+
do
|
|
466
|
+
local function ____catch(failure)
|
|
467
|
+
self.listeners:delete(listener)
|
|
468
|
+
error(failure, 0)
|
|
469
|
+
end
|
|
470
|
+
local ____try, ____hasReturned = pcall(function()
|
|
471
|
+
local ____this_3
|
|
472
|
+
____this_3 = self.input
|
|
473
|
+
local ____opt_2 = ____this_3.onChange
|
|
474
|
+
self.stop = ____opt_2 and ____opt_2(
|
|
475
|
+
____this_3,
|
|
476
|
+
function() return self:Refresh() end
|
|
477
|
+
)
|
|
478
|
+
end)
|
|
479
|
+
if not ____try then
|
|
480
|
+
____catch(____hasReturned)
|
|
481
|
+
end
|
|
482
|
+
end
|
|
483
|
+
end
|
|
484
|
+
return function()
|
|
485
|
+
self.listeners:delete(listener)
|
|
486
|
+
if self.listeners.size == 0 then
|
|
487
|
+
local ____opt_4 = self.stop
|
|
488
|
+
if ____opt_4 ~= nil then
|
|
489
|
+
____opt_4(self)
|
|
490
|
+
end
|
|
491
|
+
self.stop = nil
|
|
492
|
+
end
|
|
493
|
+
end
|
|
494
|
+
end
|
|
495
|
+
function SourceConverter.prototype.Refresh(self)
|
|
496
|
+
local value = self:GetValue()
|
|
497
|
+
if self:HasSecretFields(value) then
|
|
498
|
+
self.readable = false
|
|
499
|
+
return
|
|
500
|
+
end
|
|
501
|
+
local same = self.readable and value == self.previous
|
|
502
|
+
self.previous = value
|
|
503
|
+
self.readable = true
|
|
504
|
+
if not same and self:CanEmit(value) then
|
|
505
|
+
for ____, listener in __TS__Iterator(self.listeners) do
|
|
506
|
+
listener(nil, value)
|
|
507
|
+
end
|
|
508
|
+
end
|
|
509
|
+
end
|
|
510
|
+
function SourceConverter.prototype.BindTo(self, apply)
|
|
511
|
+
if not self:IsSecret() then
|
|
512
|
+
local value = self.Value
|
|
513
|
+
if self:CanEmit(value) then
|
|
514
|
+
apply(nil, value)
|
|
515
|
+
end
|
|
516
|
+
end
|
|
517
|
+
return self:onChange(apply)
|
|
518
|
+
end
|
|
519
|
+
function SourceConverter.prototype.Dispose(self)
|
|
520
|
+
if self.disposed then
|
|
521
|
+
return
|
|
522
|
+
end
|
|
523
|
+
self.disposed = true
|
|
524
|
+
local ____opt_6 = self.stop
|
|
525
|
+
if ____opt_6 ~= nil then
|
|
526
|
+
____opt_6(self)
|
|
527
|
+
end
|
|
528
|
+
self.stop = nil
|
|
529
|
+
self.listeners:clear()
|
|
530
|
+
end
|
|
531
|
+
--- Strict equality, first matching case, then the optional default value.
|
|
532
|
+
____exports.CaseConverter = __TS__Class()
|
|
533
|
+
local CaseConverter = ____exports.CaseConverter
|
|
534
|
+
CaseConverter.name = "CaseConverter"
|
|
535
|
+
__TS__ClassExtends(CaseConverter, ____exports.SourceConverter)
|
|
536
|
+
function CaseConverter.prototype.____constructor(self, input, cases, fallback)
|
|
537
|
+
local entries = __TS__ArrayMap(
|
|
538
|
+
cases,
|
|
539
|
+
function(____, entry) return __TS__ObjectAssign({}, entry) end
|
|
540
|
+
)
|
|
541
|
+
local seen = __TS__New(Set)
|
|
542
|
+
for ____, entry in ipairs(entries) do
|
|
543
|
+
local key = entry.equals
|
|
544
|
+
if issecretvalue(key) or not __TS__ArrayIncludes(
|
|
545
|
+
{"string", "number", "boolean"},
|
|
546
|
+
__TS__TypeOf(key)
|
|
547
|
+
) or type(key) == "number" and not __TS__NumberIsFinite(key) then
|
|
548
|
+
error("CaseConverter: invalid match value")
|
|
549
|
+
end
|
|
550
|
+
if seen:has(key) then
|
|
551
|
+
error("CaseConverter: duplicate match value")
|
|
552
|
+
end
|
|
553
|
+
seen:add(key)
|
|
554
|
+
end
|
|
555
|
+
CaseConverter.____super.prototype.____constructor(
|
|
556
|
+
self,
|
|
557
|
+
input,
|
|
558
|
+
function(____, value)
|
|
559
|
+
for ____, entry in ipairs(entries) do
|
|
560
|
+
if value == entry.equals then
|
|
561
|
+
return entry.value
|
|
562
|
+
end
|
|
563
|
+
end
|
|
564
|
+
return fallback
|
|
565
|
+
end
|
|
566
|
+
)
|
|
567
|
+
end
|
|
568
|
+
return ____exports
|
|
@@ -8,11 +8,17 @@ export interface ClassInfo {
|
|
|
8
8
|
}
|
|
9
9
|
export declare class ClassSource extends DataSource<ClassInfo | undefined> {
|
|
10
10
|
private restricted;
|
|
11
|
+
private readonly listeners;
|
|
12
|
+
private events?;
|
|
13
|
+
private stopUnit?;
|
|
11
14
|
readonly target: UnitSource;
|
|
12
15
|
constructor(unit: UnitInput);
|
|
13
16
|
get unit(): string;
|
|
14
17
|
protected HasSecretFields(): boolean;
|
|
15
18
|
protected GetValue(): ClassInfo | undefined;
|
|
19
|
+
onChange(listener: (value: ClassInfo | undefined) => void): () => void;
|
|
20
|
+
private StopListening;
|
|
21
|
+
Dispose(): void;
|
|
16
22
|
}
|
|
17
23
|
export interface SpecializationInfo {
|
|
18
24
|
readonly id: number;
|