@khanacademy/perseus 84.0.2 → 84.1.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 (46) hide show
  1. package/dist/components/drag-and-drop/choice-bank.d.ts +16 -0
  2. package/dist/es/index.css +4 -4
  3. package/dist/es/index.css.map +1 -1
  4. package/dist/es/index.js +59 -59
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/index.css +4 -4
  7. package/dist/index.css.map +1 -1
  8. package/dist/index.d.ts +0 -1
  9. package/dist/index.js +59 -59
  10. package/dist/index.js.map +1 -1
  11. package/dist/renderer.new.d.ts +2 -2
  12. package/dist/renderer.old.d.ts +2 -2
  13. package/dist/types.d.ts +7 -9
  14. package/dist/widget-ai-utils/matcher/matcher-ai-utils.d.ts +1 -1
  15. package/dist/widget-ai-utils/prompt-types.d.ts +1 -2
  16. package/dist/widget-container.new.d.ts +1 -8
  17. package/dist/widget-container.old.d.ts +1 -8
  18. package/dist/widgets/blank/blank.d.ts +3 -58
  19. package/dist/widgets/categorizer/categorizer.d.ts +4 -61
  20. package/dist/widgets/cs-program/cs-program.d.ts +3 -58
  21. package/dist/widgets/dropdown/dropdown.d.ts +2 -58
  22. package/dist/widgets/expression/expression.d.ts +4 -124
  23. package/dist/widgets/iframe/iframe.d.ts +0 -2
  24. package/dist/widgets/image/components/common-image-props.d.ts +11 -0
  25. package/dist/widgets/image/components/explore-image-modal-content.d.ts +4 -4
  26. package/dist/widgets/image/components/explore-image-modal.d.ts +2 -4
  27. package/dist/widgets/image/components/image-info-area.d.ts +3 -23
  28. package/dist/widgets/image/image.d.ts +3 -58
  29. package/dist/widgets/input-number/input-number.d.ts +3 -2
  30. package/dist/widgets/interaction/interaction.d.ts +0 -5
  31. package/dist/widgets/interactive-graphs/graphs/polygon.d.ts +3 -2
  32. package/dist/widgets/interactive-graphs/graphs/strings/polygon.d.ts +3 -2
  33. package/dist/widgets/interactive-graphs/interactive-graph.d.ts +20 -20
  34. package/dist/widgets/interactive-graphs/mafs-graph.d.ts +11 -10
  35. package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +12 -12
  36. package/dist/widgets/label-image/label-image.d.ts +2 -61
  37. package/dist/widgets/matcher/matcher.d.ts +2 -58
  38. package/dist/widgets/measurer/measurer.d.ts +1 -1
  39. package/dist/widgets/mock-widgets/mock-widget.d.ts +3 -3
  40. package/dist/widgets/number-line/number-line.d.ts +3 -59
  41. package/dist/widgets/numeric-input/numeric-input.d.ts +3 -119
  42. package/dist/widgets/phet-simulation/phet-simulation.d.ts +1 -1
  43. package/dist/widgets/python-program/python-program.d.ts +7 -8
  44. package/dist/widgets/table/table.d.ts +2 -58
  45. package/package.json +7 -7
  46. package/dist/widget-ai-utils/input-number/input-number-ai-utils.d.ts +0 -29
@@ -1,128 +1,12 @@
1
1
  import * as React from "react";
2
2
  import { getCorrectUserInput, getOneCorrectAnswerFromRubric, getStartUserInput, getUserInputFromSerializedState } from "./utils";
