@vectoriox/iox-builder 1.4.44 → 1.4.45

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.
@@ -1280,9 +1280,13 @@ class InteractionEngineService {
1280
1280
  }
1281
1281
  // ── Triggers ─────────────────────────────────────────────
1282
1282
  attachPageLoad(node, ix, element) {
1283
- // Execute immediately (next microtask to let rendering settle)
1284
1283
  const timer = setTimeout(() => {
1285
- this.runActions(node, ix.actions);
1284
+ if (this.hasPreStatedAncestor(element)) {
1285
+ this.deferUntilVisible(element, () => this.runActions(node, ix.actions));
1286
+ }
1287
+ else {
1288
+ this.runActions(node, ix.actions);
1289
+ }
1286
1290
  }, 50);
1287
1291
  return () => clearTimeout(timer);
1288
1292
  }
@@ -1294,6 +1298,17 @@ class InteractionEngineService {
1294
1298
  const key = ix.id;
1295
1299
  if (ix.actions.some(a => a.once) && firedSet.has(key))
1296
1300
  continue;
1301
+ // Element is in viewport but may be inside a still-fading parent.
1302
+ // Defer until all pre-stated ancestors finish their entrance animation.
1303
+ if (this.hasPreStatedAncestor(element)) {
1304
+ this.deferUntilVisible(element, () => {
1305
+ if (ix.actions.some(a => a.once) && firedSet.has(key))
1306
+ return;
1307
+ firedSet.add(key);
1308
+ this.runActions(node, ix.actions);
1309
+ });
1310
+ continue;
1311
+ }
1297
1312
  firedSet.add(key);
1298
1313
  this.runActions(node, ix.actions);
1299
1314
  }
@@ -1302,6 +1317,28 @@ class InteractionEngineService {
1302
1317
  observer.observe(element);
1303
1318
  return () => observer.disconnect();
1304
1319
  }
1320
+ /** Returns true if any DOM ancestor of element is currently faded out via pre-state. */
1321
+ hasPreStatedAncestor(element) {
1322
+ let el = element.parentElement;
1323
+ while (el && el !== document.body) {
1324
+ if (this.preStatedElements.has(el))
1325
+ return true;
1326
+ el = el.parentElement;
1327
+ }
1328
+ return false;
1329
+ }
1330
+ /** Polls via RAF until no ancestor is in pre-state, then fires callback. */
1331
+ deferUntilVisible(element, callback) {
1332
+ const poll = () => {
1333
+ if (!this.hasPreStatedAncestor(element)) {
1334
+ callback();
1335
+ }
1336
+ else {
1337
+ requestAnimationFrame(poll);
1338
+ }
1339
+ };
1340
+ requestAnimationFrame(poll);
1341
+ }
1305
1342
  attachClick(node, ix, element) {
1306
1343
  const handler = () => {
1307
1344
  if (ix.reverseActions?.length) {
@@ -1369,9 +1406,11 @@ class InteractionEngineService {
1369
1406
  });
1370
1407
  if (this.ENTRANCE_TYPES.has(action.type)) {
1371
1408
  // Once the entrance animation finishes the element is fully visible —
1372
- // restore pointer events so it can be interacted with.
1409
+ // restore pointer events and clear the pre-state tracker so children
1410
+ // waiting on this ancestor can fire their deferred animations.
1373
1411
  anim.finished.then(() => {
1374
1412
  element.style.removeProperty('pointer-events');
1413
+ this.preStatedElements.delete(element);
1375
1414
  }).catch(() => { });
1376
1415
  }
1377
1416
  else if (this.EXIT_TYPES.has(action.type)) {