@marimo-team/frontend 0.16.0 → 0.16.2
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-B5cPvWoQ.js +19 -0
- package/dist/assets/{ImageComparisonComponent-fTHv1Ih0.js → ImageComparisonComponent-CqR26LSv.js} +1 -1
- package/dist/assets/{VegaLite-Bdi-TyfY.js → VegaLite-DvQDATwI.js} +1 -1
- package/dist/assets/_baseEach--KDTwKbG.js +1 -0
- package/dist/assets/_baseMap-Cu3o-eyO.js +1 -0
- package/dist/assets/{_baseUniq-CCgDNtZb.js → _baseUniq-y7ZXnMo1.js} +1 -1
- package/dist/assets/{_createAggregator-DcD0kTA5.js → _createAggregator-ZcHkHPNJ.js} +1 -1
- package/dist/assets/{agent-panel-Crv430aI.js → agent-panel-B91RoLct.js} +76 -57
- package/dist/assets/{any-language-editor-CQh552Wu.js → any-language-editor-CxfHcm5h.js} +1 -1
- package/dist/assets/{architectureDiagram-W76B3OCA-BAJeBxzt.js → architectureDiagram-W76B3OCA-BQsvK8uR.js} +1 -1
- package/dist/assets/{between-horizontal-start-Boxgxbt_.js → between-horizontal-start-BmYToIaM.js} +1 -1
- package/dist/assets/{blockDiagram-QIGZ2CNN-CL-1svEK.js → blockDiagram-QIGZ2CNN-r3HgCj4w.js} +1 -1
- package/dist/assets/{c4Diagram-FPNF74CW-BbEqbCTl.js → c4Diagram-FPNF74CW-BJbPNt41.js} +1 -1
- package/dist/assets/channel-DFaEx1fu.js +1 -0
- package/dist/assets/chat-panel-IoPMv8e2.js +3 -0
- package/dist/assets/{chunk-4BX2VUAB-C--8TXeE.js → chunk-4BX2VUAB-Dv4MZ9Hj.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-Bj00HDqq.js → chunk-55IACEB6-CM4AHquB.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-C-lhB6hN.js → chunk-FMBD7UC4-C_Zz0ENB.js} +1 -1
- package/dist/assets/{chunk-K7UQS3LO-B-pGTXPt.js → chunk-K7UQS3LO-DYSmiXYq.js} +1 -1
- package/dist/assets/{chunk-QN33PNHL-DqUzGhvm.js → chunk-QN33PNHL-QM4OPuQP.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-TntJHfSk.js → chunk-QZHKN3VN-CfAsGyeB.js} +1 -1
- package/dist/assets/{chunk-TVAH2DTR-HUJb1psV.js → chunk-TVAH2DTR-6j_Cpjsi.js} +1 -1
- package/dist/assets/{chunk-TZMSLE5B-BK3C__t3.js → chunk-TZMSLE5B-BHslFJQE.js} +1 -1
- package/dist/assets/{circle-play-DBLOv1Yu.js → circle-play-CK3UZRYQ.js} +1 -1
- package/dist/assets/classDiagram-KNZD7YFC-BsZtvV5O.js +1 -0
- package/dist/assets/classDiagram-v2-RKCZMP56-BsZtvV5O.js +1 -0
- package/dist/assets/{clear-button-BeoFbEKH.js → clear-button-C4fDVSv8.js} +1 -1
- package/dist/assets/clone-YBEvPE-s.js +1 -0
- package/dist/assets/command-palette-D7hOfvf6.js +1 -0
- package/dist/assets/{common-C7oJcmCT.js → common-D-lbuUwz.js} +1 -1
- package/dist/assets/{compile-7L0MwhyI.js → compile-DVQe1Mzk.js} +1 -1
- package/dist/assets/{cose-bilkent-S5V4N54A-BMkGLcVC.js → cose-bilkent-S5V4N54A-D-IS7WC8.js} +1 -1
- package/dist/assets/{dagre-5GWH7T2D-BJtRienS.js → dagre-5GWH7T2D-lYu-tEWT.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-DBkmGtNs.js → data-grid-overlay-editor-C5peOCit.js} +1 -1
- package/dist/assets/datasources-panel-D3NA20uZ.js +1 -0
- package/dist/assets/{dependency-graph-panel-DEdOxp2X.js → dependency-graph-panel-BGVYOfkV.js} +1 -1
- package/dist/assets/{diagram-N5W7TBWH-CmECY3nb.js → diagram-N5W7TBWH-BnvIuYUp.js} +1 -1
- package/dist/assets/{diagram-QEK2KX5R-DMOVSNKD.js → diagram-QEK2KX5R-DemedRK3.js} +1 -1
- package/dist/assets/{diagram-S2PKOQOG-BiJ96PNQ.js → diagram-S2PKOQOG-iiY7AuyH.js} +1 -1
- package/dist/assets/{documentation-panel-xULhaEv3.js → documentation-panel-C3dSwOSQ.js} +1 -1
- package/dist/assets/edit-page-C5TsEeSo.js +129 -0
- package/dist/assets/{ellipsis-vertical-BBqXIlc2.js → ellipsis-vertical-CazJl8M7.js} +1 -1
- package/dist/assets/{empty-state-B3dA3G5P.js → empty-state-DW308mFO.js} +1 -1
- package/dist/assets/{erDiagram-AWTI2OKA-MP1DiFRo.js → erDiagram-AWTI2OKA-6wQ8Ugg0.js} +1 -1
- package/dist/assets/{error-panel-Cc1sv-Ag.js → error-panel-D1VnJ1yP.js} +1 -1
- package/dist/assets/file-explorer-panel-0oVd4t-D.js +1 -0
- package/dist/assets/{flowDiagram-PVAE7QVJ-BX7caPp7.js → flowDiagram-PVAE7QVJ-C55IUWjm.js} +1 -1
- package/dist/assets/{ganttDiagram-OWAHRB6G-B462g4Yf.js → ganttDiagram-OWAHRB6G-DmqCM6ME.js} +4 -4
- package/dist/assets/{gitGraphDiagram-NY62KEGX-CGgvZ9-9.js → gitGraphDiagram-NY62KEGX-DBvhAeM_.js} +1 -1
- package/dist/assets/{glide-data-editor-C0gUFZON.js → glide-data-editor-CHNuHidQ.js} +4 -4
- package/dist/assets/{graph-CHRVBzY5.js → graph-CG6BgUWQ.js} +1 -1
- package/dist/assets/home-page-dgivXuSR.js +9 -0
- package/dist/assets/{index-Clbi_Yaq.js → index-BTGpssVX.js} +1 -1
- package/dist/assets/{index-CQDrxQ0j.js → index-BYVZlBF8.js} +1 -1
- package/dist/assets/{index-lYa_leQE.js → index-BelfnXwL.js} +1 -1
- package/dist/assets/{index-DRMm6SNo.js → index-BneyUujp.js} +1 -1
- package/dist/assets/{index-BY93Ejhl.js → index-C02SqeRj.js} +1 -1
- package/dist/assets/{index-C-8WADat.js → index-C7dtgr9A.js} +1 -1
- package/dist/assets/{index-D9UKkrr2.js → index-CAQvMTzM.js} +1 -1
- package/dist/assets/index-CGDMlQfO.css +1 -0
- package/dist/assets/index-CelXfcd8.js +580 -0
- package/dist/assets/{index-vmICa5KN.js → index-Csd6QrCV.js} +1 -1
- package/dist/assets/{index-DoRmcrKM.js → index-CtPksxf0.js} +1 -1
- package/dist/assets/{index-C1v_Z9et.js → index-Cxyk7pt-.js} +1 -1
- package/dist/assets/{index-CpTPJo4k.js → index-DAZ-9ri2.js} +1 -1
- package/dist/assets/{index-DEQvTChO.js → index-DONRrmA2.js} +1 -1
- package/dist/assets/{index-C4Tn5NvJ.js → index-Db36XTG_.js} +1 -1
- package/dist/assets/{index-z9bohSQJ.js → index-DdIhdEVw.js} +1 -1
- package/dist/assets/{index-C-GhZ7ti.js → index-M_pBKDSe.js} +1 -1
- package/dist/assets/{index-C77h_TXN.js → index-_luCZMLM.js} +1 -1
- package/dist/assets/{index-D1vmG6DS.js → index-mkubqy9-.js} +1 -1
- package/dist/assets/{index-BVgAenPd.js → index-sbO9UaUU.js} +1 -1
- package/dist/assets/{index-CWMgowgL.js → index-z4krxQ4j.js} +1 -1
- package/dist/assets/infoDiagram-STP46IZ2-wTALjfPc.js +2 -0
- package/dist/assets/{isEmpty-DU_ogP_D.js → isEmpty-CqX_YTIf.js} +1 -1
- package/dist/assets/{journeyDiagram-BIP6EPQ6-C6EgLP_Q.js → journeyDiagram-BIP6EPQ6-Y5w_Tqe_.js} +1 -1
- package/dist/assets/{kanban-definition-6OIFK2YF-BXzYO1yj.js → kanban-definition-6OIFK2YF-DbXs5Rxi.js} +1 -1
- package/dist/assets/{layout-jihVw5-i.js → layout-BCNPDACj.js} +1 -1
- package/dist/assets/{linear-C4blANlC.js → linear-uO6UVhXt.js} +1 -1
- package/dist/assets/links-Drv7cJgN.js +7 -0
- package/dist/assets/{logs-panel-D401qzZh.js → logs-panel-BEQ1eRUp.js} +1 -1
- package/dist/assets/{markdown-renderer-Cd9eYyaL.js → markdown-renderer-Dmzbb00W.js} +20 -20
- package/dist/assets/{mermaid-BEVuRz_O.js → mermaid-qRc4MXIj.js} +1 -1
- package/dist/assets/{mermaid.core-CaSnaLH0.js → mermaid.core-CvvJtCRj.js} +4 -4
- package/dist/assets/min-DYUOb1RR.js +1 -0
- package/dist/assets/{mindmap-definition-Q6HEUPPD-BXUM5MT2.js → mindmap-definition-Q6HEUPPD-G5NognM-.js} +1 -1
- package/dist/assets/{number-overlay-editor-4uWXGlPG.js → number-overlay-editor-DPr5sHFu.js} +1 -1
- package/dist/assets/outline-panel-gxQXvVi4.js +1 -0
- package/dist/assets/{packages-panel-CJL0MVlj.js → packages-panel-B1T0VPlg.js} +1 -1
- package/dist/assets/{pieDiagram-ADFJNKIX-Dxt5PVNo.js → pieDiagram-ADFJNKIX-DK9SHkfc.js} +1 -1
- package/dist/assets/{quadrantDiagram-LMRXKWRM-D4pUaA31.js → quadrantDiagram-LMRXKWRM-D1DdWF8C.js} +1 -1
- package/dist/assets/{react-plotly-cJZ0VWBq.js → react-plotly-CTwajqCb.js} +1 -1
- package/dist/assets/{requirementDiagram-4UW4RH46-DVRTjgas.js → requirementDiagram-4UW4RH46-DnjDAypr.js} +1 -1
- package/dist/assets/{run-page-BUEnMC9w.js → run-page-CQY9im22.js} +1 -1
- package/dist/assets/{sankeyDiagram-GR3RE2ED-CVFnD9C-.js → sankeyDiagram-GR3RE2ED-B67Va-ER.js} +1 -1
- package/dist/assets/{scratchpad-panel-BIgRENkI.js → scratchpad-panel-DlDfcDtW.js} +1 -1
- package/dist/assets/{secrets-panel-xY5-V_BD.js → secrets-panel-BDGyuGZA.js} +1 -1
- package/dist/assets/{sequenceDiagram-C3RYC4MD-_lY4ZN_S.js → sequenceDiagram-C3RYC4MD-DiWgZPtN.js} +1 -1
- package/dist/assets/{slides-component-DMjQomc3.css → slides-component-C-LoGC1U.css} +1 -1
- package/dist/assets/{slides-component-Xjymwj7X.js → slides-component-DhpPRtQp.js} +1 -1
- package/dist/assets/snippets-panel-CLkBXhJ2.js +1 -0
- package/dist/assets/sortBy-D4OG7w4O.js +1 -0
- package/dist/assets/{state-C4NiC9tO.js → state-Dz_3JyED.js} +1 -1
- package/dist/assets/{stateDiagram-KXAO66HF-Da0JQWCn.js → stateDiagram-KXAO66HF-ByF2AULw.js} +1 -1
- package/dist/assets/stateDiagram-v2-UMBNRL4Z-CtBJqosP.js +1 -0
- package/dist/assets/storage-Dr0CC44z.js +26 -0
- package/dist/assets/{terminal-BPwTkXae.js → terminal-BtdissBf.js} +1 -1
- package/dist/assets/{time-Dv5_Ouz_.js → time-DKdOTnQg.js} +1 -1
- package/dist/assets/{timeline-definition-XQNQX7LJ-Dxh5Zu2e.js → timeline-definition-XQNQX7LJ-DzER9bf6.js} +1 -1
- package/dist/assets/tracing-Dpx5M-u3.js +2 -0
- package/dist/assets/{tracing-panel-DAzrzNmm.js → tracing-panel-hCjBkSER.js} +2 -2
- package/dist/assets/{trash-Dc6DSjz_.js → trash-C6Ko-g5q.js} +1 -1
- package/dist/assets/{tree-jheoerAX.js → tree-BHN2gcCF.js} +6 -6
- package/dist/assets/{treemap-75Q7IDZK-IgpxeGaf.js → treemap-75Q7IDZK-DR79Mhzt.js} +27 -27
- package/dist/assets/variable-panel-PFBCFz36.js +1 -0
- package/dist/assets/{vega-component-BpfpiPKI.js → vega-component-Db6-uY4C.js} +1 -1
- package/dist/assets/worker-fHbtoWvT.js +1 -0
- package/dist/assets/{xychartDiagram-6GGTOJPD-CmNigJ31.js → xychartDiagram-6GGTOJPD-DWzBP3tZ.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +5 -4
- package/src/__mocks__/requests.ts +1 -0
- package/src/components/app-config/user-config-form.tsx +46 -1
- package/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap +62 -43
- package/src/components/chat/acp/__tests__/atoms.test.ts +1 -1
- package/src/components/chat/acp/__tests__/state.test.ts +36 -36
- package/src/components/chat/acp/agent-panel.tsx +24 -27
- package/src/components/chat/acp/blocks.tsx +6 -6
- package/src/components/chat/acp/prompt.ts +62 -43
- package/src/components/chat/chat-panel.tsx +5 -1
- package/src/components/chat/markdown-renderer.tsx +6 -10
- package/src/components/chat/tool-call-accordion.tsx +52 -20
- package/src/components/data-table/SearchBar.tsx +8 -7
- package/src/components/data-table/__tests__/column_formatting.test.ts +50 -35
- package/src/components/data-table/__tests__/columns.test.tsx +38 -0
- package/src/components/data-table/__tests__/data-table.test.tsx +39 -1
- package/src/components/data-table/cell-hover-template/feature.ts +14 -0
- package/src/components/data-table/cell-hover-template/types.ts +11 -0
- package/src/components/data-table/charts/components/form-fields.tsx +41 -37
- package/src/components/data-table/charts/forms/common-chart.tsx +2 -2
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +5 -2
- package/src/components/data-table/column-formatting/feature.ts +62 -29
- package/src/components/data-table/column-formatting/types.ts +1 -0
- package/src/components/data-table/column-header.tsx +3 -1
- package/src/components/data-table/column-summary/chart-spec-model.tsx +24 -7
- package/src/components/data-table/column-summary/column-summary.tsx +18 -9
- package/src/components/data-table/columns.tsx +63 -20
- package/src/components/data-table/data-table.tsx +10 -2
- package/src/components/data-table/date-popover.tsx +85 -75
- package/src/components/data-table/filter-pills.tsx +14 -9
- package/src/components/data-table/header-items.tsx +5 -1
- package/src/components/data-table/pagination.tsx +20 -13
- package/src/components/data-table/renderers.tsx +36 -0
- package/src/components/data-table/row-viewer-panel/row-viewer.tsx +10 -8
- package/src/components/data-table/schemas.ts +16 -0
- package/src/components/datasources/column-preview.tsx +6 -2
- package/src/components/datasources/datasources.tsx +8 -12
- package/src/components/editor/Cell.tsx +2 -0
- package/src/components/editor/ai/transport/chat-transport.tsx +4 -1
- package/src/components/editor/cell/CellStatus.tsx +23 -20
- package/src/components/editor/cell/CreateCellButton.tsx +3 -4
- package/src/components/editor/cell/code/language-toggle.tsx +3 -4
- package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +39 -28
- package/src/components/editor/controls/notebook-menu-dropdown.tsx +4 -2
- package/src/components/editor/errors/sql-validation-errors.tsx +34 -0
- package/src/components/editor/file-tree/requesting-tree.tsx +14 -8
- package/src/components/editor/output/ConsoleOutput.tsx +13 -1
- package/src/components/editor/output/MarimoErrorOutput.tsx +60 -1
- package/src/components/editor/renderers/CellArray.tsx +3 -4
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +3 -3
- package/src/components/editor/renderers/slides-layout/types.ts +1 -0
- package/src/components/pages/home-page.tsx +4 -1
- package/src/components/slides/slides-component.tsx +1 -1
- package/src/components/slides/slides.css +6 -0
- package/src/components/terminal/theme.tsx +1 -0
- package/src/components/tracing/tracing-spec.ts +5 -4
- package/src/components/ui/range-slider.tsx +4 -2
- package/src/components/ui/slider.tsx +3 -1
- package/src/components/variables/variables-table.tsx +3 -0
- package/src/core/MarimoApp.tsx +9 -6
- package/src/core/ai/context/__tests__/registry.test.ts +6 -4
- package/src/core/ai/context/providers/cell-output.ts +4 -20
- package/src/core/ai/context/providers/error.ts +3 -1
- package/src/core/ai/context/providers/file.ts +7 -2
- package/src/core/ai/context/providers/tables.ts +3 -2
- package/src/core/ai/context/providers/variable.ts +6 -4
- package/src/core/ai/staged-cells.ts +34 -1
- package/src/core/cells/__tests__/add-missing-import.test.ts +67 -22
- package/src/core/cells/add-missing-import.ts +24 -7
- package/src/core/cells/cells.ts +26 -27
- package/src/core/cells/logs.ts +1 -1
- package/src/core/codemirror/find-replace/search-highlight.ts +3 -1
- package/src/core/codemirror/language/LanguageAdapters.ts +9 -3
- package/src/core/codemirror/language/__tests__/extension.test.ts +24 -0
- package/src/core/codemirror/language/__tests__/sql-validation.test.ts +133 -0
- package/src/core/codemirror/language/languages/sql/sql-mode.ts +20 -0
- package/src/core/codemirror/language/languages/sql/sql.ts +90 -3
- package/src/core/codemirror/language/languages/sql/validation-errors.ts +79 -0
- package/src/core/codemirror/language/panel/panel.tsx +8 -2
- package/src/core/codemirror/language/panel/sql.tsx +81 -4
- package/src/core/codemirror/lsp/notebook-lsp.ts +8 -2
- package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
- package/src/core/codemirror/rtc/loro/awareness.ts +52 -17
- package/src/core/codemirror/rtc/loro/sync.ts +12 -4
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/config/config.ts +4 -0
- package/src/core/config/feature-flag.tsx +3 -1
- package/src/core/datasets/request-registry.ts +17 -1
- package/src/core/hotkeys/hotkeys.ts +8 -4
- package/src/core/i18n/__tests__/locale-provider.test.tsx +176 -0
- package/src/core/i18n/locale-provider.tsx +35 -0
- package/src/core/i18n/with-locale.tsx +12 -0
- package/src/core/islands/bridge.ts +1 -0
- package/src/core/islands/components/web-components.tsx +13 -10
- package/src/core/islands/main.ts +1 -0
- package/src/core/kernel/RuntimeState.ts +4 -1
- package/src/core/kernel/messages.ts +3 -2
- package/src/core/network/DeferredRequestRegistry.ts +16 -4
- package/src/core/network/requests-network.ts +7 -0
- package/src/core/network/requests-static.ts +1 -0
- package/src/core/network/requests-toasting.ts +1 -0
- package/src/core/network/types.ts +2 -0
- package/src/core/runtime/runtime.ts +5 -4
- package/src/core/wasm/bridge.ts +10 -1
- package/src/core/wasm/store.ts +4 -1
- package/src/core/wasm/worker/message-buffer.ts +3 -2
- package/src/core/websocket/types.ts +22 -16
- package/src/core/websocket/useMarimoWebSocket.tsx +4 -0
- package/src/hooks/useFormatting.ts +97 -0
- package/src/hooks/useTimer.ts +8 -5
- package/src/plugins/core/registerReactComponent.tsx +39 -29
- package/src/plugins/impl/DataTablePlugin.tsx +15 -4
- package/src/plugins/impl/RangeSliderPlugin.tsx +5 -3
- package/src/plugins/impl/SliderPlugin.tsx +3 -1
- package/src/plugins/impl/anywidget/model.ts +16 -5
- package/src/plugins/impl/data-editor/types.ts +7 -5
- package/src/plugins/impl/data-explorer/components/column-summary.tsx +20 -13
- package/src/plugins/impl/data-frames/DataFramePlugin.tsx +17 -5
- package/src/plugins/impl/panel/utils.ts +6 -4
- package/src/plugins/layout/OutlinePlugin.tsx +69 -0
- package/src/plugins/layout/StatPlugin.tsx +4 -1
- package/src/plugins/plugins.ts +2 -0
- package/src/stories/dataframe.stories.tsx +2 -0
- package/src/utils/__tests__/dates.test.ts +45 -24
- package/src/utils/__tests__/dom.test.ts +167 -0
- package/src/utils/__tests__/numbers.test.ts +42 -30
- package/src/utils/__tests__/once.test.ts +187 -0
- package/src/utils/dates.ts +15 -10
- package/src/utils/dom.ts +55 -0
- package/src/utils/edit-distance.ts +8 -6
- package/src/utils/errors.ts +1 -1
- package/src/utils/id-tree.tsx +21 -10
- package/src/utils/localStorage.ts +13 -4
- package/src/utils/numbers.ts +11 -11
- package/src/utils/once.ts +32 -0
- package/src/utils/paths.ts +4 -1
- package/src/utils/pluralize.ts +12 -5
- package/src/utils/python-poet/poet.ts +30 -15
- package/src/utils/time.ts +5 -1
- package/dist/assets/ConnectedDataExplorerComponent-BErMbWvG.js +0 -19
- package/dist/assets/_baseEach-CNBxBxvS.js +0 -1
- package/dist/assets/_baseMap-D1WHjKrd.js +0 -1
- package/dist/assets/channel-_2eNSz0n.js +0 -1
- package/dist/assets/chat-panel-CXh5Wl6C.js +0 -3
- package/dist/assets/classDiagram-KNZD7YFC-BGmh9POF.js +0 -1
- package/dist/assets/classDiagram-v2-RKCZMP56-BGmh9POF.js +0 -1
- package/dist/assets/clone-BFDSPAj3.js +0 -1
- package/dist/assets/command-palette-CXZiSv0I.js +0 -1
- package/dist/assets/datasources-panel-B7FbYLiy.js +0 -1
- package/dist/assets/edit-page-BrYda9VE.js +0 -129
- package/dist/assets/file-explorer-panel-Bw59Kva1.js +0 -1
- package/dist/assets/home-page-Fb2osjys.js +0 -9
- package/dist/assets/index-Cx0bsY1w.css +0 -1
- package/dist/assets/index-DKEudB02.js +0 -578
- package/dist/assets/infoDiagram-STP46IZ2-CVyrdLc8.js +0 -2
- package/dist/assets/links-D59GIweI.js +0 -7
- package/dist/assets/min-DUMu_zeK.js +0 -1
- package/dist/assets/outline-panel-DIzkvm2I.js +0 -1
- package/dist/assets/snippets-panel-CTPYW41n.js +0 -1
- package/dist/assets/sortBy-BNZKwiq_.js +0 -1
- package/dist/assets/stateDiagram-v2-UMBNRL4Z-D5lYZOOt.js +0 -1
- package/dist/assets/storage-CMdLzB_c.js +0 -26
- package/dist/assets/tracing-BCIurUfa.js +0 -2
- package/dist/assets/variable-panel-DYAiLBmF.js +0 -1
- package/dist/assets/worker-X5rxzQGQ.js +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { useAtomValue } from "jotai";
|
|
4
|
+
import type { ReactNode } from "react";
|
|
5
|
+
import { I18nProvider } from "react-aria-components";
|
|
6
|
+
import { localeAtom } from "@/core/config/config";
|
|
7
|
+
|
|
8
|
+
interface LocaleProviderProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const LocaleProvider = ({ children }: LocaleProviderProps) => {
|
|
13
|
+
const locale = useAtomValue(localeAtom);
|
|
14
|
+
|
|
15
|
+
return <I18nProvider locale={safeLocale(locale)}>{children}</I18nProvider>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function safeLocale(locale: string | null | undefined) {
|
|
19
|
+
if (!locale) {
|
|
20
|
+
return navigator.language;
|
|
21
|
+
}
|
|
22
|
+
if (isValidLocale(locale)) {
|
|
23
|
+
return locale;
|
|
24
|
+
}
|
|
25
|
+
return navigator.language;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function isValidLocale(locale: string) {
|
|
29
|
+
try {
|
|
30
|
+
new Intl.NumberFormat(locale);
|
|
31
|
+
return true;
|
|
32
|
+
} catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { useLocale } from "react-aria";
|
|
4
|
+
|
|
5
|
+
export const WithLocale = ({
|
|
6
|
+
children,
|
|
7
|
+
}: {
|
|
8
|
+
children: (locale: string) => React.ReactNode;
|
|
9
|
+
}) => {
|
|
10
|
+
const { locale } = useLocale();
|
|
11
|
+
return children(locale);
|
|
12
|
+
};
|
|
@@ -153,6 +153,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
153
153
|
previewSQLTable = throwNotImplemented;
|
|
154
154
|
previewSQLTableList = throwNotImplemented;
|
|
155
155
|
previewDataSourceConnection = throwNotImplemented;
|
|
156
|
+
validateSQL = throwNotImplemented;
|
|
156
157
|
openFile = throwNotImplemented;
|
|
157
158
|
sendListFiles = throwNotImplemented;
|
|
158
159
|
sendSearchFiles = throwNotImplemented;
|
|
@@ -7,6 +7,7 @@ import { ErrorBoundary } from "@/components/editor/boundary/ErrorBoundary";
|
|
|
7
7
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
8
8
|
import { notebookAtom } from "@/core/cells/cells";
|
|
9
9
|
import { UI_ELEMENT_REGISTRY } from "@/core/dom/uiregistry";
|
|
10
|
+
import { LocaleProvider } from "@/core/i18n/locale-provider";
|
|
10
11
|
import { renderHTML } from "@/plugins/core/RenderHTML";
|
|
11
12
|
import { invariant } from "@/utils/invariant";
|
|
12
13
|
import type { CellId } from "../../cells/ids";
|
|
@@ -80,16 +81,18 @@ export class MarimoIslandElement extends HTMLElement {
|
|
|
80
81
|
this.root?.render(
|
|
81
82
|
<ErrorBoundary>
|
|
82
83
|
<Provider store={store}>
|
|
83
|
-
<
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
<LocaleProvider>
|
|
85
|
+
<TooltipProvider>
|
|
86
|
+
<MarimoOutputWrapper
|
|
87
|
+
cellId={this.cellId}
|
|
88
|
+
codeCallback={codeCallback}
|
|
89
|
+
alwaysShowRun={alwaysShowRun}
|
|
90
|
+
>
|
|
91
|
+
{initialHtml}
|
|
92
|
+
</MarimoOutputWrapper>
|
|
93
|
+
{editor}
|
|
94
|
+
</TooltipProvider>
|
|
95
|
+
</LocaleProvider>
|
|
93
96
|
</Provider>
|
|
94
97
|
</ErrorBoundary>,
|
|
95
98
|
);
|
package/src/core/islands/main.ts
CHANGED
|
@@ -29,8 +29,11 @@ export class RuntimeState {
|
|
|
29
29
|
* ObjectIds of UIElements whose values need to be updated in the kernel
|
|
30
30
|
*/
|
|
31
31
|
private _sendComponentValues: RunRequests["sendComponentValues"] | undefined;
|
|
32
|
+
private uiElementRegistry: UIElementRegistry;
|
|
32
33
|
|
|
33
|
-
constructor(
|
|
34
|
+
constructor(uiElementRegistry: UIElementRegistry) {
|
|
35
|
+
this.uiElementRegistry = uiElementRegistry;
|
|
36
|
+
}
|
|
34
37
|
|
|
35
38
|
private get sendComponentValues(): RunRequests["sendComponentValues"] {
|
|
36
39
|
if (!this._sendComponentValues) {
|
|
@@ -38,6 +38,7 @@ export type DataColumnPreview = OperationMessageData<"data-column-preview">;
|
|
|
38
38
|
export type SQLTablePreview = OperationMessageData<"sql-table-preview">;
|
|
39
39
|
export type SQLTableListPreview =
|
|
40
40
|
OperationMessageData<"sql-table-list-preview">;
|
|
41
|
+
export type ValidateSQLResult = OperationMessageData<"validate-sql-result">;
|
|
41
42
|
export type SecretKeysResult = OperationMessageData<"secret-keys-result">;
|
|
42
43
|
export type StartupLogs = OperationMessageData<"startup-logs">;
|
|
43
44
|
export type CellMessage = OperationMessageData<"cell-op">;
|
|
@@ -46,9 +47,9 @@ export type Capabilities = OperationMessageData<"kernel-ready">["capabilities"];
|
|
|
46
47
|
export type MessageOperationUnion = schemas["KnownUnions"]["operation"];
|
|
47
48
|
|
|
48
49
|
export type OperationMessageType = MessageOperationUnion["op"];
|
|
49
|
-
export
|
|
50
|
+
export interface OperationMessage {
|
|
50
51
|
data: MessageOperationUnion;
|
|
51
|
-
}
|
|
52
|
+
}
|
|
52
53
|
|
|
53
54
|
export type OperationMessageData<T extends OperationMessageType> = Omit<
|
|
54
55
|
Extract<MessageOperationUnion, { op: T }>,
|
|
@@ -18,17 +18,29 @@ export const RequestId = {
|
|
|
18
18
|
*/
|
|
19
19
|
export class DeferredRequestRegistry<REQ, RES> {
|
|
20
20
|
public requests = new Map<RequestId, Deferred<RES>>();
|
|
21
|
+
public operation: string;
|
|
22
|
+
private makeRequest: (id: RequestId, req: REQ) => Promise<void>;
|
|
23
|
+
private opts: {
|
|
24
|
+
/**
|
|
25
|
+
* Resolve existing requests with an empty response.
|
|
26
|
+
*/
|
|
27
|
+
resolveExistingRequests?: () => RES;
|
|
28
|
+
};
|
|
21
29
|
|
|
22
30
|
constructor(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
operation: string,
|
|
32
|
+
makeRequest: (id: RequestId, req: REQ) => Promise<void>,
|
|
33
|
+
opts: {
|
|
26
34
|
/**
|
|
27
35
|
* Resolve existing requests with an empty response.
|
|
28
36
|
*/
|
|
29
37
|
resolveExistingRequests?: () => RES;
|
|
30
38
|
} = {},
|
|
31
|
-
) {
|
|
39
|
+
) {
|
|
40
|
+
this.operation = operation;
|
|
41
|
+
this.makeRequest = makeRequest;
|
|
42
|
+
this.opts = opts;
|
|
43
|
+
}
|
|
32
44
|
|
|
33
45
|
async request(opts: REQ): Promise<RES> {
|
|
34
46
|
if (this.opts.resolveExistingRequests) {
|
|
@@ -207,6 +207,13 @@ export function createNetworkRequests(): EditRequests & RunRequests {
|
|
|
207
207
|
})
|
|
208
208
|
.then(handleResponseReturnNull);
|
|
209
209
|
},
|
|
210
|
+
validateSQL: (request) => {
|
|
211
|
+
return getClient()
|
|
212
|
+
.POST("/api/sql/validate", {
|
|
213
|
+
body: request,
|
|
214
|
+
})
|
|
215
|
+
.then(handleResponseReturnNull);
|
|
216
|
+
},
|
|
210
217
|
openFile: async (request) => {
|
|
211
218
|
await waitForConnectionOpen();
|
|
212
219
|
await getClient()
|
|
@@ -57,6 +57,7 @@ export function createStaticRequests(): EditRequests & RunRequests {
|
|
|
57
57
|
previewSQLTable: throwNotInEditMode,
|
|
58
58
|
previewSQLTableList: throwNotInEditMode,
|
|
59
59
|
previewDataSourceConnection: throwNotInEditMode,
|
|
60
|
+
validateSQL: throwNotInEditMode,
|
|
60
61
|
openFile: throwNotInEditMode,
|
|
61
62
|
getUsageStats: throwNotInEditMode,
|
|
62
63
|
sendListFiles: throwNotInEditMode,
|
|
@@ -35,6 +35,7 @@ export function createErrorToastingRequests(
|
|
|
35
35
|
previewSQLTable: "Failed to fetch SQL table",
|
|
36
36
|
previewSQLTableList: "Failed to fetch SQL table list",
|
|
37
37
|
previewDataSourceConnection: "Failed to preview data source connection",
|
|
38
|
+
validateSQL: "Failed to validate SQL",
|
|
38
39
|
openFile: "Failed to open file",
|
|
39
40
|
getUsageStats: "", // No toast
|
|
40
41
|
sendListFiles: "Failed to list files",
|
|
@@ -62,6 +62,7 @@ export type PreviewSQLTableRequest = schemas["PreviewSQLTableRequest"];
|
|
|
62
62
|
export type PreviewSQLTableListRequest = schemas["PreviewSQLTableListRequest"];
|
|
63
63
|
export type PreviewDataSourceConnectionRequest =
|
|
64
64
|
schemas["PreviewDataSourceConnectionRequest"];
|
|
65
|
+
export type ValidateSQLRequest = schemas["ValidateSQLRequest"];
|
|
65
66
|
export type PdbRequest = schemas["PdbRequest"];
|
|
66
67
|
export type ReadCodeResponse = schemas["ReadCodeResponse"];
|
|
67
68
|
export type RecentFilesResponse = schemas["RecentFilesResponse"];
|
|
@@ -140,6 +141,7 @@ export interface EditRequests {
|
|
|
140
141
|
previewDataSourceConnection: (
|
|
141
142
|
request: PreviewDataSourceConnectionRequest,
|
|
142
143
|
) => Promise<null>;
|
|
144
|
+
validateSQL: (request: ValidateSQLRequest) => Promise<null>;
|
|
143
145
|
openFile: (request: { path: string }) => Promise<null>;
|
|
144
146
|
getUsageStats: () => Promise<UsageResponse>;
|
|
145
147
|
// Debugger
|
|
@@ -10,11 +10,12 @@ import type { RuntimeConfig } from "./types";
|
|
|
10
10
|
|
|
11
11
|
export class RuntimeManager {
|
|
12
12
|
private initialHealthyCheck = new Deferred<void>();
|
|
13
|
+
private config: RuntimeConfig;
|
|
14
|
+
private lazy: boolean;
|
|
13
15
|
|
|
14
|
-
constructor(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
) {
|
|
16
|
+
constructor(config: RuntimeConfig, lazy = false) {
|
|
17
|
+
this.config = config;
|
|
18
|
+
this.lazy = lazy;
|
|
18
19
|
// Validate the URL on construction
|
|
19
20
|
try {
|
|
20
21
|
new URL(this.config.url);
|
package/src/core/wasm/bridge.ts
CHANGED
|
@@ -496,6 +496,11 @@ export class PyodideBridge implements RunRequests, EditRequests {
|
|
|
496
496
|
return null;
|
|
497
497
|
};
|
|
498
498
|
|
|
499
|
+
validateSQL: EditRequests["validateSQL"] = async (request) => {
|
|
500
|
+
await this.putControlRequest(request);
|
|
501
|
+
return null;
|
|
502
|
+
};
|
|
503
|
+
|
|
499
504
|
sendModelValue: RunRequests["sendModelValue"] = async (request) => {
|
|
500
505
|
await this.putControlRequest(request);
|
|
501
506
|
return null;
|
|
@@ -576,7 +581,11 @@ export class PyodideWebsocket implements IReconnectingWebSocket {
|
|
|
576
581
|
messageSubscriptions = new Set<(event: MessageEvent) => void>();
|
|
577
582
|
errorSubscriptions = new Set<(event: Event) => void>();
|
|
578
583
|
|
|
579
|
-
|
|
584
|
+
private bridge: Pick<PyodideBridge, "consumeMessages">;
|
|
585
|
+
|
|
586
|
+
constructor(bridge: Pick<PyodideBridge, "consumeMessages">) {
|
|
587
|
+
this.bridge = bridge;
|
|
588
|
+
}
|
|
580
589
|
|
|
581
590
|
private consumeMessages() {
|
|
582
591
|
this.bridge.consumeMessages((message) => {
|
package/src/core/wasm/store.ts
CHANGED
|
@@ -87,7 +87,10 @@ const emptyFileStore: FileStore = {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
export class CompositeFileStore implements FileStore {
|
|
90
|
-
|
|
90
|
+
private stores: FileStore[];
|
|
91
|
+
constructor(stores: FileStore[]) {
|
|
92
|
+
this.stores = stores;
|
|
93
|
+
}
|
|
91
94
|
|
|
92
95
|
insert(index: number, store: FileStore) {
|
|
93
96
|
this.stores.splice(index, 0, store);
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
export class MessageBuffer<T> {
|
|
8
8
|
private buffer: T[];
|
|
9
9
|
private started = false;
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
10
|
+
private onMessage: (data: T) => void;
|
|
11
|
+
constructor(onMessage: (data: T) => void) {
|
|
12
|
+
this.onMessage = onMessage;
|
|
12
13
|
this.buffer = [];
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -2,22 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
import type ReconnectingWebSocket from "partysocket/ws";
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
CONNECTING
|
|
7
|
-
OPEN
|
|
8
|
-
CLOSING
|
|
9
|
-
CLOSED
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
export const WebSocketState = {
|
|
6
|
+
CONNECTING: "CONNECTING",
|
|
7
|
+
OPEN: "OPEN",
|
|
8
|
+
CLOSING: "CLOSING",
|
|
9
|
+
CLOSED: "CLOSED",
|
|
10
|
+
} as const;
|
|
11
|
+
|
|
12
|
+
export type WebSocketState =
|
|
13
|
+
(typeof WebSocketState)[keyof typeof WebSocketState];
|
|
14
|
+
|
|
15
|
+
export const WebSocketClosedReason = {
|
|
16
|
+
KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
|
|
17
|
+
ALREADY_RUNNING: "ALREADY_RUNNING",
|
|
18
|
+
MALFORMED_QUERY: "MALFORMED_QUERY",
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
export type WebSocketClosedReason =
|
|
22
|
+
(typeof WebSocketClosedReason)[keyof typeof WebSocketClosedReason];
|
|
17
23
|
|
|
18
24
|
export type ConnectionStatus =
|
|
19
25
|
| {
|
|
20
|
-
state: WebSocketState.CLOSED;
|
|
26
|
+
state: typeof WebSocketState.CLOSED;
|
|
21
27
|
code: WebSocketClosedReason;
|
|
22
28
|
/**
|
|
23
29
|
* Human-readable reason for closing the connection.
|
|
@@ -31,9 +37,9 @@ export type ConnectionStatus =
|
|
|
31
37
|
}
|
|
32
38
|
| {
|
|
33
39
|
state:
|
|
34
|
-
| WebSocketState.CONNECTING
|
|
35
|
-
| WebSocketState.OPEN
|
|
36
|
-
| WebSocketState.CLOSING;
|
|
40
|
+
| typeof WebSocketState.CONNECTING
|
|
41
|
+
| typeof WebSocketState.OPEN
|
|
42
|
+
| typeof WebSocketState.CLOSING;
|
|
37
43
|
};
|
|
38
44
|
|
|
39
45
|
type PublicInterface<T> = {
|
|
@@ -32,6 +32,7 @@ import type { ConnectionName } from "../datasets/engines";
|
|
|
32
32
|
import {
|
|
33
33
|
PreviewSQLTable,
|
|
34
34
|
PreviewSQLTableList,
|
|
35
|
+
ValidateSQL,
|
|
35
36
|
} from "../datasets/request-registry";
|
|
36
37
|
import { useDatasetsActions } from "../datasets/state";
|
|
37
38
|
import { UI_ELEMENT_REGISTRY } from "../dom/uiregistry";
|
|
@@ -238,6 +239,9 @@ export function useMarimoWebSocket(opts: {
|
|
|
238
239
|
case "sql-table-list-preview":
|
|
239
240
|
PreviewSQLTableList.resolve(msg.data.request_id as RequestId, msg.data);
|
|
240
241
|
return;
|
|
242
|
+
case "validate-sql-result":
|
|
243
|
+
ValidateSQL.resolve(msg.data.request_id as RequestId, msg.data);
|
|
244
|
+
return;
|
|
241
245
|
case "secret-keys-result":
|
|
242
246
|
SECRETS_REGISTRY.resolve(msg.data.request_id as RequestId, msg.data);
|
|
243
247
|
return;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { useLocale } from "react-aria";
|
|
5
|
+
import { getShortTimeZone, prettyDate, timeAgo } from "@/utils/dates";
|
|
6
|
+
import {
|
|
7
|
+
prettyEngineeringNumber,
|
|
8
|
+
prettyNumber,
|
|
9
|
+
prettyScientificNumber,
|
|
10
|
+
} from "@/utils/numbers";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Hook that provides locale-aware number formatting using the prettyNumber utility
|
|
14
|
+
*/
|
|
15
|
+
export function usePrettyNumber() {
|
|
16
|
+
const { locale } = useLocale();
|
|
17
|
+
|
|
18
|
+
return useCallback(
|
|
19
|
+
(value: unknown): string => {
|
|
20
|
+
return prettyNumber(value, locale);
|
|
21
|
+
},
|
|
22
|
+
[locale],
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Hook that provides locale-aware scientific number formatting
|
|
28
|
+
*/
|
|
29
|
+
export function usePrettyScientificNumber() {
|
|
30
|
+
const { locale } = useLocale();
|
|
31
|
+
|
|
32
|
+
return useCallback(
|
|
33
|
+
(value: number, opts: { shouldRound?: boolean } = {}): string => {
|
|
34
|
+
return prettyScientificNumber(value, { ...opts, locale });
|
|
35
|
+
},
|
|
36
|
+
[locale],
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Hook that provides locale-aware engineering number formatting
|
|
42
|
+
*/
|
|
43
|
+
export function usePrettyEngineeringNumber() {
|
|
44
|
+
const { locale } = useLocale();
|
|
45
|
+
|
|
46
|
+
return useCallback(
|
|
47
|
+
(value: number): string => {
|
|
48
|
+
return prettyEngineeringNumber(value, locale);
|
|
49
|
+
},
|
|
50
|
+
[locale],
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Hook that provides locale-aware date formatting
|
|
56
|
+
*/
|
|
57
|
+
export function usePrettyDate() {
|
|
58
|
+
const { locale } = useLocale();
|
|
59
|
+
|
|
60
|
+
return useCallback(
|
|
61
|
+
(
|
|
62
|
+
value: string | number | null | undefined,
|
|
63
|
+
type: "date" | "datetime",
|
|
64
|
+
): string => {
|
|
65
|
+
return prettyDate(value, type, locale);
|
|
66
|
+
},
|
|
67
|
+
[locale],
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Hook that provides locale-aware relative time formatting
|
|
73
|
+
*/
|
|
74
|
+
export function useTimeAgo() {
|
|
75
|
+
const { locale } = useLocale();
|
|
76
|
+
|
|
77
|
+
return useCallback(
|
|
78
|
+
(value: string | number | null | undefined): string => {
|
|
79
|
+
return timeAgo(value, locale);
|
|
80
|
+
},
|
|
81
|
+
[locale],
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Hook that provides locale-aware timezone abbreviation
|
|
87
|
+
*/
|
|
88
|
+
export function useShortTimeZone() {
|
|
89
|
+
const { locale } = useLocale();
|
|
90
|
+
|
|
91
|
+
return useCallback(
|
|
92
|
+
(timezone: string): string => {
|
|
93
|
+
return getShortTimeZone(timezone, locale);
|
|
94
|
+
},
|
|
95
|
+
[locale],
|
|
96
|
+
);
|
|
97
|
+
}
|
package/src/hooks/useTimer.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { useNumberFormatter } from "react-aria";
|
|
4
5
|
import useEvent from "react-use-event-hook";
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -11,6 +12,12 @@ export function useTimer() {
|
|
|
11
12
|
const [time, setTime] = useState(0);
|
|
12
13
|
const interval = useRef<number>(undefined);
|
|
13
14
|
|
|
15
|
+
// one decimal place, exactly
|
|
16
|
+
const numberFormatter = useNumberFormatter({
|
|
17
|
+
minimumFractionDigits: 1,
|
|
18
|
+
maximumFractionDigits: 1,
|
|
19
|
+
});
|
|
20
|
+
|
|
14
21
|
const start = useEvent(() => {
|
|
15
22
|
interval.current = window.setInterval(() => {
|
|
16
23
|
setTime((time) => time + 0.1);
|
|
@@ -36,11 +43,7 @@ export function useTimer() {
|
|
|
36
43
|
}, []);
|
|
37
44
|
|
|
38
45
|
return {
|
|
39
|
-
|
|
40
|
-
time: new Intl.NumberFormat("en-US", {
|
|
41
|
-
minimumFractionDigits: 1,
|
|
42
|
-
maximumFractionDigits: 1,
|
|
43
|
-
}).format(time),
|
|
46
|
+
time: numberFormatter.format(time),
|
|
44
47
|
start,
|
|
45
48
|
stop,
|
|
46
49
|
clear,
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* component. The factory handles the logic of communicating UI element values
|
|
9
9
|
* to and from the rest of marimo.
|
|
10
10
|
*/
|
|
11
|
+
import { Provider } from "jotai";
|
|
11
12
|
import React, {
|
|
12
13
|
createRef,
|
|
13
14
|
type JSX,
|
|
@@ -23,12 +24,13 @@ import ReactDOM, { type Root } from "react-dom/client";
|
|
|
23
24
|
import useEvent from "react-use-event-hook";
|
|
24
25
|
import type { ZodSchema } from "zod";
|
|
25
26
|
import { notebookAtom } from "@/core/cells/cells.ts";
|
|
26
|
-
import {
|
|
27
|
+
import { HTMLCellId } from "@/core/cells/ids.ts";
|
|
27
28
|
import { isUninstantiated } from "@/core/cells/utils";
|
|
28
29
|
import { createInputEvent, MarimoValueUpdateEvent } from "@/core/dom/events";
|
|
29
30
|
import { getUIElementObjectId } from "@/core/dom/ui-element";
|
|
30
31
|
import { UIElementRegistry } from "@/core/dom/uiregistry";
|
|
31
32
|
import { FUNCTIONS_REGISTRY } from "@/core/functions/FunctionRegistry";
|
|
33
|
+
import { LocaleProvider } from "@/core/i18n/locale-provider";
|
|
32
34
|
import { store } from "@/core/state/jotai";
|
|
33
35
|
import {
|
|
34
36
|
type HTMLElementNotDerivedFromRef,
|
|
@@ -180,24 +182,28 @@ function PluginSlotInternal<T>(
|
|
|
180
182
|
const objectId = getUIElementObjectId(hostElement);
|
|
181
183
|
invariant(objectId, "Object ID should exist");
|
|
182
184
|
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
185
|
+
const htmlId = HTMLCellId.findElementThroughShadowDOMs(hostElement)?.id;
|
|
186
|
+
const cellId = htmlId ? HTMLCellId.parse(htmlId) : null;
|
|
187
|
+
if (cellId) {
|
|
188
|
+
// If the cell is not initialized, throw an error
|
|
189
|
+
const notebookState = store.get(notebookAtom);
|
|
190
|
+
const cellRuntime = notebookState.cellRuntime[cellId];
|
|
191
|
+
const cellData = notebookState.cellData[cellId];
|
|
192
|
+
|
|
193
|
+
const cellNotInitialized = isUninstantiated({
|
|
194
|
+
executionTime:
|
|
195
|
+
cellRuntime.runElapsedTimeMs ?? cellData.lastExecutionTime,
|
|
196
|
+
status: cellRuntime.status,
|
|
197
|
+
errored: cellRuntime.errored,
|
|
198
|
+
interrupted: cellRuntime.interrupted,
|
|
199
|
+
stopped: cellRuntime.stopped,
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
if (cellNotInitialized) {
|
|
203
|
+
throw new CellNotInitializedError();
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
Logger.warn(`Cell ID ${cellId} cannot be found`);
|
|
201
207
|
}
|
|
202
208
|
|
|
203
209
|
const response = await FUNCTIONS_REGISTRY.request({
|
|
@@ -363,16 +369,20 @@ export function registerReactComponent<T>(plugin: IPlugin<T, unknown>): void {
|
|
|
363
369
|
|
|
364
370
|
invariant(this.root, "Root must be defined");
|
|
365
371
|
this.root.render(
|
|
366
|
-
<
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
372
|
+
<Provider store={store}>
|
|
373
|
+
<LocaleProvider>
|
|
374
|
+
<PluginSlot
|
|
375
|
+
hostElement={this}
|
|
376
|
+
plugin={plugin}
|
|
377
|
+
ref={this.pluginRef}
|
|
378
|
+
getInitialValue={() => {
|
|
379
|
+
return parseInitialValue(this, UIElementRegistry.INSTANCE);
|
|
380
|
+
}}
|
|
381
|
+
>
|
|
382
|
+
{this.getChildren()}
|
|
383
|
+
</PluginSlot>
|
|
384
|
+
</LocaleProvider>
|
|
385
|
+
</Provider>,
|
|
376
386
|
);
|
|
377
387
|
}
|
|
378
388
|
|