@marimo-team/islands 0.25.3-dev482 → 0.25.3-dev486

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 (108) hide show
  1. package/dist/{ConnectedDataExplorerComponent-LA5OtjAG.js → ConnectedDataExplorerComponent-BV2GFVYn.js} +9 -9
  2. package/dist/{ErrorBoundary-Tw4GGoit.js → ErrorBoundary-D--EtR81.js} +6 -6
  3. package/dist/{abnfDiagram-VCTEODGH-CBntFgCZ.js → abnfDiagram-VCTEODGH-1AWrWE-o.js} +2 -2
  4. package/dist/{any-language-editor-gzDRWdCH.js → any-language-editor-Dqpg95i0.js} +2 -2
  5. package/dist/{architectureDiagram-5GKGNRK7-Bz6ouXl-.js → architectureDiagram-5GKGNRK7-D0zM5fGn.js} +1 -1
  6. package/dist/{assertNever-DOTNJ2Y4.js → assertNever-BQEDS5Ew.js} +2 -2
  7. package/dist/assets/__vite-browser-external-DZv_7F5P.js +1 -0
  8. package/dist/assets/{worker-DFvnFhLF.js → worker-cHYZNFD4.js} +2 -2
  9. package/dist/{chat-ui-LeUI9zli.js → chat-ui-Blvl4-Kd.js} +16 -16
  10. package/dist/{check-CApwK1fD.js → check-BTnCP_6g.js} +1 -1
  11. package/dist/{chunk-IMKFNOWR-DK_M66Dt.js → chunk-IMKFNOWR-CTe-GyEo.js} +1 -1
  12. package/dist/{chunk-SHT3W25Y-C7Cg6zGL.js → chunk-SHT3W25Y-mDvz0_Bb.js} +1 -1
  13. package/dist/{chunk-SVP7TREG-K0lWia53.js → chunk-SVP7TREG-TQe5CTi-.js} +1 -1
  14. package/dist/{chunk-TICWLB2K-DiKpryGp.js → chunk-TICWLB2K-DueGZcaL.js} +1 -1
  15. package/dist/{classDiagram-ZZMXUADV-CXX5eaxi.js → classDiagram-ZZMXUADV-C80WtbRl.js} +2 -2
  16. package/dist/{classDiagram-v2-VYDZK3BY-Bjyy4iKL.js → classDiagram-v2-VYDZK3BY-BGUFGXB1.js} +2 -2
  17. package/dist/{code-visibility-CWrFAfrs.js → code-visibility-CKSt_AlX.js} +14 -14
  18. package/dist/{common-DZARFS07.js → common-B0U1M1ok.js} +30 -30
  19. package/dist/{config-C8TXSDmC.js → config-DbjezUyA.js} +3 -3
  20. package/dist/{copy-icon-CDvvlY90.js → copy-icon-7bY-OuK1.js} +2 -2
  21. package/dist/{createReducer-CXqSak4H.js → createReducer-BTiEYD5d.js} +1 -1
  22. package/dist/{cynefinDiagram-5FMLGOSQ-C-MlCYj4.js → cynefinDiagram-5FMLGOSQ-B1FxtX7q.js} +1 -1
  23. package/dist/{dagre-GXQ25YYZ-C6e9vEKZ.js → dagre-GXQ25YYZ-DsaxsLKR.js} +1 -1
  24. package/dist/{data-grid-overlay-editor-C1ZVcFjq.js → data-grid-overlay-editor-B1wgTm3e.js} +1 -1
  25. package/dist/{diagram-S7CK7UJ4-DgXNq_At.js → diagram-S7CK7UJ4-0_x8Q-Gz.js} +1 -1
  26. package/dist/{diagram-UQ7AKVKN-BG5NExCt.js → diagram-UQ7AKVKN-nvR7yqd-.js} +1 -1
  27. package/dist/{diagram-VX7I27RA-Da7VYCfC.js → diagram-VX7I27RA-BnEUU78X.js} +1 -1
  28. package/dist/{diagram-Z3DM3KII-DHk6GaR5.js → diagram-Z3DM3KII-BHX2x9ql.js} +1 -1
  29. package/dist/{dialog-rgayPemF.js → dialog-CBKdXrw9.js} +2 -2
  30. package/dist/{dropdown-menu-B12Nf3Zf.js → dropdown-menu-218IIk7S.js} +5 -5
  31. package/dist/{ebnfDiagram-PWID7BFC-DdSjinXr.js → ebnfDiagram-PWID7BFC-DYZD7-aw.js} +2 -2
  32. package/dist/{erDiagram-RLTQ6QDP-BgcwfZct.js → erDiagram-RLTQ6QDP-Bv-0tHzX.js} +1 -1
  33. package/dist/{error-banner-DXHIN-63.js → error-banner-cub3qDum.js} +1 -1
  34. package/dist/{error-entries--YT1ZOUW.js → error-entries-MZLN-feW.js} +92 -87
  35. package/dist/feedback-button-coih3loz.js +370 -0
  36. package/dist/{flowDiagram-HODETNUW-CVwzkmUF.js → flowDiagram-HODETNUW-BV2Dug--.js} +2 -2
  37. package/dist/{formats-BWuAsLfw.js → formats-CBWqzCiR.js} +1 -1
  38. package/dist/{glide-data-editor-BQHo_8OJ.js → glide-data-editor-BGlWbHIN.js} +11 -11
  39. package/dist/{glide-utils-D1McS0Pn.js → glide-utils-DlglW_uh.js} +2 -2
  40. package/dist/{globals-DQXC3L6D.js → globals-C08BeEBR.js} +3 -3
  41. package/dist/{html-to-image-BMt1erSy.js → html-to-image-D6h4lzXj.js} +79 -79
  42. package/dist/{infoDiagram-27XIBGKW-CHkU2P-8.js → infoDiagram-27XIBGKW-xekhSKlY.js} +1 -1
  43. package/dist/{ishikawaDiagram-5VMMS53U-B0k5UyY5.js → ishikawaDiagram-5VMMS53U-Coe7mUqv.js} +1 -1
  44. package/dist/{kanban-definition-UXKFOSKX-DwQvOV0x.js → kanban-definition-UXKFOSKX-Znywqtyi.js} +1 -1
  45. package/dist/main.js +8725 -8691
  46. package/dist/{mermaid-Bqy6f_NU.js → mermaid-DRT7MewO.js} +34 -34
  47. package/dist/{mindmap-definition-YA3MSWOX-CqvvAm8I.js → mindmap-definition-YA3MSWOX-Do_NrRXE.js} +1 -1
  48. package/dist/{number-overlay-editor-B6VKb3LS.js → number-overlay-editor-J2u2bfxK.js} +1 -1
  49. package/dist/{pegDiagram-XKGWAZYB-Befnx4Ry.js → pegDiagram-XKGWAZYB-CTuwofVH.js} +2 -2
  50. package/dist/{pencil-BC7pOv9g.js → pencil-qedVMD6q.js} +1 -1
  51. package/dist/{pieDiagram-E7YTZNPT-6rYFbF7p.js → pieDiagram-E7YTZNPT-CFHRBvha.js} +1 -1
  52. package/dist/{process-output-CNBGRz3r.js → process-output-MYh-Vr__.js} +4 -4
  53. package/dist/{railroadDiagram-O6MQD6OU-SSniwYC8.js → railroadDiagram-O6MQD6OU-BJBqS4A3.js} +2 -2
  54. package/dist/{requirementDiagram-BXWQKSXE-3L_xNfQr.js → requirementDiagram-BXWQKSXE-CoMoIh3b.js} +1 -1
  55. package/dist/{reveal-component-BlB1yXJU.js → reveal-component-CZLdWmre.js} +7 -7
  56. package/dist/{select-PQHWLm64.js → select-BcEi9lad.js} +4 -4
  57. package/dist/{sequenceDiagram-WJ2MYXX4-DvzIRlWu.js → sequenceDiagram-WJ2MYXX4-Cu7Mpp-z.js} +1 -1
  58. package/dist/{spec-6shN7lEe.js → spec-AxyC1vc5.js} +4 -4
  59. package/dist/{stateDiagram-D77RDMKH-VsHup-Ig.js → stateDiagram-D77RDMKH-DX7_Rnib.js} +2 -2
  60. package/dist/{stateDiagram-v2-MP3YSRHH-BwIIR8nk.js → stateDiagram-v2-MP3YSRHH-oFXVbGoo.js} +2 -2
  61. package/dist/{static-state-CWXd6dYX.js → static-state-CqzVppxA.js} +1 -1
  62. package/dist/{swimlanes-42K2YHIH-DhSDCIWI.js → swimlanes-42K2YHIH-CxzCGtVZ.js} +1 -1
  63. package/dist/{swimlanesDiagram-VR7AAH4N-C2WGVm-W.js → swimlanesDiagram-VR7AAH4N-1a1GRLNf.js} +2 -2
  64. package/dist/{timeline-definition-24CTP7MA-DhUhNinO.js → timeline-definition-24CTP7MA-Pfn2awsU.js} +1 -1
  65. package/dist/{toast-BGvv7tKS.js → toast-aYa8V5tR.js} +3 -3
  66. package/dist/{tooltip-CiJ919pg.js → tooltip-CwQmweEz.js} +1 -1
  67. package/dist/{use-restore-focus-BLj45Ibw.js → use-restore-focus-DlX1CSiq.js} +6 -1
  68. package/dist/{useDateFormatter-C659lkax.js → useDateFormatter-BAckjdIS.js} +2 -2
  69. package/dist/{useDeepCompareMemoize-CDhinwm7.js → useDeepCompareMemoize-C6mte0N8.js} +1 -1
  70. package/dist/{useLifecycle-mKiMNa4V.js → useLifecycle-XZ5KJAFU.js} +1 -1
  71. package/dist/{vega-component-CWvQ7wBJ.js → vega-component-_We1FoNw.js} +6 -6
  72. package/dist/{vennDiagram-4TSXK5OY-exvBF8P5.js → vennDiagram-4TSXK5OY-DrIqDugg.js} +1 -1
  73. package/dist/{wardleyDiagram-VM6X3IG4-BFhJmnXo.js → wardleyDiagram-VM6X3IG4-DBPVNfc3.js} +1 -1
  74. package/dist/{xychartDiagram-S5SC5T6Z-D_xAdG6u.js → xychartDiagram-S5SC5T6Z-64Isocef.js} +1 -1
  75. package/package.json +1 -1
  76. package/src/__mocks__/executions.ts +2 -0
  77. package/src/__tests__/CellStatus.test.tsx +3 -3
  78. package/src/components/dependency-graph/__tests__/elements.test.ts +20 -11
  79. package/src/components/dependency-graph/dependency-graph-tree.tsx +17 -3
  80. package/src/components/dependency-graph/elements.ts +12 -25
  81. package/src/components/editor/cell/CellStatus.tsx +23 -38
  82. package/src/components/editor/cell/ReusableDefinitionBadge.tsx +62 -0
  83. package/src/components/editor/notebook-cell.tsx +8 -67
  84. package/src/components/slides/slide-cell-view.tsx +1 -1
  85. package/src/core/cells/__tests__/cells.test.ts +0 -3
  86. package/src/core/cells/actions.ts +0 -1
  87. package/src/core/cells/cells.ts +0 -12
  88. package/src/core/cells/execution-console.ts +0 -2
  89. package/src/core/cells/reusable-definition.ts +25 -0
  90. package/src/core/cells/types.ts +1 -6
  91. package/src/core/executions/__tests__/atoms.test.ts +1 -41
  92. package/src/core/executions/__tests__/output-lifecycle.test.ts +1 -5
  93. package/src/core/executions/__tests__/select.test.ts +34 -2
  94. package/src/core/executions/atoms.ts +16 -31
  95. package/src/core/executions/hooks.ts +2 -3
  96. package/src/core/executions/index.ts +0 -1
  97. package/src/core/executions/select.ts +55 -2
  98. package/src/core/islands/bootstrap.ts +0 -16
  99. package/src/core/notebook/replica/replica.ts +50 -3
  100. package/src/core/notebook/replica/resources/analysis.ts +9 -0
  101. package/src/core/session/__tests__/backend.test.ts +3 -12
  102. package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +84 -0
  103. package/src/core/session/active-notebook.ts +6 -0
  104. package/src/core/session/backend.ts +4 -4
  105. package/src/core/session/useNotebookSession.tsx +0 -17
  106. package/src/stories/cell-status.stories.tsx +6 -6
  107. package/dist/assets/__vite-browser-external-DoIBUY2I.js +0 -1
  108. package/dist/feedback-button-Cypq285l.js +0 -370
