@marimo-team/islands 0.22.5-dev22 → 0.22.5-dev25

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.
@@ -5,7 +5,7 @@ import { s as __toESM, t as __commonJSMin } from "./chunk-BNovOVIE.js";
5
5
  import { t as require_react } from "./react-Bs6Z0kvn.js";
6
6
  import { t as require_compiler_runtime } from "./compiler-runtime-B_OLMU9S.js";
7
7
  import { r as toast } from "./copy-BRF7ryOP.js";
8
- import { $t as singleFacet, A as MarimoIncomingMessageEvent, Bt as PluralWord, C as contextToXml, D as AccordionContent, E as Accordion, Fn as Info, Gt as allTablesAtom, I as ChatBubbleIcon, In as File$1, Kt as dataSourceConnectionsAtom, Nn as LoaderCircle, O as AccordionItem, On as Wrench, Ot as createVariableInfoElement, Q as cellErrorsAtom, Rt as jotaiJsonStorage, S as Sections, Sn as Anchor2, T as AIContextRegistry, U as deserializeBlob, Vn as CircleX, W as base64ToDataURL, Yt as getRequestClient, Z as renderHTML, a as toPng, bn as atomWithStorage, d as Spinner, f as Popover, g as isOutputEmpty, h as PopoverTrigger, in as ZodLocalStorage, jt as moveToEndOfEditor, k as AccordionTrigger, kn as Trash2, ln as CellOutputId, m as PopoverContent, n as blobToString, nt as notebookAtom, o as MarkdownRenderer, qt as getTableType, t as processOutput, w as AIContextProvider, x as Boosts, xt as displayCellName, y as DatasourceContextProvider, zt as variablesAtom } from "./process-output-CefHb9q-.js";
8
+ import { $t as singleFacet, A as MarimoIncomingMessageEvent, Bt as PluralWord, C as contextToXml, D as AccordionContent, E as Accordion, Fn as Info, Gt as allTablesAtom, I as ChatBubbleIcon, In as File$1, Kt as dataSourceConnectionsAtom, Nn as LoaderCircle, O as AccordionItem, On as Wrench, Ot as createVariableInfoElement, Q as cellErrorsAtom, Rt as jotaiJsonStorage, S as Sections, Sn as Anchor2, T as AIContextRegistry, U as deserializeBlob, Vn as CircleX, W as base64ToDataURL, Yt as getRequestClient, Z as renderHTML, a as toPng, bn as atomWithStorage, d as Spinner, f as Popover, g as isOutputEmpty, h as PopoverTrigger, in as ZodLocalStorage, jt as moveToEndOfEditor, k as AccordionTrigger, kn as Trash2, ln as CellOutputId, m as PopoverContent, n as blobToString, nt as notebookAtom, o as MarkdownRenderer, qt as getTableType, t as processOutput, w as AIContextProvider, x as Boosts, xt as displayCellName, y as DatasourceContextProvider, zt as variablesAtom } from "./process-output-D_uZ0o1x.js";
9
9
  import "./chunk-5FQGJX7Z-C428iZBW.js";
10
10
  import { u as createLucideIcon } from "./dist-D56NKWim.js";
11
11
  import { C as logNever, I as X, n as Strings, t as Label } from "./label-CIR53v8V.js";
