@quenty/blend 2.1.0 → 2.2.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,25 @@
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
+ # [2.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/blend@2.1.1...@quenty/blend@2.2.0) (2022-01-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Blend does not complete all observables is a sub-observable completes ([f5ce02b](https://github.com/Quenty/NevermoreEngine/commit/f5ce02bcb18003b9dd86cf9cf013cb5cc411cdcd))
12
+
13
+
14
+
15
+
16
+
17
+ ## [2.1.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/blend@2.1.0...@quenty/blend@2.1.1) (2022-01-06)
18
+
19
+ **Note:** Version bump only for package @quenty/blend
20
+
21
+
22
+
23
+
24
+
6
25
  # [2.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/blend@2.0.2...@quenty/blend@2.1.0) (2022-01-03)
7
26
 
8
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/blend",
3
- "version": "2.1.0",
3
+ "version": "2.2.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.0.1",
31
- "@quenty/brio": "^3.6.0",
32
- "@quenty/instanceutils": "^3.6.0",
33
- "@quenty/loader": "^3.2.0",
31
+ "@quenty/brio": "^3.7.0",
32
+ "@quenty/instanceutils": "^3.7.0",
33
+ "@quenty/loader": "^3.3.0",
34
34
  "@quenty/maid": "^2.0.2",
35
- "@quenty/promise": "^3.4.0",
36
- "@quenty/rx": "^3.6.0",
35
+ "@quenty/promise": "^3.5.0",
36
+ "@quenty/rx": "^3.7.0",
37
37
  "@quenty/signal": "^2.1.0",
38
- "@quenty/spring": "^3.1.0",
38
+ "@quenty/spring": "^3.2.0",
39
39
  "@quenty/steputils": "^3.0.1",
40
40
  "@quenty/string": "^2.2.1",
41
- "@quenty/valuebaseutils": "^3.6.0",
42
- "@quenty/valueobject": "^3.6.0"
41
+ "@quenty/valuebaseutils": "^3.7.0",
42
+ "@quenty/valueobject": "^3.7.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@quenty/contentproviderutils": "^3.4.0",
46
- "@quenty/playerthumbnailutils": "^3.5.0"
45
+ "@quenty/contentproviderutils": "^3.5.0",
46
+ "@quenty/playerthumbnailutils": "^3.6.0"
47
47
  },
48
- "gitHead": "d910da8f5c7e9a55a8bf76d8efbe5632713dd0fe"
48
+ "gitHead": "5a3f3fb6c908fd3874f5ceacc70b404780275119"
49
49
  }
@@ -145,7 +145,9 @@ function Blend.Computed(...)
145
145
 
146
146
  if #args == 0 then
147
147
  -- static value?
148
- return Rx.start(compute)
148
+ return Observable.new(function(sub)
149
+ sub:Fire(compute())
150
+ end)
149
151
  elseif #args == 1 then
150
152
  return args[1]:Pipe({
151
153
  Rx.map(compute)
@@ -643,12 +645,19 @@ function Blend._observeChildren(value)
643
645
  -- Subscription is for lifetime of brio, so we do
644
646
  -- not need to specifically add these results to the maid, and
645
647
  -- risk memory leak of the maid with a lot of items in it.
646
- maid:GiveTask(observe:Subscribe(sub:GetFireFailComplete()))
648
+ maid:GiveTask(observe:Subscribe(function(inst)
649
+ sub:Fire(inst)
650
+ end, function(...)
651
+ sub:Fail(...)
652
+ end, function()
653
+ -- completion should not result more than maid cleaning up
654
+ maid:DoCleaning()
655
+ end))
647
656
 
648
657
  return maid
649
658
  end
650
659
 
651
- warn(("Unknown type in brio %q"):format(typeof(value)))
660
+ warn(("Unknown type in brio %q"):format(typeof(result)))
652
661
  return nil
653
662
  end)
654
663
  end
@@ -676,12 +685,32 @@ function Blend._observeChildren(value)
676
685
  end
677
686
 
678
687
  local observe = Blend._observeChildren(result)
688
+
679
689
  if observe then
680
- maid:GiveTask(observe:Subscribe(sub:GetFireFailComplete()))
690
+ local innerMaid = Maid.new()
691
+
692
+ -- Note: I think this still memory leaks
693
+ innerMaid:GiveTask(observe:Subscribe(function(inst)
694
+ sub:Fire(inst)
695
+ end, function(...)
696
+ innerMaid:DoCleaning()
697
+ sub:Fail(...)
698
+ end, function()
699
+ innerMaid:DoCleaning()
700
+ end))
701
+
702
+ innerMaid:GiveTask(function()
703
+ maid[innerMaid] = nil
704
+ end)
705
+ maid[innerMaid] = innerMaid
681
706
  else
682
- warn(("Unknown type %q in observable"):format(typeof(result)))
707
+ warn(("Failed to convert %q into children"):format(tostring(result)))
683
708
  end
684
- end, sub:GetFailComplete())
709
+ end, function(...)
710
+ sub:Fire(...)
711
+ end, function()
712
+ -- Drop completion, other inner components may have completed.
713
+ end)
685
714
 
686
715
  return maid
687
716
  end)
@@ -694,7 +723,7 @@ function Blend._observeChildren(value)
694
723
  if observe then
695
724
  table.insert(observables, observe)
696
725
  else
697
- warn(("Unknown %q of %q"):format(tostring(key), typeof(item)))
726
+ warn(("Failed to convert [%s] %q into children"):format(tostring(key), tostring(item)))
698
727
  end
699
728
  end
700
729
 
@@ -9,6 +9,7 @@ local RunService = game:GetService("RunService")
9
9
  local Blend = require("Blend")
10
10
  local Maid = require("Maid")
11
11
  local ValueObject = require("ValueObject")
12
+ local Rx = require("Rx")
12
13
 
13
14
  return function(target)
14
15
  local maid = Maid.new()
@@ -48,6 +49,23 @@ return function(target)
48
49
  [Blend.Children] = {
49
50
  uiCornerValueObject;
50
51
 
52
+ Rx.NEVER;
53
+ Rx.EMPTY;
54
+
55
+ {
56
+ Blend.Single(Blend.Computed(percentVisible, function(visible)
57
+ if visible <= 0.5 then
58
+ return nil
59
+ else
60
+ return Blend.New "Frame" {
61
+ Size = UDim2.new(0, 100, 0, 100);
62
+ BackgroundTransparency = 0.5;
63
+ }
64
+ end
65
+ end));
66
+
67
+ };
68
+
51
69
  {
52
70
  Blend.Single(Blend.Computed(percentVisible, function(visible)
53
71
  local results = {}