chat-layout 1.2.0-7 → 1.2.0-9

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/README.md CHANGED
@@ -178,7 +178,7 @@ Notes:
178
178
  - `FlexItem` exposes `grow`, `shrink`, and `alignSelf`; `basis` is no longer public.
179
179
  - `MultilineText` now uses `align` / `physicalAlign` instead of `alignment`.
180
180
  - `ListState.position` uses `undefined` for the renderer default anchor.
181
- - Use `list.resetScroll()` or `list.setAnchor(index, offset)` instead of assigning `Number.NaN`.
181
+ - Use `list.applyScroll(delta)` for relative scrolling, or renderer `jumpTo()` / `jumpToTop()` / `jumpToBottom()` for absolute navigation.
182
182
 
183
183
  ## Development
184
184
 
package/example/chat.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
+ Fixed,
2
3
  Flex,
3
4
  FlexItem,
4
- Fixed,
5
5
  ListRenderer,
6
6
  ListState,
7
7
  MultilineText,
package/index.d.mts CHANGED
@@ -535,14 +535,13 @@ type ListScrollStatePatch = {
535
535
  offset?: number;
536
536
  };
537
537
  declare const WRITE_LIST_SCROLL_STATE: unique symbol;
538
+ declare const FINALIZE_LIST_DELETE: unique symbol;
538
539
  declare class ListState<T extends {}> {
539
540
  #private;
540
541
  /** Pixel offset from the anchored item edge. */
541
542
  get offset(): number;
542
- set offset(value: number);
543
543
  /** Anchor item index, or `undefined` to use the renderer default. */
544
544
  get position(): number | undefined;
545
- set position(value: number | undefined);
546
545
  /** Items currently managed by the renderer. */
547
546
  get items(): T[];
548
547
  /** Replaces the full item collection while preserving scroll state. */
@@ -570,17 +569,11 @@ declare class ListState<T extends {}> {
570
569
  /**
571
570
  * Finalizes a pending delete by removing the item from the list.
572
571
  */
573
- finalizeDelete(item: T): void;
574
- /**
575
- * Sets the current anchor item and pixel offset.
576
- */
577
- setAnchor(position: number, offset?: number): void;
572
+ [FINALIZE_LIST_DELETE](item: T): void;
578
573
  /**
579
574
  * Replaces all items and clears scroll state.
580
575
  */
581
576
  reset(items?: T[]): void;
582
- /** Clears the current scroll anchor while keeping the items. */
583
- resetScroll(): void;
584
577
  /** Applies a relative pixel scroll delta. */
585
578
  applyScroll(delta: number): void;
586
579
  [WRITE_LIST_SCROLL_STATE](patch: ListScrollStatePatch, source: ListScrollMutationSource): void;
@@ -603,17 +596,6 @@ declare function memoRenderItemBy<C extends CanvasRenderingContext2D, T, K>(keyO
603
596
  resetKey: (key: K) => boolean;
604
597
  };
605
598
  //#endregion
606
- //#region src/renderer/virtualized/base-types.d.ts
607
- type AutoFollowCapabilities = {
608
- top: boolean;
609
- bottom: boolean;
610
- };
611
- /** Per-item draw/hittest callbacks produced by the resolver. */
612
- type VirtualizedResolvedItem = {
613
- draw: (y: number) => boolean;
614
- hittest: (test: HitTest, y: number) => boolean;
615
- };
616
- //#endregion
617
599
  //#region src/renderer/virtualized/solver.d.ts
618
600
  type ListAnchorMode = "top" | "bottom";
619
601
  type ListUnderflowAlign = "top" | "bottom";
@@ -652,7 +634,7 @@ interface NormalizedListState {
652
634
  offset: number;
653
635
  }
654
636
  interface VisibleWindowEntry<T> {
655
- idx: number;
637
+ index: number;
656
638
  value: T;
657
639
  offset: number;
658
640
  height: number;
@@ -667,6 +649,17 @@ interface VisibleWindowResult<T> {
667
649
  window: VisibleWindow<T>;
668
650
  }
669
651
  //#endregion
652
+ //#region src/renderer/virtualized/virtualized-types.d.ts
653
+ type AutoFollowCapabilities = {
654
+ top: boolean;
655
+ bottom: boolean;
656
+ };
657
+ /** Per-item draw/hittest callbacks produced by the resolver. */
658
+ type VirtualizedResolvedItem = {
659
+ draw: (y: number) => boolean;
660
+ hittest: (test: HitTest, y: number) => boolean;
661
+ };
662
+ //#endregion
670
663
  //#region src/renderer/virtualized/base.d.ts
671
664
  /**
672
665
  * Options for programmatic scrolling to a target item.
@@ -698,12 +691,8 @@ declare abstract class VirtualizedRenderer<C extends CanvasRenderingContext2D, T
698
691
  });
699
692
  /** Current anchor item index. */
700
693
  get position(): number | undefined;
701
- /** Updates the current anchor item index. */
702
- set position(value: number | undefined);
703
694
  /** Pixel offset from the anchored item edge. */
704
695
  get offset(): number;
705
- /** Updates the pixel offset from the anchored item edge. */
706
- set offset(value: number);
707
696
  /** Items currently available to the renderer. */
708
697
  get items(): T[];
709
698
  /** Replaces the current item collection. */