@khanacademy/perseus 19.2.0 → 19.3.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 +25 -23
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +20 -23
- package/dist/index.js.map +1 -1
- package/dist/perseus-api.d.ts +3 -1
- package/dist/server-item-renderer.d.ts +3 -1
- package/dist/types.d.ts +3 -1
- package/dist/widgets/expression.d.ts +18 -6
- package/dist/widgets/label-image.d.ts +16 -2
- package/package.json +2 -2
package/dist/es/index.js
CHANGED
|
@@ -1904,11 +1904,25 @@ const KhanAnswerTypes = {
|
|
|
1904
1904
|
const _excluded$4 = ["scoring"];
|
|
1905
1905
|
const ERROR_TITLE = i18n._("Oops!");
|
|
1906
1906
|
const ERROR_MESSAGE = i18n._("Sorry, I don't understand that!");
|
|
1907
|
+
|
|
1908
|
+
// Map of international operator names to their English equivalents
|
|
1909
|
+
const englishOperators = {
|
|
1910
|
+
arctg: "arctan",
|
|
1911
|
+
cosec: "csc",
|
|
1912
|
+
cossec: "csc",
|
|
1913
|
+
cotg: "cot",
|
|
1914
|
+
ctg: "cot",
|
|
1915
|
+
sen: "sin",
|
|
1916
|
+
tg: "tan"
|
|
1917
|
+
};
|
|
1907
1918
|
const anglicizeOperators = tex => {
|
|
1908
1919
|
// sen is used instead of sin in some languages, e.g. Portuguese.
|
|
1909
1920
|
// To ensure that answers in various languages are graded correctly, we
|
|
1910
1921
|
// convert operators to their Englishy forms.
|
|
1911
|
-
return tex.replace(/\\operatorname{
|
|
1922
|
+
return tex.replace(/\\operatorname{([a-z]+)}/g, (_, op) => {
|
|
1923
|
+
var _englishOperators$op;
|
|
1924
|
+
return `\\${(_englishOperators$op = englishOperators[op]) != null ? _englishOperators$op : op} `;
|
|
1925
|
+
});
|
|
1912
1926
|
};
|
|
1913
1927
|
const normalizeTex = tex => {
|
|
1914
1928
|
return anglicizeOperators(tex);
|
|
@@ -2394,6 +2408,7 @@ ExpressionWithDependencies.getOneCorrectAnswerFromRubric = Expression.getOneCorr
|
|
|
2394
2408
|
var Expression$1 = {
|
|
2395
2409
|
name: "expression",
|
|
2396
2410
|
displayName: "Expression / Equation",
|
|
2411
|
+
accessible: true,
|
|
2397
2412
|
defaultAlignment: "inline-block",
|
|
2398
2413
|
widget: ExpressionWithDependencies,
|
|
2399
2414
|
transform: widgetOptions => {
|
|
@@ -21520,15 +21535,6 @@ class InputNumber extends React.Component {
|
|
|
21520
21535
|
};
|
|
21521
21536
|
this._handleFocus = () => {
|
|
21522
21537
|
this.props.onFocus([]);
|
|
21523
|
-
// HACK(kevinb): We want to dismiss the feedback popover that webapp
|
|
21524
|
-
// displays as soon as a user clicks in in the input field so we call
|
|
21525
|
-
// interactionCallback directly.
|
|
21526
|
-
const {
|
|
21527
|
-
interactionCallback
|
|
21528
|
-
} = this.props.apiOptions;
|
|
21529
|
-
if (interactionCallback) {
|
|
21530
|
-
interactionCallback();
|
|
21531
|
-
}
|
|
21532
21538
|
};
|
|
21533
21539
|
this._handleBlur = () => {
|
|
21534
21540
|
this.props.onBlur([]);
|
|
@@ -21862,15 +21868,6 @@ class NumericInput extends React.Component {
|
|
|
21862
21868
|
};
|
|
21863
21869
|
this._handleFocus = () => {
|
|
21864
21870
|
this.props.onFocus([]);
|
|
21865
|
-
// HACK(kevinb): We want to dismiss the feedback popover that webapp
|
|
21866
|
-
// displays as soon as a user clicks in in the input field so we call
|
|
21867
|
-
// interactionCallback directly.
|
|
21868
|
-
const {
|
|
21869
|
-
interactionCallback
|
|
21870
|
-
} = this.props.apiOptions;
|
|
21871
|
-
if (interactionCallback) {
|
|
21872
|
-
interactionCallback();
|
|
21873
|
-
}
|
|
21874
21871
|
};
|
|
21875
21872
|
this._handleBlur = () => {
|
|
21876
21873
|
this.props.onBlur([]);
|
|
@@ -41555,7 +41552,7 @@ const init = function init(options) {
|
|
|
41555
41552
|
|
|
41556
41553
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41557
41554
|
const libName = "@khanacademy/perseus";
|
|
41558
|
-
const libVersion = "19.
|
|
41555
|
+
const libVersion = "19.3.0";
|
|
41559
41556
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41560
41557
|
|
|
41561
41558
|
const apiVersion = {
|
|
@@ -42100,20 +42097,25 @@ class ServerItemRenderer extends React.Component {
|
|
|
42100
42097
|
this.blurTimeoutID = void 0;
|
|
42101
42098
|
this._handleFocusChange = (newFocus, oldFocus) => {
|
|
42102
42099
|
if (newFocus != null) {
|
|
42100
|
+
var _this$props$apiOption;
|
|
42103
42101
|
this._setCurrentFocus(newFocus);
|
|
42102
|
+
|
|
42103
|
+
// Call the interactionCallback, if it exists, with the current user input data
|
|
42104
|
+
(_this$props$apiOption = this.props.apiOptions) == null || _this$props$apiOption.interactionCallback == null || _this$props$apiOption.interactionCallback(this.questionRenderer.getUserInputForWidgets());
|
|
42104
42105
|
} else {
|
|
42105
42106
|
this._onRendererBlur(oldFocus);
|
|
42106
42107
|
}
|
|
42107
42108
|
};
|
|
42108
42109
|
this.handleInteractWithWidget = widgetId => {
|
|
42110
|
+
var _this$props$apiOption2;
|
|
42109
42111
|
const withRemoved = _.difference(this.state.questionHighlightedWidgets, [widgetId]);
|
|
42110
42112
|
this.setState({
|
|
42111
42113
|
questionCompleted: false,
|
|
42112
42114
|
questionHighlightedWidgets: withRemoved
|
|
42113
42115
|
});
|
|
42114
|
-
|
|
42115
|
-
|
|
42116
|
-
|
|
42116
|
+
|
|
42117
|
+
// Call the interactionCallback, if it exists, with the current user input data
|
|
42118
|
+
(_this$props$apiOption2 = this.props.apiOptions) == null || _this$props$apiOption2.interactionCallback == null || _this$props$apiOption2.interactionCallback(this.questionRenderer.getUserInputForWidgets());
|
|
42117
42119
|
};
|
|
42118
42120
|
// This must be pre-bound otherwise SvgImage's shouldComponentUpdate
|
|
42119
42121
|
// won't behave correctly and we'll get an infinite loop.
|