@quenty/binder 14.36.0 → 14.37.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,20 @@
|
|
|
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.37.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/binder@14.36.1...@quenty/binder@14.37.0) (2026-07-14)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **lint:** resolve selene unused-self and Rx shadowing from --!strict conversions ([3f4a085](https://github.com/Quenty/NevermoreEngine/commit/3f4a085911808146f10a2435efbe9e89dff8edff))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **binder:** convert package to --!strict ([78f42c2](https://github.com/Quenty/NevermoreEngine/commit/78f42c2265f2ef9313db146220cb15e87baf6747))
|
|
15
|
+
|
|
16
|
+
## [14.36.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/binder@14.36.0...@quenty/binder@14.36.1) (2026-05-30)
|
|
17
|
+
|
|
18
|
+
**Note:** Version bump only for package @quenty/binder
|
|
19
|
+
|
|
6
20
|
# [14.36.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/binder@14.35.0...@quenty/binder@14.36.0) (2026-05-29)
|
|
7
21
|
|
|
8
22
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/binder",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.37.0",
|
|
4
4
|
"description": "Utility object to Bind a class to Roblox object, and associated helper methods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -29,23 +29,23 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@quenty/baseobject": "10.13.0",
|
|
32
|
-
"@quenty/brio": "14.30.
|
|
33
|
-
"@quenty/canceltoken": "11.19.
|
|
34
|
-
"@quenty/instanceutils": "13.30.
|
|
35
|
-
"@quenty/linkutils": "13.
|
|
32
|
+
"@quenty/brio": "14.30.1",
|
|
33
|
+
"@quenty/canceltoken": "11.19.1",
|
|
34
|
+
"@quenty/instanceutils": "13.30.1",
|
|
35
|
+
"@quenty/linkutils": "13.31.0",
|
|
36
36
|
"@quenty/loader": "10.11.0",
|
|
37
37
|
"@quenty/maid": "3.9.0",
|
|
38
38
|
"@quenty/nevermore-test-runner": "1.4.0",
|
|
39
|
-
"@quenty/promise": "10.18.
|
|
40
|
-
"@quenty/rx": "13.28.
|
|
41
|
-
"@quenty/servicebag": "11.18.
|
|
42
|
-
"@quenty/signal": "7.13.
|
|
39
|
+
"@quenty/promise": "10.18.1",
|
|
40
|
+
"@quenty/rx": "13.28.3",
|
|
41
|
+
"@quenty/servicebag": "11.18.1",
|
|
42
|
+
"@quenty/signal": "7.13.1",
|
|
43
43
|
"@quenty/table": "3.9.2",
|
|
44
|
-
"@quenty/valueobject": "13.31.
|
|
44
|
+
"@quenty/valueobject": "13.31.1",
|
|
45
45
|
"@quentystudios/jest-lua": "3.10.0-quenty.2"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "13f0162f4971a77378e55e9b7236aea94f0dd3a8"
|
|
51
51
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Provides a basis for binderGroups that can be retrieved anywhere
|
|
4
4
|
@class BinderGroupProvider
|
|
@@ -13,13 +13,23 @@ BinderGroupProvider.ClassName = "BinderGroupProvider"
|
|
|
13
13
|
BinderGroupProvider.ServiceName = "BinderGroupProvider"
|
|
14
14
|
BinderGroupProvider.__index = BinderGroupProvider
|
|
15
15
|
|
|
16
|
+
export type BinderGroupProvider = typeof(setmetatable(
|
|
17
|
+
{} :: {
|
|
18
|
+
_initMethod: (BinderGroupProvider, ...any) -> (),
|
|
19
|
+
_groupsAddedPromise: Promise.Promise<()>,
|
|
20
|
+
_init: boolean,
|
|
21
|
+
_binderGroups: { any },
|
|
22
|
+
},
|
|
23
|
+
{} :: typeof({ __index = BinderGroupProvider })
|
|
24
|
+
))
|
|
25
|
+
|
|
16
26
|
--[=[
|
|
17
27
|
Constructs a new BinderGroupProvider
|
|
18
28
|
@param initMethod (BinderGroupProvider) -> ()
|
|
19
29
|
@return BinderGroupProvider
|
|
20
30
|
]=]
|
|
21
|
-
function BinderGroupProvider.new(initMethod)
|
|
22
|
-
local self = setmetatable({}, BinderGroupProvider)
|
|
31
|
+
function BinderGroupProvider.new(initMethod: (BinderGroupProvider, ...any) -> ()): BinderGroupProvider
|
|
32
|
+
local self: BinderGroupProvider = setmetatable({} :: any, BinderGroupProvider)
|
|
23
33
|
|
|
24
34
|
self._initMethod = initMethod or error("No initMethod")
|
|
25
35
|
self._groupsAddedPromise = Promise.new()
|
|
@@ -34,7 +44,7 @@ end
|
|
|
34
44
|
Returns a promise that will resolve once groups are added.
|
|
35
45
|
@return Promise
|
|
36
46
|
]=]
|
|
37
|
-
function BinderGroupProvider
|
|
47
|
+
function BinderGroupProvider.PromiseGroupsAdded(self: BinderGroupProvider): Promise.Promise<()>
|
|
38
48
|
return self._groupsAddedPromise
|
|
39
49
|
end
|
|
40
50
|
|
|
@@ -42,7 +52,7 @@ end
|
|
|
42
52
|
Starts the binder provider. Should be called via ServiceBag.
|
|
43
53
|
@param ... ServiceBag | any
|
|
44
54
|
]=]
|
|
45
|
-
function BinderGroupProvider
|
|
55
|
+
function BinderGroupProvider.Init(self: BinderGroupProvider, ...: any): ()
|
|
46
56
|
assert(not self._init, "Already initialized")
|
|
47
57
|
|
|
48
58
|
self._initMethod(self, ...)
|
|
@@ -54,11 +64,11 @@ end
|
|
|
54
64
|
--[=[
|
|
55
65
|
Starts the binder provider. Should be called via ServiceBag.
|
|
56
66
|
]=]
|
|
57
|
-
function BinderGroupProvider
|
|
67
|
+
function BinderGroupProvider.Start(_self: BinderGroupProvider): ()
|
|
58
68
|
-- Do nothing
|
|
59
69
|
end
|
|
60
70
|
|
|
61
|
-
|
|
71
|
+
(BinderGroupProvider :: any).__index = function(_self, index)
|
|
62
72
|
if BinderGroupProvider[index] then
|
|
63
73
|
return BinderGroupProvider[index]
|
|
64
74
|
end
|
|
@@ -72,9 +82,9 @@ end
|
|
|
72
82
|
@param groupName string
|
|
73
83
|
@return BinderGroup?
|
|
74
84
|
]=]
|
|
75
|
-
function BinderGroupProvider
|
|
85
|
+
function BinderGroupProvider.Get(self: BinderGroupProvider, groupName: string): any
|
|
76
86
|
assert(type(groupName) == "string", "Bad groupName")
|
|
77
|
-
return rawget(self, groupName)
|
|
87
|
+
return rawget(self :: any, groupName)
|
|
78
88
|
end
|
|
79
89
|
|
|
80
90
|
--[=[
|
|
@@ -83,17 +93,17 @@ end
|
|
|
83
93
|
@param groupName string
|
|
84
94
|
@param binderGroup BinderGroup
|
|
85
95
|
]=]
|
|
86
|
-
function BinderGroupProvider
|
|
96
|
+
function BinderGroupProvider.Add(self: BinderGroupProvider, groupName: string, binderGroup: any): ()
|
|
87
97
|
assert(type(groupName) == "string", "Bad groupName")
|
|
88
98
|
assert(type(binderGroup) == "table", "Bad binderGroup")
|
|
89
99
|
assert(not self._init, "Already initialized")
|
|
90
100
|
assert(not self:Get(groupName), "Duplicate groupName")
|
|
91
101
|
|
|
92
|
-
table.insert(self._binderGroups, binderGroup)
|
|
93
|
-
self[groupName] = binderGroup
|
|
102
|
+
table.insert(self._binderGroups, binderGroup);
|
|
103
|
+
(self :: any)[groupName] = binderGroup
|
|
94
104
|
end
|
|
95
105
|
|
|
96
|
-
function BinderGroupProvider
|
|
106
|
+
function BinderGroupProvider.Destroy(_self: BinderGroupProvider): ()
|
|
97
107
|
-- Do nothing
|
|
98
108
|
end
|
|
99
109
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Provides a basis for binders that can be retrieved anywhere
|
|
4
4
|
@class BinderProvider
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
|
+
local Binder = require("Binder")
|
|
9
10
|
local Maid = require("Maid")
|
|
10
11
|
local Promise = require("Promise")
|
|
11
12
|
|
|
@@ -14,6 +15,21 @@ BinderProvider.ClassName = "BinderProvider"
|
|
|
14
15
|
BinderProvider.ServiceName = "BinderProvider"
|
|
15
16
|
BinderProvider.__index = BinderProvider
|
|
16
17
|
|
|
18
|
+
export type BinderProvider = typeof(setmetatable(
|
|
19
|
+
{} :: {
|
|
20
|
+
ServiceName: string,
|
|
21
|
+
_initMethod: (self: BinderProvider, ...any) -> (),
|
|
22
|
+
_initialized: boolean,
|
|
23
|
+
_destroyed: boolean,
|
|
24
|
+
_started: boolean,
|
|
25
|
+
_maid: Maid.Maid,
|
|
26
|
+
_binders: { any },
|
|
27
|
+
_bindersAddedPromise: Promise.Promise<()>,
|
|
28
|
+
_startPromise: Promise.Promise<()>,
|
|
29
|
+
},
|
|
30
|
+
{} :: typeof({ __index = BinderProvider })
|
|
31
|
+
))
|
|
32
|
+
|
|
17
33
|
--[=[
|
|
18
34
|
Constructs a new BinderProvider.
|
|
19
35
|
|
|
@@ -43,8 +59,8 @@ BinderProvider.__index = BinderProvider
|
|
|
43
59
|
@param initMethod (self, serviceBag: ServiceBag)
|
|
44
60
|
@return BinderProvider
|
|
45
61
|
]=]
|
|
46
|
-
function BinderProvider.new(serviceName: string, initMethod)
|
|
47
|
-
local self = setmetatable({}, BinderProvider)
|
|
62
|
+
function BinderProvider.new(serviceName: string, initMethod: ((self: BinderProvider, ...any) -> ())?): BinderProvider
|
|
63
|
+
local self: BinderProvider = setmetatable({} :: any, BinderProvider)
|
|
48
64
|
|
|
49
65
|
if type(serviceName) == "string" then
|
|
50
66
|
self.ServiceName = serviceName
|
|
@@ -83,7 +99,7 @@ end
|
|
|
83
99
|
@param binderName string
|
|
84
100
|
@return Promise<Binder<T>>
|
|
85
101
|
]=]
|
|
86
|
-
function BinderProvider
|
|
102
|
+
function BinderProvider.PromiseBinder(self: BinderProvider, binderName: string): Promise.Promise<Binder.Binder<any>>
|
|
87
103
|
if self._bindersAddedPromise:IsFulfilled() then
|
|
88
104
|
local binder = self:Get(binderName)
|
|
89
105
|
if binder then
|
|
@@ -100,7 +116,7 @@ function BinderProvider:PromiseBinder(binderName)
|
|
|
100
116
|
else
|
|
101
117
|
return Promise.rejected()
|
|
102
118
|
end
|
|
103
|
-
end)
|
|
119
|
+
end) :: any
|
|
104
120
|
end
|
|
105
121
|
|
|
106
122
|
--[=[
|
|
@@ -108,7 +124,7 @@ end
|
|
|
108
124
|
|
|
109
125
|
@param ... ServiceBag | any
|
|
110
126
|
]=]
|
|
111
|
-
function BinderProvider
|
|
127
|
+
function BinderProvider.Init(self: BinderProvider, ...: any): ()
|
|
112
128
|
assert(not self._initialized, "Already initialized")
|
|
113
129
|
|
|
114
130
|
self._maid = Maid.new()
|
|
@@ -134,7 +150,7 @@ end
|
|
|
134
150
|
|
|
135
151
|
@return Promise
|
|
136
152
|
]=]
|
|
137
|
-
function BinderProvider
|
|
153
|
+
function BinderProvider.PromiseBindersAdded(self: BinderProvider): Promise.Promise<()>
|
|
138
154
|
return assert(self._bindersAddedPromise, "Be sure to require via serviceBag")
|
|
139
155
|
end
|
|
140
156
|
|
|
@@ -143,14 +159,14 @@ end
|
|
|
143
159
|
|
|
144
160
|
@return Promise
|
|
145
161
|
]=]
|
|
146
|
-
function BinderProvider
|
|
162
|
+
function BinderProvider.PromiseBindersStarted(self: BinderProvider): Promise.Promise<()>
|
|
147
163
|
return assert(self._startPromise, "Be sure to require via serviceBag")
|
|
148
164
|
end
|
|
149
165
|
|
|
150
166
|
--[=[
|
|
151
167
|
Starts all of the binders.
|
|
152
168
|
]=]
|
|
153
|
-
function BinderProvider
|
|
169
|
+
function BinderProvider.Start(self: BinderProvider): ()
|
|
154
170
|
assert(self._initialized, "Not initialized")
|
|
155
171
|
assert(not self._started, "Already started")
|
|
156
172
|
|
|
@@ -161,8 +177,7 @@ function BinderProvider:Start()
|
|
|
161
177
|
|
|
162
178
|
self._startPromise:Resolve()
|
|
163
179
|
end
|
|
164
|
-
|
|
165
|
-
function BinderProvider:__index(index)
|
|
180
|
+
(BinderProvider :: any).__index = function(self, index)
|
|
166
181
|
if BinderProvider[index] then
|
|
167
182
|
return BinderProvider[index]
|
|
168
183
|
end
|
|
@@ -180,9 +195,9 @@ end
|
|
|
180
195
|
@param tagName string
|
|
181
196
|
@return Binder<T>?
|
|
182
197
|
]=]
|
|
183
|
-
function BinderProvider
|
|
198
|
+
function BinderProvider.Get(self: BinderProvider, tagName: string): Binder.Binder<any>?
|
|
184
199
|
assert(type(tagName) == "string", "Bad tagName")
|
|
185
|
-
return rawget(self, tagName)
|
|
200
|
+
return rawget(self :: any, tagName)
|
|
186
201
|
end
|
|
187
202
|
|
|
188
203
|
--[=[
|
|
@@ -190,30 +205,30 @@ end
|
|
|
190
205
|
|
|
191
206
|
@param binder Binder<T>
|
|
192
207
|
]=]
|
|
193
|
-
function BinderProvider
|
|
208
|
+
function BinderProvider.Add(self: BinderProvider, binder: Binder.Binder<any>): ()
|
|
194
209
|
assert(not self._started, "Already inited")
|
|
195
210
|
assert(not self:Get(binder:GetTag()), "Binder already exists")
|
|
196
211
|
|
|
197
212
|
self._maid:GiveTask(binder)
|
|
198
213
|
|
|
199
|
-
table.insert(self._binders, binder)
|
|
200
|
-
self[binder:GetTag()] = binder
|
|
214
|
+
table.insert(self._binders, binder);
|
|
215
|
+
(self :: any)[binder:GetTag()] = binder
|
|
201
216
|
end
|
|
202
217
|
|
|
203
|
-
function BinderProvider
|
|
218
|
+
function BinderProvider.Destroy(self: BinderProvider): ()
|
|
204
219
|
self._destroyed = true
|
|
205
220
|
|
|
206
|
-
local binders = rawget(self, "_binders")
|
|
207
|
-
rawset(self, "_binders", nil)
|
|
221
|
+
local binders = rawget(self :: any, "_binders")
|
|
222
|
+
rawset(self :: any, "_binders", nil)
|
|
208
223
|
|
|
209
224
|
if binders then
|
|
210
225
|
for _, item in binders do
|
|
211
|
-
rawset(self, item:GetTag(), nil)
|
|
226
|
+
rawset(self :: any, item:GetTag(), nil)
|
|
212
227
|
end
|
|
213
228
|
end
|
|
214
229
|
|
|
215
|
-
local maid = rawget(self, "_maid")
|
|
216
|
-
rawset(self, "_maid", nil)
|
|
230
|
+
local maid = rawget(self :: any, "_maid")
|
|
231
|
+
rawset(self :: any, "_maid", nil)
|
|
217
232
|
|
|
218
233
|
if maid then
|
|
219
234
|
maid:DoCleaning()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Tracks a parent bound to a specific binder
|
|
4
4
|
@class BoundAncestorTracker
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
9
|
local BaseObject = require("BaseObject")
|
|
10
|
+
local Binder = require("Binder")
|
|
10
11
|
local BinderUtils = require("BinderUtils")
|
|
11
12
|
local ValueObject = require("ValueObject")
|
|
12
13
|
|
|
@@ -14,6 +15,17 @@ local BoundAncestorTracker = setmetatable({}, BaseObject)
|
|
|
14
15
|
BoundAncestorTracker.ClassName = "BoundAncestorTracker"
|
|
15
16
|
BoundAncestorTracker.__index = BoundAncestorTracker
|
|
16
17
|
|
|
18
|
+
export type BoundAncestorTracker<T> =
|
|
19
|
+
typeof(setmetatable(
|
|
20
|
+
{} :: {
|
|
21
|
+
_child: Instance,
|
|
22
|
+
_binder: Binder.Binder<T>,
|
|
23
|
+
Class: ValueObject.ValueObject<T?>,
|
|
24
|
+
},
|
|
25
|
+
{} :: typeof({ __index = BoundAncestorTracker })
|
|
26
|
+
))
|
|
27
|
+
& BaseObject.BaseObject
|
|
28
|
+
|
|
17
29
|
--[=[
|
|
18
30
|
Constructs a new BoundAncestorTracker
|
|
19
31
|
|
|
@@ -21,8 +33,8 @@ Constructs a new BoundAncestorTracker
|
|
|
21
33
|
@param child Instance
|
|
22
34
|
@return BoundAncestorTracker
|
|
23
35
|
]=]
|
|
24
|
-
function BoundAncestorTracker.new(binder
|
|
25
|
-
local self = setmetatable(BaseObject.new(), BoundAncestorTracker)
|
|
36
|
+
function BoundAncestorTracker.new<T>(binder: Binder.Binder<T>, child: Instance): BoundAncestorTracker<T>
|
|
37
|
+
local self: BoundAncestorTracker<T> = setmetatable(BaseObject.new() :: any, BoundAncestorTracker)
|
|
26
38
|
|
|
27
39
|
self._child = child or error("No child")
|
|
28
40
|
self._binder = binder or error("No binder")
|
|
@@ -33,7 +45,7 @@ function BoundAncestorTracker.new(binder, child)
|
|
|
33
45
|
@within BoundAncestorTracker
|
|
34
46
|
Bound value
|
|
35
47
|
]=]
|
|
36
|
-
self.Class = ValueObject.new()
|
|
48
|
+
self.Class = ValueObject.new() :: ValueObject.ValueObject<T?>
|
|
37
49
|
self._maid:GiveTask(self.Class)
|
|
38
50
|
|
|
39
51
|
-- Handle instance removing
|
|
@@ -58,7 +70,7 @@ function BoundAncestorTracker.new(binder, child)
|
|
|
58
70
|
return self
|
|
59
71
|
end
|
|
60
72
|
|
|
61
|
-
function BoundAncestorTracker
|
|
73
|
+
function BoundAncestorTracker._update<T>(self: BoundAncestorTracker<T>): ()
|
|
62
74
|
local parent = self._child.Parent
|
|
63
75
|
if not parent then
|
|
64
76
|
self.Class.Value = nil
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Tracks a parent bound to a specific binder
|
|
4
4
|
@class BoundParentTracker
|
|
@@ -7,20 +7,32 @@
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
9
|
local BaseObject = require("BaseObject")
|
|
10
|
+
local Binder = require("Binder")
|
|
10
11
|
local ValueObject = require("ValueObject")
|
|
11
12
|
|
|
12
13
|
local BoundParentTracker = setmetatable({}, BaseObject)
|
|
13
14
|
BoundParentTracker.ClassName = "BoundParentTracker"
|
|
14
15
|
BoundParentTracker.__index = BoundParentTracker
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
export type BoundParentTracker<T> =
|
|
18
|
+
typeof(setmetatable(
|
|
19
|
+
{} :: {
|
|
20
|
+
_child: Instance,
|
|
21
|
+
_binder: Binder.Binder<T>,
|
|
22
|
+
Class: ValueObject.ValueObject<T?>,
|
|
23
|
+
},
|
|
24
|
+
{} :: typeof({ __index = BoundParentTracker })
|
|
25
|
+
))
|
|
26
|
+
& BaseObject.BaseObject
|
|
27
|
+
|
|
28
|
+
function BoundParentTracker.new<T>(binder: Binder.Binder<T>, child: Instance): BoundParentTracker<T>
|
|
29
|
+
local self: BoundParentTracker<T> = setmetatable(BaseObject.new() :: any, BoundParentTracker)
|
|
18
30
|
|
|
19
31
|
self._child = child or error("No child")
|
|
20
32
|
self._binder = binder or error("No binder")
|
|
21
33
|
|
|
22
34
|
-- Bound value
|
|
23
|
-
self.Class = ValueObject.new()
|
|
35
|
+
self.Class = ValueObject.new(nil :: T?)
|
|
24
36
|
self._maid:GiveTask(self.Class)
|
|
25
37
|
|
|
26
38
|
-- Handle instance removing
|
|
@@ -39,7 +51,7 @@ function BoundParentTracker.new(binder, child)
|
|
|
39
51
|
return self
|
|
40
52
|
end
|
|
41
53
|
|
|
42
|
-
function BoundParentTracker
|
|
54
|
+
function BoundParentTracker._update<T>(self: BoundParentTracker<T>): ()
|
|
43
55
|
local parent = self._child.Parent
|
|
44
56
|
if not parent then
|
|
45
57
|
self.Class.Value = nil
|