@@ -48,7 +56,7 @@ computed(() => value = getValueStatement())
diff --git a/src/components/TextBox.vue b/src/components/TextBox.vue
new file mode 100644
index 0000000..80216ac
--- /dev/null
+++ b/src/components/TextBox.vue
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $emit('edit')"
+ >Edit
+
+
+ $emit('remove')"
+ >Remove
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/WrapperBox.vue b/src/components/WrapperBox.vue
new file mode 100644
index 0000000..caa52a7
--- /dev/null
+++ b/src/components/WrapperBox.vue
@@ -0,0 +1,27 @@
+
+
+
+
+
+
Grid with component
+
+
Count is: {{ count }}
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/Editor.vue b/src/pages/Editor.vue
index d267c91..0ec3342 100644
--- a/src/pages/Editor.vue
+++ b/src/pages/Editor.vue
@@ -1,19 +1,288 @@
+
+
+
+
+
+
+
+
+
+ Title
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ props.row.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ props.row.name }}
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ openNewVariableDeclModal()"
+ />
+ openNewExpressionModal()"
+ />
+ makeNewRichTextBox()"
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+ Status
+
+
+
+
-
\ No newline at end of file
+
diff --git a/src/pages/ExpressionEditor.vue b/src/pages/ExpressionEditor.vue
new file mode 100644
index 0000000..6fffc12
--- /dev/null
+++ b/src/pages/ExpressionEditor.vue
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+ {{ expressionError }}
+
+
+
+
+
+
+ saveExpression()">
+
+
+
diff --git a/src/pages/RichTextEditor.vue b/src/pages/RichTextEditor.vue
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/src/pages/RichTextEditor.vue
@@ -0,0 +1,2 @@
+
+
diff --git a/src/pages/Scratch.vue b/src/pages/Scratch.vue
index d2aa3fd..6e54ad8 100644
--- a/src/pages/Scratch.vue
+++ b/src/pages/Scratch.vue
@@ -3,6 +3,8 @@
import {v4 as uuidv4} from 'uuid'
import Statement from '../components/Statement.vue'
import {MathStatement} from '../support/parse'
+ import {onMounted, ref} from 'vue'
+ import Katex from '../components/Katex.vue'
const page = new MathPage(uuidv4())
const stmt1Id = page.addRaw('x = y+3/4')
@@ -12,10 +14,59 @@
const stmt = page.getStatement(stmt1Id)
console.log({page, stmt1Id})
- const onEdit = (stmt: MathStatement) => () => console.log('edit', stmt)
+ let editModal = ref(false)
+ let editExpression = ref('')
+ let editPreview = ref(MathStatement.temp(''))
+ let activeStatement!: MathStatement
+
+ const editStatement = (stmt: MathStatement) => {
+ console.log('editing statement', stmt, editModal)
+ activeStatement = stmt
+ editPreview.value = MathStatement.temp(stmt.raw)
+ editModal.value = true
+ editExpression.value = stmt.raw
+ }
+
+ let key = ref(uuidv4())
+ const updateEditRender = () => {
+ const previewStmt = MathStatement.temp(editExpression.value)
+ if ( previewStmt.isValid() ) {
+ editPreview.value = MathStatement.temp(editExpression.value)
+ key.value = uuidv4()
+ }
+ }
Scratch page for testing!
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 @@
+
+
+
+
+
+
+
+
+
+
+ {{ newVariableModalError }}
+
+
+
+
+
+
+
+
+ saveNewVariable()">
+
+
+
diff --git a/src/router.ts b/src/router.ts
index c747a57..079434c 100644
--- a/src/router.ts
+++ b/src/router.ts
@@ -15,8 +15,9 @@ const routes = [
{
path: '/editor',
name: 'Editor',
- component: () => import('./pages/Editor.vue'),
+ component: () => import(/* webpackChunkName: "Editor" */ './pages/Editor.vue'),
},
+
]
const router = createRouter({
diff --git a/src/support/const.ts b/src/support/const.ts
new file mode 100644
index 0000000..4d1ef7f
--- /dev/null
+++ b/src/support/const.ts
@@ -0,0 +1,2 @@
+export const stepX = 5
+export const stepY = 5
diff --git a/src/support/page.ts b/src/support/page.ts
index 3e77930..462cc03 100644
--- a/src/support/page.ts
+++ b/src/support/page.ts
@@ -2,7 +2,7 @@ import {MathStatement} from './parse'
import * as math from 'mathjs'
import {DepGraph} from 'dependency-graph'
import { v4 as uuidv4 } from 'uuid'
-import {EvaluationResult, Maybe, StatementID, VariableName} from '../types'
+import {EvaluationResult, Maybe, StatementID, VariableName} from './types'
/**
* Wrapper for a page containing multiple interrelated mathematical statements.
@@ -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 6dfdae2..5e15fb9 100644
--- a/src/support/parse.ts
+++ b/src/support/parse.ts
@@ -1,6 +1,6 @@
import * as math from 'mathjs'
import katex from 'katex'
-import {HTMLString, LaTeXString, StatementID} from '../types'
+import {HTMLString, LaTeXString, StatementID} from './types'
import {v4 as uuidv4} from 'uuid'
/** Base class for walks over MathNode trees. */
@@ -269,6 +269,9 @@ export class MathStatement {
/** The raw statement input by the user. */
public readonly raw: string,
+
+ public x: Number = 0,
+ public y: Number = 0,
) {}
/** Parse the raw statement to an AST. */
@@ -300,6 +303,16 @@ export class MathStatement {
return node
}
+ /** Returns true if the expression is valid. */
+ isValid(): boolean {
+ try {
+ this.toHTMLString()
+ return true
+ } catch (_) {
+ return false
+ }
+ }
+
/** Get all symbols referenced in this statement. */
symbols(): math.SymbolNode[] {
return (new SymbolWalk()).walk(this.parse())
@@ -314,4 +327,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/src/types.ts b/src/support/types.ts
similarity index 94%
rename from src/types.ts
rename to src/support/types.ts
index c0b76d6..d459c20 100644
--- a/src/types.ts
+++ b/src/support/types.ts
@@ -91,3 +91,14 @@ export interface EvaluationResult {
variables: Record
statements: Record
}
+
+
+export class RichTextBox {
+ constructor(
+ public text: string = '',
+ public x: Number = 0,
+ public y: Number = 0,
+ ) {
+
+ }
+}
\ No newline at end of file
diff --git a/vite.config.ts b/vite.config.ts
index 365a48c..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: [
@@ -18,6 +21,5 @@ export default defineConfig({
quasar({
sassVariables: 'src/quasar-variables.sass',
- }),
- ],
+ })],
})