@marimo-team/islands 0.25.3-dev437 → 0.25.3-dev438

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 (91) hide show
  1. package/dist/{ConnectedDataExplorerComponent-CoEU9snz.js → ConnectedDataExplorerComponent-LA5OtjAG.js} +11 -11
  2. package/dist/{ErrorBoundary-LQpWaaaj.js → ErrorBoundary-Bvtsf3zB.js} +18 -18
  3. package/dist/{abnfDiagram-VCTEODGH-RbfxpmIE.js → abnfDiagram-VCTEODGH-CBntFgCZ.js} +2 -2
  4. package/dist/{any-language-editor-Cw4VtZvb.js → any-language-editor-gzDRWdCH.js} +2 -2
  5. package/dist/{architectureDiagram-5GKGNRK7-DzzNVRo4.js → architectureDiagram-5GKGNRK7-Bz6ouXl-.js} +1 -1
  6. package/dist/{assertNever-ChGm2jYv.js → assertNever-DOTNJ2Y4.js} +2 -2
  7. package/dist/{chat-ui-BEMyRpmS.js → chat-ui-ZGXdN6Vr.js} +45 -45
  8. package/dist/{check-BHRB6N0I.js → check-CApwK1fD.js} +1 -1
  9. package/dist/{chunk-IMKFNOWR-1Zy6M_oP.js → chunk-IMKFNOWR-DK_M66Dt.js} +1 -1
  10. package/dist/{chunk-SHT3W25Y-yAttqZEk.js → chunk-SHT3W25Y-C7Cg6zGL.js} +1 -1
  11. package/dist/{chunk-SVP7TREG-MKJpuJHR.js → chunk-SVP7TREG-K0lWia53.js} +1 -1
  12. package/dist/{chunk-TICWLB2K-BOC0OebH.js → chunk-TICWLB2K-DiKpryGp.js} +1 -1
  13. package/dist/{classDiagram-ZZMXUADV-BOlD7kH9.js → classDiagram-ZZMXUADV-CXX5eaxi.js} +2 -2
  14. package/dist/{classDiagram-v2-VYDZK3BY-C3p3seuT.js → classDiagram-v2-VYDZK3BY-Bjyy4iKL.js} +2 -2
  15. package/dist/{code-visibility-Cl2Z5Y2R.js → code-visibility-CmfNaZAX.js} +17 -17
  16. package/dist/{common-DVxtA3e0.js → common-i_ykKLxU.js} +4881 -4842
  17. package/dist/{config-EJnOxh0i.js → config-C8TXSDmC.js} +18 -18
  18. package/dist/{copy-icon-Bv5SAA0w.js → copy-icon-CDvvlY90.js} +2 -2
  19. package/dist/{createReducer-BJJ0K5Tu.js → createReducer-CXqSak4H.js} +1 -1
  20. package/dist/{cynefinDiagram-5FMLGOSQ-BKnxm64C.js → cynefinDiagram-5FMLGOSQ-C-MlCYj4.js} +1 -1
  21. package/dist/{dagre-GXQ25YYZ-COBTexAI.js → dagre-GXQ25YYZ-C6e9vEKZ.js} +1 -1
  22. package/dist/{data-grid-overlay-editor-FI3lYcm3.js → data-grid-overlay-editor-kj617zpx.js} +1 -1
  23. package/dist/{diagram-S7CK7UJ4-Dyt3J6ek.js → diagram-S7CK7UJ4-DgXNq_At.js} +1 -1
  24. package/dist/{diagram-UQ7AKVKN-CJCsT4fA.js → diagram-UQ7AKVKN-BG5NExCt.js} +1 -1
  25. package/dist/{diagram-VX7I27RA-BboxCtbh.js → diagram-VX7I27RA-Da7VYCfC.js} +1 -1
  26. package/dist/{diagram-Z3DM3KII-DfRWWQ5t.js → diagram-Z3DM3KII-DHk6GaR5.js} +1 -1
  27. package/dist/{dialog-B8vU2hHC.js → dialog-rgayPemF.js} +20 -20
  28. package/dist/{dropdown-menu-DzhAnAhr.js → dropdown-menu-B12Nf3Zf.js} +703 -703
  29. package/dist/{ebnfDiagram-PWID7BFC-DYxwv-nl.js → ebnfDiagram-PWID7BFC-DdSjinXr.js} +2 -2
  30. package/dist/{erDiagram-RLTQ6QDP-D9e5WUw7.js → erDiagram-RLTQ6QDP-BgcwfZct.js} +1 -1
  31. package/dist/{error-banner-BRkKwvku.js → error-banner-DXHIN-63.js} +58 -58
  32. package/dist/{error-entries-BbxtqUQ4.js → error-entries-DMgIKuK1.js} +380 -380
  33. package/dist/{feedback-button-1MiN6gfS.js → feedback-button-CGAe5hFZ.js} +7 -7
  34. package/dist/{flowDiagram-HODETNUW-tt7EepxX.js → flowDiagram-HODETNUW-CVwzkmUF.js} +2 -2
  35. package/dist/{formats-HRSqKdFt.js → formats-BWuAsLfw.js} +1 -1
  36. package/dist/{glide-data-editor-Kt7kYQLq.js → glide-data-editor-BiU_hF9A.js} +11 -11
  37. package/dist/{glide-utils-BzjESEmr.js → glide-utils-D1McS0Pn.js} +2 -2
  38. package/dist/{globals-BjpSYd8i.js → globals-jz3DTWzC.js} +3 -3
  39. package/dist/{html-to-image-DuNAF8H5.js → html-to-image-Dopvv40j.js} +774 -774
  40. package/dist/{infoDiagram-27XIBGKW-CpQH_joy.js → infoDiagram-27XIBGKW-CHkU2P-8.js} +1 -1
  41. package/dist/{ishikawaDiagram-5VMMS53U-d-it4xqm.js → ishikawaDiagram-5VMMS53U-B0k5UyY5.js} +1 -1
  42. package/dist/{kanban-definition-UXKFOSKX-DItpqTFY.js → kanban-definition-UXKFOSKX-DwQvOV0x.js} +1 -1
  43. package/dist/main.js +4913 -4936
  44. package/dist/{mermaid-BugOVfeH.js → mermaid-Bqy6f_NU.js} +34 -34
  45. package/dist/{mindmap-definition-YA3MSWOX-D6IpF-_J.js → mindmap-definition-YA3MSWOX-CqvvAm8I.js} +1 -1
  46. package/dist/{number-overlay-editor-BG707U9t.js → number-overlay-editor-D3OSLsDB.js} +1 -1
  47. package/dist/{pegDiagram-XKGWAZYB-CXUu3QwE.js → pegDiagram-XKGWAZYB-Befnx4Ry.js} +2 -2
  48. package/dist/{pencil-DWRFEz2B.js → pencil-BC7pOv9g.js} +1 -1
  49. package/dist/{pieDiagram-E7YTZNPT-DoUJF0yj.js → pieDiagram-E7YTZNPT-6rYFbF7p.js} +1 -1
  50. package/dist/{process-output-Cl97_Reh.js → process-output-BidrKebE.js} +4 -4
  51. package/dist/{railroadDiagram-O6MQD6OU-BsGDhtLL.js → railroadDiagram-O6MQD6OU-SSniwYC8.js} +2 -2
  52. package/dist/{requirementDiagram-BXWQKSXE-BHW0qW2Z.js → requirementDiagram-BXWQKSXE-3L_xNfQr.js} +1 -1
  53. package/dist/{reveal-component-C8L9okWw.js → reveal-component-CnyvRvqy.js} +900 -900
  54. package/dist/{select-Brvb-RwP.js → select-PQHWLm64.js} +99 -99
  55. package/dist/{sequenceDiagram-WJ2MYXX4-DpgYJzLl.js → sequenceDiagram-WJ2MYXX4-DvzIRlWu.js} +1 -1
  56. package/dist/{spec-BWpscSQi.js → spec-6shN7lEe.js} +4 -4
  57. package/dist/{stateDiagram-D77RDMKH-Btf1jiYb.js → stateDiagram-D77RDMKH-VsHup-Ig.js} +2 -2
  58. package/dist/{stateDiagram-v2-MP3YSRHH-DN9FyEf3.js → stateDiagram-v2-MP3YSRHH-BwIIR8nk.js} +2 -2
  59. package/dist/{static-state-BhCfPRoz.js → static-state-CWXd6dYX.js} +9 -9
  60. package/dist/{swimlanes-42K2YHIH-2l_tR9qL.js → swimlanes-42K2YHIH-DhSDCIWI.js} +1 -1
  61. package/dist/{swimlanesDiagram-VR7AAH4N-BAkmv8kE.js → swimlanesDiagram-VR7AAH4N-C2WGVm-W.js} +2 -2
  62. package/dist/{timeline-definition-24CTP7MA-AxSxEOhx.js → timeline-definition-24CTP7MA-DhUhNinO.js} +1 -1
  63. package/dist/{toast-DOWc3HtU.js → toast-BGvv7tKS.js} +153 -153
  64. package/dist/{tooltip-DsQZP310.js → tooltip-CiJ919pg.js} +62 -62
  65. package/dist/{use-restore-focus-CTa7IRP6.js → use-restore-focus-BLj45Ibw.js} +75 -75
  66. package/dist/{useDateFormatter-CRuBYwR6.js → useDateFormatter-C659lkax.js} +2 -2
  67. package/dist/{useDeepCompareMemoize-B2RNcTmn.js → useDeepCompareMemoize-CDhinwm7.js} +1 -1
  68. package/dist/{useLifecycle-Bw0JtmoB.js → useLifecycle-mKiMNa4V.js} +1 -1
  69. package/dist/{vega-component-BV9sYHhU.js → vega-component-CWvQ7wBJ.js} +6 -6
  70. package/dist/{vennDiagram-4TSXK5OY-oHztO7MH.js → vennDiagram-4TSXK5OY-exvBF8P5.js} +1 -1
  71. package/dist/{wardleyDiagram-VM6X3IG4-DWeEjZSc.js → wardleyDiagram-VM6X3IG4-BFhJmnXo.js} +1 -1
  72. package/dist/{xychartDiagram-S5SC5T6Z-ESBlsY9i.js → xychartDiagram-S5SC5T6Z-D_xAdG6u.js} +1 -1
  73. package/package.json +1 -1
  74. package/src/components/editor/controls/Controls.tsx +5 -2
  75. package/src/components/editor/notebook-cell.tsx +7 -21
  76. package/src/components/editor/renderers/grid-layout/grid-layout.tsx +2 -7
  77. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +2 -4
  78. package/src/components/slides/minimap.tsx +2 -3
  79. package/src/components/slides/reveal-component.tsx +2 -3
  80. package/src/components/slides/slide-cell-view.tsx +5 -12
  81. package/src/core/cells/__tests__/cell.test.ts +8 -51
  82. package/src/core/cells/__tests__/utils.test.ts +27 -18
  83. package/src/core/cells/cell.ts +6 -12
  84. package/src/core/cells/cells.ts +5 -3
  85. package/src/core/cells/utils.ts +61 -55
  86. package/src/core/config/config.ts +4 -0
  87. package/src/core/executions/__tests__/hooks.test.tsx +48 -2
  88. package/src/core/executions/__tests__/select.test.ts +0 -17
  89. package/src/core/executions/hooks.ts +24 -0
  90. package/src/core/executions/index.ts +2 -0
  91. package/src/core/executions/select.ts +0 -5