@@ -2,7 +2,7 @@ import { i as e } from "./chunk-75Z2AOVW-76L6My3P.js";
2
2
  import { n as t } from "./src-D5uZaZib.js";
3
3
  import { n } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
4
4
  import { D as r, H as i, K as a, U as o, a as s, b as c, c as l, v as u, w as d, x as f, y as p } from "./chunk-DU6HZSFF-4SDIhUTY.js";
5
- import { p as m } from "./mermaid-Bqy6f_NU.js";
5
+ import { p as m } from "./mermaid-DRT7MewO.js";
6
6
  import { n as h } from "./mermaid-parser.core-DtOnl7m4.js";
7
7
  import { t as g } from "./chunk-JWPE2WC7-DJvv1t8U.js";
8
8
  //#region ../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-VM6X3IG4.mjs
@@ -9,7 +9,7 @@ import { n as s } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
9
9
  import { D as c, H as l, K as u, U as d, a as f, b as p, c as m, f as h, v as g, w as _, y as v, z as y } from "./chunk-DU6HZSFF-4SDIhUTY.js";
10
10
  import "./chunk-PWAF6VOD-CRu_RGP2.js";
11
11
  import { t as b } from "./chunk-GMAD6QVW-BJGF8QZL.js";
12
- import { p as x } from "./mermaid-Bqy6f_NU.js";
12
+ import { p as x } from "./mermaid-DRT7MewO.js";
13
13
  //#region ../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/band.js
