@khanacademy/perseus 21.6.0 → 22.0.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.
Files changed (62) hide show
  1. package/dist/article-renderer.d.ts +6 -0
  2. package/dist/components/highlighting/ui/highlight-set-renderer.d.ts +14 -0
  3. package/dist/components/highlighting/ui/highlighting-ui.d.ts +17 -0
  4. package/dist/components/i18n-context.d.ts +16 -0
  5. package/dist/components/input-with-examples.d.ts +6 -0
  6. package/dist/components/math-input.d.ts +22 -2
  7. package/dist/components/number-input.d.ts +6 -0
  8. package/dist/es/index.js +883 -496
  9. package/dist/es/index.js.map +1 -1
  10. package/dist/es/strings.js +312 -0
  11. package/dist/es/strings.js.map +1 -0
  12. package/dist/hint-renderer.d.ts +6 -0
  13. package/dist/hints-renderer.d.ts +6 -0
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.js +1099 -534
  16. package/dist/index.js.map +1 -1
  17. package/dist/multi-items/multi-renderer.d.ts +6 -0
  18. package/dist/perseus-types.d.ts +3 -2
  19. package/dist/renderer.d.ts +2 -0
  20. package/dist/server-item-renderer.d.ts +6 -0
  21. package/dist/strings.d.ts +190 -0
  22. package/dist/strings.js +395 -119
  23. package/dist/strings.js.map +1 -0
  24. package/dist/types.d.ts +2 -1
  25. package/dist/util/answer-types.d.ts +4 -12
  26. package/dist/util.d.ts +2 -1
  27. package/dist/widgets/categorizer.d.ts +8 -1
  28. package/dist/widgets/definition.d.ts +6 -0
  29. package/dist/widgets/deprecated-standin/index.d.ts +6 -0
  30. package/dist/widgets/explanation.d.ts +6 -0
  31. package/dist/widgets/expression.d.ts +12 -1
  32. package/dist/widgets/graded-group-answer-bar.d.ts +6 -0
  33. package/dist/widgets/graded-group.d.ts +6 -0
  34. package/dist/widgets/group.d.ts +6 -0
  35. package/dist/widgets/image.d.ts +6 -0
  36. package/dist/widgets/input-number.d.ts +8 -1
  37. package/dist/widgets/interactive-graph.d.ts +6 -0
  38. package/dist/widgets/interactive-graphs/graphs/components/arrowhead.d.ts +1 -0
  39. package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +21 -0
  40. package/dist/widgets/interactive-graphs/locked-point.d.ts +1 -1
  41. package/dist/widgets/interactive-graphs/mafs-graph.d.ts +1 -0
  42. package/dist/widgets/interactive-graphs/reducer/use-graph-config.d.ts +1 -0
  43. package/dist/widgets/label-image/marker.d.ts +6 -0
  44. package/dist/widgets/label-image.d.ts +6 -0
  45. package/dist/widgets/matcher.d.ts +6 -0
  46. package/dist/widgets/matrix.d.ts +9 -1
  47. package/dist/widgets/molecule.d.ts +6 -0
  48. package/dist/widgets/number-line.d.ts +6 -0
  49. package/dist/widgets/numeric-input.d.ts +8 -1
  50. package/dist/widgets/passage-ref-target.d.ts +6 -0
  51. package/dist/widgets/passage-ref.d.ts +6 -0
  52. package/dist/widgets/passage.d.ts +6 -0
  53. package/dist/widgets/plotter.d.ts +6 -0
  54. package/dist/widgets/radio/choice-a11y-text.d.ts +2 -1
  55. package/dist/widgets/radio/radio.d.ts +8 -1
  56. package/dist/widgets/radio/util.d.ts +2 -1
  57. package/dist/widgets/table.d.ts +7 -0
  58. package/dist/widgets/unit.d.ts +8 -1
  59. package/dist/widgets/video.d.ts +6 -0
  60. package/dist/widgets.d.ts +2 -1
  61. package/package.json +18 -6
  62. package/dist/widgets/label-image/strings.d.ts +0 -3
@@ -1,5 +1,7 @@
1
1
  import * as React from "react";
2
+ import { PerseusI18nContext } from "../components/i18n-context";
2
3
  import type { PerseusUnitInputWidgetOptions } from "../perseus-types";
4
+ import type { PerseusStrings } from "../strings";
3
5
  import type { APIOptions, ChangeHandler, FocusPath } from "../types";
4
6
  export declare const countSigfigs: (value: string) => number;
5
7
  export declare const sigfigPrint: (num: number, sigfigs: number) => string;
@@ -34,9 +36,14 @@ type DefaultProps = {
34
36
  value: Props["value"];
35
37
  };
