@marimo-team/islands 0.23.7-dev6 → 0.23.7-dev61

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 (547) hide show
  1. package/dist/{ConnectedDataExplorerComponent-PmilQqXR.js → ConnectedDataExplorerComponent-2lBNiUv6.js} +14 -14
  2. package/dist/{ErrorBoundary-Da4UeYxT.js → ErrorBoundary-D3wrPNma.js} +1 -1
  3. package/dist/{any-language-editor-BVR0l12r.js → any-language-editor-VWs_7v27.js} +15 -15
  4. package/dist/apl-Bdc61P1y.js +4 -0
  5. package/dist/{arc-CHF8PiiF.js → arc-DfkSnvZm.js} +2 -2
  6. package/dist/{architecture-7HQA4BMR-D0JB_3hE.js → architecture-7HQA4BMR-CS9jOrqM.js} +1 -1
  7. package/dist/{architectureDiagram-VXUJARFQ-BXQEUDtK.js → architectureDiagram-VXUJARFQ-CXVJxFhH.js} +16 -16
  8. package/dist/asciiarmor-DVRHDGzT.js +4 -0
  9. package/dist/asn1-BmuKfkfu.js +4 -0
  10. package/dist/assets/__vite-browser-external-CAdMKBac.js +1 -0
  11. package/dist/assets/worker-CpBbwbQo.js +73 -0
  12. package/dist/{blockDiagram-VD42YOAC-DhJe-Y9i.js → blockDiagram-VD42YOAC-DGDaxR8I.js} +11 -11
  13. package/dist/brainfuck-DPrRpyTV.js +4 -0
  14. package/dist/{button-CA5pI2YF.js → button-Dj4BTre0.js} +5 -0
  15. package/dist/{c4Diagram-YG6GDRKO-9dSfzOFR.js → c4Diagram-YG6GDRKO-C2hc6ne8.js} +5 -5
  16. package/dist/{capabilities-6laDasij.js → capabilities-C9rrYCzf.js} +1 -1
  17. package/dist/{channel-MqYIiKgS.js → channel-BBoIVUrJ.js} +1 -1
  18. package/dist/{chat-ui-B-gbqk_F.js → chat-ui-D3XBept8.js} +626 -234
  19. package/dist/{check-CFM2mVDr.js → check-BcUIXnUT.js} +1 -1
  20. package/dist/{chunk-4BX2VUAB-BwfrWBqN.js → chunk-4BX2VUAB-CzXltWHN.js} +1 -1
  21. package/dist/{chunk-55IACEB6-D8THf2mi.js → chunk-55IACEB6-B-1mjMMC.js} +1 -1
  22. package/dist/{chunk-5FQGJX7Z-CO1e63h_.js → chunk-5FQGJX7Z-BOg95xG5.js} +2 -2
  23. package/dist/{chunk-ABZYJK2D-BrBb_0yY.js → chunk-ABZYJK2D-D0cLy8Bb.js} +2 -2
  24. package/dist/{chunk-ATLVNIR6-D-0XqNah.js → chunk-ATLVNIR6-BXsEjlHF.js} +2 -2
  25. package/dist/{chunk-B4BG7PRW-8iRKvugR.js → chunk-B4BG7PRW-Q1usn6T3.js} +7 -7
  26. package/dist/{chunk-CVBHYZKI-B6xhgaBd.js → chunk-CVBHYZKI-B_c5YBcW.js} +1 -1
  27. package/dist/{chunk-DI55MBZ5-C0_2D4m4.js → chunk-DI55MBZ5-D1qLYNrb.js} +6 -6
  28. package/dist/{chunk-EXTU4WIE-Jiw9ca1u.js → chunk-EXTU4WIE-BKNXdLmD.js} +2 -2
  29. package/dist/{chunk-FMBD7UC4-CHdus51S.js → chunk-FMBD7UC4-Ie8M9q0W.js} +1 -1
  30. package/dist/{chunk-HN2XXSSU-2Vfbq-kU.js → chunk-HN2XXSSU-E3n-Ys7Z.js} +1 -1
  31. package/dist/{chunk-JA3XYJ7Z-6wbaigKe.js → chunk-JA3XYJ7Z-D6c6cOBG.js} +3 -3
  32. package/dist/{chunk-JZLCHNYA-_rfptlUP.js → chunk-JZLCHNYA-BvsPHJmL.js} +6 -6
  33. package/dist/{chunk-MI3HLSF2-Do0-KRc0.js → chunk-MI3HLSF2-CUYEasXO.js} +1 -1
  34. package/dist/{chunk-N4CR4FBY-DIZG9dVD.js → chunk-N4CR4FBY-8ycT-O9a.js} +7 -7
  35. package/dist/{chunk-QN33PNHL-Cc64y40m.js → chunk-QN33PNHL-Bb-eUBW3.js} +2 -2
  36. package/dist/{chunk-QXUST7PY-BDG0-0Or.js → chunk-QXUST7PY-DV8yRwBd.js} +10 -10
  37. package/dist/{chunk-QZHKN3VN-B_Mdb8GC.js → chunk-QZHKN3VN-DRjXVwuJ.js} +1 -1
  38. package/dist/{chunk-S3R3BYOJ-DphMP0FA.js → chunk-S3R3BYOJ-mQeCz5CE.js} +4 -4
  39. package/dist/{chunk-TZMSLE5B-C9LUoYkc.js → chunk-TZMSLE5B-BqW10dHe.js} +3 -3
  40. package/dist/classDiagram-2ON5EDUG--Yh__LHb.js +30 -0
  41. package/dist/classDiagram-v2-WZHVMYZB-BC7X7Xtc.js +30 -0
  42. package/dist/{clike-sBZrGeF8.js → clike-DTxNUn7l.js} +1 -1
  43. package/dist/clojure-DEttQW5T.js +4 -0
  44. package/dist/cmake-jNlx_DaM.js +4 -0
  45. package/dist/cobol-BvvIm5MJ.js +4 -0
  46. package/dist/{code-block-37QAKDTI-0JNwiPGv.js → code-block-37QAKDTI-BsGy1AOJ.js} +1 -1
  47. package/dist/{code-visibility-jLjZTWEO.js → code-visibility-7Y-Fviqz.js} +13540 -4044
  48. package/dist/coffeescript-DTpBMyFU.js +4 -0
  49. package/dist/commonlisp-BmmUG8jb.js +4 -0
  50. package/dist/{copy-TGGAUEWp.js → copy-DLf4aN7I.js} +2 -2
  51. package/dist/{cose-bilkent-S5V4N54A-DXHZkJKX.js → cose-bilkent-S5V4N54A-kjoZoid4.js} +2 -2
  52. package/dist/crystal-BxyqmEWC.js +4 -0
  53. package/dist/css-BGoCtuG3.js +4 -0
  54. package/dist/cypher-BmCbdl3u.js +4 -0
  55. package/dist/d-CFrlbjZt.js +4 -0
  56. package/dist/{dagre-6UL2VRFP-tH87fkPA.js → dagre-6UL2VRFP-DRBWoQUw.js} +10 -10
  57. package/dist/{data-grid-overlay-editor-CWUN78-s.js → data-grid-overlay-editor-efe5ZagF.js} +2 -2
  58. package/dist/{diagram-PSM6KHXK-2VjPSCDn.js → diagram-PSM6KHXK-H66ATWP2.js} +18 -18
  59. package/dist/{diagram-QEK2KX5R-CiLmNyta.js → diagram-QEK2KX5R-DItl5Wns.js} +14 -14
  60. package/dist/{diagram-S2PKOQOG-Zha_1CLx.js → diagram-S2PKOQOG-CtuW_ZuL.js} +14 -14
  61. package/dist/diff-D6XwL6P8.js +4 -0
  62. package/dist/{dist-Brkazupz.js → dist--sWVZwjW.js} +1 -1
  63. package/dist/{dist-FN0ZA_8F.js → dist-21ButRCu.js} +1 -1
  64. package/dist/{dist-BetEKbPG.js → dist-B8RaFTRF.js} +1 -1
  65. package/dist/dist-BoHGySTM.js +5 -0
  66. package/dist/dist-ByAz19Qc.js +5 -0
  67. package/dist/dist-C93EysN4.js +5 -0
  68. package/dist/{dist-BHnX0ia_.js → dist-CY-lVor6.js} +1 -1
  69. package/dist/{dist-YP-G7W0f.js → dist-CYDuv4bR.js} +1 -1
  70. package/dist/{dist-CMjD5MQb.js → dist-Cfo5EE2t.js} +1 -1
  71. package/dist/dist-CjivSDvN.js +5 -0
  72. package/dist/dist-Cqwx-MH7.js +5 -0
  73. package/dist/{dist-ESg7xyoD.js → dist-D3ZI9nhS.js} +2 -2
  74. package/dist/{dist-DkC6YEo0.js → dist-DMZNjfX4.js} +1 -1
  75. package/dist/{dist-ChC1BhqM.js → dist-DbpcoFAV.js} +1 -1
  76. package/dist/dist-FUNenbiQ.js +5 -0
  77. package/dist/{dist-BEOU2g1b.js → dist-zhSud5X3.js} +1 -1
  78. package/dist/{dockerfile-COvlVLcE.js → dockerfile-twL37N91.js} +1 -1
  79. package/dist/dtd-Bw0lRN0-.js +4 -0
  80. package/dist/dylan-B55eBHTt.js +4 -0
  81. package/dist/ecl-C8G4p0wn.js +4 -0
  82. package/dist/eiffel-BmH46VJl.js +4 -0
  83. package/dist/elm-DhzeFqkl.js +4 -0
  84. package/dist/{erDiagram-Q2GNP2WA-biHZS05w.js → erDiagram-Q2GNP2WA--19X2kU5.js} +14 -14
  85. package/dist/erlang-CY-wdlsU.js +4 -0
  86. package/dist/{error-banner-DnBPzEWg.js → error-banner-CVkfBUT3.js} +2 -2
  87. package/dist/{esm-Dd1z1auZ.js → esm-CWp0KQeK.js} +1 -1
  88. package/dist/{esm-CYEyrE3Y.js → esm-DjNnlmpf.js} +96 -96
  89. package/dist/{extends-CzJgxo2J.js → extends-vAi97cpa.js} +4 -4
  90. package/dist/{factor-C2GT7jfQ.js → factor-CajWS6mS.js} +1 -1
  91. package/dist/factor-DWkgl0xw.js +4 -0
  92. package/dist/{flowDiagram-NV44I4VS-CWWlUpBR.js → flowDiagram-NV44I4VS-DQmWlo7f.js} +16 -16
  93. package/dist/{formats-CgaK7Gmx.js → formats-Dsy9kkZu.js} +3 -3
  94. package/dist/forth-Cij_ie2t.js +4 -0
  95. package/dist/fortran-Br3X9cfm.js +4 -0
  96. package/dist/{ganttDiagram-JELNMOA3-D7B2c4Z9.js → ganttDiagram-JELNMOA3-BOGXJ8Lk.js} +7 -7
  97. package/dist/gas-DYsGcMN2.js +4 -0
  98. package/dist/gherkin-eVgXQ0fQ.js +4 -0
  99. package/dist/{gitGraph-G5XIXVHT-BdepdFa_.js → gitGraph-G5XIXVHT-DGlbae5m.js} +1 -1
  100. package/dist/{gitGraphDiagram-V2S2FVAM-CtLvNR1S.js → gitGraphDiagram-V2S2FVAM-DjzxfF0P.js} +14 -14
  101. package/dist/{glide-data-editor-CvlvtPWJ.js → glide-data-editor-DucgdjRo.js} +13 -13
  102. package/dist/groovy-_NFHIXG7.js +4 -0
  103. package/dist/haskell-D6xNG_bH.js +4 -0
  104. package/dist/haxe-sU_rzAwn.js +5 -0
  105. package/dist/{html-to-image-hMMPiNe_.js → html-to-image-CpggM7u1.js} +2806 -2547
  106. package/dist/idl-Ds_VbrUx.js +4 -0
  107. package/dist/{info-VBDWY6EO--JNA2rNu.js → info-VBDWY6EO-D2lvLLw5.js} +1 -1
  108. package/dist/{infoDiagram-HS3SLOUP-BbZyOxsP.js → infoDiagram-HS3SLOUP-ChNufFsP.js} +12 -12
  109. package/dist/{input-BAOe64zx.js → input-D4kjoQUB.js} +8 -6
  110. package/dist/javascript-CztfIl0i.js +4 -0
  111. package/dist/{journeyDiagram-XKPGCS4Q-BU2mjjzl.js → journeyDiagram-XKPGCS4Q-BO_O4Ij1.js} +6 -6
  112. package/dist/julia-DDv40QMV.js +4 -0
  113. package/dist/{kanban-definition-3W4ZIXB7-BlmczUuw.js → kanban-definition-3W4ZIXB7-CPpiiiWk.js} +11 -11
  114. package/dist/{katex-qPqrBHZ8.js → katex-9-9QRhxz.js} +1 -1
  115. package/dist/{label-BCWi-Oqu.js → label-BLqV33b1.js} +2 -2
  116. package/dist/{line-BWRi3U3S.js → line-C5s_12ee.js} +3 -3
  117. package/dist/{linear-DnHwODZa.js → linear-2NnK4cxi.js} +2 -2
  118. package/dist/livescript-BEOngLLc.js +4 -0
  119. package/dist/{loader-BvW0-YWZ.js → loader-Dr8Qem8p.js} +1 -1
  120. package/dist/lua-9-7BhQ4Y.js +4 -0
  121. package/dist/main.js +2250 -10847
  122. package/dist/mathematica-DDa0Pfxm.js +4 -0
  123. package/dist/mbox-iO03mmoE.js +4 -0
  124. package/dist/{mermaid-4DMBBIKO-CG1ECj5W.js → mermaid-4DMBBIKO-B7VQMwJx.js} +1 -1
  125. package/dist/{mermaid-CEbzCxCc.js → mermaid-DO-Daq7u.js} +46 -46
  126. package/dist/{mermaid-parser.core-CleJseNW.js → mermaid-parser.core-DreccfmS.js} +7 -7
  127. package/dist/{mhchem-BwoRNwg_.js → mhchem-yiCCuiEF.js} +1 -1
  128. package/dist/{mindmap-definition-VGOIOE7T-CcSYqYP9.js → mindmap-definition-VGOIOE7T-CC1_Vl0f.js} +13 -13
  129. package/dist/mirc-C9z5LT4X.js +4 -0
  130. package/dist/mllike-jGJbdm_C.js +6 -0
  131. package/dist/modelica-DzF7oIEL.js +4 -0
  132. package/dist/mscgen-DB-u125o.js +6 -0
  133. package/dist/mumps-CRTFHhzh.js +4 -0
  134. package/dist/nsis-C4NPTuox.js +4 -0
  135. package/dist/{nsis-B5K1qoyo.js → nsis-ClF3r5Tr.js} +1 -1
  136. package/dist/ntriples-BCOoGph1.js +4 -0
  137. package/dist/{number-overlay-editor-_GnlYFHC.js → number-overlay-editor-CpKi64Fy.js} +1 -1
  138. package/dist/octave-DTwNlazz.js +4 -0
  139. package/dist/{ordinal-2jIulmcR.js → ordinal-B43ZeR68.js} +1 -1
  140. package/dist/oz-DD38AzSz.js +4 -0
  141. package/dist/{packet-DYOGHKS2-CBxXGWNr.js → packet-DYOGHKS2-CmWtF3uO.js} +1 -1
  142. package/dist/pascal-BohSp9jV.js +4 -0
  143. package/dist/perl-f5OutoPM.js +4 -0
  144. package/dist/{pie-VRWISCQL-Bmdnqjip.js → pie-VRWISCQL-B6u8vus8.js} +1 -1
  145. package/dist/{pieDiagram-ADFJNKIX-DNyLF5H2.js → pieDiagram-ADFJNKIX-Di34MOFQ.js} +19 -19
  146. package/dist/pig-Dv7wSmHb.js +4 -0
  147. package/dist/powershell-rYgjKB39.js +4 -0
  148. package/dist/{process-output-Bza_GK7Q.js → process-output-X8TR20AK.js} +30 -25
  149. package/dist/properties-BFUNLRDN.js +4 -0
  150. package/dist/protobuf-B9QJQPPv.js +4 -0
  151. package/dist/{pug-tjbzJCFk.js → pug-B_rby2yb.js} +1 -1
  152. package/dist/pug-DzvWpaMC.js +4 -0
  153. package/dist/puppet-B_K-n_xK.js +4 -0
  154. package/dist/python-CAiFcaA2.js +4 -0
  155. package/dist/q-cLeFIBLK.js +4 -0
  156. package/dist/{quadrantDiagram-AYHSOK5B-rXwjifrj.js → quadrantDiagram-AYHSOK5B-B9kVk1ny.js} +3 -3
  157. package/dist/r-04Y-Wco3.js +4 -0
  158. package/dist/{radar-ZZBFDIW7-BmCWDffL.js → radar-ZZBFDIW7-XAmXSa8s.js} +1 -1
  159. package/dist/{react-vega-B-rkEqtS.js → react-vega-Cavbrg4l.js} +1 -1
  160. package/dist/{react-vega-k9ODWPlI.js → react-vega-Dh6-UKKe.js} +13 -13
  161. package/dist/{requirementDiagram-UZGBJVZJ-DBdrMVbs.js → requirementDiagram-UZGBJVZJ-BxGfGYEx.js} +13 -13
  162. package/dist/{reveal-component-BMOBPyvh.js → reveal-component-DtL5O-Ms.js} +10 -10
  163. package/dist/rpm-FUdrIia9.js +5 -0
  164. package/dist/ruby-DMjFXuEW.js +4 -0
  165. package/dist/{sankeyDiagram-TZEHDZUN-CxmzalGv.js → sankeyDiagram-TZEHDZUN-D09PBJ-n.js} +4 -4
  166. package/dist/sas-DzHZxjXK.js +4 -0
  167. package/dist/scheme-DxHd_Rb9.js +4 -0
  168. package/dist/semaphore-CNDGTzkX.js +46 -0
  169. package/dist/{sequenceDiagram-WL72ISMW-CVCDsJ9h.js → sequenceDiagram-WL72ISMW-t_Dpemj0.js} +7 -7
  170. package/dist/shell-C8Kwypgf.js +4 -0
  171. package/dist/sieve-DdyqOKXZ.js +4 -0
  172. package/dist/smalltalk-pB7X1D9y.js +4 -0
  173. package/dist/sparql-NhBO6oOa.js +4 -0
  174. package/dist/{spec-DSIuqd3f.js → spec-hVaaZsY5.js} +4 -4
  175. package/dist/{src-BY0BGg6V.js → src-Bf2iLOlr.js} +1 -1
  176. package/dist/{stateDiagram-FKZM4ZOC-D_2djEhW.js → stateDiagram-FKZM4ZOC-B18gTP_j.js} +16 -16
  177. package/dist/stateDiagram-v2-4FDKWEC3-B6e_t14A.js +29 -0
  178. package/dist/{step-DGAGWg3y.js → step-CWipAYTY.js} +1 -1
  179. package/dist/{strings-B_FOH6eV.js → strings-BiIhGaI8.js} +4 -4
  180. package/dist/style.css +1 -1
  181. package/dist/stylus-SfWSnzPv.js +4 -0
  182. package/dist/swift-jRPdq2zR.js +4 -0
  183. package/dist/{swiper-component-KkEVUDd3.js → swiper-component-DlD2GU2g.js} +2 -2
  184. package/dist/tcl-_hpTHGX3.js +4 -0
  185. package/dist/textile-C9h8slqH.js +4 -0
  186. package/dist/{time-CMdrp3hw.js → time-C1SGcFMH.js} +2 -2
  187. package/dist/{timeline-definition-IT6M3QCI-E4NzxCs3.js → timeline-definition-IT6M3QCI-DJnh1ks5.js} +3 -3
  188. package/dist/{toDate-CHtl9vts.js → toDate-CIpC_34u.js} +33 -20
  189. package/dist/toml-DWvtinD4.js +4 -0
  190. package/dist/{tooltip-B0mtKTXm.js → tooltip-DRaMBu06.js} +3 -3
  191. package/dist/{treemap-GDKQZRPO-CoKHPxa7.js → treemap-GDKQZRPO-Du95DV6u.js} +1 -1
  192. package/dist/troff-Dwo_A0y7.js +4 -0
  193. package/dist/ttcn-V--CPFKq.js +4 -0
  194. package/dist/ttcn-cfg-CPSMchTG.js +4 -0
  195. package/dist/turtle-B4rPGBWu.js +4 -0
  196. package/dist/{types-DBtDeUKD.js → types-Dzuoc3LN.js} +1 -1
  197. package/dist/{useAsyncData-B6hCGywC.js → useAsyncData-C56Khv_R.js} +1 -1
  198. package/dist/{useDateFormatter-B3mCQMP3.js → useDateFormatter-B_9k85Ex.js} +2 -2
  199. package/dist/{useDeepCompareMemoize-CmwDuYUH.js → useDeepCompareMemoize-Dt98v2ua.js} +1 -1
  200. package/dist/{useIframeCapabilities-DbdLoEDm.js → useIframeCapabilities-BkYHTrss.js} +1 -1
  201. package/dist/{useLifecycle-CjMjllqy.js → useLifecycle-BF6-z62y.js} +3 -3
  202. package/dist/{useTheme-CByZUW0p.js → useTheme-DykuNHR2.js} +2 -2
  203. package/dist/vb-DaMBBd4j.js +4 -0
  204. package/dist/vbscript-BMJQqcE2.js +4 -0
  205. package/dist/{vega-component-CC8TqWWV.js → vega-component-cSdqoAxe.js} +26 -24
  206. package/dist/velocity-CGq2QRq2.js +4 -0
  207. package/dist/verilog-CUNo8F5u.js +4 -0
  208. package/dist/vhdl-CCzA0msW.js +4 -0
  209. package/dist/webidl-CqIMDIBL.js +4 -0
  210. package/dist/xquery-XC5Kbr-1.js +4 -0
  211. package/dist/{xychartDiagram-PRI3JC2R-CuxTvjw5.js → xychartDiagram-PRI3JC2R-Dk2d_bX0.js} +10 -10
  212. package/dist/yacas-CGOv7Dzy.js +4 -0
  213. package/dist/z80-CXhVmi-f.js +4 -0
  214. package/dist/{zod-BxdsqRPd.js → zod-BWkcDORu.js} +1 -1
  215. package/package.json +3 -3
  216. package/src/components/chat/chat-components.tsx +47 -0
  217. package/src/components/chat/chat-display.tsx +41 -7
  218. package/src/components/chat/chat-panel.tsx +37 -10
  219. package/src/components/chat/chat-utils.ts +42 -20
  220. package/src/components/chat/reasoning-accordion.tsx +14 -3
  221. package/src/components/chat/tool-call/shared.ts +13 -0
  222. package/src/components/chat/tool-call/tool-approval-card.tsx +62 -0
  223. package/src/components/chat/tool-call/tool-args.tsx +26 -0
  224. package/src/components/chat/tool-call/tool-call-view.tsx +99 -0
  225. package/src/components/chat/tool-call/tool-error-card.tsx +81 -0
  226. package/src/components/chat/tool-call/tool-history-row.tsx +153 -0
  227. package/src/components/chat/tool-call/tool-result.tsx +101 -0
  228. package/src/components/data-table/TableTopBar.tsx +5 -1
  229. package/src/components/data-table/__tests__/column-header.test.ts +3 -1
  230. package/src/components/data-table/__tests__/column-header.test.tsx +308 -0
  231. package/src/components/data-table/__tests__/filter-by-values-picker.test.tsx +112 -0
  232. package/src/components/data-table/__tests__/filter-pill-editor.test.tsx +261 -0
  233. package/src/components/data-table/__tests__/filters.test.ts +196 -49
  234. package/src/components/data-table/charts/components/form-fields.tsx +1 -0
  235. package/src/components/data-table/column-header.tsx +349 -170
  236. package/src/components/data-table/data-table.tsx +5 -0
  237. package/src/components/data-table/date-filter-inputs.tsx +325 -0
  238. package/src/components/data-table/download-policy/atoms.ts +10 -0
  239. package/src/components/data-table/export-actions.tsx +31 -4
  240. package/src/components/data-table/filter-by-values-picker.tsx +70 -9
  241. package/src/components/data-table/filter-pill-editor.tsx +410 -156
  242. package/src/components/data-table/filter-pills.tsx +69 -54
  243. package/src/components/data-table/filters.ts +218 -101
  244. package/src/components/data-table/header-items.tsx +8 -1
  245. package/src/components/data-table/operator-labels.ts +25 -0
  246. package/src/components/data-table/regex-input.tsx +61 -0
  247. package/src/components/editor/actions/pair-with-agent-modal.tsx +140 -49
  248. package/src/components/editor/actions/useNotebookActions.tsx +3 -1
  249. package/src/components/editor/app-container.tsx +7 -1
  250. package/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx +10 -2
  251. package/src/components/editor/chrome/wrapper/app-chrome.tsx +1 -0
  252. package/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx +1 -1
  253. package/src/components/editor/chrome/wrapper/footer.tsx +4 -1
  254. package/src/components/editor/chrome/wrapper/panels.tsx +4 -1
  255. package/src/components/editor/chrome/wrapper/sidebar.tsx +4 -1
  256. package/src/components/editor/controls/Controls.tsx +11 -3
  257. package/src/components/editor/file-tree/file-explorer.tsx +12 -2
  258. package/src/components/editor/file-tree/requesting-tree.tsx +27 -25
  259. package/src/components/editor/file-tree/upload.tsx +23 -24
  260. package/src/components/editor/header/__tests__/status.test.tsx +108 -0
  261. package/src/components/editor/header/status.tsx +44 -10
  262. package/src/components/editor/navigation/__tests__/clipboard.test.ts +106 -0
  263. package/src/components/editor/navigation/__tests__/navigation.test.ts +70 -0
  264. package/src/components/editor/navigation/clipboard.ts +99 -25
  265. package/src/components/editor/navigation/navigation.ts +15 -1
  266. package/src/components/editor/notebook-cell.tsx +3 -0
  267. package/src/components/home/components.tsx +6 -0
  268. package/src/components/pages/run-page.tsx +4 -1
  269. package/src/components/ui/combobox.tsx +24 -5
  270. package/src/components/ui/number-field.tsx +2 -0
  271. package/src/core/ai/tools/__tests__/registry.test.ts +10 -12
  272. package/src/core/ai/tools/registry.ts +9 -5
  273. package/src/core/cells/__tests__/cells.test.ts +187 -0
  274. package/src/core/cells/__tests__/pending-cut-service.test.tsx +123 -0
  275. package/src/core/cells/cells.ts +102 -17
  276. package/src/core/cells/document-changes.ts +6 -1
  277. package/src/core/cells/pending-cut-service.ts +55 -0
  278. package/src/core/cells/utils.ts +11 -0
  279. package/src/core/codemirror/cells/extensions.ts +10 -0
  280. package/src/core/codemirror/go-to-definition/__tests__/commands.test.ts +152 -0
  281. package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +99 -0
  282. package/src/core/codemirror/go-to-definition/commands.ts +382 -22
  283. package/src/core/codemirror/go-to-definition/utils.ts +23 -5
  284. package/src/core/codemirror/markdown/__tests__/commands.test.ts +3 -3
  285. package/src/core/codemirror/markdown/commands.ts +1 -2
  286. package/src/core/edit-app.tsx +2 -1
  287. package/src/core/hotkeys/hotkeys.ts +5 -0
  288. package/src/core/islands/worker/worker.tsx +3 -2
  289. package/src/core/network/requests-network.ts +21 -3
  290. package/src/core/network/types.ts +12 -1
  291. package/src/core/run-app.tsx +2 -1
  292. package/src/core/runtime/__tests__/runtime.test.ts +38 -17
  293. package/src/core/runtime/runtime.ts +57 -34
  294. package/src/core/wasm/__tests__/utils.test.ts +34 -0
  295. package/src/core/wasm/bridge.ts +14 -1
  296. package/src/core/wasm/utils.ts +14 -0
  297. package/src/core/wasm/worker/bootstrap.ts +3 -2
  298. package/src/core/wasm/worker/worker.ts +3 -2
  299. package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +156 -0
  300. package/src/core/websocket/__tests__/useMarimoKernelConnection.test.ts +101 -0
  301. package/src/core/websocket/transports/__tests__/ws.test.ts +125 -0
  302. package/src/core/websocket/transports/basic.ts +1 -1
  303. package/src/core/websocket/transports/ws.ts +96 -0
  304. package/src/core/websocket/useMarimoKernelConnection.tsx +133 -54
  305. package/src/core/websocket/useWebSocket.tsx +3 -15
  306. package/src/css/app/Cell.css +10 -0
  307. package/src/plugins/core/__test__/sanitize.test.ts +30 -0
  308. package/src/plugins/impl/DataTablePlugin.tsx +12 -0
  309. package/src/plugins/impl/DropdownPlugin.tsx +12 -1
  310. package/src/plugins/impl/MultiselectPlugin.tsx +4 -0
  311. package/src/plugins/impl/SearchableSelect.tsx +11 -1
  312. package/src/plugins/impl/TabsPlugin.tsx +35 -7
  313. package/src/plugins/impl/__tests__/DropdownPlugin.test.tsx +56 -0
  314. package/src/plugins/impl/__tests__/TabsPlugin.test.tsx +154 -0
  315. package/src/plugins/impl/data-frames/DataFramePlugin.tsx +6 -0
  316. package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +48 -36
  317. package/src/plugins/impl/data-frames/schema.ts +4 -1
  318. package/src/plugins/impl/vega/resolve-data.ts +8 -1
  319. package/src/utils/__tests__/id-tree.test.ts +71 -0
  320. package/src/utils/__tests__/semaphore.test.ts +218 -0
  321. package/src/utils/fileToBase64.ts +8 -7
  322. package/src/utils/id-tree.tsx +89 -0
  323. package/src/utils/semaphore.ts +88 -0
  324. package/dist/apl-BKoVld9y.js +0 -4
  325. package/dist/asciiarmor-DQrKIjoo.js +0 -4
  326. package/dist/asn1-BZvnj0dq.js +0 -4
  327. package/dist/assets/__vite-browser-external-rrUYDKRl.js +0 -1
  328. package/dist/assets/worker-Bfy15ViQ.js +0 -73
  329. package/dist/brainfuck-D558nlUv.js +0 -4
  330. package/dist/classDiagram-2ON5EDUG-CBHMR6ZU.js +0 -30
  331. package/dist/classDiagram-v2-WZHVMYZB-BsUtUGM_.js +0 -30
  332. package/dist/clojure-Cq8mTSrE.js +0 -4
  333. package/dist/cmake-D8HCovWK.js +0 -4
  334. package/dist/cobol-UolN-9iU.js +0 -4
  335. package/dist/coffeescript-VdNuWrt5.js +0 -4
  336. package/dist/commonlisp-ALX7fpDc.js +0 -4
  337. package/dist/crystal-PbyO9Q_s.js +0 -4
  338. package/dist/css-DFklJkr_.js +0 -4
  339. package/dist/cypher-BifNeYlv.js +0 -4
  340. package/dist/d-BA-JP4PJ.js +0 -4
  341. package/dist/diff-CtkDpav4.js +0 -4
  342. package/dist/dist-BuBwsFva.js +0 -5
  343. package/dist/dist-BzmEQ9u7.js +0 -5
  344. package/dist/dist-Cih01ssx.js +0 -5
  345. package/dist/dist-CqfONiY9.js +0 -5
  346. package/dist/dist-D0iD0Fi9.js +0 -5
  347. package/dist/dist-DtNLXm8d.js +0 -5
  348. package/dist/dtd-DW3_UFEG.js +0 -4
  349. package/dist/dylan-pDhodO2N.js +0 -4
  350. package/dist/ecl-BJT8-YD7.js +0 -4
  351. package/dist/eiffel-Dmns-9vS.js +0 -4
  352. package/dist/elm-Da4sO4Bz.js +0 -4
  353. package/dist/erlang-C-zBsDi7.js +0 -4
  354. package/dist/factor-4xPWlWB5.js +0 -4
  355. package/dist/forth-l-c75zSd.js +0 -4
  356. package/dist/fortran-DIujSODW.js +0 -4
  357. package/dist/gas-CXnG5g_b.js +0 -4
  358. package/dist/gherkin-VPeqd4-X.js +0 -4
  359. package/dist/groovy-CphhZQgg.js +0 -4
  360. package/dist/haskell-CCvlS5Iq.js +0 -4
  361. package/dist/haxe-C_bi66fP.js +0 -5
  362. package/dist/idl-1DcP4Dm8.js +0 -4
  363. package/dist/javascript-DUIGhBvO.js +0 -4
  364. package/dist/julia-Cs2G4PQi.js +0 -4
  365. package/dist/livescript-DMtVFaAN.js +0 -4
  366. package/dist/lua-BAoLtdJg.js +0 -4
  367. package/dist/mathematica-C_NoFtbo.js +0 -4
  368. package/dist/mbox-DcFJFYrH.js +0 -4
  369. package/dist/mirc-71dccf_u.js +0 -4
  370. package/dist/mllike-CWcOFVDq.js +0 -6
  371. package/dist/modelica-Ape2VXxx.js +0 -4
  372. package/dist/mscgen-Cc6TwbSN.js +0 -6
  373. package/dist/mumps-h-ZbdkJ9.js +0 -4
  374. package/dist/nsis-C0p3m7JW.js +0 -4
  375. package/dist/ntriples-c9lEeT5w.js +0 -4
  376. package/dist/octave-DzEgB_74.js +0 -4
  377. package/dist/oz-CAxvHkyQ.js +0 -4
  378. package/dist/pascal-BJzu1sgP.js +0 -4
  379. package/dist/perl--IrOzZ2Z.js +0 -4
  380. package/dist/pig-CiBKKNhC.js +0 -4
  381. package/dist/powershell-KY0j6Qop.js +0 -4
  382. package/dist/properties-BW8q3ziV.js +0 -4
  383. package/dist/protobuf-BGaeuTGV.js +0 -4
  384. package/dist/pug-DjOKK-4J.js +0 -4
  385. package/dist/puppet-DWm2o6zX.js +0 -4
  386. package/dist/python-Bp2gezZy.js +0 -4
  387. package/dist/q-DljPshos.js +0 -4
  388. package/dist/r-BajPMnEu.js +0 -4
  389. package/dist/rpm-BKx-ZZ62.js +0 -5
  390. package/dist/ruby-DJq_HNKc.js +0 -4
  391. package/dist/sas-WANvpcOU.js +0 -4
  392. package/dist/scheme-CliBbhGF.js +0 -4
  393. package/dist/shell-BwhrNUvM.js +0 -4
  394. package/dist/sieve-BIVePvMp.js +0 -4
  395. package/dist/smalltalk-D6G48JmY.js +0 -4
  396. package/dist/sparql-jjc3BmEP.js +0 -4
  397. package/dist/stateDiagram-v2-4FDKWEC3-Cv9Av10H.js +0 -29
  398. package/dist/stylus-WPBPQ4PE.js +0 -4
  399. package/dist/swift-O1Qy6iCm.js +0 -4
  400. package/dist/tcl-BAFdhvsi.js +0 -4
  401. package/dist/textile-DFuzhNLG.js +0 -4
  402. package/dist/toml-DRSTeely.js +0 -4
  403. package/dist/troff-B_ZjwBW0.js +0 -4
  404. package/dist/ttcn-CAyiB3ic.js +0 -4
  405. package/dist/ttcn-cfg-BS5_BGBJ.js +0 -4
  406. package/dist/turtle-CUBEDy3E.js +0 -4
  407. package/dist/vb-DY9S6-U2.js +0 -4
  408. package/dist/vbscript-gaHC39Jq.js +0 -4
  409. package/dist/velocity-TfCOtJZ_.js +0 -4
  410. package/dist/verilog-c2JOX8mv.js +0 -4
  411. package/dist/vhdl-dHBirRiO.js +0 -4
  412. package/dist/webidl-Bauj-i07.js +0 -4
  413. package/dist/xquery-CtaEAOt8.js +0 -4
  414. package/dist/yacas-BZ85agQP.js +0 -4
  415. package/dist/z80-hCgR-L4U.js +0 -4
  416. package/src/components/chat/tool-call-accordion.tsx +0 -247
  417. /package/dist/{ImageComparisonComponent-DaocPIse.js → ImageComparisonComponent-CNHIsPDj.js} +0 -0
  418. /package/dist/{Plot-PIeIvFnD.js → Plot-4wn-lMVn.js} +0 -0
  419. /package/dist/{apl-Dt8GMXYg.js → apl-BCgCq9iM.js} +0 -0
  420. /package/dist/{array-B-MVxRIF.js → array-tvvEqPy7.js} +0 -0
  421. /package/dist/{asciiarmor-CitDQ85h.js → asciiarmor-BtqU-KJQ.js} +0 -0
  422. /package/dist/{asn1-abrf9SMK.js → asn1-Dmb-dTMx.js} +0 -0
  423. /package/dist/{asterisk-BUZwqih-.js → asterisk-DaVJJDnV.js} +0 -0
  424. /package/dist/{brainfuck-BL-Boof0.js → brainfuck-C1HoZKlE.js} +0 -0
  425. /package/dist/{chunk-4F5CHEZ2-C6tO9vjs.js → chunk-4F5CHEZ2-BZq7Kom7.js} +0 -0
  426. /package/dist/{chunk-B2363JML-Ds8wZXyP.js → chunk-B2363JML-D9-XOau1.js} +0 -0
  427. /package/dist/{chunk-DR5Q36YT-CP69aZS_.js → chunk-DR5Q36YT-BflwErH1.js} +0 -0
  428. /package/dist/{chunk-FRFDVMJY-BgQv1HBE.js → chunk-FRFDVMJY-BSBUAX7r.js} +0 -0
  429. /package/dist/{chunk-PL6DKKU2-DHfTUHy8.js → chunk-PL6DKKU2-B0MTXvyc.js} +0 -0
  430. /package/dist/{chunk-SJTYNZTY-Diciw4sx.js → chunk-SJTYNZTY-CEG4F0pB.js} +0 -0
  431. /package/dist/{chunk-TQ3KTPDO-CQfP9npd.js → chunk-TQ3KTPDO-DiCtqVSi.js} +0 -0
  432. /package/dist/{chunk-UMXZTB3W-MSKeGL7W.js → chunk-UMXZTB3W-97iS1iEl.js} +0 -0
  433. /package/dist/{click-outside-container-BZgN7xS_.js → click-outside-container-BDd67_1U.js} +0 -0
  434. /package/dist/{clike-RWg7anhx.js → clike-CdT0yHjt.js} +0 -0
  435. /package/dist/{clojure-DaojKHow.js → clojure-CdyrCpUv.js} +0 -0
  436. /package/dist/{cmake-DN-_v0XE.js → cmake-BFlPxym7.js} +0 -0
  437. /package/dist/{cobol-C3VpMyux.js → cobol-CcJXewp8.js} +0 -0
  438. /package/dist/{coffeescript-DIkz3Tbt.js → coffeescript-DnKuIKRo.js} +0 -0
  439. /package/dist/{colors-Cn2p_FA3.js → colors-CQAOa8cK.js} +0 -0
  440. /package/dist/{common-keywords-hbLeU7VU.js → common-keywords-FBrXPTcz.js} +0 -0
  441. /package/dist/{commonlisp-CB1boOiP.js → commonlisp-B-kok83Z.js} +0 -0
  442. /package/dist/{crystal-DI2oCml6.js → crystal-FYRYjI1I.js} +0 -0
  443. /package/dist/{css-BdEVwQDV.js → css-B45lc2V3.js} +0 -0
  444. /package/dist/{cypher-BNHToqxU.js → cypher-DZMLyVY_.js} +0 -0
  445. /package/dist/{cytoscape.esm-WbbDoCfu.js → cytoscape.esm-ayF70frT.js} +0 -0
  446. /package/dist/{d-D7we7I1b.js → d-x-VVT4o9.js} +0 -0
  447. /package/dist/{diff-Cia6fzjN.js → diff-Dxe2mpXk.js} +0 -0
  448. /package/dist/{dist-BK-3fF4P.js → dist-B4LJpMEg.js} +0 -0
  449. /package/dist/{dist-CxdUraQr.js → dist-B507mf_I.js} +0 -0
  450. /package/dist/{dist-C89sHDXk.js → dist-BGdYVvOu.js} +0 -0
  451. /package/dist/{dist-DquyVv5H.js → dist-BNyrZfqT.js} +0 -0
  452. /package/dist/{dist-Zn0KNbo9.js → dist-Bc5pmZIw.js} +0 -0
  453. /package/dist/{dist-C-J0pt5p.js → dist-BvCfQQQE.js} +0 -0
  454. /package/dist/{dist-D9r7Cmw7.js → dist-C2ej4eOH.js} +0 -0
  455. /package/dist/{dist-HVuryI1a.js → dist-C34oIrQ9.js} +0 -0
  456. /package/dist/{dist-CGLzXdrt.js → dist-CDFZi-QD.js} +0 -0
  457. /package/dist/{dist-C9fmTOin.js → dist-CYEylvZA.js} +0 -0
  458. /package/dist/{dist-DadjmS-4.js → dist-DJ6zJQZ4.js} +0 -0
  459. /package/dist/{dist-CtCY55Jf.js → dist-Dh3wkoyH.js} +0 -0
  460. /package/dist/{dist-C474qFoq.js → dist-Dhk6FMb0.js} +0 -0
  461. /package/dist/{dist-DZjQ_MBo.js → dist-KnujRhFL.js} +0 -0
  462. /package/dist/{dist-CinA9Enb.js → dist-WdPUFc56.js} +0 -0
  463. /package/dist/{dist-DBLeRrPp.js → dist-t_qL7eB8.js} +0 -0
  464. /package/dist/{dist-CyFFzJTb.js → dist-usPCDYx8.js} +0 -0
  465. /package/dist/{dtd-H4Hubdwp.js → dtd-C9VM_Wfu.js} +0 -0
  466. /package/dist/{duckdb-keywords-CZ_ZTscu.js → duckdb-keywords-CvJhR_Yd.js} +0 -0
  467. /package/dist/{dylan-fVO6rnq3.js → dylan-DTSnEIFO.js} +0 -0
  468. /package/dist/{ebnf-WEXPLEWb.js → ebnf-2D4Ctp3y.js} +0 -0
  469. /package/dist/{ecl-B94VPjNR.js → ecl-N04ptnRK.js} +0 -0
  470. /package/dist/{eiffel-C_R6TusS.js → eiffel-Dd8rpqr_.js} +0 -0
  471. /package/dist/{elm-DzCHbO2g.js → elm-GT2E866W.js} +0 -0
  472. /package/dist/{erlang-BGNkx6JU.js → erlang-Cf0Bp5pY.js} +0 -0
  473. /package/dist/{esm-Bb_hbWan.js → esm-BaaaPNGl.js} +0 -0
  474. /package/dist/{fcl-B_Gv5Jfx.js → fcl-Ccj8Z5Xd.js} +0 -0
  475. /package/dist/{forth-Bybw0cJ7.js → forth-wd_XzGTg.js} +0 -0
  476. /package/dist/{fortran-C6PoCLkI.js → fortran-DcwUTZFe.js} +0 -0
  477. /package/dist/{gas-BBlhenj4.js → gas-DeALIER3.js} +0 -0
  478. /package/dist/{gherkin-NXtNG85X.js → gherkin-CKTqaJNX.js} +0 -0
  479. /package/dist/{groovy-BoFYK9xM.js → groovy-Bwdp_d8D.js} +0 -0
  480. /package/dist/{haskell-BtBdvQ1n.js → haskell-DCdCcPLK.js} +0 -0
  481. /package/dist/{haxe-D--o6dr0.js → haxe-DAyktQWJ.js} +0 -0
  482. /package/dist/{http-Dc2fv19V.js → http-_DVAYWoR.js} +0 -0
  483. /package/dist/{idl-AqTq5l7e.js → idl-CBuZiRYu.js} +0 -0
  484. /package/dist/{init-D-g0ONX1.js → init-uv0kkh4g.js} +0 -0
  485. /package/dist/{javascript-DvwNVye9.js → javascript-DzigE11c.js} +0 -0
  486. /package/dist/{julia-DoKiagZC.js → julia-PwfB-0Cm.js} +0 -0
  487. /package/dist/{katex-B7pMJpE0.js → katex-C_XRmjAP.js} +0 -0
  488. /package/dist/{livescript-DxBZMiWB.js → livescript-BJLz1EbT.js} +0 -0
  489. /package/dist/{lua-DmS_0NTu.js → lua-ZC-XC2jf.js} +0 -0
  490. /package/dist/{math-BYK36kWZ.js → math-DFcdCCU8.js} +0 -0
  491. /package/dist/{mathematica-ChlDFeIC.js → mathematica-DCYMx6qB.js} +0 -0
  492. /package/dist/{mbox-CguZuODr.js → mbox-OxMK_9XI.js} +0 -0
  493. /package/dist/{mirc-CFtY8dqz.js → mirc-nJVyhA0H.js} +0 -0
  494. /package/dist/{mllike-C0EJrEOk.js → mllike-DRO89bsU.js} +0 -0
  495. /package/dist/{modelica-C1kO1nfS.js → modelica-Don3E6ZD.js} +0 -0
  496. /package/dist/{mscgen-DEYdr7AY.js → mscgen-DJfqD3bN.js} +0 -0
  497. /package/dist/{mumps-B3NVJs2V.js → mumps-SjGTvDYL.js} +0 -0
  498. /package/dist/{nginx-ComVAAGN.js → nginx-DasThI7R.js} +0 -0
  499. /package/dist/{node-sql-parser-DNGGJ-Rw.js → node-sql-parser-B8nBD36q.js} +0 -0
  500. /package/dist/{ntriples-DHol9X9H.js → ntriples-CNBKRl3I.js} +0 -0
  501. /package/dist/{octave-CYGz0bfo.js → octave-DdeVHNlx.js} +0 -0
  502. /package/dist/{oz-kPxb2ni5.js → oz-CcKSoNvN.js} +0 -0
  503. /package/dist/{pascal-bZ0yrJKy.js → pascal-6leftwNj.js} +0 -0
  504. /package/dist/{path-Du6n3sOU.js → path-BGaWgPKg.js} +0 -0
  505. /package/dist/{perl-z4hvqyqz.js → perl-BhJIwWzN.js} +0 -0
  506. /package/dist/{pig-DZO8QDF9.js → pig-r-xDHqRf.js} +0 -0
  507. /package/dist/{powershell-BSuaDQEC.js → powershell-D-BELeNi.js} +0 -0
  508. /package/dist/{properties-BXhGLlIx.js → properties-CnuDhbll.js} +0 -0
  509. /package/dist/{protobuf-DM6iybWV.js → protobuf-CO8RBhvX.js} +0 -0
  510. /package/dist/{puppet-Bn05sQT8.js → puppet-NmXHjLy8.js} +0 -0
  511. /package/dist/{python-Cvnhm0g7.js → python-DAQXi720.js} +0 -0
  512. /package/dist/{q-B9V8hzex.js → q-DlikXfV0.js} +0 -0
  513. /package/dist/{r-Cf0gFqmq.js → r-CuohilwT.js} +0 -0
  514. /package/dist/{rpm-D-LMkTV1.js → rpm-0Pjwp0Pb.js} +0 -0
  515. /package/dist/{ruby-DeuPikpK.js → ruby-Dq8NJTDG.js} +0 -0
  516. /package/dist/{sas-C9tjgAo9.js → sas-CuwonyVP.js} +0 -0
  517. /package/dist/{scheme-D1_bUF0G.js → scheme-CYU-RRIf.js} +0 -0
  518. /package/dist/{shell-CJBmnks3.js → shell-COPmX2qE.js} +0 -0
  519. /package/dist/{sieve-1fSV75CF.js → sieve-B_3zyLne.js} +0 -0
  520. /package/dist/{simple-mode-B90Wdavj.js → simple-mode-DSBniks8.js} +0 -0
  521. /package/dist/{smalltalk-sZNPD0HO.js → smalltalk-DRft7iPv.js} +0 -0
  522. /package/dist/{solr-DTkyqJ-Z.js → solr-RZ9uTl59.js} +0 -0
  523. /package/dist/{sparql-oHc1nm77.js → sparql-CN6qj55H.js} +0 -0
  524. /package/dist/{spreadsheet-CER0raqY.js → spreadsheet-BNNUNXA2.js} +0 -0
  525. /package/dist/{sql-ByOoEONQ.js → sql-B4x8IkwU.js} +0 -0
  526. /package/dist/{stylus-KzkX6zRB.js → stylus-Bn_ZjOQ3.js} +0 -0
  527. /package/dist/{swift-DqVxZvKo.js → swift-BLUJhMbz.js} +0 -0
  528. /package/dist/{tcl-BtWSwXfA.js → tcl-C86fxecl.js} +0 -0
  529. /package/dist/{textile-CWDbn9Ql.js → textile-DmHh2rsK.js} +0 -0
  530. /package/dist/{tiddlywiki-Cr9xyOY1.js → tiddlywiki-DI0mF2WJ.js} +0 -0
  531. /package/dist/{tiki-D5JONyfZ.js → tiki-2HU6XLLn.js} +0 -0
  532. /package/dist/{timer-D7JVdX9U.js → timer-YZl28NYN.js} +0 -0
  533. /package/dist/{toml-BfehlgmL.js → toml-GWANRNAD.js} +0 -0
  534. /package/dist/{treemap-qFGzn7xk.js → treemap-D-ka1hvx.js} +0 -0
  535. /package/dist/{troff-BZBk6AAu.js → troff-BHTsomIy.js} +0 -0
  536. /package/dist/{ttcn-DVwvXg0_.js → ttcn-DQuhn5Mn.js} +0 -0
  537. /package/dist/{ttcn-cfg-gjbVLf1L.js → ttcn-cfg-HjFYtdB-.js} +0 -0
  538. /package/dist/{turtle-CgxKXorV.js → turtle-nCay33Nv.js} +0 -0
  539. /package/dist/{vb-B9kSwTdM.js → vb-BG-XlqqJ.js} +0 -0
  540. /package/dist/{vbscript-DrUKSCdb.js → vbscript-B6vyW0-D.js} +0 -0
  541. /package/dist/{velocity-AlMYTnMy.js → velocity-CWegueqO.js} +0 -0
  542. /package/dist/{verilog-DLUaM05j.js → verilog-CzSQm4cG.js} +0 -0
  543. /package/dist/{vhdl-DUJOtSmO.js → vhdl-DqnNVL7r.js} +0 -0
  544. /package/dist/{webidl-CQp4aHk_.js → webidl-DXEUpDWH.js} +0 -0
  545. /package/dist/{xquery-IxkjlwOD.js → xquery-Ba_NB5bD.js} +0 -0
  546. /package/dist/{yacas-Bnctn5w8.js → yacas-HKQU6hyk.js} +0 -0
  547. /package/dist/{z80-DrFwhx53.js → z80-CXkHXLdj.js} +0 -0
