@mathscan/math-exercise-engine 1.0.13 → 1.0.15
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/index.d.ts +5602 -1921
- package/dist/index.js +6343 -151
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6343 -151
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +115 -1
- package/package.json +3 -1
package/dist/style.css
CHANGED
|
@@ -317,6 +317,16 @@ mark {
|
|
|
317
317
|
font-weight: bold;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
+
/* ========================================
|
|
321
|
+
IMAGE
|
|
322
|
+
======================================== */
|
|
323
|
+
|
|
324
|
+
.image-item {
|
|
325
|
+
vertical-align: middle;
|
|
326
|
+
max-width: 100%;
|
|
327
|
+
object-fit: contain;
|
|
328
|
+
}
|
|
329
|
+
|
|
320
330
|
/* ========================================
|
|
321
331
|
OPERATORS & SYMBOLS
|
|
322
332
|
======================================== */
|
|
@@ -606,7 +616,8 @@ table.exercise-table {
|
|
|
606
616
|
border-collapse: collapse;
|
|
607
617
|
}
|
|
608
618
|
|
|
609
|
-
td.exercise-table-cell,
|
|
619
|
+
td.exercise-table-cell,
|
|
620
|
+
th.exercise-table-cell {
|
|
610
621
|
border: 2px solid #7c6cf2;
|
|
611
622
|
}
|
|
612
623
|
|
|
@@ -668,6 +679,109 @@ td.exercise-table-cell, th.exercise-table-cell {
|
|
|
668
679
|
display: inline-flex;
|
|
669
680
|
}
|
|
670
681
|
|
|
682
|
+
/* ========================================
|
|
683
|
+
MATCHER WIDGET
|
|
684
|
+
======================================== */
|
|
685
|
+
|
|
686
|
+
.matcher-widget {
|
|
687
|
+
display: flex;
|
|
688
|
+
flex-direction: column;
|
|
689
|
+
gap: 12px;
|
|
690
|
+
padding: 16px;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
.matcher-row {
|
|
694
|
+
display: grid;
|
|
695
|
+
grid-template-columns: repeat(var(--matcher-cols, 3), 1fr);
|
|
696
|
+
gap: 12px;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
.matcher-card {
|
|
700
|
+
display: flex;
|
|
701
|
+
flex-wrap: wrap;
|
|
702
|
+
align-items: center;
|
|
703
|
+
justify-content: center;
|
|
704
|
+
width: 100%;
|
|
705
|
+
min-height: 56px;
|
|
706
|
+
padding: 14px 12px;
|
|
707
|
+
border: 2.5px solid var(--exercise-border, #ddd);
|
|
708
|
+
border-radius: 14px;
|
|
709
|
+
background: var(--exercise-bg, #fff);
|
|
710
|
+
color: var(--exercise-text, #333);
|
|
711
|
+
font-size: var(--exercise-font-size, 1rem);
|
|
712
|
+
font-weight: var(--exercise-font-weight, 400);
|
|
713
|
+
line-height: 1.4;
|
|
714
|
+
text-align: center;
|
|
715
|
+
overflow-wrap: break-word;
|
|
716
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
|
|
717
|
+
cursor: pointer;
|
|
718
|
+
user-select: none;
|
|
719
|
+
transition:
|
|
720
|
+
border-color 0.2s ease,
|
|
721
|
+
background 0.2s ease,
|
|
722
|
+
color 0.2s ease,
|
|
723
|
+
box-shadow 0.2s ease,
|
|
724
|
+
transform 0.2s ease,
|
|
725
|
+
filter 0.2s ease;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
.matcher-card:hover {
|
|
729
|
+
border-color: var(--exercise-accent, #705dc0);
|
|
730
|
+
box-shadow: 0 4px 10px rgba(112, 93, 192, 0.22);
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
.matcher-card:active {
|
|
734
|
+
transform: scale(0.96);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
.matcher-card--selected {
|
|
738
|
+
background: var(--matcher-card-color);
|
|
739
|
+
border-color: var(--matcher-card-color);
|
|
740
|
+
color: var(--matcher-card-text-color, #1a1a1a);
|
|
741
|
+
transform: translateY(-3px);
|
|
742
|
+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/* Force all nested text descendants to inherit the button's color so
|
|
746
|
+
validation/assignment colors aren't masked by their own color rules. */
|
|
747
|
+
|
|
748
|
+
.matcher-card--selected * {
|
|
749
|
+
color: inherit;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
.matcher-card--selected:hover {
|
|
753
|
+
border-color: var(--exercise-accent, #705dc0);
|
|
754
|
+
filter: brightness(1.07);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
.matcher-card--selected:active {
|
|
758
|
+
transform: scale(0.96) translateY(0);
|
|
759
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
|
|
760
|
+
filter: none;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
.matcher-widget.widget--correct .matcher-card--selected {
|
|
764
|
+
background: var(--exercise-correct, #22c55e);
|
|
765
|
+
border-color: var(--exercise-correct, #22c55e);
|
|
766
|
+
color: #fff;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
.matcher-widget.widget--correct .matcher-card:not(.matcher-card--selected) {
|
|
770
|
+
border-color: var(--exercise-correct, #22c55e);
|
|
771
|
+
opacity: 0.5;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
.matcher-widget.widget--incorrect .matcher-card--selected {
|
|
775
|
+
background: var(--exercise-incorrect, #ef4444);
|
|
776
|
+
border-color: var(--exercise-incorrect, #ef4444);
|
|
777
|
+
color: #fff;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
.matcher-widget.widget--incorrect .matcher-card:not(.matcher-card--selected) {
|
|
781
|
+
border-color: var(--exercise-incorrect, #ef4444);
|
|
782
|
+
opacity: 0.5;
|
|
783
|
+
}
|
|
784
|
+
|
|
671
785
|
/**
|
|
672
786
|
* Number Line Styles
|
|
673
787
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mathscan/math-exercise-engine",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
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",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"@dnd-kit/core": "^6.3.1",
|
|
49
49
|
"@dnd-kit/utilities": "^3.2.2",
|
|
50
50
|
"chevrotain": "^11.0.3",
|
|
51
|
+
"lodash": "^4.17.21",
|
|
51
52
|
"mathjs": "^12.4.0",
|
|
52
53
|
"zod": "^3.22.4"
|
|
53
54
|
},
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"@testing-library/jest-dom": "^6.9.1",
|
|
68
69
|
"@testing-library/react": "^16.3.2",
|
|
69
70
|
"@testing-library/user-event": "^14.6.1",
|
|
71
|
+
"@types/lodash": "^4.17.24",
|
|
70
72
|
"@types/node": "^20.11.0",
|
|
71
73
|
"@types/react": "^19.0.0",
|
|
72
74
|
"@types/react-dom": "^19.0.0",
|