@marimo-team/islands 0.25.1-dev4 → 0.25.1-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.
- package/dist/{ConnectedDataExplorerComponent-KVhjDMSe.js → ConnectedDataExplorerComponent-CwMXfDQR.js} +3 -3
- package/dist/{ErrorBoundary-pV36lYEK.js → ErrorBoundary-CAJO-M56.js} +1 -1
- package/dist/{ImageComparisonComponent-Dlm5aWnH.js → ImageComparisonComponent-Cpfz30OZ.js} +51 -52
- package/dist/{abnfDiagram-VCTEODGH-CpN0FRda.js → abnfDiagram-VCTEODGH-AFhOQTt8.js} +3 -3
- package/dist/{architectureDiagram-5GKGNRK7-DDyj5SRB.js → architectureDiagram-5GKGNRK7-BngksAAQ.js} +5 -5
- package/dist/{blockDiagram-I7D4REHJ-BbXEXJRu.js → blockDiagram-I7D4REHJ-CvBmppdy.js} +9 -9
- package/dist/{c4Diagram-7LVT6UL2-DcLsbQmR.js → c4Diagram-7LVT6UL2-EceL4_jH.js} +7 -7
- package/dist/{cells-B5-y5EY3.js → cells-Cv93oav_.js} +3 -3
- package/dist/{channel-B5XnTarr.js → channel-z7HZXHwv.js} +1 -1
- package/dist/{chat-ui-HJZsTl7o.js → chat-ui-DLSF8a04.js} +4 -4
- package/dist/{chunk-4HAMMTFA-D2qv8E0X.js → chunk-4HAMMTFA-BPTTOOC5.js} +5 -5
- package/dist/{chunk-75Z2AOVW-5_HsvXwr.js → chunk-75Z2AOVW-C4AOleKf.js} +1 -1
- package/dist/{chunk-DU6HZSFF-BUgAHvnM.js → chunk-DU6HZSFF-1TwWR6gh.js} +1 -1
- package/dist/{chunk-F27PBJKO-DHmYWZXr.js → chunk-F27PBJKO-DMI1PBe4.js} +1 -1
- package/dist/{chunk-GMAD6QVW-Czynz8aA.js → chunk-GMAD6QVW-vStrMz2P.js} +3 -3
- package/dist/{chunk-GVQU2GXP-yQEdulRS.js → chunk-GVQU2GXP-2HwWgs4u.js} +2 -2
- package/dist/{chunk-IMKFNOWR-BfwTebD0.js → chunk-IMKFNOWR-UOVZuZVn.js} +5 -5
- package/dist/{chunk-L3NEJ4N5-DwRWnDDK.js → chunk-L3NEJ4N5-RhC7i0I2.js} +5 -5
- package/dist/{chunk-OSK3NFVY-BBKU_Ign.js → chunk-OSK3NFVY-CZV09N-U.js} +6 -6
- package/dist/{chunk-P2QGCYS3-C0iGU29N.js → chunk-P2QGCYS3-0TAWai9C.js} +1 -1
- package/dist/{chunk-POPQ4Y6H-BCbS3Ozc.js → chunk-POPQ4Y6H-Cc3_56GX.js} +1 -1
- package/dist/{chunk-PWAF6VOD-CTFCL0jI.js → chunk-PWAF6VOD-lNxB9k8z.js} +1 -1
- package/dist/{chunk-SHT3W25Y-BspJEJ5H.js → chunk-SHT3W25Y-CrEPyWy1.js} +7 -7
- package/dist/{chunk-SVP7TREG-DX3rFNTe.js → chunk-SVP7TREG-uIyyySp6.js} +2 -2
- package/dist/{chunk-TICWLB2K-fVF7Uujg.js → chunk-TICWLB2K-DdXM3eg6.js} +5 -5
- package/dist/classDiagram-ZZMXUADV-BiATbBE4.js +30 -0
- package/dist/classDiagram-v2-VYDZK3BY-JnH97GYw.js +30 -0
- package/dist/{code-visibility-CgZS2a3W.js → code-visibility-XU9RAJNV.js} +2 -2
- package/dist/{common-DnMDPPaW.js → common-C0fbrgB8.js} +13 -13
- package/dist/{cynefinDiagram-5FMLGOSQ-CFQrqzSX.js → cynefinDiagram-5FMLGOSQ-zknaAsGy.js} +3 -3
- package/dist/{dagre-GXQ25YYZ-xHNAUTyG.js → dagre-GXQ25YYZ-BhMOoMGJ.js} +10 -10
- package/dist/{data-grid-overlay-editor-hHYgD_Sm.js → data-grid-overlay-editor-BnhbJgoq.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-Bt1rPbAx.js → diagram-S7CK7UJ4-V5-Z-EDY.js} +4 -4
- package/dist/{diagram-UQ7AKVKN-D1sq5FoZ.js → diagram-UQ7AKVKN-qw8AjDal.js} +3 -3
- package/dist/{diagram-VSXAHHWV-BKpmG23x.js → diagram-VSXAHHWV-CR7BJygZ.js} +2 -2
- package/dist/{diagram-VX7I27RA-BMwGFVD6.js → diagram-VX7I27RA-DfuqFb1E.js} +5 -5
- package/dist/{diagram-Z3DM3KII--KLDR9Pl.js → diagram-Z3DM3KII-DpWwlYZB.js} +3 -3
- package/dist/{dist-BaHjhkpZ.js → dist-CcyKTBTF.js} +1 -1
- package/dist/{ebnfDiagram-PWID7BFC-WnG4cvSQ.js → ebnfDiagram-PWID7BFC-C20OnNMZ.js} +3 -3
- package/dist/{erDiagram-RLTQ6QDP-DhzKiYHc.js → erDiagram-RLTQ6QDP-DBXLWO9v.js} +12 -12
- package/dist/{error-entries-Bkbpx0T0.js → error-entries-DLl0XqoW.js} +1 -1
- package/dist/{feedback-button-CvKssdG_.js → feedback-button-B0QSkbSp.js} +4 -4
- package/dist/flowDiagram-HODETNUW-DL52nMkt.js +16 -0
- package/dist/{formats-C8rLgZT9.js → formats-Cl_67ghI.js} +1 -1
- package/dist/{ganttDiagram-EL5Y4UJY-DbzEBLbl.js → ganttDiagram-EL5Y4UJY-cRRaDt88.js} +2 -2
- package/dist/{gitGraphDiagram-WWUBYQGX-BMf0iKi1.js → gitGraphDiagram-WWUBYQGX-Pox5k9-Y.js} +2 -2
- package/dist/{glide-data-editor-Ohetlgag.js → glide-data-editor-ymIQdwrb.js} +3 -3
- package/dist/{globals-CPNNcOJI.js → globals-B0S3-e_D.js} +1 -1
- package/dist/{html-to-image-BAgJOlSW.js → html-to-image-CGVgroef.js} +2 -2
- package/dist/{infoDiagram-27XIBGKW-BagtCX_5.js → infoDiagram-27XIBGKW-ntpxMfrq.js} +2 -2
- package/dist/{ishikawaDiagram-5VMMS53U-DByDehYy.js → ishikawaDiagram-5VMMS53U-BllIlHE5.js} +3 -3
- package/dist/{journeyDiagram-3NMN7TZE-D2LcKDUO.js → journeyDiagram-3NMN7TZE-EPJDPlt0.js} +2 -2
- package/dist/{kanban-definition-UXKFOSKX-BxwkbBI_.js → kanban-definition-UXKFOSKX-GYtNMjtS.js} +9 -9
- package/dist/{katex-C6D4cX_N.js → katex-BNCmKUol.js} +983 -1120
- package/dist/{loader-D2W4oM-3.js → loader-DEZSzvma.js} +253 -248
- package/dist/main.js +72 -69
- package/dist/{mermaid-DPNuhemn.js → mermaid-Dnzoxjt1.js} +49 -49
- package/dist/{mhchem-DWCF06w9.js → mhchem-BEc7A1or.js} +1 -1
- package/dist/{mindmap-definition-YA3MSWOX-Cgvojw3y.js → mindmap-definition-YA3MSWOX-Cth76xgH.js} +11 -11
- package/dist/{number-overlay-editor-CHWg5gGO.js → number-overlay-editor-DB3HJDI1.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-DahHhYyN.js → pegDiagram-XKGWAZYB-Cu4uOXii.js} +3 -3
- package/dist/{pieDiagram-E7YTZNPT-CCtX0oCK.js → pieDiagram-E7YTZNPT-Bh3eDa9s.js} +3 -3
- package/dist/{process-output-zDX4jbhd.js → process-output-CGfg-JmZ.js} +2 -2
- package/dist/{quadrantDiagram-AXDQQJYC-DftINo6g.js → quadrantDiagram-AXDQQJYC--kqzFC3w.js} +1 -1
- package/dist/{railroadDiagram-O6MQD6OU-Du5NsPUb.js → railroadDiagram-O6MQD6OU-DG-M6Rnc.js} +3 -3
- package/dist/{react-vega-5AcMW8gG.js → react-vega-ewj7q_U5.js} +1 -1
- package/dist/{requirementDiagram-BXWQKSXE-0pmmxL6_.js → requirementDiagram-BXWQKSXE-DCwsThh0.js} +11 -11
- package/dist/{reveal-component-BujcZI2B.js → reveal-component-CfTzIkA2.js} +3 -3
- package/dist/{sankeyDiagram-P5KCCOFB-CDKR5TJH.js → sankeyDiagram-P5KCCOFB-BdzhT0BM.js} +1 -1
- package/dist/{sequenceDiagram-WJ2MYXX4-DB-ChWwU.js → sequenceDiagram-WJ2MYXX4-CbXB1_PU.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-orN6AwMx.js → stateDiagram-D77RDMKH-A-Zf3Sb2.js} +13 -13
- package/dist/stateDiagram-v2-MP3YSRHH-D9YMnUGx.js +30 -0
- package/dist/style.css +1 -1
- package/dist/{swimlanes-42K2YHIH-BkSDcqDT.js → swimlanes-42K2YHIH-B_pMf0J4.js} +10 -10
- package/dist/swimlanesDiagram-VR7AAH4N-Ctgy-yGP.js +30 -0
- package/dist/{timeline-definition-24CTP7MA-BuqJUIRZ.js → timeline-definition-24CTP7MA-DTXFjTTM.js} +3 -3
- package/dist/{vega-component-CNf5gcrm.js → vega-component-tFOzgarw.js} +4 -4
- package/dist/{vega-embed-container-CbnTccZi.js → vega-embed-container-sSR5hAsy.js} +2 -2
- package/dist/{vega-loader.browser-D95WfUcj.js → vega-loader.browser-DNST6uVf.js} +2 -2
- package/dist/{vennDiagram-4TSXK5OY-CTUlJ2PK.js → vennDiagram-4TSXK5OY-BPHjZo0R.js} +3 -3
- package/dist/{wardleyDiagram-VM6X3IG4-3evLUb0M.js → wardleyDiagram-VM6X3IG4-6fTLYBuD.js} +3 -3
- package/dist/{xychartDiagram-S5SC5T6Z-DL2E3K8-.js → xychartDiagram-S5SC5T6Z-BYjwjrzE.js} +5 -5
- 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/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/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/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/share-modal.tsx +2 -1
- 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/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 +130 -126
- 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/classDiagram-ZZMXUADV-Fe-V14Sc.js +0 -30
- package/dist/classDiagram-v2-VYDZK3BY-xTDg7lOs.js +0 -30
- package/dist/flowDiagram-HODETNUW-6dMdB8pR.js +0 -16
- package/dist/katex-DFBiSucW.js +0 -21840
- package/dist/stateDiagram-v2-MP3YSRHH-o05_rJN8.js +0 -30
- package/dist/swimlanesDiagram-VR7AAH4N-D_nFQfRc.js +0 -30
|
@@ -36,7 +36,7 @@ abstract class CodeGenerator<T extends DatabaseConnection["type"]> {
|
|
|
36
36
|
protected orm: ConnectionLibrary;
|
|
37
37
|
protected secrets: SecretContainer;
|
|
38
38
|
|
|
39
|
-
constructor(
|
|
39
|
+
public constructor(
|
|
40
40
|
connection: Extract<DatabaseConnection, { type: T }>,
|
|
41
41
|
orm: ConnectionLibrary,
|
|
42
42
|
secrets: SecretContainer,
|
|
@@ -46,7 +46,7 @@ abstract class CodeGenerator<T extends DatabaseConnection["type"]> {
|
|
|
46
46
|
this.secrets = secrets;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
get imports(): Set<string> {
|
|
49
|
+
public get imports(): Set<string> {
|
|
50
50
|
const imports = new Set<string>(this.generateImports());
|
|
51
51
|
switch (this.orm) {
|
|
52
52
|
case "sqlalchemy":
|
|
@@ -67,7 +67,7 @@ abstract class CodeGenerator<T extends DatabaseConnection["type"]> {
|
|
|
67
67
|
|
|
68
68
|
protected abstract generateImports(): string[];
|
|
69
69
|
|
|
70
|
-
abstract generateConnectionCode(): string;
|
|
70
|
+
public abstract generateConnectionCode(): string;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
const makePrivate = (name: string) => `_${name}`;
|
|
@@ -75,14 +75,14 @@ const makePrivate = (name: string) => `_${name}`;
|
|
|
75
75
|
class SecretContainer {
|
|
76
76
|
private secrets: Record<string, string> = {};
|
|
77
77
|
|
|
78
|
-
get imports(): Set<string> {
|
|
78
|
+
public get imports(): Set<string> {
|
|
79
79
|
if (Object.keys(this.secrets).length === 0) {
|
|
80
80
|
return new Set<string>();
|
|
81
81
|
}
|
|
82
82
|
return new Set<string>(["import os"]);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
print(
|
|
85
|
+
public print(
|
|
86
86
|
varName: string,
|
|
87
87
|
secretKeyOrValue: string | number | boolean,
|
|
88
88
|
defaultValue?: string | undefined,
|
|
@@ -119,7 +119,7 @@ class SecretContainer {
|
|
|
119
119
|
return `"${secretKeyOrValue}"`;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
printInFString(
|
|
122
|
+
public printInFString(
|
|
123
123
|
varName: string,
|
|
124
124
|
secretKeyOrValue: string | number | undefined | boolean,
|
|
125
125
|
defaultValue?: string | undefined,
|
|
@@ -171,7 +171,7 @@ class SecretContainer {
|
|
|
171
171
|
* f"db://sample:access_token@sample.com"
|
|
172
172
|
* ```
|
|
173
173
|
*/
|
|
174
|
-
printPassword(
|
|
174
|
+
public printPassword(
|
|
175
175
|
password: string | undefined,
|
|
176
176
|
passwordPlaceholder: string,
|
|
177
177
|
inFString: boolean,
|
|
@@ -187,11 +187,11 @@ class SecretContainer {
|
|
|
187
187
|
: printMethod(variableName || "password", passwordPlaceholder, password);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
getSecrets(): Record<string, string> {
|
|
190
|
+
public getSecrets(): Record<string, string> {
|
|
191
191
|
return this.secrets;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
formatSecrets(): string {
|
|
194
|
+
public formatSecrets(): string {
|
|
195
195
|
if (Object.keys(this.secrets).length === 0) {
|
|
196
196
|
return "";
|
|
197
197
|
}
|
|
@@ -203,11 +203,11 @@ class SecretContainer {
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
class PostgresGenerator extends CodeGenerator<"postgres"> {
|
|
206
|
-
generateImports(): string[] {
|
|
206
|
+
public generateImports(): string[] {
|
|
207
207
|
return [];
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
generateConnectionCode(): string {
|
|
210
|
+
public generateConnectionCode(): string {
|
|
211
211
|
const ssl = this.connection.ssl
|
|
212
212
|
? ", connect_args={'sslmode': 'require'}"
|
|
213
213
|
: "";
|
|
@@ -235,11 +235,11 @@ class PostgresGenerator extends CodeGenerator<"postgres"> {
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
class MySQLGenerator extends CodeGenerator<"mysql"> {
|
|
238
|
-
generateImports(): string[] {
|
|
238
|
+
public generateImports(): string[] {
|
|
239
239
|
return [];
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
generateConnectionCode(): string {
|
|
242
|
+
public generateConnectionCode(): string {
|
|
243
243
|
const ssl = this.connection.ssl
|
|
244
244
|
? ", connect_args={'ssl': {'ssl-mode': 'preferred'}}"
|
|
245
245
|
: "";
|
|
@@ -267,11 +267,11 @@ class MySQLGenerator extends CodeGenerator<"mysql"> {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
class SQLiteGenerator extends CodeGenerator<"sqlite"> {
|
|
270
|
-
generateImports(): string[] {
|
|
270
|
+
public generateImports(): string[] {
|
|
271
271
|
return [];
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
generateConnectionCode(): string {
|
|
274
|
+
public generateConnectionCode(): string {
|
|
275
275
|
const database = this.connection.database
|
|
276
276
|
? this.secrets.printInFString("database", this.connection.database)
|
|
277
277
|
: "";
|
|
@@ -289,11 +289,11 @@ class SQLiteGenerator extends CodeGenerator<"sqlite"> {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
class SnowflakeGenerator extends CodeGenerator<"snowflake"> {
|
|
292
|
-
generateImports(): string[] {
|
|
292
|
+
public generateImports(): string[] {
|
|
293
293
|
return ["from snowflake.sqlalchemy import URL"];
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
generateConnectionCode(): string {
|
|
296
|
+
public generateConnectionCode(): string {
|
|
297
297
|
const { authType, account, database, warehouse, schema, role } =
|
|
298
298
|
this.connection;
|
|
299
299
|
const baseParams: Record<string, string | undefined> = {
|
|
@@ -422,11 +422,11 @@ class BigQueryGenerator extends CodeGenerator<"bigquery"> {
|
|
|
422
422
|
);
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
generateImports(): string[] {
|
|
425
|
+
public generateImports(): string[] {
|
|
426
426
|
return this.credential.kind === "path" ? [] : ["import json"];
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
generateConnectionCode(): string {
|
|
429
|
+
public generateConnectionCode(): string {
|
|
430
430
|
const project = this.secrets.printInFString(
|
|
431
431
|
"project",
|
|
432
432
|
this.connection.project,
|
|
@@ -451,11 +451,11 @@ class BigQueryGenerator extends CodeGenerator<"bigquery"> {
|
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
class DuckDBGenerator extends CodeGenerator<"duckdb"> {
|
|
454
|
-
generateImports(): string[] {
|
|
454
|
+
public generateImports(): string[] {
|
|
455
455
|
return [];
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
-
generateConnectionCode(): string {
|
|
458
|
+
public generateConnectionCode(): string {
|
|
459
459
|
const database = this.secrets.printInFString(
|
|
460
460
|
"database",
|
|
461
461
|
this.connection.database || ":memory:",
|
|
@@ -469,11 +469,11 @@ class DuckDBGenerator extends CodeGenerator<"duckdb"> {
|
|
|
469
469
|
}
|
|
470
470
|
|
|
471
471
|
class MotherDuckGenerator extends CodeGenerator<"motherduck"> {
|
|
472
|
-
generateImports(): string[] {
|
|
472
|
+
public generateImports(): string[] {
|
|
473
473
|
return [];
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
-
generateConnectionCode(): string {
|
|
476
|
+
public generateConnectionCode(): string {
|
|
477
477
|
const database = this.secrets.printInFString(
|
|
478
478
|
"database",
|
|
479
479
|
this.connection.database,
|
|
@@ -497,11 +497,11 @@ class MotherDuckGenerator extends CodeGenerator<"motherduck"> {
|
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
class ClickHouseGenerator extends CodeGenerator<"clickhouse_connect"> {
|
|
500
|
-
generateImports(): string[] {
|
|
500
|
+
public generateImports(): string[] {
|
|
501
501
|
return ["import clickhouse_connect"];
|
|
502
502
|
}
|
|
503
503
|
|
|
504
|
-
generateConnectionCode(): string {
|
|
504
|
+
public generateConnectionCode(): string {
|
|
505
505
|
const password = this.secrets.printPassword(
|
|
506
506
|
this.connection.password,
|
|
507
507
|
"CLICKHOUSE_PASSWORD",
|
|
@@ -530,11 +530,11 @@ ${formatUrlParams(params, (inner) => ` ${inner}`)},
|
|
|
530
530
|
}
|
|
531
531
|
|
|
532
532
|
class TimeplusGenerator extends CodeGenerator<"timeplus"> {
|
|
533
|
-
generateImports(): string[] {
|
|
533
|
+
public generateImports(): string[] {
|
|
534
534
|
return [];
|
|
535
535
|
}
|
|
536
536
|
|
|
537
|
-
generateConnectionCode(): string {
|
|
537
|
+
public generateConnectionCode(): string {
|
|
538
538
|
const password = this.secrets.printPassword(
|
|
539
539
|
this.connection.password,
|
|
540
540
|
"TIMEPLUS_PASSWORD",
|
|
@@ -555,11 +555,11 @@ class TimeplusGenerator extends CodeGenerator<"timeplus"> {
|
|
|
555
555
|
}
|
|
556
556
|
|
|
557
557
|
class ChDBGenerator extends CodeGenerator<"chdb"> {
|
|
558
|
-
generateImports(): string[] {
|
|
558
|
+
public generateImports(): string[] {
|
|
559
559
|
return ["import chdb"];
|
|
560
560
|
}
|
|
561
561
|
|
|
562
|
-
generateConnectionCode(): string {
|
|
562
|
+
public generateConnectionCode(): string {
|
|
563
563
|
const database =
|
|
564
564
|
this.secrets.print("database", this.connection.database) || '""';
|
|
565
565
|
|
|
@@ -570,13 +570,13 @@ class ChDBGenerator extends CodeGenerator<"chdb"> {
|
|
|
570
570
|
}
|
|
571
571
|
|
|
572
572
|
class TrinoGenerator extends CodeGenerator<"trino"> {
|
|
573
|
-
generateImports(): string[] {
|
|
573
|
+
public generateImports(): string[] {
|
|
574
574
|
return this.connection.async_support
|
|
575
575
|
? ["import aiotrino"]
|
|
576
576
|
: ["import trino.sqlalchemy"];
|
|
577
577
|
}
|
|
578
578
|
|
|
579
|
-
generateConnectionCode(): string {
|
|
579
|
+
public generateConnectionCode(): string {
|
|
580
580
|
const trinoExtension = this.connection.async_support ? "aiotrino" : "trino";
|
|
581
581
|
const schema = this.connection.schema ? `/${this.connection.schema}` : "";
|
|
582
582
|
|
|
@@ -614,7 +614,7 @@ class PyIcebergGenerator extends CodeGenerator<"iceberg"> {
|
|
|
614
614
|
);
|
|
615
615
|
}
|
|
616
616
|
|
|
617
|
-
generateImports(): string[] {
|
|
617
|
+
public generateImports(): string[] {
|
|
618
618
|
if (Object.keys(this.getCatalogOptions()).length === 0) {
|
|
619
619
|
return ["from pyiceberg.catalog import load_catalog"];
|
|
620
620
|
}
|
|
@@ -635,7 +635,7 @@ class PyIcebergGenerator extends CodeGenerator<"iceberg"> {
|
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
637
|
|
|
638
|
-
generateConnectionCode(): string {
|
|
638
|
+
public generateConnectionCode(): string {
|
|
639
639
|
const name = `"${this.connection.name}"`;
|
|
640
640
|
const options = this.getCatalogOptions();
|
|
641
641
|
if (Object.keys(options).length === 0) {
|
|
@@ -705,12 +705,12 @@ class PyIcebergGenerator extends CodeGenerator<"iceberg"> {
|
|
|
705
705
|
}
|
|
706
706
|
|
|
707
707
|
class DataFusionGenerator extends CodeGenerator<"datafusion"> {
|
|
708
|
-
generateImports(): string[] {
|
|
708
|
+
public generateImports(): string[] {
|
|
709
709
|
// To trigger installation of ibis-datafusion
|
|
710
710
|
return ["from datafusion import SessionContext"];
|
|
711
711
|
}
|
|
712
712
|
|
|
713
|
-
generateConnectionCode(): string {
|
|
713
|
+
public generateConnectionCode(): string {
|
|
714
714
|
if (this.connection.sessionContext) {
|
|
715
715
|
return dedent(`
|
|
716
716
|
ctx = SessionContext()
|
|
@@ -727,11 +727,11 @@ class DataFusionGenerator extends CodeGenerator<"datafusion"> {
|
|
|
727
727
|
}
|
|
728
728
|
|
|
729
729
|
class PySparkGenerator extends CodeGenerator<"pyspark"> {
|
|
730
|
-
generateImports(): string[] {
|
|
730
|
+
public generateImports(): string[] {
|
|
731
731
|
return ["from pyspark.sql import SparkSession"];
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
-
generateConnectionCode(): string {
|
|
734
|
+
public generateConnectionCode(): string {
|
|
735
735
|
if (this.connection.host || this.connection.port) {
|
|
736
736
|
const host = this.secrets.printInFString("host", this.connection.host);
|
|
737
737
|
const port = this.secrets.printInFString("port", this.connection.port);
|
|
@@ -747,11 +747,11 @@ class PySparkGenerator extends CodeGenerator<"pyspark"> {
|
|
|
747
747
|
}
|
|
748
748
|
|
|
749
749
|
class RedshiftGenerator extends CodeGenerator<"redshift"> {
|
|
750
|
-
generateImports(): string[] {
|
|
750
|
+
public generateImports(): string[] {
|
|
751
751
|
return ["import redshift_connector"];
|
|
752
752
|
}
|
|
753
753
|
|
|
754
|
-
generateConnectionCode(): string {
|
|
754
|
+
public generateConnectionCode(): string {
|
|
755
755
|
const host = this.secrets.print("host", this.connection.host);
|
|
756
756
|
const port = this.secrets.print("port", this.connection.port);
|
|
757
757
|
const database = this.secrets.print("database", this.connection.database);
|
|
@@ -819,11 +819,11 @@ ${formatUrlParams(params, (inner) => ` ${inner}`)},
|
|
|
819
819
|
}
|
|
820
820
|
|
|
821
821
|
class DatabricksGenerator extends CodeGenerator<"databricks"> {
|
|
822
|
-
generateImports(): string[] {
|
|
822
|
+
public generateImports(): string[] {
|
|
823
823
|
return [];
|
|
824
824
|
}
|
|
825
825
|
|
|
826
|
-
generateConnectionCode(): string {
|
|
826
|
+
public generateConnectionCode(): string {
|
|
827
827
|
const useFString = this.orm !== "ibis";
|
|
828
828
|
|
|
829
829
|
const accessToken = this.secrets.printPassword(
|
|
@@ -883,14 +883,14 @@ class DatabricksGenerator extends CodeGenerator<"databricks"> {
|
|
|
883
883
|
}
|
|
884
884
|
|
|
885
885
|
class SupabaseGenerator extends CodeGenerator<"supabase"> {
|
|
886
|
-
generateImports(): string[] {
|
|
886
|
+
public generateImports(): string[] {
|
|
887
887
|
if (this.connection.disable_client_pooling) {
|
|
888
888
|
return ["from sqlalchemy.pool import NullPool"];
|
|
889
889
|
}
|
|
890
890
|
return [];
|
|
891
891
|
}
|
|
892
892
|
|
|
893
|
-
generateConnectionCode(): string {
|
|
893
|
+
public generateConnectionCode(): string {
|
|
894
894
|
const password = this.secrets.printPassword(
|
|
895
895
|
this.connection.password,
|
|
896
896
|
"SUPABASE_PASSWORD",
|
|
@@ -921,7 +921,7 @@ class SupabaseGenerator extends CodeGenerator<"supabase"> {
|
|
|
921
921
|
class CodeGeneratorFactory {
|
|
922
922
|
public secrets = new SecretContainer();
|
|
923
923
|
|
|
924
|
-
createGenerator(
|
|
924
|
+
public createGenerator(
|
|
925
925
|
connection: DatabaseConnection,
|
|
926
926
|
orm: ConnectionLibrary,
|
|
927
927
|
): CodeGenerator<DatabaseConnection["type"]> {
|
|
@@ -26,14 +26,14 @@ export const StorageLibraryDisplayNames: Record<StorageLibrary, string> = {
|
|
|
26
26
|
class SecretContainer {
|
|
27
27
|
private secrets: Record<string, string> = {};
|
|
28
28
|
|
|
29
|
-
get imports(): Set<string> {
|
|
29
|
+
public get imports(): Set<string> {
|
|
30
30
|
if (Object.keys(this.secrets).length === 0) {
|
|
31
31
|
return new Set<string>();
|
|
32
32
|
}
|
|
33
33
|
return new Set<string>(["import os"]);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
print(varName: string, value: string | undefined): string {
|
|
36
|
+
public print(varName: string, value: string | undefined): string {
|
|
37
37
|
if (value === undefined || value === "") {
|
|
38
38
|
return "";
|
|
39
39
|
}
|
|
@@ -46,7 +46,7 @@ class SecretContainer {
|
|
|
46
46
|
return `"${escapePythonString(value)}"`;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
formatSecrets(): string {
|
|
49
|
+
public formatSecrets(): string {
|
|
50
50
|
if (Object.keys(this.secrets).length === 0) {
|
|
51
51
|
return "";
|
|
52
52
|
}
|
|
@@ -55,7 +55,7 @@ export class RequestingTree {
|
|
|
55
55
|
renameFileOrFolder: EditRequests["sendRenameFileOrFolder"];
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
constructor(callbacks: {
|
|
58
|
+
public constructor(callbacks: {
|
|
59
59
|
getRoots: EditRequests["getFileRoots"];
|
|
60
60
|
listFiles: EditRequests["sendListFiles"];
|
|
61
61
|
createFileOrFolder: EditRequests["sendCreateFileOrFolder"];
|
|
@@ -71,7 +71,7 @@ export class RequestingTree {
|
|
|
71
71
|
private onChange: (data: FileTreeNode[]) => void = Functions.NOOP;
|
|
72
72
|
private path = new PathBuilder("/");
|
|
73
73
|
|
|
74
|
-
initialize = async (
|
|
74
|
+
public initialize = async (
|
|
75
75
|
onChange: (data: FileTreeNode[]) => void,
|
|
76
76
|
): Promise<void> => {
|
|
77
77
|
this.onChange = onChange;
|
|
@@ -102,7 +102,7 @@ export class RequestingTree {
|
|
|
102
102
|
this.emitChange();
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
expand(id: string): Promise<boolean> {
|
|
105
|
+
public expand(id: string): Promise<boolean> {
|
|
106
106
|
return this.requestDirectory(id);
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -149,11 +149,11 @@ export class RequestingTree {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
getRoots(): readonly FileRoot[] {
|
|
152
|
+
public getRoots(): readonly FileRoot[] {
|
|
153
153
|
return this.roots;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
async reveal(node: FileTreeNode): Promise<boolean> {
|
|
156
|
+
public async reveal(node: FileTreeNode): Promise<boolean> {
|
|
157
157
|
const relative = relativePath(node.path as FilePath, node.rootPath);
|
|
158
158
|
if (relative === null) {
|
|
159
159
|
return false;
|
|
@@ -190,7 +190,7 @@ export class RequestingTree {
|
|
|
190
190
|
return true;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
async copy(id: string, newName: string): Promise<void> {
|
|
193
|
+
public async copy(id: string, newName: string): Promise<void> {
|
|
194
194
|
const node = this.getMutableNode(id);
|
|
195
195
|
if (!node) {
|
|
196
196
|
return;
|
|
@@ -206,7 +206,7 @@ export class RequestingTree {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
async rename(id: string, name: string): Promise<void> {
|
|
209
|
+
public async rename(id: string, name: string): Promise<void> {
|
|
210
210
|
const node = this.getMutableNode(id);
|
|
211
211
|
if (!node) {
|
|
212
212
|
return;
|
|
@@ -222,7 +222,7 @@ export class RequestingTree {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
async move(fromIds: string[], parentId: string | null): Promise<void> {
|
|
225
|
+
public async move(fromIds: string[], parentId: string | null): Promise<void> {
|
|
226
226
|
const targetParentId = parentId ?? this.getPrimaryRootId();
|
|
227
227
|
const parent = this.delegate.find(targetParentId);
|
|
228
228
|
if (!parent?.data.isDirectory) {
|
|
@@ -253,7 +253,7 @@ export class RequestingTree {
|
|
|
253
253
|
await this.refreshPaths([...refreshPaths]);
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
async createFile({
|
|
256
|
+
public async createFile({
|
|
257
257
|
name,
|
|
258
258
|
parentId,
|
|
259
259
|
type = "file",
|
|
@@ -278,7 +278,10 @@ export class RequestingTree {
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
async createFolder(
|
|
281
|
+
public async createFolder(
|
|
282
|
+
name: string,
|
|
283
|
+
parentId: string | null,
|
|
284
|
+
): Promise<void> {
|
|
282
285
|
const parent = this.getParentNode(parentId);
|
|
283
286
|
if (!parent) {
|
|
284
287
|
return;
|
|
@@ -295,7 +298,7 @@ export class RequestingTree {
|
|
|
295
298
|
}
|
|
296
299
|
}
|
|
297
300
|
|
|
298
|
-
async delete(id: string): Promise<void> {
|
|
301
|
+
public async delete(id: string): Promise<void> {
|
|
299
302
|
const node = this.getMutableNode(id);
|
|
300
303
|
if (!node) {
|
|
301
304
|
return;
|
|
@@ -309,7 +312,7 @@ export class RequestingTree {
|
|
|
309
312
|
}
|
|
310
313
|
}
|
|
311
314
|
|
|
312
|
-
refreshAll = async (ids: string[]): Promise<void> => {
|
|
315
|
+
public refreshAll = async (ids: string[]): Promise<void> => {
|
|
313
316
|
const paths = [
|
|
314
317
|
...this.roots.map((root) => root.path),
|
|
315
318
|
...ids
|
|
@@ -325,7 +328,7 @@ export class RequestingTree {
|
|
|
325
328
|
);
|
|
326
329
|
};
|
|
327
330
|
|
|
328
|
-
refreshPath = async (path: FilePath): Promise<void> => {
|
|
331
|
+
public refreshPath = async (path: FilePath): Promise<void> => {
|
|
329
332
|
await this.refreshPaths([path]);
|
|
330
333
|
};
|
|
331
334
|
|
|
@@ -257,7 +257,7 @@ const toastPasteFailed = () => {
|
|
|
257
257
|
class ClipboardItemBuilder {
|
|
258
258
|
private items: Record<string, string | Blob> = {};
|
|
259
259
|
|
|
260
|
-
add(mimeType: string, value: string | object) {
|
|
260
|
+
public add(mimeType: string, value: string | object) {
|
|
261
261
|
// Skip if the browser doesn't support the mime type
|
|
262
262
|
if (!ClipboardItem.supports(mimeType)) {
|
|
263
263
|
Logger.warn(`ClipboardItem does not support ${mimeType}`);
|
|
@@ -275,7 +275,7 @@ class ClipboardItemBuilder {
|
|
|
275
275
|
return this;
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
-
build() {
|
|
278
|
+
public build() {
|
|
279
279
|
return new ClipboardItem(this.items);
|
|
280
280
|
}
|
|
281
281
|
}
|
|
@@ -762,7 +762,7 @@ const EditableCellComponent = ({
|
|
|
762
762
|
href="https://links.marimo.app/reusable-definitions"
|
|
763
763
|
target="_blank"
|
|
764
764
|
className="hover:underline text-muted-foreground text-xs font-bold"
|
|
765
|
-
rel="
|
|
765
|
+
rel="noreferrer"
|
|
766
766
|
>
|
|
767
767
|
reusable
|
|
768
768
|
</a>
|
|
@@ -801,7 +801,7 @@ const EditableCellComponent = ({
|
|
|
801
801
|
<a
|
|
802
802
|
href="https://links.marimo.app/reusable-definitions"
|
|
803
803
|
target="_blank"
|
|
804
|
-
rel="
|
|
804
|
+
rel="noreferrer"
|
|
805
805
|
>
|
|
806
806
|
<HelpCircleIcon
|
|
807
807
|
size={16}
|
|
@@ -13,8 +13,10 @@ export interface Cursor {
|
|
|
13
13
|
export class TerminalBuffer {
|
|
14
14
|
private lines: string[] = [""];
|
|
15
15
|
private cursor: Cursor = { row: 0, col: 0 };
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
private static readonly ESCAPE_REGEX = new RegExp(
|
|
17
|
+
String.raw`\u001B\[([0-9;]*)([A-DJKH])`,
|
|
18
|
+
"u",
|
|
19
|
+
);
|
|
18
20
|
|
|
19
21
|
/** Ensure the internal lines array is large enough. */
|
|
20
22
|
private ensureLine(row: number) {
|
|
@@ -40,7 +42,7 @@ export class TerminalBuffer {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/** Write a visible character at the current cursor position. */
|
|
43
|
-
writeChar(ch: string) {
|
|
45
|
+
public writeChar(ch: string) {
|
|
44
46
|
this.ensureLine(this.cursor.row);
|
|
45
47
|
const line = this.lines[this.cursor.row];
|
|
46
48
|
const padded = line.padEnd(this.cursor.col, " ");
|
|
@@ -50,7 +52,7 @@ export class TerminalBuffer {
|
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
/** Write a string of visible characters at the current cursor position (optimized batch write). */
|
|
53
|
-
writeString(str: string) {
|
|
55
|
+
public writeString(str: string) {
|
|
54
56
|
if (str.length === 0) {
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
@@ -65,7 +67,7 @@ export class TerminalBuffer {
|
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
/** Handle simple control characters (\n, \r, \t, \b, \v). */
|
|
68
|
-
control(ch: string) {
|
|
70
|
+
public control(ch: string) {
|
|
69
71
|
switch (ch) {
|
|
70
72
|
case "\n":
|
|
71
73
|
this.cursor.row++;
|
|
@@ -93,7 +95,7 @@ export class TerminalBuffer {
|
|
|
93
95
|
* Supports cursor movement and line erasing.
|
|
94
96
|
* For other sequences (like color codes), preserve them by writing to the buffer.
|
|
95
97
|
*/
|
|
96
|
-
handleEscape(seq: string) {
|
|
98
|
+
public handleEscape(seq: string) {
|
|
97
99
|
const match = TerminalBuffer.ESCAPE_REGEX.exec(seq);
|
|
98
100
|
if (!match) {
|
|
99
101
|
// If it doesn't match the cursor movement pattern, it might be:
|
|
@@ -170,7 +172,7 @@ export class TerminalBuffer {
|
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
/** Return the final rendered buffer as a single string. */
|
|
173
|
-
render(): string {
|
|
175
|
+
public render(): string {
|
|
174
176
|
return this.lines.join("\n");
|
|
175
177
|
}
|
|
176
178
|
}
|
|
@@ -180,10 +182,12 @@ export class TerminalBuffer {
|
|
|
180
182
|
*/
|
|
181
183
|
export class AnsiParser {
|
|
182
184
|
// Matches both CSI sequences (ESC[...letter) and other escape sequences like character set selection (ESC(B)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
private ESC_REGEX = new RegExp(
|
|
186
|
+
String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`,
|
|
187
|
+
"gu",
|
|
188
|
+
);
|
|
185
189
|
|
|
186
|
-
parse(input: string): { type: "text" | "escape"; value: string }[] {
|
|
190
|
+
public parse(input: string): { type: "text" | "escape"; value: string }[] {
|
|
187
191
|
const tokens: { type: "text" | "escape"; value: string }[] = [];
|
|
188
192
|
let lastIndex = 0;
|
|
189
193
|
|
|
@@ -217,7 +221,7 @@ export class AnsiReducer {
|
|
|
217
221
|
* Process the entire input string (replaces any previous state).
|
|
218
222
|
* Use this for one-time processing or when starting fresh.
|
|
219
223
|
*/
|
|
220
|
-
reduce(input: string): string {
|
|
224
|
+
public reduce(input: string): string {
|
|
221
225
|
this.reset();
|
|
222
226
|
this.append(input);
|
|
223
227
|
return this.render();
|
|
@@ -227,7 +231,7 @@ export class AnsiReducer {
|
|
|
227
231
|
* Append new input to the existing buffer (for streaming/incremental updates).
|
|
228
232
|
* This is efficient for streaming scenarios - only processes the new chunk.
|
|
229
233
|
*/
|
|
230
|
-
append(input: string): void {
|
|
234
|
+
public append(input: string): void {
|
|
231
235
|
const tokens = this.parser.parse(input);
|
|
232
236
|
|
|
233
237
|
// Fast path: if only one text token (no ANSI codes), handle directly
|
|
@@ -256,14 +260,14 @@ export class AnsiReducer {
|
|
|
256
260
|
* Reset the buffer and cursor to initial state.
|
|
257
261
|
* Use this when you want to start processing fresh input.
|
|
258
262
|
*/
|
|
259
|
-
reset(): void {
|
|
263
|
+
public reset(): void {
|
|
260
264
|
this.buffer = new TerminalBuffer();
|
|
261
265
|
}
|
|
262
266
|
|
|
263
267
|
/**
|
|
264
268
|
* Get the current rendered output without processing new input.
|
|
265
269
|
*/
|
|
266
|
-
render(): string {
|
|
270
|
+
public render(): string {
|
|
267
271
|
return this.buffer.render();
|
|
268
272
|
}
|
|
269
273
|
|
|
@@ -371,7 +375,7 @@ export class StatefulOutputMessage implements OutputMessage {
|
|
|
371
375
|
return this._data;
|
|
372
376
|
}
|
|
373
377
|
|
|
374
|
-
static create(message: StringOutputMessage): StatefulOutputMessage {
|
|
378
|
+
public static create(message: StringOutputMessage): StatefulOutputMessage {
|
|
375
379
|
const ansiReducer = new AnsiReducer();
|
|
376
380
|
ansiReducer.append(message.data);
|
|
377
381
|
return new StatefulOutputMessage(
|
|
@@ -395,7 +399,7 @@ export class StatefulOutputMessage implements OutputMessage {
|
|
|
395
399
|
this._data = this.ansiReducer.render();
|
|
396
400
|
}
|
|
397
401
|
|
|
398
|
-
appendData(chunk: string): StatefulOutputMessage {
|
|
402
|
+
public appendData(chunk: string): StatefulOutputMessage {
|
|
399
403
|
this.ansiReducer.append(chunk);
|
|
400
404
|
return new StatefulOutputMessage(
|
|
401
405
|
this.mimetype,
|
|
@@ -405,7 +409,7 @@ export class StatefulOutputMessage implements OutputMessage {
|
|
|
405
409
|
);
|
|
406
410
|
}
|
|
407
411
|
|
|
408
|
-
toJSON(): StringOutputMessage {
|
|
412
|
+
public toJSON(): StringOutputMessage {
|
|
409
413
|
return {
|
|
410
414
|
mimetype: this.mimetype,
|
|
411
415
|
channel: this.channel,
|
|
@@ -347,20 +347,20 @@ const StdInput = (props: {
|
|
|
347
347
|
placeholder="stdin"
|
|
348
348
|
// Capture the keydown event for history navigation and submission
|
|
349
349
|
onKeyDownCapture={(e) => {
|
|
350
|
-
if (e.key === "ArrowUp") {
|
|
350
|
+
if (!isPassword && e.key === "ArrowUp") {
|
|
351
351
|
navigateUp();
|
|
352
352
|
e.preventDefault();
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
-
if (e.key === "ArrowDown") {
|
|
356
|
+
if (!isPassword && e.key === "ArrowDown") {
|
|
357
357
|
navigateDown();
|
|
358
358
|
e.preventDefault();
|
|
359
359
|
return;
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
363
|
-
if (value) {
|
|
363
|
+
if (value && !isPassword) {
|
|
364
364
|
addToHistory(value);
|
|
365
365
|
}
|
|
366
366
|
onSubmit(value);
|