@@ -3,8 +3,9 @@
3
3
 
4
4
  import type { Column, Table } from "@tanstack/react-table";
5
5
  import { CheckIcon, MinusIcon, Trash2Icon, XIcon } from "lucide-react";
6
- import { useId, useState } from "react";
6
+ import { useEffect, useId, useRef, useState } from "react";
7
7
  import type { CalculateTopKRows } from "@/plugins/impl/DataTablePlugin";
8
+ import type { OperatorType } from "@/plugins/impl/data-frames/utils/operators";
8
9
  import { Combobox, ComboboxItem } from "../ui/combobox";
9
10
  import { Input } from "../ui/input";
10
11
  import { NumberField } from "../ui/number-field";
@@ -16,68 +17,90 @@ import {
16
17
  SelectValue,
17
18
  } from "../ui/select";
18
19
  import { Button } from "../ui/button";
20
+ import { DateLikeInput, DateLikeRangeInput } from "./date-filter-inputs";
19
21
  import { FilterByValuesPicker } from "./filter-by-values-picker";
20
- import { type ColumnFilterValue, Filter } from "./filters";
22
+ import { RegexInput } from "./regex-input";
23
+ import {
24
+ type ColumnFilterValue,
25
+ DATETIME_OPS,
26
+ Filter,
27
+ isDatetimeComparisonOp,
28
+ isNumberComparisonOp,
29
+ isTextScalarOp,
30
+ MEMBERSHIP_OPS,
31
+ NUMBER_OPS,
32
+ TEXT_OPS,
33
+ } from "./filters";
34
+ import { OPERATOR_LABELS } from "./operator-labels";
21
35
  import { Tooltip } from "../ui/tooltip";
