@marimo-team/islands 0.25.3-dev461 → 0.25.3-dev463

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.
Files changed (29) hide show
  1. package/dist/{ErrorBoundary-CgQcF2Y8.js → ErrorBoundary-LEY4eR-u.js} +1 -1
  2. package/dist/assets/__vite-browser-external-DoIBUY2I.js +1 -0
  3. package/dist/assets/{worker-D70Lo75A.js → worker-DFvnFhLF.js} +2 -2
  4. package/dist/{chat-ui-Ci-OmyBN.js → chat-ui-Ow2U38zW.js} +3 -3
  5. package/dist/{code-visibility-Bfy5Xs7h.js → code-visibility-B6vd-MS9.js} +2 -2
  6. package/dist/{common-B1BHI8OU.js → common-CmFmwC3k.js} +3 -3
  7. package/dist/{data-grid-overlay-editor-D1ZL_HM6.js → data-grid-overlay-editor-DLAyzP8s.js} +1 -1
  8. package/dist/{error-entries-DMWlemUn.js → error-entries-DEV4YOvI.js} +18 -22
  9. package/dist/{feedback-button-Dk6liQGD.js → feedback-button-ln7KZEYq.js} +3 -3
  10. package/dist/{glide-data-editor-BITFrcq_.js → glide-data-editor-DwVqbx2W.js} +3 -3
  11. package/dist/{globals-BT6bOWG8.js → globals-DqKjaSau.js} +1 -1
  12. package/dist/{html-to-image-CDlYnllr.js → html-to-image-BdgBPfgg.js} +1 -1
  13. package/dist/main.js +4345 -4361
  14. package/dist/{number-overlay-editor-BoH3EMeN.js → number-overlay-editor-D9vaIlf5.js} +1 -1
  15. package/dist/{process-output-89n_C_pU.js → process-output-C_EHwiTn.js} +2 -2
  16. package/dist/{reveal-component-DTAvChaV.js → reveal-component-BrnL8w_N.js} +2 -2
  17. package/package.json +1 -1
  18. package/src/__mocks__/notebook.ts +6 -3
  19. package/src/core/cells/execution-console.ts +18 -13
  20. package/src/core/islands/__tests__/bridge.test.ts +8 -1
  21. package/src/core/islands/bridge.ts +7 -3
  22. package/src/core/notebook/replica/__tests__/executions.test.ts +8 -7
  23. package/src/core/notebook/replica/__tests__/replica.test.ts +3 -1
  24. package/src/core/notebook/replica/replica.ts +2 -8
  25. package/src/core/notebook/replica/resources/executions.ts +1 -6
  26. package/src/core/session/__tests__/backend.test.ts +1 -1
  27. package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +8 -11
  28. package/src/stories/layout/vertical/one-column.stories.tsx +1 -2
  29. package/dist/assets/__vite-browser-external-DxDOnHRB.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
2
  import { t } from "./react-Bgs_wQh3.js";
