@khanacademy/perseus-editor 18.1.0 → 18.2.0
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 +33 -5
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +34 -5
- package/dist/index.js.map +1 -1
- package/dist/widgets/interactive-graph-editor/components/interactive-graph-settings.d.ts +11 -1
- package/dist/widgets/interactive-graph-editor/interactive-graph-editor.d.ts +377 -42
- package/package.json +8 -8
package/dist/es/index.js
CHANGED
|
@@ -95,7 +95,7 @@ const addLibraryVersionToPerseusDebug = (libraryName, libraryVersion) => {
|
|
|
95
95
|
|
|
96
96
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
97
97
|
const libName = "@khanacademy/perseus-editor";
|
|
98
|
-
const libVersion = "18.
|
|
98
|
+
const libVersion = "18.2.0";
|
|
99
99
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
100
100
|
|
|
101
101
|
const devices = {
|
|
@@ -11007,6 +11007,7 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
11007
11007
|
static stateFromProps(props) {
|
|
11008
11008
|
return {
|
|
11009
11009
|
labelsTextbox: props.labels,
|
|
11010
|
+
labelLocation: props.labelLocation,
|
|
11010
11011
|
gridStepTextbox: props.gridStep,
|
|
11011
11012
|
snapStepTextbox: props.snapStep,
|
|
11012
11013
|
stepTextbox: props.step,
|
|
@@ -11212,6 +11213,7 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
11212
11213
|
};
|
|
11213
11214
|
this.changeGraph = () => {
|
|
11214
11215
|
const labels = this.state.labelsTextbox;
|
|
11216
|
+
const labelLocation = this.state.labelLocation;
|
|
11215
11217
|
const range = _.map(this.state.rangeTextbox, function (range) {
|
|
11216
11218
|
return _.map(range, Number);
|
|
11217
11219
|
});
|
|
@@ -11231,6 +11233,7 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
11231
11233
|
this.change({
|
|
11232
11234
|
valid: true,
|
|
11233
11235
|
labels: labels,
|
|
11236
|
+
labelLocation: labelLocation,
|
|
11234
11237
|
range: range,
|
|
11235
11238
|
step: step,
|
|
11236
11239
|
gridStep: gridStep,
|
|
@@ -11254,7 +11257,7 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
11254
11257
|
this.changeGraph = _.debounce(this.changeGraph, 300);
|
|
11255
11258
|
}
|
|
11256
11259
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
11257
|
-
if (!_.isEqual(this.props.labels, nextProps.labels) || !_.isEqual(this.props.gridStep, nextProps.gridStep) || !_.isEqual(this.props.snapStep, nextProps.snapStep) || !_.isEqual(this.props.step, nextProps.step) || !_.isEqual(this.props.range, nextProps.range) || !_.isEqual(this.props.backgroundImage, nextProps.backgroundImage)) {
|
|
11260
|
+
if (!_.isEqual(this.props.labels, nextProps.labels) || !_.isEqual(this.props.labelLocation, nextProps.labelLocation) || !_.isEqual(this.props.gridStep, nextProps.gridStep) || !_.isEqual(this.props.snapStep, nextProps.snapStep) || !_.isEqual(this.props.step, nextProps.step) || !_.isEqual(this.props.range, nextProps.range) || !_.isEqual(this.props.backgroundImage, nextProps.backgroundImage)) {
|
|
11258
11261
|
this.setState(InteractiveGraphSettings.stateFromProps(nextProps));
|
|
11259
11262
|
}
|
|
11260
11263
|
}
|
|
@@ -11273,6 +11276,21 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
11273
11276
|
className: "graph-settings"
|
|
11274
11277
|
}, /*#__PURE__*/React.createElement("div", {
|
|
11275
11278
|
className: "perseus-widget-row"
|
|
11279
|
+
}, /*#__PURE__*/React.createElement(LabeledRow, {
|
|
11280
|
+
label: "Label Location"
|
|
11281
|
+
}, /*#__PURE__*/React.createElement(ButtonGroup$1, {
|
|
11282
|
+
value: this.props.labelLocation,
|
|
11283
|
+
allowEmpty: false,
|
|
11284
|
+
buttons: [{
|
|
11285
|
+
value: "onAxis",
|
|
11286
|
+
content: "On Axis"
|
|
11287
|
+
}, {
|
|
11288
|
+
value: "alongEdge",
|
|
11289
|
+
content: "Along Graph Edge"
|
|
11290
|
+
}],
|
|
11291
|
+
onChange: this.change("labelLocation")
|
|
11292
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
11293
|
+
className: "perseus-widget-row"
|
|
11276
11294
|
}, /*#__PURE__*/React.createElement("div", {
|
|
11277
11295
|
className: "perseus-widget-left-col"
|
|
11278
11296
|
}, /*#__PURE__*/React.createElement(LabeledRow, {
|
|
@@ -11411,6 +11429,7 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
11411
11429
|
InteractiveGraphSettings.defaultProps = {
|
|
11412
11430
|
box: [interactiveSizes.defaultBoxSizeSmall, interactiveSizes.defaultBoxSizeSmall],
|
|
11413
11431
|
labels: ["$x$", "$y$"],
|
|
11432
|
+
labelLocation: "onAxis",
|
|
11414
11433
|
range: [[-10, 10], [-10, 10]],
|
|
11415
11434
|
step: [1, 1],
|
|
11416
11435
|
gridStep: [1, 1],
|
|
@@ -14938,7 +14957,7 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
14938
14957
|
// is copied from the question editor and pasted into the hint editor
|
|
14939
14958
|
// (double brackets in the markdown).
|
|
14940
14959
|
serialize() {
|
|
14941
|
-
const json = _.pick(this.props, "step", "backgroundImage", "markings", "labels", "showProtractor", "showTooltips", "range", "gridStep", "snapStep", "lockedFigures", "fullGraphAriaLabel", "fullGraphAriaDescription");
|
|
14960
|
+
const json = _.pick(this.props, "step", "backgroundImage", "markings", "labels", "labelLocation", "showProtractor", "showTooltips", "range", "gridStep", "snapStep", "lockedFigures", "fullGraphAriaLabel", "fullGraphAriaDescription");
|
|
14942
14961
|
|
|
14943
14962
|
// eslint-disable-next-line react/no-string-refs
|
|
14944
14963
|
const graph = this.refs.graph;
|
|
@@ -14977,6 +14996,7 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
14977
14996
|
box: this.props.box,
|
|
14978
14997
|
range: this.props.range,
|
|
14979
14998
|
labels: this.props.labels,
|
|
14999
|
+
labelLocation: this.props.labelLocation,
|
|
14980
15000
|
step: this.props.step,
|
|
14981
15001
|
gridStep: gridStep,
|
|
14982
15002
|
snapStep: snapStep,
|
|
@@ -15240,6 +15260,7 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
15240
15260
|
box: getInteractiveBoxFromSizeClass(sizeClass),
|
|
15241
15261
|
range: this.props.range,
|
|
15242
15262
|
labels: this.props.labels,
|
|
15263
|
+
labelLocation: this.props.labelLocation,
|
|
15243
15264
|
step: this.props.step,
|
|
15244
15265
|
gridStep: gridStep,
|
|
15245
15266
|
snapStep: snapStep,
|
|
@@ -18789,7 +18810,10 @@ class RadioEditor extends React.Component {
|
|
|
18789
18810
|
this.props.onChange({
|
|
18790
18811
|
choices: choices,
|
|
18791
18812
|
numCorrect: deriveNumCorrect(_extends({}, this.props, {
|
|
18792
|
-
choices
|
|
18813
|
+
choices,
|
|
18814
|
+
// When deriving numCorrect, we don't want to pass the current value,
|
|
18815
|
+
// as it has changed.
|
|
18816
|
+
numCorrect: undefined
|
|
18793
18817
|
}))
|
|
18794
18818
|
});
|
|
18795
18819
|
};
|
|
@@ -18877,7 +18901,11 @@ class RadioEditor extends React.Component {
|
|
|
18877
18901
|
displayCount,
|
|
18878
18902
|
hasNoneOfTheAbove,
|
|
18879
18903
|
deselectEnabled,
|
|
18880
|
-
numCorrect: deriveNumCorrect(this.props
|
|
18904
|
+
numCorrect: deriveNumCorrect(_extends({}, this.props, {
|
|
18905
|
+
// When deriving numCorrect, we don't want to pass the current value,
|
|
18906
|
+
// as it has changed.
|
|
18907
|
+
numCorrect: undefined
|
|
18908
|
+
}))
|
|
18881
18909
|
};
|
|
18882
18910
|
}
|
|
18883
18911
|
render() {
|