package/dist/main.js CHANGED
@@ -21,7 +21,7 @@ import { a as __toCommonJS, n as __esmMin, r as __export, s as __toESM, t as __c
21
21
  import { t as require_react } from "./react-Bs6Z0kvn.js";
22
22
  import { t as require_compiler_runtime } from "./compiler-runtime-B_OLMU9S.js";
23
23
  import { n as Copy, r as toast, t as copyToClipboard } from "./copy-BRF7ryOP.js";
24
- import { $ as createActions, A as MarimoIncomingMessageEvent, An as Table2, At as Paths, B as DotFilledIcon, Bn as Columns2, Bt as PluralWord, Cn as Close$1, Ct as isInternalCellName, D as AccordionContent, Dn as Trigger2, Dt as MarkdownLanguageAdapter, E as Accordion, En as Root2$4, Et as customPythonLanguageSupport, F as BorderAllIcon, Fn as Info, Ft as useChromeActions, G as base64ToDataView, Gn as import_lib, H as PinRightIcon, Hn as CircleAlert, Ht as DATA_TYPE_ICON, In as File, It as repl, J as extractBase64FromDataURL, Jt as convertStatsName, K as base64ToUint8Array, L as CheckIcon, Ln as FileText, Lt as adaptForLocalStorage, M as MarimoValueReadyEvent, Mn as NotebookPen, Mt as goToCellLine, N as MarimoValueUpdateEvent, Nn as LoaderCircle, Nt as DeferredRequestRegistry, O as AccordionItem, On as Wrench, P as createInputEvent, Pn as Layers, Pt as generateUUID, Qt as isUninstantiated, R as ChevronDownIcon, Rn as Eye, Rt as jotaiJsonStorage, St as getValidName, Tn as Item$1, Tt as Checkbox, U as deserializeBlob, Un as Braces, Ut as getDataTypeColor, V as PinLeftIcon, Vn as CircleX, Vt as PluralWords, Wn as esm_default$1, Wt as require_client, X as safeExtractSetUIElementMessageBuffers, Xt as requestClientAtom, Y as isDataURLString, Yt as getRequestClient, Z as renderHTML, Zt as useRequestClient, _ as useExpandedConsoleOutput, _n as jsonToMarkdown, _t as headingToIdentifier, a as toPng, an as filenameAtom, at as useCellActions, b as getDatasourceContext, bn as atomWithStorage, bt as getCellDomProps, c as useCellFocusActions, cn as parseInitialValue, ct as createCell, d as Spinner, dn as SCRATCH_CELL_ID, dt as initialModeAtom, en as elementContainsMarimoCellFile, et as getCellEditorView, f as Popover$1, fn as UIElementId, ft as kioskModeAtom, g as isOutputEmpty, gn as jsonParseWithSpecialChar, gt as isErrorMime, h as PopoverTrigger, hn as RANDOM_ID_ATTR, ht as outputIsStale, i as PythonIcon, it as reducer, j as MarimoValueInputEvent, jn as PaintRoller, k as AccordionTrigger, kn as Trash2, kt as PathBuilder, l as useLastFocusedCellId, ln as CellOutputId, lt as AnsiUp, m as PopoverContent, mn as OBJECT_ID_ATTR, mt as outputIsLoading, n as blobToString, nn as getTracebackInfo, nt as notebookAtom, o as MarkdownRenderer, on as parseAttrValue, ot as useCellIds, p as PopoverClose$1, pn as findCellId, pt as viewStateAtom, q as dataViewToBase64, r as filesToBase64, rn as NotebookScopedLocalStorage, rt as notebookOutline, s as LazyAnyLanguageCodeMirror, sn as parseDataset, st as useCellNames, t as processOutput, tn as extractAllTracebackInfo, tt as getCellNames, u as maybeAddAltairImport, un as HTMLCellId, ut as getInitialAppMode, v as useExpandedOutput, vn as jsonToTSV, vt as sanitizeHtml, wn as Content2$1, wt as normalizeName, xn as selectAtom, xt as displayCellName, yn as atomWithReducer, yt as DATA_CELL_ID, z as ChevronRightIcon, zn as Database, __tla as __tla_0 } from "./process-output-CefHb9q-.js";
24
+ import { $ as createActions, A as MarimoIncomingMessageEvent, An as Table2, At as Paths, B as DotFilledIcon, Bn as Columns2, Bt as PluralWord, Cn as Close$1, Ct as isInternalCellName, D as AccordionContent, Dn as Trigger2, Dt as MarkdownLanguageAdapter, E as Accordion, En as Root2$4, Et as customPythonLanguageSupport, F as BorderAllIcon, Fn as Info, Ft as useChromeActions, G as base64ToDataView, Gn as import_lib, H as PinRightIcon, Hn as CircleAlert, Ht as DATA_TYPE_ICON, In as File, It as repl, J as extractBase64FromDataURL, Jt as convertStatsName, K as base64ToUint8Array, L as CheckIcon, Ln as FileText, Lt as adaptForLocalStorage, M as MarimoValueReadyEvent, Mn as NotebookPen, Mt as goToCellLine, N as MarimoValueUpdateEvent, Nn as LoaderCircle, Nt as DeferredRequestRegistry, O as AccordionItem, On as Wrench, P as createInputEvent, Pn as Layers, Pt as generateUUID, Qt as isUninstantiated, R as ChevronDownIcon, Rn as Eye, Rt as jotaiJsonStorage, St as getValidName, Tn as Item$1, Tt as Checkbox, U as deserializeBlob, Un as Braces, Ut as getDataTypeColor, V as PinLeftIcon, Vn as CircleX, Vt as PluralWords, Wn as esm_default$1, Wt as require_client, X as safeExtractSetUIElementMessageBuffers, Xt as requestClientAtom, Y as isDataURLString, Yt as getRequestClient, Z as renderHTML, Zt as useRequestClient, _ as useExpandedConsoleOutput, _n as jsonToMarkdown, _t as headingToIdentifier, a as toPng, an as filenameAtom, at as useCellActions, b as getDatasourceContext, bn as atomWithStorage, bt as getCellDomProps, c as useCellFocusActions, cn as parseInitialValue, ct as createCell, d as Spinner, dn as SCRATCH_CELL_ID, dt as initialModeAtom, en as elementContainsMarimoCellFile, et as getCellEditorView, f as Popover$1, fn as UIElementId, ft as kioskModeAtom, g as isOutputEmpty, gn as jsonParseWithSpecialChar, gt as isErrorMime, h as PopoverTrigger, hn as RANDOM_ID_ATTR, ht as outputIsStale, i as PythonIcon, it as reducer, j as MarimoValueInputEvent, jn as PaintRoller, k as AccordionTrigger, kn as Trash2, kt as PathBuilder, l as useLastFocusedCellId, ln as CellOutputId, lt as AnsiUp, m as PopoverContent, mn as OBJECT_ID_ATTR, mt as outputIsLoading, n as blobToString, nn as getTracebackInfo, nt as notebookAtom, o as MarkdownRenderer, on as parseAttrValue, ot as useCellIds, p as PopoverClose$1, pn as findCellId, pt as viewStateAtom, q as dataViewToBase64, r as filesToBase64, rn as NotebookScopedLocalStorage, rt as notebookOutline, s as LazyAnyLanguageCodeMirror, sn as parseDataset, st as useCellNames, t as processOutput, tn as extractAllTracebackInfo, tt as getCellNames, u as maybeAddAltairImport, un as HTMLCellId, ut as getInitialAppMode, v as useExpandedOutput, vn as jsonToTSV, vt as sanitizeHtml, wn as Content2$1, wt as normalizeName, xn as selectAtom, xt as displayCellName, yn as atomWithReducer, yt as DATA_CELL_ID, z as ChevronRightIcon, zn as Database, __tla as __tla_0 } from "./process-output-D_uZ0o1x.js";
25
25
  import { __tla as __tla_1 } from "./chunk-5FQGJX7Z-C428iZBW.js";
26
26
  import { o as useSize, s as Root$4, u as createLucideIcon } from "./dist-D56NKWim.js";
27
27
  import { A as $896ba0a80a8f4d36$export$85fd5fdf27bacc79, C as DEFAULT_COLOR_SCHEME, D as SCALE_TYPE_DESCRIPTIONS, E as EMPTY_VALUE$1, F as ListFilter, I as ChartPie, L as ChartColumn, M as $5a387cc49350e6db$export$722debc0e56fea39, N as Table$1, O as TIME_UNIT_DESCRIPTIONS, P as SquareFunction, S as DEFAULT_AGGREGATION, T as DEFAULT_TIME_UNIT, _ as AGGREGATION_TYPE_DESCRIPTIONS, a as AGGREGATION_FNS$1, 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 $fb18d541ea1ad717$export$ad991b66133851cf, 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-ByDEU1T3.js";
@@ -35662,7 +35662,7 @@ ${E}`,
35662
35662
  MimeBundleOutputRenderer.displayName = "MimeBundleOutputRenderer";
35663
35663
  const OutputArea = import_react.memo((e) => {
35664
35664
  let r = (0, import_compiler_runtime$94.c)(17), { output: c, cellId: d, stale: f, loading: h, allowExpand: _, forceExpand: v, className: y } = e;
35665
- if (c === null || c.channel === "output" && c.data === "") return null;
35665
+ if (c == null || c.channel === "output" && c.data === "") return null;
35666
35666
  let S = f ? "This output is stale" : void 0, w = _ ? ExpandableOutput : Div, E;
35667
35667
  r[0] === d ? E = r[1] : (E = CellOutputId.create(d), r[0] = d, r[1] = E);
35668
35668
  let O = f && "marimo-output-stale", M = h && "marimo-output-loading", I;
@@ -37125,7 +37125,7 @@ ${E}`,
37125
37125
  };
37126
37126
  }
