@ringozz/react-godot 4.7.2-592 → 4.7.2-594

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/README.md CHANGED
@@ -304,7 +304,7 @@ return <Node3D {...spring} />;
304
304
  ```
305
305
 
306
306
  - **`spring`** holds one function per `to` key (spread them all onto the node; each contributes its own prop's tweener to the shared `Tween`). Array values are converted to the property's value type.
307
- - **Node-typed goals**: call `useTween<Node3D>(...)` so `to`/`from` are typed against that node's props — `position: [0, 2, 0]` and nested `basis: [[…]]` infer as `Vector3`/`Basis`, with no `as Vector3` casts. A bare `useTween(...)` keeps array goals loose (`number[]`).
307
+ - **Node-typed goals**: call `useTween<Node3D>(...)` so `to`/`from` are typed against that node's props — `position: [0, 2, 0]` and nested `basis: [[…]]` infer as `Vector3`/`Basis`, with no `as Vector3` casts. Only scalar-number and value-type props are tweenable (signals, `Node` refs, bools, strings, containers are rejected); the returned `spring` is that whole prop set (all optional), so `{...spring}` stays JSX-spreadable. A bare `useTween(...)` keeps array goals loose (`number[]`).
308
308
  - **`tweenRef.current`** is the **live native Godot `Tween`**, created when the node mounts (null before that): `tweenRef.current?.kill()`, `?.pause()`, `?.play()`, `?.setSpeedScale(n)`, `?.isRunning()`, `?.finished`…
309
309
  - **`config`** maps to the Godot Tween API: `duration` (seconds), `transition`/`ease` (`TransitionType`/`EaseType` — the tween's defaults), `easing` (a `[0,1]→[0,1]` function → `setCustomInterpolator`), `speedScale`.
310
310
  - **`onStart`** fires when the tween is created/bound (on mount or when `deps` change), before it starts stepping.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ringozz/react-godot",
3
3
  "author": "Vladimir Davidovich",
4
- "version": "4.7.2-592",
4
+ "version": "4.7.2-594",
5
5
  "description": "A React renderer for Godot Engine via @ringozz/godot",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -23,7 +23,7 @@
23
23
  "*.md"
24
24
  ],
25
25
  "dependencies": {
26
- "@ringozz/godot": "^4.7.2-592",
26
+ "@ringozz/godot": "^4.7.2-594",
27
27
  "@types/react-reconciler": "^0.33.0",
28
28
  "react-reconciler": "^0.33.0"
29
29
  },
@@ -6,10 +6,10 @@ import type { Signal } from '@ringozz/godot';
6
6
  import type { Node } from '@ringozz/godot/Node';
7
7
  import type { Object as Instance } from '@ringozz/godot/Object';
8
8
  import { PropertyTweener } from '@ringozz/godot/PropertyTweener';
9
- import { Tween, type EaseType, type TransitionType } from '@ringozz/godot/Tween';
10
- import type React from 'react';
11
- import { useEffect, useMemo, useRef } from 'react';
12
- import { toValueType, type GodotVar } from '@ringozz/godot/runtime';
9
+ import { Tween, type EaseType, type TransitionType } from '@ringozz/godot/Tween';
10
+ import type React from 'react';
11
+ import { useEffect, useMemo, useRef } from 'react';
12
+ import { toValueType } from '@ringozz/godot/runtime';
13
13
 
14
14
  // Tween/PropertyTweener are only type-used here; value-reference them so their
15
15
  // `_R` class registration isn't tree-shaken (otherwise createTween's wrapper
@@ -47,18 +47,21 @@ export function useSignal<T extends (...args: any[]) => any>(signal: Signal<T>,
47
47
  // identity diff drops them, so nothing restarts); changing deps creates a new
48
48
  // tween (the previous one is killed).
49
49
 
50
- // Value-type goals are named tuples on the JS side — flat ones are `number[]`,
51
- // nested ones (Transform2D/Basis/Transform3D/Projection/AABB) are `number[][]`.
50
+ // Tweenable goal values: scalars and value-type tuples. `GodotVar` (the base of
51
+ // *every* Godot object) is deliberately NOT a member — `useTween` always wraps
52
+ // goals through `toValueType`, so callers pass plain numbers/tuples, and
53
+ // including `GodotVar` would wrongly admit signals/`Node` refs/object props.
52
54
  //
53
55
  // When the caller passes a node instance type (e.g. `useTween<Node3D>`), `to`
54
56
  // /`from` are contextually typed against that node's settable props, so each
55
57
  // array goal infers as the property's value-type tuple (Vector3, Basis, …). A
56
58
  // bare `useTween(...)` call keeps the loose behavior below (`number[]` goals).
57
- export type TweenValue = number | number[] | number[][] | GodotVar;
59
+ type TweenValue = number | number[] | number[][];
58
60
 
59
- // Settable props whose value is tween-compatible (numeric, value-type tuples,
60
- // GodotVar); excludes bool/string/signal/container/method props. Mapping over
61
- // `keyof N` lets `to` be contextually typed with the node's value-type tuples.
61
+ // Settable props whose value is a tweenable goal (`number`/value-type tuple).
62
+ // Signals, `Node` refs and other Godot objects are not `TweenValue`s, so they
63
+ // never leak into `spring` (`{...spring}` stays JSX-spreadable). Mapping over
64
+ // `keyof T` lets `to` be contextually typed with the node's value-type tuples.
62
65
  type TweenableProps<T> = {
63
66
  [K in keyof T as T[K] extends TweenValue ? K : never]: T[K];
64
67
  };