@marimo-team/islands 0.25.1-dev4 → 0.25.1-dev41
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-vRGgXmad.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-5wuTKcAD.js} +2 -2
- package/dist/{common-DnMDPPaW.js → common-PL37o7BX.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-CWqzAL_P.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-BwKWcLqp.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-DdDhX9sS.js} +3 -3
- package/dist/{globals-CPNNcOJI.js → globals-D07l3kcu.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-DerHT6Rq.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-sfZwts_E.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/__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/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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import React
|
|
3
|
+
import { ExternalLinkIcon } from "lucide-react";
|
|
4
|
+
import type React from "react";
|
|
5
|
+
import { useState } from "react";
|
|
5
6
|
import { Button } from "@/components/ui/button";
|
|
6
7
|
import {
|
|
7
8
|
DialogContent,
|
|
@@ -10,175 +11,144 @@ import {
|
|
|
10
11
|
DialogHeader,
|
|
11
12
|
DialogTitle,
|
|
12
13
|
} from "@/components/ui/dialog";
|
|
13
|
-
import { toast } from "@/components/ui/use-toast";
|
|
14
14
|
import { Constants } from "@/core/constants";
|
|
15
15
|
import { getExportLayout } from "@/core/export/layout";
|
|
16
16
|
import { useRequestClient } from "@/core/network/requests";
|
|
17
17
|
import { VirtualFileTracker } from "@/core/static/virtual-file-tracker";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
import { Spinner } from "../icons/spinner";
|
|
19
|
+
import { stageForPublish } from "./stage-for-publish";
|
|
20
|
+
|
|
21
|
+
type PublishState =
|
|
22
|
+
| { kind: "idle" }
|
|
23
|
+
| { kind: "publishing" }
|
|
24
|
+
| { kind: "staged"; claimUrl: string }
|
|
25
|
+
| { kind: "failed"; message: string };
|
|
22
26
|
|
|
23
|
-
const BASE_URL = "https://static.marimo.app";
|
|
24
27
|
export const ShareStaticNotebookModal: React.FC<{
|
|
25
28
|
onClose: () => void;
|
|
26
29
|
}> = ({ onClose }) => {
|
|
27
|
-
const [
|
|
30
|
+
const [state, setState] = useState<PublishState>({ kind: "idle" });
|
|
28
31
|
const { exportAsHTML } = useRequestClient();
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
onClose();
|
|
45
|
-
const { contents: html } = await exportAsHTML({
|
|
46
|
-
download: false,
|
|
47
|
-
includeCode: true,
|
|
48
|
-
files: VirtualFileTracker.INSTANCE.filenames(),
|
|
49
|
-
layout: await getExportLayout(),
|
|
50
|
-
});
|
|
33
|
+
const handlePublish = async () => {
|
|
34
|
+
setState({ kind: "publishing" });
|
|
35
|
+
try {
|
|
36
|
+
const { contents: html, filename } = await exportAsHTML({
|
|
37
|
+
download: false,
|
|
38
|
+
includeCode: true,
|
|
39
|
+
files: VirtualFileTracker.INSTANCE.filenames(),
|
|
40
|
+
layout: await getExportLayout(),
|
|
41
|
+
// Published notebooks are served from a remote origin, so assets must
|
|
42
|
+
// come from the CDN — never the local server (which is the dev-mode
|
|
43
|
+
// default). The server substitutes {version}.
|
|
44
|
+
assetUrl:
|
|
45
|
+
"https://cdn.jsdelivr.net/npm/@marimo-team/frontend@{version}/dist",
|
|
46
|
+
});
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
title: "Uploading static notebook...",
|
|
54
|
-
description: "Please wait.",
|
|
55
|
-
});
|
|
48
|
+
const claimUrl = await stageForPublish(filename, html);
|
|
56
49
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
title: "Error uploading static page",
|
|
70
|
-
description: (
|
|
71
|
-
<div>
|
|
72
|
-
Please try again later. If the problem persists, please file a
|
|
73
|
-
bug report on{" "}
|
|
74
|
-
<a
|
|
75
|
-
href={Constants.issuesPage}
|
|
76
|
-
target="_blank"
|
|
77
|
-
className="underline"
|
|
78
|
-
>
|
|
79
|
-
GitHub
|
|
80
|
-
</a>
|
|
81
|
-
.
|
|
82
|
-
</div>
|
|
83
|
-
),
|
|
84
|
-
});
|
|
85
|
-
});
|
|
50
|
+
// Best effort: after the async work above, browsers may treat this as a
|
|
51
|
+
// popup and block it. The dialog keeps the link either way.
|
|
52
|
+
window.open(claimUrl, "_blank", "noopener,noreferrer");
|
|
53
|
+
setState({ kind: "staged", claimUrl });
|
|
54
|
+
} catch (error) {
|
|
55
|
+
setState({
|
|
56
|
+
kind: "failed",
|
|
57
|
+
message:
|
|
58
|
+
error instanceof Error ? error.message : "Something went wrong",
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
86
62
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
description: (
|
|
91
|
-
<div>
|
|
92
|
-
The URL has been copied to your clipboard.
|
|
93
|
-
<br />
|
|
94
|
-
You can share it with anyone.
|
|
95
|
-
</div>
|
|
96
|
-
),
|
|
97
|
-
});
|
|
98
|
-
}}
|
|
99
|
-
>
|
|
63
|
+
if (state.kind === "staged") {
|
|
64
|
+
return (
|
|
65
|
+
<DialogContent className="sm:max-w-[480px]">
|
|
100
66
|
<DialogHeader>
|
|
101
|
-
<DialogTitle>
|
|
67
|
+
<DialogTitle>Finish publishing</DialogTitle>
|
|
102
68
|
<DialogDescription>
|
|
103
|
-
|
|
104
|
-
to the public web. We will create a link for you that lives on{" "}
|
|
105
|
-
<a href={BASE_URL} target="_blank">
|
|
106
|
-
{BASE_URL}
|
|
107
|
-
</a>
|
|
108
|
-
.
|
|
69
|
+
If the confirmation page didn't open in a new tab, open it below.
|
|
109
70
|
</DialogDescription>
|
|
110
71
|
</DialogHeader>
|
|
111
|
-
<div className="flex flex-col gap-6 py-4">
|
|
112
|
-
<Input
|
|
113
|
-
data-testid="slug-input"
|
|
114
|
-
id="slug"
|
|
115
|
-
autoFocus={true}
|
|
116
|
-
value={slug}
|
|
117
|
-
placeholder="Notebook slug"
|
|
118
|
-
onChange={(e) => {
|
|
119
|
-
const newSlug = e.target.value
|
|
120
|
-
.toLowerCase()
|
|
121
|
-
.replaceAll(/\s/g, "-")
|
|
122
|
-
.replaceAll(/[^\da-z-]/g, "");
|
|
123
|
-
setSlug(newSlug);
|
|
124
|
-
}}
|
|
125
|
-
required={true}
|
|
126
|
-
autoComplete="off"
|
|
127
|
-
/>
|
|
128
|
-
|
|
129
|
-
<div className="font-semibold text-sm text-muted-foreground gap-2 flex flex-col">
|
|
130
|
-
Anyone will be able to access your notebook at this URL:
|
|
131
|
-
<div className="flex items-center gap-2">
|
|
132
|
-
<CopyButton text={url} />
|
|
133
|
-
<span className="text-primary">{url}</span>
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
72
|
<DialogFooter>
|
|
138
73
|
<Button
|
|
139
|
-
data-testid="
|
|
74
|
+
data-testid="done-share-static-notebook-button"
|
|
140
75
|
variant="secondary"
|
|
141
76
|
onClick={onClose}
|
|
142
77
|
>
|
|
143
|
-
|
|
78
|
+
Done
|
|
144
79
|
</Button>
|
|
145
|
-
<Button
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
80
|
+
<Button asChild={true} variant="default">
|
|
81
|
+
<a
|
|
82
|
+
data-testid="open-claim-page-link"
|
|
83
|
+
href={state.claimUrl}
|
|
84
|
+
target="_blank"
|
|
85
|
+
rel="noopener noreferrer"
|
|
86
|
+
>
|
|
87
|
+
<ExternalLinkIcon size={14} strokeWidth={1.5} className="mr-2" />
|
|
88
|
+
Open confirmation page
|
|
89
|
+
</a>
|
|
155
90
|
</Button>
|
|
156
91
|
</DialogFooter>
|
|
157
|
-
</
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const CopyButton = (props: { text: string }) => {
|
|
163
|
-
const [copied, setCopied] = React.useState(false);
|
|
92
|
+
</DialogContent>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
164
95
|
|
|
165
|
-
const
|
|
166
|
-
e.preventDefault();
|
|
167
|
-
await copyToClipboard(props.text);
|
|
168
|
-
setCopied(true);
|
|
169
|
-
setTimeout(() => setCopied(false), 2000);
|
|
170
|
-
});
|
|
96
|
+
const isPublishing = state.kind === "publishing";
|
|
171
97
|
|
|
172
98
|
return (
|
|
173
|
-
<
|
|
174
|
-
<
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
99
|
+
<DialogContent className="sm:max-w-[480px]">
|
|
100
|
+
<DialogHeader>
|
|
101
|
+
<DialogTitle>Publish HTML to web</DialogTitle>
|
|
102
|
+
<DialogDescription>
|
|
103
|
+
Publish a static snapshot of this notebook to{" "}
|
|
104
|
+
<a
|
|
105
|
+
href={Constants.molab}
|
|
106
|
+
target="_blank"
|
|
107
|
+
rel="noopener noreferrer"
|
|
108
|
+
className="underline"
|
|
109
|
+
>
|
|
110
|
+
molab
|
|
111
|
+
</a>
|
|
112
|
+
. Snapshots can be viewed by anyone on the internet.
|
|
113
|
+
</DialogDescription>
|
|
114
|
+
</DialogHeader>
|
|
115
|
+
{state.kind === "failed" && (
|
|
116
|
+
<p
|
|
117
|
+
role="alert"
|
|
118
|
+
className="text-sm text-destructive"
|
|
119
|
+
data-testid="share-static-notebook-error"
|
|
120
|
+
>
|
|
121
|
+
Publish failed: {state.message}
|
|
122
|
+
</p>
|
|
123
|
+
)}
|
|
124
|
+
<DialogFooter>
|
|
125
|
+
<Button
|
|
126
|
+
data-testid="cancel-share-static-notebook-button"
|
|
127
|
+
variant="secondary"
|
|
128
|
+
onClick={onClose}
|
|
129
|
+
disabled={isPublishing}
|
|
130
|
+
>
|
|
131
|
+
Cancel
|
|
132
|
+
</Button>
|
|
133
|
+
<Button
|
|
134
|
+
data-testid="share-static-notebook-button"
|
|
135
|
+
variant="default"
|
|
136
|
+
disabled={isPublishing}
|
|
137
|
+
onClick={handlePublish}
|
|
138
|
+
>
|
|
139
|
+
{isPublishing ? (
|
|
140
|
+
<>
|
|
141
|
+
<Spinner className="mr-2" size="small" />
|
|
142
|
+
Snapshotting notebook ...
|
|
143
|
+
</>
|
|
144
|
+
) : (
|
|
145
|
+
<>
|
|
146
|
+
<ExternalLinkIcon size={14} strokeWidth={1.5} className="mr-2" />
|
|
147
|
+
{state.kind === "failed" ? "Try again" : "Publish"}
|
|
148
|
+
</>
|
|
149
|
+
)}
|
|
150
|
+
</Button>
|
|
151
|
+
</DialogFooter>
|
|
152
|
+
</DialogContent>
|
|
183
153
|
);
|
|
184
154
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { Constants } from "@/core/constants";
|
|
4
|
+
|
|
5
|
+
interface PendingUploadResponse {
|
|
6
|
+
pendingId: string;
|
|
7
|
+
presignedUrl: string;
|
|
8
|
+
claimUrl: string;
|
|
9
|
+
expiresAt: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Keep in sync with molab.
|
|
13
|
+
export const MAX_PUBLISH_BYTES = 100 * 1024 * 1024;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Stage an HTML export for publishing on molab: reserve a pending upload,
|
|
17
|
+
* PUT the bytes to the presigned URL, and return the claim URL where the
|
|
18
|
+
* user finishes publishing after signing in.
|
|
19
|
+
*/
|
|
20
|
+
export async function stageForPublish(
|
|
21
|
+
fileName: string,
|
|
22
|
+
html: string,
|
|
23
|
+
): Promise<string> {
|
|
24
|
+
const blob = new Blob([html], { type: "text/html" });
|
|
25
|
+
if (blob.size > MAX_PUBLISH_BYTES) {
|
|
26
|
+
throw new Error("File is too large. Maximum size is 100 MB.");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const staged = await fetch(`${Constants.molab}/api/artifacts/pending`, {
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers: { "Content-Type": "application/json" },
|
|
32
|
+
body: JSON.stringify({ fileName, fileSize: blob.size }),
|
|
33
|
+
});
|
|
34
|
+
if (!staged.ok) {
|
|
35
|
+
const body = (await staged.json().catch(() => null)) as {
|
|
36
|
+
error?: string;
|
|
37
|
+
} | null;
|
|
38
|
+
throw new Error(
|
|
39
|
+
body?.error ??
|
|
40
|
+
(staged.status === 429
|
|
41
|
+
? "Too many uploads, try again later"
|
|
42
|
+
: "Failed to prepare the upload"),
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
const { presignedUrl, claimUrl } =
|
|
46
|
+
(await staged.json()) as PendingUploadResponse;
|
|
47
|
+
|
|
48
|
+
// The presigned PUT is capped to the declared size; the browser sends the
|
|
49
|
+
// matching Content-Length automatically from the blob.
|
|
50
|
+
const put = await fetch(presignedUrl, { method: "PUT", body: blob });
|
|
51
|
+
if (!put.ok) {
|
|
52
|
+
throw new Error("Failed to upload the notebook export");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return claimUrl;
|
|
56
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
-
/* oxlint-disable react/jsx-no-comment-textnodes */
|
|
3
|
-
/* oxlint-disable react/jsx-no-target-blank */
|
|
4
2
|
|
|
5
3
|
import { useAtomValue } from "jotai";
|
|
6
4
|
import { CopyIcon, DownloadIcon } from "lucide-react";
|
|
@@ -49,6 +47,7 @@ export const StaticBanner: React.FC = () => {
|
|
|
49
47
|
<a
|
|
50
48
|
href={Constants.githubPage}
|
|
51
49
|
target="_blank"
|
|
50
|
+
rel="noreferrer"
|
|
52
51
|
className="text-(--sky-11) font-medium underline"
|
|
53
52
|
>
|
|
54
53
|
marimo
|
|
@@ -93,6 +92,7 @@ const StaticBannerDialog = ({ code }: { code: string }) => {
|
|
|
93
92
|
<a
|
|
94
93
|
href={Constants.githubPage}
|
|
95
94
|
target="_blank"
|
|
95
|
+
rel="noreferrer"
|
|
96
96
|
className="text-(--sky-11) hover:underline font-medium"
|
|
97
97
|
>
|
|
98
98
|
marimo
|
|
@@ -21,7 +21,12 @@ export const ExternalLink = ({
|
|
|
21
21
|
children: React.ReactNode;
|
|
22
22
|
}) => {
|
|
23
23
|
return (
|
|
24
|
-
<a
|
|
24
|
+
<a
|
|
25
|
+
href={href}
|
|
26
|
+
target="_blank"
|
|
27
|
+
rel="noreferrer"
|
|
28
|
+
className="text-link hover:underline"
|
|
29
|
+
>
|
|
25
30
|
{children}
|
|
26
31
|
</a>
|
|
27
32
|
);
|
|
@@ -5,7 +5,7 @@ import { cn } from "@/utils/cn";
|
|
|
5
5
|
const H1 = React.forwardRef<
|
|
6
6
|
HTMLHeadingElement,
|
|
7
7
|
React.ComponentPropsWithoutRef<"h1">
|
|
8
|
-
>(({ className, ...props }, ref) => {
|
|
8
|
+
>(({ className, children, ...props }, ref) => {
|
|
9
9
|
return (
|
|
10
10
|
<h1
|
|
11
11
|
className={cn(
|
|
@@ -14,7 +14,9 @@ const H1 = React.forwardRef<
|
|
|
14
14
|
)}
|
|
15
15
|
ref={ref}
|
|
16
16
|
{...props}
|
|
17
|
-
|
|
17
|
+
>
|
|
18
|
+
{children}
|
|
19
|
+
</h1>
|
|
18
20
|
);
|
|
19
21
|
});
|
|
20
22
|
H1.displayName = "H1";
|
|
@@ -22,7 +24,7 @@ H1.displayName = "H1";
|
|
|
22
24
|
const H2 = React.forwardRef<
|
|
23
25
|
HTMLHeadingElement,
|
|
24
26
|
React.ComponentPropsWithoutRef<"h2">
|
|
25
|
-
>(({ className, ...props }, ref) => {
|
|
27
|
+
>(({ className, children, ...props }, ref) => {
|
|
26
28
|
return (
|
|
27
29
|
<h2
|
|
28
30
|
className={cn(
|
|
@@ -31,7 +33,9 @@ const H2 = React.forwardRef<
|
|
|
31
33
|
)}
|
|
32
34
|
ref={ref}
|
|
33
35
|
{...props}
|
|
34
|
-
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</h2>
|
|
35
39
|
);
|
|
36
40
|
});
|
|
37
41
|
H2.displayName = "H2";
|
|
@@ -39,7 +43,7 @@ H2.displayName = "H2";
|
|
|
39
43
|
const H3 = React.forwardRef<
|
|
40
44
|
HTMLHeadingElement,
|
|
41
45
|
React.ComponentPropsWithoutRef<"h3">
|
|
42
|
-
>(({ className, ...props }, ref) => {
|
|
46
|
+
>(({ className, children, ...props }, ref) => {
|
|
43
47
|
return (
|
|
44
48
|
<h3
|
|
45
49
|
className={cn(
|
|
@@ -48,7 +52,9 @@ const H3 = React.forwardRef<
|
|
|
48
52
|
)}
|
|
49
53
|
ref={ref}
|
|
50
54
|
{...props}
|
|
51
|
-
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</h3>
|
|
52
58
|
);
|
|
53
59
|
});
|
|
54
60
|
H3.displayName = "H3";
|
|
@@ -56,7 +62,7 @@ H3.displayName = "H3";
|
|
|
56
62
|
const H4 = React.forwardRef<
|
|
57
63
|
HTMLHeadingElement,
|
|
58
64
|
React.ComponentPropsWithoutRef<"h4">
|
|
59
|
-
>(({ className, ...props }, ref) => {
|
|
65
|
+
>(({ className, children, ...props }, ref) => {
|
|
60
66
|
return (
|
|
61
67
|
<h4
|
|
62
68
|
className={cn(
|
|
@@ -65,7 +71,9 @@ const H4 = React.forwardRef<
|
|
|
65
71
|
)}
|
|
66
72
|
ref={ref}
|
|
67
73
|
{...props}
|
|
68
|
-
|
|
74
|
+
>
|
|
75
|
+
{children}
|
|
76
|
+
</h4>
|
|
69
77
|
);
|
|
70
78
|
});
|
|
71
79
|
H4.displayName = "H4";
|
|
@@ -44,9 +44,9 @@ const mockAttachment2: FileUIPart = {
|
|
|
44
44
|
|
|
45
45
|
// Concrete implementation of AIContextProvider for testing
|
|
46
46
|
class MockContextProvider extends AIContextProvider<MockContextItem> {
|
|
47
|
-
readonly title = "Mock Items";
|
|
48
|
-
readonly mentionPrefix = "@";
|
|
49
|
-
readonly contextType = "mock";
|
|
47
|
+
public readonly title = "Mock Items";
|
|
48
|
+
public readonly mentionPrefix = "@";
|
|
49
|
+
public readonly contextType = "mock";
|
|
50
50
|
|
|
51
51
|
private items: MockContextItem[] = [
|
|
52
52
|
{
|
|
@@ -72,57 +72,60 @@ class MockContextProvider extends AIContextProvider<MockContextItem> {
|
|
|
72
72
|
},
|
|
73
73
|
];
|
|
74
74
|
|
|
75
|
-
getItems(): MockContextItem[] {
|
|
75
|
+
public getItems(): MockContextItem[] {
|
|
76
76
|
return this.items;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
formatContext(item: MockContextItem): string {
|
|
79
|
+
public formatContext(item: MockContextItem): string {
|
|
80
80
|
return `Mock: ${item.name} (${item.data.value})`;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
formatCompletion(item: MockContextItem): Completion {
|
|
83
|
+
public formatCompletion(item: MockContextItem): Completion {
|
|
84
84
|
return this.createBasicCompletion(item);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
// Method to add items for testing
|
|
88
|
-
addItem(item: MockContextItem): void {
|
|
88
|
+
public addItem(item: MockContextItem): void {
|
|
89
89
|
this.items.push(item);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
// Method to clear items for testing
|
|
93
|
-
clearItems(): void {
|
|
93
|
+
public clearItems(): void {
|
|
94
94
|
this.items = [];
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
// Test provider that supports attachments
|
|
99
99
|
class AttachmentContextProvider extends AIContextProvider<MockContextItem> {
|
|
100
|
-
readonly title = "Attachment Items";
|
|
101
|
-
readonly mentionPrefix = "@";
|
|
102
|
-
readonly contextType = "attachment";
|
|
100
|
+
public readonly title = "Attachment Items";
|
|
101
|
+
public readonly mentionPrefix = "@";
|
|
102
|
+
public readonly contextType = "attachment";
|
|
103
103
|
|
|
104
104
|
private items: MockContextItem[];
|
|
105
105
|
private attachments: FileUIPart[];
|
|
106
106
|
|
|
107
|
-
constructor(
|
|
107
|
+
public constructor(
|
|
108
|
+
items: MockContextItem[] = [],
|
|
109
|
+
attachments: FileUIPart[] = [],
|
|
110
|
+
) {
|
|
108
111
|
super();
|
|
109
112
|
this.items = items;
|
|
110
113
|
this.attachments = attachments;
|
|
111
114
|
}
|
|
112
115
|
|
|
113
|
-
getItems(): MockContextItem[] {
|
|
116
|
+
public getItems(): MockContextItem[] {
|
|
114
117
|
return this.items;
|
|
115
118
|
}
|
|
116
119
|
|
|
117
|
-
formatContext(item: MockContextItem): string {
|
|
120
|
+
public formatContext(item: MockContextItem): string {
|
|
118
121
|
return `Attachment: ${item.name} (${item.data.value})`;
|
|
119
122
|
}
|
|
120
123
|
|
|
121
|
-
formatCompletion(item: MockContextItem): Completion {
|
|
124
|
+
public formatCompletion(item: MockContextItem): Completion {
|
|
122
125
|
return this.createBasicCompletion(item);
|
|
123
126
|
}
|
|
124
127
|
|
|
125
|
-
override async getAttachments(
|
|
128
|
+
public override async getAttachments(
|
|
126
129
|
items: MockContextItem[],
|
|
127
130
|
): Promise<FileUIPart[]> {
|
|
128
131
|
// Return attachments for items that need them
|
|
@@ -142,9 +145,9 @@ interface FileContextItem extends AIContextItem {
|
|
|
142
145
|
|
|
143
146
|
// Another mock provider with different prefix and type
|
|
144
147
|
class FileContextProvider extends AIContextProvider<FileContextItem> {
|
|
145
|
-
readonly title = "Files";
|
|
146
|
-
readonly mentionPrefix = "@";
|
|
147
|
-
readonly contextType = "file";
|
|
148
|
+
public readonly title = "Files";
|
|
149
|
+
public readonly mentionPrefix = "@";
|
|
150
|
+
public readonly contextType = "file";
|
|
148
151
|
|
|
149
152
|
private items: FileContextItem[] = [
|
|
150
153
|
{
|
|
@@ -163,26 +166,26 @@ class FileContextProvider extends AIContextProvider<FileContextItem> {
|
|
|
163
166
|
},
|
|
164
167
|
];
|
|
165
168
|
|
|
166
|
-
getItems(): FileContextItem[] {
|
|
169
|
+
public getItems(): FileContextItem[] {
|
|
167
170
|
return this.items;
|
|
168
171
|
}
|
|
169
172
|
|
|
170
|
-
formatCompletion(item: FileContextItem): Completion {
|
|
173
|
+
public formatCompletion(item: FileContextItem): Completion {
|
|
171
174
|
return this.createBasicCompletion(item);
|
|
172
175
|
}
|
|
173
176
|
|
|
174
|
-
formatContext(item: FileContextItem): string {
|
|
177
|
+
public formatContext(item: FileContextItem): string {
|
|
175
178
|
return `File: ${item.uri}\nDescription: ${item.description}`;
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
// Second mock provider with the same context type as MockContextProvider
|
|
180
183
|
class SecondaryMockProvider extends AIContextProvider<MockContextItem> {
|
|
181
|
-
readonly title = "Secondary Mock Items";
|
|
182
|
-
readonly mentionPrefix = "@";
|
|
183
|
-
readonly contextType = "mock";
|
|
184
|
+
public readonly title = "Secondary Mock Items";
|
|
185
|
+
public readonly mentionPrefix = "@";
|
|
186
|
+
public readonly contextType = "mock";
|
|
184
187
|
|
|
185
|
-
getItems(): MockContextItem[] {
|
|
188
|
+
public getItems(): MockContextItem[] {
|
|
186
189
|
return [
|
|
187
190
|
{
|
|
188
191
|
type: "mock",
|
|
@@ -194,11 +197,11 @@ class SecondaryMockProvider extends AIContextProvider<MockContextItem> {
|
|
|
194
197
|
];
|
|
195
198
|
}
|
|
196
199
|
|
|
197
|
-
formatContext(item: MockContextItem): string {
|
|
200
|
+
public formatContext(item: MockContextItem): string {
|
|
198
201
|
return `Secondary: ${item.name}`;
|
|
199
202
|
}
|
|
200
203
|
|
|
201
|
-
formatCompletion(item: MockContextItem): Completion {
|
|
204
|
+
public formatCompletion(item: MockContextItem): Completion {
|
|
202
205
|
return this.createBasicCompletion(item);
|
|
203
206
|
}
|
|
204
207
|
}
|
|
@@ -80,16 +80,16 @@ function isMediaMimetype(
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
export class CellOutputContextProvider extends AIContextProvider<CellOutputContextItem> {
|
|
83
|
-
readonly title = "Cell Outputs";
|
|
84
|
-
readonly mentionPrefix = "@";
|
|
85
|
-
readonly contextType = "cell-output";
|
|
83
|
+
public readonly title = "Cell Outputs";
|
|
84
|
+
public readonly mentionPrefix = "@";
|
|
85
|
+
public readonly contextType = "cell-output";
|
|
86
86
|
private store: JotaiStore;
|
|
87
|
-
constructor(store: JotaiStore) {
|
|
87
|
+
public constructor(store: JotaiStore) {
|
|
88
88
|
super();
|
|
89
89
|
this.store = store;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
getItems(): CellOutputContextItem[] {
|
|
92
|
+
public getItems(): CellOutputContextItem[] {
|
|
93
93
|
const notebook = this.store.get(notebookAtom);
|
|
94
94
|
const items: CellOutputContextItem[] = [];
|
|
95
95
|
|
|
@@ -116,7 +116,7 @@ export class CellOutputContextProvider extends AIContextProvider<CellOutputConte
|
|
|
116
116
|
return items;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
formatCompletion(item: CellOutputContextItem): Completion {
|
|
119
|
+
public formatCompletion(item: CellOutputContextItem): Completion {
|
|
120
120
|
const { cellOutput: data, cellName, cellCode } = item.data;
|
|
121
121
|
|
|
122
122
|
return {
|
|
@@ -224,7 +224,7 @@ export class CellOutputContextProvider extends AIContextProvider<CellOutputConte
|
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
formatContext(item: CellOutputContextItem): string {
|
|
227
|
+
public formatContext(item: CellOutputContextItem): string {
|
|
228
228
|
const { cellOutput: data, cellName, cellId, cellCode } = item.data;
|
|
229
229
|
|
|
230
230
|
const contextData = {
|
|
@@ -253,7 +253,7 @@ export class CellOutputContextProvider extends AIContextProvider<CellOutputConte
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
/** Get attachments for cell output items that have shouldDownloadImage=true */
|
|
256
|
-
override async getAttachments(
|
|
256
|
+
public override async getAttachments(
|
|
257
257
|
items: CellOutputContextItem[],
|
|
258
258
|
): Promise<FileUIPart[]> {
|
|
259
259
|
const cellId = items[0].data.cellId;
|