@marimo-team/islands 0.23.17-dev45 → 0.23.17-dev47

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.
@@ -36331,7 +36331,7 @@ ${d}`,
36331
36331
  return Logger.warn("Failed to get version from mount config"), null;
36332
36332
  }
36333
36333
  }
36334
- marimoVersionAtom = atom(getVersionFromMountConfig() || "0.23.17-dev45");
36334
+ marimoVersionAtom = atom(getVersionFromMountConfig() || "0.23.17-dev47");
36335
36335
  showCodeInRunModeAtom = atom(true);
36336
36336
  atom(null);
36337
36337
  var import_compiler_runtime = require_compiler_runtime();
package/dist/main.js CHANGED
@@ -26,7 +26,7 @@ import { $ as notebookOutline, $t as isUninstantiated, A as ChevronDownIcon, An
26
26
  import { __tla as __tla_1 } from "./chunk-5FQGJX7Z-B9WoXK1R.js";
27
27
  import { o as useSize, s as Root$1, u as createLucideIcon } from "./dist-DarwE0ZO.js";
28
28
  import { A as SquareFunction, C as DEFAULT_COLOR_SCHEME, D as SCALE_TYPE_DESCRIPTIONS, E as EMPTY_VALUE$1, O as TIME_UNIT_DESCRIPTIONS, S as DEFAULT_AGGREGATION, T as DEFAULT_TIME_UNIT, _ as AGGREGATION_TYPE_DESCRIPTIONS, a as AGGREGATION_FNS, b as COLOR_SCHEMES, c as COLOR_BY_FIELDS, d as NONE_VALUE, f as SELECTABLE_DATA_TYPES, g as TIME_UNITS, h as STRING_AGGREGATION_FNS, i as convertDataTypeToSelectable, j as ChartColumn, k as escapeFieldName, l as COMBINED_TIME_UNITS, m as SORT_TYPES, n as createSpecWithoutData, o as BIN_AGGREGATION, p as SINGLE_TIME_UNITS, r as isFieldSet, s as CHART_TYPES, t as augmentSpecWithData, u as ChartType, v as AGGREGATION_TYPE_ICON, w as DEFAULT_MAX_BINS_FACET, x as COUNT_FIELD, y as CHART_TYPE_ICON } from "./spec-uMKNvMRZ.js";
29
- import { $ as CommandSeparator, $t as Kbd, A as ErrorState, At as getPageIndexForRow, B as ContextMenuTrigger, Bt as dateToLocalISODate, C as downloadHTMLAsImage, Ct as inferFieldTypes, D as ColumnName, Dt as DelayMount, E as downloadSizeLimitAtom, Et as ColumnChartSpecModel, F as getUserColumnVisibilityCounts, Ft as TOO_MANY_ROWS, G as DateRangePicker, Gt as TabsList, H as useSelectList, Ht as dateToLocalISOTime, I as ContextMenu, It as toFieldTypes, J as Command, Jt as ChartInfoState, K as Combobox, Kt as TabsTrigger, L as ContextMenuContent, Lt as getMimeValues, M as prettifyRowColumnCount, Mt as loadTableData, N as prettifyRowCount, Nt as INDEX_COLUMN_NAME, O as ColumnPreviewContainer, Ot as useIntersectionObserver, P as getColumnCountForDisplay, Pt as SELECT_COLUMN_ID, Q as CommandList, Qt as RenderTextWithLinks, R as ContextMenuItem, Rt as isNullishFilter, S as downloadExportedFile, St as generateColumns, T as Filenames, Tt as ColumnChartContext, U as CompactChipRow, Ut as Tabs, V as useInternalStateWithSync, Vt as dateToLocalISODateTime, W as DatePicker, Wt as TabsContent, X as CommandInput, Xt as LazyVegaEmbed, Y as CommandEmpty, Yt as ChartLoadingState, Z as CommandItem, Zt as useOverflowDetection, _ as DataTable, _n as ChevronLeft, _t as TableCell, an as TextWrap, at as contextAwarePanelType, b as downloadBlob, bt as TableRow, c as SLIDE_TYPE_OPTIONS_BY_VALUE, cn as EyeOff, ct as slotsController, d as Switch, dn as Download, en as HtmlOutput, et as smartMatch, f as RadioGroup, fn as Code, g as OutputRenderer, gn as ChevronsDownUp, gt as TableBody, h as OutputArea, hn as ChevronsLeft, ht as Table, i as showCodeInRunModeAtom, in as $fae977aafc393c5c$export$6b862160d295c8e, it as contextAwarePanelOwner, j as LoadingState, jt as loadTableAndRawData, k as EmptyState, kt as usePrevious$1, lt as Toggle, m as JsonOutput, mn as ChevronsRight, mt as Provider$1, n as useNotebookCodeAvailable, nn as safeLocale, nt as PANEL_TYPES, on as GripHorizontal, ot as isCellAwareAtom, p as RadioGroupItem, pn as ChevronsUpDown, pt as Fill, q as ComboboxItem, qt as ChartErrorState, r as marimoVersionAtom, rn as $fae977aafc393c5c$export$588937bcd60ade55, rt as contextAwarePanelOpen, sn as Funnel, st as SlotNames, t as cellDomProps, tn as EmotionCacheProvider, tt as ContextAwarePanelItem, u as Slide, un as Ellipsis, v as InstallPackageButton, vn as ArrowDownWideNarrow, vt as TableHead, w as Progress, wt as renderCellValue, x as downloadByURL, xt as NAMELESS_COLUMN_PREFIX, y as ADD_PRINTING_CLASS, yt as TableHeader, z as ContextMenuSeparator, zt as Maps, __tla as __tla_2 } from "./common-BpaVk2oS.js";
29
+ import { $ as CommandSeparator, $t as Kbd, A as ErrorState, At as getPageIndexForRow, B as ContextMenuTrigger, Bt as dateToLocalISODate, C as downloadHTMLAsImage, Ct as inferFieldTypes, D as ColumnName, Dt as DelayMount, E as downloadSizeLimitAtom, Et as ColumnChartSpecModel, F as getUserColumnVisibilityCounts, Ft as TOO_MANY_ROWS, G as DateRangePicker, Gt as TabsList, H as useSelectList, Ht as dateToLocalISOTime, I as ContextMenu, It as toFieldTypes, J as Command, Jt as ChartInfoState, K as Combobox, Kt as TabsTrigger, L as ContextMenuContent, Lt as getMimeValues, M as prettifyRowColumnCount, Mt as loadTableData, N as prettifyRowCount, Nt as INDEX_COLUMN_NAME, O as ColumnPreviewContainer, Ot as useIntersectionObserver, P as getColumnCountForDisplay, Pt as SELECT_COLUMN_ID, Q as CommandList, Qt as RenderTextWithLinks, R as ContextMenuItem, Rt as isNullishFilter, S as downloadExportedFile, St as generateColumns, T as Filenames, Tt as ColumnChartContext, U as CompactChipRow, Ut as Tabs, V as useInternalStateWithSync, Vt as dateToLocalISODateTime, W as DatePicker, Wt as TabsContent, X as CommandInput, Xt as LazyVegaEmbed, Y as CommandEmpty, Yt as ChartLoadingState, Z as CommandItem, Zt as useOverflowDetection, _ as DataTable, _n as ChevronLeft, _t as TableCell, an as TextWrap, at as contextAwarePanelType, b as downloadBlob, bt as TableRow, c as SLIDE_TYPE_OPTIONS_BY_VALUE, cn as EyeOff, ct as slotsController, d as Switch, dn as Download, en as HtmlOutput, et as smartMatch, f as RadioGroup, fn as Code, g as OutputRenderer, gn as ChevronsDownUp, gt as TableBody, h as OutputArea, hn as ChevronsLeft, ht as Table, i as showCodeInRunModeAtom, in as $fae977aafc393c5c$export$6b862160d295c8e, it as contextAwarePanelOwner, j as LoadingState, jt as loadTableAndRawData, k as EmptyState, kt as usePrevious$1, lt as Toggle, m as JsonOutput, mn as ChevronsRight, mt as Provider$1, n as useNotebookCodeAvailable, nn as safeLocale, nt as PANEL_TYPES, on as GripHorizontal, ot as isCellAwareAtom, p as RadioGroupItem, pn as ChevronsUpDown, pt as Fill, q as ComboboxItem, qt as ChartErrorState, r as marimoVersionAtom, rn as $fae977aafc393c5c$export$588937bcd60ade55, rt as contextAwarePanelOpen, sn as Funnel, st as SlotNames, t as cellDomProps, tn as EmotionCacheProvider, tt as ContextAwarePanelItem, u as Slide, un as Ellipsis, v as InstallPackageButton, vn as ArrowDownWideNarrow, vt as TableHead, w as Progress, wt as renderCellValue, x as downloadByURL, xt as NAMELESS_COLUMN_PREFIX, y as ADD_PRINTING_CLASS, yt as TableHeader, z as ContextMenuSeparator, zt as Maps, __tla as __tla_2 } from "./common-JNfvrcu2.js";
30
30
  import { c as Calendar, i as createReducerAndAtoms, n as useOnUnmount, o as ToggleLeft, t as useOnMount } from "./useLifecycle-D4N02q82.js";
31
31
  import { t as Check } from "./check-D-BaEjEh.js";
32
32
  import { A as Icon, C as logNever, D as $18f2051aff69b9bf$export$a54013f0d02a8f82, E as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7, F as createCollection, I as X, M as clamp$2, N as usePrevious$2, P as useDirection, R as ChevronDown, S as assertNever, a as SelectGroup, c as SelectSeparator, d as NativeSelect, i as SelectContent, j as Trigger$1, l as SelectTrigger, n as capitalize, o as SelectItem, r as Select, s as SelectLabel, t as Strings, u as SelectValue, w as $a916eb452884faea$export$b7a616150fdb9f44 } from "./strings-BUDhKc0s.js";
@@ -38214,7 +38214,7 @@ ${c}
38214
38214
  function _temp2$2(e) {
38215
38215
  e.target === e.currentTarget && e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), e.currentTarget.click());
38216
38216
  }
38217
- var LazySlidesComponent = import_react.lazy(() => import("./reveal-component-DwO6vFzC.js"));
38217
+ var LazySlidesComponent = import_react.lazy(() => import("./reveal-component-_1Mnbk6F.js"));
38218
38218
  const SlidesLayoutRenderer = ({ layout: e, setLayout: r, cells: c, mode: l }) => {
38219
38219
  var _a5;
38220
38220
  let u = useAtomValue(kioskModeAtom), d = l === "read" || u, f = useAtomValue(numColumnsAtom) > 1, [p, m] = (0, import_react.useState)(null), { slideCells: h, skippedIds: g, noOutputIds: _, slideTypes: v, startCellIndex: y } = (0, import_react.useMemo)(() => computeSlideCellsInfo(c, e), [
@@ -9,7 +9,7 @@ import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
9
9
  import { ut as outputIsStale } from "./html-to-image-DrEMf75G.js";
10
10
  import "./chunk-5FQGJX7Z-B9WoXK1R.js";
11
11
  import { u as createLucideIcon } from "./dist-DarwE0ZO.js";
12
- import { a as DEFAULT_DECK_TRANSITION, cn as EyeOff, dt as PanelGroup, fn as Code, ft as PanelResizeHandle, l as SlideSidebar, ln as Expand, n as useNotebookCodeAvailable, o as DEFAULT_DECK_VERTICAL_ALIGN, s as DEFAULT_SLIDE_TYPE, t as cellDomProps, u as Slide, ut as Panel } from "./common-BpaVk2oS.js";
12
+ import { a as DEFAULT_DECK_TRANSITION, cn as EyeOff, dt as PanelGroup, fn as Code, ft as PanelResizeHandle, l as SlideSidebar, ln as Expand, n as useNotebookCodeAvailable, o as DEFAULT_DECK_VERTICAL_ALIGN, s as DEFAULT_SLIDE_TYPE, t as cellDomProps, u as Slide, ut as Panel } from "./common-JNfvrcu2.js";
13
13
  import { R as ChevronDown } from "./strings-BUDhKc0s.js";
14
14
  import { X as useDebouncedCallback } from "./input-B4ddy8Jy.js";
15
15
  import { v as kioskModeAtom } from "./toDate-BiyuFdnT.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.23.17-dev45",
3
+ "version": "0.23.17-dev47",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -0,0 +1,39 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { act, renderHook } from "@testing-library/react";
4
+ import { describe, expect, it } from "vitest";
5
+ import type { ChatId } from "@/core/ai/state";
6
+ import { useChatControllerId } from "../use-chat-controller-id";
7
+
8
+ describe("useChatControllerId", () => {
9
+ it("creates a new ID when starting another unsaved chat", () => {
10
+ const activeChatId = "existing-chat" as ChatId;
11
+ const initialProps: { activeId: ChatId | undefined } = {
12
+ activeId: undefined,
13
+ };
14
+ const { result, rerender } = renderHook(
15
+ ({ activeId }: { activeId: ChatId | undefined }) =>
16
+ useChatControllerId(activeId),
17
+ { initialProps },
18
+ );
19
+
20
+ const initialDraftId = result.current.chatControllerId;
21
+ rerender({ activeId: activeChatId });
22
+
23
+ expect(result.current.chatControllerId).toBe(activeChatId);
24
+
25
+ act(() => result.current.renewDraftChatId());
26
+ rerender({ activeId: undefined });
27
+
28
+ expect(result.current.chatControllerId).not.toBe(initialDraftId);
29
+ });
30
+
31
+ it("renews the ID when the current chat is already unsaved", () => {
32
+ const { result } = renderHook(() => useChatControllerId(undefined));
33
+ const initialDraftId = result.current.chatControllerId;
34
+
35
+ act(() => result.current.renewDraftChatId());
36
+
37
+ expect(result.current.chatControllerId).not.toBe(initialDraftId);
38
+ });
39
+ });
@@ -110,6 +110,7 @@ import {
110
110
  import { getCodes } from "@/core/codemirror/copilot/getCodes";
111
111
  import { focusInputAndMoveToEnd } from "@/core/codemirror/utils";
112
112
  import ScrollToBottomButton from "./acp/scroll-to-bottom-button";
113
+ import { useChatControllerId } from "./use-chat-controller-id";
113
114
 
114
115
  // Default mode for the AI
115
116
  const DEFAULT_MODE = "manual";
@@ -554,6 +555,8 @@ const ChatPanelBody = () => {
554
555
  const { openModal, closeModal } = useImperativeModal();
555
556
 
556
557
  const activeChatId = activeChat?.id;
558
+ const { chatControllerId, renewDraftChatId } =
559
+ useChatControllerId(activeChatId);
557
560
  const store = useStore();
558
561
 
559
562
  const { addStagedCell } = useStagedAICellsActions();
@@ -577,7 +580,7 @@ const ChatPanelBody = () => {
577
580
  addToolApprovalResponse,
578
581
  id: chatId,
579
582
  } = useChat({
580
- id: activeChatId,
583
+ id: chatControllerId,
581
584
  throttle: AI_SDK_UI_THROTTLE_MS,
582
585
  sendAutomaticallyWhen: ({ messages }) => hasPendingToolCalls(messages),
583
586
  messages: activeChat?.messages || [], // initial messages
@@ -816,6 +819,7 @@ const ChatPanelBody = () => {
816
819
  );
817
820
 
818
821
  const handleNewChat = useEvent(() => {
822
+ renewDraftChatId();
819
823
  setActiveChat(null);
820
824
  setInput("");
821
825
  setNewThreadInput("");
@@ -0,0 +1,24 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { useState } from "react";
4
+ import useEvent from "react-use-event-hook";
5
+ import type { ChatId } from "@/core/ai/state";
6
+ import { generateUUID } from "@/utils/uuid";
7
+
8
+ function generateChatId(): ChatId {
9
+ return generateUUID() as ChatId;
10
+ }
11
+
12
+ /**
13
+ * Keep an ID for an unsaved chat so `useChat` can distinguish it from the
14
+ * previously active chat. Empty chats are not added to chat history.
15
+ */
16
+ export function useChatControllerId(activeChatId?: ChatId) {
17
+ const [draftChatId, setDraftChatId] = useState(generateChatId);
18
+ const renewDraftChatId = useEvent(() => setDraftChatId(generateChatId()));
19
+
20
+ return {
21
+ chatControllerId: activeChatId ?? draftChatId,
22
+ renewDraftChatId,
23
+ };
24
+ }