@khanacademy/perseus-editor 28.10.1 → 28.10.3
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/es/index.js +5 -5
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/testing/feature-flags-util.d.ts +15 -0
- package/dist/testing/image-loader-utils.d.ts +9 -0
- package/dist/testing/object-utils.d.ts +1 -0
- package/dist/testing/preview/exercise-preview-page.d.ts +9 -0
- package/dist/testing/preview/preview-renderer.d.ts +10 -0
- package/dist/testing/split-view.d.ts +13 -0
- package/dist/testing/test-dependencies.d.ts +4 -0
- package/dist/widgets/radio/editor.d.ts +6 -2
- package/dist/widgets/radio/radio-option-content-and-image-editor.d.ts +4 -1
- package/dist/widgets/radio/radio-option-settings.d.ts +4 -1
- package/package.json +43 -43
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const DEFAULT_FEATURE_FLAGS: {
|
|
2
|
+
"new-radio-widget": boolean;
|
|
3
|
+
"image-widget-upgrade": boolean;
|
|
4
|
+
"image-widget-upgrade-alignment": boolean;
|
|
5
|
+
};
|
|
6
|
+
/** Utility to get feature flags with optional overrides for testing.
|
|
7
|
+
* sample usage:
|
|
8
|
+
* getFeatureFlags({"image-widget-upgrade": true})
|
|
9
|
+
*/
|
|
10
|
+
export declare function getFeatureFlags(overrides?: Partial<typeof DEFAULT_FEATURE_FLAGS>): {
|
|
11
|
+
"new-radio-widget": boolean;
|
|
12
|
+
"image-widget-upgrade": boolean;
|
|
13
|
+
"image-widget-upgrade-alignment": boolean;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mocks image loading done by the ImageLoader component to immediately trigger
|
|
3
|
+
* the load event.
|
|
4
|
+
* @returns A function to unmock the image loading
|
|
5
|
+
*/
|
|
6
|
+
export declare const mockImageLoading: (options?: {
|
|
7
|
+
naturalWidth?: number;
|
|
8
|
+
naturalHeight?: number;
|
|
9
|
+
}) => () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const clone: <T>(obj: T) => T;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Loads the exercise preview frame
|
|
4
|
+
*
|
|
5
|
+
* This is loaded inside the iframe, where it sets up the ExercisePreviewFrame
|
|
6
|
+
* component that handles all communication between the iframe and its parent.
|
|
7
|
+
*/
|
|
8
|
+
declare const ExercisePreviewPage: () => React.JSX.Element;
|
|
9
|
+
export default ExercisePreviewPage;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { PreviewContent } from "../../preview/message-types";
|
|
3
|
+
type Props = {
|
|
4
|
+
data: PreviewContent;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Renders the appropriate content based on preview data type
|
|
8
|
+
*/
|
|
9
|
+
export declare function PreviewRenderer({ data }: Props): React.JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
rendererTitle: React.ReactNode;
|
|
4
|
+
renderer: React.ReactNode;
|
|
5
|
+
JSONTitle?: string;
|
|
6
|
+
jsonObject: any;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* This component is used in Storybook to render both the renderer and the JSON object in a split view.
|
|
10
|
+
* Currently, the renderer is displayed above the JSON object.
|
|
11
|
+
*/
|
|
12
|
+
declare const SplitView: ({ rendererTitle, renderer, JSONTitle, jsonObject, }: Props) => React.ReactElement;
|
|
13
|
+
export default SplitView;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PerseusDependencies, PerseusDependenciesV2 } from "@khanacademy/perseus";
|
|
2
|
+
export declare const testDependencies: PerseusDependencies;
|
|
3
|
+
export declare const testDependenciesV2: PerseusDependenciesV2;
|
|
4
|
+
export declare const storybookDependenciesV2: PerseusDependenciesV2;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { RadioOptionSettingsHandle } from "./radio-option-settings";
|
|
2
3
|
import type { ChoiceMovementType } from "./radio-option-settings-actions";
|
|
3
|
-
import type {
|
|
4
|
+
import type { APIOptions } from "@khanacademy/perseus";
|
|
4
5
|
import type { PerseusRadioWidgetOptions, PerseusRadioChoice, RadioDefaultWidgetOptions } from "@khanacademy/perseus-core";
|
|
5
|
-
export interface RadioEditorProps
|
|
6
|
+
export interface RadioEditorProps {
|
|
6
7
|
apiOptions: APIOptions;
|
|
7
8
|
countChoices: boolean;
|
|
8
9
|
choices: PerseusRadioChoice[];
|
|
@@ -11,6 +12,7 @@ export interface RadioEditorProps extends Changeable.ChangeableProps {
|
|
|
11
12
|
multipleSelect: boolean;
|
|
12
13
|
deselectEnabled: boolean;
|
|
13
14
|
static: boolean;
|
|
15
|
+
onChange: (values: Partial<PerseusRadioWidgetOptions>, callback?: (() => void) | null) => void;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* An editor for adding a radio widget that allows users to select a single option from multiple choices.
|
|
@@ -18,7 +20,9 @@ export interface RadioEditorProps extends Changeable.ChangeableProps {
|
|
|
18
20
|
declare class RadioEditor extends React.Component<RadioEditorProps> {
|
|
19
21
|
static widgetName: "radio";
|
|
20
22
|
static defaultProps: RadioDefaultWidgetOptions;
|
|
23
|
+
choiceRefs: Map<string, React.RefObject<RadioOptionSettingsHandle>>;
|
|
21
24
|
componentDidMount(): void;
|
|
25
|
+
getChoiceRef: (choiceId: string) => React.RefObject<RadioOptionSettingsHandle>;
|
|
22
26
|
onMultipleSelectChange: (options: {
|
|
23
27
|
multipleSelect: boolean;
|
|
24
28
|
}) => void;
|
|
@@ -5,5 +5,8 @@ type Props = {
|
|
|
5
5
|
choiceIndex: number;
|
|
6
6
|
onContentChange: (choiceIndex: number, content: string) => void;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type RadioOptionContentAndImageEditorHandle = {
|
|
9
|
+
focus: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const RadioOptionContentAndImageEditor: React.ForwardRefExoticComponent<Props & React.RefAttributes<RadioOptionContentAndImageEditorHandle>>;
|
|
9
12
|
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { ChoiceMovementType } from "./radio-option-settings-actions";
|
|
3
3
|
import type { PerseusRadioChoice } from "@khanacademy/perseus-core";
|
|
4
|
+
export type RadioOptionSettingsHandle = {
|
|
5
|
+
focus: () => void;
|
|
6
|
+
};
|
|
4
7
|
interface RadioOptionSettingsProps {
|
|
5
8
|
index: number;
|
|
6
9
|
choice: PerseusRadioChoice;
|
|
@@ -13,5 +16,5 @@ interface RadioOptionSettingsProps {
|
|
|
13
16
|
onDelete: () => void;
|
|
14
17
|
onMove: (choiceIndex: number, movement: ChoiceMovementType) => void;
|
|
15
18
|
}
|
|
16
|
-
export declare
|
|
19
|
+
export declare const RadioOptionSettings: React.ForwardRefExoticComponent<RadioOptionSettingsProps & React.RefAttributes<RadioOptionSettingsHandle>>;
|
|
17
20
|
export {};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Perseus editors",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "28.10.
|
|
6
|
+
"version": "28.10.3",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -36,35 +36,35 @@
|
|
|
36
36
|
"mafs": "^0.19.0",
|
|
37
37
|
"tiny-invariant": "1.3.1",
|
|
38
38
|
"@khanacademy/kas": "2.1.7",
|
|
39
|
-
"@khanacademy/keypad-context": "3.2.
|
|
40
|
-
"@khanacademy/kmath": "2.2.
|
|
41
|
-
"@khanacademy/
|
|
42
|
-
"@khanacademy/
|
|
43
|
-
"@khanacademy/perseus-core": "23.0.
|
|
44
|
-
"@khanacademy/perseus-
|
|
45
|
-
"@khanacademy/perseus-
|
|
39
|
+
"@khanacademy/keypad-context": "3.2.31",
|
|
40
|
+
"@khanacademy/kmath": "2.2.31",
|
|
41
|
+
"@khanacademy/math-input": "26.3.12",
|
|
42
|
+
"@khanacademy/perseus": "75.0.0",
|
|
43
|
+
"@khanacademy/perseus-core": "23.0.1",
|
|
44
|
+
"@khanacademy/perseus-linter": "4.7.1",
|
|
45
|
+
"@khanacademy/perseus-score": "8.2.8",
|
|
46
46
|
"@khanacademy/perseus-utils": "2.1.4"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@khanacademy/mathjax-renderer": "3.0.0",
|
|
50
|
-
"@khanacademy/wonder-blocks-accordion": "3.1.
|
|
51
|
-
"@khanacademy/wonder-blocks-banner": "5.0.
|
|
52
|
-
"@khanacademy/wonder-blocks-button": "11.
|
|
53
|
-
"@khanacademy/wonder-blocks-clickable": "8.
|
|
54
|
-
"@khanacademy/wonder-blocks-core": "12.4.
|
|
55
|
-
"@khanacademy/wonder-blocks-dropdown": "10.
|
|
56
|
-
"@khanacademy/wonder-blocks-form": "7.4
|
|
57
|
-
"@khanacademy/wonder-blocks-icon": "5.3.
|
|
58
|
-
"@khanacademy/wonder-blocks-icon-button": "11.
|
|
59
|
-
"@khanacademy/wonder-blocks-labeled-field": "4.0.
|
|
60
|
-
"@khanacademy/wonder-blocks-layout": "3.1.
|
|
61
|
-
"@khanacademy/wonder-blocks-link": "10.
|
|
62
|
-
"@khanacademy/wonder-blocks-pill": "3.1.
|
|
63
|
-
"@khanacademy/wonder-blocks-switch": "3.3.
|
|
50
|
+
"@khanacademy/wonder-blocks-accordion": "3.1.51",
|
|
51
|
+
"@khanacademy/wonder-blocks-banner": "5.0.15",
|
|
52
|
+
"@khanacademy/wonder-blocks-button": "11.3.4",
|
|
53
|
+
"@khanacademy/wonder-blocks-clickable": "8.1.3",
|
|
54
|
+
"@khanacademy/wonder-blocks-core": "12.4.3",
|
|
55
|
+
"@khanacademy/wonder-blocks-dropdown": "10.7.1",
|
|
56
|
+
"@khanacademy/wonder-blocks-form": "7.5.4",
|
|
57
|
+
"@khanacademy/wonder-blocks-icon": "5.3.7",
|
|
58
|
+
"@khanacademy/wonder-blocks-icon-button": "11.1.4",
|
|
59
|
+
"@khanacademy/wonder-blocks-labeled-field": "4.0.14",
|
|
60
|
+
"@khanacademy/wonder-blocks-layout": "3.1.44",
|
|
61
|
+
"@khanacademy/wonder-blocks-link": "10.1.5",
|
|
62
|
+
"@khanacademy/wonder-blocks-pill": "3.1.55",
|
|
63
|
+
"@khanacademy/wonder-blocks-switch": "3.3.28",
|
|
64
64
|
"@khanacademy/wonder-blocks-timing": "7.0.4",
|
|
65
|
-
"@khanacademy/wonder-blocks-tokens": "
|
|
66
|
-
"@khanacademy/wonder-blocks-tooltip": "4.1.
|
|
67
|
-
"@khanacademy/wonder-blocks-typography": "4.2.
|
|
65
|
+
"@khanacademy/wonder-blocks-tokens": "15.0.0",
|
|
66
|
+
"@khanacademy/wonder-blocks-tooltip": "4.1.66",
|
|
67
|
+
"@khanacademy/wonder-blocks-typography": "4.2.29",
|
|
68
68
|
"@khanacademy/wonder-stuff-core": "3.0.0",
|
|
69
69
|
"@phosphor-icons/core": "2.0.2",
|
|
70
70
|
"aphrodite": "1.2.5",
|
|
@@ -79,24 +79,24 @@
|
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@khanacademy/mathjax-renderer": "^3.0.0",
|
|
82
|
-
"@khanacademy/wonder-blocks-accordion": "^3.1.
|
|
83
|
-
"@khanacademy/wonder-blocks-banner": "^5.0.
|
|
84
|
-
"@khanacademy/wonder-blocks-button": "^11.
|
|
85
|
-
"@khanacademy/wonder-blocks-clickable": "^8.
|
|
86
|
-
"@khanacademy/wonder-blocks-core": "^12.4.
|
|
87
|
-
"@khanacademy/wonder-blocks-dropdown": "^10.
|
|
88
|
-
"@khanacademy/wonder-blocks-form": "^7.4
|
|
89
|
-
"@khanacademy/wonder-blocks-icon": "^5.3.
|
|
90
|
-
"@khanacademy/wonder-blocks-icon-button": "^11.
|
|
91
|
-
"@khanacademy/wonder-blocks-labeled-field": "^4.0.
|
|
92
|
-
"@khanacademy/wonder-blocks-layout": "^3.1.
|
|
93
|
-
"@khanacademy/wonder-blocks-link": "^10.
|
|
94
|
-
"@khanacademy/wonder-blocks-pill": "^3.1.
|
|
95
|
-
"@khanacademy/wonder-blocks-switch": "^3.3.
|
|
82
|
+
"@khanacademy/wonder-blocks-accordion": "^3.1.51",
|
|
83
|
+
"@khanacademy/wonder-blocks-banner": "^5.0.15",
|
|
84
|
+
"@khanacademy/wonder-blocks-button": "^11.3.4",
|
|
85
|
+
"@khanacademy/wonder-blocks-clickable": "^8.1.3",
|
|
86
|
+
"@khanacademy/wonder-blocks-core": "^12.4.3",
|
|
87
|
+
"@khanacademy/wonder-blocks-dropdown": "^10.7.1",
|
|
88
|
+
"@khanacademy/wonder-blocks-form": "^7.5.4",
|
|
89
|
+
"@khanacademy/wonder-blocks-icon": "^5.3.7",
|
|
90
|
+
"@khanacademy/wonder-blocks-icon-button": "^11.1.4",
|
|
91
|
+
"@khanacademy/wonder-blocks-labeled-field": "^4.0.14",
|
|
92
|
+
"@khanacademy/wonder-blocks-layout": "^3.1.44",
|
|
93
|
+
"@khanacademy/wonder-blocks-link": "^10.1.5",
|
|
94
|
+
"@khanacademy/wonder-blocks-pill": "^3.1.55",
|
|
95
|
+
"@khanacademy/wonder-blocks-switch": "^3.3.28",
|
|
96
96
|
"@khanacademy/wonder-blocks-timing": "^7.0.4",
|
|
97
|
-
"@khanacademy/wonder-blocks-tokens": "^
|
|
98
|
-
"@khanacademy/wonder-blocks-tooltip": "^4.1.
|
|
99
|
-
"@khanacademy/wonder-blocks-typography": "^4.2.
|
|
97
|
+
"@khanacademy/wonder-blocks-tokens": "^15.0.0",
|
|
98
|
+
"@khanacademy/wonder-blocks-tooltip": "^4.1.66",
|
|
99
|
+
"@khanacademy/wonder-blocks-typography": "^4.2.29",
|
|
100
100
|
"@khanacademy/wonder-stuff-core": "^3.0.0",
|
|
101
101
|
"@phosphor-icons/core": "^2.0.2",
|
|
102
102
|
"aphrodite": "^1.2.5",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
},
|
|
110
110
|
"keywords": [],
|
|
111
111
|
"khan": {
|
|
112
|
-
"catalogHash": "
|
|
112
|
+
"catalogHash": "91fd14c25b886292"
|
|
113
113
|
},
|
|
114
114
|
"scripts": {}
|
|
115
115
|
}
|