@vectoriox/iox-builder 1.4.45 → 1.4.47
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.
|
@@ -1150,8 +1150,9 @@ class InteractionEngineService {
|
|
|
1150
1150
|
const ref = this.overlayService.getNodeRef(node);
|
|
1151
1151
|
if (!ref)
|
|
1152
1152
|
return;
|
|
1153
|
-
|
|
1154
|
-
//
|
|
1153
|
+
const inBuilder = this.isBuilderMode();
|
|
1154
|
+
// Apply any pre-states queued for THIS element by earlier-registered nodes.
|
|
1155
|
+
// Pending entries are only added when appropriate (see loop below), so always consume.
|
|
1155
1156
|
if (node.id) {
|
|
1156
1157
|
const pending = this.pendingPreStates.get(node.id);
|
|
1157
1158
|
if (pending) {
|
|
@@ -1165,21 +1166,24 @@ class InteractionEngineService {
|
|
|
1165
1166
|
return;
|
|
1166
1167
|
const cleanups = [];
|
|
1167
1168
|
for (const ix of node.interactions) {
|
|
1168
|
-
//
|
|
1169
|
-
//
|
|
1170
|
-
//
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1169
|
+
// Pre-state: hide target elements before their entrance animation fires.
|
|
1170
|
+
// In builder mode, skip auto-fire triggers (pageLoad, viewportEnter, scrollProgress)
|
|
1171
|
+
// because those triggers are also suppressed in builder mode — targets would stay
|
|
1172
|
+
// permanently hidden. Manual triggers (click, hover) are kept active on the canvas,
|
|
1173
|
+
// so their targets should start in the correct pre-state.
|
|
1174
|
+
const skipPreState = inBuilder && ix.trigger !== 'click' && ix.trigger !== 'hover';
|
|
1175
|
+
if (!skipPreState) {
|
|
1176
|
+
for (const action of ix.actions) {
|
|
1177
|
+
if (this.ENTRANCE_TYPES.has(action.type)) {
|
|
1178
|
+
const target = this.resolveTarget(node, action);
|
|
1179
|
+
if (target) {
|
|
1180
|
+
this.applyPreState(target, action);
|
|
1181
|
+
}
|
|
1182
|
+
else if (action.target && action.target !== 'self') {
|
|
1183
|
+
const list = this.pendingPreStates.get(action.target) ?? [];
|
|
1184
|
+
list.push(action);
|
|
1185
|
+
this.pendingPreStates.set(action.target, list);
|
|
1186
|
+
}
|
|
1183
1187
|
}
|
|
1184
1188
|
}
|
|
1185
1189
|
}
|
|
@@ -1251,10 +1255,23 @@ class InteractionEngineService {
|
|
|
1251
1255
|
replay(node) {
|
|
1252
1256
|
if (!node.interactions?.length)
|
|
1253
1257
|
return;
|
|
1254
|
-
// Cancel any in-progress animations first to reset the element cleanly.
|
|
1255
1258
|
const ref = this.overlayService.getNodeRef(node);
|
|
1256
1259
|
if (ref) {
|
|
1257
1260
|
ref.element.getAnimations().forEach(a => a.cancel());
|
|
1261
|
+
// Clear any leftover inline styles so the pre-state applies cleanly.
|
|
1262
|
+
this.clearInlineAnimationStyles(ref.element);
|
|
1263
|
+
}
|
|
1264
|
+
// In builder mode pre-state is never applied on attach, so apply it now
|
|
1265
|
+
// to give an accurate hidden→visible preview. It is cleaned up via
|
|
1266
|
+
// executeAction's anim.finished handler once the animation completes.
|
|
1267
|
+
for (const ix of node.interactions) {
|
|
1268
|
+
for (const action of ix.actions) {
|
|
1269
|
+
if (this.ENTRANCE_TYPES.has(action.type)) {
|
|
1270
|
+
const target = this.resolveTarget(node, action);
|
|
1271
|
+
if (target)
|
|
1272
|
+
this.applyPreState(target, action);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1258
1275
|
}
|
|
1259
1276
|
for (const ix of node.interactions) {
|
|
1260
1277
|
this.runActions(node, ix.actions);
|
|
@@ -1262,6 +1279,11 @@ class InteractionEngineService {
|
|
|
1262
1279
|
}
|
|
1263
1280
|
// ── Private ──────────────────────────────────────────────
|
|
1264
1281
|
attachInteraction(node, ix, element) {
|
|
1282
|
+
// In builder mode, automatic triggers don't auto-fire — use the play button instead.
|
|
1283
|
+
// Click/hover remain active so users can test those interactions on the canvas.
|
|
1284
|
+
if (this.isBuilderMode() && (ix.trigger === 'pageLoad' || ix.trigger === 'viewportEnter' || ix.trigger === 'scrollProgress')) {
|
|
1285
|
+
return () => { };
|
|
1286
|
+
}
|
|
1265
1287
|
switch (ix.trigger) {
|
|
1266
1288
|
case 'pageLoad':
|
|
1267
1289
|
return this.attachPageLoad(node, ix, element);
|
|
@@ -1317,6 +1339,9 @@ class InteractionEngineService {
|
|
|
1317
1339
|
observer.observe(element);
|
|
1318
1340
|
return () => observer.disconnect();
|
|
1319
1341
|
}
|
|
1342
|
+
isBuilderMode() {
|
|
1343
|
+
return document.body.classList.contains('builder-active');
|
|
1344
|
+
}
|
|
1320
1345
|
/** Returns true if any DOM ancestor of element is currently faded out via pre-state. */
|
|
1321
1346
|
hasPreStatedAncestor(element) {
|
|
1322
1347
|
let el = element.parentElement;
|
|
@@ -1405,12 +1430,13 @@ class InteractionEngineService {
|
|
|
1405
1430
|
fill: 'both',
|
|
1406
1431
|
});
|
|
1407
1432
|
if (this.ENTRANCE_TYPES.has(action.type)) {
|
|
1408
|
-
// Once the entrance animation finishes the element is fully visible —
|
|
1409
|
-
// restore pointer events and clear the pre-state tracker so children
|
|
1410
|
-
// waiting on this ancestor can fire their deferred animations.
|
|
1411
1433
|
anim.finished.then(() => {
|
|
1412
1434
|
element.style.removeProperty('pointer-events');
|
|
1413
1435
|
this.preStatedElements.delete(element);
|
|
1436
|
+
// Builder: clear inline pre-state so cancelling animations later
|
|
1437
|
+
// doesn't leave the element invisible after a play preview.
|
|
1438
|
+
if (this.isBuilderMode())
|
|
1439
|
+
this.clearInlineAnimationStyles(element);
|
|
1414
1440
|
}).catch(() => { });
|
|
1415
1441
|
}
|
|
1416
1442
|
else if (this.EXIT_TYPES.has(action.type)) {
|