@marimo-team/islands 0.26.1-dev1 → 0.26.1-dev15

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 (142) hide show
  1. package/dist/{ConnectedDataExplorerComponent-DtwVgVpX.js → ConnectedDataExplorerComponent-CR9WyiEc.js} +11 -11
  2. package/dist/{ErrorBoundary-CnVR4XMW.js → ErrorBoundary-BQXI85CA.js} +7 -7
  3. package/dist/{abnfDiagram-VCTEODGH-BbZOIueZ.js → abnfDiagram-VCTEODGH-DGAbsdXT.js} +2 -2
  4. package/dist/{any-language-editor-yG-YmLaK.js → any-language-editor-DzGF1ll-.js} +5 -5
  5. package/dist/{architectureDiagram-5GKGNRK7-qjLjxapm.js → architectureDiagram-5GKGNRK7-D4DnIo7R.js} +1 -1
  6. package/dist/{assertNever-DywGMo-S.js → assertNever-CqwxSD_2.js} +3 -3
  7. package/dist/{button-qQhINE7z.js → button-Z2R2272J.js} +34 -31
  8. package/dist/{capabilities-DKqMqBzm.js → capabilities-ba3Dyv8n.js} +1 -1
  9. package/dist/{chat-ui-D5YPIONI.js → chat-ui-b1ERxzeA.js} +17 -17
  10. package/dist/{check-jchHMCfs.js → check-D9vf6LYF.js} +1 -1
  11. package/dist/{chunk-IMKFNOWR-BzDY1_I7.js → chunk-IMKFNOWR-Bc_i6jWx.js} +1 -1
  12. package/dist/{chunk-SHT3W25Y-DbHsMKdo.js → chunk-SHT3W25Y-CGML5pnF.js} +1 -1
  13. package/dist/{chunk-SVP7TREG-CtwnwAE6.js → chunk-SVP7TREG-ZpeFKfFT.js} +1 -1
  14. package/dist/{chunk-TICWLB2K-C5Z5QMbO.js → chunk-TICWLB2K-C6cLmcg8.js} +1 -1
  15. package/dist/{classDiagram-ZZMXUADV-B8E5Hn78.js → classDiagram-ZZMXUADV--q40NTXr.js} +2 -2
  16. package/dist/{classDiagram-v2-VYDZK3BY-DeGsK9bT.js → classDiagram-v2-VYDZK3BY-Dt_Pp94L.js} +2 -2
  17. package/dist/{code-visibility-Cs-o5weM.js → code-visibility-B_n3GMdg.js} +6 -6
  18. package/dist/{common-C92_m-1k.js → common-BPgO2zo6.js} +41 -41
  19. package/dist/{config-qTaTHnpE.js → config-B8JCQMby.js} +4 -4
  20. package/dist/{copy-icon-BI7vZHEW.js → copy-icon-BLig0ZKb.js} +3 -3
  21. package/dist/{createReducer-DdSLRfBT.js → createReducer-BIUQ3TbG.js} +2 -2
  22. package/dist/{cynefinDiagram-5FMLGOSQ-NDedRwsw.js → cynefinDiagram-5FMLGOSQ-2FtF_-cc.js} +1 -1
  23. package/dist/{dagre-GXQ25YYZ-De0sSZO7.js → dagre-GXQ25YYZ-Cymu2SPS.js} +1 -1
  24. package/dist/{data-grid-overlay-editor-D32Gn15n.js → data-grid-overlay-editor-B5aHiI2o.js} +5 -5
  25. package/dist/{data-grid-types-DIX_pCco.js → data-grid-types-DBNnjiYJ.js} +2 -2
  26. package/dist/{diagram-S7CK7UJ4-wBtVl61y.js → diagram-S7CK7UJ4-OwDa8kAa.js} +1 -1
  27. package/dist/{diagram-UQ7AKVKN-CKWE3c1T.js → diagram-UQ7AKVKN-CzRDwZwd.js} +1 -1
  28. package/dist/{diagram-VX7I27RA-D2Ac5198.js → diagram-VX7I27RA-XRIcgMDs.js} +1 -1
  29. package/dist/{diagram-Z3DM3KII-CYaFOQcI.js → diagram-Z3DM3KII-DdRDYAs6.js} +1 -1
  30. package/dist/{dialog-Ic6dh09m.js → dialog-DGh2HNAO.js} +3 -3
  31. package/dist/{dist-BvZpdAuG.js → dist-6B1_Ttbh.js} +1 -1
  32. package/dist/{dist-D1D56-GS.js → dist-B28poF32.js} +2 -2
  33. package/dist/{dist-BozTF_gH.js → dist-BBZ7lnMw.js} +2 -2
  34. package/dist/{dist-BfrgytDR.js → dist-BD8ZKF5t.js} +3 -3
  35. package/dist/{dist-DNkrY12t.js → dist-BG-7Qpaj.js} +3 -3
  36. package/dist/{dist-D92tYjLc.js → dist-BIaGGUbU.js} +13 -11
  37. package/dist/{dist-BagHbFqG.js → dist-BR5PU2Ph.js} +3 -3
  38. package/dist/{dist-DpYpG8Yc.js → dist-BidYR5m4.js} +3 -3
  39. package/dist/{dist-D95Cd4xm.js → dist-BkGYCvFX.js} +3 -3
  40. package/dist/{dist-DneeBk3K.js → dist-BmEyXT7K.js} +2 -2
  41. package/dist/{dist-BdUitvVW.js → dist-Bt0Wt6m9.js} +2 -2
  42. package/dist/{dist-CEomphG1.js → dist-CG2Sl0D4.js} +2 -2
  43. package/dist/{dist-BMz__bo5.js → dist-CQfpgadU.js} +3 -3
  44. package/dist/{dist-BreKIQqQ.js → dist-CVOPvfzN.js} +3 -3
  45. package/dist/{dist-BEcpQbZa.js → dist-Cm0iCeQQ.js} +3 -3
  46. package/dist/{dist-CDVvitRS.js → dist-Cnc14jEq.js} +2 -2
  47. package/dist/{dist-ChcBm3jk.js → dist-D3KPC38e.js} +4 -4
  48. package/dist/{dist-B1qu3Bez.js → dist-D7BXk27E.js} +3 -3
  49. package/dist/{dist-BsE4gQHj.js → dist-D9Qhvxvg.js} +1 -1
  50. package/dist/{dist-OmeAz0fR.js → dist-DJKajXDB.js} +3 -3
  51. package/dist/{dist-ObeTgSmf.js → dist-DYbNRTYG.js} +4 -4
  52. package/dist/{dist-Cshl6jBw.js → dist-DhtDWnzK.js} +2 -2
  53. package/dist/{dist-BunZKA_9.js → dist-_x2Jks2R.js} +2 -2
  54. package/dist/{dist-MggMo7OR.js → dist-m0MWV-aw.js} +1 -1
  55. package/dist/{dist-TGSwzj8a.js → dist-pPbYNVjd.js} +4 -4
  56. package/dist/{dropdown-menu-Dhv4fcNl.js → dropdown-menu-ChH3oiqI.js} +6 -6
  57. package/dist/{ebnfDiagram-PWID7BFC-Ds7f42dj.js → ebnfDiagram-PWID7BFC-CZMNMGNP.js} +2 -2
  58. package/dist/{erDiagram-RLTQ6QDP-b58Sz2Mc.js → erDiagram-RLTQ6QDP-ByxHAN4b.js} +1 -1
  59. package/dist/{error-banner-CJVLr5_a.js → error-banner-BvRaQnGH.js} +22 -22
  60. package/dist/{error-entries-BKlEsuk4.js → error-entries-Bl8fzLQc.js} +11 -11
  61. package/dist/{esm-B9n0caHs.js → esm-DY8dGAjJ.js} +23 -23
  62. package/dist/{esm-Bwp_FHP0.js → esm-Dw2ZydG_.js} +3 -3
  63. package/dist/{feedback-button-HXizISwe.js → feedback-button-C5zljLS1.js} +8 -8
  64. package/dist/{flowDiagram-HODETNUW-BH9U7VZK.js → flowDiagram-HODETNUW-BQpzWx5O.js} +2 -2
  65. package/dist/{formats-BLNFWWhV.js → formats-BxP8k8Un.js} +3 -3
  66. package/dist/{glide-data-editor-Cha2TqyF.js → glide-data-editor-Cy67HDvb.js} +59 -59
  67. package/dist/{glide-utils-Cn2_NadX.js → glide-utils-bKdvDwwo.js} +4 -4
  68. package/dist/{globals-C4qZtAQ0.js → globals-CXef1w1d.js} +3 -3
  69. package/dist/{html-to-image-CNM0ZSFD.js → html-to-image-D6A1lg0A.js} +3471 -3367
  70. package/dist/{infoDiagram-27XIBGKW-xbjwrcNi.js → infoDiagram-27XIBGKW-C9EWHkak.js} +1 -1
  71. package/dist/{ishikawaDiagram-5VMMS53U-DKtukhGS.js → ishikawaDiagram-5VMMS53U-D67SGFvp.js} +1 -1
  72. package/dist/{kanban-definition-UXKFOSKX-BEhlkZBb.js → kanban-definition-UXKFOSKX-CTMTiazR.js} +1 -1
  73. package/dist/{loader-Bin_dutt.js → loader-qPmiRXZd.js} +1 -1
  74. package/dist/main.js +5808 -5783
  75. package/dist/{mermaid-D1CZDNoB.js → mermaid-DE_tvTGF.js} +35 -35
  76. package/dist/{mindmap-definition-YA3MSWOX-DQcnJPcV.js → mindmap-definition-YA3MSWOX-LzNgDy8O.js} +1 -1
  77. package/dist/{number-overlay-editor-BVmdbAY7.js → number-overlay-editor-CxhKunPL.js} +3 -3
  78. package/dist/{pegDiagram-XKGWAZYB-BFQuPYfI.js → pegDiagram-XKGWAZYB-DFMS6feI.js} +2 -2
  79. package/dist/{pencil-DVYzq-iR.js → pencil-CHkdsX07.js} +1 -1
  80. package/dist/{pieDiagram-E7YTZNPT-l7aqNrem.js → pieDiagram-E7YTZNPT-C0MSBop-.js} +1 -1
  81. package/dist/{process-output-DthYR2Te.js → process-output-w5omHedc.js} +4 -4
  82. package/dist/{railroadDiagram-O6MQD6OU-6R3C1lwQ.js → railroadDiagram-O6MQD6OU-mbdav2pV.js} +2 -2
  83. package/dist/{requirementDiagram-BXWQKSXE-DdWYu8fn.js → requirementDiagram-BXWQKSXE-C1HNBBO6.js} +1 -1
  84. package/dist/{reveal-component-B8gTDFli.js → reveal-component-CWzW-8vE.js} +20 -20
  85. package/dist/{select-CDUxhHZg.js → select-CvorIE3l.js} +35 -35
  86. package/dist/{sequenceDiagram-WJ2MYXX4-Dzp0dgRc.js → sequenceDiagram-WJ2MYXX4-D6gBHifq.js} +1 -1
  87. package/dist/{spec-ZAt4P01J.js → spec-ayzaXGVq.js} +4 -4
  88. package/dist/{stateDiagram-D77RDMKH-BGnTUhFJ.js → stateDiagram-D77RDMKH-Bx-fTtRZ.js} +2 -2
  89. package/dist/{stateDiagram-v2-MP3YSRHH-DsJbmDf1.js → stateDiagram-v2-MP3YSRHH-Cec8T2yO.js} +2 -2
  90. package/dist/{static-state-C4bAlKTU.js → static-state-CqwW3B_X.js} +1 -1
  91. package/dist/{swimlanes-42K2YHIH-Bd4Bzh9r.js → swimlanes-42K2YHIH-C2bAgnov.js} +1 -1
  92. package/dist/{swimlanesDiagram-VR7AAH4N-BlY12Jf6.js → swimlanesDiagram-VR7AAH4N-CzeG-Mnb.js} +2 -2
  93. package/dist/{swiper-component-DTdNB9wg.js → swiper-component-B2O8hF7b.js} +2 -2
  94. package/dist/{timeline-definition-24CTP7MA-m0LanyCH.js → timeline-definition-24CTP7MA-DTJ0Rx8X.js} +1 -1
  95. package/dist/{toast-U3NpO2x3.js → toast-6V8Og7d5.js} +11 -11
  96. package/dist/{tooltip-UzJukb3F.js → tooltip-D0h-ZJ6j.js} +2 -2
  97. package/dist/{use-restore-focus-DaTVz6S6.js → use-restore-focus-BFvwj2Hj.js} +1884 -1861
  98. package/dist/{useDateFormatter-LQNtoXyh.js → useDateFormatter-D6o9PsWt.js} +2 -2
  99. package/dist/{useDeepCompareMemoize-CmNbQ9TT.js → useDeepCompareMemoize-D-Pbv7dN.js} +1 -1
  100. package/dist/{useIframeCapabilities-HTZiVlGV.js → useIframeCapabilities-_0KX0nu_.js} +1 -1
  101. package/dist/{useLifecycle-DTMczKkf.js → useLifecycle-CE0yGTMF.js} +2 -2
  102. package/dist/{vega-component-ZTdbCcwI.js → vega-component-DTf7GHQe.js} +8 -8
  103. package/dist/{vennDiagram-4TSXK5OY-BJ7vqDmn.js → vennDiagram-4TSXK5OY-lIM3SAjl.js} +1 -1
  104. package/dist/{wardleyDiagram-VM6X3IG4-D5kWacsn.js → wardleyDiagram-VM6X3IG4-Bw_t7uvA.js} +1 -1
  105. package/dist/{xychartDiagram-S5SC5T6Z-gr15Ws_z.js → xychartDiagram-S5SC5T6Z-BXwkLYKj.js} +1 -1
  106. package/package.json +3 -3
  107. package/src/components/editor/cell/CreateCellButton.tsx +69 -40
  108. package/src/components/editor/cell/__tests__/CreateCellButton.test.tsx +49 -0
  109. package/src/components/editor/cell/__tests__/cell-context-menu.test.tsx +126 -0
  110. package/src/components/editor/cell/cell-context-menu.tsx +202 -111
  111. package/src/components/editor/cell/code/cell-editor.tsx +5 -2
  112. package/src/components/editor/cell/code/code-placeholder.tsx +5 -3
  113. package/src/components/editor/output/console/ConsoleOutput.tsx +77 -50
  114. package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +28 -0
  115. package/src/components/editor/renderers/cells-renderer.tsx +3 -2
  116. package/src/components/ui/__tests__/button-shortcut.test.tsx +22 -0
  117. package/src/components/ui/__tests__/fullscreen.test.tsx +23 -1
  118. package/src/components/ui/button.tsx +5 -1
  119. package/src/components/ui/fullscreen.tsx +8 -39
  120. package/src/core/codemirror/__tests__/debounced-editor-update.test.ts +72 -0
  121. package/src/core/codemirror/__tests__/setup.test.ts +61 -1
  122. package/src/core/codemirror/cells/debugger-decorations.ts +22 -18
  123. package/src/core/codemirror/cells/line-timing-decorations.ts +13 -11
  124. package/src/core/codemirror/cells/traceback-decorations.ts +10 -11
  125. package/src/core/codemirror/code-lens/__tests__/extension.test.ts +31 -0
  126. package/src/core/codemirror/code-lens/extension.ts +21 -13
  127. package/src/core/codemirror/debounced-editor-update.ts +41 -0
  128. package/src/core/codemirror/go-to-definition/__tests__/underline.test.ts +58 -0
  129. package/src/core/codemirror/go-to-definition/extension.ts +9 -7
  130. package/src/core/codemirror/go-to-definition/underline.ts +39 -48
  131. package/src/core/codemirror/language/__tests__/sql.test.ts +36 -0
  132. package/src/core/codemirror/language/languages/sql/sql.ts +3 -0
  133. package/src/core/codemirror/placeholder/extensions.ts +26 -24
  134. package/src/core/codemirror/reactive-references/__tests__/extension.test.ts +60 -0
  135. package/src/core/codemirror/reactive-references/extension.ts +30 -21
  136. package/src/core/islands/__tests__/bridge.test.ts +1 -1
  137. package/src/core/islands/bootstrap.ts +0 -3
  138. package/src/core/notebook/replica/__tests__/replica.test.ts +7 -7
  139. package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +2 -2
  140. package/src/core/session/useNotebookSession.tsx +0 -8
  141. package/src/utils/__tests__/shared-resource.test.ts +107 -0
  142. package/src/utils/shared-resource.ts +59 -0
