@quenty/blend 6.17.0 → 6.18.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
+ # [6.18.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/blend@6.17.0...@quenty/blend@6.18.0) (2023-05-26)
7
+
8
+
9
+ ### Features
10
+
11
+ * Initial refactor of guis to use ValueObject instead of ValueObject ([723aba0](https://github.com/Quenty/NevermoreEngine/commit/723aba0208cae7e06c9d8bf2d8f0092d042d70ea))
12
+
13
+
14
+
15
+
16
+
6
17
  # [6.17.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/blend@6.16.0...@quenty/blend@6.17.0) (2023-05-08)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/blend
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/blend",
3
- "version": "6.17.0",
3
+ "version": "6.18.0",
4
4
  "description": "Declarative UI system.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,22 +28,22 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@quenty/acceltween": "^2.2.1",
31
- "@quenty/brio": "^8.12.0",
32
- "@quenty/instanceutils": "^7.13.0",
31
+ "@quenty/brio": "^8.13.0",
32
+ "@quenty/instanceutils": "^7.14.0",
33
33
  "@quenty/loader": "^6.2.1",
34
34
  "@quenty/maid": "^2.5.0",
35
35
  "@quenty/promise": "^6.5.0",
36
- "@quenty/rx": "^7.10.0",
37
- "@quenty/signal": "^2.3.0",
38
- "@quenty/spring": "^6.2.1",
36
+ "@quenty/rx": "^7.11.0",
37
+ "@quenty/signal": "^2.4.0",
38
+ "@quenty/spring": "^6.3.0",
39
39
  "@quenty/steputils": "^3.2.0",
40
40
  "@quenty/string": "^3.1.0",
41
- "@quenty/valuebaseutils": "^7.13.0",
42
- "@quenty/valueobject": "^7.13.0"
41
+ "@quenty/valuebaseutils": "^7.14.0",
42
+ "@quenty/valueobject": "^7.14.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@quenty/contentproviderutils": "^6.9.0",
45
+ "@quenty/contentproviderutils": "^6.10.0",
46
46
  "@quenty/playerthumbnailutils": "^6.5.0"
47
47
  },
48
- "gitHead": "2ad8cea7dd3ad79a39afd7d7b785b489b90553fd"
48
+ "gitHead": "11058e90e51ea83d3dad6ae9abe59cc19c36b94b"
49
49
  }
@@ -75,10 +75,11 @@ end
75
75
  Creates a new Blend State which is actually just a ValueObject underneath.
76
76
 
77
77
  @param defaultValue T
78
+ @param checkType string | nil
78
79
  @return ValueObject<T>
79
80
  ]=]
80
- function Blend.State(defaultValue)
81
- return ValueObject.new(defaultValue)
81
+ function Blend.State(defaultValue, checkType)
82
+ return ValueObject.new(defaultValue, checkType)
82
83
  end
83
84
 
84
85
  --[=[
@@ -1024,6 +1025,8 @@ end
1024
1025
  @return Maid
1025
1026
  ]=]
1026
1027
  function Blend.mount(instance, props)
1028
+ assert(typeof(instance) == "Instance", "Bad instance")
1029
+
1027
1030
  local maid = Maid.new()
1028
1031
 
1029
1032
  local parent = nil
@@ -25,28 +25,45 @@ return function(target)
25
25
  maid:GiveTask(uiCornerValueObject)
26
26
 
27
27
  -- Reassign to a new value
28
- task.delay(1, function()
29
- if uiCornerValueObject.Destroy then
30
- uiCornerValueObject.Value = Blend.New "UICorner" {
31
- CornerRadius = UDim.new(0, 25);
32
- };
33
- end
34
- end)
28
+ maid:GiveTask(task.delay(1, function()
29
+ uiCornerValueObject.Value = Blend.New "UICorner" {
30
+ CornerRadius = UDim.new(0, 5);
31
+ };
32
+ end))
35
33
 
