@khanacademy/perseus 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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @khanacademy/perseus
2
2
 
3
+ ## 17.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#850](https://github.com/Khan/perseus/pull/850) [`f4cd2a76`](https://github.com/Khan/perseus/commit/f4cd2a7639556312af75b9ba9c6a97c41c94beac) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Widget rendering errors are now reported as distinct errors to the Perseus logging infrastructure.
8
+
9
+ ## 17.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#873](https://github.com/Khan/perseus/pull/873) [`b7777865`](https://github.com/Khan/perseus/commit/b777786517afc289e92201e3fea876c30c493290) Thanks [@nedredmond](https://github.com/nedredmond)! - Prevent paragraph class from being added to answer pills component
14
+
15
+ - Updated dependencies [[`610ebba2`](https://github.com/Khan/perseus/commit/610ebba29ab8b2ee4ddf4879f8c8b87993f29b20)]:
16
+ - @khanacademy/math-input@16.4.0
17
+
3
18
  ## 17.3.0
4
19
 
5
20
  ### Minor Changes
package/dist/es/index.css CHANGED
@@ -2795,23 +2795,11 @@ body.mobile .categorizer-container td.category input[type="radio"] + span:active
2795
2795
  .framework-perseus .perseus-label-image-widget-instructions div.paragraph {
2796
2796
  margin: 0;
2797
2797
  }
2798
- .framework-perseus button[id*="perseus-label-image-widget-answer-pill"] div.paragraph,
2799
- .framework-perseus div[id*="perseus-label-image-widget-answer-pill"] div.paragraph {
2800
- all: revert;
2801
- }
2802
- .framework-perseus button[id*="perseus-label-image-widget-answer-pill"] div.perseus-block-math-inner,
2803
- .framework-perseus div[id*="perseus-label-image-widget-answer-pill"] div.perseus-block-math-inner {
2804
- margin: -5px 0 !important;
2805
- }
2806
2798
  @media (max-width: 767px) {
2807
- [id*="perseus-label-image-widget-answer-pill"] div.paragraph {
2808
- all: revert;
2809
- }
2810
2799
  [id*="perseus-label-image-widget-answer-pill"] > div.perseus-renderer-responsive {
2811
2800
  all: revert;
2812
2801
  }
2813
- .framework-perseus.perseus-mobile [id*="perseus-label-image-widget-answer-pill"] .perseus-renderer > .paragraph,
2814
- .framework-perseus.perseus-mobile [id*="perseus-label-image-widget-answer-pill"] .perseus-renderer > .paragraph .paragraph {
2802
+ .framework-perseus.perseus-mobile [id*="perseus-label-image-widget-answer-pill"] mjx-container {
2815
2803
  all: revert;
2816
2804
  }
2817
2805
  }
package/dist/es/index.js CHANGED
@@ -17373,10 +17373,18 @@ class ErrorBoundary extends React.Component {
17373
17373
  error: error.toString()
17374
17374
  });
17375
17375
  (_this$props$onError = (_this$props = this.props).onError) == null || _this$props$onError.call(_this$props, error, info);
17376
- Log.error("Perseus error boundary caught error", Errors.Internal, {
17376
+ Log.error(
17377
+ // NOTE(jeremy): We concatenate the error messsage here. Typical
17378
+ // Khan Academy error handling guidance says that you should never
17379
+ // "build" the error message that might be sent to our error
17380
+ // reporting tool (currently Sentry). However, if we don't
17381
+ // differentiate between the different errors that are thrown, they
17382
+ // all end up being grouped as a single Sentry event, which is very
17383
+ // unhelpful.
17384
+ "Unhandled Perseus error: " + error.message, Errors.Internal, {
17377
17385
  cause: error,
17378
17386
  loggedMetadata: _extends({
17379
- componentStack: info.componentStack
17387
+ componentStack: !!info && "componentStack" in info ? info.componentStack : "componentStack not provided"
17380
17388
  }, this.props.metadata)
17381
17389
  });
17382
17390
  }
@@ -17390,8 +17398,9 @@ class ErrorBoundary extends React.Component {
17390
17398
  return /*#__PURE__*/React.createElement("svg", {
17391
17399
  height: "16",
17392
17400
  width: "16",
17393
- viewBox: "0 0 16 16"
17394
- }, /*#__PURE__*/React.createElement("path", {
17401
+ viewBox: "0 0 16 16",
17402
+ role: "img"
17403
+ }, /*#__PURE__*/React.createElement("title", null, "Rendering Error!"), /*#__PURE__*/React.createElement("path", {
17395
17404
  d: "m8 16c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm0-3c0.55 0 1-0.45 1-1s-0.45-1-1-1-1 0.45-1 1 0.45 1 1 1zm0-9c-0.55 0-1 0.45-1 1v4c0 0.55.45 1 1 1s1-0.45 1-1v-4c0-0.55-0.45-1-1-1z",
17396
17405
  fill: "#d92916",
17397
17406
  fillRule: "evenodd"
@@ -18193,11 +18202,12 @@ var PerseusMarkdown = {
18193
18202
 
18194
18203
  class QuestionParagraph extends React.Component {
18195
18204
  render() {
18205
+ var _this$props$className;
18196
18206
  const className = this.props.className ? "paragraph " + this.props.className : "paragraph";
18197
18207
  // For perseus-article just-in-place-translation (jipt), we need
18198
18208
  // to attach some metadata to top-level QuestionParagraphs:
18199
18209
  return /*#__PURE__*/React.createElement("div", {
18200
- className: className,
18210
+ className: this.props.inline ? (_this$props$className = this.props.className) != null ? _this$props$className : undefined : className,
18201
18211
  "data-perseus-component-index": this.props.translationIndex,
18202
18212
  "data-perseus-paragraph-index": this.props.paragraphIndex
18203
18213
  }, this.props.children);
@@ -19378,7 +19388,8 @@ class Renderer extends React.Component {
19378
19388
  key: state.key,
19379
19389
  className: className,
19380
19390
  translationIndex: this.translationIndex,
19381
- paragraphIndex: state.paragraphIndex
19391
+ paragraphIndex: state.paragraphIndex,
19392
+ inline: this.props.inline
19382
19393
  }, /*#__PURE__*/React.createElement(ErrorBoundary, null, output));
19383
19394
  };
19384
19395
  // output non-top-level nodes or arrays
@@ -20192,12 +20203,14 @@ class Renderer extends React.Component {
20192
20203
  this._isTwoColumn = false;
20193
20204
 
20194
20205
  // Parse the string of markdown to a parse tree
20195
- const parsedMarkdown = PerseusMarkdown.parse(content, {
20206
+ const parsedMarkdown = this.props.inline ? PerseusMarkdown.parseInline(content, {
20196
20207
  // Recognize crowdin IDs while translating articles
20197
20208
  // (This should never be hit by exercises, though if you
20198
20209
  // decide you want to add a check that this is an article,
20199
20210
  // go for it.)
20200
20211
  isJipt: this.translationIndex != null
20212
+ }) : PerseusMarkdown.parse(content, {
20213
+ isJipt: this.translationIndex != null
20201
20214
  });
20202
20215
 
20203
20216
  // Optionally apply the linter to the parse tree
@@ -31075,7 +31088,8 @@ const AnswerPill = props => {
31075
31088
  ":focus": bringToFront
31076
31089
  }, correct && styles$i.correct, incorrect && styles$i.incorrect]
31077
31090
  }, /*#__PURE__*/React.createElement(Renderer, {
31078
- content: answerString
31091
+ content: answerString,
31092
+ inline: true
31079
31093
  })));
31080
31094
  };
31081
31095
  const styles$i = StyleSheet.create({
@@ -31846,7 +31860,7 @@ class LabelImage extends React.Component {
31846
31860
  };
31847
31861
 
31848
31862
  const adjustPillDistance = {
31849
- [`margin${markerPosition.charAt(0).toUpperCase() + markerPosition.slice(1)}`]: 5 // move pill further from marker
31863
+ [`margin${markerPosition.charAt(0).toUpperCase() + markerPosition.slice(1)}`]: 15 // move pill further from marker
31850
31864
  };
31851
31865
 
31852
31866
  const showAnswerChoice = !answerChoicesActive && !this.state.hideAnswers;
@@ -38307,9 +38321,12 @@ class PassageRefTarget extends React.Component {
38307
38321
  render() {
38308
38322
  return /*#__PURE__*/React.createElement(Renderer, {
38309
38323
  content: this.props.content
38310
- // @ts-expect-error - TS2322 - Type '{ content: any; inline: boolean; apiOptions: any; linterContext: any; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Renderer> & Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | ... 3 more ... | "legacyPerseusLint"> & InexactPartial<...> & InexactPartial<...>'.
38324
+ // This was already here before inline was recently added (#873)
38325
+ // It was for a different use case a long time ago:
38326
+ // https://phabricator.khanacademy.org/D12113
38327
+ // Commenting out to prevent unanticipated side effects
38328
+ // inline={true}
38311
38329
  ,
38312
- inline: true,
38313
38330
  apiOptions: this.props.apiOptions,
38314
38331
  linterContext: this.props.linterContext
38315
38332
  });
@@ -44185,7 +44202,7 @@ const init = function init(options) {
44185
44202
 
44186
44203
  // This file is processed by a Rollup plugin (replace) to inject the production
44187
44204
  const libName = "@khanacademy/perseus";
44188
- const libVersion = "17.3.0";
44205
+ const libVersion = "17.3.2";
44189
44206
  addLibraryVersionToPerseusDebug(libName, libVersion);
44190
44207
 
44191
44208
  const apiVersion = {