@needle-tools/engine 5.1.0-alpha.8 → 5.1.0-alpha.9

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 (111) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/components.needle.json +1 -1
  3. package/dist/{materialx-CE2sUv2B.umd.cjs → materialx-B47Bz-xs.umd.cjs} +1 -1
  4. package/dist/{materialx-u1EqYrhu.min.js → materialx-B85WjP7E.min.js} +1 -1
  5. package/dist/{materialx-vyB2Zbt4.js → materialx-jkHmVPez.js} +1 -1
  6. package/dist/{needle-engine.bundle-BuI2pjv1.min.js → needle-engine.bundle-BotdnwVF.min.js} +172 -172
  7. package/dist/{needle-engine.bundle-DQy9vQdJ.umd.cjs → needle-engine.bundle-DagaNrZK.umd.cjs} +145 -145
  8. package/dist/{needle-engine.bundle-3LOy9tj8.js → needle-engine.bundle-mtqHZ45d.js} +6580 -6392
  9. package/dist/needle-engine.d.ts +295 -23
  10. package/dist/needle-engine.js +592 -582
  11. package/dist/needle-engine.min.js +1 -1
  12. package/dist/needle-engine.umd.cjs +1 -1
  13. package/dist/{vendor-ButPLzor.umd.cjs → vendor-1UvpPPSB.umd.cjs} +2 -2
  14. package/dist/{vendor-DqZC4Is7.min.js → vendor-BQ2Vuntm.min.js} +4 -4
  15. package/dist/{vendor-DkWSNjMV.js → vendor-BslSKZPo.js} +113 -106
  16. package/lib/engine/api.d.ts +1 -1
  17. package/lib/engine/api.js +1 -1
  18. package/lib/engine/api.js.map +1 -1
  19. package/lib/engine/engine_audio.d.ts +30 -1
  20. package/lib/engine/engine_audio.js +57 -13
  21. package/lib/engine/engine_audio.js.map +1 -1
  22. package/lib/engine/engine_init.js +2 -2
  23. package/lib/engine/engine_init.js.map +1 -1
  24. package/lib/engine/engine_license.d.ts +7 -7
  25. package/lib/engine/engine_license.js +72 -72
  26. package/lib/engine/engine_license.js.map +1 -1
  27. package/lib/engine/engine_math.d.ts +1 -1
  28. package/lib/engine/engine_math.js +10 -4
  29. package/lib/engine/engine_math.js.map +1 -1
  30. package/lib/engine/engine_networking_blob.js +3 -3
  31. package/lib/engine/engine_networking_blob.js.map +1 -1
  32. package/lib/engine/engine_scenedata.js +7 -0
  33. package/lib/engine/engine_scenedata.js.map +1 -1
  34. package/lib/engine/engine_serialization_core.js +7 -2
  35. package/lib/engine/engine_serialization_core.js.map +1 -1
  36. package/lib/engine/engine_time_utils.d.ts +10 -6
  37. package/lib/engine/engine_time_utils.js +10 -6
  38. package/lib/engine/engine_time_utils.js.map +1 -1
  39. package/lib/engine/engine_utils_qrcode.js +2 -2
  40. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  41. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  42. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
  43. package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
  44. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  45. package/lib/engine/webcomponents/needle-engine.js +2 -2
  46. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  47. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  48. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  49. package/lib/engine/xr/TempXRContext.js +2 -2
  50. package/lib/engine/xr/TempXRContext.js.map +1 -1
  51. package/lib/engine-components/AudioSource.d.ts +46 -2
  52. package/lib/engine-components/AudioSource.js +268 -60
  53. package/lib/engine-components/AudioSource.js.map +1 -1
  54. package/lib/engine-components/DragControls.js +2 -2
  55. package/lib/engine-components/DragControls.js.map +1 -1
  56. package/lib/engine-components/DragControlsConstraints.d.ts +0 -15
  57. package/lib/engine-components/DragControlsConstraints.js +14 -8
  58. package/lib/engine-components/DragControlsConstraints.js.map +1 -1
  59. package/lib/engine-components/EventList.js +1 -1
  60. package/lib/engine-components/EventList.js.map +1 -1
  61. package/lib/engine-components/SceneSwitcher.js +17 -2
  62. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  63. package/lib/engine-components/codegen/components.d.ts +10 -0
  64. package/lib/engine-components/codegen/components.js +10 -0
  65. package/lib/engine-components/codegen/components.js.map +1 -1
  66. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  67. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  68. package/lib/engine-components/timeline/PlayableDirector.js +1 -1
  69. package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
  70. package/lib/engine-components/web/ScrollFollow.d.ts +33 -0
  71. package/lib/engine-components/web/ScrollFollow.js +164 -22
  72. package/lib/engine-components/web/ScrollFollow.js.map +1 -1
  73. package/lib/needle-app.d.ts +18 -0
  74. package/lib/needle-app.js +19 -0
  75. package/lib/needle-app.js.map +1 -0
  76. package/package.json +3 -2
  77. package/plugins/common/license.js +25 -4
  78. package/plugins/common/needle-engine.js +5 -2
  79. package/plugins/types/userconfig.d.ts +22 -0
  80. package/plugins/vite/dts-generator.d.ts +24 -0
  81. package/plugins/vite/dts-generator.js +40 -7
  82. package/plugins/vite/index.d.ts +2 -0
  83. package/plugins/vite/index.js +17 -0
  84. package/plugins/vite/license.js +4 -4
  85. package/plugins/vite/needle-app.js +78 -5
  86. package/plugins/vite/remote.d.ts +28 -0
  87. package/plugins/vite/remote.js +124 -0
  88. package/src/engine/api.ts +1 -1
  89. package/src/engine/engine_audio.ts +68 -15
  90. package/src/engine/engine_init.ts +2 -2
  91. package/src/engine/engine_license.ts +69 -69
  92. package/src/engine/engine_math.ts +11 -4
  93. package/src/engine/engine_networking_blob.ts +3 -3
  94. package/src/engine/engine_scenedata.ts +7 -2
  95. package/src/engine/engine_serialization_core.ts +7 -2
  96. package/src/engine/engine_time_utils.ts +10 -6
  97. package/src/engine/engine_utils_qrcode.ts +2 -2
  98. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  99. package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
  100. package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
  101. package/src/engine/webcomponents/needle-engine.ts +2 -2
  102. package/src/engine/xr/TempXRContext.ts +2 -2
  103. package/src/engine-components/AudioSource.ts +256 -55
  104. package/src/engine-components/DragControls.ts +3 -2
  105. package/src/engine-components/DragControlsConstraints.ts +16 -8
  106. package/src/engine-components/EventList.ts +1 -1
  107. package/src/engine-components/SceneSwitcher.ts +14 -2
  108. package/src/engine-components/codegen/components.ts +10 -0
  109. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
  110. package/src/engine-components/timeline/PlayableDirector.ts +1 -1
  111. package/src/engine-components/web/ScrollFollow.ts +168 -22
