@marimo-team/frontend 0.16.2 → 0.16.3

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.
Files changed (293) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-B5cPvWoQ.js → ConnectedDataExplorerComponent-Brtw1DxF.js} +1 -1
  2. package/dist/assets/{ImageComparisonComponent-CqR26LSv.js → ImageComparisonComponent-Dxl-PbZX.js} +1 -1
  3. package/dist/assets/{VegaLite-DvQDATwI.js → VegaLite-BXQF0Cx_.js} +1 -1
  4. package/dist/assets/_baseEach-BjSm9ht3.js +1 -0
  5. package/dist/assets/_baseMap-CV4Ezmtf.js +1 -0
  6. package/dist/assets/_baseUniq-Ci9yZGxz.js +1 -0
  7. package/dist/assets/{_createAggregator-ZcHkHPNJ.js → _createAggregator-VFK9K2d9.js} +1 -1
  8. package/dist/assets/{agent-panel-B91RoLct.js → agent-panel-BoscVLCT.js} +7 -7
  9. package/dist/assets/{any-language-editor-CxfHcm5h.js → any-language-editor-ChaY_VUU.js} +1 -1
  10. package/dist/assets/{architectureDiagram-W76B3OCA-BQsvK8uR.js → architectureDiagram-W76B3OCA-CueUUFYd.js} +1 -1
  11. package/dist/assets/{between-horizontal-start-BmYToIaM.js → between-horizontal-start-DAHqmLYT.js} +1 -1
  12. package/dist/assets/{blockDiagram-QIGZ2CNN-r3HgCj4w.js → blockDiagram-QIGZ2CNN-BYYygyWn.js} +1 -1
  13. package/dist/assets/{c4Diagram-FPNF74CW-BJbPNt41.js → c4Diagram-FPNF74CW-DAz3xEh1.js} +1 -1
  14. package/dist/assets/channel-6SqQ2U_X.js +1 -0
  15. package/dist/assets/chat-panel-DJkOLrw9.js +3 -0
  16. package/dist/assets/{chunk-4BX2VUAB-Dv4MZ9Hj.js → chunk-4BX2VUAB-8g-RyHdt.js} +1 -1
  17. package/dist/assets/{chunk-55IACEB6-CM4AHquB.js → chunk-55IACEB6-iWZZ8Mt6.js} +1 -1
  18. package/dist/assets/{chunk-FMBD7UC4-C_Zz0ENB.js → chunk-FMBD7UC4-knjss4wk.js} +1 -1
  19. package/dist/assets/{chunk-K7UQS3LO-DYSmiXYq.js → chunk-K7UQS3LO-DVIwPBgZ.js} +1 -1
  20. package/dist/assets/{chunk-QN33PNHL-QM4OPuQP.js → chunk-QN33PNHL-CBU8pN6I.js} +1 -1
  21. package/dist/assets/{chunk-QZHKN3VN-CfAsGyeB.js → chunk-QZHKN3VN-5ljElUF4.js} +1 -1
  22. package/dist/assets/{chunk-TVAH2DTR-6j_Cpjsi.js → chunk-TVAH2DTR-DkIdGINc.js} +1 -1
  23. package/dist/assets/{chunk-TZMSLE5B-BHslFJQE.js → chunk-TZMSLE5B-CIFOSTqh.js} +1 -1
  24. package/dist/assets/{circle-play-CK3UZRYQ.js → circle-play-BOdsbq5u.js} +1 -1
  25. package/dist/assets/classDiagram-KNZD7YFC-DVqXcTYf.js +1 -0
  26. package/dist/assets/classDiagram-v2-RKCZMP56-DVqXcTYf.js +1 -0
  27. package/dist/assets/{clear-button-C4fDVSv8.js → clear-button-GAjXl0CQ.js} +1 -1
  28. package/dist/assets/clone-DSDb0xen.js +1 -0
  29. package/dist/assets/command-palette-BUXkqoLh.js +1 -0
  30. package/dist/assets/{common-D-lbuUwz.js → common-DahoYqdi.js} +1 -1
  31. package/dist/assets/{compile-DVQe1Mzk.js → compile-Bg8uJ7vm.js} +1 -1
  32. package/dist/assets/{cose-bilkent-S5V4N54A-D-IS7WC8.js → cose-bilkent-S5V4N54A-z_0gqD9K.js} +1 -1
  33. package/dist/assets/{dagre-5GWH7T2D-lYu-tEWT.js → dagre-5GWH7T2D-BMt7CNXL.js} +1 -1
  34. package/dist/assets/{data-grid-overlay-editor-C5peOCit.js → data-grid-overlay-editor-Ctn4XtXx.js} +1 -1
  35. package/dist/assets/{datasources-panel-D3NA20uZ.js → datasources-panel-C7sqRIHs.js} +1 -1
  36. package/dist/assets/{dependency-graph-panel-BGVYOfkV.js → dependency-graph-panel-DNajptzv.js} +4 -4
  37. package/dist/assets/{diagram-N5W7TBWH-BnvIuYUp.js → diagram-N5W7TBWH-BzwvLvAy.js} +1 -1
  38. package/dist/assets/{diagram-QEK2KX5R-DemedRK3.js → diagram-QEK2KX5R-DRLJ56FS.js} +1 -1
  39. package/dist/assets/{diagram-S2PKOQOG-iiY7AuyH.js → diagram-S2PKOQOG-Bf8x4KTU.js} +1 -1
  40. package/dist/assets/{documentation-panel-C3dSwOSQ.js → documentation-panel-Dm6Ozl67.js} +1 -1
  41. package/dist/assets/edit-page-CGc9EjuG.js +140 -0
  42. package/dist/assets/{ellipsis-vertical-CazJl8M7.js → ellipsis-vertical-Bj1YXvZe.js} +1 -1
  43. package/dist/assets/{empty-state-DW308mFO.js → empty-state-CYev-D31.js} +1 -1
  44. package/dist/assets/{erDiagram-AWTI2OKA-6wQ8Ugg0.js → erDiagram-AWTI2OKA-DmgzgN_I.js} +1 -1
  45. package/dist/assets/{error-panel-D1VnJ1yP.js → error-panel-BYG4twCa.js} +1 -1
  46. package/dist/assets/{file-explorer-panel-0oVd4t-D.js → file-explorer-panel-BSMiOApi.js} +1 -1
  47. package/dist/assets/{flowDiagram-PVAE7QVJ-C55IUWjm.js → flowDiagram-PVAE7QVJ-BdRKkajr.js} +1 -1
  48. package/dist/assets/{ganttDiagram-OWAHRB6G-DmqCM6ME.js → ganttDiagram-OWAHRB6G-lfRAMnq_.js} +5 -5
  49. package/dist/assets/{gitGraphDiagram-NY62KEGX-DBvhAeM_.js → gitGraphDiagram-NY62KEGX-CQVTIrHF.js} +1 -1
  50. package/dist/assets/{glide-data-editor-CHNuHidQ.js → glide-data-editor-D5A4pou7.js} +11 -11
  51. package/dist/assets/{graph-CG6BgUWQ.js → graph-CBNo279v.js} +1 -1
  52. package/dist/assets/{home-page-dgivXuSR.js → home-page-CmdznBJR.js} +3 -3
  53. package/dist/assets/{index-BTGpssVX.js → index-0dfGh-Gj.js} +1 -1
  54. package/dist/assets/{index-C7dtgr9A.js → index-BDYVSSzB.js} +1 -1
  55. package/dist/assets/{index-C02SqeRj.js → index-B_KyDZ94.js} +1 -1
  56. package/dist/assets/{index-mkubqy9-.js → index-Bfy-I_lW.js} +1 -1
  57. package/dist/assets/{index-BelfnXwL.js → index-Bh98Tp-z.js} +1 -1
  58. package/dist/assets/{index-CAQvMTzM.js → index-BhroIwBL.js} +1 -1
  59. package/dist/assets/{index-BneyUujp.js → index-BtQtesaI.js} +1 -1
  60. package/dist/assets/index-C0iXCvyY.css +1 -0
  61. package/dist/assets/index-C1SHFMCp.js +581 -0
  62. package/dist/assets/{index-Csd6QrCV.js → index-C6DWtSls.js} +1 -1
  63. package/dist/assets/{index-BYVZlBF8.js → index-C71cdkH-.js} +1 -1
  64. package/dist/assets/{index-z4krxQ4j.js → index-CT_FTqvK.js} +1 -1
  65. package/dist/assets/{index-Db36XTG_.js → index-CU5rRr66.js} +1 -1
  66. package/dist/assets/{index-CtPksxf0.js → index-Cb6duXQm.js} +1 -1
  67. package/dist/assets/{index-DAZ-9ri2.js → index-D23e9zQj.js} +1 -1
  68. package/dist/assets/index-DUGecC2Z.js +68 -0
  69. package/dist/assets/{index-M_pBKDSe.js → index-DcGIOAQi.js} +1 -1
  70. package/dist/assets/{index-DONRrmA2.js → index-PJfa9qXY.js} +1 -1
  71. package/dist/assets/{index-sbO9UaUU.js → index-SPslPC2B.js} +1 -1
  72. package/dist/assets/{index-DdIhdEVw.js → index-VPQlo4Uz.js} +1 -1
  73. package/dist/assets/{index-_luCZMLM.js → index-qbTLKWyG.js} +1 -1
  74. package/dist/assets/infoDiagram-STP46IZ2-DBu8p9gd.js +2 -0
  75. package/dist/assets/{isEmpty-CqX_YTIf.js → isEmpty-CnOLuQIv.js} +1 -1
  76. package/dist/assets/{journeyDiagram-BIP6EPQ6-Y5w_Tqe_.js → journeyDiagram-BIP6EPQ6-6U_vHJBH.js} +1 -1
  77. package/dist/assets/{kanban-definition-6OIFK2YF-DbXs5Rxi.js → kanban-definition-6OIFK2YF-DgnR14ys.js} +1 -1
  78. package/dist/assets/{layout-BCNPDACj.js → layout-RHmq4fP9.js} +1 -1
  79. package/dist/assets/{linear-uO6UVhXt.js → linear-CLdOVPGV.js} +1 -1
  80. package/dist/assets/links-Dd1icsEk.js +7 -0
  81. package/dist/assets/{logs-panel-BEQ1eRUp.js → logs-panel-CjbuhBLx.js} +1 -1
  82. package/dist/assets/{markdown-renderer-Dmzbb00W.js → markdown-renderer-X5YJvAZq.js} +3 -3
  83. package/dist/assets/{mermaid-qRc4MXIj.js → mermaid-Bl2T5oEC.js} +1 -1
  84. package/dist/assets/{mermaid.core-CvvJtCRj.js → mermaid.core-CfukBvGI.js} +4 -4
  85. package/dist/assets/min-BXIes1Za.js +1 -0
  86. package/dist/assets/{mindmap-definition-Q6HEUPPD-G5NognM-.js → mindmap-definition-Q6HEUPPD-BXCjP4Lu.js} +1 -1
  87. package/dist/assets/{number-overlay-editor-DPr5sHFu.js → number-overlay-editor-BUyqkSes.js} +1 -1
  88. package/dist/assets/{outline-panel-gxQXvVi4.js → outline-panel-BvGcPKdd.js} +1 -1
  89. package/dist/assets/{packages-panel-B1T0VPlg.js → packages-panel-BichDQWG.js} +1 -1
  90. package/dist/assets/{pieDiagram-ADFJNKIX-DK9SHkfc.js → pieDiagram-ADFJNKIX-CMzJFIJM.js} +1 -1
  91. package/dist/assets/{quadrantDiagram-LMRXKWRM-D1DdWF8C.js → quadrantDiagram-LMRXKWRM-CfGssUlO.js} +1 -1
  92. package/dist/assets/{react-plotly-CTwajqCb.js → react-plotly-DR3hV0HW.js} +1 -1
  93. package/dist/assets/{requirementDiagram-4UW4RH46-DnjDAypr.js → requirementDiagram-4UW4RH46-CfrFolth.js} +1 -1
  94. package/dist/assets/{run-page-CQY9im22.js → run-page-Bqd_4ePD.js} +1 -1
  95. package/dist/assets/{sankeyDiagram-GR3RE2ED-B67Va-ER.js → sankeyDiagram-GR3RE2ED-D_UttKU0.js} +1 -1
  96. package/dist/assets/scratchpad-panel-D5N15ji1.js +1 -0
  97. package/dist/assets/secrets-panel-BpbnAO4R.js +1 -0
  98. package/dist/assets/{sequenceDiagram-C3RYC4MD-DiWgZPtN.js → sequenceDiagram-C3RYC4MD-MdfQQApP.js} +1 -1
  99. package/dist/assets/{slides-component-DhpPRtQp.js → slides-component-C0z7rXmk.js} +1 -1
  100. package/dist/assets/{snippets-panel-CLkBXhJ2.js → snippets-panel-wlpZ_Wzx.js} +1 -1
  101. package/dist/assets/{sortBy-D4OG7w4O.js → sortBy-BW_zNHP6.js} +1 -1
  102. package/dist/assets/{state-Dz_3JyED.js → state-CDooX-dk.js} +1 -1
  103. package/dist/assets/{stateDiagram-KXAO66HF-ByF2AULw.js → stateDiagram-KXAO66HF-H7kfw3ot.js} +1 -1
  104. package/dist/assets/stateDiagram-v2-UMBNRL4Z-YMeb9qMR.js +1 -0
  105. package/dist/assets/{storage-Dr0CC44z.js → storage-b1QCapTq.js} +6 -6
  106. package/dist/assets/{terminal-BtdissBf.js → terminal-CPV44BXz.js} +1 -1
  107. package/dist/assets/{time-DKdOTnQg.js → time-DDy3xv5Y.js} +1 -1
  108. package/dist/assets/{timeline-definition-XQNQX7LJ-DzER9bf6.js → timeline-definition-XQNQX7LJ-J-cPRT2_.js} +1 -1
  109. package/dist/assets/{tracing-Dpx5M-u3.js → tracing-3eHHRUiJ.js} +2 -2
  110. package/dist/assets/{tracing-panel-hCjBkSER.js → tracing-panel-BMgy3D7d.js} +2 -2
  111. package/dist/assets/{trash-C6Ko-g5q.js → trash--tonOuDe.js} +1 -1
  112. package/dist/assets/{tree-BHN2gcCF.js → tree-ouIGEsVg.js} +6 -6
  113. package/dist/assets/{treemap-75Q7IDZK-DR79Mhzt.js → treemap-75Q7IDZK-CzJTJ_3R.js} +20 -20
  114. package/dist/assets/{variable-panel-PFBCFz36.js → variable-panel-sFTn4Oih.js} +1 -1
  115. package/dist/assets/{vega-component-Db6-uY4C.js → vega-component-BkPkzX9r.js} +1 -1
  116. package/dist/assets/{xychartDiagram-6GGTOJPD-DWzBP3tZ.js → xychartDiagram-6GGTOJPD-BZ8WOb_8.js} +1 -1
  117. package/dist/index.html +10 -3
  118. package/package.json +6 -6
  119. package/src/__mocks__/common.ts +5 -3
  120. package/src/__mocks__/notebook.ts +2 -2
  121. package/src/__tests__/main.test.tsx +2 -2
  122. package/src/components/ai/ai-provider-icon.tsx +2 -0
  123. package/src/components/app-config/ai-config.tsx +32 -1
  124. package/src/components/app-config/common.tsx +2 -2
  125. package/src/components/app-config/user-config-form.tsx +26 -0
  126. package/src/components/audio/audio-recorder.tsx +0 -1
  127. package/src/components/chat/acp/blocks.tsx +2 -2
  128. package/src/components/chat/acp/thread.tsx +3 -5
  129. package/src/components/chat/acp/utils.ts +5 -5
  130. package/src/components/chat/chat-panel.tsx +1 -1
  131. package/src/components/data-table/__tests__/data-table.test.tsx +2 -2
  132. package/src/components/data-table/charts/__tests__/altair-generator.test.ts +1 -1
  133. package/src/components/data-table/charts/chart-spec/tooltips.ts +3 -3
  134. package/src/components/data-table/charts/components/chart-items.tsx +1 -1
  135. package/src/components/data-table/charts/components/form-fields.tsx +2 -2
  136. package/src/components/data-table/charts/constants.ts +1 -1
  137. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +1 -1
  138. package/src/components/data-table/column-summary/chart-spec-model.tsx +2 -2
  139. package/src/components/data-table/columns.tsx +1 -1
  140. package/src/components/data-table/data-table.tsx +35 -3
  141. package/src/components/data-table/date-popover.tsx +1 -1
  142. package/src/components/data-table/download-actions.tsx +1 -1
  143. package/src/components/data-table/range-focus/__tests__/utils.test.ts +5 -5
  144. package/src/components/data-table/renderers.tsx +6 -5
  145. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +1 -1
  146. package/src/components/data-table/types.ts +4 -3
  147. package/src/components/datasources/column-preview.tsx +9 -6
  148. package/src/components/debugger/debugger-code.tsx +1 -1
  149. package/src/components/dependency-graph/custom-node.tsx +15 -6
  150. package/src/components/dependency-graph/dependency-graph-minimap.tsx +2 -2
  151. package/src/components/dependency-graph/dependency-graph-tree.tsx +2 -2
  152. package/src/components/dependency-graph/dependency-graph.tsx +1 -1
  153. package/src/components/dependency-graph/elements.ts +7 -7
  154. package/src/components/dependency-graph/utils/changes.ts +4 -4
  155. package/src/components/editor/Cell.tsx +6 -2
  156. package/src/components/editor/ai/transport/chat-transport.tsx +1 -1
  157. package/src/components/editor/chrome/panels/outline/useActiveOutline.tsx +1 -1
  158. package/src/components/editor/chrome/panels/packages-panel.tsx +1 -1
  159. package/src/components/editor/columns/storage.ts +1 -1
  160. package/src/components/editor/database/__tests__/__snapshots__/as-code.test.ts.snap +36 -0
  161. package/src/components/editor/database/__tests__/as-code.test.ts +30 -7
  162. package/src/components/editor/database/add-database-form.tsx +11 -0
  163. package/src/components/editor/database/as-code.ts +104 -5
  164. package/src/components/editor/database/schemas.ts +36 -18
  165. package/src/components/editor/errors/auto-fix.tsx +12 -2
  166. package/src/components/editor/errors/sql-validation-errors.tsx +12 -6
  167. package/src/components/editor/navigation/clipboard.ts +2 -2
  168. package/src/components/editor/output/ConsoleOutput.tsx +1 -1
  169. package/src/components/editor/output/JsonOutput.tsx +1 -1
  170. package/src/components/editor/output/MarimoErrorOutput.tsx +25 -25
  171. package/src/components/editor/output/MarimoTracebackOutput.tsx +17 -2
  172. package/src/components/editor/renderers/grid-layout/types.ts +2 -2
  173. package/src/components/editor/renderers/plugins.ts +1 -1
  174. package/src/components/editor/renderers/types.ts +1 -1
  175. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +7 -7
  176. package/src/components/forms/form.tsx +5 -5
  177. package/src/components/ui/links.tsx +1 -0
  178. package/src/core/ai/__tests__/model-registry.test.ts +0 -10
  179. package/src/core/ai/context/providers/error.ts +2 -2
  180. package/src/core/ai/ids/ids.ts +1 -0
  181. package/src/core/ai/model-registry.ts +2 -1
  182. package/src/core/cells/cells.ts +5 -5
  183. package/src/core/cells/logs.ts +1 -1
  184. package/src/core/cells/types.ts +1 -1
  185. package/src/core/codemirror/__tests__/format.test.ts +6 -0
  186. package/src/core/codemirror/cells/traceback-decorations.ts +1 -1
  187. package/src/core/codemirror/editing/commands.ts +2 -2
  188. package/src/core/codemirror/find-replace/navigate.ts +1 -1
  189. package/src/core/codemirror/language/__tests__/extension.test.ts +1 -1
  190. package/src/core/codemirror/language/__tests__/sql-validation.test.ts +1 -1
  191. package/src/core/codemirror/language/__tests__/sql.test.ts +764 -79
  192. package/src/core/codemirror/language/languages/markdown.ts +4 -1
  193. package/src/core/codemirror/language/languages/sql/{validation-errors.ts → banner-validation-errors.ts} +9 -3
  194. package/src/core/codemirror/language/languages/sql/completion-builder.ts +160 -0
  195. package/src/core/codemirror/language/languages/sql/completion-sources.tsx +9 -3
  196. package/src/core/codemirror/language/languages/sql/completion-store.ts +46 -50
  197. package/src/core/codemirror/language/languages/sql/renderers.tsx +485 -0
  198. package/src/core/codemirror/language/languages/sql/sql.ts +151 -24
  199. package/src/core/codemirror/language/languages/sql/utils.ts +4 -1
  200. package/src/core/codemirror/language/panel/sql.tsx +6 -1
  201. package/src/core/codemirror/language/utils/ast.ts +3 -3
  202. package/src/core/codemirror/lsp/federated-lsp.ts +4 -4
  203. package/src/core/codemirror/lsp/lens.ts +4 -4
  204. package/src/core/codemirror/lsp/notebook-lsp.ts +1 -1
  205. package/src/core/codemirror/lsp/types.ts +1 -1
  206. package/src/core/codemirror/markdown/completions.ts +1 -1
  207. package/src/core/codemirror/reactive-references/analyzer.ts +2 -2
  208. package/src/core/codemirror/rtc/loro/awareness.ts +1 -1
  209. package/src/core/config/config-schema.ts +1 -0
  210. package/src/core/config/feature-flag.tsx +3 -1
  211. package/src/core/datasets/request-registry.ts +17 -10
  212. package/src/core/dom/events.ts +1 -1
  213. package/src/core/dom/outline.ts +2 -2
  214. package/src/core/dom/uiregistry.ts +2 -8
  215. package/src/core/errors/__tests__/errors.test.ts +22 -4
  216. package/src/core/errors/errors.ts +29 -1
  217. package/src/core/errors/state.ts +1 -1
  218. package/src/core/islands/main.ts +2 -2
  219. package/src/core/islands/parse.ts +1 -3
  220. package/src/core/kernel/messages.ts +1 -1
  221. package/src/core/network/CachingRequestRegistry.ts +74 -0
  222. package/src/core/network/DeferredRequestRegistry.ts +3 -1
  223. package/src/core/network/__tests__/CachingRequestRegistry.test.ts +73 -0
  224. package/src/core/network/types.ts +1 -1
  225. package/src/core/variables/state.ts +2 -2
  226. package/src/core/wasm/__tests__/state.test.ts +1 -1
  227. package/src/core/websocket/useMarimoWebSocket.tsx +5 -2
  228. package/src/custom.d.ts +1 -1
  229. package/src/hooks/useCellRenderCount.ts +1 -0
  230. package/src/hooks/useResizeHandle.ts +4 -1
  231. package/src/plugins/core/RenderHTML.tsx +1 -2
  232. package/src/plugins/impl/DataTablePlugin.tsx +7 -2
  233. package/src/plugins/impl/FileUploadPlugin.tsx +1 -1
  234. package/src/plugins/impl/RefreshPlugin.tsx +1 -1
  235. package/src/plugins/impl/SliderPlugin.tsx +4 -0
  236. package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +27 -9
  237. package/src/plugins/impl/anywidget/__tests__/AnyWidgetPlugin.test.tsx +58 -2
  238. package/src/plugins/impl/anywidget/__tests__/model.test.ts +3 -4
  239. package/src/plugins/impl/anywidget/model.ts +2 -3
  240. package/src/plugins/impl/data-editor/types.ts +1 -1
  241. package/src/plugins/impl/data-explorer/components/query-form.tsx +1 -1
  242. package/src/plugins/impl/data-frames/types.ts +1 -1
  243. package/src/plugins/impl/panel/PanelPlugin.tsx +2 -2
  244. package/src/plugins/impl/plotly/PlotlyPlugin.tsx +3 -3
  245. package/src/plugins/impl/vega/__tests__/loader.test.ts +2 -2
  246. package/src/plugins/impl/vega/loader.ts +1 -1
  247. package/src/plugins/impl/vega/vega-component.tsx +1 -1
  248. package/src/plugins/impl/vega/vega-loader.ts +2 -2
  249. package/src/plugins/layout/NavigationMenuPlugin.tsx +1 -1
  250. package/src/plugins/layout/RoutesPlugin.tsx +1 -2
  251. package/src/plugins/plugins.ts +2 -2
  252. package/src/utils/Logger.ts +1 -1
  253. package/src/utils/__tests__/data-views.test.ts +30 -68
  254. package/src/utils/__tests__/dom.test.ts +10 -10
  255. package/src/utils/__tests__/id-tree.test.ts +49 -1
  256. package/src/utils/__tests__/storage.test.ts +1 -1
  257. package/src/utils/__tests__/traceback.test.ts +13 -2
  258. package/src/utils/arrays.ts +1 -1
  259. package/src/utils/createReducer.ts +1 -5
  260. package/src/utils/data-views.ts +6 -19
  261. package/src/utils/edit-distance.ts +1 -1
  262. package/src/utils/fileToBase64.ts +1 -1
  263. package/src/utils/id-tree.tsx +20 -18
  264. package/src/utils/json/base64.ts +13 -0
  265. package/src/utils/json/json-parser.ts +2 -2
  266. package/src/utils/lru.ts +4 -0
  267. package/src/utils/mergeRefs.ts +1 -1
  268. package/src/utils/objects.ts +3 -3
  269. package/src/utils/pluralize.ts +1 -1
  270. package/src/utils/routes.ts +2 -2
  271. package/src/utils/sets.ts +1 -1
  272. package/src/utils/traceback.ts +45 -15
  273. package/src/utils/tracer.ts +11 -9
  274. package/dist/assets/_baseEach--KDTwKbG.js +0 -1
  275. package/dist/assets/_baseMap-Cu3o-eyO.js +0 -1
  276. package/dist/assets/_baseUniq-y7ZXnMo1.js +0 -1
  277. package/dist/assets/channel-DFaEx1fu.js +0 -1
  278. package/dist/assets/chat-panel-IoPMv8e2.js +0 -3
  279. package/dist/assets/classDiagram-KNZD7YFC-BsZtvV5O.js +0 -1
  280. package/dist/assets/classDiagram-v2-RKCZMP56-BsZtvV5O.js +0 -1
  281. package/dist/assets/clone-YBEvPE-s.js +0 -1
  282. package/dist/assets/command-palette-D7hOfvf6.js +0 -1
  283. package/dist/assets/edit-page-C5TsEeSo.js +0 -129
  284. package/dist/assets/index-CGDMlQfO.css +0 -1
  285. package/dist/assets/index-CelXfcd8.js +0 -580
  286. package/dist/assets/index-Cxyk7pt-.js +0 -68
  287. package/dist/assets/infoDiagram-STP46IZ2-wTALjfPc.js +0 -2
  288. package/dist/assets/links-Drv7cJgN.js +0 -7
  289. package/dist/assets/min-DYUOb1RR.js +0 -1
  290. package/dist/assets/scratchpad-panel-DlDfcDtW.js +0 -1
  291. package/dist/assets/secrets-panel-BDGyuGZA.js +0 -1
  292. package/dist/assets/stateDiagram-v2-UMBNRL4Z-CtBJqosP.js +0 -1
  293. package/src/__tests__/lru.test.ts +0 -74
