@khanacademy/perseus 10.0.1 → 11.0.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/article-renderer.d.ts +5 -7
  3. package/dist/components/zoomable.d.ts +2 -0
  4. package/dist/es/index.css +26 -0
  5. package/dist/es/index.js +184 -203
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/index.css +26 -0
  8. package/dist/index.js +184 -203
  9. package/dist/index.js.map +1 -1
  10. package/dist/perseus-api.d.ts +2 -2
  11. package/dist/server-item-renderer.d.ts +5 -4
  12. package/dist/types.d.ts +2 -1
  13. package/dist/widgets/expression.d.ts +12 -12
  14. package/package.json +5 -4
  15. package/src/__stories__/article-renderer.stories.tsx +22 -0
  16. package/src/__testdata__/article-renderer.testdata.ts +28 -0
  17. package/src/__tests__/__snapshots__/renderer.test.tsx.snap +1 -1
  18. package/src/__tests__/server-item-renderer.test.tsx +12 -4
  19. package/src/article-renderer.tsx +14 -27
  20. package/src/components/__stories__/zoomable.stories.tsx +9 -1
  21. package/src/components/zoomable-tex.tsx +2 -0
  22. package/src/components/zoomable.tsx +10 -3
  23. package/src/server-item-renderer.tsx +10 -7
  24. package/src/styles/widgets/image.less +32 -0
  25. package/src/types.ts +2 -4
  26. package/src/widgets/__stories__/expression.stories.tsx +3 -3
  27. package/src/widgets/__stories__/image.stories.tsx +37 -0
  28. package/src/widgets/__tests__/__snapshots__/categorizer.test.ts.snap +1 -1
  29. package/src/widgets/__tests__/__snapshots__/group.test.tsx.snap +2 -2
  30. package/src/widgets/__tests__/__snapshots__/image.test.ts.snap +9 -11
  31. package/src/widgets/__tests__/__snapshots__/matrix.test.ts.snap +1 -1
  32. package/src/widgets/__tests__/__snapshots__/number-line.test.ts.snap +1 -1
  33. package/src/widgets/image.tsx +8 -31
  34. package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @khanacademy/perseus
2
2
 
3
+ ## 11.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 2af4f9fa: Switch from using ProvideKeypad in ArticleRenderer to passing the keypad element down instead
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [2af4f9fa]
12
+ - @khanacademy/math-input@11.0.0
13
+ - @khanacademy/perseus-core@1.0.0
14
+
15
+ ## 10.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 3078825a: Remove animation when math is first drawn on a page
20
+ - 100fb7e5: Update design of image widget's caption
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [3f7be05a]
25
+ - Updated dependencies [810c7bd9]
26
+ - Updated dependencies [b161d004]
27
+ - Updated dependencies [a99a9ca4]
28
+ - @khanacademy/math-input@10.1.1
29
+
3
30
  ## 10.0.1
4
31
 
5
32
  ### Patch Changes
@@ -6,6 +6,8 @@ import * as React from "react";
6
6
  import type { KeypadProps } from "./mixins/provide-keypad";
7
7
  import type { PerseusRenderer } from "./perseus-types";
8
8
  import type { APIOptions, PerseusDependenciesV2 } from "./types";
9
+ import type { KeypadAPI } from "@khanacademy/math-input";
10
+ import type { KeypadContextRendererInterface } from "@khanacademy/perseus-core";
9
11
  import type { LinterContextProps } from "@khanacademy/perseus-linter";
10
12
  type Props = {
11
13
  apiOptions: APIOptions;
@@ -16,6 +18,7 @@ type Props = {
16
18
  useNewStyles: boolean;
17
19
  linterContext: LinterContextProps;
18
20
  legacyPerseusLint?: ReadonlyArray<string>;
21
+ keypadElement?: KeypadAPI | null | undefined;
19
22
  dependencies: PerseusDependenciesV2;
20
23
  } & KeypadProps;
21
24
  type DefaultProps = {
@@ -23,17 +26,12 @@ type DefaultProps = {
23
26
  useNewStyles: Props["useNewStyles"];
24
27
  linterContext: Props["linterContext"];
25
28
  };
26
- type State = {
27
- keypadElement: any | null;
28
- };
29
- declare class ArticleRenderer extends React.Component<Props, State> {
29
+ declare class ArticleRenderer extends React.Component<Props> implements KeypadContextRendererInterface {
30
30
  _currentFocus: any;
31
31
  static defaultProps: DefaultProps;
32
32
  constructor(props: Props);
33
33
  componentDidMount(): void;
34
- shouldComponentUpdate(nextProps: Props, nextState: State): boolean;
35
- componentWillUnmount(): void;
36
- keypadElement: () => void;
34
+ shouldComponentUpdate(nextProps: Props): boolean;
37
35
  _handleFocusChange: (arg1: any, arg2: any) => void;
38
36
  _setCurrentFocus: (arg1: any) => void;
39
37
  _onRendererBlur: (arg1: any) => void;
@@ -9,6 +9,7 @@ type Bounds = {
9
9
  type Props = {
10
10
  children: React.ReactNode;
11
11
  animateHeight: boolean;
12
+ disableEntranceAnimation: boolean;
12
13
  /**
13
14
  * Optional function that allows customizations in zooming.
14
15
  *
@@ -26,6 +27,7 @@ type DefaultProps = {
26
27
  animateHeight: Props["animateHeight"];
27
28
  computeChildBounds: Props["computeChildBounds"];
28
29
  readyToMeasure: Props["readyToMeasure"];
30
+ disableEntranceAnimation: Props["disableEntranceAnimation"];
29
31
  };
30
32
  type State = {
31
33
  visible: boolean;
package/dist/es/index.css CHANGED
@@ -2799,9 +2799,35 @@ body.mobile .categorizer-container td.category input[type="radio"] + span:active
2799
2799
  top: calc(50% - 7px);
2800
2800
  margin-left: -20px;
2801
2801
  }
2802
+ .perseus-image-widget {
2803
+ margin: 0;
2804
+ }
2802
2805
  .perseus-image-widget .perseus-image-title {
2803
2806
  text-align: center;
2804
2807
  }
2808
+ .perseus-image-widget .perseus-image-caption {
2809
+ color: rgba(33, 36, 44, 0.7);
2810
+ max-width: 420px;
2811
+ padding-left: 16px;
2812
+ position: relative;
2813
+ top: -12px;
2814
+ }
2815
+ .perseus-image-widget .perseus-image-caption::before {
2816
+ content: "";
2817
+ position: absolute;
2818
+ top: 0;
2819
+ bottom: 0;
2820
+ left: 0;
2821
+ margin-left: 4px;
2822
+ width: 1px;
2823
+ background-color: rgba(33, 36, 44, 0.5);
2824
+ border: 1px solid rgba(33, 36, 44, 0.5);
2825
+ border-radius: 2px;
2826
+ }
2827
+ .perseus-image-widget .perseus-image-caption .paragraph {
2828
+ font-size: 14px;
2829
+ padding-right: 12px;
2830
+ }
2805
2831
  .perseus-image-editor .label-settings td {
2806
2832
  padding: 5px 4px;
2807
2833
  text-align: center;