@ringozz/godot 4.7.2-579 → 4.7.2-585

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.
Files changed (49) hide show
  1. package/README.md +19 -1
  2. package/gen/classes/ArrayOccluder3D.ts +1 -1
  3. package/gen/classes/CPUParticles2D.ts +3 -3
  4. package/gen/classes/CPUParticles3D.ts +3 -3
  5. package/gen/classes/CSGPolygon3D.ts +1 -1
  6. package/gen/classes/CollisionPolygon2D.ts +1 -1
  7. package/gen/classes/CollisionPolygon3D.ts +1 -1
  8. package/gen/classes/ColorPalette.ts +1 -1
  9. package/gen/classes/ConcavePolygonShape2D.ts +1 -1
  10. package/gen/classes/ConcavePolygonShape3D.ts +1 -1
  11. package/gen/classes/ConvexPolygonShape2D.ts +1 -1
  12. package/gen/classes/ConvexPolygonShape3D.ts +1 -1
  13. package/gen/classes/FontVariation.ts +1 -1
  14. package/gen/classes/Gradient.ts +1 -1
  15. package/gen/classes/Line2D.ts +1 -1
  16. package/gen/classes/MultiMesh.ts +4 -4
  17. package/gen/classes/NavigationMesh.ts +1 -1
  18. package/gen/classes/NavigationObstacle2D.ts +1 -1
  19. package/gen/classes/NavigationObstacle3D.ts +1 -1
  20. package/gen/classes/NavigationPathQueryResult2D.ts +1 -1
  21. package/gen/classes/NavigationPathQueryResult3D.ts +1 -1
  22. package/gen/classes/NavigationPolygon.ts +1 -1
  23. package/gen/classes/OccluderPolygon2D.ts +1 -1
  24. package/gen/classes/Polygon2D.ts +3 -3
  25. package/gen/classes/PolygonOccluder3D.ts +1 -1
  26. package/gen/classes/Window.ts +1 -1
  27. package/gen/index.ts +0 -3
  28. package/gen/utility-functions.ts +114 -114
  29. package/gen/value-types/AABB.ts +267 -277
  30. package/gen/value-types/Basis.ts +313 -264
  31. package/gen/value-types/Color.ts +398 -268
  32. package/gen/value-types/Plane.ts +121 -125
  33. package/gen/value-types/Projection.ts +178 -126
  34. package/gen/value-types/Quaternion.ts +180 -179
  35. package/gen/value-types/Rect2.ts +169 -171
  36. package/gen/value-types/Rect2i.ts +148 -150
  37. package/gen/value-types/Transform2D.ts +192 -194
  38. package/gen/value-types/Transform3D.ts +133 -126
  39. package/gen/value-types/Vector2.ts +370 -354
  40. package/gen/value-types/Vector2i.ts +192 -191
  41. package/gen/value-types/Vector3.ts +354 -354
  42. package/gen/value-types/Vector3i.ts +187 -192
  43. package/gen/value-types/Vector4.ts +263 -274
  44. package/gen/value-types/Vector4i.ts +187 -198
  45. package/gen/value-types/index.ts +16 -16
  46. package/package.json +20 -4
  47. package/src/debug.ts +30 -27
  48. package/src/index.ts +0 -2
  49. package/src/runtime.ts +31 -8
package/src/runtime.ts CHANGED
@@ -36,22 +36,31 @@ export const GodotVar = _mod.GodotVar as (new (...args: unknown[]) => GodotVar)
36
36
  * - _C(this, methodId, ...args) → instance method
37
37
  * - _C(classId, methodId, ...args) → static method
38
38
  * - _C(null, methodId, ...args) → singleton lookup (_getInstance) or internal
39
- * - _C(0xHASHn, methodId, ...args) → utility function (BigInt carries hash + type metadata)
39
+ * - _C(0n, methodId, ...args) → utility function (BigInt tags the call;
40
+ * arg types resolve by name at runtime)
40
41
  */
