@khanacademy/perseus 19.8.0 → 20.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/es/index.css +0 -35
- package/dist/es/index.js +128 -1191
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +0 -35
- package/dist/index.js +141 -1209
- package/dist/index.js.map +1 -1
- package/dist/perseus-types.d.ts +2 -14
- package/dist/strings.js +0 -8
- package/dist/widgets.d.ts +4 -2
- package/package.json +1 -1
- package/dist/widgets/sequence.d.ts +0 -44
- package/dist/widgets/simulator.d.ts +0 -89
package/dist/perseus-types.d.ts
CHANGED
|
@@ -42,8 +42,6 @@ export type PerseusWidgetsMap = {
|
|
|
42
42
|
[key in `interactive-graph ${number}`]: InteractiveGraphWidget;
|
|
43
43
|
} & {
|
|
44
44
|
[key in `label-image ${number}`]: LabelImageWidget;
|
|
45
|
-
} & {
|
|
46
|
-
[key in `lights-puzzle ${number}`]: LightsPuzzleWidget;
|
|
47
45
|
} & {
|
|
48
46
|
[key in `matcher ${number}`]: MatcherWidget;
|
|
49
47
|
} & {
|
|
@@ -70,14 +68,8 @@ export type PerseusWidgetsMap = {
|
|
|
70
68
|
[key in `python-program ${number}`]: PythonProgramWidget;
|
|
71
69
|
} & {
|
|
72
70
|
[key in `radio ${number}`]: RadioWidget;
|
|
73
|
-
} & {
|
|
74
|
-
[key in `reaction-diagram ${number}`]: ReactionDiagramWidget;
|
|
75
|
-
} & {
|
|
76
|
-
[key in `sequence ${number}`]: SequenceWidget;
|
|
77
71
|
} & {
|
|
78
72
|
[key in `simple-markdown-tester ${number}`]: SimpleMarkdownTesterWidget;
|
|
79
|
-
} & {
|
|
80
|
-
[key in `simulator ${number}`]: SimulatorWidget;
|
|
81
73
|
} & {
|
|
82
74
|
[key in `sorter ${number}`]: SorterWidget;
|
|
83
75
|
} & {
|
|
@@ -150,22 +142,18 @@ export type PassageWidget = Widget<'passage', PerseusPassageWidgetOptions>;
|
|
|
150
142
|
export type PlotterWidget = Widget<'plotter', PerseusPlotterWidgetOptions>;
|
|
151
143
|
export type PythonProgramWidget = Widget<'python-program', PerseusPythonProgramWidgetOptions>;
|
|
152
144
|
export type RadioWidget = Widget<'radio', PerseusRadioWidgetOptions>;
|
|
153
|
-
export type SequenceWidget = Widget<'sequence', PerseusSequenceWidgetOptions>;
|
|
154
|
-
export type SimulatorWidget = Widget<'simulator', PerseusSimulatorWidgetOptions>;
|
|
155
145
|
export type SorterWidget = Widget<'sorter', PerseusSorterWidgetOptions>;
|
|
156
146
|
export type TableWidget = Widget<'table', PerseusTableWidgetOptions>;
|
|
157
147
|
export type ExampleGraphieWidget = Widget<'example-graphie-widget', PerseusExampleGraphieWidgetOptions>;
|
|
158
148
|
export type ExampleWidget = Widget<'example-widget', PerseusExampleWidgetOptions>;
|
|
159
149
|
export type InputNumberWidget = Widget<'input-number', PerseusInputNumberWidgetOptions>;
|
|
160
|
-
export type LightsPuzzleWidget = Widget<'lights-puzzle', PerseusLightsPuzzleWidgetOptions>;
|
|
161
150
|
export type MoleculeRendererWidget = Widget<'molecule-renderer', PerseusMoleculeRendererWidgetOptions>;
|
|
162
151
|
export type RefTargetWidget = Widget<'passage-ref-target', PerseusPassageRefTargetWidgetOptions>;
|
|
163
|
-
export type ReactionDiagramWidget = Widget<'reaction-diagram', PerseusReactionDiagramWidgetOptions>;
|
|
164
152
|
export type SimpleMarkdownTesterWidget = Widget<'simple-markdown-tester', PerseusSimpleMarkdownTesterWidgetOptions>;
|
|
165
153
|
export type UnitInputWidget = Widget<'unit-input', PerseusUnitInputWidgetOptions>;
|
|
166
154
|
export type VideoWidget = Widget<'video', PerseusVideoWidgetOptions>;
|
|
167
155
|
export type AutoCorrectWidget = Widget<'deprecated-standin', PerseusWidgetOptions>;
|
|
168
|
-
export type PerseusWidget = CategorizerWidget | CSProgramWidget | DefinitionWidget | DropdownWidget | ExampleGraphieWidget | ExampleWidget | ExplanationWidget | ExpressionWidget | GradedGroupSetWidget | GradedGroupWidget | GrapherWidget | GroupWidget | IFrameWidget | ImageWidget | InputNumberWidget | InteractionWidget | InteractiveGraphWidget | LabelImageWidget |
|
|
156
|
+
export type PerseusWidget = CategorizerWidget | CSProgramWidget | DefinitionWidget | DropdownWidget | ExampleGraphieWidget | ExampleWidget | ExplanationWidget | ExpressionWidget | GradedGroupSetWidget | GradedGroupWidget | GrapherWidget | GroupWidget | IFrameWidget | ImageWidget | InputNumberWidget | InteractionWidget | InteractiveGraphWidget | LabelImageWidget | MatcherWidget | MatrixWidget | MeasurerWidget | MoleculeRendererWidget | NumberLineWidget | NumericInputWidget | OrdererWidget | PassageRefWidget | PassageWidget | PlotterWidget | PythonProgramWidget | RadioWidget | RefTargetWidget | SimpleMarkdownTesterWidget | SorterWidget | TableWidget | UnitInputWidget | VideoWidget | AutoCorrectWidget;
|
|
169
157
|
export type PerseusImageBackground = {
|
|
170
158
|
url: string | null | undefined;
|
|
171
159
|
width?: number;
|
|
@@ -814,5 +802,5 @@ export type PerseusSimpleMarkdownTesterWidgetOptions = {
|
|
|
814
802
|
export type PerseusUnitInputWidgetOptions = {
|
|
815
803
|
value: string;
|
|
816
804
|
};
|
|
817
|
-
export type PerseusWidgetOptions = PerseusCategorizerWidgetOptions | PerseusCSProgramWidgetOptions | PerseusDefinitionWidgetOptions | PerseusDropdownWidgetOptions | PerseusExampleGraphieWidgetOptions | PerseusExampleWidgetOptions | PerseusExplanationWidgetOptions | PerseusExpressionWidgetOptions | PerseusGradedGroupSetWidgetOptions | PerseusGradedGroupWidgetOptions | PerseusIFrameWidgetOptions | PerseusImageWidgetOptions | PerseusInputNumberWidgetOptions | PerseusInteractionWidgetOptions | PerseusInteractiveGraphWidgetOptions | PerseusLabelImageWidgetOptions |
|
|
805
|
+
export type PerseusWidgetOptions = PerseusCategorizerWidgetOptions | PerseusCSProgramWidgetOptions | PerseusDefinitionWidgetOptions | PerseusDropdownWidgetOptions | PerseusExampleGraphieWidgetOptions | PerseusExampleWidgetOptions | PerseusExplanationWidgetOptions | PerseusExpressionWidgetOptions | PerseusGradedGroupSetWidgetOptions | PerseusGradedGroupWidgetOptions | PerseusIFrameWidgetOptions | PerseusImageWidgetOptions | PerseusInputNumberWidgetOptions | PerseusInteractionWidgetOptions | PerseusInteractiveGraphWidgetOptions | PerseusLabelImageWidgetOptions | PerseusMatcherWidgetOptions | PerseusMatrixWidgetOptions | PerseusMeasurerWidgetOptions | PerseusMoleculeRendererWidgetOptions | PerseusNumberLineWidgetOptions | PerseusNumericInputWidgetOptions | PerseusOrdererWidgetOptions | PerseusPassageRefTargetWidgetOptions | PerseusPassageRefWidgetOptions | PerseusPassageWidgetOptions | PerseusPlotterWidgetOptions | PerseusRadioWidgetOptions | PerseusSimpleMarkdownTesterWidgetOptions | PerseusSorterWidgetOptions | PerseusTableWidgetOptions | PerseusUnitInputWidgetOptions | PerseusVideoWidgetOptions;
|
|
818
806
|
export {};
|
package/dist/strings.js
CHANGED
|
@@ -91,16 +91,12 @@ module.exports = [
|
|
|
91
91
|
i18n._("No", {}),
|
|
92
92
|
i18n._("None of the above", {}),
|
|
93
93
|
i18n._("Number of divisions:", {}),
|
|
94
|
-
i18n._("Number of trials:", {}),
|
|
95
94
|
i18n._("Oops!", {}),
|
|
96
95
|
i18n._("open math keypad", {}),
|
|
97
|
-
i18n._("Parameter", {}),
|
|
98
96
|
i18n._("Please choose the correct number of answers.", {}),
|
|
99
97
|
i18n.$_("Please make sure the number of divisions is in the range %(divRangeString)s.", {}),
|
|
100
98
|
i18n._("Reaction arrow pointing to the right.", {}),
|
|
101
99
|
i18n._("Remove highlight", {}),
|
|
102
|
-
i18n._("Run simulation", {}),
|
|
103
|
-
i18n._("Sample size:", {}),
|
|
104
100
|
i18n._("See video transcript", {}),
|
|
105
101
|
i18n._("Skip to %(title)s", {}),
|
|
106
102
|
i18n._("Something went wrong.", {}),
|
|
@@ -112,12 +108,8 @@ module.exports = [
|
|
|
112
108
|
i18n._("Tap to add points", {}),
|
|
113
109
|
i18n._("That answer is numerically incorrect.", {}),
|
|
114
110
|
i18n._("The symbol %(questionSymbol)s indicates that question %(questionNumber)s references this portion of the passage.", {}),
|
|
115
|
-
i18n._("This controls the proportion or percentage that will be used in your simulation.", {}),
|
|
116
|
-
i18n._("This controls the sample size that will be used in your simulation. For example, if you set this to 100, then for each trial, responses from 100 participants will be simulated.", {}),
|
|
117
|
-
i18n._("This is the number of trials used in the simulation. For example, if set to 50, then the survey will be conducted 50 times.", {}),
|
|
118
111
|
i18n._("True", {}),
|
|
119
112
|
i18n._("Try again", {}),
|
|
120
|
-
i18n._("Value", {}),
|
|
121
113
|
i18n._("We could not understand your answer. Please check your answer for extra text or symbols.", {}),
|
|
122
114
|
i18n._("We couldn't grade your answer.", {}),
|
|
123
115
|
i18n._("Yes", {}),
|
package/dist/widgets.d.ts
CHANGED
|
@@ -13,16 +13,18 @@ export declare const registerWidgets: (widgets: ReadonlyArray<WidgetExports>) =>
|
|
|
13
13
|
* transformer widget is replaced by the always correct widget
|
|
14
14
|
*/
|
|
15
15
|
export declare const replaceWidget: (name: string, replacementName: string) => void;
|
|
16
|
+
export declare const replaceDeprecatedWidgets: () => void;
|
|
16
17
|
export declare const registerEditors: (editorsToRegister: ReadonlyArray<Editor>) => void;
|
|
17
18
|
/**
|
|
18
19
|
*
|
|
19
20
|
* @param name - the widget that you are trying to replace
|
|
20
21
|
* @param replacementName - the name of the widget that takes its place
|
|
21
22
|
*
|
|
22
|
-
* e.g. replaceEditor("transformer", "
|
|
23
|
-
* transformer widget is replaced by the
|
|
23
|
+
* e.g. replaceEditor("transformer", "deprecated-standin") will make it so the
|
|
24
|
+
* transformer widget is replaced by the deprecated stand-in widget
|
|
24
25
|
*/
|
|
25
26
|
export declare const replaceEditor: (name: string, replacementName: string) => void;
|
|
27
|
+
export declare const replaceDeprecatedEditors: () => void;
|
|
26
28
|
export declare const getWidget: (name: string) => React.ComponentType<any> | null | undefined;
|
|
27
29
|
export declare const getEditor: (name: string) => Editor | null | undefined;
|
|
28
30
|
export declare const getTransform: (name: string) => WidgetTransform | null | undefined;
|
package/package.json
CHANGED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { PerseusSequenceWidgetOptions } from "../perseus-types";
|
|
3
|
-
import type { TrackingSequenceExtraArguments, WidgetProps } from "../types";
|
|
4
|
-
type Rubric = PerseusSequenceWidgetOptions;
|
|
5
|
-
type ExternalProps = WidgetProps<PerseusSequenceWidgetOptions, Rubric, TrackingSequenceExtraArguments>;
|
|
6
|
-
type Props = ExternalProps;
|
|
7
|
-
type DefaultProps = {
|
|
8
|
-
json: Props["json"];
|
|
9
|
-
linterContext: Props["linterContext"];
|
|
10
|
-
};
|
|
11
|
-
type State = {
|
|
12
|
-
visible: number;
|
|
13
|
-
};
|
|
14
|
-
declare class Sequence extends React.Component<Props, State> {
|
|
15
|
-
static defaultProps: DefaultProps;
|
|
16
|
-
state: {
|
|
17
|
-
visible: number;
|
|
18
|
-
};
|
|
19
|
-
shouldComponentUpdate(nextProps: any, nextState: any): boolean;
|
|
20
|
-
change: (arg1: any, arg2: any, arg3: any) => any;
|
|
21
|
-
_handleInteraction: (arg1: string) => void;
|
|
22
|
-
render(): React.ReactNode;
|
|
23
|
-
}
|
|
24
|
-
declare const _default: Readonly<{
|
|
25
|
-
name: string;
|
|
26
|
-
displayName: string;
|
|
27
|
-
getWidget?: (() => typeof Sequence) | undefined;
|
|
28
|
-
widget: typeof Sequence;
|
|
29
|
-
accessible?: boolean | ((props: any) => boolean) | undefined;
|
|
30
|
-
hidden?: boolean | undefined;
|
|
31
|
-
version?: import("../types").Version | undefined;
|
|
32
|
-
supportedAlignments?: readonly import("../types").Alignment[] | undefined;
|
|
33
|
-
defaultAlignment?: import("../types").Alignment | undefined;
|
|
34
|
-
getDefaultAlignment?: (() => import("../types").Alignment) | undefined;
|
|
35
|
-
isLintable?: boolean | undefined;
|
|
36
|
-
tracking?: import("../types").Tracking | undefined;
|
|
37
|
-
traverseChildWidgets?: any;
|
|
38
|
-
transform?: import("../types").WidgetTransform | undefined;
|
|
39
|
-
staticTransform?: import("../types").WidgetTransform | undefined;
|
|
40
|
-
propUpgrades?: {
|
|
41
|
-
[key: string]: (arg1: any) => any;
|
|
42
|
-
} | undefined;
|
|
43
|
-
}>;
|
|
44
|
-
export default _default;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
declare class Simulator extends React.Component<any, any> {
|
|
4
|
-
generateNumber: () => number;
|
|
5
|
-
static propTypes: {
|
|
6
|
-
apiOptions: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
7
|
-
isArticle: PropTypes.Validator<boolean>;
|
|
8
|
-
onInputError: PropTypes.Validator<(...args: any[]) => any>;
|
|
9
|
-
onFocusChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
10
|
-
GroupMetadataEditor: PropTypes.Validator<(...args: any[]) => any>;
|
|
11
|
-
showAlignmentOptions: PropTypes.Validator<boolean>;
|
|
12
|
-
readOnly: PropTypes.Validator<boolean>;
|
|
13
|
-
answerableCallback: PropTypes.Requireable<(...args: any[]) => any>;
|
|
14
|
-
getAnotherHint: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
-
interactionCallback: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
-
groupAnnotator: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
-
imagePlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
18
|
-
widgetPlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
19
|
-
baseElements: PropTypes.Requireable<PropTypes.InferProps<{
|
|
20
|
-
Link: PropTypes.Requireable<(...args: any[]) => any>;
|
|
21
|
-
}>>;
|
|
22
|
-
imagePreloader: PropTypes.Requireable<(...args: any[]) => any>;
|
|
23
|
-
trackInteraction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
24
|
-
customKeypad: PropTypes.Requireable<boolean>;
|
|
25
|
-
nativeKeypadProxy: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
|
-
isMobile: PropTypes.Requireable<boolean>;
|
|
27
|
-
setDrawingAreaAvailable: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
-
useDraftEditor: PropTypes.Requireable<boolean>;
|
|
29
|
-
hintProgressColor: PropTypes.Requireable<string>;
|
|
30
|
-
canScrollPage: PropTypes.Requireable<boolean>;
|
|
31
|
-
inModal: PropTypes.Requireable<boolean>;
|
|
32
|
-
crossOutEnabled: PropTypes.Requireable<boolean>;
|
|
33
|
-
editorChangeDelay: PropTypes.Requireable<number>;
|
|
34
|
-
}>>>;
|
|
35
|
-
data: PropTypes.Requireable<(number | null | undefined)[]>;
|
|
36
|
-
numTrials: PropTypes.Requireable<number>;
|
|
37
|
-
proportionLabel: PropTypes.Requireable<string>;
|
|
38
|
-
proportionOrPercentage: PropTypes.Requireable<string>;
|
|
39
|
-
randomSeed: PropTypes.Requireable<number>;
|
|
40
|
-
sampleSize: PropTypes.Requireable<number>;
|
|
41
|
-
trackInteraction: PropTypes.Validator<(...args: any[]) => any>;
|
|
42
|
-
userProportion: PropTypes.Requireable<number>;
|
|
43
|
-
xAxisLabel: PropTypes.Requireable<string>;
|
|
44
|
-
yAxisLabel: PropTypes.Requireable<string>;
|
|
45
|
-
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
46
|
-
};
|
|
47
|
-
static defaultProps: any;
|
|
48
|
-
state: any;
|
|
49
|
-
UNSAFE_componentWillMount(): void;
|
|
50
|
-
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
51
|
-
render(): React.ReactNode;
|
|
52
|
-
calculateDisplayProportion: () => number;
|
|
53
|
-
change: (...args: ReadonlyArray<unknown>) => any;
|
|
54
|
-
checkProportionValidity: (arg1: number) => boolean;
|
|
55
|
-
handleUserProportionChange: (arg1: number, arg2: any) => void;
|
|
56
|
-
handleSampleSizeChange: (number: any) => void;
|
|
57
|
-
handleRunSimulation: () => void;
|
|
58
|
-
generateData: (arg1: any) => any;
|
|
59
|
-
getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
|
|
60
|
-
focus: () => boolean;
|
|
61
|
-
focusInputPath: (arg1: any) => void;
|
|
62
|
-
blurInputPath: (arg1: any) => void;
|
|
63
|
-
getDOMNodeForPath: (arg1: any) => Element | Text | null | undefined;
|
|
64
|
-
getGrammarTypeForPath: (arg1: any) => string;
|
|
65
|
-
setInputValue: (arg1: any, arg2: any, arg3: any) => void;
|
|
66
|
-
getUserInput: () => undefined | null | undefined;
|
|
67
|
-
simpleValidate: (arg1: any) => any;
|
|
68
|
-
}
|
|
69
|
-
declare const _default: Readonly<{
|
|
70
|
-
name: string;
|
|
71
|
-
displayName: string;
|
|
72
|
-
getWidget?: (() => typeof Simulator) | undefined;
|
|
73
|
-
widget: typeof Simulator;
|
|
74
|
-
accessible?: boolean | ((props: any) => boolean) | undefined;
|
|
75
|
-
hidden?: boolean | undefined;
|
|
76
|
-
version?: import("../types").Version | undefined;
|
|
77
|
-
supportedAlignments?: readonly import("../types").Alignment[] | undefined;
|
|
78
|
-
defaultAlignment?: import("../types").Alignment | undefined;
|
|
79
|
-
getDefaultAlignment?: (() => import("../types").Alignment) | undefined;
|
|
80
|
-
isLintable?: boolean | undefined;
|
|
81
|
-
tracking?: import("../types").Tracking | undefined;
|
|
82
|
-
traverseChildWidgets?: any;
|
|
83
|
-
transform?: import("../types").WidgetTransform | undefined;
|
|
84
|
-
staticTransform?: import("../types").WidgetTransform | undefined;
|
|
85
|
-
propUpgrades?: {
|
|
86
|
-
[key: string]: (arg1: any) => any;
|
|
87
|
-
} | undefined;
|
|
88
|
-
}>;
|
|
89
|
-
export default _default;
|