@khanacademy/perseus 11.1.0 → 11.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/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @khanacademy/perseus
2
2
 
3
+ ## 11.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 26fc0b41: Updated ErrorBoundary logging to include the componentStack as well as the widget type as metadata.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [a5a60852]
12
+ - @khanacademy/math-input@12.1.0
13
+
14
+ ## 11.2.1
15
+
16
+ ### Patch Changes
17
+
18
+ - a383823d: Bump @khanacademy/wonder-stuff-core to v1.5.1 (which adds needed support for `isTruthy` helper function)
19
+ - Updated dependencies [a383823d]
20
+ - @khanacademy/math-input@12.0.1
21
+ - @khanacademy/perseus-linter@0.3.3
22
+ - @khanacademy/pure-markdown@0.2.5
23
+
24
+ ## 11.2.0
25
+
26
+ ### Minor Changes
27
+
28
+ - 9ff8a575: Fix image widget caption styling
29
+ - 1b618343: Add new Perseus analytics event: 'perseus:expression-focused'. This event is fired any time the expression widget input box receives focus.
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [fa5f463b]
34
+ - Updated dependencies [fa1bb6b4]
35
+ - Updated dependencies [6d8ede65]
36
+ - Updated dependencies [3afc0da2]
37
+ - @khanacademy/math-input@12.0.0
38
+
3
39
  ## 11.1.0
4
40
 
5
41
  ### Minor Changes
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  type Props = {
3
3
  children: React.ReactNode;
4
+ metadata?: Record<string, string>;
4
5
  };
5
6
  type State = {
6
7
  error: string;
package/dist/es/index.css CHANGED
@@ -1607,7 +1607,6 @@ body.mobile ul.inequalities-one-line-radios > li {
1607
1607
  font-size: 14px;
1608
1608
  line-height: 19px;
1609
1609
  margin: 16px auto 42px;
1610
- max-width: 455px;
1611
1610
  text-align: left;
1612
1611
  }
1613
1612
  .framework-perseus.perseus-article:not(.perseus-mobile) .paragraph.perseus-paragraph-full-width {
@@ -2807,7 +2806,6 @@ body.mobile .categorizer-container td.category input[type="radio"] + span:active
2807
2806
  }
2808
2807
  .perseus-image-widget .perseus-image-caption {
2809
2808
  color: rgba(33, 36, 44, 0.7);
2810
- max-width: 420px;
2811
2809
  padding-left: 16px;
2812
2810
  position: relative;
2813
2811
  top: -12px;
package/dist/es/index.js CHANGED
@@ -2552,6 +2552,11 @@ class Expression extends React.Component {
2552
2552
  this.props.trackInteraction();
2553
2553
  };
2554
2554
  this._handleFocus = () => {
2555
+ this.props.analytics.onAnalyticsEvent({
2556
+ type: "perseus:expression-focused",
2557
+ payload: null
2558
+ });
2559
+
2555
2560
  /* c8 ignore next */
2556
2561
  this.props.onFocus([]);
2557
2562
  };
@@ -17724,9 +17729,9 @@ class ErrorBoundary extends React.Component {
17724
17729
  });
17725
17730
  Log.error("Perseus error boundary caught error", Errors.Internal, {
17726
17731
  cause: error,
17727
- loggedMetadata: {
17728
- info: info.toString()
17729
- }
17732
+ loggedMetadata: _extends({
17733
+ componentStack: info.componentStack
17734
+ }, this.props.metadata)
17730
17735
  });
17731
17736
  }
17732
17737
  render() {
@@ -19316,7 +19321,11 @@ class Renderer extends React.Component {
19316
19321
  // filtered out in this.render(), so we shouldn't have to
19317
19322
  // worry about using this widget key and ref:
19318
19323
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
19319
- key: "container:" + id
19324
+ key: "container:" + id,
19325
+ metadata: {
19326
+ widget_type: type,
19327
+ widget_id: id
19328
+ }
19320
19329
  }, /*#__PURE__*/React.createElement(WidgetContainer, {
19321
19330
  ref: "container:" + id,
19322
19331
  type: type,
@@ -26706,7 +26715,10 @@ class ImageWidget extends React.Component {
26706
26715
  // Aphrodite.
26707
26716
  const minWidth = isImageFullWidth ? null : "0 !important";
26708
26717
  titleAndCaption = /*#__PURE__*/React.createElement("figcaption", {
26709
- className: className
26718
+ className: className,
26719
+ style: {
26720
+ maxWidth: backgroundImage.width
26721
+ }
26710
26722
  }, /*#__PURE__*/React.createElement("div", {
26711
26723
  style: {
26712
26724
  // @ts-expect-error - TS2322 - Type 'string | null' is not assignable to type 'MinWidth<string | number> | undefined'.
@@ -26735,7 +26747,10 @@ class ImageWidget extends React.Component {
26735
26747
  }
26736
26748
  if (this.props.caption) {
26737
26749
  caption = /*#__PURE__*/React.createElement("figcaption", {
26738
- className: "perseus-image-caption"
26750
+ className: "perseus-image-caption",
26751
+ style: {
26752
+ maxWidth: backgroundImage.width
26753
+ }
26739
26754
  }, /*#__PURE__*/React.createElement(Renderer, {
26740
26755
  content: this.props.caption,
26741
26756
  apiOptions: apiOptions,
@@ -44406,7 +44421,12 @@ const ProvideKeypad = {
44406
44421
  // @ts-expect-error - TS2339 - Property 'props' does not exist on type '{ readonly propTypes: { readonly apiOptions: React.PropType<{ customKeypad?: boolean | undefined; nativeKeypadProxy?: ((...a: readonly any[]) => unknown) | undefined; }>; readonly keypadStyle: Requireable<any>; }; readonly getInitialState: () => { ...; }; readonly componentDidMount: () => void; readonly componentWil...'.
44407
44422
  ,
44408
44423
  style: _this.props.keypadStyle,
44409
- useV2Keypad: apiOptions.useV2Keypad
44424
+ useV2Keypad: apiOptions.useV2Keypad,
44425
+ onAnalyticsEvent: async () => {
44426
+ // Intentionally left empty. This component is
44427
+ // deprecated and so we don't want/need to instrument
44428
+ // it.
44429
+ }
44410
44430
  }), _this._keypadContainer);
44411
44431
  }
44412
44432
  },