3
- import type { Widget } from "../../types";
3
+ import type { Widget, WidgetProps } from "../../types";
4
4
  import type { PerseusNumericInputUserInput, PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
5
- /**
6
- * The NumericInput widget is a numeric input field that supports a variety of
7
- * answer forms, including integers, decimals, fractions, and mixed numbers.
8
- */
9
- export declare const NumericInput: React.ForwardRefExoticComponent<PerseusNumericInputWidgetOptions & {
10
- trackInteraction: (extraData?: Empty | undefined) => void;
11
- widgetId: string;
12
- widgetIndex: number;
13
- alignment: string | null | undefined;
14
- static: boolean | null | undefined;
15
- graded?: boolean | null;
16
- problemNum: number | null | undefined;
17
- apiOptions: Readonly<Readonly<{
18
- isArticle?: boolean;
19
- onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
20
- showAlignmentOptions?: boolean;
21
- readOnly?: boolean;
22
- editingDisabled?: boolean;
23
- answerableCallback?: (arg1: boolean) => unknown;
24
- getAnotherHint?: () => unknown;
25
- interactionCallback?: (widgetData: {
26
- [widgetId: string]: any;
27
- }) => void;
28
- imagePlaceholder?: React.ReactNode;
29
- widgetPlaceholder?: React.ReactNode;
30
- baseElements?: {
31
- Link: React.ComponentType<any>;
32
- };
33
- trackInteraction?: (args: {
34
- type: string;
35
- id: string;
36
- correct?: boolean;
37
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
38
- visible: number;
39
- }>) => void;
40
- customKeypad?: boolean;
41
- isMobile?: boolean;
42
- isMobileApp?: boolean;
43
- hintProgressColor?: string;
44
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
45
- }> & {
46
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
47
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
48
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
49
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
50
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
51
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
52
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
53
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
54
- }>;
55
- keypadElement?: any;
56
- onFocus: (blurPath: import("../..").FocusPath) => void;
57
- onBlur: (blurPath: import("../..").FocusPath) => void;
58
- findWidgets: import("../../types").FindWidgetsFunction;
59
- reviewMode: boolean;
60
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
61
- handleUserInput: (newUserInput: PerseusNumericInputUserInput, cb?: () => void, silent?: boolean) => void;
62
- userInput: PerseusNumericInputUserInput;
63
- linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
64
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
65
- } & React.RefAttributes<Widget>>;
5
+ type Props = WidgetProps<PerseusNumericInputWidgetOptions, PerseusNumericInputUserInput>;
66
6
  declare const _default: {
67
7
  name: string;
68
8
  displayName: string;
69
- widget: React.ForwardRefExoticComponent<PerseusNumericInputWidgetOptions & {
70
- trackInteraction: (extraData?: Empty | undefined) => void;
71
- widgetId: string;
72
- widgetIndex: number;
73
- alignment: string | null | undefined;
74
- static: boolean | null | undefined;
75
- graded?: boolean | null;
76
- problemNum: number | null | undefined;
77
- apiOptions: Readonly<Readonly<{
78
- isArticle?: boolean;
79
- onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
80
- showAlignmentOptions?: boolean;
81
- readOnly?: boolean;
82
- editingDisabled?: boolean;
83
- answerableCallback?: (arg1: boolean) => unknown;
84
- getAnotherHint?: () => unknown;
85
- interactionCallback?: (widgetData: {
86
- [widgetId: string]: any;
87
- }) => void;
88
- imagePlaceholder?: React.ReactNode;
89
- widgetPlaceholder?: React.ReactNode;
90
- baseElements?: {
91
- Link: React.ComponentType<any>;
92
- };
93
- trackInteraction?: (args: {
94
- type: string;
95
- id: string;
96
- correct?: boolean;
97
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
98
- visible: number;
99
- }>) => void;
100
- customKeypad?: boolean;
101
- isMobile?: boolean;
102
- isMobileApp?: boolean;
103
- hintProgressColor?: string;
104
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
105
- }> & {
106
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
107
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
108
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
109
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
110
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
111
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
112
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
113
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
114
- }>;
115
- keypadElement?: any;
116
- onFocus: (blurPath: import("../..").FocusPath) => void;
117
- onBlur: (blurPath: import("../..").FocusPath) => void;
118
- findWidgets: import("../../types").FindWidgetsFunction;
119
- reviewMode: boolean;
120
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
121
- handleUserInput: (newUserInput: PerseusNumericInputUserInput, cb?: () => void, silent?: boolean) => void;
122
- userInput: PerseusNumericInputUserInput;
123
- linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
124
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
125
- } & React.RefAttributes<Widget>>;
9
+ widget: React.ForwardRefExoticComponent<Props & React.RefAttributes<Widget>>;
126
10
  isLintable: true;
127
11
  getCorrectUserInput: typeof getCorrectUserInput;
128
12
  getOneCorrectAnswerFromRubric: typeof getOneCorrectAnswerFromRubric;
@@ -23,7 +23,7 @@ export declare class PhetSimulation extends React.Component<Props, State> implem
23
23
  isWidget: true;
24
24
  state: State;
25
25
  componentDidMount(): Promise<void>;
26
- componentDidUpdate(prevProps: any): Promise<void>;
26
+ componentDidUpdate(prevProps: Props): Promise<void>;
27
27
  private getLocale;
28
28
  getPromptJSON(): UnsupportedWidgetPromptJSON;
29
29
  displayLoadFailure: () => void;
@@ -1,13 +1,12 @@
1
- import * as React from "react";
2
- import { type PerseusDependenciesV2 } from "../../types";
3
- type Props = {
4
- programID: string;
5
- height: number;
6
- dependencies: PerseusDependenciesV2;
7
- };
1
+ import React from "react";
2
+ import type { PerseusDependenciesV2, Widget, WidgetProps } from "../../types";
3
+ import type { PerseusPythonProgramWidgetOptions } from "@khanacademy/perseus-core";
4
+ type WidgetHandle = Pick<Widget, "getPromptJSON">;
8
5
  declare const _default: {
9
6
  name: string;
10
7
  displayName: string;
11
- widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
8
+ widget: React.ForwardRefExoticComponent<Omit<Omit<WidgetProps<PerseusPythonProgramWidgetOptions> & {
9
+ dependencies: PerseusDependenciesV2;
10
+ } & React.RefAttributes<WidgetHandle>, "dependencies">, "ref"> & React.RefAttributes<any>>;
12
11
  };
13
12
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { FocusPath, Widget } from "../../types";
2
+ import type { Widget, WidgetProps } from "../../types";
3
3
  import type { PerseusTableWidgetOptions, PerseusTableUserInput } from "@khanacademy/perseus-core";
4
4
  type EditorProps = {
5
5
  editableHeaders?: boolean;
@@ -16,63 +16,7 @@ declare function getUserInputFromSerializedState(serializedState: any): PerseusT
16
16
  declare const _default: {
17
17
  name: string;
18
18
  displayName: string;
19
- widget: React.ForwardRefExoticComponent<PerseusTableWidgetOptions & {
20
- trackInteraction: (extraData?: Empty | undefined) => void;
21
- widgetId: string;
22
- widgetIndex: number;
23
- alignment: string | null | undefined;
24
- static: boolean | null | undefined;
25
- graded?: boolean | null;
26
- problemNum: number | null | undefined;
27
- apiOptions: Readonly<Readonly<{
28
- isArticle?: boolean;
29
- onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
30
- showAlignmentOptions?: boolean;
31
- readOnly?: boolean;
32
- editingDisabled?: boolean;
33
- answerableCallback?: (arg1: boolean) => unknown;
34
- getAnotherHint?: () => unknown;
35
- interactionCallback?: (widgetData: {
36
- [widgetId: string]: any;
37
- }) => void;
38
- imagePlaceholder?: React.ReactNode;
39
- widgetPlaceholder?: React.ReactNode;
40
- baseElements?: {
41
- Link: React.ComponentType<any>;
42
- };
43
- trackInteraction?: (args: {
44
- type: string;
45
- id: string;
46
- correct?: boolean;
47
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
48
- visible: number;
49
- }>) => void;
50
- customKeypad?: boolean;
51
- isMobile?: boolean;
52
- isMobileApp?: boolean;
53
- hintProgressColor?: string;
54
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
55
- }> & {
56
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
57
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
58
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
59
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
60
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
61
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
62
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
63
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
64
- }>;
65
- keypadElement?: any;
66
- onFocus: (blurPath: FocusPath) => void;
67
- onBlur: (blurPath: FocusPath) => void;
68
- findWidgets: import("../../types").FindWidgetsFunction;
69
- reviewMode: boolean;
70
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
71
- handleUserInput: (newUserInput: PerseusTableUserInput, cb?: () => void, silent?: boolean) => void;
72
- userInput: PerseusTableUserInput;
73
- linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
74
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
75
- } & EditorProps & React.RefAttributes<Widget>>;
19
+ widget: React.ForwardRefExoticComponent<WidgetProps<PerseusTableWidgetOptions, PerseusTableUserInput> & EditorProps & React.RefAttributes<Widget>>;
76
20
  hidden: true;
77
21
  isLintable: true;
78
22
  getStartUserInput: typeof getStartUserInput;
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.2",
6
+ "version": "84.1.1",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -44,13 +44,13 @@
44
44
  "tiny-invariant": "1.3.1",
45
45
  "uuid": "^10.0.0",
46
46
  "@khanacademy/kas": "2.2.6",
47
- "@khanacademy/keypad-context": "3.2.82",
48
- "@khanacademy/kmath": "2.4.41",
49
- "@khanacademy/math-input": "27.0.2",
50
- "@khanacademy/perseus-core": "35.0.0",
51
- "@khanacademy/perseus-linter": "5.1.22",
47
+ "@khanacademy/keypad-context": "3.2.84",
48
+ "@khanacademy/kmath": "2.4.43",
49
+ "@khanacademy/math-input": "27.0.4",
50
+ "@khanacademy/perseus-core": "36.1.0",
51
+ "@khanacademy/perseus-linter": "5.1.24",
52
+ "@khanacademy/perseus-score": "8.12.16",
52
53
  "@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
  },
@@ -1,29 +0,0 @@
1
- import type inputNumber from "../../widgets/input-number/input-number";
2
- import type React from "react";
3
- /**
4
- * JSON describing an InputNumber widget. Intended for consumption by AI tools.
5
- * An InputNumber displays a text field where users can enter numbers in a
6
- * variety of formats: decimals, integers, fractions, mixed numbers,
7
- * percentages, and multiples of pi. The allowed formats are configurable by
8
- * the content creator.
9
- */
10
- export type InputNumberPromptJSON = {
11
- type: "input-number";
12
- /**
13
- * Accessible label for the input field, set by the content creator.
14
- * Shown to learners using screen readers to describe what value should
15
- * be entered.
16
- */
17
- label?: string;
18
- /**
19
- * The current state of the widget user interface. Usually represents a
20
- * learner's attempt to answer a question.
21
- */
22
- userInput: {
23
- /**
24
- * The text currently entered in the input field by the learner.
25
- */
26
- value: string;
27
- };
28
- };
29
- export declare const getPromptJSON: (widgetData: React.ComponentProps<typeof inputNumber.widget>) => InputNumberPromptJSON;