37127
37127
  };
37128
- var LazyChatbot = import_react.lazy(() => import("./chat-ui-C-3Lg9w8.js").then((e) => ({
37128
+ var LazyChatbot = import_react.lazy(() => import("./chat-ui-BXYRQ5MH.js").then((e) => ({
37129
37129
  default: e.Chatbot
37130
37130
  }))), messageSchema = array(object({
37131
37131
  id: string(),
@@ -65633,7 +65633,7 @@ ${c}
65633
65633
  return Logger.warn("Failed to get version from mount config"), null;
65634
65634
  }
65635
65635
  }
65636
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.5-dev22"), showCodeInRunModeAtom = atom(true);
65636
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.5-dev25"), showCodeInRunModeAtom = atom(true);
65637
65637
  atom(null);
65638
65638
  var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
65639
65639
  constructor() {
@@ -24735,6 +24735,10 @@ ${n.sqlString}
24735
24735
  </pre>`,
24736
24736
  timestamp: -1
24737
24737
  }, o = e[i];
24738
+ if (o == null) return [
24739
+ a,
24740
+ ...e.slice(i + 1)
24741
+ ];
24738
24742
  if (o.mimetype === "text/plain") {
24739
24743
  invariant(typeof o.data == "string", "expected string");
24740
24744
  let r2 = o.data.split("\n"), s = t - (n - r2.length);
@@ -26237,7 +26241,7 @@ ${n.sqlString}
26237
26241
  let t2 = [
26238
26242
  ...e2.consoleOutputs
26239
26243
  ], n2 = t2[i];
26240
- return n2.channel === "stdin" ? (t2[i] = {
26244
+ return n2 == null || n2.channel !== "stdin" ? (Logger.warn("Expected stdin output"), e2) : (t2[i] = {
26241
26245
  channel: "stdin",
26242
26246
  mimetype: n2.mimetype,
26243
26247
  data: n2.data,
@@ -26247,7 +26251,7 @@ ${n.sqlString}
26247
26251
  ...e2,
26248
26252
  interrupted: false,
26249
26253
  consoleOutputs: t2
26250
- }) : (Logger.warn("Expected stdin output"), e2);
26254
+ });
26251
26255
  }
26252
26256
  });
26253
26257
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.22.5-dev22",
3
+ "version": "0.22.5-dev25",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -367,7 +367,7 @@ export const OutputArea = React.memo(
367
367
  forceExpand,
368
368
  className,
369
369
  }: OutputAreaProps) => {
370
- if (output === null) {
370
+ if (output == null) {
371
371
  return null;
372
372
  }
373
373
  if (output.channel === "output" && output.data === "") {
@@ -1,7 +1,9 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  import { render, screen } from "@testing-library/react";
3
3
  import { describe, expect, it } from "vitest";
4
- import { OutputRenderer } from "../Output";
4
+ import { cellId } from "@/__tests__/branded";
5
+ import { TooltipProvider } from "@/components/ui/tooltip";
6
+ import { OutputArea, OutputRenderer } from "../Output";
5
7
 
6
8
  describe("OutputRenderer renderFallback prop", () => {
7
9
  it("should use renderFallback for unsupported mimetypes", () => {
@@ -65,6 +67,39 @@ describe("OutputRenderer renderFallback prop", () => {
65
67
  });
66
68
  });
67
69
 
70
+ describe("OutputArea null/undefined handling", () => {
71
+ it("should render null when output is null", () => {
72
+ const { container } = render(
73
+ <TooltipProvider>
74
+ <OutputArea
75
+ output={null}
76
+ cellId={cellId("test")}
77
+ stale={false}
78
+ loading={false}
79
+ allowExpand={true}
80
+ />
81
+ </TooltipProvider>,
82
+ );
83
+ expect(container.innerHTML).toBe("");
84
+ });
85
+
86
+ it("should render null when output is undefined", () => {
87
+ const { container } = render(
88
+ <TooltipProvider>
89
+ <OutputArea
90
+ // @ts-expect-error -- testing runtime safety for undefined output
91
+ output={undefined}
92
+ cellId={cellId("test")}
93
+ stale={false}
94
+ loading={false}
95
+ allowExpand={true}
96
+ />
97
+ </TooltipProvider>,
98
+ );
99
+ expect(container.innerHTML).toBe("");
100
+ });
101
+ });
102
+
68
103
  describe("OutputRenderer image and SVG rendering", () => {
69
104
  const plainSvgString =
70
105
  '<svg><rect x="0" y="0" width="10" height="10"></rect></svg>';
@@ -1209,6 +1209,47 @@ describe("cell reducer", () => {
1209
1209
  ]);
1210
1210
  });
1211
1211
 
1212
+ it("does not crash when setStdinResponse has out-of-bounds outputIndex", () => {
1213
+ const STDOUT: OutputMessage = {
1214
+ channel: "stdout",
1215
+ mimetype: "text/plain",
1216
+ data: "hello!",
1217
+ timestamp: 1,
1218
+ };
1219
+
1220
+ // Set the cell to running with a console output
1221
+ actions.prepareForRun({ cellId: firstCellId });
1222
+ actions.handleCellMessage({
1223
+ cell_id: firstCellId,
1224
+ output: undefined,
1225
+ console: null,
1226
+ status: "running",
1227
+ stale_inputs: null,
1228
+ timestamp: new Date(20).getTime() as Seconds,
1229
+ });
1230
+ actions.handleCellMessage({
1231
+ cell_id: firstCellId,
1232
+ output: undefined,
1233
+ console: STDOUT,
1234
+ status: undefined,
1235
+ stale_inputs: null,
1236
+ timestamp: new Date(22).getTime() as Seconds,
1237
+ });
1238
+
1239
+ // Try to set stdin response with an out-of-bounds index
1240
+ // This should not crash - it should return state unchanged
1241
+ actions.setStdinResponse({
1242
+ response: "test",
1243
+ cellId: firstCellId,
1244
+ outputIndex: 999,
1245
+ });
1246
+
1247
+ // Cell state should be unchanged
1248
+ const cell = cells[0];
1249
+ expect(cell.consoleOutputs).toHaveLength(1);
1250
+ expect(cell.consoleOutputs[0]).toMatchObject(STDOUT);
1251
+ });
1252
+
1212
1253
  it("can receive console when the cell is idle and will clear when starts again", () => {
1213
1254
  const OLD_STDOUT: OutputMessage = {
1214
1255
  channel: "stdout",
@@ -241,6 +241,44 @@ describe("collapseConsoleOutputs", () => {
241
241
  expect(result[2].data).toBe("<pre>E\nF\nG\nH\n</pre>");
242
242
  });
243
243
 
244
+ it("should not crash when truncating with a single output at the limit boundary", () => {
245
+ // Create outputs that push truncation to the exact boundary
246
+ const consoleOutputs: OutputMessage[] = [
247
+ {
248
+ mimetype: "text/html",
249
+ channel: "output",
250
+ data: "<div>html1</div>",
251
+ timestamp: 0,
252
+ },
253
+ {
254
+ mimetype: "text/html",
255
+ channel: "output",
256
+ data: "<div>html2</div>",
257
+ timestamp: 0,
258
+ },
259
+ ];
260
+ // With limit=1, truncation must handle edge cases gracefully
261
+ const result = collapseConsoleOutputs(consoleOutputs, 1);
262
+ expect(result[0].data).toContain("Streaming output truncated");
263
+ });
264
+
265
+ it("should handle truncation when cutoff indexes past the end of the array", () => {
266
+ // With maxLines=0, the truncation loop never runs, causing cutoff
267
+ // to index past the array. This exercises the `output == null`
268
+ // defensive branch in truncateHead().
269
+ const consoleOutputs: OutputMessage[] = [
270
+ {
271
+ mimetype: "text/html",
272
+ channel: "output",
273
+ data: "<div>content</div>",
274
+ timestamp: 0,
275
+ },
276
+ ];
277
+ const result = collapseConsoleOutputs(consoleOutputs, 0);
278
+ expect(result).toHaveLength(1);
279
+ expect(result[0].data).toContain("Streaming output truncated");
280
+ });
281
+
244
282
  describe("ANSI escape sequences", () => {
245
283
  it("should handle cursor movement with collapse", () => {
246
284
  const consoleOutputs: OutputMessage[] = [
@@ -947,7 +947,7 @@ const {
947
947
  cellReducer: (cell) => {
948
948
  const consoleOutputs = [...cell.consoleOutputs];
949
949
  const stdinOutput = consoleOutputs[outputIndex];
950
- if (stdinOutput.channel !== "stdin") {
950
+ if (stdinOutput == null || stdinOutput.channel !== "stdin") {
951
951
  Logger.warn("Expected stdin output");
952
952
  return cell;
953
953
  }
@@ -108,6 +108,9 @@ function truncateHead(consoleOutputs: OutputMessage[], limit: number) {
108
108
  timestamp: -1,
109
109
  };
110
110
  const output = consoleOutputs[cutoff];
111
+ if (output == null) {
112
+ return [warningOutput, ...consoleOutputs.slice(cutoff + 1)];
113
+ }
111
114
  if (output.mimetype === "text/plain") {
112
115
  invariant(typeof output.data === "string", "expected string");
113
116
  const outputLines = output.data.split("\n");