22
36
 
23
- // Editable filter types in this editor — date/datetime/time are read-only
24
- // Will add support for rest in next PR
25
- type EditableFilterType = "number" | "text" | "boolean" | "select";
26
-
27
- // UI-level operator for the operator dropdown. Today the committed filter
28
- // value does not carry this operator for number ranges — ranges are
29
- // converted to `>=` / `<=` condition pairs at the RPC boundary
30
- // (`filterToFilterCondition`). The follow-up PR splits UI operators into
31
- // distinct `<`, `>`, `between` variants and routes them through as-is.
32
- type UiOperator =
33
- | "between"
34
- | "contains"
35
- | "is_true"
36
- | "is_false"
37
- | "is_null"
38
- | "is_not_null"
39
- | "in"
40
- | "not_in";
41
-
42
- // will be expanded by a follow up PR
43
- const OPERATORS_BY_TYPE: Record<EditableFilterType, UiOperator[]> = {
44
- number: ["between", "is_null", "is_not_null"],
45
- text: ["contains", "is_null", "is_not_null"],
46
- boolean: ["is_true", "is_false", "is_null", "is_not_null"],
47
- select: ["in", "not_in"],
37
+ type EditableFilterType =
38
+ | "number"
39
+ | "text"
40
+ | "boolean"
41
+ | "select"
42
+ | "date"
43
+ | "datetime"
44
+ | "time";
45
+
46
+ type DateLikeEditableFilterType = Extract<
47
+ EditableFilterType,
48
+ "date" | "datetime" | "time"
49
+ >;
50
+
51
+ const DATE_LIKE_TYPES: ReadonlySet<EditableFilterType> = new Set([
52
+ "date",
53
+ "datetime",
54
+ "time",
55
+ ]);
56
+
57
+ const isDateLikeType = (
58
+ type: EditableFilterType,
59
+ ): type is DateLikeEditableFilterType => DATE_LIKE_TYPES.has(type);
60
+
61
+ const BOOLEAN_OPS = ["is_true", "is_false", "is_null", "is_not_null"] as const;
62
+ const SELECT_OPS = MEMBERSHIP_OPS;
63
+
64
+ const OPERATORS_BY_TYPE: Record<
65
+ EditableFilterType,
66
+ ReadonlyArray<OperatorType>
67
+ > = {
68
+ number: NUMBER_OPS,
69
+ text: TEXT_OPS,
70
+ boolean: BOOLEAN_OPS,
71
+ select: SELECT_OPS,
72
+ date: DATETIME_OPS,
73
+ datetime: DATETIME_OPS,
74
+ time: DATETIME_OPS,
48
75
  };
49
76
 
50
- const DEFAULT_OPERATOR: Record<EditableFilterType, UiOperator> = {
77
+ const DEFAULT_OPERATOR: Record<EditableFilterType, OperatorType> = {
51
78
  number: "between",
52
79
  text: "contains",
53
80
  boolean: "is_true",
54
81
  select: "in",
82
+ date: "between",
83
+ datetime: "between",
84
+ time: "between",
55
85
  };
56
86
 
57
- const OPERATOR_LABELS: Record<UiOperator, string> = {
58
- between: "Between",
59
- contains: "Contains",
60
- is_true: "Is true",
61
- is_false: "Is false",
62
- is_null: "Is null",
63
- is_not_null: "Is not null",
64
- in: "Is in",
65
- not_in: "Not in",
66
- };
67
-
68
- const OPERATORS_WITHOUT_VALUE = new Set<UiOperator>([
87
+ const OPERATORS_WITHOUT_VALUE = new Set<OperatorType>([
69
88
  "is_true",
70
89
  "is_false",
71
90
  "is_null",
72
91
  "is_not_null",
92
+ "is_empty",
73
93
  ]);
74
94
 
75
- interface DraftValue {
76
- min?: number;
77
- max?: number;
78
- text?: string;
79
- options?: unknown[];
80
- }
95
+ type DraftValue =
96
+ | { kind: "between"; min?: number; max?: number }
97
+ | { kind: "single-number"; value?: number }
98
+ | { kind: "single-text"; text?: string }
99
+ | { kind: "multi-text"; values?: string[] }
100
+ | { kind: "options"; options?: unknown[] }
101
+ | { kind: "date-between"; min?: Date; max?: Date }
102
+ | { kind: "date-single"; value?: Date }
103
+ | { kind: "none" };
81
104
 
82
105
  interface Snapshot {
83
106
  columnId: string;
@@ -92,7 +115,7 @@ interface FilterPillEditorProps<TData> {
92
115
  }
93
116
 
94
117
  export const FilterPillEditor = <TData,>({
95
- snapshot, // current state of filter pre-edit
118
+ snapshot,
96
119
  table,
97
120
  calculateTopKRows,
98
121
  onClose,
@@ -102,34 +125,33 @@ export const FilterPillEditor = <TData,>({
102
125
  const valueId = useId();
103
126
 
104
127
  const snapshotType = getEditableType(snapshot.value);
105
- const snapshotOperator = getUiOperator(snapshot.value);
128
+ const snapshotOperator = snapshot.value.operator as OperatorType;
106
129
  const snapshotDraft = toDraftValue(snapshot.value);
107
130
 
108
131
  const [draftColumnId, setDraftColumnId] = useState<string>(snapshot.columnId);
109
132
  const [draftType, setDraftType] = useState<EditableFilterType>(snapshotType);
110
133
  const [draftOperator, setDraftOperator] =
111
- useState<UiOperator>(snapshotOperator);
134
+ useState<OperatorType>(snapshotOperator);
112
135
  const [draftValue, setDraftValue] = useState<DraftValue>(snapshotDraft);
113
136
 
114
137
  const editableColumns = table.getAllColumns().filter((c) => {
115
138
  const ft = c.columnDef.meta?.filterType;
116
139
  return (
117
- ft === "number" || ft === "text" || ft === "boolean" || ft === "select"
140
+ ft === "number" ||
141
+ ft === "text" ||
142
+ ft === "boolean" ||
143
+ ft === "select" ||
144
+ ft === "date" ||
145
+ ft === "datetime" ||
146
+ ft === "time"
118
147
  );
119
148
  });
120
149
 
121
- // if we switch back to pre-edit column+operator
122
- // restore the original value as well
123
150
  const rehydrateIfMatchesSnapshot = (args: {
124
151
  id: string;
125
- type: EditableFilterType;
126
- operator: UiOperator;
152
+ operator: OperatorType;
127
153
  }) => {
128
- if (
129
- args.id === snapshot.columnId &&
130
- args.type === snapshotType &&
131
- args.operator === snapshotOperator
132
- ) {
154
+ if (args.id === snapshot.columnId && args.operator === snapshotOperator) {
133
155
  setDraftValue(snapshotDraft);
134
156
  }
135
157
  };
@@ -147,34 +169,42 @@ export const FilterPillEditor = <TData,>({
147
169
  nextOperator = DEFAULT_OPERATOR[nextColumnType];
148
170
  setDraftType(nextColumnType);
149
171
  setDraftOperator(nextOperator);
150
- setDraftValue({});
172
+ setDraftValue(emptyDraftFor(nextColumnType, nextOperator));
151
173
  }
152
174
  setDraftColumnId(nextColumnId);
153
175
  rehydrateIfMatchesSnapshot({
154
176
  id: nextColumnId,
155
- type: nextColumnType,
156
177
  operator: nextOperator,
157
178
  });
158
179
  };
159
180
 
160
- const handleOperatorChange = (nextOp: UiOperator) => {
181
+ const handleOperatorChange = (nextOp: OperatorType) => {
161
182
  setDraftOperator(nextOp);
183
+ const nextEmpty = emptyDraftFor(draftType, nextOp);
184
+ if (nextEmpty.kind !== draftValue.kind) {
185
+ setDraftValue(nextEmpty);
186
+ }
162
187
  rehydrateIfMatchesSnapshot({
163
188
  id: draftColumnId,
164
- type: draftType,
165
189
  operator: nextOp,
166
190
  });
167
191
  };
168
192
 
193
+ const pendingValue = buildFilterValue({
194
+ type: draftType,
195
+ operator: draftOperator,
196
+ draft: draftValue,
197
+ });
198
+ const applyDisabled = pendingValue === undefined;
199
+ const applyTooltip = applyDisabled
200
+ ? getMissingValueMessage(draftType, draftOperator)
201
+ : "Apply filter";
202
+
169
203
  const handleApply = () => {
170
- const value = buildFilterValue({
171
- type: draftType,
172
- operator: draftOperator,
173
- draft: draftValue,
174
- });
175
- if (!value) {
204
+ if (!pendingValue) {
176
205
  return;
177
206
  }
207
+ const value = pendingValue;
178
208
  table.setColumnFilters((filters) => {
179
209
  const dropIds = new Set([snapshot.columnId, draftColumnId]);
180
210
  const filtered = filters.filter((f) => !dropIds.has(f.id));
@@ -191,9 +221,34 @@ export const FilterPillEditor = <TData,>({
191
221
  };
192
222
 
193
223
  const showValueSlot = !OPERATORS_WITHOUT_VALUE.has(draftOperator);
224
+ const operatorOptions = OPERATORS_BY_TYPE[draftType];
225
+
226
+ const valueSlotRef = useRef<HTMLDivElement>(null);
227
+ const operatorTriggerRef = useRef<HTMLButtonElement>(null);
228
+ useEffect(() => {
229
+ const firstInput = valueSlotRef.current?.querySelector<HTMLElement>(
230
+ 'input, [role="spinbutton"], [role="combobox"], button',
231
+ );
232
+ if (firstInput) {
233
+ firstInput.focus();
234
+ } else {
235
+ operatorTriggerRef.current?.focus();
236
+ }
237
+ }, [draftType, draftOperator]);
194
238
 
195
239
  return (
196
- <div className="flex flex-row gap-4 items-end p-3">
240
+ <form
241
+ className="flex flex-row gap-4 items-end p-3"
242
+ onSubmit={(e) => {
243
+ e.preventDefault();
244
+ handleApply();
245
+ }}
246
+ onKeyDownCapture={(e) => {
247
+ if (e.key === "Tab") {
248
+ e.stopPropagation();
249
+ }
250
+ }}
251
+ >
197
252
  <div className="flex flex-col gap-1">
198
253
  <label className="text-xs text-muted-foreground" htmlFor={columnId}>
199
254
  Column
@@ -218,14 +273,19 @@ export const FilterPillEditor = <TData,>({
218
273
  Operator
219
274
  </label>
220
275
  <Select
276
+ key={draftType}
221
277
  value={draftOperator}
222
- onValueChange={(v) => handleOperatorChange(v as UiOperator)}
278
+ onValueChange={(v) => handleOperatorChange(v as OperatorType)}
223
279
  >
224
- <SelectTrigger id={operatorId} className="h-6 mb-1 bg-transparent">
280
+ <SelectTrigger
281
+ ref={operatorTriggerRef}
282
+ id={operatorId}
283
+ className="h-6 mb-1 bg-transparent"
284
+ >
225
285
  <SelectValue />
226
286
  </SelectTrigger>
227
287
  <SelectContent>
228
- {OPERATORS_BY_TYPE[draftType].map((op) => (
288
+ {operatorOptions.map((op) => (
229
289
  <SelectItem key={op} value={op}>
230
290
  {OPERATOR_LABELS[op]}
231
291
  </SelectItem>
@@ -234,13 +294,14 @@ export const FilterPillEditor = <TData,>({
234
294
  </Select>
235
295
  </div>
236
296
  {showValueSlot && (
237
- <div className="flex flex-col gap-1">
297
+ <div ref={valueSlotRef} className="flex flex-col gap-1">
238
298
  <label htmlFor={valueId} className="text-xs text-muted-foreground">
239
299
  Value
240
300
  </label>
241
301
  <ValueSlot
242
302
  id={valueId}
243
303
  type={draftType}
304
+ operator={draftOperator}
244
305
  value={draftValue}
245
306
  onChange={setDraftValue}
246
307
  column={table.getColumn(draftColumnId) ?? null}
@@ -249,17 +310,19 @@ export const FilterPillEditor = <TData,>({
249
310
  </div>
250
311
  )}
251
312
  <div className="flex gap-1 mb-1">
252
- <Tooltip content="Apply filter">
253
- <Button
254
- type="button"
255
- size="icon"
256
- variant="ghost"
257
- className="rounded-full text-primary hover:text-primary hover:bg-primary/10"
258
- onClick={handleApply}
259
- aria-label="Apply filter"
260
- >
261
- <CheckIcon className="h-3.5 w-3.5" aria-hidden={true} />
262
- </Button>
313
+ <Tooltip content={applyTooltip}>
314
+ <span className="inline-flex">
315
+ <Button
316
+ type="submit"
317
+ size="icon"
318
+ variant="ghost"
319
+ disabled={applyDisabled}
320
+ className="rounded-full text-primary hover:text-primary hover:bg-primary/10"
321
+ aria-label="Apply filter"
322
+ >
323
+ <CheckIcon className="h-3.5 w-3.5" aria-hidden={true} />
324
+ </Button>
325
+ </span>
263
326
  </Tooltip>
264
327
  <Tooltip content="Close without saving">
265
328
  <Button
@@ -286,13 +349,14 @@ export const FilterPillEditor = <TData,>({
286
349
  </Button>
287
350
  </Tooltip>
288
351
  </div>
289
- </div>
352
+ </form>
290
353
  );
291
354
  };
292
355
 
293
356
  interface ValueSlotProps<TData, TValue> {
294
357
  id?: string;
295
358
  type: EditableFilterType;
359
+ operator: OperatorType;
296
360
  value: DraftValue;
297
361
  onChange: (next: DraftValue) => void;
298
362
  column: Column<TData, TValue> | null;
@@ -302,26 +366,28 @@ interface ValueSlotProps<TData, TValue> {
302
366
  const ValueSlot = <TData, TValue>({
303
367
  id,
304
368
  type,
369
+ operator,
305
370
  value,
306
371
  onChange,
307
372
  column,
308
373
  calculateTopKRows,
309
374
  }: ValueSlotProps<TData, TValue>) => {
310
- if (type === "number") {
375
+ if (type === "number" && operator === "between") {
376
+ const v = value.kind === "between" ? value : { kind: "between" as const };
311
377
  return (
312
- <div className="flex gap-1 items-center w-48">
378
+ <div className="flex gap-1 items-center w-44">
313
379
  <NumberField
314
380
  id={id}
315
- value={value.min}
316
- onChange={(v) => onChange({ ...value, min: v })}
381
+ value={v.min}
382
+ onChange={(n) => onChange({ kind: "between", min: n, max: v.max })}
317
383
  aria-label="min"
318
384
  placeholder="min"
319
385
  className="border-input flex-1 min-w-0"
320
386
  />
321
387
  <MinusIcon className="h-5 w-5 text-muted-foreground shrink-0" />
322
388
  <NumberField
323
- value={value.max}
324
- onChange={(v) => onChange({ ...value, max: v })}
389
+ value={v.max}
390
+ onChange={(n) => onChange({ kind: "between", min: v.min, max: n })}
325
391
  aria-label="max"
326
392
  placeholder="max"
327
393
  className="border-input flex-1 min-w-0"
@@ -329,26 +395,108 @@ const ValueSlot = <TData, TValue>({
329
395
  </div>
330
396
  );
331
397
  }
332
- if (type === "text") {
398
+ if (type === "number" && isNumberComparisonOp(operator)) {
399
+ const v =
400
+ value.kind === "single-number"
401
+ ? value
402
+ : { kind: "single-number" as const };
403
+ return (
404
+ <NumberField
405
+ id={id}
406
+ value={v.value}
407
+ onChange={(n) => onChange({ kind: "single-number", value: n })}
408
+ aria-label="value"
409
+ placeholder="value"
410
+ className="border-input w-24 min-w-0"
411
+ />
412
+ );
413
+ }
414
+ if (
415
+ type === "text" &&
416
+ (operator === "in" || operator === "not_in") &&
417
+ column
418
+ ) {
419
+ const v =
420
+ value.kind === "multi-text" ? value : { kind: "multi-text" as const };
421
+ return (
422
+ <div className="w-48">
423
+ <FilterByValuesPicker
424
+ column={column}
425
+ calculateTopKRows={calculateTopKRows}
426
+ chosenValues={v.values ?? []}
427
+ onChange={(next) =>
428
+ onChange({ kind: "multi-text", values: next.map(String) })
429
+ }
430
+ creatable={true}
431
+ />
432
+ </div>
433
+ );
434
+ }
435
+ if (type === "text" && isTextScalarOp(operator)) {
436
+ const v =
437
+ value.kind === "single-text" ? value : { kind: "single-text" as const };
438
+ if (operator === "regex") {
439
+ return (
440
+ <RegexInput
441
+ id={id}
442
+ value={v.text ?? ""}
443
+ onChange={(text) => onChange({ kind: "single-text", text })}
444
+ className="w-40"
445
+ />
446
+ );
447
+ }
333
448
  return (
334
449
  <Input
335
450
  id={id}
336
451
  type="text"
337
- value={value.text ?? ""}
338
- onChange={(e) => onChange({ ...value, text: e.target.value })}
452
+ value={v.text ?? ""}
453
+ onChange={(e) =>
454
+ onChange({ kind: "single-text", text: e.target.value })
455
+ }
339
456
  placeholder="Text…"
340
- className="border-input min-w-0"
457
+ className="border-input w-40 min-w-0"
458
+ />
459
+ );
460
+ }
461
+ if (isDateLikeType(type) && operator === "between") {
462
+ const v =
463
+ value.kind === "date-between" ? value : { kind: "date-between" as const };
464
+ return (
465
+ <DateLikeRangeInput
466
+ key={`${column?.id ?? "_"}-${operator}`}
467
+ filterType={type}
468
+ min={v.min}
469
+ max={v.max}
470
+ onRangeChange={(min, max) =>
471
+ onChange({ kind: "date-between", min, max })
472
+ }
473
+ className="border-input"
474
+ />
475
+ );
476
+ }
477
+ if (isDateLikeType(type) && isDatetimeComparisonOp(operator)) {
478
+ const v =
479
+ value.kind === "date-single" ? value : { kind: "date-single" as const };
480
+ return (
481
+ <DateLikeInput
482
+ key={`${column?.id ?? "_"}-${operator}`}
483
+ filterType={type}
484
+ value={v.value}
485
+ onChange={(next) => onChange({ kind: "date-single", value: next })}
486
+ aria-label="value"
487
+ className="border-input"
341
488
  />
342
489
  );
343
490
  }
344
491
  if (type === "select" && column) {
492
+ const v = value.kind === "options" ? value : { kind: "options" as const };
345
493
  return (
346
494
  <div className="flex w-48">
347
495
  <FilterByValuesPicker
348
496
  column={column}
349
497
  calculateTopKRows={calculateTopKRows}
350
- chosenValues={value.options ?? []}
351
- onChange={(values) => onChange({ ...value, options: values })}
498
+ chosenValues={v.options ?? []}
499
+ onChange={(values) => onChange({ kind: "options", options: values })}
352
500
  />
353
501
  </div>
354
502
  );
@@ -357,55 +505,105 @@ const ValueSlot = <TData, TValue>({
357
505
  };
358
506
 
359
507
  function getEditableType(value: ColumnFilterValue): EditableFilterType {
508
+ switch (value.type) {
509
+ case "number":
510
+ case "text":
511
+ case "boolean":
512
+ case "select":
513
+ case "date":
514
+ case "datetime":
515
+ case "time":
516
+ return value.type;
517
+ default:
518
+ return "text";
519
+ }
520
+ }
521
+
522
+ function toDraftValue(value: ColumnFilterValue): DraftValue {
360
523
  if (value.type === "number") {
361
- return "number";
524
+ switch (value.operator) {
525
+ case "between":
526
+ return { kind: "between", min: value.min, max: value.max };
527
+ case "is_null":
528
+ case "is_not_null":
529
+ return { kind: "none" };
530
+ default:
531
+ return { kind: "single-number", value: value.value };
532
+ }
362
533
  }
363
534
  if (value.type === "text") {
364
- return "text";
365
- }
366
- if (value.type === "boolean") {
367
- return "boolean";
535
+ switch (value.operator) {
536
+ case "in":
537
+ case "not_in":
538
+ return { kind: "multi-text", values: [...value.values] };
539
+ case "is_null":
540
+ case "is_not_null":
541
+ case "is_empty":
542
+ return { kind: "none" };
543
+ default:
544
+ return { kind: "single-text", text: value.text };
545
+ }
368
546
  }
369
547
  if (value.type === "select") {
370
- return "select";
548
+ return { kind: "options", options: [...value.options] };
371
549
  }
372
- // date/datetime/time fall back to text; callers should guard. supported in future
373
- return "text";
550
+ if (
551
+ value.type === "date" ||
552
+ value.type === "datetime" ||
553
+ value.type === "time"
554
+ ) {
555
+ switch (value.operator) {
556
+ case "between":
557
+ return { kind: "date-between", min: value.min, max: value.max };
558
+ case "is_null":
559
+ case "is_not_null":
560
+ return { kind: "none" };
561
+ default:
562
+ return { kind: "date-single", value: value.value };
563
+ }
564
+ }
565
+ return { kind: "none" };
374
566
  }
375
567
 
376
- function getUiOperator(value: ColumnFilterValue): UiOperator {
377
- if (value.operator === "is_null") {
378
- return "is_null";
379
- }
380
- if (value.operator === "is_not_null") {
381
- return "is_not_null";
568
+ function emptyDraftFor(
569
+ type: EditableFilterType,
570
+ operator: OperatorType,
571
+ ): DraftValue {
572
+ if (OPERATORS_WITHOUT_VALUE.has(operator)) {
573
+ return { kind: "none" };
382
574
  }
383
- if (value.type === "number") {
384
- return "between";
575
+ if (type === "number") {
576
+ return operator === "between"
577
+ ? { kind: "between" }
578
+ : { kind: "single-number" };
385
579
  }
386
- if (value.type === "text") {
387
- return "contains";
580
+ if (type === "text") {
581
+ return operator === "in" || operator === "not_in"
582
+ ? { kind: "multi-text", values: [] }
583
+ : { kind: "single-text" };
388
584
  }
389
- if (value.type === "boolean") {
390
- return value.value ? "is_true" : "is_false";
585
+ if (type === "select") {
586
+ return { kind: "options", options: [] };
391
587
  }
392
- if (value.type === "select") {
393
- return value.operator === "not_in" ? "not_in" : "in";
588
+ if (isDateLikeType(type)) {
589
+ return operator === "between"
590
+ ? { kind: "date-between" }
591
+ : { kind: "date-single" };
394
592
  }
395
- return "contains";
593
+ return { kind: "none" };
396
594
  }
397
595
 
398
- function toDraftValue(value: ColumnFilterValue): DraftValue {
399
- if (value.type === "number") {
400
- return { min: value.min, max: value.max };
401
- }
402
- if (value.type === "text") {
403
- return { text: value.text };
596
+ function getMissingValueMessage(
597
+ type: EditableFilterType,
598
+ operator: OperatorType,
599
+ ): string {
600
+ if (operator === "between") {
601
+ return "Min and max are required";
404
602
  }
405
- if (value.type === "select") {
406
- return { options: [...value.options] };
603
+ if (type === "text" && (operator === "in" || operator === "not_in")) {
604
+ return "Pick at least one value";
407
605
  }
408
- return {};
606
+ return "Value is required";
409
607
  }
410
608
 
411
609
  function buildFilterValue({
@@ -414,51 +612,79 @@ function buildFilterValue({
414
612
  draft,
415
613
  }: {
416
614
  type: EditableFilterType;
417
- operator: UiOperator;
615
+ operator: OperatorType;
418
616
  draft: DraftValue;
419
617
  }): ColumnFilterValue | undefined {
420
- if (operator === "is_null" || operator === "is_not_null") {
421
- const op = operator;
422
- if (type === "number") {
423
- return Filter.number({ operator: op });
618
+ if (type === "number") {
619
+ if (operator === "is_null" || operator === "is_not_null") {
620
+ return Filter.number({ operator });
424
621
  }
425
- if (type === "boolean") {
426
- return Filter.boolean({ operator: op });
622
+ if (operator === "between") {
623
+ if (
624
+ draft.kind !== "between" ||
625
+ draft.min === undefined ||
626
+ draft.max === undefined
627
+ ) {
628
+ return undefined;
629
+ }
630
+ return Filter.number({
631
+ operator: "between",
632
+ min: draft.min,
633
+ max: draft.max,
634
+ });
427
635
  }
428
- return Filter.text({ operator: op });
429
- }
430
- if (type === "number") {
431
- if (draft.min === undefined && draft.max === undefined) {
636
+ if (!isNumberComparisonOp(operator)) {
432
637
  return undefined;
433
638
  }
434
- return Filter.number({ min: draft.min, max: draft.max });
639
+ if (draft.kind !== "single-number" || draft.value === undefined) {
640
+ return undefined;
641
+ }
642
+ return Filter.number({ operator, value: draft.value });
435
643
  }
436
644
  if (type === "text") {
437
- if (!draft.text) {
645
+ if (
646
+ operator === "is_null" ||
647
+ operator === "is_not_null" ||
648
+ operator === "is_empty"
649
+ ) {
650
+ return Filter.text({ operator });
651
+ }
652
+ if (operator === "in" || operator === "not_in") {
653
+ if (
654
+ draft.kind !== "multi-text" ||
655
+ !draft.values ||
656
+ draft.values.length === 0
657
+ ) {
658
+ return undefined;
659
+ }
660
+ return Filter.text({ operator, values: draft.values });
661
+ }
662
+ if (!isTextScalarOp(operator)) {
438
663
  return undefined;
439
664
  }
440
- return Filter.text({
441
- text: draft.text,
442
- operator: "contains",
443
- });
665
+ if (draft.kind !== "single-text" || !draft.text) {
666
+ return undefined;
667
+ }
668
+ return Filter.text({ operator, text: draft.text });
444
669
  }
445
670
  if (type === "boolean") {
446
671
  if (operator === "is_true") {
447
- return Filter.boolean({
448
- value: true,
449
- operator: "is_true",
450
- });
672
+ return Filter.boolean({ value: true, operator: "is_true" });
451
673
  }
452
674
  if (operator === "is_false") {
453
- return Filter.boolean({
454
- value: false,
455
- operator: "is_false",
456
- });
675
+ return Filter.boolean({ value: false, operator: "is_false" });
676
+ }
677
+ if (operator === "is_null" || operator === "is_not_null") {
678
+ return Filter.boolean({ operator });
457
679
  }
458
680
  return undefined;
459
681
  }
460
682
  if (type === "select") {
461
- if (!draft.options || draft.options.length === 0) {
683
+ if (
684
+ draft.kind !== "options" ||
685
+ !draft.options ||
686
+ draft.options.length === 0
687
+ ) {
462
688
  return undefined;
463
689
  }
464
690
  return Filter.select({
@@ -466,5 +692,33 @@ function buildFilterValue({
466
692
  operator: operator === "not_in" ? "not_in" : "in",
467
693
  });
468
694
  }
695
+ if (isDateLikeType(type)) {
696
+ const factory =
697
+ type === "date"
698
+ ? Filter.date
699
+ : type === "datetime"
700
+ ? Filter.datetime
701
+ : Filter.time;
702
+ if (operator === "is_null" || operator === "is_not_null") {
703
+ return factory({ operator });
704
+ }
705
+ if (operator === "between") {
706
+ if (
707
+ draft.kind !== "date-between" ||
708
+ draft.min === undefined ||
709
+ draft.max === undefined
710
+ ) {
711
+ return undefined;
712
+ }
713
+ return factory({ operator: "between", min: draft.min, max: draft.max });
714
+ }
715
+ if (!isDatetimeComparisonOp(operator)) {
716
+ return undefined;
717
+ }
718
+ if (draft.kind !== "date-single" || draft.value === undefined) {
719
+ return undefined;
720
+ }
721
+ return factory({ operator, value: draft.value });
722
+ }
469
723
  return undefined;
470
724
  }