@quenty/highlight 10.21.3 → 10.21.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 +16 -0
- package/package.json +18 -18
- package/src/Client/AnimatedHighlight.lua +7 -7
- package/src/Client/AnimatedHighlight.story.lua +4 -3
- package/src/Client/AnimatedHighlightGroup.lua +15 -6
- package/src/Client/AnimatedHighlightGroup.story.lua +4 -3
- package/src/Client/HighlightServiceClient.lua +4 -3
- package/src/Client/Stack/AnimatedHighlightModel.lua +34 -16
- package/src/Client/Stack/AnimatedHighlightStack.lua +85 -50
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
|
+
## [10.21.4-canary.11a5dcf.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/highlight@10.21.3...@quenty/highlight@10.21.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
|
## [10.21.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/highlight@10.21.2...@quenty/highlight@10.21.3) (2025-04-10)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @quenty/highlight
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/highlight",
|
|
3
|
-
"version": "10.21.
|
|
3
|
+
"version": "10.21.4-canary.11a5dcf.0",
|
|
4
4
|
"description": "Animated highlight system for the Roblox highlight object",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,25 +26,25 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/baseobject": "
|
|
30
|
-
"@quenty/basicpane": "
|
|
31
|
-
"@quenty/blend": "
|
|
32
|
-
"@quenty/ducktype": "
|
|
33
|
-
"@quenty/enumutils": "
|
|
34
|
-
"@quenty/instanceutils": "
|
|
35
|
-
"@quenty/loader": "
|
|
36
|
-
"@quenty/maid": "
|
|
37
|
-
"@quenty/math": "
|
|
38
|
-
"@quenty/observablecollection": "
|
|
39
|
-
"@quenty/rx": "
|
|
40
|
-
"@quenty/selectionutils": "
|
|
41
|
-
"@quenty/signal": "
|
|
42
|
-
"@quenty/statestack": "
|
|
43
|
-
"@quenty/table": "
|
|
44
|
-
"@quenty/valueobject": "
|
|
29
|
+
"@quenty/baseobject": "10.8.4-canary.11a5dcf.0",
|
|
30
|
+
"@quenty/basicpane": "13.17.4-canary.11a5dcf.0",
|
|
31
|
+
"@quenty/blend": "12.18.4-canary.11a5dcf.0",
|
|
32
|
+
"@quenty/ducktype": "5.8.5-canary.11a5dcf.0",
|
|
33
|
+
"@quenty/enumutils": "3.4.2",
|
|
34
|
+
"@quenty/instanceutils": "13.17.4-canary.11a5dcf.0",
|
|
35
|
+
"@quenty/loader": "10.8.4-canary.11a5dcf.0",
|
|
36
|
+
"@quenty/maid": "3.4.4-canary.11a5dcf.0",
|
|
37
|
+
"@quenty/math": "2.7.3",
|
|
38
|
+
"@quenty/observablecollection": "12.20.4-canary.11a5dcf.0",
|
|
39
|
+
"@quenty/rx": "13.17.4-canary.11a5dcf.0",
|
|
40
|
+
"@quenty/selectionutils": "8.17.4-canary.11a5dcf.0",
|
|
41
|
+
"@quenty/signal": "7.10.4-canary.11a5dcf.0",
|
|
42
|
+
"@quenty/statestack": "14.18.4-canary.11a5dcf.0",
|
|
43
|
+
"@quenty/table": "3.7.5-canary.11a5dcf.0",
|
|
44
|
+
"@quenty/valueobject": "13.17.4-canary.11a5dcf.0"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "11a5dcf7d4c7a0bfbf3337e97d30e8346ea09d3f"
|
|
50
50
|
}
|
|
@@ -8,14 +8,14 @@ local require = require(script.Parent.loader).load(script)
|
|
|
8
8
|
|
|
9
9
|
local BasicPane = require("BasicPane")
|
|
10
10
|
local Blend = require("Blend")
|
|
11
|
-
local
|
|
12
|
-
local Math = require("Math")
|
|
13
|
-
local ValueObject = require("ValueObject")
|
|
11
|
+
local DuckTypeUtils = require("DuckTypeUtils")
|
|
14
12
|
local EnumUtils = require("EnumUtils")
|
|
15
13
|
local Maid = require("Maid")
|
|
14
|
+
local Math = require("Math")
|
|
15
|
+
local Observable = require("Observable")
|
|
16
16
|
local Signal = require("Signal")
|
|
17
|
-
local
|
|
18
|
-
local
|
|
17
|
+
local SpringObject = require("SpringObject")
|
|
18
|
+
local ValueObject = require("ValueObject")
|
|
19
19
|
|
|
20
20
|
local AnimatedHighlight = setmetatable({}, BasicPane)
|
|
21
21
|
AnimatedHighlight.ClassName = "AnimatedHighlight"
|
|
@@ -253,7 +253,7 @@ function AnimatedHighlight.SetFillTransparency(
|
|
|
253
253
|
end
|
|
254
254
|
end
|
|
255
255
|
|
|
256
|
-
function AnimatedHighlight._render(self: AnimatedHighlight):
|
|
256
|
+
function AnimatedHighlight._render(self: AnimatedHighlight): Observable.Observable<Highlight>
|
|
257
257
|
return Blend.New("Highlight")({
|
|
258
258
|
Name = "AnimatedHighlight",
|
|
259
259
|
Archivable = false,
|
|
@@ -279,4 +279,4 @@ function AnimatedHighlight._render(self: AnimatedHighlight): _Observable.Observa
|
|
|
279
279
|
}) :: any
|
|
280
280
|
end
|
|
281
281
|
|
|
282
|
-
return AnimatedHighlight
|
|
282
|
+
return AnimatedHighlight
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
@class AnimatedHighlight.story
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
|
-
local Maid = require("Maid")
|
|
8
8
|
local AnimatedHighlight = require("AnimatedHighlight")
|
|
9
|
+
local Maid = require("Maid")
|
|
9
10
|
local RxSelectionUtils = require("RxSelectionUtils")
|
|
10
11
|
|
|
11
12
|
return function(_target)
|
|
@@ -35,4 +36,4 @@ return function(_target)
|
|
|
35
36
|
return function()
|
|
36
37
|
maid:DoCleaning()
|
|
37
38
|
end
|
|
38
|
-
end
|
|
39
|
+
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
@client
|
|
3
4
|
@class AnimatedHighlightGroup
|
|
@@ -5,19 +6,27 @@
|
|
|
5
6
|
|
|
6
7
|
local require = require(script.Parent.loader).load(script)
|
|
7
8
|
|
|
8
|
-
local
|
|
9
|
+
local AnimatedHighlightModel = require("AnimatedHighlightModel")
|
|
9
10
|
local AnimatedHighlightStack = require("AnimatedHighlightStack")
|
|
10
|
-
local
|
|
11
|
+
local BaseObject = require("BaseObject")
|
|
11
12
|
local EnumUtils = require("EnumUtils")
|
|
12
|
-
local
|
|
13
|
+
local Maid = require("Maid")
|
|
13
14
|
local Rx = require("Rx")
|
|
14
15
|
|
|
15
16
|
local AnimatedHighlightGroup = setmetatable({}, BaseObject)
|
|
16
17
|
AnimatedHighlightGroup.ClassName = "AnimatedHighlightGroup"
|
|
17
18
|
AnimatedHighlightGroup.__index = AnimatedHighlightGroup
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
export type AnimatedHighlightGroup = typeof(setmetatable(
|
|
21
|
+
{} :: {
|
|
22
|
+
_defaultValues: AnimatedHighlightModel.AnimatedHighlightModel,
|
|
23
|
+
_highlightStacks: { [Instance]: AnimatedHighlightStack.AnimatedHighlightStack },
|
|
24
|
+
},
|
|
25
|
+
{} :: typeof({ __index = AnimatedHighlightGroup })
|
|
26
|
+
)) & BaseObject.BaseObject
|
|
27
|
+
|
|
28
|
+
function AnimatedHighlightGroup.new(): AnimatedHighlightGroup
|
|
29
|
+
local self: AnimatedHighlightGroup = setmetatable(BaseObject.new() :: any, AnimatedHighlightGroup)
|
|
21
30
|
|
|
22
31
|
self._defaultValues = self._maid:Add(AnimatedHighlightModel.new())
|
|
23
32
|
self._defaultValues:SetHighlightDepthMode(Enum.HighlightDepthMode.AlwaysOnTop)
|
|
@@ -185,4 +194,4 @@ function AnimatedHighlightGroup:_findHighlightAdornee(adornee)
|
|
|
185
194
|
return self._highlightStacks[adornee]
|
|
186
195
|
end
|
|
187
196
|
|
|
188
|
-
return AnimatedHighlightGroup
|
|
197
|
+
return AnimatedHighlightGroup
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
@class AnimatedHighlight.story
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
|
-
local Maid = require("Maid")
|
|
8
8
|
local AnimatedHighlightGroup = require("AnimatedHighlightGroup")
|
|
9
|
+
local Maid = require("Maid")
|
|
9
10
|
local RxSelectionUtils = require("RxSelectionUtils")
|
|
10
11
|
|
|
11
12
|
return function(_target)
|
|
@@ -38,4 +39,4 @@ return function(_target)
|
|
|
38
39
|
return function()
|
|
39
40
|
maid:DoCleaning()
|
|
40
41
|
end
|
|
41
|
-
end
|
|
42
|
+
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
Centralized group
|
|
3
4
|
@client
|
|
@@ -8,7 +9,7 @@ local require = require(script.Parent.loader).load(script)
|
|
|
8
9
|
|
|
9
10
|
local AnimatedHighlightGroup = require("AnimatedHighlightGroup")
|
|
10
11
|
local Maid = require("Maid")
|
|
11
|
-
local
|
|
12
|
+
local ServiceBag = require("ServiceBag")
|
|
12
13
|
|
|
13
14
|
local HighlightServiceClient = {}
|
|
14
15
|
HighlightServiceClient.ServiceName = "HighlightServiceClient"
|
|
@@ -18,7 +19,7 @@ HighlightServiceClient.ServiceName = "HighlightServiceClient"
|
|
|
18
19
|
|
|
19
20
|
@param serviceBag ServiceBag
|
|
20
21
|
]=]
|
|
21
|
-
function HighlightServiceClient:Init(serviceBag:
|
|
22
|
+
function HighlightServiceClient:Init(serviceBag: ServiceBag.ServiceBag)
|
|
22
23
|
assert(not self._serviceBag, "Already initialized")
|
|
23
24
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
24
25
|
self._maid = Maid.new()
|
|
@@ -56,4 +57,4 @@ function HighlightServiceClient:Destroy()
|
|
|
56
57
|
self._maid:DoCleaning()
|
|
57
58
|
end
|
|
58
59
|
|
|
59
|
-
return HighlightServiceClient
|
|
60
|
+
return HighlightServiceClient
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
@class AnimatedHighlightModel
|
|
3
4
|
]=]
|
|
@@ -5,15 +6,31 @@
|
|
|
5
6
|
local require = require(script.Parent.loader).load(script)
|
|
6
7
|
|
|
7
8
|
local BaseObject = require("BaseObject")
|
|
8
|
-
local
|
|
9
|
+
local DuckTypeUtils = require("DuckTypeUtils")
|
|
9
10
|
local EnumUtils = require("EnumUtils")
|
|
10
11
|
local Signal = require("Signal")
|
|
11
|
-
local
|
|
12
|
+
local ValueObject = require("ValueObject")
|
|
12
13
|
|
|
13
14
|
local AnimatedHighlightModel = setmetatable({}, BaseObject)
|
|
14
15
|
AnimatedHighlightModel.ClassName = "AnimatedHighlightModel"
|
|
15
16
|
AnimatedHighlightModel.__index = AnimatedHighlightModel
|
|
16
17
|
|
|
18
|
+
export type AnimatedHighlightModel = typeof(setmetatable(
|
|
19
|
+
{} :: {
|
|
20
|
+
HighlightDepthMode: ValueObject.ValueObject<Enum.HighlightDepthMode?>,
|
|
21
|
+
FillColor: ValueObject.ValueObject<Color3?>,
|
|
22
|
+
OutlineColor: ValueObject.ValueObject<Color3?>,
|
|
23
|
+
FillTransparency: ValueObject.ValueObject<number?>,
|
|
24
|
+
OutlineTransparency: ValueObject.ValueObject<number?>,
|
|
25
|
+
Speed: ValueObject.ValueObject<number?>,
|
|
26
|
+
ColorSpeed: ValueObject.ValueObject<number?>,
|
|
27
|
+
TransparencySpeed: ValueObject.ValueObject<number?>,
|
|
28
|
+
FillSpeed: ValueObject.ValueObject<number?>,
|
|
29
|
+
Destroying: Signal.Signal<()>,
|
|
30
|
+
},
|
|
31
|
+
{} :: typeof({ __index = AnimatedHighlightModel })
|
|
32
|
+
)) & BaseObject.BaseObject
|
|
33
|
+
|
|
17
34
|
--[=[
|
|
18
35
|
Constructs a new data model for an animated highlight. Probably retrieve via an
|
|
19
36
|
[AnimatedHighlightStack] or more likely an [AnimatedHighlightGroup] or even the
|
|
@@ -21,8 +38,8 @@ AnimatedHighlightModel.__index = AnimatedHighlightModel
|
|
|
21
38
|
|
|
22
39
|
@return AnimatedHighlightModel
|
|
23
40
|
]=]
|
|
24
|
-
function AnimatedHighlightModel.new()
|
|
25
|
-
local self = setmetatable(BaseObject.new(), AnimatedHighlightModel)
|
|
41
|
+
function AnimatedHighlightModel.new(): AnimatedHighlightModel
|
|
42
|
+
local self: AnimatedHighlightModel = setmetatable(BaseObject.new() :: any, AnimatedHighlightModel)
|
|
26
43
|
|
|
27
44
|
self.HighlightDepthMode = self._maid:Add(ValueObject.new(nil))
|
|
28
45
|
self.FillColor = self._maid:Add(ValueObject.new(nil))
|
|
@@ -54,10 +71,12 @@ function AnimatedHighlightModel.isAnimatedHighlightModel(value: any): boolean
|
|
|
54
71
|
end
|
|
55
72
|
|
|
56
73
|
--[=[
|
|
74
|
+
Sets the highlight depth mode
|
|
75
|
+
|
|
57
76
|
@param depthMode HighlightDepthMode
|
|
58
77
|
]=]
|
|
59
|
-
function AnimatedHighlightModel:SetHighlightDepthMode(depthMode: Enum.HighlightDepthMode?)
|
|
60
|
-
assert(EnumUtils.isOfType(Enum.HighlightDepthMode, depthMode)
|
|
78
|
+
function AnimatedHighlightModel:SetHighlightDepthMode(depthMode: Enum.HighlightDepthMode?): ()
|
|
79
|
+
assert(depthMode == nil or EnumUtils.isOfType(Enum.HighlightDepthMode, depthMode), "Bad depthMode")
|
|
61
80
|
|
|
62
81
|
self.HighlightDepthMode.Value = depthMode
|
|
63
82
|
end
|
|
@@ -67,7 +86,7 @@ end
|
|
|
67
86
|
|
|
68
87
|
@param speed number?
|
|
69
88
|
]=]
|
|
70
|
-
function AnimatedHighlightModel:SetTransparencySpeed(speed: number?)
|
|
89
|
+
function AnimatedHighlightModel:SetTransparencySpeed(speed: number?): ()
|
|
71
90
|
assert(type(speed) == "number" or speed == nil, "Bad speed")
|
|
72
91
|
|
|
73
92
|
self.TransparencySpeed:SetValue(speed)
|
|
@@ -78,7 +97,7 @@ end
|
|
|
78
97
|
|
|
79
98
|
@param speed number?
|
|
80
99
|
]=]
|
|
81
|
-
function AnimatedHighlightModel:SetColorSpeed(speed: number?)
|
|
100
|
+
function AnimatedHighlightModel:SetColorSpeed(speed: number?): ()
|
|
82
101
|
assert(type(speed) == "number" or speed == nil, "Bad speed")
|
|
83
102
|
|
|
84
103
|
self.ColorSpeed:SetValue(speed)
|
|
@@ -89,7 +108,7 @@ end
|
|
|
89
108
|
|
|
90
109
|
@param speed number?
|
|
91
110
|
]=]
|
|
92
|
-
function AnimatedHighlightModel:SetSpeed(speed: number?)
|
|
111
|
+
function AnimatedHighlightModel:SetSpeed(speed: number?): ()
|
|
93
112
|
assert(type(speed) == "number" or speed == nil, "Bad speed")
|
|
94
113
|
|
|
95
114
|
self.Speed:SetValue(speed)
|
|
@@ -101,7 +120,7 @@ end
|
|
|
101
120
|
@param color Color3?
|
|
102
121
|
@param doNotAnimate boolean?
|
|
103
122
|
]=]
|
|
104
|
-
function AnimatedHighlightModel:SetFillColor(color: Color3?, doNotAnimate: boolean?)
|
|
123
|
+
function AnimatedHighlightModel:SetFillColor(color: Color3?, doNotAnimate: boolean?): ()
|
|
105
124
|
assert(typeof(color) == "Color3" or color == nil, "Bad color")
|
|
106
125
|
|
|
107
126
|
self.FillColor:SetValue(color, doNotAnimate)
|
|
@@ -122,7 +141,7 @@ end
|
|
|
122
141
|
@param color Color3?
|
|
123
142
|
@param doNotAnimate boolean?
|
|
124
143
|
]=]
|
|
125
|
-
function AnimatedHighlightModel:SetOutlineColor(color: Color3?, doNotAnimate: boolean?)
|
|
144
|
+
function AnimatedHighlightModel:SetOutlineColor(color: Color3?, doNotAnimate: boolean?): ()
|
|
126
145
|
assert(typeof(color) == "Color3" or color == nil, "Bad color")
|
|
127
146
|
|
|
128
147
|
self.OutlineColor:SetValue(color, doNotAnimate)
|
|
@@ -133,7 +152,7 @@ end
|
|
|
133
152
|
|
|
134
153
|
@return Color3?
|
|
135
154
|
]=]
|
|
136
|
-
function AnimatedHighlightModel:GetOutlineColor()
|
|
155
|
+
function AnimatedHighlightModel:GetOutlineColor(): Color3?
|
|
137
156
|
return self.OutlineColor.Value
|
|
138
157
|
end
|
|
139
158
|
|
|
@@ -143,7 +162,7 @@ end
|
|
|
143
162
|
@param outlineTransparency number
|
|
144
163
|
@param doNotAnimate boolean?
|
|
145
164
|
]=]
|
|
146
|
-
function AnimatedHighlightModel:SetOutlineTransparency(outlineTransparency: number?, doNotAnimate: boolean?)
|
|
165
|
+
function AnimatedHighlightModel:SetOutlineTransparency(outlineTransparency: number?, doNotAnimate: boolean?): ()
|
|
147
166
|
assert(type(outlineTransparency) == "number" or outlineTransparency == nil, "Bad outlineTransparency")
|
|
148
167
|
|
|
149
168
|
self.OutlineTransparency:SetValue(outlineTransparency, doNotAnimate)
|
|
@@ -155,11 +174,10 @@ end
|
|
|
155
174
|
@param fillTransparency number
|
|
156
175
|
@param doNotAnimate boolean?
|
|
157
176
|
]=]
|
|
158
|
-
function AnimatedHighlightModel:SetFillTransparency(fillTransparency: number?, doNotAnimate: boolean?)
|
|
177
|
+
function AnimatedHighlightModel:SetFillTransparency(fillTransparency: number?, doNotAnimate: boolean?): ()
|
|
159
178
|
assert(type(fillTransparency) == "number" or fillTransparency == nil, "Bad fillTransparency")
|
|
160
179
|
|
|
161
180
|
self.FillTransparency:SetValue(fillTransparency, doNotAnimate)
|
|
162
181
|
end
|
|
163
182
|
|
|
164
|
-
|
|
165
|
-
return AnimatedHighlightModel
|
|
183
|
+
return AnimatedHighlightModel
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
@class AnimatedHighlightStack
|
|
3
4
|
]=]
|
|
@@ -7,19 +8,36 @@ local require = require(script.Parent.loader).load(script)
|
|
|
7
8
|
local AnimatedHighlight = require("AnimatedHighlight")
|
|
8
9
|
local AnimatedHighlightModel = require("AnimatedHighlightModel")
|
|
9
10
|
local BaseObject = require("BaseObject")
|
|
11
|
+
local DuckTypeUtils = require("DuckTypeUtils")
|
|
10
12
|
local Maid = require("Maid")
|
|
13
|
+
local Observable = require("Observable")
|
|
14
|
+
local ObservableSortedList = require("ObservableSortedList")
|
|
11
15
|
local Rx = require("Rx")
|
|
12
16
|
local Signal = require("Signal")
|
|
13
|
-
local ObservableSortedList = require("ObservableSortedList")
|
|
14
17
|
local ValueObject = require("ValueObject")
|
|
15
|
-
local DuckTypeUtils = require("DuckTypeUtils")
|
|
16
18
|
|
|
17
19
|
local AnimatedHighlightStack = setmetatable({}, BaseObject)
|
|
18
20
|
AnimatedHighlightStack.ClassName = "AnimatedHighlightStack"
|
|
19
21
|
AnimatedHighlightStack.__index = AnimatedHighlightStack
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
export type AnimatedHighlightStack = typeof(setmetatable(
|
|
24
|
+
{} :: {
|
|
25
|
+
_adornee: Instance,
|
|
26
|
+
_defaultModelValues: AnimatedHighlightModel.AnimatedHighlightModel,
|
|
27
|
+
_list: any,
|
|
28
|
+
_currentModel: AnimatedHighlightModel.AnimatedHighlightModel,
|
|
29
|
+
_highlight: AnimatedHighlight.AnimatedHighlight,
|
|
30
|
+
_hasEntries: ValueObject.ValueObject<boolean>,
|
|
31
|
+
maid: Maid.Maid,
|
|
32
|
+
|
|
33
|
+
Done: Signal.Signal<()>,
|
|
34
|
+
Destroying: Signal.Signal<()>,
|
|
35
|
+
},
|
|
36
|
+
{} :: typeof({ __index = AnimatedHighlightStack })
|
|
37
|
+
)) & BaseObject.BaseObject
|
|
38
|
+
|
|
39
|
+
function AnimatedHighlightStack.new(adornee: Instance, defaultModelValues): AnimatedHighlightStack
|
|
40
|
+
local self: AnimatedHighlightStack = setmetatable(BaseObject.new() :: any, AnimatedHighlightStack)
|
|
23
41
|
|
|
24
42
|
self._adornee = assert(adornee, "No adornee")
|
|
25
43
|
|
|
@@ -31,24 +49,27 @@ function AnimatedHighlightStack.new(adornee, defaultModelValues)
|
|
|
31
49
|
|
|
32
50
|
self.Done = self._maid:Add(Signal.new())
|
|
33
51
|
|
|
34
|
-
self._maid:GiveTask(self._list
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
52
|
+
self._maid:GiveTask(self._list
|
|
53
|
+
:ObserveCount()
|
|
54
|
+
:Pipe({
|
|
55
|
+
Rx.switchMap(function(count)
|
|
56
|
+
if count == 0 then
|
|
57
|
+
return Rx.of(nil) :: any
|
|
58
|
+
else
|
|
59
|
+
return self._list:ObserveAtIndex(count)
|
|
60
|
+
end
|
|
61
|
+
end) :: any,
|
|
62
|
+
Rx.distinct() :: any,
|
|
63
|
+
})
|
|
64
|
+
:Subscribe(function(currentModel)
|
|
65
|
+
if currentModel then
|
|
66
|
+
self._maid._current = self:_setupModel(currentModel)
|
|
67
|
+
self._hasEntries.Value = true
|
|
38
68
|
else
|
|
39
|
-
|
|
69
|
+
self._hasEntries.Value = false
|
|
70
|
+
self._maid._current = nil
|
|
40
71
|
end
|
|
41
|
-
end)
|
|
42
|
-
Rx.distinct()
|
|
43
|
-
}):Subscribe(function(currentModel)
|
|
44
|
-
if currentModel then
|
|
45
|
-
self._maid._current = self:_setupModel(currentModel)
|
|
46
|
-
self._hasEntries.Value = true
|
|
47
|
-
else
|
|
48
|
-
self._hasEntries.Value = false
|
|
49
|
-
self._maid._current = nil
|
|
50
|
-
end
|
|
51
|
-
end))
|
|
72
|
+
end))
|
|
52
73
|
|
|
53
74
|
self:_setupHighlight()
|
|
54
75
|
|
|
@@ -79,7 +100,7 @@ end
|
|
|
79
100
|
@param value any
|
|
80
101
|
@return boolean
|
|
81
102
|
]=]
|
|
82
|
-
function AnimatedHighlightStack.isAnimatedHighlightStack(value)
|
|
103
|
+
function AnimatedHighlightStack.isAnimatedHighlightStack(value: any): boolean
|
|
83
104
|
return DuckTypeUtils.isImplementation(AnimatedHighlightStack, value)
|
|
84
105
|
end
|
|
85
106
|
|
|
@@ -88,7 +109,7 @@ end
|
|
|
88
109
|
|
|
89
110
|
@param source AnimatedHighlightStack
|
|
90
111
|
]=]
|
|
91
|
-
function AnimatedHighlightStack:SetPropertiesFrom(source)
|
|
112
|
+
function AnimatedHighlightStack:SetPropertiesFrom(source: AnimatedHighlightStack)
|
|
92
113
|
assert(AnimatedHighlightStack.isAnimatedHighlightStack(source), "Bad source")
|
|
93
114
|
|
|
94
115
|
self._highlight:SetPropertiesFrom(source._highlight)
|
|
@@ -97,7 +118,7 @@ end
|
|
|
97
118
|
--[=[
|
|
98
119
|
@return Observable<boolean>
|
|
99
120
|
]=]
|
|
100
|
-
function AnimatedHighlightStack:ObserveHasEntries()
|
|
121
|
+
function AnimatedHighlightStack:ObserveHasEntries(): Observable.Observable<boolean>
|
|
101
122
|
return self._hasEntries:Observe()
|
|
102
123
|
end
|
|
103
124
|
|
|
@@ -153,46 +174,58 @@ function AnimatedHighlightStack:_setupHighlight()
|
|
|
153
174
|
return maid
|
|
154
175
|
end
|
|
155
176
|
|
|
156
|
-
function AnimatedHighlightStack:_setupModel(model)
|
|
177
|
+
function AnimatedHighlightStack:_setupModel(model: AnimatedHighlightModel.AnimatedHighlightModel)
|
|
157
178
|
local maid = Maid.new()
|
|
158
179
|
|
|
159
180
|
-- TODO: Default to default value instead
|
|
160
181
|
local function filterNil(observeDefaultValue, observable)
|
|
161
182
|
return observable:Pipe({
|
|
162
|
-
Rx.switchMap(function(value)
|
|
183
|
+
Rx.switchMap(function(value): any
|
|
163
184
|
if value ~= nil then
|
|
164
185
|
return Rx.of(value)
|
|
165
186
|
else
|
|
166
187
|
return observeDefaultValue
|
|
167
188
|
end
|
|
168
|
-
end)
|
|
189
|
+
end) :: any,
|
|
169
190
|
Rx.where(function(value)
|
|
170
191
|
return value ~= nil
|
|
171
|
-
end)
|
|
192
|
+
end) :: any,
|
|
172
193
|
})
|
|
173
194
|
end
|
|
174
195
|
|
|
175
|
-
maid:GiveTask(
|
|
176
|
-
self.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
maid:GiveTask(
|
|
191
|
-
self.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
+
maid:GiveTask(
|
|
197
|
+
self._currentModel.HighlightDepthMode:Mount(
|
|
198
|
+
filterNil(self._defaultModelValues.HighlightDepthMode:Observe(), model.HighlightDepthMode:Observe())
|
|
199
|
+
)
|
|
200
|
+
)
|
|
201
|
+
maid:GiveTask(
|
|
202
|
+
self._currentModel.FillColor:Mount(
|
|
203
|
+
filterNil(self._defaultModelValues.FillColor:Observe(), model.FillColor:Observe())
|
|
204
|
+
)
|
|
205
|
+
)
|
|
206
|
+
maid:GiveTask(
|
|
207
|
+
self._currentModel.OutlineColor:Mount(
|
|
208
|
+
filterNil(self._defaultModelValues.OutlineColor:Observe(), model.OutlineColor:Observe())
|
|
209
|
+
)
|
|
210
|
+
)
|
|
211
|
+
maid:GiveTask(
|
|
212
|
+
self._currentModel.FillTransparency:Mount(
|
|
213
|
+
filterNil(self._defaultModelValues.FillTransparency:Observe(), model.FillTransparency:Observe())
|
|
214
|
+
)
|
|
215
|
+
)
|
|
216
|
+
maid:GiveTask(
|
|
217
|
+
self._currentModel.OutlineTransparency:Mount(
|
|
218
|
+
filterNil(self._defaultModelValues.OutlineTransparency:Observe(), model.OutlineTransparency:Observe())
|
|
219
|
+
)
|
|
220
|
+
)
|
|
221
|
+
maid:GiveTask(
|
|
222
|
+
self._currentModel.Speed:Mount(filterNil(self._defaultModelValues.Speed:Observe(), model.Speed:Observe()))
|
|
223
|
+
)
|
|
224
|
+
maid:GiveTask(
|
|
225
|
+
self._currentModel.TransparencySpeed:Mount(
|
|
226
|
+
filterNil(self._defaultModelValues.TransparencySpeed:Observe(), model.TransparencySpeed:Observe())
|
|
227
|
+
)
|
|
228
|
+
)
|
|
196
229
|
|
|
197
230
|
return maid
|
|
198
231
|
end
|
|
@@ -203,7 +236,9 @@ end
|
|
|
203
236
|
@param observeScore Observable<number>
|
|
204
237
|
@return AnimatedHighlightModel
|
|
205
238
|
]=]
|
|
206
|
-
function AnimatedHighlightStack:GetHandle(
|
|
239
|
+
function AnimatedHighlightStack:GetHandle(
|
|
240
|
+
observeScore: Observable.Observable<number>
|
|
241
|
+
): AnimatedHighlightModel.AnimatedHighlightModel
|
|
207
242
|
assert(observeScore, "No observeScore")
|
|
208
243
|
|
|
209
244
|
local maid = Maid.new()
|
|
@@ -225,4 +260,4 @@ function AnimatedHighlightStack:GetHandle(observeScore)
|
|
|
225
260
|
return model
|
|
226
261
|
end
|
|
227
262
|
|
|
228
|
-
return AnimatedHighlightStack
|
|
263
|
+
return AnimatedHighlightStack
|