@khanacademy/perseus 84.0.1 → 84.1.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 (48) hide show
  1. package/dist/components/drag-and-drop/choice-bank.d.ts +16 -0
  2. package/dist/components/zoomable.d.ts +34 -4
  3. package/dist/es/index.css +4 -4
  4. package/dist/es/index.css.map +1 -1
  5. package/dist/es/index.js +63 -63
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/index.css +4 -4
  8. package/dist/index.css.map +1 -1
  9. package/dist/index.d.ts +0 -1
  10. package/dist/index.js +63 -63
  11. package/dist/index.js.map +1 -1
  12. package/dist/renderer.new.d.ts +2 -2
  13. package/dist/renderer.old.d.ts +2 -2
  14. package/dist/server-item-renderer.d.ts +21 -11
  15. package/dist/types.d.ts +7 -9
  16. package/dist/widget-ai-utils/matcher/matcher-ai-utils.d.ts +1 -1
  17. package/dist/widget-ai-utils/prompt-types.d.ts +1 -2
  18. package/dist/widget-container.new.d.ts +1 -8
  19. package/dist/widget-container.old.d.ts +1 -8
  20. package/dist/widgets/blank/blank.d.ts +3 -58
  21. package/dist/widgets/categorizer/categorizer.d.ts +4 -61
  22. package/dist/widgets/cs-program/cs-program.d.ts +3 -58
  23. package/dist/widgets/dropdown/dropdown.d.ts +2 -58
  24. package/dist/widgets/expression/expression.d.ts +4 -124
  25. package/dist/widgets/iframe/iframe.d.ts +0 -2
  26. package/dist/widgets/image/components/common-image-props.d.ts +11 -0
  27. package/dist/widgets/image/components/explore-image-modal-content.d.ts +4 -4
  28. package/dist/widgets/image/components/explore-image-modal.d.ts +2 -4
  29. package/dist/widgets/image/components/image-info-area.d.ts +3 -23
  30. package/dist/widgets/image/image.d.ts +3 -58
  31. package/dist/widgets/input-number/input-number.d.ts +3 -2
  32. package/dist/widgets/interaction/interaction.d.ts +0 -5
  33. package/dist/widgets/interactive-graphs/graphs/polygon.d.ts +3 -2
  34. package/dist/widgets/interactive-graphs/graphs/strings/polygon.d.ts +3 -2
  35. package/dist/widgets/interactive-graphs/interactive-graph.d.ts +20 -20
  36. package/dist/widgets/interactive-graphs/mafs-graph.d.ts +11 -10
  37. package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +12 -12
  38. package/dist/widgets/label-image/label-image.d.ts +2 -61
  39. package/dist/widgets/matcher/matcher.d.ts +2 -58
  40. package/dist/widgets/measurer/measurer.d.ts +1 -1
  41. package/dist/widgets/mock-widgets/mock-widget.d.ts +3 -3
  42. package/dist/widgets/number-line/number-line.d.ts +3 -59
  43. package/dist/widgets/numeric-input/numeric-input.d.ts +3 -119
  44. package/dist/widgets/phet-simulation/phet-simulation.d.ts +1 -1
  45. package/dist/widgets/python-program/python-program.d.ts +7 -8
  46. package/dist/widgets/table/table.d.ts +2 -58
  47. package/package.json +9 -9
  48. 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
  *
@@ -28,15 +28,6 @@ type HOCProps = {
28
28
  };
29
29
  type Props = SharedRendererProps & OwnProps & HOCProps;
30
30
  type DefaultProps = Required<Pick<Props, "apiOptions" | "onRendered" | "linterContext">>;
31
- type State = {
32
- /**
33
- * Keeps track of whether each asset (SvgImage or TeX) rendered by
34
- * the questionRenderer has finished loading or rendering.
35
- */
36
- assetStatuses: {
37
- [assetKey: string]: boolean;
38
- };
39
- };
40
31
  /**
41
32
  * @deprecated and likely a very broken API
42
33
  * [LEMS-3185] do not trust serializedState
@@ -45,20 +36,39 @@ type SerializedState = {
45
36
  question: any;
46
37
  hints: any;
47
38
  };
48
- export declare class ServerItemRenderer extends React.Component<Props, State> implements RendererInterface, KeypadContextRendererInterface, GetPromptJSONInterface {
39
+ export declare class ServerItemRenderer extends React.Component<Props> implements RendererInterface, KeypadContextRendererInterface, GetPromptJSONInterface {
49
40
  static contextType: React.Context<import("./components/i18n-context").I18nContextType>;
50
41
  context: React.ContextType<typeof PerseusI18nContext>;
51
42
  questionRenderer: Renderer;
52
43
  hintsRenderer: any;
53
44
  _currentFocus: FocusPath;
54
45
  _fullyRendered: boolean;
46
+ /**
47
+ * Tracks whether each asset rendered below us (images, math, anything else
48
+ * that takes extra passes to settle) has finished rendering.
49
+ *
50
+ * This is deliberately not React state: assets register themselves in
51
+ * their constructors, while we're still rendering, and a state update
52
+ * from there isn't visible to us until a later render pass — by which point we'd
53
+ * already have called `onRendered()` under the assumption
54
+ * there were no assets to wait for.
55
+ */
56
+ _assetStatuses: {
57
+ [assetKey: string]: boolean;
58
+ };
55
59
  blurTimeoutID: number | null | undefined;
56
60
  userInput: UserInputMap;
57
61
  static defaultProps: DefaultProps;
58
62
  constructor(props: Props);
59
63
  componentDidMount(): void;
60
- componentDidUpdate(): void;
61
64
  componentWillUnmount(): void;
65
+ /**
66
+ * Reports that we've finished rendering, if every asset has settled.
67
+ *
68
+ * Called once we've mounted (to cover content with no assets at all) and
69
+ * again on every status change, so it doesn't depend on a render pass
70
+ * happening at the right moment. Only ever reports once.
71
+ */
62
72
  maybeCallOnRendered(): void;
63
73
  _handleFocusChange: (newFocus: FocusPath, oldFocus: FocusPath) => void;
64
74
  _setCurrentFocus(newFocus: FocusPath): void;
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;