@marimo-team/frontend 0.16.0 → 0.16.1

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 (257) hide show
  1. package/dist/assets/ConnectedDataExplorerComponent-2wVcyvDj.js +19 -0
  2. package/dist/assets/{ImageComparisonComponent-fTHv1Ih0.js → ImageComparisonComponent-D2j6i0hv.js} +1 -1
  3. package/dist/assets/{VegaLite-Bdi-TyfY.js → VegaLite-BckFaf2D.js} +1 -1
  4. package/dist/assets/_baseEach-CvTX9w0Y.js +1 -0
  5. package/dist/assets/_baseMap-CtlwA90f.js +1 -0
  6. package/dist/assets/_baseUniq-BKktIGQ1.js +1 -0
  7. package/dist/assets/{_createAggregator-DcD0kTA5.js → _createAggregator-C5CVY-0t.js} +1 -1
  8. package/dist/assets/{agent-panel-Crv430aI.js → agent-panel-RGLNjkYe.js} +76 -57
  9. package/dist/assets/{any-language-editor-CQh552Wu.js → any-language-editor-DjuXwGCA.js} +1 -1
  10. package/dist/assets/{architectureDiagram-W76B3OCA-BAJeBxzt.js → architectureDiagram-W76B3OCA-Dyj4ds_R.js} +1 -1
  11. package/dist/assets/{between-horizontal-start-Boxgxbt_.js → between-horizontal-start-Dt2aKpPf.js} +1 -1
  12. package/dist/assets/{blockDiagram-QIGZ2CNN-CL-1svEK.js → blockDiagram-QIGZ2CNN-o-i7DDvN.js} +1 -1
  13. package/dist/assets/{c4Diagram-FPNF74CW-BbEqbCTl.js → c4Diagram-FPNF74CW-DGHEwWrx.js} +1 -1
  14. package/dist/assets/channel-Co6iMgWq.js +1 -0
  15. package/dist/assets/chat-panel-9alr8FS4.js +3 -0
  16. package/dist/assets/{chunk-4BX2VUAB-C--8TXeE.js → chunk-4BX2VUAB-BJecb-Ri.js} +1 -1
  17. package/dist/assets/{chunk-55IACEB6-Bj00HDqq.js → chunk-55IACEB6-CAATkc4w.js} +1 -1
  18. package/dist/assets/{chunk-FMBD7UC4-C-lhB6hN.js → chunk-FMBD7UC4-DPuNbQ-f.js} +1 -1
  19. package/dist/assets/{chunk-K7UQS3LO-B-pGTXPt.js → chunk-K7UQS3LO-C8TWVLiH.js} +1 -1
  20. package/dist/assets/{chunk-QN33PNHL-DqUzGhvm.js → chunk-QN33PNHL-DiZZ09q4.js} +1 -1
  21. package/dist/assets/{chunk-QZHKN3VN-TntJHfSk.js → chunk-QZHKN3VN-BIUM7usu.js} +1 -1
  22. package/dist/assets/{chunk-TVAH2DTR-HUJb1psV.js → chunk-TVAH2DTR-vGTArPBG.js} +1 -1
  23. package/dist/assets/{chunk-TZMSLE5B-BK3C__t3.js → chunk-TZMSLE5B-D2KRqp_x.js} +1 -1
  24. package/dist/assets/{circle-play-DBLOv1Yu.js → circle-play-cjeNez0N.js} +1 -1
  25. package/dist/assets/classDiagram-KNZD7YFC-BbJ0rY3y.js +1 -0
  26. package/dist/assets/classDiagram-v2-RKCZMP56-BbJ0rY3y.js +1 -0
  27. package/dist/assets/{clear-button-BeoFbEKH.js → clear-button-C97JtAez.js} +1 -1
  28. package/dist/assets/clone-BMP0PsTa.js +1 -0
  29. package/dist/assets/{command-palette-CXZiSv0I.js → command-palette-B93Pjcky.js} +1 -1
  30. package/dist/assets/{common-C7oJcmCT.js → common-Du9rSOwD.js} +1 -1
  31. package/dist/assets/{compile-7L0MwhyI.js → compile-CZXqyOxa.js} +1 -1
  32. package/dist/assets/{cose-bilkent-S5V4N54A-BMkGLcVC.js → cose-bilkent-S5V4N54A-CqUN5Y9b.js} +1 -1
  33. package/dist/assets/{dagre-5GWH7T2D-BJtRienS.js → dagre-5GWH7T2D-RJqTI9DM.js} +1 -1
  34. package/dist/assets/{data-grid-overlay-editor-DBkmGtNs.js → data-grid-overlay-editor-DZN0q1LV.js} +1 -1
  35. package/dist/assets/datasources-panel-v7H3cR0p.js +1 -0
  36. package/dist/assets/{dependency-graph-panel-DEdOxp2X.js → dependency-graph-panel-CEog_O7V.js} +1 -1
  37. package/dist/assets/{diagram-N5W7TBWH-CmECY3nb.js → diagram-N5W7TBWH-D-l4zZ9d.js} +1 -1
  38. package/dist/assets/{diagram-QEK2KX5R-DMOVSNKD.js → diagram-QEK2KX5R-CCOmBUt-.js} +1 -1
  39. package/dist/assets/{diagram-S2PKOQOG-BiJ96PNQ.js → diagram-S2PKOQOG-C_I_9jnZ.js} +1 -1
  40. package/dist/assets/{documentation-panel-xULhaEv3.js → documentation-panel-C1BtMZ3M.js} +1 -1
  41. package/dist/assets/edit-page-B-oevUZ9.js +129 -0
  42. package/dist/assets/{ellipsis-vertical-BBqXIlc2.js → ellipsis-vertical-BEb-J8z6.js} +1 -1
  43. package/dist/assets/{empty-state-B3dA3G5P.js → empty-state-C99UyDE3.js} +1 -1
  44. package/dist/assets/{erDiagram-AWTI2OKA-MP1DiFRo.js → erDiagram-AWTI2OKA-BePOLi5M.js} +1 -1
  45. package/dist/assets/{error-panel-Cc1sv-Ag.js → error-panel-Bs34jXFh.js} +1 -1
  46. package/dist/assets/file-explorer-panel-Ck6UL861.js +1 -0
  47. package/dist/assets/{flowDiagram-PVAE7QVJ-BX7caPp7.js → flowDiagram-PVAE7QVJ-BgjFu5l7.js} +1 -1
  48. package/dist/assets/{ganttDiagram-OWAHRB6G-B462g4Yf.js → ganttDiagram-OWAHRB6G-YOPb3XSV.js} +4 -4
  49. package/dist/assets/{gitGraphDiagram-NY62KEGX-CGgvZ9-9.js → gitGraphDiagram-NY62KEGX-CGhqaDTy.js} +1 -1
  50. package/dist/assets/{glide-data-editor-C0gUFZON.js → glide-data-editor-9QUH6iso.js} +11 -11
  51. package/dist/assets/{graph-CHRVBzY5.js → graph-DQQFGrho.js} +1 -1
  52. package/dist/assets/home-page-DRKpPCrF.js +9 -0
  53. package/dist/assets/{index-C1v_Z9et.js → index-2252nrk6.js} +1 -1
  54. package/dist/assets/{index-CQDrxQ0j.js → index-Aeo6WiK7.js} +1 -1
  55. package/dist/assets/{index-C4Tn5NvJ.js → index-B8jXZ12t.js} +1 -1
  56. package/dist/assets/{index-DoRmcrKM.js → index-BAbIIxHU.js} +1 -1
  57. package/dist/assets/{index-BY93Ejhl.js → index-BJNCMUmG.js} +1 -1
  58. package/dist/assets/{index-CpTPJo4k.js → index-BW3k9Gss.js} +1 -1
  59. package/dist/assets/{index-D1vmG6DS.js → index-BjgnbONl.js} +1 -1
  60. package/dist/assets/{index-z9bohSQJ.js → index-BprjMYH5.js} +1 -1
  61. package/dist/assets/{index-BVgAenPd.js → index-C1ez98sk.js} +1 -1
  62. package/dist/assets/{index-D9UKkrr2.js → index-C2MD0vgD.js} +1 -1
  63. package/dist/assets/index-C7CoaNFb.js +578 -0
  64. package/dist/assets/{index-C-GhZ7ti.js → index-CFKO7WXI.js} +1 -1
  65. package/dist/assets/{index-lYa_leQE.js → index-CUFv_thQ.js} +1 -1
  66. package/dist/assets/{index-vmICa5KN.js → index-C_tkBKNO.js} +1 -1
  67. package/dist/assets/{index-C77h_TXN.js → index-CfaDbEdi.js} +1 -1
  68. package/dist/assets/{index-DEQvTChO.js → index-ClzeQrN7.js} +1 -1
  69. package/dist/assets/index-DadI618h.css +1 -0
  70. package/dist/assets/{index-DRMm6SNo.js → index-DdnKZNxM.js} +1 -1
  71. package/dist/assets/{index-CWMgowgL.js → index-G5QZppK2.js} +1 -1
  72. package/dist/assets/{index-Clbi_Yaq.js → index-SGLNXrGP.js} +1 -1
  73. package/dist/assets/{index-C-8WADat.js → index-aE43R74q.js} +1 -1
  74. package/dist/assets/infoDiagram-STP46IZ2-CJLOpSAf.js +2 -0
  75. package/dist/assets/{isEmpty-DU_ogP_D.js → isEmpty-D-4c7sMv.js} +1 -1
  76. package/dist/assets/{journeyDiagram-BIP6EPQ6-C6EgLP_Q.js → journeyDiagram-BIP6EPQ6-C94u3Mv3.js} +1 -1
  77. package/dist/assets/{kanban-definition-6OIFK2YF-BXzYO1yj.js → kanban-definition-6OIFK2YF-BEXYFzz7.js} +1 -1
  78. package/dist/assets/{layout-jihVw5-i.js → layout-Bz2BJ2ru.js} +1 -1
  79. package/dist/assets/{linear-C4blANlC.js → linear-D8s7K76e.js} +1 -1
  80. package/dist/assets/links-BpXlz1GG.js +7 -0
  81. package/dist/assets/{logs-panel-D401qzZh.js → logs-panel-DC7wpmPz.js} +1 -1
  82. package/dist/assets/{markdown-renderer-Cd9eYyaL.js → markdown-renderer-DRdSWR9X.js} +20 -20
  83. package/dist/assets/{mermaid-BEVuRz_O.js → mermaid-Y3x4hmD0.js} +1 -1
  84. package/dist/assets/{mermaid.core-CaSnaLH0.js → mermaid.core-DzthE35Y.js} +4 -4
  85. package/dist/assets/min-BBO3-1Hg.js +1 -0
  86. package/dist/assets/{mindmap-definition-Q6HEUPPD-BXUM5MT2.js → mindmap-definition-Q6HEUPPD-DktvuLe1.js} +1 -1
  87. package/dist/assets/{number-overlay-editor-4uWXGlPG.js → number-overlay-editor-BEfwI1IT.js} +1 -1
  88. package/dist/assets/outline-panel-CdsnAy2w.js +1 -0
  89. package/dist/assets/{packages-panel-CJL0MVlj.js → packages-panel-DiTA-d_D.js} +1 -1
  90. package/dist/assets/{pieDiagram-ADFJNKIX-Dxt5PVNo.js → pieDiagram-ADFJNKIX-DQDNQ-de.js} +1 -1
  91. package/dist/assets/{quadrantDiagram-LMRXKWRM-D4pUaA31.js → quadrantDiagram-LMRXKWRM-0kgIXc2-.js} +1 -1
  92. package/dist/assets/{react-plotly-cJZ0VWBq.js → react-plotly-DJqqfM7c.js} +1 -1
  93. package/dist/assets/{requirementDiagram-4UW4RH46-DVRTjgas.js → requirementDiagram-4UW4RH46-B5rb0ypd.js} +1 -1
  94. package/dist/assets/{run-page-BUEnMC9w.js → run-page-CFmLrv1R.js} +1 -1
  95. package/dist/assets/{sankeyDiagram-GR3RE2ED-CVFnD9C-.js → sankeyDiagram-GR3RE2ED-Dom7IlnF.js} +1 -1
  96. package/dist/assets/{scratchpad-panel-BIgRENkI.js → scratchpad-panel-CuHWpHO8.js} +1 -1
  97. package/dist/assets/{secrets-panel-xY5-V_BD.js → secrets-panel-CfHc5YD0.js} +1 -1
  98. package/dist/assets/{sequenceDiagram-C3RYC4MD-_lY4ZN_S.js → sequenceDiagram-C3RYC4MD-PNJWXQbw.js} +1 -1
  99. package/dist/assets/{slides-component-DMjQomc3.css → slides-component-C-LoGC1U.css} +1 -1
  100. package/dist/assets/{slides-component-Xjymwj7X.js → slides-component-CJgaTRZ0.js} +1 -1
  101. package/dist/assets/snippets-panel-B2EC1txM.js +1 -0
  102. package/dist/assets/sortBy-DZnlX29-.js +1 -0
  103. package/dist/assets/{state-C4NiC9tO.js → state-CWict9RU.js} +1 -1
  104. package/dist/assets/{stateDiagram-KXAO66HF-Da0JQWCn.js → stateDiagram-KXAO66HF-BE58aJnr.js} +1 -1
  105. package/dist/assets/stateDiagram-v2-UMBNRL4Z-CdThjimL.js +1 -0
  106. package/dist/assets/storage-DRaR04wR.js +26 -0
  107. package/dist/assets/{terminal-BPwTkXae.js → terminal-BX3Su5q7.js} +1 -1
  108. package/dist/assets/{time-Dv5_Ouz_.js → time-hUzZfpNE.js} +1 -1
  109. package/dist/assets/{timeline-definition-XQNQX7LJ-Dxh5Zu2e.js → timeline-definition-XQNQX7LJ-CqQP9t51.js} +1 -1
  110. package/dist/assets/tracing-B10Q1n-L.js +2 -0
  111. package/dist/assets/{tracing-panel-DAzrzNmm.js → tracing-panel-Du8WCnno.js} +2 -2
  112. package/dist/assets/{trash-Dc6DSjz_.js → trash-B81GTiv6.js} +1 -1
  113. package/dist/assets/{tree-jheoerAX.js → tree-6vW2ogkh.js} +1 -1
  114. package/dist/assets/{treemap-75Q7IDZK-IgpxeGaf.js → treemap-75Q7IDZK-CdwDwwsz.js} +27 -27
  115. package/dist/assets/variable-panel-D5qgJI7k.js +1 -0
  116. package/dist/assets/{vega-component-BpfpiPKI.js → vega-component-DJaJWMJM.js} +1 -1
  117. package/dist/assets/worker-fHbtoWvT.js +1 -0
  118. package/dist/assets/{xychartDiagram-6GGTOJPD-CmNigJ31.js → xychartDiagram-6GGTOJPD-WFtXqaM9.js} +1 -1
  119. package/dist/index.html +2 -2
  120. package/package.json +3 -2
  121. package/src/components/app-config/user-config-form.tsx +46 -1
  122. package/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap +62 -43
  123. package/src/components/chat/acp/__tests__/atoms.test.ts +1 -1
  124. package/src/components/chat/acp/__tests__/state.test.ts +36 -36
  125. package/src/components/chat/acp/agent-panel.tsx +24 -27
  126. package/src/components/chat/acp/blocks.tsx +6 -6
  127. package/src/components/chat/acp/prompt.ts +62 -43
  128. package/src/components/chat/chat-panel.tsx +5 -1
  129. package/src/components/chat/markdown-renderer.tsx +6 -10
  130. package/src/components/chat/tool-call-accordion.tsx +52 -20
  131. package/src/components/data-table/SearchBar.tsx +8 -7
  132. package/src/components/data-table/__tests__/column_formatting.test.ts +50 -35
  133. package/src/components/data-table/__tests__/data-table.test.tsx +39 -1
  134. package/src/components/data-table/cell-hover-template/feature.ts +14 -0
  135. package/src/components/data-table/cell-hover-template/types.ts +11 -0
  136. package/src/components/data-table/charts/components/form-fields.tsx +41 -37
  137. package/src/components/data-table/charts/forms/common-chart.tsx +2 -2
  138. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +5 -2
  139. package/src/components/data-table/column-formatting/feature.ts +62 -29
  140. package/src/components/data-table/column-formatting/types.ts +1 -0
  141. package/src/components/data-table/column-header.tsx +3 -1
  142. package/src/components/data-table/column-summary/chart-spec-model.tsx +24 -7
  143. package/src/components/data-table/column-summary/column-summary.tsx +18 -9
  144. package/src/components/data-table/columns.tsx +42 -18
  145. package/src/components/data-table/data-table.tsx +10 -2
  146. package/src/components/data-table/date-popover.tsx +85 -75
  147. package/src/components/data-table/filter-pills.tsx +14 -9
  148. package/src/components/data-table/header-items.tsx +5 -1
  149. package/src/components/data-table/pagination.tsx +20 -13
  150. package/src/components/data-table/renderers.tsx +28 -0
  151. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +10 -8
  152. package/src/components/datasources/column-preview.tsx +6 -2
  153. package/src/components/datasources/datasources.tsx +8 -12
  154. package/src/components/editor/ai/transport/chat-transport.tsx +4 -1
  155. package/src/components/editor/cell/CellStatus.tsx +23 -20
  156. package/src/components/editor/cell/CreateCellButton.tsx +3 -4
  157. package/src/components/editor/cell/code/language-toggle.tsx +3 -4
  158. package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +39 -28
  159. package/src/components/editor/controls/notebook-menu-dropdown.tsx +4 -2
  160. package/src/components/editor/file-tree/requesting-tree.tsx +14 -8
  161. package/src/components/editor/renderers/CellArray.tsx +3 -4
  162. package/src/components/editor/renderers/slides-layout/slides-layout.tsx +3 -3
  163. package/src/components/editor/renderers/slides-layout/types.ts +1 -0
  164. package/src/components/pages/home-page.tsx +4 -1
  165. package/src/components/slides/slides-component.tsx +1 -1
  166. package/src/components/slides/slides.css +6 -0
  167. package/src/components/terminal/theme.tsx +1 -0
  168. package/src/components/tracing/tracing-spec.ts +5 -4
  169. package/src/components/ui/range-slider.tsx +4 -2
  170. package/src/components/ui/slider.tsx +3 -1
  171. package/src/components/variables/variables-table.tsx +3 -0
  172. package/src/core/MarimoApp.tsx +9 -6
  173. package/src/core/ai/context/__tests__/registry.test.ts +6 -4
  174. package/src/core/ai/context/providers/cell-output.ts +3 -2
  175. package/src/core/ai/context/providers/error.ts +3 -1
  176. package/src/core/ai/context/providers/file.ts +7 -2
  177. package/src/core/ai/context/providers/tables.ts +3 -2
  178. package/src/core/ai/context/providers/variable.ts +6 -4
  179. package/src/core/ai/staged-cells.ts +34 -1
  180. package/src/core/cells/__tests__/add-missing-import.test.ts +67 -22
  181. package/src/core/cells/add-missing-import.ts +24 -7
  182. package/src/core/cells/cells.ts +26 -27
  183. package/src/core/cells/logs.ts +1 -1
  184. package/src/core/codemirror/find-replace/search-highlight.ts +3 -1
  185. package/src/core/codemirror/language/LanguageAdapters.ts +9 -3
  186. package/src/core/codemirror/lsp/notebook-lsp.ts +8 -2
  187. package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
  188. package/src/core/codemirror/rtc/loro/awareness.ts +52 -17
  189. package/src/core/codemirror/rtc/loro/sync.ts +12 -4
  190. package/src/core/config/config-schema.ts +1 -0
  191. package/src/core/config/config.ts +4 -0
  192. package/src/core/hotkeys/hotkeys.ts +8 -4
  193. package/src/core/i18n/__tests__/locale-provider.test.tsx +176 -0
  194. package/src/core/i18n/locale-provider.tsx +35 -0
  195. package/src/core/i18n/with-locale.tsx +12 -0
  196. package/src/core/islands/components/web-components.tsx +13 -10
  197. package/src/core/kernel/RuntimeState.ts +4 -1
  198. package/src/core/kernel/messages.ts +2 -2
  199. package/src/core/network/DeferredRequestRegistry.ts +16 -4
  200. package/src/core/runtime/runtime.ts +5 -4
  201. package/src/core/wasm/bridge.ts +5 -1
  202. package/src/core/wasm/store.ts +4 -1
  203. package/src/core/wasm/worker/message-buffer.ts +3 -2
  204. package/src/core/websocket/types.ts +22 -16
  205. package/src/hooks/useFormatting.ts +97 -0
  206. package/src/hooks/useTimer.ts +8 -5
  207. package/src/plugins/core/registerReactComponent.tsx +16 -10
  208. package/src/plugins/impl/DataTablePlugin.tsx +4 -0
  209. package/src/plugins/impl/RangeSliderPlugin.tsx +5 -3
  210. package/src/plugins/impl/SliderPlugin.tsx +3 -1
  211. package/src/plugins/impl/anywidget/model.ts +16 -5
  212. package/src/plugins/impl/data-editor/types.ts +7 -5
  213. package/src/plugins/impl/data-explorer/components/column-summary.tsx +20 -13
  214. package/src/plugins/impl/panel/utils.ts +6 -4
  215. package/src/plugins/layout/OutlinePlugin.tsx +69 -0
  216. package/src/plugins/layout/StatPlugin.tsx +4 -1
  217. package/src/plugins/plugins.ts +2 -0
  218. package/src/utils/__tests__/dates.test.ts +45 -24
  219. package/src/utils/__tests__/numbers.test.ts +42 -30
  220. package/src/utils/__tests__/once.test.ts +187 -0
  221. package/src/utils/dates.ts +15 -10
  222. package/src/utils/edit-distance.ts +8 -6
  223. package/src/utils/errors.ts +1 -1
  224. package/src/utils/id-tree.tsx +21 -10
  225. package/src/utils/localStorage.ts +13 -4
  226. package/src/utils/numbers.ts +11 -11
  227. package/src/utils/once.ts +32 -0
  228. package/src/utils/paths.ts +4 -1
  229. package/src/utils/pluralize.ts +12 -5
  230. package/src/utils/python-poet/poet.ts +30 -15
  231. package/src/utils/time.ts +5 -1
  232. package/dist/assets/ConnectedDataExplorerComponent-BErMbWvG.js +0 -19
  233. package/dist/assets/_baseEach-CNBxBxvS.js +0 -1
  234. package/dist/assets/_baseMap-D1WHjKrd.js +0 -1
  235. package/dist/assets/_baseUniq-CCgDNtZb.js +0 -1
  236. package/dist/assets/channel-_2eNSz0n.js +0 -1
  237. package/dist/assets/chat-panel-CXh5Wl6C.js +0 -3
  238. package/dist/assets/classDiagram-KNZD7YFC-BGmh9POF.js +0 -1
  239. package/dist/assets/classDiagram-v2-RKCZMP56-BGmh9POF.js +0 -1
  240. package/dist/assets/clone-BFDSPAj3.js +0 -1
  241. package/dist/assets/datasources-panel-B7FbYLiy.js +0 -1
  242. package/dist/assets/edit-page-BrYda9VE.js +0 -129
  243. package/dist/assets/file-explorer-panel-Bw59Kva1.js +0 -1
  244. package/dist/assets/home-page-Fb2osjys.js +0 -9
  245. package/dist/assets/index-Cx0bsY1w.css +0 -1
  246. package/dist/assets/index-DKEudB02.js +0 -578
  247. package/dist/assets/infoDiagram-STP46IZ2-CVyrdLc8.js +0 -2
  248. package/dist/assets/links-D59GIweI.js +0 -7
  249. package/dist/assets/min-DUMu_zeK.js +0 -1
  250. package/dist/assets/outline-panel-DIzkvm2I.js +0 -1
  251. package/dist/assets/snippets-panel-CTPYW41n.js +0 -1
  252. package/dist/assets/sortBy-BNZKwiq_.js +0 -1
  253. package/dist/assets/stateDiagram-v2-UMBNRL4Z-D5lYZOOt.js +0 -1
  254. package/dist/assets/storage-CMdLzB_c.js +0 -26
  255. package/dist/assets/tracing-BCIurUfa.js +0 -2
  256. package/dist/assets/variable-panel-DYAiLBmF.js +0 -1
  257. package/dist/assets/worker-X5rxzQGQ.js +0 -1
