@vectoriox/iox-builder 1.5.6 → 1.5.8

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, inject, EventEmitter, Output, Input, Directive, ChangeDetectionStrategy, Component, ViewChild, Optional, Inject, InjectionToken, ContentChildren, NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
2
+ import { Injectable, inject, NgZone, EventEmitter, Output, Input, Directive, ChangeDetectionStrategy, Component, ViewChild, Optional, Inject, InjectionToken, ContentChildren, NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
3
3
  import * as i2 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import * as i4$1 from '@angular/forms';
@@ -1243,9 +1243,21 @@ class InteractionEngineService {
1243
1243
  'swiperAutoplayStart', 'swiperAutoplayStop', 'swiperAutoplayPause',
1244
1244
  ]);
1245
1245
  this.instanceRegistry = inject(ComponentInstanceRegistryService);
1246
+ this.ngZone = inject(NgZone);
1247
+ }
1248
+ /**
1249
+ * Run all DOM-manipulation operations (pre-state, observers, animations)
1250
+ * outside the Angular zone so Zone.js does not schedule unnecessary CD ticks
1251
+ * for each RAF/IntersectionObserver/animation callback.
1252
+ * The caller is responsible for calling markForCheck() / refreshSelect() inside
1253
+ * the zone after this returns.
1254
+ */
1255
+ runOutside(fn) {
1256
+ return this.ngZone.runOutsideAngular(fn);
1246
1257
  }
1247
1258
  /** Wire all interactions for a node to its rendered DOM element. */
1248
- attach(node) {
1259
+ attach(node) { this.runOutside(() => this._attach(node)); }
1260
+ _attach(node) {
1249
1261
  const ref = this.overlayService.getNodeRef(node);
1250
1262
  if (!ref)
1251
1263
  return;
@@ -1290,7 +1302,8 @@ class InteractionEngineService {
1290
1302
  this.attached.set(node, cleanups);
1291
1303
  }
1292
1304
  /** Tear down all interaction listeners for a node and reset its animated state. */
1293
- detach(node) {
1305
+ detach(node) { this.runOutside(() => this._detach(node)); }
1306
+ _detach(node) {
1294
1307
  const entries = this.attached.get(node);
1295
1308
  if (!entries)
1296
1309
  return;
@@ -1341,15 +1354,15 @@ class InteractionEngineService {
1341
1354
  }
1342
1355
  /** Re-attach interactions after they have been edited in the panel. */
1343
1356
  refresh(node) {
1344
- this.detach(node);
1345
- this.attach(node);
1357
+ this.runOutside(() => { this._detach(node); this._attach(node); });
1346
1358
  }
1347
1359
  /**
1348
1360
  * Replay all interactions on a node immediately, regardless of their trigger.
1349
1361
  * Used by the builder overlay play button for in-editor animation preview.
1350
1362
  * Uses fill:'none' so the element returns to its natural state after the preview.
1351
1363
  */
1352
- replay(node) {
1364
+ replay(node) { this.runOutside(() => this._replay(node)); }
1365
+ _replay(node) {
1353
1366
  if (!node.interactions?.length)
1354
1367
  return;
1355
1368
  const ref = this.overlayService.getNodeRef(node);
@@ -1379,7 +1392,8 @@ class InteractionEngineService {
1379
1392
  * Used by Swiper (and future components) to dispatch their events into the
1380
1393
  * interaction engine without coupling to the engine's attach/detach lifecycle.
1381
1394
  */
1382
- replayTrigger(nodeId, trigger) {
1395
+ replayTrigger(nodeId, trigger) { this.runOutside(() => this._replayTrigger(nodeId, trigger)); }
1396
+ _replayTrigger(nodeId, trigger) {
1383
1397
  for (const [node] of this.attached) {
1384
1398
  if (node.id !== nodeId)
1385
1399
  continue;
@@ -1393,9 +1407,14 @@ class InteractionEngineService {
1393
1407
  }
1394
1408
  // ── Private ──────────────────────────────────────────────
1395
1409
  attachInteraction(node, ix, element) {
1396
- // In builder mode, automatic triggers don't auto-fire — use the play button instead.
1410
+ // In builder mode, scroll-based and time-based triggers don't auto-fire — use the
1411
+ // play button instead. viewportEnter is skipped because the IntersectionObserver
1412
+ // fires immediately (element is visible in the canvas) and its WAAPI animation +
1413
+ // the overlay ResizeObserver feedback loop triggers NG0103 during synchronize().
1397
1414
  // Click/hover remain active so users can test those interactions on the canvas.
1398
- if (this.isBuilderMode() && (ix.trigger === 'pageLoad' || ix.trigger === 'scrollProgress')) {
1415
+ if (this.isBuilderMode() && (ix.trigger === 'pageLoad' ||
1416
+ ix.trigger === 'scrollProgress' ||
1417
+ ix.trigger === 'viewportEnter')) {
1399
1418
  return () => { };
1400
1419
  }
1401
1420
  switch (ix.trigger) {
@@ -5540,6 +5559,7 @@ class SliderContainerComponent {
5540
5559
  this._orgId = 'default';
5541
5560
  this.instanceRegistry = inject(ComponentInstanceRegistryService);
5542
5561
  this.interactionEngine = inject(InteractionEngineService);
5562
+ this.ngZone = inject(NgZone);
5543
5563
  this.isPreview = !!isPreview;
5544
5564
  }
5545
5565
  ngOnInit() {
@@ -5558,7 +5578,11 @@ class SliderContainerComponent {
5558
5578
  }
5559
5579
  }
5560
5580
  ngAfterViewInit() {
5561
- this._initRafId = requestAnimationFrame(() => this._initSwiper());
5581
+ // Run outside Angular's zone so Swiper's internal ResizeObserver, MutationObserver,
5582
+ // and RAF-based animation loops don't trigger unnecessary CD ticks.
5583
+ this.ngZone.runOutsideAngular(() => {
5584
+ this._initRafId = requestAnimationFrame(() => this._initSwiper());
5585
+ });
5562
5586
  }
5563
5587
  ngOnChanges(changes) {
5564
5588
  if (!this._swiper)
@@ -5586,7 +5610,9 @@ class SliderContainerComponent {
5586
5610
  const hasConfigChange = Object.keys(changes).some(k => relevantKeys.has(k));
5587
5611
  if (hasConfigChange) {
5588
5612
  this._destroySwiper();
5589
- this._initRafId = requestAnimationFrame(() => this._initSwiper());
5613
+ this.ngZone.runOutsideAngular(() => {
5614
+ this._initRafId = requestAnimationFrame(() => this._initSwiper());
5615
+ });
5590
5616
  }
5591
5617
  }
5592
5618
  ngOnDestroy() {
@@ -5601,9 +5627,10 @@ class SliderContainerComponent {
5601
5627
  if (this._source)
5602
5628
  return; // repeat mode: drops disabled, slides come from data source
5603
5629
  this.dragEngine.handleDrop(this.children, event, this.dropListId, this.cdr);
5604
- // Sync Swiper's internal slide list after drag-drop reorder
5605
5630
  if (this._swiper) {
5606
- requestAnimationFrame(() => this._swiper?.update());
5631
+ this.ngZone.runOutsideAngular(() => {
5632
+ requestAnimationFrame(() => this._swiper?.update());
5633
+ });
5607
5634
  }
5608
5635
  }
5609
5636
  // ── Data fetching ───────────────────────────────────────────────────────────
@@ -5678,7 +5705,9 @@ class SliderContainerComponent {
5678
5705
  }
5679
5706
  _scheduleReinit() {
5680
5707
  this._destroySwiper();
5681
- this._initRafId = requestAnimationFrame(() => this._initSwiper());
5708
+ this.ngZone.runOutsideAngular(() => {
5709
+ this._initRafId = requestAnimationFrame(() => this._initSwiper());
5710
+ });
5682
5711
  }
5683
5712
  // ── Swiper lifecycle ────────────────────────────────────────────────────────
5684
5713
  async _initSwiper() {