@@ -27,7 +27,7 @@ type AxisDatum = unknown;
27
27
 
28
28
  type T =
29
29
  | {
30
- points?: Array<Record<AxisName, AxisDatum>> | Plotly.PlotDatum[];
30
+ points?: Record<AxisName, AxisDatum>[] | Plotly.PlotDatum[];
31
31
  indices?: number[];
32
32
  range?: {
33
33
  x?: number[];
@@ -85,7 +85,7 @@ function initialLayout(figure: Figure): Partial<Plotly.Layout> {
85
85
  };
86
86
  }
87
87
 
88
- const SUNBURST_DATA_KEYS: Array<keyof Plotly.SunburstPlotDatum> = [
88
+ const SUNBURST_DATA_KEYS: (keyof Plotly.SunburstPlotDatum)[] = [
89
89
  "color",
90
90
  "curveNumber",
91
91
  "entry",
@@ -279,7 +279,7 @@ PlotlyComponent.displayName = "PlotlyComponent";
279
279
  */
280
280
  function extractPoints(
281
281
  points: Plotly.PlotDatum[],
282
- ): Array<Record<AxisName, AxisDatum>> {
282
+ ): Record<AxisName, AxisDatum>[] {
283
283
  if (!points) {
284
284
  return [];
285
285
  }
@@ -59,10 +59,10 @@ describe("DATE_MIDDLEWARE", () => {
59
59
  const csv = "Date,Value\n2024-13-45,100\n2024-02-30,200";
60
60
 
61
61
  // When parsing the CSV
62
- const data = parseCsvData(csv, false) as Array<{
62
+ const data = parseCsvData(csv, false) as {
63
63
  Date: string;
64
64
  Value: number;
65
- }>;
65
+ }[];
66
66
 
67
67
  // Then invalid dates should remain as strings
68
68
  expect(typeof data[0].Date).toBe("string");
@@ -41,7 +41,7 @@ const BIG_INT_MIDDLEWARE: Middleware = () => {
41
41
  return result;
42
42
  }
43
43
 
44
- const parsedInt = Number.parseInt(v);
44
+ const parsedInt = Number.parseInt(v, 10);
45
45
  if (isNumber(parsedInt)) {
46
46
  const needsBigInt = Math.abs(parsedInt) > Number.MAX_SAFE_INTEGER;
47
47
  if (!needsBigInt) {
@@ -157,7 +157,7 @@ const LoadedVegaComponent = ({
157
157
  });
158
158
 
159
159
  const renderHelpContent = () => {
160
- const hints: Array<[string, string]> = [];
160
+ const hints: [string, string][] = [];
161
161
  if (ParamNames.hasPoint(names)) {
162
162
  hints.push([
163
163
  "Point selection",
@@ -7,7 +7,7 @@ import type { DataType } from "./vega-loader";
7
7
  // Re-export the vega-loader functions to add TypeScript types
8
8
 
9
9
  export function read<T = object>(
10
- data: string | Record<string, unknown> | Array<Record<string, unknown>>,
10
+ data: string | Record<string, unknown> | Record<string, unknown>[],
11
11
  format:
12
12
  | DataFormat
13
13
  | {
@@ -27,7 +27,7 @@ export interface Loader {
27
27
  load(
28
28
  uri: string,
29
29
  options?: unknown,
30
- ): Promise<string | Record<string, unknown> | Array<Record<string, unknown>>>;
30
+ ): Promise<string | Record<string, unknown> | Record<string, unknown>[]>;
31
31
  sanitize(uri: string, options?: unknown): Promise<{ href: string }>;
32
32
  http(uri: string, options?: unknown): Promise<string>;
33
33
  file(filename: string): Promise<string>;
@@ -35,7 +35,7 @@ interface Data {
35
35
  /**
36
36
  * The labels for each item; raw HTML.
37
37
  */
38
- items: Array<MenuItem | MenuItemGroup>;
38
+ items: (MenuItem | MenuItemGroup)[];
39
39
 
40
40
  /**
41
41
  * The orientation of the menu.
@@ -69,13 +69,12 @@ const RoutesComponent = ({
69
69
  }, [handleFindMatch]);
70
70
 
71
71
  if (!matched) {
72
- // eslint-disable-next-line react/jsx-no-useless-fragment
72
+ // biome-ignore lint/complexity/noUselessFragments: this is intentional
73
73
  return <></>;
74
74
  }
75
75
 
76
76
  const matchedIndex = routes.indexOf(matched);
77
77
  const child = React.Children.toArray(children)[matchedIndex];
78
78
 
79
- // eslint-disable-next-line react/jsx-no-useless-fragment
80
79
  return <>{child}</>;
81
80
  };
@@ -54,7 +54,7 @@ import type { IStatelessPlugin } from "./stateless-plugin";
54
54
  import type { IPlugin } from "./types";
55
55
 
56
56
  // List of UI plugins
57
- export const UI_PLUGINS: Array<IPlugin<any, unknown>> = [
57
+ export const UI_PLUGINS: IPlugin<any, unknown>[] = [
58
58
  new ButtonPlugin(),
59
59
  new CheckboxPlugin(),
60
60
  DataTablePlugin,
@@ -91,7 +91,7 @@ export const UI_PLUGINS: Array<IPlugin<any, unknown>> = [
91
91
  ];
92
92
 
93
93
  // List of output / layout plugins
94
- const LAYOUT_PLUGINS: Array<IStatelessPlugin<unknown>> = [
94
+ const LAYOUT_PLUGINS: IStatelessPlugin<unknown>[] = [
95
95
  new AccordionPlugin(),
96
96
  new CalloutPlugin(),
97
97
  new CarouselPlugin(),
@@ -1,5 +1,5 @@
1
1
  /* Copyright 2024 Marimo. All rights reserved. */
2
- /* eslint-disable no-console */
2
+ /** biome-ignore-all lint/suspicious/noConsole: For console logging */
3
3
 
4
4
  import { Functions } from "./functions";
5
5
 
@@ -1,39 +1,11 @@
1
1
  /* Copyright 2024 Marimo. All rights reserved. */
2
2
  import { describe, expect, it } from "vitest";
3
- import { byteStringToDataView, updateBufferPaths } from "../data-views";
4
- import type { Base64String, ByteString } from "../json/base64";
3
+ import { updateBufferPaths } from "../data-views";
5
4
 
6
5
  describe("updateBufferPaths", () => {
7
- it("should return the original object if bufferPaths is null", () => {
6
+ it("should return the original object if bufferPaths.length === 0", () => {
8
7
  const input = { a: 1, b: 2 };
9
- const result = updateBufferPaths(input, null);
10
- expect(result).toEqual(input);
11
- });
12
-
13
- it("should update buffer paths correctly", () => {
14
- const input = {
15
- a: 1,
16
- b: {
17
- c: "Hello",
18
- d: "World",
19
- },
20
- };
21
- const bufferPaths = [
22
- ["b", "c"],
23
- ["b", "d"],
24
- ];
25
- const result = updateBufferPaths(input, bufferPaths);
26
-
27
- expect(result.a).toBe(1);
28
- expect(result.b.c).toBeInstanceOf(DataView);
29
- expect(result.b.d).toBeInstanceOf(DataView);
30
- });
31
-
32
- it("should handle non-existent paths", () => {
33
- const input = { a: 1 };
34
- const bufferPaths = [["b", "c"]];
35
- const result = updateBufferPaths(input, bufferPaths);
36
-
8
+ const result = updateBufferPaths(input, [], []);
37
9
  expect(result).toEqual(input);
38
10
  });
39
11
 
@@ -49,19 +21,32 @@ describe("updateBufferPaths", () => {
49
21
  ["b", "c"],
50
22
  ["b", "d"],
51
23
  ];
52
- const buffers: Base64String[] = [
53
- "SGVsbG8=" as Base64String,
54
- "V29ybGQ=" as Base64String,
55
- ]; // Base64 encoded "Hello" and "World"
24
+ const buffers = [
25
+ new TextEncoder().encode("Hello"),
26
+ new TextEncoder().encode("World"),
27
+ ].map((b) => new DataView(b.buffer));
56
28
  const result = updateBufferPaths(input, bufferPaths, buffers);
57
-
58
- expect(result.a).toBe(1);
59
- const cView = result.b.c as unknown as DataView;
60
- const dView = result.b.d as unknown as DataView;
61
- expect(cView).toBeInstanceOf(DataView);
62
- expect(dView).toBeInstanceOf(DataView);
63
- expect(cView.byteLength).toBe(5);
64
- expect(dView.byteLength).toBe(5);
29
+ expect(result).toMatchInlineSnapshot(`
30
+ {
31
+ "a": 1,
32
+ "b": {
33
+ "c": DataView [
34
+ 72,
35
+ 101,
36
+ 108,
37
+ 108,
38
+ 111,
39
+ ],
40
+ "d": DataView [
41
+ 87,
42
+ 111,
43
+ 114,
44
+ 108,
45
+ 100,
46
+ ],
47
+ },
48
+ }
49
+ `);
65
50
  });
66
51
 
67
52
  it("should throw error when buffers and paths length mismatch", () => {
@@ -70,7 +55,7 @@ describe("updateBufferPaths", () => {
70
55
  ["b", "c"],
71
56
  ["b", "d"],
72
57
  ];
73
- const buffers: Base64String[] = ["SGVsbG8=" as Base64String]; // Only one buffer for two paths
58
+ const buffers = [new DataView(new ArrayBuffer())]; // Only one buffer for two paths
74
59
 
75
60
  expect(() => updateBufferPaths(input, bufferPaths, buffers)).toThrow(
76
61
  "Buffers and buffer paths not the same length",
@@ -80,33 +65,10 @@ describe("updateBufferPaths", () => {
80
65
  it("should handle empty buffers array", () => {
81
66
  const input = { a: 1 };
82
67
  const bufferPaths = [["b", "c"]];
83
- const buffers: Base64String[] = [];
68
+ const buffers: DataView[] = [];
84
69
 
85
70
  expect(() => updateBufferPaths(input, bufferPaths, buffers)).toThrow(
86
71
  "Buffers and buffer paths not the same length",
87
72
  );
88
73
  });
89
74
  });
90
-
91
- describe("byteStringToDataView", () => {
92
- it("should convert a base64 string to a DataView", () => {
93
- const input = "Hello" as ByteString;
94
- const result = byteStringToDataView(input);
95
-
96
- expect(result).toBeInstanceOf(DataView);
97
- expect(result.byteLength).toBe(5);
98
- expect(result.getUint8(0)).toBe(72); // 'H'
99
- expect(result.getUint8(1)).toBe(101); // 'e'
100
- expect(result.getUint8(2)).toBe(108); // 'l'
101
- expect(result.getUint8(3)).toBe(108); // 'l'
102
- expect(result.getUint8(4)).toBe(111); // 'o'
103
- });
104
-
105
- it("should handle empty string", () => {
106
- const input = "" as ByteString;
107
- const result = byteStringToDataView(input);
108
-
109
- expect(result).toBeInstanceOf(DataView);
110
- expect(result.byteLength).toBe(0);
111
- });
112
- });
@@ -60,14 +60,14 @@ describe("parseHtmlContent", () => {
60
60
 
61
61
  describe("ansiToPlainText", () => {
62
62
  test("converts ANSI color codes to plain text", () => {
63
- const ansiString = "\x1b[31mError:\x1b[0m Something went wrong";
63
+ const ansiString = "\u001B[31mError:\u001B[0m Something went wrong";
64
64
  const result = ansiToPlainText(ansiString);
65
65
  expect(result).toMatchInlineSnapshot(`"Error: Something went wrong"`);
66
66
  });
67
67
 
68
68
  test("handles multiple ANSI color codes", () => {
69
69
  const ansiString =
70
- "\x1b[32mSUCCESS:\x1b[0m \x1b[34mOperation completed\x1b[0m successfully";
70
+ "\u001B[32mSUCCESS:\u001B[0m \u001B[34mOperation completed\u001B[0m successfully";
71
71
  const result = ansiToPlainText(ansiString);
72
72
  expect(result).toMatchInlineSnapshot(
73
73
  `"SUCCESS: Operation completed successfully"`,
@@ -76,14 +76,14 @@ describe("ansiToPlainText", () => {
76
76
 
77
77
  test("handles ANSI bold and color combinations", () => {
78
78
  const ansiString =
79
- "\x1b[1;31mBOLD RED ERROR:\x1b[0m \x1b[33mWarning message\x1b[0m";
79
+ "\u001B[1;31mBOLD RED ERROR:\u001B[0m \u001B[33mWarning message\u001B[0m";
80
80
  const result = ansiToPlainText(ansiString);
81
81
  expect(result).toMatchInlineSnapshot(`"BOLD RED ERROR: Warning message"`);
82
82
  });
83
83
 
84
84
  test("handles Python traceback with ANSI codes", () => {
85
85
  const ansiString =
86
- "\x1b[0;36m File \"\x1b[0m\x1b[0;32mtest.py\x1b[0m\x1b[0;36m\", line \x1b[0m\x1b[0;32m1\x1b[0m\x1b[0;36m, in \x1b[0m\x1b[0;35m<module>\x1b[0m\n\x1b[0;31mNameError\x1b[0m: name 'undefined_var' is not defined";
86
+ "\u001B[0;36m File \"\u001B[0m\u001B[0;32mtest.py\u001B[0m\u001B[0;36m\", line \u001B[0m\u001B[0;32m1\u001B[0m\u001B[0;36m, in \u001B[0m\u001B[0;35m<module>\u001B[0m\n\u001B[0;31mNameError\u001B[0m: name 'undefined_var' is not defined";
87
87
  const result = ansiToPlainText(ansiString);
88
88
  expect(result).toMatchInlineSnapshot(`
89
89
  " File "test.py", line 1, in <module>
@@ -93,7 +93,7 @@ describe("ansiToPlainText", () => {
93
93
 
94
94
  test("handles error messages with background colors", () => {
95
95
  const ansiString =
96
- "\x1b[41;37m CRITICAL ERROR \x1b[0m \x1b[31mSystem failure detected\x1b[0m";
96
+ "\u001B[41;37m CRITICAL ERROR \u001B[0m \u001B[31mSystem failure detected\u001B[0m";
97
97
  const result = ansiToPlainText(ansiString);
98
98
  expect(result).toMatchInlineSnapshot(
99
99
  `" CRITICAL ERROR System failure detected"`,
@@ -102,7 +102,7 @@ describe("ansiToPlainText", () => {
102
102
 
103
103
  test("handles complex stack trace with mixed formatting", () => {
104
104
  const ansiString =
105
- 'Traceback (most recent call last):\n \x1b[36mFile "\x1b[32m/path/to/file.py\x1b[36m", line \x1b[32m42\x1b[36m, in \x1b[35mfunction_name\x1b[0m\n \x1b[31mraise ValueError("Something went wrong")\x1b[0m\n\x1b[31mValueError\x1b[0m: Something went wrong';
105
+ 'Traceback (most recent call last):\n \u001B[36mFile "\u001B[32m/path/to/file.py\u001B[36m", line \u001B[32m42\u001B[36m, in \u001B[35mfunction_name\u001B[0m\n \u001B[31mraise ValueError("Something went wrong")\u001B[0m\n\u001B[31mValueError\u001B[0m: Something went wrong';
106
106
  const result = ansiToPlainText(ansiString);
107
107
  expect(result).toMatchInlineSnapshot(`
108
108
  "Traceback (most recent call last):
@@ -128,7 +128,7 @@ describe("ansiToPlainText", () => {
128
128
 
129
129
  test("handles whitespace and newlines correctly", () => {
130
130
  const ansiString =
131
- "\x1b[31m Error: \x1b[0m\n\n \x1b[33m Warning \x1b[0m ";
131
+ "\u001B[31m Error: \u001B[0m\n\n \u001B[33m Warning \u001B[0m ";
132
132
  const result = ansiToPlainText(ansiString);
133
133
  expect(result).toMatchInlineSnapshot(`
134
134
  " Error:
@@ -139,7 +139,7 @@ describe("ansiToPlainText", () => {
139
139
 
140
140
  test("handles JavaScript error stack trace", () => {
141
141
  const ansiString =
142
- "\x1b[31mReferenceError\x1b[0m: \x1b[33mvariable\x1b[0m is not defined\n at \x1b[36mObject.<anonymous>\x1b[0m (\x1b[32m/path/to/script.js\x1b[0m:\x1b[33m5\x1b[0m:\x1b[33m1\x1b[0m)";
142
+ "\u001B[31mReferenceError\u001B[0m: \u001B[33mvariable\u001B[0m is not defined\n at \u001B[36mObject.<anonymous>\u001B[0m (\u001B[32m/path/to/script.js\u001B[0m:\u001B[33m5\u001B[0m:\u001B[33m1\u001B[0m)";
143
143
  const result = ansiToPlainText(ansiString);
144
144
  expect(result).toMatchInlineSnapshot(`
145
145
  "ReferenceError: variable is not defined
@@ -149,7 +149,7 @@ describe("ansiToPlainText", () => {
149
149
 
150
150
  test("handles Rust panic with ANSI formatting", () => {
151
151
  const ansiString =
152
- "thread '\x1b[32mmain\x1b[0m' panicked at '\x1b[31massertion failed: `(left == right)`\x1b[0m'\n \x1b[36mleft\x1b[0m: `\x1b[33m5\x1b[0m`\n \x1b[36mright\x1b[0m: `\x1b[33m10\x1b[0m`";
152
+ "thread '\u001B[32mmain\u001B[0m' panicked at '\u001B[31massertion failed: `(left == right)`\u001B[0m'\n \u001B[36mleft\u001B[0m: `\u001B[33m5\u001B[0m`\n \u001B[36mright\u001B[0m: `\u001B[33m10\u001B[0m`";
153
153
  const result = ansiToPlainText(ansiString);
154
154
  expect(result).toMatchInlineSnapshot(`
155
155
  "thread 'main' panicked at 'assertion failed: \`(left == right)\`'
@@ -160,7 +160,7 @@ describe("ansiToPlainText", () => {
160
160
 
161
161
  test("handles mix of 8-bit and 256-color ANSI codes", () => {
162
162
  const ansiString =
163
- "\x1b[38;5;196mBright Red\x1b[0m and \x1b[38;5;46mBright Green\x1b[0m text";
163
+ "\u001B[38;5;196mBright Red\u001B[0m and \u001B[38;5;46mBright Green\u001B[0m text";
164
164
  const result = ansiToPlainText(ansiString);
165
165
  expect(result).toMatchInlineSnapshot(`"Bright Red and Bright Green text"`);
166
166
  });
@@ -740,7 +740,7 @@ describe("MultiColumn", () => {
740
740
  });
741
741
 
742
742
  it("creates from ids and columns", () => {
743
- const idAndColumns: Array<[string, number | undefined | null]> = [
743
+ const idAndColumns: [string, number | undefined | null][] = [
744
744
  ["A1", 0],
745
745
  ["A2", 0],
746
746
  ["B1", 1],
@@ -1991,4 +1991,52 @@ describe("CollapsibleTree.fromWithPreviousShape", () => {
1991
1991
  expect(tree.isCollapsed("one")).toBe(false);
1992
1992
  expect(tree.topLevelIds).toEqual(["one", "three", "four"]);
1993
1993
  });
1994
+
1995
+ it("reproduces GitHub issue #6188: inOrderIds with nested collapses", () => {
1996
+ // Simplified reproduction case:
1997
+ // Cell A (markdown): # Section 1 Header
1998
+ // Cell B (markdown): ## Subsection 1.1 Header
1999
+ // Cell C (python): print("This cell should be in Subsection 1.1")
2000
+ // Cell D (python): print("This cell should also be in Subsection 1.1")
2001
+ // Cell E (markdown): ## Subsection 1.2 Header
2002
+ // Cell F (python): print("This cell should be in Subsection 1.2")
2003
+
2004
+ const originalOrder = [
2005
+ "CellA", // # Section 1 Header
2006
+ "CellB", // ## Subsection 1.1 Header
2007
+ "CellC", // print("This cell should be in Subsection 1.1")
2008
+ "CellD", // print("This cell should also be in Subsection 1.1")
2009
+ "CellE", // ## Subsection 1.2 Header
2010
+ "CellF", // print("This cell should be in Subsection 1.2")
2011
+ ];
2012
+
2013
+ // Create notebook with one column
2014
+ let notebook = MultiColumn.from([originalOrder]);
2015
+
2016
+ // Before collapsing, order should be correct
2017
+ expect(notebook.inOrderIds).toEqual(originalOrder);
2018
+
2019
+ const columnId = notebook.getColumnIds()[0];
2020
+
2021
+ // Follow the exact reproduction steps from the GitHub issue:
2022
+ // 1. Collapse B (subsection 1.1) - includes C, D (stops before E)
2023
+ notebook = notebook.transform(columnId, (tree) =>
2024
+ tree.collapse("CellB", "CellD"),
2025
+ );
2026
+
2027
+ // 2. Collapse E (subsection 1.2) - includes F (to end)
2028
+ notebook = notebook.transform(columnId, (tree) =>
2029
+ tree.collapse("CellE", undefined),
2030
+ );
2031
+
2032
+ // 3. Collapse A (section 1) - includes all the rest (B, E and their children)
2033
+ notebook = notebook.transform(columnId, (tree) =>
2034
+ tree.collapse("CellA", undefined),
2035
+ );
2036
+
2037
+ const finalOrder = notebook.inOrderIds;
2038
+
2039
+ // inOrderIds now correctly preserves logical order even with nested collapses
2040
+ expect(finalOrder).toEqual(originalOrder);
2041
+ });
1994
2042
  });
@@ -29,7 +29,7 @@ interface TestValue {
29
29
 
30
30
  interface SerializableValue {
31
31
  id: string;
32
- data: Array<[string, number]>;
32
+ data: [string, number][];
33
33
  }
34
34
 
35
35
  describe("adaptForLocalStorage", () => {
@@ -6,14 +6,20 @@ import { extractAllTracebackInfo } from "../traceback";
6
6
  describe("traceback", () => {
7
7
  test("extracts cell-link", () => {
8
8
  const errors = extractAllTracebackInfo(Tracebacks.raw);
9
- expect(errors).toMatchInlineSnapshot(`
9
+ expect(
10
+ errors[0].kind === "file" &&
11
+ errors[0].filePath.endsWith("marimo/_runtime/executor.py"),
12
+ ).toBe(true);
13
+ expect(errors.slice(1)).toMatchInlineSnapshot(`
10
14
  [
11
15
  {
12
16
  "cellId": "Hbol",
17
+ "kind": "cell",
13
18
  "lineNumber": 4,
14
19
  },
15
20
  {
16
21
  "cellId": "Hbol",
22
+ "kind": "cell",
17
23
  "lineNumber": 2,
18
24
  },
19
25
  ]
@@ -22,10 +28,15 @@ describe("traceback", () => {
22
28
 
23
29
  test("extracts cell-link from assertion", () => {
24
30
  const info = extractAllTracebackInfo(Tracebacks.assertion);
25
- expect(info).toMatchInlineSnapshot(`
31
+ expect(
32
+ info[0].kind === "file" &&
33
+ info[0].filePath.endsWith("marimo/_runtime/executor.py"),
34
+ ).toBe(true);
35
+ expect(info.slice(1)).toMatchInlineSnapshot(`
26
36
  [
27
37
  {
28
38
  "cellId": "Hbol",
39
+ "kind": "cell",
29
40
  "lineNumber": 1,
30
41
  },
31
42
  ]
@@ -55,7 +55,7 @@ export function arrayShallowEquals<T>(a: T[], b: T[]): boolean {
55
55
  export const Arrays = {
56
56
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
57
  EMPTY: [] as any,
58
- zip: <T, U>(a: T[], b: U[]): Array<[T, U]> => {
58
+ zip: <T, U>(a: T[], b: U[]): [T, U][] => {
59
59
  invariant(a.length === b.length, "Arrays must be the same length");
60
60
  return a.map((item, i) => [item, b[i]]);
61
61
  },
@@ -79,11 +79,7 @@ type Middleware<State> = (
79
79
  export function createReducerAndAtoms<
80
80
  State,
81
81
  RH extends ReducerHandlers<NoInfer<State>>,
82
- >(
83
- initialState: () => State,
84
- reducers: RH,
85
- middleware?: Array<Middleware<State>>,
86
- ) {
82
+ >(initialState: () => State, reducers: RH, middleware?: Middleware<State>[]) {
87
83
  const { reducer, createActions } = createReducer(initialState, reducers);
88
84
 
89
85
  const reducerWithMiddleware = (state: State, action: ReducerAction<any>) => {
@@ -1,7 +1,6 @@
1
1
  /* Copyright 2024 Marimo. All rights reserved. */
2
- import { get, set } from "lodash-es";
2
+ import { set } from "lodash-es";
3
3
  import { invariant } from "./invariant";
4
- import { type Base64String, type ByteString, typedAtob } from "./json/base64";
5
4
  import { Logger } from "./Logger";
6
5
 
7
6
  /**
@@ -9,8 +8,8 @@ import { Logger } from "./Logger";
9
8
  */
10
9
  export function updateBufferPaths<T extends Record<string, unknown>>(
11
10
  inputObject: T,
12
- bufferPaths: Array<Array<string | number>> | null | undefined,
13
- buffers?: Base64String[] | null | undefined,
11
+ bufferPaths: readonly (readonly (string | number)[])[],
12
+ buffers: readonly DataView[],
14
13
  ): T {
15
14
  // If no buffer paths, return the original object
16
15
  if (!bufferPaths || bufferPaths.length === 0) {
@@ -30,25 +29,13 @@ export function updateBufferPaths<T extends Record<string, unknown>>(
30
29
  for (const [i, bufferPath] of bufferPaths.entries()) {
31
30
  // If buffers exists, we use that value
32
31
  // Otherwise we grab it from inside the inputObject
33
- const bytes: ByteString = buffers
34
- ? typedAtob(buffers[i])
35
- : get(object, bufferPath);
36
- if (!bytes) {
32
+ const dataView = buffers[i];
33
+ if (!dataView) {
37
34
  Logger.warn("Could not find buffer at path", bufferPath);
38
35
  continue;
39
36
  }
40
- const buffer = byteStringToDataView(bytes);
41
- object = set(object, bufferPath, buffer);
37
+ object = set(object, bufferPath, dataView);
42
38
  }
43
39
 
44
40
  return object;
45
41
  }
46
-
47
- export const byteStringToDataView = (bytes: ByteString) => {
48
- const buffer = new ArrayBuffer(bytes.length);
49
- const view = new DataView(buffer);
50
- for (let i = 0; i < bytes.length; i++) {
51
- view.setUint8(i, bytes.charCodeAt(i));
52
- }
53
- return view;
54
- };
@@ -134,7 +134,7 @@ export function mergeArray<T, U>(
134
134
  arr2: U[],
135
135
  equals: (a: T, b: U) => boolean,
136
136
  stub: T,
137
- ): { merged: Array<T | null>; edits: EditDistanceResult } {
137
+ ): { merged: (T | null)[]; edits: EditDistanceResult } {
138
138
  const edits = editDistanceGeneral(arr1, arr2, equals);
139
139
  return {
140
140
  merged: applyOperationsWithStub(arr1, edits.operations, stub),
@@ -34,7 +34,7 @@ export function blobToString(
34
34
  *
35
35
  * Returns a promised array of tuples [file name, file contents].
36
36
  */
37
- export function filesToBase64(files: File[]): Promise<Array<[string, string]>> {
37
+ export function filesToBase64(files: File[]): Promise<[string, string][]> {
38
38
  return Promise.all(
39
39
  files.map((file) =>
40
40
  blobToString(file, "base64").then(