@quenty/observablecollection 12.20.3 → 12.20.4-canary.11a5dcf.0

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 CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [12.20.4-canary.11a5dcf.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/observablecollection@12.20.3...@quenty/observablecollection@12.20.4-canary.11a5dcf.0) (2025-05-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Additional type checking updates ([05ba29a](https://github.com/Quenty/NevermoreEngine/commit/05ba29a03efc9f3feed74b34f1d9dfb237496214))
12
+
13
+
14
+ ### Features
15
+
16
+ * Add even more types ([b31717d](https://github.com/Quenty/NevermoreEngine/commit/b31717d8c9f7620c457f5018a2affa760a65334a))
17
+
18
+
19
+
20
+
21
+
6
22
  ## [12.20.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/observablecollection@12.20.2...@quenty/observablecollection@12.20.3) (2025-04-10)
7
23
 
8
24
  **Note:** Version bump only for package @quenty/observablecollection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/observablecollection",
3
- "version": "12.20.3",
3
+ "version": "12.20.4-canary.11a5dcf.0",
4
4
  "description": "A set of observable collections, such as sets, maps, sorted lists, and more.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,24 +27,24 @@
27
27
  "Quenty"
28
28
  ],
29
29
  "dependencies": {
30
- "@quenty/baseobject": "^10.8.3",
31
- "@quenty/brio": "^14.17.3",
32
- "@quenty/ducktype": "^5.8.4",
33
- "@quenty/loader": "^10.8.3",
34
- "@quenty/maid": "^3.4.3",
35
- "@quenty/promise": "^10.10.4",
36
- "@quenty/rx": "^13.17.3",
37
- "@quenty/signal": "^7.10.3",
38
- "@quenty/steputils": "^3.5.5",
39
- "@quenty/symbol": "^3.4.2",
40
- "@quenty/table": "^3.7.4",
41
- "@quenty/valueobject": "^13.17.3"
30
+ "@quenty/baseobject": "10.8.4-canary.11a5dcf.0",
31
+ "@quenty/brio": "14.17.4-canary.11a5dcf.0",
32
+ "@quenty/ducktype": "5.8.5-canary.11a5dcf.0",
33
+ "@quenty/loader": "10.8.4-canary.11a5dcf.0",
34
+ "@quenty/maid": "3.4.4-canary.11a5dcf.0",
35
+ "@quenty/promise": "10.10.5-canary.11a5dcf.0",
36
+ "@quenty/rx": "13.17.4-canary.11a5dcf.0",
37
+ "@quenty/signal": "7.10.4-canary.11a5dcf.0",
38
+ "@quenty/steputils": "3.5.6-canary.11a5dcf.0",
39
+ "@quenty/symbol": "3.4.3-canary.11a5dcf.0",
40
+ "@quenty/table": "3.7.5-canary.11a5dcf.0",
41
+ "@quenty/valueobject": "13.17.4-canary.11a5dcf.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@quenty/blend": "^12.18.3"
44
+ "@quenty/blend": "12.18.4-canary.11a5dcf.0"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "b06c070ae91d5dab7bd8de6e290ad2caabb15d8f"
49
+ "gitHead": "11a5dcf7d4c7a0bfbf3337e97d30e8346ea09d3f"
50
50
  }
@@ -53,17 +53,20 @@ function FilteredObservableListView.new(observableList, observeScoreCallback, co
53
53
  local observeScore = self._observeScoreCallback(entry)
54
54
  assert(Observable.isObservable(observeScore), "Bad observeScore")
55
55
 
56
- maid._add = self._scoredList:Add(entry, Rx.combineLatest({
57
- score = observeScore;
58
- index = self._baseList:ObserveIndexByKey(key);
59
- }):Pipe({
60
- Rx.map(function(state)
61
- if state.score == nil then
62
- return nil
63
- end
64
- return state
65
- end)
66
- }))
56
+ maid._add = self._scoredList:Add(
57
+ entry,
58
+ Rx.combineLatest({
59
+ score = observeScore,
60
+ index = self._baseList:ObserveIndexByKey(key),
61
+ }):Pipe({
62
+ Rx.map(function(state)
63
+ if state.score == nil then
64
+ return nil
65
+ end
66
+ return state
67
+ end),
68
+ })
69
+ )
67
70
  end))
68
71
 
69
72
  return self
@@ -106,4 +109,4 @@ function FilteredObservableListView:ObserveCount()
106
109
  return self._scoredList:ObserveCount()
107
110
  end
108
111
 
109
- return FilteredObservableListView
112
+ return FilteredObservableListView
@@ -6,14 +6,14 @@
6
6
 
7
7
  local require = require(script.Parent.loader).load(script)
8
8
 
9
- local Signal = require("Signal")
10
- local Observable = require("Observable")
11
- local Maid = require("Maid")
12
9
  local Brio = require("Brio")
13
- local ValueObject = require("ValueObject")
14
10
  local DuckTypeUtils = require("DuckTypeUtils")
11
+ local Maid = require("Maid")
12
+ local Observable = require("Observable")
15
13
  local ObservableSubscriptionTable = require("ObservableSubscriptionTable")
16
- local _Set = require("Set")
14
+ local Set = require("Set")
15
+ local Signal = require("Signal")
16
+ local ValueObject = require("ValueObject")
17
17
 
18
18
  local ObservableCountingMap = {}
19
19
  ObservableCountingMap.ClassName = "ObservableCountingMap"
@@ -119,7 +119,7 @@ end
119
119
  Observes the current set of active keys
120
120
  @return Observable<{ [T]: true }>
121
121
  ]=]
122
- function ObservableCountingMap.ObserveKeysSet<T>(self: ObservableCountingMap<T>): Observable.Observable<_Set.Set<T>>
122
+ function ObservableCountingMap.ObserveKeysSet<T>(self: ObservableCountingMap<T>): Observable.Observable<Set.Set<T>>
123
123
  return self:_observeDerivedDataStructureFromKeys(function()
124
124
  local set = {}
125
125
 
@@ -412,4 +412,4 @@ function ObservableCountingMap.Destroy<T>(self: ObservableCountingMap<T>): ()
412
412
  setmetatable(self :: any, nil)
413
413
  end
414
414
 
415
- return ObservableCountingMap
415
+ return ObservableCountingMap
@@ -2,7 +2,8 @@
2
2
  @class ObservableCountingMap.spec.lua
3
3
  ]]
