From 2ef6f7fe0f30ddc69437581af0226d64801ce245 Mon Sep 17 00:00:00 2001 From: Lumi Pakkanen Date: Tue, 14 May 2024 09:10:07 +0300 Subject: [PATCH] Update sonic-weave dependency SonicWeave changelog: - Admit inf in the universal monzo basis - Interprete rgb and hsl colors literally - Reserve nan and inf as keywords - Normalize zero and NaN - Fix intrinsic calls --- package-lock.json | 10 +++++----- package.json | 4 ++-- src/components/modals/modification/EnumerateScale.vue | 8 ++++---- src/exporters/__tests__/test-data.ts | 2 +- src/stores/scale.ts | 10 +++++----- src/stores/tempering.ts | 10 ++++++---- src/utils.ts | 10 ++-------- 7 files changed, 25 insertions(+), 29 deletions(-) diff --git a/package-lock.json b/package-lock.json index d53d5302..7b8a9a0e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "scale-workshop", - "version": "3.0.0-beta.25", + "version": "3.0.0-beta.26", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "scale-workshop", - "version": "3.0.0-beta.25", + "version": "3.0.0-beta.26", "dependencies": { "isomorphic-qwerty": "^0.0.2", "ji-lattice": "^0.0.3", @@ -14,7 +14,7 @@ "moment-of-symmetry": "^0.5.2", "pinia": "^2.1.7", "qs": "^6.12.0", - "sonic-weave": "github:xenharmonic-devs/sonic-weave#v0.0.36", + "sonic-weave": "github:xenharmonic-devs/sonic-weave#v0.0.37", "sw-synth": "^0.1.0", "temperaments": "^0.5.3", "values.js": "^2.1.1", @@ -5455,8 +5455,8 @@ } }, "node_modules/sonic-weave": { - "version": "0.0.36", - "resolved": "git+ssh://git@github.com/xenharmonic-devs/sonic-weave.git#4e120d3bfed93cf0971c90260dd71f0852f78143", + "version": "0.0.37", + "resolved": "git+ssh://git@github.com/xenharmonic-devs/sonic-weave.git#ccaaff89dd85d0d0ace0aff50bc2a1cc4ace7e1c", "license": "MIT", "dependencies": { "moment-of-symmetry": "^0.5.2", diff --git a/package.json b/package.json index 6891b5fe..e3f349c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scale-workshop", - "version": "3.0.0-beta.25", + "version": "3.0.0-beta.26", "scripts": { "dev": "vite", "build": "run-p type-check \"build-only {@}\" --", @@ -21,7 +21,7 @@ "moment-of-symmetry": "^0.5.2", "pinia": "^2.1.7", "qs": "^6.12.0", - "sonic-weave": "github:xenharmonic-devs/sonic-weave#v0.0.36", + "sonic-weave": "github:xenharmonic-devs/sonic-weave#v0.0.37", "sw-synth": "^0.1.0", "temperaments": "^0.5.3", "values.js": "^2.1.1", diff --git a/src/components/modals/modification/EnumerateScale.vue b/src/components/modals/modification/EnumerateScale.vue index 74aa4268..49634e5c 100644 --- a/src/components/modals/modification/EnumerateScale.vue +++ b/src/components/modals/modification/EnumerateScale.vue @@ -9,7 +9,7 @@ const scale = useScaleStore() function overtonal() { scale.sourceText += ';elevate();simplify;map(repr)' const { visitor, defaults } = scale.getUserScopeVisitor() - const overtones = visitor.currentScale.map(i => i.label) + const overtones = visitor.currentScale.map((i) => i.label) visitor.currentScale.length = 0 scale.sourceText = visitor.expand(defaults) if (scale.sourceText) { @@ -23,7 +23,7 @@ function overtonal() { function undertonal() { scale.sourceText += ';reflect();elevate();simplify;map(repr)' const { visitor, defaults } = scale.getUserScopeVisitor() - const undertones = visitor.currentScale.map(i => i.label) + const undertones = visitor.currentScale.map((i) => i.label) visitor.currentScale.length = 0 scale.sourceText = visitor.expand(defaults) if (scale.sourceText) { @@ -37,7 +37,7 @@ function undertonal() { function retroversion() { scale.sourceText += ';retrovert();elevate();simplify;map(repr)' const { visitor, defaults } = scale.getUserScopeVisitor() - const tones = visitor.currentScale.map(i => i.label) + const tones = visitor.currentScale.map((i) => i.label) visitor.currentScale.length = 0 scale.sourceText = visitor.expand(defaults) if (scale.sourceText) { @@ -51,7 +51,7 @@ function retroversion() { function revposition() { scale.sourceText += ';revpose();elevate();simplify;map(repr)' const { visitor, defaults } = scale.getUserScopeVisitor() - const tones = visitor.currentScale.map(i => i.label) + const tones = visitor.currentScale.map((i) => i.label) visitor.currentScale.length = 0 scale.sourceText = visitor.expand(defaults) if (scale.sourceText) { diff --git a/src/exporters/__tests__/test-data.ts b/src/exporters/__tests__/test-data.ts index d17a0ffd..dcb0fdbb 100644 --- a/src/exporters/__tests__/test-data.ts +++ b/src/exporters/__tests__/test-data.ts @@ -30,7 +30,7 @@ export function getTestData(appTitle: string) { whole: 100n, fractional: '', exponent: null, - real: false, + real: false }), relativeC5, new Interval( diff --git a/src/stores/scale.ts b/src/stores/scale.ts index b5e4f819..b0cd55d4 100644 --- a/src/stores/scale.ts +++ b/src/stores/scale.ts @@ -336,13 +336,13 @@ export const useScaleStore = defineStore('scale', () => { // Methods function getUserScopeVisitor() { const globalVisitor = getGlobalScaleWorkshopVisitor() - const visitor = new StatementVisitor(globalVisitor); - visitor.isUserRoot = true; + const visitor = new StatementVisitor(globalVisitor) + visitor.isUserRoot = true const defaults = visitor.rootContext!.clone() defaults.gas = gas.value const ast = parseAST(sourceText.value) - visitor.executeProgram(ast); + visitor.executeProgram(ast) return { defaults, visitor @@ -356,9 +356,9 @@ export const useScaleStore = defineStore('scale', () => { latticeIntervals.value = [] const globalVisitor = getGlobalScaleWorkshopVisitor() const visitor = new StatementVisitor(globalVisitor) - visitor.isUserRoot = true; + visitor.isUserRoot = true const ast = parseAST(sourceText.value) - visitor.executeProgram(ast); + visitor.executeProgram(ast) let userDeclaredPitch = false for (const statement of ast.body) { if (statement.type === 'PitchDeclaration') { diff --git a/src/stores/tempering.ts b/src/stores/tempering.ts index aab9f291..43d8a2c2 100644 --- a/src/stores/tempering.ts +++ b/src/stores/tempering.ts @@ -163,7 +163,7 @@ export const useRank2Store = defineStore('rank2', () => { const generatorPerPeriod = computed(() => { const p = period.value.totalCents() if (!p) { - return 0; + return 0 } return generator.value.totalCents() / p }) @@ -174,7 +174,9 @@ export const useRank2Store = defineStore('rank2', () => { } return value || 1 }) - const opposite = computed(() => isBright(generatorPerPeriod.value, safeSize.value / safeNumPeriods.value) ? 'dark' : 'bright') + const opposite = computed(() => + isBright(generatorPerPeriod.value, safeSize.value / safeNumPeriods.value) ? 'dark' : 'bright' + ) const [mosPatterns, mosPatternsError] = computedAndError(() => { if (method.value === 'generator') { @@ -223,7 +225,7 @@ export const useRank2Store = defineStore('rank2', () => { const circlePeriodCents = computed(() => { const p = period.value.totalCents() if (!p || isNaN(p)) { - return 0.0001; + return 0.0001 } const stretch = parseFloat(periodStretch.value) if (isNaN(stretch)) { @@ -235,7 +237,7 @@ export const useRank2Store = defineStore('rank2', () => { const circleGeneratorCents = computed(() => { const g = generator.value.totalCents() if (isNaN(g)) { - return 0; + return 0 } const fine = parseFloat(generatorFineCents.value) if (isNaN(fine)) { diff --git a/src/utils.ts b/src/utils.ts index 50510b0f..0166072b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,12 +1,6 @@ import { computed, watch, type ComputedRef, type Ref } from 'vue' import { gcd, mmod } from 'xen-dev-utils' -import { - evaluateExpression, - getSourceVisitor, - Interval, - parseAST, - repr -} from 'sonic-weave' +import { evaluateExpression, getSourceVisitor, Interval, parseAST, repr } from 'sonic-weave' /** * Calculate the smallest power of two greater or equal to the input value. @@ -62,7 +56,7 @@ export function expandCode(source: string) { const visitor = getSourceVisitor() const defaults = visitor.rootContext!.clone() const ast = parseAST(source) - visitor.executeProgram(ast); + visitor.executeProgram(ast) return visitor.expand(defaults) }