@marimo-team/frontend 0.21.2-dev33 → 0.21.2-dev34
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/{cell-editor-DjgVKzSN.js → cell-editor-CtnuCOtA.js} +13 -13
- package/dist/assets/{edit-page-DILTuy37.js → edit-page-vExGqsee.js} +3 -3
- package/dist/assets/{index--jnf_XpT.js → index-OH-GH0bF.js} +2 -2
- package/dist/assets/{scratchpad-panel-C9dOTCrV.js → scratchpad-panel-vKbONRfT.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/core/codemirror/completion/__tests__/keymap.test.ts +15 -35
- package/src/core/codemirror/completion/keymap.ts +14 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as oe}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as ae,u as we}from"./useEvent-O0nX5vok.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{E as ke,F as ze,li as Ce,ti as Se,ui as n,yn as Oe,__tla as Ae}from"./cells-DZyIQGyJ.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import"./utils-CdjCA1J8.js";import{h as ie}from"./useEventListener-Dy81QR4n.js";import{y as Ie}from"./utils-tNbLd14P.js";import{t as Ee}from"./constants-Rz_lD4HK.js";import{t as Le}from"./jsx-runtime-icT_Ltz2.js";import{t as z}from"./button-Ej3vmCIF.js";import{t as le}from"./cn-BoaCR37F.js";import"./dist-B_cxg-E4.js";import{n as Me,__tla as Pe}from"./JsonOutput-CN6rPeEV.js";import"./cjs-BU2qXMKx.js";import"./main-DrBRErTM.js";import"./useNonce-BtW-rR_1.js";import{r as Re}from"./requests-Bgjtqo_1.js";import{t as me}from"./createLucideIcon-Cm-Z7dYr.js";import{d as De,__tla as He}from"./layout-qNHT912R.js";import{n as Ve,t as qe,__tla as Te}from"./LazyAnyLanguageCodeMirror-Dmh6kfiy.js";import"./download-BlNsDzA2.js";import"./markdown-renderer-CH1ffrUG.js";import{u as Fe}from"./toDate-BqKH-Jd9.js";import{t as Ge,__tla as Ue}from"./cell-editor-
|
|
1
|
+
import{s as oe}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as ae,u as we}from"./useEvent-O0nX5vok.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{E as ke,F as ze,li as Ce,ti as Se,ui as n,yn as Oe,__tla as Ae}from"./cells-DZyIQGyJ.js";import"./react-dom-CSu739Rf.js";import{t as se}from"./compiler-runtime-B3qBwwSJ.js";import"./utils-CdjCA1J8.js";import{h as ie}from"./useEventListener-Dy81QR4n.js";import{y as Ie}from"./utils-tNbLd14P.js";import{t as Ee}from"./constants-Rz_lD4HK.js";import{t as Le}from"./jsx-runtime-icT_Ltz2.js";import{t as z}from"./button-Ej3vmCIF.js";import{t as le}from"./cn-BoaCR37F.js";import"./dist-B_cxg-E4.js";import{n as Me,__tla as Pe}from"./JsonOutput-CN6rPeEV.js";import"./cjs-BU2qXMKx.js";import"./main-DrBRErTM.js";import"./useNonce-BtW-rR_1.js";import{r as Re}from"./requests-Bgjtqo_1.js";import{t as me}from"./createLucideIcon-Cm-Z7dYr.js";import{d as De,__tla as He}from"./layout-qNHT912R.js";import{n as Ve,t as qe,__tla as Te}from"./LazyAnyLanguageCodeMirror-Dmh6kfiy.js";import"./download-BlNsDzA2.js";import"./markdown-renderer-CH1ffrUG.js";import{u as Fe}from"./toDate-BqKH-Jd9.js";import{t as Ge,__tla as Ue}from"./cell-editor-CtnuCOtA.js";import{t as Be}from"./spinner-C5JoisA7.js";import{t as Je}from"./play-DKSqmedg.js";import"./dist-BNC_tnlW.js";import"./dist-CXLJUPFl.js";import"./dist-CQqv2gQL.js";import"./dist-8UD0A5sU.js";import"./dist-apDpadc4.js";import"./session-BrEm7qNv.js";import{r as Ke}from"./useTheme-BYXBU1of.js";import"./Combination-Cs9nbinQ.js";import{t as C}from"./tooltip-D9723Brr.js";import"./purify.es-BBn8CPhf.js";import"./dates-CHaNfieI.js";import"./popover-BPGG2gPG.js";import"./vega-loader.browser-CZV6_g2i.js";import"./defaultLocale-OkOxlkkM.js";import"./defaultLocale-DK1MWd7f.js";import{__tla as Qe}from"./chunk-5FQGJX7Z-CM1a_K7I.js";import"./katex-rvFxOCU-.js";import"./html-to-image-DDWA96Ex.js";import{o as We}from"./focus-Cnr-VB8o.js";import{a as Xe}from"./renderShortcut-CnD1Dah5.js";import"./esm-CBkHtTOV.js";import{n as Ye,r as Ze,t as ne}from"./react-resizable-panels.browser.esm-DDRqG5ui.js";import"./name-cell-input-BmkGdvnh.js";import{n as $e,r as et}from"./panel-context-BN0DQXiK.js";import{__tla as tt}from"./loro_wasm_bg-CcIcmNa3.js";import"./ws-CBdPISJL.js";import"./Inputs-D5kI9GwB.js";import"./dist-D9Vhptds.js";import"./dist-CVEvQ1Ex.js";import"./dist-sVuk6mkQ.js";import"./dist-DxrbvUBv.js";import"./dist-6FIAeDIu.js";import"./dist-CgC048vN.js";import"./dist-DbK_4_qo.js";import"./dist-ASlWkGgG.js";import"./dist-DBPtheKQ.js";import"./esm-DhTsVMLM.js";import{t as rt}from"./kiosk-mode-D4FbpWVp.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Pe}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Ue}catch{}})(),(()=>{try{return Qe}catch{}})(),(()=>{try{return tt}catch{}})()]).then(async()=>{var de=me("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),pe=me("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),he=se(),q=oe(Ne(),1),ue=15;const T=Se("marimo:scratchpadHistory:v1",[],Oe),fe=ae(!1),xe=ae(null,(e,s,i)=>{if(i=i.trim(),!i)return;let m=e(T);s(T,[i,...m.filter(c=>c!==i)].slice(0,ue))});var t=oe(Le(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,he.c)(60),s=ze(),[i]=Ie(),{theme:m}=Ke(),c=(0,q.useRef)(null),F=We(),{createNewCell:G,updateCellCode:d}=ke(),{sendRunScratchpad:p}=Re(),S=$e(),U=et(),l=s.cellRuntime[n],B=l==null?void 0:l.output,O=l==null?void 0:l.status,J=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",K=be(xe),[a,h]=ye(fe),u=we(T),A;e[0]!==K||e[1]!==r||e[2]!==p?(A=()=>{p({code:r}),K(r)},e[0]=K,e[1]=r,e[2]=p,e[3]=A):A=e[3];let f=V(A),I;e[4]!==r||e[5]!==G||e[6]!==F?(I=()=>{r.trim()&&G({code:r,before:!1,cellId:F??"__end__"})},e[4]=r,e[5]=G,e[6]=F,e[7]=I):I=e[7];let Q=V(I),E;e[8]!==p||e[9]!==d?(E=()=>{d({cellId:n,code:"",formattingChange:!1}),p({code:""});let o=c.current;o&&o.dispatch({changes:{from:0,to:o.state.doc.length,insert:""}})},e[8]=p,e[9]=d,e[10]=E):E=e[10];let W=V(E),L;e[11]!==h||e[12]!==d?(L=o=>{h(!1),d({cellId:n,code:o,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:o}})},e[11]=h,e[12]=d,e[13]=L):L=e[13];let X=V(L),[Y,ge]=(0,q.useState)(),M;e[14]!==X||e[15]!==u||e[16]!==a||e[17]!==m?(M=()=>a?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((o,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>X(o),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:o.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=a,e[17]=m,e[18]=M):M=e[18];let Z=M,P;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==a||e[24]!==h||e[25]!==O?(P=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(C,{content:Xe("cell.run"),children:(0,t.jsx)(z,{"data-testid":"scratchpad-run-button",onClick:f,disabled:a,variant:"text",size:"xs",children:(0,t.jsx)(Je,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(C,{content:"Clear code and outputs",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:W,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(rt,{children:(0,t.jsx)(C,{content:"Insert code",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Be,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(C,{content:"Toggle history",children:(0,t.jsx)(z,{size:"xs",variant:"text",className:le(a&&"bg-(--sky-3) rounded-none"),onClick:()=>h(!a),disabled:u.length===0,children:(0,t.jsx)(pe,{size:16})})}),(0,t.jsx)(C,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(z,{size:"xs",variant:"text",children:(0,t.jsx)(Fe,{size:16})})})]}),e[19]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=a,e[24]=h,e[25]=O,e[26]=P):P=e[26];let $=P,je=S==="vertical",R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=Ce.create(n),e[27]=R):R=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=o=>{c.current=o},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==Y||e[34]!==m||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ge,{theme:m,showPlaceholder:!1,id:n,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:D,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,e[34]=m,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(ne,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=b);let y;e[47]===B?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Me,{allowExpand:!1,output:B,className:Ee.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=B,e[48]=y);let w;e[49]===J?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:J,className:"overflow-auto",stale:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=J,e[50]=w);let N;e[51]!==y||e[52]!==w?(N=(0,t.jsx)(ne,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==U||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,b,N]},U)}),e[54]=S,e[55]=U,e[56]=g,e[57]=b,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
|
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-OH-GH0bF.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-BW0IMuFq.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/clsx-BDxNtGmi.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/cn-BoaCR37F.js">
|
package/package.json
CHANGED
|
@@ -1,44 +1,24 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { completionKeymap } from "../keymap";
|
|
3
|
+
import { completionKeymap as defaultCompletionKeymap } from "@codemirror/autocomplete";
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
import { filterCompletionBindings } from "../keymap";
|
|
7
6
|
|
|
8
7
|
describe("completionKeymap", () => {
|
|
9
|
-
it("
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
vi.spyOn(view.state, "field").mockReturnValue("pending");
|
|
17
|
-
|
|
18
|
-
view.dispatch({ changes: [], effects: [], annotations: [] });
|
|
19
|
-
const result = false; // Mock the expected result
|
|
20
|
-
|
|
21
|
-
// Should return false to propagate the Escape key
|
|
22
|
-
expect(result).toBe(false);
|
|
23
|
-
|
|
24
|
-
view.destroy();
|
|
8
|
+
it("upstream includes the macOS-only completion bindings we care about", () => {
|
|
9
|
+
expect(
|
|
10
|
+
defaultCompletionKeymap.some((binding) => binding.mac === "Alt-`"),
|
|
11
|
+
).toBe(true);
|
|
12
|
+
expect(
|
|
13
|
+
defaultCompletionKeymap.some((binding) => binding.mac === "Alt-i"),
|
|
14
|
+
).toBe(true);
|
|
25
15
|
});
|
|
26
16
|
|
|
27
|
-
it("
|
|
28
|
-
const
|
|
29
|
-
extensions: [completionKeymap()],
|
|
30
|
-
});
|
|
31
|
-
const view = new EditorView({ state });
|
|
32
|
-
|
|
33
|
-
// Mock completionStatus to return "active"
|
|
34
|
-
vi.spyOn(view.state, "field").mockReturnValue("active");
|
|
35
|
-
|
|
36
|
-
view.dispatch({ changes: [], effects: [], annotations: [] });
|
|
37
|
-
const result = true; // Mock the expected result
|
|
38
|
-
|
|
39
|
-
// Should return true to stop propagation
|
|
40
|
-
expect(result).toBe(true);
|
|
17
|
+
it("removes Alt-backtick and Escape while keeping Alt-i", () => {
|
|
18
|
+
const filtered = filterCompletionBindings(defaultCompletionKeymap);
|
|
41
19
|
|
|
42
|
-
|
|
20
|
+
expect(filtered.some((binding) => binding.mac === "Alt-`")).toBe(false);
|
|
21
|
+
expect(filtered.some((binding) => binding.key === "Escape")).toBe(false);
|
|
22
|
+
expect(filtered.some((binding) => binding.mac === "Alt-i")).toBe(true);
|
|
43
23
|
});
|
|
44
24
|
});
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
moveCompletionSelection,
|
|
7
7
|
} from "@codemirror/autocomplete";
|
|
8
8
|
import { type Extension, Prec } from "@codemirror/state";
|
|
9
|
-
import { keymap } from "@codemirror/view";
|
|
9
|
+
import { type KeyBinding, keymap } from "@codemirror/view";
|
|
10
10
|
import { isInVimMode } from "../utils";
|
|
11
11
|
|
|
12
12
|
const KEYS_TO_REMOVE = new Set<string | undefined>([
|
|
@@ -22,10 +22,20 @@ const KEYS_TO_REMOVE = new Set<string | undefined>([
|
|
|
22
22
|
"Alt-`",
|
|
23
23
|
]);
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
function hasRemovedKeybinding(binding: KeyBinding): boolean {
|
|
26
|
+
return [binding.key, binding.mac, binding.linux, binding.win].some((key) =>
|
|
27
|
+
KEYS_TO_REMOVE.has(key),
|
|
28
28
|
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function filterCompletionBindings(
|
|
32
|
+
bindings: readonly KeyBinding[],
|
|
33
|
+
): readonly KeyBinding[] {
|
|
34
|
+
return bindings.filter((binding) => !hasRemovedKeybinding(binding));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function completionKeymap(): Extension {
|
|
38
|
+
const withoutKeysToRemove = filterCompletionBindings(defaultCompletionKeymap);
|
|
29
39
|
|
|
30
40
|
return Prec.highest(
|
|
31
41
|
keymap.of([
|