36
38
  export declare class OldUnitInput extends React.Component<Props> {
39
+ static contextType: React.Context<{
40
+ strings: PerseusStrings;
41
+ locale: string;
42
+ }>;
43
+ context: React.ContextType<typeof PerseusI18nContext>;
37
44
  _errorTimeout: number | null | undefined;
38
45
  static defaultProps: DefaultProps;
39
- static validate(userInput: string, rubric: Rubric): ValidationResult;
46
+ static validate(userInput: string, rubric: Rubric, strings: PerseusStrings): ValidationResult;
40
47
  componentDidUpdate(): void;
41
48
  componentWillUnmount(): void;
42
49
  _showError: () => void;
@@ -2,6 +2,7 @@
2
2
  * This is a video widget for embedding videos in articles.
3
3
  */
4
4
  import * as React from "react";
5
+ import { PerseusI18nContext } from "../components/i18n-context";
5
6
  import type { PerseusVideoWidgetOptions } from "../perseus-types";
6
7
  import type { PerseusScore, WidgetProps } from "../types";
7
8
  type UserInput = null;
@@ -14,6 +15,11 @@ type Props = WidgetProps<RenderProps, Rubric> & {
14
15
  * Video renderer.
15
16
  */
16
17
  declare class Video extends React.Component<Props> {
18
+ static contextType: React.Context<{
19
+ strings: import("../strings").PerseusStrings;
20
+ locale: string;
21
+ }>;
22
+ context: React.ContextType<typeof PerseusI18nContext>;
17
23
  /**
18
24
  * This is the widget's grading function.
19
25
  * Points for videos are tallied by the embedded video itself, in the case
package/dist/widgets.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { PerseusWidget } from "./perseus-types";
2
+ import type { PerseusStrings } from "./strings";
2
3
  import type { Alignment, Tracking, Version, WidgetExports, WidgetTransform } from "./types";
3
4
  import type * as React from "react";
4
5
  type Editor = any;
@@ -36,7 +37,7 @@ export declare const getPublicWidgets: () => ReadonlyArray<WidgetExports>;
36
37
  export declare const isAccessible: (widgetInfo: PerseusWidget) => boolean;
37
38
  export declare const getAllWidgetTypes: () => ReadonlyArray<string>;
38
39
  export declare const upgradeWidgetInfoToLatestVersion: (oldWidgetInfo: PerseusWidget) => PerseusWidget;
39
- export declare const getRendererPropsForWidgetInfo: (widgetInfo: PerseusWidget, problemNum?: number) => PerseusWidget;
40
+ export declare const getRendererPropsForWidgetInfo: (widgetInfo: PerseusWidget, strings: PerseusStrings, problemNum?: number) => PerseusWidget;
40
41
  export declare const traverseChildWidgets: (widgetInfo: PerseusWidget, traverseRenderer: any) => PerseusWidget;
41
42
  /**
42
43
  * Handling for the optional alignments for widgets
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": "21.6.0",
6
+ "version": "22.0.1",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -18,6 +18,20 @@
18
18
  "module": "dist/es/index.js",
19
19
  "main": "dist/index.js",
20
20
  "source": "src/index.ts",
21
+ "exports": {
22
+ ".": {
23
+ "import": "./dist/es/index.js",
24
+ "require": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "source": "./src/index.ts"
27
+ },
28
+ "./strings": {
29
+ "import": "./dist/es/strings.js",
30
+ "require": "./dist/strings.js",
31
+ "types": "./dist/strings.d.ts",
32
+ "source": "./src/strings.ts"
33
+ }
34
+ },
21
35
  "files": [
22
36
  "dist"
23
37
  ],
@@ -27,10 +41,10 @@
27
41
  "dependencies": {
28
42
  "@khanacademy/kas": "^0.3.9",
29
43
  "@khanacademy/kmath": "^0.1.12",
30
- "@khanacademy/math-input": "^17.5.0",
44
+ "@khanacademy/math-input": "^18.0.0",
31
45
  "@khanacademy/perseus-core": "1.4.2",
32
46
  "@khanacademy/perseus-linter": "^0.3.12",
33
- "@khanacademy/pure-markdown": "^0.3.1",
47
+ "@khanacademy/pure-markdown": "^0.3.2",
34
48
  "@khanacademy/simple-markdown": "^0.11.4",
35
49
  "mafs": "https://github.com/Khan/mafs/releases/download/v0.18.1%2Bbuild-cd8b2467893342ba0b02100073fe21f93f8b1125/mafs-0.18.1.tgz"
36
50
  },
@@ -42,7 +56,6 @@
42
56
  "@khanacademy/wonder-blocks-data": "^13.0.7",
43
57
  "@khanacademy/wonder-blocks-dropdown": "^5.2.0",
44
58
  "@khanacademy/wonder-blocks-form": "^4.5.0",
45
- "@khanacademy/wonder-blocks-i18n": "^2.0.2",
46
59
  "@khanacademy/wonder-blocks-icon": "^4.1.0",
47
60
  "@khanacademy/wonder-blocks-layout": "^2.0.31",
48
61
  "@khanacademy/wonder-blocks-link": "^6.1.0",
@@ -63,7 +76,7 @@
63
76
  "jquery": "^2.1.1",
64
77
  "katex": "^0.11.1",
65
78
  "lodash.debounce": "^4.0.8",
66
- "perseus-build-settings": "^0.3.0",
79
+ "perseus-build-settings": "^0.4.0",
67
80
  "prop-types": "^15.6.1",
68
81
  "react": "16.14.0",
69
82
  "react-dom": "16.14.0",
@@ -78,7 +91,6 @@
78
91
  "@khanacademy/wonder-blocks-data": "^13.0.7",
79
92
  "@khanacademy/wonder-blocks-dropdown": "^5.2.0",
80
93
  "@khanacademy/wonder-blocks-form": "^4.5.0",
81
- "@khanacademy/wonder-blocks-i18n": "^2.0.2",
82
94
  "@khanacademy/wonder-blocks-icon": "^4.1.0",
83
95
  "@khanacademy/wonder-blocks-layout": "^2.0.31",
84
96
  "@khanacademy/wonder-blocks-link": "^6.1.0",
@@ -1,3 +0,0 @@
1
- export declare const strings: {
2
- hideAnswersToggleLabel: string;
3
- };