4
4
 
5
- local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
5
+ local require =
6
+ require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
6
7
 
7
8
  local Jest = require("Jest")
8
9
  local ObservableCountingMap = require("ObservableCountingMap")
@@ -38,4 +39,4 @@ describe("ObservableCountingMap.new()", function()
38
39
  it("should clean up", function()
39
40
  observableCountingMap:Destroy()
40
41
  end)
41
- end)
42
+ end)
@@ -7,16 +7,16 @@
7
7
  local require = require(script.Parent.loader).load(script)
8
8
 
9
9
  local Brio = require("Brio")
10
+ local DuckTypeUtils = require("DuckTypeUtils")
11
+ local ListIndexUtils = require("ListIndexUtils")
10
12
  local Maid = require("Maid")
11
13
  local Observable = require("Observable")
12
14
  local ObservableSubscriptionTable = require("ObservableSubscriptionTable")
13
15
  local RxBrioUtils = require("RxBrioUtils")
14
16
  local Signal = require("Signal")
17
+ local SortFunctionUtils = require("SortFunctionUtils")
15
18
  local Symbol = require("Symbol")
16
19
  local ValueObject = require("ValueObject")
17
- local DuckTypeUtils = require("DuckTypeUtils")
18
- local ListIndexUtils = require("ListIndexUtils")
19
- local _SortFunctionUtils = require("SortFunctionUtils")
20
20
 
21
21
  local ObservableList = {}
22
22
  ObservableList.ClassName = "ObservableList"
@@ -28,8 +28,8 @@ export type ObservableList<T> = typeof(setmetatable(
28
28
  _keyList: { Symbol.Symbol },
29
29
  _contents: { [Symbol.Symbol]: T },
30
30
  _indexes: { [Symbol.Symbol]: number },
31
- _indexObservers: any; -- ObservableSubscriptionTable.ObservableSubscriptionTable<T?>,
32
- _keyIndexObservables: any; -- ObservableSubscriptionTable.ObservableSubscriptionTable<number?>,
31
+ _indexObservers: any, -- ObservableSubscriptionTable.ObservableSubscriptionTable<T?>,
32
+ _keyIndexObservables: any, -- ObservableSubscriptionTable.ObservableSubscriptionTable<number?>,
33
33
  _countValue: ValueObject.ValueObject<number>,
34
34
 
35
35
  --[=[
@@ -123,7 +123,7 @@ end
123
123
 
124
124
  @return (T) -> ((T, nextIndex: any) -> ...any, T?)
125
125
  ]=]
126
- function ObservableList.__iter<T>(self: ObservableList<T>): _SortFunctionUtils.WrappedIterator<number, T>
126
+ function ObservableList.__iter<T>(self: ObservableList<T>): SortFunctionUtils.WrappedIterator<number, T>
127
127
  return coroutine.wrap(function()
128
128
  for index, value in self._keyList do
129
129
  coroutine.yield(index, self._contents[value])
@@ -216,8 +216,8 @@ function ObservableList.ObserveAtIndexBrio<T>(
216
216
  assert(type(indexToObserve) == "number", "Bad indexToObserve")
217
217
 
218
218
  return self:ObserveAtIndex(indexToObserve):Pipe({
219
- RxBrioUtils.toBrio(),
220
- RxBrioUtils.onlyLastBrioSurvives(),
219
+ RxBrioUtils.toBrio() :: any,
220
+ RxBrioUtils.onlyLastBrioSurvives() :: any,
221
221
  }) :: any
222
222
  end
223
223
 
@@ -483,4 +483,4 @@ function ObservableList.Destroy<T>(self: ObservableList<T>)
483
483
  setmetatable(self :: any, nil)
484
484
  end
485
485
 
486
- return ObservableList
486
+ return ObservableList
@@ -2,7 +2,8 @@
2
2
  @class ObservableList.spec.lua
3
3
  ]]
4
4
 
5
- local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
5
+ local require =
6
+ require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
6
7
 
7
8
  local Jest = require("Jest")
8
9
  local ObservableList = require("ObservableList")
@@ -131,4 +132,4 @@ describe("ObservableList.new()", function()
131
132
  it("should clean up", function()
132
133
  observableList:Destroy()
133
134
  end)
134
- end)
135
+ end)
@@ -7,14 +7,13 @@
7
7
  local require = require(script.Parent.loader).load(script)
8
8
 
9
9
  local Brio = require("Brio")
10
+ local DuckTypeUtils = require("DuckTypeUtils")
10
11
  local Maid = require("Maid")
11
12
  local Observable = require("Observable")
12
13
  local ObservableSubscriptionTable = require("ObservableSubscriptionTable")
14
+ local RxBrioUtils = require("RxBrioUtils")
13
15
  local Signal = require("Signal")
14
16
  local ValueObject = require("ValueObject")
15
- local RxBrioUtils = require("RxBrioUtils")
16
- local DuckTypeUtils = require("DuckTypeUtils")
17
- local _SortFunctionUtils = require("SortFunctionUtils")
18
17
 
19
18
  local ObservableMap = {}
20
19
  ObservableMap.ClassName = "ObservableMap"
@@ -220,9 +219,9 @@ function ObservableMap.ObserveAtKeyBrio<TKey, TValue>(
220
219
  assert(key ~= nil, "Bad key")
221
220
 
222
221
  return self:ObserveAtKey(key):Pipe({
223
- RxBrioUtils.switchToBrio(function(value)
222
+ RxBrioUtils.switchToBrio(function(value): boolean
224
223
  return value ~= nil
225
- end),
224
+ end) :: any,
226
225
  }) :: any
227
226
  end
228
227
 
@@ -368,4 +367,4 @@ function ObservableMap.Destroy<TKey, TValue>(self: ObservableMap<TKey, TValue>)
368
367
  setmetatable(self :: any, nil)
369
368
  end
370
369
 
371
- return ObservableMap
370
+ return ObservableMap
@@ -2,7 +2,8 @@
2
2
  @class ObservableMap.spec.lua
3
3
  ]]
4
4
 
5
- local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
5
+ local require =
6
+ require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
6
7
 
7
8
  local Jest = require("Jest")
8
9
  local ObservableMap = require("ObservableMap")
@@ -74,4 +75,4 @@ describe("ObservableMap.new()", function()
74
75
  it("should clean up", function()
75
76
  observableMap:Destroy()
76
77
  end)
77
- end)
78
+ end)
@@ -7,14 +7,14 @@
7
7
 
8
8
  local require = require(script.Parent.loader).load(script)
9
9
 
10
+ local Brio = require("Brio")
10
11
  local Maid = require("Maid")
11
12
  local Observable = require("Observable")
12
13
  local ObservableList = require("ObservableList")
13
14
  local ObservableMap = require("ObservableMap")
14
15
  local Rx = require("Rx")
15
16
  local RxBrioUtils = require("RxBrioUtils")
16
- local _Signal = require("Signal")
17
- local _Brio = require("Brio")
17
+ local Signal = require("Signal")
18
18
 
19
19
  local ObservableMapList = {}
20
20
  ObservableMapList.ClassName = "ObservableMapList"
@@ -33,7 +33,7 @@ export type ObservableMapList<TKey, TValue> = typeof(setmetatable(
33
33
  @prop ListAdded Signal<TKey>
34
34
  @within ObservableMapSet
35
35
  ]=]
36
- ListAdded: _Signal.Signal<TKey, ObservableList<TValue>>,
36
+ ListAdded: Signal.Signal<TKey, ObservableList<TValue>>,
37
37
 
38
38
  --[=[
39
39
  Fires when an item is removed
@@ -41,14 +41,14 @@ export type ObservableMapList<TKey, TValue> = typeof(setmetatable(
41
41
  @prop ListRemoved Signal<TKey>
42
42
  @within ObservableMapSet
43
43
  ]=]
44
- ListRemoved: _Signal.Signal<TKey>,
44
+ ListRemoved: Signal.Signal<TKey>,
45
45
 
46
46
  --[=[
47
47
  Fires when the count changes.
48
48
  @prop CountChanged RBXScriptSignal
49
49
  @within ObservableMap
50
50
  ]=]
51
- CountChanged: _Signal.Signal<number>,
51
+ CountChanged: Signal.Signal<number>,
52
52
  },
53
53
  {} :: typeof({ __index = ObservableMapList })
54
54
  ))
@@ -246,7 +246,7 @@ end
246
246
  ]=]
247
247
  function ObservableMapList.ObserveKeysBrio<TKey, TValue>(
248
248
  self: ObservableMapList<TKey, TValue>
249
- ): Observable.Observable<_Brio.Brio<TKey>>
249
+ ): Observable.Observable<Brio.Brio<TKey>>
250
250
  return self._observableMapOfLists:ObserveKeysBrio()
251
251
  end
252
252
 
@@ -261,7 +261,7 @@ function ObservableMapList.ObserveAtListIndexBrio<TKey, TValue>(
261
261
  self: ObservableMapList<TKey, TValue>,
262
262
  key: TKey,
263
263
  index: number
264
- ): Observable.Observable<_Brio.Brio<TValue>>
264
+ ): Observable.Observable<Brio.Brio<TValue>>
265
265
  assert(key ~= nil, "Bad key")
266
266
  assert(type(index) == "number", "Bad index")
267
267
 
@@ -285,7 +285,7 @@ end
285
285
  function ObservableMapList.ObserveItemsForKeyBrio<TKey, TValue>(
286
286
  self: ObservableMapList<TKey, TValue>,
287
287
  key: TKey
288
- ): Observable.Observable<_Brio.Brio<TValue>>
288
+ ): Observable.Observable<Brio.Brio<TValue>>
289
289
  assert(key ~= nil, "Bad key")
290
290
 
291
291
  return self._observableMapOfLists:ObserveAtKeyBrio(key):Pipe({
@@ -372,7 +372,7 @@ end
372
372
  function ObservableMapList.ObserveListBrio<TKey, TValue>(
373
373
  self: ObservableMapList<TKey, TValue>,
374
374
  key: TKey
375
- ): Observable.Observable<_Brio.Brio<ObservableList<TValue>>>
375
+ ): Observable.Observable<Brio.Brio<ObservableList<TValue>>>
376
376
  assert(key ~= nil, "Bad key")
377
377
 
378
378
  return self._observableMapOfLists:ObserveAtKeyBrio(key)
@@ -385,7 +385,7 @@ end
385
385
  ]=]
