@sensiblestats/widget-react 0.26.1 → 0.26.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.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +10 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/styles.css +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.26.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix the new-turn scroll anchor jumping to the bottom on a follow-up send after tall content (e.g. tapping a chip below a club dashboard). Reserve a viewport of space below the new turn while it streams so its start can actually reach the top of the panel, then collapse the space once the turn completes. The turn's start now stays pinned to the top through the whole reply instead of the view following the stream to the bottom.
|
|
8
|
+
|
|
3
9
|
## 0.26.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1889,14 +1889,17 @@ function MessageList({ controller, ui, slip, onDashboardTap }) {
|
|
|
1889
1889
|
const anchoredTurnRef = (0, import_react10.useRef)(null);
|
|
1890
1890
|
(0, import_react10.useEffect)(() => {
|
|
1891
1891
|
const anchor = turnAnchor(state.messages);
|
|
1892
|
+
const list = listRef.current;
|
|
1892
1893
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
1893
1894
|
anchoredTurnRef.current = anchor.turnId;
|
|
1895
|
+
if (endRef.current && list) endRef.current.style.height = `${list.clientHeight}px`;
|
|
1894
1896
|
pinnedRef.current = false;
|
|
1895
|
-
|
|
1897
|
+
list?.querySelector(`[data-msg-id="${anchor.anchorId}"]`)?.scrollIntoView({ block: "start" });
|
|
1896
1898
|
return;
|
|
1897
1899
|
}
|
|
1900
|
+
if (!state.isStreaming && endRef.current) endRef.current.style.height = "";
|
|
1898
1901
|
if (pinnedRef.current) endRef.current?.scrollIntoView({ block: "end" });
|
|
1899
|
-
}, [state.messages, state.status]);
|
|
1902
|
+
}, [state.messages, state.status, state.isStreaming]);
|
|
1900
1903
|
const hasUserMessage = state.messages.some((m) => m.role === "user");
|
|
1901
1904
|
const hasDashboard = state.messages.some((m) => m.role === "assistant" && (m.greetingDashboard || m.clubFanDashboard));
|
|
1902
1905
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
@@ -1932,7 +1935,7 @@ function MessageList({ controller, ui, slip, onDashboardTap }) {
|
|
|
1932
1935
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", className: "ss-w-retry", onClick: () => controller.retry(), children: ui.retry })
|
|
1933
1936
|
] }) : null,
|
|
1934
1937
|
!hasUserMessage && !hasDashboard ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(IntentChips, { chips: state.starters, onPick: (t) => send(t) }) : null,
|
|
1935
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { ref: endRef })
|
|
1938
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { ref: endRef, className: "ss-w-turn-spacer", "aria-hidden": "true" })
|
|
1936
1939
|
]
|
|
1937
1940
|
}
|
|
1938
1941
|
);
|
|
@@ -2054,6 +2057,10 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
2054
2057
|
|
|
2055
2058
|
/* messages */
|
|
2056
2059
|
.ss-w-list { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; scroll-padding-top: 14px; }
|
|
2060
|
+
/* Transient bottom spacer: reserves a viewport of room below a new turn so its
|
|
2061
|
+
top can be scrolled into view while the reply is still streaming in. Height is
|
|
2062
|
+
set imperatively and flex must not shrink it away. */
|
|
2063
|
+
.ss-w-turn-spacer { flex: none; }
|
|
2057
2064
|
.ss-w-msg { display: flex; }
|
|
2058
2065
|
.ss-w-user { justify-content: flex-end; }
|
|
2059
2066
|
.ss-w-user .ss-w-bubble { background: color-mix(in srgb, var(--ss-w-accent) 14%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 30%, var(--ss-w-line)); border-radius: 14px; padding: 8px 12px; max-width: 80%; }
|