@khanacademy/perseus 11.1.0 → 11.2.1

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Core Perseus API (includes renderers and widgets)",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "11.1.0",
6
+ "version": "11.2.1",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -24,10 +24,10 @@
24
24
  "dependencies": {
25
25
  "@khanacademy/kas": "^0.3.1",
26
26
  "@khanacademy/kmath": "^0.1.2",
27
- "@khanacademy/math-input": "^11.0.0",
27
+ "@khanacademy/math-input": "^12.0.1",
28
28
  "@khanacademy/perseus-core": "1.0.0",
29
- "@khanacademy/perseus-linter": "^0.3.2",
30
- "@khanacademy/pure-markdown": "^0.2.4",
29
+ "@khanacademy/perseus-linter": "^0.3.3",
30
+ "@khanacademy/pure-markdown": "^0.2.5",
31
31
  "@khanacademy/simple-markdown": "^0.10.0"
32
32
  },
33
33
  "devDependencies": {
@@ -47,7 +47,7 @@
47
47
  "@khanacademy/wonder-blocks-spacing": "^3.0.5",
48
48
  "@khanacademy/wonder-blocks-tooltip": "^2.1.2",
49
49
  "@khanacademy/wonder-blocks-typography": "^2.1.3",
50
- "@khanacademy/wonder-stuff-core": "^1.2.2",
50
+ "@khanacademy/wonder-stuff-core": "^1.5.1",
51
51
  "aphrodite": "^1.2.5",
52
52
  "classnames": "^1.1.4",
53
53
  "create-react-class": "^15.6.3",
@@ -80,7 +80,7 @@
80
80
  "@khanacademy/wonder-blocks-spacing": "^3.0.5",
81
81
  "@khanacademy/wonder-blocks-tooltip": "^2.1.2",
82
82
  "@khanacademy/wonder-blocks-typography": "^2.1.3",
83
- "@khanacademy/wonder-stuff-core": "^1.2.2",
83
+ "@khanacademy/wonder-stuff-core": "^1.5.1",
84
84
  "aphrodite": "^1.2.5",
85
85
  "classnames": "^1.1.4",
86
86
  "create-react-class": "^15.6.3",
@@ -25,7 +25,8 @@ export const singleSectionArticle: PerseusRenderer = {
25
25
  },
26
26
  labels: [],
27
27
  alt: 'A scene from Pixar\'s film "Toy Story 3" where the characters are swimming in a sea of trash and look very afraid.',
28
- caption: "",
28
+ caption:
29
+ 'A scene from Pixar\'s film "Toy Story 3" where the characters are swimming in a sea of trash and look very afraid."',
29
30
  },
30
31
  version: {major: 0, minor: 0},
31
32
  },
@@ -103,6 +103,11 @@ const ProvideKeypad = {
103
103
  // @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...'.
104
104
  style={_this.props.keypadStyle}
105
105
  useV2Keypad={apiOptions.useV2Keypad}
106
+ onAnalyticsEvent={async () => {
107
+ // Intentionally left empty. This component is
108
+ // deprecated and so we don't want/need to instrument
109
+ // it.
110
+ }}
106
111
  />,
107
112
  _this._keypadContainer,
108
113
  );
@@ -121,7 +121,6 @@
121
121
  font-size: 14px;
122
122
  line-height: 19px;
123
123
  margin: 16px auto 42px;
124
- max-width: 455px;
125
124
  text-align: left;
126
125
  }
127
126
 
@@ -7,7 +7,6 @@
7
7
 
8
8
  .perseus-image-caption {
9
9
  color: rgba(33, 36, 44, 0.7);
10
- max-width: 420px;
11
10
  padding-left: 16px;
12
11
  position: relative;
13
12
 
@@ -1,5 +1,6 @@
1
1
  import {KeypadContext, MobileKeypad} from "@khanacademy/math-input";
2
2
  import {View} from "@khanacademy/wonder-blocks-core";
3
+ import {action} from "@storybook/addon-actions";
3
4
  import {StyleSheet} from "aphrodite";
4
5
  import * as React from "react";
5
6
 
@@ -12,6 +13,10 @@ const Footer = (): React.ReactElement => {
12
13
  onElementMounted={setKeypadElement}
13
14
  onDismiss={() => renderer && renderer.blur()}
14
15
  style={styles.keypad}
16
+ useV2Keypad={true}
17
+ onAnalyticsEvent={async (e) => {
18
+ action("onAnalyticsEvent")(e);
19
+ }}
15
20
  />
16
21
  )}
17
22
  </KeypadContext.Consumer>
@@ -75,6 +75,7 @@ exports[`image widget - isMobile %b should snapshot: first render 1`] = `
75
75
  </span>
76
76
  <figcaption
77
77
  class="perseus-image-caption has-title"
78
+ style="max-width: 420px;"
78
79
  >
79
80
  <div>
80
81
  <div
@@ -273,6 +274,7 @@ exports[`image widget - isMobile %b should snapshot: first render 2`] = `
273
274
  </span>
274
275
  <figcaption
275
276
  class="perseus-image-caption"
277
+ style="max-width: 420px;"
276
278
  >
277
279
  <div
278
280
  class="perseus-renderer perseus-renderer-responsive"
@@ -422,6 +422,11 @@ export class Expression extends React.Component<Props, ExpressionState> {
422
422
  };
423
423
 
424
424
  _handleFocus: () => void = () => {
425
+ this.props.analytics.onAnalyticsEvent({
426
+ type: "perseus:expression-focused",
427
+ payload: null,
428
+ });
429
+
425
430
  /* c8 ignore next */
426
431
  this.props.onFocus([]);
427
432
  };
@@ -197,7 +197,12 @@ class ImageWidget extends React.Component<Props> {
197
197
  const minWidth = isImageFullWidth ? null : "0 !important";
198
198
 
199
199
  titleAndCaption = (
200
- <figcaption className={className}>
200
+ <figcaption
201
+ className={className}
202
+ style={{
203
+ maxWidth: backgroundImage.width,
204
+ }}
205
+ >
201
206
  <div
202
207
  style={{
203
208
  // @ts-expect-error - TS2322 - Type 'string | null' is not assignable to type 'MinWidth<string | number> | undefined'.
@@ -239,7 +244,12 @@ class ImageWidget extends React.Component<Props> {
239
244
 
240
245
  if (this.props.caption) {
241
246
  caption = (
242
- <figcaption className="perseus-image-caption">
247
+ <figcaption
248
+ className="perseus-image-caption"
249
+ style={{
250
+ maxWidth: backgroundImage.width,
251
+ }}
252
+ >
243
253
  <Renderer
244
254
  content={this.props.caption}
245
255
  apiOptions={apiOptions}