@mathscan/math-exercise-engine 1.2.7 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/style.css CHANGED
@@ -1087,7 +1087,8 @@ th.exercise-table-cell.exercise-table-cell--last-row:last-child {
1087
1087
  .matcher-widget {
1088
1088
  display: flex;
1089
1089
  flex-direction: column;
1090
- gap: clamp(10px, 2.5vw, 16px);
1090
+ gap: clamp(6px, min(max(10px, 2.5vw), 2.5vh), 16px);
1091
+ gap: clamp(6px, min(max(10px, 2.5vw), 2.5dvh), 16px);
1091
1092
  width: min(100%, 580px);
1092
1093
  margin-inline: auto;
1093
1094
  }
@@ -1095,15 +1096,20 @@ th.exercise-table-cell.exercise-table-cell--last-row:last-child {
1095
1096
  .matcher-row {
1096
1097
  display: grid;
1097
1098
  grid-template-columns: repeat(var(--matcher-cols, 3), minmax(0, 1fr));
1098
- gap: clamp(10px, 2.5vw, 16px);
1099
+ gap: clamp(6px, min(max(10px, 2.5vw), 2.5vh), 16px);
1100
+ gap: clamp(6px, min(max(10px, 2.5vw), 2.5dvh), 16px);
1099
1101
  }
1100
1102
 
1101
1103
  .matcher-card {
1102
1104
  display: flex;
1103
1105
  align-items: center;
1104
1106
  justify-content: center;
1105
- min-height: clamp(72px, 14vw, 96px);
1106
- padding: clamp(8px, 2vw, 12px);
1107
+ /* Bounded by viewport height too, so 3 rows fit on landscape phones (~330px tall).
1108
+ vh lines are fallbacks for WebViews without dvh support. */
1109
+ min-height: clamp(44px, min(max(72px, 14vw), 15vh), 96px);
1110
+ min-height: clamp(44px, min(max(72px, 14vw), 15dvh), 96px);
1111
+ padding: clamp(4px, min(max(8px, 2vw), 1.5vh), 12px);
1112
+ padding: clamp(4px, min(max(8px, 2vw), 1.5dvh), 12px);
1107
1113
  border: 2px solid #ffca76;
1108
1114
  border-radius: clamp(12px, 3vw, 17px);
1109
1115
  background: #ffffff;
@@ -2620,6 +2626,28 @@ th.exercise-table-cell.exercise-table-cell--last-row:last-child {
2620
2626
  transform: translateY(-50%);
2621
2627
  }
2622
2628
 
2629
+ /**
2630
+ * GEOMETRY widget — the wrapper this package owns. Everything inside it is
2631
+ * rendered by @mathscan/geometry-engine, which ships no stylesheet of its own
2632
+ * and sizes its canvas from the box it is given.
2633
+ */
2634
+
2635
+ .geometry-widget {
2636
+ width: 100%;
2637
+ max-width: 100%;
2638
+ margin: 0;
2639
+ }
2640
+
2641
+ /* Reserves the canvas box while the engine's React entry is still loading, so
2642
+ the exercise does not jump when the canvas appears. */
2643
+
2644
+ .geometry-widget__loading {
2645
+ width: 100%;
2646
+ aspect-ratio: 1 / 1;
2647
+ border-radius: 8px;
2648
+ background: var(--exercise-bg, transparent);
2649
+ }
2650
+
2623
2651
  /**
2624
2652
  * Button & Action Styles
2625
2653
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mathscan/math-exercise-engine",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "A DSL parser and validator for math exercises - transforms text-based exercise definitions into structured AST and JSON",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -18,6 +18,7 @@
18
18
  ],
19
19
  "scripts": {
20
20
  "build": "vite build",
21
+ "check:geometry-isolation": "node --no-warnings --experimental-loader ./scripts/geometry-validation-isolation-loader.mjs ./scripts/check-geometry-validation-isolation.mjs && node ./scripts/check-geometry-bundle-isolation.mjs",
21
22
  "dev": "vite build --watch",
22
23
  "playground": "vite --open /playground/grid-symmetry-builder/",
23
24
  "demo": "node examples/demo.mjs",
@@ -31,7 +32,7 @@
31
32
  "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\" \"*.{json,md}\"",
32
33
  "format:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\" \"*.{json,md}\"",
33
34
  "typecheck": "tsc --noEmit",
34
- "prepublishOnly": "pnpm run build"
35
+ "prepublishOnly": "pnpm run build && pnpm run check:geometry-isolation"
35
36
  },
36
37
  "keywords": [
37
38
  "math",
@@ -48,14 +49,17 @@
48
49
  "dependencies": {
49
50
  "@dnd-kit/core": "^6.3.1",
50
51
  "@dnd-kit/utilities": "^3.2.2",
52
+ "@mathscan/geometry-engine": "0.1.4",
51
53
  "chevrotain": "^11.0.3",
52
54
  "lodash": "^4.17.21",
53
55
  "mathjs": "^12.4.0",
54
56
  "zod": "^3.22.4"
55
57
  },
56
58
  "peerDependencies": {
57
- "react": "^18.0.0 || ^19.0.0",
58
- "react-dom": "^18.0.0 || ^19.0.0"
59
+ "konva": "^10.3.0",
60
+ "react": "^19.2.0",
61
+ "react-dom": "^19.2.0",
62
+ "react-konva": "^19.2.5"
59
63
  },
60
64
  "peerDependenciesMeta": {
61
65
  "react": {
@@ -63,6 +67,12 @@
63
67
  },
64
68
  "react-dom": {
65
69
  "optional": true
70
+ },
71
+ "konva": {
72
+ "optional": true
73
+ },
74
+ "react-konva": {
75
+ "optional": true
66
76
  }
67
77
  },
68
78
  "devDependencies": {
@@ -89,7 +99,7 @@
89
99
  "vitest": "^4.0.17"
90
100
  },
91
101
  "engines": {
92
- "node": ">=18.0.0"
102
+ "node": "^20.19.0 || >=22.12.0"
93
103
  },
94
104
  "packageManager": "pnpm@8.15.0"
95
105
  }