@marimo-team/islands 0.25.3-dev460 → 0.25.3-dev462

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 (54) hide show
  1. package/dist/{ErrorBoundary-D2YXxE_x.js → ErrorBoundary-BnH_3-iX.js} +1 -1
  2. package/dist/assets/__vite-browser-external-DxDOnHRB.js +1 -0
  3. package/dist/assets/{worker-DLJ9P24O.js → worker-D70Lo75A.js} +2 -2
  4. package/dist/{chat-ui-wWHUzOrx.js → chat-ui-Ci-OmyBN.js} +3 -3
  5. package/dist/{code-visibility-BPWgfZVa.js → code-visibility-9cVyvQDR.js} +2 -2
  6. package/dist/{common-_2RH91nQ.js → common-BFNJT3tG.js} +3 -3
  7. package/dist/{data-grid-overlay-editor-yh1wqygW.js → data-grid-overlay-editor-CQpih6Vr.js} +1 -1
  8. package/dist/{error-entries-3nytC8-z.js → error-entries-DMWlemUn.js} +471 -447
  9. package/dist/{feedback-button-Ctc_u2JY.js → feedback-button-D_xvjRAC.js} +3 -3
  10. package/dist/{glide-data-editor-DJikF-sp.js → glide-data-editor-ttA3lt4w.js} +3 -3
  11. package/dist/{globals-D8_0qvIC.js → globals-DgHMWwtp.js} +1 -1
  12. package/dist/{html-to-image-C3Nb90uM.js → html-to-image-CDlYnllr.js} +1 -1
  13. package/dist/main.js +8527 -8499
  14. package/dist/{number-overlay-editor-BUXorcPD.js → number-overlay-editor-VuSNPGWk.js} +1 -1
  15. package/dist/{process-output-BiLaCBoX.js → process-output-89n_C_pU.js} +2 -2
  16. package/dist/{reveal-component-B54ZJYk8.js → reveal-component-D63GuWKz.js} +2 -2
  17. package/package.json +1 -1
  18. package/src/__mocks__/executions.ts +61 -30
  19. package/src/components/editor/__tests__/output-persistence.test.tsx +1 -1
  20. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +5 -1
  21. package/src/components/editor/renderers/grid-layout/grid-layout.tsx +1 -1
  22. package/src/core/cells/__tests__/clear-outputs.test.ts +18 -19
  23. package/src/core/cells/__tests__/harness.ts +4 -1
  24. package/src/core/cells/__tests__/layout.test.ts +4 -1
  25. package/src/core/cells/__tests__/runs.test.ts +2 -2
  26. package/src/core/cells/__tests__/session.test.ts +52 -45
  27. package/src/core/cells/__tests__/utils.test.ts +3 -3
  28. package/src/core/cells/execution-console.ts +7 -2
  29. package/src/core/cells/runs.ts +1 -1
  30. package/src/core/cells/session.ts +28 -18
  31. package/src/core/executions/__tests__/freshness.test.ts +11 -9
  32. package/src/core/executions/__tests__/hooks.test.tsx +8 -9
  33. package/src/core/executions/__tests__/output-lifecycle.test.ts +34 -35
  34. package/src/core/executions/__tests__/output.test.ts +28 -53
  35. package/src/core/executions/__tests__/select.test.ts +7 -7
  36. package/src/core/executions/atoms.ts +5 -5
  37. package/src/core/executions/output.ts +25 -28
  38. package/src/core/executions/select.ts +3 -11
  39. package/src/core/export/__tests__/hooks.test.ts +7 -9
  40. package/src/core/notebook/replica/__tests__/replica.test.ts +3 -3
  41. package/src/core/notebook/replica/__tests__/results.test.ts +2 -2
  42. package/src/core/notebook/replica/execution-state.ts +20 -12
  43. package/src/core/notebook/replica/index.ts +2 -1
  44. package/src/core/notebook/replica/replica.ts +25 -5
  45. package/src/core/notebook/replica/resources/executions.ts +41 -17
  46. package/src/core/notebook/replica/resources/results.ts +11 -9
  47. package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +5 -9
  48. package/src/core/static/virtual-file-tracker.ts +5 -8
  49. package/src/core/transports/__tests__/server.test.ts +1 -1
  50. package/src/core/transports/__tests__/static.test.ts +17 -10
  51. package/src/core/transports/static.ts +14 -6
  52. package/src/stories/cell.stories.tsx +14 -14
  53. package/src/stories/layout/vertical/one-column.stories.tsx +2 -1
  54. package/dist/assets/__vite-browser-external-D2z_TiUO.js +0 -1
