@vectoriox/iox-builder 1.4.70 → 1.4.72

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.
@@ -209,6 +209,7 @@ class OverlayService {
209
209
  this.select$ = this.selectSubject.asObservable();
210
210
  this.containerElement = null;
211
211
  this.scrollContainerElement = null;
212
+ this.intersectionRootElement = null;
212
213
  /** Emits the scroll container element whenever it is registered. */
213
214
  this.scrollContainer$ = new Subject();
214
215
  /** Emits cursor coords when a canvas element is right-clicked. */
@@ -232,6 +233,13 @@ class OverlayService {
232
233
  getScrollContainer() {
233
234
  return this.scrollContainerElement;
234
235
  }
236
+ /** The clipping container used as IntersectionObserver root in builder mode (.preview-scroll). */
237
+ setIntersectionRoot(el) {
238
+ this.intersectionRootElement = el;
239
+ }
240
+ getIntersectionRoot() {
241
+ return this.intersectionRootElement;
242
+ }
235
243
  /**
236
244
  * Resolve the inner styled element.
237
245
  * Builder components apply [ngStyle] on their first child element,
@@ -1258,11 +1266,12 @@ class InteractionEngineService {
1258
1266
  const cleanups = [];
1259
1267
  for (const ix of node.interactions) {
1260
1268
  // Pre-state: hide target elements before their entrance animation fires.
1261
- // In builder mode, pageLoad and scrollProgress are suppressed so their
1262
- // targets must not be pre-hidden (would stay permanently hidden).
1263
- // viewportEnter IS active in builder mode so its pre-state is applied normally.
1264
- // Click/hover triggers are always active.
1265
- const skipPreState = inBuilder && ix.trigger === 'pageLoad' || inBuilder && ix.trigger === 'scrollProgress';
1269
+ // In builder mode: skip pre-state only for pageLoad and scrollProgress —
1270
+ // those triggers are suppressed in the canvas so elements would stay hidden.
1271
+ // viewportEnter uses IntersectionObserver with .preview-scroll as its root,
1272
+ // so it fires correctly when the canvas scrolls — pre-state is safe to apply.
1273
+ // Click/hover triggers are always active so their pre-state is applied too.
1274
+ const skipPreState = inBuilder && (ix.trigger === 'pageLoad' || ix.trigger === 'scrollProgress');
1266
1275
  if (!skipPreState) {
1267
1276
  for (const action of ix.actions) {
1268
1277
  if (this.ENTRANCE_TYPES.has(action.type)) {
@@ -1422,6 +1431,9 @@ class InteractionEngineService {
1422
1431
  }
1423
1432
  attachViewportEnter(node, ix, element) {
1424
1433
  const firedSet = new Set();
1434
+ // In builder mode, use .preview-scroll as root so IntersectionObserver fires
1435
+ // against the canvas clipping container (scrollTop-driven) rather than the browser viewport.
1436
+ const root = this.overlayService.getIntersectionRoot() ?? null;
1425
1437
  const observer = new IntersectionObserver((entries) => {
1426
1438
  for (const entry of entries) {
1427
1439
  if (entry.isIntersecting) {
@@ -1443,7 +1455,7 @@ class InteractionEngineService {
1443
1455
  this.runActions(node, ix.actions);
1444
1456
  }
1445
1457
  }
1446
- }, { threshold: 0.1 });
1458
+ }, { threshold: 0.1, root });
1447
1459
  observer.observe(element);
1448
1460
  return () => observer.disconnect();
1449
1461
  }
@@ -3847,6 +3859,9 @@ class BuilderComponent {
3847
3859
  // (Not previewScrollRef which is the Lenis eventsTarget — dispatching there
3848
3860
  // would cause Lenis to re-fire its scroll handler → infinite loop.)
3849
3861
  this.overlayService.setScrollContainer(this.lenisContentRef?.nativeElement || null);
3862
+ // .preview-scroll is the Lenis clipping container (overflow:hidden, scrollTop changes).
3863
+ // Used as IntersectionObserver root so viewportEnter triggers fire correctly on canvas scroll.
3864
+ this.overlayService.setIntersectionRoot(this.previewScrollRef?.nativeElement || null);
3850
3865
  // Register the root canvas as a dropzone.
3851
3866
  const canvasEl = document.getElementById('canvas-preview');
3852
3867
  if (canvasEl) {
@@ -3875,6 +3890,7 @@ class BuilderComponent {
3875
3890
  this.previewFrameRo?.disconnect();
3876
3891
  this.overlayService.setContainer(null);
3877
3892
  this.overlayService.setScrollContainer(null);
3893
+ this.overlayService.setIntersectionRoot(null);
3878
3894
  const canvasEl = document.getElementById('canvas-preview');
3879
3895
  if (canvasEl) {
3880
3896
  this.dragEngine.unregisterDropzone('canvas-preview', canvasEl);