386
386
  function ObservableMapList.ObserveListsBrio<TKey, TValue>(
387
387
  self: ObservableMapList<TKey, TValue>
388
- ): Observable.Observable<_Brio.Brio<ObservableList<TValue>>>
388
+ ): Observable.Observable<Brio.Brio<ObservableList<TValue>>>
389
389
  return self._observableMapOfLists:ObserveValuesBrio()
390
390
  end
391
391
 
@@ -443,5 +443,4 @@ function ObservableMapList.Destroy<TKey, TValue>(self: ObservableMapList<TKey, T
443
443
  setmetatable(self :: any, nil)
444
444
  end
445
445
 
446
-
447
- return ObservableMapList
446
+ return ObservableMapList
@@ -2,7 +2,8 @@
2
2
  @class ObservableMapList.spec.lua
3
3
  ]]
4
4
 
5
- local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
5
+ local require =
6
+ require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
6
7
 
7
8
  local Jest = require("Jest")
8
9
  local ObservableMapList = require("ObservableMapList")
@@ -24,4 +25,4 @@ describe("ObservableMapList.new()", function()
24
25
  expect(observableMapList:GetAtListIndex("hello", -1)).toEqual("dragon")
25
26
  expect(observableMapList:GetAtListIndex("fire", 1)).toEqual(nil)
26
27
  end)
27
- end)
28
+ end)
@@ -8,15 +8,15 @@
8
8
 
9
9
  local require = require(script.Parent.loader).load(script)
10
10
 
11
+ local Brio = require("Brio")
11
12
  local Maid = require("Maid")
12
13
  local Observable = require("Observable")
13
14
  local ObservableMap = require("ObservableMap")
14
15
  local ObservableSet = require("ObservableSet")
15
16
  local Rx = require("Rx")
16
17
  local RxBrioUtils = require("RxBrioUtils")
17
- local _Brio = require("Brio")
18
- local _Signal = require("Signal")
19
- local _Table = require("Table")
18
+ local Signal = require("Signal")
19
+ local Table = require("Table")
20
20
 
21
21
  local ObservableMapSet = {}
22
22
  ObservableMapSet.ClassName = "ObservableMapSet"
@@ -26,9 +26,9 @@ export type ObservableMapSet<TKey, TValue> = typeof(setmetatable(
26
26
  {} :: {
27
27
  _observableMapOfSets: any, -- ObservableMap.ObservableMap<TKey, ObservableSet.ObservableSet<TValue>>,
28
28
  _maid: Maid.Maid,
29
- SetAdded: _Signal.Signal<TKey>,
30
- SetRemoved: _Signal.Signal<TKey>,
31
- CountChanged: _Signal.Signal<number>,
29
+ SetAdded: Signal.Signal<TKey>,
30
+ SetRemoved: Signal.Signal<TKey>,
31
+ CountChanged: Signal.Signal<number>,
32
32
  },
33
33
  {} :: typeof({ __index = ObservableMapSet })
34
34
  ))
@@ -165,7 +165,7 @@ end
165
165
  Observes all keys in the map
166
166
  @return Observable<Brio<TKey>>
167
167
  ]=]
168
- function ObservableMapSet.ObserveKeysBrio<TKey, TValue>(self: ObservableMapSet<TKey, TValue>): Observable.Observable<_Brio.Brio<TKey>>
168
+ function ObservableMapSet.ObserveKeysBrio<TKey, TValue>(self: ObservableMapSet<TKey, TValue>): Observable.Observable<Brio.Brio<TKey>>
169
169
  return self._observableMapOfSets:ObserveKeysBrio()
170
170
  end
171
171
 
@@ -195,7 +195,7 @@ end
195
195
  function ObservableMapSet.ObserveItemsForKeyBrio<TKey, TValue>(
196
196
  self: ObservableMapSet<TKey, TValue>,
197
197
  key: TKey
198
- ): Observable.Observable<_Brio.Brio<TValue>>
198
+ ): Observable.Observable<Brio.Brio<TValue>>
199
199
  assert(key ~= nil, "Bad key")
200
200
 
201
201
  return self._observableMapOfSets:ObserveAtKeyBrio(key):Pipe({
@@ -230,7 +230,7 @@ end
230
230
  @param key TKey
231
231
  @return { TValue }
232
232
  ]=]
233
- function ObservableMapSet.GetListForKey<TKey, TValue>(self: ObservableMapSet<TKey, TValue>, key: TKey): _Table.Array<TValue>
233
+ function ObservableMapSet.GetListForKey<TKey, TValue>(self: ObservableMapSet<TKey, TValue>, key: TKey): Table.Array<TValue>
234
234
  assert(key ~= nil, "Bad key")
235
235
 
236
236
  local observableSet = self:GetObservableSetForKey(key)
@@ -265,7 +265,7 @@ function ObservableMapSet.ObserveSetBrio<TKey, TValue>(
265
265
  self: ObservableMapSet<TKey, TValue>,
266
266
  key: TKey
267
267
  ): Observable.Observable<
268
- _Brio.Brio<ObservableSet.ObservableSet<TValue>>
268
+ Brio.Brio<ObservableSet.ObservableSet<TValue>>
269
269
  >
270
270
  assert(key ~= nil, "Bad key")
271
271
 
@@ -6,14 +6,14 @@
6
6
 
7
7
  local require = require(script.Parent.loader).load(script)
