move everything

This commit is contained in:
Joeri Exelmans 2025-05-23 22:35:47 +02:00
parent 3ff7e76694
commit 9050581a10
25 changed files with 37 additions and 42 deletions

View file

@ -1,62 +0,0 @@
import { initialEditorState } from "./configurations";
// import { removeFocus } from "./eval";
const removeFocus = state => state;
export const actionShortcuts: [string, string[], string][] = [
["call" , ['c'], "expr ⌴" ],
["transform", ['t'], "⌴ expr" ],
["assign" , ['a'], "let (⌴ = expr) in ⌴"],
["declare" , ['d'], "let (⌴ = ⌴) in expr"],
["lambda" , ['l'], "λ⌴. expr" ],
];
export function getActions(globalContext, setState) {
return {
c: () => {
setState(state => ({
kind: "call",
fn: removeFocus(state),
input: initialEditorState,
}));
globalContext?.doHighlight.call();
},
t: () => {
setState(state => ({
kind: "call",
fn: initialEditorState,
input: removeFocus(state),
}));
globalContext?.doHighlight.transform();
},
a: () => {
setState(state => ({
kind: "let",
name: "",
focus: true,
value: removeFocus(state),
inner: removeFocus(initialEditorState),
}));
globalContext?.doHighlight.assign();
},
d: () => {
setState(state => ({
kind: "let",
name: "",
focus: true,
value: removeFocus(initialEditorState),
inner: removeFocus(state),
}));
globalContext?.doHighlight.declare();
},
l: () => {
setState(state => ({
kind: "lambda",
paramName: "",
focus: true,
expr: removeFocus(state),
}));
globalContext?.doHighlight.lambda();
},
};
}