@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
package/src/utils/id-tree.tsx
CHANGED
|
@@ -23,11 +23,15 @@ export type CellIndex = number & { __brand?: "CellIndex" };
|
|
|
23
23
|
* Tree data structure for handling ids with nested children
|
|
24
24
|
*/
|
|
25
25
|
export class TreeNode<T> {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
) {
|
|
26
|
+
public value: T;
|
|
27
|
+
public isCollapsed: boolean;
|
|
28
|
+
public children: Array<TreeNode<T>>;
|
|
29
|
+
|
|
30
|
+
constructor(value: T, isCollapsed: boolean, children: Array<TreeNode<T>>) {
|
|
31
|
+
this.value = value;
|
|
32
|
+
this.isCollapsed = isCollapsed;
|
|
33
|
+
this.children = children;
|
|
34
|
+
}
|
|
31
35
|
|
|
32
36
|
/**
|
|
33
37
|
* Recursively count the number of nodes in the tree
|
|
@@ -102,10 +106,13 @@ export class TreeNode<T> {
|
|
|
102
106
|
let uniqueId = 0;
|
|
103
107
|
|
|
104
108
|
export class CollapsibleTree<T> {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
) {
|
|
109
|
+
public readonly nodes: Array<TreeNode<T>>;
|
|
110
|
+
public readonly id: CellColumnId;
|
|
111
|
+
|
|
112
|
+
private constructor(nodes: Array<TreeNode<T>>, id: CellColumnId) {
|
|
113
|
+
this.nodes = nodes;
|
|
114
|
+
this.id = id;
|
|
115
|
+
}
|
|
109
116
|
|
|
110
117
|
static from<T>(ids: T[]): CollapsibleTree<T> {
|
|
111
118
|
const id = `tree_${uniqueId++}` as CellColumnId;
|
|
@@ -592,7 +599,11 @@ export class CollapsibleTree<T> {
|
|
|
592
599
|
}
|
|
593
600
|
|
|
594
601
|
export class MultiColumn<T> {
|
|
595
|
-
|
|
602
|
+
private readonly columns: ReadonlyArray<CollapsibleTree<T>>;
|
|
603
|
+
|
|
604
|
+
constructor(columns: ReadonlyArray<CollapsibleTree<T>>) {
|
|
605
|
+
this.columns = columns;
|
|
606
|
+
|
|
596
607
|
// Ensure there is always at least one column
|
|
597
608
|
if (columns.length === 0) {
|
|
598
609
|
this.columns = [CollapsibleTree.from([])];
|
|
@@ -12,7 +12,10 @@ interface Storage<T> {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export class TypedLocalStorage<T> implements Storage<T> {
|
|
15
|
-
|
|
15
|
+
private defaultValue: T;
|
|
16
|
+
constructor(defaultValue: T) {
|
|
17
|
+
this.defaultValue = defaultValue;
|
|
18
|
+
}
|
|
16
19
|
|
|
17
20
|
get(key: string): T {
|
|
18
21
|
try {
|
|
@@ -33,10 +36,16 @@ export class TypedLocalStorage<T> implements Storage<T> {
|
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
export class ZodLocalStorage<T> implements Storage<T> {
|
|
39
|
+
private schema: ZodType<T, ZodTypeDef, unknown>;
|
|
40
|
+
private getDefaultValue: () => T;
|
|
41
|
+
|
|
36
42
|
constructor(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
) {
|
|
43
|
+
schema: ZodType<T, ZodTypeDef, unknown>,
|
|
44
|
+
getDefaultValue: () => T,
|
|
45
|
+
) {
|
|
46
|
+
this.schema = schema;
|
|
47
|
+
this.getDefaultValue = getDefaultValue;
|
|
48
|
+
}
|
|
40
49
|
|
|
41
50
|
get(key: string): T {
|
|
42
51
|
try {
|
package/src/utils/numbers.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
-
export function prettyNumber(value: unknown): string {
|
|
3
|
+
export function prettyNumber(value: unknown, locale: string): string {
|
|
4
4
|
if (value === undefined || value === null) {
|
|
5
5
|
return "";
|
|
6
6
|
}
|
|
@@ -18,7 +18,7 @@ export function prettyNumber(value: unknown): string {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
if (typeof value === "number" || typeof value === "bigint") {
|
|
21
|
-
return value.toLocaleString(
|
|
21
|
+
return value.toLocaleString(locale, {
|
|
22
22
|
minimumFractionDigits: 0,
|
|
23
23
|
maximumFractionDigits: 2,
|
|
24
24
|
});
|
|
@@ -45,9 +45,9 @@ function scientificSpecialCase(value: number): string | null {
|
|
|
45
45
|
export function prettyScientificNumber(
|
|
46
46
|
value: number,
|
|
47
47
|
opts: {
|
|
48
|
-
// Default to false
|
|
49
|
-
|
|
50
|
-
}
|
|
48
|
+
shouldRound?: boolean; // Default to false
|
|
49
|
+
locale: string;
|
|
50
|
+
},
|
|
51
51
|
): string {
|
|
52
52
|
// Handle special cases first
|
|
53
53
|
const specialCase = scientificSpecialCase(value);
|
|
@@ -58,7 +58,7 @@ export function prettyScientificNumber(
|
|
|
58
58
|
// Determine if the number should be in scientific notation
|
|
59
59
|
const absValue = Math.abs(value);
|
|
60
60
|
if (absValue < 1e-2 || absValue >= 1e6) {
|
|
61
|
-
return new Intl.NumberFormat(
|
|
61
|
+
return new Intl.NumberFormat(opts.locale, {
|
|
62
62
|
minimumFractionDigits: 1,
|
|
63
63
|
maximumFractionDigits: 1,
|
|
64
64
|
notation: "scientific",
|
|
@@ -67,18 +67,18 @@ export function prettyScientificNumber(
|
|
|
67
67
|
.toLowerCase();
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
const { shouldRound } = opts;
|
|
70
|
+
const { shouldRound, locale } = opts;
|
|
71
71
|
|
|
72
72
|
if (shouldRound) {
|
|
73
73
|
// Number has an integer part, format with 2 decimal places
|
|
74
|
-
return new Intl.NumberFormat(
|
|
74
|
+
return new Intl.NumberFormat(locale, {
|
|
75
75
|
minimumFractionDigits: 0,
|
|
76
76
|
maximumFractionDigits: 2,
|
|
77
77
|
}).format(value);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// Don't round
|
|
81
|
-
return value.toLocaleString(
|
|
81
|
+
return value.toLocaleString(locale, {
|
|
82
82
|
minimumFractionDigits: 0,
|
|
83
83
|
maximumFractionDigits: 100,
|
|
84
84
|
});
|
|
@@ -104,14 +104,14 @@ const prefixes = {
|
|
|
104
104
|
"-24": "y",
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
-
export function prettyEngineeringNumber(value: number): string {
|
|
107
|
+
export function prettyEngineeringNumber(value: number, locale: string): string {
|
|
108
108
|
// Handle special cases first
|
|
109
109
|
const specialCase = scientificSpecialCase(value);
|
|
110
110
|
if (specialCase !== null) {
|
|
111
111
|
return specialCase;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
const [mant, exp] = new Intl.NumberFormat(
|
|
114
|
+
const [mant, exp] = new Intl.NumberFormat(locale, {
|
|
115
115
|
notation: "engineering",
|
|
116
116
|
maximumSignificantDigits: 3,
|
|
117
117
|
})
|
package/src/utils/once.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
+
import { arrayShallowEquals } from "./arrays";
|
|
4
|
+
|
|
3
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
6
|
export function once<T extends (...args: any[]) => any>(fn: T): T {
|
|
5
7
|
let result: ReturnType<T>;
|
|
@@ -15,3 +17,33 @@ export function once<T extends (...args: any[]) => any>(fn: T): T {
|
|
|
15
17
|
return result;
|
|
16
18
|
} as T;
|
|
17
19
|
}
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
export function memoizeLastValue<T extends (...args: any[]) => any>(fn: T): T {
|
|
23
|
+
let result: ReturnType<T>;
|
|
24
|
+
let lastArgs: Parameters<T> | undefined;
|
|
25
|
+
let lastError: unknown;
|
|
26
|
+
let hasError = false;
|
|
27
|
+
|
|
28
|
+
return function (
|
|
29
|
+
this: ThisParameterType<T>,
|
|
30
|
+
...args: Parameters<T>
|
|
31
|
+
): ReturnType<T> {
|
|
32
|
+
if (lastArgs === undefined || !arrayShallowEquals(args, lastArgs)) {
|
|
33
|
+
try {
|
|
34
|
+
result = fn.apply(this, args) as ReturnType<T>;
|
|
35
|
+
hasError = false;
|
|
36
|
+
lastError = undefined;
|
|
37
|
+
} catch (error) {
|
|
38
|
+
hasError = true;
|
|
39
|
+
lastError = error;
|
|
40
|
+
}
|
|
41
|
+
lastArgs = args;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (hasError) {
|
|
45
|
+
throw lastError;
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
} as T;
|
|
49
|
+
}
|
package/src/utils/paths.ts
CHANGED
|
@@ -32,7 +32,10 @@ export const Paths = {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export class PathBuilder {
|
|
35
|
-
|
|
35
|
+
public readonly deliminator: string;
|
|
36
|
+
constructor(deliminator: "/" | "\\") {
|
|
37
|
+
this.deliminator = deliminator;
|
|
38
|
+
}
|
|
36
39
|
|
|
37
40
|
static guessDeliminator(path: string): PathBuilder {
|
|
38
41
|
return path.includes("/") ? new PathBuilder("/") : new PathBuilder("\\");
|
package/src/utils/pluralize.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
export class PluralWord {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
) {
|
|
4
|
+
public singular: string;
|
|
5
|
+
public _plural?: string;
|
|
6
|
+
|
|
7
|
+
constructor(singular: string, _plural?: string) {
|
|
8
|
+
this.singular = singular;
|
|
9
|
+
this._plural = _plural;
|
|
10
|
+
}
|
|
8
11
|
|
|
9
12
|
public pluralize(count: number) {
|
|
10
13
|
return count === 1 ? this.singular : this.plural;
|
|
@@ -16,7 +19,11 @@ export class PluralWord {
|
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
export class PluralWords {
|
|
19
|
-
|
|
22
|
+
private words: PluralWord[];
|
|
23
|
+
|
|
24
|
+
constructor(words: PluralWord[]) {
|
|
25
|
+
this.words = words;
|
|
26
|
+
}
|
|
20
27
|
|
|
21
28
|
static of(...words: Array<PluralWord | string>) {
|
|
22
29
|
return new PluralWords(
|
|
@@ -25,7 +25,10 @@ function asString(value: string | PythonCode): string {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export class Variable implements PythonCode {
|
|
28
|
-
|
|
28
|
+
name: string;
|
|
29
|
+
constructor(name: string) {
|
|
30
|
+
this.name = name;
|
|
31
|
+
}
|
|
29
32
|
|
|
30
33
|
toCode(): string {
|
|
31
34
|
return this.name;
|
|
@@ -38,10 +41,12 @@ interface LiteralOptions {
|
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
export class Literal implements PythonCode {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
public readonly value: unknown;
|
|
45
|
+
public readonly opts: LiteralOptions;
|
|
46
|
+
constructor(value: unknown, opts: LiteralOptions = {}) {
|
|
47
|
+
this.value = value;
|
|
48
|
+
this.opts = opts;
|
|
49
|
+
}
|
|
45
50
|
|
|
46
51
|
static from(value: unknown, opts: LiteralOptions = {}): Literal {
|
|
47
52
|
return new Literal(value, opts);
|
|
@@ -114,10 +119,13 @@ export class Literal implements PythonCode {
|
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
export class VariableDeclaration implements PythonCode {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
) {
|
|
122
|
+
public name: string;
|
|
123
|
+
public value: string | PythonCode;
|
|
124
|
+
|
|
125
|
+
constructor(name: string, value: string | PythonCode) {
|
|
126
|
+
this.name = name;
|
|
127
|
+
this.value = value;
|
|
128
|
+
}
|
|
121
129
|
|
|
122
130
|
toCode(): string {
|
|
123
131
|
const right = asString(this.value);
|
|
@@ -129,10 +137,13 @@ export class VariableDeclaration implements PythonCode {
|
|
|
129
137
|
}
|
|
130
138
|
|
|
131
139
|
export class FunctionArg implements PythonCode {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
) {
|
|
140
|
+
public name: string;
|
|
141
|
+
public value: string | PythonCode;
|
|
142
|
+
|
|
143
|
+
constructor(name: string, value: string | PythonCode) {
|
|
144
|
+
this.name = name;
|
|
145
|
+
this.value = value;
|
|
146
|
+
}
|
|
136
147
|
|
|
137
148
|
toCode(): string {
|
|
138
149
|
return `${this.name}=${asString(this.value)}`;
|
|
@@ -141,12 +152,16 @@ export class FunctionArg implements PythonCode {
|
|
|
141
152
|
|
|
142
153
|
export class FunctionCall implements PythonCode {
|
|
143
154
|
private args: PythonCode[];
|
|
155
|
+
public name: string;
|
|
156
|
+
public multiLine: boolean;
|
|
144
157
|
|
|
145
158
|
constructor(
|
|
146
|
-
|
|
159
|
+
name: string,
|
|
147
160
|
args: PythonCode[] | Record<string, PythonCode>,
|
|
148
|
-
|
|
161
|
+
multiLine = false,
|
|
149
162
|
) {
|
|
163
|
+
this.name = name;
|
|
164
|
+
this.multiLine = multiLine;
|
|
150
165
|
this.args = objectToArgs(args);
|
|
151
166
|
}
|
|
152
167
|
|
package/src/utils/time.ts
CHANGED
|
@@ -5,6 +5,8 @@ export type Milliseconds = number & { __type__: "milliseconds" };
|
|
|
5
5
|
export type Seconds = number & { __type__: "seconds" };
|
|
6
6
|
|
|
7
7
|
export class Time {
|
|
8
|
+
private readonly ms: Milliseconds;
|
|
9
|
+
|
|
8
10
|
static fromMilliseconds(ms: Milliseconds): Time;
|
|
9
11
|
static fromMilliseconds(ms: Milliseconds | null): Time | null;
|
|
10
12
|
static fromMilliseconds(ms: Milliseconds | null): Time | null {
|
|
@@ -27,7 +29,9 @@ export class Time {
|
|
|
27
29
|
return new Time(Date.now() as Milliseconds);
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
private constructor(
|
|
32
|
+
private constructor(ms: Milliseconds) {
|
|
33
|
+
this.ms = ms;
|
|
34
|
+
}
|
|
31
35
|
|
|
32
36
|
toMilliseconds(): Milliseconds {
|
|
33
37
|
return this.ms;
|