@khanacademy/perseus 22.5.0 → 22.5.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 +25 -28
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +25 -28
- package/dist/index.js.map +1 -1
- package/dist/widgets/interactive-graphs/mafs-graph.d.ts +12 -4
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-action.d.ts +5 -6
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-state.d.ts +0 -1
- package/dist/widgets/interactive-graphs/types.d.ts +0 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29984,14 +29984,12 @@ function initializeGraphState(params) {
|
|
|
29984
29984
|
graph,
|
|
29985
29985
|
step,
|
|
29986
29986
|
snapStep,
|
|
29987
|
-
range
|
|
29988
|
-
markings
|
|
29987
|
+
range
|
|
29989
29988
|
} = params;
|
|
29990
29989
|
const shared = {
|
|
29991
29990
|
hasBeenInteractedWith: false,
|
|
29992
29991
|
range,
|
|
29993
|
-
snapStep
|
|
29994
|
-
markings
|
|
29992
|
+
snapStep
|
|
29995
29993
|
};
|
|
29996
29994
|
switch (graph.type) {
|
|
29997
29995
|
case "segment":
|
|
@@ -31519,35 +31517,22 @@ function mafsStateToInteractiveGraph(state) {
|
|
|
31519
31517
|
};
|
|
31520
31518
|
}
|
|
31521
31519
|
const StatefulMafsGraph = /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
|
|
31520
|
+
const {
|
|
31521
|
+
onChange
|
|
31522
|
+
} = props;
|
|
31522
31523
|
const [state, dispatch] = React__namespace.useReducer(interactiveGraphReducer, props, initializeGraphState);
|
|
31523
31524
|
React.useImperativeHandle(ref, () => ({
|
|
31524
31525
|
getUserInput: () => getGradableGraph(state, props.graph)
|
|
31525
31526
|
}));
|
|
31526
|
-
function onChange(next) {
|
|
31527
|
-
props.onChange(mafsStateToInteractiveGraph(next));
|
|
31528
|
-
}
|
|
31529
|
-
return /*#__PURE__*/React__namespace.createElement(MafsGraph, _extends({}, props, {
|
|
31530
|
-
state: state,
|
|
31531
|
-
dispatch: dispatch,
|
|
31532
|
-
onChange: onChange
|
|
31533
|
-
}));
|
|
31534
|
-
});
|
|
31535
|
-
const MafsGraph = props => {
|
|
31536
|
-
const {
|
|
31537
|
-
state,
|
|
31538
|
-
dispatch,
|
|
31539
|
-
labels
|
|
31540
|
-
} = props;
|
|
31541
|
-
const [width, height] = props.box;
|
|
31542
31527
|
const prevState = React.useRef(state);
|
|
31543
31528
|
React.useEffect(() => {
|
|
31544
31529
|
if (prevState.current !== state) {
|
|
31545
|
-
|
|
31530
|
+
onChange(mafsStateToInteractiveGraph({
|
|
31546
31531
|
graph: state
|
|
31547
|
-
});
|
|
31532
|
+
}));
|
|
31548
31533
|
}
|
|
31549
31534
|
prevState.current = state;
|
|
31550
|
-
}, [
|
|
31535
|
+
}, [onChange, state]);
|
|
31551
31536
|
|
|
31552
31537
|
// Destructuring first to keep useEffect from making excess calls
|
|
31553
31538
|
const [xSnap, ySnap] = props.snapStep;
|
|
@@ -31560,6 +31545,18 @@ const MafsGraph = props => {
|
|
|
31560
31545
|
React.useEffect(() => {
|
|
31561
31546
|
dispatch(changeRange([[xMinRange, xMaxRange], [yMinRange, yMaxRange]]));
|
|
31562
31547
|
}, [dispatch, xMinRange, xMaxRange, yMinRange, yMaxRange]);
|
|
31548
|
+
return /*#__PURE__*/React__namespace.createElement(MafsGraph, _extends({}, props, {
|
|
31549
|
+
state: state,
|
|
31550
|
+
dispatch: dispatch
|
|
31551
|
+
}));
|
|
31552
|
+
});
|
|
31553
|
+
const MafsGraph = props => {
|
|
31554
|
+
const {
|
|
31555
|
+
state,
|
|
31556
|
+
dispatch,
|
|
31557
|
+
labels
|
|
31558
|
+
} = props;
|
|
31559
|
+
const [width, height] = props.box;
|
|
31563
31560
|
return /*#__PURE__*/React__namespace.createElement(GraphConfigContext.Provider, {
|
|
31564
31561
|
value: {
|
|
31565
31562
|
range: state.range,
|
|
@@ -31592,8 +31589,8 @@ const MafsGraph = props => {
|
|
|
31592
31589
|
}, props.markings === "graph" && /*#__PURE__*/React__namespace.createElement(AxisLabels, null), /*#__PURE__*/React__namespace.createElement(mafs.Mafs, {
|
|
31593
31590
|
preserveAspectRatio: false,
|
|
31594
31591
|
viewBox: {
|
|
31595
|
-
x:
|
|
31596
|
-
y:
|
|
31592
|
+
x: state.range[0],
|
|
31593
|
+
y: state.range[1],
|
|
31597
31594
|
padding: 0
|
|
31598
31595
|
},
|
|
31599
31596
|
pan: false,
|
|
@@ -31603,12 +31600,12 @@ const MafsGraph = props => {
|
|
|
31603
31600
|
}, /*#__PURE__*/React__namespace.createElement(SvgDefs, null), /*#__PURE__*/React__namespace.createElement(Grid, {
|
|
31604
31601
|
tickStep: props.step,
|
|
31605
31602
|
gridStep: props.gridStep,
|
|
31606
|
-
range:
|
|
31603
|
+
range: state.range,
|
|
31607
31604
|
containerSizeClass: props.containerSizeClass,
|
|
31608
31605
|
markings: props.markings
|
|
31609
31606
|
}), props.lockedFigures && /*#__PURE__*/React__namespace.createElement(GraphLockedLayer, {
|
|
31610
31607
|
lockedFigures: props.lockedFigures,
|
|
31611
|
-
range:
|
|
31608
|
+
range: state.range
|
|
31612
31609
|
}), renderGraph({
|
|
31613
31610
|
state,
|
|
31614
31611
|
dispatch
|
|
@@ -43704,7 +43701,7 @@ const init = function (options) {
|
|
|
43704
43701
|
|
|
43705
43702
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
43706
43703
|
const libName = "@khanacademy/perseus";
|
|
43707
|
-
const libVersion = "22.5.
|
|
43704
|
+
const libVersion = "22.5.1";
|
|
43708
43705
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
43709
43706
|
|
|
43710
43707
|
const apiVersion = {
|