@quenty/adorneevalue 10.18.0 → 10.18.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 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
+ ## [10.18.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/adorneevalue@10.18.0...@quenty/adorneevalue@10.18.1) (2025-04-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
12
+
13
+
14
+
15
+
16
+
6
17
  # [10.18.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/adorneevalue@10.17.2...@quenty/adorneevalue@10.18.0) (2025-04-02)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/adorneevalue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/adorneevalue",
3
- "version": "10.18.0",
3
+ "version": "10.18.1",
4
4
  "description": "Adorneevalue - Helper class to transform a an adornee into relative positions/information.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,15 +25,15 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/adorneeutils": "^3.3.1",
29
- "@quenty/baseobject": "^10.8.0",
30
- "@quenty/blend": "^12.18.0",
31
- "@quenty/loader": "^10.8.0",
32
- "@quenty/maid": "^3.4.0",
33
- "@quenty/valueobject": "^13.17.0"
28
+ "@quenty/adorneeutils": "^3.3.2",
29
+ "@quenty/baseobject": "^10.8.1",
30
+ "@quenty/blend": "^12.18.1",
31
+ "@quenty/loader": "^10.8.1",
32
+ "@quenty/maid": "^3.4.1",
33
+ "@quenty/valueobject": "^13.17.1"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "e8ea56930e65322fcffc05a1556d5df988068f0b"
38
+ "gitHead": "78c3ac0ab08dd18085b6e6e6e4f745e76ed99f68"
39
39
  }
@@ -11,6 +11,7 @@ local AdorneeUtils = require("AdorneeUtils")
11
11
  local BaseObject = require("BaseObject")
12
12
  local Blend = require("Blend")
13
13
  local ValueObject = require("ValueObject")
14
+ local _Observable = require("Observable")
14
15
 
15
16
  local AdorneeValue = setmetatable({}, BaseObject)
16
17
  AdorneeValue.ClassName = "AdorneeValue"
@@ -27,8 +28,6 @@ function AdorneeValue.new()
27
28
  self._adornee = ValueObject.new()
28
29
  self._maid:GiveTask(self._adornee)
29
30
 
30
-
31
-
32
31
  return self
33
32
  end
34
33
 
@@ -37,7 +36,7 @@ end
37
36
 
38
37
  @return Instance | CFrame | Vector3 | nil
39
38
  ]=]
40
- function AdorneeValue:GetAdornee()
39
+ function AdorneeValue:GetAdornee(): (Instance | CFrame | Vector3)?
41
40
  return self._adornee.Value
42
41
  end
43
42
 
@@ -46,7 +45,7 @@ end
46
45
 
47
46
  @return Observable<Instance | CFrame | Vector3 | nil>
48
47
  ]=]
49
- function AdorneeValue:Observe()
48
+ function AdorneeValue:Observe(): _Observable.Observable<(Instance | CFrame | Vector3)?>
50
49
  return self._adornee:Observe()
51
50
  end
52
51
 
@@ -79,10 +78,10 @@ end
79
78
 
80
79
  function AdorneeValue:__newindex(index, value)
81
80
  if index == "Value" then
82
- assert(typeof(value) == "Instance"
83
- or typeof(value) == "Vector3"
84
- or typeof(value) == "CFrame"
85
- or value == nil, "Bad value")
81
+ assert(
82
+ typeof(value) == "Instance" or typeof(value) == "Vector3" or typeof(value) == "CFrame" or value == nil,
83
+ "Bad value"
84
+ )
86
85
 
87
86
  self._adornee.Value = value
88
87
  elseif index == "_adornee" or index == "_maid" then
@@ -102,7 +101,7 @@ end
102
101
  @return Observable<CFrame | nil>
103
102
  ]=]
104
103
  function AdorneeValue:ObserveBottomCFrame()
105
- return Blend.Computed(self._adornee, function(adornee)
104
+ return Blend.Computed(self._adornee, function(adornee: Instance): CFrame?
106
105
  if typeof(adornee) == "CFrame" then
107
106
  return adornee
108
107
  elseif typeof(adornee) == "Vector3" then
@@ -110,11 +109,11 @@ function AdorneeValue:ObserveBottomCFrame()
110
109
  elseif typeof(adornee) == "Instance" then
111
110
  -- TODO: Nearest bounding box stuff.
112
111
  local bbCFrame, bbSize = AdorneeUtils.getBoundingBox(adornee)
113
- if not bbCFrame then
112
+ if not bbCFrame or not bbSize then
114
113
  return nil
115
114
  end
116
115
 
117
- return bbCFrame * CFrame.new(0, -bbSize.y/2, 0)
116
+ return bbCFrame * CFrame.new(0, -bbSize.Y / 2, 0)
118
117
  elseif adornee then
119
118
  warn("Bad adornee")
120
119
  return nil
@@ -140,7 +139,7 @@ end
140
139
 
141
140
  @return Vector3 | nil
142
141
  ]=]
