@mathscan/math-exercise-engine 1.1.0 → 1.1.1
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.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -1
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +47 -77
- package/package.json +1 -1
package/dist/style.css
CHANGED
|
@@ -421,10 +421,6 @@ mark {
|
|
|
421
421
|
DRAG OPTIONS
|
|
422
422
|
======================================== */
|
|
423
423
|
|
|
424
|
-
.drag-options-container {
|
|
425
|
-
/* Container for drag options widget */
|
|
426
|
-
}
|
|
427
|
-
|
|
428
424
|
.drag-options {
|
|
429
425
|
display: flex;
|
|
430
426
|
justify-content: center;
|
|
@@ -737,10 +733,10 @@ th.exercise-table-cell {
|
|
|
737
733
|
--visual-fraction-svg-line-width: 0.5px;
|
|
738
734
|
--visual-fraction-gap: var(--visual-fraction-line-width);
|
|
739
735
|
--visual-fraction-border-radius: 0;
|
|
740
|
-
--visual-fraction-border-color: #
|
|
736
|
+
--visual-fraction-border-color: #705dc0;
|
|
741
737
|
--visual-fraction-empty-bg: var(--exercise-bg, #fff);
|
|
742
|
-
--visual-fraction-hover-color: #
|
|
743
|
-
--visual-fraction-part-color: #
|
|
738
|
+
--visual-fraction-hover-color: #e6e0ff;
|
|
739
|
+
--visual-fraction-part-color: #ae9cff;
|
|
744
740
|
--visual-fraction-part-text-color: #fff;
|
|
745
741
|
--visual-fraction-label-color: var(--exercise-text-light, #555);
|
|
746
742
|
display: inline-flex;
|
|
@@ -778,18 +774,21 @@ th.exercise-table-cell {
|
|
|
778
774
|
min-height: 0;
|
|
779
775
|
background: var(--visual-fraction-empty-bg);
|
|
780
776
|
color: var(--exercise-text, #333);
|
|
781
|
-
transition:
|
|
777
|
+
transition:
|
|
778
|
+
background 0.2s ease,
|
|
779
|
+
border-color 0.2s ease,
|
|
780
|
+
filter 0.2s ease;
|
|
782
781
|
}
|
|
783
782
|
|
|
784
|
-
.visual-fraction-widget__part[role=
|
|
783
|
+
.visual-fraction-widget__part[role='button'] {
|
|
785
784
|
cursor: pointer;
|
|
786
785
|
}
|
|
787
786
|
|
|
788
|
-
.visual-fraction-widget__part[role=
|
|
787
|
+
.visual-fraction-widget__part[role='button']:hover {
|
|
789
788
|
background: var(--visual-fraction-hover-color);
|
|
790
789
|
}
|
|
791
790
|
|
|
792
|
-
.visual-fraction-widget__part[role=
|
|
791
|
+
.visual-fraction-widget__part[role='button']:focus-visible {
|
|
793
792
|
outline: 2px solid var(--exercise-border-focus, var(--exercise-primary, #007acc));
|
|
794
793
|
outline-offset: -2px;
|
|
795
794
|
}
|
|
@@ -800,8 +799,8 @@ th.exercise-table-cell {
|
|
|
800
799
|
color: var(--visual-fraction-part-text-color);
|
|
801
800
|
}
|
|
802
801
|
|
|
803
|
-
.visual-fraction-widget__part--filled[role=
|
|
804
|
-
.visual-fraction-widget__part--answer[role=
|
|
802
|
+
.visual-fraction-widget__part--filled[role='button']:hover,
|
|
803
|
+
.visual-fraction-widget__part--answer[role='button']:hover {
|
|
805
804
|
background: var(--visual-fraction-part-color);
|
|
806
805
|
color: var(--visual-fraction-part-text-color);
|
|
807
806
|
}
|
|
@@ -812,26 +811,28 @@ th.exercise-table-cell {
|
|
|
812
811
|
stroke-width: var(--visual-fraction-svg-line-width);
|
|
813
812
|
stroke-linejoin: round;
|
|
814
813
|
stroke-linecap: round;
|
|
815
|
-
transition:
|
|
814
|
+
transition:
|
|
815
|
+
fill 0.2s ease,
|
|
816
|
+
filter 0.2s ease;
|
|
816
817
|
}
|
|
817
818
|
|
|
818
|
-
.visual-fraction-widget__sector[role=
|
|
819
|
+
.visual-fraction-widget__sector[role='button'] {
|
|
819
820
|
cursor: pointer;
|
|
820
821
|
}
|
|
821
822
|
|
|
822
|
-
.visual-fraction-widget__sector[role=
|
|
823
|
+
.visual-fraction-widget__sector[role='button']:hover {
|
|
823
824
|
fill: var(--visual-fraction-hover-color);
|
|
824
825
|
}
|
|
825
826
|
|
|
826
|
-
.visual-fraction-widget__sector[role=
|
|
827
|
+
.visual-fraction-widget__sector[role='button']:focus-visible {
|
|
827
828
|
outline: none;
|
|
828
829
|
filter: drop-shadow(0 0 0.18rem var(--exercise-border-focus, var(--exercise-primary, #007acc)));
|
|
829
830
|
}
|
|
830
831
|
|
|
831
832
|
.visual-fraction-widget__sector.visual-fraction-widget__part--filled,
|
|
832
833
|
.visual-fraction-widget__sector.visual-fraction-widget__part--answer,
|
|
833
|
-
.visual-fraction-widget__sector.visual-fraction-widget__part--filled[role=
|
|
834
|
-
.visual-fraction-widget__sector.visual-fraction-widget__part--answer[role=
|
|
834
|
+
.visual-fraction-widget__sector.visual-fraction-widget__part--filled[role='button']:hover,
|
|
835
|
+
.visual-fraction-widget__sector.visual-fraction-widget__part--answer[role='button']:hover {
|
|
835
836
|
fill: var(--visual-fraction-part-color);
|
|
836
837
|
}
|
|
837
838
|
|
|
@@ -896,9 +897,9 @@ th.exercise-table-cell {
|
|
|
896
897
|
justify-content: center;
|
|
897
898
|
min-height: clamp(72px, 14vw, 96px);
|
|
898
899
|
padding: clamp(8px, 2vw, 12px);
|
|
899
|
-
border: 2px solid #
|
|
900
|
+
border: 2px solid #ffca76;
|
|
900
901
|
border-radius: clamp(12px, 3vw, 17px);
|
|
901
|
-
background: #
|
|
902
|
+
background: #ffffff;
|
|
902
903
|
color: #333333;
|
|
903
904
|
text-align: center;
|
|
904
905
|
cursor: pointer;
|
|
@@ -921,21 +922,21 @@ th.exercise-table-cell {
|
|
|
921
922
|
} */
|
|
922
923
|
|
|
923
924
|
.matcher-card--selected {
|
|
924
|
-
background: color-mix(in srgb, var(--matcher-card-color) 12%, #
|
|
925
|
+
background: color-mix(in srgb, var(--matcher-card-color) 12%, #ffffff);
|
|
925
926
|
border-color: var(--matcher-card-color);
|
|
926
927
|
box-shadow: 0 4px 0 color-mix(in srgb, var(--matcher-card-color) 30%, transparent);
|
|
927
928
|
transform: scale(1.04);
|
|
928
929
|
}
|
|
929
930
|
|
|
930
931
|
.widget--correct .matcher-card--selected {
|
|
931
|
-
border-color: #
|
|
932
|
-
background: #
|
|
933
|
-
box-shadow: 0 4px 0 rgba(67, 185, 37, 0.
|
|
932
|
+
border-color: #43b925;
|
|
933
|
+
background: #f2ffee;
|
|
934
|
+
box-shadow: 0 4px 0 rgba(67, 185, 37, 0.3);
|
|
934
935
|
}
|
|
935
936
|
|
|
936
937
|
.widget--incorrect .matcher-card--selected {
|
|
937
|
-
border-color: #
|
|
938
|
-
background: #
|
|
938
|
+
border-color: #d6234d;
|
|
939
|
+
background: #fff0f7;
|
|
939
940
|
box-shadow: 0 4px 0 rgba(214, 35, 77, 0.25);
|
|
940
941
|
}
|
|
941
942
|
|
|
@@ -1544,7 +1545,9 @@ th.exercise-table-cell {
|
|
|
1544
1545
|
}
|
|
1545
1546
|
|
|
1546
1547
|
.draggable.dragging {
|
|
1547
|
-
|
|
1548
|
+
/* Hide original while drag overlay follows cursor to avoid duplicate render.
|
|
1549
|
+
visibility:hidden preserves layout space so neighbors don't shift. */
|
|
1550
|
+
visibility: hidden;
|
|
1548
1551
|
}
|
|
1549
1552
|
|
|
1550
1553
|
/* Droppable base */
|
|
@@ -1564,53 +1567,31 @@ th.exercise-table-cell {
|
|
|
1564
1567
|
outline-offset: 2px;
|
|
1565
1568
|
}
|
|
1566
1569
|
|
|
1567
|
-
/* Drag overlay - the item following cursor
|
|
1570
|
+
/* Drag overlay - the item following cursor. Matches the rendered button look,
|
|
1571
|
+
which is the `button.drag-option` legacy rule in styles/widgets.css
|
|
1572
|
+
(accent background + white text, no border).
|
|
1573
|
+
NOTE: @dnd-kit DragOverlay renders in a portal at document.body, outside
|
|
1574
|
+
the .math-exercise-renderer scope — so CSS vars must include fallbacks. */
|
|
1568
1575
|
.drag-overlay-option {
|
|
1569
|
-
padding:
|
|
1570
|
-
|
|
1576
|
+
padding: 10px 16px;
|
|
1577
|
+
border: none;
|
|
1578
|
+
border-radius: var(--exercise-border-radius, 0.25rem);
|
|
1579
|
+
background: var(--exercise-accent, #705DC0);
|
|
1571
1580
|
color: white;
|
|
1572
|
-
|
|
1573
|
-
font-weight: 500;
|
|
1574
|
-
|
|
1581
|
+
font-size: var(--exercise-font-size, clamp(0.875rem, 2vw, 1.1rem));
|
|
1582
|
+
font-weight: var(--exercise-font-weight, 500);
|
|
1583
|
+
min-width: var(--exercise-button-width, clamp(3rem, 6vw, 4rem));
|
|
1584
|
+
text-align: center;
|
|
1575
1585
|
cursor: grabbing;
|
|
1576
1586
|
}
|
|
1577
1587
|
|
|
1578
|
-
/*
|
|
1579
|
-
.
|
|
1580
|
-
display: flex;
|
|
1581
|
-
flex-wrap: wrap;
|
|
1582
|
-
gap: 8px;
|
|
1583
|
-
/* padding: 12px; */
|
|
1584
|
-
/* background: #f5f5f5; */
|
|
1585
|
-
border-radius: 8px;
|
|
1586
|
-
justify-content: center;
|
|
1587
|
-
}
|
|
1588
|
+
/* Note: .drag-options and .drag-option base styles live in styles/widgets.css
|
|
1589
|
+
(themed via CSS vars). Don't duplicate them here. */
|
|
1588
1590
|
|
|
1589
1591
|
.drag-option-wrapper {
|
|
1590
1592
|
display: inline-block;
|
|
1591
1593
|
}
|
|
1592
1594
|
|
|
1593
|
-
.drag-option {
|
|
1594
|
-
padding: 10px 20px;
|
|
1595
|
-
border: 2px solid #ddd;
|
|
1596
|
-
border-radius: 8px;
|
|
1597
|
-
background: white;
|
|
1598
|
-
font-size: 16px;
|
|
1599
|
-
font-weight: 500;
|
|
1600
|
-
cursor: grab;
|
|
1601
|
-
transition: all 0.15s ease;
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
.drag-option:hover {
|
|
1605
|
-
border-color: #4a90d9;
|
|
1606
|
-
background: #f0f7ff;
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
.drag-option.selected {
|
|
1610
|
-
border-color: #4a90d9;
|
|
1611
|
-
background: #e3f0ff;
|
|
1612
|
-
}
|
|
1613
|
-
|
|
1614
1595
|
/* Slot container - maintains space when item is dragged out */
|
|
1615
1596
|
.drag-option-slot {
|
|
1616
1597
|
display: inline-flex;
|
|
@@ -1676,17 +1657,6 @@ th.exercise-table-cell {
|
|
|
1676
1657
|
background-color: rgba(74, 144, 217, 0.05);
|
|
1677
1658
|
}
|
|
1678
1659
|
|
|
1679
|
-
/* Drag options container at bottom */
|
|
1680
|
-
.drag-options-container {
|
|
1681
|
-
/* margin-top: 20px;
|
|
1682
|
-
padding-top: 16px;
|
|
1683
|
-
border-top: 1px solid #eee; */
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
|
-
/* ============================================
|
|
1687
|
-
FUTURE WIDGETS - Placeholder styles
|
|
1688
|
-
============================================ */
|
|
1689
|
-
|
|
1690
1660
|
/* ============================================
|
|
1691
1661
|
DRAGGABLE TOOLS (Ruler, Protractor, etc.)
|
|
1692
1662
|
============================================ */
|
|
@@ -1747,4 +1717,4 @@ th.exercise-table-cell {
|
|
|
1747
1717
|
.math-exercise-renderer {
|
|
1748
1718
|
position: relative;
|
|
1749
1719
|
min-height: 200px;
|
|
1750
|
-
}
|
|
1720
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mathscan/math-exercise-engine",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
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",
|