From b8085e9dc36a24c5ad3b31e10716d0411f04d771 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Sun, 19 May 2024 13:25:56 -0400 Subject: [PATCH 1/4] change fanchor to 0 --- packages/superdough/superdough.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index c0ba96e0..2b04dc1a 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -289,7 +289,7 @@ export const superdough = async (value, t, hapDuration) => { density = 0.03, // filters ftype = '12db', - fanchor = 0.5, + fanchor = 0, // low pass cutoff, lpenv, From eed4a83b71f7d47229bd49395a562f092ed754b0 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Sun, 19 May 2024 21:13:46 -0400 Subject: [PATCH 2/4] add defaults and fanchor docs --- packages/core/controls.mjs | 9 ++ packages/superdough/superdough.mjs | 8 +- test/__snapshots__/examples.test.mjs.snap | 187 +++++----------------- 3 files changed, 53 insertions(+), 151 deletions(-) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index d5dbef13..7e9556d3 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -753,6 +753,15 @@ export const { bprelease, bpr } = registerControl('bprelease', 'bpr'); * .ftype("12db 24db") */ export const { ftype } = registerControl('ftype'); + +/** + * controls the center of the filter envelope. 0 is unipolar positive, .5 is bipolar, 1 is unipolar negative + * @name fanchor + * @param {number | Pattern} center 0 to 1 + * @example + * note("{f g g c d a a#}%8").s("sawtooth").lpf("{1000}%2") + * .lpenv(8).fanchor("<0 .5 1>") + */ export const { fanchor } = registerControl('fanchor'); /** * Applies the cutoff frequency of the **h**igh-**p**ass **f**ilter. diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 2b04dc1a..c37ff50b 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -24,6 +24,12 @@ export function getSound(s) { return soundMap.get()[s]; } +const defaults = new Map([['fanchor', 0]]); + +export function setDefault(key, value) { + defaults.set(key, value); +} + export const resetLoadedSounds = () => soundMap.set({}); let audioContext; @@ -289,7 +295,7 @@ export const superdough = async (value, t, hapDuration) => { density = 0.03, // filters ftype = '12db', - fanchor = 0, + fanchor = defaults.get('fanchor'), // low pass cutoff, lpenv, diff --git a/test/__snapshots__/examples.test.mjs.snap b/test/__snapshots__/examples.test.mjs.snap index 30db05a2..d1539ba4 100644 --- a/test/__snapshots__/examples.test.mjs.snap +++ b/test/__snapshots__/examples.test.mjs.snap @@ -2493,6 +2493,43 @@ exports[`runs examples > example "every" example index 0 1`] = ` ] `; +exports[`runs examples > example "fanchor" example index 0 1`] = ` +[ + "[ 0/1 → 1/8 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 1/8 → 1/4 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 1/4 → 3/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 3/8 → 1/2 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 1/2 → 5/8 | note:d s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 5/8 → 3/4 | note:a s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 3/4 → 7/8 | note:a# s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 7/8 → 1/1 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 1/1 → 9/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]", + "[ 9/8 → 5/4 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]", + "[ 5/4 → 11/8 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]", + "[ 11/8 → 3/2 | note:d s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]", + "[ 3/2 → 13/8 | note:a s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]", + "[ 13/8 → 7/4 | note:a# s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]", + "[ 7/4 → 15/8 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]", + "[ 15/8 → 2/1 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]", + "[ 2/1 → 17/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]", + "[ 17/8 → 9/4 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]", + "[ 9/4 → 19/8 | note:d s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]", + "[ 19/8 → 5/2 | note:a s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]", + "[ 5/2 → 21/8 | note:a# s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]", + "[ 21/8 → 11/4 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]", + "[ 11/4 → 23/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]", + "[ 23/8 → 3/1 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]", + "[ 3/1 → 25/8 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 25/8 → 13/4 | note:d s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 13/4 → 27/8 | note:a s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 27/8 → 7/2 | note:a# s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 7/2 → 29/8 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 29/8 → 15/4 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 15/4 → 31/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", + "[ 31/8 → 4/1 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]", +] +`; + exports[`runs examples > example "fast" example index 0 1`] = ` [ "[ 0/1 → 1/8 | s:bd ]", @@ -5035,72 +5072,6 @@ exports[`runs examples > example "ply" example index 0 1`] = ` ] `; -exports[`runs examples > example "polymeter" example index 0 1`] = ` -[ - "[ 0/1 → 1/3 | c ]", - "[ 0/1 → 1/3 | c2 ]", - "[ 1/3 → 2/3 | eb ]", - "[ 1/3 → 2/3 | g2 ]", - "[ 2/3 → 1/1 | g ]", - "[ 2/3 → 1/1 | c2 ]", - "[ 1/1 → 4/3 | c ]", - "[ 1/1 → 4/3 | g2 ]", - "[ 4/3 → 5/3 | eb ]", - "[ 4/3 → 5/3 | c2 ]", - "[ 5/3 → 2/1 | g ]", - "[ 5/3 → 2/1 | g2 ]", - "[ 2/1 → 7/3 | c ]", - "[ 2/1 → 7/3 | c2 ]", - "[ 7/3 → 8/3 | eb ]", - "[ 7/3 → 8/3 | g2 ]", - "[ 8/3 → 3/1 | g ]", - "[ 8/3 → 3/1 | c2 ]", - "[ 3/1 → 10/3 | c ]", - "[ 3/1 → 10/3 | g2 ]", - "[ 10/3 → 11/3 | eb ]", - "[ 10/3 → 11/3 | c2 ]", - "[ 11/3 → 4/1 | g ]", - "[ 11/3 → 4/1 | g2 ]", -] -`; - -exports[`runs examples > example "polymeterSteps" example index 0 1`] = ` -[ - "[ 0/1 → 1/4 | c ]", - "[ 0/1 → 1/4 | e ]", - "[ 1/4 → 1/2 | d ]", - "[ 1/4 → 1/2 | f ]", - "[ 1/2 → 3/4 | c ]", - "[ 1/2 → 3/4 | g ]", - "[ 3/4 → 1/1 | d ]", - "[ 3/4 → 1/1 | e ]", - "[ 1/1 → 5/4 | c ]", - "[ 1/1 → 5/4 | f ]", - "[ 5/4 → 3/2 | d ]", - "[ 5/4 → 3/2 | g ]", - "[ 3/2 → 7/4 | c ]", - "[ 3/2 → 7/4 | e ]", - "[ 7/4 → 2/1 | d ]", - "[ 7/4 → 2/1 | f ]", - "[ 2/1 → 9/4 | c ]", - "[ 2/1 → 9/4 | g ]", - "[ 9/4 → 5/2 | d ]", - "[ 9/4 → 5/2 | e ]", - "[ 5/2 → 11/4 | c ]", - "[ 5/2 → 11/4 | f ]", - "[ 11/4 → 3/1 | d ]", - "[ 11/4 → 3/1 | g ]", - "[ 3/1 → 13/4 | c ]", - "[ 3/1 → 13/4 | e ]", - "[ 13/4 → 7/2 | d ]", - "[ 13/4 → 7/2 | f ]", - "[ 7/2 → 15/4 | c ]", - "[ 7/2 → 15/4 | g ]", - "[ 15/4 → 4/1 | d ]", - "[ 15/4 → 4/1 | e ]", -] -`; - exports[`runs examples > example "postgain" example index 0 1`] = ` [ "[ 0/1 → 1/8 | s:hh compressor:-20 compressorRatio:20 compressorKnee:10 compressorAttack:0.002 compressorRelease:0.02 postgain:1.5 ]", @@ -7216,31 +7187,6 @@ exports[`runs examples > example "stack" example index 0 2`] = ` ] `; -exports[`runs examples > example "stepcat" example index 0 1`] = ` -[ - "[ 0/1 → 1/5 | s:bd ]", - "[ 1/5 → 2/5 | s:cp ]", - "[ 2/5 → 3/5 | s:bd ]", - "[ 3/5 → 4/5 | s:mt ]", - "[ 4/5 → 1/1 | s:bd ]", - "[ 1/1 → 6/5 | s:bd ]", - "[ 6/5 → 7/5 | s:cp ]", - "[ 7/5 → 8/5 | s:bd ]", - "[ 8/5 → 9/5 | s:mt ]", - "[ 9/5 → 2/1 | s:bd ]", - "[ 2/1 → 11/5 | s:bd ]", - "[ 11/5 → 12/5 | s:cp ]", - "[ 12/5 → 13/5 | s:bd ]", - "[ 13/5 → 14/5 | s:mt ]", - "[ 14/5 → 3/1 | s:bd ]", - "[ 3/1 → 16/5 | s:bd ]", - "[ 16/5 → 17/5 | s:cp ]", - "[ 17/5 → 18/5 | s:bd ]", - "[ 18/5 → 19/5 | s:mt ]", - "[ 19/5 → 4/1 | s:bd ]", -] -`; - exports[`runs examples > example "steps" example index 0 1`] = ` [ "[ 0/1 → 1/4 | s:bd ]", @@ -7554,65 +7500,6 @@ exports[`runs examples > example "swingBy" example index 0 1`] = ` ] `; -exports[`runs examples > example "timecat" example index 0 1`] = ` -[ - "[ 0/1 → 3/4 | note:e3 ]", - "[ 3/4 → 1/1 | note:g3 ]", - "[ 1/1 → 7/4 | note:e3 ]", - "[ 7/4 → 2/1 | note:g3 ]", - "[ 2/1 → 11/4 | note:e3 ]", - "[ 11/4 → 3/1 | note:g3 ]", - "[ 3/1 → 15/4 | note:e3 ]", - "[ 15/4 → 4/1 | note:g3 ]", -] -`; - -exports[`runs examples > example "timecat" example index 1 1`] = ` -[ - "[ 0/1 → 1/5 | s:bd ]", - "[ 1/5 → 2/5 | s:sd ]", - "[ 2/5 → 3/5 | s:cp ]", - "[ 3/5 → 4/5 | s:hh ]", - "[ 4/5 → 1/1 | s:hh ]", - "[ 1/1 → 6/5 | s:bd ]", - "[ 6/5 → 7/5 | s:sd ]", - "[ 7/5 → 8/5 | s:cp ]", - "[ 8/5 → 9/5 | s:hh ]", - "[ 9/5 → 2/1 | s:hh ]", - "[ 2/1 → 11/5 | s:bd ]", - "[ 11/5 → 12/5 | s:sd ]", - "[ 12/5 → 13/5 | s:cp ]", - "[ 13/5 → 14/5 | s:hh ]", - "[ 14/5 → 3/1 | s:hh ]", - "[ 3/1 → 16/5 | s:bd ]", - "[ 16/5 → 17/5 | s:sd ]", - "[ 17/5 → 18/5 | s:cp ]", - "[ 18/5 → 19/5 | s:hh ]", - "[ 19/5 → 4/1 | s:hh ]", -] -`; - -exports[`runs examples > example "toTactus" example index 0 1`] = ` -[ - "[ 0/1 → 1/4 | s:bd ]", - "[ 1/4 → 1/2 | s:sd ]", - "[ 1/2 → 3/4 | s:cp ]", - "[ 3/4 → 1/1 | s:bd ]", - "[ 1/1 → 5/4 | s:sd ]", - "[ 5/4 → 3/2 | s:cp ]", - "[ 3/2 → 7/4 | s:bd ]", - "[ 7/4 → 2/1 | s:sd ]", - "[ 2/1 → 9/4 | s:cp ]", - "[ 9/4 → 5/2 | s:bd ]", - "[ 5/2 → 11/4 | s:sd ]", - "[ 11/4 → 3/1 | s:cp ]", - "[ 3/1 → 13/4 | s:bd ]", - "[ 13/4 → 7/2 | s:sd ]", - "[ 7/2 → 15/4 | s:cp ]", - "[ 15/4 → 4/1 | s:bd ]", -] -`; - exports[`runs examples > example "transpose" example index 0 1`] = ` [ "[ 0/1 → 1/4 | note:C2 ]", From a214b1b2241b0e37bc40d49e9439737575f2f80d Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Sun, 19 May 2024 23:16:27 -0400 Subject: [PATCH 3/4] fill in remaining defaults git push --- packages/superdough/superdough.mjs | 68 +++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 20 deletions(-) diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index c37ff50b..dc096cbb 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -13,6 +13,7 @@ import { createFilter, gainNode, getCompressor } from './helpers.mjs'; import { map } from 'nanostores'; import { logger } from './logger.mjs'; import { loadBuffer } from './sampler.mjs'; +import { velocity } from '../core/controls.mjs'; export const soundMap = map(); @@ -24,12 +25,39 @@ export function getSound(s) { return soundMap.get()[s]; } -const defaults = new Map([['fanchor', 0]]); +const defaults = new Map([ + ['s', 'triangle'], + ['gain', 0.8], + ['postgain', 1], + ['density', '.03'], + ['ftype', '12db'], + ['fanchor', 0], + ['resonance', 1], + ['hresonance', 1], + ['bandq', 1], + ['channels', [1, 2]], + ['phaserdepth', 0.75], + ['shapevol', 1], + ['distortvol', 1], + ['delay', 0], + ['delayfeedback', 0.5], + ['delaytime', 0.25], + ['orbit', 1], + ['i', 1], + ['velocity', 1], + ['fft', 8], +]); export function setDefault(key, value) { defaults.set(key, value); } +export function setDefaults(defaultsobj) { + Object.keys(defaultsobj).forEach((key) => { + setDefault(key, defaultsobj[key]); + }); +} + export const resetLoadedSounds = () => soundMap.set({}); let audioContext; @@ -287,14 +315,14 @@ export const superdough = async (value, t, hapDuration) => { } // destructure let { - s = 'triangle', + s = defaults.get('s'), bank, source, - gain = 0.8, - postgain = 1, - density = 0.03, + gain = defaults.get('gain'), + postgain = defaults.get('postgain'), + density = defaults.get('density'), // filters - ftype = '12db', + ftype = defaults.get('ftype'), fanchor = defaults.get('fanchor'), // low pass cutoff, @@ -303,7 +331,7 @@ export const superdough = async (value, t, hapDuration) => { lpdecay, lpsustain, lprelease, - resonance = 1, + resonance = defaults.get('resonance'), // high pass hpenv, hcutoff, @@ -311,7 +339,7 @@ export const superdough = async (value, t, hapDuration) => { hpdecay, hpsustain, hprelease, - hresonance = 1, + hresonance = defaults.get('hresonance'), // band pass bpenv, bandf, @@ -319,36 +347,36 @@ export const superdough = async (value, t, hapDuration) => { bpdecay, bpsustain, bprelease, - bandq = 1, - channels = [1, 2], + bandq = defaults.get('bandq'), + channels = defaults.get('channels'), //phaser phaser, - phaserdepth = 0.75, + phaserdepth = defaults.get('phaserdepth'), phasersweep, phasercenter, // coarse, crush, shape, - shapevol = 1, + shapevol = defaults.get('shapevol'), distort, - distortvol = 1, + distortvol = defaults.get('distortvol'), pan, vowel, - delay = 0, - delayfeedback = 0.5, - delaytime = 0.25, - orbit = 1, + delay = defaults.get('delay'), + delayfeedback = defaults.get('delayfeedback'), + delaytime = defaults.get('delaytime'), + orbit = defaults.get('orbit'), room, roomfade, roomlp, roomdim, roomsize, ir, - i = 0, - velocity = 1, + i = defaults.get('i'), + velocity = defaults.get('velocity'), analyze, // analyser wet - fft = 8, // fftSize 0 - 10 + fft = defaults.get('fft'), // fftSize 0 - 10 compressor: compressorThreshold, compressorRatio, compressorKnee, From 2bae6e06c0d48f31cb3f4974297f451ecd594a57 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Tue, 28 May 2024 23:08:41 +0200 Subject: [PATCH 4/4] add simple default value versioning --- packages/superdough/superdough.mjs | 106 ++++++++++++++++------------- website/src/repl/Repl.jsx | 7 ++ 2 files changed, 66 insertions(+), 47 deletions(-) diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 76711338..5488b404 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -13,7 +13,6 @@ import { createFilter, gainNode, getCompressor, getWorklet } from './helpers.mjs import { map } from 'nanostores'; import { logger } from './logger.mjs'; import { loadBuffer } from './sampler.mjs'; -import { velocity } from '../core/controls.mjs'; export const soundMap = map(); @@ -25,38 +24,51 @@ export function getSound(s) { return soundMap.get()[s]; } -const defaults = new Map([ - ['s', 'triangle'], - ['gain', 0.8], - ['postgain', 1], - ['density', '.03'], - ['ftype', '12db'], - ['fanchor', 0], - ['resonance', 1], - ['hresonance', 1], - ['bandq', 1], - ['channels', [1, 2]], - ['phaserdepth', 0.75], - ['shapevol', 1], - ['distortvol', 1], - ['delay', 0], - ['delayfeedback', 0.5], - ['delaytime', 0.25], - ['orbit', 1], - ['i', 1], - ['velocity', 1], - ['fft', 8], -]); +const defaultDefaultValues = { + s: 'triangle', + gain: 0.8, + postgain: 1, + density: '.03', + ftype: '12db', + fanchor: 0, + resonance: 1, + hresonance: 1, + bandq: 1, + channels: [1, 2], + phaserdepth: 0.75, + shapevol: 1, + distortvol: 1, + delay: 0, + delayfeedback: 0.5, + delaytime: 0.25, + orbit: 1, + i: 1, + velocity: 1, + fft: 8, +}; -export function setDefault(key, value) { - defaults.set(key, value); +let defaultControls = new Map(Object.entries(defaultDefaultValues)); + +export function setDefaultValue(key, value) { + defaultControls.set(key, value); } - -export function setDefaults(defaultsobj) { +export function getDefaultValue(key) { + return defaultControls.get(key); +} +export function setDefaultValues(defaultsobj) { Object.keys(defaultsobj).forEach((key) => { - setDefault(key, defaultsobj[key]); + setDefaultValue(key, defaultsobj[key]); }); } +export function resetDefaultValues() { + defaultControls = new Map(Object.entries(defaultDefaultValues)); +} +export function setVersionDefaults(version) { + resetDefaultValues(); + if (version === '1.0') { + setDefaultValue('fanchor', 0.5); + } +} export const resetLoadedSounds = () => soundMap.set({}); @@ -310,14 +322,14 @@ export const superdough = async (value, t, hapDuration) => { } // destructure let { - s = defaults.get('s'), + s = getDefaultValue('s'), bank, source, - gain = defaults.get('gain'), - postgain = defaults.get('postgain'), - density = defaults.get('density'), + gain = getDefaultValue('gain'), + postgain = getDefaultValue('postgain'), + density = getDefaultValue('density'), // filters - fanchor = defaults.get('fanchor'), + fanchor = getDefaultValue('fanchor'), drive = 0.69, // low pass cutoff, @@ -326,7 +338,7 @@ export const superdough = async (value, t, hapDuration) => { lpdecay, lpsustain, lprelease, - resonance = defaults.get('resonance'), + resonance = getDefaultValue('resonance'), // high pass hpenv, hcutoff, @@ -334,7 +346,7 @@ export const superdough = async (value, t, hapDuration) => { hpdecay, hpsustain, hprelease, - hresonance = defaults.get('hresonance'), + hresonance = getDefaultValue('hresonance'), // band pass bpenv, bandf, @@ -342,36 +354,36 @@ export const superdough = async (value, t, hapDuration) => { bpdecay, bpsustain, bprelease, - bandq = defaults.get('bandq'), - channels = defaults.get('channels'), + bandq = getDefaultValue('bandq'), + channels = getDefaultValue('channels'), //phaser phaser, - phaserdepth = defaults.get('phaserdepth'), + phaserdepth = getDefaultValue('phaserdepth'), phasersweep, phasercenter, // coarse, crush, shape, - shapevol = defaults.get('shapevol'), + shapevol = getDefaultValue('shapevol'), distort, - distortvol = defaults.get('distortvol'), + distortvol = getDefaultValue('distortvol'), pan, vowel, - delay = defaults.get('delay'), - delayfeedback = defaults.get('delayfeedback'), - delaytime = defaults.get('delaytime'), - orbit = defaults.get('orbit'), + delay = getDefaultValue('delay'), + delayfeedback = getDefaultValue('delayfeedback'), + delaytime = getDefaultValue('delaytime'), + orbit = getDefaultValue('orbit'), room, roomfade, roomlp, roomdim, roomsize, ir, - i = defaults.get('i'), - velocity = defaults.get('velocity'), + i = getDefaultValue('i'), + velocity = getDefaultValue('velocity'), analyze, // analyser wet - fft = defaults.get('fft'), // fftSize 0 - 10 + fft = getDefaultValue('fft'), // fftSize 0 - 10 compressor: compressorThreshold, compressorRatio, compressorKnee, diff --git a/website/src/repl/Repl.jsx b/website/src/repl/Repl.jsx index d709d058..bbfb8b50 100644 --- a/website/src/repl/Repl.jsx +++ b/website/src/repl/Repl.jsx @@ -94,6 +94,13 @@ export function Repl({ embedded = false }) { window.location.hash = '#' + code2hash(code); setDocumentTitle(code); const viewingPatternData = getViewingPatternData(); + try { + const metadata = getMetadata(code); + setVersionDefaults(metadata.version); + } catch (err) { + console.error('Error parsing metadata..'); + console.error(err); + } const data = { ...viewingPatternData, code }; let id = data.id; const isExamplePattern = viewingPatternData.collection !== userPattern.collection;