@marimo-team/islands 0.26.1-dev105 → 0.26.1-dev112

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 (117) hide show
  1. package/dist/{ConnectedDataExplorerComponent-C6dY5fiI.js → ConnectedDataExplorerComponent-DQaiOY7w.js} +15 -15
  2. package/dist/{ErrorBoundary-Bn664FZa.js → ErrorBoundary-pNKOBKXw.js} +19 -19
  3. package/dist/{abnfDiagram-VCTEODGH-Ba0MYVW8.js → abnfDiagram-VCTEODGH-Df80tEYq.js} +2 -2
  4. package/dist/{any-language-editor-BNe8do3C.js → any-language-editor-BW-gNmbk.js} +2 -2
  5. package/dist/{architectureDiagram-5GKGNRK7-7MqAehef.js → architectureDiagram-5GKGNRK7-DNNMvKkY.js} +1 -1
  6. package/dist/{assertNever-5vhHGKOK.js → assertNever-B9_7z-dW.js} +13 -13
  7. package/dist/{chat-ui-zGgiq5zN.js → chat-ui-C9NZA-bk.js} +49 -49
  8. package/dist/{check-DUIc04aK.js → check-BqF09bSG.js} +1 -1
  9. package/dist/{chunk-IMKFNOWR-CAWA0HGB.js → chunk-IMKFNOWR-pXqnQ_fj.js} +1 -1
  10. package/dist/{chunk-SHT3W25Y-BIwVQjG5.js → chunk-SHT3W25Y-BWrxB3I2.js} +1 -1
  11. package/dist/{chunk-SVP7TREG-Cux251TB.js → chunk-SVP7TREG-CPdQP8_U.js} +1 -1
  12. package/dist/{chunk-TICWLB2K-DJVQ6khO.js → chunk-TICWLB2K-C5MYCwBz.js} +1 -1
  13. package/dist/{circle-question-mark-evCnVIut.js → circle-question-mark-YmLYXyvS.js} +1 -1
  14. package/dist/{classDiagram-ZZMXUADV-Cwve77ev.js → classDiagram-ZZMXUADV-Ba0SRm01.js} +2 -2
  15. package/dist/{classDiagram-v2-VYDZK3BY-BAeHKXmD.js → classDiagram-v2-VYDZK3BY-DSSzL_Dk.js} +2 -2
  16. package/dist/{code-visibility-CMgSFUs7.js → code-visibility-B9s3Hl8z.js} +18 -18
  17. package/dist/{common-DWnR77Qk.js → common-Bn3jx0X6.js} +170 -168
  18. package/dist/{copy-icon-CmNLxT5_.js → copy-icon-zP4__HPI.js} +2 -2
  19. package/dist/{createReducer-m7yAXmDu.js → createReducer-CArOwUaJ.js} +1 -1
  20. package/dist/{cynefinDiagram-5FMLGOSQ-t4eEkPJh.js → cynefinDiagram-5FMLGOSQ-BOtNvA04.js} +1 -1
  21. package/dist/{dagre-GXQ25YYZ-IuZuI28B.js → dagre-GXQ25YYZ-FpCEOTxX.js} +1 -1
  22. package/dist/{data-grid-overlay-editor-zS1h3iMI.js → data-grid-overlay-editor-mxwwRaQy.js} +1 -1
  23. package/dist/{diagram-S7CK7UJ4-D8R5Q_ok.js → diagram-S7CK7UJ4-Cm1HaBuu.js} +1 -1
  24. package/dist/{diagram-UQ7AKVKN-BGuMPsr-.js → diagram-UQ7AKVKN-D1lA7Ggu.js} +1 -1
  25. package/dist/{diagram-VX7I27RA-BkTtpO8P.js → diagram-VX7I27RA-BX3e-Rue.js} +1 -1
  26. package/dist/{diagram-Z3DM3KII-C0__Mxfm.js → diagram-Z3DM3KII-Dgoj7bPf.js} +1 -1
  27. package/dist/{dialog-BvjfalZ9.js → dialog-DfKgafXJ.js} +30 -30
  28. package/dist/{dropdown-menu-D0DeN-aL.js → dropdown-menu-Dge_SmqE.js} +168 -168
  29. package/dist/{ebnfDiagram-PWID7BFC-CSESPZoz.js → ebnfDiagram-PWID7BFC-B0xWiXrz.js} +2 -2
  30. package/dist/{erDiagram-RLTQ6QDP-DsDTtabH.js → erDiagram-RLTQ6QDP-Cm-GO31-.js} +1 -1
  31. package/dist/{error-banner-CXLjTW24.js → error-banner-CfYrJaIb.js} +91 -91
  32. package/dist/{error-entries-DVclFjaE.js → error-entries-1DC4BiYB.js} +661 -656
  33. package/dist/{export-context-CkgZeARR.js → export-context-B1jdxzHF.js} +21 -21
  34. package/dist/{feedback-button-BMGqp8Ff.js → feedback-button-BrzbnRTT.js} +72 -72
  35. package/dist/{flowDiagram-HODETNUW-qxDPYbfV.js → flowDiagram-HODETNUW-CH6xMlW_.js} +2 -2
  36. package/dist/{formats-CcQrzFo8.js → formats-Y52bg800.js} +1 -1
  37. package/dist/{glide-data-editor-Bra6h4KB.js → glide-data-editor-Cnsv3NcI.js} +11 -11
  38. package/dist/{glide-utils-CD8BaFTm.js → glide-utils-BRcuSTCx.js} +2 -2
  39. package/dist/{globals-_bXqC0R8.js → globals-BGqfFPx8.js} +3 -3
  40. package/dist/{html-to-image-Cst4BlIm.js → html-to-image-CsvAOgd3.js} +5073 -5076
  41. package/dist/{infoDiagram-27XIBGKW-B5hq8RM_.js → infoDiagram-27XIBGKW-DbUO63CX.js} +1 -1
  42. package/dist/{ishikawaDiagram-5VMMS53U-DkHc_9ET.js → ishikawaDiagram-5VMMS53U-CfQrrELH.js} +1 -1
  43. package/dist/{kanban-definition-UXKFOSKX-CqkTFXmU.js → kanban-definition-UXKFOSKX-C5SJcu1W.js} +1 -1
  44. package/dist/{loader-CGrYn73j.js → loader-C9-qRO3m.js} +2 -2
  45. package/dist/main.js +6696 -6602
  46. package/dist/{mermaid-pmVHDUQA.js → mermaid-C2alqcd8.js} +34 -34
  47. package/dist/{mindmap-definition-YA3MSWOX-D6cNa__z.js → mindmap-definition-YA3MSWOX-ByVHE0Ax.js} +1 -1
  48. package/dist/{number-overlay-editor-XLUhOVa7.js → number-overlay-editor-DuSCOMTK.js} +1 -1
  49. package/dist/{pegDiagram-XKGWAZYB-CmWJX_s1.js → pegDiagram-XKGWAZYB-DF5FBKZi.js} +2 -2
  50. package/dist/{pencil-CxMgOe04.js → pencil-D7jyZPnP.js} +1 -1
  51. package/dist/{pieDiagram-E7YTZNPT-CAQAxHah.js → pieDiagram-E7YTZNPT-B5n9nBQN.js} +1 -1
  52. package/dist/{process-output-DizFa5IE.js → process-output-CtfJ_Gbp.js} +4 -4
  53. package/dist/{railroadDiagram-O6MQD6OU-jlSsiQg3.js → railroadDiagram-O6MQD6OU-r5t7OYNE.js} +2 -2
  54. package/dist/{requirementDiagram-BXWQKSXE-DkDjfPhn.js → requirementDiagram-BXWQKSXE-D4QtEyZQ.js} +1 -1
  55. package/dist/{reveal-component-llpC324_.js → reveal-component-DzmiQyN9.js} +1008 -1008
  56. package/dist/{select-CEnB18uc.js → select-Buk3aXi1.js} +341 -341
  57. package/dist/{sequenceDiagram-WJ2MYXX4-DLywsGCW.js → sequenceDiagram-WJ2MYXX4-CK3Atn-z.js} +1 -1
  58. package/dist/{spec-Dz-Avv1m.js → spec-BEp9O9dy.js} +4 -4
  59. package/dist/{stateDiagram-D77RDMKH-DUmlKwYU.js → stateDiagram-D77RDMKH-C1SxRI8V.js} +2 -2
  60. package/dist/{stateDiagram-v2-MP3YSRHH-D646KiXs.js → stateDiagram-v2-MP3YSRHH-DK5X6bsr.js} +2 -2
  61. package/dist/{static-state-iw0PrHK4.js → static-state-D-aT9dOr.js} +9 -9
  62. package/dist/style.css +1 -1
  63. package/dist/{swimlanes-42K2YHIH-L7B1GphF.js → swimlanes-42K2YHIH-DdH5TZdu.js} +1 -1
  64. package/dist/{swimlanesDiagram-VR7AAH4N-DEu2wxtC.js → swimlanesDiagram-VR7AAH4N-CWBIvzgR.js} +2 -2
  65. package/dist/{timeline-definition-24CTP7MA-DDPyx1yG.js → timeline-definition-24CTP7MA-DE7-o2zU.js} +1 -1
  66. package/dist/{toast-BTjH6fIf.js → toast-b3k4YxaT.js} +54 -54
  67. package/dist/{tooltip-DyLdBIM4.js → tooltip-D-9pDheN.js} +62 -62
  68. package/dist/{use-restore-focus-DJ_-uSn_.js → use-restore-focus-CCfk-ey2.js} +1 -1
  69. package/dist/{useDateFormatter-HpKD0jEC.js → useDateFormatter-DH0uFwfL.js} +2 -2
  70. package/dist/{useDeepCompareMemoize-CHx-NxMl.js → useDeepCompareMemoize-Dn-ZJVTd.js} +1 -1
  71. package/dist/{useLifecycle-tPpAt-OE.js → useLifecycle-yjK7JsRL.js} +1 -1
  72. package/dist/{vega-component-BzNDFvQf.js → vega-component-BIq0qzhQ.js} +8 -8
  73. package/dist/{vennDiagram-4TSXK5OY-CRwWeb7g.js → vennDiagram-4TSXK5OY-D7yfNz0d.js} +1 -1
  74. package/dist/{wardleyDiagram-VM6X3IG4-DVlG9eoq.js → wardleyDiagram-VM6X3IG4-m5Jcz26Z.js} +1 -1
  75. package/dist/{xychartDiagram-S5SC5T6Z-CM32AISp.js → xychartDiagram-S5SC5T6Z-CA3zV3RW.js} +1 -1
  76. package/package.json +1 -1
  77. package/src/__mocks__/intersection-observer.ts +13 -12
  78. package/src/components/editor/Output.tsx +1 -1
  79. package/src/components/editor/__tests__/cell-renders.test.tsx +344 -2
  80. package/src/components/editor/ai/__tests__/completion-utils.test.ts +12 -20
  81. package/src/components/editor/ai/ai-completion-editor.tsx +391 -289
  82. package/src/components/editor/ai/completion-utils.ts +9 -7
  83. package/src/components/editor/cell/CellDeleteShoulder.tsx +82 -0
  84. package/src/components/editor/cell/DeleteButton.tsx +11 -2
  85. package/src/components/editor/cell/__tests__/CellDeleteShoulder.test.tsx +181 -0
  86. package/src/components/editor/cell/code/cell-editor.tsx +15 -25
  87. package/src/components/editor/chrome/panels/__tests__/logs-panel.test.tsx +26 -2
  88. package/src/components/editor/chrome/panels/logs-panel.tsx +27 -11
  89. package/src/components/editor/chrome/panels/outline/__tests__/outline-keyboard.test.tsx +517 -68
  90. package/src/components/editor/chrome/panels/outline/__tests__/useActiveOutline.test.ts +17 -5
  91. package/src/components/editor/chrome/panels/outline/floating-outline.tsx +29 -59
  92. package/src/components/editor/chrome/panels/outline/useActiveOutline.tsx +333 -133
  93. package/src/components/editor/chrome/panels/outline-panel.tsx +5 -19
  94. package/src/components/editor/notebook-cell.tsx +250 -274
  95. package/src/core/ai/state.ts +6 -0
  96. package/src/core/cells/__tests__/cells.test.ts +34 -20
  97. package/src/core/cells/__tests__/layout.test.ts +1 -1
  98. package/src/core/cells/__tests__/notebook-outline.test.ts +31 -3
  99. package/src/core/cells/cell-log-chunks.ts +31 -0
  100. package/src/core/cells/cells.ts +31 -20
  101. package/src/core/cells/outline.ts +8 -8
  102. package/src/core/codemirror/language/extension.ts +6 -3
  103. package/src/core/codemirror/language/panel/panel.test.tsx +144 -0
  104. package/src/core/codemirror/language/panel/panel.tsx +9 -6
  105. package/src/core/codemirror/lsp/__tests__/log-messages.test.ts +1 -1
  106. package/src/core/codemirror/lsp/__tests__/transports.test.ts +1 -1
  107. package/src/core/codemirror/react-dom/createPanel.tsx +15 -15
  108. package/src/core/dom/__tests__/outline.test.ts +29 -170
  109. package/src/core/dom/outline.ts +21 -61
  110. package/src/core/executions/atoms.ts +12 -4
  111. package/src/core/islands/__tests__/bridge.test.ts +2 -5
  112. package/src/core/islands/components/output-wrapper.tsx +7 -2
  113. package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +10 -1
  114. package/src/css/common.css +11 -0
  115. package/src/hooks/useFinePointer.ts +30 -0
  116. package/src/plugins/layout/OutlinePlugin.tsx +5 -17
  117. package/src/stories/log-viewer.stories.tsx +48 -44
