@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
@@ -103,6 +103,9 @@ export class MarkdownLanguageAdapter
103
103
  code: string,
104
104
  metadata: MarkdownLanguageAdapterMetadata,
105
105
  ): [string, number] {
106
+ // NB. Must be kept consistent with marimo/_convert/utils.py
107
+ // ::markdown_to_marimo
108
+
106
109
  // Empty string
107
110
  if (code === "") {
108
111
  // Need at least a space, otherwise the output will be 6 quotes
@@ -152,7 +155,7 @@ export class MarkdownLanguageAdapter
152
155
  const tree = pythonLanguage.parser.parse(pythonCode);
153
156
 
154
157
  // This is the exact match of mo.md() signature
155
- const enterOrder: Array<{ match: string | RegExp; stop?: boolean }> = [
158
+ const enterOrder: { match: string | RegExp; stop?: boolean }[] = [
156
159
  { match: "Script" },
157
160
  { match: "ExpressionStatement" },
158
161
  { match: "CallExpression" },
@@ -29,20 +29,26 @@ export function clearSqlValidationError(cellId: CellId) {
29
29
  store.set(sqlValidationErrorsAtom, newErrors);
30
30
  }
31
31
 
32
+ export function clearAllSqlValidationErrors() {
33
+ store.set(sqlValidationErrorsAtom, new Map<CellId, SQLValidationError>());
34
+ }
35
+
32
36
  export function setSqlValidationError({
33
37
  cellId,
34
- error,
38
+ errorMessage,
35
39
  dialect,
36
40
  }: {
37
41
  cellId: CellId;
38
- error: string;
42
+ errorMessage: string;
39
43
  dialect: SupportedDialects | null;
40
44
  }) {
41
45
  const sqlValidationErrors = store.get(sqlValidationErrorsAtom);
42
46
  const newErrors = new Map(sqlValidationErrors);
43
47
 
44
48
  const errorResult: SQLValidationError =
45
- dialect === "DuckDB" ? handleDuckdbError(error) : splitErrorMessage(error);
49
+ dialect === "DuckDB"
50
+ ? handleDuckdbError(errorMessage)
51
+ : splitErrorMessage(errorMessage);
46
52
 
47
53
  newErrors.set(cellId, errorResult);
48
54
  store.set(sqlValidationErrorsAtom, newErrors);
@@ -0,0 +1,160 @@
1
+ /* Copyright 2024 Marimo. All rights reserved. */
2
+
3
+ import type { Completion } from "@codemirror/autocomplete";
4
+ import type { SQLNamespace } from "@codemirror/lang-sql";
5
+ import { createRoot } from "react-dom/client";
6
+ import type {
7
+ Database,
8
+ DatabaseSchema,
9
+ DataTable,
10
+ DataTableColumn,
11
+ } from "@/core/kernel/messages";
12
+ import {
13
+ renderColumnInfo,
14
+ renderDatabaseInfo,
15
+ renderSchemaInfo,
16
+ renderTableInfo,
17
+ } from "./renderers";
18
+
19
+ /**
20
+ * Simple builder for SQL completion schemas.
21
+ */
22
+ export class CompletionBuilder {
23
+ private schema: Record<string, SQLNamespace> = {};
24
+
25
+ /**
26
+ * Add a table with its columns at the specified path
27
+ */
28
+ addTable(path: string[], table: DataTable): this {
29
+ const tableNamespace: SQLNamespace = {
30
+ self: tableToCompletion({
31
+ table: table,
32
+ }),
33
+ children: table.columns.map((col) =>
34
+ columnToCompletion({
35
+ column: col,
36
+ }),
37
+ ),
38
+ };
39
+
40
+ this.setAt([...path, table.name], tableNamespace);
41
+ return this;
42
+ }
43
+
44
+ /**
45
+ * Add a schema at the specified path
46
+ */
47
+ addSchema(path: string[], schema: DatabaseSchema): this {
48
+ const schemaObject: SQLNamespace = {
49
+ self: schemaToCompletion({
50
+ namespace: schema,
51
+ path: path,
52
+ }),
53
+ children: {},
54
+ };
55
+
56
+ this.setAt(path, schemaObject);
57
+ return this;
58
+ }
59
+
60
+ /**
61
+ * Add a database at the specified path
62
+ */
63
+ addDatabase(path: string[], database: Database): this {
64
+ const databaseObject: SQLNamespace = {
65
+ self: databaseToCompletion({
66
+ namespace: database,
67
+ path: path,
68
+ }),
69
+ children: {},
70
+ };
71
+ this.setAt(path, databaseObject);
72
+ return this;
73
+ }
74
+
75
+ /**
76
+ * Set a value at a nested path, creating intermediate objects as needed
77
+ */
78
+ private setAt(path: string[], value: SQLNamespace): void {
79
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
80
+ let current: any = this.schema;
81
+ for (const key of path.slice(0, -1)) {
82
+ if (!current[key]) {
83
+ current[key] = { children: {} };
84
+ }
85
+ current = current[key].children;
86
+ }
87
+ current[path[path.length - 1]] = value;
88
+ }
89
+
90
+ /**
91
+ * Build the final schema
92
+ */
93
+ build(): SQLNamespace {
94
+ return this.schema;
95
+ }
96
+
97
+ /**
98
+ * Reset for reuse
99
+ */
100
+ reset(): this {
101
+ this.schema = {};
102
+ return this;
103
+ }
104
+ }
105
+
106
+ function columnToCompletion(opts: { column: DataTableColumn }): Completion {
107
+ return {
108
+ label: opts.column.name,
109
+ type: "column",
110
+ info: () => {
111
+ const dom = document.createElement("div");
112
+ createRoot(dom).render(renderColumnInfo(opts.column));
113
+ return { dom: dom };
114
+ },
115
+ };
116
+ }
117
+
118
+ function tableToCompletion(opts: { table: DataTable }): Completion {
119
+ return {
120
+ label: opts.table.name,
121
+ type: "table",
122
+ info: () => {
123
+ const dom = document.createElement("div");
124
+ createRoot(dom).render(renderTableInfo(opts.table));
125
+ return { dom: dom };
126
+ },
127
+ };
128
+ }
129
+
130
+ function schemaToCompletion(opts: {
131
+ namespace: DatabaseSchema;
132
+ path: string[];
133
+ }): Completion {
134
+ return {
135
+ label: opts.namespace.name,
136
+ detail: opts.path.join("."),
137
+ type: "schema",
138
+ info: () => {
139
+ const dom = document.createElement("div");
140
+ createRoot(dom).render(renderSchemaInfo(opts.namespace));
141
+ return { dom: dom };
142
+ },
143
+ };
144
+ }
145
+
146
+ function databaseToCompletion(opts: {
147
+ namespace: Database;
148
+ path: string[];
149
+ }): Completion {
150
+ return {
151
+ label: opts.namespace.name,
152
+ detail: opts.path.join("."),
153
+ type: "database",
154
+ info: () => {
155
+ const dom = document.createElement("div");
156
+ createRoot(dom).render(renderDatabaseInfo(opts.namespace));
157
+ return { dom: dom };
158
+ },
159
+ };
160
+ }
@@ -7,6 +7,7 @@ import {
7
7
  } from "@codemirror/lang-sql";
8
8
  import type { EditorState } from "@codemirror/state";
9
9
  import { DefaultSqlTooltipRenders } from "@marimo-team/codemirror-sql";
10
+ import { once } from "@/utils/once";
10
11
  import { languageMetadataField } from "../../metadata";
11
12
  import { SCHEMA_CACHE } from "./completion-store";
12
13
  import type { SQLLanguageAdapterMetadata } from "./sql";
@@ -28,7 +29,12 @@ export function tablesCompletionSource(): CompletionSource {
28
29
  return null;
29
30
  }
30
31
 
31
- return schemaCompletionSource(config)(ctx);
32
+ const completions = schemaCompletionSource(config)(ctx);
33
+ if (!completions) {
34
+ return null;
35
+ }
36
+
37
+ return completions;
32
38
  };
33
39
  }
34
40
 
@@ -84,7 +90,7 @@ export function customKeywordCompletionSource(): CompletionSource {
84
90
  }
85
91
 
86
92
  // e.g. lazily load keyword docs
87
- const getKeywordDocs = async (): Promise<Record<string, unknown>> => {
93
+ const getKeywordDocs = once(async (): Promise<Record<string, unknown>> => {
88
94
  const keywords = await import(
89
95
  "@marimo-team/codemirror-sql/data/common-keywords.json"
90
96
  );
@@ -96,4 +102,4 @@ const getKeywordDocs = async (): Promise<Record<string, unknown>> => {
96
102
  ...keywords.default.keywords,
97
103
  ...duckdbKeywords.default.keywords,
98
104
  };
99
- };
105
+ });
@@ -1,6 +1,7 @@
1
1
  /* Copyright 2024 Marimo. All rights reserved. */
2
2
 
3
3
  import type { SQLConfig, SQLDialect } from "@codemirror/lang-sql";
4
+ import { atom } from "jotai";
4
5
  import { isSchemaless } from "@/components/datasources/utils";
5
6
  import { dataConnectionsMapAtom } from "@/core/datasets/data-source-connections";
6
7
  import type { ConnectionName } from "@/core/datasets/engines";
@@ -8,14 +9,22 @@ import { datasetTablesAtom } from "@/core/datasets/state";
8
9
  import type { DataSourceConnection } from "@/core/kernel/messages";
9
10
  import { store } from "@/core/state/jotai";
10
11
  import { LRUCache } from "@/utils/lru";
12
+ import { CompletionBuilder } from "./completion-builder";
11
13
  import { guessDialect, ModifiedStandardSQL } from "./utils";
12
14
 
13
- type TableToCols = Record<string, string[]>;
14
- type Schemas = Record<string, TableToCols>;
15
15
  type CachedSchema = Pick<SQLConfig, "schema" | "defaultSchema"> & {
16
16
  shouldAddLocalTables: boolean;
17
17
  };
18
18
 
19
+ const datasetTableCompletionsAtom = atom((get) => {
20
+ const tables = get(datasetTablesAtom);
21
+ const builder = new CompletionBuilder();
22
+ for (const table of tables) {
23
+ builder.addTable([], table);
24
+ }
25
+ return builder.build();
26
+ });
27
+
19
28
  class SQLCompletionStore {
20
29
  private cache: LRUCache<DataSourceConnection, CachedSchema>;
21
30
 
@@ -33,81 +42,74 @@ class SQLCompletionStore {
33
42
  }
34
43
 
35
44
  private getConnectionSchema(connection: DataSourceConnection): CachedSchema {
36
- const schemaMap: Record<string, TableToCols> = {};
37
- const databaseMap: Record<string, Schemas> = {};
45
+ const { default_database, databases, default_schema } = connection;
46
+ const builder = new CompletionBuilder();
38
47
 
39
48
  // When there is only one database, it is the default
40
- const defaultDb = connection.databases.find(
41
- (db) =>
42
- db.name === connection.default_database ||
43
- connection.databases.length === 1,
49
+ const defaultDb = databases.find(
50
+ (db) => db.name === default_database || databases.length === 1,
44
51
  );
45
52
 
46
- const dbToVerify = defaultDb ?? connection.databases[0];
53
+ const dbToVerify = defaultDb ?? databases[0];
47
54
  const isSchemalessDb =
48
55
  dbToVerify?.schemas.some((schema) => isSchemaless(schema.name)) ?? false;
49
56
 
50
57
  // For schemaless databases, treat databases as schemas
51
58
  if (isSchemalessDb) {
52
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
- const dbToTablesMap: Record<string, any> = {};
54
-
55
- for (const db of connection.databases) {
59
+ for (const db of databases) {
56
60
  const isDefaultDb = db.name === defaultDb?.name;
57
-
58
- for (const schema of db.schemas) {
59
- for (const table of schema.tables) {
60
- const columns = table.columns.map((col) => col.name);
61
-
62
- if (isDefaultDb) {
63
- // For default database, add tables directly to top level
64
- dbToTablesMap[table.name] = columns;
65
- } else {
66
- // Otherwise nest under database name
67
- dbToTablesMap[db.name] = dbToTablesMap[db.name] || {};
68
- dbToTablesMap[db.name][table.name] = columns;
69
- }
61
+ const tables = db.schemas.flatMap((schema) => schema.tables);
62
+ builder.addDatabase([db.name], db);
63
+
64
+ for (const table of tables) {
65
+ if (isDefaultDb) {
66
+ // For default database, add tables directly to top level
67
+ builder.addTable([], table);
68
+ } else {
69
+ // Otherwise nest under database name
70
+ builder.addTable([db.name], table);
70
71
  }
71
72
  }
72
73
  }
73
74
 
74
75
  return {
75
76
  shouldAddLocalTables: false,
76
- schema: dbToTablesMap,
77
+ schema: builder.build(),
77
78
  defaultSchema: defaultDb?.name,
78
79
  };
79
80
  }
80
81
 
81
- // For default db, we can use the schema name directly
82
- for (const schema of defaultDb?.schemas ?? []) {
83
- schemaMap[schema.name] = {};
84
- for (const table of schema.tables) {
85
- const columns = table.columns.map((col) => col.name);
86
- schemaMap[schema.name][table.name] = columns;
82
+ // For default db, we can use the schema name directly so add them to the top level
83
+ if (defaultDb) {
84
+ for (const schema of defaultDb.schemas) {
85
+ builder.addSchema([schema.name], schema);
86
+
87
+ for (const table of schema.tables) {
88
+ builder.addTable([schema.name], table);
89
+ }
87
90
  }
88
91
  }
89
92
 
90
93
  // Otherwise, we need to use the fully qualified name
91
- for (const database of connection.databases) {
92
- if (database.name === defaultDb?.name) {
93
- continue;
94
- }
95
- databaseMap[database.name] = {};
94
+ for (const database of databases) {
95
+ // We still want to add the default database here in case
96
+ // users want fully qualified names for completions
97
+
98
+ builder.addDatabase([database.name], database);
96
99
 
97
100
  for (const schema of database.schemas) {
98
- databaseMap[database.name][schema.name] = {};
101
+ builder.addSchema([database.name, schema.name], schema);
99
102
 
100
103
  for (const table of schema.tables) {
101
- const columns = table.columns.map((col) => col.name);
102
- databaseMap[database.name][schema.name][table.name] = columns;
104
+ builder.addTable([database.name, schema.name], table);
103
105
  }
104
106
  }
105
107
  }
106
108
 
107
109
  return {
108
110
  shouldAddLocalTables: true,
109
- schema: { ...databaseMap, ...schemaMap },
110
- defaultSchema: connection.default_schema ?? undefined,
111
+ schema: builder.build(),
112
+ defaultSchema: default_schema ?? undefined,
111
113
  };
112
114
  }
113
115
 
@@ -142,15 +144,9 @@ class SQLCompletionStore {
142
144
  }
143
145
 
144
146
  const getTablesMap = () => {
145
- const localTables = store.get(datasetTablesAtom);
146
147
  // If there is a conflict with connection tables,
147
148
  // the engine will prioritize the connection tables without special handling
148
- const tablesMap: TableToCols = {};
149
- for (const table of localTables) {
150
- const tableColumns = table.columns.map((col) => col.name);
151
- tablesMap[table.name] = tableColumns;
152
- }
153
- return tablesMap;
149
+ return store.get(datasetTableCompletionsAtom);
154
150
  };
155
151
 
156
152
  const schema = this.cache.getOrCreate(connection);