@@ -1,7 +1,7 @@
1
1
  import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
2
  import { t } from "./react-Bgs_wQh3.js";
3
- import { h as n } from "./tooltip-UzJukb3F.js";
4
- import { C as r } from "./select-CDUxhHZg.js";
3
+ import { h as n } from "./tooltip-D0h-ZJ6j.js";
4
+ import { C as r } from "./select-CvorIE3l.js";
5
5
  var i = n("chart-pie", [["path", {
6
6
  d: "M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",
7
7
  key: "pzmjnu"
@@ -1,6 +1,6 @@
1
1
  import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
2
  import { t } from "./react-Bgs_wQh3.js";
3
- import { It as n } from "./use-restore-focus-DaTVz6S6.js";
3
+ import { It as n } from "./use-restore-focus-BFvwj2Hj.js";
4
4
  //#region src/utils/semaphore.ts
5
5
  var r = class {
6
6
  maxPermits;
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./compiler-runtime-C5KHtL5D.js";
2
- import { t } from "./capabilities-DKqMqBzm.js";
2
+ import { t } from "./capabilities-ba3Dyv8n.js";
3
3
  //#region src/hooks/useIframeCapabilities.ts
4
4
  var n = e();
5
5
  function r() {
@@ -1,8 +1,8 @@
1
1
  import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
- import { h as t, r as n } from "./button-qQhINE7z.js";
2
+ import { h as t, i as n } from "./button-Z2R2272J.js";
3
3
  import { t as r } from "./react-Bgs_wQh3.js";
4
4
  import { t as i } from "./compiler-runtime-C5KHtL5D.js";
5
- import { h as a } from "./tooltip-UzJukb3F.js";
5
+ import { h as a } from "./tooltip-D0h-ZJ6j.js";
6
6
  import { t as o } from "./jsx-runtime-D8btoEHk.js";
7
7
  var s = a("calendar", [
8
8
  ["path", {
@@ -1,22 +1,22 @@
1
1
  import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
- import { g as t, h as n, m as r, s as i } from "./button-qQhINE7z.js";
2
+ import { g as t, h as n, m as r, s as i } from "./button-Z2R2272J.js";
3
3
  import { t as a } from "./react-Bgs_wQh3.js";
4
4
  import { t as o } from "./compiler-runtime-C5KHtL5D.js";
5
- import { t as s } from "./tooltip-UzJukb3F.js";
6
- import { l as c, t as l } from "./config-qTaTHnpE.js";
5
+ import { t as s } from "./tooltip-D0h-ZJ6j.js";
6
+ import { l as c, t as l } from "./config-B8JCQMby.js";
7
7
  import { t as u } from "./jsx-runtime-D8btoEHk.js";
8
- import { d } from "./use-restore-focus-DaTVz6S6.js";
9
- import { n as f } from "./error-banner-CJVLr5_a.js";
8
+ import { d } from "./use-restore-focus-BFvwj2Hj.js";
9
+ import { n as f } from "./error-banner-BvRaQnGH.js";
10
10
  import { t as p } from "./debounce-DrhhziJv.js";
11
11
  import { t as ee } from "./objects-DCmMvZtn.js";
12
12
  import { t as te } from "./useEvent-BoN7U38T.js";
13
- import { a as ne, i as re, n as ie, t as m } from "./formats-BLNFWWhV.js";
13
+ import { a as ne, i as re, n as ie, t as m } from "./formats-BxP8k8Un.js";
14
14
  import { a as h, t as g } from "./arrays-DoQ-AILx.js";
15
15
  import { t as ae } from "./useAsyncData-P5-Oovhq.js";
16
- import { n as _, t as oe } from "./useDeepCompareMemoize-CmNbQ9TT.js";
16
+ import { n as _, t as oe } from "./useDeepCompareMemoize-D-Pbv7dN.js";
17
17
  import { W as se, n as ce } from "./vega-loader.browser-Co9gYE8Z.js";
18
18
  import { t as le } from "./react-vega-CGgQEf0O.js";
19
- import { a as ue, n as de } from "./loader-Bin_dutt.js";
19
+ import { a as ue, n as de } from "./loader-qPmiRXZd.js";
20
20
  import { t as fe } from "./use-vega-container-remeasure-BrUpWQfF.js";
21
21
  //#region src/plugins/impl/vega/fix-relative-url.ts
22
22
  var pe = /* @__PURE__ */ e(a(), 1), me = o();
@@ -3,7 +3,7 @@ import { t } from "./src-D5uZaZib.js";
3
3
  import { n } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
4
4
  import { $ as r, H as i, K as a, U as o, a as s, b as c, c as l, et as u, f as d, nt as f, tt as p, v as m, w as h, y as g } from "./chunk-DU6HZSFF-4SDIhUTY.js";
5
5
  import { t as _ } from "./rough.esm-CtV9AnV1.js";
6
- import { p as v } from "./mermaid-D1CZDNoB.js";
6
+ import { p as v } from "./mermaid-DE_tvTGF.js";
7
7
  //#region ../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/transparentize.js
8
8
  var y = (e, t) => p(e, "a", -t), b = 1e-10;
9
9
  function x(e, t) {
@@ -2,7 +2,7 @@ import { i as e } from "./chunk-75Z2AOVW-76L6My3P.js";
2
2
  import { n as t } from "./src-D5uZaZib.js";
3
3
  import { n } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
4
4
  import { D as r, H as i, K as a, U as o, a as s, b as c, c as l, v as u, w as d, x as f, y as p } from "./chunk-DU6HZSFF-4SDIhUTY.js";
5
- import { p as m } from "./mermaid-D1CZDNoB.js";
5
+ import { p as m } from "./mermaid-DE_tvTGF.js";
6
6
  import { n as h } from "./mermaid-parser.core-DtOnl7m4.js";
7
7
  import { t as g } from "./chunk-JWPE2WC7-DJvv1t8U.js";
8
8
  //#region ../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-VM6X3IG4.mjs
@@ -9,7 +9,7 @@ import { n as s } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
9
9
  import { D as c, H as l, K as u, U as d, a as f, b as p, c as m, f as h, v as g, w as _, y as v, z as y } from "./chunk-DU6HZSFF-4SDIhUTY.js";
10
10
  import "./chunk-PWAF6VOD-CRu_RGP2.js";
11
11
  import { t as b } from "./chunk-GMAD6QVW-BJGF8QZL.js";
12
- import { p as x } from "./mermaid-D1CZDNoB.js";
12
+ import { p as x } from "./mermaid-DE_tvTGF.js";
13
13
  //#region ../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/band.js
14
14
  function S() {
15
15
  var e = t().unknown(void 0), r = e.domain, i = e.range, o = 0, s = 1, c, l, u = !1, d = 0, f = 0, p = .5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.26.1-dev1",
3
+ "version": "0.26.1-dev15",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -55,9 +55,9 @@
55
55
  "@lezer/python": "^1.1.19",
56
56
  "@marimo-team/client": "workspace:*",
57
57
  "@marimo-team/codemirror-ai": "^0.3.10",
58
- "@marimo-team/codemirror-languageserver": "^2.0.1",
58
+ "@marimo-team/codemirror-languageserver": "^2.0.2",
59
59
  "@marimo-team/codemirror-mcp": "^0.1.7",
60
- "@marimo-team/codemirror-sql": "^0.3.1",
60
+ "@marimo-team/codemirror-sql": "^0.3.2",
61
61
  "@marimo-team/llm-info": "workspace:*",
62
62
  "@marimo-team/marimo-api": "workspace:*",
63
63
  "@marimo-team/react-slotz": "^0.2.0",
@@ -1,6 +1,6 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  import { DatabaseIcon, DiamondPlusIcon, PlusIcon } from "lucide-react";
3
- import { useRef, useState } from "react";
3
+ import { useId, useRef, useState } from "react";
4
4
  import { Button } from "@/components/editor/inputs/Inputs";
5
5
  import { MinimalHotkeys } from "@/components/shortcuts/renderShortcut";
6
6
  import {
@@ -35,6 +35,8 @@ export const CreateCellButton = ({
35
35
  }) => {
36
36
  const { createCell, addSetupCell } = useCellActions();
37
37
  const shortcut = `${oneClickShortcut}-Click`;
38
+ const menuId = useId();
39
+ const buttonRef = useRef<HTMLButtonElement>(null);
38
40
  const [open, setOpen] = useState(false);
39
41
  // Time the dropdown last opened, to ignore the click that opened it
40
42
  const openedAt = useRef(0);
@@ -132,45 +134,72 @@ export const CreateCellButton = ({
132
134
  };
133
135
 
134
136
  return (
135
- <DropdownMenu open={open} onOpenChange={handleOpenChange}>
136
- <DropdownMenuTrigger asChild={true}>
137
- <Button
138
- className={cn(
139
- "border-none hover-action shadow-none! bg-transparent! focus-visible:outline-hidden",
140
- isAppInteractionDisabled(connectionState) && " inactive-button",
141
- )}
142
- onPointerDownCapture={handlePointerDownCapture}
143
- onContextMenuCapture={handleContextMenu}
144
- size="small"
145
- data-testid="create-cell-button"
146
- >
147
- <Tooltip content={finalTooltipContent}>
148
- <PlusIcon
149
- strokeWidth={1.8}
150
- size={14}
151
- className="opacity-60 hover:opacity-90"
137
+ <div className="relative inline-flex">
138
+ <Button
139
+ ref={buttonRef}
140
+ aria-haspopup="menu"
141
+ aria-controls={open ? menuId : undefined}
142
+ aria-expanded={open}
143
+ onKeyDown={(event) => {
144
+ if (["Enter", " ", "ArrowDown"].includes(event.key)) {
145
+ event.preventDefault();
146
+ openDropdown();
147
+ }
148
+ }}
149
+ className={cn(
150
+ "border-none hover-action shadow-none! bg-transparent! focus-visible:outline-hidden",
151
+ isAppInteractionDisabled(connectionState) && " inactive-button",
152
+ )}
153
+ onPointerDownCapture={handlePointerDownCapture}
154
+ onContextMenuCapture={handleContextMenu}
155
+ size="small"
156
+ data-testid="create-cell-button"
157
+ >
158
+ <Tooltip content={finalTooltipContent}>
159
+ <PlusIcon
160
+ strokeWidth={1.8}
161
+ size={14}
162
+ className="opacity-60 hover:opacity-90"
163
+ />
164
+ </Tooltip>
165
+ </Button>
166
+ {open && (
167
+ <DropdownMenu open={open} onOpenChange={handleOpenChange}>
168
+ {/* Keep the real button mounted while the menu and its anchor come and go. */}
169
+ <DropdownMenuTrigger asChild={true}>
170
+ <span
171
+ aria-hidden={true}
172
+ className="absolute inset-0 pointer-events-none"
152
173
  />
153
- </Tooltip>
154
- </Button>
155
- </DropdownMenuTrigger>
156
- <DropdownMenuContent side="bottom" sideOffset={-30}>
157
- <DropdownMenuItem onClick={handleFirstItemClick}>
158
- {renderIcon(<PythonIcon />)}
159
- Python cell
160
- </DropdownMenuItem>
161
- <DropdownMenuItem onClick={addMarkdownCell}>
162
- {renderIcon(<MarkdownIcon />)}
163
- Markdown cell
164
- </DropdownMenuItem>
165
- <DropdownMenuItem onClick={addSQLCell}>
166
- {renderIcon(<DatabaseIcon size={13} strokeWidth={1.5} />)}
167
- SQL cell
168
- </DropdownMenuItem>
169
- <DropdownMenuItem onClick={() => addSetupCell()}>
170
- {renderIcon(<DiamondPlusIcon size={13} strokeWidth={1.5} />)}
171
- Setup cell
172
- </DropdownMenuItem>
173
- </DropdownMenuContent>
174
- </DropdownMenu>
174
+ </DropdownMenuTrigger>
175
+ <DropdownMenuContent
176
+ id={menuId}
177
+ side="bottom"
178
+ sideOffset={-30}
179
+ onCloseAutoFocus={(event) => {
180
+ event.preventDefault();
181
+ buttonRef.current?.focus();
182
+ }}
183
+ >
184
+ <DropdownMenuItem onClick={handleFirstItemClick}>
185
+ {renderIcon(<PythonIcon />)}
186
+ Python cell
187
+ </DropdownMenuItem>
188
+ <DropdownMenuItem onClick={addMarkdownCell}>
189
+ {renderIcon(<MarkdownIcon />)}
190
+ Markdown cell
191
+ </DropdownMenuItem>
192
+ <DropdownMenuItem onClick={addSQLCell}>
193
+ {renderIcon(<DatabaseIcon size={13} strokeWidth={1.5} />)}
194
+ SQL cell
195
+ </DropdownMenuItem>
196
+ <DropdownMenuItem onClick={() => addSetupCell()}>
197
+ {renderIcon(<DiamondPlusIcon size={13} strokeWidth={1.5} />)}
198
+ Setup cell
199
+ </DropdownMenuItem>
200
+ </DropdownMenuContent>
201
+ </DropdownMenu>
202
+ )}
203
+ </div>
175
204
  );
176
205
  };
@@ -0,0 +1,49 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+ import { fireEvent, render, screen, waitFor } from "@testing-library/react";
3
+ import { expect, it, vi } from "vitest";
4
+ import { TooltipProvider } from "@/components/ui/tooltip";
5
+ import { ConnectionState } from "@/core/session/types";
6
+ import { CreateCellButton } from "../CreateCellButton";
7
+
8
+ vi.mock("@/core/cells/actions", () => ({
9
+ useCellActions: () => ({ createCell: vi.fn(), addSetupCell: vi.fn() }),
10
+ }));
11
+
12
+ it("mounts menus only on demand and restores keyboard focus to the same button", async () => {
13
+ const onClick = vi.fn();
14
+ const add = vi.spyOn(document, "addEventListener");
15
+ render(
16
+ <TooltipProvider>
17
+ {Array.from({ length: 20 }, (_, i) => (
18
+ <CreateCellButton
19
+ key={i}
20
+ connectionState={ConnectionState.OPEN}
21
+ onClick={onClick}
22
+ tooltipContent="Add cell"
23
+ oneClickShortcut="shift"
24
+ />
25
+ ))}
26
+ </TooltipProvider>,
27
+ );
28
+ expect(add.mock.calls.filter(([name]) => name === "keydown")).toHaveLength(0);
29
+ add.mockClear();
30
+ fireEvent.keyDown(document.body, { key: "a" });
31
+ expect(add).not.toHaveBeenCalled();
32
+ const button = screen.getAllByTestId("create-cell-button")[0];
33
+ fireEvent.pointerDown(button, { button: 0 });
34
+ expect(onClick).toHaveBeenCalledWith({ code: "" });
35
+ button.focus();
36
+ fireEvent.keyDown(button, { key: "ArrowDown" });
37
+ expect(
38
+ await screen.findByRole("menuitem", { name: "SQL cell" }),
39
+ ).toBeTruthy();
40
+ expect(screen.getAllByTestId("create-cell-button")[0]).toBe(button);
41
+ fireEvent.keyDown(screen.getByRole("menu"), { key: "Escape" });
42
+ await waitFor(() => expect(screen.queryByRole("menu")).toBeNull());
43
+ await waitFor(() => expect(document.activeElement).toBe(button));
44
+ fireEvent.contextMenu(button);
45
+ expect(
46
+ await screen.findByRole("menuitem", { name: /Markdown cell/ }),
47
+ ).toBeTruthy();
48
+ add.mockRestore();
49
+ });
@@ -0,0 +1,126 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+ import { EditorView } from "@codemirror/view";
3
+ import { goToDefinitionWithLspFallback } from "@/core/codemirror/go-to-definition/utils";
4
+ import { fireEvent, render, screen, waitFor } from "@testing-library/react";
5
+ import { expect, it, vi } from "vitest";
6
+ import { cellId } from "@/__tests__/branded";
7
+ import { TooltipProvider } from "@/components/ui/tooltip";
8
+ import {
9
+ CellActionsContextMenu,
10
+ NotebookContextMenu,
11
+ } from "../cell-context-menu";
12
+
13
+ vi.mock("@/core/codemirror/go-to-definition/utils", () => ({
14
+ goToDefinitionWithLspFallback: vi.fn(),
15
+ }));
16
+
17
+ vi.mock("@/core/cells/cells", () => ({
18
+ useCellData: () => ({ name: "cell", config: {} }),
19
+ useCellRuntime: () => ({ consoleOutputs: [] }),
20
+ }));
21
+ vi.mock("@/core/executions", () => ({
22
+ useCellExecution: () => ({ status: "idle", blocked: false }),
23
+ useCellOutput: () => null,
24
+ }));
25
+ vi.mock("../../actions/useCellActionButton", () => ({
26
+ useCellActionButtons: () => [],
27
+ }));
28
+
29
+ it("shares one closed menu and resolves plot actions for the cell that opens it", async () => {
30
+ const add = vi.spyOn(document, "addEventListener");
31
+ const { unmount } = render(
32
+ <TooltipProvider>
33
+ <NotebookContextMenu>
34
+ <div data-testid="background" />
35
+ {Array.from({ length: 20 }, (_, i) => (
36
+ <CellActionsContextMenu
37
+ key={i}
38
+ cellId={cellId(`cell${i}`)}
39
+ getEditorView={() => null}
40
+ disabled={i === 19}
41
+ >
42
+ <div data-testid={`cell${i}`}>
43
+ <img alt={`plot${i}`} />
44
+ <button
45
+ type="button"
46
+ data-testid={`nested${i}`}
47
+ onContextMenu={(event) => event.stopPropagation()}
48
+ >
49
+ Nested menu
50
+ </button>
51
+ </div>
52
+ </CellActionsContextMenu>
53
+ ))}
54
+ </NotebookContextMenu>
55
+ </TooltipProvider>,
56
+ );
57
+ expect(
58
+ add.mock.calls.filter(
59
+ ([name, , capture]) =>
60
+ name === "keydown" &&
61
+ (capture === true || (typeof capture === "object" && capture.capture)),
62
+ ),
63
+ ).toHaveLength(1);
64
+ expect(fireEvent.contextMenu(screen.getByTestId("background"))).toBe(true);
65
+ expect(fireEvent.contextMenu(screen.getByTestId("cell19"))).toBe(true);
66
+ expect(screen.queryByRole("menu")).toBeNull();
67
+ fireEvent.contextMenu(screen.getByTestId("nested0"));
68
+ expect(screen.queryByRole("menu")).toBeNull();
69
+ fireEvent.contextMenu(screen.getByAltText("plot0"));
70
+ expect(
71
+ await screen.findByRole("menuitem", { name: "Copy image" }),
72
+ ).toBeTruthy();
73
+ fireEvent.keyDown(screen.getByRole("menu"), { key: "Escape" });
74
+ await waitFor(() => expect(screen.queryByRole("menu")).toBeNull());
75
+ fireEvent.contextMenu(screen.getByTestId("cell1"));
76
+ expect(await screen.findByRole("menuitem", { name: "Copy" })).toBeTruthy();
77
+ expect(screen.queryByRole("menuitem", { name: "Copy image" })).toBeNull();
78
+ fireEvent.keyDown(screen.getByRole("menu"), { key: "Escape" });
79
+ await waitFor(() => expect(screen.queryByRole("menu")).toBeNull());
80
+ const touch = new Event("pointerdown", { bubbles: true });
81
+ Object.assign(touch, { pointerType: "touch", clientX: 10, clientY: 10 });
82
+ fireEvent(screen.getByTestId("cell1"), touch);
83
+ expect(await screen.findByRole("menu")).toBeTruthy();
84
+ unmount();
85
+ add.mockRestore();
86
+ });
87
+
88
+ it.each([false, true])(
89
+ "restores focus unless go-to-definition navigates (navigated: %s)",
90
+ async (navigated) => {
91
+ const editor = new EditorView();
92
+ const { unmount } = render(
93
+ <TooltipProvider>
94
+ <NotebookContextMenu>
95
+ <CellActionsContextMenu
96
+ cellId={cellId("cell")}
97
+ getEditorView={() => editor}
98
+ >
99
+ <button type="button">Source cell</button>
100
+ </CellActionsContextMenu>
101
+ <button type="button">Destination cell</button>
102
+ </NotebookContextMenu>
103
+ </TooltipProvider>,
104
+ );
105
+ const source = screen.getByText("Source cell");
106
+ const destination = screen.getByText("Destination cell");
107
+ vi.mocked(goToDefinitionWithLspFallback).mockImplementation(() => {
108
+ if (navigated) {
109
+ destination.focus();
110
+ }
111
+ return navigated;
112
+ });
113
+ source.focus();
114
+ fireEvent.contextMenu(source);
115
+ fireEvent.click(
116
+ await screen.findByRole("menuitem", { name: "Go to Definition" }),
117
+ );
118
+ await waitFor(() => expect(screen.queryByRole("menu")).toBeNull());
119
+ await waitFor(() =>
120
+ expect(document.activeElement).toBe(navigated ? destination : source),
121
+ );
122
+ expect(goToDefinitionWithLspFallback).toHaveBeenLastCalledWith(editor);
123
+ unmount();
124
+ editor.destroy();
125
+ },
126
+ );