@@ -0,0 +1,187 @@
1
+ /* Copyright 2024 Marimo. All rights reserved. */
2
+ import { describe, expect, it, vi } from "vitest";
3
+ import { memoizeLastValue, once } from "../once";
4
+
5
+ describe("once", () => {
6
+ it("should call function only once", () => {
7
+ const fn = vi.fn(() => "result");
8
+ const onceFn = once(fn);
9
+
10
+ const result1 = onceFn();
11
+ const result2 = onceFn();
12
+
13
+ expect(result1).toBe("result");
14
+ expect(result2).toBe("result");
15
+ expect(fn).toHaveBeenCalledTimes(1);
16
+ });
17
+
18
+ it("should return the same result on subsequent calls", () => {
19
+ let counter = 0;
20
+ const fn = () => ++counter;
21
+ const onceFn = once(fn);
22
+
23
+ expect(onceFn()).toBe(1);
24
+ expect(onceFn()).toBe(1);
25
+ expect(onceFn()).toBe(1);
26
+ });
27
+ });
28
+
29
+ describe("memoizeLastValue", () => {
30
+ it("should memoize result for same arguments", () => {
31
+ const fn = vi.fn((a: number, b: string) => `${a}-${b}`);
32
+ const memoizedFn = memoizeLastValue(fn);
33
+
34
+ const result1 = memoizedFn(1, "test");
35
+ const result2 = memoizedFn(1, "test");
36
+
37
+ expect(result1).toBe("1-test");
38
+ expect(result2).toBe("1-test");
39
+ expect(fn).toHaveBeenCalledTimes(1);
40
+ });
41
+
42
+ it("should recompute for different arguments", () => {
43
+ const fn = vi.fn((a: number) => a * 2);
44
+ const memoizedFn = memoizeLastValue(fn);
45
+
46
+ const result1 = memoizedFn(5);
47
+ const result2 = memoizedFn(10);
48
+ const result3 = memoizedFn(5); // Should recompute since args changed from previous call
49
+
50
+ expect(result1).toBe(10);
51
+ expect(result2).toBe(20);
52
+ expect(result3).toBe(10);
53
+ expect(fn).toHaveBeenCalledTimes(3);
54
+ });
55
+
56
+ it("should handle no arguments", () => {
57
+ const fn = vi.fn(() => "no-args");
58
+ const memoizedFn = memoizeLastValue(fn);
59
+
60
+ const result1 = memoizedFn();
61
+ const result2 = memoizedFn();
62
+
63
+ expect(result1).toBe("no-args");
64
+ expect(result2).toBe("no-args");
65
+ expect(fn).toHaveBeenCalledTimes(1);
66
+ });
67
+
68
+ it("should handle single argument", () => {
69
+ const fn = vi.fn((x: number) => x + 1);
70
+ const memoizedFn = memoizeLastValue(fn);
71
+
72
+ expect(memoizedFn(5)).toBe(6);
73
+ expect(memoizedFn(5)).toBe(6);
74
+ expect(memoizedFn(3)).toBe(4);
75
+
76
+ expect(fn).toHaveBeenCalledTimes(2);
77
+ });
78
+
79
+ it("should handle multiple arguments", () => {
80
+ const fn = vi.fn((a: number, b: string, c: boolean) => ({ a, b, c }));
81
+ const memoizedFn = memoizeLastValue(fn);
82
+
83
+ const result1 = memoizedFn(1, "hello", true);
84
+ const result2 = memoizedFn(1, "hello", true);
85
+ const result3 = memoizedFn(1, "hello", false);
86
+
87
+ expect(result1).toEqual({ a: 1, b: "hello", c: true });
88
+ expect(result2).toEqual({ a: 1, b: "hello", c: true });
89
+ expect(result3).toEqual({ a: 1, b: "hello", c: false });
90
+ expect(fn).toHaveBeenCalledTimes(2);
91
+ });
92
+
93
+ it("should use shallow comparison for objects", () => {
94
+ const fn = vi.fn((obj: { x: number }) => obj.x * 2);
95
+ const memoizedFn = memoizeLastValue(fn);
96
+
97
+ const obj1 = { x: 5 };
98
+ const obj2 = { x: 5 }; // Different reference but same content
99
+
100
+ const result1 = memoizedFn(obj1);
101
+ const result2 = memoizedFn(obj1); // Same reference
102
+ const result3 = memoizedFn(obj2); // Different reference
103
+
104
+ expect(result1).toBe(10);
105
+ expect(result2).toBe(10);
106
+ expect(result3).toBe(10);
107
+ expect(fn).toHaveBeenCalledTimes(2); // obj1 (twice with same ref) and obj2 (different ref)
108
+ });
109
+
110
+ it("should handle arrays", () => {
111
+ const fn = vi.fn((arr: number[]) => arr.reduce((sum, x) => sum + x, 0));
112
+ const memoizedFn = memoizeLastValue(fn);
113
+
114
+ const result1 = memoizedFn([1, 2, 3]);
115
+ const result2 = memoizedFn([1, 2, 3]); // Different array reference but same content
116
+ const result3 = memoizedFn([1, 2, 4]); // Different content
117
+
118
+ expect(result1).toBe(6);
119
+ expect(result2).toBe(6);
120
+ expect(result3).toBe(7);
121
+ expect(fn).toHaveBeenCalledTimes(3); // Each call has different array reference
122
+ });
123
+
124
+ it("should handle mixed argument types", () => {
125
+ const fn = vi.fn(
126
+ (num: number, str: string, arr: number[], obj: { key: string }) =>
127
+ `${num}-${str}-${arr.length}-${obj.key}`,
128
+ );
129
+ const memoizedFn = memoizeLastValue(fn);
130
+
131
+ const arr = [1, 2, 3];
132
+ const obj = { key: "test" };
133
+
134
+ const result1 = memoizedFn(42, "hello", arr, obj);
135
+ const result2 = memoizedFn(42, "hello", arr, obj); // Same references
136
+ const result3 = memoizedFn(42, "hello", [1, 2, 3], { key: "test" }); // Different references
137
+
138
+ expect(result1).toBe("42-hello-3-test");
139
+ expect(result2).toBe("42-hello-3-test");
140
+ expect(result3).toBe("42-hello-3-test");
141
+ expect(fn).toHaveBeenCalledTimes(2);
142
+ });
143
+
144
+ it("should handle undefined and null arguments", () => {
145
+ const fn = vi.fn((a?: string, b?: null) => `${a}-${b}`);
146
+ const memoizedFn = memoizeLastValue(fn);
147
+
148
+ const result1 = memoizedFn(undefined, null);
149
+ const result2 = memoizedFn(undefined, null);
150
+ const result3 = memoizedFn("test", null);
151
+
152
+ expect(result1).toBe("undefined-null");
153
+ expect(result2).toBe("undefined-null");
154
+ expect(result3).toBe("test-null");
155
+ expect(fn).toHaveBeenCalledTimes(2);
156
+ });
157
+
158
+ it("should preserve function context", () => {
159
+ const context = {
160
+ value: 10,
161
+ fn: vi.fn(function (this: { value: number }, multiplier: number) {
162
+ return this.value * multiplier;
163
+ }),
164
+ };
165
+
166
+ const memoizedFn = memoizeLastValue(context.fn);
167
+
168
+ const result1 = memoizedFn.call(context, 2);
169
+ const result2 = memoizedFn.call(context, 2);
170
+
171
+ expect(result1).toBe(20);
172
+ expect(result2).toBe(20);
173
+ expect(context.fn).toHaveBeenCalledTimes(1);
174
+ });
175
+
176
+ it("should handle functions that throw errors", () => {
177
+ const error = new Error("test error");
178
+ const fn = vi.fn(() => {
179
+ throw error;
180
+ });
181
+ const memoizedFn = memoizeLastValue(fn);
182
+
183
+ expect(() => memoizedFn()).toThrow("test error");
184
+ expect(() => memoizedFn()).toThrow("test error"); // Should throw cached error
185
+ expect(fn).toHaveBeenCalledTimes(1); // Error should be memoized too
186
+ });
187
+ });
@@ -7,6 +7,7 @@ import { Logger } from "./Logger";
7
7
  export function prettyDate(
8
8
  value: string | number | null | undefined,
9
9
  type: "date" | "datetime",
10
+ locale: string,
10
11
  ): string {
11
12
  if (value == null) {
12
13
  return "";
@@ -16,7 +17,7 @@ export function prettyDate(
16
17
  // If type is date, drop the timezone by rendering in UTC
17
18
  // since dates are absolute
18
19
  if (type === "date") {
19
- return new Date(value).toLocaleDateString(undefined, {
20
+ return new Date(value).toLocaleDateString(locale, {
20
21
  year: "numeric",
21
22
  month: "short",
22
23
  day: "numeric",
@@ -25,7 +26,7 @@ export function prettyDate(
25
26
  }
26
27
 
27
28
  // For datetime, we keep the original timezone
28
- return new Date(value).toLocaleDateString(undefined, {
29
+ return new Date(value).toLocaleDateString(locale, {
29
30
  year: "numeric",
30
31
  month: "short",
31
32
  day: "numeric",
@@ -43,12 +44,13 @@ export function prettyDate(
43
44
  export function exactDateTime(
44
45
  value: Date,
45
46
  timezone: string | undefined,
47
+ locale: string,
46
48
  ): string {
47
49
  const hasSubSeconds = value.getUTCMilliseconds() !== 0;
48
50
  try {
49
51
  if (timezone) {
50
52
  const valueWithTimezone = new TZDate(value, timezone);
51
- const shortTimeZone = getShortTimeZone(timezone);
53
+ const shortTimeZone = getShortTimeZone(timezone, locale);
52
54
  if (hasSubSeconds) {
53
55
  return `${formatDate(valueWithTimezone, "yyyy-MM-dd HH:mm:ss.SSS")} ${shortTimeZone}`;
54
56
  }
@@ -66,9 +68,9 @@ export function exactDateTime(
66
68
  }
67
69
  }
68
70
 
69
- export function getShortTimeZone(timezone: string): string {
71
+ export function getShortTimeZone(timezone: string, locale: string): string {
70
72
  try {
71
- const abbrev = new Intl.DateTimeFormat("en-US", {
73
+ const abbrev = new Intl.DateTimeFormat(locale, {
72
74
  timeZone: timezone,
73
75
  timeZoneName: "short",
74
76
  })
@@ -88,7 +90,10 @@ export function getShortTimeZone(timezone: string): string {
88
90
  *
89
91
  * If a date in the past, it should say "<date> at 8:00 AM".
90
92
  */
91
- export function timeAgo(value: string | number | null | undefined): string {
93
+ export function timeAgo(
94
+ value: string | number | null | undefined,
95
+ locale: string,
96
+ ): string {
92
97
  if (value == null) {
93
98
  return "";
94
99
  }
@@ -103,22 +108,22 @@ export function timeAgo(value: string | number | null | undefined): string {
103
108
  yesterday.setDate(yesterday.getDate() - 1);
104
109
 
105
110
  if (date.toDateString() === today.toDateString()) {
106
- return `Today at ${date.toLocaleTimeString(undefined, {
111
+ return `Today at ${date.toLocaleTimeString(locale, {
107
112
  hour: "numeric",
108
113
  minute: "numeric",
109
114
  })}`;
110
115
  }
111
116
  if (date.toDateString() === yesterday.toDateString()) {
112
- return `Yesterday at ${date.toLocaleTimeString(undefined, {
117
+ return `Yesterday at ${date.toLocaleTimeString(locale, {
113
118
  hour: "numeric",
114
119
  minute: "numeric",
115
120
  })}`;
116
121
  }
117
- return `${date.toLocaleDateString(undefined, {
122
+ return `${date.toLocaleDateString(locale, {
118
123
  year: "numeric",
119
124
  month: "short",
120
125
  day: "numeric",
121
- })} at ${date.toLocaleTimeString(undefined, {
126
+ })} at ${date.toLocaleTimeString(locale, {
122
127
  hour: "numeric",
123
128
  minute: "numeric",
124
129
  })}`;
@@ -1,11 +1,13 @@
1
1
  /* Copyright 2024 Marimo. All rights reserved. */
2
2
 
3
- export enum OperationType {
4
- INSERT = "insert",
5
- DELETE = "delete",
6
- SUBSTITUTE = "substitute",
7
- MATCH = "match",
8
- }
3
+ export const OperationType = {
4
+ INSERT: "insert",
5
+ DELETE: "delete",
6
+ SUBSTITUTE: "substitute",
7
+ MATCH: "match",
8
+ };
9
+
10
+ type OperationType = (typeof OperationType)[keyof typeof OperationType];
9
11
 
10
12
  export interface EditOperation {
11
13
  type: OperationType;
@@ -64,7 +64,7 @@ function safeJSONParse(message: string): unknown {
64
64
 
65
65
  export class CellNotInitializedError extends Error {
66
66
  constructor(
67
- message: string = "The cell containing this UI element has not been run yet. Please run the cell first.",
67
+ message = "The cell containing this UI element has not been run yet. Please run the cell first.",
68
68
  ) {
69
69
  super(message);
70
70
  this.name = "CellNotInitializedError";
@@ -23,11 +23,15 @@ export type CellIndex = number & { __brand?: "CellIndex" };
23
23
  * Tree data structure for handling ids with nested children
24
24
  */
25
25
  export class TreeNode<T> {
26
- constructor(
27
- public value: T,
28
- public isCollapsed: boolean,
29
- public children: Array<TreeNode<T>>,
30
- ) {}
26
+ public value: T;
27
+ public isCollapsed: boolean;
28
+ public children: Array<TreeNode<T>>;
29
+
30
+ constructor(value: T, isCollapsed: boolean, children: Array<TreeNode<T>>) {
31
+ this.value = value;
32
+ this.isCollapsed = isCollapsed;
33
+ this.children = children;
34
+ }
31
35
 
32
36
  /**
33
37
  * Recursively count the number of nodes in the tree
@@ -102,10 +106,13 @@ export class TreeNode<T> {
102
106
  let uniqueId = 0;
103
107
 
104
108
  export class CollapsibleTree<T> {
105
- private constructor(
106
- public readonly nodes: Array<TreeNode<T>>,
107
- public readonly id: CellColumnId,
108
- ) {}
109
+ public readonly nodes: Array<TreeNode<T>>;
110
+ public readonly id: CellColumnId;
111
+
112
+ private constructor(nodes: Array<TreeNode<T>>, id: CellColumnId) {
113
+ this.nodes = nodes;
114
+ this.id = id;
115
+ }
109
116
 
110
117
  static from<T>(ids: T[]): CollapsibleTree<T> {
111
118
  const id = `tree_${uniqueId++}` as CellColumnId;
@@ -592,7 +599,11 @@ export class CollapsibleTree<T> {
592
599
  }
593
600
 
594
601
  export class MultiColumn<T> {
595
- constructor(private readonly columns: ReadonlyArray<CollapsibleTree<T>>) {
602
+ private readonly columns: ReadonlyArray<CollapsibleTree<T>>;
603
+
604
+ constructor(columns: ReadonlyArray<CollapsibleTree<T>>) {
605
+ this.columns = columns;
606
+
596
607
  // Ensure there is always at least one column
597
608
  if (columns.length === 0) {
598
609
  this.columns = [CollapsibleTree.from([])];
@@ -12,7 +12,10 @@ interface Storage<T> {
12
12
  }
13
13
 
14
14
  export class TypedLocalStorage<T> implements Storage<T> {
15
- constructor(private defaultValue: T) {}
15
+ private defaultValue: T;
16
+ constructor(defaultValue: T) {
17
+ this.defaultValue = defaultValue;
18
+ }
16
19
 
17
20
  get(key: string): T {
18
21
  try {
@@ -33,10 +36,16 @@ export class TypedLocalStorage<T> implements Storage<T> {
33
36
  }
34
37
 
35
38
  export class ZodLocalStorage<T> implements Storage<T> {
39
+ private schema: ZodType<T, ZodTypeDef, unknown>;
40
+ private getDefaultValue: () => T;
41
+
36
42
  constructor(
37
- private schema: ZodType<T, ZodTypeDef, unknown>,
38
- private getDefaultValue: () => T,
39
- ) {}
43
+ schema: ZodType<T, ZodTypeDef, unknown>,
44
+ getDefaultValue: () => T,
45
+ ) {
46
+ this.schema = schema;
47
+ this.getDefaultValue = getDefaultValue;
48
+ }
40
49
 
41
50
  get(key: string): T {
42
51
  try {
@@ -1,6 +1,6 @@
1
1
  /* Copyright 2024 Marimo. All rights reserved. */
2
2
 
3
- export function prettyNumber(value: unknown): string {
3
+ export function prettyNumber(value: unknown, locale: string): string {
4
4
  if (value === undefined || value === null) {
5
5
  return "";
6
6
  }
@@ -18,7 +18,7 @@ export function prettyNumber(value: unknown): string {
18
18
  }
19
19
 
20
20
  if (typeof value === "number" || typeof value === "bigint") {
21
- return value.toLocaleString(undefined, {
21
+ return value.toLocaleString(locale, {
22
22
  minimumFractionDigits: 0,
23
23
  maximumFractionDigits: 2,
24
24
  });
@@ -45,9 +45,9 @@ function scientificSpecialCase(value: number): string | null {
45
45
  export function prettyScientificNumber(
46
46
  value: number,
47
47
  opts: {
48
- // Default to false
49
- shouldRound?: boolean;
50
- } = {},
48
+ shouldRound?: boolean; // Default to false
49
+ locale: string;
50
+ },
51
51
  ): string {
52
52
  // Handle special cases first
53
53
  const specialCase = scientificSpecialCase(value);
@@ -58,7 +58,7 @@ export function prettyScientificNumber(
58
58
  // Determine if the number should be in scientific notation
59
59
  const absValue = Math.abs(value);
60
60
  if (absValue < 1e-2 || absValue >= 1e6) {
61
- return new Intl.NumberFormat(undefined, {
61
+ return new Intl.NumberFormat(opts.locale, {
62
62
  minimumFractionDigits: 1,
63
63
  maximumFractionDigits: 1,
64
64
  notation: "scientific",
@@ -67,18 +67,18 @@ export function prettyScientificNumber(
67
67
  .toLowerCase();
68
68
  }
69
69
 
70
- const { shouldRound } = opts;
70
+ const { shouldRound, locale } = opts;
71
71
 
72
72
  if (shouldRound) {
73
73
  // Number has an integer part, format with 2 decimal places
74
- return new Intl.NumberFormat(undefined, {
74
+ return new Intl.NumberFormat(locale, {
75
75
  minimumFractionDigits: 0,
76
76
  maximumFractionDigits: 2,
77
77
  }).format(value);
78
78
  }
79
79
 
80
80
  // Don't round
81
- return value.toLocaleString(undefined, {
81
+ return value.toLocaleString(locale, {
82
82
  minimumFractionDigits: 0,
83
83
  maximumFractionDigits: 100,
84
84
  });
@@ -104,14 +104,14 @@ const prefixes = {
104
104
  "-24": "y",
105
105
  };
106
106
 
107
- export function prettyEngineeringNumber(value: number): string {
107
+ export function prettyEngineeringNumber(value: number, locale: string): string {
108
108
  // Handle special cases first
109
109
  const specialCase = scientificSpecialCase(value);
110
110
  if (specialCase !== null) {
111
111
  return specialCase;
112
112
  }
113
113
 
114
- const [mant, exp] = new Intl.NumberFormat("en-us", {
114
+ const [mant, exp] = new Intl.NumberFormat(locale, {
115
115
  notation: "engineering",
116
116
  maximumSignificantDigits: 3,
117
117
  })
package/src/utils/once.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  /* Copyright 2024 Marimo. All rights reserved. */
2
2
 
3
+ import { arrayShallowEquals } from "./arrays";
4
+
3
5
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
6
  export function once<T extends (...args: any[]) => any>(fn: T): T {
5
7
  let result: ReturnType<T>;
@@ -15,3 +17,33 @@ export function once<T extends (...args: any[]) => any>(fn: T): T {
15
17
  return result;
16
18
  } as T;
17
19
  }
20
+
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ export function memoizeLastValue<T extends (...args: any[]) => any>(fn: T): T {
23
+ let result: ReturnType<T>;
24
+ let lastArgs: Parameters<T> | undefined;
25
+ let lastError: unknown;
26
+ let hasError = false;
27
+
28
+ return function (
29
+ this: ThisParameterType<T>,
30
+ ...args: Parameters<T>
31
+ ): ReturnType<T> {
32
+ if (lastArgs === undefined || !arrayShallowEquals(args, lastArgs)) {
33
+ try {
34
+ result = fn.apply(this, args) as ReturnType<T>;
35
+ hasError = false;
36
+ lastError = undefined;
37
+ } catch (error) {
38
+ hasError = true;
39
+ lastError = error;
40
+ }
41
+ lastArgs = args;
42
+ }
43
+
44
+ if (hasError) {
45
+ throw lastError;
46
+ }
47
+ return result;
48
+ } as T;
49
+ }
@@ -32,7 +32,10 @@ export const Paths = {
32
32
  };
33
33
 
34
34
  export class PathBuilder {
35
- constructor(public readonly deliminator: "/" | "\\") {}
35
+ public readonly deliminator: string;
36
+ constructor(deliminator: "/" | "\\") {
37
+ this.deliminator = deliminator;
38
+ }
36
39
 
37
40
  static guessDeliminator(path: string): PathBuilder {
38
41
  return path.includes("/") ? new PathBuilder("/") : new PathBuilder("\\");
@@ -1,10 +1,13 @@
1
1
  /* Copyright 2024 Marimo. All rights reserved. */
2
2
 
3
3
  export class PluralWord {
4
- constructor(
5
- public singular: string,
6
- public _plural?: string,
7
- ) {}
4
+ public singular: string;
5
+ public _plural?: string;
6
+
7
+ constructor(singular: string, _plural?: string) {
8
+ this.singular = singular;
9
+ this._plural = _plural;
10
+ }
8
11
 
9
12
  public pluralize(count: number) {
10
13
  return count === 1 ? this.singular : this.plural;
@@ -16,7 +19,11 @@ export class PluralWord {
16
19
  }
17
20
 
18
21
  export class PluralWords {
19
- constructor(private words: PluralWord[]) {}
22
+ private words: PluralWord[];
23
+
24
+ constructor(words: PluralWord[]) {
25
+ this.words = words;
26
+ }
20
27
 
21
28
  static of(...words: Array<PluralWord | string>) {
22
29
  return new PluralWords(
@@ -25,7 +25,10 @@ function asString(value: string | PythonCode): string {
25
25
  }
26
26
 
27
27
  export class Variable implements PythonCode {
28
- constructor(public name: string) {}
28
+ name: string;
29
+ constructor(name: string) {
30
+ this.name = name;
31
+ }
29
32
 
30
33
  toCode(): string {
31
34
  return this.name;
@@ -38,10 +41,12 @@ interface LiteralOptions {
38
41
  }
39
42
 
40
43
  export class Literal implements PythonCode {
41
- constructor(
42
- public readonly value: unknown,
43
- public readonly opts: LiteralOptions = {},
44
- ) {}
44
+ public readonly value: unknown;
45
+ public readonly opts: LiteralOptions;
46
+ constructor(value: unknown, opts: LiteralOptions = {}) {
47
+ this.value = value;
48
+ this.opts = opts;
49
+ }
45
50
 
46
51
  static from(value: unknown, opts: LiteralOptions = {}): Literal {
47
52
  return new Literal(value, opts);
@@ -114,10 +119,13 @@ export class Literal implements PythonCode {
114
119
  }
115
120
 
116
121
  export class VariableDeclaration implements PythonCode {
117
- constructor(
118
- public name: string,
119
- public value: string | PythonCode,
120
- ) {}
122
+ public name: string;
123
+ public value: string | PythonCode;
124
+
125
+ constructor(name: string, value: string | PythonCode) {
126
+ this.name = name;
127
+ this.value = value;
128
+ }
121
129
 
122
130
  toCode(): string {
123
131
  const right = asString(this.value);
@@ -129,10 +137,13 @@ export class VariableDeclaration implements PythonCode {
129
137
  }
130
138
 
131
139
  export class FunctionArg implements PythonCode {
132
- constructor(
133
- public name: string,
134
- public value: string | PythonCode,
135
- ) {}
140
+ public name: string;
141
+ public value: string | PythonCode;
142
+
143
+ constructor(name: string, value: string | PythonCode) {
144
+ this.name = name;
145
+ this.value = value;
146
+ }
136
147
 
137
148
  toCode(): string {
138
149
  return `${this.name}=${asString(this.value)}`;
@@ -141,12 +152,16 @@ export class FunctionArg implements PythonCode {
141
152
 
142
153
  export class FunctionCall implements PythonCode {
143
154
  private args: PythonCode[];
155
+ public name: string;
156
+ public multiLine: boolean;
144
157
 
145
158
  constructor(
146
- public name: string,
159
+ name: string,
147
160
  args: PythonCode[] | Record<string, PythonCode>,
148
- public multiLine = false,
161
+ multiLine = false,
149
162
  ) {
163
+ this.name = name;
164
+ this.multiLine = multiLine;
150
165
  this.args = objectToArgs(args);
151
166
  }
152
167
 
package/src/utils/time.ts CHANGED
@@ -5,6 +5,8 @@ export type Milliseconds = number & { __type__: "milliseconds" };
5
5
  export type Seconds = number & { __type__: "seconds" };
6
6
 
7
7
  export class Time {
8
+ private readonly ms: Milliseconds;
9
+
8
10
  static fromMilliseconds(ms: Milliseconds): Time;
9
11
  static fromMilliseconds(ms: Milliseconds | null): Time | null;
10
12
  static fromMilliseconds(ms: Milliseconds | null): Time | null {
@@ -27,7 +29,9 @@ export class Time {
27
29
  return new Time(Date.now() as Milliseconds);
28
30
  }
29
31
 
30
- private constructor(private readonly ms: Milliseconds) {}
32
+ private constructor(ms: Milliseconds) {
33
+ this.ms = ms;
34
+ }
31
35
 
32
36
  toMilliseconds(): Milliseconds {
33
37
  return this.ms;