diff --git a/packages/repl/repl-component.mjs b/packages/repl/repl-component.mjs index b8dc4cb9..1aece8a4 100644 --- a/packages/repl/repl-component.mjs +++ b/packages/repl/repl-component.mjs @@ -1,33 +1,12 @@ import { getDrawContext, silence } from '@strudel.cycles/core'; import { transpiler } from '@strudel.cycles/transpiler'; import { getAudioContext, webaudioOutput } from '@strudel.cycles/webaudio'; -import { StrudelMirror, defaultSettings, codemirrorSettings } from '@strudel/codemirror'; +import { StrudelMirror, codemirrorSettings } from '@strudel/codemirror'; import { prebake } from './prebake.mjs'; -function camelToKebab(camelCaseString) { - return camelCaseString.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); -} -function kebabToCamel(kebabCaseString) { - return kebabCaseString.replace(/-([a-z])/g, function (match, group) { - return group.toUpperCase(); - }); -} - -const settingAttributes = Object.keys(defaultSettings).map(camelToKebab); -const parseAttribute = (name, value) => { - const camel = kebabToCamel(name); - const type = typeof defaultSettings[camel]; - if (type === 'boolean') { - return ['1', 'true'].includes(value); - } - if (type === 'number') { - return Number(value); - } - return value; -}; if (typeof HTMLElement !== 'undefined') { class StrudelRepl extends HTMLElement { - static observedAttributes = ['code', ...settingAttributes]; + static observedAttributes = ['code']; settings = codemirrorSettings.get(); editor = null; constructor() { @@ -37,10 +16,6 @@ if (typeof HTMLElement !== 'undefined') { if (name === 'code') { this.code = newValue; this.editor?.setCode(newValue); - } else if (settingAttributes.includes(name)) { - const camel = kebabToCamel(name); - this.settings[camel] = parseAttribute(name, newValue); - this.editor?.updateSettings(this.settings); } } connectedCallback() { @@ -64,7 +39,6 @@ if (typeof HTMLElement !== 'undefined') { root: container, initialCode: '// LOADING', pattern: silence, - settings: this.settings, drawTime, onDraw: (haps, time, frame, painters) => { painters.length && drawContext.clearRect(0, 0, drawContext.canvas.width * 2, drawContext.canvas.height * 2); diff --git a/website/src/pages/vanilla/mini.astro b/website/src/pages/vanilla/mini.astro index e0d44a29..34438309 100644 --- a/website/src/pages/vanilla/mini.astro +++ b/website/src/pages/vanilla/mini.astro @@ -5,19 +5,6 @@

This is a REPL:

-

This is another REPL: