@vectoriox/iox-builder 11.35.0 → 11.36.0

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.
@@ -29,7 +29,7 @@ import * as i1 from '@angular/common/http';
29
29
  import { SAMPLE_PRODUCT, productInScope, simulatedCartTransport, storefrontCatalog, SAMPLE_STUDIO, SAMPLE_CART_LINE, SAMPLE_SWATCHES } from '@vectoriox/iox-ui/commerce-core';
30
30
  import { POPOVER_ACTION_TYPE_SET, TOAST_ACTION_TYPES, itemActionOf, BEHAVIOUR_ACTION_TYPES, SHOP_ACTION_TYPES, ACCOUNT_ACTION_TYPES, SERVER_ELEMENT_ACTION_TYPES, CONSENT_ACTION_TYPES, opensAtClickedItem, openedDialogId, DIALOG_CLOSING_ATTRIBUTE, cancelExit, runExitMotion, dialogOpenersSelector, dialogDomId, revealOrigin, holdClosedWhile, revealOriginStyle, popoverOpenersSelector, popoverDomId } from '@vectoriox/iox-ui/actions-core';
31
31
  import { NavRole, navShapeBreakpoint, isScrubbedEntrance, ENTRANCE_TRIGGER, entranceInteraction, entranceAction, sectionEntrances, EntrancePart } from '@vectoriox/iox-ui/generation-core';
32
- import { ScrollDriver, syncSceneAttributes, SCENE_LAND_TRIGGER, onSceneLand, buildSceneRecipe } from '@vectoriox/iox-ui/scene-core';
32
+ import { ScrollDriver, syncSceneAttributes, SCENE_LAND_TRIGGER, onSceneLand, watchArrival, arrivedWithin, buildSceneRecipe } from '@vectoriox/iox-ui/scene-core';
33
33
  import Lenis from 'lenis';
34
34
  import { simulatedSiteAuthTransport } from '@vectoriox/iox-ui/identity-core';
35
35
  import Moveable from 'moveable';
@@ -5096,21 +5096,17 @@ class InteractionEngineService {
5096
5096
  firedSet.add(key);
5097
5097
  this.runActions(node, ix.actions, element);
5098
5098
  };
5099
- // IntersectionObserver with no root uses the browser viewport.
5100
- // It respects overflow:hidden clipping from .preview-scroll so it fires
5101
- // correctly as Lenis scrolls (Lenis changes scrollTop on .preview-scroll).
5102
- const observer = new IntersectionObserver((entries) => {
5103
- for (const entry of entries) {
5104
- if (entry.isIntersecting) {
5105
- cleanup();
5106
- fire();
5107
- }
5108
- }
5109
- }, { threshold: 0.1 });
5110
- observer.observe(element);
5099
+ // The moment the element ARRIVES is shared scene-core `watchArrival`'s (a tenth of it, or a tenth of the screen,
5100
+ // shows it — iox-ui#156), the same rule the live engine plays by. With no root it asks the browser viewport and
5101
+ // respects the overflow clipping of .preview-scroll, so it fires as Lenis scrolls (Lenis changes its scrollTop).
5102
+ // No IntersectionObserver at all (an old browser): the entrance plays at once, never an empty band.
5103
+ const unwatch = watchArrival(element, arrived => { if (arrived) {
5104
+ cleanup();
5105
+ fire();
5106
+ } });
5111
5107
  // Builder: also listen to Lenis scroll events on .preview-lenis-content
5112
5108
  // as a fallback in case IntersectionObserver misses elements behind a
5113
- // CSS transform (scale) on iox-page-component.
5109
+ // CSS transform (scale) on iox-page-component — the same rule, read off the canvas's box (scene-core `arrivedWithin`).
5114
5110
  const lenisEl = this.overlayService.getScrollContainer();
5115
5111
  let scrollFired = false;
5116
5112
  const onScroll = () => {
@@ -5119,11 +5115,7 @@ class InteractionEngineService {
5119
5115
  const rootEl = this.overlayService.getIntersectionRoot();
5120
5116
  if (!rootEl)
5121
5117
  return;
5122
- const rootRect = rootEl.getBoundingClientRect();
5123
- const elRect = element.getBoundingClientRect();
5124
- const overlapH = Math.min(elRect.bottom, rootRect.bottom) - Math.max(elRect.top, rootRect.top);
5125
- const elH = elRect.bottom - elRect.top;
5126
- if (elH > 0 && overlapH / elH >= 0.1) {
5118
+ if (arrivedWithin(element.getBoundingClientRect(), rootEl.getBoundingClientRect())) {
5127
5119
  scrollFired = true;
5128
5120
  cleanup();
5129
5121
  fire();
@@ -5132,11 +5124,15 @@ class InteractionEngineService {
5132
5124
  if (lenisEl)
5133
5125
  lenisEl.addEventListener('scroll', onScroll, { passive: true });
5134
5126
  const cleanup = () => {
5135
- observer.disconnect();
5127
+ unwatch?.();
5136
5128
  scrollFired = true;
5137
5129
  if (lenisEl)
5138
5130
  lenisEl.removeEventListener('scroll', onScroll);
5139
5131
  };
5132
+ if (!unwatch) {
5133
+ cleanup();
5134
+ fire();
5135
+ }
5140
5136
  return cleanup;
5141
5137
  }
5142
5138
  isBuilderMode() {