@@ -1,25 +1,17 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
- import { useAtomValue } from "jotai";
4
3
  import { ScrollTextIcon } from "lucide-react";
5
- import React, { useMemo } from "react";
6
- import { notebookOutline } from "../../../../core/cells/cells";
4
+ import React from "react";
7
5
  import { PanelEmptyState } from "./empty-state";
8
6
 
9
7
  import "./outline-panel.css";
10
8
  import { OutlineList } from "./outline/floating-outline";
11
- import {
12
- findOutlineElements,
13
- useActiveOutline,
14
- } from "./outline/useActiveOutline";
9
+ import { useActiveOutline } from "./outline/useActiveOutline";
15
10
 
16
11
  const OutlinePanel: React.FC = () => {
17
- const { items } = useAtomValue(notebookOutline);
18
- const headerElements = useMemo(() => findOutlineElements(items), [items]);
19
- const { activeHeaderId, activeOccurrences } =
20
- useActiveOutline(headerElements);
12
+ const outline = useActiveOutline();
21
13
 
22
- if (items.length === 0) {
14
+ if (outline.entries.length === 0) {
23
15
  return (
24
16
  <PanelEmptyState
25
17
  title="No outline found"
@@ -29,13 +21,7 @@ const OutlinePanel: React.FC = () => {
29
21
  );
30
22
  }
31
23
 
32
- return (
33
- <OutlineList
34
- items={items}
35
- activeHeaderId={activeHeaderId}
36
- activeOccurrences={activeOccurrences}
37
- />
38
- );
24
+ return <OutlineList {...outline} />;
39
25
  };
40
26
 
41
27
  export default OutlinePanel;
@@ -20,7 +20,7 @@ import { mergeProps } from "react-aria";
20
20
  import useEvent from "react-use-event-hook";
21
21
  import { StopButton } from "@/components/editor/cell/StopButton";
22
22
  import { Toolbar, ToolbarItem } from "@/components/editor/cell/toolbar";
23
- import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
23
+ import { Tooltip } from "@/components/ui/tooltip";
24
24
  import { aiCompletionCellAtom } from "@/core/ai/state";
25
25
  import {
26
26
  consoleOutputIsStale,
@@ -70,7 +70,6 @@ import {
70
70
  shouldHidePublishedCell,
71
71
  } from "../../core/cells/utils";
72
72
  import type { UserConfig } from "../../core/config/config-schema";
73
- import { isAppInteractionDisabled } from "../../core/session/connection-utils";
74
73
  import { useCellRenderCount } from "../../hooks/useCellRenderCount";
75
74
  import type { Theme } from "../../theme/useTheme";
76
75
  import { Functions } from "../../utils/functions";
@@ -86,11 +85,13 @@ import {
86
85
  import { CellActionsContextMenu } from "./cell/cell-context-menu";
87
86
  import { CellEditor } from "./cell/code/cell-editor";
88
87
  import { CollapsedCellBanner, CollapseToggle } from "./cell/collapse";
89
- import { DeleteButton } from "./cell/DeleteButton";
88
+ import {
89
+ CellDeleteShoulder,
90
+ useCellHoverProps,
91
+ } from "./cell/CellDeleteShoulder";
90
92
  import { PendingDeleteConfirmation } from "./cell/PendingDeleteConfirmation";
91
93
  import { RunButton } from "./cell/RunButton";
92
94
  import { StagedAIDeletionMarker } from "./cell/StagedAICell";
93
- import { useDeleteCellCallback } from "./cell/useDeleteCell";
94
95
  import { useRunCell } from "./cell/useRunCells";
95
96
  import { cellDomProps } from "./common";
96
97
  import { SqlValidationErrorBanner } from "./errors/sql-validation-errors";
@@ -392,7 +393,6 @@ const EditableCellComponent = ({
392
393
  const actions = useCellActions();
393
394
  const connection = useAtomValue(connectionAtom);
394
395
  const setAiCompletionCell = useSetAtom(aiCompletionCellAtom);
395
- const deleteCell = useDeleteCellCallback();
396
396
  const runCell = useRunCell(cellId);
397
397
  const answerPrompt = useAnswerPrompt(cellId);
398
398
  const isPendingCut = useIsPendingCut(cellId);
@@ -410,8 +410,6 @@ const EditableCellComponent = ({
410
410
 
411
411
  const needsRun = cellRunReason(execution, freshness, cellData) !== null;
412
412
 
413
- const loading = outputIsLoading(execution.status);
414
-
415
413
  const isPresenting = mode === "present";
416
414
 
417
415
  // While presenting, the cell may be hidden (matching the read view), but it
@@ -466,6 +464,7 @@ const EditableCellComponent = ({
466
464
  editorView,
467
465
  cellActionDropdownRef,
468
466
  });
467
+ const hoverProps = useCellHoverProps(cellId);
469
468
  const canCollapse = canCollapseOutline(outline);
470
469
  const hasOutput = !isOutputEmpty(output);
471
470
  // While presenting, pending edits do not dim the output as stale,
@@ -618,156 +617,145 @@ const EditableCellComponent = ({
618
617
  };
619
618
 
620
619
  return (
621
- <TooltipProvider>
622
- <CellActionsContextMenu
620
+ <CellActionsContextMenu
621
+ cellId={cellId}
622
+ getEditorView={getEditorView}
623
+ disabled={isPresenting}
624
+ >
625
+ <SortableCell
626
+ tabIndex={-1}
627
+ ref={cellRef}
628
+ data-status={execution.status}
629
+ onBlur={closeCompletionHandler}
630
+ onKeyDown={resumeCompletionHandler}
623
631
  cellId={cellId}
624
- getEditorView={getEditorView}
632
+ canMoveX={canMoveX}
625
633
  disabled={isPresenting}
634
+ hidden={presentHidden}
635
+ title={renderCellTitle()}
626
636
  >
627
- <SortableCell
637
+ <div
628
638
  tabIndex={-1}
629
- ref={cellRef}
630
- data-status={execution.status}
631
- onBlur={closeCompletionHandler}
632
- onKeyDown={resumeCompletionHandler}
633
- cellId={cellId}
634
- canMoveX={canMoveX}
635
- disabled={isPresenting}
636
- hidden={presentHidden}
637
- title={renderCellTitle()}
639
+ {...(isPresenting ? undefined : navigationProps)}
640
+ {...(isPresenting ? undefined : hoverProps)}
641
+ className={cn(
642
+ className,
643
+ !isPresenting && navigationProps.className,
644
+ !isPresenting &&
645
+ "focus:ring-1 focus:ring-(--slate-8) focus:ring-offset-2",
646
+ )}
647
+ ref={cellContainerRef}
648
+ {...cellDomProps(cellId, cellData.name)}
638
649
  >
650
+ {!isPresenting && (
651
+ <CellLeftSideActions cellId={cellId} actions={actions} />
652
+ )}
653
+ {cellOutput === "above" && (outputArea || emptyMarkdownPlaceholder)}
654
+ {/* The tray is hidden-but-mounted while presenting so CodeMirror
655
+ state survives mode toggles. Hide via the `hidden` attribute:
656
+ preflight's `[hidden] { display: none !important }` beats
657
+ `.tray { display: flex }`, which a display class would not. */}
639
658
  <div
640
- tabIndex={-1}
641
- {...(isPresenting ? undefined : navigationProps)}
642
- className={cn(
643
- className,
644
- !isPresenting && navigationProps.className,
645
- !isPresenting &&
646
- "focus:ring-1 focus:ring-(--slate-8) focus:ring-offset-2",
647
- )}
648
- ref={cellContainerRef}
649
- {...cellDomProps(cellId, cellData.name)}
659
+ data-testid="cell-tray"
660
+ className="tray"
661
+ hidden={isPresenting}
662
+ data-has-output-above={hasOutputAbove}
663
+ data-hidden={isMarkdownCodeHidden}
650
664
  >
651
- {!isPresenting && (
652
- <CellLeftSideActions cellId={cellId} actions={actions} />
653
- )}
654
- {cellOutput === "above" && (outputArea || emptyMarkdownPlaceholder)}
655
- {/* The tray is hidden-but-mounted while presenting so CodeMirror
656
- state survives mode toggles. Hide via the `hidden` attribute:
657
- preflight's `[hidden] { display: none !important }` beats
658
- `.tray { display: flex }`, which a display class would not. */}
659
- <div
660
- data-testid="cell-tray"
661
- className="tray"
662
- hidden={isPresenting}
663
- data-has-output-above={hasOutputAbove}
664
- data-hidden={isMarkdownCodeHidden}
665
- >
666
- <StagedAIDeletionMarker cellId={cellId} />
667
- <div className="absolute right-2 -top-4 z-10">
668
- <CellToolbar
669
- edited={freshness.sourceChanged}
670
- status={execution.status}
671
- blocked={execution.blocked}
672
- cellConfig={cellData.config}
673
- needsRun={needsRun}
674
- hasOutput={hasOutput}
675
- hasConsoleOutput={hasConsoleOutput}
676
- cellActionDropdownRef={cellActionDropdownRef}
677
- cellId={cellId}
678
- name={cellData.name}
679
- getEditorView={getEditorView}
680
- onRun={runCell}
681
- />
682
- </div>
683
- <CellEditor
684
- theme={theme}
685
- showPlaceholder={showPlaceholder}
686
- id={cellId}
687
- code={cellData.code}
688
- config={cellData.config}
665
+ <StagedAIDeletionMarker cellId={cellId} />
666
+ <div className="absolute right-2 -top-4 z-10">
667
+ <CellToolbar
668
+ edited={freshness.sourceChanged}
689
669
  status={execution.status}
690
- runCell={runCell}
691
- setEditorView={setEditorView}
692
- userConfig={userConfig}
693
- editorViewRef={editorView}
694
- editorViewParentRef={editorViewParentRef}
695
- hidden={!isCellCodeShown}
670
+ blocked={execution.blocked}
671
+ cellConfig={cellData.config}
672
+ needsRun={needsRun}
696
673
  hasOutput={hasOutput}
697
- showHiddenCode={showHiddenCode}
698
- languageAdapter={languageAdapter}
699
- setLanguageAdapter={setLanguageAdapter}
700
- outputArea={cellOutput}
701
- />
702
- {/* Unmounted while presenting: the status timer re-renders every
703
- frame for running cells. */}
704
- {!isPresenting && (
705
- <CellRightSideActions
706
- className={cn(
707
- isMarkdownCodeHidden && cellOutput === "below" && "top-14",
708
- )}
709
- execution={execution}
710
- freshness={freshness}
711
- isCellStatusInline={isCellStatusInline}
712
- uninstantiated={uninstantiated}
713
- disabled={cellData.config.disabled}
714
- />
715
- )}
716
- <div className="shoulder-bottom hover-action">
717
- {canDelete && isCellCodeShown && (
718
- <DeleteButton
719
- status={execution.status}
720
- connectionState={connection.state}
721
- onClick={() => {
722
- if (
723
- !loading &&
724
- !isAppInteractionDisabled(connection.state)
725
- ) {
726
- deleteCell({ cellId });
727
- }
728
- }}
729
- />
730
- )}
731
- </div>
732
- </div>
733
- {!isPresenting && (
734
- <SqlValidationErrorBanner
674
+ hasConsoleOutput={hasConsoleOutput}
675
+ cellActionDropdownRef={cellActionDropdownRef}
735
676
  cellId={cellId}
736
- hide={errored && !isStaleCell}
677
+ name={cellData.name}
678
+ getEditorView={getEditorView}
679
+ onRun={runCell}
737
680
  />
738
- )}
739
- {cellOutput === "below" && (outputArea || emptyMarkdownPlaceholder)}
740
- {!isPresenting && reusable && (
741
- <ReusableDefinitionBadge finding={reusable} />
742
- )}
681
+ </div>
682
+ <CellEditor
683
+ theme={theme}
684
+ showPlaceholder={showPlaceholder}
685
+ id={cellId}
686
+ code={cellData.code}
687
+ config={cellData.config}
688
+ status={execution.status}
689
+ runCell={runCell}
690
+ setEditorView={setEditorView}
691
+ userConfig={userConfig}
692
+ editorViewRef={editorView}
693
+ editorViewParentRef={editorViewParentRef}
694
+ hidden={!isCellCodeShown}
695
+ hasOutput={hasOutput}
696
+ showHiddenCode={showHiddenCode}
697
+ languageAdapter={languageAdapter}
698
+ setLanguageAdapter={setLanguageAdapter}
699
+ outputArea={cellOutput}
700
+ />
701
+ {/* Unmounted while presenting: the status timer re-renders every
702
+ frame for running cells. */}
743
703
  {!isPresenting && (
744
- <ConsoleOutput
745
- consoleOutputs={cellRuntime.consoleOutputs}
746
- stale={consoleOutputStale}
747
- cellName={reusable ? "_" : cellData.name}
748
- onRefactorWithAI={handleRefactorWithAI}
749
- onClear={() => {
750
- actions.clearCellConsoleOutput({ cellId });
751
- // The debugger "Clear" (trashcan) also drops this cell's
752
- // breakpoints; no-op when none are set.
753
- clearCellBreakpoints(cellId);
754
- }}
755
- onSubmitDebugger={answerPrompt}
756
- cellId={cellId}
704
+ <CellRightSideActions
705
+ className={cn(
706
+ isMarkdownCodeHidden && cellOutput === "below" && "top-14",
707
+ )}
708
+ execution={execution}
709
+ freshness={freshness}
710
+ isCellStatusInline={isCellStatusInline}
711
+ uninstantiated={uninstantiated}
712
+ disabled={cellData.config.disabled}
757
713
  />
758
714
  )}
759
- <PendingDeleteConfirmation cellId={cellId} />
715
+ <CellDeleteShoulder
716
+ cellId={cellId}
717
+ status={execution.status}
718
+ connectionState={connection.state}
719
+ showButton={canDelete && isCellCodeShown}
720
+ />
760
721
  </div>
761
- {isCollapsed && !isPresenting && (
762
- <CollapsedCellBanner
763
- onClick={() => actions.expandCell({ cellId })}
764
- count={collapseCount}
722
+ {!isPresenting && (
723
+ <SqlValidationErrorBanner
765
724
  cellId={cellId}
725
+ hide={errored && !isStaleCell}
766
726
  />
767
727
  )}
768
- </SortableCell>
769
- </CellActionsContextMenu>
770
- </TooltipProvider>
728
+ {cellOutput === "below" && (outputArea || emptyMarkdownPlaceholder)}
729
+ {!isPresenting && reusable && (
730
+ <ReusableDefinitionBadge finding={reusable} />
731
+ )}
732
+ {!isPresenting && (
733
+ <ConsoleOutput
734
+ consoleOutputs={cellRuntime.consoleOutputs}
735
+ stale={consoleOutputStale}
736
+ cellName={reusable ? "_" : cellData.name}
737
+ onRefactorWithAI={handleRefactorWithAI}
738
+ onClear={() => {
739
+ actions.clearCellConsoleOutput({ cellId });
740
+ // The debugger "Clear" (trashcan) also drops this cell's
741
+ // breakpoints; no-op when none are set.
742
+ clearCellBreakpoints(cellId);
743
+ }}
744
+ onSubmitDebugger={answerPrompt}
745
+ cellId={cellId}
746
+ />
747
+ )}
748
+ <PendingDeleteConfirmation cellId={cellId} />
749
+ </div>
750
+ {isCollapsed && !isPresenting && (
751
+ <CollapsedCellBanner
752
+ onClick={() => actions.expandCell({ cellId })}
753
+ count={collapseCount}
754
+ cellId={cellId}
755
+ />
756
+ )}
757
+ </SortableCell>
758
+ </CellActionsContextMenu>
771
759
  );
772
760
  };
773
761
 
@@ -980,7 +968,6 @@ const SetupCellComponent = ({
980
968
  const connection = useAtomValue(connectionAtom);
981
969
 
982
970
  const actions = useCellActions();
983
- const deleteCell = useDeleteCellCallback();
984
971
  const setAiCompletionCell = useSetAtom(aiCompletionCellAtom);
985
972
  const runCell = useRunCell(cellId);
986
973
  const answerPrompt = useAnswerPrompt(cellId);
@@ -1017,6 +1004,7 @@ const SetupCellComponent = ({
1017
1004
  editorView,
1018
1005
  cellActionDropdownRef,
1019
1006
  });
1007
+ const hoverProps = useCellHoverProps(cellId);
1020
1008
  const hasOutput = !isOutputEmpty(output);
1021
1009
  const hasConsoleOutput = cellRuntime.consoleOutputs.length > 0;
1022
1010
  const isErrorOutput = isErrorMime(output?.mimetype);
@@ -1066,152 +1054,140 @@ const SetupCellComponent = ({
1066
1054
  }, [isPresenting, editorView]);
1067
1055
 
1068
1056
  return (
1069
- <TooltipProvider>
1070
- <CellActionsContextMenu
1071
- cellId={cellId}
1072
- getEditorView={getEditorView}
1073
- disabled={isPresenting}
1074
- >
1075
- {/* The setup cell has no visible output, so it is hidden (but stays
1076
- mounted) while presenting. */}
1077
- <div hidden={isPresenting}>
1057
+ <CellActionsContextMenu
1058
+ cellId={cellId}
1059
+ getEditorView={getEditorView}
1060
+ disabled={isPresenting}
1061
+ >
1062
+ {/* The setup cell has no visible output, so it is hidden (but stays
1063
+ mounted) while presenting. */}
1064
+ <div hidden={isPresenting}>
1065
+ <div
1066
+ data-status={execution.status}
1067
+ ref={cellRef}
1068
+ {...mergeProps(navigationProps, hoverProps, {
1069
+ className: cn(
1070
+ className,
1071
+ "focus:ring-1 focus:ring-(--slate-8) focus:ring-offset-2",
1072
+ ),
1073
+ onBlur: closeCompletionHandler,
1074
+ onKeyDown: resumeCompletionHandler,
1075
+ })}
1076
+ {...cellDomProps(cellId, cellData.name)}
1077
+ title={renderCellTitle()}
1078
+ tabIndex={-1}
1079
+ data-setup-cell={true}
1080
+ >
1078
1081
  <div
1079
- data-status={execution.status}
1080
- ref={cellRef}
1081
- {...mergeProps(navigationProps, {
1082
- className: cn(
1083
- className,
1084
- "focus:ring-1 focus:ring-(--slate-8) focus:ring-offset-2",
1085
- ),
1086
- onBlur: closeCompletionHandler,
1087
- onKeyDown: resumeCompletionHandler,
1088
- })}
1089
- {...cellDomProps(cellId, cellData.name)}
1090
- title={renderCellTitle()}
1091
- tabIndex={-1}
1092
- data-setup-cell={true}
1082
+ className={cn("tray")}
1083
+ data-has-output-above={false}
1084
+ data-hidden={!isCellCodeShown}
1093
1085
  >
1094
- <div
1095
- className={cn("tray")}
1096
- data-has-output-above={false}
1097
- data-hidden={!isCellCodeShown}
1098
- >
1099
- <StagedAIDeletionMarker cellId={cellId} />
1100
- <div className="absolute right-2 -top-4 z-10">
1101
- <CellToolbar
1102
- edited={freshness.sourceChanged}
1103
- status={execution.status}
1104
- blocked={execution.blocked}
1105
- cellConfig={cellData.config}
1106
- needsRun={needsRun}
1107
- hasOutput={hasOutput}
1108
- hasConsoleOutput={hasConsoleOutput}
1109
- cellActionDropdownRef={cellActionDropdownRef}
1110
- cellId={cellId}
1111
- name={cellData.name}
1112
- getEditorView={getEditorView}
1113
- onRun={runCell}
1114
- includeCellActions={true}
1115
- />
1116
- </div>
1117
- <CellEditor
1118
- theme={theme}
1119
- showPlaceholder={showPlaceholder}
1120
- id={cellId}
1121
- code={cellData.code}
1122
- config={cellData.config}
1086
+ <StagedAIDeletionMarker cellId={cellId} />
1087
+ <div className="absolute right-2 -top-4 z-10">
1088
+ <CellToolbar
1089
+ edited={freshness.sourceChanged}
1123
1090
  status={execution.status}
1124
- runCell={runCell}
1125
- setEditorView={setEditorView}
1126
- userConfig={userConfig}
1127
- editorViewRef={editorView}
1128
- editorViewParentRef={editorViewParentRef}
1129
- hidden={!isCellCodeShown}
1091
+ blocked={execution.blocked}
1092
+ cellConfig={cellData.config}
1093
+ needsRun={needsRun}
1130
1094
  hasOutput={hasOutput}
1131
- showHiddenCode={showHiddenCode}
1132
- languageAdapter={"python"}
1133
- setLanguageAdapter={Functions.NOOP}
1134
- showLanguageToggles={false}
1095
+ hasConsoleOutput={hasConsoleOutput}
1096
+ cellActionDropdownRef={cellActionDropdownRef}
1097
+ cellId={cellId}
1098
+ name={cellData.name}
1099
+ getEditorView={getEditorView}
1100
+ onRun={runCell}
1101
+ includeCellActions={true}
1135
1102
  />
1136
- {/* Unmounted while presenting: the status timer re-renders every
1137
- frame for running cells. */}
1138
- {!isPresenting && (
1139
- <CellRightSideActions
1140
- execution={execution}
1141
- freshness={freshness}
1142
- isCellStatusInline={false}
1143
- uninstantiated={uninstantiated}
1144
- disabled={cellData.config.disabled}
1145
- />
1146
- )}
1147
- <div className="shoulder-bottom hover-action">
1148
- {canDelete && (
1149
- <DeleteButton
1150
- connectionState={connection.state}
1151
- status={execution.status}
1152
- onClick={() => {
1153
- if (
1154
- !loading &&
1155
- !isAppInteractionDisabled(connection.state)
1156
- ) {
1157
- deleteCell({ cellId });
1158
- }
1159
- }}
1160
- />
1161
- )}
1162
- </div>
1163
1103
  </div>
1164
- <div className="py-1 px-2 flex justify-end gap-2 last:rounded-b">
1165
- <span className="text-muted-foreground text-xs font-bold">
1166
- setup cell
1167
- </span>
1168
- <Tooltip
1169
- content={
1170
- <span className="max-w-16">
1171
- This <b>setup cell</b> is guaranteed to run before all other
1172
- cells. Include <br />
1173
- initialization or imports and constants required by
1174
- top-level functions.
1175
- </span>
1176
- }
1177
- >
1178
- <HelpCircleIcon
1179
- size={16}
1180
- strokeWidth={1.5}
1181
- className="rounded-lg text-muted-foreground"
1182
- />
1183
- </Tooltip>
1184
- </div>
1185
- {isErrorOutput && (
1186
- <OutputArea
1187
- allowExpand={true}
1188
- forceExpand={true}
1189
- className={CSSClasses.outputArea}
1190
- cellId={cellId}
1191
- output={output}
1192
- stale={false}
1193
- loading={loading}
1104
+ <CellEditor
1105
+ theme={theme}
1106
+ showPlaceholder={showPlaceholder}
1107
+ id={cellId}
1108
+ code={cellData.code}
1109
+ config={cellData.config}
1110
+ status={execution.status}
1111
+ runCell={runCell}
1112
+ setEditorView={setEditorView}
1113
+ userConfig={userConfig}
1114
+ editorViewRef={editorView}
1115
+ editorViewParentRef={editorViewParentRef}
1116
+ hidden={!isCellCodeShown}
1117
+ hasOutput={hasOutput}
1118
+ showHiddenCode={showHiddenCode}
1119
+ languageAdapter={"python"}
1120
+ setLanguageAdapter={Functions.NOOP}
1121
+ showLanguageToggles={false}
1122
+ />
1123
+ {/* Unmounted while presenting: the status timer re-renders every
1124
+ frame for running cells. */}
1125
+ {!isPresenting && (
1126
+ <CellRightSideActions
1127
+ execution={execution}
1128
+ freshness={freshness}
1129
+ isCellStatusInline={false}
1130
+ uninstantiated={uninstantiated}
1131
+ disabled={cellData.config.disabled}
1194
1132
  />
1195
1133
  )}
1196
- <ConsoleOutput
1197
- consoleOutputs={cellRuntime.consoleOutputs}
1198
- stale={consoleOutputStale}
1199
- // Don't show name
1200
- cellName={"_"}
1201
- onRefactorWithAI={handleRefactorWithAI}
1202
- onClear={() => {
1203
- actions.clearCellConsoleOutput({ cellId });
1204
- // The debugger "Clear" (trashcan) also drops this cell's
1205
- // breakpoints; no-op when none are set.
1206
- clearCellBreakpoints(cellId);
1207
- }}
1208
- onSubmitDebugger={answerPrompt}
1134
+ <CellDeleteShoulder
1209
1135
  cellId={cellId}
1136
+ status={execution.status}
1137
+ connectionState={connection.state}
1138
+ showButton={canDelete}
1210
1139
  />
1211
1140
  </div>
1141
+ <div className="py-1 px-2 flex justify-end gap-2 last:rounded-b">
1142
+ <span className="text-muted-foreground text-xs font-bold">
1143
+ setup cell
1144
+ </span>
1145
+ <Tooltip
1146
+ content={
1147
+ <span className="max-w-16">
1148
+ This <b>setup cell</b> is guaranteed to run before all other
1149
+ cells. Include <br />
1150
+ initialization or imports and constants required by top-level
1151
+ functions.
1152
+ </span>
1153
+ }
1154
+ >
1155
+ <HelpCircleIcon
1156
+ size={16}
1157
+ strokeWidth={1.5}
1158
+ className="rounded-lg text-muted-foreground"
1159
+ />
1160
+ </Tooltip>
1161
+ </div>
1162
+ {isErrorOutput && (
1163
+ <OutputArea
1164
+ allowExpand={true}
1165
+ forceExpand={true}
1166
+ className={CSSClasses.outputArea}
1167
+ cellId={cellId}
1168
+ output={output}
1169
+ stale={false}
1170
+ loading={loading}
1171
+ />
1172
+ )}
1173
+ <ConsoleOutput
1174
+ consoleOutputs={cellRuntime.consoleOutputs}
1175
+ stale={consoleOutputStale}
1176
+ // Don't show name
1177
+ cellName={"_"}
1178
+ onRefactorWithAI={handleRefactorWithAI}
1179
+ onClear={() => {
1180
+ actions.clearCellConsoleOutput({ cellId });
1181
+ // The debugger "Clear" (trashcan) also drops this cell's
1182
+ // breakpoints; no-op when none are set.
1183
+ clearCellBreakpoints(cellId);
1184
+ }}
1185
+ onSubmitDebugger={answerPrompt}
1186
+ cellId={cellId}
1187
+ />
1212
1188
  </div>
1213
- </CellActionsContextMenu>
1214
- </TooltipProvider>
1189
+ </div>
1190
+ </CellActionsContextMenu>
1215
1191
  );
1216
1192
  };
1217
1193