@marimo-team/frontend 0.25.1-dev7 → 0.25.1
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.
- package/dist/assets/{ConnectedDataExplorerComponent-DeqCS430.js → ConnectedDataExplorerComponent-DJ5jwKfp.js} +1 -1
- package/dist/assets/{ErrorBoundary-DDm0F3Ge.js → ErrorBoundary-BeE1cdgM.js} +2 -2
- package/dist/assets/{ImageComparisonComponent-DLxkuRy3.js → ImageComparisonComponent-pCLPT6RA.js} +1 -1
- package/dist/assets/{LazyAnyLanguageCodeMirror-DPoyi1KJ.js → LazyAnyLanguageCodeMirror-B_IYTCX5.js} +2 -2
- package/dist/assets/{RunButton-1O-85ifv.js → RunButton-C2kFUhyO.js} +8 -8
- package/dist/assets/{abnfDiagram-VCTEODGH-DhJEqQ9k.js → abnfDiagram-VCTEODGH-CSPJSGaM.js} +1 -1
- package/dist/assets/add-cell-with-ai-BFgdVPaN.js +76 -0
- package/dist/assets/{agent-panel-nJz0jCo0.js → agent-panel-Dh7yWh9P.js} +5 -5
- package/dist/assets/ai-model-dropdown-DJ2elMLM.js +5 -0
- package/dist/assets/{any-language-editor-CxgTzMTD.js → any-language-editor-Cj_HzlZY.js} +1 -1
- package/dist/assets/app-config-button-DBCTefOX.js +1 -0
- package/dist/assets/{architectureDiagram-5GKGNRK7-BwF4-SE1.js → architectureDiagram-5GKGNRK7-7iukRoC9.js} +1 -1
- package/dist/assets/{blockDiagram-I7D4REHJ-B7xaFbfk.js → blockDiagram-I7D4REHJ-cuhpQB60.js} +1 -1
- package/dist/assets/{c4Diagram-7LVT6UL2-BbMz-zwF.js → c4Diagram-7LVT6UL2-CMQEYn6T.js} +1 -1
- package/dist/assets/{cache-panel-Bd7XcHQd.js → cache-panel-C0oB1kE2.js} +1 -1
- package/dist/assets/{cells-Cu3p4E4U.js → cells-CzugpTQu.js} +4 -4
- package/dist/assets/channel-CGdeorQk.js +1 -0
- package/dist/assets/{chat-display-CKr8MVOE.js → chat-display-DevO4F8W.js} +1 -1
- package/dist/assets/chat-panel-BGw0bqDk.js +4 -0
- package/dist/assets/{chat-ui-BH1aZhD7.js → chat-ui-CZZFGlZi.js} +4 -4
- package/dist/assets/{chunk-4HAMMTFA-F3WVmmmo.js → chunk-4HAMMTFA-C6Tl7kEY.js} +1 -1
- package/dist/assets/{chunk-75Z2AOVW-DA_lihEi.js → chunk-75Z2AOVW-BzzYECN7.js} +1 -1
- package/dist/assets/{chunk-DU6HZSFF-J-califE.js → chunk-DU6HZSFF-BlpgvKzl.js} +2 -2
- package/dist/assets/{chunk-F27PBJKO-BzJrz4xx.js → chunk-F27PBJKO-BVIgLGPF.js} +1 -1
- package/dist/assets/{chunk-GMAD6QVW-mXoq4V-T.js → chunk-GMAD6QVW-hv6IsAru.js} +1 -1
- package/dist/assets/{chunk-GVQU2GXP-B-87l3Xt.js → chunk-GVQU2GXP-Duv4ZYb-.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-Cypkx_kh.js → chunk-IMKFNOWR-BIILwBhp.js} +1 -1
- package/dist/assets/{chunk-L3NEJ4N5-DLeZO9l0.js → chunk-L3NEJ4N5-B2hafvRU.js} +1 -1
- package/dist/assets/{chunk-OSK3NFVY-PWoOtECb.js → chunk-OSK3NFVY-SNGRdtNA.js} +1 -1
- package/dist/assets/{chunk-P2QGCYS3-DsJshZeL.js → chunk-P2QGCYS3-_SeE0QXb.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-CCg5TpSp.js → chunk-POPQ4Y6H-BB5NNJFE.js} +1 -1
- package/dist/assets/{chunk-PWAF6VOD-CrFPAGFi.js → chunk-PWAF6VOD-BZoBqp8x.js} +1 -1
- package/dist/assets/{chunk-SHT3W25Y-V37g5TGQ.js → chunk-SHT3W25Y-BtLGdeDB.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-CTD0ZEkK.js → chunk-SVP7TREG-B0UfxhUP.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-BmUJmjwl.js → chunk-TICWLB2K-BP7vel_P.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-CoNXKNMZ.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-CoNXKNMZ.js +1 -0
- package/dist/assets/{code-visibility-7811giS9.js → code-visibility-BFNYI7hr.js} +1 -1
- package/dist/assets/{command-palette-ZCeZiFkl.js → command-palette-DN4JoOLD.js} +1 -1
- package/dist/assets/{common-BdqirnCM.js → common-DUCPhoyP.js} +1 -1
- package/dist/assets/{components-BFIaoBwJ.js → components-CK7CeYlo.js} +1 -1
- package/dist/assets/{components-CzFNo5Dk.js → components-DAmFBASm.js} +1 -1
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-CTXT8KNm.js → cynefinDiagram-5FMLGOSQ-BARZRQBb.js} +1 -1
- package/dist/assets/{dagre-B5pirN9r.js → dagre-DVyyr7Cb.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-6LiieueL.js → dagre-GXQ25YYZ-79s0lOP0.js} +1 -1
- package/dist/assets/data-grid-overlay-editor-DPfnIudL.js +1 -0
- package/dist/assets/{dependency-graph-panel-CHbDGV22.js → dependency-graph-panel-BN4CLayU.js} +3 -3
- package/dist/assets/{diagram-S7CK7UJ4-BZL5Ql7I.js → diagram-S7CK7UJ4-BCviGhvd.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-AhAtqSJG.js → diagram-UQ7AKVKN-Ds-BT46T.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-DOQllF_r.js → diagram-VSXAHHWV-CK4GkM-q.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-COX-CxL0.js → diagram-VX7I27RA-BtL2eh0t.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-DXw7fg_D.js → diagram-Z3DM3KII-C6SmbLBS.js} +1 -1
- package/dist/assets/{dist-0HQ0BMF5.js → dist-CQvJDryh.js} +1 -1
- package/dist/assets/{documentation-panel-DUlFjJdz.js → documentation-panel-CzRbXV5u.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC-Ds-CB5Z_.js → ebnfDiagram-PWID7BFC-D_JU4cMQ.js} +1 -1
- package/dist/assets/edit-page-jGNYBqQo.js +174 -0
- package/dist/assets/{erDiagram-RLTQ6QDP-RdxnwvNA.js → erDiagram-RLTQ6QDP-Z9MJ6X-r.js} +1 -1
- package/dist/assets/{error-entries-BUsiy4Fq.js → error-entries-CDSsy76p.js} +1 -1
- package/dist/assets/{error-panel-DmaQ2MSS.js → error-panel-ABvjFG3p.js} +1 -1
- package/dist/assets/{feedback-button-DJMAFZ1t.js → feedback-button-CZhLiwkO.js} +2 -2
- package/dist/assets/{file-explorer-panel-BZ4A-j8a.js → file-explorer-panel-DTiEpmVE.js} +1 -1
- package/dist/assets/file-name-input-C1C8xrjA.js +3 -0
- package/dist/assets/filename-fxG7K_MU.js +1 -0
- package/dist/assets/flowDiagram-HODETNUW-ncLciK2K.js +1 -0
- package/dist/assets/{gallery-page-DFoyByKn.js → gallery-page-Moi4ZdJ0.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-d9Qqbnau.js → ganttDiagram-EL5Y4UJY-Cgy11k0G.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-DBunV_fz.js → gitGraphDiagram-WWUBYQGX-CVH8fay_.js} +1 -1
- package/dist/assets/glide-data-editor-CbsCWu-K.js +131 -0
- package/dist/assets/{graphlib-CWJvl2Lb.js → graphlib-3maKwbRO.js} +1 -1
- package/dist/assets/has-cJsIKK9t.js +1 -0
- package/dist/assets/{home-page-D_6gPong.js → home-page-UAgVOkCZ.js} +2 -2
- package/dist/assets/index--sT8xf-8.css +2 -0
- package/dist/assets/index-DafnX1Xx.js +62 -0
- package/dist/assets/{infoDiagram-27XIBGKW-B0jMwBBO.js → infoDiagram-27XIBGKW-Dk8U81nJ.js} +1 -1
- package/dist/assets/{ishikawaDiagram-5VMMS53U-4eji-_U4.js → ishikawaDiagram-5VMMS53U-CzHQlMUQ.js} +1 -1
- package/dist/assets/{journeyDiagram-3NMN7TZE-Cp4mxQrE.js → journeyDiagram-3NMN7TZE-DRc8ACzh.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-BYgV-VZ3.js → kanban-definition-UXKFOSKX-CVyVYiI6.js} +1 -1
- package/dist/assets/katex-DkE0ukCy.js +257 -0
- package/dist/assets/{logs-panel-CvwX6Xnb.js → logs-panel-Bz5ysVX4.js} +1 -1
- package/dist/assets/{mermaid-BmcDudwo.js → mermaid-D_jPUVqz.js} +4 -4
- package/dist/assets/mhchem-CmzEtQj8.js +1 -0
- package/dist/assets/{mindmap-definition-YA3MSWOX-Cz5xXQnv.js → mindmap-definition-YA3MSWOX-D5t6Aq5Z.js} +1 -1
- package/dist/assets/{number-overlay-editor-Jcf1i5Xj.js → number-overlay-editor-FAD8sjFU.js} +1 -1
- package/dist/assets/{outline-panel-4icYQ4vr.js → outline-panel-85oiQ0XX.js} +1 -1
- package/dist/assets/packages-panel-ClKIaP5S.js +1 -0
- package/dist/assets/{panels-CM1tqwz-.js → panels-B48zp96D.js} +9 -9
- package/dist/assets/{pegDiagram-XKGWAZYB-CCOAs3UH.js → pegDiagram-XKGWAZYB-BTkTm4ej.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-BBxiPx1C.js → pieDiagram-E7YTZNPT-Bq6X88M1.js} +1 -1
- package/dist/assets/{process-output-CXjf0zEE.js → process-output-Cg2ta3vY.js} +1 -1
- package/dist/assets/{quadrantDiagram-AXDQQJYC-BE-xlTLH.js → quadrantDiagram-AXDQQJYC-D_wrOwLk.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-BRv2wsAz.js → railroadDiagram-O6MQD6OU-fv8HXW_g.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-HAdL90iQ.js → requirementDiagram-BXWQKSXE-DDOOMUfC.js} +1 -1
- package/dist/assets/{reveal-component-CiQEczuZ.js → reveal-component-CR43gpTZ.js} +3 -3
- package/dist/assets/run-page-NR_KFWk8.js +1 -0
- package/dist/assets/{sankeyDiagram-P5KCCOFB-BWLQCyjK.js → sankeyDiagram-P5KCCOFB-CvvUY6tS.js} +1 -1
- package/dist/assets/{scratchpad-panel-Btg5EoIW.js → scratchpad-panel-DHc-oVb1.js} +1 -1
- package/dist/assets/{secrets-panel-C-17vrf1.js → secrets-panel-C-65ZjnM.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-Bs66qtoH.js → sequenceDiagram-WJ2MYXX4-DdpBhQaS.js} +1 -1
- package/dist/assets/session-panel-DiwQqIbt.js +1 -0
- package/dist/assets/{SelectionIndicator-DLJBcP4e.js → shell-BSnvn9t7.js} +1 -1
- package/dist/assets/snippets-panel-BLmXrneD.js +1 -0
- package/dist/assets/{stateDiagram-D77RDMKH-CZZcOZaL.js → stateDiagram-D77RDMKH-D3p19fac.js} +1 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-CplsDaDl.js +1 -0
- package/dist/assets/{swimlanes-42K2YHIH-DmvAwXeY.js → swimlanes-42K2YHIH-CLxCSvU4.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-DPoIFx8T.js +8 -0
- package/dist/assets/{swiper-component-C-iHKt3a.js → swiper-component-rqJChT_P.js} +1 -1
- package/dist/assets/{terminal-BJXvwDtX.js → terminal-CY4h1UmO.js} +1 -1
- package/dist/assets/{timeline-definition-24CTP7MA-DMBmrnDz.js → timeline-definition-24CTP7MA-Cw2PY--x.js} +1 -1
- package/dist/assets/tooltip-PLkI_UfK.js +61 -0
- package/dist/assets/{tracing-C1gfnMTz.js → tracing-Q8NAdlrA.js} +1 -1
- package/dist/assets/tracing-panel-Ci4kY4dr.js +2 -0
- package/dist/assets/{useCellActionButton-ChAk7KSd.js → useCellActionButton-DpYtVfFe.js} +1 -1
- package/dist/assets/{vega-component-Dyn2ovlw.js → vega-component-BpoSew4K.js} +1 -1
- package/dist/assets/{vega-embed-container-SaZMhvDB.js → vega-embed-container-BOJG8mCA.js} +1 -1
- package/dist/assets/{vennDiagram-4TSXK5OY-CU4ZQxbP.js → vennDiagram-4TSXK5OY-D8bN6lVl.js} +1 -1
- package/dist/assets/{wardleyDiagram-VM6X3IG4-CqJhzIbP.js → wardleyDiagram-VM6X3IG4-CbZdo0SA.js} +1 -1
- package/dist/assets/{write-secret-modal-CBUZw27N.js → write-secret-modal-BiG2tahJ.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-CS6EJwUz.js → xychartDiagram-S5SC5T6Z-DUUQ9tau.js} +1 -1
- package/dist/index.html +8 -7
- package/package.json +1 -2
- package/src/__mocks__/common.ts +3 -3
- package/src/__tests__/CellStatus.test.tsx +1 -1
- package/src/__tests__/setup.ts +7 -7
- package/src/components/app-config/ai-config.tsx +2 -0
- package/src/components/app-config/optional-features.tsx +1 -1
- package/src/components/chat/chat-panel.tsx +19 -8
- package/src/components/data-table/TableTopBar.tsx +2 -2
- package/src/components/data-table/__tests__/export-actions.test.tsx +662 -0
- package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +286 -0
- package/src/components/data-table/charts/charts.tsx +26 -13
- package/src/components/data-table/column-summary/chart-spec-model.tsx +4 -4
- package/src/components/data-table/data-table.tsx +1 -1
- package/src/components/data-table/export-actions.tsx +642 -176
- package/src/components/data-table/schemas.ts +25 -3
- package/src/components/dependency-graph/elements.ts +2 -2
- package/src/components/editor/__tests__/package-alert.test.tsx +140 -0
- package/src/components/editor/actions/__tests__/pair-with-agent.test.tsx +107 -0
- package/src/components/editor/actions/pair-with-agent.tsx +119 -0
- package/src/components/editor/actions/useNotebookActions.tsx +2 -1
- package/src/components/editor/ai/add-cell-with-ai.tsx +2 -0
- package/src/components/editor/ai/staged-cell-submission.ts +2 -2
- package/src/components/editor/ai/transport/chat-transport.tsx +1 -1
- package/src/components/editor/chrome/components/contribute-snippet-button.tsx +6 -1
- package/src/components/editor/connections/database/as-code.ts +44 -44
- package/src/components/editor/connections/storage/as-code.ts +3 -3
- package/src/components/editor/file-tree/requesting-tree.tsx +16 -13
- package/src/components/editor/navigation/clipboard.ts +2 -2
- package/src/components/editor/notebook-cell.tsx +2 -2
- package/src/components/editor/output/MarimoTracebackOutput.tsx +1 -1
- package/src/components/editor/output/VideoOutput.tsx +1 -1
- package/src/components/editor/output/ansi-reduce.ts +21 -17
- package/src/components/editor/output/console/ConsoleOutput.tsx +3 -3
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +59 -0
- package/src/components/editor/output/console/text-rendering.tsx +3 -1
- package/src/components/editor/package-alert.tsx +20 -7
- package/src/components/home/components.tsx +1 -0
- package/src/components/markdown/markdown-renderer.css +1 -1
- package/src/components/pages/run-page.tsx +1 -0
- package/src/components/slides/__tests__/minimap-actions.test.tsx +7 -7
- package/src/components/slides/__tests__/minimap.test.ts +12 -12
- package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +8 -8
- package/src/components/static-html/__tests__/share-modal.test.tsx +154 -0
- package/src/components/static-html/__tests__/stage-for-publish.test.ts +111 -0
- package/src/components/static-html/share-modal.tsx +114 -144
- package/src/components/static-html/stage-for-publish.ts +56 -0
- package/src/components/static-html/static-banner.tsx +2 -2
- package/src/components/ui/links.tsx +6 -1
- package/src/components/ui/typography.tsx +16 -8
- package/src/core/ai/context/__tests__/registry.test.ts +31 -28
- package/src/core/ai/context/providers/cell-output.ts +8 -8
- package/src/core/ai/context/providers/datasource.ts +10 -7
- package/src/core/ai/context/providers/error.ts +7 -7
- package/src/core/ai/context/providers/file.ts +8 -8
- package/src/core/ai/context/providers/tables.ts +7 -7
- package/src/core/ai/context/providers/variable.ts +7 -7
- package/src/core/ai/context/registry.ts +18 -18
- package/src/core/ai/ids/ids.ts +5 -5
- package/src/core/ai/model-registry.ts +12 -9
- package/src/core/ai/staged-cells.ts +6 -6
- package/src/core/ai/tools/base.ts +6 -6
- package/src/core/ai/tools/edit-notebook-tool.ts +6 -6
- package/src/core/ai/tools/registry.ts +4 -4
- package/src/core/ai/tools/run-cells-tool.ts +7 -7
- package/src/core/ai/tools/sample-tool.ts +6 -6
- package/src/core/cells/__tests__/cells.test.ts +27 -0
- package/src/core/cells/cells.ts +2 -1
- package/src/core/codemirror/cells/debugger-decorations.ts +13 -7
- package/src/core/codemirror/cells/line-timing-decorations.ts +9 -9
- package/src/core/codemirror/cells/traceback-decorations.ts +7 -4
- package/src/core/codemirror/code-lens/extension.ts +13 -13
- package/src/core/codemirror/copilot/__tests__/language-server.test.ts +6 -6
- package/src/core/codemirror/copilot/__tests__/transport.test.ts +12 -12
- package/src/core/codemirror/copilot/language-server.ts +13 -13
- package/src/core/codemirror/copilot/transport.ts +1 -1
- package/src/core/codemirror/find-replace/search-highlight.ts +5 -5
- package/src/core/codemirror/go-to-definition/underline.ts +3 -3
- package/src/core/codemirror/keymaps/vim.ts +3 -3
- package/src/core/codemirror/language/languages/markdown.ts +8 -8
- package/src/core/codemirror/language/languages/python.ts +7 -7
- package/src/core/codemirror/language/languages/sql/completion-builder.ts +5 -5
- package/src/core/codemirror/language/languages/sql/completion-store.ts +4 -4
- package/src/core/codemirror/language/languages/sql/sql.ts +21 -21
- package/src/core/codemirror/lsp/__tests__/transports.test.ts +10 -10
- package/src/core/codemirror/lsp/federated-lsp.ts +29 -27
- package/src/core/codemirror/lsp/notebook-lsp.ts +21 -21
- package/src/core/codemirror/misc/__tests__/dnd.test.ts +10 -10
- package/src/core/codemirror/misc/__tests__/paste.test.ts +7 -4
- package/src/core/codemirror/reactive-references/extension.ts +3 -3
- package/src/core/codemirror/rtc/loro/awareness.ts +12 -12
- package/src/core/codemirror/rtc/loro/sync.ts +5 -5
- package/src/core/codemirror/vim/cursor-visibility.ts +3 -3
- package/src/core/dom/ui-element.ts +5 -5
- package/src/core/dom/uiregistry.ts +10 -10
- package/src/core/hotkeys/hotkeys.ts +9 -9
- package/src/core/islands/__tests__/bridge.test.ts +4 -4
- package/src/core/islands/__tests__/test-utils.tsx +4 -4
- package/src/core/islands/bridge.ts +85 -82
- package/src/core/islands/components/web-components.tsx +7 -7
- package/src/core/islands/worker/__tests__/controller.test.ts +1 -1
- package/src/core/islands/worker/controller.ts +6 -3
- package/src/core/islands/worker-factory.ts +2 -2
- package/src/core/kernel/RuntimeState.ts +4 -4
- package/src/core/lsp/__tests__/transport.test.ts +19 -19
- package/src/core/lsp/transport.ts +5 -5
- package/src/core/network/CachingRequestRegistry.ts +2 -2
- package/src/core/network/DeferredRequestRegistry.ts +4 -4
- package/src/core/network/__tests__/export-asset-url.test.ts +45 -0
- package/src/core/network/export-asset-url.ts +19 -0
- package/src/core/network/requests-network.ts +2 -7
- package/src/core/runtime/runtime.ts +25 -20
- package/src/core/static/virtual-file-tracker.ts +5 -5
- package/src/core/wasm/__tests__/bridge.test.ts +2 -2
- package/src/core/wasm/bridge.ts +132 -133
- package/src/core/wasm/router.ts +5 -5
- package/src/core/wasm/store.ts +4 -4
- package/src/core/wasm/worker/bootstrap.ts +8 -5
- package/src/core/wasm/worker/message-buffer.ts +3 -3
- package/src/core/websocket/transports/__tests__/ws.test.ts +8 -8
- package/src/core/websocket/transports/basic.ts +15 -8
- package/src/core/websocket/transports/sse.ts +7 -7
- package/src/core/websocket/transports/transport.ts +3 -3
- package/src/core/websocket/transports/ws.ts +9 -7
- package/src/css/globals.css +18 -21
- package/src/css/katex.min.css +260 -241
- package/src/hooks/__tests__/useOverflowDetection.test.tsx +5 -5
- package/src/hooks/__tests__/useResizeObserver.test.tsx +12 -12
- package/src/plugins/core/registerReactComponent.tsx +5 -5
- package/src/plugins/core/sidebar-element.tsx +2 -2
- package/src/plugins/impl/ButtonPlugin.tsx +3 -3
- package/src/plugins/impl/CheckboxPlugin.tsx +3 -3
- package/src/plugins/impl/CodeEditorPlugin.tsx +3 -3
- package/src/plugins/impl/DatePickerPlugin.tsx +3 -3
- package/src/plugins/impl/DateRangePlugin.tsx +3 -3
- package/src/plugins/impl/DateTimePickerPlugin.tsx +3 -3
- package/src/plugins/impl/DictPlugin.tsx +3 -3
- package/src/plugins/impl/DropdownPlugin.tsx +3 -3
- package/src/plugins/impl/FileUploadPlugin.tsx +3 -3
- package/src/plugins/impl/MatrixPlugin.tsx +4 -4
- package/src/plugins/impl/MicrophonePlugin.tsx +3 -3
- package/src/plugins/impl/MultiselectPlugin.tsx +3 -3
- package/src/plugins/impl/NumberPlugin.tsx +3 -3
- package/src/plugins/impl/RadioPlugin.tsx +9 -5
- package/src/plugins/impl/RangeSliderPlugin.tsx +3 -3
- package/src/plugins/impl/RefreshPlugin.tsx +3 -3
- package/src/plugins/impl/SliderPlugin.tsx +3 -3
- package/src/plugins/impl/SwitchPlugin.tsx +3 -3
- package/src/plugins/impl/TabsPlugin.tsx +3 -3
- package/src/plugins/impl/TextAreaPlugin.tsx +3 -3
- package/src/plugins/impl/TextInputPlugin.tsx +3 -3
- package/src/plugins/impl/__tests__/MatrixPlugin.test.tsx +2 -2
- package/src/plugins/impl/anywidget/model.ts +10 -10
- package/src/plugins/impl/anywidget/registry.ts +12 -9
- package/src/plugins/impl/anywidget/runtime.ts +11 -9
- package/src/plugins/impl/anywidget/widget-binding.ts +6 -6
- package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +7 -6
- package/src/plugins/impl/matplotlib/MatplotlibPlugin.tsx +3 -3
- package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +2 -2
- package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +2 -2
- package/src/plugins/impl/mpl-interactive/mpl-websocket-shim.ts +10 -10
- package/src/plugins/impl/panel/utils.ts +5 -5
- package/src/plugins/impl/plotly/PlotlyPlugin.tsx +3 -3
- package/src/plugins/impl/vega/VegaPlugin.tsx +3 -3
- package/src/plugins/impl/vega/__tests__/use-vega-container-remeasure.test.ts +7 -7
- package/src/plugins/impl/vega/__tests__/utils.test.ts +16 -1
- package/src/plugins/impl/vega/__tests__/vega.test.ts +37 -0
- package/src/plugins/impl/vega/loader.ts +23 -1
- package/src/plugins/impl/vega/utils.ts +5 -4
- package/src/plugins/layout/AccordionPlugin.tsx +3 -3
- package/src/plugins/layout/CalloutPlugin.tsx +3 -3
- package/src/plugins/layout/ImageComparisonPlugin.tsx +5 -3
- package/src/plugins/layout/JsonOutputPlugin.tsx +3 -3
- package/src/plugins/layout/MimeRenderPlugin.tsx +3 -3
- package/src/plugins/layout/NavigationMenuPlugin.tsx +3 -3
- package/src/plugins/layout/OutlinePlugin.tsx +3 -3
- package/src/plugins/layout/ProgressPlugin.tsx +3 -3
- package/src/plugins/layout/RoutesPlugin.tsx +6 -8
- package/src/plugins/layout/StatPlugin.tsx +3 -3
- package/src/plugins/layout/TexPlugin.tsx +3 -3
- package/src/plugins/layout/carousel/CarouselPlugin.tsx +4 -4
- package/src/plugins/layout/mermaid/MermaidPlugin.tsx +3 -3
- package/src/utils/Deferred.ts +6 -6
- package/src/utils/async-capture-tracker.ts +10 -7
- package/src/utils/errors.ts +5 -5
- package/src/utils/id-tree.tsx +83 -80
- package/src/utils/lru.ts +1 -1
- package/src/utils/multi-map.ts +14 -12
- package/src/utils/paths.ts +6 -6
- package/src/utils/pluralize.ts +3 -3
- package/src/utils/progress.ts +6 -6
- package/src/utils/python-poet/poet.ts +14 -14
- package/src/utils/routes.ts +4 -2
- package/src/utils/semaphore.ts +6 -6
- package/src/utils/storage/storage.ts +6 -6
- package/src/utils/storage/typed.ts +16 -12
- package/src/utils/time.ts +9 -9
- package/src/utils/timed-cache.ts +4 -4
- package/src/utils/tracer.ts +9 -6
- package/dist/assets/add-cell-with-ai-B_rl7cPp.js +0 -76
- package/dist/assets/ai-model-dropdown-BmCwaRek.js +0 -3
- package/dist/assets/app-config-button-CtDuDui6.js +0 -1
- package/dist/assets/channel-ni7ei-yz.js +0 -1
- package/dist/assets/chat-panel-J4XhiL6i.js +0 -4
- package/dist/assets/classDiagram-ZZMXUADV-BS3U2jc1.js +0 -1
- package/dist/assets/classDiagram-v2-VYDZK3BY-BS3U2jc1.js +0 -1
- package/dist/assets/data-grid-overlay-editor-87bCN9IO.js +0 -1
- package/dist/assets/edit-page-D--nkMAI.js +0 -176
- package/dist/assets/file-name-input-CCRQJdng.js +0 -3
- package/dist/assets/flowDiagram-HODETNUW-DN8oq7vL.js +0 -1
- package/dist/assets/glide-data-editor-jH9-4ffy.js +0 -131
- package/dist/assets/has-W-yPT2HD.js +0 -1
- package/dist/assets/index-2TQenOiQ.css +0 -2
- package/dist/assets/index-Bjli4tSW.js +0 -62
- package/dist/assets/katex-mNPPSsir.js +0 -257
- package/dist/assets/katex-ukvJUC1e.js +0 -257
- package/dist/assets/mhchem-DcHTrqjv.js +0 -1
- package/dist/assets/packages-panel-pQzYAoH5.js +0 -1
- package/dist/assets/run-page-BTAjlR7y.js +0 -1
- package/dist/assets/session-panel-BYf4LDAo.js +0 -1
- package/dist/assets/snippets-panel-BAYAZKCH.js +0 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-sU5f30Vy.js +0 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-CNzkvYiI.js +0 -8
- package/dist/assets/tooltip-B1vGi-z4.js +0 -61
- package/dist/assets/tracing-panel-CzJ8ckHz.js +0 -2
|
@@ -0,0 +1,662 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
act,
|
|
5
|
+
fireEvent,
|
|
6
|
+
render,
|
|
7
|
+
screen,
|
|
8
|
+
waitFor,
|
|
9
|
+
within,
|
|
10
|
+
} from "@testing-library/react";
|
|
11
|
+
import { createStore, Provider } from "jotai";
|
|
12
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
13
|
+
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
14
|
+
import { toast } from "@/components/ui/use-toast";
|
|
15
|
+
import { viewStateAtom, type AppMode } from "@/core/mode";
|
|
16
|
+
import { copyToClipboard } from "@/utils/copy";
|
|
17
|
+
import { downloadByURL } from "@/utils/download";
|
|
18
|
+
import { jsonToMarkdown } from "@/utils/json/json-parser";
|
|
19
|
+
import { downloadSizeLimitAtom } from "../download-policy/atoms";
|
|
20
|
+
import { ExportActions, type ExportActionProps } from "../export-actions";
|
|
21
|
+
|
|
22
|
+
const mocks = vi.hoisted(() => ({
|
|
23
|
+
handleInstallPackages: vi.fn(),
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
vi.mock("@/core/packages/useInstallPackage", () => ({
|
|
27
|
+
useInstallPackages: () => ({
|
|
28
|
+
handleInstallPackages: mocks.handleInstallPackages,
|
|
29
|
+
}),
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
vi.mock("@/utils/copy", () => ({
|
|
33
|
+
copyToClipboard: vi.fn().mockResolvedValue(undefined),
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
vi.mock("@/utils/download", () => ({
|
|
37
|
+
downloadByURL: vi.fn(),
|
|
38
|
+
withLoadingToast: vi.fn(
|
|
39
|
+
async (_title: string, callback: () => Promise<unknown>) => callback(),
|
|
40
|
+
),
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
vi.mock("@/components/ui/use-toast", () => ({
|
|
44
|
+
toast: vi.fn(() => ({
|
|
45
|
+
dismiss: vi.fn(),
|
|
46
|
+
update: vi.fn(),
|
|
47
|
+
})),
|
|
48
|
+
}));
|
|
49
|
+
|
|
50
|
+
const downloadAs = vi.fn<ExportActionProps["downloadAs"]>();
|
|
51
|
+
|
|
52
|
+
function renderExportActions(
|
|
53
|
+
props: Partial<ExportActionProps> = {},
|
|
54
|
+
sizeLimit: { limitBytes: number; unavailableMessage: string } | null = null,
|
|
55
|
+
mode: AppMode = "edit",
|
|
56
|
+
) {
|
|
57
|
+
const store = createStore();
|
|
58
|
+
store.set(downloadSizeLimitAtom, sizeLimit);
|
|
59
|
+
store.set(viewStateAtom, { mode, cellAnchor: null });
|
|
60
|
+
|
|
61
|
+
return render(
|
|
62
|
+
<Provider store={store}>
|
|
63
|
+
<TooltipProvider delayDuration={0}>
|
|
64
|
+
<ExportActions downloadAs={downloadAs} {...props} />
|
|
65
|
+
</TooltipProvider>
|
|
66
|
+
</Provider>,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function openDialog() {
|
|
71
|
+
fireEvent.click(screen.getByTestId("export-button"));
|
|
72
|
+
return screen.findByRole("dialog", { name: "Export table" });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
describe("ExportActions dialog", () => {
|
|
76
|
+
beforeEach(() => {
|
|
77
|
+
vi.clearAllMocks();
|
|
78
|
+
downloadAs.mockResolvedValue({
|
|
79
|
+
url: "https://example.test/export",
|
|
80
|
+
filename: "table",
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
afterEach(() => {
|
|
85
|
+
vi.unstubAllGlobals();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("shows formats in the approved order with an options toggle where supported", async () => {
|
|
89
|
+
renderExportActions();
|
|
90
|
+
const dialog = await openDialog();
|
|
91
|
+
const list = within(dialog).getByRole("list", { name: "Export formats" });
|
|
92
|
+
const rows = within(list).getAllByRole("listitem");
|
|
93
|
+
|
|
94
|
+
expect(rows.map((row) => row.dataset.testid)).toEqual([
|
|
95
|
+
"export-row-csv",
|
|
96
|
+
"export-row-tsv",
|
|
97
|
+
"export-row-json",
|
|
98
|
+
"export-row-parquet",
|
|
99
|
+
"export-row-markdown",
|
|
100
|
+
]);
|
|
101
|
+
for (const label of ["CSV", "TSV", "JSON"]) {
|
|
102
|
+
expect(
|
|
103
|
+
screen.getByRole("button", { name: `${label} options` }),
|
|
104
|
+
).toHaveAttribute("aria-expanded", "false");
|
|
105
|
+
}
|
|
106
|
+
for (const label of ["Parquet", "Markdown"]) {
|
|
107
|
+
expect(
|
|
108
|
+
screen.queryByRole("button", { name: `${label} options` }),
|
|
109
|
+
).not.toBeInTheDocument();
|
|
110
|
+
}
|
|
111
|
+
expect(within(dialog).queryByRole("group")).not.toBeInTheDocument();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("expands one options panel at a time", async () => {
|
|
115
|
+
renderExportActions();
|
|
116
|
+
const dialog = await openDialog();
|
|
117
|
+
|
|
118
|
+
fireEvent.click(screen.getByRole("button", { name: "CSV options" }));
|
|
119
|
+
expect(
|
|
120
|
+
within(dialog).getByRole("group", { name: "CSV options" }),
|
|
121
|
+
).toBeInTheDocument();
|
|
122
|
+
expect(screen.getByRole("combobox", { name: "Delimiter" })).toHaveValue(
|
|
123
|
+
",",
|
|
124
|
+
);
|
|
125
|
+
expect(screen.getByRole("combobox", { name: "Encoding" })).toHaveValue(
|
|
126
|
+
"utf-8",
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
fireEvent.click(screen.getByRole("button", { name: "JSON options" }));
|
|
130
|
+
expect(
|
|
131
|
+
within(dialog).queryByRole("group", { name: "CSV options" }),
|
|
132
|
+
).not.toBeInTheDocument();
|
|
133
|
+
expect(
|
|
134
|
+
within(dialog).getByRole("group", { name: "JSON options" }),
|
|
135
|
+
).toBeInTheDocument();
|
|
136
|
+
expect(
|
|
137
|
+
screen.getByRole("switch", { name: "Escape non-ASCII" }),
|
|
138
|
+
).toBeChecked();
|
|
139
|
+
|
|
140
|
+
fireEvent.click(screen.getByRole("button", { name: "JSON options" }));
|
|
141
|
+
expect(within(dialog).queryByRole("group")).not.toBeInTheDocument();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("sends only changed CSV options with a download", async () => {
|
|
145
|
+
renderExportActions();
|
|
146
|
+
await openDialog();
|
|
147
|
+
expect(screen.getByTestId("export-summary-csv")).toHaveTextContent(
|
|
148
|
+
"Comma · UTF-8",
|
|
149
|
+
);
|
|
150
|
+
expect(screen.queryByTestId("export-summary-parquet")).toBeNull();
|
|
151
|
+
|
|
152
|
+
fireEvent.click(screen.getByRole("button", { name: "CSV options" }));
|
|
153
|
+
fireEvent.change(screen.getByRole("combobox", { name: "Delimiter" }), {
|
|
154
|
+
target: { value: ";" },
|
|
155
|
+
});
|
|
156
|
+
fireEvent.change(screen.getByRole("combobox", { name: "Encoding" }), {
|
|
157
|
+
target: { value: "utf-8-sig" },
|
|
158
|
+
});
|
|
159
|
+
expect(screen.getByTestId("export-summary-csv")).toHaveTextContent(
|
|
160
|
+
"Semicolon · UTF-8 with BOM",
|
|
161
|
+
);
|
|
162
|
+
fireEvent.click(screen.getByRole("button", { name: "Download CSV" }));
|
|
163
|
+
|
|
164
|
+
await waitFor(() => {
|
|
165
|
+
expect(downloadByURL).toHaveBeenCalled();
|
|
166
|
+
});
|
|
167
|
+
expect(downloadAs).toHaveBeenCalledWith({
|
|
168
|
+
format: "csv",
|
|
169
|
+
options: { separator: ";", encoding: "utf-8-sig" },
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it("keeps the delimiter but drops the encoding for a CSV copy", async () => {
|
|
174
|
+
vi.stubGlobal(
|
|
175
|
+
"fetch",
|
|
176
|
+
vi.fn().mockResolvedValue({
|
|
177
|
+
ok: true,
|
|
178
|
+
text: vi.fn().mockResolvedValue("name;value\n"),
|
|
179
|
+
}),
|
|
180
|
+
);
|
|
181
|
+
renderExportActions();
|
|
182
|
+
await openDialog();
|
|
183
|
+
|
|
184
|
+
fireEvent.click(screen.getByRole("button", { name: "CSV options" }));
|
|
185
|
+
fireEvent.change(screen.getByRole("combobox", { name: "Delimiter" }), {
|
|
186
|
+
target: { value: ";" },
|
|
187
|
+
});
|
|
188
|
+
fireEvent.change(screen.getByRole("combobox", { name: "Encoding" }), {
|
|
189
|
+
target: { value: "latin-1" },
|
|
190
|
+
});
|
|
191
|
+
fireEvent.click(screen.getByRole("button", { name: "Copy CSV" }));
|
|
192
|
+
|
|
193
|
+
await waitFor(() => {
|
|
194
|
+
expect(copyToClipboard).toHaveBeenCalledWith("name;value\n");
|
|
195
|
+
});
|
|
196
|
+
expect(downloadAs).toHaveBeenCalledWith({
|
|
197
|
+
format: "csv",
|
|
198
|
+
options: { separator: ";" },
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it("sends the JSON escape setting only when turned off", async () => {
|
|
203
|
+
renderExportActions();
|
|
204
|
+
await openDialog();
|
|
205
|
+
|
|
206
|
+
fireEvent.click(screen.getByRole("button", { name: "JSON options" }));
|
|
207
|
+
fireEvent.click(screen.getByRole("switch", { name: "Escape non-ASCII" }));
|
|
208
|
+
fireEvent.click(screen.getByRole("button", { name: "Download JSON" }));
|
|
209
|
+
|
|
210
|
+
await waitFor(() => {
|
|
211
|
+
expect(downloadByURL).toHaveBeenCalled();
|
|
212
|
+
});
|
|
213
|
+
expect(downloadAs).toHaveBeenCalledWith({
|
|
214
|
+
format: "json",
|
|
215
|
+
options: { ensure_ascii: false },
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it("resets options and panels when the dialog closes", async () => {
|
|
220
|
+
renderExportActions();
|
|
221
|
+
let dialog = await openDialog();
|
|
222
|
+
|
|
223
|
+
fireEvent.click(screen.getByRole("button", { name: "CSV options" }));
|
|
224
|
+
fireEvent.change(screen.getByRole("combobox", { name: "Delimiter" }), {
|
|
225
|
+
target: { value: "|" },
|
|
226
|
+
});
|
|
227
|
+
fireEvent.click(within(dialog).getByRole("button", { name: "Close" }));
|
|
228
|
+
await waitFor(() => {
|
|
229
|
+
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
dialog = await openDialog();
|
|
233
|
+
expect(within(dialog).queryByRole("group")).not.toBeInTheDocument();
|
|
234
|
+
fireEvent.click(screen.getByRole("button", { name: "Download CSV" }));
|
|
235
|
+
await waitFor(() => {
|
|
236
|
+
expect(downloadAs).toHaveBeenCalledWith({ format: "csv" });
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
it("opens without showing an action tooltip", async () => {
|
|
241
|
+
renderExportActions();
|
|
242
|
+
const dialog = await openDialog();
|
|
243
|
+
await act(async () => {
|
|
244
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
expect(dialog).toHaveFocus();
|
|
248
|
+
expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it("uses named icon buttons and reserves unavailable actions", async () => {
|
|
252
|
+
renderExportActions();
|
|
253
|
+
await openDialog();
|
|
254
|
+
|
|
255
|
+
for (const format of ["CSV", "TSV", "JSON"]) {
|
|
256
|
+
expect(
|
|
257
|
+
screen.getByRole("button", { name: `Download ${format}` }),
|
|
258
|
+
).toBeEnabled();
|
|
259
|
+
expect(
|
|
260
|
+
screen.getByRole("button", { name: `Copy ${format}` }),
|
|
261
|
+
).toBeEnabled();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
expect(
|
|
265
|
+
screen.getByRole("button", { name: "Download Parquet" }),
|
|
266
|
+
).toBeEnabled();
|
|
267
|
+
expect(screen.getByRole("button", { name: "Copy Parquet" })).toBeDisabled();
|
|
268
|
+
expect(
|
|
269
|
+
screen.getByRole("button", { name: "Download Markdown" }),
|
|
270
|
+
).toBeDisabled();
|
|
271
|
+
expect(screen.getByRole("button", { name: "Copy Markdown" })).toBeEnabled();
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it.each([
|
|
275
|
+
["CSV", "csv"],
|
|
276
|
+
["TSV", "tsv"],
|
|
277
|
+
["JSON", "json"],
|
|
278
|
+
["Parquet", "parquet"],
|
|
279
|
+
] as const)(
|
|
280
|
+
"downloads %s with its existing URL contract",
|
|
281
|
+
async (label, format) => {
|
|
282
|
+
downloadAs.mockResolvedValue({
|
|
283
|
+
url: "https://example.test/export?token=abc",
|
|
284
|
+
filename: "table.source",
|
|
285
|
+
});
|
|
286
|
+
renderExportActions();
|
|
287
|
+
await openDialog();
|
|
288
|
+
|
|
289
|
+
fireEvent.click(
|
|
290
|
+
screen.getByRole("button", { name: `Download ${label}` }),
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
await waitFor(() => {
|
|
294
|
+
expect(downloadByURL).toHaveBeenCalledWith(
|
|
295
|
+
`https://example.test/export?token=abc&download=1&filename=table.${format}`,
|
|
296
|
+
`table.${format}`,
|
|
297
|
+
);
|
|
298
|
+
});
|
|
299
|
+
expect(downloadAs).toHaveBeenCalledWith({ format });
|
|
300
|
+
expect(toast).toHaveBeenCalledWith({
|
|
301
|
+
title: `${label} download started`,
|
|
302
|
+
});
|
|
303
|
+
expect(screen.getByRole("dialog")).toBeInTheDocument();
|
|
304
|
+
},
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
it("keeps data URLs unchanged", async () => {
|
|
308
|
+
downloadAs.mockResolvedValue({
|
|
309
|
+
url: "data:text/csv;base64,YQ==",
|
|
310
|
+
filename: "table",
|
|
311
|
+
});
|
|
312
|
+
renderExportActions();
|
|
313
|
+
await openDialog();
|
|
314
|
+
|
|
315
|
+
fireEvent.click(screen.getByRole("button", { name: "Download CSV" }));
|
|
316
|
+
|
|
317
|
+
await waitFor(() => {
|
|
318
|
+
expect(downloadByURL).toHaveBeenCalledWith(
|
|
319
|
+
"data:text/csv;base64,YQ==",
|
|
320
|
+
"table.csv",
|
|
321
|
+
);
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
it.each([
|
|
326
|
+
{
|
|
327
|
+
label: "CSV",
|
|
328
|
+
sourceFormat: "csv" as const,
|
|
329
|
+
sourceText: "name,value\nalpha,1\n",
|
|
330
|
+
expectedText: "name,value\nalpha,1\n",
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
label: "TSV",
|
|
334
|
+
sourceFormat: "tsv" as const,
|
|
335
|
+
sourceText: "name\tvalue\nalpha\t1\n",
|
|
336
|
+
expectedText: "name\tvalue\nalpha\t1\n",
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
label: "JSON",
|
|
340
|
+
sourceFormat: "json" as const,
|
|
341
|
+
sourceText: JSON.stringify([{ name: "alpha", value: 1 }]),
|
|
342
|
+
expectedText: JSON.stringify([{ name: "alpha", value: 1 }], null, 2),
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
label: "Markdown",
|
|
346
|
+
sourceFormat: "json" as const,
|
|
347
|
+
sourceText: JSON.stringify([{ name: "alpha", value: 1 }]),
|
|
348
|
+
expectedText: jsonToMarkdown([{ name: "alpha", value: 1 }]),
|
|
349
|
+
},
|
|
350
|
+
])(
|
|
351
|
+
"copies $label with its existing conversion",
|
|
352
|
+
async ({ label, sourceFormat, sourceText, expectedText }) => {
|
|
353
|
+
vi.stubGlobal(
|
|
354
|
+
"fetch",
|
|
355
|
+
vi.fn().mockResolvedValue({
|
|
356
|
+
ok: true,
|
|
357
|
+
text: vi.fn().mockResolvedValue(sourceText),
|
|
358
|
+
}),
|
|
359
|
+
);
|
|
360
|
+
renderExportActions();
|
|
361
|
+
await openDialog();
|
|
362
|
+
|
|
363
|
+
fireEvent.click(screen.getByRole("button", { name: `Copy ${label}` }));
|
|
364
|
+
|
|
365
|
+
await waitFor(() => {
|
|
366
|
+
expect(copyToClipboard).toHaveBeenCalledWith(expectedText);
|
|
367
|
+
});
|
|
368
|
+
expect(downloadAs).toHaveBeenCalledWith({ format: sourceFormat });
|
|
369
|
+
expect(toast).toHaveBeenCalledWith({ title: "Copied to clipboard" });
|
|
370
|
+
await waitFor(() => {
|
|
371
|
+
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
|
372
|
+
});
|
|
373
|
+
},
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
it("shows the failure inside the affected format row", async () => {
|
|
377
|
+
downloadAs.mockRejectedValueOnce(new Error("Kernel disconnected"));
|
|
378
|
+
renderExportActions();
|
|
379
|
+
await openDialog();
|
|
380
|
+
|
|
381
|
+
fireEvent.click(screen.getByRole("button", { name: "Download JSON" }));
|
|
382
|
+
|
|
383
|
+
const alert = await screen.findByRole("alert");
|
|
384
|
+
expect(screen.getByTestId("export-row-json")).toContainElement(alert);
|
|
385
|
+
expect(screen.getByTestId("export-row-csv")).not.toContainElement(alert);
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
it("shows download request failures inside the dialog", async () => {
|
|
389
|
+
downloadAs.mockRejectedValueOnce(new Error("Kernel disconnected"));
|
|
390
|
+
renderExportActions();
|
|
391
|
+
await openDialog();
|
|
392
|
+
|
|
393
|
+
fireEvent.click(screen.getByRole("button", { name: "Download CSV" }));
|
|
394
|
+
|
|
395
|
+
const alert = await screen.findByRole("alert");
|
|
396
|
+
expect(alert).toHaveTextContent("Failed to download");
|
|
397
|
+
expect(alert).toHaveTextContent("Kernel disconnected");
|
|
398
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
it("shows file delivery failures inside the dialog", async () => {
|
|
402
|
+
vi.mocked(downloadByURL).mockImplementationOnce(() => {
|
|
403
|
+
throw new Error("Download blocked");
|
|
404
|
+
});
|
|
405
|
+
renderExportActions();
|
|
406
|
+
await openDialog();
|
|
407
|
+
|
|
408
|
+
fireEvent.click(screen.getByRole("button", { name: "Download CSV" }));
|
|
409
|
+
|
|
410
|
+
const alert = await screen.findByRole("alert");
|
|
411
|
+
expect(alert).toHaveTextContent("Failed to download");
|
|
412
|
+
expect(alert).toHaveTextContent("Download blocked");
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
it("shows fetch failures inside the dialog", async () => {
|
|
416
|
+
vi.stubGlobal(
|
|
417
|
+
"fetch",
|
|
418
|
+
vi.fn().mockResolvedValue({
|
|
419
|
+
ok: false,
|
|
420
|
+
statusText: "Forbidden",
|
|
421
|
+
}),
|
|
422
|
+
);
|
|
423
|
+
renderExportActions();
|
|
424
|
+
await openDialog();
|
|
425
|
+
|
|
426
|
+
fireEvent.click(screen.getByRole("button", { name: "Copy CSV" }));
|
|
427
|
+
|
|
428
|
+
const alert = await screen.findByRole("alert");
|
|
429
|
+
expect(alert).toHaveTextContent("Failed to copy to clipboard");
|
|
430
|
+
expect(alert).toHaveTextContent("Forbidden");
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
it("shows clipboard failures inside the dialog", async () => {
|
|
434
|
+
vi.stubGlobal(
|
|
435
|
+
"fetch",
|
|
436
|
+
vi.fn().mockResolvedValue({
|
|
437
|
+
ok: true,
|
|
438
|
+
text: vi.fn().mockResolvedValue("name\nalpha\n"),
|
|
439
|
+
}),
|
|
440
|
+
);
|
|
441
|
+
vi.mocked(copyToClipboard).mockRejectedValueOnce(
|
|
442
|
+
new Error("Clipboard permission denied"),
|
|
443
|
+
);
|
|
444
|
+
renderExportActions();
|
|
445
|
+
await openDialog();
|
|
446
|
+
|
|
447
|
+
fireEvent.click(screen.getByRole("button", { name: "Copy CSV" }));
|
|
448
|
+
|
|
449
|
+
const alert = await screen.findByRole("alert");
|
|
450
|
+
expect(alert).toHaveTextContent("Failed to copy to clipboard");
|
|
451
|
+
expect(alert).toHaveTextContent("Clipboard permission denied");
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
it("shows backend failures before success fields", async () => {
|
|
455
|
+
downloadAs.mockResolvedValueOnce({
|
|
456
|
+
url: "https://example.test/partial",
|
|
457
|
+
filename: "partial",
|
|
458
|
+
error: "Export was rejected",
|
|
459
|
+
});
|
|
460
|
+
renderExportActions();
|
|
461
|
+
await openDialog();
|
|
462
|
+
|
|
463
|
+
fireEvent.click(screen.getByRole("button", { name: "Download JSON" }));
|
|
464
|
+
|
|
465
|
+
const alert = await screen.findByRole("alert");
|
|
466
|
+
expect(alert).toHaveTextContent("Export was rejected");
|
|
467
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
it("installs missing packages and retries the same action", async () => {
|
|
471
|
+
downloadAs
|
|
472
|
+
.mockResolvedValueOnce({
|
|
473
|
+
url: "",
|
|
474
|
+
filename: "",
|
|
475
|
+
error: "Parquet export requires pyarrow.",
|
|
476
|
+
missing_packages: ["pyarrow"],
|
|
477
|
+
})
|
|
478
|
+
.mockResolvedValueOnce({
|
|
479
|
+
url: "https://example.test/export",
|
|
480
|
+
filename: "table",
|
|
481
|
+
});
|
|
482
|
+
renderExportActions();
|
|
483
|
+
await openDialog();
|
|
484
|
+
|
|
485
|
+
fireEvent.click(screen.getByRole("button", { name: "Download Parquet" }));
|
|
486
|
+
|
|
487
|
+
const alert = await screen.findByRole("alert");
|
|
488
|
+
expect(alert).toHaveTextContent("Parquet export requires pyarrow.");
|
|
489
|
+
fireEvent.click(
|
|
490
|
+
within(alert).getByRole("button", { name: "Install pyarrow" }),
|
|
491
|
+
);
|
|
492
|
+
expect(mocks.handleInstallPackages).toHaveBeenCalledWith(
|
|
493
|
+
["pyarrow"],
|
|
494
|
+
expect.any(Function),
|
|
495
|
+
);
|
|
496
|
+
|
|
497
|
+
const onInstall = mocks.handleInstallPackages.mock
|
|
498
|
+
.calls[0][1] as () => void;
|
|
499
|
+
onInstall();
|
|
500
|
+
|
|
501
|
+
await waitFor(() => {
|
|
502
|
+
expect(downloadAs).toHaveBeenCalledTimes(2);
|
|
503
|
+
expect(downloadByURL).toHaveBeenCalledWith(
|
|
504
|
+
"https://example.test/export?download=1&filename=table.parquet",
|
|
505
|
+
"table.parquet",
|
|
506
|
+
);
|
|
507
|
+
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
|
|
508
|
+
});
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
it("hides package details and installation in read mode", async () => {
|
|
512
|
+
downloadAs.mockResolvedValueOnce({
|
|
513
|
+
url: "",
|
|
514
|
+
filename: "",
|
|
515
|
+
error: "Install pyarrow to export Parquet.",
|
|
516
|
+
missing_packages: ["pyarrow"],
|
|
517
|
+
});
|
|
518
|
+
renderExportActions({}, null, "read");
|
|
519
|
+
await openDialog();
|
|
520
|
+
|
|
521
|
+
fireEvent.click(screen.getByRole("button", { name: "Download Parquet" }));
|
|
522
|
+
|
|
523
|
+
const alert = await screen.findByRole("alert");
|
|
524
|
+
expect(alert).toHaveTextContent(
|
|
525
|
+
"Parquet export isn't available in this notebook",
|
|
526
|
+
);
|
|
527
|
+
expect(alert).not.toHaveTextContent("pyarrow");
|
|
528
|
+
expect(within(alert).queryByRole("button")).not.toBeInTheDocument();
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
it("clears stale failures before a new action and after close", async () => {
|
|
532
|
+
downloadAs.mockRejectedValueOnce(new Error("First failure"));
|
|
533
|
+
renderExportActions();
|
|
534
|
+
let dialog = await openDialog();
|
|
535
|
+
|
|
536
|
+
fireEvent.click(screen.getByRole("button", { name: "Download CSV" }));
|
|
537
|
+
expect(await screen.findByRole("alert")).toHaveTextContent("First failure");
|
|
538
|
+
|
|
539
|
+
fireEvent.click(screen.getByRole("button", { name: "Download JSON" }));
|
|
540
|
+
await waitFor(() => {
|
|
541
|
+
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
|
|
542
|
+
expect(downloadByURL).toHaveBeenCalled();
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
downloadAs.mockRejectedValueOnce(new Error("Second failure"));
|
|
546
|
+
fireEvent.click(screen.getByRole("button", { name: "Download CSV" }));
|
|
547
|
+
expect(await screen.findByRole("alert")).toHaveTextContent(
|
|
548
|
+
"Second failure",
|
|
549
|
+
);
|
|
550
|
+
|
|
551
|
+
fireEvent.click(within(dialog).getByRole("button", { name: "Close" }));
|
|
552
|
+
await waitFor(() => {
|
|
553
|
+
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
|
554
|
+
});
|
|
555
|
+
dialog = await openDialog();
|
|
556
|
+
expect(within(dialog).queryByRole("alert")).not.toBeInTheDocument();
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
it("ignores a late failure from an earlier action", async () => {
|
|
560
|
+
let rejectFirst: (reason: Error) => void = () => undefined;
|
|
561
|
+
downloadAs
|
|
562
|
+
.mockImplementationOnce(
|
|
563
|
+
() =>
|
|
564
|
+
new Promise((_, reject) => {
|
|
565
|
+
rejectFirst = reject;
|
|
566
|
+
}),
|
|
567
|
+
)
|
|
568
|
+
.mockResolvedValueOnce({
|
|
569
|
+
url: "https://example.test/export",
|
|
570
|
+
filename: "table",
|
|
571
|
+
});
|
|
572
|
+
renderExportActions();
|
|
573
|
+
await openDialog();
|
|
574
|
+
|
|
575
|
+
fireEvent.click(screen.getByRole("button", { name: "Download CSV" }));
|
|
576
|
+
fireEvent.click(screen.getByRole("button", { name: "Download JSON" }));
|
|
577
|
+
await waitFor(() => {
|
|
578
|
+
expect(downloadByURL).toHaveBeenCalled();
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
await act(async () => {
|
|
582
|
+
rejectFirst(new Error("Late failure"));
|
|
583
|
+
});
|
|
584
|
+
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
it("ignores a late failure after the dialog closes", async () => {
|
|
588
|
+
let rejectDownload: (reason: Error) => void = () => undefined;
|
|
589
|
+
downloadAs.mockImplementationOnce(
|
|
590
|
+
() =>
|
|
591
|
+
new Promise((_, reject) => {
|
|
592
|
+
rejectDownload = reject;
|
|
593
|
+
}),
|
|
594
|
+
);
|
|
595
|
+
renderExportActions();
|
|
596
|
+
const dialog = await openDialog();
|
|
597
|
+
|
|
598
|
+
fireEvent.click(screen.getByRole("button", { name: "Download CSV" }));
|
|
599
|
+
fireEvent.click(within(dialog).getByRole("button", { name: "Close" }));
|
|
600
|
+
await waitFor(() => {
|
|
601
|
+
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
|
602
|
+
});
|
|
603
|
+
await openDialog();
|
|
604
|
+
|
|
605
|
+
await act(async () => {
|
|
606
|
+
rejectDownload(new Error("Late failure"));
|
|
607
|
+
});
|
|
608
|
+
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
it("closes with the close button and restores trigger focus", async () => {
|
|
612
|
+
renderExportActions();
|
|
613
|
+
const trigger = screen.getByTestId("export-button");
|
|
614
|
+
const dialog = await openDialog();
|
|
615
|
+
|
|
616
|
+
fireEvent.click(within(dialog).getByRole("button", { name: "Close" }));
|
|
617
|
+
|
|
618
|
+
await waitFor(() => {
|
|
619
|
+
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
|
620
|
+
expect(trigger).toHaveFocus();
|
|
621
|
+
});
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
it("closes with Escape and restores trigger focus", async () => {
|
|
625
|
+
renderExportActions();
|
|
626
|
+
const trigger = screen.getByTestId("export-button");
|
|
627
|
+
trigger.focus();
|
|
628
|
+
const dialog = await openDialog();
|
|
629
|
+
const closeButton = within(dialog).getByRole("button", { name: "Close" });
|
|
630
|
+
closeButton.focus();
|
|
631
|
+
|
|
632
|
+
fireEvent.keyDown(closeButton, { key: "Escape" });
|
|
633
|
+
|
|
634
|
+
await waitFor(() => {
|
|
635
|
+
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
|
636
|
+
expect(trigger).toHaveFocus();
|
|
637
|
+
});
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
it.each([
|
|
641
|
+
{
|
|
642
|
+
name: "the size check is pending",
|
|
643
|
+
props: { sizeBytesIsLoading: true },
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
name: "the export is over the host limit",
|
|
647
|
+
props: { sizeBytes: 101 },
|
|
648
|
+
},
|
|
649
|
+
])("keeps the trigger disabled when $name", ({ props }) => {
|
|
650
|
+
renderExportActions(props, {
|
|
651
|
+
limitBytes: 100,
|
|
652
|
+
unavailableMessage: "This export is too large.",
|
|
653
|
+
});
|
|
654
|
+
const trigger = screen.getByTestId("export-button");
|
|
655
|
+
|
|
656
|
+
expect(trigger).toBeDisabled();
|
|
657
|
+
expect(trigger).toHaveClass("print:hidden");
|
|
658
|
+
expect(trigger.parentElement).toHaveAttribute("tabindex", "0");
|
|
659
|
+
fireEvent.click(trigger);
|
|
660
|
+
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
|
661
|
+
});
|
|
662
|
+
});
|