@khanacademy/perseus 71.3.2 → 71.4.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.
@@ -2,7 +2,7 @@
2
2
  * @fileoverview A React context for managing math rendering options.
3
3
  */
4
4
  import * as React from "react";
5
- export type MathRenderingContextType = {
5
+ type MathRenderingContextType = {
6
6
  shouldAddAriaLabels: boolean;
7
7
  };
8
8
  /**
@@ -15,5 +15,5 @@ export type MathRenderingContextType = {
15
15
  * addition of aria labels for times when the element is not within such
16
16
  * containers.
17
17
  */
18
- export declare const MathRenderingContext: React.Context<MathRenderingContextType>;
18
+ declare const MathRenderingContext: React.Context<MathRenderingContextType>;
19
19
  export default MathRenderingContext;
@@ -1,18 +1 @@
1
- /**
2
- * These are things that widgets should exclude when serializing themselves.
3
- *
4
- * The use of this list needs to die. Basically, there are codepaths that
5
- * blindly serialize the "props" of a widget so that it can pass around its
6
- * info. Unfortunately, props aren't guaranteed to be serializable, and
7
- * automatically serializing schemaless list of attributes causes issues (e.g.
8
- * circular JSON structures sometimes).
9
- *
10
- * This blocks things that we know don't need to be serialized.
11
- */
12
- /**
13
- * @deprecated and likely a very broken API
14
- * [LEMS-3185] do not trust serializedState
15
- */
16
- declare const denylist: string[];
17
1
  export declare function excludeDenylistKeys(obj: Record<any, any>): {};
18
- export default denylist;
package/dist/types.d.ts CHANGED
@@ -101,7 +101,6 @@ export type GenerateUrlArgs = {
101
101
  url: string;
102
102
  context: GenerateUrlContext;
103
103
  };
104
- export type GenerateUrlFn = (args: GenerateUrlArgs) => string;
105
104
  /**
106
105
  * APIOptions provides different ways to customize the behaviour of Perseus.
107
106
  *
@@ -377,7 +376,7 @@ export type WidgetProps<TWidgetOptions, TUserInput = Empty, TrackingExtraArgs =
377
376
  /**
378
377
  * The props passed to every widget, regardless of its `type`.
379
378
  */
380
- export type UniversalWidgetProps<TUserInput = Empty, TrackingExtraArgs = Empty> = {
379
+ type UniversalWidgetProps<TUserInput = Empty, TrackingExtraArgs = Empty> = {
381
380
  trackInteraction: (extraData?: TrackingExtraArgs) => void;
382
381
  widgetId: string;
383
382
  widgetIndex: number;
package/dist/util.d.ts CHANGED
@@ -41,7 +41,7 @@ declare function inputPathsEqual(a?: ReadonlyArray<string> | null, b?: ReadonlyA
41
41
  */
42
42
  declare function firstNumericalParse(text: string): ParsedValue | null | undefined;
43
43
  declare function stringArrayOfSize(size: number): string[];
44
- export declare function stringArrayOfSize2D(opt: {
44
+ declare function stringArrayOfSize2D(opt: {
45
45
  rows: number;
46
46
  columns: number;
47
47
  }): string[][];
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { Widget, WidgetProps } from "../../types";
4
4
  import type { DefinitionPromptJSON } from "../../widget-ai-utils/definition/definition-ai-utils";
5
- import type { PerseusRenderer, PerseusDefinitionWidgetOptions } from "@khanacademy/perseus-core";
5
+ import type { PerseusDefinitionWidgetOptions, PerseusRenderer } from "@khanacademy/perseus-core";
6
6
  type DefinitionProps = WidgetProps<PerseusDefinitionWidgetOptions> & {
7
7
  widgets: PerseusRenderer["widgets"];
8
8
  };
@@ -145,7 +145,72 @@ declare function getCorrectUserInput(options: PerseusExpressionWidgetOptions): P
145
145
  declare const _default: {
146
146
  name: string;
147
147
  displayName: string;
148
- widget: React.ForwardRefExoticComponent<Omit<Pick<PerseusExpressionWidgetOptions & import("../../types").UniversalWidgetProps<string, Empty> & Partial<import("../..").PerseusDependenciesV2> & {
148
+ widget: React.ForwardRefExoticComponent<Omit<Pick<PerseusExpressionWidgetOptions & {
149
+ trackInteraction: (extraData?: Empty | undefined) => void;
150
+ widgetId: string;
151
+ widgetIndex: number;
152
+ alignment: string | null | undefined;
153
+ static: boolean | null | undefined;
154
+ problemNum: number | null | undefined;
155
+ apiOptions: Readonly<Readonly<{
156
+ isArticle?: boolean;
157
+ onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
158
+ GroupMetadataEditor?: React.ComponentType<any>;
159
+ showAlignmentOptions?: boolean;
160
+ readOnly?: boolean;
161
+ answerableCallback?: (arg1: boolean) => unknown;
162
+ getAnotherHint?: () => unknown;
163
+ interactionCallback?: (widgetData: {
164
+ [widgetId: string]: any;
165
+ }) => void;
166
+ groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
167
+ imagePlaceholder?: React.ReactNode;
168
+ widgetPlaceholder?: React.ReactNode;
169
+ baseElements?: {
170
+ Link: React.ComponentType<any>;
171
+ };
172
+ imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
173
+ trackInteraction?: (args: {
174
+ type: string;
175
+ id: string;
176
+ correct?: boolean;
177
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
178
+ visible: number;
179
+ }>) => void;
180
+ customKeypad?: boolean;
181
+ nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
182
+ isMobile?: boolean;
183
+ isMobileApp?: boolean;
184
+ setDrawingAreaAvailable?: (arg1: boolean) => unknown;
185
+ hintProgressColor?: string;
186
+ canScrollPage?: boolean;
187
+ editorChangeDelay?: number;
188
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade", boolean>;
189
+ }> & {
190
+ baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
191
+ canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
192
+ editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
193
+ groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
194
+ isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
195
+ isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
196
+ isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
197
+ onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
198
+ readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
199
+ setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
200
+ showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
201
+ }>;
202
+ keypadElement?: any;
203
+ questionCompleted?: boolean;
204
+ onFocus: (blurPath: import("../..").FocusPath) => void;
205
+ onBlur: (blurPath: import("../..").FocusPath) => void;
206
+ findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
207
+ reviewMode: boolean;
208
+ showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
209
+ handleUserInput: (newUserInput: string, cb?: () => void, silent?: boolean) => void;
210
+ userInput: string;
211
+ linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
212
+ containerSizeClass: import("../../util/sizing-utils").SizeClass;
213
+ } & Partial<import("../..").PerseusDependenciesV2> & {
149
214
  apiOptions: NonNullable<ExternalProps["apiOptions"]>;
150
215
  buttonSets: NonNullable<ExternalProps["buttonSets"]>;
151
216
  functions: NonNullable<ExternalProps["functions"]>;
@@ -9,11 +9,6 @@ export declare const getLabelTransform: (labelLocation: GraphConfig["labelLocati
9
9
  xLabelTransform: string;
10
10
  yLabelTransform: string;
11
11
  };
12
- /**
13
- * Calculate the maximum number of digits needed to display tick labels on the y-axis.
14
- * This accounts for both the integer part of the range values and decimal places in the tick step.
15
- */
16
- export declare const calculateMaxDigitsInRange: (range: [number, number], tickStep: number) => number;
17
12
  export declare const getLabelPosition: (graphInfo: GraphDimensions, labelLocation: GraphConfig["labelLocation"], tickStep: GraphConfig["tickStep"]) => vec.Vector2[];
18
13
  export declare const shouldShowLabel: (currentTick: number, range: [Interval, Interval], tickStep: number) => boolean;
19
14
  export declare function generateTickLocations(tickStep: number, min: number, max: number, otherAxisMin: number): number[];
@@ -10,5 +10,6 @@ export declare const getSinusoidKeyboardConstraint: (coords: ReadonlyArray<Coord
10
10
  left: vec.Vector2;
11
11
  right: vec.Vector2;
12
12
  };
13
- export declare const computeSine: (x: number, sinusoidCoefficients: NamedSineCoefficient) => number;
13
+ export declare const computeSine: (x: number, // x-coordinate
14
+ sinusoidCoefficients: NamedSineCoefficient) => number;
14
15
  export declare const getSinusoidCoefficients: (coords: ReadonlyArray<Coord>) => NamedSineCoefficient | undefined;
@@ -111,7 +111,72 @@ declare const _default: {
111
111
  displayName: string;
112
112
  widget: React.ForwardRefExoticComponent<Omit<Omit<PerseusLabelImageWidgetOptions, "markers"> & {
113
113
  markers: ReadonlyArray<OptionalAnswersMarkerType>;
114
- } & import("../../types").UniversalWidgetProps<PerseusLabelImageUserInput, Empty> & {
114
+ } & {
115
+ trackInteraction: (extraData?: Empty | undefined) => void;
116
+ widgetId: string;
117
+ widgetIndex: number;
118
+ alignment: string | null | undefined;
119
+ static: boolean | null | undefined;
120
+ problemNum: number | null | undefined;
121
+ apiOptions: Readonly<Readonly<{
122
+ isArticle?: boolean;
123
+ onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
124
+ GroupMetadataEditor?: React.ComponentType<any>;
125
+ showAlignmentOptions?: boolean;
126
+ readOnly?: boolean;
127
+ answerableCallback?: (arg1: boolean) => unknown;
128
+ getAnotherHint?: () => unknown;
129
+ interactionCallback?: (widgetData: {
130
+ [widgetId: string]: any;
131
+ }) => void;
132
+ groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
133
+ imagePlaceholder?: React.ReactNode;
134
+ widgetPlaceholder?: React.ReactNode;
135
+ baseElements?: {
136
+ Link: React.ComponentType<any>;
137
+ };
138
+ imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
139
+ trackInteraction?: (args: {
140
+ type: string;
141
+ id: string;
142
+ correct?: boolean;
143
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
144
+ visible: number;
145
+ }>) => void;
146
+ customKeypad?: boolean;
147
+ nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
148
+ isMobile?: boolean;
149
+ isMobileApp?: boolean;
150
+ setDrawingAreaAvailable?: (arg1: boolean) => unknown;
151
+ hintProgressColor?: string;
152
+ canScrollPage?: boolean;
153
+ editorChangeDelay?: number;
154
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade", boolean>;
155
+ }> & {
156
+ baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
157
+ canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
158
+ editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
159
+ groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
160
+ isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
161
+ isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
162
+ isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
163
+ onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
164
+ readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
165
+ setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
166
+ showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
167
+ }>;
168
+ keypadElement?: any;
169
+ questionCompleted?: boolean;
170
+ onFocus: (blurPath: import("../..").FocusPath) => void;
171
+ onBlur: (blurPath: import("../..").FocusPath) => void;
172
+ findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
173
+ reviewMode: boolean;
174
+ showSolutions?: ShowSolutions;
175
+ handleUserInput: (newUserInput: PerseusLabelImageUserInput, cb?: () => void, silent?: boolean) => void;
176
+ userInput: PerseusLabelImageUserInput;
177
+ linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
178
+ containerSizeClass: import("../../util/sizing-utils").SizeClass;
179
+ } & {
115
180
  analytics: DependencyProps["analytics"];
116
181
  preferredPopoverDirection?: PreferredPopoverDirection;
117
182
  }, keyof import("../..").PerseusDependenciesV2> & React.RefAttributes<LabelImage>>;
@@ -5,7 +5,72 @@ import type { Focusable } from "../../types";
5
5
  * component. It is responsible for rendering the UI elements of the Numeric
6
6
  * Input widget.
7
7
  */
8
- export declare const NumericInputComponent: React.ForwardRefExoticComponent<import("@khanacademy/perseus-core").PerseusNumericInputWidgetOptions & import("../../types").UniversalWidgetProps<import("@khanacademy/perseus-core").PerseusNumericInputUserInput, Empty> & {
8
+ export declare const NumericInputComponent: React.ForwardRefExoticComponent<import("@khanacademy/perseus-core").PerseusNumericInputWidgetOptions & {
9
+ trackInteraction: (extraData?: Empty | undefined) => void;
10
+ widgetId: string;
11
+ widgetIndex: number;
12
+ alignment: string | null | undefined;
13
+ static: boolean | null | undefined;
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
+ GroupMetadataEditor?: React.ComponentType<any>;
19
+ showAlignmentOptions?: boolean;
20
+ readOnly?: boolean;
21
+ answerableCallback?: (arg1: boolean) => unknown;
22
+ getAnotherHint?: () => unknown;
23
+ interactionCallback?: (widgetData: {
24
+ [widgetId: string]: any;
25
+ }) => void;
26
+ groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
27
+ imagePlaceholder?: React.ReactNode;
28
+ widgetPlaceholder?: React.ReactNode;
29
+ baseElements?: {
30
+ Link: React.ComponentType<any>;
31
+ };
32
+ imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
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
+ nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
42
+ isMobile?: boolean;
43
+ isMobileApp?: boolean;
44
+ setDrawingAreaAvailable?: (arg1: boolean) => unknown;
45
+ hintProgressColor?: string;
46
+ canScrollPage?: boolean;
47
+ editorChangeDelay?: number;
48
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade", boolean>;
49
+ }> & {
50
+ baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
51
+ canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
52
+ editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
53
+ groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
54
+ isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
55
+ isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
56
+ isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
57
+ onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
58
+ readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
59
+ setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
60
+ showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
61
+ }>;
62
+ keypadElement?: any;
63
+ questionCompleted?: boolean;
64
+ onFocus: (blurPath: import("../..").FocusPath) => void;
65
+ onBlur: (blurPath: import("../..").FocusPath) => void;
66
+ findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<import("../../types").Widget>;
67
+ reviewMode: boolean;
68
+ showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
69
+ handleUserInput: (newUserInput: import("@khanacademy/perseus-core").PerseusNumericInputUserInput, cb?: () => void, silent?: boolean) => void;
70
+ userInput: import("@khanacademy/perseus-core").PerseusNumericInputUserInput;
71
+ linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
72
+ containerSizeClass: import("../../util/sizing-utils").SizeClass;
73
+ } & {
9
74
  size: NonNullable<string>;
10
75
  rightAlign: NonNullable<boolean | undefined>;
11
76
  apiOptions: NonNullable<Readonly<Readonly<{
@@ -1,12 +1,5 @@
1
1
  import type { PerseusStrings } from "../../strings";
2
2
  import type { PerseusNumericInputAnswerForm, PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
3
- /**
4
- * The full list of available strings for the numeric input widget,
5
- * based on whether the Content Creator has specified that the answer must be simplified.
6
- */
7
- export declare const NumericExampleStrings: {
8
- [key: string]: (form: PerseusNumericInputAnswerForm, strings: PerseusStrings) => string;
9
- };
10
3
  /**
11
4
  * Generates the specific set of examples for the current question.
12
5
  * This string is shown as examples to the user in a tooltip.
@@ -23,7 +23,7 @@ type DefaultProps = {
23
23
  type State = {
24
24
  categoryHeights: Record<string, number>;
25
25
  };
26
- export declare class Plotter extends React.Component<Props, State> implements Widget {
26
+ declare class Plotter extends React.Component<Props, State> implements Widget {
27
27
  static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
28
28
  context: React.ContextType<typeof PerseusI18nContext>;
29
29
  _isMounted: boolean;
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  import type { ChoiceState, Widget, ChangeHandler } from "../../types";
3
3
  import type { PerseusRadioChoice, PerseusRadioRubric, PerseusRadioUserInput } from "@khanacademy/perseus-core";
4
+ import type { LinterContextProps } from "@khanacademy/perseus-linter";
4
5
  /**
5
6
  * Represents a single choice in the MultipleChoiceComponent
6
7
  */
@@ -18,7 +19,7 @@ export interface ChoiceType {
18
19
  revealNoneOfTheAbove: boolean;
19
20
  disabled: boolean;
20
21
  }
21
- export type RadioProps = {
22
+ type RadioProps = {
22
23
  numCorrect: number;
23
24
  hasNoneOfTheAbove?: boolean;
24
25
  multipleSelect?: boolean;
@@ -37,5 +38,70 @@ export interface RadioChoiceWithMetadata extends PerseusRadioChoice {
37
38
  originalIndex: number;
38
39
  correct?: boolean;
39
40
  }
40
- declare const Radio: React.ForwardRefExoticComponent<RadioProps & import("../../types").UniversalWidgetProps<PerseusRadioUserInput, PerseusRadioRubric> & React.RefAttributes<Widget>>;
41
+ declare const Radio: React.ForwardRefExoticComponent<RadioProps & {
42
+ trackInteraction: (extraData?: PerseusRadioRubric | undefined) => void;
43
+ widgetId: string;
44
+ widgetIndex: number;
45
+ alignment: string | null | undefined;
46
+ static: boolean | null | undefined;
47
+ problemNum: number | null | undefined;
48
+ apiOptions: Readonly<Readonly<{
49
+ isArticle?: boolean;
50
+ onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
51
+ GroupMetadataEditor?: React.ComponentType<any>;
52
+ showAlignmentOptions?: boolean;
53
+ readOnly?: boolean;
54
+ answerableCallback?: (arg1: boolean) => unknown;
55
+ getAnotherHint?: () => unknown;
56
+ interactionCallback?: (widgetData: {
57
+ [widgetId: string]: any;
58
+ }) => void;
59
+ groupAnnotator?: (groupNumber: number, widgetId: string) => React.ReactNode;
60
+ imagePlaceholder?: React.ReactNode;
61
+ widgetPlaceholder?: React.ReactNode;
62
+ baseElements?: {
63
+ Link: React.ComponentType<any>;
64
+ };
65
+ imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
66
+ trackInteraction?: (args: {
67
+ type: string;
68
+ id: string;
69
+ correct?: boolean;
70
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
71
+ visible: number;
72
+ }>) => void;
73
+ customKeypad?: boolean;
74
+ nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
75
+ isMobile?: boolean;
76
+ isMobileApp?: boolean;
77
+ setDrawingAreaAvailable?: (arg1: boolean) => unknown;
78
+ hintProgressColor?: string;
79
+ canScrollPage?: boolean;
80
+ editorChangeDelay?: number;
81
+ flags?: Record<"new-radio-widget" | "image-widget-upgrade", boolean>;
82
+ }> & {
83
+ baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
84
+ canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
85
+ editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
86
+ groupAnnotator: NonNullable<import("../..").APIOptions["groupAnnotator"]>;
87
+ isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
88
+ isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
89
+ isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
90
+ onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
91
+ readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
92
+ setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
93
+ showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
94
+ }>;
95
+ keypadElement?: any;
96
+ questionCompleted?: boolean;
97
+ onFocus: (blurPath: import("../..").FocusPath) => void;
98
+ onBlur: (blurPath: import("../..").FocusPath) => void;
99
+ findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
100
+ reviewMode: boolean;
101
+ showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
102
+ handleUserInput: (newUserInput: PerseusRadioUserInput, cb?: () => void, silent?: boolean) => void;
103
+ userInput: PerseusRadioUserInput;
104
+ linterContext: LinterContextProps;
105
+ containerSizeClass: import("../../util/sizing-utils").SizeClass;
106
+ } & React.RefAttributes<Widget>>;
41
107
  export default Radio;
@@ -15,7 +15,7 @@ export type RadioProps = PerseusRadioWidgetOptions & {
15
15
  choiceStates?: ChoiceState[];
16
16
  onChange: ChangeHandler;
17
17
  };
18
- export type Props = WidgetProps<RadioProps, PerseusRadioUserInput, PerseusRadioRubric>;
18
+ type Props = WidgetProps<RadioProps, PerseusRadioUserInput, PerseusRadioRubric>;
19
19
  type DefaultProps = Required<Pick<Props, "choices" | "multipleSelect" | "countChoices" | "deselectEnabled" | "linterContext" | "showSolutions">>;
20
20
  export type RadioChoiceWithMetadata = PerseusRadioChoice & {
21
21
  originalIndex: number;
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": "71.3.2",
6
+ "version": "71.4.1",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -42,45 +42,44 @@
42
42
  "tiny-invariant": "1.3.1",
43
43
  "uuid": "^10.0.0",
44
44
  "@khanacademy/kas": "2.1.3",
45
- "@khanacademy/keypad-context": "3.2.13",
46
- "@khanacademy/kmath": "2.2.13",
47
- "@khanacademy/math-input": "26.2.14",
48
- "@khanacademy/perseus-core": "20.1.1",
49
- "@khanacademy/perseus-linter": "4.4.3",
50
- "@khanacademy/perseus-score": "8.0.2",
45
+ "@khanacademy/keypad-context": "3.2.15",
46
+ "@khanacademy/kmath": "2.2.15",
47
+ "@khanacademy/math-input": "26.2.16",
48
+ "@khanacademy/perseus-core": "20.1.3",
49
+ "@khanacademy/perseus-linter": "4.4.5",
50
+ "@khanacademy/perseus-score": "8.0.4",
51
51
  "@khanacademy/perseus-utils": "2.1.1",
52
52
  "@khanacademy/pure-markdown": "2.2.1",
53
53
  "@khanacademy/simple-markdown": "2.1.1"
54
54
  },
55
55
  "devDependencies": {
56
- "@khanacademy/wonder-blocks-announcer": "1.0.3",
57
- "@khanacademy/wonder-blocks-banner": "4.5.2",
58
- "@khanacademy/wonder-blocks-button": "11.2.4",
59
- "@khanacademy/wonder-blocks-clickable": "8.0.0",
60
- "@khanacademy/wonder-blocks-core": "12.4.0",
61
- "@khanacademy/wonder-blocks-data": "14.1.6",
62
- "@khanacademy/wonder-blocks-dropdown": "10.4.5",
63
- "@khanacademy/wonder-blocks-form": "7.4.1",
64
- "@khanacademy/wonder-blocks-icon-button": "10.5.3",
65
- "@khanacademy/wonder-blocks-icon": "5.3.0",
66
- "@khanacademy/wonder-blocks-labeled-field": "4.0.6",
67
- "@khanacademy/wonder-blocks-layout": "3.1.37",
68
- "@khanacademy/wonder-blocks-link": "10.0.1",
69
- "@khanacademy/wonder-blocks-modal": "8.4.6",
70
- "@khanacademy/wonder-blocks-pill": "3.1.43",
71
- "@khanacademy/wonder-blocks-popover": "6.1.36",
72
- "@khanacademy/wonder-blocks-progress-spinner": "3.1.37",
73
- "@khanacademy/wonder-blocks-switch": "3.3.20",
74
- "@khanacademy/wonder-blocks-timing": "7.0.2",
75
- "@khanacademy/wonder-blocks-tokens": "14.0.0",
76
- "@khanacademy/wonder-blocks-tooltip": "4.1.50",
77
- "@khanacademy/wonder-blocks-typography": "4.2.22",
56
+ "@khanacademy/wonder-blocks-announcer": "1.0.4",
57
+ "@khanacademy/wonder-blocks-banner": "5.0.2",
58
+ "@khanacademy/wonder-blocks-button": "11.2.6",
59
+ "@khanacademy/wonder-blocks-clickable": "8.0.2",
60
+ "@khanacademy/wonder-blocks-core": "12.4.1",
61
+ "@khanacademy/wonder-blocks-data": "14.1.7",
62
+ "@khanacademy/wonder-blocks-dropdown": "10.4.10",
63
+ "@khanacademy/wonder-blocks-form": "7.4.3",
64
+ "@khanacademy/wonder-blocks-icon-button": "10.5.5",
65
+ "@khanacademy/wonder-blocks-icon": "5.3.2",
66
+ "@khanacademy/wonder-blocks-labeled-field": "4.0.8",
67
+ "@khanacademy/wonder-blocks-layout": "3.1.39",
68
+ "@khanacademy/wonder-blocks-link": "10.0.3",
69
+ "@khanacademy/wonder-blocks-modal": "8.5.3",
70
+ "@khanacademy/wonder-blocks-pill": "3.1.45",
71
+ "@khanacademy/wonder-blocks-popover": "6.1.40",
72
+ "@khanacademy/wonder-blocks-progress-spinner": "3.1.39",
73
+ "@khanacademy/wonder-blocks-switch": "3.3.22",
74
+ "@khanacademy/wonder-blocks-timing": "7.0.3",
75
+ "@khanacademy/wonder-blocks-tokens": "14.1.0",
76
+ "@khanacademy/wonder-blocks-tooltip": "4.1.54",
77
+ "@khanacademy/wonder-blocks-typography": "4.2.24",
78
78
  "@khanacademy/wonder-stuff-core": "1.5.5",
79
79
  "@phosphor-icons/core": "2.0.2",
80
80
  "@popperjs/core": "2.10.2",
81
81
  "aphrodite": "1.2.5",
82
82
  "classnames": "1.1.4",
83
- "csstype": "^3.1.3",
84
83
  "intersection-observer": "^0.12.0",
85
84
  "jquery": "2.1.1",
86
85
  "lodash.debounce": "^4.0.8",
@@ -93,28 +92,28 @@
93
92
  "raphael": "1.5.4"
94
93
  },
95
94
  "peerDependencies": {
96
- "@khanacademy/wonder-blocks-announcer": "^1.0.3",
97
- "@khanacademy/wonder-blocks-banner": "^4.5.2",
98
- "@khanacademy/wonder-blocks-button": "^11.2.4",
99
- "@khanacademy/wonder-blocks-clickable": "^8.0.0",
100
- "@khanacademy/wonder-blocks-core": "^12.4.0",
101
- "@khanacademy/wonder-blocks-data": "^14.1.6",
102
- "@khanacademy/wonder-blocks-dropdown": "^10.4.5",
103
- "@khanacademy/wonder-blocks-form": "^7.4.1",
104
- "@khanacademy/wonder-blocks-icon": "^5.3.0",
105
- "@khanacademy/wonder-blocks-icon-button": "^10.5.3",
106
- "@khanacademy/wonder-blocks-labeled-field": "^4.0.6",
107
- "@khanacademy/wonder-blocks-layout": "^3.1.37",
108
- "@khanacademy/wonder-blocks-link": "^10.0.1",
109
- "@khanacademy/wonder-blocks-modal": "^8.4.6",
110
- "@khanacademy/wonder-blocks-pill": "^3.1.43",
111
- "@khanacademy/wonder-blocks-popover": "^6.1.36",
112
- "@khanacademy/wonder-blocks-progress-spinner": "^3.1.37",
113
- "@khanacademy/wonder-blocks-switch": "^3.3.20",
114
- "@khanacademy/wonder-blocks-timing": "^7.0.2",
115
- "@khanacademy/wonder-blocks-tokens": "^14.0.0",
116
- "@khanacademy/wonder-blocks-tooltip": "^4.1.50",
117
- "@khanacademy/wonder-blocks-typography": "^4.2.22",
95
+ "@khanacademy/wonder-blocks-announcer": "^1.0.4",
96
+ "@khanacademy/wonder-blocks-banner": "^5.0.2",
97
+ "@khanacademy/wonder-blocks-button": "^11.2.6",
98
+ "@khanacademy/wonder-blocks-clickable": "^8.0.2",
99
+ "@khanacademy/wonder-blocks-core": "^12.4.1",
100
+ "@khanacademy/wonder-blocks-data": "^14.1.7",
101
+ "@khanacademy/wonder-blocks-dropdown": "^10.4.10",
102
+ "@khanacademy/wonder-blocks-form": "^7.4.3",
103
+ "@khanacademy/wonder-blocks-icon": "^5.3.2",
104
+ "@khanacademy/wonder-blocks-icon-button": "^10.5.5",
105
+ "@khanacademy/wonder-blocks-labeled-field": "^4.0.8",
106
+ "@khanacademy/wonder-blocks-layout": "^3.1.39",
107
+ "@khanacademy/wonder-blocks-link": "^10.0.3",
108
+ "@khanacademy/wonder-blocks-modal": "^8.5.3",
109
+ "@khanacademy/wonder-blocks-pill": "^3.1.45",
110
+ "@khanacademy/wonder-blocks-popover": "^6.1.40",
111
+ "@khanacademy/wonder-blocks-progress-spinner": "^3.1.39",
112
+ "@khanacademy/wonder-blocks-switch": "^3.3.22",
113
+ "@khanacademy/wonder-blocks-timing": "^7.0.3",
114
+ "@khanacademy/wonder-blocks-tokens": "^14.1.0",
115
+ "@khanacademy/wonder-blocks-tooltip": "^4.1.54",
116
+ "@khanacademy/wonder-blocks-typography": "^4.2.24",
118
117
  "@khanacademy/wonder-stuff-core": "^1.5.5",
119
118
  "@phosphor-icons/core": "^2.0.2",
120
119
  "@popperjs/core": "^2.10.2",
@@ -1,34 +0,0 @@
1
- /**
2
- * VisibilityObserver watches a target element for changes to visibility,
3
- * relative to a given root node.
4
- *
5
- * When the target element entirely disappears, or partially reappears, the
6
- * caller is notified via the `onVisibilityChange` callback.
7
- *
8
- * Potential visibility changes include:
9
- * - Being scrolled out of view, by any scroll container between the target
10
- * and the root.
11
- * - Style changes to the target element or an ancestor, like `display: none`.
12
- *
13
- * The VisibilityObserver relies on the IntersectionObserver, which does not
14
- * exist on Safari and is buggy on Edge. Instead, we will polyfill the
15
- * IntersectionObserver on those platforms.
16
- *
17
- * TODO(mdr): Currently, we emulate the API of IntersectionObserver. It might
18
- * be nicer to instead use a more React-y API: let `targetElement` be a
19
- * required prop, and render the element only when it's present. Then, we
20
- * can use React lifecycle methods to set-up/tear-down handlers. Not sure
21
- * that's _actually_ a net win, though, in complexity or performance - but
22
- * worth thinking about if this API is causing too much entanglement!
23
- */
24
- import "intersection-observer";
25
- export interface VisibilityObserver {
26
- setTargetElement(targetElement: HTMLElement): void;
27
- disconnect(): void;
28
- }
29
- type VisibilityChangeCallback = (isVisible: boolean, rootBounds: DOMRectReadOnly) => void;
30
- /**
31
- * Create a new VisibilityObserver.
32
- */
33
- export declare function createVisibilityObserver(rootElement: HTMLElement | null | undefined, onVisibilityChange: VisibilityChangeCallback, rootMargin?: string): VisibilityObserver;
34
- export {};
@@ -1 +0,0 @@
1
- export declare const getScrollParent: (node: Element) => Element | null | undefined;