@khanacademy/perseus 17.6.1 → 17.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @khanacademy/perseus
2
2
 
3
+ ## 17.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#921](https://github.com/Khan/perseus/pull/921) [`81b9a562`](https://github.com/Khan/perseus/commit/81b9a562d0fb8ff2cd82e708781432bff8437116) Thanks [@benchristel](https://github.com/benchristel)! - Make the Expression widget treat `sen` as equivalent to `sin`. The spelling
8
+ `sen` is used in Portuguese.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [[`81b9a562`](https://github.com/Khan/perseus/commit/81b9a562d0fb8ff2cd82e708781432bff8437116)]:
13
+ - @khanacademy/math-input@16.5.0
14
+
15
+ ## 17.6.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [#918](https://github.com/Khan/perseus/pull/918) [`21222f55`](https://github.com/Khan/perseus/commit/21222f55b1efd46acbc0fe1dcc8aa0399b8555ee) Thanks [@nedredmond](https://github.com/nedredmond)! - Fix bug that caused svg to be 300px wide
20
+
3
21
  ## 17.6.1
4
22
 
5
23
  ### Patch Changes
package/dist/es/index.js CHANGED
@@ -1914,6 +1914,15 @@ const insertBraces = value => {
1914
1914
  // TODO(alex): Properly hack MathQuill to always use explicit braces.
1915
1915
  return value.replace(/([_^])([^{])/g, "$1{$2}");
1916
1916
  };
1917
+ const anglicizeOperators = tex => {
1918
+ // sen is used instead of sin in some languages, e.g. Portuguese.
1919
+ // To ensure that answers in various languages are graded correctly, we
1920
+ // convert operators to their Englishy forms.
1921
+ return tex.replace(/\\operatorname{sen}/g, "\\sin ");
1922
+ };
1923
+ const normalizeTex = tex => {
1924
+ return anglicizeOperators(insertBraces(tex));
1925
+ };
1917
1926
  const deriveKeypadVersion = apiOptions => {
1918
1927
  // We can derive which version of the keypad is in use. This is
1919
1928
  // a bit tricky, but this code will be relatively short-lived
@@ -2006,7 +2015,7 @@ class Expression extends React.Component {
2006
2015
  _.extend(options, {
2007
2016
  decimal_separator: i18n.getDecimalSeparator()
2008
2017
  });
2009
- return KAS.parse(insertBraces(value), options);
2018
+ return KAS.parse(normalizeTex(value), options);
2010
2019
  };
2011
2020
  this.changeAndTrack = (e, cb) => {
2012
2021
  this.change("value", e, cb);
@@ -2206,7 +2215,7 @@ class Expression extends React.Component {
2206
2215
  };
2207
2216
  }
2208
2217
  static getUserInputFromProps(props) {
2209
- return insertBraces(props.value);
2218
+ return normalizeTex(props.value);
2210
2219
  }
2211
2220
  static getOneCorrectAnswerFromRubric(rubric) {
2212
2221
  const correctAnswers = (rubric.answerForms || []).filter(answerForm => answerForm.considered === "correct");
@@ -31063,8 +31072,8 @@ class Marker extends React.Component {
31063
31072
  let iconStyles;
31064
31073
  const iconNull = {
31065
31074
  path: "",
31066
- height: 0,
31067
- width: 0
31075
+ height: 1,
31076
+ width: 1
31068
31077
  };
31069
31078
 
31070
31079
  // default dot
@@ -43993,7 +44002,7 @@ const init = function init(options) {
43993
44002
 
43994
44003
  // This file is processed by a Rollup plugin (replace) to inject the production
43995
44004
  const libName = "@khanacademy/perseus";
43996
- const libVersion = "17.6.1";
44005
+ const libVersion = "17.7.0";
43997
44006
  addLibraryVersionToPerseusDebug(libName, libVersion);
43998
44007
 
43999
44008
  const apiVersion = {