Import kabelsalat, update transpiler to handle K and S, add worklet control

This commit is contained in:
Aria 2026-01-07 12:18:57 -06:00
parent fd472a64d9
commit 5caaf423ff
8 changed files with 311 additions and 8 deletions

View file

@ -6,6 +6,7 @@ import { setTime } from './time.mjs';
import { evalScope } from './evaluate.mjs';
import { register, Pattern, isPattern, silence, stack } from './pattern.mjs';
import { reset_state } from './impure.mjs';
import { SalatRepl } from '@kabelsalat/web';
export function repl({
defaultOutput,
@ -24,6 +25,7 @@ export function repl({
id,
mondo = false,
}) {
const kabel = new SalatRepl({ localScope: true });
const state = {
schedulerError: undefined,
evalError: undefined,
@ -78,6 +80,11 @@ export function repl({
return silence;
};
const compileKabel = (code) => {
const node = kabel.evaluate(code);
return node.compile({ log: false });
};
// helper to get a patternified pure value out
function unpure(pat) {
if (pat._Pattern) {
@ -198,6 +205,7 @@ export function repl({
setcps: setCps,
setCpm,
setcpm: setCpm,
compileKabel,
});
};