@adecore/agents-react 0.44.3 → 0.44.4
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/dist/chat/ui/Timeline.js +34 -9
- package/package.json +8 -8
- package/src/chat/ui/Timeline.tsx +28 -0
package/dist/chat/ui/Timeline.js
CHANGED
|
@@ -631,32 +631,57 @@ export function Timeline({
|
|
|
631
631
|
viewport: element_2.clientHeight
|
|
632
632
|
};
|
|
633
633
|
}, [rows.length, totalSize, composerHeight, frame.height]);
|
|
634
|
+
/*
|
|
635
|
+
* A height that changes after the first paint (the composer taking its draft, a row measured again) is
|
|
636
|
+
* seen by an observer before the page paints, but the state it sets is drawn after that paint. The
|
|
637
|
+
* end is pinned here as well, so the page never paints the thread with its end out of view.
|
|
638
|
+
*/
|
|
639
|
+
useLayoutEffect(() => {
|
|
640
|
+
const content = contentRef.current;
|
|
641
|
+
if (content === null || typeof ResizeObserver === 'undefined') {
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
const observer_1 = new ResizeObserver(() => {
|
|
645
|
+
const element_3 = scrollRef.current;
|
|
646
|
+
if (!followRef.current || element_3 === null) {
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
element_3.scrollTop = element_3.scrollHeight;
|
|
650
|
+
scrollGeometry.current = {
|
|
651
|
+
top: element_3.scrollTop,
|
|
652
|
+
height: element_3.scrollHeight,
|
|
653
|
+
viewport: element_3.clientHeight
|
|
654
|
+
};
|
|
655
|
+
});
|
|
656
|
+
observer_1.observe(content);
|
|
657
|
+
return () => observer_1.disconnect();
|
|
658
|
+
}, []);
|
|
634
659
|
// Prepending history moves rows; keep the reader on the same row at the same height.
|
|
635
660
|
useLayoutEffect(() => {
|
|
636
|
-
const
|
|
661
|
+
const element_4 = scrollRef.current;
|
|
637
662
|
const head = order?.[0];
|
|
638
663
|
const moved = head !== headRef.current;
|
|
639
664
|
headRef.current = head;
|
|
640
|
-
if (
|
|
665
|
+
if (element_4 === null) {
|
|
641
666
|
return;
|
|
642
667
|
}
|
|
643
668
|
const anchor = anchorRef.current;
|
|
644
669
|
const index_2 = moved && anchor !== null && !followRef.current ? rows.findIndex(row_9 => row_9.id === anchor.id) : -1;
|
|
645
670
|
if (anchor !== null && index_2 !== -1) {
|
|
646
671
|
virtualizer.getTotalSize();
|
|
647
|
-
|
|
672
|
+
element_4.scrollTop = virtualizer.measurementsCache[index_2].start - anchor.offset;
|
|
648
673
|
return;
|
|
649
674
|
}
|
|
650
|
-
const row_10 = virtualizer.getVirtualItemForOffset(
|
|
675
|
+
const row_10 = virtualizer.getVirtualItemForOffset(element_4.scrollTop);
|
|
651
676
|
anchorRef.current = row_10 === undefined ? null : {
|
|
652
677
|
id: String(row_10.key),
|
|
653
|
-
offset: row_10.start -
|
|
678
|
+
offset: row_10.start - element_4.scrollTop
|
|
654
679
|
};
|
|
655
680
|
});
|
|
656
681
|
// Close to the top, the page before goes in; again after each page that left too little above the reader.
|
|
657
682
|
useEffect(() => {
|
|
658
|
-
const
|
|
659
|
-
if (
|
|
683
|
+
const element_5 = scrollRef.current;
|
|
684
|
+
if (element_5 !== null && wantsEarlier(element_5)) {
|
|
660
685
|
loadEarlier();
|
|
661
686
|
}
|
|
662
687
|
}, [rows, loadEarlier, frame.height]);
|
|
@@ -698,7 +723,7 @@ export function Timeline({
|
|
|
698
723
|
starts,
|
|
699
724
|
inView
|
|
700
725
|
};
|
|
701
|
-
const followStrip =
|
|
726
|
+
const followStrip = element_6 => {
|
|
702
727
|
const {
|
|
703
728
|
starts: current_0,
|
|
704
729
|
inView: shown
|
|
@@ -708,7 +733,7 @@ export function Timeline({
|
|
|
708
733
|
}
|
|
709
734
|
const next = messagesInView({
|
|
710
735
|
starts: current_0,
|
|
711
|
-
scrollTop:
|
|
736
|
+
scrollTop: element_6.scrollTop,
|
|
712
737
|
visibleHeight: visibleHeightRef.current
|
|
713
738
|
});
|
|
714
739
|
if (next?.first !== shown.first || next?.last !== shown.last) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/agents-react",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.4",
|
|
4
4
|
"description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
"test:visuals": "bun --config=integration.bunfig.toml --conditions=source test ./src/chat/visual-viewport.integration.test.ts"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@adecore/agent-contracts": "0.44.
|
|
76
|
-
"@adecore/editor": "0.44.
|
|
77
|
-
"@adecore/editor-react": "0.44.
|
|
78
|
-
"@adecore/intelligent-ui": "0.44.
|
|
79
|
-
"@adecore/merge": "0.44.
|
|
75
|
+
"@adecore/agent-contracts": "0.44.4",
|
|
76
|
+
"@adecore/editor": "0.44.4",
|
|
77
|
+
"@adecore/editor-react": "0.44.4",
|
|
78
|
+
"@adecore/intelligent-ui": "0.44.4",
|
|
79
|
+
"@adecore/merge": "0.44.4",
|
|
80
80
|
"@codemirror/commands": "^6.11.1",
|
|
81
81
|
"@codemirror/language": "^6.13.1",
|
|
82
82
|
"@codemirror/state": "^6.7.6",
|
|
@@ -100,14 +100,14 @@
|
|
|
100
100
|
"zustand": "^5.0.16"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"@adecore/ui": "^0.44.
|
|
103
|
+
"@adecore/ui": "^0.44.4",
|
|
104
104
|
"i18next": "^26.4.2",
|
|
105
105
|
"react": "^19.3.0",
|
|
106
106
|
"react-dom": "^19.3.0",
|
|
107
107
|
"react-i18next": "^17.0.15"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
|
-
"@adecore/ui": "0.44.
|
|
110
|
+
"@adecore/ui": "0.44.4",
|
|
111
111
|
"@types/bun": "^1.4.4",
|
|
112
112
|
"@types/react": "^19.3.0",
|
|
113
113
|
"@types/react-dom": "^19.3.0",
|
package/src/chat/ui/Timeline.tsx
CHANGED
|
@@ -480,6 +480,34 @@ export function Timeline({
|
|
|
480
480
|
scrollGeometry.current = { top: element.scrollTop, height: element.scrollHeight, viewport: element.clientHeight };
|
|
481
481
|
}, [rows.length, totalSize, composerHeight, frame.height]);
|
|
482
482
|
|
|
483
|
+
/*
|
|
484
|
+
* A height that changes after the first paint (the composer taking its draft, a row measured again) is
|
|
485
|
+
* seen by an observer before the page paints, but the state it sets is drawn after that paint. The
|
|
486
|
+
* end is pinned here as well, so the page never paints the thread with its end out of view.
|
|
487
|
+
*/
|
|
488
|
+
useLayoutEffect(() => {
|
|
489
|
+
const content = contentRef.current;
|
|
490
|
+
|
|
491
|
+
if (content === null || typeof ResizeObserver === 'undefined') {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
const observer = new ResizeObserver(() => {
|
|
496
|
+
const element = scrollRef.current;
|
|
497
|
+
|
|
498
|
+
if (!followRef.current || element === null) {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
element.scrollTop = element.scrollHeight;
|
|
503
|
+
scrollGeometry.current = { top: element.scrollTop, height: element.scrollHeight, viewport: element.clientHeight };
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
observer.observe(content);
|
|
507
|
+
|
|
508
|
+
return () => observer.disconnect();
|
|
509
|
+
}, []);
|
|
510
|
+
|
|
483
511
|
// Prepending history moves rows; keep the reader on the same row at the same height.
|
|
484
512
|
useLayoutEffect(() => {
|
|
485
513
|
const element = scrollRef.current;
|