@@ -2,7 +2,7 @@ import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
2
  import { h as t, r as n } from "./button-qQhINE7z.js";
3
3
  import { t as r } from "./react-Bgs_wQh3.js";
4
4
  import { t as i } from "./compiler-runtime-C5KHtL5D.js";
5
- import { h as a } from "./tooltip-DsQZP310.js";
5
+ import { h as a } from "./tooltip-CiJ919pg.js";
6
6
  import { t as o } from "./jsx-runtime-D8btoEHk.js";
7
7
  var s = a("calendar", [
8
8
  ["path", {
@@ -2,18 +2,18 @@ import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
2
  import { g as t, h as n, m as r, s as i } from "./button-qQhINE7z.js";
3
3
  import { t as a } from "./react-Bgs_wQh3.js";
4
4
  import { t as o } from "./compiler-runtime-C5KHtL5D.js";
5
- import { t as s } from "./tooltip-DsQZP310.js";
6
- import { l as c, t as l } from "./config-EJnOxh0i.js";
5
+ import { t as s } from "./tooltip-CiJ919pg.js";
6
+ import { l as c, t as l } from "./config-C8TXSDmC.js";
7
7
  import { t as u } from "./jsx-runtime-D8btoEHk.js";
8
- import { d } from "./use-restore-focus-CTa7IRP6.js";
9
- import { n as f } from "./error-banner-BRkKwvku.js";
8
+ import { d } from "./use-restore-focus-BLj45Ibw.js";
9
+ import { n as f } from "./error-banner-DXHIN-63.js";
10
10
  import { t as p } from "./debounce-DrhhziJv.js";
11
11
  import { t as ee } from "./objects-DCmMvZtn.js";
12
12
  import { t as te } from "./useEvent-BoN7U38T.js";
13
- import { a as ne, i as re, n as ie, t as m } from "./formats-HRSqKdFt.js";
13
+ import { a as ne, i as re, n as ie, t as m } from "./formats-BWuAsLfw.js";
14
14
  import { a as h, t as g } from "./arrays-DoQ-AILx.js";
15
15
  import { t as ae } from "./useAsyncData-P5-Oovhq.js";
16
- import { n as _, t as oe } from "./useDeepCompareMemoize-B2RNcTmn.js";
16
+ import { n as _, t as oe } from "./useDeepCompareMemoize-CDhinwm7.js";
17
17
  import { W as se, n as ce } from "./vega-loader.browser-Co9gYE8Z.js";
18
18
  import { t as le } from "./react-vega-CGgQEf0O.js";
19
19
  import { a as ue, n as de } from "./loader-Bin_dutt.js";
@@ -3,7 +3,7 @@ import { t } from "./src-D5uZaZib.js";
3
3
  import { n } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
4
4
  import { $ as r, H as i, K as a, U as o, a as s, b as c, c as l, et as u, f as d, nt as f, tt as p, v as m, w as h, y as g } from "./chunk-DU6HZSFF-4SDIhUTY.js";
5
5
  import { t as _ } from "./rough.esm-CtV9AnV1.js";
6
- import { p as v } from "./mermaid-BugOVfeH.js";
6
+ import { p as v } from "./mermaid-Bqy6f_NU.js";
7
7
  //#region ../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/transparentize.js
8
8
  var y = (e, t) => p(e, "a", -t), b = 1e-10;
9
9
  function x(e, t) {
@@ -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-BugOVfeH.js";
5
+ import { p as m } from "./mermaid-Bqy6f_NU.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-BugOVfeH.js";
12
+ import { p as x } from "./mermaid-Bqy6f_NU.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-dev437",
3
+ "version": "0.25.3-dev438",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -23,10 +23,11 @@ import {
23
23
  } from "@/core/session/connection-utils";
24
24
  import { ConnectionState } from "@/core/session/types";
25
25
  import { cn } from "@/utils/cn";
26
+ import { useShowChangedInputs } from "@/core/executions";
26
27
  import { Functions } from "@/utils/functions";
27
28
  import {
28
29
  canUndoDeletesAtom,
29
- needsRunAtom,
30
+ runReasonAtom,
30
31
  undoLabelAtom,
31
32
  } from "../../../core/cells/cells";
32
33
  import { useCellActions } from "../../../core/cells/actions";
@@ -58,7 +59,9 @@ export const Controls = ({
58
59
  }: ControlsProps): JSX.Element => {
59
60
  const undoAvailable = useAtomValue(canUndoDeletesAtom);
60
61
  const undoLabel = useAtomValue(undoLabelAtom);
61
- const needsRun = useAtomValue(needsRunAtom);
62
+ const reason = useAtomValue(runReasonAtom);
63
+ const showInputs = useShowChangedInputs(reason === "inputs");
64
+ const needsRun = reason === "inputs" ? showInputs : reason !== null;
62
65
  const { undoDeleteCell } = useCellActions();
63
66
  const closed = connectionState === ConnectionState.CLOSED;
64
67
 
@@ -45,8 +45,7 @@ import {
45
45
  type CellFreshness,
46
46
  type CellRunStatus,
47
47
  replyInput,
48
- useCellExecution,
49
- useCellFreshness,
48
+ useCellPresentation,
50
49
  useCellOutline,
51
50
  useCellOutput,
52
51
  } from "@/core/executions";
@@ -67,7 +66,7 @@ import {
67
66
  } from "../../core/cells/editor";
68
67
  import { type CellId, SETUP_CELL_ID } from "../../core/cells/ids";
69
68
  import {
70
- cellNeedsRun,
69
+ cellRunReason,
71
70
  cellStatusClasses,
72
71
  isUninstantiated,
73
72
  publishedCellClasses,
@@ -353,8 +352,7 @@ const ReadonlyCellComponent = forwardRef(
353
352
  const { cellId } = props;
354
353
  const cellData = useCellData(cellId);
355
354
  const output = useCellOutput(cellId);
356
- const execution = useCellExecution(cellId);
357
- const freshness = useCellFreshness(cellId);
355
+ const { execution, freshness } = useCellPresentation(cellId);
358
356
  const errored = execution.outcome === "error";
359
357
  const interrupted = execution.outcome === "interrupted";
360
358
  const stopped = execution.outcome === "skipped";
@@ -419,8 +417,7 @@ const EditableCellComponent = ({
419
417
  const cellRuntime = useCellRuntime(cellId);
420
418
  const output = useCellOutput(cellId);
421
419
  const outline = useCellOutline(cellId);
422
- const execution = useCellExecution(cellId);
423
- const freshness = useCellFreshness(cellId);
420
+ const { execution, freshness } = useCellPresentation(cellId);
424
421
  const errored = execution.outcome === "error";
425
422
  const interrupted = execution.outcome === "interrupted";
426
423
  const stopped = execution.outcome === "skipped";
@@ -441,12 +438,7 @@ const EditableCellComponent = ({
441
438
 
442
439
  const uninstantiated = isUninstantiated(execution);
443
440
 
444
- const needsRun = cellNeedsRun({
445
- freshness,
446
- interrupted,
447
- disabled: cellData.config.disabled,
448
- blocked: execution.blocked,
449
- });
441
+ const needsRun = cellRunReason(execution, freshness, cellData) !== null;
450
442
 
451
443
  const loading = outputIsLoading(execution.status);
452
444
 
@@ -1073,8 +1065,7 @@ const SetupCellComponent = ({
1073
1065
  const cellData = useCellData(cellId);
1074
1066
  const cellRuntime = useCellRuntime(cellId);
1075
1067
  const output = useCellOutput(cellId);
1076
- const execution = useCellExecution(cellId);
1077
- const freshness = useCellFreshness(cellId);
1068
+ const { execution, freshness } = useCellPresentation(cellId);
1078
1069
  const errored = execution.outcome === "error";
1079
1070
  const interrupted = execution.outcome === "interrupted";
1080
1071
  const stopped = execution.outcome === "skipped";
@@ -1091,12 +1082,7 @@ const SetupCellComponent = ({
1091
1082
 
1092
1083
  const uninstantiated = isUninstantiated(execution);
1093
1084
 
1094
- const needsRun = cellNeedsRun({
1095
- freshness,
1096
- interrupted,
1097
- disabled: cellData.config.disabled,
1098
- blocked: execution.blocked,
1099
- });
1085
+ const needsRun = cellRunReason(execution, freshness, cellData) !== null;
1100
1086
  const loading =
1101
1087
  execution.status === "running" || execution.status === "queued";
1102
1088
 
@@ -37,11 +37,7 @@ import { NumberField } from "@/components/ui/number-field";
37
37
  import { Switch } from "@/components/ui/switch";
38
38
  import { outputIsLoading, outputIsStale } from "@/core/cells/cell";
39
39
  import type { CellId } from "@/core/cells/ids";
40
- import {
41
- useCellExecution,
42
- useCellFreshness,
43
- useCellOutput,
44
- } from "@/core/executions";
40
+ import { useCellPresentation, useCellOutput } from "@/core/executions";
45
41
  import type { AppMode } from "@/core/mode";
46
42
  import { useIsDragging } from "@/hooks/useIsDragging";
47
43
  import { cn } from "@/utils/cn";
@@ -395,8 +391,7 @@ const GridCell = memo(
395
391
  className,
396
392
  }: GridCellProps) => {
397
393
  const output = useCellOutput(cellId);
398
- const execution = useCellExecution(cellId);
399
- const freshness = useCellFreshness(cellId);
394
+ const { execution, freshness } = useCellPresentation(cellId);
400
395
  const loading = outputIsLoading(execution.status);
401
396
  const stale = outputIsStale(execution, freshness, false);
402
397
  const hidden =
@@ -34,8 +34,7 @@ import { useResolvedMarimoConfig } from "@/core/config/config";
34
34
  import { CSSClasses } from "@/core/constants";
35
35
  import {
36
36
  runtimeStatusAtom,
37
- useCellExecution,
38
- useCellFreshness,
37
+ useCellPresentation,
39
38
  useCellOutput,
40
39
  } from "@/core/executions";
41
40
  import { useNotebookCodeAvailable } from "@/core/meta/code-visibility";
@@ -328,8 +327,7 @@ const VerticalCell = memo(
328
327
  }: VerticalCellProps) => {
329
328
  const cellRef = useRef<HTMLDivElement>(null);
330
329
  const output = useCellOutput(cellId);
331
- const execution = useCellExecution(cellId);
332
- const freshness = useCellFreshness(cellId);
330
+ const { execution, freshness } = useCellPresentation(cellId);
333
331
  const errored = execution.outcome === "error";
334
332
  const interrupted = execution.outcome === "interrupted";
335
333
  const stopped = execution.outcome === "skipped";
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { useDeleteCellCallback } from "@/components/editor/cell/useDeleteCell";
4
4
  import { outputIsStale } from "@/core/cells/cell";
5
- import { useCellExecution, useCellFreshness } from "@/core/executions";
5
+ import { useCellPresentation } from "@/core/executions";
6
6
  import { useCellActions } from "@/core/cells/actions";
7
7
  import type { CellId } from "@/core/cells/ids";
8
8
  import { type CellColumnId, type Layout, useLayout } from "@/core/cells/layout";
@@ -628,8 +628,7 @@ const SlideThumbnailCard = ({
628
628
  ...props
629
629
  }: SlideThumbnailCardProps) => {
630
630
  const { width, height, scale } = dimensions;
631
- const execution = useCellExecution(cell.id);
632
- const freshness = useCellFreshness(cell.id);
631
+ const { execution, freshness } = useCellPresentation(cell.id);
633
632
  const visual = isNoOutput ? NO_OUTPUT_VISUAL : getSlideTypeVisual(slideType);
634
633
  const isSkipped = isNoOutput || slideType === "skip";
635
634
 
@@ -20,7 +20,7 @@ import { Button } from "@/components/ui/button";
20
20
  import { useFullScreenElement } from "@/components/ui/fullscreen";
21
21
  import { Tooltip } from "@/components/ui/tooltip";
22
22
  import { outputIsStale } from "@/core/cells/cell";
23
- import { useCellExecution, useCellFreshness } from "@/core/executions";
23
+ import { useCellPresentation } from "@/core/executions";
24
24
  import type { CellId } from "@/core/cells/ids";
25
25
  import type { RuntimeCell } from "@/core/cells/types";
26
26
  import type { RevealApi, RevealConfig } from "reveal.js";
@@ -353,8 +353,7 @@ function resolveSlideContentStyle(
353
353
  * `display: contents`, which can't be targeted for background/border styling.
354
354
  */
355
355
  export const CellOutputBlock = ({ cell }: { cell: RuntimeCell }) => {
356
- const execution = useCellExecution(cell.id);
357
- const freshness = useCellFreshness(cell.id);
356
+ const { execution, freshness } = useCellPresentation(cell.id);
358
357
  return (
359
358
  <div className="flex flex-col" {...cellDomProps(cell.id, cell.name)}>
360
359
  <CellOutputSlide
@@ -17,13 +17,13 @@ import { outputIsStale } from "@/core/cells/cell";
17
17
  import { useCellActions } from "@/core/cells/actions";
18
18
  import { autoInstantiateAtom, useUserConfig } from "@/core/config/config";
19
19
  import {
20
- cellNeedsRun,
20
+ cellRunReason,
21
21
  cellStatusClasses,
22
22
  isUninstantiated,
23
23
  } from "@/core/cells/utils";
24
24
  import type { RuntimeCell } from "@/core/cells/types";
25
25
  import type { LanguageAdapterType } from "@/core/codemirror/language/types";
26
- import { useCellExecution, useCellFreshness } from "@/core/executions";
26
+ import { useCellPresentation } from "@/core/executions";
27
27
  import { connectionAtom } from "@/core/network/connection";
28
28
  import { useTheme } from "@/theme/useTheme";
29
29
  import { cn } from "@/utils/cn";
@@ -61,20 +61,14 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
61
61
 
62
62
  const cellOutputPosition = userConfig.display.cell_output;
63
63
  const hasOutput = cell.output != null;
64
- const execution = useCellExecution(cell.id);
65
- const freshness = useCellFreshness(cell.id);
64
+ const { execution, freshness } = useCellPresentation(cell.id);
66
65
  const errored = execution.outcome === "error";
67
66
  const interrupted = execution.outcome === "interrupted";
68
67
  const stopped = execution.outcome === "skipped";
69
68
 
70
69
  const uninstantiated = isUninstantiated(execution);
71
70
 
72
- const needsRun = cellNeedsRun({
73
- freshness,
74
- interrupted,
75
- disabled: cell.config.disabled,
76
- blocked: execution.blocked,
77
- });
71
+ const needsRun = cellRunReason(execution, freshness, cell) !== null;
78
72
 
79
73
  const editorWrapperClassName = cn(
80
74
  "marimo-cell",
@@ -189,8 +183,7 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
189
183
  export const SlideCellReadOnlyView = ({ cell }: { cell: RuntimeCell }) => {
190
184
  const [userConfig] = useUserConfig();
191
185
  const cellOutputPosition = userConfig.display.cell_output;
192
- const execution = useCellExecution(cell.id);
193
- const freshness = useCellFreshness(cell.id);
186
+ const { execution, freshness } = useCellPresentation(cell.id);
194
187
 
195
188
  const display = useMemo(() => getReadonlyCodeDisplay(cell.code), [cell.code]);
196
189
 
@@ -1,12 +1,8 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  import { describe, expect, it } from "vitest";
3
- import type {
4
- CellExecutionView,
5
- CellFreshness,
6
- CellRunStatus,
7
- } from "@/core/executions";
3
+ import type { CellExecutionView, CellFreshness } from "@/core/executions";
8
4
  import type { CellMessage, OutputMessage } from "@/core/kernel/messages";
9
- import type { Milliseconds, Seconds } from "@/utils/time";
5
+ import type { Seconds } from "@/utils/time";
10
6
  import {
11
7
  consoleOutputIsStale,
12
8
  outputIsLoading,
@@ -15,26 +11,18 @@ import {
15
11
  } from "../cell";
16
12
  import { createCellRuntimeState } from "../types";
17
13
 
18
- const STATUSES: CellRunStatus[] = ["queued", "running", "idle"];
19
-
20
- const NOW = Date.now() as Milliseconds;
21
-
22
14
  const CURRENT: CellFreshness = { sourceChanged: false, inputsChanged: false };
23
15
  const EDITED: CellFreshness = { sourceChanged: true, inputsChanged: false };
24
16
  const REPLACED: CellFreshness = { sourceChanged: false, inputsChanged: true };
25
17
  const BOTH: CellFreshness = { sourceChanged: true, inputsChanged: true };
26
18
 
27
- type View = Pick<
28
- CellExecutionView,
29
- "status" | "outcome" | "startedAt" | "rendered"
30
- >;
19
+ type View = Pick<CellExecutionView, "status" | "outcome" | "startedAt">;
31
20
 
32
21
  function view(overrides: Partial<View>): View {
33
22
  return {
34
23
  status: "idle",
35
24
  outcome: null,
36
25
  startedAt: null,
37
- rendered: false,
38
26
  ...overrides,
39
27
  };
40
28
  }
@@ -54,24 +42,13 @@ describe("outputIsLoading", () => {
54
42
  });
55
43
 
56
44
  describe("outputIsStale", () => {
57
- it.each(STATUSES)(
58
- "should return true if the cell is edited and status is %s",
45
+ it.each(["queued", "running"] as const)(
46
+ "keeps previous output visible while %s",
59
47
  (status) => {
60
- expect(outputIsStale(view({ status }), EDITED, true)).toBe(true);
48
+ expect(outputIsStale(view({ status }), BOTH, true)).toBe(false);
61
49
  },
62
50
  );
63
51
 
64
- it("should return true if the cell is loading", () => {
65
- expect(outputIsStale(view({ status: "running" }), CURRENT, false)).toBe(
66
- true,
67
- );
68
- });
69
-
70
- it("should return false if the cell is running and has shown output", () => {
71
- const running = view({ status: "running", rendered: true });
72
- expect(outputIsStale(running, CURRENT, false)).toBe(false);
73
- });
74
-
75
52
  it("should return true if the cell has stale inputs", () => {
76
53
  expect(outputIsStale(view({}), REPLACED, false)).toBe(true);
77
54
  });
@@ -94,41 +71,21 @@ describe("outputIsStale", () => {
94
71
  expect(outputIsStale(view({}), EDITED, false)).toBe(false);
95
72
  });
96
73
 
97
- it("should return true if the cell is queued", () => {
98
- expect(outputIsStale(view({ status: "queued" }), CURRENT, false)).toBe(
99
- true,
100
- );
101
- });
102
-
103
- it("should return true if the cell is running but no output is received", () => {
104
- const running = view({ status: "running", startedAt: NOW });
105
- expect(outputIsStale(running, CURRENT, false)).toBe(true);
106
- });
107
-
108
74
  it("should return true if the cell is interrupted and edited since", () => {
109
75
  expect(outputIsStale(view({ outcome: "interrupted" }), EDITED, true)).toBe(
110
76
  true,
111
77
  );
112
78
  });
113
79
 
114
- it("should not dim output the rerun of edited code has already shown", () => {
115
- const running = view({ status: "running", rendered: true });
116
- expect(outputIsStale(running, EDITED, true)).toBe(false);
117
- });
118
-
119
- it("should dim while the rerun of edited code has shown nothing", () => {
120
- expect(outputIsStale(view({ status: "running" }), EDITED, true)).toBe(true);
121
- });
122
-
123
80
  it("should still dim for changed inputs in a read view when the source also changed", () => {
124
81
  expect(outputIsStale(view({}), BOTH, false)).toBe(true);
125
82
  });
126
83
  });
127
84
 
128
85
  describe("consoleOutputIsStale", () => {
129
- it("is stale while queued, since the run clears the console", () => {
86
+ it("keeps the queued console visible", () => {
130
87
  expect(consoleOutputIsStale(view({ status: "queued" }), CURRENT)).toBe(
131
- true,
88
+ false,
132
89
  );
133
90
  });
134
91
 
@@ -8,7 +8,7 @@ import type { CellData } from "@/core/cells/types";
8
8
  import type { CellFreshnessLookup } from "@/core/executions";
9
9
  import type { OutputMessage } from "@/core/kernel/messages";
10
10
  import {
11
- cellNeedsRun,
11
+ cellRunReason,
12
12
  disabledCellIds,
13
13
  enabledCellIds,
14
14
  isUninstantiated,
@@ -27,7 +27,7 @@ function notebook(cells: Cells): NotebookState {
27
27
  cellData: Object.fromEntries(
28
28
  Object.entries(cells).map(([id, cell]) => [
29
29
  id,
30
- { config: { disabled: cell.disabled } },
30
+ { code: "x", config: { disabled: cell.disabled } },
31
31
  ]),
32
32
  ),
33
33
  cellRuntime: Object.fromEntries(Object.keys(cells).map((id) => [id, {}])),
@@ -138,25 +138,34 @@ describe("staleCellIds with a run in progress", () => {
138
138
  });
139
139
  });
140
140
 
141
- describe("cellNeedsRun", () => {
142
- const blocked = { interrupted: false, disabled: false, blocked: true };
143
-
144
- it("flags a blocked cell whose source changed, whatever its inputs did", () => {
141
+ describe("cellRunReason", () => {
142
+ const view = {
143
+ status: "idle",
144
+ outcome: "value",
145
+ live: true,
146
+ blocked: false,
147
+ } as const;
148
+ const changes = { sourceChanged: false, inputsChanged: true };
149
+ const cell = { code: "x", config: { disabled: false, hide_code: false } };
150
+
151
+ it("shows queued and running instead of a manual warning, then exposes intervening edits", () => {
152
+ const edited = { ...changes, sourceChanged: true };
153
+ expect(cellRunReason(view, changes, cell)).toBe("inputs");
145
154
  expect(
146
- cellNeedsRun({
147
- ...blocked,
148
- freshness: freshness({ c: { edited: true, staleInputs: true } })("c"),
149
- }),
150
- ).toBe(true);
155
+ cellRunReason({ ...view, status: "queued" }, changes, cell),
156
+ ).toBeNull();
157
+ expect(
158
+ cellRunReason({ ...view, status: "running" }, edited, cell),
159
+ ).toBeNull();
160
+ expect(cellRunReason(view, edited, cell)).toBe("source");
151
161
  });
152
162
 
153
- it("does not flag a blocked cell for changed inputs alone", () => {
154
- expect(
155
- cellNeedsRun({
156
- ...blocked,
157
- freshness: freshness({ c: { staleInputs: true } })("c"),
158
- }),
159
- ).toBe(false);
163
+ it("only asks for an initial run when the cell contains code", () => {
164
+ const fresh = { inputsChanged: false, sourceChanged: false };
165
+ const unrun = { ...view, outcome: null };
166
+ expect(cellRunReason(unrun, fresh, cell)).toBe("not-run");
167
+ expect(cellRunReason(unrun, fresh, { ...cell, code: " " })).toBeNull();
168
+ expect(cellRunReason(view, fresh, cell)).toBeNull();
160
169
  });
161
170
  });
162
171
 
@@ -106,21 +106,19 @@ export function outputIsLoading(status: CellRunStatus): boolean {
106
106
  }
107
107
 
108
108
  /**
109
- * A cell's output is stale if it is loading, an input it read has changed,
109
+ * A settled output is stale if an input it read has changed,
110
110
  * or, while `editing`, its source has changed. A read view keeps showing
111
111
  * the last result of edited source.
112
112
  */
113
113
  export function outputIsStale(
114
- execution: Pick<CellExecutionView, "status" | "outcome" | "rendered">,
114
+ execution: Pick<CellExecutionView, "status" | "outcome">,
115
115
  freshness: CellFreshness,
116
116
  editing: boolean,
117
117
  ): boolean {
118
- const { status, outcome, rendered } = execution;
118
+ const { status, outcome } = execution;
119
119
 
120
- // A run in progress owns the output area: loading until the running cell
121
- // has shown output (e.g. mo.output.append()), whatever the last result was.
122
120
  if (outputIsLoading(status)) {
123
- return !(status === "running" && rendered);
121
+ return false;
124
122
  }
125
123
  if (editing && freshness.sourceChanged) {
126
124
  return true;
@@ -133,8 +131,7 @@ export function outputIsStale(
133
131
  }
134
132
 
135
133
  /**
136
- * Console output is stale while a run is queued, since the run will clear
137
- * it, and once a settled result is outdated. A run in progress owns it.
134
+ * Console output is stale once its settled result is outdated.
138
135
  */
139
136
  export function consoleOutputIsStale(
140
137
  execution: Pick<CellExecutionView, "status" | "outcome">,
@@ -144,10 +141,7 @@ export function consoleOutputIsStale(
144
141
  if (outcome === "interrupted") {
145
142
  return false;
146
143
  }
147
- if (status === "queued") {
148
- return true;
149
- }
150
- if (status === "running") {
144
+ if (outputIsLoading(status)) {
151
145
  return false;
152
146
  }
153
147
  return freshness.sourceChanged || freshness.inputsChanged;
@@ -48,7 +48,7 @@ import {
48
48
  disabledCellIds,
49
49
  enabledCellIds,
50
50
  getUndoLabel,
51
- notebookNeedsRun,
51
+ notebookRunReason,
52
52
  } from "./utils";
53
53
 
54
54
  /** A deleted cell as it was, with where it went in the document. */
@@ -380,14 +380,16 @@ export const canUndoDeletesAtom = atom((get) =>
380
380
 
381
381
  export const undoLabelAtom = atom((get) => getUndoLabel(get(notebookAtom)));
382
382
 
383
- export const needsRunAtom = atom((get) =>
384
- notebookNeedsRun(
383
+ export const runReasonAtom = atom((get) =>
384
+ notebookRunReason(
385
385
  get(notebookAtom),
386
386
  get(cellExecutionInputsAtom),
387
387
  get(cellFreshnessAtom),
388
388
  ),
389
389
  );
390
390
 
391
+ export const needsRunAtom = atom((get) => get(runReasonAtom) !== null);
392
+
391
393
  export const cellErrorsAtom = atom((get) => {
392
394
  const { cellIds, cellData } = get(notebookAtom);
393
395
  const errors = cellIds