@quenty/boundlinkutils 14.37.0 → 14.38.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,16 @@
|
|
|
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
|
+
# [14.38.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/boundlinkutils@14.37.1...@quenty/boundlinkutils@14.38.0) (2026-07-14)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **boundlinkutils:** convert package to --!strict ([6cd3e7f](https://github.com/Quenty/NevermoreEngine/commit/6cd3e7f518ffb74c0ba5266bee786b91f879a99d))
|
|
11
|
+
|
|
12
|
+
## [14.37.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/boundlinkutils@14.37.0...@quenty/boundlinkutils@14.37.1) (2026-05-30)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @quenty/boundlinkutils
|
|
15
|
+
|
|
6
16
|
# [14.37.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/boundlinkutils@14.36.0...@quenty/boundlinkutils@14.37.0) (2026-05-29)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @quenty/boundlinkutils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/boundlinkutils",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.38.0",
|
|
4
4
|
"description": "Utility functions involving binders and links",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"Quenty"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@quenty/binder": "14.
|
|
32
|
-
"@quenty/linkutils": "13.
|
|
31
|
+
"@quenty/binder": "14.37.0",
|
|
32
|
+
"@quenty/linkutils": "13.31.0",
|
|
33
33
|
"@quenty/loader": "10.11.0",
|
|
34
34
|
"@quenty/maid": "3.9.0",
|
|
35
|
-
"@quenty/promise": "10.18.
|
|
36
|
-
"@quenty/signal": "7.13.
|
|
35
|
+
"@quenty/promise": "10.18.1",
|
|
36
|
+
"@quenty/signal": "7.13.1"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "13f0162f4971a77378e55e9b7236aea94f0dd3a8"
|
|
42
42
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Handles searching for bound objects following links (object values) under a parent
|
|
4
4
|
with a specific name.
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
local require = require(script.Parent.loader).load(script)
|
|
10
10
|
|
|
11
|
+
local Binder = require("Binder")
|
|
11
12
|
local Maid = require("Maid")
|
|
12
13
|
local Signal = require("Signal")
|
|
13
14
|
|
|
@@ -15,8 +16,23 @@ local BoundLinkCollection = {}
|
|
|
15
16
|
BoundLinkCollection.ClassName = "BoundLinkCollection"
|
|
16
17
|
BoundLinkCollection.__index = BoundLinkCollection
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
export type BoundLinkCollection = typeof(setmetatable(
|
|
20
|
+
{} :: {
|
|
21
|
+
_maid: Maid.Maid,
|
|
22
|
+
_linkName: string,
|
|
23
|
+
_binder: Binder.Binder<any>,
|
|
24
|
+
ClassAdded: Signal.Signal<any>,
|
|
25
|
+
ClassRemoved: Signal.Signal<any>,
|
|
26
|
+
_classes: { [any]: boolean },
|
|
27
|
+
_canidates: { [Instance]: { [Instance]: boolean } },
|
|
28
|
+
_linkCanidate: { [Instance]: Instance },
|
|
29
|
+
_linkValues: { [Instance]: boolean },
|
|
30
|
+
},
|
|
31
|
+
{} :: typeof({ __index = BoundLinkCollection })
|
|
32
|
+
))
|
|
33
|
+
|
|
34
|
+
function BoundLinkCollection.new(binder: Binder.Binder<any>, linkName: string, parent: Instance): BoundLinkCollection
|
|
35
|
+
local self: BoundLinkCollection = setmetatable({} :: any, BoundLinkCollection)
|
|
20
36
|
|
|
21
37
|
self._maid = Maid.new()
|
|
22
38
|
|
|
@@ -43,7 +59,7 @@ function BoundLinkCollection.new(binder, linkName, parent)
|
|
|
43
59
|
return self
|
|
44
60
|
end
|
|
45
61
|
|
|
46
|
-
function BoundLinkCollection
|
|
62
|
+
function BoundLinkCollection.GetClasses(self: BoundLinkCollection): { any }
|
|
47
63
|
local list = {}
|
|
48
64
|
for class, _ in self._classes do
|
|
49
65
|
table.insert(list, class)
|
|
@@ -51,11 +67,11 @@ function BoundLinkCollection:GetClasses()
|
|
|
51
67
|
return list
|
|
52
68
|
end
|
|
53
69
|
|
|
54
|
-
function BoundLinkCollection
|
|
70
|
+
function BoundLinkCollection.HasClass(self: BoundLinkCollection, class: any): boolean
|
|
55
71
|
return self._classes[class] ~= nil
|
|
56
72
|
end
|
|
57
73
|
|
|
58
|
-
function BoundLinkCollection
|
|
74
|
+
function BoundLinkCollection.TrackParent(self: BoundLinkCollection, parent: Instance): ()
|
|
59
75
|
assert(parent, "Bad parent")
|
|
60
76
|
|
|
61
77
|
self._maid:GiveTask(parent.ChildAdded:Connect(function(child)
|
|
@@ -75,11 +91,11 @@ function BoundLinkCollection:TrackParent(parent: Instance)
|
|
|
75
91
|
end
|
|
76
92
|
end
|
|
77
93
|
|
|
78
|
-
function BoundLinkCollection
|
|
94
|
+
function BoundLinkCollection._removeLink(self: BoundLinkCollection, objValue: Instance): ()
|
|
79
95
|
self._maid[objValue] = nil
|
|
80
96
|
end
|
|
81
97
|
|
|
82
|
-
function BoundLinkCollection
|
|
98
|
+
function BoundLinkCollection._handleNewLink(self: BoundLinkCollection, objValue: ObjectValue): ()
|
|
83
99
|
local maid = Maid.new()
|
|
84
100
|
|
|
85
101
|
maid:GiveTask(objValue.Changed:Connect(function()
|
|
@@ -95,7 +111,7 @@ function BoundLinkCollection:_handleNewLink(objValue)
|
|
|
95
111
|
self:_handleLinkChanged(objValue)
|
|
96
112
|
end
|
|
97
113
|
|
|
98
|
-
function BoundLinkCollection
|
|
114
|
+
function BoundLinkCollection._handleLinkChanged(self: BoundLinkCollection, objValue: ObjectValue): ()
|
|
99
115
|
self:_removeLinkCanidates(objValue)
|
|
100
116
|
|
|
101
117
|
if objValue.Value then
|
|
@@ -103,7 +119,7 @@ function BoundLinkCollection:_handleLinkChanged(objValue)
|
|
|
103
119
|
end
|
|
104
120
|
end
|
|
105
121
|
|
|
106
|
-
function BoundLinkCollection
|
|
122
|
+
function BoundLinkCollection._removeLinkCanidates(self: BoundLinkCollection, objValue: Instance): ()
|
|
107
123
|
local canidate = self._linkCanidate[objValue]
|
|
108
124
|
if not canidate then
|
|
109
125
|
return
|
|
@@ -113,7 +129,6 @@ function BoundLinkCollection:_removeLinkCanidates(objValue)
|
|
|
113
129
|
|
|
114
130
|
if not self._canidates[canidate] then
|
|
115
131
|
error("[BoundLinkCollection] - Got link canidate that isn''t real. This shouldn't happen.")
|
|
116
|
-
return
|
|
117
132
|
end
|
|
118
133
|
|
|
119
134
|
local canidateLinks = self._canidates[canidate]
|
|
@@ -124,7 +139,7 @@ function BoundLinkCollection:_removeLinkCanidates(objValue)
|
|
|
124
139
|
end
|
|
125
140
|
end
|
|
126
141
|
|
|
127
|
-
function BoundLinkCollection
|
|
142
|
+
function BoundLinkCollection._removeCanidate(self: BoundLinkCollection, canidate: Instance): ()
|
|
128
143
|
self._canidates[canidate] = nil
|
|
129
144
|
|
|
130
145
|
local class = self._binder:Get(canidate)
|
|
@@ -135,7 +150,7 @@ function BoundLinkCollection:_removeCanidate(canidate)
|
|
|
135
150
|
self:_removeClass(class)
|
|
136
151
|
end
|
|
137
152
|
|
|
138
|
-
function BoundLinkCollection
|
|
153
|
+
function BoundLinkCollection._addCanidate(self: BoundLinkCollection, objValue: Instance, canidate: Instance): ()
|
|
139
154
|
assert(not self._linkCanidate[objValue], "Should not have existing canidate set for link")
|
|
140
155
|
|
|
141
156
|
self._linkCanidate[objValue] = canidate
|
|
@@ -152,7 +167,7 @@ function BoundLinkCollection:_addCanidate(objValue, canidate)
|
|
|
152
167
|
self:_addClass(class)
|
|
153
168
|
end
|
|
154
169
|
|
|
155
|
-
function BoundLinkCollection
|
|
170
|
+
function BoundLinkCollection._removeClass(self: BoundLinkCollection, class: any): ()
|
|
156
171
|
if not self._classes[class] then
|
|
157
172
|
return
|
|
158
173
|
end
|
|
@@ -161,7 +176,7 @@ function BoundLinkCollection:_removeClass(class)
|
|
|
161
176
|
self.ClassRemoved:Fire(class)
|
|
162
177
|
end
|
|
163
178
|
|
|
164
|
-
function BoundLinkCollection
|
|
179
|
+
function BoundLinkCollection._addClass(self: BoundLinkCollection, class: any): ()
|
|
165
180
|
if self._classes[class] then
|
|
166
181
|
return
|
|
167
182
|
end
|
|
@@ -170,7 +185,7 @@ function BoundLinkCollection:_addClass(class)
|
|
|
170
185
|
self.ClassAdded:Fire(class)
|
|
171
186
|
end
|
|
172
187
|
|
|
173
|
-
function BoundLinkCollection
|
|
188
|
+
function BoundLinkCollection._handleNewClassBound(self: BoundLinkCollection, class: any, inst: Instance): ()
|
|
174
189
|
if not self._canidates[inst] then
|
|
175
190
|
return
|
|
176
191
|
end
|
|
@@ -178,9 +193,9 @@ function BoundLinkCollection:_handleNewClassBound(class, inst)
|
|
|
178
193
|
self:_addClass(class)
|
|
179
194
|
end
|
|
180
195
|
|
|
181
|
-
function BoundLinkCollection
|
|
196
|
+
function BoundLinkCollection.Destroy(self: BoundLinkCollection): ()
|
|
182
197
|
self._maid:Destroy()
|
|
183
|
-
setmetatable(self, nil)
|
|
198
|
+
setmetatable(self :: any, nil)
|
|
184
199
|
end
|
|
185
200
|
|
|
186
201
|
return BoundLinkCollection
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Utility functions involving binders and links. It's a common pattern to link
|
|
4
4
|
back to a bound class. This allows you to quickly retrieve these objects.
|
|
@@ -10,6 +10,7 @@ local require = require(script.Parent.loader).load(script)
|
|
|
10
10
|
|
|
11
11
|
local CollectionService = game:GetService("CollectionService")
|
|
12
12
|
|
|
13
|
+
local Binder = require("Binder")
|
|
13
14
|
local BinderUtils = require("BinderUtils")
|
|
14
15
|
local LinkUtils = require("LinkUtils")
|
|
15
16
|
|
|
@@ -23,7 +24,7 @@ local BoundLinkUtils = {}
|
|
|
23
24
|
@param from Instance
|
|
24
25
|
@return T?
|
|
25
26
|
]=]
|
|
26
|
-
function BoundLinkUtils.getLinkClass(binder
|
|
27
|
+
function BoundLinkUtils.getLinkClass<T>(binder: Binder.Binder<T>, linkName: string, from: Instance): T?
|
|
27
28
|
assert(type(binder) == "table", "Bad binder")
|
|
28
29
|
assert(type(linkName) == "string", "Bad linkName")
|
|
29
30
|
assert(typeof(from) == "Instance", "Bad froM")
|
|
@@ -44,12 +45,12 @@ end
|
|
|
44
45
|
@param from Instance
|
|
45
46
|
@return { T }
|
|
46
47
|
]=]
|
|
47
|
-
function BoundLinkUtils.getLinkClasses(binder
|
|
48
|
+
function BoundLinkUtils.getLinkClasses<T>(binder: Binder.Binder<T>, linkName: string, from: Instance): { T }
|
|
48
49
|
assert(type(binder) == "table", "Bad binder")
|
|
49
50
|
assert(type(linkName) == "string", "Bad linkName")
|
|
50
51
|
assert(typeof(from) == "Instance", "Bad from")
|
|
51
52
|
|
|
52
|
-
local classes = {}
|
|
53
|
+
local classes: { T } = {}
|
|
53
54
|
for _, value in LinkUtils.getAllLinkValues(linkName, from) do
|
|
54
55
|
local class = binder:Get(value)
|
|
55
56
|
if class then
|
|
@@ -67,7 +68,7 @@ end
|
|
|
67
68
|
@param from Instance
|
|
68
69
|
@return { T }
|
|
69
70
|
]=]
|
|
70
|
-
function BoundLinkUtils.getClassesForLinkValues(binders, linkName, from)
|
|
71
|
+
function BoundLinkUtils.getClassesForLinkValues<T>(binders: { Binder.Binder<T> }, linkName: string, from: Instance): { T }
|
|
71
72
|
assert(type(binders) == "table", "Bad binders")
|
|
72
73
|
assert(type(linkName) == "string", "Bad linkName")
|
|
73
74
|
assert(typeof(from) == "Instance", "Bad from")
|
|
@@ -77,7 +78,7 @@ function BoundLinkUtils.getClassesForLinkValues(binders, linkName, from)
|
|
|
77
78
|
end
|
|
78
79
|
|
|
79
80
|
local tags = BinderUtils.mapBinderListToTable(binders)
|
|
80
|
-
local classes = {}
|
|
81
|
+
local classes: { T } = {}
|
|
81
82
|
|
|
82
83
|
for _, instance in LinkUtils.getAllLinkValues(linkName, from) do
|
|
83
84
|
for _, tag in CollectionService:GetTags(instance) do
|
|
@@ -103,7 +104,13 @@ end
|
|
|
103
104
|
@param methodName string
|
|
104
105
|
@param args {}
|
|
105
106
|
]=]
|
|
106
|
-
function BoundLinkUtils.callMethodOnLinkedClasses(
|
|
107
|
+
function BoundLinkUtils.callMethodOnLinkedClasses(
|
|
108
|
+
binders: { Binder.Binder<any> },
|
|
109
|
+
linkName: string,
|
|
110
|
+
from: Instance,
|
|
111
|
+
methodName: string,
|
|
112
|
+
args: { any }
|
|
113
|
+
)
|
|
107
114
|
assert(type(binders) == "table", "Bad arg 'binders'")
|
|
108
115
|
assert(type(linkName) == "string", "Bad arg 'linkName'")
|
|
109
116
|
assert(typeof(from) == "Instance", "Bad arg 'from'")
|
|
@@ -116,9 +123,9 @@ function BoundLinkUtils.callMethodOnLinkedClasses(binders, linkName, from, metho
|
|
|
116
123
|
|
|
117
124
|
local tags = BinderUtils.mapBinderListToTable(binders)
|
|
118
125
|
|
|
119
|
-
local called = {}
|
|
126
|
+
local called: { [any]: boolean } = {}
|
|
120
127
|
|
|
121
|
-
local function callForTag(value, tag)
|
|
128
|
+
local function callForTag(value: Instance, tag: string)
|
|
122
129
|
local binder = tags[tag]
|
|
123
130
|
if not binder then
|
|
124
131
|
return
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Promise that returns an objectValue's value that has a bound
|
|
4
4
|
value to it.
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
local require = require(script.Parent.loader).load(script)
|
|
10
10
|
|
|
11
|
+
local Binder = require("Binder")
|
|
11
12
|
local Maid = require("Maid")
|
|
12
13
|
local Promise = require("Promise")
|
|
13
14
|
|
|
14
|
-
return function(binder
|
|
15
|
+
return function<T>(binder: Binder.Binder<T>, objValue: ObjectValue): Promise.Promise<T>
|
|
15
16
|
if objValue.Value then
|
|
16
17
|
local class = binder:Get(objValue.Value)
|
|
17
18
|
if class then
|
|
@@ -20,12 +21,15 @@ return function(binder, objValue)
|
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
local maid = Maid.new()
|
|
23
|
-
local promise = Promise.new()
|
|
24
|
+
local promise: Promise.Promise<T> = Promise.new() :: any
|
|
24
25
|
|
|
25
26
|
maid:GiveTask(objValue.Changed:Connect(function()
|
|
26
|
-
local
|
|
27
|
-
if
|
|
28
|
-
|
|
27
|
+
local value = objValue.Value
|
|
28
|
+
if value then
|
|
29
|
+
local class = binder:Get(value)
|
|
30
|
+
if class then
|
|
31
|
+
promise:Resolve(class)
|
|
32
|
+
end
|
|
29
33
|
end
|
|
30
34
|
end))
|
|
31
35
|
|