From be95477e7b694cc8e79422d4d31cf2aa8eb621e0 Mon Sep 17 00:00:00 2001 From: mgreminger Date: Mon, 15 Apr 2024 20:23:07 -0500 Subject: [PATCH 1/6] Bump mathlive version to include maxMatrixCols feat --- package-lock.json | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 073ea3be..1d852aa8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "idb-keyval": "^6.2.0", "mathjax": "^3.2.2", "mathjs": "^11.8.2", - "mathlive": "github:mgreminger/mathlive#23492aab778bf75b87b6b6f40c9fbe694757ec7e", + "mathlive": "github:mgreminger/mathlive#29b14918088a7f0ad9f8204f982447a7dbc6c8df", "plotly.js-basic-dist": "github:mgreminger/plotly.js#dist-basic-for-ep", "quick-lru": "^6.1.1", "quill": "^1.3.7", @@ -5274,8 +5274,8 @@ }, "node_modules/mathlive": { "version": "0.98.6", - "resolved": "git+ssh://git@github.com/mgreminger/mathlive.git#23492aab778bf75b87b6b6f40c9fbe694757ec7e", - "integrity": "sha512-pBQTdGt+L0UsSggnrDGzY1lvroNPYtS0BsXIzsHXzfSa09JVchruq6ob6MIU2FDbtz9aoDk12MfzDFEmv0y0SQ==", + "resolved": "git+ssh://git@github.com/mgreminger/mathlive.git#29b14918088a7f0ad9f8204f982447a7dbc6c8df", + "integrity": "sha512-TWC1iRy9bi9VQPk/5eRAPwm39SvvETm01KAY/wj+Nnzf7agSUbclRMRI530Mc3Gaz2ehbNZEzVmIsVhJQk/aZg==", "license": "MIT", "dependencies": { "@cortex-js/compute-engine": "0.23.1" @@ -11720,9 +11720,9 @@ } }, "mathlive": { - "version": "git+ssh://git@github.com/mgreminger/mathlive.git#23492aab778bf75b87b6b6f40c9fbe694757ec7e", - "integrity": "sha512-pBQTdGt+L0UsSggnrDGzY1lvroNPYtS0BsXIzsHXzfSa09JVchruq6ob6MIU2FDbtz9aoDk12MfzDFEmv0y0SQ==", - "from": "mathlive@github:mgreminger/mathlive#23492aab778bf75b87b6b6f40c9fbe694757ec7e", + "version": "git+ssh://git@github.com/mgreminger/mathlive.git#29b14918088a7f0ad9f8204f982447a7dbc6c8df", + "integrity": "sha512-TWC1iRy9bi9VQPk/5eRAPwm39SvvETm01KAY/wj+Nnzf7agSUbclRMRI530Mc3Gaz2ehbNZEzVmIsVhJQk/aZg==", + "from": "mathlive@github:mgreminger/mathlive#29b14918088a7f0ad9f8204f982447a7dbc6c8df", "requires": { "@cortex-js/compute-engine": "0.23.1" } diff --git a/package.json b/package.json index 24a7fe4b..a6c4608e 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "idb-keyval": "^6.2.0", "mathjax": "^3.2.2", "mathjs": "^11.8.2", - "mathlive": "github:mgreminger/mathlive#23492aab778bf75b87b6b6f40c9fbe694757ec7e", + "mathlive": "github:mgreminger/mathlive#29b14918088a7f0ad9f8204f982447a7dbc6c8df", "plotly.js-basic-dist": "github:mgreminger/plotly.js#dist-basic-for-ep", "quick-lru": "^6.1.1", "quill": "^1.3.7", From f63993961e761390efa27fbe051f0bc12c1aa61b Mon Sep 17 00:00:00 2001 From: mgreminger Date: Tue, 16 Apr 2024 15:02:53 -0500 Subject: [PATCH 2/6] feat: implement increased limit on number of matrix columns --- src/CustomMatrixModal.svelte | 9 ++++----- src/MathField.svelte | 3 ++- src/constants.ts | 4 +++- src/parser/LatexToSympy.ts | 16 ++++++++++++---- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/CustomMatrixModal.svelte b/src/CustomMatrixModal.svelte index 8cf6a78a..e1b3bad7 100644 --- a/src/CustomMatrixModal.svelte +++ b/src/CustomMatrixModal.svelte @@ -1,5 +1,6 @@ @@ -44,7 +44,6 @@
@@ -53,7 +52,7 @@
diff --git a/src/MathField.svelte b/src/MathField.svelte index 565821f5..42281f62 100644 --- a/src/MathField.svelte +++ b/src/MathField.svelte @@ -4,7 +4,7 @@ import type { MathField } from "./cells/MathField"; import type { MathfieldElement } from "mathlive"; - import { INLINE_SHORTCUTS } from "./constants"; + import { INLINE_SHORTCUTS, MAX_MATRIX_COLS } from "./constants"; export let latex = ""; export let mathField: MathField | null = null; @@ -287,6 +287,7 @@ MAX_MATRIX_COLS) { + this.addParsingErrorMessage(`Matrices are limited to ${MAX_MATRIX_COLS} columns. The number of rows is unlimited`); + error = true; + continue; } const blankMatrixLatex = getBlankMatrixLatex(numRows, numColumns); @@ -1777,8 +1787,6 @@ export class LatexToSympy extends LatexParserVisitor Date: Tue, 16 Apr 2024 18:06:04 -0500 Subject: [PATCH 3/6] feat: increase max matrix columns to 50 --- src/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.ts b/src/constants.ts index 7ae0b988..ed8898fc 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -12,4 +12,4 @@ export const INLINE_SHORTCUTS = { 'log_': '\\log_{#?}(#?)', }; -export const MAX_MATRIX_COLS = 20; +export const MAX_MATRIX_COLS = 50; From 8c448a93c85fcf2e67484d6a3362d512351aadbc Mon Sep 17 00:00:00 2001 From: mgreminger Date: Tue, 16 Apr 2024 18:06:22 -0500 Subject: [PATCH 4/6] tests: test column with more than 10 columns --- tests/test_matrix_keyboard.spec.mjs | 34 ++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tests/test_matrix_keyboard.spec.mjs b/tests/test_matrix_keyboard.spec.mjs index 95fc7f30..2bf33431 100644 --- a/tests/test_matrix_keyboard.spec.mjs +++ b/tests/test_matrix_keyboard.spec.mjs @@ -49,7 +49,7 @@ test('Matrix inverse keyboard entry', async () => { expect(content).toBe(String.raw`\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}`); }); -test('Matrix inverse keyboard entry for two blank matrices', async () => { +test('Matrix keyboard entry for two blank matrices', async () => { await page.locator('#cell-0 >> math-field.editable').type('([1,2]@[2,1])_1,1'); await page.locator('#cell-0 >> math-field.editable').press('Tab'); await page.locator('#cell-0 >> math-field.editable').type('='); @@ -95,3 +95,35 @@ test('Matrix virtual keyboard entry', async () => { let content = await page.textContent(`#result-value-0`); expect(content).toBe(String.raw`\begin{bmatrix} a c + b d \end{bmatrix}`); }); + +test('Matrix with more than 10 columns', async () => { + await page.locator('#cell-0 >> math-field.editable').type('[1,11]'); + await page.locator('#cell-0 >> math-field.editable').type('='); + await page.locator('#cell-0 >> math-field.editable').press('Enter'); + await page.locator('#cell-0 >> math-field.editable').type('a'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('b'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('c'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('d'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('e0'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('f'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('g'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('h'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('i0'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('j'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('k'); + + await page.waitForSelector('text=Updating...', {state: 'detached'}); + + let content = await page.textContent(`#result-value-0`); + expect(content).toBe(String.raw`\begin{bmatrix} a & b & c & d & e_{0} & f & g & h & i_{0} & j & k \end{bmatrix}`); +}); \ No newline at end of file From b1140e35a03c243d41409417a4ac4f73e157ff8a Mon Sep 17 00:00:00 2001 From: mgreminger Date: Tue, 16 Apr 2024 18:08:15 -0500 Subject: [PATCH 5/6] fix: limit max number of rows in new matrix modal Use same limit as number of columns to prevent matrices so large that they'll crash the sheet --- src/CustomMatrixModal.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CustomMatrixModal.svelte b/src/CustomMatrixModal.svelte index e1b3bad7..056322d9 100644 --- a/src/CustomMatrixModal.svelte +++ b/src/CustomMatrixModal.svelte @@ -44,6 +44,7 @@
From 23adbe192808135c1338d6f32221d91c0d0489ea Mon Sep 17 00:00:00 2001 From: mgreminger Date: Thu, 18 Apr 2024 20:12:25 -0500 Subject: [PATCH 6/6] Bump version and updated new features modal --- src/App.svelte | 2 +- src/CustomMatrixModal.svelte | 1 - src/Updates.svelte | 10 ++++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 4de08b1b..7a3baac1 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -90,7 +90,7 @@ const apiUrl = window.location.origin; - const currentVersion = 20240406; + const currentVersion = 20240418; const tutorialHash = "fFjTsnFoSQMLwcvteVoNtL"; const termsVersion = 20240110; diff --git a/src/CustomMatrixModal.svelte b/src/CustomMatrixModal.svelte index 056322d9..e1b3bad7 100644 --- a/src/CustomMatrixModal.svelte +++ b/src/CustomMatrixModal.svelte @@ -44,7 +44,6 @@
diff --git a/src/Updates.svelte b/src/Updates.svelte index a4159e33..59bd2b82 100644 --- a/src/Updates.svelte +++ b/src/Updates.svelte @@ -16,6 +16,16 @@ } +April 18, 2024 +

Maximum Matrix Columns Limit Increased

+

+ The maximum number of columns allowed in a matrix has been increased to 50. + The previous limit was 10. The number of rows allowed is unlimited, however, + performance may become sluggish with large matrices. +

+ +
+ April 6, 2024

Drag to Reorder Cells Improvements