@frankieai/react 0.2.5 → 0.2.7

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/index.js CHANGED
@@ -1183,14 +1183,23 @@ function ChatPanel({
1183
1183
  const theme = useFrankieTheme();
1184
1184
  const { messages, busy, restoring, error, send, stop, reset } = useFrankieChat();
1185
1185
  const scrollRef = useRef4(null);
1186
+ const atBottomRef = useRef4(true);
1186
1187
  const features = config?.features;
1187
1188
  const pickerModels = features?.modelPicker.enabled ? features.modelPicker.models : [];
1188
1189
  const [model, setModel] = useState5(void 0);
1189
1190
  useEffect4(() => {
1190
1191
  const node = scrollRef.current;
1191
1192
  if (!node) return;
1192
- const distanceFromBottom = node.scrollHeight - node.scrollTop - node.clientHeight;
1193
- if (distanceFromBottom < 160) node.scrollTop = node.scrollHeight;
1193
+ const onScroll = () => {
1194
+ atBottomRef.current = node.scrollHeight - node.scrollTop - node.clientHeight < 160;
1195
+ };
1196
+ node.addEventListener("scroll", onScroll, { passive: true });
1197
+ return () => node.removeEventListener("scroll", onScroll);
1198
+ }, []);
1199
+ useEffect4(() => {
1200
+ const node = scrollRef.current;
1201
+ if (!node || !atBottomRef.current) return;
1202
+ node.scrollTop = node.scrollHeight;
1194
1203
  }, [messages]);
1195
1204
  const name = config?.branding.name ?? "Assistant";
1196
1205
  const mode = resolveMode(theme?.mode);
@@ -1333,7 +1342,7 @@ function FrankieInline({ className, style, ...panelProps }) {
1333
1342
 
1334
1343
  // src/components/chat/FrankieChatPage.tsx
1335
1344
  import { useCallback as useCallback3, useEffect as useEffect6, useRef as useRef5, useState as useState7 } from "react";
1336
- import { History, Menu, Plus as Plus2, Settings, X as X5 } from "lucide-react";
1345
+ import { ChevronsLeft, ChevronsRight, History, Menu, Plus as Plus2, Settings, X as X5 } from "lucide-react";
1337
1346
  import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
1338
1347
  function PageEmptyState() {
1339
1348
  const { config } = useFrankie();
@@ -1360,6 +1369,13 @@ function PageChrome({ showHistory, navigation, currentId, onSelect, onNew, ...pa
1360
1369
  const [historyError, setHistoryError] = useState7("");
1361
1370
  const [historyLoading, setHistoryLoading] = useState7(false);
1362
1371
  const [drawerOpen, setDrawerOpen] = useState7(false);
1372
+ const [collapsed, setCollapsed] = useState7(() => {
1373
+ try {
1374
+ return window.localStorage.getItem("frankie.history-collapsed") === "1";
1375
+ } catch {
1376
+ return false;
1377
+ }
1378
+ });
1363
1379
  const [query, setQuery] = useState7("");
1364
1380
  const dialog = useRef5(null);
1365
1381
  const menu = useRef5(null);
@@ -1391,6 +1407,12 @@ function PageChrome({ showHistory, navigation, currentId, onSelect, onNew, ...pa
1391
1407
  requestVersion.current++;
1392
1408
  };
1393
1409
  }, [refresh, busy]);
1410
+ useEffect6(() => {
1411
+ try {
1412
+ window.localStorage.setItem("frankie.history-collapsed", collapsed ? "1" : "0");
1413
+ } catch {
1414
+ }
1415
+ }, [collapsed]);
1394
1416
  useEffect6(() => {
1395
1417
  const node = dialog.current;
1396
1418
  if (drawerOpen) {
@@ -1436,7 +1458,10 @@ function PageChrome({ showHistory, navigation, currentId, onSelect, onNew, ...pa
1436
1458
  navigation ? /* @__PURE__ */ jsx17("div", { className: "frankie-host-navigation", children: navigation }) : null
1437
1459
  ] });
1438
1460
  return /* @__PURE__ */ jsxs7("div", { className: "frankie-page-shell" + (resolveMode(theme?.mode) === "dark" ? " dark" : ""), style: themeToCssVars(theme), children: [
1439
- showHistory ? /* @__PURE__ */ jsx17("aside", { className: "frankie-history-desktop", children: history }) : null,
1461
+ showHistory ? /* @__PURE__ */ jsxs7("aside", { className: "frankie-history-desktop" + (collapsed ? " frankie-history-collapsed" : ""), children: [
1462
+ /* @__PURE__ */ jsx17("button", { type: "button", className: "frankie-history-toggle", "aria-label": collapsed ? "Expand conversations" : "Collapse conversations", "aria-expanded": !collapsed, onClick: () => setCollapsed((value) => !value), children: collapsed ? /* @__PURE__ */ jsx17(ChevronsRight, { size: 16 }) : /* @__PURE__ */ jsx17(ChevronsLeft, { size: 16 }) }),
1463
+ collapsed ? null : history
1464
+ ] }) : null,
1440
1465
  /* @__PURE__ */ jsxs7("div", { className: "frankie-page-main", children: [
1441
1466
  /* @__PURE__ */ jsxs7("header", { className: "frankie-page-header", children: [
1442
1467
  /* @__PURE__ */ jsxs7("div", { children: [