@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/dist/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/index.js CHANGED
@@ -17421,10 +17421,18 @@ class ErrorBoundary extends React__namespace.Component {
17421
17421
  error: error.toString()
17422
17422
  });
17423
17423
  this.props.onError?.(error, info);
17424
- Log.error("Perseus error boundary caught error", Errors.Internal, {
17424
+ Log.error(
17425
+ // NOTE(jeremy): We concatenate the error messsage here. Typical
17426
+ // Khan Academy error handling guidance says that you should never
17427
+ // "build" the error message that might be sent to our error
17428
+ // reporting tool (currently Sentry). However, if we don't
17429
+ // differentiate between the different errors that are thrown, they
17430
+ // all end up being grouped as a single Sentry event, which is very
17431
+ // unhelpful.
17432
+ "Unhandled Perseus error: " + error.message, Errors.Internal, {
17425
17433
  cause: error,
17426
17434
  loggedMetadata: {
17427
- componentStack: info.componentStack,
17435
+ componentStack: !!info && "componentStack" in info ? info.componentStack : "componentStack not provided",
17428
17436
  ...this.props.metadata
17429
17437
  }
17430
17438
  });
@@ -17439,8 +17447,9 @@ class ErrorBoundary extends React__namespace.Component {
17439
17447
  return /*#__PURE__*/React__namespace.createElement("svg", {
17440
17448
  height: "16",
17441
17449
  width: "16",
17442
- viewBox: "0 0 16 16"
17443
- }, /*#__PURE__*/React__namespace.createElement("path", {
17450
+ viewBox: "0 0 16 16",
17451
+ role: "img"
17452
+ }, /*#__PURE__*/React__namespace.createElement("title", null, "Rendering Error!"), /*#__PURE__*/React__namespace.createElement("path", {
17444
17453
  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",
17445
17454
  fill: "#d92916",
17446
17455
  fillRule: "evenodd"
@@ -18263,7 +18272,7 @@ class QuestionParagraph extends React__namespace.Component {
18263
18272
  // For perseus-article just-in-place-translation (jipt), we need
18264
18273
  // to attach some metadata to top-level QuestionParagraphs:
18265
18274
  return /*#__PURE__*/React__namespace.createElement("div", {
18266
- className: className,
18275
+ className: this.props.inline ? this.props.className ?? undefined : className,
18267
18276
  "data-perseus-component-index": this.props.translationIndex,
18268
18277
  "data-perseus-paragraph-index": this.props.paragraphIndex
18269
18278
  }, this.props.children);
@@ -19621,7 +19630,8 @@ class Renderer extends React__namespace.Component {
19621
19630
  key: state.key,
19622
19631
  className: className,
19623
19632
  translationIndex: this.translationIndex,
19624
- paragraphIndex: state.paragraphIndex
19633
+ paragraphIndex: state.paragraphIndex,
19634
+ inline: this.props.inline
19625
19635
  }, /*#__PURE__*/React__namespace.createElement(ErrorBoundary, null, output));
19626
19636
  };
19627
19637
 
@@ -20333,12 +20343,14 @@ class Renderer extends React__namespace.Component {
20333
20343
  this._isTwoColumn = false;
20334
20344
 
20335
20345
  // Parse the string of markdown to a parse tree
20336
- const parsedMarkdown = PerseusMarkdown.parse(content, {
20346
+ const parsedMarkdown = this.props.inline ? PerseusMarkdown.parseInline(content, {
20337
20347
  // Recognize crowdin IDs while translating articles
20338
20348
  // (This should never be hit by exercises, though if you
20339
20349
  // decide you want to add a check that this is an article,
20340
20350
  // go for it.)
20341
20351
  isJipt: this.translationIndex != null
20352
+ }) : PerseusMarkdown.parse(content, {
20353
+ isJipt: this.translationIndex != null
20342
20354
  });
20343
20355
 
20344
20356
  // Optionally apply the linter to the parse tree
@@ -31203,7 +31215,8 @@ const AnswerPill = props => {
31203
31215
  ":focus": bringToFront
31204
31216
  }, correct && styles$i.correct, incorrect && styles$i.incorrect]
31205
31217
  }, /*#__PURE__*/React__namespace.createElement(Renderer, {
31206
- content: answerString
31218
+ content: answerString,
31219
+ inline: true
31207
31220
  }));
31208
31221
  });
31209
31222
  };
@@ -31973,7 +31986,7 @@ class LabelImage extends React__namespace.Component {
31973
31986
  };
31974
31987
 
31975
31988
  const adjustPillDistance = {
31976
- [`margin${markerPosition.charAt(0).toUpperCase() + markerPosition.slice(1)}`]: 5 // move pill further from marker
31989
+ [`margin${markerPosition.charAt(0).toUpperCase() + markerPosition.slice(1)}`]: 15 // move pill further from marker
31977
31990
  };
31978
31991
 
31979
31992
  const showAnswerChoice = !answerChoicesActive && !this.state.hideAnswers;
@@ -38453,9 +38466,12 @@ class PassageRefTarget extends React__namespace.Component {
38453
38466
  render() {
38454
38467
  return /*#__PURE__*/React__namespace.createElement(Renderer, {
38455
38468
  content: this.props.content
38456
- // @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<...>'.
38469
+ // This was already here before inline was recently added (#873)
38470
+ // It was for a different use case a long time ago:
38471
+ // https://phabricator.khanacademy.org/D12113
38472
+ // Commenting out to prevent unanticipated side effects
38473
+ // inline={true}
38457
38474
  ,
38458
- inline: true,
38459
38475
  apiOptions: this.props.apiOptions,
38460
38476
  linterContext: this.props.linterContext
38461
38477
  });
@@ -44321,7 +44337,7 @@ const init = function (options) {
44321
44337
 
44322
44338
  // This file is processed by a Rollup plugin (replace) to inject the production
44323
44339
  const libName = "@khanacademy/perseus";
44324
- const libVersion = "17.3.0";
44340
+ const libVersion = "17.3.2";
44325
44341
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
44326
44342
 
44327
44343
  const apiVersion = {