@khanacademy/perseus 82.1.0 → 82.2.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 (35) hide show
  1. package/dist/components/sortable.d.ts +1 -1
  2. package/dist/es/index.css +1 -1
  3. package/dist/es/index.css.map +1 -1
  4. package/dist/es/index.js +38 -35
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/es/strings.js +1 -1
  7. package/dist/es/strings.js.map +1 -1
  8. package/dist/index.css +1 -1
  9. package/dist/index.css.map +1 -1
  10. package/dist/index.js +37 -33
  11. package/dist/index.js.map +1 -1
  12. package/dist/question-paragraph.new.d.ts +9 -0
  13. package/dist/renderer.new.d.ts +1 -1
  14. package/dist/renderer.old.d.ts +1 -1
  15. package/dist/strings.d.ts +6 -0
  16. package/dist/strings.js +1 -1
  17. package/dist/strings.js.map +1 -1
  18. package/dist/util.d.ts +23 -0
  19. package/dist/widget-ai-utils/input-number/input-number-ai-utils.d.ts +1 -1
  20. package/dist/widget-ai-utils/numeric-input/prompt-utils.d.ts +1 -1
  21. package/dist/{widget-container.d.ts → widget-container.new.d.ts} +5 -0
  22. package/dist/widget-container.old.d.ts +31 -0
  23. package/dist/widgets/categorizer/categorizer.d.ts +63 -8
  24. package/dist/widgets/cs-program/cs-program.d.ts +1 -2
  25. package/dist/widgets/dropdown/dropdown.d.ts +1 -2
  26. package/dist/widgets/image/image.d.ts +1 -2
  27. package/dist/widgets/input-number/input-number.d.ts +60 -4
  28. package/dist/widgets/matcher/matcher.d.ts +66 -32
  29. package/dist/widgets/number-line/number-line.d.ts +1 -4
  30. package/dist/widgets/numeric-input/index.d.ts +1 -1
  31. package/dist/widgets/numeric-input/numeric-input.d.ts +76 -53
  32. package/dist/widgets/numeric-input/utils.d.ts +14 -1
  33. package/dist/widgets/phet-simulation/phet-simulation.d.ts +2 -0
  34. package/package.json +11 -11
  35. package/dist/widgets/numeric-input/numeric-input.class.d.ts +0 -127
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": "82.1.0",
6
+ "version": "82.2.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -42,13 +42,13 @@
42
42
  "mafs": "0.19.0",
43
43
  "tiny-invariant": "1.3.1",
44
44
  "uuid": "^10.0.0",
45
- "@khanacademy/kas": "2.2.3",
46
- "@khanacademy/keypad-context": "3.2.77",
47
- "@khanacademy/kmath": "2.4.36",
48
- "@khanacademy/math-input": "26.6.6",
49
- "@khanacademy/perseus-core": "33.0.1",
50
- "@khanacademy/perseus-linter": "5.1.17",
51
- "@khanacademy/perseus-score": "8.12.9",
45
+ "@khanacademy/kas": "2.2.4",
46
+ "@khanacademy/keypad-context": "3.2.78",
47
+ "@khanacademy/kmath": "2.4.37",
48
+ "@khanacademy/math-input": "26.6.7",
49
+ "@khanacademy/perseus-core": "34.0.0",
50
+ "@khanacademy/perseus-linter": "5.1.18",
51
+ "@khanacademy/perseus-score": "8.12.10",
52
52
  "@khanacademy/perseus-utils": "2.1.5",
53
53
  "@khanacademy/pure-markdown": "2.3.1",
54
54
  "@khanacademy/simple-markdown": "3.0.0"
@@ -59,7 +59,7 @@
59
59
  "@khanacademy/wonder-blocks-button": "11.7.6",
60
60
  "@khanacademy/wonder-blocks-clickable": "8.2.8",
61
61
  "@khanacademy/wonder-blocks-core": "12.4.4",
62
- "@khanacademy/wonder-blocks-data": "15.0.2",
62
+ "@khanacademy/wonder-blocks-data": "15.0.3",
63
63
  "@khanacademy/wonder-blocks-dropdown": "10.11.7",
64
64
  "@khanacademy/wonder-blocks-form": "7.6.9",
65
65
  "@khanacademy/wonder-blocks-icon": "5.3.22",
@@ -96,7 +96,7 @@
96
96
  "@khanacademy/wonder-blocks-button": "^11.7.6",
97
97
  "@khanacademy/wonder-blocks-clickable": "^8.2.8",
98
98
  "@khanacademy/wonder-blocks-core": "^12.4.4",
99
- "@khanacademy/wonder-blocks-data": "^15.0.2",
99
+ "@khanacademy/wonder-blocks-data": "^15.0.3",
100
100
  "@khanacademy/wonder-blocks-dropdown": "^10.11.7",
101
101
  "@khanacademy/wonder-blocks-form": "^7.6.9",
102
102
  "@khanacademy/wonder-blocks-icon": "^5.3.22",
@@ -127,7 +127,7 @@
127
127
  },
128
128
  "keywords": [],
129
129
  "khan": {
130
- "catalogHash": "ad217163f04bf0b2"
130
+ "catalogHash": "3f4a3330f0a56ab9"
131
131
  },
132
132
  "scripts": {}
133
133
  }