8
8
 
9
- local Signal = require("Signal")
10
- local Observable = require("Observable")
11
- local Maid = require("Maid")
12
9
  local Brio = require("Brio")
13
- local ValueObject = require("ValueObject")
14
- local ObservableSubscriptionTable = require("ObservableSubscriptionTable")
15
10
  local DuckTypeUtils = require("DuckTypeUtils")
16
- local _Set = require("Set")
11
+ local Maid = require("Maid")
12
+ local Observable = require("Observable")
13
+ local ObservableSubscriptionTable = require("ObservableSubscriptionTable")
14
+ local Set = require("Set")
15
+ local Signal = require("Signal")
16
+ local ValueObject = require("ValueObject")
17
17
 
18
18
  local ObservableSet = {}
19
19
  ObservableSet.ClassName = "ObservableSet"
@@ -22,7 +22,7 @@ ObservableSet.__index = ObservableSet
22
22
  export type ObservableSet<T> = typeof(setmetatable(
23
23
  {} :: {
24
24
  _maid: Maid.Maid,
25
- _set: _Set.Set<T>,
25
+ _set: Set.Set<T>,
26
26
  _containsObservables: any,
27
27
  _countValue: ValueObject.ValueObject<number>,
28
28
  ItemAdded: Signal.Signal<T>,
@@ -85,7 +85,7 @@ end
85
85
 
86
86
  @return (T) -> ((T, nextIndex: any) -> ...any, T?)
87
87
  ]=]
88
- function ObservableSet.__iter<T>(self: ObservableSet<T>): typeof(pairs({} :: _Set.Set<T>))
88
+ function ObservableSet.__iter<T>(self: ObservableSet<T>): typeof(pairs({} :: Set.Set<T>))
89
89
  return pairs(self._set)
90
90
  end
91
91
 
@@ -100,7 +100,7 @@ function ObservableSet.ObserveItemsBrio<T>(self: ObservableSet<T>): Observable.O
100
100
  end
101
101
 
102
102
  local maid = Maid.new()
103
- local brios: _Set.Map<T, Brio.Brio<T>> = {}
103
+ local brios: Set.Map<T, Brio.Brio<T>> = {}
104
104
 
105
105
  local function handleItem(item: T)
106
106
  if brios[item] then
@@ -278,7 +278,7 @@ end
278
278
  Gets a copy of the set
279
279
  @return { [T]: true }
280
280
  ]=]
281
- function ObservableSet.GetSetCopy<T>(self: ObservableSet<T>): _Set.Set<T>
281
+ function ObservableSet.GetSetCopy<T>(self: ObservableSet<T>): Set.Set<T>
282
282
  return table.clone(self._set)
283
283
  end
284
284
 
@@ -286,11 +286,10 @@ end
286
286
  Gets the raw set. Do not modify this set.
287
287
  @return { [T]: true }
288
288
  ]=]
289
- function ObservableSet.GetRawSet<T>(self: ObservableSet<T>): _Set.Set<T>
289
+ function ObservableSet.GetRawSet<T>(self: ObservableSet<T>): Set.Set<T>
290
290
  return self._set
291
291
  end
292
292
 
293
-
294
293
  --[=[
295
294
  Cleans up the ObservableSet and sets the metatable to nil.
296
295
  ]=]
@@ -299,4 +298,4 @@ function ObservableSet.Destroy<T>(self: ObservableSet<T>)
299
298
  setmetatable(self :: any, nil)
300
299
  end
301
300
 
302
- return ObservableSet
301
+ return ObservableSet
@@ -27,9 +27,9 @@ local Observable = require("Observable")
27
27
  local ObservableSubscriptionTable = require("ObservableSubscriptionTable")
28
28
  local Rx = require("Rx")
29
29
  local Signal = require("Signal")
30
+ local SortFunctionUtils = require("SortFunctionUtils")
30
31
  local SortedNode = require("SortedNode")
31
32
  local SortedNodeValue = require("SortedNodeValue")
32
- local SortFunctionUtils = require("SortFunctionUtils")
33
33
  local ValueObject = require("ValueObject")
34
34
 
35
35
  local ObservableSortedList = {}
@@ -64,7 +64,7 @@ export type ObservableSortedList<T> = typeof(setmetatable(
64
64
  @param compare function
65
65
  @return ObservableSortedList<T>
66
66
  ]=]
67
- function ObservableSortedList.new<T>(isReversed: boolean?, compare: CompareFunction<T>): ObservableSortedList<T>
67
+ function ObservableSortedList.new<T>(isReversed: boolean?, compare: CompareFunction<T>?): ObservableSortedList<T>
68
68
  assert(type(isReversed) == "boolean" or isReversed == nil, "Bad isReversed")
69
69
 
70
70
  local self = setmetatable({} :: any, ObservableSortedList)
@@ -672,4 +672,4 @@ function ObservableSortedList.Destroy<T>(self: ObservableSortedList<T>)
672
672
  setmetatable(self :: any, nil)
673
673
  end
674
674
 
675
- return ObservableSortedList
675
+ return ObservableSortedList
@@ -2,7 +2,8 @@
2
2
  @class ObservableSortedList.spec.lua
3
3
  ]]
4
4
 
5
- local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
5
+ local require =
6
+ require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
6
7
 
7
8
  local Jest = require("Jest")
8
9
  local ObservableSortedList = require("ObservableSortedList")
@@ -56,4 +57,4 @@ describe("ObservableSortedList.new()", function()
56
57
  expect(observableSortedList:Get(3)).toEqual("c")
57
58
  expect(observableSortedList:GetCount()).toEqual(3)
58
59
  end)
