@khanacademy/perseus 84.0.0 → 84.0.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.
@@ -28,15 +28,6 @@ type HOCProps = {
28
28
  };
29
29
  type Props = SharedRendererProps & OwnProps & HOCProps;
30
30
  type DefaultProps = Required<Pick<Props, "apiOptions" | "onRendered" | "linterContext">>;
31
- type State = {
32
- /**
33
- * Keeps track of whether each asset (SvgImage or TeX) rendered by
34
- * the questionRenderer has finished loading or rendering.
35
- */
36
- assetStatuses: {
37
- [assetKey: string]: boolean;
38
- };
39
- };
40
31
  /**
41
32
  * @deprecated and likely a very broken API
42
33
  * [LEMS-3185] do not trust serializedState
@@ -45,20 +36,39 @@ type SerializedState = {
45
36
  question: any;
46
37
  hints: any;
47
38
  };
48
- export declare class ServerItemRenderer extends React.Component<Props, State> implements RendererInterface, KeypadContextRendererInterface, GetPromptJSONInterface {
39
+ export declare class ServerItemRenderer extends React.Component<Props> implements RendererInterface, KeypadContextRendererInterface, GetPromptJSONInterface {
49
40
  static contextType: React.Context<import("./components/i18n-context").I18nContextType>;
50
41
  context: React.ContextType<typeof PerseusI18nContext>;
51
42
  questionRenderer: Renderer;
52
43
  hintsRenderer: any;
53
44
  _currentFocus: FocusPath;
54
45
  _fullyRendered: boolean;
46
+ /**
47
+ * Tracks whether each asset rendered below us (images, math, anything else
48
+ * that takes extra passes to settle) has finished rendering.
49
+ *
50
+ * This is deliberately not React state: assets register themselves in
51
+ * their constructors, while we're still rendering, and a state update
52
+ * from there isn't visible to us until a later render pass — by which point we'd
53
+ * already have called `onRendered()` under the assumption
54
+ * there were no assets to wait for.
55
+ */
56
+ _assetStatuses: {
57
+ [assetKey: string]: boolean;
58
+ };
55
59
  blurTimeoutID: number | null | undefined;
56
60
  userInput: UserInputMap;
57
61
  static defaultProps: DefaultProps;
58
62
  constructor(props: Props);
59
63
  componentDidMount(): void;
60
- componentDidUpdate(): void;
61
64
  componentWillUnmount(): void;
65
+ /**
66
+ * Reports that we've finished rendering, if every asset has settled.
67
+ *
68
+ * Called once we've mounted (to cover content with no assets at all) and
69
+ * again on every status change, so it doesn't depend on a render pass
70
+ * happening at the right moment. Only ever reports once.
71
+ */
62
72
  maybeCallOnRendered(): void;
63
73
  _handleFocusChange: (newFocus: FocusPath, oldFocus: FocusPath) => void;
64
74
  _setCurrentFocus(newFocus: FocusPath): void;
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": "84.0.0",
6
+ "version": "84.0.2",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -49,8 +49,8 @@
49
49
  "@khanacademy/math-input": "27.0.2",
50
50
  "@khanacademy/perseus-core": "35.0.0",
51
51
  "@khanacademy/perseus-linter": "5.1.22",
52
- "@khanacademy/perseus-score": "8.12.14",
53
52
  "@khanacademy/perseus-utils": "2.1.5",
53
+ "@khanacademy/perseus-score": "8.12.14",
54
54
  "@khanacademy/pure-markdown": "2.3.2",
55
55
  "@khanacademy/simple-markdown": "3.0.1"
56
56
  },