@quenty/observablecollection 9.0.0 → 9.0.1-canary.445.bf8e4c3.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,18 @@
|
|
|
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
|
+
## [9.0.1-canary.445.bf8e4c3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/observablecollection@9.0.0...@quenty/observablecollection@9.0.1-canary.445.bf8e4c3.0) (2024-02-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Fix bootstrap of test environments and loader samples ([441e4a9](https://github.com/Quenty/NevermoreEngine/commit/441e4a90d19fcc203da2fdedc08e532c20d52f99))
|
|
12
|
+
* Fix sorting errors ([43ac468](https://github.com/Quenty/NevermoreEngine/commit/43ac468dd49147011c04e9d61e08573fb543423c))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
# [9.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/observablecollection@8.0.0...@quenty/observablecollection@9.0.0) (2024-02-13)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @quenty/observablecollection
|
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2014-
|
|
3
|
+
Copyright (c) 2014-2024 James Onnen (Quenty)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/observablecollection",
|
|
3
|
-
"version": "9.0.0",
|
|
3
|
+
"version": "9.0.1-canary.445.bf8e4c3.0",
|
|
4
4
|
"description": "A set of observable collections, such as sets, maps, sorted lists, and more.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,23 +27,23 @@
|
|
|
27
27
|
"Quenty"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@quenty/baseobject": "
|
|
31
|
-
"@quenty/brio": "
|
|
32
|
-
"@quenty/ducktype": "
|
|
33
|
-
"@quenty/loader": "
|
|
34
|
-
"@quenty/maid": "
|
|
35
|
-
"@quenty/promise": "
|
|
36
|
-
"@quenty/rx": "
|
|
37
|
-
"@quenty/signal": "
|
|
38
|
-
"@quenty/steputils": "
|
|
39
|
-
"@quenty/symbol": "
|
|
40
|
-
"@quenty/valueobject": "
|
|
30
|
+
"@quenty/baseobject": "8.0.1-canary.445.bf8e4c3.0",
|
|
31
|
+
"@quenty/brio": "12.0.1-canary.445.bf8e4c3.0",
|
|
32
|
+
"@quenty/ducktype": "3.0.1-canary.445.bf8e4c3.0",
|
|
33
|
+
"@quenty/loader": "8.0.1-canary.445.bf8e4c3.0",
|
|
34
|
+
"@quenty/maid": "3.0.0",
|
|
35
|
+
"@quenty/promise": "8.0.1-canary.445.bf8e4c3.0",
|
|
36
|
+
"@quenty/rx": "11.0.1-canary.445.bf8e4c3.0",
|
|
37
|
+
"@quenty/signal": "5.0.1-canary.445.bf8e4c3.0",
|
|
38
|
+
"@quenty/steputils": "3.3.0",
|
|
39
|
+
"@quenty/symbol": "3.0.0",
|
|
40
|
+
"@quenty/valueobject": "11.0.1-canary.445.bf8e4c3.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@quenty/blend": "
|
|
43
|
+
"@quenty/blend": "10.0.1-canary.445.bf8e4c3.0"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "bf8e4c3cbff3de4e4c7ffbfc768c1f7ae2ff9e42"
|
|
49
49
|
}
|
|
@@ -15,7 +15,14 @@ FilteredObservableListView.__index = FilteredObservableListView
|
|
|
15
15
|
|
|
16
16
|
-- Higher numbers last
|
|
17
17
|
local function defaultCompare(a, b)
|
|
18
|
-
return a
|
|
18
|
+
-- equivalent of `return a - b` except it supports comparison of strings and stuff
|
|
19
|
+
if b > a then
|
|
20
|
+
return -1
|
|
21
|
+
elseif b < a then
|
|
22
|
+
return 1
|
|
23
|
+
else
|
|
24
|
+
return 0
|
|
25
|
+
end
|
|
19
26
|
end
|
|
20
27
|
|
|
21
28
|
function FilteredObservableListView.new(observableList, observeScoreCallback, compare)
|
|
@@ -25,15 +32,14 @@ function FilteredObservableListView.new(observableList, observeScoreCallback, co
|
|
|
25
32
|
self._baseList = assert(observableList, "No observableList")
|
|
26
33
|
self._observeScoreCallback = assert(observeScoreCallback, "No observeScoreCallback")
|
|
27
34
|
|
|
28
|
-
self._scoredList = ObservableSortedList.new(false, function(a, b)
|
|
35
|
+
self._scoredList = self._maid:Add(ObservableSortedList.new(false, function(a, b)
|
|
29
36
|
-- Preserve index when scoring does not
|
|
30
37
|
if a.score == b.score then
|
|
31
38
|
return a.index - b.index
|
|
32
39
|
else
|
|
33
40
|
return self._compare(a.score, b.score)
|
|
34
41
|
end
|
|
35
|
-
end)
|
|
36
|
-
self._maid:GiveTask(self._scoredList)
|
|
42
|
+
end))
|
|
37
43
|
|
|
38
44
|
-- Shockingly this is somewhat performant because the sorted list defers all events
|
|
39
45
|
-- to process the list reordering.
|
|
@@ -58,8 +64,6 @@ function FilteredObservableListView.new(observableList, observeScoreCallback, co
|
|
|
58
64
|
return state
|
|
59
65
|
end)
|
|
60
66
|
}))
|
|
61
|
-
|
|
62
|
-
|
|
63
67
|
end))
|
|
64
68
|
|
|
65
69
|
return self
|
|
@@ -632,7 +632,9 @@ function ObservableSortedList:_highBinarySearch(sortValue)
|
|
|
632
632
|
while true do
|
|
633
633
|
local mid = math.floor((minIndex + maxIndex) / 2)
|
|
634
634
|
local compareValue = self._compare(self._sortValue[self._keyList[mid]], sortValue)
|
|
635
|
-
|
|
635
|
+
if type(compareValue) ~= "number" then
|
|
636
|
+
error(string.format("Bad compareValue, expected number, got %q", type(compareValue)))
|
|
637
|
+
end
|
|
636
638
|
|
|
637
639
|
if self._isReversed then
|
|
638
640
|
compareValue = -compareValue
|
|
@@ -5,11 +5,11 @@ local ServerScriptService = game:GetService("ServerScriptService")
|
|
|
5
5
|
local TweenService = game:GetService("TweenService")
|
|
6
6
|
|
|
7
7
|
local loader = ServerScriptService:FindFirstChild("LoaderUtils", true).Parent
|
|
8
|
-
local
|
|
8
|
+
local require = require(loader).bootstrapGame(ServerScriptService.observablecollection)
|
|
9
9
|
|
|
10
|
-
local ObservableSortedList = require(
|
|
11
|
-
local RxInstanceUtils = require(
|
|
12
|
-
local Rx = require(
|
|
10
|
+
local ObservableSortedList = require("ObservableSortedList")
|
|
11
|
+
local RxInstanceUtils = require("RxInstanceUtils")
|
|
12
|
+
local Rx = require("Rx")
|
|
13
13
|
|
|
14
14
|
local observableSortedList = ObservableSortedList.new()
|
|
15
15
|
|