diff --git a/src/components/Statement.vue b/src/components/Statement.vue index 8712aab..05b4a2e 100644 --- a/src/components/Statement.vue +++ b/src/components/Statement.vue @@ -6,12 +6,11 @@ import Katex from './Katex.vue' const props = defineProps<{ statement: MathStatement, - evaluation: EvaluationResult, - renderVersion: number, + evaluation?: EvaluationResult, }>() const getValueStatement = (): Maybe => { - const value = props.evaluation.statements[props.statement.id] + const value = props.evaluation?.statements?.[props.statement.id] if ( value ) { return MathStatement.temp(String(value)) } @@ -48,7 +47,7 @@ computed(() => value = getValueStatement()) diff --git a/src/pages/VarDeclEditor.vue b/src/pages/VarDeclEditor.vue new file mode 100644 index 0000000..a8f545f --- /dev/null +++ b/src/pages/VarDeclEditor.vue @@ -0,0 +1,94 @@ + + + diff --git a/src/support/page.ts b/src/support/page.ts index 3e77930..b4e60fa 100644 --- a/src/support/page.ts +++ b/src/support/page.ts @@ -16,6 +16,11 @@ export class MathPage { public readonly id: string, ) {} + /** Get all defined statements. */ + getStatements(): MathStatement[] { + return Object.values(this.statements) + } + /** Get a statement by ID if it exists. */ getStatement(id: StatementID): Maybe { return this.statements[id] diff --git a/src/support/parse.ts b/src/support/parse.ts index 4245dc2..f5d96da 100644 --- a/src/support/parse.ts +++ b/src/support/parse.ts @@ -324,4 +324,18 @@ export class MathStatement { uses(): math.SymbolNode[] { return (new RValSymbolWalk()).walk(this.parse()) } + + /** Returns true if the definition is correctly non-recursive. */ + isNotRecursive(): boolean { + const uses = this.uses() + const defines = this.defines() + + for ( const define of defines ) { + if ( uses.some(x => x.name === define.name) ) { + return false + } + } + + return true + } } diff --git a/vite.config.ts b/vite.config.ts index 3bc00d8..96e978b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -9,6 +9,9 @@ export default defineConfig({ '/api': { target: 'http://localhost:8000/', }, + '/auth': { + target: 'http://localhost:8000/', + }, }, }, plugins: [