@quenty/snackbar 3.2.1-canary.8533eea.0 → 3.3.1
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 +10 -2
- package/README.md +5 -3
- package/package.json +6 -6
- package/src/Client/DraggableSnackbar.lua +6 -4
- package/src/Client/Snackbar.lua +9 -7
- package/src/Client/SnackbarManager.lua +11 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +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
|
-
## [3.
|
|
6
|
+
## [3.3.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/snackbar@3.3.0...@quenty/snackbar@3.3.1) (2021-12-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/snackbar
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/snackbar@3.2.0...@quenty/snackbar@3.3.0) (2021-12-18)
|
|
7
15
|
|
|
8
16
|
|
|
9
17
|
### Bug Fixes
|
|
10
18
|
|
|
11
|
-
* use task.delay() instead of delay() ([
|
|
19
|
+
* use task.delay() instead of delay() ([f3171d4](https://github.com/Quenty/NevermoreEngine/commit/f3171d409226dd38306818fa429136746ad4d213))
|
|
12
20
|
|
|
13
21
|
|
|
14
22
|
|
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
## Snackbar
|
|
2
2
|
<div align="center">
|
|
3
|
-
<a href="http://quenty.github.io/
|
|
4
|
-
<img src="https://
|
|
3
|
+
<a href="http://quenty.github.io/NevermoreEngine/">
|
|
4
|
+
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
|
|
5
5
|
</a>
|
|
6
6
|
<a href="https://discord.gg/mhtGUS8">
|
|
7
|
-
<img src="https://img.shields.io/
|
|
7
|
+
<img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
|
|
8
8
|
</a>
|
|
9
9
|
<a href="https://github.com/Quenty/NevermoreEngine/actions">
|
|
10
10
|
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
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.
|
|
15
15
|
|
|
16
|
+
<div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/Snackbar">View docs →</a></div>
|
|
17
|
+
|
|
16
18
|
## Installation
|
|
17
19
|
```
|
|
18
20
|
npm install @quenty/snackbar --save
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/snackbar",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
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",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/loader": "3.1.
|
|
29
|
-
"@quenty/maid": "2.0.
|
|
30
|
-
"@quenty/math": "2.0.
|
|
31
|
-
"@quenty/qgui": "2.0.
|
|
28
|
+
"@quenty/loader": "^3.1.2",
|
|
29
|
+
"@quenty/maid": "^2.0.2",
|
|
30
|
+
"@quenty/math": "^2.0.1",
|
|
31
|
+
"@quenty/qgui": "^2.0.1"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "d146c77d0a8e452824de0ab0b4b03ba0370bcc1b"
|
|
37
37
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Snackbar, but draggable
|
|
3
|
+
@class DraggableSnackbar
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -21,7 +23,7 @@ DraggableSnackbar.Duration = 3
|
|
|
21
23
|
-- By default the Snackbar will close automatically if the user types outside or presses the esc key.
|
|
22
24
|
DraggableSnackbar.AutoCloseDisabled = false
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
-- Note that this will not show until :Show() is called
|
|
25
27
|
-- @constructor
|
|
26
28
|
-- @param [GCOnDismissal] If true, will destroy itself and GC after being dismissed. Defaults to true
|
|
27
29
|
-- @param [Options] Table of optional values, adds call to actions, et cetera
|
|
@@ -88,7 +90,7 @@ function DraggableSnackbar:Show()
|
|
|
88
90
|
end
|
|
89
91
|
end))
|
|
90
92
|
|
|
91
|
-
|
|
93
|
+
-- Setup hide on dismissal
|
|
92
94
|
task.delay(self.Duration, function()
|
|
93
95
|
if self.Destroy and self._showId == LocalShowId and self._visible then
|
|
94
96
|
self:Dismiss()
|
package/src/Client/Snackbar.lua
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Snackbars provide lightweight feedback on an operation
|
|
3
|
+
at the base of the screen. They automatically disappear
|
|
4
|
+
after a timeout or user interaction. There can only be
|
|
5
|
+
one on the screen at a time.
|
|
6
|
+
@class Snackbar
|
|
7
|
+
]=]
|
|
6
8
|
|
|
7
9
|
local require = require(script.Parent.loader).load(script)
|
|
8
10
|
|
|
@@ -52,7 +54,7 @@ function Snackbar.new(Parent, Text, options)
|
|
|
52
54
|
ShadowContainer.Archivable = false
|
|
53
55
|
ShadowContainer.Position = UDim2.new(0.5, 0, 0.5, 0)
|
|
54
56
|
|
|
55
|
-
|
|
57
|
+
-- Image is blurred at
|
|
56
58
|
self.ShadowImages = {
|
|
57
59
|
qGUI.AddNinePatch(ShadowContainer, "rbxassetid://191838004",
|
|
58
60
|
Vector2.new(150, 150),
|
|
@@ -204,7 +206,7 @@ function Snackbar:FadeOutTransparency(PercentFaded)
|
|
|
204
206
|
end
|
|
205
207
|
end
|
|
206
208
|
|
|
207
|
-
|
|
209
|
+
-- Will animate unless given PercentFaded
|
|
208
210
|
function Snackbar:FadeInTransparency(PercentFaded)
|
|
209
211
|
if PercentFaded then
|
|
210
212
|
-- self.Gui.BackgroundTransparency = Math.map(PercentFaded, 0, 1, 1, 0)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Guarantees that only one snackbar is visible at once
|
|
3
|
+
@class SnackbarManager
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -12,14 +14,19 @@ function SnackbarManager:Init(screenGui)
|
|
|
12
14
|
self:WithScreenGui(screenGui)
|
|
13
15
|
end
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
--[=[
|
|
18
|
+
Sets the screenGui to use
|
|
19
|
+
|
|
20
|
+
@param screenGui ScreenGui
|
|
21
|
+
@return SnackbarManager
|
|
22
|
+
]=]
|
|
16
23
|
function SnackbarManager:WithScreenGui(screenGui)
|
|
17
24
|
self._screenGui = screenGui or error("No screenGui")
|
|
18
25
|
|
|
19
26
|
return self
|
|
20
27
|
end
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
-- Automatically makes a snackbar and shows it
|
|
23
30
|
-- @param text to show
|
|
24
31
|
-- @param[opt] options
|
|
25
32
|
--[[
|
|
@@ -40,7 +47,6 @@ function SnackbarManager:MakeSnackbar(text, options)
|
|
|
40
47
|
return snackbar
|
|
41
48
|
end
|
|
42
49
|
|
|
43
|
-
--- Cleanup existing snackbar
|
|
44
50
|
function SnackbarManager:_showSnackbar(snackbar)
|
|
45
51
|
assert(snackbar, "Must send a snackbar")
|
|
46
52
|
|