@vectoriox/iox-builder 1.7.7 → 1.7.9
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.
|
@@ -1283,9 +1283,13 @@ class InteractionEngineService {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
/** Wire all interactions for a node to its rendered DOM element. */
|
|
1285
1285
|
attach(node) { this.runOutside(() => this._attach(node)); }
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1286
|
+
/** Attach interactions to a node whose element is NOT overlay-registered — e.g. repeater/slider
|
|
1287
|
+
* PREVIEW CLONES, which are non-selectable but must still animate (parity with the SSR runtime,
|
|
1288
|
+
* which animates every repeated row). See RenderDirective. */
|
|
1289
|
+
attachTo(node, element) { this.runOutside(() => this._attach(node, element)); }
|
|
1290
|
+
_attach(node, elementOverride) {
|
|
1291
|
+
const element = elementOverride ?? this.overlayService.getNodeRef(node)?.element;
|
|
1292
|
+
if (!element)
|
|
1289
1293
|
return;
|
|
1290
1294
|
const inBuilder = this.isBuilderMode();
|
|
1291
1295
|
// Apply any pre-states queued for THIS element by earlier-registered nodes.
|
|
@@ -1294,7 +1298,7 @@ class InteractionEngineService {
|
|
|
1294
1298
|
const pending = this.pendingPreStates.get(node.id);
|
|
1295
1299
|
if (pending) {
|
|
1296
1300
|
for (const action of pending) {
|
|
1297
|
-
this.applyPreState(
|
|
1301
|
+
this.applyPreState(element, action);
|
|
1298
1302
|
}
|
|
1299
1303
|
this.pendingPreStates.delete(node.id);
|
|
1300
1304
|
}
|
|
@@ -1312,7 +1316,7 @@ class InteractionEngineService {
|
|
|
1312
1316
|
if (!skipPreState) {
|
|
1313
1317
|
for (const action of ix.actions) {
|
|
1314
1318
|
if (this.ENTRANCE_TYPES.has(action.type)) {
|
|
1315
|
-
const target = this.resolveTarget(node, action);
|
|
1319
|
+
const target = this.resolveTarget(node, action, element);
|
|
1316
1320
|
if (target) {
|
|
1317
1321
|
this.applyPreState(target, action);
|
|
1318
1322
|
}
|
|
@@ -1324,7 +1328,7 @@ class InteractionEngineService {
|
|
|
1324
1328
|
}
|
|
1325
1329
|
}
|
|
1326
1330
|
}
|
|
1327
|
-
const cleanup = this.attachInteraction(node, ix,
|
|
1331
|
+
const cleanup = this.attachInteraction(node, ix, element);
|
|
1328
1332
|
cleanups.push({ node, interaction: ix, cleanup });
|
|
1329
1333
|
}
|
|
1330
1334
|
this.attached.set(node, cleanups);
|
|
@@ -1628,10 +1632,9 @@ class InteractionEngineService {
|
|
|
1628
1632
|
break;
|
|
1629
1633
|
}
|
|
1630
1634
|
}
|
|
1631
|
-
resolveTarget(ownerNode, action) {
|
|
1632
|
-
if (action.target === 'self') {
|
|
1633
|
-
|
|
1634
|
-
return ref?.element ?? null;
|
|
1635
|
+
resolveTarget(ownerNode, action, selfEl) {
|
|
1636
|
+
if (action.target === 'self' || !action.target) {
|
|
1637
|
+
return selfEl ?? this.overlayService.getNodeRef(ownerNode)?.element ?? null;
|
|
1635
1638
|
}
|
|
1636
1639
|
// Find by node ID
|
|
1637
1640
|
for (const [n, ref] of this.overlayService.getAllNodeEntries()) {
|
|
@@ -3014,6 +3017,23 @@ class RenderDirective {
|
|
|
3014
3017
|
* Returns { element, node } if found, or null if the target is outside
|
|
3015
3018
|
* all known builder components (e.g. the canvas background).
|
|
3016
3019
|
*/
|
|
3020
|
+
/**
|
|
3021
|
+
* The nearest ancestor node's cssId, read from the DOM `iox-node-{id}` classes (NOT the overlay
|
|
3022
|
+
* registry — at state-restore time the parent isn't registered yet, since it registers only
|
|
3023
|
+
* AFTER rendering its children). Used to key relational (parent-hover) rules. (issue #1)
|
|
3024
|
+
*/
|
|
3025
|
+
resolveParentNodeId(childEl) {
|
|
3026
|
+
let el = childEl?.parentElement ?? null;
|
|
3027
|
+
while (el) {
|
|
3028
|
+
for (let i = 0; i < el.classList.length; i++) {
|
|
3029
|
+
const c = el.classList[i];
|
|
3030
|
+
if (c.startsWith('iox-node-'))
|
|
3031
|
+
return c.slice('iox-node-'.length);
|
|
3032
|
+
}
|
|
3033
|
+
el = el.parentElement;
|
|
3034
|
+
}
|
|
3035
|
+
return undefined;
|
|
3036
|
+
}
|
|
3017
3037
|
findParentNodeElement(target) {
|
|
3018
3038
|
let el = target;
|
|
3019
3039
|
while (el) {
|
|
@@ -3078,9 +3098,24 @@ class RenderDirective {
|
|
|
3078
3098
|
this.styleRegistry.upsert(cssId, composedBase);
|
|
3079
3099
|
// Restore per-state overrides saved from a previous session.
|
|
3080
3100
|
if (node.stateStyles) {
|
|
3101
|
+
const childEl = componentRef.location?.nativeElement;
|
|
3081
3102
|
for (const state of Object.keys(node.stateStyles)) {
|
|
3082
3103
|
const stateMap = node.stateStyles[state];
|
|
3083
|
-
if (stateMap
|
|
3104
|
+
if (!stateMap || !Object.keys(stateMap).length)
|
|
3105
|
+
continue;
|
|
3106
|
+
if (RELATIONAL_STATES.includes(state)) {
|
|
3107
|
+
// Relational states (parent-hover) compile to
|
|
3108
|
+
// `.iox-node-{parentId}:hover .iox-node-{childId}` — they need the CURRENT parent id.
|
|
3109
|
+
// Resolve it from the DOM so the rule re-resolves after a cross-container MOVE (which
|
|
3110
|
+
// re-renders the child). If it can't be resolved yet (initial load: the parent registers
|
|
3111
|
+
// its class only after rendering its children), SKIP — do NOT clobber the correct rule
|
|
3112
|
+
// that page-ui's applyStateEnhancements already produced from the node tree. (issue #1)
|
|
3113
|
+
const relativeToId = this.resolveParentNodeId(childEl);
|
|
3114
|
+
if (!relativeToId)
|
|
3115
|
+
continue;
|
|
3116
|
+
this.styleRegistry.upsert(cssId, composeVirtualTraits(stateMap, initialStyle), state, relativeToId);
|
|
3117
|
+
}
|
|
3118
|
+
else {
|
|
3084
3119
|
this.styleRegistry.upsert(cssId, composeVirtualTraits(stateMap, initialStyle), state);
|
|
3085
3120
|
}
|
|
3086
3121
|
}
|
|
@@ -3176,11 +3211,15 @@ class RenderDirective {
|
|
|
3176
3211
|
this.overlayService.triggerContextMenu(event.clientX, event.clientY);
|
|
3177
3212
|
});
|
|
3178
3213
|
}
|
|
3179
|
-
// Wire up interactions (animations) after the element is in the DOM.
|
|
3180
|
-
//
|
|
3214
|
+
// Wire up interactions (animations) after the element is in the DOM. Preview clones are
|
|
3215
|
+
// non-selectable (not overlay-registered) but MUST still animate — parity with the SSR
|
|
3216
|
+
// runtime, which animates every repeated row — so attach by element (issue #2).
|
|
3181
3217
|
if (!isPreviewClone) {
|
|
3182
3218
|
this.interactionEngine.attach(node);
|
|
3183
3219
|
}
|
|
3220
|
+
else if (nativeEl) {
|
|
3221
|
+
this.interactionEngine.attachTo(node, nativeEl);
|
|
3222
|
+
}
|
|
3184
3223
|
}
|
|
3185
3224
|
/** Try setInput(); fall back to direct assignment for non-@Input properties. */
|
|
3186
3225
|
safeSetInput(ref, name, value) {
|