@quenty/snackbar 11.2.0 → 11.3.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,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
|
+
# [11.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/snackbar@11.2.0...@quenty/snackbar@11.3.0) (2024-04-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Refactor SnackbarManager ([1bcac76](https://github.com/Quenty/NevermoreEngine/commit/1bcac762686c93a432438374d17831fb4b77ee68))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [11.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/snackbar@11.1.0...@quenty/snackbar@11.2.0) (2024-04-27)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/snackbar
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/snackbar",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "Snackbars provide lightweight feedback on an operation at the base of the screen. They automatically disappear after a timeout or user interaction. There can only be one on the screen at a time.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "1f65df4adb6f3c04fb25d70bfa93f0f7c332c143"
|
|
37
37
|
}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
--[=[
|
|
2
2
|
Guarantees that only one snackbar is visible at once
|
|
3
|
-
@class
|
|
3
|
+
@class SnackbarServiceClient
|
|
4
4
|
]=]
|
|
5
5
|
|
|
6
6
|
local require = require(script.Parent.loader).load(script)
|
|
7
7
|
|
|
8
8
|
local DraggableSnackbar = require("DraggableSnackbar")
|
|
9
9
|
|
|
10
|
-
local
|
|
11
|
-
|
|
10
|
+
local SnackbarServiceClient = {}
|
|
11
|
+
SnackbarServiceClient.ServiceName = "SnackbarServiceClient"
|
|
12
|
+
|
|
13
|
+
function SnackbarServiceClient:Init(serviceBag)
|
|
14
|
+
assert(not self._serviceBag, "Already initialized")
|
|
15
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
12
16
|
|
|
13
|
-
function SnackbarManager:Init(screenGui)
|
|
14
17
|
self._currentSnackbar = nil
|
|
15
|
-
self:WithScreenGui(screenGui)
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
--[=[
|
|
19
21
|
Sets the screenGui to use
|
|
20
22
|
|
|
21
23
|
@param screenGui ScreenGui
|
|
22
|
-
@return
|
|
24
|
+
@return SnackbarServiceClient
|
|
23
25
|
]=]
|
|
24
|
-
function
|
|
26
|
+
function SnackbarServiceClient:SetScreenGui(screenGui)
|
|
25
27
|
self._screenGui = screenGui or error("No screenGui")
|
|
26
28
|
|
|
27
29
|
return self
|
|
@@ -39,7 +41,7 @@ end
|
|
|
39
41
|
};
|
|
40
42
|
};
|
|
41
43
|
]]
|
|
42
|
-
function
|
|
44
|
+
function SnackbarServiceClient:ShowSnackbar(text, options)
|
|
43
45
|
assert(type(text) == "string", "text must be a string")
|
|
44
46
|
|
|
45
47
|
local snackbar = DraggableSnackbar.new(self._screenGui, text, true, options)
|
|
@@ -48,7 +50,7 @@ function SnackbarManager:MakeSnackbar(text, options)
|
|
|
48
50
|
return snackbar
|
|
49
51
|
end
|
|
50
52
|
|
|
51
|
-
function
|
|
53
|
+
function SnackbarServiceClient:_showSnackbar(snackbar)
|
|
52
54
|
assert(snackbar, "Must send a snackbar")
|
|
53
55
|
|
|
54
56
|
if self._currentSnackbar == snackbar and self._currentSnackbar:IsVisible() then
|
|
@@ -77,4 +79,4 @@ function SnackbarManager:_showSnackbar(snackbar)
|
|
|
77
79
|
end
|
|
78
80
|
end
|
|
79
81
|
|
|
80
|
-
return
|
|
82
|
+
return SnackbarServiceClient
|