3
- import { a as n } from "./glide-data-editor-BITFrcq_.js";
3
+ import { a as n } from "./glide-data-editor-DwVqbx2W.js";
4
4
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.1_57c124ac5a994dbbf13fd11838cf9ba9/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/private/number-overlay-editor-style.js
5
5
  var r = /* @__PURE__ */ e(t()), i = /*#__PURE__*/ n("div")({
6
6
  name: "NumberOverlayEditorStyle",
@@ -1,6 +1,6 @@
1
- import { T as e } from "./html-to-image-CDlYnllr.js";
1
+ import { T as e } from "./html-to-image-BdgBPfgg.js";
2
2
  import { h as t } from "./tooltip-CiJ919pg.js";
3
- import { Tt as n, wt as r } from "./error-entries-DMWlemUn.js";
3
+ import { Tt as n, wt as r } from "./error-entries-DEV4YOvI.js";
4
4
  import { r as i } from "./assertNever-DOTNJ2Y4.js";
5
5
  var a = t("file", [["path", {
6
6
  d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
@@ -3,14 +3,14 @@ import { g as t, h as n, i as r, m as i, t as a } from "./button-qQhINE7z.js";
3
3
  import { t as o } from "./react-Bgs_wQh3.js";
4
4
  import { t as s } from "./compiler-runtime-C5KHtL5D.js";
5
5
  import { h as c, t as l } from "./tooltip-CiJ919pg.js";
6
- import { Cn as u, En as d, Sn as f, dn as p, et as m, f as h, i as g, l as _, n as v, nt as y, r as b, t as x, tt as S, u as C } from "./common-B1BHI8OU.js";
6
+ import { Cn as u, En as d, Sn as f, dn as p, et as m, f as h, i as g, l as _, n as v, nt as y, r as b, t as x, tt as S, u as C } from "./common-CmFmwC3k.js";
7
7
  import { M as w } from "./select-PQHWLm64.js";
8
8
  import { X as T } from "./dropdown-menu-B12Nf3Zf.js";
9
9
  import { t as E } from "./jsx-runtime-D8btoEHk.js";
10
10
  import { Rt as D, Vt as O, f as k, i as ee } from "./use-restore-focus-BLj45Ibw.js";
11
11
  import { t as A } from "./useEvent-BoN7U38T.js";
12
12
  import { o as te } from "./static-state-CWXd6dYX.js";
13
- import { n as ne, t as re } from "./code-visibility-Bfy5Xs7h.js";
13
+ import { n as ne, t as re } from "./code-visibility-B6vd-MS9.js";
14
14
  /* empty css */
15
15
  var j = c("sticky-note", [["path", {
16
16
  d: "M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.25.3-dev461",
3
+ "version": "0.25.3-dev463",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -167,13 +167,16 @@ export const MockNotebook = {
167
167
  return record;
168
168
  }
169
169
  const traceback: Item = {
170
- kind: "display",
170
+ kind: "console",
171
171
  id: `traceback-${record.id}`,
172
172
  execution_id: record.id,
173
173
  seq: 0,
174
174
  content: {
175
- mimetype: "application/vnd.marimo+traceback",
176
- data: consoleTraceback,
175
+ kind: "media",
176
+ media: {
177
+ mimetype: "application/vnd.marimo+traceback",
178
+ data: consoleTraceback,
179
+ },
177
180
  },
178
181
  };
179
182
  return { ...record, items: [traceback] };
@@ -36,24 +36,26 @@ function consoleEntry(
36
36
  const id = item.seq + 1;
37
37
  switch (item.kind) {
38
38
  case "console":
39
- return {
40
- id,
41
- channel: item.name,
42
- data: item.text,
43
- mimetype: "text/plain",
44
- timestamp,
45
- };
46
- case "display":
39
+ if (item.content.kind === "text") {
40
+ return {
41
+ id,
42
+ channel: item.content.stream,
43
+ data: item.content.text,
44
+ mimetype: "text/plain",
45
+ timestamp,
46
+ };
47
+ }
48
+ const { media } = item.content;
47
49
  return {
48
50
  id,
49
51
  channel:
50
- item.content.mimetype === "application/vnd.marimo+traceback"
52
+ media.mimetype === "application/vnd.marimo+traceback"
51
53
  ? "stderr"
52
54
  : "media",
53
- mimetype: item.content.mimetype as OutputMessage["mimetype"],
54
- data: item.content.data,
55
+ mimetype: media.mimetype as OutputMessage["mimetype"],
56
+ data: media.data,
55
57
  code:
56
- item.content.mimetype === "application/vnd.marimo+traceback"
58
+ media.mimetype === "application/vnd.marimo+traceback"
57
59
  ? code
58
60
  : undefined,
59
61
  timestamp,
@@ -100,7 +102,10 @@ export function consoleObservers(
100
102
  if (output.channel === "media") {
101
103
  VirtualFileTracker.INSTANCE.track({ cell_id: cellId, output });
102
104
  }
103
- if (live && (item.kind === "console" || output.channel === "stderr")) {
105
+ if (
106
+ live &&
107
+ (output.channel === "stdout" || output.channel === "stderr")
108
+ ) {
104
109
  actions.addLogs({
105
110
  logs: getCellLogsForMessage({ cell_id: cellId, console: output }),
106
111
  });
@@ -418,7 +418,14 @@ describe("IslandsPyodideBridge", () => {
418
418
  };
419
419
  const write = (name: "stdout" | "stderr", text: string, seq = 0) => ({
420
420
  event: "console",
421
- data: { console: { id: text, execution_id: "e1", seq, name, text } },
421
+ data: {
422
+ console: {
423
+ id: text,
424
+ execution_id: "e1",
425
+ seq,
426
+ content: { kind: "text", stream: name, text },
427
+ },
428
+ },
422
429
  });
423
430
  sendNotebookEvent(2, record);
424
431
  sendNotebookEvent(2, write("stdout", "snapshot"));
@@ -212,13 +212,17 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
212
212
  const entry = frame.data.console;
213
213
  const cellId = cells.get(entry.execution_id);
214
214
  // Snapshot rows have no cursor. Only live writes belong in the logs.
215
- if (frame.id !== undefined && cellId !== undefined) {
215
+ if (
216
+ frame.id !== undefined &&
217
+ cellId !== undefined &&
218
+ entry.content.kind === "text"
219
+ ) {
216
220
  const logs = getCellLogsForMessage({
217
221
  cell_id: cellId,
218
222
  console: {
219
- channel: entry.name,
223
+ channel: entry.content.stream,
220
224
  mimetype: "text/plain",
221
- data: entry.text,
225
+ data: entry.content.text,
222
226
  timestamp: frame.data.time
223
227
  ? Date.parse(frame.data.time) / 1000
224
228
  : Date.now() / 1000,
@@ -118,19 +118,21 @@ describe("executions resource", () => {
118
118
  id: "o9",
119
119
  execution_id: "e12",
120
120
  seq: 0,
121
- name: "stdout",
122
- text: "late\n",
121
+ content: { kind: "text", stream: "stdout", text: "late\n" },
123
122
  };
124
123
  const shown = {
125
124
  id: "d1",
126
125
  execution_id: "e12",
127
126
  seq: 1,
128
- content: { mimetype: "text/plain", data: "figure" },
127
+ content: {
128
+ kind: "media",
129
+ media: { mimetype: "text/plain", data: "figure" },
130
+ },
129
131
  };
130
132
  const added = replay(
131
133
  [
132
134
  event({ event: "console", id: "111", data: { console: late } }),
133
- event({ event: "display", id: "112", data: { display: shown } }),
135
+ event({ event: "console", id: "112", data: { console: shown } }),
134
136
  ],
135
137
  done,
136
138
  );
@@ -138,7 +140,7 @@ describe("executions resource", () => {
138
140
 
139
141
  const cleared = replay(
140
142
  [
141
- removed("display", "d1", "113"),
143
+ removed("console", "d1", "113"),
142
144
  removed("console", "o9", "114"),
143
145
  removed("variable", "e12-x", "115"),
144
146
  ],
@@ -184,8 +186,7 @@ describe("executions resource", () => {
184
186
  id: "o-orphan",
185
187
  execution_id: "nope",
186
188
  seq: 0,
187
- name: "stdout",
188
- text: "",
189
+ content: { kind: "text", stream: "stdout", text: "" },
189
190
  },
190
191
  },
191
192
  }),
@@ -161,7 +161,9 @@ describe("NotebookReplica lifetime", () => {
161
161
  const events = fixtureEvents("notebook-events.sse");
162
162
  events.forEach(receive);
163
163
  const previous = store.get(client.executionsAtom).scratchConsole;
164
- expect(previous?.items.get("o3")).toMatchObject({ text: "2\n" });
164
+ expect(previous?.items.get("o3")).toMatchObject({
165
+ content: { kind: "text", text: "2\n" },
166
+ });
165
167
 
166
168
  receive({ event: "reset", data: {} });
167
169
  for (const event of events) {
@@ -49,7 +49,6 @@ export const EDITOR_EVENT_TYPES = [
49
49
  "run",
50
50
  "execution",
51
51
  "console",
52
- "display",
53
52
  "input",
54
53
  "output",
55
54
  "variable",
@@ -412,7 +411,7 @@ export function createNotebookReplica(
412
411
  }
413
412
  if (onItem) {
414
413
  for (const item of execution.items.values()) {
415
- if (item.kind === "display") {
414
+ if (item.kind === "console" && item.content.kind === "media") {
416
415
  onItem(execution.record, item, false);
417
416
  }
418
417
  }
@@ -454,14 +453,9 @@ export function createNotebookReplica(
454
453
  return;
455
454
  }
456
455
  case "console":
457
- case "display":
458
456
  case "input": {
459
457
  const item =
460
- event.event === "console"
461
- ? event.data.console
462
- : event.event === "display"
463
- ? event.data.display
464
- : event.data.input;
458
+ event.event === "console" ? event.data.console : event.data.input;
465
459
  const execution = executions.get(item.execution_id);
466
460
  if (execution && onItem) {
467
461
  const received = execution.items.get(item.id);
@@ -10,10 +10,9 @@ import {
10
10
  } from "./results";
11
11
  import { shown, startedAt } from "../execution-state";
12
12
 
13
- /** A console line, display, or input an execution produced, tagged by kind. */
13
+ /** A console entry or input an execution produced, tagged by kind. */
14
14
  type ProducedItem =
15
15
  | (Protocol.Console & { readonly kind: "console" })
16
- | (Protocol.Display & { readonly kind: "display" })
17
16
  | (Protocol.Input & { readonly kind: "input" });
18
17
 
19
18
  /** Time the host published the item, when included in a live event. */
@@ -54,7 +53,6 @@ type Kind =
54
53
  | "execution"
55
54
  | "output"
56
55
  | "console"
57
- | "display"
58
56
  | "input"
59
57
  | "variable";
60
58
 
@@ -315,9 +313,6 @@ export const executions: NotebookResource<Executions, Kind> = {
315
313
  console: (state, { data }) =>
316
314
  attach(state, { ...data.console, kind: "console", time: data.time }),
317
315
  "console.removed": (state, { data }) => detach(state, data.id),
318
- display: (state, { data }) =>
319
- attach(state, { ...data.display, kind: "display", time: data.time }),
320
- "display.removed": (state, { data }) => detach(state, data.id),
321
316
  input: (state, { data }) =>
322
317
  attach(state, { ...data.input, kind: "input", time: data.time }),
323
318
  variable: (state, { data }) => bind(state, data.variable),
@@ -87,7 +87,7 @@ describe("createEditorBackend", () => {
87
87
  const executionKinds = [
88
88
  "execution",
89
89
  "console",
90
- "display",
90
+ "output",
91
91
  "input",
92
92
  "marimo",
93
93
  ];
@@ -517,8 +517,7 @@ it.each(["", "latest"])(
517
517
  id: "second-line",
518
518
  execution_id: scratch.id,
519
519
  seq: 0,
520
- name: "stdout",
521
- text,
520
+ content: { kind: "text", stream: "stdout", text },
522
521
  },
523
522
  },
524
523
  });
@@ -593,8 +592,7 @@ it("keeps a browser-cleared console hidden when the running execution is replaye
593
592
  id: "new-line",
594
593
  execution_id: "e7",
595
594
  seq: 1,
596
- name: "stdout",
597
- text: "after the clear",
595
+ content: { kind: "text", stream: "stdout", text: "after the clear" },
598
596
  },
599
597
  },
600
598
  }),
@@ -753,8 +751,7 @@ it.each(["live", "replay"])(
753
751
  id: `line-${seq}`,
754
752
  execution_id: execution.id,
755
753
  seq,
756
- name: "stdout",
757
- text,
754
+ content: { kind: "text", stream: "stdout", text },
758
755
  },
759
756
  },
760
757
  });
@@ -815,8 +812,7 @@ it("replays execution, debugger, and callback output independently", async () =>
815
812
  id: "line",
816
813
  execution_id: execution.id,
817
814
  seq: 0,
818
- name: "stdout",
819
- text: "before pdb",
815
+ content: { kind: "text", stream: "stdout", text: "before pdb" },
820
816
  };
821
817
  const input = {
822
818
  id: "request",
@@ -906,7 +902,9 @@ it("replays execution, debugger, and callback output independently", async () =>
906
902
  act(() =>
907
903
  conn.receive({
908
904
  event: "console",
909
- data: { console: { ...line, text: "replaced" } },
905
+ data: {
906
+ console: { ...line, content: { ...line.content, text: "replaced" } },
907
+ },
910
908
  }),
911
909
  );
912
910
  expect(runtime().consoleOutputs.map((v) => v.data)).toEqual([
@@ -948,8 +946,7 @@ it.each([
948
946
  id: "old-line",
949
947
  execution_id: execution.id,
950
948
  seq: 0,
951
- name: "stdout",
952
- text: "previous run",
949
+ content: { kind: "text", stream: "stdout", text: "previous run" },
953
950
  },
954
951
  },
955
952
  });
@@ -38,8 +38,7 @@ function seedLongRepr(store: ReturnType<typeof createStore>, cellId: CellId) {
38
38
  id: "printed",
39
39
  execution_id: record.id,
40
40
  seq: 0,
41
- name: "stdout",
42
- text: "hello",
41
+ content: { kind: "text", stream: "stdout", text: "hello" },
43
42
  },
44
43
  ],
45
44
  },
@@ -1 +0,0 @@
1
- import{t as e}from"./worker-D70Lo75A.js";var t=/* @__PURE__ */ e(((e,t)=>{t.exports={}}));export default t();