@vectoriox/iox-builder 1.4.71 → 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,12 +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: skip pre-state for all auto-fire triggers (pageLoad,
1262
- // viewportEnter, scrollProgress) — they would stay permanently hidden if
1263
- // the trigger is suppressed or the canvas scroll container doesn't expose
1264
- // a standard browser viewport for IntersectionObserver.
1265
- // Click/hover triggers are always active so their pre-state is applied.
1266
- const skipPreState = inBuilder && ix.trigger !== 'click' && ix.trigger !== 'hover';
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');
1267
1275
  if (!skipPreState) {
1268
1276
  for (const action of ix.actions) {
1269
1277
  if (this.ENTRANCE_TYPES.has(action.type)) {
@@ -1423,6 +1431,9 @@ class InteractionEngineService {
1423
1431
  }
1424
1432
  attachViewportEnter(node, ix, element) {
1425
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;
1426
1437
  const observer = new IntersectionObserver((entries) => {
1427
1438
  for (const entry of entries) {
1428
1439
  if (entry.isIntersecting) {
@@ -1444,7 +1455,7 @@ class InteractionEngineService {
1444
1455
  this.runActions(node, ix.actions);
1445
1456
  }
1446
1457
  }
1447
- }, { threshold: 0.1 });
1458
+ }, { threshold: 0.1, root });
1448
1459
  observer.observe(element);
1449
1460
  return () => observer.disconnect();
1450
1461
  }
@@ -3848,6 +3859,9 @@ class BuilderComponent {
3848
3859
  // (Not previewScrollRef which is the Lenis eventsTarget — dispatching there
3849
3860
  // would cause Lenis to re-fire its scroll handler → infinite loop.)
3850
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);
3851
3865
  // Register the root canvas as a dropzone.
3852
3866
  const canvasEl = document.getElementById('canvas-preview');
3853
3867
  if (canvasEl) {
@@ -3876,6 +3890,7 @@ class BuilderComponent {
3876
3890
  this.previewFrameRo?.disconnect();
3877
3891
  this.overlayService.setContainer(null);
3878
3892
  this.overlayService.setScrollContainer(null);
3893
+ this.overlayService.setIntersectionRoot(null);
3879
3894
  const canvasEl = document.getElementById('canvas-preview');
3880
3895
  if (canvasEl) {
3881
3896
  this.dragEngine.unregisterDropzone('canvas-preview', canvasEl);