@marimo-team/frontend 0.16.0-dev96986 → 0.16.0
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-BErMbWvG.js +19 -0
- package/dist/assets/{ImageComparisonComponent-SX7fDaTK.js → ImageComparisonComponent-fTHv1Ih0.js} +1 -1
- package/dist/assets/{VegaLite-MJUW3b7C.js → VegaLite-Bdi-TyfY.js} +1 -1
- package/dist/assets/_baseEach-CNBxBxvS.js +1 -0
- package/dist/assets/_baseMap-D1WHjKrd.js +1 -0
- package/dist/assets/_baseUniq-CCgDNtZb.js +1 -0
- package/dist/assets/{_createAggregator-ZRm2b6Zm.js → _createAggregator-DcD0kTA5.js} +1 -1
- package/dist/assets/{agent-panel-BBd11wNX.js → agent-panel-Crv430aI.js} +57 -76
- package/dist/assets/{any-language-editor-DwAaEQfS.js → any-language-editor-CQh552Wu.js} +1 -1
- package/dist/assets/{architectureDiagram-W76B3OCA-BJmVXUoW.js → architectureDiagram-W76B3OCA-BAJeBxzt.js} +1 -1
- package/dist/assets/{between-horizontal-start-KiwU-a3C.js → between-horizontal-start-Boxgxbt_.js} +1 -1
- package/dist/assets/{blockDiagram-QIGZ2CNN-DzxZjE7B.js → blockDiagram-QIGZ2CNN-CL-1svEK.js} +1 -1
- package/dist/assets/{c4Diagram-FPNF74CW-DjmldG_J.js → c4Diagram-FPNF74CW-BbEqbCTl.js} +1 -1
- package/dist/assets/channel-_2eNSz0n.js +1 -0
- package/dist/assets/chat-panel-CXh5Wl6C.js +3 -0
- package/dist/assets/{chunk-4BX2VUAB-EUTQThiZ.js → chunk-4BX2VUAB-C--8TXeE.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-DZAiDJxy.js → chunk-55IACEB6-Bj00HDqq.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-Bd0Czs-J.js → chunk-FMBD7UC4-C-lhB6hN.js} +1 -1
- package/dist/assets/{chunk-K7UQS3LO-DEKMIknX.js → chunk-K7UQS3LO-B-pGTXPt.js} +1 -1
- package/dist/assets/{chunk-QN33PNHL-E0jwHU_n.js → chunk-QN33PNHL-DqUzGhvm.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-BzaIHJbq.js → chunk-QZHKN3VN-TntJHfSk.js} +1 -1
- package/dist/assets/{chunk-TVAH2DTR-CZFYvqnm.js → chunk-TVAH2DTR-HUJb1psV.js} +1 -1
- package/dist/assets/{chunk-TZMSLE5B-BNqnFjtv.js → chunk-TZMSLE5B-BK3C__t3.js} +1 -1
- package/dist/assets/{circle-play-D3J_mYrF.js → circle-play-DBLOv1Yu.js} +1 -1
- package/dist/assets/classDiagram-KNZD7YFC-BGmh9POF.js +1 -0
- package/dist/assets/classDiagram-v2-RKCZMP56-BGmh9POF.js +1 -0
- package/dist/assets/{clear-button-ifzRuAR3.js → clear-button-BeoFbEKH.js} +1 -1
- package/dist/assets/clone-BFDSPAj3.js +1 -0
- package/dist/assets/{command-palette-D2fdVSET.js → command-palette-CXZiSv0I.js} +1 -1
- package/dist/assets/{common-Ku-cF_2J.js → common-C7oJcmCT.js} +1 -1
- package/dist/assets/{compile-BgZlHW1c.js → compile-7L0MwhyI.js} +1 -1
- package/dist/assets/{cose-bilkent-S5V4N54A-CVM83SqK.js → cose-bilkent-S5V4N54A-BMkGLcVC.js} +1 -1
- package/dist/assets/{dagre-5GWH7T2D-ouQPkxT3.js → dagre-5GWH7T2D-BJtRienS.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-B47j5GJJ.js → data-grid-overlay-editor-DBkmGtNs.js} +1 -1
- package/dist/assets/datasources-panel-B7FbYLiy.js +1 -0
- package/dist/assets/{dependency-graph-panel-CZC_B7pK.js → dependency-graph-panel-DEdOxp2X.js} +1 -1
- package/dist/assets/{diagram-N5W7TBWH-CQ817ZdR.js → diagram-N5W7TBWH-CmECY3nb.js} +1 -1
- package/dist/assets/{diagram-QEK2KX5R-DOK_psUO.js → diagram-QEK2KX5R-DMOVSNKD.js} +1 -1
- package/dist/assets/{diagram-S2PKOQOG-CVljmOW8.js → diagram-S2PKOQOG-BiJ96PNQ.js} +1 -1
- package/dist/assets/{documentation-panel-C7yIvGg1.js → documentation-panel-xULhaEv3.js} +1 -1
- package/dist/assets/edit-page-BrYda9VE.js +129 -0
- package/dist/assets/{ellipsis-vertical-C7FjlUsY.js → ellipsis-vertical-BBqXIlc2.js} +1 -1
- package/dist/assets/{empty-state-DIOGM_CU.js → empty-state-B3dA3G5P.js} +1 -1
- package/dist/assets/{erDiagram-AWTI2OKA-DYu8cEdc.js → erDiagram-AWTI2OKA-MP1DiFRo.js} +1 -1
- package/dist/assets/{error-panel-Ddb8RkFG.js → error-panel-Cc1sv-Ag.js} +1 -1
- package/dist/assets/file-explorer-panel-Bw59Kva1.js +1 -0
- package/dist/assets/{flowDiagram-PVAE7QVJ-CmvW5iTb.js → flowDiagram-PVAE7QVJ-BX7caPp7.js} +1 -1
- package/dist/assets/{ganttDiagram-OWAHRB6G-BaKQlCaT.js → ganttDiagram-OWAHRB6G-B462g4Yf.js} +4 -4
- package/dist/assets/{gitGraphDiagram-NY62KEGX-CWO24eP6.js → gitGraphDiagram-NY62KEGX-CGgvZ9-9.js} +1 -1
- package/dist/assets/{glide-data-editor-CNDLEJ9a.js → glide-data-editor-C0gUFZON.js} +11 -11
- package/dist/assets/{graph-BZKTtxsc.js → graph-CHRVBzY5.js} +1 -1
- package/dist/assets/home-page-Fb2osjys.js +9 -0
- package/dist/assets/{index-zrSUQXha.js → index-BVgAenPd.js} +1 -1
- package/dist/assets/{index-Brf2DwUM.js → index-BY93Ejhl.js} +1 -1
- package/dist/assets/{index-CerjupfZ.js → index-C-8WADat.js} +1 -1
- package/dist/assets/{index-DZhOPkOB.js → index-C-GhZ7ti.js} +1 -1
- package/dist/assets/{index-CZaurnA9.js → index-C1v_Z9et.js} +1 -1
- package/dist/assets/{index-0XOUPdwT.js → index-C4Tn5NvJ.js} +1 -1
- package/dist/assets/{index-B_d_JZGI.js → index-C77h_TXN.js} +1 -1
- package/dist/assets/{index-BJVyzkx5.js → index-CQDrxQ0j.js} +1 -1
- package/dist/assets/{index-DFrGFNW1.js → index-CWMgowgL.js} +1 -1
- package/dist/assets/{index-DmgwT3sx.js → index-Clbi_Yaq.js} +1 -1
- package/dist/assets/{index-D-tZfElD.js → index-CpTPJo4k.js} +1 -1
- package/dist/assets/index-Cx0bsY1w.css +1 -0
- package/dist/assets/{index-DkntzpX4.js → index-D1vmG6DS.js} +1 -1
- package/dist/assets/{index-D3PqGupX.js → index-D9UKkrr2.js} +1 -1
- package/dist/assets/{index-BgXbBA39.js → index-DEQvTChO.js} +1 -1
- package/dist/assets/index-DKEudB02.js +578 -0
- package/dist/assets/{index-DCkzth56.js → index-DRMm6SNo.js} +1 -1
- package/dist/assets/{index-WXJFkQHg.js → index-DoRmcrKM.js} +1 -1
- package/dist/assets/{index-qE8lHQ-N.js → index-lYa_leQE.js} +1 -1
- package/dist/assets/{index-CXrWwFX6.js → index-vmICa5KN.js} +1 -1
- package/dist/assets/{index-BH7f3aiU.js → index-z9bohSQJ.js} +1 -1
- package/dist/assets/infoDiagram-STP46IZ2-CVyrdLc8.js +2 -0
- package/dist/assets/{isEmpty-D1t7Gran.js → isEmpty-DU_ogP_D.js} +1 -1
- package/dist/assets/{journeyDiagram-BIP6EPQ6-D4Rp6H_h.js → journeyDiagram-BIP6EPQ6-C6EgLP_Q.js} +1 -1
- package/dist/assets/{kanban-definition-6OIFK2YF-DFt9DftA.js → kanban-definition-6OIFK2YF-BXzYO1yj.js} +1 -1
- package/dist/assets/{layout-D8WXi2_g.js → layout-jihVw5-i.js} +1 -1
- package/dist/assets/{linear-BwY8e5hA.js → linear-C4blANlC.js} +1 -1
- package/dist/assets/links-D59GIweI.js +7 -0
- package/dist/assets/{logs-panel-Dxiyt7dO.js → logs-panel-D401qzZh.js} +1 -1
- package/dist/assets/{markdown-renderer-VDu-NBKB.js → markdown-renderer-Cd9eYyaL.js} +20 -20
- package/dist/assets/{mermaid-B-O-Puyi.js → mermaid-BEVuRz_O.js} +1 -1
- package/dist/assets/{mermaid.core-BFFCqfOn.js → mermaid.core-CaSnaLH0.js} +4 -4
- package/dist/assets/min-DUMu_zeK.js +1 -0
- package/dist/assets/{mindmap-definition-Q6HEUPPD-kyvIY8Dg.js → mindmap-definition-Q6HEUPPD-BXUM5MT2.js} +1 -1
- package/dist/assets/{number-overlay-editor-GjLB2UK4.js → number-overlay-editor-4uWXGlPG.js} +1 -1
- package/dist/assets/outline-panel-DIzkvm2I.js +1 -0
- package/dist/assets/{packages-panel-nfXB-bKW.js → packages-panel-CJL0MVlj.js} +1 -1
- package/dist/assets/{pieDiagram-ADFJNKIX-D8JFQcWR.js → pieDiagram-ADFJNKIX-Dxt5PVNo.js} +1 -1
- package/dist/assets/{quadrantDiagram-LMRXKWRM-Nf8GzxXG.js → quadrantDiagram-LMRXKWRM-D4pUaA31.js} +1 -1
- package/dist/assets/{react-plotly-CnW9p7ZA.js → react-plotly-cJZ0VWBq.js} +1 -1
- package/dist/assets/{requirementDiagram-4UW4RH46-CCUxF8BZ.js → requirementDiagram-4UW4RH46-DVRTjgas.js} +1 -1
- package/dist/assets/{run-page-Bl4p3AbZ.js → run-page-BUEnMC9w.js} +1 -1
- package/dist/assets/{sankeyDiagram-GR3RE2ED-Sr8kDwP1.js → sankeyDiagram-GR3RE2ED-CVFnD9C-.js} +1 -1
- package/dist/assets/{scratchpad-panel-Ja1Mu-W3.js → scratchpad-panel-BIgRENkI.js} +1 -1
- package/dist/assets/{secrets-panel-B-3fcSyP.js → secrets-panel-xY5-V_BD.js} +1 -1
- package/dist/assets/{sequenceDiagram-C3RYC4MD-CBJ152Q3.js → sequenceDiagram-C3RYC4MD-_lY4ZN_S.js} +1 -1
- package/dist/assets/{slides-component-C-LoGC1U.css → slides-component-DMjQomc3.css} +1 -1
- package/dist/assets/{slides-component-DGtsVP5o.js → slides-component-Xjymwj7X.js} +1 -1
- package/dist/assets/snippets-panel-CTPYW41n.js +1 -0
- package/dist/assets/sortBy-BNZKwiq_.js +1 -0
- package/dist/assets/{state-B_RCHTH5.js → state-C4NiC9tO.js} +1 -1
- package/dist/assets/{stateDiagram-KXAO66HF-BlBFSAZr.js → stateDiagram-KXAO66HF-Da0JQWCn.js} +1 -1
- package/dist/assets/stateDiagram-v2-UMBNRL4Z-D5lYZOOt.js +1 -0
- package/dist/assets/storage-CMdLzB_c.js +26 -0
- package/dist/assets/{terminal-CATzv5Hd.js → terminal-BPwTkXae.js} +1 -1
- package/dist/assets/{time-CsYqILfB.js → time-Dv5_Ouz_.js} +1 -1
- package/dist/assets/{timeline-definition-XQNQX7LJ-CGrhjuAs.js → timeline-definition-XQNQX7LJ-Dxh5Zu2e.js} +1 -1
- package/dist/assets/tracing-BCIurUfa.js +2 -0
- package/dist/assets/{tracing-panel-DmzqPUtc.js → tracing-panel-DAzrzNmm.js} +2 -2
- package/dist/assets/{trash-rxdjLzkf.js → trash-Dc6DSjz_.js} +1 -1
- package/dist/assets/{tree-C2Ul1h1C.js → tree-jheoerAX.js} +1 -1
- package/dist/assets/{treemap-75Q7IDZK-N9hyUpyj.js → treemap-75Q7IDZK-IgpxeGaf.js} +27 -27
- package/dist/assets/variable-panel-DYAiLBmF.js +1 -0
- package/dist/assets/{vega-component-CR_MHOBT.js → vega-component-BpfpiPKI.js} +1 -1
- package/dist/assets/worker-X5rxzQGQ.js +1 -0
- package/dist/assets/{xychartDiagram-6GGTOJPD-jdLZsMb2.js → xychartDiagram-6GGTOJPD-CmNigJ31.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +2 -3
- package/src/components/app-config/user-config-form.tsx +1 -46
- package/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap +43 -62
- 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 +27 -24
- package/src/components/chat/acp/blocks.tsx +6 -6
- package/src/components/chat/acp/prompt.ts +43 -62
- package/src/components/chat/chat-panel.tsx +1 -5
- package/src/components/chat/markdown-renderer.tsx +10 -6
- package/src/components/chat/tool-call-accordion.tsx +20 -52
- package/src/components/data-table/SearchBar.tsx +7 -8
- package/src/components/data-table/__tests__/column_formatting.test.ts +35 -50
- package/src/components/data-table/__tests__/data-table.test.tsx +1 -39
- package/src/components/data-table/charts/components/form-fields.tsx +37 -41
- package/src/components/data-table/charts/forms/common-chart.tsx +2 -2
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +2 -5
- package/src/components/data-table/column-formatting/feature.ts +29 -62
- package/src/components/data-table/column-formatting/types.ts +0 -1
- package/src/components/data-table/column-header.tsx +1 -3
- package/src/components/data-table/column-summary/chart-spec-model.tsx +7 -24
- package/src/components/data-table/column-summary/column-summary.tsx +9 -18
- package/src/components/data-table/columns.tsx +18 -42
- package/src/components/data-table/data-table.tsx +2 -10
- package/src/components/data-table/date-popover.tsx +75 -85
- package/src/components/data-table/filter-pills.tsx +9 -14
- package/src/components/data-table/header-items.tsx +1 -5
- package/src/components/data-table/pagination.tsx +13 -20
- package/src/components/data-table/renderers.tsx +0 -28
- package/src/components/data-table/row-viewer-panel/row-viewer.tsx +8 -10
- package/src/components/datasources/column-preview.tsx +2 -6
- package/src/components/datasources/datasources.tsx +12 -8
- package/src/components/editor/ai/transport/chat-transport.tsx +1 -4
- package/src/components/editor/cell/CellStatus.tsx +20 -23
- package/src/components/editor/cell/CreateCellButton.tsx +4 -3
- package/src/components/editor/cell/code/language-toggle.tsx +4 -3
- package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +28 -39
- package/src/components/editor/controls/notebook-menu-dropdown.tsx +2 -4
- package/src/components/editor/file-tree/requesting-tree.tsx +8 -14
- package/src/components/editor/renderers/CellArray.tsx +4 -3
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +3 -3
- package/src/components/editor/renderers/slides-layout/types.ts +0 -1
- package/src/components/pages/home-page.tsx +1 -4
- package/src/components/slides/slides-component.tsx +1 -1
- package/src/components/slides/slides.css +0 -6
- package/src/components/terminal/theme.tsx +0 -1
- package/src/components/tracing/tracing-spec.ts +4 -5
- package/src/components/ui/range-slider.tsx +2 -4
- package/src/components/ui/slider.tsx +1 -3
- package/src/components/variables/variables-table.tsx +0 -3
- package/src/core/MarimoApp.tsx +6 -9
- package/src/core/ai/context/__tests__/registry.test.ts +4 -6
- package/src/core/ai/context/providers/cell-output.ts +2 -3
- package/src/core/ai/context/providers/error.ts +1 -3
- package/src/core/ai/context/providers/file.ts +2 -7
- package/src/core/ai/context/providers/tables.ts +2 -3
- package/src/core/ai/context/providers/variable.ts +4 -6
- package/src/core/cells/logs.ts +1 -1
- package/src/core/codemirror/find-replace/search-highlight.ts +1 -3
- package/src/core/codemirror/language/LanguageAdapters.ts +3 -9
- package/src/core/codemirror/lsp/notebook-lsp.ts +2 -8
- package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
- package/src/core/codemirror/rtc/loro/awareness.ts +17 -52
- package/src/core/codemirror/rtc/loro/sync.ts +4 -12
- package/src/core/config/config-schema.ts +0 -1
- package/src/core/config/config.ts +0 -4
- package/src/core/hotkeys/hotkeys.ts +4 -8
- package/src/core/islands/components/web-components.tsx +10 -13
- package/src/core/kernel/RuntimeState.ts +1 -4
- package/src/core/kernel/messages.ts +2 -2
- package/src/core/network/DeferredRequestRegistry.ts +4 -16
- package/src/core/runtime/runtime.ts +4 -5
- package/src/core/wasm/bridge.ts +1 -5
- package/src/core/wasm/store.ts +1 -4
- package/src/core/wasm/worker/message-buffer.ts +2 -3
- package/src/core/websocket/types.ts +16 -22
- package/src/hooks/useTimer.ts +5 -8
- package/src/plugins/core/registerReactComponent.tsx +10 -16
- package/src/plugins/impl/DataTablePlugin.tsx +0 -4
- package/src/plugins/impl/RangeSliderPlugin.tsx +3 -5
- package/src/plugins/impl/SliderPlugin.tsx +1 -3
- package/src/plugins/impl/anywidget/model.ts +5 -16
- package/src/plugins/impl/data-editor/types.ts +5 -7
- package/src/plugins/impl/data-explorer/components/column-summary.tsx +13 -20
- package/src/plugins/impl/panel/utils.ts +4 -6
- package/src/plugins/layout/StatPlugin.tsx +1 -4
- package/src/plugins/plugins.ts +0 -2
- package/src/utils/__tests__/dates.test.ts +24 -45
- package/src/utils/__tests__/numbers.test.ts +30 -42
- package/src/utils/dates.ts +10 -15
- package/src/utils/edit-distance.ts +6 -8
- package/src/utils/errors.ts +1 -1
- package/src/utils/id-tree.tsx +10 -21
- package/src/utils/localStorage.ts +4 -13
- package/src/utils/numbers.ts +11 -11
- package/src/utils/once.ts +0 -32
- package/src/utils/paths.ts +1 -4
- package/src/utils/pluralize.ts +5 -12
- package/src/utils/python-poet/poet.ts +15 -30
- package/src/utils/time.ts +1 -5
- package/dist/assets/ConnectedDataExplorerComponent-CNLoZkWr.js +0 -19
- package/dist/assets/_baseEach-9_logFrf.js +0 -1
- package/dist/assets/_baseMap-NzEbKt5c.js +0 -1
- package/dist/assets/_baseUniq-C5LFcyNC.js +0 -1
- package/dist/assets/channel-DHcKBVM4.js +0 -1
- package/dist/assets/chat-panel-DgJZr0eS.js +0 -3
- package/dist/assets/classDiagram-KNZD7YFC-D-xwLnlX.js +0 -1
- package/dist/assets/classDiagram-v2-RKCZMP56-D-xwLnlX.js +0 -1
- package/dist/assets/clone-CSxIll62.js +0 -1
- package/dist/assets/datasources-panel-Bt41Zir-.js +0 -1
- package/dist/assets/edit-page-CyTMQV2u.js +0 -129
- package/dist/assets/file-explorer-panel-Oy9DbyFP.js +0 -1
- package/dist/assets/home-page-Bvwppn9N.js +0 -9
- package/dist/assets/index-DadI618h.css +0 -1
- package/dist/assets/index-PmY0x4Zd.js +0 -578
- package/dist/assets/infoDiagram-STP46IZ2-CAuVVehw.js +0 -2
- package/dist/assets/links-4B6ldZ5P.js +0 -7
- package/dist/assets/min-DtVSfYKl.js +0 -1
- package/dist/assets/outline-panel-CMJjOoN7.js +0 -1
- package/dist/assets/snippets-panel-ClNnwKBM.js +0 -1
- package/dist/assets/sortBy-D47H6Vyl.js +0 -1
- package/dist/assets/stateDiagram-v2-UMBNRL4Z-DbA-iToo.js +0 -1
- package/dist/assets/storage-BNcWOH3-.js +0 -26
- package/dist/assets/tracing-DUbJtOyq.js +0 -2
- package/dist/assets/variable-panel-BbgupOdG.js +0 -1
- package/dist/assets/worker-fHbtoWvT.js +0 -1
- package/src/components/data-table/cell-hover-template/feature.ts +0 -14
- package/src/components/data-table/cell-hover-template/types.ts +0 -11
- package/src/core/i18n/__tests__/locale-provider.test.tsx +0 -176
- package/src/core/i18n/locale-provider.tsx +0 -35
- package/src/core/i18n/with-locale.tsx +0 -12
- package/src/hooks/useFormatting.ts +0 -97
- package/src/plugins/layout/OutlinePlugin.tsx +0 -69
- package/src/utils/__tests__/once.test.ts +0 -187
|
@@ -52,7 +52,7 @@ export function getAgentPrompt(filename: string) {
|
|
|
52
52
|
## Best Practices
|
|
53
53
|
|
|
54
54
|
<data_handling>
|
|
55
|
-
- Use
|
|
55
|
+
- Use pandas for data manipulation
|
|
56
56
|
- Implement proper data validation
|
|
57
57
|
- Handle missing values appropriately
|
|
58
58
|
- Use efficient data structures
|
|
@@ -62,7 +62,7 @@ export function getAgentPrompt(filename: string) {
|
|
|
62
62
|
<visualization>
|
|
63
63
|
- For matplotlib: use plt.gca() as the last expression instead of plt.show()
|
|
64
64
|
- For plotly: return the figure object directly
|
|
65
|
-
- For altair: return the chart object directly
|
|
65
|
+
- For altair: return the chart object directly
|
|
66
66
|
- Include proper labels, titles, and color schemes
|
|
67
67
|
- Make visualizations interactive where appropriate
|
|
68
68
|
</visualization>
|
|
@@ -76,7 +76,7 @@ export function getAgentPrompt(filename: string) {
|
|
|
76
76
|
</ui_elements>
|
|
77
77
|
|
|
78
78
|
<sql>
|
|
79
|
-
- When writing duckdb, prefer using marimo's SQL cells, which start with
|
|
79
|
+
- When writing duckdb, prefer using marimo's SQL cells, which start with _df = mo.sql(query)
|
|
80
80
|
- See the SQL with duckdb example for an example on how to do this
|
|
81
81
|
- Don't add comments in cells that use mo.sql()
|
|
82
82
|
- Consider using \`vega_datasets\` for common example datasets
|
|
@@ -144,8 +144,7 @@ export function getAgentPrompt(filename: string) {
|
|
|
144
144
|
${formatCells([
|
|
145
145
|
`
|
|
146
146
|
import marimo as mo
|
|
147
|
-
import
|
|
148
|
-
import polars as pl
|
|
147
|
+
import matplotlib.pyplot as plt
|
|
149
148
|
import numpy as np
|
|
150
149
|
`,
|
|
151
150
|
`
|
|
@@ -156,18 +155,12 @@ export function getAgentPrompt(filename: string) {
|
|
|
156
155
|
x = np.random.rand(n_points.value)
|
|
157
156
|
y = np.random.rand(n_points.value)
|
|
158
157
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
title=f"Scatter plot with {n_points.value} points",
|
|
166
|
-
width=400,
|
|
167
|
-
height=300
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
chart
|
|
158
|
+
plt.figure(figsize=(8, 6))
|
|
159
|
+
plt.scatter(x, y, alpha=0.7)
|
|
160
|
+
plt.title(f"Scatter plot with {n_points.value} points")
|
|
161
|
+
plt.xlabel("X axis")
|
|
162
|
+
plt.ylabel("Y axis")
|
|
163
|
+
plt.gca()
|
|
171
164
|
`,
|
|
172
165
|
])}
|
|
173
166
|
</example>
|
|
@@ -176,11 +169,11 @@ export function getAgentPrompt(filename: string) {
|
|
|
176
169
|
${formatCells([
|
|
177
170
|
`
|
|
178
171
|
import marimo as mo
|
|
179
|
-
import
|
|
172
|
+
import pandas as pd
|
|
180
173
|
from vega_datasets import data
|
|
181
174
|
`,
|
|
182
175
|
`
|
|
183
|
-
cars_df =
|
|
176
|
+
cars_df = data.cars()
|
|
184
177
|
mo.ui.data_explorer(cars_df)
|
|
185
178
|
`,
|
|
186
179
|
])}
|
|
@@ -190,44 +183,43 @@ export function getAgentPrompt(filename: string) {
|
|
|
190
183
|
${formatCells([
|
|
191
184
|
`
|
|
192
185
|
import marimo as mo
|
|
193
|
-
import
|
|
194
|
-
import
|
|
186
|
+
import pandas as pd
|
|
187
|
+
import matplotlib.pyplot as plt
|
|
188
|
+
import seaborn as sns
|
|
195
189
|
`,
|
|
196
190
|
`
|
|
197
|
-
iris =
|
|
191
|
+
iris = sns.load_dataset('iris')
|
|
198
192
|
`,
|
|
199
193
|
`
|
|
200
194
|
species_selector = mo.ui.dropdown(
|
|
201
|
-
options=["All"] + iris["
|
|
195
|
+
options=["All"] + iris["species"].unique().tolist(),
|
|
202
196
|
value="All",
|
|
203
|
-
label="Species"
|
|
197
|
+
label="Species"
|
|
204
198
|
)
|
|
205
199
|
x_feature = mo.ui.dropdown(
|
|
206
|
-
options=iris.
|
|
207
|
-
value="
|
|
208
|
-
label="X Feature"
|
|
200
|
+
options=iris.select_dtypes('number').columns.tolist(),
|
|
201
|
+
value="sepal_length",
|
|
202
|
+
label="X Feature"
|
|
209
203
|
)
|
|
210
204
|
y_feature = mo.ui.dropdown(
|
|
211
|
-
options=iris.
|
|
212
|
-
value="
|
|
213
|
-
label="Y Feature"
|
|
205
|
+
options=iris.select_dtypes('number').columns.tolist(),
|
|
206
|
+
value="sepal_width",
|
|
207
|
+
label="Y Feature"
|
|
214
208
|
)
|
|
215
209
|
mo.hstack([species_selector, x_feature, y_feature])
|
|
216
210
|
`,
|
|
217
211
|
`
|
|
218
|
-
filtered_data = iris if species_selector.value == "All" else iris
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
width=500,
|
|
227
|
-
height=400
|
|
212
|
+
filtered_data = iris if species_selector.value == "All" else iris[iris["species"] == species_selector.value]
|
|
213
|
+
|
|
214
|
+
plt.figure(figsize=(10, 6))
|
|
215
|
+
sns.scatterplot(
|
|
216
|
+
data=filtered_data,
|
|
217
|
+
x=x_feature.value,
|
|
218
|
+
y=y_feature.value,
|
|
219
|
+
hue="species"
|
|
228
220
|
)
|
|
229
|
-
|
|
230
|
-
|
|
221
|
+
plt.title(f"{y_feature.value} vs {x_feature.value}")
|
|
222
|
+
plt.gca()
|
|
231
223
|
`,
|
|
232
224
|
])}
|
|
233
225
|
</example>
|
|
@@ -250,21 +242,14 @@ export function getAgentPrompt(filename: string) {
|
|
|
250
242
|
`
|
|
251
243
|
import marimo as mo
|
|
252
244
|
import altair as alt
|
|
253
|
-
import
|
|
245
|
+
import pandas as pd
|
|
254
246
|
`,
|
|
255
247
|
`# Load dataset
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
alt.Chart(weather_dates)
|
|
262
|
-
.mark_point()
|
|
263
|
-
.encode(
|
|
264
|
-
x="date:T",
|
|
265
|
-
y="temp_max",
|
|
266
|
-
color="location",
|
|
267
|
-
)
|
|
248
|
+
cars_df = pd.read_csv('<https://raw.githubusercontent.com/vega/vega-datasets/master/data/cars.json>')
|
|
249
|
+
_chart = alt.Chart(cars_df).mark_point().encode(
|
|
250
|
+
x='Horsepower',
|
|
251
|
+
y='Miles_per_Gallon',
|
|
252
|
+
color='Origin',
|
|
268
253
|
)
|
|
269
254
|
`,
|
|
270
255
|
"chart = mo.ui.altair_chart(_chart)\nchart",
|
|
@@ -293,13 +278,9 @@ export function getAgentPrompt(filename: string) {
|
|
|
293
278
|
|
|
294
279
|
<example title="SQL with duckdb">
|
|
295
280
|
${formatCells([
|
|
296
|
-
"import marimo as mo\
|
|
297
|
-
`
|
|
298
|
-
`
|
|
299
|
-
f"""
|
|
300
|
-
SELECT * FROM weather WHERE location = 'Seattle';
|
|
301
|
-
"""
|
|
302
|
-
)`,
|
|
281
|
+
"import marimo as mo\nimport pandas as pd",
|
|
282
|
+
`cars_df = pd.read_csv('<https://raw.githubusercontent.com/vega/vega-datasets/master/data/cars.json>')`,
|
|
283
|
+
`_df = mo.sql("SELECT * from cars_df WHERE Miles_per_Gallon > 20")`,
|
|
303
284
|
])}
|
|
304
285
|
</example>`;
|
|
305
286
|
}
|
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
SquareIcon,
|
|
19
19
|
} from "lucide-react";
|
|
20
20
|
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
21
|
-
import { useLocale } from "react-aria";
|
|
22
21
|
import useEvent from "react-use-event-hook";
|
|
23
22
|
import { Button } from "@/components/ui/button";
|
|
24
23
|
import {
|
|
@@ -104,7 +103,6 @@ const ChatHeader: React.FC<ChatHeaderProps> = ({
|
|
|
104
103
|
}) => {
|
|
105
104
|
const { handleClick } = useOpenSettingsToTab();
|
|
106
105
|
const chatState = useAtomValue(chatStateAtom);
|
|
107
|
-
const { locale } = useLocale();
|
|
108
106
|
const chats = useMemo(() => {
|
|
109
107
|
return [...chatState.chats.values()].sort(
|
|
110
108
|
(a, b) => b.updatedAt - a.updatedAt,
|
|
@@ -161,7 +159,7 @@ const ChatHeader: React.FC<ChatHeaderProps> = ({
|
|
|
161
159
|
>
|
|
162
160
|
<div className="font-medium">{chat.title}</div>
|
|
163
161
|
<div className="text-sm text-muted-foreground">
|
|
164
|
-
{timeAgo(chat.updatedAt
|
|
162
|
+
{timeAgo(chat.updatedAt)}
|
|
165
163
|
</div>
|
|
166
164
|
</button>
|
|
167
165
|
))}
|
|
@@ -238,7 +236,6 @@ const ChatMessageDisplay: React.FC<ChatMessageProps> = memo(
|
|
|
238
236
|
result={part.output}
|
|
239
237
|
className="my-2"
|
|
240
238
|
state={part.state}
|
|
241
|
-
input={part.input}
|
|
242
239
|
/>
|
|
243
240
|
);
|
|
244
241
|
}
|
|
@@ -270,7 +267,6 @@ const ChatMessageDisplay: React.FC<ChatMessageProps> = memo(
|
|
|
270
267
|
toolName={part.type}
|
|
271
268
|
result={part.output}
|
|
272
269
|
state={part.state}
|
|
273
|
-
input={part.input}
|
|
274
270
|
className="my-2"
|
|
275
271
|
/>
|
|
276
272
|
);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { EditorView } from "@codemirror/view";
|
|
4
4
|
import { useAtomValue } from "jotai";
|
|
5
5
|
import { BetweenHorizontalStartIcon } from "lucide-react";
|
|
6
|
-
import { memo, Suspense, useState } from "react";
|
|
6
|
+
import { memo, Suspense, useEffect, useState } from "react";
|
|
7
7
|
import { Streamdown, type StreamdownProps } from "streamdown";
|
|
8
8
|
import { Button, type ButtonProps } from "@/components/ui/button";
|
|
9
9
|
import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
|
|
@@ -114,9 +114,9 @@ const CodeBlock = ({ code, language }: CodeBlockProps) => {
|
|
|
114
114
|
const { theme } = useTheme();
|
|
115
115
|
const [value, setValue] = useState(code);
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
useEffect(() => {
|
|
118
118
|
setValue(code);
|
|
119
|
-
}
|
|
119
|
+
}, [code]);
|
|
120
120
|
|
|
121
121
|
const handleCopyCode = async () => {
|
|
122
122
|
await copyToClipboard(value);
|
|
@@ -150,13 +150,18 @@ const CodeBlock = ({ code, language }: CodeBlockProps) => {
|
|
|
150
150
|
const CopyButton: React.FC<ButtonProps> = ({ onClick, ...props }) => {
|
|
151
151
|
const [copied, setCopied] = useState(false);
|
|
152
152
|
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
if (copied) {
|
|
155
|
+
setTimeout(() => setCopied(false), 1000);
|
|
156
|
+
}
|
|
157
|
+
}, [copied]);
|
|
158
|
+
|
|
153
159
|
return (
|
|
154
160
|
<Button
|
|
155
161
|
{...props}
|
|
156
162
|
onClick={(e) => {
|
|
157
163
|
onClick?.(e);
|
|
158
164
|
setCopied(true);
|
|
159
|
-
setTimeout(() => setCopied(false), 1000);
|
|
160
165
|
}}
|
|
161
166
|
>
|
|
162
167
|
{copied ? "Copied" : "Copy"}
|
|
@@ -170,11 +175,10 @@ const COMPONENTS: Components = {
|
|
|
170
175
|
code: ({ children, className }) => {
|
|
171
176
|
const language = className?.replace("language-", "");
|
|
172
177
|
if (language && typeof children === "string") {
|
|
173
|
-
const code = children.trim();
|
|
174
178
|
return (
|
|
175
179
|
<div>
|
|
176
180
|
<div className="text-xs text-muted-foreground pl-1">{language}</div>
|
|
177
|
-
<CodeBlock code={
|
|
181
|
+
<CodeBlock code={children.trim()} language={language} />
|
|
178
182
|
</div>
|
|
179
183
|
);
|
|
180
184
|
}
|
|
@@ -45,21 +45,17 @@ const PrettySuccessResult: React.FC<{ data: SuccessResult }> = ({ data }) => {
|
|
|
45
45
|
} = data;
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
<div className="flex flex-col gap-1
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
<div className="py-1 flex flex-col gap-1">
|
|
49
|
+
{/* Status */}
|
|
50
|
+
<div className="flex items-center gap-2">
|
|
51
|
+
<span className="text-xs font-medium text-[var(--grass-11)] capitalize">
|
|
52
|
+
{status}
|
|
53
|
+
</span>
|
|
54
|
+
{auth_required && (
|
|
55
|
+
<span className="text-xs px-2 py-0.5 bg-[var(--amber-2)] text-[var(--amber-11)] rounded-full">
|
|
56
|
+
Auth Required
|
|
56
57
|
</span>
|
|
57
|
-
|
|
58
|
-
<span className="text-xs px-2 py-0.5 bg-[var(--amber-2)] text-[var(--amber-11)] rounded-full">
|
|
59
|
-
Auth Required
|
|
60
|
-
</span>
|
|
61
|
-
)}
|
|
62
|
-
</div>
|
|
58
|
+
)}
|
|
63
59
|
</div>
|
|
64
60
|
|
|
65
61
|
{/* Message */}
|
|
@@ -72,18 +68,17 @@ const PrettySuccessResult: React.FC<{ data: SuccessResult }> = ({ data }) => {
|
|
|
72
68
|
|
|
73
69
|
{/* Data */}
|
|
74
70
|
{rest && (
|
|
75
|
-
<div className="
|
|
71
|
+
<div className="flex flex-col gap-1">
|
|
76
72
|
{Object.entries(rest).map(([key, value]) => {
|
|
77
73
|
if (isEmpty(value)) {
|
|
78
74
|
return null;
|
|
79
75
|
}
|
|
80
76
|
return (
|
|
81
|
-
<div key={key}
|
|
82
|
-
<div className="text-xs font-medium text-muted-foreground
|
|
83
|
-
|
|
84
|
-
{key}
|
|
77
|
+
<div key={key}>
|
|
78
|
+
<div className="text-xs font-medium text-muted-foreground mb-1 capitalize">
|
|
79
|
+
{key}:
|
|
85
80
|
</div>
|
|
86
|
-
<pre className="bg-[var(--slate-2)] p-
|
|
81
|
+
<pre className="bg-[var(--slate-2)] p-1 text-muted-foreground border border-[var(--slate-4)] rounded text-xs overflow-auto scrollbar-thin max-h-64">
|
|
87
82
|
{JSON.stringify(value, null, 2)}
|
|
88
83
|
</pre>
|
|
89
84
|
</div>
|
|
@@ -112,29 +107,6 @@ const ResultRenderer: React.FC<{ result: unknown }> = ({ result }) => {
|
|
|
112
107
|
);
|
|
113
108
|
};
|
|
114
109
|
|
|
115
|
-
const ToolArgsRenderer: React.FC<{ input: unknown }> = ({ input }) => {
|
|
116
|
-
const hasinput = input && input !== null;
|
|
117
|
-
|
|
118
|
-
if (!hasinput) {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const isObject =
|
|
123
|
-
typeof input === "object" &&
|
|
124
|
-
Object.keys(input as Record<string, unknown>).length > 0;
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<div className="space-y-2">
|
|
128
|
-
<h3 className="text-xs font-semibold text-muted-foreground">
|
|
129
|
-
Tool Request
|
|
130
|
-
</h3>
|
|
131
|
-
<pre className="bg-[var(--slate-2)] p-2 text-muted-foreground border border-[var(--slate-4)] rounded text-xs overflow-auto scrollbar-thin max-h-64">
|
|
132
|
-
{isObject ? JSON.stringify(input, null, 2) : String(input)}
|
|
133
|
-
</pre>
|
|
134
|
-
</div>
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
110
|
interface ToolCallAccordionProps {
|
|
139
111
|
toolName: string;
|
|
140
112
|
result: unknown;
|
|
@@ -142,7 +114,6 @@ interface ToolCallAccordionProps {
|
|
|
142
114
|
index?: number;
|
|
143
115
|
state?: ToolUIPart["state"];
|
|
144
116
|
className?: string;
|
|
145
|
-
input?: unknown;
|
|
146
117
|
}
|
|
147
118
|
|
|
148
119
|
export const ToolCallAccordion: React.FC<ToolCallAccordionProps> = ({
|
|
@@ -152,7 +123,6 @@ export const ToolCallAccordion: React.FC<ToolCallAccordionProps> = ({
|
|
|
152
123
|
index = 0,
|
|
153
124
|
state,
|
|
154
125
|
className,
|
|
155
|
-
input,
|
|
156
126
|
}) => {
|
|
157
127
|
const hasResult = state === "output-available" && (result || error);
|
|
158
128
|
const status = error ? "error" : hasResult ? "success" : "loading";
|
|
@@ -206,23 +176,21 @@ export const ToolCallAccordion: React.FC<ToolCallAccordionProps> = ({
|
|
|
206
176
|
</code>
|
|
207
177
|
</span>
|
|
208
178
|
</AccordionTrigger>
|
|
209
|
-
<AccordionContent className="
|
|
179
|
+
<AccordionContent className="pb-2 px-2">
|
|
210
180
|
{/* Only show content when tool is complete */}
|
|
211
181
|
{hasResult && (
|
|
212
182
|
<div className="space-y-3">
|
|
213
|
-
<ToolArgsRenderer input={input} />
|
|
214
183
|
{result !== undefined && result !== null && (
|
|
215
184
|
<ResultRenderer result={result} />
|
|
216
185
|
)}
|
|
217
186
|
|
|
218
187
|
{/* Error */}
|
|
219
188
|
{error && (
|
|
220
|
-
<div
|
|
221
|
-
<div className="text-xs font-
|
|
222
|
-
|
|
223
|
-
Error
|
|
189
|
+
<div>
|
|
190
|
+
<div className="text-xs font-medium text-[var(--red-11)] mb-1">
|
|
191
|
+
Error:
|
|
224
192
|
</div>
|
|
225
|
-
<div className="text-sm text-[var(--red-11)]
|
|
193
|
+
<div className="bg-[var(--red-2)] border border-[var(--red-6)] rounded-md p-3 text-sm text-[var(--red-11)]">
|
|
226
194
|
{error}
|
|
227
195
|
</div>
|
|
228
196
|
</div>
|
|
@@ -31,14 +31,13 @@ export const SearchBar = ({
|
|
|
31
31
|
onSearch(debouncedSearch);
|
|
32
32
|
}, [debouncedSearch, onSearch]);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (hidden) {
|
|
36
|
+
setInternalValue("");
|
|
37
|
+
} else {
|
|
38
|
+
ref.current?.focus();
|
|
39
|
+
}
|
|
40
|
+
}, [hidden]);
|
|
42
41
|
|
|
43
42
|
return (
|
|
44
43
|
<div
|
|
@@ -6,44 +6,37 @@ import {
|
|
|
6
6
|
} from "@/utils/numbers";
|
|
7
7
|
import { applyFormat } from "../column-formatting/feature";
|
|
8
8
|
|
|
9
|
-
const locale = "en-US";
|
|
10
|
-
|
|
11
9
|
describe("applyFormat", () => {
|
|
12
10
|
it("should return an empty string for null, undefined, or empty string values", () => {
|
|
13
|
-
expect(
|
|
14
|
-
|
|
15
|
-
).toBe("");
|
|
16
|
-
expect(
|
|
17
|
-
applyFormat(undefined, { format: "Date", dataType: "date", locale }),
|
|
18
|
-
).toBe("");
|
|
19
|
-
expect(applyFormat("", { format: "Date", dataType: "date", locale })).toBe(
|
|
11
|
+
expect(applyFormat(null, { format: "Date", dataType: "date" })).toBe("");
|
|
12
|
+
expect(applyFormat(undefined, { format: "Date", dataType: "date" })).toBe(
|
|
20
13
|
"",
|
|
21
14
|
);
|
|
15
|
+
expect(applyFormat("", { format: "Date", dataType: "date" })).toBe("");
|
|
22
16
|
});
|
|
23
17
|
|
|
24
18
|
describe("date formatting", () => {
|
|
25
19
|
it("should format date values correctly", () => {
|
|
26
20
|
const date = "2023-10-01T12:00:00Z";
|
|
27
|
-
expect(
|
|
28
|
-
|
|
29
|
-
)
|
|
30
|
-
expect(
|
|
31
|
-
|
|
32
|
-
)
|
|
21
|
+
expect(applyFormat(date, { format: "Date", dataType: "date" })).toBe(
|
|
22
|
+
"10/1/23",
|
|
23
|
+
);
|
|
24
|
+
expect(applyFormat(date, { format: "Datetime", dataType: "date" })).toBe(
|
|
25
|
+
"10/1/23, 12:00:00 PM UTC",
|
|
26
|
+
);
|
|
33
27
|
});
|
|
34
28
|
|
|
35
29
|
it("should format time values correctly", () => {
|
|
36
30
|
const time = "12:00:00Z";
|
|
37
|
-
expect(
|
|
38
|
-
|
|
39
|
-
)
|
|
31
|
+
expect(applyFormat(time, { format: "Time", dataType: "time" })).toBe(
|
|
32
|
+
"12:00:00Z",
|
|
33
|
+
);
|
|
40
34
|
});
|
|
41
35
|
|
|
42
36
|
it("should format datetime values correctly", () => {
|
|
43
37
|
const datetime = "2023-10-01T12:00:00Z";
|
|
44
38
|
expect(
|
|
45
39
|
applyFormat(datetime, {
|
|
46
|
-
locale,
|
|
47
40
|
format: "Datetime",
|
|
48
41
|
dataType: "datetime",
|
|
49
42
|
}),
|
|
@@ -54,28 +47,26 @@ describe("applyFormat", () => {
|
|
|
54
47
|
describe("number formatting", () => {
|
|
55
48
|
it("should format number values correctly", () => {
|
|
56
49
|
const number = "1234.567";
|
|
50
|
+
expect(applyFormat(number, { format: "Auto", dataType: "number" })).toBe(
|
|
51
|
+
"1,234.57",
|
|
52
|
+
);
|
|
57
53
|
expect(
|
|
58
|
-
applyFormat(number, { format: "
|
|
59
|
-
).toBe("1,234.57");
|
|
60
|
-
expect(
|
|
61
|
-
applyFormat(number, { format: "Percent", dataType: "number", locale }),
|
|
54
|
+
applyFormat(number, { format: "Percent", dataType: "number" }),
|
|
62
55
|
).toBe("123,456.7%");
|
|
63
56
|
expect(
|
|
64
57
|
applyFormat(number, {
|
|
65
|
-
locale,
|
|
66
58
|
format: "Scientific",
|
|
67
59
|
dataType: "number",
|
|
68
60
|
}),
|
|
69
|
-
).toBe(prettyScientificNumber(1234.567, { shouldRound: true
|
|
61
|
+
).toBe(prettyScientificNumber(1234.567, { shouldRound: true }));
|
|
70
62
|
expect(
|
|
71
63
|
applyFormat(number, {
|
|
72
64
|
format: "Engineering",
|
|
73
65
|
dataType: "number",
|
|
74
|
-
locale,
|
|
75
66
|
}),
|
|
76
|
-
).toBe(prettyEngineeringNumber(1234.567
|
|
67
|
+
).toBe(prettyEngineeringNumber(1234.567));
|
|
77
68
|
expect(
|
|
78
|
-
applyFormat(number, { format: "Integer", dataType: "number"
|
|
69
|
+
applyFormat(number, { format: "Integer", dataType: "number" }),
|
|
79
70
|
).toBe("1,235");
|
|
80
71
|
});
|
|
81
72
|
});
|
|
@@ -84,47 +75,41 @@ describe("applyFormat", () => {
|
|
|
84
75
|
it("should format string values correctly", () => {
|
|
85
76
|
const str = "hello world";
|
|
86
77
|
expect(
|
|
87
|
-
applyFormat(str, { format: "Uppercase", dataType: "string"
|
|
78
|
+
applyFormat(str, { format: "Uppercase", dataType: "string" }),
|
|
88
79
|
).toBe("HELLO WORLD");
|
|
89
80
|
expect(
|
|
90
|
-
applyFormat(str, { format: "Lowercase", dataType: "string"
|
|
81
|
+
applyFormat(str, { format: "Lowercase", dataType: "string" }),
|
|
91
82
|
).toBe("hello world");
|
|
92
83
|
expect(
|
|
93
|
-
applyFormat(str, { format: "Capitalize", dataType: "string"
|
|
84
|
+
applyFormat(str, { format: "Capitalize", dataType: "string" }),
|
|
94
85
|
).toBe("Hello world");
|
|
95
|
-
expect(
|
|
96
|
-
|
|
97
|
-
)
|
|
86
|
+
expect(applyFormat(str, { format: "Title", dataType: "string" })).toBe(
|
|
87
|
+
"Hello World",
|
|
88
|
+
);
|
|
98
89
|
});
|
|
99
90
|
});
|
|
100
91
|
|
|
101
92
|
describe("boolean formatting", () => {
|
|
102
93
|
it("should format boolean values correctly", () => {
|
|
94
|
+
expect(applyFormat(true, { format: "Yes/No", dataType: "boolean" })).toBe(
|
|
95
|
+
"Yes",
|
|
96
|
+
);
|
|
103
97
|
expect(
|
|
104
|
-
applyFormat(
|
|
105
|
-
).toBe("Yes");
|
|
106
|
-
expect(
|
|
107
|
-
applyFormat(false, { format: "Yes/No", dataType: "boolean", locale }),
|
|
98
|
+
applyFormat(false, { format: "Yes/No", dataType: "boolean" }),
|
|
108
99
|
).toBe("No");
|
|
100
|
+
expect(applyFormat(true, { format: "On/Off", dataType: "boolean" })).toBe(
|
|
101
|
+
"On",
|
|
102
|
+
);
|
|
109
103
|
expect(
|
|
110
|
-
applyFormat(
|
|
111
|
-
).toBe("On");
|
|
112
|
-
expect(
|
|
113
|
-
applyFormat(false, { format: "On/Off", dataType: "boolean", locale }),
|
|
104
|
+
applyFormat(false, { format: "On/Off", dataType: "boolean" }),
|
|
114
105
|
).toBe("Off");
|
|
115
106
|
});
|
|
116
107
|
});
|
|
117
108
|
|
|
118
109
|
it("should return the original value for unknown data types or formats", () => {
|
|
119
110
|
expect(
|
|
120
|
-
applyFormat("some value", {
|
|
121
|
-
format: "Auto",
|
|
122
|
-
dataType: "unknown",
|
|
123
|
-
locale,
|
|
124
|
-
}),
|
|
111
|
+
applyFormat("some value", { format: "Auto", dataType: "unknown" }),
|
|
125
112
|
).toBe("some value");
|
|
126
|
-
expect(
|
|
127
|
-
applyFormat(123, { format: "Auto", dataType: "unknown", locale }),
|
|
128
|
-
).toBe(123);
|
|
113
|
+
expect(applyFormat(123, { format: "Auto", dataType: "unknown" })).toBe(123);
|
|
129
114
|
});
|
|
130
115
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
2
|
import type { ColumnDef, RowSelectionState } from "@tanstack/react-table";
|
|
3
|
-
import { render
|
|
3
|
+
import { render } from "@testing-library/react";
|
|
4
4
|
import { describe, expect, it, vi } from "vitest";
|
|
5
5
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
6
6
|
import { DataTable } from "../data-table";
|
|
@@ -57,42 +57,4 @@ describe("DataTable", () => {
|
|
|
57
57
|
// Verify the rowSelection prop is maintained
|
|
58
58
|
expect(commonProps.rowSelection).toEqual(initialRowSelection);
|
|
59
59
|
});
|
|
60
|
-
|
|
61
|
-
it("applies hoverTemplate to the row title using row values", () => {
|
|
62
|
-
interface RowData {
|
|
63
|
-
id: number;
|
|
64
|
-
first: string;
|
|
65
|
-
last: string;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const testData: RowData[] = [
|
|
69
|
-
{ id: 1, first: "Michael", last: "Scott" },
|
|
70
|
-
{ id: 2, first: "Jim", last: "Halpert" },
|
|
71
|
-
];
|
|
72
|
-
|
|
73
|
-
const columns: Array<ColumnDef<RowData>> = [
|
|
74
|
-
{ accessorKey: "first", header: "First" },
|
|
75
|
-
{ accessorKey: "last", header: "Last" },
|
|
76
|
-
];
|
|
77
|
-
|
|
78
|
-
render(
|
|
79
|
-
<TooltipProvider>
|
|
80
|
-
<DataTable
|
|
81
|
-
data={testData}
|
|
82
|
-
columns={columns}
|
|
83
|
-
selection={null}
|
|
84
|
-
totalRows={2}
|
|
85
|
-
totalColumns={2}
|
|
86
|
-
pagination={false}
|
|
87
|
-
hoverTemplate={"{{first}} {{last}}"}
|
|
88
|
-
/>
|
|
89
|
-
</TooltipProvider>,
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
// Grab all rows and assert title attribute computed from template
|
|
93
|
-
const rows = screen.getAllByRole("row");
|
|
94
|
-
// The first row is header; subsequent rows correspond to data
|
|
95
|
-
expect(rows[1]).toHaveAttribute("title", "Michael Scott");
|
|
96
|
-
expect(rows[2]).toHaveAttribute("title", "Jim Halpert");
|
|
97
|
-
});
|
|
98
60
|
});
|