@quenty/guivisiblemanager 12.9.3 → 12.9.4-canary.559.339cfa7.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 +11 -0
- package/package.json +7 -7
- package/src/Client/GuiVisibleManager.lua +34 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.9.4-canary.559.339cfa7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/guivisiblemanager@12.9.3...@quenty/guivisiblemanager@12.9.4-canary.559.339cfa7.0) (2025-05-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add even more types ([b31717d](https://github.com/Quenty/NevermoreEngine/commit/b31717d8c9f7620c457f5018a2affa760a65334a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [12.9.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/guivisiblemanager@12.9.2...@quenty/guivisiblemanager@12.9.3) (2025-04-10)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/guivisiblemanager
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/guivisiblemanager",
|
|
3
|
-
"version": "12.9.
|
|
3
|
+
"version": "12.9.4-canary.559.339cfa7.0",
|
|
4
4
|
"description": "Help manage the visibility of GUIs while only constructing the Gui while visible",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/baseobject": "
|
|
29
|
-
"@quenty/cancellabledelay": "
|
|
30
|
-
"@quenty/loader": "
|
|
31
|
-
"@quenty/maid": "
|
|
32
|
-
"@quenty/valueobject": "
|
|
28
|
+
"@quenty/baseobject": "10.8.4-canary.559.339cfa7.0",
|
|
29
|
+
"@quenty/cancellabledelay": "3.5.3-canary.559.339cfa7.0",
|
|
30
|
+
"@quenty/loader": "10.8.4-canary.559.339cfa7.0",
|
|
31
|
+
"@quenty/maid": "3.4.4-canary.559.339cfa7.0",
|
|
32
|
+
"@quenty/valueobject": "13.17.4-canary.559.339cfa7.0"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "339cfa778736f08768ed7305041f6221faa35bfc"
|
|
38
38
|
}
|
|
@@ -12,14 +12,28 @@ local require = require(script.Parent.loader).load(script)
|
|
|
12
12
|
local HttpService = game:GetService("HttpService")
|
|
13
13
|
|
|
14
14
|
local BaseObject = require("BaseObject")
|
|
15
|
+
local BasicPane = require("BasicPane")
|
|
15
16
|
local Maid = require("Maid")
|
|
16
|
-
local
|
|
17
|
+
local Promise = require("Promise")
|
|
17
18
|
local ValueObject = require("ValueObject")
|
|
19
|
+
local cancellableDelay = require("cancellableDelay")
|
|
18
20
|
|
|
19
21
|
local GuiVisibleManager = setmetatable({}, BaseObject)
|
|
20
22
|
GuiVisibleManager.ClassName = "GuiVisibleManager"
|
|
21
23
|
GuiVisibleManager.__index = GuiVisibleManager
|
|
22
24
|
|
|
25
|
+
export type ConstructPane = (maid: Maid.Maid) -> Promise.Promise<BasicPane.BasicPane>
|
|
26
|
+
|
|
27
|
+
export type GuiVisibleManager = typeof(setmetatable(
|
|
28
|
+
{} :: {
|
|
29
|
+
_paneVisible: ValueObject.ValueObject<boolean>,
|
|
30
|
+
_promiseNewPane: ConstructPane,
|
|
31
|
+
_maxHideTime: number,
|
|
32
|
+
_nextDoNotAnimate: boolean?,
|
|
33
|
+
},
|
|
34
|
+
{} :: typeof({ __index = GuiVisibleManager })
|
|
35
|
+
)) & BaseObject.BaseObject
|
|
36
|
+
|
|
23
37
|
--[=[
|
|
24
38
|
Constructs a new GuiVisibleManager.
|
|
25
39
|
|
|
@@ -27,8 +41,8 @@ GuiVisibleManager.__index = GuiVisibleManager
|
|
|
27
41
|
@param maxHideTime number? -- Optional hide time
|
|
28
42
|
@return GuiVisibleManager
|
|
29
43
|
]=]
|
|
30
|
-
function GuiVisibleManager.new(promiseNewPane, maxHideTime: number?)
|
|
31
|
-
local self = setmetatable(BaseObject.new(), GuiVisibleManager)
|
|
44
|
+
function GuiVisibleManager.new(promiseNewPane: ConstructPane, maxHideTime: number?): GuiVisibleManager
|
|
45
|
+
local self: GuiVisibleManager = setmetatable(BaseObject.new() :: any, GuiVisibleManager)
|
|
32
46
|
|
|
33
47
|
self._maxHideTime = maxHideTime or 1
|
|
34
48
|
self._promiseNewPane = promiseNewPane or error("No promiseNewPane")
|
|
@@ -53,7 +67,7 @@ end
|
|
|
53
67
|
|
|
54
68
|
@return boolean
|
|
55
69
|
]=]
|
|
56
|
-
function GuiVisibleManager
|
|
70
|
+
function GuiVisibleManager.IsVisible(self: GuiVisibleManager): boolean
|
|
57
71
|
return self._paneVisible.Value
|
|
58
72
|
end
|
|
59
73
|
|
|
@@ -63,7 +77,7 @@ end
|
|
|
63
77
|
|
|
64
78
|
@param boolValue BoolValue
|
|
65
79
|
]=]
|
|
66
|
-
function GuiVisibleManager
|
|
80
|
+
function GuiVisibleManager.BindToBoolValue(self: GuiVisibleManager, boolValue: BoolValue)
|
|
67
81
|
assert(boolValue, "Must have boolValue")
|
|
68
82
|
assert(not self._boundBoolValue, "Already bound")
|
|
69
83
|
|
|
@@ -89,7 +103,7 @@ end
|
|
|
89
103
|
@param doNotAnimate boolean?
|
|
90
104
|
@return MaidTask
|
|
91
105
|
]=]
|
|
92
|
-
function GuiVisibleManager
|
|
106
|
+
function GuiVisibleManager.CreateShowHandle(self: GuiVisibleManager, doNotAnimate: boolean?): Maid.MaidTask
|
|
93
107
|
assert(self._showHandles, "Not initialized yet")
|
|
94
108
|
|
|
95
109
|
local key = HttpService:GenerateGUID(false)
|
|
@@ -111,7 +125,7 @@ function GuiVisibleManager:CreateShowHandle(doNotAnimate: boolean?)
|
|
|
111
125
|
}
|
|
112
126
|
end
|
|
113
127
|
|
|
114
|
-
function GuiVisibleManager
|
|
128
|
+
function GuiVisibleManager._updatePaneVisible(self: GuiVisibleManager, doNotAnimate: boolean?): ()
|
|
115
129
|
local nextValue = next(self._showHandles) ~= nil
|
|
116
130
|
if nextValue ~= self._paneVisible.Value then
|
|
117
131
|
self._nextDoNotAnimate = doNotAnimate
|
|
@@ -119,7 +133,7 @@ function GuiVisibleManager:_updatePaneVisible(doNotAnimate: boolean?)
|
|
|
119
133
|
end
|
|
120
134
|
end
|
|
121
135
|
|
|
122
|
-
function GuiVisibleManager
|
|
136
|
+
function GuiVisibleManager._onPaneVisibleChanged(self: GuiVisibleManager): ()
|
|
123
137
|
if self._maid._paneMaid then
|
|
124
138
|
return
|
|
125
139
|
end
|
|
@@ -132,20 +146,19 @@ function GuiVisibleManager:_onPaneVisibleChanged()
|
|
|
132
146
|
local maid = Maid.new()
|
|
133
147
|
self._maid._paneMaid = maid
|
|
134
148
|
|
|
135
|
-
self._promiseNewPane(maid)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
end)
|
|
149
|
+
self._promiseNewPane(maid):Then(function(pane)
|
|
150
|
+
if self._maid._paneMaid == maid then
|
|
151
|
+
self:_handleNewPane(maid, pane)
|
|
152
|
+
else
|
|
153
|
+
warn("[GuiVisibleManager] - Pane is not needed, promise took too long")
|
|
154
|
+
pane:Destroy()
|
|
155
|
+
end
|
|
156
|
+
end)
|
|
144
157
|
end
|
|
145
158
|
|
|
146
|
-
function GuiVisibleManager
|
|
159
|
+
function GuiVisibleManager._handleNewPane(self: GuiVisibleManager, maid: Maid.Maid, pane: BasicPane.BasicPane): ()
|
|
147
160
|
assert(pane.SetVisible, "No SetVisible on self, already destroyed")
|
|
148
|
-
assert(self._maid._paneMaid == maid, "Bad maid")
|
|
161
|
+
assert(self._maid._paneMaid :: any == maid, "Bad maid")
|
|
149
162
|
|
|
150
163
|
maid:GiveTask(pane)
|
|
151
164
|
|
|
@@ -161,7 +174,7 @@ function GuiVisibleManager:_handleNewPane(maid, pane)
|
|
|
161
174
|
|
|
162
175
|
-- cleanup after a given amount of time
|
|
163
176
|
maid._hideTask = cancellableDelay(self._maxHideTime, function()
|
|
164
|
-
if self._maid._paneMaid == maid then
|
|
177
|
+
if self._maid._paneMaid :: any == maid then
|
|
165
178
|
self._maid._paneMaid = nil
|
|
166
179
|
end
|
|
167
180
|
end)
|
|
@@ -173,4 +186,4 @@ function GuiVisibleManager:_handleNewPane(maid, pane)
|
|
|
173
186
|
updateVisible()
|
|
174
187
|
end
|
|
175
188
|
|
|
176
|
-
return GuiVisibleManager
|
|
189
|
+
return GuiVisibleManager
|