59
- end)
60
+ end)
@@ -2,14 +2,15 @@
2
2
  @class observableSortedList.story
3
3
  ]]
4
4
 
5
- local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
5
+ local require =
6
+ require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
6
7
 
8
+ local Blend = require("Blend")
7
9
  local Maid = require("Maid")
8
- local ValueObject = require("ValueObject")
9
10
  local ObservableSortedList = require("ObservableSortedList")
10
- local Blend = require("Blend")
11
- local RxBrioUtils = require("RxBrioUtils")
12
11
  local Rx = require("Rx")
12
+ local RxBrioUtils = require("RxBrioUtils")
13
+ local ValueObject = require("ValueObject")
13
14
 
14
15
  local ENTRIES = 10
15
16
  local CHANGE_TO_NEGATIVE_INDEX = false
@@ -22,22 +23,22 @@ return function(target)
22
23
  local random = Random.new(35)
23
24
 
24
25
  local values = {}
25
- for i=1, ENTRIES do
26
+ for i = 1, ENTRIES do
26
27
  local scoreValue = maid:Add(ValueObject.new(0 or random:NextNumber(), "number"))
27
28
 
28
29
  local data = {
29
- originalIndex = i;
30
- scoreValue = scoreValue;
30
+ originalIndex = i,
31
+ scoreValue = scoreValue,
31
32
  }
32
33
 
33
34
  values[i] = data
34
35
 
35
- maid:GiveTask(task.delay(i*0.05, function()
36
+ maid:GiveTask(task.delay(i * 0.05, function()
36
37
  maid:Add(observableSortedList:Add(data, scoreValue:Observe()))
37
38
  end))
38
39
 
39
40
  if CHANGE_TO_NEGATIVE_INDEX then
40
- maid:GiveTask(task.delay(ENTRIES*0.05 + random:NextNumber()*3, function()
41
+ maid:GiveTask(task.delay(ENTRIES * 0.05 + random:NextNumber() * 3, function()
41
42
  -- print("change", scoreValue.Value, " to", -1)
42
43
  scoreValue.Value = -i
43
44
  end))
@@ -71,57 +72,60 @@ return function(target)
71
72
 
72
73
  maid:GiveTask(Blend.mount(target, {
73
74
  Blend.New "Frame" {
74
- Size = UDim2.new(1, 0, 1, 0);
75
- BackgroundTransparency = 1;
75
+ Size = UDim2.new(1, 0, 1, 0),
76
+ BackgroundTransparency = 1,
76
77
 
77
78
  Blend.New "UIListLayout" {
78
- Padding = UDim.new(0, 5);
79
- HorizontalAlignment = Enum.HorizontalAlignment.Center;
80
- VerticalAlignment = Enum.VerticalAlignment.Top;
81
- };
79
+ Padding = UDim.new(0, 5),
80
+ HorizontalAlignment = Enum.HorizontalAlignment.Center,
81
+ VerticalAlignment = Enum.VerticalAlignment.Top,
82
+ },
82
83
 
83
84
  Blend.New "UIPadding" {
84
- PaddingTop = UDim.new(0, 10);
85
- PaddingBottom = UDim.new(0, 10);
86
- };
85
+ PaddingTop = UDim.new(0, 10),
86
+ PaddingBottom = UDim.new(0, 10),
87
+ },
87
88
 
88
89
  observableSortedList:ObserveItemsBrio():Pipe({
89
90
  RxBrioUtils.flatMapBrio(function(data, itemKey)
90
91
  local valid = ValueObject.new(false, "boolean")
91
92
 
92
93
  return Blend.New "Frame" {
93
- Size = UDim2.fromOffset(100, 30);
94
- BackgroundColor3 = Blend.Spring(Blend.Computed(valid, function(isValid)
95
- if isValid then
96
- return Color3.new(1, 1, 1)
97
- else
98
- return Color3.new(1, 0.5, 0.5)
99
- end
100
- end), 5);
101
- LayoutOrder = observableSortedList:ObserveIndexByKey(itemKey);
94
+ Size = UDim2.fromOffset(100, 30),
95
+ BackgroundColor3 = Blend.Spring(
96
+ Blend.Computed(valid, function(isValid)
97
+ if isValid then
98
+ return Color3.new(1, 1, 1)
99
+ else
100
+ return Color3.new(1, 0.5, 0.5)
101
+ end
102
+ end),
103
+ 5
104
+ ),
105
+ LayoutOrder = observableSortedList:ObserveIndexByKey(itemKey),
102
106
 
103
107
  Blend.New "UICorner" {
104
- CornerRadius = UDim.new(0, 5);
105
- };
108
+ CornerRadius = UDim.new(0, 5),
109
+ },
106
110
 
107
111
  Blend.New "TextLabel" {
108
- Name = "Score";
112
+ Name = "Score",
109
113
  Text = data.scoreValue:Observe():Pipe({
110
- Rx.map(tostring)
111
- });
112
- Size = UDim2.fromScale(1, 1);
113
- BackgroundTransparency = 1;
114
- Position = UDim2.new(1, 10, 0.5, 0);
115
- AnchorPoint = Vector2.new(0, 0.5);
116
- TextColor3 = Color3.new(1, 1, 1);
117
- TextXAlignment = Enum.TextXAlignment.Left;
118
- };
114
+ Rx.map(tostring),
115
+ }),
116
+ Size = UDim2.fromScale(1, 1),
117
+ BackgroundTransparency = 1,
118
+ Position = UDim2.new(1, 10, 0.5, 0),
119
+ AnchorPoint = Vector2.new(0, 0.5),
120
+ TextColor3 = Color3.new(1, 1, 1),
121
+ TextXAlignment = Enum.TextXAlignment.Left,
122
+ },
119
123
 
120
124
  Blend.New "TextBox" {
121
- Name = "SetScore";
122
- Size = UDim2.fromScale(1, 1);
123
- Text = tostring(data.scoreValue.Value);
124
- BackgroundTransparency = 1;
125
+ Name = "SetScore",
126
+ Size = UDim2.fromScale(1, 1),
127
+ Text = tostring(data.scoreValue.Value),
128
+ BackgroundTransparency = 1,
125
129
  [Blend.OnChange "Text"] = function(newValue)
126
130
  if tonumber(newValue) then
127
131
  data.scoreValue.Value = tonumber(newValue)
@@ -129,27 +133,26 @@ return function(target)
129
133
  else
130
134
  valid.Value = false
131
135
  end
132
- end;
133
- };
136
+ end,
137
+ },
134
138
 
135
139
  Blend.New "TextLabel" {
136
- Name = "OriginalIndex";
137
- Text = data.originalIndex;
138
- Size = UDim2.fromScale(1, 1);
139
- BackgroundTransparency = 1;
140
- Position = UDim2.new(0, -10, 0.5, 0);
141
- AnchorPoint = Vector2.new(1, 0.5);
142
- TextColor3 = Color3.new(1, 1, 1);
143
- TextXAlignment = Enum.TextXAlignment.Right;
144
- };
140
+ Name = "OriginalIndex",
141
+ Text = data.originalIndex,
142
+ Size = UDim2.fromScale(1, 1),
143
+ BackgroundTransparency = 1,
144
+ Position = UDim2.new(0, -10, 0.5, 0),
145
+ AnchorPoint = Vector2.new(1, 0.5),
146
+ TextColor3 = Color3.new(1, 1, 1),
147
+ TextXAlignment = Enum.TextXAlignment.Right,
148
+ },
145
149
  }
146
- end)
147
- })
148
- }
150
+ end),
151
+ }),
152
+ },
149
153
  }))