@@ -106,7 +106,7 @@ describe("static notebook backend", () => {
106
106
  it("delivers embedded results as completed executions after the document", async () => {
107
107
  const source = snapshot();
108
108
  const cell = source.cells[0];
109
- const result: Protocol.Execution = {
109
+ const execution: Protocol.Execution = {
110
110
  id: "embedded:result",
111
111
  run_id: "embedded:run",
112
112
  runtime_id: "embedded",
@@ -117,29 +117,36 @@ describe("static notebook backend", () => {
117
117
  status: "completed",
118
118
  started_at: null,
119
119
  completed_at: null,
120
- outcome: {
121
- kind: "value",
122
- display: { mimetype: "text/html", data: "<b>1</b>" },
123
- },
120
+ outcome: { kind: "succeeded" },
124
121
  depends_on: {},
125
122
  },
126
123
  };
124
+ const output: Protocol.Output = {
125
+ id: "embedded:result:output",
126
+ execution_id: execution.id,
127
+ media: { mimetype: "text/html", data: "<b>1</b>" },
128
+ };
127
129
  const { events } = await read(
128
- createStaticNotebookBackend({ ...source, results: [result] }),
130
+ createStaticNotebookBackend({
131
+ ...source,
132
+ results: [{ execution, output }],
133
+ }),
129
134
  );
130
135
  const reducer = createNotebookReducer({
131
136
  document: documentResource,
132
137
  executions,
133
138
  });
134
139
  const state = events.reduce(reducer.reduce, reducer.initial);
135
- expect(events.map((event) => event.event).slice(-3)).toEqual([
140
+ expect(events.map((event) => event.event).slice(-4)).toEqual([
136
141
  "document",
137
142
  "execution",
143
+ "output",
138
144
  "ready",
139
145
  ]);
140
- expect(state.resources.executions.results.get(cell.id)?.record).toEqual(
141
- result,
142
- );
146
+ expect(state.resources.executions.results.get(cell.id)).toMatchObject({
147
+ record: execution,
148
+ output,
149
+ });
143
150
  });
144
151
 
145
152
  it("preserves withheld source and its revision metadata", async () => {
@@ -11,8 +11,14 @@ export interface StaticNotebookSnapshot {
11
11
  readonly notebook: Omit<Protocol.Notebook, "operations">;
12
12
  readonly document: Protocol.Document;
13
13
  readonly cells: readonly Protocol.Cell[];
14
- /** What the cells last produced, as completed executions. */
15
- readonly results: readonly Protocol.Execution[];
14
+ /** What the cells last produced, as completed executions and their outputs. */
15
+ readonly results: readonly StaticResult[];
16
+ }
17
+
18
+ /** A completed execution and the output it showed, if it set one. */
19
+ export interface StaticResult {
20
+ readonly execution: Protocol.Execution;
21
+ readonly output: Protocol.Output | null;
16
22
  }
17
23
 
18
24
  /** The events that describe a snapshot, in the order a host sends them. */
@@ -27,10 +33,12 @@ function snapshotFrames(snapshot: StaticNotebookSnapshot): Protocol.Event[] {
27
33
  data: { cell },
28
34
  })),
29
35
  { event: "document", data: { document: snapshot.document } },
30
- ...snapshot.results.map((execution): Protocol.ExecutionEvent => ({
31
- event: "execution",
32
- data: { execution },
33
- })),
36
+ ...snapshot.results.flatMap(({ execution, output }): Protocol.Event[] => [
37
+ { event: "execution", data: { execution } },
38
+ ...(output === null
39
+ ? []
40
+ : [{ event: "output" as const, data: { output } }]),
41
+ ]),
34
42
  ];
35
43
  }
36
44
 
@@ -49,19 +49,7 @@ function seedResult(
49
49
  status: "completed",
50
50
  started_at: MockExecutions.T0,
51
51
  completed_at: MockExecutions.T1,
52
- outcome: {
53
- kind: "value",
54
- display:
55
- output === null
56
- ? null
57
- : {
58
- mimetype: output.mimetype,
59
- data:
60
- typeof output.data === "string"
61
- ? output.data
62
- : JSON.stringify(output.data),
63
- },
64
- },
52
+ outcome: { kind: "succeeded" },
65
53
  depends_on:
66
54
  freshness === undefined || freshness === "edited"
67
55
  ? {}
@@ -83,7 +71,19 @@ function seedResult(
83
71
  },
84
72
  [cid],
85
73
  );
86
- MockExecutions.seed(store, [ran], null, document);
74
+ const shown =
75
+ output === null
76
+ ? []
77
+ : [
78
+ MockExecutions.output(ran, {
79
+ mimetype: output.mimetype,
80
+ data:
81
+ typeof output.data === "string"
82
+ ? output.data
83
+ : JSON.stringify(output.data),
84
+ }),
85
+ ];
86
+ MockExecutions.seed(store, [ran, ...shown], null, document);
87
87
  }
88
88
 
89
89
  const Cell: React.FC<{
@@ -25,7 +25,7 @@ const LONG_REPR =
25
25
 
26
26
  /** Show the long repr as the cell's result. */
27
27
  function seedLongRepr(store: ReturnType<typeof createStore>, cellId: CellId) {
28
- const record = MockExecutions.shown(cellId, {
28
+ const [record, output] = MockExecutions.shown(cellId, {
29
29
  mimetype: "text/plain",
30
30
  data: LONG_REPR,
31
31
  });
@@ -43,6 +43,7 @@ function seedLongRepr(store: ReturnType<typeof createStore>, cellId: CellId) {
43
43
  },
44
44
  ],
45
45
  },
46
+ output,
46
47
  ]);
47
48
  }
48
49
 
@@ -1 +0,0 @@
1
- import{t as e}from"./worker-DLJ9P24O.js";var t=/* @__PURE__ */ e(((e,t)=>{t.exports={}}));export default t();