@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
@@ -14,7 +14,7 @@ import type { APIOptions, APIOptionsWithDefaults, FilterCriterion, FindWidgetsFu
14
14
  import type { HandleUserInputCallback, InitializeUserInputCallback } from "./user-input-manager";
15
15
  import type { GetPromptJSONInterface, RendererPromptJSON } from "./widget-ai-utils/prompt-types";
16
16
  import type { KeypadAPI } from "@khanacademy/math-input";
17
- import type { PerseusRenderer, PerseusWidget, PerseusWidgetOptions, PerseusWidgetsMap, ShowSolutions, PerseusScore, UserInputMap } from "@khanacademy/perseus-core";
17
+ import type { PerseusRenderer, PerseusScore, PerseusWidget, PerseusWidgetOptions, PerseusWidgetsMap, ShowSolutions, UserInput, UserInputMap } from "@khanacademy/perseus-core";
18
18
  import type { LinterContextProps } from "@khanacademy/perseus-linter";
19
19
  import "./styles/perseus-renderer.new.css";
20
20
  type WidgetState = {
@@ -93,7 +93,7 @@ declare class Renderer extends React.Component<Props, State> implements GetPromp
93
93
  _isAnswerable(): boolean;
94
94
  renderWidget: (impliedType: string, id: string, state: WidgetState) => null | React.ReactNode;
95
95
  _getWidgetIndexById(id: string): number;
96
- getWidgetProps(widgetId: string): WidgetProps<any, any, PerseusWidgetOptions>;
96
+ getWidgetProps(widgetId: string): WidgetProps<PerseusWidgetOptions, UserInput>;
97
97
  /**
98
98
  * Serializes the questions state so it can be recovered.
99
99
  *
@@ -14,7 +14,7 @@ import type { APIOptions, APIOptionsWithDefaults, FilterCriterion, FindWidgetsFu
14
14
  import type { HandleUserInputCallback, InitializeUserInputCallback } from "./user-input-manager";
15
15
  import type { GetPromptJSONInterface, RendererPromptJSON } from "./widget-ai-utils/prompt-types";
16
16
  import type { KeypadAPI } from "@khanacademy/math-input";
17
- import type { PerseusRenderer, PerseusWidget, PerseusWidgetOptions, PerseusWidgetsMap, ShowSolutions, PerseusScore, UserInputMap } from "@khanacademy/perseus-core";
17
+ import type { PerseusRenderer, PerseusScore, PerseusWidget, PerseusWidgetOptions, PerseusWidgetsMap, ShowSolutions, UserInput, UserInputMap } from "@khanacademy/perseus-core";
18
18
  import type { LinterContextProps } from "@khanacademy/perseus-linter";
19
19
  import "./styles/perseus-renderer.css";
20
20
  type WidgetState = {
@@ -104,7 +104,7 @@ declare class Renderer extends React.Component<Props, State> implements GetPromp
104
104
  _isAnswerable(): boolean;
105
105
  renderWidget: (impliedType: string, id: string, state: WidgetState) => null | React.ReactNode;
106
106
  _getWidgetIndexById(id: string): number;
107
- getWidgetProps(widgetId: string): WidgetProps<any, any, PerseusWidgetOptions>;
107
+ getWidgetProps(widgetId: string): WidgetProps<PerseusWidgetOptions, UserInput>;
108
108
  /**
109
109
  * Serializes the questions state so it can be recovered.
110
110
  *
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { ILogger } from "./logging/log";
2
2
  import type { SizeClass } from "./util/sizing-utils";
3
3
  import type { WidgetPromptJSON } from "./widget-ai-utils/prompt-types";
4
- import type { Hint, PerseusAnswerArea, PerseusFeatureFlags, PerseusWidget, PerseusWidgetsMap, AnalyticsEventHandlerFn, LabelImageMarkerPublicData, PerseusLabelImageMarker, ShowSolutions } from "@khanacademy/perseus-core";
4
+ import type { Alignment, Hint, PerseusAnswerArea, PerseusFeatureFlags, PerseusWidget, PerseusWidgetsMap, AnalyticsEventHandlerFn, LabelImageMarkerPublicData, PerseusLabelImageMarker, ShowSolutions } from "@khanacademy/perseus-core";
5
5
  import type { LinterContextProps } from "@khanacademy/perseus-linter";
6
6
  import type { Result } from "@khanacademy/wonder-blocks-data";
7
7
  import type $ from "jquery";
@@ -316,18 +316,16 @@ export type FindWidgetsFunction = (filterFunc: FilterCriterion) => ReadonlyArray
316
316
  export type FilterCriterion = string | ((id: string, widgetInfo: PerseusWidget, widget?: Widget | null | undefined) => boolean);
317
317
  /**
318
318
  * The full set of props provided to all widgets when they are rendered. The
319
- * `TWidgetOptions` generic argument are the widget-specific props that originate
320
- * from the PerseusItem.
319
+ * widget-specific options that originate from the PerseusItem are nested under
320
+ * the `options` prop; everything else is provided to every widget regardless of
321
+ * its `type`.
321
322
  */
322
- export type WidgetProps<TWidgetOptions, TUserInput = Empty, TrackingExtraArgs = Empty> = TWidgetOptions & UniversalWidgetProps<TUserInput, TrackingExtraArgs>;
323
- /**
324
- * The props passed to every widget, regardless of its `type`.
325
- */
326
- type UniversalWidgetProps<TUserInput = Empty, TrackingExtraArgs = Empty> = {
323
+ export type WidgetProps<TWidgetOptions, TUserInput = Empty, TrackingExtraArgs = Empty> = {
324
+ options: TWidgetOptions;
327
325
  trackInteraction: (extraData?: TrackingExtraArgs) => void;
328
326
  widgetId: string;
329
327
  widgetIndex: number;
330
- alignment: string | null | undefined;
328
+ alignment: Alignment | null | undefined;
331
329
  static: boolean | null | undefined;
332
330
  graded?: boolean | null;
333
331
  problemNum: number | null | undefined;
@@ -53,5 +53,5 @@ export type MatcherPromptJSON = {
53
53
  right: ReadonlyArray<string>;
54
54
  };
55
55
  };
56
- export type widgetDataPartial = Pick<React.ComponentProps<typeof matcher.widget>, "userInput" | "labels" | "left" | "right" | "orderMatters">;
56
+ export type widgetDataPartial = Pick<React.ComponentProps<typeof matcher.widget>, "userInput" | "options">;
57
57
  export declare const getPromptJSON: (widgetData: widgetDataPartial) => MatcherPromptJSON;
@@ -8,7 +8,6 @@ import type { GradedGroupSetPromptJSON } from "./graded-group-set/graded-group-s
8
8
  import type { GrapherPromptJSON } from "./grapher/grapher-ai-utils";
9
9
  import type { GroupPromptJSON } from "./group/group-ai-utils";
10
10
  import type { ImagePromptJSON } from "./image/image-ai-utils";
11
- import type { InputNumberPromptJSON } from "./input-number/input-number-ai-utils";
12
11
  import type { LabelImagePromptJSON } from "./label-image/label-image-ai-utils";
13
12
  import type { MatcherPromptJSON } from "./matcher/matcher-ai-utils";
14
13
  import type { MatrixPromptJSON } from "./matrix/matrix-ai-utils";
@@ -20,7 +19,7 @@ import type { RadioPromptJSON } from "./radio/radio-ai-utils";
20
19
  import type { SorterPromptJSON } from "./sorter/sorter-ai-utils";
21
20
  import type { UnsupportedWidgetPromptJSON } from "./unsupported-widget";
22
21
  export type UnsupportedWidget = "cs-program" | "iframe" | "interaction" | "interactive-graph-unsupported" | "measurer" | "phet-simulation" | "plotter" | "python-program" | "video";
23
- export type WidgetPromptJSON = CategorizerPromptJSON | DefinitionPromptJSON | DropdownPromptJSON | ExplanationPromptJSON | ExpressionPromptJSON | GradedGroupPromptJSON | GradedGroupSetPromptJSON | GrapherPromptJSON | GroupPromptJSON | ImagePromptJSON | InputNumberPromptJSON | LabelImagePromptJSON | MatcherPromptJSON | MatrixPromptJSON | MockWidgetPromptJSON | NumberLinePromptJSON | NumericInputPromptJSON | OrdererPromptJSON | RadioPromptJSON | SorterPromptJSON | UnsupportedWidgetPromptJSON;
22
+ export type WidgetPromptJSON = CategorizerPromptJSON | DefinitionPromptJSON | DropdownPromptJSON | ExplanationPromptJSON | ExpressionPromptJSON | GradedGroupPromptJSON | GradedGroupSetPromptJSON | GrapherPromptJSON | GroupPromptJSON | ImagePromptJSON | LabelImagePromptJSON | MatcherPromptJSON | MatrixPromptJSON | MockWidgetPromptJSON | NumberLinePromptJSON | NumericInputPromptJSON | OrdererPromptJSON | RadioPromptJSON | SorterPromptJSON | UnsupportedWidgetPromptJSON;
24
23
  /**
25
24
  * JSON describing a Perseus renderer. Intended for consumption by AI tools.
26
25
  * A "renderer" is essentially a Markdown document with embedded interactive
@@ -3,25 +3,18 @@
3
3
  * WARNING!!!! THERE ARE ACTIVE CHANGES HAPPENING IN THE RENDERER! *
4
4
  * *
5
5
  ***********************************************************************/
6
- import { type PerseusWidgetOptions } from "@khanacademy/perseus-core";
7
6
  import * as React from "react";
8
7
  import type { WidgetProps } from "./types";
9
- import type { LinterContextProps } from "@khanacademy/perseus-linter";
10
8
  type Props = {
11
9
  type: string;
12
10
  id: string;
13
- widgetProps: WidgetProps<any, PerseusWidgetOptions>;
14
- linterContext: LinterContextProps;
15
- };
16
- type DefaultProps = {
17
- linterContext: LinterContextProps;
11
+ widgetProps: WidgetProps<any, any>;
18
12
  };
19
13
  type State = {
20
14
  sizeClass: "small" | "medium" | "large" | "xlarge";
21
15
  };
22
16
  declare class WidgetContainer extends React.Component<Props, State> {
23
17
  widgetRef: React.RefObject<React.ComponentType<any>>;
24
- static defaultProps: DefaultProps;
25
18
  state: State;
26
19
  componentDidMount(): void;
27
20
  UNSAFE_componentWillReceiveProps(nextProps: Props): void;
@@ -3,25 +3,18 @@
3
3
  * WARNING!!!! THERE ARE ACTIVE CHANGES HAPPENING IN THE RENDERER! *
4
4
  * *
5
5
  ***********************************************************************/
6
- import { type PerseusWidgetOptions } from "@khanacademy/perseus-core";
7
6
  import * as React from "react";
8
7
  import type { WidgetProps } from "./types";
9
- import type { LinterContextProps } from "@khanacademy/perseus-linter";
10
8
  type Props = {
11
9
  type: string;
12
10
  id: string;
13
- widgetProps: WidgetProps<any, PerseusWidgetOptions>;
14
- linterContext: LinterContextProps;
15
- };
16
- type DefaultProps = {
17
- linterContext: LinterContextProps;
11
+ widgetProps: WidgetProps<any, any>;
18
12
  };
19
13
  type State = {
20
14
  sizeClass: "small" | "medium" | "large" | "xlarge";
21
15
  };
22
16
  declare class WidgetContainerOld extends React.Component<Props, State> {
23
17
  widgetRef: React.RefObject<React.ComponentType<any>>;
24
- static defaultProps: DefaultProps;
25
18
  state: State;
26
19
  componentDidMount(): void;
27
20
  UNSAFE_componentWillReceiveProps(nextProps: Props): void;
@@ -1,66 +1,11 @@
1
1
  import * as React from "react";
2
- import type { Widget } from "../../types";
2
+ import type { WidgetProps, Widget } from "../../types";
3
3
  import type { PerseusBlankWidgetOptions, PerseusBlankUserInput } from "@khanacademy/perseus-core";
4
+ type BlankProps = WidgetProps<PerseusBlankWidgetOptions, PerseusBlankUserInput>;
4
5
  declare const _default: {
5
6
  name: string;
6
7
  displayName: string;
7
- widget: React.ForwardRefExoticComponent<PerseusBlankWidgetOptions & {
8
- trackInteraction: (extraData?: Empty | undefined) => void;
9
- widgetId: string;
10
- widgetIndex: number;
11
- alignment: string | null | undefined;
12
- static: boolean | null | undefined;
13
- graded?: boolean | null;
14
- problemNum: number | null | undefined;
15
- apiOptions: Readonly<Readonly<{
16
- isArticle?: boolean;
17
- onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
18
- showAlignmentOptions?: boolean;
19
- readOnly?: boolean;
20
- editingDisabled?: boolean;
21
- answerableCallback?: (arg1: boolean) => unknown;
22
- getAnotherHint?: () => unknown;
23
- interactionCallback?: (widgetData: {
24
- [widgetId: string]: any;
25
- }) => void;
26
- imagePlaceholder?: React.ReactNode;
27
- widgetPlaceholder?: React.ReactNode;
28
- baseElements?: {
29
- Link: React.ComponentType<any>;
30
- };
31
- trackInteraction?: (args: {
32
- type: string;
33
- id: string;
34
- correct?: boolean;
35
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
36
- visible: number;
37
- }>) => void;
38
- customKeypad?: boolean;
39
- isMobile?: boolean;
40
- isMobileApp?: boolean;
41
- hintProgressColor?: string;
42
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
43
- }> & {
44
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
45
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
46
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
47
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
48
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
49
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
50
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
51
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
52
- }>;
53
- keypadElement?: any;
54
- onFocus: (blurPath: import("../..").FocusPath) => void;
55
- onBlur: (blurPath: import("../..").FocusPath) => void;
56
- findWidgets: import("../../types").FindWidgetsFunction;
57
- reviewMode: boolean;
58
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
59
- handleUserInput: (newUserInput: PerseusBlankUserInput, cb?: () => void, silent?: boolean) => void;
60
- userInput: PerseusBlankUserInput;
61
- linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
62
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
63
- } & React.RefAttributes<Widget>>;
8
+ widget: React.ForwardRefExoticComponent<BlankProps & React.RefAttributes<Widget>>;
64
9
  isLintable: true;
65
10
  hidden: true;
66
11
  };
@@ -1,7 +1,9 @@
1
1
  import React from "react";
2
2
  import type { PerseusDependenciesV2, Widget, WidgetProps } from "../../types";
3
3
  import type { PerseusCategorizerUserInput, PerseusCategorizerWidgetOptions } from "@khanacademy/perseus-core";
4
- type ExternalProps = WidgetProps<PerseusCategorizerWidgetOptions, PerseusCategorizerUserInput>;
4
+ interface Props extends WidgetProps<PerseusCategorizerWidgetOptions, PerseusCategorizerUserInput> {
5
+ dependencies: PerseusDependenciesV2;
6
+ }
5
7
  /**
6
8
  * @deprecated and likely a very broken API
7
9
  * [LEMS-3185] do not trust serializedState
@@ -16,66 +18,7 @@ declare function getStartUserInput(): PerseusCategorizerUserInput;
16
18
  declare const _default: {
17
19
  name: string;
18
20
  displayName: string;
19
- widget: React.ForwardRefExoticComponent<Omit<Omit<PerseusCategorizerWidgetOptions & {
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: import("../..").FocusPath, oldFocusPath: import("../..").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: import("../..").FocusPath) => void;
67
- onBlur: (blurPath: import("../..").FocusPath) => void;
68
- findWidgets: import("../../types").FindWidgetsFunction;
69
- reviewMode: boolean;
70
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
71
- handleUserInput: (newUserInput: PerseusCategorizerUserInput, cb?: () => void, silent?: boolean) => void;
72
- userInput: PerseusCategorizerUserInput;
73
- linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
74
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
75
- } & {
76
- linterContext: NonNullable<ExternalProps["linterContext"]>;
77
- dependencies: PerseusDependenciesV2;
78
- } & React.RefAttributes<Widget>, "dependencies">, "ref"> & React.RefAttributes<any>>;
21
+ widget: React.ForwardRefExoticComponent<Omit<Omit<Props & React.RefAttributes<Widget>, "dependencies">, "ref"> & React.RefAttributes<any>>;
79
22
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
80
23
  getCorrectUserInput: typeof getCorrectUserInput;
81
24
  getStartUserInput: typeof getStartUserInput;
@@ -2,8 +2,9 @@
2
2
  * This widget is for embedding Khan Academy CS programs.
3
3
  */
4
4
  import React from "react";
5
- import type { Widget } from "../../types";
5
+ import type { Widget, WidgetProps } from "../../types";
6
6
  import type { PerseusCSProgramWidgetOptions, PerseusCSProgramUserInput } from "@khanacademy/perseus-core";
7
+ type Props = WidgetProps<PerseusCSProgramWidgetOptions, PerseusCSProgramUserInput>;
7
8
  /**
8
9
  * @deprecated and likely a very broken API
9
10
  * [LEMS-3185] do not trust serializedState
@@ -13,63 +14,7 @@ declare function getStartUserInput(): PerseusCSProgramUserInput;
13
14
  declare const _default: {
14
15
  name: string;
15
16
  displayName: string;
16
- widget: React.ForwardRefExoticComponent<PerseusCSProgramWidgetOptions & {
17
- trackInteraction: (extraData?: Empty | undefined) => void;
18
- widgetId: string;
19
- widgetIndex: number;
20
- alignment: string | null | undefined;
21
- static: boolean | null | undefined;
22
- graded?: boolean | null;
23
- problemNum: number | null | undefined;
24
- apiOptions: Readonly<Readonly<{
25
- isArticle?: boolean;
26
- onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
27
- showAlignmentOptions?: boolean;
28
- readOnly?: boolean;
29
- editingDisabled?: boolean;
30
- answerableCallback?: (arg1: boolean) => unknown;
31
- getAnotherHint?: () => unknown;
32
- interactionCallback?: (widgetData: {
33
- [widgetId: string]: any;
34
- }) => void;
35
- imagePlaceholder?: React.ReactNode;
36
- widgetPlaceholder?: React.ReactNode;
37
- baseElements?: {
38
- Link: React.ComponentType<any>;
39
- };
40
- trackInteraction?: (args: {
41
- type: string;
42
- id: string;
43
- correct?: boolean;
44
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
45
- visible: number;
46
- }>) => void;
47
- customKeypad?: boolean;
48
- isMobile?: boolean;
49
- isMobileApp?: boolean;
50
- hintProgressColor?: string;
51
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
52
- }> & {
53
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
54
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
55
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
56
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
57
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
58
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
59
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
60
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
61
- }>;
62
- keypadElement?: any;
63
- onFocus: (blurPath: import("../..").FocusPath) => void;
64
- onBlur: (blurPath: import("../..").FocusPath) => void;
65
- findWidgets: import("../../types").FindWidgetsFunction;
66
- reviewMode: boolean;
67
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
68
- handleUserInput: (newUserInput: PerseusCSProgramUserInput, cb?: () => void, silent?: boolean) => void;
69
- userInput: PerseusCSProgramUserInput;
70
- linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
71
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
72
- } & React.RefAttributes<Widget>>;
17
+ widget: React.ForwardRefExoticComponent<Props & React.RefAttributes<Widget>>;
73
18
  hidden: true;
74
19
  getStartUserInput: typeof getStartUserInput;
75
20
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { PerseusDependenciesV2, Widget } from "../../types";
2
+ import type { PerseusDependenciesV2, Widget, WidgetProps } from "../../types";
3
3
  import type { PerseusDropdownUserInput, PerseusDropdownWidgetOptions } from "@khanacademy/perseus-core";
4
4
  /**
5
5
  * @deprecated and likely a very broken API
@@ -11,63 +11,7 @@ declare function getCorrectUserInput(options: PerseusDropdownWidgetOptions): Per
11
11
  declare const _default: {
12
12
  name: string;
13
13
  displayName: string;
14
- widget: React.ForwardRefExoticComponent<Omit<Omit<PerseusDropdownWidgetOptions & {
15
- trackInteraction: (extraData?: Empty | undefined) => void;
16
- widgetId: string;
17
- widgetIndex: number;
18
- alignment: string | null | undefined;
19
- static: boolean | null | undefined;
20
- graded?: boolean | null;
21
- problemNum: number | null | undefined;
22
- apiOptions: Readonly<Readonly<{
23
- isArticle?: boolean;
24
- onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
25
- showAlignmentOptions?: boolean;
26
- readOnly?: boolean;
27
- editingDisabled?: boolean;
28
- answerableCallback?: (arg1: boolean) => unknown;
29
- getAnotherHint?: () => unknown;
30
- interactionCallback?: (widgetData: {
31
- [widgetId: string]: any;
32
- }) => void;
33
- imagePlaceholder?: React.ReactNode;
34
- widgetPlaceholder?: React.ReactNode;
35
- baseElements?: {
36
- Link: React.ComponentType<any>;
37
- };
38
- trackInteraction?: (args: {
39
- type: string;
40
- id: string;
41
- correct?: boolean;
42
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
43
- visible: number;
44
- }>) => void;
45
- customKeypad?: boolean;
46
- isMobile?: boolean;
47
- isMobileApp?: boolean;
48
- hintProgressColor?: string;
49
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
50
- }> & {
51
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
52
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
53
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
54
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
55
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
56
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
57
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
58
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
59
- }>;
60
- keypadElement?: any;
61
- onFocus: (blurPath: import("../..").FocusPath) => void;
62
- onBlur: (blurPath: import("../..").FocusPath) => void;
63
- findWidgets: import("../../types").FindWidgetsFunction;
64
- reviewMode: boolean;
65
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
66
- handleUserInput: (newUserInput: PerseusDropdownUserInput, cb?: () => void, silent?: boolean) => void;
67
- userInput: PerseusDropdownUserInput;
68
- linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
69
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
70
- } & {
14
+ widget: React.ForwardRefExoticComponent<Omit<Omit<WidgetProps<PerseusDropdownWidgetOptions, PerseusDropdownUserInput> & {
71
15
  dependencies: PerseusDependenciesV2;
72
16
  } & React.RefAttributes<Widget>, "dependencies">, "ref"> & React.RefAttributes<any>>;
73
17
  getStartUserInput: typeof getStartUserInput;
@@ -1,68 +1,8 @@
1
1
  import * as React from "react";
2
- import type { Widget, WidgetProps, FocusPath } from "../../types";
2
+ import type { Widget, WidgetProps } from "../../types";
3
3
  import type { PerseusExpressionRubric, PerseusExpressionUserInput, PerseusExpressionWidgetOptions } from "@khanacademy/perseus-core";
4
- type ExternalProps = WidgetProps<PerseusExpressionWidgetOptions, PerseusExpressionUserInput>;
5
- export declare const Expression: React.ForwardRefExoticComponent<PerseusExpressionWidgetOptions & {
6
- trackInteraction: (extraData?: Empty | undefined) => void;
7
- widgetId: string;
8
- widgetIndex: number;
9
- alignment: string | null | undefined;
10
- static: boolean | null | undefined;
11
- graded?: boolean | null;
12
- problemNum: number | null | undefined;
13
- apiOptions: Readonly<Readonly<{
14
- isArticle?: boolean;
15
- onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
16
- showAlignmentOptions?: boolean;
17
- readOnly?: boolean;
18
- editingDisabled?: boolean;
19
- answerableCallback?: (arg1: boolean) => unknown;
20
- getAnotherHint?: () => unknown;
21
- interactionCallback?: (widgetData: {
22
- [widgetId: string]: any;
23
- }) => void;
24
- imagePlaceholder?: React.ReactNode;
25
- widgetPlaceholder?: React.ReactNode;
26
- baseElements?: {
27
- Link: React.ComponentType<any>;
28
- };
29
- trackInteraction?: (args: {
30
- type: string;
31
- id: string;
32
- correct?: boolean;
33
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
34
- visible: number;
35
- }>) => void;
36
- customKeypad?: boolean;
37
- isMobile?: boolean;
38
- isMobileApp?: boolean;
39
- hintProgressColor?: string;
40
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
41
- }> & {
42
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
43
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
44
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
45
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
46
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
47
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
48
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
49
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
50
- }>;
51
- keypadElement?: any;
52
- onFocus: (blurPath: FocusPath) => void;
53
- onBlur: (blurPath: FocusPath) => void;
54
- findWidgets: import("../../types").FindWidgetsFunction;
55
- reviewMode: boolean;
56
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
57
- handleUserInput: (newUserInput: string, cb?: () => void, silent?: boolean) => void;
58
- userInput: string;
59
- linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
60
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
61
- } & {
62
- buttonSets: NonNullable<ExternalProps["buttonSets"]>;
63
- functions: NonNullable<ExternalProps["functions"]>;
64
- times: NonNullable<ExternalProps["times"]>;
65
- } & React.RefAttributes<Widget>>;
4
+ type Props = WidgetProps<PerseusExpressionWidgetOptions, PerseusExpressionUserInput>;
5
+ export declare const Expression: React.ForwardRefExoticComponent<Props & React.RefAttributes<Widget>>;
66
6
  /**
67
7
  * @deprecated and likely a very broken API
68
8
  * [LEMS-3185] do not trust serializedState
@@ -74,67 +14,7 @@ declare function getCorrectUserInput(options: PerseusExpressionWidgetOptions): P
74
14
  declare const _default: {
75
15
  name: string;
76
16
  displayName: string;
77
- widget: React.ForwardRefExoticComponent<PerseusExpressionWidgetOptions & {
78
- trackInteraction: (extraData?: Empty | undefined) => void;
79
- widgetId: string;
80
- widgetIndex: number;
81
- alignment: string | null | undefined;
82
- static: boolean | null | undefined;
83
- graded?: boolean | null;
84
- problemNum: number | null | undefined;
85
- apiOptions: Readonly<Readonly<{
86
- isArticle?: boolean;
87
- onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
88
- showAlignmentOptions?: boolean;
89
- readOnly?: boolean;
90
- editingDisabled?: boolean;
91
- answerableCallback?: (arg1: boolean) => unknown;
92
- getAnotherHint?: () => unknown;
93
- interactionCallback?: (widgetData: {
94
- [widgetId: string]: any;
95
- }) => void;
96
- imagePlaceholder?: React.ReactNode;
97
- widgetPlaceholder?: React.ReactNode;
98
- baseElements?: {
99
- Link: React.ComponentType<any>;
100
- };
101
- trackInteraction?: (args: {
102
- type: string;
103
- id: string;
104
- correct?: boolean;
105
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
106
- visible: number;
107
- }>) => void;
108
- customKeypad?: boolean;
109
- isMobile?: boolean;
110
- isMobileApp?: boolean;
111
- hintProgressColor?: string;
112
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
113
- }> & {
114
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
115
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
116
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
117
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
118
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
119
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
120
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
121
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
122
- }>;
123
- keypadElement?: any;
124
- onFocus: (blurPath: FocusPath) => void;
125
- onBlur: (blurPath: FocusPath) => void;
126
- findWidgets: import("../../types").FindWidgetsFunction;
127
- reviewMode: boolean;
128
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
129
- handleUserInput: (newUserInput: string, cb?: () => void, silent?: boolean) => void;
130
- userInput: string;
131
- linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
132
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
133
- } & {
134
- buttonSets: NonNullable<ExternalProps["buttonSets"]>;
135
- functions: NonNullable<ExternalProps["functions"]>;
136
- times: NonNullable<ExternalProps["times"]>;
137
- } & React.RefAttributes<Widget>>;
17
+ widget: React.ForwardRefExoticComponent<Props & React.RefAttributes<Widget>>;
138
18
  isLintable: true;
139
19
  getOneCorrectAnswerFromRubric: typeof getOneCorrectAnswerFromRubric;
140
20
  getStartUserInput: typeof getStartUserInput;
@@ -13,8 +13,6 @@ import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsuppor
13
13
  import type { PerseusIFrameUserInput, PerseusIFrameWidgetOptions } from "@khanacademy/perseus-core";
14
14
  type Props = WidgetProps<PerseusIFrameWidgetOptions, PerseusIFrameUserInput>;
15
15
  type DefaultProps = {
16
- allowFullScreen: Props["allowFullScreen"];
17
- allowTopNavigation: Props["allowTopNavigation"];
18
16
  userInput: Props["userInput"];
19
17
  };
20
18
  declare class Iframe extends React.Component<Props> implements Widget {
@@ -0,0 +1,11 @@
1
+ import type { APIOptions } from "../../../types";
2
+ import type { PerseusImageWidgetOptions } from "@khanacademy/perseus-core";
3
+ import type { LinterContextProps } from "@khanacademy/perseus-linter";
4
+ export interface CommonImageProps {
5
+ options: PerseusImageWidgetOptions;
6
+ linterContext: LinterContextProps;
7
+ apiOptions: APIOptions;
8
+ widgetId: string;
9
+ isGifPlaying: boolean;
10
+ setIsGifPlaying: (isPlaying: boolean) => void;
11
+ }
@@ -1,8 +1,8 @@
1
1
  import * as React from "react";
2
- import type { CommonImageProps, GifProps } from "./image-info-area";
3
- type Props = CommonImageProps & GifProps & {
2
+ import type { CommonImageProps } from "./common-image-props";
3
+ interface Props extends CommonImageProps {
4
4
  captionId: string;
5
5
  longDescId: string;
6
- };
7
- export default function ExploreImageModalContent({ backgroundImage, scale: contentScale, caption, alt, longDescription, linterContext, apiOptions, box, labels, range, captionId, longDescId, }: Props): React.JSX.Element | null;
6
+ }
7
+ export default function ExploreImageModalContent({ options, linterContext, apiOptions, captionId, longDescId, }: Props): React.JSX.Element | null;
8
8
  export {};
@@ -1,5 +1,3 @@
1
1
  import React from "react";
2
- import type { CommonImageProps, GifProps } from "./image-info-area";
3
- type Props = CommonImageProps & GifProps;
4
- export declare const ExploreImageModal: (props: Props) => React.JSX.Element;
5
- export {};
2
+ import type { CommonImageProps } from "./common-image-props";
3
+ export declare const ExploreImageModal: (props: CommonImageProps) => React.JSX.Element;