@khanacademy/perseus-editor 17.3.0 → 17.3.2
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/components/graph-settings.d.ts +1 -2
- package/dist/es/index.js +17 -66
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +16 -65
- package/dist/index.js.map +1 -1
- package/dist/widgets/interaction-editor/interaction-editor.d.ts +1 -2
- package/dist/widgets/interactive-graph-editor/interactive-graph-editor.d.ts +68 -68
- package/dist/widgets/label-image/marker.d.ts +1 -1
- package/dist/widgets/label-image/question-markers.d.ts +1 -1
- package/dist/widgets/label-image-editor.d.ts +1 -1
- package/package.json +40 -39
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ var KAS = require('@khanacademy/kas');
|
|
|
23
23
|
var Button = require('@khanacademy/wonder-blocks-button');
|
|
24
24
|
var wonderStuffCore = require('@khanacademy/wonder-stuff-core');
|
|
25
25
|
var kmath = require('@khanacademy/kmath');
|
|
26
|
+
var perseusScore = require('@khanacademy/perseus-score');
|
|
26
27
|
var mathInput = require('@khanacademy/math-input');
|
|
27
28
|
var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
|
|
28
29
|
var Banner = require('@khanacademy/wonder-blocks-banner');
|
|
@@ -98,7 +99,7 @@ var arrowCounterClockwise__default = /*#__PURE__*/_interopDefaultLegacy(arrowCou
|
|
|
98
99
|
|
|
99
100
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
100
101
|
const libName = "@khanacademy/perseus-editor";
|
|
101
|
-
const libVersion = "17.3.
|
|
102
|
+
const libVersion = "17.3.2";
|
|
102
103
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
103
104
|
|
|
104
105
|
function _extends() {
|
|
@@ -21212,7 +21213,12 @@ class Editor extends React__namespace.Component {
|
|
|
21212
21213
|
if (!perseus.Widgets.getEditor(type)) {
|
|
21213
21214
|
return;
|
|
21214
21215
|
}
|
|
21215
|
-
return /*#__PURE__*/React__namespace.createElement(WidgetEditor
|
|
21216
|
+
return /*#__PURE__*/React__namespace.createElement(WidgetEditor
|
|
21217
|
+
// The order of props matters here. We need to spread the
|
|
21218
|
+
// widget data before specifying the `key` prop, to ensure the
|
|
21219
|
+
// key overrides any `key` field on the widget (which might not
|
|
21220
|
+
// be unique.
|
|
21221
|
+
, _extends({}, this.props.widgets[id], {
|
|
21216
21222
|
ref: id,
|
|
21217
21223
|
id: id,
|
|
21218
21224
|
key: id
|
|
@@ -21224,7 +21230,7 @@ class Editor extends React__namespace.Component {
|
|
|
21224
21230
|
onRemove: this._handleWidgetEditorRemove.bind(this, id),
|
|
21225
21231
|
apiOptions: this.props.apiOptions,
|
|
21226
21232
|
widgetIsOpen: this.props.widgetIsOpen
|
|
21227
|
-
}
|
|
21233
|
+
}));
|
|
21228
21234
|
}
|
|
21229
21235
|
_handleWidgetEditorChange = (id, newWidgetInfo, cb, silent) => {
|
|
21230
21236
|
const widgets = Object.assign({}, this.props.widgets);
|
|
@@ -26405,7 +26411,6 @@ const {
|
|
|
26405
26411
|
const Grapher = perseus.GrapherWidget.widget;
|
|
26406
26412
|
const {
|
|
26407
26413
|
DEFAULT_GRAPHER_PROPS,
|
|
26408
|
-
allTypes,
|
|
26409
26414
|
chooseType,
|
|
26410
26415
|
defaultPlotProps,
|
|
26411
26416
|
getEquationString,
|
|
@@ -26511,7 +26516,7 @@ class GrapherEditor extends React__namespace.Component {
|
|
|
26511
26516
|
}, /*#__PURE__*/React__namespace.createElement("label", null, "Available functions: "), /*#__PURE__*/React__namespace.createElement(MultiButtonGroup$1, {
|
|
26512
26517
|
allowEmpty: false,
|
|
26513
26518
|
values: this.props.availableTypes,
|
|
26514
|
-
buttons: ___default["default"].map(allTypes, typeToButton),
|
|
26519
|
+
buttons: ___default["default"].map(perseusCore.GrapherUtil.allTypes, typeToButton),
|
|
26515
26520
|
onChange: this.handleAvailableTypesChange
|
|
26516
26521
|
})), graph);
|
|
26517
26522
|
}
|
|
@@ -26990,40 +26995,6 @@ class ImageEditor extends React__namespace.Component {
|
|
|
26990
26995
|
const {
|
|
26991
26996
|
InfoTip: InfoTip$g
|
|
26992
26997
|
} = perseus.components;
|
|
26993
|
-
const answerTypes = {
|
|
26994
|
-
number: {
|
|
26995
|
-
name: "Numbers",
|
|
26996
|
-
forms: "integer, decimal, proper, improper, mixed"
|
|
26997
|
-
},
|
|
26998
|
-
decimal: {
|
|
26999
|
-
name: "Decimals",
|
|
27000
|
-
forms: "decimal"
|
|
27001
|
-
},
|
|
27002
|
-
integer: {
|
|
27003
|
-
name: "Integers",
|
|
27004
|
-
forms: "integer"
|
|
27005
|
-
},
|
|
27006
|
-
rational: {
|
|
27007
|
-
name: "Fractions and mixed numbers",
|
|
27008
|
-
forms: "integer, proper, improper, mixed"
|
|
27009
|
-
},
|
|
27010
|
-
improper: {
|
|
27011
|
-
name: "Improper numbers (no mixed)",
|
|
27012
|
-
forms: "integer, proper, improper"
|
|
27013
|
-
},
|
|
27014
|
-
mixed: {
|
|
27015
|
-
name: "Mixed numbers (no improper)",
|
|
27016
|
-
forms: "integer, proper, mixed"
|
|
27017
|
-
},
|
|
27018
|
-
percent: {
|
|
27019
|
-
name: "Numbers or percents",
|
|
27020
|
-
forms: "integer, decimal, proper, improper, mixed, percent"
|
|
27021
|
-
},
|
|
27022
|
-
pi: {
|
|
27023
|
-
name: "Numbers with pi",
|
|
27024
|
-
forms: "pi"
|
|
27025
|
-
}
|
|
27026
|
-
};
|
|
27027
26998
|
class InputNumberEditor extends React__namespace.Component {
|
|
27028
26999
|
static contextType = perseus.PerseusI18nContext;
|
|
27029
27000
|
static widgetName = "input-number";
|
|
@@ -27057,7 +27028,7 @@ class InputNumberEditor extends React__namespace.Component {
|
|
|
27057
27028
|
rightAlign: this.props.rightAlign
|
|
27058
27029
|
});
|
|
27059
27030
|
render() {
|
|
27060
|
-
const answerTypeOptions = ___default["default"].map(
|
|
27031
|
+
const answerTypeOptions = ___default["default"].map(perseusScore.inputNumberAnswerTypes, function (v, k) {
|
|
27061
27032
|
return /*#__PURE__*/React__namespace.createElement("option", {
|
|
27062
27033
|
value: k,
|
|
27063
27034
|
key: k
|
|
@@ -96493,6 +96464,9 @@ const styles$i = aphrodite.StyleSheet.create({
|
|
|
96493
96464
|
}
|
|
96494
96465
|
});
|
|
96495
96466
|
|
|
96467
|
+
const {
|
|
96468
|
+
getClockwiseAngle
|
|
96469
|
+
} = kmath.angles;
|
|
96496
96470
|
function getStartCoords(graph) {
|
|
96497
96471
|
if ("startCoords" in graph) {
|
|
96498
96472
|
return graph.startCoords;
|
|
@@ -96592,7 +96566,7 @@ const getAngleEquation = function (startCoords) {
|
|
|
96592
96566
|
const vertex = startCoords[1];
|
|
96593
96567
|
|
|
96594
96568
|
// Get the angle in degrees and round it to the nearest whole number
|
|
96595
|
-
const roundedAngle =
|
|
96569
|
+
const roundedAngle = getClockwiseAngle(startCoords, allowReflexAngles).toFixed(0);
|
|
96596
96570
|
return `${roundedAngle}\u00B0 angle at (${vertex[0]}, ${vertex[1]})`;
|
|
96597
96571
|
};
|
|
96598
96572
|
const shouldShowStartCoordsUI = (graph, isStatic) => {
|
|
@@ -99246,29 +99220,6 @@ const Matrix = perseus.MatrixWidget.widget;
|
|
|
99246
99220
|
// Really large matrices will cause issues with question formatting, so we
|
|
99247
99221
|
// have to cap it at some point.
|
|
99248
99222
|
const MAX_BOARD_SIZE = 6;
|
|
99249
|
-
const getMatrixSize = function (matrix) {
|
|
99250
|
-
const matrixSize = [1, 1];
|
|
99251
|
-
|
|
99252
|
-
// We need to find the widest row and tallest column to get the correct
|
|
99253
|
-
// matrix size.
|
|
99254
|
-
___default["default"](matrix).each((matrixRow, row) => {
|
|
99255
|
-
let rowWidth = 0;
|
|
99256
|
-
___default["default"](matrixRow).each((matrixCol, col) => {
|
|
99257
|
-
if (matrixCol != null && matrixCol.toString().length) {
|
|
99258
|
-
rowWidth = col + 1;
|
|
99259
|
-
}
|
|
99260
|
-
});
|
|
99261
|
-
|
|
99262
|
-
// Matrix width:
|
|
99263
|
-
matrixSize[1] = Math.max(matrixSize[1], rowWidth);
|
|
99264
|
-
|
|
99265
|
-
// Matrix height:
|
|
99266
|
-
if (rowWidth > 0) {
|
|
99267
|
-
matrixSize[0] = Math.max(matrixSize[0], row + 1);
|
|
99268
|
-
}
|
|
99269
|
-
});
|
|
99270
|
-
return matrixSize;
|
|
99271
|
-
};
|
|
99272
99223
|
class MatrixEditor extends React__namespace.Component {
|
|
99273
99224
|
static propTypes = {
|
|
99274
99225
|
...perseus.Changeable.propTypes,
|
|
@@ -99296,7 +99247,7 @@ class MatrixEditor extends React__namespace.Component {
|
|
|
99296
99247
|
};
|
|
99297
99248
|
})();
|
|
99298
99249
|
onMatrixBoardSizeChange = range => {
|
|
99299
|
-
const matrixSize = getMatrixSize(this.props.answers);
|
|
99250
|
+
const matrixSize = perseusCore.getMatrixSize(this.props.answers);
|
|
99300
99251
|
if (range[0] !== null && range[1] !== null) {
|
|
99301
99252
|
range = [Math.round(Math.min(Math.max(range[0], 1), MAX_BOARD_SIZE)), Math.round(Math.min(Math.max(range[1], 1), MAX_BOARD_SIZE))];
|
|
99302
99253
|
const answers = ___default["default"](Math.min(range[0], matrixSize[0])).times(row => {
|