@khanacademy/perseus 61.2.1 → 63.0.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.
- package/dist/components/scrollable-view.d.ts +17 -0
- package/dist/es/index.css +1 -1
- package/dist/es/index.js +62 -47
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +1 -1
- package/dist/es/strings.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +61 -42
- package/dist/index.js.map +1 -1
- package/dist/server-item-renderer.d.ts +1 -0
- package/dist/strings.d.ts +16 -0
- package/dist/strings.js +1 -1
- package/dist/strings.js.map +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/util/widget-enum-utils.d.ts +1 -1
- package/dist/widgets/expression/expression.d.ts +2 -0
- package/dist/widgets/free-response/free-response.d.ts +28 -0
- package/dist/widgets/free-response/index.d.ts +1 -0
- package/dist/widgets/grapher/grapher.d.ts +1 -2
- package/dist/widgets/numeric-input/numeric-input.d.ts +2 -0
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +20 -0
- package/dist/widgets/radio/base-radio.new.d.ts +1 -3
- package/dist/widgets/radio/choice-icon/choice-icon-styles.d.ts +9 -0
- package/dist/widgets/radio/choice-none-above.new.d.ts +12 -4
- package/dist/widgets/radio/choice.new.d.ts +9 -2
- package/dist/widgets/radio/option-status.new.d.ts +1 -1
- package/dist/widgets/radio/{radio-component.new.d.ts → radio.class.new.d.ts} +9 -22
- package/dist/widgets/radio/radio.ff.d.ts +1 -2
- package/dist/widgets/radio/radio.new.d.ts +30 -0
- package/dist/widgets/radio/utils/general-utils.d.ts +35 -0
- package/dist/widgets/radio/utils/string-utils.d.ts +72 -0
- package/dist/widgets.d.ts +15 -15
- package/package.json +13 -11
- package/dist/widgets/radio/choice-a11y-text.new.d.ts +0 -14
|
@@ -15,6 +15,7 @@ type State = {
|
|
|
15
15
|
kind: "warning" | "critical";
|
|
16
16
|
} | null;
|
|
17
17
|
url: URL | null;
|
|
18
|
+
isFullScreen: boolean;
|
|
18
19
|
};
|
|
19
20
|
export declare class PhetSimulation extends React.Component<Props, State> implements Widget {
|
|
20
21
|
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
@@ -31,6 +32,25 @@ export declare class PhetSimulation extends React.Component<Props, State> implem
|
|
|
31
32
|
displayLoadFailure: () => void;
|
|
32
33
|
updateSimState(urlString: string): Promise<void>;
|
|
33
34
|
showLocaleWarning(url: URL): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Mobile App Fullscreen Implementation
|
|
37
|
+
*
|
|
38
|
+
* The mobile app environment doesn't support the standard browser fullscreen API.
|
|
39
|
+
* Instead, we implement a "fake" fullscreen mode with the following approach:
|
|
40
|
+
*
|
|
41
|
+
* 1. When fullscreen is toggled, we use a fixed position container that covers
|
|
42
|
+
* almost the entire viewport (appFullScreenWidgetContainer)
|
|
43
|
+
* 2. We leave space at the bottom for the mobile app's Check Answer bar (66px)
|
|
44
|
+
* 3. We position a close button in the top-right corner for exiting fullscreen
|
|
45
|
+
* 4. The iframe container expands to fill the available space
|
|
46
|
+
*
|
|
47
|
+
* This differs from the web implementation which uses the browser's
|
|
48
|
+
* native Fullscreen API via requestFullscreen().
|
|
49
|
+
*
|
|
50
|
+
* Note: Unfortunately, full screen is not supported in iOS mobile web due to
|
|
51
|
+
* the lack of support for the Fullscreen API.
|
|
52
|
+
*/
|
|
53
|
+
toggleFullScreen: () => void;
|
|
34
54
|
render(): React.ReactNode;
|
|
35
55
|
}
|
|
36
56
|
export declare const makeSafeUrl: (urlString: string, locale: string) => URL | null;
|
|
@@ -16,7 +16,6 @@ export type ChoiceType = {
|
|
|
16
16
|
revealNoneOfTheAbove: boolean;
|
|
17
17
|
disabled: boolean;
|
|
18
18
|
};
|
|
19
|
-
export type FocusFunction = (choiceIndex?: number | null | undefined) => boolean;
|
|
20
19
|
type Props = {
|
|
21
20
|
apiOptions: APIOptions;
|
|
22
21
|
choices: ReadonlyArray<ChoiceType>;
|
|
@@ -32,7 +31,6 @@ type Props = {
|
|
|
32
31
|
checked: ReadonlyArray<boolean>;
|
|
33
32
|
crossedOut: ReadonlyArray<boolean>;
|
|
34
33
|
}) => void;
|
|
35
|
-
registerFocusFunction?: (arg1: FocusFunction) => void;
|
|
36
34
|
isLastUsedWidget?: boolean;
|
|
37
35
|
};
|
|
38
36
|
/**
|
|
@@ -45,5 +43,5 @@ type Props = {
|
|
|
45
43
|
*
|
|
46
44
|
* TODO(LEMS-2994): Clean up this file.
|
|
47
45
|
*/
|
|
48
|
-
declare const BaseRadio: ({ apiOptions, reviewModeRubric, reviewMode, choices, editMode, multipleSelect, labelWrap, countChoices, numCorrect, isLastUsedWidget, onChange,
|
|
46
|
+
declare const BaseRadio: ({ apiOptions, reviewModeRubric, reviewMode, choices, editMode, multipleSelect, labelWrap, countChoices, numCorrect, isLastUsedWidget, onChange, }: Props) => React.ReactElement;
|
|
49
47
|
export default BaseRadio;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { ChoiceProps } from "./choice";
|
|
3
|
-
|
|
2
|
+
import type { ChoiceProps } from "./choice.new";
|
|
3
|
+
interface Props extends ChoiceProps {
|
|
4
4
|
showContent?: boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* This component is a duplicate of the ChoiceNoneAbove component in choice-none-above.tsx
|
|
8
|
+
* for the Radio Revitalization Project. (LEMS-2933)
|
|
9
|
+
* This component will eventually replace choice-none-above.tsx when the feature flag is no longer needed.
|
|
10
|
+
*
|
|
11
|
+
* TODO(LEMS-2994): Clean up this file.
|
|
12
|
+
*/
|
|
13
|
+
declare const ChoiceNoneAbove: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
export default ChoiceNoneAbove;
|
|
@@ -19,5 +19,12 @@ export type ChoiceProps = {
|
|
|
19
19
|
crossedOut: boolean;
|
|
20
20
|
}) => void;
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* This component is a duplicate of the Choice component in choice.tsx
|
|
24
|
+
* for the Radio Revitalization Project. (LEMS-2933)
|
|
25
|
+
* This component will eventually replace choice.tsx when the feature flag is no longer needed.
|
|
26
|
+
*
|
|
27
|
+
* TODO(LEMS-2994): Clean up this file.
|
|
28
|
+
*/
|
|
29
|
+
declare const Choice: React.ForwardRefExoticComponent<ChoiceProps & React.RefAttributes<HTMLButtonElement>>;
|
|
30
|
+
export default Choice;
|
|
@@ -20,5 +20,5 @@ type Props = {
|
|
|
20
20
|
*
|
|
21
21
|
* TODO(LEMS-2994): Clean up this file.
|
|
22
22
|
*/
|
|
23
|
-
declare const OptionStatus: (
|
|
23
|
+
declare const OptionStatus: ({ checked, correct, crossedOut, previouslyAnswered, reviewMode, }: Props) => React.ReactElement | null;
|
|
24
24
|
export default OptionStatus;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
-
import type { FocusFunction } from "./base-radio.new";
|
|
4
2
|
import type { WidgetProps, ChoiceState, Widget } from "../../types";
|
|
5
3
|
import type { RadioPromptJSON } from "../../widget-ai-utils/radio/radio-ai-utils";
|
|
6
|
-
import type { PerseusRadioChoice, ShowSolutions, PerseusRadioRubric, PerseusRadioUserInput,
|
|
4
|
+
import type { PerseusRadioChoice, ShowSolutions, PerseusRadioRubric, PerseusRadioUserInput, PerseusRadioWidgetOptions } from "@khanacademy/perseus-core";
|
|
7
5
|
export type RenderProps = {
|
|
8
6
|
numCorrect: number;
|
|
9
7
|
hasNoneOfTheAbove?: boolean;
|
|
@@ -18,42 +16,31 @@ export type RenderProps = {
|
|
|
18
16
|
};
|
|
19
17
|
type Props = WidgetProps<RenderProps, PerseusRadioRubric>;
|
|
20
18
|
type DefaultProps = Required<Pick<Props, "choices" | "multipleSelect" | "countChoices" | "deselectEnabled" | "linterContext" | "showSolutions">>;
|
|
21
|
-
export
|
|
19
|
+
export interface RadioChoiceWithMetadata extends PerseusRadioChoice {
|
|
22
20
|
originalIndex: number;
|
|
23
21
|
correct?: boolean;
|
|
24
|
-
}
|
|
22
|
+
}
|
|
25
23
|
/**
|
|
26
|
-
* This component is
|
|
27
|
-
* for the Radio Revitalization Project. (LEMS-2933)
|
|
28
|
-
* This component will be
|
|
29
|
-
*
|
|
30
|
-
* the feature flag is no longer needed.
|
|
24
|
+
* This component is holds the class methods for the radio widget, that were split
|
|
25
|
+
* out of radio-component.new.tsx for the Radio Revitalization Project. (LEMS-2933)
|
|
26
|
+
* This component will be the main entry point for the radio widget when the feature
|
|
27
|
+
* flag is no longer needed.
|
|
31
28
|
*
|
|
32
29
|
* TODO(LEMS-2994): Clean up this file.
|
|
33
30
|
*/
|
|
34
31
|
declare class Radio extends React.Component<Props> implements Widget {
|
|
35
|
-
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
36
|
-
context: React.ContextType<typeof PerseusI18nContext>;
|
|
37
|
-
focusFunction: FocusFunction;
|
|
38
32
|
static defaultProps: DefaultProps;
|
|
39
33
|
static getUserInputFromProps(props: Props, unshuffle?: boolean): PerseusRadioUserInput;
|
|
40
|
-
componentDidUpdate(prevProps: Props): void;
|
|
41
|
-
_renderRenderer: (content?: string) => React.ReactElement;
|
|
42
|
-
focus(choiceIndex?: number | null): boolean;
|
|
43
|
-
registerFocusFunction(fun: FocusFunction): void;
|
|
44
|
-
updateChoices: (newValueLists: Readonly<{
|
|
45
|
-
checked: ReadonlyArray<boolean>;
|
|
46
|
-
crossedOut: ReadonlyArray<boolean>;
|
|
47
|
-
}>) => void;
|
|
48
34
|
getUserInput(): PerseusRadioUserInput;
|
|
49
35
|
getPromptJSON(): RadioPromptJSON;
|
|
50
36
|
/**
|
|
51
37
|
* Turn on rationale display for the currently selected choices. Note that
|
|
52
38
|
* this leaves rationales on for choices that are already showing
|
|
53
39
|
* rationales.
|
|
40
|
+
* TODO: LEMS-3077 Remove deprecated class function
|
|
54
41
|
* @deprecated Internal only. Use `showSolutions` prop instead.
|
|
55
42
|
*/
|
|
56
|
-
showRationalesForCurrentlySelectedChoices: (arg1:
|
|
43
|
+
showRationalesForCurrentlySelectedChoices: (arg1: PerseusRadioWidgetOptions) => void;
|
|
57
44
|
/**
|
|
58
45
|
* Deselects any currently-selected choices that are not correct choices.
|
|
59
46
|
*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import RadioOld from "./radio-component";
|
|
3
|
-
import RadioNew from "./radio-component.new";
|
|
4
3
|
import type { RenderProps } from "./radio-component";
|
|
5
4
|
import type { WidgetProps } from "../../types";
|
|
6
5
|
import type { PerseusRadioRubric } from "@khanacademy/perseus-core";
|
|
@@ -16,7 +15,7 @@ type Props = WidgetProps<RenderProps, PerseusRadioRubric>;
|
|
|
16
15
|
*/
|
|
17
16
|
declare class Radio extends RadioOld {
|
|
18
17
|
ffIsOn: boolean;
|
|
19
|
-
radioRef: React.RefObject<RadioOld
|
|
18
|
+
radioRef: React.RefObject<RadioOld>;
|
|
20
19
|
constructor(props: Props);
|
|
21
20
|
focus(choiceIndex?: number | null): boolean;
|
|
22
21
|
render(): React.ReactNode;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { WidgetProps, ChoiceState } from "../../types";
|
|
3
|
+
import type { PerseusRadioChoice, ShowSolutions, PerseusRadioRubric } from "@khanacademy/perseus-core";
|
|
4
|
+
export interface RadioChoiceWithMetadata extends PerseusRadioChoice {
|
|
5
|
+
originalIndex: number;
|
|
6
|
+
correct?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface RenderProps {
|
|
9
|
+
numCorrect: number;
|
|
10
|
+
hasNoneOfTheAbove?: boolean;
|
|
11
|
+
multipleSelect?: boolean;
|
|
12
|
+
countChoices?: boolean;
|
|
13
|
+
deselectEnabled?: boolean;
|
|
14
|
+
choices: ReadonlyArray<RadioChoiceWithMetadata>;
|
|
15
|
+
selectedChoices: ReadonlyArray<PerseusRadioChoice["correct"]>;
|
|
16
|
+
showSolutions?: ShowSolutions;
|
|
17
|
+
choiceStates?: ReadonlyArray<ChoiceState>;
|
|
18
|
+
values?: ReadonlyArray<boolean>;
|
|
19
|
+
}
|
|
20
|
+
type RadioComponentProps = WidgetProps<RenderProps, PerseusRadioRubric>;
|
|
21
|
+
/**
|
|
22
|
+
* This component is a duplicate of the Radio component in radio.tsx
|
|
23
|
+
* for the Radio Revitalization Project. (LEMS-2933)
|
|
24
|
+
* This component has been split up to move the rendering logic to a new functional component.
|
|
25
|
+
* The class methods are now in radio.class.new.tsx.
|
|
26
|
+
*
|
|
27
|
+
* TODO(LEMS-2994): Clean up this file.
|
|
28
|
+
*/
|
|
29
|
+
declare const RadioComponent: ({ choices, multipleSelect, countChoices, deselectEnabled, linterContext, showSolutions, static: isStatic, reviewModeRubric, reviewMode, apiOptions, isLastUsedWidget, questionCompleted, findWidgets, onChange, trackInteraction, numCorrect, choiceStates, values, }: RadioComponentProps) => React.ReactElement;
|
|
30
|
+
export default RadioComponent;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ShowSolutions } from "@khanacademy/perseus-core";
|
|
2
|
+
import type { ChoiceState } from "../../../types";
|
|
3
|
+
import type { RadioChoiceWithMetadata } from "../radio.new";
|
|
4
|
+
interface GetChoiceStatesProps {
|
|
5
|
+
choices: ReadonlyArray<RadioChoiceWithMetadata>;
|
|
6
|
+
isStatic?: boolean | null;
|
|
7
|
+
showSolutions?: ShowSolutions;
|
|
8
|
+
choiceStates?: ReadonlyArray<ChoiceState>;
|
|
9
|
+
values?: ReadonlyArray<boolean>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Determine the updated choice states for the Radio widget, based on the
|
|
13
|
+
* widget's static / showSolutions states, choiceStates, and values.
|
|
14
|
+
*
|
|
15
|
+
* @param choices - The choices for the Radio widget.
|
|
16
|
+
* @param isStatic - Whether the widget is static.
|
|
17
|
+
* @param showSolutions - Whether the widget is in showSolutions mode.
|
|
18
|
+
* @param choiceStates - The choice states for the widget. (The user's current selection states.)
|
|
19
|
+
* @param values - The values for the widget. (Deprecated: The user's current selection states for old content.)
|
|
20
|
+
* @returns The updated choice states for the widget.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getChoiceStates: ({ choices, isStatic, showSolutions, choiceStates, values, }: GetChoiceStatesProps) => ReadonlyArray<ChoiceState>;
|
|
23
|
+
/**
|
|
24
|
+
* Parse the nested widgets in the content of a Radio widget.
|
|
25
|
+
* Currently this only supports passage-ref widgets, but can
|
|
26
|
+
* be extended to support other nested widgets in the future.
|
|
27
|
+
*
|
|
28
|
+
* @param content - The content of the Radio widget.
|
|
29
|
+
* @returns The parsed content and the extracted widgets.
|
|
30
|
+
*/
|
|
31
|
+
export declare const parseNestedWidgets: (content: string) => {
|
|
32
|
+
parsedContent: string;
|
|
33
|
+
extractedWidgets: Record<string, any>;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { PerseusStrings } from "../../../strings";
|
|
2
|
+
/**
|
|
3
|
+
* Given a choice's position in the radio widget, return the corresponding
|
|
4
|
+
* "choice letter". (For example, `getChoiceLetter(0)` is "A",
|
|
5
|
+
* `getChoiceLetter(1)` is "B", etc.)
|
|
6
|
+
*
|
|
7
|
+
* All locales use English letters for the choice letters.
|
|
8
|
+
*
|
|
9
|
+
* @param pos - The position of the choice in the radio widget.
|
|
10
|
+
* @param strings - The strings for the Radio widget.
|
|
11
|
+
* @returns The choice letter for the given position.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getChoiceLetter: (pos: number, strings: PerseusStrings) => string;
|
|
14
|
+
interface GetOptionStatusTextProps {
|
|
15
|
+
checked: boolean;
|
|
16
|
+
correct: boolean;
|
|
17
|
+
crossedOut: boolean;
|
|
18
|
+
strings: PerseusStrings;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the correct (translated) string for an option status (correct, incorrect, selected, etc.)
|
|
22
|
+
*
|
|
23
|
+
* @param checked - Whether the option is checked.
|
|
24
|
+
* @param correct - Whether the option is correct.
|
|
25
|
+
* @param crossedOut - Whether the option is crossed out.
|
|
26
|
+
* @param strings - The strings for the Radio widget.
|
|
27
|
+
* @returns The appropriate string for the option status.
|
|
28
|
+
*/
|
|
29
|
+
export declare const getOptionStatusText: ({ checked, correct, crossedOut, strings, }: GetOptionStatusTextProps) => string;
|
|
30
|
+
interface GetInstructionsTextProps {
|
|
31
|
+
multipleSelect: boolean;
|
|
32
|
+
countChoices: boolean | null | undefined;
|
|
33
|
+
numCorrect: number;
|
|
34
|
+
strings: PerseusStrings;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get the (translated) instructions string for a Radio widget.
|
|
38
|
+
*
|
|
39
|
+
* This is the text that appears above the widget that explains
|
|
40
|
+
* how many choices the user should select.
|
|
41
|
+
*
|
|
42
|
+
* @param multipleSelect - Whether the widget is a multiple-select widget.
|
|
43
|
+
* @param countChoices - Whether the widget counts choices.
|
|
44
|
+
* @param numCorrect - The number of correct choices.
|
|
45
|
+
* @param strings - The strings for the Radio widget.
|
|
46
|
+
* @returns The instructions string for the widget.
|
|
47
|
+
*/
|
|
48
|
+
export declare const getInstructionsText: ({ multipleSelect, countChoices, numCorrect, strings, }: GetInstructionsTextProps) => string;
|
|
49
|
+
interface GetA11yTextProps {
|
|
50
|
+
letter: string;
|
|
51
|
+
checked: boolean;
|
|
52
|
+
correct: boolean;
|
|
53
|
+
crossedOut: boolean;
|
|
54
|
+
showCorrectness: boolean;
|
|
55
|
+
strings: PerseusStrings;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get the (translated) a11y string for a Radio widget.
|
|
59
|
+
*
|
|
60
|
+
* This string is provided to screen readers to help the user
|
|
61
|
+
* understand the current state of a Radio option.
|
|
62
|
+
*
|
|
63
|
+
* @param letter - The letter for the choice.
|
|
64
|
+
* @param checked - Whether the choice is checked.
|
|
65
|
+
* @param correct - Whether the choice is correct.
|
|
66
|
+
* @param crossedOut - Whether the choice is crossed out.
|
|
67
|
+
* @param showCorrectness - Whether the correctness is shown.
|
|
68
|
+
* @param strings - The strings for the Radio widget.
|
|
69
|
+
* @returns The a11y string for the Radio option.
|
|
70
|
+
*/
|
|
71
|
+
export declare const getA11yText: ({ letter, checked, correct, crossedOut, showCorrectness, strings, }: GetA11yTextProps) => string;
|
|
72
|
+
export {};
|
package/dist/widgets.d.ts
CHANGED
|
@@ -3,38 +3,38 @@ import type { Tracking, WidgetExports, WidgetTransform } from "./types";
|
|
|
3
3
|
import type { PerseusWidget, Version } from "@khanacademy/perseus-core";
|
|
4
4
|
import type * as React from "react";
|
|
5
5
|
type Editor = any;
|
|
6
|
-
export declare const registerWidget: (
|
|
7
|
-
export declare const registerWidgets: (
|
|
6
|
+
export declare const registerWidget: (type: string, widget: WidgetExports) => void;
|
|
7
|
+
export declare const registerWidgets: (widgetArr: ReadonlyArray<WidgetExports>) => void;
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
10
|
+
* @param type - the widget that you are trying to replace
|
|
11
|
+
* @param replacementType - the type of the widget that takes its place
|
|
12
12
|
*
|
|
13
13
|
* e.g. replaceWidget("transformer", "deprecated-standin") will make it so the
|
|
14
14
|
* transformer widget is replaced by the always correct widget
|
|
15
15
|
*/
|
|
16
|
-
export declare const replaceWidget: (
|
|
16
|
+
export declare const replaceWidget: (type: string, replacementType: string) => void;
|
|
17
17
|
export declare const replaceDeprecatedWidgets: () => void;
|
|
18
18
|
export declare const registerEditors: (editorsToRegister: ReadonlyArray<Editor>) => void;
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
21
|
+
* @param type - the widget that you are trying to replace
|
|
22
|
+
* @param replacementType - the type of the widget that takes its place
|
|
23
23
|
*
|
|
24
24
|
* e.g. replaceEditor("transformer", "deprecated-standin") will make it so the
|
|
25
25
|
* transformer widget is replaced by the deprecated stand-in widget
|
|
26
26
|
*/
|
|
27
|
-
export declare const replaceEditor: (
|
|
27
|
+
export declare const replaceEditor: (type: string, replacementType: string) => void;
|
|
28
28
|
export declare const replaceDeprecatedEditors: () => void;
|
|
29
|
-
export declare const getWidget: (
|
|
30
|
-
export declare const getWidgetExport: (
|
|
31
|
-
export declare const getEditor: (
|
|
32
|
-
export declare const getTransform: (
|
|
33
|
-
export declare const getVersion: (
|
|
29
|
+
export declare const getWidget: (type: string) => React.ComponentType<any> | null | undefined;
|
|
30
|
+
export declare const getWidgetExport: (type: string) => WidgetExports | null;
|
|
31
|
+
export declare const getEditor: (type: string) => Editor | null;
|
|
32
|
+
export declare const getTransform: (type: string) => WidgetTransform | null | undefined;
|
|
33
|
+
export declare const getVersion: (type: string) => Version | undefined;
|
|
34
34
|
export declare const getVersionVector: () => {
|
|
35
35
|
[key: string]: Version;
|
|
36
36
|
};
|
|
37
|
-
export declare const getPublicWidgets: () =>
|
|
37
|
+
export declare const getPublicWidgets: () => Record<string, WidgetExports>;
|
|
38
38
|
export declare const isAccessible: (widgetInfo: PerseusWidget) => boolean;
|
|
39
39
|
export declare const getAllWidgetTypes: () => ReadonlyArray<string>;
|
|
40
40
|
export declare const getRendererPropsForWidgetInfo: (widgetInfo: PerseusWidget, strings: PerseusStrings, problemNum?: number) => PerseusWidget;
|
|
@@ -47,7 +47,7 @@ export declare const traverseChildWidgets: (widgetInfo: PerseusWidget, traverseR
|
|
|
47
47
|
* A widget implicitly supports static mode if it exports a
|
|
48
48
|
* staticTransform function.
|
|
49
49
|
*/
|
|
50
|
-
export declare const supportsStaticMode: (type: string) => boolean;
|
|
50
|
+
export declare const supportsStaticMode: (type: string) => boolean | undefined;
|
|
51
51
|
/**
|
|
52
52
|
* Return the staticTransform function used to convert the editorProps to
|
|
53
53
|
* the rendered widget state.
|
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": "
|
|
6
|
+
"version": "63.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
"mafs": "0.19.0",
|
|
42
42
|
"tiny-invariant": "^1.3.1",
|
|
43
43
|
"uuid": "^10.0.0",
|
|
44
|
-
"@khanacademy/kas": "2.0.
|
|
45
|
-
"@khanacademy/keypad-context": "3.0.
|
|
46
|
-
"@khanacademy/kmath": "2.0.
|
|
47
|
-
"@khanacademy/math-input": "25.1.
|
|
48
|
-
"@khanacademy/perseus-core": "
|
|
49
|
-
"@khanacademy/perseus-linter": "3.0.
|
|
50
|
-
"@khanacademy/perseus-score": "
|
|
51
|
-
"@khanacademy/perseus-utils": "2.0.
|
|
52
|
-
"@khanacademy/pure-markdown": "2.0.
|
|
53
|
-
"@khanacademy/simple-markdown": "2.0.
|
|
44
|
+
"@khanacademy/kas": "2.0.4",
|
|
45
|
+
"@khanacademy/keypad-context": "3.0.10",
|
|
46
|
+
"@khanacademy/kmath": "2.0.10",
|
|
47
|
+
"@khanacademy/math-input": "25.1.5",
|
|
48
|
+
"@khanacademy/perseus-core": "12.0.0",
|
|
49
|
+
"@khanacademy/perseus-linter": "3.0.10",
|
|
50
|
+
"@khanacademy/perseus-score": "7.0.0",
|
|
51
|
+
"@khanacademy/perseus-utils": "2.0.3",
|
|
52
|
+
"@khanacademy/pure-markdown": "2.0.4",
|
|
53
|
+
"@khanacademy/simple-markdown": "2.0.4"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@khanacademy/wonder-blocks-banner": "4.1.12",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"@khanacademy/wonder-blocks-form": "7.1.10",
|
|
63
63
|
"@khanacademy/wonder-blocks-icon-button": "9.0.4",
|
|
64
64
|
"@khanacademy/wonder-blocks-icon": "5.1.3",
|
|
65
|
+
"@khanacademy/wonder-blocks-labeled-field": "3.0.6",
|
|
65
66
|
"@khanacademy/wonder-blocks-layout": "3.1.9",
|
|
66
67
|
"@khanacademy/wonder-blocks-link": "9.0.3",
|
|
67
68
|
"@khanacademy/wonder-blocks-pill": "3.1.10",
|
|
@@ -98,6 +99,7 @@
|
|
|
98
99
|
"@khanacademy/wonder-blocks-form": "7.1.10",
|
|
99
100
|
"@khanacademy/wonder-blocks-icon": "5.1.3",
|
|
100
101
|
"@khanacademy/wonder-blocks-icon-button": "9.0.4",
|
|
102
|
+
"@khanacademy/wonder-blocks-labeled-field": "3.0.6",
|
|
101
103
|
"@khanacademy/wonder-blocks-layout": "3.1.9",
|
|
102
104
|
"@khanacademy/wonder-blocks-link": "9.0.3",
|
|
103
105
|
"@khanacademy/wonder-blocks-pill": "3.1.10",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { PerseusStrings } from "../../strings";
|
|
2
|
-
/**
|
|
3
|
-
* This function is used to generate the a11y text for the radio widget.
|
|
4
|
-
* It is used in the radio-component.tsx file to generate the a11y text for the radio widget.
|
|
5
|
-
*
|
|
6
|
-
* This function is a duplicate of the getA11yText function in choice-a11y-text.ts
|
|
7
|
-
* for the Radio Revitalization Project. (LEMS-2933)
|
|
8
|
-
*
|
|
9
|
-
* This function will eventually replace choice-a11y-text.ts when the feature flag is no longer needed.
|
|
10
|
-
*
|
|
11
|
-
* TODO(LEMS-2994): Clean up this file.
|
|
12
|
-
*/
|
|
13
|
-
declare function getA11yText(letter: string, checked: boolean, correct: boolean, crossedOut: boolean, showCorrectness: boolean, strings: PerseusStrings): string;
|
|
14
|
-
export default getA11yText;
|