@@ -1,127 +0,0 @@
1
- import * as React from "react";
2
- import type { Focusable, Widget, WidgetProps } from "../../types";
3
- import type { NumericInputPromptJSON } from "../../widget-ai-utils/numeric-input/prompt-utils";
4
- import type { PerseusNumericInputAnswerForm, PerseusNumericInputRubric, PerseusNumericInputUserInput, PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
5
- type ExternalProps = WidgetProps<PerseusNumericInputWidgetOptions, PerseusNumericInputUserInput>;
6
- export type NumericInputProps = ExternalProps & {
7
- size: NonNullable<ExternalProps["size"]>;
8
- textAlign: NonNullable<ExternalProps["textAlign"]>;
9
- apiOptions: NonNullable<ExternalProps["apiOptions"]>;
10
- coefficient: NonNullable<ExternalProps["coefficient"]>;
11
- answerForms: ReadonlyArray<PerseusNumericInputAnswerForm>;
12
- labelText: string;
13
- linterContext: NonNullable<ExternalProps["linterContext"]>;
14
- };
15
- type DefaultProps = Pick<NumericInputProps, "size" | "apiOptions" | "coefficient" | "answerForms" | "labelText" | "linterContext" | "userInput">;
16
- /**
17
- * The NumericInput widget is a numeric input field that supports a variety of
18
- * answer forms, including integers, decimals, fractions, and mixed numbers.
19
- *
20
- * [Jan 2025] We're currenly migrating from class-based components to functional
21
- * components. While we cannot fully migrate this component yet, we can start
22
- * by using the functional component for the rendering the UI of the widget.
23
- */
24
- export declare class NumericInput extends React.Component<NumericInputProps> implements Widget {
25
- inputRef: React.RefObject<Focusable>;
26
- static defaultProps: DefaultProps;
27
- focus: () => boolean;
28
- blur: () => void;
29
- focusInputPath: () => void;
30
- blurInputPath: () => void;
31
- getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
32
- /**
33
- * Returns the JSON representation of the prompt for this widget.
34
- * This is used by the AI to determine the prompt for the widget.
35
- */
36
- getPromptJSON(): NumericInputPromptJSON;
37
- /**
38
- * @deprecated and likely very broken API
39
- * [LEMS-3185] do not trust serializedState
40
- */
41
- getSerializedState(): {
42
- currentValue: string;
43
- labelText: string;
44
- size: string;
45
- coefficient: boolean;
46
- textAlign: "left" | "right" | "center";
47
- trackInteraction: (extraData?: Empty | undefined) => void;
48
- widgetId: string;
49
- widgetIndex: number;
50
- alignment: string | null | undefined;
51
- static: boolean | null | undefined;
52
- graded?: boolean | null;
53
- problemNum: number | null | undefined;
54
- apiOptions: Readonly<Readonly<{
55
- isArticle?: boolean;
56
- onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
57
- showAlignmentOptions?: boolean;
58
- readOnly?: boolean;
59
- editingDisabled?: boolean;
60
- answerableCallback?: (arg1: boolean) => unknown;
61
- getAnotherHint?: () => unknown;
62
- interactionCallback?: (widgetData: {
63
- [widgetId: string]: any;
64
- }) => void;
65
- imagePlaceholder?: React.ReactNode;
66
- widgetPlaceholder?: React.ReactNode;
67
- baseElements?: {
68
- Link: React.ComponentType<any>;
69
- };
70
- trackInteraction?: (args: {
71
- type: string;
72
- id: string;
73
- correct?: boolean;
74
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
75
- visible: number;
76
- }>) => void;
77
- customKeypad?: boolean;
78
- isMobile?: boolean;
79
- isMobileApp?: boolean;
80
- hintProgressColor?: string;
81
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
82
- }> & {
83
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
84
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
85
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
86
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
87
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
88
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
89
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
90
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
91
- }>;
92
- keypadElement?: any;
93
- onFocus: (blurPath: import("../..").FocusPath) => void;
94
- onBlur: (blurPath: import("../..").FocusPath) => void;
95
- findWidgets: import("../../types").FindWidgetsFunction;
96
- reviewMode: boolean;
97
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
98
- handleUserInput: (newUserInput: PerseusNumericInputUserInput, cb?: () => void, silent?: boolean) => void;
99
- linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
100
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
101
- answerForms: ReadonlyArray<PerseusNumericInputAnswerForm>;
102
- };
103
- render(): React.ReactNode;
104
- }
105
- declare function getStartUserInput(): PerseusNumericInputUserInput;
106
- /**
107
- * @deprecated and likely a very broken API
108
- * [LEMS-3185] do not trust serializedState
109
- */
110
- declare function getUserInputFromSerializedState(serializedState: any): PerseusNumericInputUserInput;
111
- export declare function findPrecision(value: number): number;
112
- export declare function findCommonFractions(value: number): {
113
- num: number;
114
- denom: number;
115
- } | undefined;
116
- declare function getCorrectUserInput(options: PerseusNumericInputWidgetOptions): PerseusNumericInputUserInput;
117
- declare const _default: {
118
- name: string;
119
- displayName: string;
120
- widget: typeof NumericInput;
121
- isLintable: true;
122
- getCorrectUserInput: typeof getCorrectUserInput;
123
- getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputRubric): string | null | undefined;
124
- getStartUserInput: typeof getStartUserInput;
125
- getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
126
- };
127
- export default _default;