@marimo-team/frontend 0.23.16-dev4 → 0.23.16-dev40

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 (254) hide show
  1. package/dist/assets/{CellStatus-BalYv0pK.js → CellStatus-C6Cj3oJc.js} +1 -1
  2. package/dist/assets/{ConnectedDataExplorerComponent-DI7mV-Gw.js → ConnectedDataExplorerComponent-CMaZapRd.js} +1 -1
  3. package/dist/assets/{ErrorBoundary-C7_5jjWi.js → ErrorBoundary-DzTD8LVq.js} +1 -1
  4. package/dist/assets/{ImperativeModal-BIavOiUv.js → ImperativeModal-fY-ZfT0b.js} +1 -1
  5. package/dist/assets/{JsonOutput-CkCD-FgM.js → JsonOutput-CyzvjIjx.js} +12 -12
  6. package/dist/assets/{LazyAnyLanguageCodeMirror-sVm_hz8A.js → LazyAnyLanguageCodeMirror-B2JvSXP-.js} +2 -2
  7. package/dist/assets/{MarimoErrorOutput-DO2k2fA5.js → MarimoErrorOutput-CIuzXFFo.js} +4 -4
  8. package/dist/assets/{RSPContexts-CgC81f0I.js → RSPContexts-WiCgGm__.js} +1 -1
  9. package/dist/assets/RenderHTML-Cd-PP5ZR.js +1 -0
  10. package/dist/assets/{RunButton-BKRupqr7.js → RunButton-CnYWedW4.js} +1 -1
  11. package/dist/assets/{add-cell-with-ai-CEZtaZCK.js → add-cell-with-ai-ByOBQT99.js} +8 -8
  12. package/dist/assets/add-connection-dialog-C97ylgk0.js +170 -0
  13. package/dist/assets/{agent-panel-CHB6t7Zy.js → agent-panel-Dxo9WUKV.js} +5 -5
  14. package/dist/assets/ai-model-dropdown-Bvqy98cI.js +5 -0
  15. package/dist/assets/{alert-dialog-BXegNC0I.js → alert-dialog-Bb8Lz8ko.js} +1 -1
  16. package/dist/assets/{any-language-editor-DCpZRrpx.js → any-language-editor--tRHs8C_.js} +1 -1
  17. package/dist/assets/{app-config-button-NrM9ywXA.js → app-config-button-v1lG63C2.js} +1 -1
  18. package/dist/assets/{button-eIihcbUw.js → button-DDGiD1NW.js} +1 -1
  19. package/dist/assets/{cache-panel-wllSTlbM.js → cache-panel-DcQUeUpg.js} +1 -1
  20. package/dist/assets/{capabilities-B09j1Eor.js → capabilities-DoEg0XwL.js} +1 -1
  21. package/dist/assets/{cell-editor-B5JVq7_q.js → cell-editor-BKrHbyX_.js} +16 -16
  22. package/dist/assets/cell-link-w5IbCQV4.js +1 -0
  23. package/dist/assets/cells-DzyDERZy.js +235 -0
  24. package/dist/assets/{chat-display-BG08ltQ3.js → chat-display-Ccgk4vbE.js} +1 -1
  25. package/dist/assets/{chat-panel-P2CzCtXJ.js → chat-panel--53TIc3t.js} +4 -4
  26. package/dist/assets/{chat-ui-fAJZAoTD.js → chat-ui-B5rBxgsw.js} +4 -4
  27. package/dist/assets/{column-preview-Dne1dIt0.js → column-preview-Cb8R9kfl.js} +1 -1
  28. package/dist/assets/{command-CAJLPEBq.js → command-Dqxie4gq.js} +1 -1
  29. package/dist/assets/{command-palette-iOCqUIs1.js → command-palette-B1S9PjZi.js} +1 -1
  30. package/dist/assets/{common-CD6Mj8n6.js → common-CJ3baa6D.js} +1 -1
  31. package/dist/assets/components-DpUIWGaj.js +1 -0
  32. package/dist/assets/config-B-Q7J_6d.js +1 -0
  33. package/dist/assets/{config-COUOIPEq.js → config-BJVx3eBW.js} +1 -1
  34. package/dist/assets/{copy-BtTOqPTS.js → copy-Bxb1_Gtw.js} +1 -1
  35. package/dist/assets/{copy-icon-C2pG0ZNK.js → copy-icon-neDQUo4Q.js} +1 -1
  36. package/dist/assets/{createReducer-C7kZ8zEe.js → createReducer-DGx5Af-C.js} +1 -1
  37. package/dist/assets/{datasource-ySAiC9gr.js → datasource-D_VcQMEn.js} +2 -2
  38. package/dist/assets/{dates-D-kIKDYA.js → dates-C2LWzsCZ.js} +1 -1
  39. package/dist/assets/{dependency-graph-panel-BF23EwcD.js → dependency-graph-panel-DY5lvPDx.js} +3 -3
  40. package/dist/assets/{dialog-D1DEsRZ2.js → dialog-BCVepWLJ.js} +1 -1
  41. package/dist/assets/{dist-ByVeMWkr.js → dist-BLN8PNJV.js} +1 -1
  42. package/dist/assets/dist-CiVShZKM.js +2 -0
  43. package/dist/assets/{documentation-panel-e9Fi9R7e.js → documentation-panel-CGhwxsXK.js} +1 -1
  44. package/dist/assets/download-DpS57jyt.js +9 -0
  45. package/dist/assets/{dropdown-menu-BFZLnWeO.js → dropdown-menu-dHmZR8bI.js} +1 -1
  46. package/dist/assets/{edit-page-7X3HYey7.js → edit-page-DA765yQV.js} +6 -6
  47. package/dist/assets/{error-banner-B6eIlxzg.js → error-banner-BSxEOIn2.js} +1 -1
  48. package/dist/assets/error-entries-CTYMwfsh.js +8 -0
  49. package/dist/assets/{error-panel-DdsUL6b7.js → error-panel-DGAkG5kW.js} +1 -1
  50. package/dist/assets/{es-1D83cgiu.js → es-gYgfF8y5.js} +1 -1
  51. package/dist/assets/{esm-BL7jQmzn.js → esm-B30N1GS0.js} +1 -1
  52. package/dist/assets/{field-BeZbVzXA.js → field-BsxD35VE.js} +1 -1
  53. package/dist/assets/{file-explorer-panel-Ntq1-VbF.js → file-explorer-panel-BKUo-MDh.js} +3 -3
  54. package/dist/assets/{file-icons-Cb54mIL8.js → file-icons-DfWENcb8.js} +1 -1
  55. package/dist/assets/{file-name-input-BWFcK1ey.js → file-name-input-CNVZtm5K.js} +1 -1
  56. package/dist/assets/floating-outline-LitP0wCD.js +1 -0
  57. package/dist/assets/focus-CNKbm-Xz.js +1 -0
  58. package/dist/assets/{form-B6BkSCJb.js → form-nHzLTU1m.js} +2 -2
  59. package/dist/assets/{formats-ClEFGPy-.js → formats-DzmLpc9A.js} +1 -1
  60. package/dist/assets/{formatting-B_41gSF5.js → formatting-CDf6w1Kt.js} +1 -1
  61. package/dist/assets/{fullscreen-dUjPYOmm.js → fullscreen-CTDqNQr6.js} +1 -1
  62. package/dist/assets/{gallery-page-CWQQAYpa.js → gallery-page-CJ3ms1Hn.js} +1 -1
  63. package/dist/assets/{glide-data-editor-lMARFWHS.js → glide-data-editor-j2igs9Y_.js} +1 -1
  64. package/dist/assets/home-page-DM9Z_IJ7.js +4 -0
  65. package/dist/assets/{html-to-image-CwmX28T9.js → html-to-image-JaxFFZcr.js} +2 -2
  66. package/dist/assets/index-C7_REKh1.js +38 -0
  67. package/dist/assets/index-D6Dp_PFj.css +2 -0
  68. package/dist/assets/{input-CqrUjynb.js → input-JxFwu-3G.js} +1 -1
  69. package/dist/assets/kiosk-mode-BumOFEtY.js +1 -0
  70. package/dist/assets/{label-BElwWzf0.js → label-CqjrpwRC.js} +1 -1
  71. package/dist/assets/{layout-CUlZijwG.js → layout-B29hqiiK.js} +5 -5
  72. package/dist/assets/{links-CToBjIIj.js → links-CZr5bjvo.js} +1 -1
  73. package/dist/assets/logs-panel-CQRPYS8j.js +1 -0
  74. package/dist/assets/{markdown-renderer-QvXG0CRk.js → markdown-renderer-sEayY9-m.js} +2 -2
  75. package/dist/assets/{menu-items-DbSLBfXR.js → menu-items-CCi6aOPm.js} +1 -1
  76. package/dist/assets/{mermaid-Bh0flEIb.js → mermaid-CYN0wOyG.js} +1 -1
  77. package/dist/assets/{name-cell-input-C6cukQ9k.js → name-cell-input-B-aj1KH3.js} +1 -1
  78. package/dist/assets/node-sql-parser-Si4oZ2P-.js +68 -0
  79. package/dist/assets/{numbers-CeeaFKqu.js → numbers-rmawRqQP.js} +1 -1
  80. package/dist/assets/{outline-panel-BPlg9_CE.js → outline-panel-BOryk60D.js} +1 -1
  81. package/dist/assets/{packages-panel-BzQF60rG.js → packages-panel-DoYDLty3.js} +1 -1
  82. package/dist/assets/pair-with-agent-modal-BCRSACei.js +4 -0
  83. package/dist/assets/panels-Bb4fIHgH.js +4 -0
  84. package/dist/assets/{popover-DrHQ3KEt.js → popover-Bcz1Zikb.js} +1 -1
  85. package/dist/assets/process-output-d-LEMtGI.js +1 -0
  86. package/dist/assets/{radio-group-CLBjGkt5.js → radio-group-DfioQthW.js} +1 -1
  87. package/dist/assets/{readonly-code-display-D63oRtBP.js → readonly-code-display-C9fu8tvK.js} +1 -1
  88. package/dist/assets/{readonly-python-code-CW_G5e4E.js → readonly-python-code-DHxOnQGj.js} +1 -1
  89. package/dist/assets/{renderShortcut-BZLr8D7H.js → renderShortcut-Bl8_FVn8.js} +1 -1
  90. package/dist/assets/{reveal-component-BLMTmd8T.js → reveal-component-5jf0W625.js} +60 -60
  91. package/dist/assets/{run-page-B6pgDYEJ.js → run-page-BMKx9ld_.js} +1 -1
  92. package/dist/assets/{runs-D51Xwrsk.js → runs-DBTXqJHS.js} +1 -1
  93. package/dist/assets/scratchpad-panel-C8z8vzBX.js +1 -0
  94. package/dist/assets/{scroll-to-bottom-button-Cgr10kaJ.js → scroll-to-bottom-button-C8yfT4wq.js} +1 -1
  95. package/dist/assets/{secrets-panel-Cc5KDBk6.js → secrets-panel-6J6wcuVR.js} +1 -1
  96. package/dist/assets/{select-B5TFNjmU.js → select-BP75_5jJ.js} +1 -1
  97. package/dist/assets/{session-CEFnN9Cq.js → session-BmukRjSi.js} +1 -1
  98. package/dist/assets/{session-panel-Y0Oon0sD.js → session-panel-BVVk-02h.js} +1 -1
  99. package/dist/assets/{share-CYpcX4N4.js → share-852X_cqy.js} +1 -1
  100. package/dist/assets/{skeleton-D3QPxqWC.js → skeleton-Bubr9pIj.js} +1 -1
  101. package/dist/assets/slides-DkEgzTJB.css +1 -0
  102. package/dist/assets/{snippets-panel-CXpGflMO.js → snippets-panel-U2-iok-c.js} +1 -1
  103. package/dist/assets/{spec-CzqcmYQk.js → spec-C7opZZRp.js} +1 -1
  104. package/dist/assets/{state-BvdK8eiw.js → state-D10U2MwA.js} +1 -1
  105. package/dist/assets/{state-WBgc7MiA.js → state-DDag0B_B.js} +1 -1
  106. package/dist/assets/state-DtziTd1T.js +3 -0
  107. package/dist/assets/{state-DBzEQtWz.js → state-DxQhUsG9.js} +1 -1
  108. package/dist/assets/{strings-Djnbwmfl.js → strings--BknHX9C.js} +1 -1
  109. package/dist/assets/{swiper-component-DInvCxhI.js → swiper-component-g8EXE911.js} +1 -1
  110. package/dist/assets/switch-OVajJBPR.js +1 -0
  111. package/dist/assets/{terminal-D3IQBBYo.js → terminal-217O8hlZ.js} +1 -1
  112. package/dist/assets/{textarea-CpFfEUet.js → textarea-Bmzmbbpo.js} +1 -1
  113. package/dist/assets/{tooltip-CFX4fYHU.js → tooltip-4bZlU7jl.js} +1 -1
  114. package/dist/assets/{tooltip-HLb6RxVp.js → tooltip-B7U4xkIN.js} +1 -1
  115. package/dist/assets/{tracing-CKn3gWHw.js → tracing-B5XFvMmV.js} +1 -1
  116. package/dist/assets/{tracing-panel-BU-o_LCd.js → tracing-panel-DnR2bYDe.js} +2 -2
  117. package/dist/assets/{tree-actions-CsC2XmGo.js → tree-actions-Dx9CDaxV.js} +1 -1
  118. package/dist/assets/{useBoolean-D89u30n-.js → useBoolean-CFj86iac.js} +1 -1
  119. package/dist/assets/useCellActionButton-DypR3yDt.js +1 -0
  120. package/dist/assets/{useDeleteCell-EPH4kcG7.js → useDeleteCell-vMXAr3rY.js} +1 -1
  121. package/dist/assets/{useDependencyPanelTab-CZnK7N2L.js → useDependencyPanelTab-CwdwKf7A.js} +1 -1
  122. package/dist/assets/useEventListener-C0195JsF.js +1 -0
  123. package/dist/assets/{useHotkey-DIuRH8Wu.js → useHotkey-DLZvrRZT.js} +1 -1
  124. package/dist/assets/{useIframeCapabilities-Ccb4fvKc.js → useIframeCapabilities-j6fR_dBA.js} +1 -1
  125. package/dist/assets/{useInstallPackage-BRbUAUFn.js → useInstallPackage-WiYBwhUO.js} +1 -1
  126. package/dist/assets/{useInterval-CC0vKpWm.js → useInterval-CWBTUy5W.js} +1 -1
  127. package/dist/assets/useNotebookActions-jWIcmpv0.js +12 -0
  128. package/dist/assets/{useRunCells-CSSF_mJ0.js → useRunCells-C2dvU2jA.js} +1 -1
  129. package/dist/assets/{useSplitCell-9Qz93yPZ.js → useSplitCell-C1tubdNi.js} +1 -1
  130. package/dist/assets/{useTheme-KXqAyDPC.js → useTheme-Bxv9B31g.js} +1 -1
  131. package/dist/assets/{utils-Z80SV4_d.js → utils-BWBBpCkT.js} +1 -1
  132. package/dist/assets/{vega-component-Cie3ag_T.js → vega-component-Db8KjZJG.js} +1 -1
  133. package/dist/assets/{write-secret-modal-DEEn7sZV.js → write-secret-modal-3-v-dHVj.js} +1 -1
  134. package/dist/index.html +68 -68
  135. package/package.json +3 -4
  136. package/src/__mocks__/requests.ts +45 -4
  137. package/src/components/data-table/__tests__/__snapshots__/chart-spec-model.test.ts.snap +174 -21
  138. package/src/components/data-table/__tests__/chart-spec-model.test.ts +102 -1
  139. package/src/components/data-table/column-summary/chart-spec-model.tsx +163 -103
  140. package/src/components/data-table/column-summary/legacy-chart-spec.ts +15 -7
  141. package/src/components/data-table/column-summary/utils.ts +26 -7
  142. package/src/components/data-table/types.ts +1 -1
  143. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +99 -18
  144. package/src/components/editor/actions/__tests__/pdf-export.test.ts +0 -4
  145. package/src/components/editor/actions/pair-with-agent-commands.ts +21 -10
  146. package/src/components/editor/actions/pair-with-agent-modal.tsx +2 -2
  147. package/src/components/editor/actions/pdf-export.ts +1 -4
  148. package/src/components/editor/actions/useNotebookActions.tsx +7 -13
  149. package/src/components/editor/cell/code/__tests__/cell-editor-activity-lifecycle.test.ts +250 -0
  150. package/src/components/editor/cell/code/cell-editor.tsx +13 -7
  151. package/src/components/editor/chrome/panels/__tests__/logs-panel.test.tsx +25 -0
  152. package/src/components/editor/chrome/panels/logs-panel.tsx +12 -2
  153. package/src/components/editor/connections/storage/__tests__/__snapshots__/as-code.test.ts.snap +50 -0
  154. package/src/components/editor/connections/storage/__tests__/as-code.test.ts +87 -8
  155. package/src/components/editor/connections/storage/as-code.ts +40 -21
  156. package/src/components/editor/connections/storage/schemas.ts +83 -42
  157. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -1
  158. package/src/components/slides/__tests__/cell-output-block.test.tsx +40 -0
  159. package/src/components/slides/__tests__/slide-cell-view.test.tsx +33 -0
  160. package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +198 -0
  161. package/src/components/slides/reveal-component.tsx +25 -19
  162. package/src/components/slides/slide-cell-view.tsx +1 -1
  163. package/src/components/slides/slide-scroll-hint.tsx +161 -0
  164. package/src/components/slides/slides.css +4 -2
  165. package/src/components/static-html/share-modal.tsx +1 -1
  166. package/src/components/ui/input.tsx +1 -1
  167. package/src/core/cells/__tests__/cells.test.ts +12 -2
  168. package/src/core/cells/__tests__/logs.test.ts +5 -5
  169. package/src/core/cells/cells.ts +17 -4
  170. package/src/core/cells/document-changes.ts +1 -0
  171. package/src/core/cells/logs.ts +14 -4
  172. package/src/core/codemirror/copilot/__tests__/language-server.test.ts +396 -100
  173. package/src/core/codemirror/copilot/__tests__/transport.test.ts +128 -540
  174. package/src/core/codemirror/copilot/language-server.ts +182 -70
  175. package/src/core/codemirror/copilot/transport.ts +15 -207
  176. package/src/core/codemirror/copilot/types.ts +9 -2
  177. package/src/core/codemirror/find-replace/__tests__/navigate.test.ts +42 -30
  178. package/src/core/codemirror/find-replace/navigate.ts +2 -0
  179. package/src/core/codemirror/go-to-definition/__tests__/commands.test.ts +24 -3
  180. package/src/core/codemirror/go-to-definition/commands.ts +3 -0
  181. package/src/core/codemirror/keymaps/__tests__/keymaps.test.ts +31 -2
  182. package/src/core/codemirror/keymaps/keymaps.ts +12 -0
  183. package/src/core/codemirror/language/__tests__/sql.test.ts +443 -61
  184. package/src/core/codemirror/language/languages/python.ts +23 -11
  185. package/src/core/codemirror/language/languages/sql/completion-store.ts +5 -1
  186. package/src/core/codemirror/language/languages/sql/sql.ts +210 -3
  187. package/src/core/codemirror/lsp/__tests__/federated-lsp.test.ts +161 -0
  188. package/src/core/codemirror/lsp/__tests__/log-messages.test.ts +53 -0
  189. package/src/core/codemirror/lsp/__tests__/normalize-markdown-math.test.ts +25 -0
  190. package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +598 -156
  191. package/src/core/codemirror/lsp/__tests__/transports.test.ts +112 -0
  192. package/src/core/codemirror/lsp/federated-lsp.ts +76 -23
  193. package/src/core/codemirror/lsp/log-messages.ts +37 -0
  194. package/src/core/codemirror/lsp/normalize-markdown-math.ts +8 -4
  195. package/src/core/codemirror/lsp/notebook-lsp.ts +220 -56
  196. package/src/core/codemirror/lsp/transports.ts +8 -1
  197. package/src/core/codemirror/lsp/types.ts +68 -8
  198. package/src/core/codemirror/lsp/utils.ts +14 -0
  199. package/src/core/codemirror/utils.ts +28 -0
  200. package/src/core/hotkeys/hotkeys.ts +0 -2
  201. package/src/core/islands/__tests__/bridge.test.ts +107 -0
  202. package/src/core/islands/bridge.ts +16 -0
  203. package/src/core/lsp/__tests__/transport.test.ts +509 -337
  204. package/src/core/lsp/transport.ts +304 -132
  205. package/src/core/mode.ts +10 -0
  206. package/src/core/network/__tests__/api.test.ts +42 -0
  207. package/src/core/network/__tests__/connection.test.ts +45 -0
  208. package/src/core/network/__tests__/requests-lazy.test.ts +32 -1
  209. package/src/core/network/__tests__/requests-network.test.ts +21 -0
  210. package/src/core/network/api.ts +27 -0
  211. package/src/core/network/connection.ts +15 -0
  212. package/src/core/network/requests-lazy.ts +1 -0
  213. package/src/core/network/requests-network.ts +14 -8
  214. package/src/core/network/requests-static.ts +1 -0
  215. package/src/core/network/requests-toasting.tsx +1 -0
  216. package/src/core/network/types.ts +22 -6
  217. package/src/core/rtc/state.ts +9 -0
  218. package/src/core/static/download-html.ts +5 -14
  219. package/src/core/wasm/bridge.ts +4 -2
  220. package/src/core/wasm/worker/types.ts +5 -2
  221. package/src/css/app/codemirror.css +16 -2
  222. package/src/plugins/impl/FormPlugin.tsx +1 -1
  223. package/src/plugins/impl/__tests__/FormPlugin.test.tsx +162 -0
  224. package/src/stories/log-viewer.stories.tsx +12 -6
  225. package/src/utils/__tests__/download.test.tsx +24 -1
  226. package/src/utils/download.ts +11 -6
  227. package/dist/assets/RenderHTML-BCvU9dYz.js +0 -1
  228. package/dist/assets/add-connection-dialog-B-jCRNTN.js +0 -170
  229. package/dist/assets/ai-model-dropdown-DXgLphFa.js +0 -5
  230. package/dist/assets/cell-link-DqBkyAFe.js +0 -1
  231. package/dist/assets/cells-Cf7bHHq3.js +0 -229
  232. package/dist/assets/components-BH6gDVv6.js +0 -1
  233. package/dist/assets/config-BbOTTCYY.js +0 -1
  234. package/dist/assets/dist-BCMBu0rO.js +0 -2
  235. package/dist/assets/download-BomYt3nl.js +0 -9
  236. package/dist/assets/error-entries-Birw-8VX.js +0 -8
  237. package/dist/assets/floating-outline-wz-WSRgP.js +0 -1
  238. package/dist/assets/focus-DiEyfiAG.js +0 -1
  239. package/dist/assets/home-page-DJ4jJsZj.js +0 -4
  240. package/dist/assets/index-A71LAt6h.css +0 -2
  241. package/dist/assets/index-CMZzy-dF.js +0 -38
  242. package/dist/assets/kiosk-mode-ABm3oYgq.js +0 -1
  243. package/dist/assets/logs-panel-iFV4ZJ9b.js +0 -1
  244. package/dist/assets/node-sql-parser-BWgUjcfV.js +0 -68
  245. package/dist/assets/pair-with-agent-modal-CKOYwOYw.js +0 -4
  246. package/dist/assets/panels-Dj45fW-v.js +0 -4
  247. package/dist/assets/process-output-BEhIGfkO.js +0 -1
  248. package/dist/assets/scratchpad-panel-B0mEqBNk.js +0 -1
  249. package/dist/assets/slides-MCbMDtlY.css +0 -1
  250. package/dist/assets/state-BZQc7xxL.js +0 -3
  251. package/dist/assets/switch-CvweaCXq.js +0 -1
  252. package/dist/assets/useCellActionButton-CRfIEVB5.js +0 -1
  253. package/dist/assets/useEventListener-B_w3A283.js +0 -1
  254. package/dist/assets/useNotebookActions-DTXAoukG.js +0 -12
