@quenty/snackbar 11.22.0-canary.ae8d76d.0 → 11.22.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 +1 -1
- package/package.json +25 -25
- package/src/Client/Gui/Snackbar.lua +20 -20
- package/src/Client/SnackbarScreenGuiProvider.lua +2 -2
- package/src/Client/SnackbarServiceClient.lua +4 -4
- package/src/Client/SnackbarServiceClient.story.lua +43 -42
- package/src/Server/SnackbarService.lua +1 -3
- package/src/Shared/SnackbarOptionUtils.lua +8 -5
- package/test/scripts/Client/ClientMain.client.lua +3 -3
- package/test/scripts/Server/ServerMain.server.lua +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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.22.0
|
|
6
|
+
# [11.22.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/snackbar@11.21.3...@quenty/snackbar@11.22.0) (2025-05-10)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/snackbar",
|
|
3
|
-
"version": "11.22.0
|
|
3
|
+
"version": "11.22.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",
|
|
@@ -25,33 +25,33 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/baseobject": "10.
|
|
29
|
-
"@quenty/basicpane": "13.18.0
|
|
30
|
-
"@quenty/blend": "12.19.0
|
|
31
|
-
"@quenty/buttondragmodel": "1.16.0
|
|
32
|
-
"@quenty/buttonhighlightmodel": "14.19.0
|
|
33
|
-
"@quenty/ducktype": "5.
|
|
34
|
-
"@quenty/genericscreenguiprovider": "13.21.0
|
|
35
|
-
"@quenty/inputobjectutils": "4.19.0
|
|
36
|
-
"@quenty/lipsum": "14.19.0
|
|
37
|
-
"@quenty/loader": "10.
|
|
38
|
-
"@quenty/maid": "3.
|
|
39
|
-
"@quenty/math": "2.7.3",
|
|
40
|
-
"@quenty/promise": "10.11.0
|
|
41
|
-
"@quenty/promisemaid": "5.11.0
|
|
42
|
-
"@quenty/promptqueue": "1.19.0
|
|
43
|
-
"@quenty/qgui": "2.
|
|
44
|
-
"@quenty/rx": "13.18.0
|
|
45
|
-
"@quenty/servicebag": "11.12.0
|
|
46
|
-
"@quenty/table": "3.
|
|
47
|
-
"@quenty/textserviceutils": "13.19.0
|
|
48
|
-
"@quenty/transitionmodel": "7.20.0
|
|
49
|
-
"@quenty/utf8": "2.3.3",
|
|
50
|
-
"@quenty/valueobject": "13.18.0
|
|
28
|
+
"@quenty/baseobject": "^10.9.0",
|
|
29
|
+
"@quenty/basicpane": "^13.18.0",
|
|
30
|
+
"@quenty/blend": "^12.19.0",
|
|
31
|
+
"@quenty/buttondragmodel": "^1.16.0",
|
|
32
|
+
"@quenty/buttonhighlightmodel": "^14.19.0",
|
|
33
|
+
"@quenty/ducktype": "^5.9.0",
|
|
34
|
+
"@quenty/genericscreenguiprovider": "^13.21.0",
|
|
35
|
+
"@quenty/inputobjectutils": "^4.19.0",
|
|
36
|
+
"@quenty/lipsum": "^14.19.0",
|
|
37
|
+
"@quenty/loader": "^10.9.0",
|
|
38
|
+
"@quenty/maid": "^3.5.0",
|
|
39
|
+
"@quenty/math": "^2.7.3",
|
|
40
|
+
"@quenty/promise": "^10.11.0",
|
|
41
|
+
"@quenty/promisemaid": "^5.11.0",
|
|
42
|
+
"@quenty/promptqueue": "^1.19.0",
|
|
43
|
+
"@quenty/qgui": "^2.4.0",
|
|
44
|
+
"@quenty/rx": "^13.18.0",
|
|
45
|
+
"@quenty/servicebag": "^11.12.0",
|
|
46
|
+
"@quenty/table": "^3.8.0",
|
|
47
|
+
"@quenty/textserviceutils": "^13.19.0",
|
|
48
|
+
"@quenty/transitionmodel": "^7.20.0",
|
|
49
|
+
"@quenty/utf8": "^2.3.3",
|
|
50
|
+
"@quenty/valueobject": "^13.18.0",
|
|
51
51
|
"@quentystudios/t": "^3.0.0"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "20cff952c2cf06b959f2f11d2293bdef38acc604"
|
|
57
57
|
}
|
|
@@ -15,17 +15,17 @@ local ButtonDragModel = require("ButtonDragModel")
|
|
|
15
15
|
local ButtonHighlightModel = require("ButtonHighlightModel")
|
|
16
16
|
local DuckTypeUtils = require("DuckTypeUtils")
|
|
17
17
|
local Math = require("Math")
|
|
18
|
+
local Observable = require("Observable")
|
|
19
|
+
local Promise = require("Promise")
|
|
18
20
|
local PromiseMaidUtils = require("PromiseMaidUtils")
|
|
19
21
|
local PromiseUtils = require("PromiseUtils")
|
|
20
22
|
local SnackbarOptionUtils = require("SnackbarOptionUtils")
|
|
23
|
+
local SpringObject = require("SpringObject")
|
|
21
24
|
local SpringTransitionModel = require("SpringTransitionModel")
|
|
25
|
+
local Table = require("Table")
|
|
22
26
|
local TransitionModel = require("TransitionModel")
|
|
23
27
|
local UTF8 = require("UTF8")
|
|
24
28
|
local ValueObject = require("ValueObject")
|
|
25
|
-
local SpringObject = require("SpringObject")
|
|
26
|
-
local Table = require("Table")
|
|
27
|
-
local Promise = require("Promise")
|
|
28
|
-
local Observable = require("Observable")
|
|
29
29
|
|
|
30
30
|
local SHADOW_RADIUS = 2
|
|
31
31
|
local CORNER_RADIUS = 2
|
|
@@ -359,26 +359,26 @@ function Snackbar._renderCallToAction(self: Snackbar, callToAction)
|
|
|
359
359
|
local buttonModel = self._maid:Add(ButtonHighlightModel.new())
|
|
360
360
|
|
|
361
361
|
return Blend.New "TextButton" {
|
|
362
|
-
Name = "CallToActionButton"
|
|
363
|
-
AnchorPoint = Vector2.new(1, 0.5)
|
|
364
|
-
LayoutOrder = 2
|
|
365
|
-
BackgroundTransparency = 1
|
|
366
|
-
Position = UDim2.new(1, 0, 0.5, 0)
|
|
367
|
-
AutomaticSize = Enum.AutomaticSize.X
|
|
368
|
-
Size = UDim2.new(0, 0, 0, 18)
|
|
369
|
-
Text = UTF8.upper(callToActionText)
|
|
370
|
-
Font = Enum.Font.SourceSans
|
|
371
|
-
TextSize = assert(self._textLabel, "Must have textLabel").TextSize
|
|
372
|
-
TextXAlignment = Enum.TextXAlignment.Right
|
|
362
|
+
Name = "CallToActionButton",
|
|
363
|
+
AnchorPoint = Vector2.new(1, 0.5),
|
|
364
|
+
LayoutOrder = 2,
|
|
365
|
+
BackgroundTransparency = 1,
|
|
366
|
+
Position = UDim2.new(1, 0, 0.5, 0),
|
|
367
|
+
AutomaticSize = Enum.AutomaticSize.X,
|
|
368
|
+
Size = UDim2.new(0, 0, 0, 18),
|
|
369
|
+
Text = UTF8.upper(callToActionText),
|
|
370
|
+
Font = Enum.Font.SourceSans,
|
|
371
|
+
TextSize = assert(self._textLabel, "Must have textLabel").TextSize,
|
|
372
|
+
TextXAlignment = Enum.TextXAlignment.Right,
|
|
373
373
|
TextColor3 = Blend.Computed(buttonModel:ObservePercentHighlighted(), function(percent)
|
|
374
374
|
local scale = Math.map(percent, 0, 1, 0, 0.2)
|
|
375
375
|
return DEFAULT_TEXT_COLOR:Lerp(Color3.new(0, 0, 0), scale)
|
|
376
|
-
end)
|
|
377
|
-
TextTransparency = self._computedTransparency
|
|
376
|
+
end),
|
|
377
|
+
TextTransparency = self._computedTransparency,
|
|
378
378
|
|
|
379
379
|
[Blend.Instance] = function(gui)
|
|
380
380
|
buttonModel:SetButton(gui)
|
|
381
|
-
end
|
|
381
|
+
end,
|
|
382
382
|
|
|
383
383
|
[Blend.OnEvent "Activated"] = function()
|
|
384
384
|
self:Hide()
|
|
@@ -386,8 +386,8 @@ function Snackbar._renderCallToAction(self: Snackbar, callToAction)
|
|
|
386
386
|
if onClick then
|
|
387
387
|
onClick()
|
|
388
388
|
end
|
|
389
|
-
end
|
|
389
|
+
end,
|
|
390
390
|
}
|
|
391
391
|
end
|
|
392
392
|
|
|
393
|
-
return Snackbar
|
|
393
|
+
return Snackbar
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
local require = require(script.Parent.loader).load(script)
|
|
7
7
|
|
|
8
|
-
local Snackbar = require("Snackbar")
|
|
9
|
-
local SnackbarScreenGuiProvider = require("SnackbarScreenGuiProvider")
|
|
10
8
|
local Maid = require("Maid")
|
|
11
|
-
local SnackbarOptionUtils = require("SnackbarOptionUtils")
|
|
12
9
|
local PromptQueue = require("PromptQueue")
|
|
13
10
|
local ServiceBag = require("ServiceBag")
|
|
11
|
+
local Snackbar = require("Snackbar")
|
|
12
|
+
local SnackbarOptionUtils = require("SnackbarOptionUtils")
|
|
13
|
+
local SnackbarScreenGuiProvider = require("SnackbarScreenGuiProvider")
|
|
14
14
|
|
|
15
15
|
local SnackbarServiceClient = {}
|
|
16
16
|
SnackbarServiceClient.ServiceName = "SnackbarServiceClient"
|
|
@@ -106,4 +106,4 @@ function SnackbarServiceClient:Destroy()
|
|
|
106
106
|
self._maid:DoCleaning()
|
|
107
107
|
end
|
|
108
108
|
|
|
109
|
-
return SnackbarServiceClient
|
|
109
|
+
return SnackbarServiceClient
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
@class snackbarServiceClient.story
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
8
|
+
local Blend = require("Blend")
|
|
9
|
+
local LipsumUtils = require("LipsumUtils")
|
|
7
10
|
local Maid = require("Maid")
|
|
11
|
+
local ScreenGuiService = require("ScreenGuiService")
|
|
8
12
|
local ServiceBag = require("ServiceBag")
|
|
9
13
|
local SnackbarServiceClient = require("SnackbarServiceClient")
|
|
10
|
-
local ScreenGuiService = require("ScreenGuiService")
|
|
11
|
-
local LipsumUtils = require("LipsumUtils")
|
|
12
|
-
local Blend = require("Blend")
|
|
13
14
|
|
|
14
15
|
return function(target)
|
|
15
16
|
local maid = Maid.new()
|
|
@@ -24,75 +25,75 @@ return function(target)
|
|
|
24
25
|
local function showSnackBar()
|
|
25
26
|
snackbarServiceClient:ShowSnackbar(LipsumUtils.sentence(10), {
|
|
26
27
|
CallToAction = {
|
|
27
|
-
Text = LipsumUtils.word()
|
|
28
|
+
Text = LipsumUtils.word(),
|
|
28
29
|
OnClick = function()
|
|
29
30
|
print("Activated action")
|
|
30
|
-
end
|
|
31
|
-
}
|
|
31
|
+
end,
|
|
32
|
+
},
|
|
32
33
|
})
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
local function button(props)
|
|
36
37
|
return Blend.New "TextButton" {
|
|
37
|
-
AutomaticSize = Enum.AutomaticSize.XY
|
|
38
|
-
AutoButtonColor = true
|
|
39
|
-
Text = props.Text
|
|
40
|
-
[Blend.OnEvent "Activated"] = props.OnActivated
|
|
38
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
39
|
+
AutoButtonColor = true,
|
|
40
|
+
Text = props.Text,
|
|
41
|
+
[Blend.OnEvent "Activated"] = props.OnActivated,
|
|
41
42
|
|
|
42
43
|
Blend.New "UIPadding" {
|
|
43
|
-
PaddingTop = UDim.new(0, 10)
|
|
44
|
-
PaddingBottom = UDim.new(0, 10)
|
|
45
|
-
PaddingLeft = UDim.new(0, 10)
|
|
46
|
-
PaddingRight = UDim.new(0, 10)
|
|
47
|
-
}
|
|
44
|
+
PaddingTop = UDim.new(0, 10),
|
|
45
|
+
PaddingBottom = UDim.new(0, 10),
|
|
46
|
+
PaddingLeft = UDim.new(0, 10),
|
|
47
|
+
PaddingRight = UDim.new(0, 10),
|
|
48
|
+
},
|
|
48
49
|
|
|
49
50
|
Blend.New "UICorner" {
|
|
50
|
-
CornerRadius = UDim.new(0, 5)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
51
|
+
CornerRadius = UDim.new(0, 5),
|
|
52
|
+
},
|
|
53
|
+
}
|
|
53
54
|
end
|
|
54
55
|
|
|
55
56
|
showSnackBar()
|
|
56
57
|
|
|
57
58
|
maid:GiveTask(Blend.mount(target, {
|
|
58
59
|
Blend.New "Frame" {
|
|
59
|
-
AutomaticSize = Enum.AutomaticSize.XY
|
|
60
|
-
AnchorPoint = Vector2.new(0.5, 0)
|
|
61
|
-
Position = UDim2.fromScale(0.5, 0)
|
|
62
|
-
BackgroundTransparency = 1
|
|
60
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
61
|
+
AnchorPoint = Vector2.new(0.5, 0),
|
|
62
|
+
Position = UDim2.fromScale(0.5, 0),
|
|
63
|
+
BackgroundTransparency = 1,
|
|
63
64
|
|
|
64
65
|
Blend.New "UIPadding" {
|
|
65
|
-
PaddingTop = UDim.new(0, 5)
|
|
66
|
-
PaddingBottom = UDim.new(0, 5)
|
|
67
|
-
PaddingLeft = UDim.new(0, 5)
|
|
68
|
-
PaddingRight = UDim.new(0, 5)
|
|
69
|
-
}
|
|
66
|
+
PaddingTop = UDim.new(0, 5),
|
|
67
|
+
PaddingBottom = UDim.new(0, 5),
|
|
68
|
+
PaddingLeft = UDim.new(0, 5),
|
|
69
|
+
PaddingRight = UDim.new(0, 5),
|
|
70
|
+
},
|
|
70
71
|
|
|
71
72
|
Blend.New "UIListLayout" {
|
|
72
|
-
FillDirection = Enum.FillDirection.Horizontal
|
|
73
|
-
Padding = UDim.new(0, 5)
|
|
74
|
-
}
|
|
73
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
74
|
+
Padding = UDim.new(0, 5),
|
|
75
|
+
},
|
|
75
76
|
|
|
76
77
|
button({
|
|
77
|
-
Text = "Show snackbar"
|
|
78
|
-
OnActivated = showSnackBar
|
|
79
|
-
})
|
|
78
|
+
Text = "Show snackbar",
|
|
79
|
+
OnActivated = showSnackBar,
|
|
80
|
+
}),
|
|
80
81
|
button({
|
|
81
|
-
Text = "Clear queue"
|
|
82
|
+
Text = "Clear queue",
|
|
82
83
|
OnActivated = function()
|
|
83
84
|
snackbarServiceClient:ClearQueue()
|
|
84
|
-
end
|
|
85
|
-
})
|
|
85
|
+
end,
|
|
86
|
+
}),
|
|
86
87
|
button({
|
|
87
|
-
Text = "Hide current"
|
|
88
|
+
Text = "Hide current",
|
|
88
89
|
OnActivated = function()
|
|
89
90
|
snackbarServiceClient:HideCurrent()
|
|
90
|
-
end
|
|
91
|
-
})
|
|
92
|
-
}
|
|
91
|
+
end,
|
|
92
|
+
}),
|
|
93
|
+
},
|
|
93
94
|
}))
|
|
94
95
|
|
|
95
96
|
return function()
|
|
96
97
|
maid:DoCleaning()
|
|
97
98
|
end
|
|
98
|
-
end
|
|
99
|
+
end
|
|
@@ -15,8 +15,6 @@ SnackbarService.ServiceName = "SnackbarService"
|
|
|
15
15
|
function SnackbarService:Init(serviceBag: ServiceBag.ServiceBag)
|
|
16
16
|
assert(not self._serviceBag, "Already initialized")
|
|
17
17
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
18
|
-
|
|
19
|
-
|
|
20
18
|
end
|
|
21
19
|
|
|
22
|
-
return SnackbarService
|
|
20
|
+
return SnackbarService
|
|
@@ -25,10 +25,13 @@ function SnackbarOptionUtils.createSnackbarOptions(options: SnackbarOptions): Sn
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
SnackbarOptionUtils.isSnackbarOptions = t.interface({
|
|
28
|
-
CallToAction = t.optional(t.union(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
CallToAction = t.optional(t.union(
|
|
29
|
+
t.string,
|
|
30
|
+
t.interface({
|
|
31
|
+
Text = t.string,
|
|
32
|
+
OnClick = t.optional(t.callback),
|
|
33
|
+
})
|
|
34
|
+
)),
|
|
32
35
|
})
|
|
33
36
|
|
|
34
|
-
return SnackbarOptionUtils
|
|
37
|
+
return SnackbarOptionUtils
|
|
@@ -16,11 +16,11 @@ local LipsumUtils = require("LipsumUtils")
|
|
|
16
16
|
local function showSnackbar()
|
|
17
17
|
snackbarServiceClient:ShowSnackbar(LipsumUtils.sentence(5), {
|
|
18
18
|
CallToAction = {
|
|
19
|
-
Text = LipsumUtils.word()
|
|
19
|
+
Text = LipsumUtils.word(),
|
|
20
20
|
OnClick = function()
|
|
21
21
|
print("Activated action")
|
|
22
|
-
end
|
|
23
|
-
}
|
|
22
|
+
end,
|
|
23
|
+
},
|
|
24
24
|
})
|
|
25
25
|
end
|
|
26
26
|
|