@quenty/uiobjectutils 6.4.0-canary.490.601c967.0 → 6.4.1-canary.496.cb49bdf.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,9 +3,23 @@
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.4.0-canary.490.601c967.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/uiobjectutils@6.3.0...@quenty/uiobjectutils@6.4.0-canary.490.601c967.0) (2024-08-27)
6
+ ## [6.4.1-canary.496.cb49bdf.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/uiobjectutils@6.4.0...@quenty/uiobjectutils@6.4.1-canary.496.cb49bdf.0) (2024-09-20)
7
7
 
8
- **Note:** Version bump only for package @quenty/uiobjectutils
8
+
9
+ ### Bug Fixes
10
+
11
+ * Ensure datamodel exists too ([cb49bdf](https://github.com/Quenty/NevermoreEngine/commit/cb49bdf8d79aac6e6901901c914271148df358b2))
12
+
13
+
14
+
15
+
16
+
17
+ # [6.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/uiobjectutils@6.3.0...@quenty/uiobjectutils@6.4.0) (2024-09-12)
18
+
19
+
20
+ ### Features
21
+
22
+ * Add GuiInteractionUtils.observeInteractionEnabled ([2e27110](https://github.com/Quenty/NevermoreEngine/commit/2e2711020665371e1c1d3b1ba35f44dc9a9ad3a7))
9
23
 
10
24
 
11
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/uiobjectutils",
3
- "version": "6.4.0-canary.490.601c967.0",
3
+ "version": "6.4.1-canary.496.cb49bdf.0",
4
4
  "description": "UI object utils library for Roblox",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,8 +28,11 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
+ "@quenty/brio": "14.5.0",
31
32
  "@quenty/enumutils": "3.2.0",
32
- "@quenty/loader": "10.4.0-canary.490.601c967.0"
33
+ "@quenty/instanceutils": "13.5.0",
34
+ "@quenty/loader": "10.4.0",
35
+ "@quenty/rx": "13.5.0"
33
36
  },
34
- "gitHead": "601c9671f09638be4f326e41fcfe3343ccfe76d8"
37
+ "gitHead": "cb49bdf8d79aac6e6901901c914271148df358b2"
35
38
  }
@@ -0,0 +1,55 @@
1
+ --[=[
2
+ @class GuiInteractionUtils
3
+ ]=]
4
+
5
+ local require = require(script.Parent.loader).load(script)
6
+
7
+ local RxInstanceUtils = require("RxInstanceUtils")
8
+ local Rx = require("Rx")
9
+ local RxBrioUtils = require("RxBrioUtils")
10
+
11
+ local GuiInteractionUtils = {}
12
+
13
+ --[=[
14
+ Observes whether a Gui is interactable
15
+
16
+ @param gui GuiObject
17
+ @return Observable<boolean>
18
+ ]=]
19
+ function GuiInteractionUtils.observeInteractionEnabled(gui)
20
+ assert(typeof(gui) == "Instance" and gui:IsA("GuiObject"), "Bad gui")
21
+
22
+ return Rx.combineLatest({
23
+ visible = RxInstanceUtils.observeProperty(gui, "Visible");
24
+ guiState = RxInstanceUtils.observeProperty(gui, "GuiState");
25
+ dataModel = RxInstanceUtils.observeFirstAncestorBrio(gui, "DataModel");
26
+ }):Pipe({
27
+ Rx.map(function(state)
28
+ return state.visible
29
+ and state.guiState ~= Enum.GuiState.NonInteractable
30
+ and state.dataModel
31
+ and true or false
32
+ end);
33
+ Rx.distinct();
34
+ })
35
+ end
36
+
37
+ --[=[
38
+ Observes whether a Gui is interactable, and returns a Brio only during
39
+ interaction.
40
+
41
+ @param gui GuiObject
42
+ @return Observable<Brio>
43
+ ]=]
44
+ function GuiInteractionUtils.observeInteractionEnabledBrio(gui)
45
+ assert(typeof(gui) == "Instance" and gui:IsA("GuiObject"), "Bad gui")
46
+
47
+ return GuiInteractionUtils.observeInteractionEnabled(gui):Pipe({
48
+ RxBrioUtils.switchToBrio(function(canInteract)
49
+ return canInteract
50
+ end)
51
+ })
52
+ end
53
+
54
+
55
+ return GuiInteractionUtils