@mozaic-ds/angular 2.1.3 → 2.1.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mozaic-ds/angular",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "type": "module",
5
5
  "peerDependencies": {
6
6
  "@angular/common": ">=20.3.15",
@@ -8,6 +8,7 @@ import * as rxjs from 'rxjs';
8
8
  import { Observable } from 'rxjs';
9
9
  import { CdkPortalOutlet } from '@angular/cdk/portal';
10
10
  import * as _mozaic_ds_angular from '@mozaic-ds/angular';
11
+ import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
11
12
  import { ComponentHarness } from '@angular/cdk/testing';
12
13
 
13
14
  type MozBreadcrumbAppearance = 'standard' | 'inverse';
@@ -2316,11 +2317,8 @@ declare function isFlatOption<T>(item: FlatItem<T>): item is FlatOption<T>;
2316
2317
  declare class MozComboboxComponent<T = string> implements ControlValueAccessor {
2317
2318
  private readonly _doc;
2318
2319
  private readonly _overlay;
2319
- private readonly _appRef;
2320
- /** rAF handle for the scroll-driven change-detection loop (see _kickViewportTick). */
2321
- private _viewportTickRaf;
2322
- /** Timestamp of the last viewport scroll event, used to stop the tick loop when idle. */
2323
- private _lastViewportScrollTs;
2320
+ /** Timestamp of the last viewport re-measure, to throttle onViewportScroll(). */
2321
+ private _lastViewportSync;
2324
2322
  /**
2325
2323
  * No-op scroll strategy: the dropdown embeds a CDK virtual-scroll viewport,
2326
2324
  * which is a global `CdkScrollable`. With the default `reposition` strategy,
@@ -2470,14 +2468,29 @@ declare class MozComboboxComponent<T = string> implements ControlValueAccessor {
2470
2468
  onOverlayOutsideClick(): void;
2471
2469
  onOverlayAttached(): void;
2472
2470
  /**
2473
- * Drive change detection for a short window after a viewport scroll so the
2474
- * CDK virtual-scroll viewport (inside the overlay portal) applies its content
2475
- * transform in zoneless mode. Runs at most one rAF loop at a time; each new
2476
- * scroll event extends the window, and the loop stops ~200ms after the last
2477
- * scroll. `tick()` is guarded because it throws if called during an ongoing
2478
- * change-detection pass (it never is here rAF callbacks run outside CD).
2479
- */
2480
- private _kickViewportTick;
2471
+ * Zoneless fix for the virtual-scroll viewport.
2472
+ *
2473
+ * On Angular/CDK 22 in zoneless mode the viewport never recomputes its
2474
+ * rendered range while the user scrolls: `onContentScrolled` doesn't refresh
2475
+ * the window and the content transform stays frozen, so the panel "bounces"
2476
+ * and never reaches the bottom of the list. (CDK 21 used a different path and
2477
+ * was unaffected — hence Storybook on 21 looked fine while the 22 consumer
2478
+ * bounced.) Calling the viewport's public `checkViewportSize()` re-measures
2479
+ * and re-renders the correct window; it is idempotent at a valid scroll
2480
+ * position (verified — repeated calls don't move the scroll), so there is no
2481
+ * feedback loop. The handler receives the viewport through the `#viewport`
2482
+ * template reference, which resolves correctly even though the viewport lives
2483
+ * in the overlay portal (unlike `viewChild`).
2484
+ *
2485
+ * Throttled to ~one re-measure per frame (16 ms). Browsers already coalesce
2486
+ * scroll events to roughly one per animation frame — even for a high-frequency
2487
+ * trackpad / momentum scroll — but the throttle is a defensive cap so this
2488
+ * synchronous reflow can never be called in a tight burst. `checkViewportSize()`
2489
+ * is idempotent at a valid scroll offset (verified on the real CDK 22 zoneless
2490
+ * runtime — repeated calls don't move the scroll), so it never fights the
2491
+ * scroll position and there is no feedback loop.
2492
+ */
2493
+ onViewportScroll(viewport: CdkVirtualScrollViewport): void;
2481
2494
  /** Coerce the current value into an array (safe for .some/.filter/.every). */
2482
2495
  private _currentValueAsArray;
2483
2496
  writeValue(val: T | T[] | null): void;
@@ -2487,6 +2500,8 @@ declare class MozComboboxComponent<T = string> implements ControlValueAccessor {
2487
2500
  readonly isFlatSection: typeof isFlatSection;
2488
2501
  readonly isFlatOption: typeof isFlatOption;
2489
2502
  readonly itemSizePx = 48;
2503
+ readonly minBufferPx: number;
2504
+ readonly maxBufferPx: number;
2490
2505
  trackByFlatItem(_index: number, item: FlatItem<T>): string;
2491
2506
  /** Set of currently selected values, recomputed reactively for OnPush */
2492
2507
  readonly selectedValues: _angular_core.Signal<T[]>;