34
+ local transparency = Blend.Computed(percentVisible, function(visible)
35
+ return 1 - visible
36
+ end);
37
+
38
+ -- Try a kitchen sink of items
36
39
  maid:GiveTask((Blend.New "TextLabel" {
37
40
  Parent = target;
41
+ Font = Enum.Font.FredokaOne;
38
42
  Size = Blend.Computed(percentVisible, function(visible)
39
- return UDim2.new(0, visible*100, 0, 50);
40
- end);
41
- BackgroundTransparency = Blend.Computed(percentVisible, function(visible)
42
- return 1 - visible
43
+ return UDim2.new(0, visible*100 + 50, 0, 50);
43
44
  end);
45
+ TextTransparency = transparency;
46
+ BackgroundTransparency = transparency;
44
47
  Position = UDim2.new(0.5, 0, 0.5, 0);
45
48
  AnchorPoint = Vector2.new(0.5, 0.5);
46
49
  Text = state;
47
- TextScaled = true;
50
+ TextSize = 15;
51
+ TextScaled = false;
48
52
 
49
53
  [Blend.Children] = {
54
+ Blend.New "UIPadding" {
55
+ PaddingLeft = UDim.new(0, 10);
56
+ PaddingRight = UDim.new(0, 10);
57
+ PaddingTop = UDim.new(0, 10);
58
+ PaddingBottom = UDim.new(0, 10);
59
+ };
60
+
61
+ Blend.New "UIScale" {
62
+ Scale = Blend.Computed(percentVisible, function(visible)
63
+ return 0.8 + 0.2*visible;
64
+ end);
65
+ };
66
+
50
67
  uiCornerValueObject;
51
68
 
52
69
  Rx.NEVER;
@@ -58,9 +75,15 @@ return function(target)
58
75
  return nil
59
76
  else
60
77
  return Blend.New "Frame" {
61
- Size = UDim2.new(0, 100, 0, 100);
62
- BackgroundTransparency = 0.5;
63
- }
78
+ Size = UDim2.new(0, 150, 0, 30);
79
+ AnchorPoint = Vector2.new(0.5, 0);
80
+ Position = UDim2.new(0.5, 0, 1, 10);
81
+ BackgroundTransparency = transparency;
82
+
83
+ Blend.New "UICorner" {
84
+ CornerRadius = UDim.new(0, 10);
85
+ }
86
+ };
64
87
  end
65
88
  end));
66
89
 
@@ -71,17 +94,18 @@ return function(target)
71
94
  local results = {}
72
95
 
73
96
  -- constructs a ton of children everytime this changes
74
- for x=0, visible*100, 10 do
97
+ for x=0, visible*100, 20 do
75
98
  table.insert(results, Blend.New "Frame" {
76
99
  Size = UDim2.new(0, 8, 0, 8);
77
- Position = UDim2.new(0, x, 0.9, 0);
100
+ Position = UDim2.new(x/100, 0, 0.9, 0);
78
101
  AnchorPoint = Vector2.new(0.5, 0.5);
79
102
  BorderSizePixel = 0;
80
103
  BackgroundColor3 = Color3.new(x/100, 0.5, 0.5);
104
+ BackgroundTransparency = transparency;
81
105
 
82
106
  [Blend.Children] = {
83
107
  Blend.New "UICorner" {
84
- CornerRadius = UDim.new(0.5, 5);
108
+ CornerRadius = UDim.new(0, 10);
85
109
  };
86
110
  };
87
111
  })
@@ -95,8 +119,9 @@ return function(target)
95
119
 
96
120
  local PERIOD = 5
97
121
  maid:GiveTask(RunService.RenderStepped:Connect(function()
98
- state.Value = tostring(os.clock())
99
- percentVisible.Value = (math.sin(os.clock()*math.pi*2/PERIOD) + 1)/2
122
+ local timeElapsed = os.clock()
123
+ state.Value = string.format("%02d:%02d:%0.3d", math.floor(timeElapsed / 60) % 60, math.floor(timeElapsed % 60), math.floor(timeElapsed*1000) % 1000)
124
+ percentVisible.Value = math.clamp((math.sin(os.clock()*math.pi*2/PERIOD) + 1), 0, 1)
100
125
  end))
101
126
 
102
127
  return function()