@@ -75,6 +75,7 @@ import { Pass } from 'postprocessing';
75
75
  import { peerjs } from 'peerjs';
76
76
  import { PeerJSOption } from 'peerjs';
77
77
  import { PerspectiveCamera } from 'three';
78
+ import { Plane } from 'three';
78
79
  import { PositionalAudio } from 'three';
79
80
  import { postprocessing } from 'postprocessing';
80
81
  import { Particle as QParticle } from 'three.quarks';
@@ -119,10 +120,6 @@ export declare const $componentName: unique symbol;
119
120
 
120
121
  export declare const $physicsKey: unique symbol;
121
122
 
122
- /* Excluded from this release type: _$QyV */
123
-
124
- /* Excluded from this release type: __Carg */
125
-
126
123
  export declare class __Ignore {
127
124
  }
128
125
 
@@ -1980,11 +1977,18 @@ export declare class AudioSource extends Component {
1980
1977
  private sound;
1981
1978
  private helper;
1982
1979
  private wasPlaying;
1983
- private audioLoader;
1984
1980
  private shouldPlay;
1985
- private _lastClipStartedLoading;
1986
1981
  private _loadedClip;
1987
1982
  private _audioElement;
1983
+ /**
1984
+ * True when {@link _audioElement} is a file-URL element routed through
1985
+ * `sound.setMediaElementSource()` (the iOS-survivable string-clip path). For this path ALL
1986
+ * playback control (play/pause/stop/loop/pitch/time/isPlaying) goes through the element,
1987
+ * because three.js sets `hasPlaybackControl = false` once a media source is attached.
1988
+ * It is `false` for the distinct MediaStream path (which uses an element with `srcObject`
1989
+ * plus `setMediaStreamSource()` and is controlled differently).
1990
+ */
1991
+ private _usesMediaElementSource;
1988
1992
  private _entryNode;
1989
1993
  private _spatialGain;
1990
1994
  private _bypassGain;
@@ -2008,11 +2012,39 @@ export declare class AudioSource extends Component {
2008
2012
  * @returns The {@link AudioContext} or null if not available
2009
2013
  */
2010
2014
  get audioContext(): AudioContext | undefined;
2015
+ /**
2016
+ * Resumes the shared AudioContext if it is currently suspended/interrupted and the
2017
+ * page is visible. Uses the same policy as the global resume handler so this never
2018
+ * triggers the iOS `InvalidStateError: Failed to start the audio device` (which
2019
+ * happens when resuming while the page is hidden). No-op when the context is already
2020
+ * running or when resuming is not currently allowed.
2021
+ */
2022
+ private ensureContextResumed;
2011
2023
  /* Excluded from this release type: awake */
2012
2024
  /* Excluded from this release type: onEnable */
2013
2025
  /* Excluded from this release type: onDisable */
2014
2026
  private onVisibilityChanged;
2015
2027
  private onApplicationMuteChanged;
2028
+ /**
2029
+ * Sets up playback of a string (file URL) clip through an `HTMLAudioElement` routed into the
2030
+ * Web Audio graph via `sound.setMediaElementSource()`.
2031
+ *
2032
+ * Why a media element instead of a decoded `AudioBuffer`: on iOS Safari an
2033
+ * `AudioBufferSourceNode` has its output torn down after a device lock / audio-session
2034
+ * interruption and cannot be reliably revived. A `MediaElementAudioSourceNode` survives the
2035
+ * lock because the playing `<audio>` element keeps iOS's media session alive, so the shared
2036
+ * AudioContext is never torn down and resumes cleanly. This is the same approach three.js's own
2037
+ * `webaudio_orientation` example uses.
2038
+ *
2039
+ * This does NOT start playback — it only creates/wires the element so a later `.play()` (driven
2040
+ * by a user gesture) is cheap.
2041
+ */
2042
+ private createAudioFromElement;
2043
+ /**
2044
+ * Sets up the {@link PositionalAudio} graph for a MediaStream clip (used for the MediaStream
2045
+ * path only — string clips go through {@link createAudioFromElement}). The actual stream node
2046
+ * is attached in {@link play} via `setMediaStreamSource`.
2047
+ */
2016
2048
  private createAudio;
2017
2049
  private __onAllowAudioCallback;
2018
2050
  /**
@@ -2034,6 +2066,15 @@ export declare class AudioSource extends Component {
2034
2066
  * @returns A promise that resolves when playback starts successfully, or rejects on error
2035
2067
  */
2036
2068
  play(clip?: string | MediaStream | undefined): Promise<boolean>;
2069
+ /**
2070
+ * Smoothly ramp the spatial-graph entry-gain node to `target` (1 = audible, 0 = silent) over a
2071
+ * few ms. A short *fade* — not a hard 0/1 gain change and not a connect/disconnect — is what
2072
+ * avoids the click on pause/resume (an instant change or a graph (dis)connect steps the waveform
2073
+ * → audible click). On iOS the MediaElementAudioSourceNode keeps feeding the graph after
2074
+ * element.pause() following an interruption, so fading this gain to 0 is what actually silences a
2075
+ * "paused" media clip; element.pause() only freezes its playback position.
2076
+ */
2077
+ private fadeEntryGain;
2037
2078
  /**
2038
2079
  * Pauses audio playback while maintaining the current position.
2039
2080
  * Use play() to resume from the paused position.
@@ -2217,6 +2258,24 @@ declare enum Axis {
2217
2258
  Vertical = "y"
2218
2259
  }
2219
2260
 
2261
+ /**
2262
+ * Constrains a dragged object to rotate only around a fixed world-space axis.
2263
+ * Uses swing-twist decomposition to extract only the twist component around
2264
+ * the given axis from the delta rotation since drag start, discarding any
2265
+ * perpendicular swing that would tilt the object.
2266
+ *
2267
+ * This is the correct constraint for XZ-plane dragging when the parent is
2268
+ * rotated — it restricts the object to yaw around the plane normal regardless
2269
+ * of how the plane is oriented in world space.
2270
+ */
2271
+ export declare class AxisRotationConstraint implements IDragConstraint {
2272
+ private readonly _startQuat;
2273
+ private readonly _axis;
2274
+ constructor(axis: Vector3);
2275
+ init(ctx: IDragConstraintContext): void;
2276
+ apply(followObject: GameObject): void;
2277
+ }
2278
+
2220
2279
  declare type BalloonOptions = {
2221
2280
  type: LogType;
2222
2281
  /**
@@ -2466,8 +2525,6 @@ export declare class BloomEffect extends PostProcessingEffect {
2466
2525
  onCreateEffect(): BloomEffect_2;
2467
2526
  }
2468
2527
 
2469
- /* Excluded from this release type: bLW */
2470
-
2471
2528
  /**
2472
2529
  * BoxCollider represents a box-shaped (cuboid) collision volume.
2473
2530
  * Most common collider type, efficient for walls, floors, crates, and rectangular objects.
@@ -5989,7 +6046,7 @@ export declare enum DragMode {
5989
6046
  * All properties are lazy getters over the flat serialized fields on the owning `DragControls`,
5990
6047
  * so runtime writes to those fields are reflected immediately without any extra bookkeeping.
5991
6048
  */
5992
- declare class DragProfile {
6049
+ export declare class DragProfile {
5993
6050
  private readonly _dc;
5994
6051
  private readonly _xr;
5995
6052
  /* Excluded from this release type: __constructor */
@@ -7007,6 +7064,33 @@ export declare class FixedJoint extends Joint {
7007
7064
  protected createJoint(self: Rigidbody, other: Rigidbody): any;
7008
7065
  }
7009
7066
 
7067
+ /**
7068
+ * Freezes individual rotation axes (X, Y, and/or Z) of the dragged object.
7069
+ * The locked axis values are captured once at construction time and restored every frame.
7070
+ *
7071
+ * Set {@link useLocalSpace} to `true` to lock axes in the object's local space;
7072
+ * leave it `false` (default) to lock axes in world space.
7073
+ *
7074
+ * @example Lock Y-axis rotation in world space:
7075
+ * ```ts
7076
+ * const c = new FixedRotationAxesConstraint(RotationAxis.Y, false);
7077
+ * // init is called automatically by DragControls, or call manually: c.init(ctx);
7078
+ * ```
7079
+ */
7080
+ export declare class FixedRotationAxesConstraint implements IDragConstraint {
7081
+ frozenAxes: RotationAxis;
7082
+ useLocalSpace: boolean;
7083
+ private readonly _startEuler;
7084
+ private readonly _eulerCache;
7085
+ /**
7086
+ * @param frozenAxes Bitfield of {@link RotationAxis} values indicating which axes to lock.
7087
+ * @param useLocalSpace When `true`, axes are locked in the object's local space; otherwise world space.
7088
+ */
7089
+ constructor(frozenAxes: RotationAxis, useLocalSpace?: boolean);
7090
+ init(ctx: IDragConstraintContext): void;
7091
+ apply(followObject: GameObject): void;
7092
+ }
7093
+
7010
7094
  declare type FocusRect = DOMRect | Element | {
7011
7095
  x: number;
7012
7096
  y: number;
@@ -7917,6 +8001,22 @@ export declare class GltfExportBox extends BoxHelperComponent {
7917
8001
  sceneRoot?: Object3D;
7918
8002
  }
7919
8003
 
8004
+ /** Projects the grabbed attachment point back onto a plane after position is resolved,
8005
+ * with optional grid snapping on that plane.
8006
+ * Owned by the strategy that requires plane-clamping (e.g. {@link XZPlaneDragStrategy}). */
8007
+ export declare class GrabPointPlaneConstraint implements IDragConstraint {
8008
+ /** Plane to project the grabbed point onto. Typically the strategy's fixed drag plane. */
8009
+ readonly plane: Plane;
8010
+ /** Attachment point in dragged-object local space. Set once at drag start; the handler
8011
+ * mutates this Vector3 in-place so updates are reflected automatically. */
8012
+ hitPointInLocalSpace: Vector3 | null;
8013
+ /** Grid snap resolution on the plane. 0 = projection only, no snapping. */
8014
+ snapResolution: number;
8015
+ constructor(plane: Plane);
8016
+ init(ctx: IDragConstraintContext): void;
8017
+ apply(followObject: GameObject): void;
8018
+ }
8019
+
7920
8020
  export declare class Gradient {
7921
8021
  alphaKeys: Array<AlphaKey>;
7922
8022
  colorKeys: Array<ColorKey>;
@@ -8078,6 +8178,15 @@ export declare class GridLayoutGroup extends LayoutGroup {
8078
8178
  protected onCalculateLayout(): void;
8079
8179
  }
8080
8180
 
8181
+ /** Snaps the follow object's world position to a uniform grid. Resolution ≤ 0 is a no-op.
8182
+ * For XZ-plane mode, use {@link GrabPointPlaneConstraint} instead (it handles both
8183
+ * plane-clamping and optional grid-snapping on the plane). */
8184
+ export declare class GridSnapConstraint implements IDragConstraint {
8185
+ snapGridResolution: number;
8186
+ constructor(snapGridResolution: number);
8187
+ apply(followObject: GameObject): void;
8188
+ }
8189
+
8081
8190
  /**
8082
8191
  * The [GroundProjectedEnv](https://engine.needle.tools/docs/api/GroundProjectedEnv) projects the environment map onto a virtual ground plane.
8083
8192
  * Creates a realistic floor from 360° panoramas/HDRIs by deforming the skybox
@@ -8632,6 +8741,47 @@ export declare interface IDisposable {
8632
8741
  dispose(): void;
8633
8742
  }
8634
8743
 
8744
+ /**
8745
+ * Contract for drag constraints applied after a follow object's position is resolved each frame.
8746
+ * Implement this interface to add custom position/rotation/scale restrictions.
8747
+ */
8748
+ declare interface IDragConstraint {
8749
+ /**
8750
+ * Called once at drag start and again whenever the drag context resets
8751
+ * (e.g. multi-touch → single-pointer transition). Capture any object snapshot
8752
+ * (position, rotation, scale) you need to hold fixed during the drag.
8753
+ * Constraints that need no dynamic initialization may omit this method.
8754
+ */
8755
+ init?(context: IDragConstraintContext): void;
8756
+ /** Modifies followObject in-place. Invoked after position is resolved each frame. */
8757
+ apply(followObject: GameObject): void;
8758
+ }
8759
+
8760
+ /**
8761
+ * Context passed to {@link IDragConstraint.init} at drag start and whenever the drag context
8762
+ * resets (e.g. transitioning from multi-touch back to single-pointer).
8763
+ * Provides a snapshot of the dragged object and attachment data a constraint needs
8764
+ * to initialize or re-initialize its locked reference values.
8765
+ */
8766
+ declare interface IDragConstraintContext {
8767
+ /** The object being dragged. Cast to IGameObject for world-space properties. */
8768
+ readonly gameObject: Object3D;
8769
+ /** Drag attachment point in the dragged object's local space. */
8770
+ readonly hitPointInLocalSpace: Vector3;
8771
+ /** Surface normal at drag attachment in the dragged object's local space. */
8772
+ readonly hitNormalInLocalSpace: Vector3;
8773
+ /**
8774
+ * Local-space bounding box at scale=1. Non-null only for multi-touch drags
8775
+ * where scale-aware constraints (e.g. keeping the bounds bottom grounded) are needed.
8776
+ */
8777
+ readonly boundsAtScaleOne: Box3 | null;
8778
+ /**
8779
+ * World scale of the object captured at the start of the current drag phase.
8780
+ * Non-null alongside boundsAtScaleOne for multi-touch; null for single-pointer.
8781
+ */
8782
+ readonly initialWorldScale: Vector3 | null;
8783
+ }
8784
+
8635
8785
  /** Implement to receive callbacks from {@type @needle-tools/editor-sync} package */
8636
8786
  declare interface IEditorModification {
8637
8787
  /**
@@ -8861,6 +9011,8 @@ export declare class ImageReference {
8861
9011
  */
8862
9012
  export declare function imageToCanvas(image: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap, color?: Vector4 | undefined, flipY?: boolean, maxTextureSize?: number): Promise<OffscreenCanvasExt>;
8863
9013
 
9014
+ /* Excluded from this release type: _imGyfK */
9015
+
8864
9016
  export declare interface IModel {
8865
9017
  guid: string;
8866
9018
  /**
@@ -10365,6 +10517,20 @@ declare abstract class Joint extends Component {
10365
10517
  protected abstract createJoint(self: Rigidbody, other: Rigidbody): any;
10366
10518
  }
10367
10519
 
10520
+ /** Locks the follow object's world rotation to the quaternion captured at drag-start. */
10521
+ export declare class KeepRotationConstraint implements IDragConstraint {
10522
+ private readonly _savedQuat;
10523
+ init(ctx: IDragConstraintContext): void;
10524
+ apply(followObject: GameObject): void;
10525
+ }
10526
+
10527
+ /** Locks the follow object's world scale to the value captured at drag-start. */
10528
+ export declare class KeepScaleConstraint implements IDragConstraint {
10529
+ private readonly _savedScale;
10530
+ init(ctx: IDragConstraintContext): void;
10531
+ apply(followObject: GameObject): void;
10532
+ }
10533
+
10368
10534
  declare const enum KeyboardEnumType {
10369
10535
  KeyDown = "keydown",
10370
10536
  KeyUp = "keyup",
@@ -11006,7 +11172,7 @@ declare class LowPassFilter {
11006
11172
  setAlpha(alpha: number): void;
11007
11173
  filter(value: number, alpha: number): number;
11008
11174
  lastValue(): number | null;
11009
- reset(value: number): void;
11175
+ reset(value?: number): void;
11010
11176
  }
11011
11177
 
11012
11178
  declare type MagicSkyboxName = "studio" | "blurred-skybox" | "quicklook-ar" | "quicklook";
@@ -15337,6 +15503,24 @@ export declare class OrbitControls extends Component implements ICameraControlle
15337
15503
  bounds: Box3;
15338
15504
  };
15339
15505
 
15506
+ /** Locks the follow object's signed distance from a plane to a value set at drag start.
15507
+ * Owned by {@link XZPlaneDragStrategy} to prevent slow Y drift in the side-view fallback path.
15508
+ * Immune to grab-point projection errors, stale matrixWorld, and epsilon guards.
15509
+ *
15510
+ * When {@link boundsBottomSignedDistFromPivot} is non-zero (set by {@link MultiTouchDragHandler}
15511
+ * for XZPlane scaling), the effective locked height is shifted each frame so the **bottom of the
15512
+ * object's bounds** stays at the height captured at drag start instead of the pivot. */
15513
+ export declare class PlaneHeightLockConstraint implements IDragConstraint {
15514
+ private readonly plane;
15515
+ private _lockedHeight;
15516
+ private _boundsBottomSignedDistFromPivot;
15517
+ /** Current pinch-scale ratio, updated each frame by {@link MultiTouchDragHandler}. */
15518
+ currentScaleRatio: number;
15519
+ constructor(plane: Plane);
15520
+ init(ctx: IDragConstraintContext): void;
15521
+ apply(followObject: GameObject): void;
15522
+ }
15523
+
15340
15524
  /**
15341
15525
  * PlayableDirector is the main component for controlling timelines in Needle Engine.
15342
15526
  * It orchestrates playback of TimelineAssets containing animation, audio, signal,
@@ -16422,11 +16606,14 @@ export declare class OrbitControls extends Component implements ICameraControlle
16422
16606
  * Progress.end("export-usdz");
16423
16607
  *
16424
16608
  * // Auto step with weights:
16609
+ * // A numeric weight applies to the NEXT step — it sets how many steps the
16610
+ * // following auto-step advances. The call it is passed on advances by the
16611
+ * // previously-set weight (1 by default).
16425
16612
  * Progress.start("export-usdz", undefined, (progress) => console.log("Progress: " + progress));
16426
- * Progress.report("export-usdz", { message: "Exporting objects", autoStep: true, totalSteps: 10 });
16427
- * Progress.report("export-usdz", { message: "Exporting object 1", autoStep: 8 }); // will advance to 80% progress
16428
- * Progress.report("export-usdz", "Exporting object 2"); // 90%
16429
- * Progress.report("export-usdz", "Exporting object 3"); // 100%
16613
+ * Progress.report("export-usdz", { message: "Exporting objects", autoStep: true, totalSteps: 10 }); // step 1/10 (10%)
16614
+ * Progress.report("export-usdz", { message: "Heavy step", autoStep: 8 }); // step 2/10 (20%); weight 8 applies to the next step
16615
+ * Progress.report("export-usdz", "Exporting object 2"); // advances by 8 -> step 10/10 (100%)
16616
+ * Progress.report("export-usdz", "Exporting object 3"); // stays at 100%
16430
16617
  *
16431
16618
  * // Child scopes:
16432
16619
  * Progress.start("export-usdz", undefined, (progress) => console.log("Progress: " + progress));
@@ -16458,8 +16645,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
16458
16645
  * Progress.report("export-usdz", { totalSteps: 20, autoStep: true });
16459
16646
  * // show the progress as 50%
16460
16647
  * Progress.report("export-usdz", { progress: 0.5 });
16461
- * // give this step a weight of 20, which changes how progress is calculated. Useful for steps that take longer and/or have child scopes.
16462
- * Progress.report("export-usdz", { message. "Long process", autoStep: 20 });
16648
+ * // give a weight of 20 to the NEXT step (useful for steps that take longer
16649
+ * // and/or have child scopes); the following auto-step will advance by 20.
16650
+ * Progress.report("export-usdz", { message: "Long process", autoStep: 20 });
16463
16651
  * // show the current step and total steps and implicitly calculate progress as 10%
16464
16652
  * Progress.report("export-usdz", { currentStep: 1, totalSteps: 10 });
16465
16653
  */
@@ -16524,6 +16712,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
16524
16712
  /** Adds an entry to the browser history. Internally uses `window.history.pushState` */
16525
16713
  export declare function pushState(title: string, urlParams: URLSearchParams, state?: any): void;
16526
16714
 
16715
+ /* Excluded from this release type: _QchMjAD */
16527
16716
  export { QParticle }
16528
16717
 
16529
16718
  export { QParticleBehaviour }
@@ -17794,6 +17983,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
17794
17983
  FreezeAll = 126
17795
17984
  }
17796
17985
 
17986
+ /* Excluded from this release type: rkHTARX */
17987
+
17797
17988
  /** Use to listen to room networking events like joining a networked room
17798
17989
  * For example: `this.context.connection.beginListen(RoomEvents.JoinedRoom, () => { })`
17799
17990
  * @link https://engine.needle.tools/docs/networking.html#manual-networking
@@ -17815,6 +18006,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
17815
18006
  RoomStateSent = "room-state-sent"
17816
18007
  }
17817
18008
 
18009
+ /**
18010
+ * Flags controlling which rotation axes are frozen by {@link FixedRotationAxesConstraint}.
18011
+ * Values can be combined with the bitwise OR operator (`|`).
18012
+ * @example Freeze X and Z: `RotationAxis.X | RotationAxis.Z`
18013
+ */
18014
+ declare enum RotationAxis {
18015
+ X = 1,
18016
+ Y = 2,
18017
+ Z = 4
18018
+ }
18019
+
17818
18020
  export declare class RotationBySpeedModule {
17819
18021
  enabled: boolean;
17820
18022
  range: Vec2;
@@ -17872,6 +18074,22 @@ export declare class OrbitControls extends Component implements ICameraControlle
17872
18074
  */
17873
18075
  declare type ScaleClipType = "linear" | "spring";
17874
18076
 
18077
+ export declare class ScaleLimitConstraint implements IDragConstraint {
18078
+ min: number;
18079
+ max: number;
18080
+ relativeToInitialScale: boolean;
18081
+ /**
18082
+ * @param min Lower bound. Relative mode: fraction of initial scale. Raw mode: absolute world-scale per axis.
18083
+ * @param max Upper bound. Relative mode: fraction of initial scale. Raw mode: absolute world-scale per axis.
18084
+ * @param relativeToInitialScale When `true`, clamp is relative to `initialWorldScale`. When `false`, each axis is clamped independently.
18085
+ * @param initialWorldScale Reference to the object's world scale captured at drag start. Required for relative mode.
18086
+ */
18087
+ private readonly _initialWorldScale;
18088
+ constructor(min: number, max: number, relativeToInitialScale?: boolean);
18089
+ init(ctx: IDragConstraintContext): void;
18090
+ apply(followObject: GameObject): void;
18091
+ }
18092
+
17875
18093
  export { SceneData }
17876
18094
 
17877
18095
  export declare class SceneLightSettings extends Component {
@@ -18758,6 +18976,22 @@ export declare class OrbitControls extends Component implements ICameraControlle
18758
18976
  */
18759
18977
  htmlSelector: string | null;
18760
18978
  mode: "window";
18979
+ /**
18980
+ * Read the scroll position from the **top-level window** instead of the window Needle Engine
18981
+ * runs in. This matters when the canvas is embedded in an iframe:
18982
+ * - When the page is **not** embedded this has no effect — the top window *is* the current window.
18983
+ * - When embedded in a **same-origin** iframe, the component follows the *host page's* scroll,
18984
+ * which is almost always the intent (an embedded iframe usually isn't scrollable itself).
18985
+ *
18986
+ * Set this to `false` to always follow the engine's own window scroll, e.g. when the iframe
18987
+ * itself is scrollable and you want to follow its own scroll rather than the host's.
18988
+ *
18989
+ * If the top window is **cross-origin** (and therefore inaccessible), the component
18990
+ * transparently falls back to the local window and logs a warning in development —
18991
+ * cross-origin embeds would require a `postMessage` scroll bridge from the host page.
18992
+ * @default true
18993
+ */
18994
+ useTopWindowScroll: boolean;
18761
18995
  /**
18762
18996
  * Event fired when the scroll position changes
18763
18997
  */
@@ -18771,9 +19005,25 @@ export declare class OrbitControls extends Component implements ICameraControlle
18771
19005
  private _appliedValue;
18772
19006
  private _needsUpdate;
18773
19007
  private _firstUpdate;
19008
+ /** The window whose scroll position currently drives this component (resolved from {@link useTopWindowScroll}). */
19009
+ private _scrollWindow;
19010
+ /** The window the `wheel` listener is attached to — kept so we remove it from the same window. */
19011
+ private _wheelTarget;
19012
+ private _crossOriginWarned;
19013
+ private _viewTimelineWarned;
18774
19014
  awake(): void;
18775
19015
  /* Excluded from this release type: onEnable */
18776
19016
  /* Excluded from this release type: onDisable */
19017
+ /* Excluded from this release type: onValidate */
19018
+ /**
19019
+ * Resolves which browsing context's scroll position should drive this component.
19020
+ * Honors {@link useTopWindowScroll}. When the top window is requested but is cross-origin
19021
+ * (and therefore inaccessible) it falls back to the local window and warns once —
19022
+ * cross-origin embeds would need a `postMessage` scroll bridge from the host page.
19023
+ */
19024
+ private resolveScrollWindow;
19025
+ /** (Re)resolves the scroll window and moves the `wheel` listener onto it. */
19026
+ private rebindScrollListener;
18777
19027
  /* Excluded from this release type: lateUpdate */
18778
19028
  private _lastSelectorValue;
18779
19029
  private _lastSelectorElement;
@@ -19590,6 +19840,28 @@ export declare class OrbitControls extends Component implements ICameraControlle
19590
19840
  updateNow(hard: boolean): void;
19591
19841
  }
19592
19842
 
19843
+ /**
19844
+ * Used by {@link SnapToSurfacesDragStrategy} for two-pointer (multi-touch) drags.
19845
+ * Casts a downward ray each frame from the follow object's world position and adjusts
19846
+ * it so the dragged object's bounding-box contact face rests on the detected surface.
19847
+ *
19848
+ * Only injected into the constraint pipeline for multi-touch; the single-pointer path
19849
+ * continues to use {@link SnapToSurfacesDragStrategy.update} (pointer ray + drag plane
19850
+ * intersection) unchanged.
19851
+ */
19852
+ export declare class SnapToSurfaceConstraint implements IDragConstraint {
19853
+ private readonly _context;
19854
+ private _gameObject;
19855
+ private _boundsAtScaleOne;
19856
+ private readonly _t1;
19857
+ private readonly _t2;
19858
+ private readonly _t3;
19859
+ private readonly _t4;
19860
+ constructor(_context: Context);
19861
+ init(ctx: IDragConstraintContext): void;
19862
+ apply(followObject: GameObject): void;
19863
+ }
19864
+
19593
19865
  /** used to find data registered via gltf files e.g. find lightmaps for a Renderer component that were shipped inside a gltf */
19594
19866
  export declare type SourceIdentifier = string;
19595
19867
 
@@ -24844,6 +25116,13 @@ export declare class OrbitControls extends Component implements ICameraControlle
24844
25116
  export { }
24845
25117
 
24846
25118
 
25119
+ declare module 'three' {
25120
+ interface Vector3 {
25121
+ slerp(end: Vector3, t: number): Vector3;
25122
+ }
25123
+ }
25124
+
25125
+
24847
25126
  declare module 'three' {
24848
25127
  interface Object3D {
24849
25128
  get guid(): string | undefined;
@@ -24984,13 +25263,6 @@ declare module 'three' {
24984
25263
  }
24985
25264
 
24986
25265
 
24987
- declare module 'three' {
24988
- interface Vector3 {
24989
- slerp(end: Vector3, t: number): Vector3;
24990
- }
24991
- }
24992
-
24993
-
24994
25266
  declare module 'three' {
24995
25267
  interface SkinnedMesh {
24996
25268
  staticGenerator?: StaticGeometryGenerator;