@pie-lib/graphing 4.0.5-next.23 → 4.0.5-next.27
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/lib/container/index.js
CHANGED
|
@@ -84,7 +84,16 @@ var Root = /*#__PURE__*/function (_React$Component) {
|
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
if (!(0, _lodashEs.isEqual)(prevProps.marks, marks)) {
|
|
87
|
-
|
|
87
|
+
// Don't dispatch marks that have correctness (evaluate mode marks) into the undo history.
|
|
88
|
+
// These marks are already handled in render() via the correctnessSet path and bypass the
|
|
89
|
+
// Redux store entirely. Dispatching them would pollute the undo history and cause the graph
|
|
90
|
+
// to show the correct answer when the user presses undo after returning to gather mode.
|
|
91
|
+
var hasCorrectness = marks && marks.find(function (m) {
|
|
92
|
+
return m.correctness;
|
|
93
|
+
});
|
|
94
|
+
if (!hasCorrectness) {
|
|
95
|
+
this.store.dispatch((0, _actions.changeMarks)(marks));
|
|
96
|
+
}
|
|
88
97
|
}
|
|
89
98
|
}
|
|
90
99
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_reactRedux","require","_react","_interopRequireDefault","_redux","_reducer","_actions","_propTypes","_lodashEs","_reduxUndo","_graphWithControls","_middleware","_excluded","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","mapStateToProps","s","marks","present","mapDispatchToProps","dispatch","onChangeMarks","m","changeMarks","onUndo","ActionCreators","undo","onRedo","redo","onReset","GraphContainer","exports","connect","GraphWithControls","Root","_React$Component","props","_this","_classCallCheck2","_defineProperty2","_this$props","storeState","store","getState","isEqual","r","reducer","createStore","applyMiddleware","lastActionMiddleware","subscribe","onStoreChange","_inherits2","_createClass2","key","value","componentDidUpdate","prevProps","render","_this$props2","rest","_objectWithoutProperties2","correctnessSet","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_reactRedux","require","_react","_interopRequireDefault","_redux","_reducer","_actions","_propTypes","_lodashEs","_reduxUndo","_graphWithControls","_middleware","_excluded","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","mapStateToProps","s","marks","present","mapDispatchToProps","dispatch","onChangeMarks","m","changeMarks","onUndo","ActionCreators","undo","onRedo","redo","onReset","GraphContainer","exports","connect","GraphWithControls","Root","_React$Component","props","_this","_classCallCheck2","_defineProperty2","_this$props","storeState","store","getState","isEqual","r","reducer","createStore","applyMiddleware","lastActionMiddleware","subscribe","onStoreChange","_inherits2","_createClass2","key","value","componentDidUpdate","prevProps","hasCorrectness","find","correctness","render","_this$props2","rest","_objectWithoutProperties2","correctnessSet","createElement","_extends2","disabled","Provider","React","Component","PropTypes","func","array","_default"],"sources":["../../src/container/index.jsx"],"sourcesContent":["import { connect, Provider } from 'react-redux';\nimport React from 'react';\nimport { applyMiddleware, createStore } from 'redux';\nimport reducer from './reducer';\nimport { changeMarks } from './actions';\nimport PropTypes from 'prop-types';\nimport { isEqual } from 'lodash-es';\nimport { ActionCreators } from 'redux-undo';\nimport GraphWithControls from '../graph-with-controls';\nimport { lastActionMiddleware } from './middleware';\n\nconst mapStateToProps = (s) => ({\n marks: s.marks.present,\n});\n\nconst mapDispatchToProps = (dispatch) => ({\n onChangeMarks: (m) => dispatch(changeMarks(m)),\n onUndo: () => dispatch(ActionCreators.undo()),\n onRedo: () => dispatch(ActionCreators.redo()),\n onReset: () => dispatch(changeMarks([])),\n});\n\nexport const GraphContainer = connect(mapStateToProps, mapDispatchToProps)(GraphWithControls);\n\n/**\n * The graph component entry point with undo/redo\n * Redux is an implementation detail, hide it in the react component.\n */\nclass Root extends React.Component {\n static propTypes = {\n onChangeMarks: PropTypes.func,\n marks: PropTypes.array,\n };\n\n constructor(props) {\n super(props);\n\n const r = reducer();\n this.store = createStore(r, { marks: props.marks }, applyMiddleware(lastActionMiddleware));\n\n this.store.subscribe(this.onStoreChange);\n }\n\n componentDidUpdate(prevProps) {\n const { marks } = this.props;\n const storeState = this.store.getState();\n\n if (isEqual(storeState.marks.present, marks)) {\n return;\n }\n\n if (!isEqual(prevProps.marks, marks)) {\n // Don't dispatch marks that have correctness (evaluate mode marks) into the undo history.\n // These marks are already handled in render() via the correctnessSet path and bypass the\n // Redux store entirely. Dispatching them would pollute the undo history and cause the graph\n // to show the correct answer when the user presses undo after returning to gather mode.\n const hasCorrectness = marks && marks.find((m) => m.correctness);\n\n if (!hasCorrectness) {\n this.store.dispatch(changeMarks(marks));\n }\n }\n }\n\n onStoreChange = () => {\n const { marks, onChangeMarks } = this.props;\n const storeState = this.store.getState();\n\n if (!isEqual(storeState.marks.present, marks)) {\n onChangeMarks(storeState.marks.present);\n }\n };\n\n render() {\n // eslint-disable-next-line no-unused-vars\n const { onChangeMarks, marks, ...rest } = this.props;\n const correctnessSet = marks && marks.find((m) => m.correctness);\n\n if (correctnessSet) {\n return <GraphWithControls {...rest} marks={marks} disabled={correctnessSet} />;\n }\n\n return (\n <Provider store={this.store}>\n <GraphContainer {...rest} />\n </Provider>\n );\n }\n}\n\nexport default Root;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAAoD,IAAAW,SAAA;AAAA,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,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AAA,IAAAhC,gBAAA,aAA5BL,IAAI,eACW;EACjBb,aAAa,EAAEmD,qBAAS,CAACC,IAAI;EAC7BxD,KAAK,EAAEuD,qBAAS,CAACE;AACnB,CAAC;AAAA,IAAAC,QAAA,GAAA5C,OAAA,cA0DYG,IAAI","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "4.0.5-next.
|
|
6
|
+
"version": "4.0.5-next.27+cce15b2d0",
|
|
7
7
|
"description": "Graphing components",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"react",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"@mui/icons-material": "^7.3.4",
|
|
24
24
|
"@mui/material": "^7.3.4",
|
|
25
25
|
"@pie-lib/drag": "^4.0.2",
|
|
26
|
-
"@pie-lib/editable-html-tip-tap": "^2.1.
|
|
26
|
+
"@pie-lib/editable-html-tip-tap": "^2.1.1",
|
|
27
27
|
"@pie-lib/graphing-utils": "^3.0.2",
|
|
28
|
-
"@pie-lib/plot": "^4.0.
|
|
28
|
+
"@pie-lib/plot": "^4.0.3",
|
|
29
29
|
"@pie-lib/render-ui": "^6.1.0",
|
|
30
30
|
"@pie-lib/translator": "^4.0.2",
|
|
31
31
|
"@visx/axis": "^3.0.0",
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"react": "^18.2.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "cce15b2d04c8573360a6695572394e737447e65e",
|
|
58
58
|
"scripts": {}
|
|
59
59
|
}
|
package/src/container/index.jsx
CHANGED
|
@@ -50,7 +50,15 @@ class Root extends React.Component {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
if (!isEqual(prevProps.marks, marks)) {
|
|
53
|
-
|
|
53
|
+
// Don't dispatch marks that have correctness (evaluate mode marks) into the undo history.
|
|
54
|
+
// These marks are already handled in render() via the correctnessSet path and bypass the
|
|
55
|
+
// Redux store entirely. Dispatching them would pollute the undo history and cause the graph
|
|
56
|
+
// to show the correct answer when the user presses undo after returning to gather mode.
|
|
57
|
+
const hasCorrectness = marks && marks.find((m) => m.correctness);
|
|
58
|
+
|
|
59
|
+
if (!hasCorrectness) {
|
|
60
|
+
this.store.dispatch(changeMarks(marks));
|
|
61
|
+
}
|
|
54
62
|
}
|
|
55
63
|
}
|
|
56
64
|
|