@vectojs/core 1.27.0 → 1.27.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/dist/index.js CHANGED
@@ -3640,10 +3640,24 @@ var Scene = (_class7 = class _Scene {
3640
3640
  * resume when it returns — instead of running the full update/render every
3641
3641
  * frame for a scene nobody can see. No-op (stays "on screen") where
3642
3642
  * `IntersectionObserver` is unavailable, so SSR/jsdom behavior is unchanged.
3643
+ *
3644
+ * Also a no-op for a canvas that is not in the document. An offscreen canvas
3645
+ * used purely as a texture source — `@vectojs/three`'s `ThreeAdapter` wraps
3646
+ * one in a `CanvasTexture`, and the same pattern shows up in any
3647
+ * render-to-texture setup — is never appended anywhere, and an
3648
+ * `IntersectionObserver` reports a detached element as not intersecting.
3649
+ * Observing it would therefore set `_canvasOnScreen = false` on the first
3650
+ * callback, and since {@link loop} returns without rescheduling in that
3651
+ * state, the loop would stop permanently: the only resume path is an
3652
+ * `isIntersecting` transition, which a detached element can never produce.
3653
+ * Such a canvas is always "visible" as far as this scene is concerned,
3654
+ * because whether its output is seen depends on the consumer sampling the
3655
+ * texture, which this scene cannot observe.
3643
3656
  */
3644
3657
  watchCanvasVisibility() {
3645
3658
  if (this._canvasObserver || typeof IntersectionObserver === "undefined") return;
3646
3659
  if (!this.canvas || typeof this.canvas.getBoundingClientRect !== "function") return;
3660
+ if (this.canvas.isConnected === false) return;
3647
3661
  this._canvasObserver = new IntersectionObserver((entries) => {
3648
3662
  const entry = entries[entries.length - 1];
3649
3663
  if (!entry) return;
package/dist/index.mjs CHANGED
@@ -3639,10 +3639,24 @@ var Scene = class _Scene {
3639
3639
  * resume when it returns — instead of running the full update/render every
3640
3640
  * frame for a scene nobody can see. No-op (stays "on screen") where
3641
3641
  * `IntersectionObserver` is unavailable, so SSR/jsdom behavior is unchanged.
3642
+ *
3643
+ * Also a no-op for a canvas that is not in the document. An offscreen canvas
3644
+ * used purely as a texture source — `@vectojs/three`'s `ThreeAdapter` wraps
3645
+ * one in a `CanvasTexture`, and the same pattern shows up in any
3646
+ * render-to-texture setup — is never appended anywhere, and an
3647
+ * `IntersectionObserver` reports a detached element as not intersecting.
3648
+ * Observing it would therefore set `_canvasOnScreen = false` on the first
3649
+ * callback, and since {@link loop} returns without rescheduling in that
3650
+ * state, the loop would stop permanently: the only resume path is an
3651
+ * `isIntersecting` transition, which a detached element can never produce.
3652
+ * Such a canvas is always "visible" as far as this scene is concerned,
3653
+ * because whether its output is seen depends on the consumer sampling the
3654
+ * texture, which this scene cannot observe.
3642
3655
  */
3643
3656
  watchCanvasVisibility() {
3644
3657
  if (this._canvasObserver || typeof IntersectionObserver === "undefined") return;
3645
3658
  if (!this.canvas || typeof this.canvas.getBoundingClientRect !== "function") return;
3659
+ if (this.canvas.isConnected === false) return;
3646
3660
  this._canvasObserver = new IntersectionObserver((entries) => {
3647
3661
  const entry = entries[entries.length - 1];
3648
3662
  if (!entry) return;
@@ -1168,6 +1168,19 @@ export declare class Scene {
1168
1168
  * resume when it returns — instead of running the full update/render every
1169
1169
  * frame for a scene nobody can see. No-op (stays "on screen") where
1170
1170
  * `IntersectionObserver` is unavailable, so SSR/jsdom behavior is unchanged.
1171
+ *
1172
+ * Also a no-op for a canvas that is not in the document. An offscreen canvas
1173
+ * used purely as a texture source — `@vectojs/three`'s `ThreeAdapter` wraps
1174
+ * one in a `CanvasTexture`, and the same pattern shows up in any
1175
+ * render-to-texture setup — is never appended anywhere, and an
1176
+ * `IntersectionObserver` reports a detached element as not intersecting.
1177
+ * Observing it would therefore set `_canvasOnScreen = false` on the first
1178
+ * callback, and since {@link loop} returns without rescheduling in that
1179
+ * state, the loop would stop permanently: the only resume path is an
1180
+ * `isIntersecting` transition, which a detached element can never produce.
1181
+ * Such a canvas is always "visible" as far as this scene is concerned,
1182
+ * because whether its output is seen depends on the consumer sampling the
1183
+ * texture, which this scene cannot observe.
1171
1184
  */
1172
1185
  private watchCanvasVisibility;
1173
1186
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectojs/core",
3
- "version": "1.27.0",
3
+ "version": "1.27.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },