integrate repl into astro website

+ update build and setup tasks + workflow
+ move repl test folder to root
+ move docs and repl to website/src
This commit is contained in:
Felix Roos 2022-12-22 17:20:51 +01:00
parent 006ca12b6d
commit 818cd9044b
141 changed files with 25956 additions and 41 deletions

View file

@ -0,0 +1,33 @@
import { evalScope, controls } from '@strudel.cycles/core';
import { samples } from '@strudel.cycles/webaudio';
import { useEffect, useState } from 'react';
if (typeof window !== 'undefined') {
fetch('https://strudel.tidalcycles.org/EmuSP12.json')
.then((res) => res.json())
.then((json) => samples(json, 'https://strudel.tidalcycles.org/EmuSP12/'));
evalScope(
controls,
import('@strudel.cycles/core'),
// import('@strudel.cycles/tone'),
import('@strudel.cycles/tonal'),
import('@strudel.cycles/mini'),
import('@strudel.cycles/midi'),
import('@strudel.cycles/xen'),
import('@strudel.cycles/webaudio'),
import('@strudel.cycles/osc'),
);
}
export function MiniRepl({ tune }) {
const [Repl, setRepl] = useState();
useEffect(() => {
// we have to load this package on the client
// because codemirror throws an error on the server
import('@strudel.cycles/react').then((res) => {
setRepl(() => res.MiniRepl);
});
}, []);
return Repl ? <Repl tune={tune} hideOutsideView={true} /> : <pre>{tune}</pre>;
}