@marimo-team/frontend 0.24.1-dev87 → 0.24.1-dev90
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.
- package/dist/assets/{CellStatus-D40JXMpi.js → CellStatus-BAfpiaJr.js} +1 -1
- package/dist/assets/{JsonOutput-DeeAtdky.js → JsonOutput-Bu92ihyf.js} +1 -1
- package/dist/assets/{MarimoErrorOutput-Dh-877oV.js → MarimoErrorOutput-B6VFcCOD.js} +1 -1
- package/dist/assets/{RenderHTML-C7JgAfHC.js → RenderHTML-Cqn8OKqJ.js} +1 -1
- package/dist/assets/{RunButton-C9d_w3qn.js → RunButton-CjlJVYRU.js} +1 -1
- package/dist/assets/{add-cell-with-ai-zrX9HOPy.js → add-cell-with-ai-CoNAy8Wk.js} +1 -1
- package/dist/assets/{add-connection-dialog-OQxtKyCV.js → add-connection-dialog-D28GcLwH.js} +1 -1
- package/dist/assets/{agent-panel-DF7_IEEH.js → agent-panel-BsUX99c5.js} +1 -1
- package/dist/assets/{ai-model-dropdown-DIItpu01.js → ai-model-dropdown-jajg9hms.js} +1 -1
- package/dist/assets/{app-config-button-CeDIYZUc.js → app-config-button-CHcCBh-B.js} +1 -1
- package/dist/assets/{blob-iewSQmkZ.js → blob-kift6pGB.js} +1 -1
- package/dist/assets/{cell-editor-BkHTcrF-.js → cell-editor-ByVa98Tu.js} +1 -1
- package/dist/assets/{cell-link-ZLZTXwR8.js → cell-link-CnfnwA6v.js} +1 -1
- package/dist/assets/{cells-DyE9dSiM.js → cells-BEcungGa.js} +1 -1
- package/dist/assets/{chat-display-B9XOYJaA.js → chat-display-CL_JFB9v.js} +1 -1
- package/dist/assets/{chat-panel-Drx8ToF5.js → chat-panel-CSzekzAv.js} +1 -1
- package/dist/assets/{chat-ui-CJ1VFz1m.js → chat-ui-C1eAy9FG.js} +1 -1
- package/dist/assets/{column-preview-Ls8UnJOt.js → column-preview-BZX77DV6.js} +1 -1
- package/dist/assets/{command-palette-DWyHSatV.js → command-palette-56SvxMFF.js} +1 -1
- package/dist/assets/{common-03vbDqrN.js → common-fL5LEOMt.js} +1 -1
- package/dist/assets/{components-J_vBLfsO.js → components-BtTyGydI.js} +1 -1
- package/dist/assets/{datasource-B4VfwXg_.js → datasource-uyI476er.js} +1 -1
- package/dist/assets/{dependency-graph-panel-B24NhlCS.js → dependency-graph-panel-DQ6IwmNu.js} +1 -1
- package/dist/assets/{documentation-panel-C4y_ufGj.js → documentation-panel-ChxeMQDj.js} +1 -1
- package/dist/assets/{download-Kg8_rqQH.js → download-Dv0iO8M_.js} +1 -1
- package/dist/assets/{edit-page-DL_yo5rn.js → edit-page-B1Vy-UvZ.js} +4 -4
- package/dist/assets/{error-entries-Cy1y8FaI.js → error-entries-B5GaQ2cq.js} +1 -1
- package/dist/assets/{error-panel-D_pwhWfh.js → error-panel-D_YO8QtX.js} +1 -1
- package/dist/assets/{file-explorer-panel-QoJu0RbE.js → file-explorer-panel-1JRkBA_A.js} +1 -1
- package/dist/assets/{file-icons-BN7fZ7-c.js → file-icons-D18ZIT8U.js} +1 -1
- package/dist/assets/{file-name-input-qU-dl8Og.js → file-name-input-Dp8aYmEH.js} +1 -1
- package/dist/assets/{floating-outline-Coq72JrA.js → floating-outline-B14J6Uv7.js} +1 -1
- package/dist/assets/{home-page-C6NwS9L9.js → home-page-CoMZwM0i.js} +1 -1
- package/dist/assets/{index-DMvKFHTV.js → index-B6Nvcqin.js} +6 -6
- package/dist/assets/layout-FSOVn_sw.js +9 -0
- package/dist/assets/{logs-panel-zYelRd3A.js → logs-panel-BwA2j1LD.js} +1 -1
- package/dist/assets/{markdown-renderer-BqMslrdb.js → markdown-renderer-IN72oVfj.js} +1 -1
- package/dist/assets/{name-cell-input-jrtswt5e.js → name-cell-input-BOFMaTa1.js} +1 -1
- package/dist/assets/{outline-panel-B0P8XNnQ.js → outline-panel-xZQU-sfs.js} +1 -1
- package/dist/assets/{packages-panel-C08E4Wjm.js → packages-panel-gfl3Dnuj.js} +1 -1
- package/dist/assets/{pair-with-agent-modal-BZBengJw.js → pair-with-agent-modal-CNxmIMFM.js} +2 -2
- package/dist/assets/{panel-accordion-state-Cyy4afrx.js → panel-accordion-state-BBB6Kqr-.js} +1 -1
- package/dist/assets/{panels-DRtPsJ1u.js → panels-mouc5Y1Z.js} +1 -1
- package/dist/assets/{process-output-BiA5MKpM.js → process-output-C-rOBNl7.js} +1 -1
- package/dist/assets/{readonly-code-display-B45Jy4vH.js → readonly-code-display-fUSnJEhE.js} +1 -1
- package/dist/assets/{readonly-python-code-BQ5Ti6Hw.js → readonly-python-code-C2BktOKY.js} +1 -1
- package/dist/assets/{reveal-component-Bna3jncc.js → reveal-component-CsovRN4m.js} +1 -1
- package/dist/assets/run-page-CRcnkzFj.js +1 -0
- package/dist/assets/{scratchpad-panel-m2LRBFI5.js → scratchpad-panel-BkqXEAfy.js} +1 -1
- package/dist/assets/{session-panel-BV8Whoy8.js → session-panel-CnIUsX9O.js} +1 -1
- package/dist/assets/shell-DLpUCctE.js +1 -0
- package/dist/assets/{skeleton-CWFWp9eU.js → skeleton-7uu6KXmn.js} +1 -1
- package/dist/assets/{snippets-panel-DBzdOGwQ.js → snippets-panel-BoziU8SV.js} +1 -1
- package/dist/assets/{state-rP7TRCla.js → state-DNIOp9vd.js} +1 -1
- package/dist/assets/{state-DPS9Q717.js → state-DaMe_1Uy.js} +1 -1
- package/dist/assets/{tracing-BP1J14GT.js → tracing-COpxb-Up.js} +1 -1
- package/dist/assets/{tracing-panel-CQasWudc.js → tracing-panel-DnNQLsh8.js} +2 -2
- package/dist/assets/{tree-actions-CrB9REp3.js → tree-actions-CjTwlxy1.js} +1 -1
- package/dist/assets/{useAddCell-DHYPnl7W.js → useAddCell-ZP7MPBcM.js} +1 -1
- package/dist/assets/{useCellActionButton-C7bEu9tJ.js → useCellActionButton-va5-Bjgq.js} +1 -1
- package/dist/assets/{useDeleteCell-CIzxZKUw.js → useDeleteCell-CuEKdiht.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-CLmRGbOD.js → useDependencyPanelTab-DDQx4yD6.js} +1 -1
- package/dist/assets/{useNotebookActions-Q97EgZxR.js → useNotebookActions-DEBmnVAR.js} +1 -1
- package/dist/assets/{useRunCells-Csh5VYKu.js → useRunCells-DccIcaY0.js} +1 -1
- package/dist/assets/{useSplitCell-BfT7UcKM.js → useSplitCell-CoAAhbPs.js} +1 -1
- package/dist/index.html +19 -19
- package/package.json +1 -1
- package/src/components/editor/output/__tests__/ansi-reduce.test.ts +36 -10
- package/src/components/editor/output/ansi-reduce.ts +2 -7
- package/src/components/editor/renderers/vertical-layout/__tests__/vertical-layout.test.ts +64 -2
- package/src/components/editor/renderers/vertical-layout/utils.ts +73 -0
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +19 -49
- package/src/components/static-html/__tests__/static-banner.test.tsx +112 -0
- package/src/components/static-html/static-banner.tsx +121 -68
- package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +35 -2
- package/dist/assets/layout-ByAlvlct.js +0 -9
- package/dist/assets/run-page-CFC5C_It.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,r as i,u as a}from"./useEvent-xfs0Sn4r.js";import{t as o}from"./react-CBDbhulC.js";import{$i as s,$r as c,Co as l,D as u,E as d,Hi as f,Jr as p,Kn as m,La as h,Po as g,Qi as _,Qr as v,Rt as y,Tt as b,Vi as x,_ as S,aa as C,b as ee,di as w,dn as T,ea as E,ei as te,h as ne,la as re,mo as D,ni as O,or as k,ra as A,ri as j,t as ie,un as M,yo as N}from"./cells-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,r as i,u as a}from"./useEvent-xfs0Sn4r.js";import{t as o}from"./react-CBDbhulC.js";import{$i as s,$r as c,Co as l,D as u,E as d,Hi as f,Jr as p,Kn as m,La as h,Po as g,Qi as _,Qr as v,Rt as y,Tt as b,Vi as x,_ as S,aa as C,b as ee,di as w,dn as T,ea as E,ei as te,h as ne,la as re,mo as D,ni as O,or as k,ra as A,ri as j,t as ie,un as M,yo as N}from"./cells-BEcungGa.js";import{Cn as P,kt as F,vt as I}from"./schemas-aTUejmFi.js";import{t as L}from"./compiler-runtime-CYIjoINj.js";import{r as ae,w as R}from"./utils-CWSZQEjr.js";import{C as z,n as B,r as V}from"./ai-model-dropdown-jajg9hms.js";import{g as H,n as U}from"./useEventListener-D27Dii_l.js";import{t as oe}from"./objects-snlMn4yk.js";import{n as W,t as G}from"./constants-BDbGiS7O.js";import{A as K,M as se,N as q,O as ce,T as le,j as ue,k as de,v as fe}from"./config-D4frVGQ4.js";import{t as pe}from"./switch-CtH5Ct94.js";import{g as me,h as he,m as ge,y as _e}from"./readonly-python-code-C2BktOKY.js";import{t as ve}from"./cn-ldLVeaqm.js";import{t as ye}from"./jsx-runtime-B74pBk57.js";import{o as be}from"./alert-dialog-BVi_GyOB.js";import{i as xe,n as Se,r as Ce,t as we}from"./tabs-c6mpccpH.js";import{a as Te,c as Ee,i as De,n as Oe,r as ke,s as Ae,t as je}from"./select-czJLm6jf.js";import{Pt as Me,X as Ne}from"./JsonOutput-Bu92ihyf.js";import{a as Pe,c as J,o as Fe,p as Ie,t as Le}from"./download-Dv0iO8M_.js";import{t as Re}from"./tooltip-D7dq6bnc.js";import{n as ze,r as Be,t as Ve}from"./button-Btj6GXNy.js";import{i as He,r as Ue,t as We}from"./strings-CpYReX2Q.js";import{r as Ge}from"./requests-C6_IaFh7.js";import{t as Y}from"./createLucideIcon-B7HeEoG2.js";import{L as Ke,R as qe,c as Je,l as Ye,t as Xe,z as Ze}from"./layout-FSOVn_sw.js";import{t as Qe}from"./check-BoA6XBpj.js";import{r as $e}from"./useCellActionButton-va5-Bjgq.js";import{t as et}from"./code-CF0HKE9K.js";import{t as tt}from"./copy-BMXKNElG.js";import{t as nt}from"./eye-off-CFuPxa9F.js";import{t as rt}from"./external-link-Bp3BxyRA.js";import{t as it}from"./file-DF8n85RA.js";import{t as at}from"./globe-BQf75qV_.js";import{n as ot,r as st,t as ct}from"./youtube-DCJ-ihUU.js";import{n as lt}from"./components-CBlGIIAX.js";import{i as ut,n as dt,r as ft}from"./markdown-export-0rLbaq8b.js";import{t as pt}from"./image-ab13yGv4.js";import{D as mt,E as ht,O as gt,T as _t,b as vt,j as yt}from"./write-secret-modal-lNU_7c2x.js";import{t as bt}from"./link-Cap-MZiw.js";import{t as xt}from"./spinner-Ck-Hgfvj.js";import{r as St}from"./input-Daz6sk8l.js";import{t as Ct}from"./settings-C-cYas75.js";import{t as wt}from"./square-B58Ib8Ir.js";import{t as Tt}from"./triangle-alert-MihykDYG.js";import{t as Et}from"./use-toast-DpWHUGuF.js";import{n as Dt,t as Ot}from"./paths-zcL04qUW.js";import{o as kt}from"./session-CEdta5_Q.js";import{n as At}from"./useAsyncData-Buhk-UgR.js";import{n as jt}from"./copy-Cg05mM3C.js";import{t as Mt}from"./copy-icon-CRxVZTJ9.js";import{r as Nt}from"./useRunCells-DccIcaY0.js";import{r as Pt,t as Ft}from"./share-C2MPy_VX.js";import{n as It,t as Lt}from"./alert-dmKwNsrp.js";import{a as Rt}from"./cell-link-CnfnwA6v.js";import{t as zt}from"./icons-CjLa9BiH.js";import{i as Bt,n as Vt}from"./error-entries-B5GaQ2cq.js";import{t as Ht}from"./shell-DLpUCctE.js";import{t as Ut}from"./pair-with-agent-modal-CNxmIMFM.js";import{n as Wt}from"./add-connection-dialog-D28GcLwH.js";import{t as Gt}from"./github-YRgb6LMu.js";import{n as Kt}from"./marimo-icons-C3KxMV9A.js";import{t as qt}from"./links-DPh7yoP-.js";import{i as Jt,n as Yt,t as Xt}from"./skeleton-7uu6KXmn.js";var Zt=Y(`circle-chevron-down`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 10-4 4-4-4`,key:`894hmk`}]]),Qt=Y(`circle-chevron-right`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m10 8 4 4-4 4`,key:`1wy4r4`}]]),$t=Y(`clipboard-copy`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`,key:`4jdomd`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`,key:`3hqy98`}],[`path`,{d:`M21 14H11`,key:`1bme5i`}],[`path`,{d:`m15 10-4 4 4 4`,key:`5dvupr`}]]),en=Y(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),tn=Y(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),nn=Y(`diamond-plus`,[[`path`,{d:`M12 8v8`,key:`napkw2`}],[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z`,key:`1ey20j`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),rn=Y(`fast-forward`,[[`path`,{d:`M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z`,key:`b19h5q`}],[`path`,{d:`M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z`,key:`h7h5ge`}]]),an=Y(`files`,[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`14sh0y`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`,key:`1970lx`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]),on=Y(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),sn=Y(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),cn=Y(`notebook`,[[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`path`,{d:`M16 2v20`,key:`rotuqe`}]]),ln=Y(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),un=Y(`presentation`,[[`path`,{d:`M2 3h20`,key:`91anmk`}],[`path`,{d:`M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3`,key:`2k9sn8`}],[`path`,{d:`m7 21 5-5 5 5`,key:`bip4we`}]]),dn=Y(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),fn=Y(`square-power`,[[`path`,{d:`M12 7v4`,key:`xawao1`}],[`path`,{d:`M7.998 9.003a5 5 0 1 0 8-.005`,key:`1pek45`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),pn=Y(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),X=ye(),Z=L(),Q=e(o(),1);function mn(e,t){let n=(0,Z.c)(11),r;n[0]===t?r=n[1]:(r=new D(t),n[0]=t,n[1]=r);let i=r,a;n[2]!==e||n[3]!==i?(a=()=>i.get(e),n[2]=e,n[3]=i,n[4]=a):a=n[4];let[o,s]=(0,Q.useState)(a),c;n[5]!==e||n[6]!==i?(c=t=>{s(t),i.set(e,t)},n[5]=e,n[6]=i,n[7]=c):c=n[7];let l=c,u;return n[8]!==l||n[9]!==o?(u=[o,l],n[8]=l,n[9]=o,n[10]=u):u=n[10],u}function hn(e,t){return{...e,Binaries:{...e.Binaries,Browser:t}}}function gn(e,t,n,r){return{marimo:e,Locale:n||void 0,Binaries:{Browser:t},"Environment Collection Error":r}}function _n(e,t){let n=Math.max(2,...Array.from(t.matchAll(/`+/g),e=>e[0].length)),r="`".repeat(n+1);return`${r}${e}\n${t}\n${r}`}function vn(e,t){let n=e.includes(`?`)?`&`:`?`,r=[],i=e,a=0;for(let[e,o]of Object.entries(t)){if(o.length===0)continue;let t=`${e}=${encodeURIComponent(o)}`,s=`${i}${a===0?n:`&`}${t}`;if(s.length>6e3){r.push(e);continue}i=s,a+=1}return{url:i,omitted:r}}function yn(e,t){return[`<details>`,`<summary>${We.htmlEscape(e)??``}</summary>`,``,t,``,`</details>`].join(`
|
|
2
2
|
`)}function bn(e){return yn(`Environment`,_n(`json`,JSON.stringify(e,null,2)))}function xn(e){return yn(`Errors`,_n(`text`,e.map(Vt).join(`
|
|
3
3
|
|
|
4
4
|
---
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,t,u as n}from"./useEvent-xfs0Sn4r.js";import{D as r,Ga as i,Ra as a,_t as o,h as s,li as c}from"./cells-
|
|
1
|
+
import{f as e,t,u as n}from"./useEvent-xfs0Sn4r.js";import{D as r,Ga as i,Ra as a,_t as o,h as s,li as c}from"./cells-BEcungGa.js";import{t as l}from"./compiler-runtime-CYIjoINj.js";import{g as u}from"./useEventListener-D27Dii_l.js";import{o as d}from"./dist-Dz_04liz.js";import{r as f}from"./requests-C6_IaFh7.js";var p=l(),m=e(!1);function h(){let e=(0,p.c)(2),n=v(),r;return e[0]===n?r=e[1]:(r=()=>n(i(s())),e[0]=n,e[1]=r),t(r)}function g(e){let n=(0,p.c)(3),r=v(),i;return n[0]!==e||n[1]!==r?(i=()=>{e!==void 0&&r([e])},n[0]=e,n[1]=r,n[2]=i):i=n[2],t(i)}function _(){let e=(0,p.c)(2),n=v(),r;return e[0]===n?r=e[1]:(r=()=>n(a(s())),e[0]=n,e[1]=r),t(r)}function v(){let e=(0,p.c)(4),{prepareForRun:i}=r(),{sendRun:a}=f(),o=n(m),c;return e[0]!==i||e[1]!==a||e[2]!==o?(c=async e=>{if(e.length===0)return;let t=s();return o(!0),y({cellIds:e,sendRun:a,prepareForRun:i,notebook:t})},e[0]=i,e[1]=a,e[2]=o,e[3]=c):c=e[3],t(c)}async function y({cellIds:e,sendRun:t,prepareForRun:n,notebook:r}){if(e.length===0)return;let{cellHandles:i,cellData:a}=r,s=[];for(let t of e){let e=i[t]?.current?.editorView,r;e?(c(e)!==`markdown`&&d(e),r=o(e)):r=a[t]?.code||``,s.push(r),n({cellId:t})}await t({cellIds:e,codes:s}).catch(e=>{u.error(e)})}export{v as a,g as i,y as n,h as o,_ as r,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./useEvent-xfs0Sn4r.js";import{D as t,_t as n,f as r}from"./cells-
|
|
1
|
+
import{t as e}from"./useEvent-xfs0Sn4r.js";import{D as t,_t as n,f as r}from"./cells-BEcungGa.js";import{t as i}from"./compiler-runtime-CYIjoINj.js";import{t as a}from"./jsx-runtime-B74pBk57.js";import{r as o}from"./useDeleteCell-CuEKdiht.js";import{t as s}from"./use-toast-DpWHUGuF.js";var c=i(),l=a();function u(){let i=(0,c.c)(3),{splitCell:a,undoSplitCell:u}=t(),d;return i[0]!==a||i[1]!==u?(d=e=>{let t=r(e.cellId);if(!t)return;let i=n(t);a(e);let{dismiss:c}=s({title:`Cell split`,action:(0,l.jsx)(o,{"data-testid":`undo-split-button`,size:`sm`,variant:`outline`,onClick:()=>{u({...e,snapshot:i}),d()},children:`Undo`})}),d=c},i[0]=a,i[1]=u,i[2]=d):d=i[2],e(d)}export{u as t};
|
package/dist/index.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
|
67
67
|
<!-- /TODO -->
|
|
68
68
|
<title>{{ title }}</title>
|
|
69
|
-
<script type="module" crossorigin src="./assets/index-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-B6Nvcqin.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-B0Z9INg1.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/react-CBDbhulC.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-CYIjoINj.js">
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
<link rel="modulepreload" crossorigin href="./assets/useTheme-CF-zG9YH.js">
|
|
139
139
|
<link rel="modulepreload" crossorigin href="./assets/useAsyncData-Buhk-UgR.js">
|
|
140
140
|
<link rel="modulepreload" crossorigin href="./assets/purify.es-DrVcFY1Q.js">
|
|
141
|
-
<link rel="modulepreload" crossorigin href="./assets/cells-
|
|
141
|
+
<link rel="modulepreload" crossorigin href="./assets/cells-BEcungGa.js">
|
|
142
142
|
<link rel="modulepreload" crossorigin href="./assets/get-DjNf4SIX.js">
|
|
143
143
|
<link rel="modulepreload" crossorigin href="./assets/_hasPath-BmRQipI0.js">
|
|
144
144
|
<link rel="modulepreload" crossorigin href="./assets/hasIn-yw4sIeJR.js">
|
|
@@ -151,42 +151,42 @@
|
|
|
151
151
|
<link rel="modulepreload" crossorigin href="./assets/copy-Cg05mM3C.js">
|
|
152
152
|
<link rel="modulepreload" crossorigin href="./assets/extends-CvVTau-c.js">
|
|
153
153
|
<link rel="modulepreload" crossorigin href="./assets/esm-Dw0vvSg2.js">
|
|
154
|
-
<link rel="modulepreload" crossorigin href="./assets/useAddCell-
|
|
155
|
-
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-
|
|
154
|
+
<link rel="modulepreload" crossorigin href="./assets/useAddCell-ZP7MPBcM.js">
|
|
155
|
+
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-C2BktOKY.js">
|
|
156
156
|
<link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-zSwE3dvU.js">
|
|
157
157
|
<link rel="modulepreload" crossorigin href="./assets/micromark-factory-space-D9Dr-k4J.js">
|
|
158
158
|
<link rel="modulepreload" crossorigin href="./assets/chunk-5FQGJX7Z-CRg4xQWg.js">
|
|
159
|
-
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-
|
|
159
|
+
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-IN72oVfj.js">
|
|
160
160
|
<link rel="modulepreload" crossorigin href="./assets/copy-icon-CRxVZTJ9.js">
|
|
161
|
-
<link rel="modulepreload" crossorigin href="./assets/useRunCells-
|
|
162
|
-
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-
|
|
163
|
-
<link rel="modulepreload" crossorigin href="./assets/blob-
|
|
161
|
+
<link rel="modulepreload" crossorigin href="./assets/useRunCells-DccIcaY0.js">
|
|
162
|
+
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-Cqn8OKqJ.js">
|
|
163
|
+
<link rel="modulepreload" crossorigin href="./assets/blob-kift6pGB.js">
|
|
164
164
|
<link rel="modulepreload" crossorigin href="./assets/share-C2MPy_VX.js">
|
|
165
165
|
<link rel="modulepreload" crossorigin href="./assets/events-CbeVJ6OD.js">
|
|
166
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
166
|
+
<link rel="modulepreload" crossorigin href="./assets/state-DaMe_1Uy.js">
|
|
167
167
|
<link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-npvnLp9x.js">
|
|
168
168
|
<link rel="modulepreload" crossorigin href="./assets/config-ycxJQP2b.js">
|
|
169
169
|
<link rel="modulepreload" crossorigin href="./assets/tabs-c6mpccpH.js">
|
|
170
170
|
<link rel="modulepreload" crossorigin href="./assets/chevron-right-CKA5zVsM.js">
|
|
171
171
|
<link rel="modulepreload" crossorigin href="./assets/dropdown-menu-CqNabM1f.js">
|
|
172
172
|
<link rel="modulepreload" crossorigin href="./assets/html-to-image-DMn_7CCA.js">
|
|
173
|
-
<link rel="modulepreload" crossorigin href="./assets/download-
|
|
173
|
+
<link rel="modulepreload" crossorigin href="./assets/download-Dv0iO8M_.js">
|
|
174
174
|
<link rel="modulepreload" crossorigin href="./assets/table-CUK1W5bI.js">
|
|
175
175
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-Bf-rx_aV.js">
|
|
176
|
-
<link rel="modulepreload" crossorigin href="./assets/tree-actions-
|
|
176
|
+
<link rel="modulepreload" crossorigin href="./assets/tree-actions-CjTwlxy1.js">
|
|
177
177
|
<link rel="modulepreload" crossorigin href="./assets/ellipsis-Dfik_tuW.js">
|
|
178
178
|
<link rel="modulepreload" crossorigin href="./assets/external-link-Bp3BxyRA.js">
|
|
179
179
|
<link rel="modulepreload" crossorigin href="./assets/spinner-Ck-Hgfvj.js">
|
|
180
180
|
<link rel="modulepreload" crossorigin href="./assets/message-circle-BQB1AIAg.js">
|
|
181
181
|
<link rel="modulepreload" crossorigin href="./assets/hat-glasses-C8LSY3HT.js">
|
|
182
182
|
<link rel="modulepreload" crossorigin href="./assets/package-DPlscLzt.js">
|
|
183
|
-
<link rel="modulepreload" crossorigin href="./assets/datasource-
|
|
183
|
+
<link rel="modulepreload" crossorigin href="./assets/datasource-uyI476er.js">
|
|
184
184
|
<link rel="modulepreload" crossorigin href="./assets/kbd-Cwh96ZBE.js">
|
|
185
185
|
<link rel="modulepreload" crossorigin href="./assets/alert-dmKwNsrp.js">
|
|
186
186
|
<link rel="modulepreload" crossorigin href="./assets/useInstallPackage-u7d0wo79.js">
|
|
187
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
188
|
-
<link rel="modulepreload" crossorigin href="./assets/cell-link-
|
|
189
|
-
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-
|
|
187
|
+
<link rel="modulepreload" crossorigin href="./assets/state-DNIOp9vd.js">
|
|
188
|
+
<link rel="modulepreload" crossorigin href="./assets/cell-link-CnfnwA6v.js">
|
|
189
|
+
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-B6VFcCOD.js">
|
|
190
190
|
<link rel="modulepreload" crossorigin href="./assets/VisuallyHidden-SChAyKIQ.js">
|
|
191
191
|
<link rel="modulepreload" crossorigin href="./assets/useDateFormatter-BiqAQ-zI.js">
|
|
192
192
|
<link rel="modulepreload" crossorigin href="./assets/en-US-yTIMUO13.js">
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
<link rel="modulepreload" crossorigin href="./assets/formats-DSzGCKeO.js">
|
|
206
206
|
<link rel="modulepreload" crossorigin href="./assets/table-DmqOOjfe.js">
|
|
207
207
|
<link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-BSRAHC4P.js">
|
|
208
|
-
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-
|
|
208
|
+
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-Bu92ihyf.js">
|
|
209
209
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-ChZdjJhj.js">
|
|
210
210
|
<link rel="modulepreload" crossorigin href="./assets/square-function-DkZweMAs.js">
|
|
211
211
|
<link rel="modulepreload" crossorigin href="./assets/spec-CUFquO6R.js">
|
|
@@ -216,12 +216,12 @@
|
|
|
216
216
|
<link rel="modulepreload" crossorigin href="./assets/file-headphone-rFCxFRI8.js">
|
|
217
217
|
<link rel="modulepreload" crossorigin href="./assets/file-DF8n85RA.js">
|
|
218
218
|
<link rel="modulepreload" crossorigin href="./assets/image-ab13yGv4.js">
|
|
219
|
-
<link rel="modulepreload" crossorigin href="./assets/file-icons-
|
|
219
|
+
<link rel="modulepreload" crossorigin href="./assets/file-icons-D18ZIT8U.js">
|
|
220
220
|
<link rel="modulepreload" crossorigin href="./assets/globe-BQf75qV_.js">
|
|
221
221
|
<link rel="modulepreload" crossorigin href="./assets/markdown-export-0rLbaq8b.js">
|
|
222
222
|
<link rel="modulepreload" crossorigin href="./assets/data-grid-types-DgHVN_Zz.js">
|
|
223
223
|
<link rel="modulepreload" crossorigin href="./assets/glide-utils-CR1sWLZU.js">
|
|
224
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
224
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-BZX77DV6.js">
|
|
225
225
|
<link rel="modulepreload" crossorigin href="./assets/square-B58Ib8Ir.js">
|
|
226
226
|
<link rel="modulepreload" crossorigin href="./assets/triangle-alert-MihykDYG.js">
|
|
227
227
|
<link rel="modulepreload" crossorigin href="./assets/prop-types-Djf4O40e.js">
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
<link rel="modulepreload" crossorigin href="./assets/icons-CjLa9BiH.js">
|
|
232
232
|
<link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-CLytDdMl.js">
|
|
233
233
|
<link rel="modulepreload" crossorigin href="./assets/pathUtils-Cryrlpma.js">
|
|
234
|
-
<link rel="modulepreload" crossorigin href="./assets/floating-outline-
|
|
234
|
+
<link rel="modulepreload" crossorigin href="./assets/floating-outline-B14J6Uv7.js">
|
|
235
235
|
<link rel="stylesheet" crossorigin href="./assets/cells-D-c15Ks-.css">
|
|
236
236
|
<link rel="stylesheet" crossorigin href="./assets/markdown-renderer-B7zTpxjS.css">
|
|
237
237
|
<link rel="stylesheet" crossorigin href="./assets/JsonOutput-BQtz7-np.css">
|
package/package.json
CHANGED
|
@@ -101,7 +101,10 @@ describe("TerminalBuffer", () => {
|
|
|
101
101
|
buffer.writeChar("b");
|
|
102
102
|
buffer.handleEscape("\u001B[1A"); // Move up 1
|
|
103
103
|
buffer.writeChar("X");
|
|
104
|
-
expect(buffer.render()).toMatchInlineSnapshot(`
|
|
104
|
+
expect(buffer.render()).toMatchInlineSnapshot(`
|
|
105
|
+
"aX
|
|
106
|
+
b"
|
|
107
|
+
`);
|
|
105
108
|
});
|
|
106
109
|
|
|
107
110
|
test("handleEscape cursor down", () => {
|
|
@@ -328,6 +331,24 @@ describe("AnsiReducer", () => {
|
|
|
328
331
|
expect(result).toMatchInlineSnapshot(`"axy"`);
|
|
329
332
|
});
|
|
330
333
|
|
|
334
|
+
test("cursor up preserves lines below the cursor", () => {
|
|
335
|
+
const reducer = new AnsiReducer();
|
|
336
|
+
reducer.append("outer: 0%");
|
|
337
|
+
reducer.append("\n");
|
|
338
|
+
reducer.append("inner: 0%");
|
|
339
|
+
reducer.append("\u001B[A");
|
|
340
|
+
|
|
341
|
+
expect(reducer.render()).toBe("outer: 0%\ninner: 0%");
|
|
342
|
+
|
|
343
|
+
// tqdm writes nested progress updates as separate, flushed chunks. The
|
|
344
|
+
// newline moves back to the preserved inner line before it is rewritten.
|
|
345
|
+
reducer.append("\n");
|
|
346
|
+
reducer.append("\rinner: 1%");
|
|
347
|
+
reducer.append("\u001B[A");
|
|
348
|
+
|
|
349
|
+
expect(reducer.render()).toBe("outer: 0%\ninner: 1%");
|
|
350
|
+
});
|
|
351
|
+
|
|
331
352
|
test("reduce ignores control characters below space", () => {
|
|
332
353
|
const reducer = new AnsiReducer();
|
|
333
354
|
const result = reducer.reduce("hello\u0000\u0001\u0007world");
|
|
@@ -361,7 +382,11 @@ describe("ansiReduce", () => {
|
|
|
361
382
|
|
|
362
383
|
test("multi-line with cursor movement", () => {
|
|
363
384
|
const result = ansiReduce("Line 1\nLine 2\nLine 3\u001B[2AModified");
|
|
364
|
-
expect(result).toMatchInlineSnapshot(`
|
|
385
|
+
expect(result).toMatchInlineSnapshot(`
|
|
386
|
+
"Line 1Modified
|
|
387
|
+
Line 2
|
|
388
|
+
Line 3"
|
|
389
|
+
`);
|
|
365
390
|
});
|
|
366
391
|
|
|
367
392
|
test("erase and rewrite", () => {
|
|
@@ -434,7 +459,8 @@ describe("ansiReduce", () => {
|
|
|
434
459
|
Running chain 0: 100%|█████████████████████████████| 101000/101000 [00:07<00:00, 12749.04it/s]
|
|
435
460
|
Running chain 1: 100%|█████████████████████████████| 101000/101000 [00:08<00:00, 12442.67it/s]
|
|
436
461
|
Running chain 2: 100%|█████████████████████████████| 101000/101000 [00:08<00:00, 12373.90it/s]
|
|
437
|
-
|
|
462
|
+
Running chain 2: 95%|████████████████████████████▌ | 95950/101000 [00:07<00:00, 12922.54it/s]
|
|
463
|
+
Running chain 2: 100%|█████████████████████████████| 101000/101000 [00:08<00:00, 14869.01it/s]"
|
|
438
464
|
`);
|
|
439
465
|
});
|
|
440
466
|
});
|
|
@@ -475,7 +501,8 @@ describe("AnsiReducer streaming with append()", () => {
|
|
|
475
501
|
reducer.append("XYZ");
|
|
476
502
|
expect(reducer.render()).toMatchInlineSnapshot(`
|
|
477
503
|
"abc
|
|
478
|
-
XYZ
|
|
504
|
+
XYZ
|
|
505
|
+
"
|
|
479
506
|
`);
|
|
480
507
|
});
|
|
481
508
|
|
|
@@ -552,14 +579,12 @@ describe("AnsiReducer color preservation", () => {
|
|
|
552
579
|
test("preserves color codes with cursor movements", () => {
|
|
553
580
|
const reducer = new AnsiReducer();
|
|
554
581
|
// Test that color codes work alongside cursor movements
|
|
555
|
-
// Note: when cursor moves up, lines below are discarded (tqdm behavior)
|
|
556
582
|
const result = reducer.reduce(
|
|
557
583
|
"Line1\n\u001B[31mRed\u001B[0m\u001B[1A\u001B[32mGreen\u001B[0m",
|
|
558
584
|
);
|
|
559
|
-
//
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
`"Line1 \u001B[32mGreen\u001B[0m"`,
|
|
585
|
+
// Green is written at the end of row 0; row 1 remains intact.
|
|
586
|
+
expect(result).toBe(
|
|
587
|
+
"Line1 \u001B[32mGreen\u001B[0m\n\u001B[31mRed\u001B[0m",
|
|
563
588
|
);
|
|
564
589
|
});
|
|
565
590
|
});
|
|
@@ -623,7 +648,8 @@ describe("StatefulOutputMessage", () => {
|
|
|
623
648
|
|
|
624
649
|
expect(stateful.data).toMatchInlineSnapshot(`
|
|
625
650
|
"Line 1
|
|
626
|
-
Xine 2
|
|
651
|
+
Xine 2
|
|
652
|
+
"
|
|
627
653
|
`);
|
|
628
654
|
});
|
|
629
655
|
});
|
|
@@ -25,16 +25,11 @@ export class TerminalBuffer {
|
|
|
25
25
|
|
|
26
26
|
/** Move cursor by relative offsets. */
|
|
27
27
|
private moveCursor(rowDelta: number, colDelta: number) {
|
|
28
|
-
const oldRow = this.cursor.row;
|
|
29
28
|
this.cursor.row = Math.max(0, this.cursor.row + rowDelta);
|
|
30
29
|
this.cursor.col = Math.max(0, this.cursor.col + colDelta);
|
|
31
30
|
this.ensureLine(this.cursor.row);
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
// This simulates a fixed terminal window where tqdm overwrites content
|
|
35
|
-
if (rowDelta < 0 && this.cursor.row < oldRow) {
|
|
36
|
-
this.lines.splice(this.cursor.row + 1);
|
|
37
|
-
}
|
|
31
|
+
// Cursor movement does not erase content. This matters for multi-line
|
|
32
|
+
// progress renderers, which move up before rewriting a preserved row.
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
/** Move cursor to a specific absolute position. */
|
|
@@ -1,8 +1,70 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
/* oxlint-disable typescript/no-explicit-any */
|
|
3
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
4
4
|
import type { OutputMessage } from "@/core/kernel/messages";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
getInitialShowCode,
|
|
7
|
+
groupCellsByColumn,
|
|
8
|
+
shouldHideCode,
|
|
9
|
+
updateShowCodeQueryParam,
|
|
10
|
+
} from "../utils";
|
|
11
|
+
|
|
12
|
+
const originalHref = window.location.href;
|
|
13
|
+
let originalStaticState: typeof window.__MARIMO_STATIC__;
|
|
14
|
+
|
|
15
|
+
describe("show code", () => {
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
originalStaticState = window.__MARIMO_STATIC__;
|
|
18
|
+
window.history.replaceState(null, "", "/?existing=value#section");
|
|
19
|
+
window.__MARIMO_STATIC__ = {
|
|
20
|
+
files: {},
|
|
21
|
+
modelNotifications: [],
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
afterEach(() => {
|
|
26
|
+
window.history.replaceState(null, "", originalHref);
|
|
27
|
+
window.__MARIMO_STATIC__ = originalStaticState;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("does not add a query parameter when reading the initial value", () => {
|
|
31
|
+
expect(
|
|
32
|
+
getInitialShowCode({
|
|
33
|
+
showCodeInRunModePreference: true,
|
|
34
|
+
kioskMode: false,
|
|
35
|
+
}),
|
|
36
|
+
).toBe(true);
|
|
37
|
+
expect(window.location.search).toBe("?existing=value");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("reflects static notebook toggles in the URL", () => {
|
|
41
|
+
updateShowCodeQueryParam(false);
|
|
42
|
+
expect(window.location.search).toBe("?existing=value&show-code=false");
|
|
43
|
+
expect(window.location.hash).toBe("#section");
|
|
44
|
+
expect(
|
|
45
|
+
getInitialShowCode({
|
|
46
|
+
showCodeInRunModePreference: true,
|
|
47
|
+
kioskMode: false,
|
|
48
|
+
}),
|
|
49
|
+
).toBe(false);
|
|
50
|
+
|
|
51
|
+
updateShowCodeQueryParam(true);
|
|
52
|
+
expect(window.location.search).toBe("?existing=value&show-code=true");
|
|
53
|
+
expect(
|
|
54
|
+
getInitialShowCode({
|
|
55
|
+
showCodeInRunModePreference: true,
|
|
56
|
+
kioskMode: false,
|
|
57
|
+
}),
|
|
58
|
+
).toBe(true);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("does not reflect non-static notebook toggles in the URL", () => {
|
|
62
|
+
delete window.__MARIMO_STATIC__;
|
|
63
|
+
|
|
64
|
+
updateShowCodeQueryParam(false);
|
|
65
|
+
expect(window.location.search).toBe("?existing=value");
|
|
66
|
+
});
|
|
67
|
+
});
|
|
6
68
|
|
|
7
69
|
describe("groupCellsByColumn", () => {
|
|
8
70
|
it("should group cells by column and maintain order", () => {
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { isOutputEmpty } from "@/core/cells/outputs";
|
|
4
|
+
import type { CellData, CellRuntimeState } from "@/core/cells/types";
|
|
5
|
+
import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
|
|
6
|
+
import { KnownQueryParams } from "@/core/constants";
|
|
7
|
+
import type { OutputMessage } from "@/core/kernel/messages";
|
|
8
|
+
import { isStaticNotebook } from "@/core/static/static-state";
|
|
9
|
+
import { isWasm } from "@/core/wasm/utils";
|
|
10
|
+
import { updateQueryParams } from "@/utils/urls";
|
|
11
|
+
|
|
12
|
+
export function getInitialShowCode({
|
|
13
|
+
showCodeInRunModePreference,
|
|
14
|
+
kioskMode,
|
|
15
|
+
}: {
|
|
16
|
+
showCodeInRunModePreference: boolean;
|
|
17
|
+
kioskMode: boolean;
|
|
18
|
+
}): boolean {
|
|
19
|
+
// The mount option takes precedence over other defaults.
|
|
20
|
+
if (!showCodeInRunModePreference) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const showCodeByQueryParam = new URLSearchParams(window.location.search).get(
|
|
25
|
+
KnownQueryParams.showCode,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
// Static notebooks, WASM notebooks, and kiosk mode show code by default.
|
|
29
|
+
return showCodeByQueryParam === null
|
|
30
|
+
? isStaticNotebook() || isWasm() || kioskMode
|
|
31
|
+
: showCodeByQueryParam === "true";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function updateShowCodeQueryParam(showCode: boolean): void {
|
|
35
|
+
// Persist explicit user choices in shareable static notebook URLs. Avoid
|
|
36
|
+
// adding the parameter on startup so unchanged URLs retain their defaults.
|
|
37
|
+
if (isStaticNotebook()) {
|
|
38
|
+
updateQueryParams((params) => {
|
|
39
|
+
params.set(KnownQueryParams.showCode, String(showCode));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function groupCellsByColumn(
|
|
45
|
+
cells: (CellRuntimeState & CellData)[],
|
|
46
|
+
): [number, (CellRuntimeState & CellData)[]][] {
|
|
47
|
+
// Group cells by column
|
|
48
|
+
const cellsByColumn = new Map<number, (CellRuntimeState & CellData)[]>();
|
|
49
|
+
let lastSeenColumn = 0;
|
|
50
|
+
cells.forEach((cell) => {
|
|
51
|
+
const column = cell.config.column ?? lastSeenColumn;
|
|
52
|
+
lastSeenColumn = column;
|
|
53
|
+
if (!cellsByColumn.has(column)) {
|
|
54
|
+
cellsByColumn.set(column, []);
|
|
55
|
+
}
|
|
56
|
+
cellsByColumn.get(column)?.push(cell);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Sort columns by index
|
|
60
|
+
return [...cellsByColumn.entries()].toSorted(([a], [b]) => a - b);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Determine if the code should be hidden.
|
|
65
|
+
*
|
|
66
|
+
* This is used to hide the code if it's pure markdown and there's an output,
|
|
67
|
+
* or if the code is empty.
|
|
68
|
+
*/
|
|
69
|
+
export function shouldHideCode(code: string, output: OutputMessage | null) {
|
|
70
|
+
const isPureMarkdown = new MarkdownLanguageAdapter().isSupported(code);
|
|
71
|
+
const hasOutput = output !== null && !isOutputEmpty(output);
|
|
72
|
+
return (isPureMarkdown && hasOutput) || code.trim() === "";
|
|
73
|
+
}
|
|
@@ -27,13 +27,11 @@ import {
|
|
|
27
27
|
} from "@/components/ui/dropdown-menu";
|
|
28
28
|
import { outputIsLoading, outputIsStale } from "@/core/cells/cell";
|
|
29
29
|
import type { CellId } from "@/core/cells/ids";
|
|
30
|
-
import { isOutputEmpty } from "@/core/cells/outputs";
|
|
31
30
|
import type { CellData, CellRuntimeState } from "@/core/cells/types";
|
|
32
31
|
import { getReadonlyCodeDisplay } from "@/core/cells/readonly-code-display";
|
|
33
32
|
import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
|
|
34
33
|
import { useResolvedMarimoConfig } from "@/core/config/config";
|
|
35
|
-
import { CSSClasses
|
|
36
|
-
import type { OutputMessage } from "@/core/kernel/messages";
|
|
34
|
+
import { CSSClasses } from "@/core/constants";
|
|
37
35
|
import { kernelStateAtom } from "@/core/kernel/state";
|
|
38
36
|
import { useNotebookCodeAvailable } from "@/core/meta/code-visibility";
|
|
39
37
|
import { showCodeInRunModeAtom } from "@/core/meta/state";
|
|
@@ -46,7 +44,6 @@ import { useRequestClient } from "@/core/network/requests";
|
|
|
46
44
|
import type { CellConfig } from "@/core/network/types";
|
|
47
45
|
import { downloadAsHTML } from "@/core/static/download-html";
|
|
48
46
|
import { isStaticNotebook } from "@/core/static/static-state";
|
|
49
|
-
import { isWasm } from "@/core/wasm/utils";
|
|
50
47
|
import { cn } from "@/utils/cn";
|
|
51
48
|
import {
|
|
52
49
|
ADD_PRINTING_CLASS,
|
|
@@ -58,6 +55,12 @@ import { FloatingOutline } from "../../chrome/panels/outline/floating-outline";
|
|
|
58
55
|
import { cellDomProps } from "../../common";
|
|
59
56
|
import type { ICellRendererPlugin, ICellRendererProps } from "../types";
|
|
60
57
|
import { useDelayVisibility } from "./useDelayVisibility";
|
|
58
|
+
import {
|
|
59
|
+
getInitialShowCode,
|
|
60
|
+
groupCellsByColumn,
|
|
61
|
+
shouldHideCode,
|
|
62
|
+
updateShowCodeQueryParam,
|
|
63
|
+
} from "./utils";
|
|
61
64
|
import { VerticalLayoutWrapper } from "./vertical-layout-wrapper";
|
|
62
65
|
|
|
63
66
|
type VerticalLayout = null;
|
|
@@ -74,22 +77,20 @@ const VerticalLayoutRenderer: React.FC<VerticalLayoutProps> = ({
|
|
|
74
77
|
const [userConfig] = useResolvedMarimoConfig();
|
|
75
78
|
const showCodeInRunModePreference = useAtomValue(showCodeInRunModeAtom);
|
|
76
79
|
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (!showCodeInRunModePreference) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
// If 'auto' or not found, use URL param
|
|
84
|
-
// If url param is not set, we default to true for static notebooks, wasm notebooks, and kiosk mode
|
|
85
|
-
const showCodeByQueryParam = urlParams.get(KnownQueryParams.showCode);
|
|
86
|
-
return showCodeByQueryParam === null
|
|
87
|
-
? isStaticNotebook() || isWasm() || kioskMode
|
|
88
|
-
: showCodeByQueryParam === "true";
|
|
89
|
-
});
|
|
80
|
+
const [showCode, setShowCode] = useState(() =>
|
|
81
|
+
getInitialShowCode({ showCodeInRunModePreference, kioskMode }),
|
|
82
|
+
);
|
|
90
83
|
|
|
91
84
|
const canShowCode = useNotebookCodeAvailable(cells);
|
|
92
85
|
|
|
86
|
+
const handleToggleShowCode = () => {
|
|
87
|
+
setShowCode((currentShowCode) => {
|
|
88
|
+
const nextShowCode = !currentShowCode;
|
|
89
|
+
updateShowCodeQueryParam(nextShowCode);
|
|
90
|
+
return nextShowCode;
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
93
94
|
const renderCell = (cell: CellRuntimeState & CellData) => {
|
|
94
95
|
return (
|
|
95
96
|
<VerticalCell
|
|
@@ -169,7 +170,7 @@ const VerticalLayoutRenderer: React.FC<VerticalLayoutProps> = ({
|
|
|
169
170
|
<ActionButtons
|
|
170
171
|
canShowCode={canShowCode}
|
|
171
172
|
showCode={showCode}
|
|
172
|
-
onToggleShowCode={
|
|
173
|
+
onToggleShowCode={handleToggleShowCode}
|
|
173
174
|
/>
|
|
174
175
|
)}
|
|
175
176
|
<FloatingOutline />
|
|
@@ -469,34 +470,3 @@ export const VerticalLayoutPlugin: ICellRendererPlugin<
|
|
|
469
470
|
serializeLayout: (layout) => layout,
|
|
470
471
|
getInitialLayout: () => null,
|
|
471
472
|
};
|
|
472
|
-
|
|
473
|
-
export function groupCellsByColumn(
|
|
474
|
-
cells: (CellRuntimeState & CellData)[],
|
|
475
|
-
): [number, (CellRuntimeState & CellData)[]][] {
|
|
476
|
-
// Group cells by column
|
|
477
|
-
const cellsByColumn = new Map<number, (CellRuntimeState & CellData)[]>();
|
|
478
|
-
let lastSeenColumn = 0;
|
|
479
|
-
cells.forEach((cell) => {
|
|
480
|
-
const column = cell.config.column ?? lastSeenColumn;
|
|
481
|
-
lastSeenColumn = column;
|
|
482
|
-
if (!cellsByColumn.has(column)) {
|
|
483
|
-
cellsByColumn.set(column, []);
|
|
484
|
-
}
|
|
485
|
-
cellsByColumn.get(column)?.push(cell);
|
|
486
|
-
});
|
|
487
|
-
|
|
488
|
-
// Sort columns by index
|
|
489
|
-
return [...cellsByColumn.entries()].toSorted(([a], [b]) => a - b);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* Determine if the code should be hidden.
|
|
494
|
-
*
|
|
495
|
-
* This is used to hide the code if it's pure markdown and there's an output,
|
|
496
|
-
* or if the code is empty.
|
|
497
|
-
*/
|
|
498
|
-
export function shouldHideCode(code: string, output: OutputMessage | null) {
|
|
499
|
-
const isPureMarkdown = new MarkdownLanguageAdapter().isSupported(code);
|
|
500
|
-
const hasOutput = output !== null && !isOutputEmpty(output);
|
|
501
|
-
return (isPureMarkdown && hasOutput) || code.trim() === "";
|
|
502
|
-
}
|