41
42
  export const _C = _mod._C as (...args: unknown[]) => unknown;
42
43
 
43
44
  /** Resolve a string name to its integer handle. */
44
45
  export const _S = _mod._S as (name: string) => number;
45
46
 
46
- /** Low-level property getter for value type fields. */
47
- export const _get = _mod._get as (target: GodotVar, nameId: number) => unknown;
48
-
49
- /** Low-level property setter for value type fields. */
50
- export const _set = _mod._set as (target: GodotVar, nameId: number, val: unknown) => void;
51
-
52
47
  /** Register Godot object wrapper. */
53
48
  export const _R = _mod._R as (typeId: number, ctor: Function) => string;
54
49
 
50
+ /**
51
+ * Value-type dispatch on tuple receivers: `_V(typeId, methodId, receiver, ...args)`.
52
+ * `methodId == SX_valueCtor` constructs (`_V(typeId, ctorSentinel, ctorIndex, ...args)`),
53
+ * negative ids are operators, non-negative ids are builtin methods.
54
+ */
55
+ export const _V = _mod._V as (...args: unknown[]) => unknown;
56
+
57
+ /**
58
+ * Build a typed value-type Variant for a Variant-typed slot by resolving the
59
+ * property's type from the node; returns a GodotVar carrier the consuming `_C`
60
+ * unwraps. Used by react-hooks' useTween (tweenProperty final_val).
61
+ */
62
+ export const toValueType = _mod.toValueType as (node: GodotVar, propName: string, value: unknown) => unknown;
63
+
55
64
  /** Stage bytes into the web MEMFS (Godot's `copyToFS`); undefined on desktop. */
56
65
  export const stageFile = (_mod as any).stageFile as ((path: string, bytes: Uint8Array) => void) | undefined;
57
66
 
@@ -64,6 +73,15 @@ export const requestAnimationFrame = _mod.requestAnimationFrame as typeof global
64
73
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope/cancelAnimationFrame) */
65
74
  export const cancelAnimationFrame = _mod.cancelAnimationFrame as typeof globalThis.cancelAnimationFrame ?? globalThis.cancelAnimationFrame;
66
75
 
76
+ // One-shot callbacks of in-flight `_P` awaits. The connection's JSCallable holds
77
+ // only a weak reference to the callback, so without this the function could be
78
+ // GC'd before the signal fires. A module root is the only retention Bun reliably
79
+ // traces: neither `_P`'s closure cells nor a Set attached to the signal's object
80
+ // wrapper survive a full GC while the await is pending (the await machinery
81
+ // discards the promise `_P` returns, and Bun may collect the emitter's wrapper).
82
+ // Removed as soon as the signal fires or the connect fails.
83
+ const pendingCallbacks = new Set<(...args: any[]) => void>();
84
+
67
85
  /** Make a Signal PromiseLike: connects a one-shot callback that resolves with the args tuple. */
68
86
  export function _P(signal: any, onfulfilled?: any, onrejected?: any) {
69
87
  return new Promise<any>((resolve, reject) => {
@@ -72,11 +90,16 @@ export function _P(signal: any, onfulfilled?: any, onrejected?: any) {
72
90
  return;
73
91
  }
74
92
  const cb = (...args: any[]) => {
93
+ pendingCallbacks.delete(cb);
75
94
  signal.disconnect(cb);
76
95
  resolve(args);
77
96
  };
97
+ pendingCallbacks.add(cb);
78
98
  const res = signal.connect(cb);
79
- if (res !== 0) reject(new Error('Failed to connect signal: error code ' + res));
99
+ if (res !== 0) {
100
+ pendingCallbacks.delete(cb);
101
+ reject(new Error('Failed to connect signal: error code ' + res));
102
+ }
80
103
  }).then(onfulfilled, onrejected);
81
104
  }
82
105