@design.estate/dees-catalog 21.51.1 → 21.51.2

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.
@@ -1421,6 +1421,7 @@ export class DeesHarnessMessageList extends DeesElement {
1421
1421
  private contentResizeObserver: ResizeObserver | null = null;
1422
1422
  private observedScrollContent: Element | null = null;
1423
1423
  private observedContentBlockSize: number | null = null;
1424
+ private observedViewportBlockSize: number | null = null;
1424
1425
  private followFrame: number | null = null;
1425
1426
  private followSecondFrame: number | null = null;
1426
1427
  // Intent-based following: the list stays pinned until the user explicitly
@@ -1974,16 +1975,25 @@ export class DeesHarnessMessageList extends DeesElement {
1974
1975
  private connectContentResizeObserver(): void {
1975
1976
  if (!this.isConnected || !this.autoFollow) return;
1976
1977
  const content = this.shadowRoot?.querySelector('.scrollContent');
1977
- if (!content || (this.contentResizeObserver && content === this.observedScrollContent)) return;
1978
+ const container = this.scrollContainer;
1979
+ if (!content || !container || (this.contentResizeObserver && content === this.observedScrollContent)) return;
1978
1980
  this.contentResizeObserver?.disconnect();
1979
1981
  this.observedContentBlockSize = content.getBoundingClientRect().height;
1982
+ this.observedViewportBlockSize = container.clientHeight;
1983
+ // The viewport is observed too: a pane that gets shorter (the composer grows, the window
1984
+ // shrinks) keeps its scrollTop, which leaves the bottom out of view while the content keeps
1985
+ // its size and the content observer sees nothing.
1980
1986
  this.contentResizeObserver = new ResizeObserver((entries) => {
1981
- const entry = entries.find((candidate) => candidate.target === this.observedScrollContent);
1982
- if (!entry) return;
1983
- const blockSize = entry.borderBoxSize[0]?.blockSize ?? entry.contentRect.height;
1984
- this.handleContentBlockSize(blockSize);
1987
+ for (const entry of entries) {
1988
+ if (entry.target === this.observedScrollContent) {
1989
+ this.handleContentBlockSize(entry.borderBoxSize[0]?.blockSize ?? entry.contentRect.height);
1990
+ } else if (entry.target === container) {
1991
+ this.handleViewportBlockSize(container.clientHeight);
1992
+ }
1993
+ }
1985
1994
  });
1986
1995
  this.contentResizeObserver.observe(content);
1996
+ this.contentResizeObserver.observe(container);
1987
1997
  this.observedScrollContent = content;
1988
1998
  }
1989
1999
 
@@ -2423,6 +2433,15 @@ export class DeesHarnessMessageList extends DeesElement {
2423
2433
  this.syncScrollEdgeFades();
2424
2434
  }
2425
2435
 
2436
+ private handleViewportBlockSize(blockSizeArg: number): void {
2437
+ const previousBlockSize = this.observedViewportBlockSize;
2438
+ this.observedViewportBlockSize = blockSizeArg;
2439
+ if (previousBlockSize !== null && Math.abs(blockSizeArg - previousBlockSize) > 0.5) {
2440
+ this.repinToBottom();
2441
+ }
2442
+ this.syncScrollEdgeFades();
2443
+ }
2444
+
2426
2445
  private syncScrollEdgeFades(): void {
2427
2446
  const container = this.scrollContainer;
2428
2447
  const fadeTop = Boolean(this.fadeScrollEdges && container && container.scrollTop > 1);
@@ -2440,6 +2459,7 @@ export class DeesHarnessMessageList extends DeesElement {
2440
2459
  this.contentResizeObserver = null;
2441
2460
  this.observedScrollContent = null;
2442
2461
  this.observedContentBlockSize = null;
2462
+ this.observedViewportBlockSize = null;
2443
2463
  }
2444
2464
 
2445
2465
  public async disconnectedCallback(): Promise<void> {