14
14
  function S() {
15
15
  var e = t().unknown(void 0), r = e.domain, i = e.range, o = 0, s = 1, c, l, u = !1, d = 0, f = 0, p = .5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.25.3-dev482",
3
+ "version": "0.25.3-dev486",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -262,6 +262,7 @@ export const MockExecutions = {
262
262
  ),
263
263
  requested: new Set(),
264
264
  blocked: new Set(),
265
+ shownBlocked: new Set(),
265
266
  runtimeId: null,
266
267
  ...extra,
267
268
  };
@@ -287,6 +288,7 @@ export const MockExecutions = {
287
288
  generationAtom: atom(1),
288
289
  backendAtom: atom<NotebookBackend | null>(null),
289
290
  notebookAtom: atom<Protocol.Notebook | null>(MockExecutions.notebook()),
291
+ analysisAtom: atom(null),
290
292
  documentAtom,
291
293
  shownDocumentAtom: documentAtom,
292
294
  runtimeAtom: atom(runtime),
@@ -77,7 +77,7 @@ describe("CellStatusComponent", () => {
77
77
  interrupted: false,
78
78
  elapsedTime: null,
79
79
  startedAt: null,
80
- blocked: false,
80
+ blocked: null,
81
81
  uninstantiated: false,
82
82
  };
83
83
 
@@ -124,7 +124,7 @@ describe("CellStatusComponent", () => {
124
124
  test("renders disabled transitively state", () => {
125
125
  const props = {
126
126
  ...baseProps,
127
- blocked: true,
127
+ blocked: "current" as const,
128
128
  startedAt: 1_704_096_000_000 as Milliseconds,
129
129
  };
130
130
 
@@ -139,7 +139,7 @@ describe("CellStatusComponent", () => {
139
139
  test("renders stale and disabled transitively state", () => {
140
140
  const props = {
141
141
  ...baseProps,
142
- blocked: true,
142
+ blocked: "current" as const,
143
143
  freshness: { sourceChanged: false, inputsChanged: true } as CellFreshness,
144
144
  startedAt: 1_704_096_000_000 as Milliseconds,
145
145
  };
@@ -3,7 +3,7 @@
3
3
  import { describe, expect, it } from "vitest";
4
4
  import type { CellId } from "@/core/cells/ids";
5
5
  import type { Variable, VariableName, Variables } from "@/core/variables/types";
6
- import { createCellRuntimeState } from "@/core/cells/types";
6
+ import type { CellDiagnostic } from "@marimo-team/client/protocol";
7
7
  import {
8
8
  collapsedNodeWidth,
9
9
  computeDefsByCell,
@@ -136,16 +136,25 @@ describe("reusableCellIds", () => {
136
136
  const c2 = "c2" as CellId;
137
137
  const c3 = "c3" as CellId;
138
138
 
139
- it("collects cells whose serialization hint is valid, case-insensitively", () => {
140
- const runtime = {
141
- [c1]: createCellRuntimeState({ serialization: "Valid" }),
142
- [c2]: createCellRuntimeState({ serialization: "Unparsable" }),
143
- [c3]: createCellRuntimeState(),
139
+ it("hides only reusable definitions reported by marimo", () => {
140
+ const valid: CellDiagnostic = {
141
+ source: "marimo",
142
+ kind: "reusable-definition",
143
+ severity: "information",
144
+ message: "Importable when saved as Python.",
145
+ range: null,
146
+ related: [],
144
147
  };
145
- expect(reusableCellIds([c1, c2, c3], runtime)).toEqual(new Set([c1]));
146
- });
147
-
148
- it("ignores cells with no runtime entry", () => {
149
- expect(reusableCellIds([c1], {})).toEqual(new Set());
148
+ const cell = { defs: [], refs: [], diagnostics: [valid] };
149
+ const cells = {
150
+ [c1]: cell,
151
+ [c2]: {
152
+ ...cell,
153
+ diagnostics: [{ ...valid, kind: "non-reusable-definition" }],
154
+ },
155
+ [c3]: { ...cell, diagnostics: [{ ...valid, source: "other" }] },
156
+ };
157
+ expect(reusableCellIds([c1, c2, c3], cells)).toEqual(new Set([c1]));
158
+ expect(reusableCellIds([c1], undefined)).toEqual(new Set());
150
159
  });
151
160
  });
@@ -28,12 +28,14 @@ import {
28
28
  import { lastFocusedCellIdAtom } from "@/core/cells/focus";
29
29
  import type { CellId } from "@/core/cells/ids";
30
30
  import type { CellData } from "@/core/cells/types";
31
+ import { notebookAnalysisAtom } from "@/core/session/active-notebook";
31
32
  import { store } from "@/core/state/jotai";
32
33
  import type { Variables } from "@/core/variables/types";
33
34
  import { Events } from "@/utils/events";
34
35
  import { Tooltip } from "../ui/tooltip";
35
36
  import {
36
37
  computeDefsByCell,
38
+ reusableCellIds,
37
39
  type NodeData,
38
40
  nodeDimensions,
39
41
  TreeElementsBuilder,
@@ -80,6 +82,18 @@ export const DependencyGraphTree: React.FC<PropsWithChildren<Props>> = ({
80
82
  layoutDirection,
81
83
  settings,
82
84
  }) => {
85
+ const hiddenReusable = useAtomValue(
86
+ useMemo(
87
+ () =>
88
+ atom((get) =>
89
+ settings.hideReusableFunctions
90
+ ? reusableCellIds(cellIds, get(notebookAnalysisAtom)?.cells)
91
+ : new Set<CellId>(),
92
+ ),
93
+ [cellIds, settings.hideReusableFunctions],
94
+ ),
95
+ );
96
+
83
97
  // Cells whose node is expanded to show its full code (toggled by double-click).
84
98
  const [expandedIds, setExpandedIds] = useState<Set<CellId>>(() => new Set());
85
99
 
@@ -90,7 +104,7 @@ export const DependencyGraphTree: React.FC<PropsWithChildren<Props>> = ({
90
104
  cellAtoms,
91
105
  variables,
92
106
  hidePureMarkdown: settings.hidePureMarkdown,
93
- hideReusableFunctions: settings.hideReusableFunctions,
107
+ hiddenReusable,
94
108
  });
95
109
  return layoutElements({
96
110
  nodes: withExpansion(elements.nodes, expandedIds),
@@ -168,7 +182,7 @@ export const DependencyGraphTree: React.FC<PropsWithChildren<Props>> = ({
168
182
  cellAtoms,
169
183
  variables,
170
184
  hidePureMarkdown: settings.hidePureMarkdown,
171
- hideReusableFunctions: settings.hideReusableFunctions,
185
+ hiddenReusable,
172
186
  });
173
187
  syncChanges({
174
188
  nodes: withExpansion(elements.nodes, expandedIds),
@@ -180,7 +194,7 @@ export const DependencyGraphTree: React.FC<PropsWithChildren<Props>> = ({
180
194
  cellAtoms,
181
195
  syncChanges,
182
196
  settings.hidePureMarkdown,
183
- settings.hideReusableFunctions,
197
+ hiddenReusable,
184
198
  expandedIds,
185
199
  sizeSignature,
186
200
  ]);
@@ -2,9 +2,10 @@
2
2
 
3
3
  import type { Atom } from "jotai";
4
4
  import { type Edge, MarkerType, type Node, type NodeProps } from "reactflow";
5
- import { getNotebook } from "@/core/cells/cells";
5
+ import type { Analysis } from "@marimo-team/client/protocol";
6
+ import { reusableDefinition } from "@/core/cells/reusable-definition";
6
7
  import type { CellId } from "@/core/cells/ids";
7
- import type { CellData, CellRuntimeState } from "@/core/cells/types";
8
+ import type { CellData } from "@/core/cells/types";
8
9
  import { store } from "@/core/state/jotai";
9
10
  import type { Variable, VariableName, Variables } from "@/core/variables/types";
10
11
  import { Arrays } from "@/utils/arrays";
@@ -47,7 +48,7 @@ interface CreateElementsOptions {
47
48
  cellAtoms: Atom<CellData>[];
48
49
  variables: Variables;
49
50
  hidePureMarkdown: boolean;
50
- hideReusableFunctions: boolean;
51
+ hiddenReusable: ReadonlySet<CellId>;
51
52
  }
52
53
 
53
54
  const LINE_HEIGHT = 11; // matches TinyCode.css
@@ -151,21 +152,15 @@ export function nodeDimensions(data: NodeData): {
151
152
  export const OUTPUTS_HANDLE_ID = "outputs";
152
153
  export const INPUTS_HANDLE_ID = "inputs";
153
154
 
154
- /**
155
- * Cells hidden by the reusable-functions filter: those the kernel marked as
156
- * valid top-level definitions (serialization hint `Valid`).
157
- */
158
155
  export function reusableCellIds(
159
- cellIds: CellId[],
160
- cellRuntime: Record<CellId, CellRuntimeState>,
156
+ cellIds: readonly CellId[],
157
+ cells: Analysis["cells"] | undefined,
161
158
  ): Set<CellId> {
162
- const reusable = new Set<CellId>();
163
- for (const cellId of cellIds) {
164
- if (cellRuntime[cellId]?.serialization?.toLowerCase() === "valid") {
165
- reusable.add(cellId);
166
- }
167
- }
168
- return reusable;
159
+ return new Set(
160
+ cellIds.filter(
161
+ (id) => reusableDefinition(cells?.[id])?.kind === "reusable-definition",
162
+ ),
163
+ );
169
164
  }
170
165
 
171
166
  /** Map each cell to the names of the variables it declares. */
@@ -319,18 +314,10 @@ export class TreeElementsBuilder implements ElementsBuilder {
319
314
  cellAtoms,
320
315
  variables,
321
316
  hidePureMarkdown,
322
- hideReusableFunctions,
317
+ hiddenReusable,
323
318
  }: CreateElementsOptions) {
324
319
  const nodes: Node<NodeData>[] = [];
325
320
 
326
- const cellRuntime = getNotebook().cellRuntime;
327
- // Hidden reusable cells are dropped along with their edges — a reusable
328
- // function is nearly always referenced somewhere, so gating on "no edges"
329
- // would make the filter a no-op.
330
- const hiddenReusable = hideReusableFunctions
331
- ? reusableCellIds(cellIds, cellRuntime)
332
- : new Set<CellId>();
333
-
334
321
  const nodesWithEdges = new Set<CellId>();
335
322
  // Dedupe cell→cell edges, aggregating every variable that crosses them so a
336
323
  // single edge can carry multiple refs and flag whether any is a state flow.
@@ -7,7 +7,11 @@ import {
7
7
  } from "lucide-react";
8
8
  import { useDateFormatter } from "react-aria";
9
9
  import { MultiIcon } from "@/components/icons/multi-icon";
10
- import type { CellFreshness, CellRunStatus } from "@/core/executions";
10
+ import type {
11
+ CellExecutionView,
12
+ CellFreshness,
13
+ CellRunStatus,
14
+ } from "@/core/executions";
11
15
  import { Logger } from "@/utils/Logger";
12
16
  import { useElapsedTime } from "../../../hooks/useElapsedTime";
13
17
  import { Tooltip } from "../../ui/tooltip";
@@ -20,7 +24,7 @@ export interface CellStatusComponentProps {
20
24
  editing: boolean;
21
25
  disabled: boolean;
22
26
  /** Whether a cell it depends on is disabled. */
23
- blocked: boolean;
27
+ blocked: CellExecutionView["shownBlock"];
24
28
  /** Whether the cell's result is current. */
25
29
  freshness: CellFreshness;
26
30
  status: CellRunStatus;
@@ -109,43 +113,20 @@ export const CellStatusComponent: React.FC<CellStatusComponentProps> = ({
109
113
  );
110
114
  }
111
115
 
112
- // disabled from parent
113
- if (!staleInputs && blocked) {
114
- return (
115
- <Tooltip
116
- content={
117
- <div className="flex flex-col gap-1">
118
- <span>
119
- An ancestor of this cell is disabled, so it can't be run
120
- </span>
121
- {lastRanTime}
122
- </div>
123
- }
124
- usePortal={true}
125
- >
126
- <div
127
- className="cell-status-icon cell-status-stale"
128
- data-testid="cell-status"
129
- data-status="disabled-transitively"
130
- >
131
- <MultiIcon layerTop={true}>
132
- <WorkflowIcon className="h-5 w-5" strokeWidth={1.5} />
133
- <BanIcon className="h-3 w-3" strokeWidth={2.5} />
134
- </MultiIcon>
135
- </div>
136
- </Tooltip>
137
- );
138
- }
139
-
140
- // stale from parent being disabled
141
- if (staleInputs && blocked) {
116
+ // A live run takes precedence over a badge from an earlier revision.
117
+ if (blocked === "current" || (blocked === "stale" && status === "idle")) {
118
+ let message = "An ancestor of this cell is disabled, so it can't be run";
119
+ if (blocked === "stale") {
120
+ message = "Blocked in the last analysis";
121
+ } else if (staleInputs) {
122
+ message =
123
+ "This cell is stale, but an ancestor is disabled so it can't be run";
124
+ }
142
125
  return (
143
126
  <Tooltip
144
127
  content={
145
128
  <div className="flex flex-col gap-1">
146
- <span>
147
- This cell is stale, but an ancestor is disabled so it can't be run
148
- </span>
129
+ <span>{message}</span>
149
130
  {lastRanTime}
150
131
  </div>
151
132
  }
@@ -154,10 +135,14 @@ export const CellStatusComponent: React.FC<CellStatusComponentProps> = ({
154
135
  <div
155
136
  className="cell-status-icon cell-status-stale"
156
137
  data-testid="cell-status"
157
- data-status="stale"
138
+ data-status={staleInputs ? "stale" : "disabled-transitively"}
158
139
  >
159
- <MultiIcon>
160
- <RefreshCwIcon className="h-5 w-5" strokeWidth={1} />
140
+ <MultiIcon layerTop={!staleInputs}>
141
+ {staleInputs ? (
142
+ <RefreshCwIcon className="h-5 w-5" strokeWidth={1} />
143
+ ) : (
144
+ <WorkflowIcon className="h-5 w-5" strokeWidth={1.5} />
145
+ )}
161
146
  <BanIcon className="h-3 w-3" strokeWidth={2.5} />
162
147
  </MultiIcon>
163
148
  </div>
@@ -0,0 +1,62 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import type { CellDiagnostic } from "@marimo-team/client/protocol";
4
+ import { HelpCircleIcon, SquareFunctionIcon } from "lucide-react";
5
+ import { Tooltip } from "@/components/ui/tooltip";
6
+
7
+ const LEARN_MORE = "https://links.marimo.app/reusable-definitions";
8
+
9
+ /** Whether a lone function or class is saved at module scope, and why not. */
10
+ export const ReusableDefinitionBadge = ({
11
+ finding,
12
+ }: {
13
+ finding: CellDiagnostic;
14
+ }) => {
15
+ const reusable = finding.kind === "reusable-definition";
16
+ const Icon = reusable ? SquareFunctionIcon : HelpCircleIcon;
17
+ return (
18
+ <div className="py-1 px-2 flex items-center justify-end gap-2 last:rounded-b">
19
+ {reusable && (
20
+ <a
21
+ href={LEARN_MORE}
22
+ target="_blank"
23
+ className="hover:underline text-muted-foreground text-xs font-bold"
24
+ rel="noreferrer"
25
+ >
26
+ reusable
27
+ </a>
28
+ )}
29
+ <Tooltip
30
+ content={
31
+ <span className="max-w-16 text-xs">
32
+ {reusable ? (
33
+ finding.message
34
+ ) : (
35
+ <>
36
+ This definition can't be reused in other Python modules:
37
+ <br />
38
+ <br />
39
+ <pre>{finding.message}</pre>
40
+ <br />
41
+ Click this icon to learn more.
42
+ </>
43
+ )}
44
+ </span>
45
+ }
46
+ >
47
+ <a
48
+ href={LEARN_MORE}
49
+ target="_blank"
50
+ rel="noreferrer"
51
+ aria-label="Learn about reusable definitions"
52
+ >
53
+ <Icon
54
+ size={16}
55
+ strokeWidth={1.5}
56
+ className="rounded-lg text-muted-foreground"
57
+ />
58
+ </a>
59
+ </Tooltip>
60
+ </div>
61
+ );
62
+ };
@@ -3,11 +3,7 @@ import { closeCompletion, completionStatus } from "@codemirror/autocomplete";
3
3
  import type { EditorView } from "@codemirror/view";
4
4
  import clsx from "clsx";
5
5
  import { useAtomValue, useSetAtom } from "jotai";
6
- import {
7
- HelpCircleIcon,
8
- MoreHorizontalIcon,
9
- SquareFunctionIcon,
10
- } from "lucide-react";
6
+ import { HelpCircleIcon, MoreHorizontalIcon } from "lucide-react";
11
7
  import {
12
8
  type FocusEvent,
13
9
  forwardRef,
@@ -30,6 +26,7 @@ import {
30
26
  outputIsLoading,
31
27
  outputIsStale,
32
28
  } from "@/core/cells/cell";
29
+ import { useReusableDefinition } from "@/core/cells/reusable-definition";
33
30
  import { isOutputEmpty } from "@/core/cells/outputs";
34
31
  import { useIsPendingCut } from "@/core/cells/pending-cut-service";
35
32
  import { autocompletionKeymap } from "@/core/codemirror/cm";
@@ -79,6 +76,7 @@ import { Logger } from "../../utils/Logger";
79
76
  import { renderShortcut } from "../shortcuts/renderShortcut";
80
77
  import { CellStatusComponent } from "./cell/CellStatus";
81
78
  import { CreateCellButton } from "./cell/CreateCellButton";
79
+ import { ReusableDefinitionBadge } from "./cell/ReusableDefinitionBadge";
82
80
  import {
83
81
  CellActionsDropdown,
84
82
  type CellActionsDropdownHandle,
@@ -389,6 +387,7 @@ const EditableCellComponent = ({
389
387
  const cellRef = useRef<HTMLDivElement>(null);
390
388
  const cellData = useCellData(cellId);
391
389
  const cellRuntime = useCellRuntime(cellId);
390
+ const reusable = useReusableDefinition(cellId);
392
391
  const output = useCellOutput(cellId);
393
392
  const outline = useCellOutline(cellId);
394
393
  const { execution, freshness } = useCellPresentation(cellId);
@@ -625,8 +624,6 @@ const EditableCellComponent = ({
625
624
  return undefined;
626
625
  };
627
626
 
628
- const isToplevel = cellRuntime.serialization?.toLowerCase() === "valid";
629
-
630
627
  return (
631
628
  <TooltipProvider>
632
629
  <CellActionsContextMenu
@@ -747,70 +744,14 @@ const EditableCellComponent = ({
747
744
  />
748
745
  )}
749
746
  {cellOutput === "below" && (outputArea || emptyMarkdownPlaceholder)}
750
- {!isPresenting && cellRuntime.serialization && (
751
- <div className="py-1 px-2 flex items-center justify-end gap-2 last:rounded-b">
752
- {isToplevel && (
753
- <a
754
- href="https://links.marimo.app/reusable-definitions"
755
- target="_blank"
756
- className="hover:underline text-muted-foreground text-xs font-bold"
757
- rel="noreferrer"
758
- >
759
- reusable
760
- </a>
761
- )}
762
- <Tooltip
763
- content={
764
- <span className="max-w-16 text-xs">
765
- {(isToplevel &&
766
- "This function or class can be imported into other Python notebooks or modules.") || (
767
- <>
768
- This definition can't be reused in other Python
769
- modules:
770
- <br />
771
- <br />
772
- <pre>{cellRuntime.serialization}</pre>
773
- <br />
774
- Click this icon to learn more.
775
- </>
776
- )}
777
- </span>
778
- }
779
- >
780
- {isToplevel ? (
781
- <a
782
- href="https://links.marimo.app/reusable-definitions"
783
- target="_blank"
784
- rel="noreferrer"
785
- >
786
- <SquareFunctionIcon
787
- size={16}
788
- strokeWidth={1.5}
789
- className="rounded-lg text-muted-foreground"
790
- />
791
- </a>
792
- ) : (
793
- <a
794
- href="https://links.marimo.app/reusable-definitions"
795
- target="_blank"
796
- rel="noreferrer"
797
- >
798
- <HelpCircleIcon
799
- size={16}
800
- strokeWidth={1.5}
801
- className="rounded-lg text-muted-foreground"
802
- />
803
- </a>
804
- )}
805
- </Tooltip>
806
- </div>
747
+ {!isPresenting && reusable && (
748
+ <ReusableDefinitionBadge finding={reusable} />
807
749
  )}
808
750
  {!isPresenting && (
809
751
  <ConsoleOutput
810
752
  consoleOutputs={cellRuntime.consoleOutputs}
811
753
  stale={consoleOutputStale}
812
- // Empty name if serialization triggered
813
- cellName={cellRuntime.serialization ? "_" : cellData.name}
754
+ cellName={reusable ? "_" : cellData.name}
814
755
  onRefactorWithAI={handleRefactorWithAI}
815
756
  onClear={() => {
816
757
  actions.clearCellConsoleOutput({ cellId });
@@ -864,7 +805,7 @@ const CellRightSideActions = memo(
864
805
  disabled={disabled}
865
806
  elapsedTime={execution.duration}
866
807
  startedAt={execution.startedAt}
867
- blocked={execution.blocked}
808
+ blocked={execution.shownBlock}
868
809
  uninstantiated={uninstantiated}
869
810
  />
870
811
  );
@@ -102,7 +102,7 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
102
102
  interrupted={interrupted}
103
103
  elapsedTime={execution.duration}
104
104
  startedAt={execution.startedAt}
105
- blocked={execution.blocked}
105
+ blocked={execution.shownBlock}
106
106
  uninstantiated={uninstantiated}
107
107
  />
108
108
  <LanguageToggles
@@ -421,7 +421,6 @@ describe("kernel-ready", () => {
421
421
  [CELL_B]: { id: CELL_B, code: "2" },
422
422
  },
423
423
  cellRuntime: {
424
- [CELL_A]: { serialization: "Valid" },
425
424
  [CELL_B]: {
426
425
  embeddedConsole: [
427
426
  {
@@ -441,7 +440,6 @@ describe("kernel-ready", () => {
441
440
  payload: undefined,
442
441
  });
443
442
 
444
- expect(next.cellRuntime[CELL_A].serialization).toBeUndefined();
445
443
  expect(next.cellRuntime[CELL_B].embeddedConsole).toEqual([]);
446
444
  });
447
445
 
@@ -486,7 +484,6 @@ describe("kernel-ready", () => {
486
484
  payload: undefined,
487
485
  });
488
486
 
489
- expect(next.cellRuntime[CELL_A].serialization).toBeUndefined();
490
487
  expect(next.cellRuntime[CELL_B].embeddedConsole[0]).toMatchObject({
491
488
  data: "hydrated-B-stdout",
492
489
  });
@@ -656,7 +656,6 @@ export function useCellActions() {
656
656
  // The session feeds the kernel's messages and the document into the
657
657
  // notebook through `useReducerActions`; components get the operations.
658
658
  const {
659
- setCellReusability: _setCellReusability,
660
659
  addLogs: _addLogs,
661
660
  reconcileDocument: _reconcileDocument,
662
661
  resetCellRuntimes: _resetCellRuntimes,
@@ -168,18 +168,6 @@ const {
168
168
  useActions,
169
169
  valueAtom: notebookAtom,
170
170
  } = createReducerAndAtoms(initialNotebookState, {
171
- setCellReusability: (
172
- state,
173
- message: { cell_id: CellId; serialization: string | null },
174
- ) =>
175
- updateCellRuntimeState({
176
- state,
177
- cellId: message.cell_id,
178
- cellReducer: (cell) => ({
179
- ...cell,
180
- serialization: message.serialization,
181
- }),
182
- }),
183
171
  startCellConsole: (state, { cellId }: { cellId: CellId }) =>
184
172
  updateCellRuntimeState({
185
173
  state,
@@ -203,7 +203,6 @@ export function consoleView(
203
203
  return {
204
204
  ...inputs,
205
205
  rendered: {
206
- serialization: local.serialization,
207
206
  consoleOutputs: added ? collapseConsoleOutputs([...rows, added]) : rows,
208
207
  },
209
208
  };
@@ -231,7 +230,6 @@ export function consoleView(
231
230
  return {
232
231
  ...inputs,
233
232
  rendered: {
234
- serialization: local.serialization,
235
233
  consoleOutputs: collapseConsoleBatch(entries),
236
234
  },
237
235
  };
@@ -0,0 +1,25 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import type { CellAnalysis } from "@marimo-team/client/protocol";
4
+ import { atom, useAtomValue } from "jotai";
5
+ import { useMemo } from "react";
6
+ import { notebookAnalysisAtom } from "../session/active-notebook";
7
+ import type { CellId } from "./ids";
8
+
9
+ export function reusableDefinition(cell: CellAnalysis | undefined) {
10
+ return cell?.diagnostics.find(
11
+ ({ source, kind }) =>
12
+ source === "marimo" &&
13
+ (kind === "reusable-definition" || kind === "non-reusable-definition"),
14
+ );
15
+ }
16
+
17
+ export function useReusableDefinition(id: CellId) {
18
+ return useAtomValue(
19
+ useMemo(
20
+ () =>
21
+ atom((get) => reusableDefinition(get(notebookAnalysisAtom)?.cells[id])),
22
+ [id],
23
+ ),
24
+ );
25
+ }
@@ -78,15 +78,10 @@ export interface CellRuntimeState {
78
78
  seq: number;
79
79
  prompts: ReadonlySet<string>;
80
80
  };
81
- /** serialization message. TODO(MO-8414) */
82
- serialization?: string | null;
83
81
  }
84
82
 
85
83
  /** The cell runtime fields available to renderers. */
86
- export interface CellRuntimeView extends Pick<
87
- CellRuntimeState,
88
- "serialization"
89
- > {
84
+ export interface CellRuntimeView {
90
85
  consoleOutputs: ConsoleOutputMessage[];
91
86
  }
92
87