150
154
 
151
-
152
155
  return function()
153
156
  maid:DoCleaning()
154
157
  end
155
- end
158
+ end
@@ -2,7 +2,8 @@
2
2
  @class ObservableSortedList.story
3
3
  ]]
4
4
 
5
- local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
5
+ local require =
6
+ require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
6
7
 
7
8
  local Maid = require("Maid")
8
9
  local ObservableSortedList = require("ObservableSortedList")
@@ -27,8 +28,8 @@ return function(_target)
27
28
  -- end
28
29
 
29
30
  local random = Random.new()
30
- for _i=1, 10 do
31
- add(math.floor(100*random:NextNumber()))
31
+ for _i = 1, 10 do
32
+ add(math.floor(100 * random:NextNumber()))
32
33
  end
33
34
 
34
35
  for index, node in observableSortedList._root:IterateNodesRange(3, 7) do
@@ -45,21 +46,21 @@ return function(_target)
45
46
  observableSortedList:Destroy()
46
47
  end)
47
48
 
48
- -- for i=1, 10 do
49
- -- add(-i)
50
- -- add(i)
51
- -- end
49
+ -- for i=1, 10 do
50
+ -- add(-i)
51
+ -- add(i)
52
+ -- end
52
53
 
53
- -- add(2)
54
- -- add(1)
55
- -- add(3)
56
- -- add(4)
57
- -- add(5)
58
- -- add(0)
54
+ -- add(2)
55
+ -- add(1)
56
+ -- add(3)
57
+ -- add(4)
58
+ -- add(5)
59
+ -- add(0)
59
60
 
60
- -- print(observableSortedList:GetList())
61
+ -- print(observableSortedList:GetList())
61
62
 
62
63
  return function()
63
64
  maid:DoCleaning()
64
65
  end
65
- end
66
+ end
@@ -42,7 +42,6 @@ function SortFunctionUtils.default(a: any, b: any): number
42
42
  end
43
43
  end
44
44
 
45
- function SortFunctionUtils.emptyIterator()
46
- end
45
+ function SortFunctionUtils.emptyIterator() end
47
46
 
48
- return SortFunctionUtils
47
+ return SortFunctionUtils
@@ -7,11 +7,11 @@
7
7
 
8
8
  local require = require(script.Parent.loader).load(script)
9
9
 
10
- local ListIndexUtils = require("ListIndexUtils")
11
10
  local DuckTypeUtils = require("DuckTypeUtils")
12
- local Table = require("Table")
11
+ local ListIndexUtils = require("ListIndexUtils")
12
+ local SortFunctionUtils = require("SortFunctionUtils")
13
13
  local SortedNodeValue = require("SortedNodeValue")
14
- local _SortFunctionUtils = require("SortFunctionUtils")
14
+ local Table = require("Table")
15
15
 
16
16
  local DEBUG_ASSERTION_SLOW = false
17
17
 
@@ -60,7 +60,7 @@ function SortedNode.isSortedNode(value: any): boolean
60
60
  return DuckTypeUtils.isImplementation(SortedNode, value)
61
61
  end
62
62
 
63
- function SortedNode.IterateNodes<T>(self: SortedNode<T>): _SortFunctionUtils.WrappedIterator<number, SortedNode<T>>
63
+ function SortedNode.IterateNodes<T>(self: SortedNode<T>): SortFunctionUtils.WrappedIterator<number, SortedNode<T>>
64
64
  return coroutine.wrap(function()
65
65
  local stack: { SortedNode<T> } = {}
66
66
  local current: any? = self
@@ -81,7 +81,7 @@ function SortedNode.IterateNodes<T>(self: SortedNode<T>): _SortFunctionUtils.Wra
81
81
  end) :: any