143
- function AdorneeValue:GetCenterPosition()
142
+ function AdorneeValue:GetCenterPosition(): Vector3?
144
143
  local adornee = self._adornee.Value
145
144
 
146
145
  if typeof(adornee) == "CFrame" then
@@ -174,7 +173,7 @@ end
174
173
 
175
174
  @return number?
176
175
  ]=]
177
- function AdorneeValue:GetRadius()
176
+ function AdorneeValue:GetRadius(): number?
178
177
  local adornee = self._adornee.Value
179
178
 
180
179
  if typeof(adornee) == "CFrame" then
@@ -184,11 +183,11 @@ function AdorneeValue:GetRadius()
184
183
  elseif typeof(adornee) == "Instance" then
185
184
  -- TODO: Nearest bounding box stuff.
186
185
  local bbCFrame, bbSize = AdorneeUtils.getBoundingBox(adornee)
187
- if not bbCFrame then
186
+ if not bbCFrame or not bbSize then
188
187
  return nil
189
188
  end
190
189
 
191
- return bbSize.magnitude/2
190
+ return bbSize.Magnitude / 2
192
191
  elseif adornee then
193
192
  warn("Bad adornee")
194
193
  return nil
@@ -212,9 +211,10 @@ function AdorneeValue:ObservePositionTowards(observeTargetPosition, observeRadiu
212
211
  observeTargetPosition,
213
212
  self:ObserveCenterPosition(),
214
213
  observeRadius or self:ObserveRadius(),
215
- function(target, radius, center)
214
+ function(target: Vector3, radius: number, center: Vector3)
216
215
  return self:_getPositionTowards(target, radius, center)
217
- end)
216
+ end
217
+ )
218
218
  end
219
219
 
220
220
  --[=[
@@ -226,7 +226,7 @@ end
226
226
  @param center Vector3
227
227
  @return Vector3
228
228
  ]=]
229
- function AdorneeValue:GetPositionTowards(target, radius, center)
229
+ function AdorneeValue:GetPositionTowards(target: Vector3, radius: number, center: Vector3): Vector3?
230
230
  assert(typeof(target) == "Vector3", "Bad target")
231
231
 
232
232
  center = center or self:GetCenterPosition()
@@ -235,13 +235,13 @@ function AdorneeValue:GetPositionTowards(target, radius, center)
235
235
  return self:_getPositionTowards(target, radius, center)
236
236
  end
237
237
 
238
- function AdorneeValue:_getPositionTowards(target, radius, center)
238
+ function AdorneeValue:_getPositionTowards(target: Vector3, radius: number, center: Vector3): Vector3?
239
239
  if not (radius and target and center) then
240
240
  return nil
241
241
  end
242
242
 
243
243
  local offset = target - center
244
- if offset.magnitude == 0 then
244
+ if offset.Magnitude == 0 then
245
245
  return nil
246
246
  end
247
247
 
@@ -255,7 +255,7 @@ end
255
255
  @return Observable<Instance?>
256
256
  ]=]
257
257
  function AdorneeValue:ObserveAttachmentParent()
258
- return Blend.Computed(self._adornee, function(adornee)
258
+ return Blend.Computed(self._adornee, function(adornee): Instance?
259
259
  if typeof(adornee) == "Instance" then
260
260
  -- TODO: Nearest bounding box stuff.
261
261
  local part = AdorneeUtils.getPart(adornee)
@@ -286,7 +286,7 @@ end
286
286
  function AdorneeValue:RenderPositionAttachment(props)
287
287
  props = props or {}
288
288
 
289
- local observeWorldPosition = props.WorldPosition or self:ObserveCenterPosition();
289
+ local observeWorldPosition = props.WorldPosition or self:ObserveCenterPosition()
290
290
  local observeParentPart = self:ObserveAttachmentParent()
291
291
 
292
292
  local observeCFrame = Blend.Computed(observeParentPart, observeWorldPosition, function(parentPart, position)
@@ -295,7 +295,7 @@ function AdorneeValue:RenderPositionAttachment(props)
295
295
  else
296
296
  return CFrame.new(0, 0, 0)
297
297
  end
298
- end);
298
+ end)
299
299
 
300
300
  return Blend.New "Attachment" {
301
301
  Name = props.Name or "AdorneeValueAttachment";