@@ -3,6 +3,7 @@
3
3
  import { afterEach, describe, expect, it, vi } from "vitest";
4
4
  import {
5
5
  type ConnectionInfo,
6
+ getFileFromURL,
6
7
  getMarimoCommand,
7
8
  getRawPrompt,
8
9
  getTerminalCommand,
@@ -12,7 +13,11 @@ import {
12
13
 
13
14
  const CONNECTION: ConnectionInfo = {
14
15
  url: "http://localhost:8000",
15
- sessionId: "s_ab12cd",
16
+ file: "notebooks/example.py",
17
+ };
18
+
19
+ const CONNECTION_WITHOUT_FILE: ConnectionInfo = {
20
+ url: "http://localhost:8000",
16
21
  };
17
22
 
18
23
  describe("shellQuote", () => {
@@ -22,7 +27,7 @@ describe("shellQuote", () => {
22
27
 
23
28
  it("leaves shell-safe values untouched", () => {
24
29
  expect(shellQuote("http://localhost:8000")).toBe("http://localhost:8000");
25
- expect(shellQuote("s_ab12cd")).toBe("s_ab12cd");
30
+ expect(shellQuote("notebooks/example.py")).toBe("notebooks/example.py");
26
31
  });
27
32
 
28
33
  it("quotes values with shell metacharacters", () => {
@@ -37,6 +42,49 @@ describe("shellQuote", () => {
37
42
  // Closes the quote, emits a literal ' via "'", then reopens: '"'"'
38
43
  expect(shellQuote("a'b")).toBe(`'a'"'"'b'`);
39
44
  });
45
+
46
+ it.each([
47
+ ["/tmp/my notebook.py", "'/tmp/my notebook.py'"],
48
+ [
49
+ String.raw`C:\Users\Jane Doe\notebook.py`,
50
+ String.raw`'C:\Users\Jane Doe\notebook.py'`,
51
+ ],
52
+ [
53
+ String.raw`\\server\share\my notebook.py`,
54
+ String.raw`'\\server\share\my notebook.py'`,
55
+ ],
56
+ ])("quotes non-portable path %s as one argument", (path, expected) => {
57
+ expect(shellQuote(path)).toBe(expected);
58
+ });
59
+ });
60
+
61
+ describe("getFileFromURL", () => {
62
+ it("returns undefined when the file query parameter is absent or empty", () => {
63
+ expect(getFileFromURL("http://localhost:8000")).toBeUndefined();
64
+ expect(getFileFromURL("http://localhost:8000?file=")).toBeUndefined();
65
+ });
66
+
67
+ it("decodes spaces and literal plus signs", () => {
68
+ expect(
69
+ getFileFromURL(
70
+ "http://localhost:8000?file=relative%2Fmy%20notebook%2Bdata.py",
71
+ ),
72
+ ).toBe("relative/my notebook+data.py");
73
+ expect(getFileFromURL("http://localhost:8000?file=my+notebook.py")).toBe(
74
+ "my notebook.py",
75
+ );
76
+ });
77
+
78
+ it("preserves decoded Windows paths and uses the first duplicate value", () => {
79
+ expect(
80
+ getFileFromURL(
81
+ "http://localhost:8000?file=C%3A%5CUsers%5CJane%20Doe%5Cnotebook.py",
82
+ ),
83
+ ).toBe(String.raw`C:\Users\Jane Doe\notebook.py`);
84
+ expect(
85
+ getFileFromURL("http://localhost:8000?file=first.py&file=second.py"),
86
+ ).toBe("first.py");
87
+ });
40
88
  });
41
89
 
42
90
  describe("getMarimoCommand", () => {
@@ -56,30 +104,56 @@ describe("getMarimoCommand", () => {
56
104
  });
57
105
 
58
106
  describe("getTerminalCommand", () => {
59
- it("includes the url and session for each agent", () => {
107
+ it("includes the url and file for each agent", () => {
60
108
  expect(getTerminalCommand("claude", CONNECTION, false)).toBe(
61
- `claude "$(uv run marimo pair prompt --url http://localhost:8000 --session s_ab12cd --claude)"`,
109
+ `claude "$(uv run marimo pair prompt --url http://localhost:8000 --file notebooks/example.py --claude)"`,
62
110
  );
63
111
  expect(getTerminalCommand("codex", CONNECTION, false)).toBe(
64
- `codex "$(uv run marimo pair prompt --url http://localhost:8000 --session s_ab12cd --codex)"`,
112
+ `codex "$(uv run marimo pair prompt --url http://localhost:8000 --file notebooks/example.py --codex)"`,
65
113
  );
66
114
  expect(getTerminalCommand("opencode", CONNECTION, false)).toBe(
67
- `opencode --prompt "$(uv run marimo pair prompt --url http://localhost:8000 --session s_ab12cd --opencode)"`,
115
+ `opencode --prompt "$(uv run marimo pair prompt --url http://localhost:8000 --file notebooks/example.py --opencode)"`,
68
116
  );
69
117
  });
70
118
 
71
- it("always targets the given session, not a random one", () => {
72
- const command = getTerminalCommand("claude", CONNECTION, false);
73
- expect(command).toContain("--session s_ab12cd");
119
+ it("omits the file flag when the page URL has no file", () => {
120
+ const command = getTerminalCommand(
121
+ "claude",
122
+ CONNECTION_WITHOUT_FILE,
123
+ false,
124
+ );
125
+ expect(command).not.toContain("--file");
126
+ expect(command).not.toContain("--session");
74
127
  });
75
128
 
76
129
  it("shell-escapes a url containing metacharacters", () => {
77
130
  const command = getTerminalCommand(
78
131
  "claude",
79
- { url: "http://host:8000?file=a&b", sessionId: "s_ab12cd" },
132
+ { url: "http://host:8000?auth=a&b", file: "notebook.py" },
80
133
  false,
81
134
  );
82
- expect(command).toContain("--url 'http://host:8000?file=a&b'");
135
+ expect(command).toContain("--url 'http://host:8000?auth=a&b'");
136
+ });
137
+
138
+ it.each([
139
+ ["relative/my notebook.py", "--file 'relative/my notebook.py'"],
140
+ ["/tmp/my notebook.py", "--file '/tmp/my notebook.py'"],
141
+ [
142
+ String.raw`C:\Users\Jane Doe\notebook.py`,
143
+ String.raw`--file 'C:\Users\Jane Doe\notebook.py'`,
144
+ ],
145
+ [
146
+ String.raw`\\server\share\my notebook.py`,
147
+ String.raw`--file '\\server\share\my notebook.py'`,
148
+ ],
149
+ ["notebooks/it's.py", `--file 'notebooks/it'"'"'s.py'`],
150
+ ])("shell-escapes file path %s", (file, expected) => {
151
+ const command = getTerminalCommand(
152
+ "claude",
153
+ { url: CONNECTION.url, file },
154
+ false,
155
+ );
156
+ expect(command).toContain(expected);
83
157
  });
84
158
 
85
159
  it("adds --with-token before the agent flag when requested", () => {
@@ -95,26 +169,33 @@ describe("getTerminalCommand", () => {
95
169
  });
96
170
 
97
171
  describe("getRawPrompt", () => {
98
- it("references the session-scoped execute-code command", () => {
172
+ it("references the file-scoped execute-code command", () => {
99
173
  const prompt = getRawPrompt(CONNECTION, null);
100
174
  expect(prompt).toContain(
101
- "execute-code.sh --url http://localhost:8000 --session s_ab12cd",
175
+ "execute-code.sh --url http://localhost:8000 --file notebooks/example.py",
102
176
  );
103
177
  expect(prompt).toContain(
104
- "Connect to the notebook at: http://localhost:8000 (session s_ab12cd)",
178
+ "Connect to the notebook at: http://localhost:8000 (file notebooks/example.py)",
105
179
  );
106
180
  });
107
181
 
182
+ it("omits file targeting when the page URL has no file", () => {
183
+ const prompt = getRawPrompt(CONNECTION_WITHOUT_FILE, null);
184
+ expect(prompt).toContain("execute-code.sh --url http://localhost:8000");
185
+ expect(prompt).not.toContain("--file");
186
+ expect(prompt).not.toContain("--session");
187
+ });
188
+
108
189
  it("omits the token hint when there is no token", () => {
109
190
  const prompt = getRawPrompt(CONNECTION, null);
110
191
  expect(prompt).not.toContain("--token");
111
192
  expect(prompt).not.toContain("auth token");
112
193
  });
113
194
 
114
- it("includes a session-scoped token hint when a token is present", () => {
195
+ it("includes a file-scoped token hint when a token is present", () => {
115
196
  const prompt = getRawPrompt(CONNECTION, "secret-token");
116
197
  expect(prompt).toContain(
117
- "execute-code.sh --url http://localhost:8000 --session s_ab12cd --token secret-token",
198
+ "execute-code.sh --url http://localhost:8000 --file notebooks/example.py --token secret-token",
118
199
  );
119
200
  });
120
201
 
@@ -128,9 +209,9 @@ describe("getRawPrompt", () => {
128
209
  expect(prompt).toMatchInlineSnapshot(`
129
210
  "Use the /marimo-pair skill to pair-program on a running marimo notebook.
130
211
 
131
- Connect to the notebook at: http://localhost:8000 (session s_ab12cd)
212
+ Connect to the notebook at: http://localhost:8000 (file notebooks/example.py)
132
213
 
133
- Use \`execute-code.sh --url http://localhost:8000 --session s_ab12cd\` from the marimo-pair skill to execute code in the notebook.
214
+ Use \`execute-code.sh --url http://localhost:8000 --file notebooks/example.py\` from the marimo-pair skill to execute code in the notebook.
134
215
 
135
216
  Once you are connected, send a fun toast (mo.status.toast(...)) to the user inside marimo letting them know you're ready to pair."
136
217
  `);
@@ -8,13 +8,11 @@ describe("runServerSidePDFDownload", () => {
8
8
  const downloadPDF = vi.fn().mockResolvedValue(undefined);
9
9
 
10
10
  await runServerSidePDFDownload({
11
- filename: "slides.py",
12
11
  preset: "document",
13
12
  downloadPDF,
14
13
  });
15
14
 
16
15
  expect(downloadPDF).toHaveBeenCalledWith({
17
- filename: "slides.py",
18
16
  webpdf: false,
19
17
  preset: "document",
20
18
  includeInputs: true,
@@ -26,13 +24,11 @@ describe("runServerSidePDFDownload", () => {
26
24
  const downloadPDF = vi.fn().mockResolvedValue(undefined);
27
25
 
28
26
  await runServerSidePDFDownload({
29
- filename: "slides.py",
30
27
  preset: "slides",
31
28
  downloadPDF,
32
29
  });
33
30
 
34
31
  expect(downloadPDF).toHaveBeenCalledWith({
35
- filename: "slides.py",
36
32
  webpdf: false,
37
33
  preset: "slides",
38
34
  includeInputs: true,
@@ -1,6 +1,7 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
3
  import { assertNever } from "@/utils/assertNever";
4
+ import { KnownQueryParams } from "@/core/constants";
4
5
 
5
6
  export type AgentTab = "claude" | "codex" | "opencode" | "prompt";
6
7
 
@@ -43,14 +44,21 @@ export function shellQuote(value: string): string {
43
44
  return `'${value.replaceAll("'", `'"'"'`)}'`;
44
45
  }
45
46
 
47
+ /** Return the server file key from a page URL, preserving its decoded value. */
48
+ export function getFileFromURL(href: string): string | undefined {
49
+ const file = new URL(href).searchParams.get(KnownQueryParams.filePath);
50
+ return file === null || file === "" ? undefined : file;
51
+ }
52
+
53
+ function getFileFlag(file: string | undefined): string {
54
+ return file ? ` --file ${shellQuote(file)}` : "";
55
+ }
56
+
46
57
  /** Identifies the specific running notebook to pair on. */
47
58
  export interface ConnectionInfo {
48
59
  url: string;
49
- /**
50
- * The current session id, so agents connect to *this* notebook rather than
51
- * guessing when multiple sessions are open on the same server.
52
- */
53
- sessionId: string;
60
+ /** The server's file key, when the page URL identifies a notebook. */
61
+ file?: string;
54
62
  }
55
63
 
56
64
  /**
@@ -59,11 +67,12 @@ export interface ConnectionInfo {
59
67
  */
60
68
  export function getTerminalCommand(
61
69
  agent: Exclude<AgentTab, "prompt">,
62
- { url, sessionId }: ConnectionInfo,
70
+ { url, file }: ConnectionInfo,
63
71
  withToken: boolean,
64
72
  ): string {
73
+ const fileFlag = getFileFlag(file);
65
74
  const tokenFlag = withToken ? " --with-token" : "";
66
- const base = `${getMarimoCommand()} pair prompt --url ${shellQuote(url)} --session ${shellQuote(sessionId)}${tokenFlag}`;
75
+ const base = `${getMarimoCommand()} pair prompt --url ${shellQuote(url)}${fileFlag}${tokenFlag}`;
67
76
  switch (agent) {
68
77
  case "claude":
69
78
  return `claude "$(${base} --claude)"`;
@@ -82,17 +91,19 @@ export function getTerminalCommand(
82
91
  * an agent behaves the same as the terminal commands.
83
92
  */
84
93
  export function getRawPrompt(
85
- { url, sessionId }: ConnectionInfo,
94
+ { url, file }: ConnectionInfo,
86
95
  token: string | null,
87
96
  ): string {
88
- const executeCmd = `execute-code.sh --url ${shellQuote(url)} --session ${shellQuote(sessionId)}`;
97
+ const fileFlag = getFileFlag(file);
98
+ const fileHint = file ? ` (file ${file})` : "";
99
+ const executeCmd = `execute-code.sh --url ${shellQuote(url)}${fileFlag}`;
89
100
  const tokenHint = token
90
101
  ? `\n\nUse this auth token when calling \`execute-code.sh\`: \`${executeCmd} --token ${shellQuote(token)}\`.`
91
102
  : "";
92
103
  return [
93
104
  "Use the /marimo-pair skill to pair-program on a running marimo notebook.",
94
105
  "",
95
- `Connect to the notebook at: ${url} (session ${sessionId})`,
106
+ `Connect to the notebook at: ${url}${fileHint}`,
96
107
  "",
97
108
  `Use \`${executeCmd}\` from the marimo-pair skill to execute code in the notebook.${tokenHint}`,
98
109
  "",
@@ -16,12 +16,12 @@ import { Events } from "@/utils/events";
16
16
  import { Tooltip } from "@/components/ui/tooltip";
17
17
  import { asRemoteURL, useRuntimeManager } from "@/core/runtime/config";
18
18
  import { API } from "@/core/network/api";
19
- import { getSessionId } from "@/core/kernel/session";
20
19
  import {
21
20
  AGENT_LABELS,
22
21
  AGENT_TABS,
23
22
  type AgentTab,
24
23
  type ConnectionInfo,
24
+ getFileFromURL,
25
25
  getRawPrompt,
26
26
  getTerminalCommand,
27
27
  maskToken,
@@ -53,7 +53,7 @@ export const PairWithAgentModal: React.FC<{
53
53
  const hasToken = Boolean(authToken);
54
54
  const connection: ConnectionInfo = {
55
55
  url: runtimeManager.httpURL.toString(),
56
- sessionId: getSessionId(),
56
+ file: getFileFromURL(window.location.href),
57
57
  };
58
58
 
59
59
  return (
@@ -2,7 +2,6 @@
2
2
 
3
3
  type Preset = "document" | "slides";
4
4
  type DownloadPDF = (opts: {
5
- filename: string;
6
5
  webpdf: boolean;
7
6
  preset: Preset;
8
7
  includeInputs: boolean;
@@ -10,14 +9,12 @@ type DownloadPDF = (opts: {
10
9
  }) => Promise<void>;
11
10
 
12
11
  export async function runServerSidePDFDownload(opts: {
13
- filename: string;
14
12
  preset: Preset;
15
13
  downloadPDF: DownloadPDF;
16
14
  }): Promise<void> {
17
- const { filename, preset, downloadPDF } = opts;
15
+ const { preset, downloadPDF } = opts;
18
16
 
19
17
  await downloadPDF({
20
- filename,
21
18
  webpdf: false,
22
19
  preset,
23
20
  includeInputs: true,
@@ -83,6 +83,7 @@ import {
83
83
  ADD_PRINTING_CLASS,
84
84
  downloadAsPDF,
85
85
  downloadBlob,
86
+ downloadExportedFile,
86
87
  downloadHTMLAsImage,
87
88
  withLoadingToast,
88
89
  } from "@/utils/download";
@@ -197,7 +198,6 @@ export function useNotebookActions() {
197
198
  updateCellOutputs,
198
199
  });
199
200
  await runServerSidePDFDownload({
200
- filename,
201
201
  preset,
202
202
  downloadPDF: downloadAsPDF,
203
203
  });
@@ -231,11 +231,8 @@ export function useNotebookActions() {
231
231
  takeScreenshots: () => takeScreenshots({ progress }),
232
232
  updateCellOutputs,
233
233
  });
234
- const ipynb = await exportAsIPYNB({ download: false });
235
- downloadBlob(
236
- new Blob([ipynb], { type: "application/x-ipynb+json" }),
237
- Filenames.toIPYNB(document.title),
238
- );
234
+ const exportedFile = await exportAsIPYNB({ download: false });
235
+ downloadExportedFile(exportedFile);
239
236
  };
240
237
 
241
238
  await withLoadingToast("Downloading IPYNB...", runDownload);
@@ -255,7 +252,7 @@ export function useNotebookActions() {
255
252
  toastNotebookMustBeNamed();
256
253
  return;
257
254
  }
258
- await downloadAsHTML({ filename, includeCode: true });
255
+ await downloadAsHTML({ includeCode: true });
259
256
  },
260
257
  },
261
258
  {
@@ -266,7 +263,7 @@ export function useNotebookActions() {
266
263
  toastNotebookMustBeNamed();
267
264
  return;
268
265
  }
269
- await downloadAsHTML({ filename, includeCode: false });
266
+ await downloadAsHTML({ includeCode: false });
270
267
  },
271
268
  },
272
269
  {
@@ -275,11 +272,8 @@ export function useNotebookActions() {
275
272
  ),
276
273
  label: "Download as Markdown",
277
274
  handle: async () => {
278
- const md = await exportAsMarkdown({ download: false });
279
- downloadBlob(
280
- new Blob([md], { type: "text/plain" }),
281
- Filenames.toMarkdown(document.title),
282
- );
275
+ const exportedFile = await exportAsMarkdown({ download: false });
276
+ downloadExportedFile(exportedFile);
283
277
  },
284
278
  },
285
279
  {
@@ -0,0 +1,250 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ /**
4
+ * Simulates React Activity's effect teardown when mode switches to "hidden":
5
+ * all useEffect cleanups run. On "visible", setups re-run (cleanups do not run
6
+ * again). Component state and DOM are preserved — only effects cycle.
7
+ *
8
+ * Registration order matches cell-editor.tsx: mount effect runs before destroy
9
+ * effect setup. With async editor creation (editorMountScheduler), destroy
10
+ * captures null initially; with sync creation it captures the live editor.
11
+ */
12
+ import { EditorState } from "@codemirror/state";
13
+ import { EditorView } from "@codemirror/view";
14
+ import { describe, expect, it } from "vitest";
15
+ import { Functions } from "@/utils/functions";
16
+
17
+ interface EffectRegistration {
18
+ cleanup: () => void;
19
+ }
20
+
21
+ function createActivitySimulator() {
22
+ const effects: EffectRegistration[] = [];
23
+
24
+ return {
25
+ /** Register effects in order — each setup runs synchronously, like React. */
26
+ useEffect(setup: () => (() => void) | undefined) {
27
+ const cleanup = setup() ?? Functions.NOOP;
28
+ effects.push({ cleanup });
29
+ },
30
+ hide() {
31
+ for (const effect of effects) {
32
+ effect.cleanup();
33
+ }
34
+ },
35
+ show() {
36
+ effects.length = 0;
37
+ },
38
+ };
39
+ }
40
+
41
+ function createEditor(doc = "hello") {
42
+ return new EditorView({
43
+ state: EditorState.create({ doc }),
44
+ });
45
+ }
46
+
47
+ interface RegisterCellEditorEffectsOptions {
48
+ activity: ReturnType<typeof createActivitySimulator>;
49
+ editorViewRef: { current: EditorView | null };
50
+ destroyPattern: "old" | "pr";
51
+ onDestroy?: () => void;
52
+ /** When true, editor creation is deferred like editorMountScheduler.request */
53
+ asyncMount?: boolean;
54
+ }
55
+
56
+ function registerCellEditorEffects({
57
+ activity,
58
+ editorViewRef,
59
+ destroyPattern,
60
+ onDestroy,
61
+ asyncMount = false,
62
+ }: RegisterCellEditorEffectsOptions) {
63
+ activity.useEffect(() => {
64
+ if (editorViewRef.current !== null) {
65
+ return;
66
+ }
67
+ let cancelled = false;
68
+ const mount = () => {
69
+ if (!cancelled && editorViewRef.current === null) {
70
+ editorViewRef.current = createEditor();
71
+ }
72
+ };
73
+ if (asyncMount) {
74
+ const id = setTimeout(mount, 0);
75
+ return () => {
76
+ cancelled = true;
77
+ clearTimeout(id);
78
+ };
79
+ }
80
+ mount();
81
+ return () => {
82
+ cancelled = true;
83
+ };
84
+ });
85
+
86
+ if (destroyPattern === "old") {
87
+ activity.useEffect(() => {
88
+ const ev = editorViewRef.current;
89
+ return () => {
90
+ if (ev) {
91
+ ev.destroy();
92
+ onDestroy?.();
93
+ }
94
+ };
95
+ });
96
+ } else {
97
+ activity.useEffect(() => {
98
+ return () => {
99
+ if (editorViewRef.current) {
100
+ editorViewRef.current.destroy();
101
+ onDestroy?.();
102
+ }
103
+ editorViewRef.current = null;
104
+ };
105
+ });
106
+ }
107
+ }
108
+
109
+ describe("CellEditor Activity lifecycle (simulated)", () => {
110
+ it("old destroy pattern (sync mount): first hide/show leaves stale ref", () => {
111
+ const editorViewRef = { current: null as EditorView | null };
112
+ let destroyCount = 0;
113
+ const activity = createActivitySimulator();
114
+
115
+ registerCellEditorEffects({
116
+ activity,
117
+ editorViewRef,
118
+ destroyPattern: "old",
119
+ onDestroy: () => {
120
+ destroyCount++;
121
+ },
122
+ });
123
+ const liveEditor = editorViewRef.current;
124
+ expect(liveEditor).not.toBeNull();
125
+
126
+ activity.hide();
127
+ expect(destroyCount).toBeGreaterThan(0);
128
+ expect(editorViewRef.current).toBe(liveEditor);
129
+
130
+ activity.show();
131
+ registerCellEditorEffects({
132
+ activity,
133
+ editorViewRef,
134
+ destroyPattern: "old",
135
+ });
136
+ expect(editorViewRef.current).toBe(liveEditor);
137
+ });
138
+
139
+ it("old destroy pattern (async mount): first hide/show preserves editor", async () => {
140
+ const editorViewRef = { current: null as EditorView | null };
141
+ let destroyCount = 0;
142
+ const activity = createActivitySimulator();
143
+
144
+ registerCellEditorEffects({
145
+ activity,
146
+ editorViewRef,
147
+ destroyPattern: "old",
148
+ onDestroy: () => {
149
+ destroyCount++;
150
+ },
151
+ asyncMount: true,
152
+ });
153
+ await new Promise((r) => setTimeout(r, 0));
154
+ const liveEditor = editorViewRef.current;
155
+ expect(liveEditor).not.toBeNull();
156
+
157
+ // Destroy effect captured null at setup (editor created async after effects)
158
+ activity.hide();
159
+ expect(destroyCount).toBe(0);
160
+ expect(editorViewRef.current).toBe(liveEditor);
161
+
162
+ activity.show();
163
+ registerCellEditorEffects({
164
+ activity,
165
+ editorViewRef,
166
+ destroyPattern: "old",
167
+ asyncMount: true,
168
+ });
169
+ await new Promise((r) => setTimeout(r, 0));
170
+ expect(editorViewRef.current).toBe(liveEditor);
171
+ });
172
+
173
+ it("PR destroy pattern (async mount): recreates on first hide/show", async () => {
174
+ const editorViewRef = { current: null as EditorView | null };
175
+ const activity = createActivitySimulator();
176
+
177
+ registerCellEditorEffects({
178
+ activity,
179
+ editorViewRef,
180
+ destroyPattern: "pr",
181
+ asyncMount: true,
182
+ });
183
+ await new Promise((r) => setTimeout(r, 0));
184
+ const firstEditor = editorViewRef.current;
185
+
186
+ activity.hide();
187
+ expect(editorViewRef.current).toBeNull();
188
+
189
+ activity.show();
190
+ registerCellEditorEffects({
191
+ activity,
192
+ editorViewRef,
193
+ destroyPattern: "pr",
194
+ asyncMount: true,
195
+ });
196
+ await new Promise((r) => setTimeout(r, 0));
197
+ expect(editorViewRef.current).not.toBeNull();
198
+ expect(editorViewRef.current).not.toBe(firstEditor);
199
+ });
200
+
201
+ it("PR destroy pattern: nulls ref on hide so mount recreates on show", () => {
202
+ const editorViewRef = { current: null as EditorView | null };
203
+ const activity = createActivitySimulator();
204
+
205
+ registerCellEditorEffects({
206
+ activity,
207
+ editorViewRef,
208
+ destroyPattern: "pr",
209
+ });
210
+ const firstEditor = editorViewRef.current;
211
+
212
+ activity.hide();
213
+ expect(editorViewRef.current).toBeNull();
214
+
215
+ activity.show();
216
+ registerCellEditorEffects({
217
+ activity,
218
+ editorViewRef,
219
+ destroyPattern: "pr",
220
+ });
221
+ expect(editorViewRef.current).not.toBeNull();
222
+ expect(editorViewRef.current).not.toBe(firstEditor);
223
+ });
224
+
225
+ it("PR destroy pattern: stable across repeated hide/show cycles", () => {
226
+ const editorViewRef = { current: null as EditorView | null };
227
+ const activity = createActivitySimulator();
228
+
229
+ for (let i = 0; i < 3; i++) {
230
+ registerCellEditorEffects({
231
+ activity,
232
+ editorViewRef,
233
+ destroyPattern: "pr",
234
+ });
235
+ expect(editorViewRef.current).not.toBeNull();
236
+
237
+ activity.hide();
238
+ expect(editorViewRef.current).toBeNull();
239
+
240
+ activity.show();
241
+ }
242
+
243
+ registerCellEditorEffects({
244
+ activity,
245
+ editorViewRef,
246
+ destroyPattern: "pr",
247
+ });
248
+ expect(editorViewRef.current).not.toBeNull();
249
+ });
250
+ });