82
82
  end
83
83
 
84
- function SortedNode.IterateData<T>(self: SortedNode<T>): _SortFunctionUtils.WrappedIterator<number, T>
84
+ function SortedNode.IterateData<T>(self: SortedNode<T>): SortFunctionUtils.WrappedIterator<number, T>
85
85
  return coroutine.wrap(function()
86
86
  local stack: { SortedNode<T> } = {}
87
87
  local current: any = self
@@ -114,7 +114,7 @@ function SortedNode.IterateNodesRange<T>(
114
114
  self: SortedNode<T>,
115
115
  start: number,
116
116
  finish: number?
117
- ): _SortFunctionUtils.WrappedIterator<number, SortedNode<T>>
117
+ ): SortFunctionUtils.WrappedIterator<number, SortedNode<T>>
118
118
  assert(type(start) == "number", "Bad start")
119
119
  assert(type(finish) == "number" or finish == nil, "Bad finish")
120
120
  assert(self.parent == nil, "Should only be called on root")
@@ -1283,4 +1283,4 @@ function SortedNode._assertDescendantCount<T>(self: SortedNode<T>, expected: num
1283
1283
  end
1284
1284
  end
1285
1285
 
1286
- return SortedNode
1286
+ return SortedNode
@@ -61,4 +61,4 @@ function SortedNodeValue.__gt<T>(self: SortedNodeValue<T>, other: SortedNodeValu
61
61
  return self._compare(self._value, other._value) > 0
62
62
  end
63
63
 
64
- return SortedNodeValue
64
+ return SortedNodeValue
@@ -43,4 +43,4 @@ function ListIndexUtils.toNegativeIndex(listLength: number, index: number): numb
43
43
  return -listLength + index - 1
44
44
  end
45
45
 
46
- return ListIndexUtils
46
+ return ListIndexUtils
@@ -8,8 +8,8 @@ local loader = ServerScriptService:FindFirstChild("LoaderUtils", true).Parent
8
8
  local require = require(loader).bootstrapGame(ServerScriptService.observablecollection)
9
9
 
10
10
  local ObservableSortedList = require("ObservableSortedList")
11
- local RxInstanceUtils = require("RxInstanceUtils")
12
11
  local Rx = require("Rx")
12
+ local RxInstanceUtils = require("RxInstanceUtils")
13
13
 
14
14
  local observableSortedList = ObservableSortedList.new()
15
15
 
@@ -37,7 +37,7 @@ observableSortedList:ObserveItemsBrio():Subscribe(function(brio)
37
37
  else
38
38
  local tweenInfo = TweenInfo.new(0.2)
39
39
  local tween = TweenService:Create(part, tweenInfo, {
40
- CFrame = cframe;
40
+ CFrame = cframe,
41
41
  })
42
42
  currentTween = tween
43
43
  tween:Play()
@@ -51,24 +51,24 @@ observableSortedList:ObserveItemsBrio():Subscribe(function(brio)
51
51
 
52
52
  if index then
53
53
  part:SetAttribute("CurrentIndex", index)
54
- setCFrame(CFrame.new(-5*index, 5, 0) * CFrame.Angles(0, math.pi/2, 0), first)
54
+ setCFrame(CFrame.new(-5 * index, 5, 0) * CFrame.Angles(0, math.pi / 2, 0), first)
55
55
  first = false
56
56
  else
57
57
  part:SetAttribute("CurrentIndex", "nil")
58
- setCFrame(CFrame.new(part.CFrame.x, 10, 0) * CFrame.Angles(0, math.pi/2, 0), first)
58
+ setCFrame(CFrame.new(part.CFrame.x, 10, 0) * CFrame.Angles(0, math.pi / 2, 0), first)
59
59
  first = false
60
60
  end
61
61
  end))
62
62
 
63
63
  maid:GiveTask(function()
64
64
  part:SetAttribute("CurrentIndex", "nil")
65
- setCFrame(CFrame.new(part.CFrame.x, 5, 5) * CFrame.Angles(0, math.pi/2, 0), first)
65
+ setCFrame(CFrame.new(part.CFrame.x, 5, 5) * CFrame.Angles(0, math.pi / 2, 0), first)
66
66
  first = false
67
67
  end)
68
68
  end)
69
69
 
70
70
  local parts = {}
71
- for i=9, 1, -1 do
71
+ for i = 9, 1, -1 do
72
72
  local part = Instance.new("Part")
73
73
  part.TopSurface = Enum.SurfaceType.Smooth
74
74
  part.BottomSurface = Enum.SurfaceType.Smooth
@@ -99,14 +99,16 @@ for i=9, 1, -1 do
99
99
  parts[i] = part
100
100
  part.Parent = workspace
101
101
 
102
- observableSortedList:Add(part, RxInstanceUtils.observeProperty(part, "Name", nil):Pipe({
103
- Rx.map(function(name)
104
- return tonumber(name)
105
- end)
106
- }))
102
+ observableSortedList:Add(
103
+ part,
104
+ RxInstanceUtils.observeProperty(part, "Name", nil):Pipe({
105
+ Rx.map(function(name)
106
+ return tonumber(name)
107
+ end),
108
+ })
109
+ )
107
110
  end
108
111
 
109
112
  parts[5].Name = "25"
110
113
  parts[9].Name = "3.1"
111
114
  parts[2].Name = "remove"
112
-