@vectoriox/iox-builder 10.1.1 → 11.0.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.
@@ -1100,6 +1100,21 @@ function regenerateNodeIds(root, opts = {}) {
1100
1100
  };
1101
1101
  assign(root);
1102
1102
  remapNodeReferences(root, idMap);
1103
+ remapItemKeyTraits(root, keyMap);
1104
+ }
1105
+ /**
1106
+ * Traits whose value NAMES an item by its key (CC4b: a Segmented control's On by default). The keys are reissued per
1107
+ * copy above, so the value follows them — else a pasted or inserted control defaults to a key none of its options holds.
1108
+ */
1109
+ const ITEM_KEY_TRAITS = new Set(['defaultOn']);
1110
+ function remapItemKeyTraits(node, keyMap) {
1111
+ if (!keyMap.size)
1112
+ return;
1113
+ for (const trait of (node.traits ?? [])) {
1114
+ if (trait?.name && ITEM_KEY_TRAITS.has(trait.name) && keyMap.has(trait.default))
1115
+ trait.default = keyMap.get(trait.default);
1116
+ }
1117
+ (node.children || []).forEach(child => remapItemKeyTraits(child, keyMap));
1103
1118
  }
1104
1119
  /** Remap absolute node-id references inside a subtree to their new ids (per `idMap`). Ids not in
1105
1120
  * the map (references to nodes outside the cloned subtree) are preserved. */
@@ -2706,14 +2721,6 @@ function defaultPageSettings() {
2706
2721
  textColor: '#000000',
2707
2722
  maxWidth: '1440px',
2708
2723
  },
2709
- scroll: {
2710
- enabled: true,
2711
- lerp: 0.1,
2712
- wheelMultiplier: 1,
2713
- touchMultiplier: 1,
2714
- direction: 'vertical',
2715
- infinite: false,
2716
- },
2717
2724
  routeAnimation: {
2718
2725
  enter: 'fade',
2719
2726
  leave: 'fade',
@@ -8848,6 +8855,12 @@ function pickInherited(css) {
8848
8855
  out[prop] = css[prop];
8849
8856
  return out;
8850
8857
  }
8858
+ /**
8859
+ * The editor canvas's own scroller — an editing surface, not the site: it never follows the look's
8860
+ * Scrolling choice (that plays on the live site and in Preview, `planScroll`). These were the
8861
+ * Page ▸ Smooth Scroll defaults the canvas read before that panel was deleted (MO-D2).
8862
+ */
8863
+ const EDITOR_CANVAS_SCROLL = { lerp: 0.1, wheelMultiplier: 1, touchMultiplier: 1, orientation: 'vertical', infinite: false };
8851
8864
  class BuilderComponent {
8852
8865
  /** The overlay's BEFORE wrapper comes and goes with its globals; its block size is the page's top reserve. */
8853
8866
  set globalsBeforeRef(ref) {
@@ -9395,9 +9408,6 @@ class BuilderComponent {
9395
9408
  }
9396
9409
  ngOnChanges(changes) {
9397
9410
  if (changes['pageSettings']) {
9398
- // Reinit Lenis with updated scroll options (lerp, wheelMultiplier, etc.)
9399
- // so the builder preview reflects the live-page scroll feel in real time.
9400
- this.initLenis();
9401
9411
  // Background / typography: until this existed the Page panel wrote a background
9402
9412
  // that only appeared once the site was published.
9403
9413
  this.pageStyleCss = compilePageStyle(this.pageSettings?.style, { designSystem: this.pageSettings?.designSystem === true });
@@ -9589,16 +9599,11 @@ class BuilderComponent {
9589
9599
  this.destroyLenis();
9590
9600
  if (!this.previewScrollRef?.nativeElement || !this.lenisContentRef?.nativeElement)
9591
9601
  return;
9592
- const s = this.pageSettings?.scroll;
9593
9602
  this.lenis = new Lenis({
9603
+ ...EDITOR_CANVAS_SCROLL,
9594
9604
  wrapper: this.previewScrollRef.nativeElement,
9595
9605
  content: this.lenisContentRef.nativeElement,
9596
9606
  eventsTarget: this.previewScrollRef.nativeElement,
9597
- lerp: s?.lerp ?? 0.1,
9598
- wheelMultiplier: s?.wheelMultiplier ?? 1,
9599
- touchMultiplier: s?.touchMultiplier ?? 1,
9600
- orientation: s?.direction ?? 'vertical',
9601
- infinite: s?.infinite ?? false,
9602
9607
  autoResize: false, // we drive resize() manually via canvasRo + viewportSub
9603
9608
  });
9604
9609
  this.lenis.on('scroll', (instance) => {