@khanacademy/perseus 20.4.0 → 20.4.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/es/index.js +48 -11
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +48 -11
- package/dist/index.js.map +1 -1
- package/dist/widgets/interactive-graphs/graphs/index.d.ts +1 -0
- package/dist/widgets/interactive-graphs/graphs/ray.d.ts +5 -0
- package/dist/widgets/interactive-graphs/graphs/types.d.ts +2 -2
- package/dist/widgets/interactive-graphs/types.d.ts +5 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28571,7 +28571,8 @@ const LinearGraph = props => {
|
|
|
28571
28571
|
};
|
|
28572
28572
|
const LineView = props => {
|
|
28573
28573
|
const {
|
|
28574
|
-
onMoveLine
|
|
28574
|
+
onMoveLine,
|
|
28575
|
+
onMovePoint,
|
|
28575
28576
|
collinearPair: [start, end],
|
|
28576
28577
|
range,
|
|
28577
28578
|
stroke
|
|
@@ -28579,7 +28580,7 @@ const LineView = props => {
|
|
|
28579
28580
|
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(MovableLine, {
|
|
28580
28581
|
start: start,
|
|
28581
28582
|
end: end,
|
|
28582
|
-
onMove:
|
|
28583
|
+
onMove: onMoveLine,
|
|
28583
28584
|
extend: {
|
|
28584
28585
|
start: true,
|
|
28585
28586
|
end: true,
|
|
@@ -28589,18 +28590,49 @@ const LineView = props => {
|
|
|
28589
28590
|
}), /*#__PURE__*/React__namespace.createElement(StyledMovablePoint, {
|
|
28590
28591
|
point: start,
|
|
28591
28592
|
onMove: newPoint => {
|
|
28592
|
-
|
|
28593
|
+
onMovePoint(0, newPoint);
|
|
28593
28594
|
},
|
|
28594
28595
|
color: stroke
|
|
28595
28596
|
}), /*#__PURE__*/React__namespace.createElement(StyledMovablePoint, {
|
|
28596
28597
|
point: end,
|
|
28597
28598
|
onMove: newPoint => {
|
|
28598
|
-
|
|
28599
|
+
onMovePoint(1, newPoint);
|
|
28599
28600
|
},
|
|
28600
28601
|
color: stroke
|
|
28601
28602
|
}));
|
|
28602
28603
|
};
|
|
28603
28604
|
|
|
28605
|
+
const RayGraph = props => {
|
|
28606
|
+
const {
|
|
28607
|
+
dispatch
|
|
28608
|
+
} = props;
|
|
28609
|
+
const {
|
|
28610
|
+
coords: lines,
|
|
28611
|
+
range
|
|
28612
|
+
} = props.graphState;
|
|
28613
|
+
|
|
28614
|
+
// a ray only has one line
|
|
28615
|
+
const [start, end] = lines[0];
|
|
28616
|
+
const handleMoveLine = delta => dispatch(moveSegment(0, delta));
|
|
28617
|
+
const handleMovePoint = (newPoint, pointIndex) => dispatch(moveControlPoint(0, pointIndex, newPoint));
|
|
28618
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(MovableLine, {
|
|
28619
|
+
start: start,
|
|
28620
|
+
end: end,
|
|
28621
|
+
onMove: handleMoveLine,
|
|
28622
|
+
extend: {
|
|
28623
|
+
end: true,
|
|
28624
|
+
start: false,
|
|
28625
|
+
range
|
|
28626
|
+
}
|
|
28627
|
+
}), /*#__PURE__*/React__namespace.createElement(StyledMovablePoint, {
|
|
28628
|
+
point: start,
|
|
28629
|
+
onMove: newPoint => handleMovePoint(newPoint, 0)
|
|
28630
|
+
}), /*#__PURE__*/React__namespace.createElement(StyledMovablePoint, {
|
|
28631
|
+
point: end,
|
|
28632
|
+
onMove: newPoint => handleMovePoint(newPoint, 1)
|
|
28633
|
+
}));
|
|
28634
|
+
};
|
|
28635
|
+
|
|
28604
28636
|
const renderLineLabel = (n, _ref) => {
|
|
28605
28637
|
let [min, max] = _ref;
|
|
28606
28638
|
return n !== -1 && n !== min && n !== max;
|
|
@@ -28725,11 +28757,11 @@ function updateAtIndex(args) {
|
|
|
28725
28757
|
}
|
|
28726
28758
|
function setAtIndex(args) {
|
|
28727
28759
|
const {
|
|
28728
|
-
array,
|
|
28760
|
+
array = [],
|
|
28729
28761
|
index,
|
|
28730
28762
|
newValue
|
|
28731
28763
|
} = args;
|
|
28732
|
-
const copy = [...
|
|
28764
|
+
const copy = [...array];
|
|
28733
28765
|
copy[index] = newValue;
|
|
28734
28766
|
// restoring readonly to array
|
|
28735
28767
|
return copy;
|
|
@@ -28775,16 +28807,16 @@ function initializeGraphState(params) {
|
|
|
28775
28807
|
range
|
|
28776
28808
|
})
|
|
28777
28809
|
};
|
|
28778
|
-
// Ray can also fall through into this case-- same type, same default coords
|
|
28779
28810
|
case "linear":
|
|
28780
28811
|
case "linear-system":
|
|
28812
|
+
case "ray":
|
|
28781
28813
|
return {
|
|
28782
28814
|
type: graph.type,
|
|
28783
28815
|
hasBeenInteractedWith: false,
|
|
28784
28816
|
range,
|
|
28785
28817
|
snapStep,
|
|
28786
|
-
//
|
|
28787
|
-
// system has two tuples of points.
|
|
28818
|
+
// Linear and ray graphs have a single tuple of points, while a
|
|
28819
|
+
// linear system has two tuples of points.
|
|
28788
28820
|
coords: getLineCoords(graph, range, step)
|
|
28789
28821
|
};
|
|
28790
28822
|
}
|
|
@@ -28829,9 +28861,9 @@ function getGradableGraph(state, initialGraph) {
|
|
|
28829
28861
|
...initialGraph,
|
|
28830
28862
|
coords: state.coords
|
|
28831
28863
|
};
|
|
28832
|
-
// RAY has the same type as below; can fall through
|
|
28833
28864
|
// coords: CollinearTuple
|
|
28834
28865
|
case state.type === "linear" && initialGraph.type === "linear":
|
|
28866
|
+
case state.type === "ray" && initialGraph.type === "ray":
|
|
28835
28867
|
return {
|
|
28836
28868
|
...initialGraph,
|
|
28837
28869
|
coords: state.coords?.[0]
|
|
@@ -29556,6 +29588,11 @@ const renderGraph = props => {
|
|
|
29556
29588
|
graphState: state,
|
|
29557
29589
|
dispatch: dispatch
|
|
29558
29590
|
});
|
|
29591
|
+
case "ray":
|
|
29592
|
+
return /*#__PURE__*/React__namespace.createElement(RayGraph, {
|
|
29593
|
+
graphState: state,
|
|
29594
|
+
dispatch: dispatch
|
|
29595
|
+
});
|
|
29559
29596
|
default:
|
|
29560
29597
|
return new wonderStuffCore.UnreachableCaseError(type);
|
|
29561
29598
|
}
|
|
@@ -41568,7 +41605,7 @@ const init = function (options) {
|
|
|
41568
41605
|
|
|
41569
41606
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41570
41607
|
const libName = "@khanacademy/perseus";
|
|
41571
|
-
const libVersion = "20.4.
|
|
41608
|
+
const libVersion = "20.4.1";
|
|
41572
41609
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41573
41610
|
|
|
41574
41611
|
const apiVersion = {
|