@khanacademy/perseus-editor 13.1.0 → 14.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.
Files changed (33) hide show
  1. package/dist/all-editors.d.ts +1 -4
  2. package/dist/components/hover-behavior.d.ts +2 -2
  3. package/dist/components/widget-editor.d.ts +1 -1
  4. package/dist/es/index.js +188 -611
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +748 -1197
  8. package/dist/index.js.map +1 -1
  9. package/dist/widgets/expression-editor.d.ts +1 -1
  10. package/dist/widgets/graded-group-editor.d.ts +1 -1
  11. package/dist/widgets/grapher-editor.d.ts +1 -1
  12. package/dist/widgets/group-editor.d.ts +1 -1
  13. package/dist/widgets/iframe-editor.d.ts +1 -1
  14. package/dist/widgets/image-editor.d.ts +2 -2
  15. package/dist/widgets/input-number-editor.d.ts +1 -1
  16. package/dist/widgets/interactive-graph-editor.d.ts +6 -22
  17. package/dist/widgets/matcher-editor.d.ts +1 -1
  18. package/dist/widgets/matrix-editor.d.ts +1 -1
  19. package/dist/widgets/measurer-editor.d.ts +1 -1
  20. package/dist/widgets/numeric-input-editor.d.ts +1 -1
  21. package/dist/widgets/orderer-editor.d.ts +1 -1
  22. package/dist/widgets/phet-simulation-editor.d.ts +2 -1
  23. package/dist/widgets/radio/editor.d.ts +1 -1
  24. package/dist/widgets/table-editor.d.ts +1 -1
  25. package/package.json +2 -2
  26. package/dist/all-widgets.d.ts +0 -22
  27. package/dist/testing-widgets.d.ts +0 -22
  28. package/dist/widgets/example-graphie-widget-editor.d.ts +0 -18
  29. package/dist/widgets/example-graphie-widget.d.ts +0 -61
  30. package/dist/widgets/example-widget-editor.d.ts +0 -20
  31. package/dist/widgets/example-widget.d.ts +0 -89
  32. package/dist/widgets/simple-markdown-tester-editor.d.ts +0 -21
  33. package/dist/widgets/simple-markdown-tester.d.ts +0 -54
@@ -19,7 +19,6 @@ declare class ExpressionEditor extends React.Component<Props, State> {
19
19
  static defaultProps: DefaultProps;
20
20
  constructor(props: any);
21
21
  change(...args: any[]): any;
22
- render(): React.ReactNode;
23
22
  serialize: () => any;
24
23
  getSaveWarnings: () => any;
25
24
  _newEmptyAnswerForm: () => any;
@@ -31,5 +30,6 @@ declare class ExpressionEditor extends React.Component<Props, State> {
31
30
  handleToggleDiv: () => void;
32
31
  handleTexInsert: (arg1: string) => void;
33
32
  handleFunctions: (value: string) => void;
33
+ render(): React.ReactNode;
34
34
  }
35
35
  export default ExpressionEditor;
@@ -44,11 +44,11 @@ declare class GradedGroupEditor extends React.Component<Props> {
44
44
  change: (arg1: any, arg2: any, arg3: any) => any;
45
45
  handleAddHint: () => void;
46
46
  handleRemoveHint: (arg1: React.MouseEvent) => void;
47
- render(): React.ReactNode;
48
47
  getSaveWarnings: () => any;
49
48
  serialize: () => {
50
49
  title: string;
51
50
  hint: any | null | undefined;
52
51
  };
52
+ render(): React.ReactNode;
53
53
  }
54
54
  export default GradedGroupEditor;
@@ -7,8 +7,8 @@ declare class GrapherEditor extends React.Component<Props> {
7
7
  static widgetName: "grapher";
8
8
  static defaultProps: Props;
9
9
  change: (arg1: any, arg2: any, arg3: any) => any;
10
- render(): React.ReactNode;
11
10
  handleAvailableTypesChange: (newAvailableTypes: Array<any>) => void;
12
11
  serialize: () => any;
12
+ render(): React.ReactNode;
13
13
  }
14
14
  export default GrapherEditor;
@@ -40,10 +40,10 @@ declare class GroupEditor extends React.Component<Props> {
40
40
  static widgetName: "group";
41
41
  static defaultProps: Props;
42
42
  editor: React.RefObject<Editor>;
43
- render(): React.ReactNode;
44
43
  _renderMetadataEditor: () => React.ReactElement;
45
44
  change: (arg1: any, arg2: any, arg3: any) => any;
46
45
  getSaveWarnings: () => ReadonlyArray<any>;
47
46
  serialize: () => any;
47
+ render(): React.ReactNode;
48
48
  }
49
49
  export default GroupEditor;
@@ -11,8 +11,8 @@ declare class IframeEditor extends React.Component<IframeEditorProps> {
11
11
  static widgetName: "iframe";
12
12
  static defaultProps: IframeEditorProps;
13
13
  change: (arg1: any, arg2: any, arg3: any) => any;
14
- render(): React.ReactNode;
15
14
  handleSettingsChange: (arg1: any) => void;
16
15
  serialize: () => any;
16
+ render(): React.ReactNode;
17
17
  }
18
18
  export default IframeEditor;
@@ -24,14 +24,13 @@ type State = {
24
24
  backgroundImageError?: string;
25
25
  };
26
26
  declare class ImageEditor extends React.Component<Props> {
27
- _isMounted: boolean;
28
27
  static displayName: string;
29
28
  static widgetName: string;
29
+ _isMounted: boolean;
30
30
  static defaultProps: DefaultProps;
31
31
  state: State;
32
32
  componentDidMount(): void;
33
33
  componentWillUnmount(): void;
34
- render(): React.JSX.Element;
35
34
  _renderRowForLabel(label: any, i: any): React.JSX.Element;
36
35
  change(...args: any[]): any;
37
36
  removeLabel(labelIndex: any, e: any): void;
@@ -42,5 +41,6 @@ declare class ImageEditor extends React.Component<Props> {
42
41
  onUrlChange(url: string | undefined | null, silent: boolean): Promise<void>;
43
42
  onRangeChange(type: any, newRange: any): void;
44
43
  serialize(): any;
44
+ render(): React.JSX.Element;
45
45
  }
46
46
  export default ImageEditor;
@@ -40,7 +40,6 @@ declare class InputNumberEditor extends React.Component<Props> {
40
40
  static defaultProps: DefaultProps;
41
41
  input: React.RefObject<BlurInput>;
42
42
  handleAnswerChange: (arg1: string) => void;
43
- render(): React.ReactNode;
44
43
  focus: () => boolean;
45
44
  serialize: () => {
46
45
  value: Props["value"];
@@ -51,5 +50,6 @@ declare class InputNumberEditor extends React.Component<Props> {
51
50
  answerType: Props["answerType"];
52
51
  rightAlign: Props["rightAlign"];
53
52
  };
53
+ render(): React.ReactNode;
54
54
  }
55
55
  export default InputNumberEditor;
@@ -493,10 +493,7 @@ declare const InteractiveGraph: {
493
493
  areAngleGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeAngle, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeAngle): boolean;
494
494
  arePointGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePoint, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePoint): boolean;
495
495
  arePolygonGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePolygon, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePolygon): boolean;
496
- areSegmentGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment): boolean; /**
497
- * An error message to display in the graph area, or true if the
498
- * graph is valid.
499
- */
496
+ areSegmentGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment): boolean;
500
497
  _lineStroke: () => {
501
498
  "stroke-width"?: number | undefined;
502
499
  };
@@ -505,12 +502,7 @@ declare const InteractiveGraph: {
505
502
  addLinearControls: () => void;
506
503
  removeLinearControls: () => void;
507
504
  addQuadraticControls: () => void;
508
- updateQuadratic: () => void; /**
509
- * The type of markings to display on the graph.
510
- * - graph: shows the axes and the grid lines
511
- * - grid: shows only the grid lines
512
- * - none: shows no markings
513
- */
505
+ updateQuadratic: () => void;
514
506
  removeQuadraticControls: () => void;
515
507
  addSinusoidControls: () => void;
516
508
  updateSinusoid: () => void;
@@ -2332,10 +2324,7 @@ declare const InteractiveGraph: {
2332
2324
  areAngleGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeAngle, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeAngle): boolean;
2333
2325
  arePointGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePoint, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePoint): boolean;
2334
2326
  arePolygonGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePolygon, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypePolygon): boolean;
2335
- areSegmentGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment): boolean; /**
2336
- * An error message to display in the graph area, or true if the
2337
- * graph is valid.
2338
- */
2327
+ areSegmentGraphsEqual(prevGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment, currentGraph: import("../../../perseus/src/perseus-types").PerseusGraphTypeSegment): boolean;
2339
2328
  _lineStroke: () => {
2340
2329
  "stroke-width"?: number | undefined;
2341
2330
  };
@@ -2344,12 +2333,7 @@ declare const InteractiveGraph: {
2344
2333
  addLinearControls: () => void;
2345
2334
  removeLinearControls: () => void;
2346
2335
  addQuadraticControls: () => void;
2347
- updateQuadratic: () => void; /**
2348
- * The type of markings to display on the graph.
2349
- * - graph: shows the axes and the grid lines
2350
- * - grid: shows only the grid lines
2351
- * - none: shows no markings
2352
- */
2336
+ updateQuadratic: () => void;
2353
2337
  removeQuadraticControls: () => void;
2354
2338
  addSinusoidControls: () => void;
2355
2339
  updateSinusoid: () => void;
@@ -5884,9 +5868,9 @@ type DefaultProps = {
5884
5868
  * Used in the exercise editor.
5885
5869
  */
5886
5870
  declare class InteractiveGraphEditor extends React.Component<Props> {
5871
+ static widgetName: string;
5887
5872
  displayName: string;
5888
5873
  className: string;
5889
- static widgetName: string;
5890
5874
  static defaultProps: DefaultProps;
5891
5875
  deprecatedProps: {
5892
5876
  readonly showGraph: (props: any) => {
@@ -5894,10 +5878,10 @@ declare class InteractiveGraphEditor extends React.Component<Props> {
5894
5878
  };
5895
5879
  };
5896
5880
  UNSAFE_componentWillMount(): void;
5897
- render(): React.JSX.Element;
5898
5881
  changeMatchType: (newValue: any) => void;
5899
5882
  changeStartCoords: (coords: any) => void;
5900
5883
  serialize(): PerseusInteractiveGraphWidgetOptions;
5901
5884
  getSaveWarnings: () => any[];
5885
+ render(): React.JSX.Element;
5902
5886
  }
5903
5887
  export default InteractiveGraphEditor;
@@ -11,9 +11,9 @@ declare class MatcherEditor extends React.Component<Props> {
11
11
  };
12
12
  static widgetName: "matcher";
13
13
  static defaultProps: Props;
14
- render(): React.ReactNode;
15
14
  onLabelChange: (arg1: number, arg2: React.ChangeEvent<HTMLInputElement>) => void;
16
15
  getSaveWarnings: () => ReadonlyArray<string>;
17
16
  serialize: any;
17
+ render(): React.ReactNode;
18
18
  }
19
19
  export default MatcherEditor;
@@ -12,9 +12,9 @@ declare class MatrixEditor extends React.Component<Props> {
12
12
  };
13
13
  static widgetName: "matrix";
14
14
  static defaultProps: Props;
15
- render(): React.ReactNode;
16
15
  change: (arg1: any, arg2: any, arg3: any) => any;
17
16
  onMatrixBoardSizeChange: (arg1: [number, number]) => void;
18
17
  serialize: () => any;
18
+ render(): React.ReactNode;
19
19
  }
20
20
  export default MatrixEditor;
@@ -20,7 +20,6 @@ declare class MeasurerEditor extends React.Component<Props> {
20
20
  };
21
21
  static defaultProps: Props;
22
22
  className: string;
23
- render(): React.ReactNode;
24
23
  change: (arg1: any, arg2: any, arg3: any) => any;
25
24
  _changeUrl: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
26
25
  _changeTop: (arg1: any) => void;
@@ -28,5 +27,6 @@ declare class MeasurerEditor extends React.Component<Props> {
28
27
  _changeImage: (arg1: string, arg2: any) => void;
29
28
  renderLabelChoices: (arg1: ReadonlyArray<[string, string]>) => ReadonlyArray<React.ReactElement<React.ComponentProps<"option">>>;
30
29
  serialize: () => any;
30
+ render(): React.ReactNode;
31
31
  }
32
32
  export default MeasurerEditor;
@@ -56,7 +56,6 @@ declare class NumericInputEditor extends React.Component<Props, State> {
56
56
  rightAlign: boolean;
57
57
  };
58
58
  constructor(props: Props);
59
- render(): React.JSX.Element;
60
59
  change: (...args: any[]) => any;
61
60
  onToggleOptions: (choiceIndex: any) => void;
62
61
  onTrashAnswer: (choiceIndex: any) => void;
@@ -66,5 +65,6 @@ declare class NumericInputEditor extends React.Component<Props, State> {
66
65
  addAnswer: () => void;
67
66
  getSaveWarnings: () => never[];
68
67
  serialize: () => any;
68
+ render(): React.JSX.Element;
69
69
  }
70
70
  export default NumericInputEditor;
@@ -11,10 +11,10 @@ declare class OrdererEditor extends React.Component<Props> {
11
11
  };
12
12
  static widgetName: "orderer";
13
13
  static defaultProps: Props;
14
- render(): React.ReactNode;
15
14
  onOptionsChange: (arg1: "correctOptions" | "otherOptions", arg2: any, arg3: any) => any;
16
15
  onLayoutChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
17
16
  onHeightChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
18
17
  serialize: () => any;
18
+ render(): React.ReactNode;
19
19
  }
20
20
  export default OrdererEditor;
@@ -13,7 +13,8 @@ type Props = DefaultProps & {
13
13
  declare class PhetSimulationEditor extends React.Component<Props> {
14
14
  static defaultProps: DefaultProps;
15
15
  static widgetName: "phet-simulation";
16
- render(): React.ReactNode;
17
16
  serialize(): PerseusPhetSimulationWidgetOptions;
17
+ getSaveWarnings: () => ReadonlyArray<string>;
18
+ render(): React.ReactNode;
18
19
  }
19
20
  export default PhetSimulationEditor;
@@ -45,7 +45,6 @@ declare class RadioEditor extends React.Component<any> {
45
45
  };
46
46
  static widgetName: "radio";
47
47
  static defaultProps: any;
48
- render(): React.ReactNode;
49
48
  change: (...args: ReadonlyArray<unknown>) => any;
50
49
  onMultipleSelectChange: (arg1: any) => any;
51
50
  onCountChoicesChange: (arg1: any) => void;
@@ -58,5 +57,6 @@ declare class RadioEditor extends React.Component<any> {
58
57
  focus: () => boolean;
59
58
  getSaveWarnings: () => ReadonlyArray<string>;
60
59
  serialize: () => any;
60
+ render(): React.ReactNode;
61
61
  }
62
62
  export default RadioEditor;
@@ -13,8 +13,8 @@ declare class TableEditor extends React.Component<Props> {
13
13
  static defaultProps: Props;
14
14
  numberOfColumns: React.RefObject<components.NumberInput>;
15
15
  focus: () => void;
16
- render(): React.ReactNode;
17
16
  onSizeInput: (arg1: number, arg2: number) => void;
18
17
  serialize: () => any;
18
+ render(): React.ReactNode;
19
19
  }
20
20
  export default TableEditor;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Perseus editors",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "13.1.0",
6
+ "version": "14.0.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -38,7 +38,7 @@
38
38
  "@khanacademy/keypad-context": "^1.0.1",
39
39
  "@khanacademy/kmath": "^0.1.13",
40
40
  "@khanacademy/math-input": "^21.0.2",
41
- "@khanacademy/perseus": "^31.1.0",
41
+ "@khanacademy/perseus": "^32.0.0",
42
42
  "@khanacademy/perseus-core": "1.5.0"
43
43
  },
44
44
  "devDependencies": {
@@ -1,22 +0,0 @@
1
- /// <reference types="react" />
2
- declare const _default: readonly Readonly<{
3
- name: string;
4
- displayName: string;
5
- getWidget?: (() => import("react").ComponentType<any>) | undefined;
6
- widget: import("react").ComponentType<any>;
7
- accessible?: boolean | ((props: any) => boolean) | undefined;
8
- hidden?: boolean | undefined;
9
- version?: import("@khanacademy/perseus").Version | undefined;
10
- supportedAlignments?: readonly import("@khanacademy/perseus").Alignment[] | undefined;
11
- defaultAlignment?: import("@khanacademy/perseus").Alignment | undefined;
12
- getDefaultAlignment?: (() => import("@khanacademy/perseus").Alignment) | undefined;
13
- isLintable?: boolean | undefined;
14
- tracking?: import("../../perseus/src/types").Tracking | undefined;
15
- traverseChildWidgets?: any;
16
- transform?: import("../../perseus/src/types").WidgetTransform | undefined;
17
- staticTransform?: import("../../perseus/src/types").WidgetTransform | undefined;
18
- propUpgrades?: {
19
- [key: string]: (arg1: any) => any;
20
- } | undefined;
21
- }>[];
22
- export default _default;
@@ -1,22 +0,0 @@
1
- /// <reference types="react" />
2
- declare const _default: readonly Readonly<{
3
- name: string;
4
- displayName: string;
5
- getWidget?: (() => import("react").ComponentType<any>) | undefined;
6
- widget: import("react").ComponentType<any>;
7
- accessible?: boolean | ((props: any) => boolean) | undefined;
8
- hidden?: boolean | undefined;
9
- version?: import("@khanacademy/perseus").Version | undefined;
10
- supportedAlignments?: readonly import("@khanacademy/perseus").Alignment[] | undefined;
11
- defaultAlignment?: import("@khanacademy/perseus").Alignment | undefined;
12
- getDefaultAlignment?: (() => import("@khanacademy/perseus").Alignment) | undefined;
13
- isLintable?: boolean | undefined;
14
- tracking?: import("../../perseus/src/types").Tracking | undefined;
15
- traverseChildWidgets?: any;
16
- transform?: import("../../perseus/src/types").WidgetTransform | undefined;
17
- staticTransform?: import("../../perseus/src/types").WidgetTransform | undefined;
18
- propUpgrades?: {
19
- [key: string]: (arg1: any) => any;
20
- } | undefined;
21
- }>[];
22
- export default _default;
@@ -1,18 +0,0 @@
1
- import * as React from "react";
2
- type Props = any;
3
- /**
4
- * This is the widget's editor. This is what shows up on the left side
5
- * of the screen in the demo page. Only the question writer sees this.
6
- */
7
- declare class ExampleGraphieWidgetEditor extends React.Component<Props> {
8
- static propTypes: {
9
- onChange: import("prop-types").Validator<(...args: any[]) => any>;
10
- };
11
- static widgetName: "example-graphie-widget";
12
- static defaultProps: Props;
13
- change: (arg1: any, arg2: any, arg3: any) => any;
14
- handleChange: (arg1: any) => void;
15
- serialize: () => any;
16
- render(): React.ReactNode;
17
- }
18
- export default ExampleGraphieWidgetEditor;
@@ -1,61 +0,0 @@
1
- /**
2
- * This is an example graphie-using widget
3
- *
4
- * TODO(jack): Add more comments
5
- */
6
- import { Changeable } from "@khanacademy/perseus";
7
- import * as React from "react";
8
- import type { Coord, PerseusExampleGraphieWidgetOptions, APIOptionsWithDefaults } from "@khanacademy/perseus";
9
- type Props = Changeable.ChangeableProps & {
10
- apiOptions: APIOptionsWithDefaults;
11
- graph: PerseusExampleGraphieWidgetOptions["graph"];
12
- coord: PerseusExampleGraphieWidgetOptions["coord"];
13
- };
14
- type DefaultProps = {
15
- graph: Props["graph"];
16
- coord: Props["coord"];
17
- };
18
- /**
19
- * This is the widget's renderer. It shows up in the right column
20
- * in the demo, and is what is visible to users, and where
21
- * users enter their answers.
22
- */
23
- declare class ExampleGraphieWidget extends React.Component<Props> {
24
- static defaultProps: DefaultProps;
25
- /**
26
- * This is the widget's grading function
27
- */
28
- static validate(state: any, rubric: any): any;
29
- getUserInput: () => any;
30
- render(): React.ReactNode;
31
- change: (arg1: any, arg2: any, arg3: any) => any;
32
- movePoint: (arg1: Coord) => void;
33
- _getGridConfig: (arg1: any) => any;
34
- setupGraphie: (arg1: any, arg2: any) => any;
35
- simpleValidate: (arg1: any) => any;
36
- }
37
- /**
38
- * For this widget to work, we must export it.
39
- * We also must import this file in src/all-widgets.js
40
- */
41
- declare const _default: Readonly<{
42
- name: string;
43
- displayName: string;
44
- getWidget?: (() => typeof ExampleGraphieWidget) | undefined;
45
- widget: typeof ExampleGraphieWidget;
46
- accessible?: boolean | ((props: any) => boolean) | undefined;
47
- hidden?: boolean | undefined;
48
- version?: import("@khanacademy/perseus").Version | undefined;
49
- supportedAlignments?: readonly import("@khanacademy/perseus").Alignment[] | undefined;
50
- defaultAlignment?: import("@khanacademy/perseus").Alignment | undefined;
51
- getDefaultAlignment?: (() => import("@khanacademy/perseus").Alignment) | undefined;
52
- isLintable?: boolean | undefined;
53
- tracking?: import("../../../perseus/src/types").Tracking | undefined;
54
- traverseChildWidgets?: any;
55
- transform?: import("../../../perseus/src/types").WidgetTransform | undefined;
56
- staticTransform?: import("../../../perseus/src/types").WidgetTransform | undefined;
57
- propUpgrades?: {
58
- [key: string]: (arg1: any) => any;
59
- } | undefined;
60
- }>;
61
- export default _default;
@@ -1,20 +0,0 @@
1
- import * as React from "react";
2
- type Props = any;
3
- /**
4
- * This is the widget's editor. This is what shows up on the left side
5
- * of the screen in the demo. Only the question writer sees this.
6
- */
7
- declare class ExampleWidgetEditor extends React.Component<Props> {
8
- static propTypes: {
9
- onChange: import("prop-types").Validator<(...args: any[]) => any>;
10
- };
11
- static widgetName: "example-widget";
12
- static defaultProps: Props;
13
- input: React.RefObject<HTMLInputElement>;
14
- handleAnswerChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
15
- render(): React.ReactNode;
16
- change: (arg1: any, arg2: any, arg3: any) => any;
17
- focus: () => boolean;
18
- serialize: () => any;
19
- }
20
- export default ExampleWidgetEditor;
@@ -1,89 +0,0 @@
1
- /**
2
- * This is a simple number-entry widget
3
- * It is not as powerful as number-input, but has a simpler, more
4
- * representative structure as an example widget, and is easier to
5
- * test new ideas on.
6
- *
7
- * TODO(jack): Add more comments
8
- */
9
- import { Changeable } from "@khanacademy/perseus";
10
- import * as React from "react";
11
- import type { PerseusExampleWidgetOptions } from "@khanacademy/perseus";
12
- type Props = Changeable.ChangeableProps & {
13
- value: PerseusExampleWidgetOptions["value"];
14
- };
15
- declare class TextInput extends React.Component<Props> {
16
- input: React.RefObject<HTMLInputElement>;
17
- render(): React.ReactNode;
18
- focus: () => boolean;
19
- changeValue: (e: any) => void;
20
- }
21
- type DefaultProps = {
22
- value: Props["value"];
23
- };
24
- /**
25
- * This is the widget's renderer. It shows up in the right column
26
- * in the demo, and is what is visible to users, and where
27
- * users enter their answers.
28
- */
29
- declare class ExampleWidget extends React.Component<Props> {
30
- static defaultProps: DefaultProps;
31
- input: React.RefObject<TextInput>;
32
- /**
33
- * This is the widget's grading function. simpleValidate generally
34
- * defers to this function.
35
- *
36
- * value is usually the result of getUserInput on the widget
37
- * rubric is the result of calling serialize() on the editor
38
- */
39
- static validate(value: string, rubric: any): any;
40
- /**
41
- * Tell our parent to update our props.
42
- */
43
- change: (arg1: any, arg2: any, arg3: any) => any;
44
- render(): React.ReactNode;
45
- getUserInput: () => string;
46
- /**
47
- * Widgets that are focusable should add a focus method that returns
48
- * true if focusing succeeded. The first such widget found will be
49
- * focused on page load.
50
- */
51
- focus: () => boolean;
52
- /**
53
- * simpleValidate is called for grading. Rubric is the result of calling
54
- * getUserInput() on the editor that created this widget.
55
- *
56
- * Should return an object representing the grading result, such as
57
- * {
58
- * type: "points",
59
- * earned: 1,
60
- * total: 1,
61
- * message: null
62
- * }
63
- */
64
- simpleValidate: (arg1: any) => any;
65
- }
66
- /**
67
- * For this widget to work, we must import this file in src/all-widgets.js
68
- */
69
- declare const _default: Readonly<{
70
- name: string;
71
- displayName: string;
72
- getWidget?: (() => typeof ExampleWidget) | undefined;
73
- widget: typeof ExampleWidget;
74
- accessible?: boolean | ((props: any) => boolean) | undefined;
75
- hidden?: boolean | undefined;
76
- version?: import("@khanacademy/perseus").Version | undefined;
77
- supportedAlignments?: readonly import("@khanacademy/perseus").Alignment[] | undefined;
78
- defaultAlignment?: import("@khanacademy/perseus").Alignment | undefined;
79
- getDefaultAlignment?: (() => import("@khanacademy/perseus").Alignment) | undefined;
80
- isLintable?: boolean | undefined;
81
- tracking?: import("../../../perseus/src/types").Tracking | undefined;
82
- traverseChildWidgets?: any;
83
- transform?: import("../../../perseus/src/types").WidgetTransform | undefined;
84
- staticTransform?: import("../../../perseus/src/types").WidgetTransform | undefined;
85
- propUpgrades?: {
86
- [key: string]: (arg1: any) => any;
87
- } | undefined;
88
- }>;
89
- export default _default;
@@ -1,21 +0,0 @@
1
- import * as React from "react";
2
- type TextAreaProps = any;
3
- declare class TextArea extends React.Component<TextAreaProps> {
4
- render(): React.ReactNode;
5
- focus: () => boolean;
6
- changeValue: (e: any) => void;
7
- }
8
- type SimpleMarkdownTesterEditorProps = any;
9
- declare class SimpleMarkdownTesterEditor extends React.Component<SimpleMarkdownTesterEditorProps> {
10
- static propTypes: {
11
- onChange: import("prop-types").Validator<(...args: any[]) => any>;
12
- };
13
- static widgetName: "simple-markdown-tester";
14
- static defaultProps: SimpleMarkdownTesterEditorProps;
15
- input: React.RefObject<TextArea>;
16
- render(): React.ReactNode;
17
- change: (arg1: any, arg2: any, arg3: any) => any;
18
- focus: () => boolean;
19
- serialize: () => any;
20
- }
21
- export default SimpleMarkdownTesterEditor;
@@ -1,54 +0,0 @@
1
- import { Changeable } from "@khanacademy/perseus";
2
- import * as React from "react";
3
- import type { PerseusSimpleMarkdownTesterWidgetOptions } from "@khanacademy/perseus";
4
- type Props = Changeable.ChangeableProps & {
5
- value: PerseusSimpleMarkdownTesterWidgetOptions["value"];
6
- };
7
- type DefaultProps = {
8
- value: Props["value"];
9
- };
10
- declare class SimpleMarkdownTester extends React.Component<Props> {
11
- static defaultProps: DefaultProps;
12
- /**
13
- * This is the widget's grading function.
14
- *
15
- * simpleValidate generally defers to this function
16
- *
17
- * state is usually the result of toJSON on the widget
18
- * rubric is the result of calling toJSON() on the editor
19
- */
20
- static validate(state: any, rubric: any): any;
21
- change: (arg1: any, arg2: any, arg3: any) => any;
22
- toJSON: () => Record<any, any>;
23
- render(): React.ReactNode;
24
- /**
25
- * Widgets that are focusable should add a focus method that returns
26
- * true if focusing succeeded. The first such widget found will be
27
- * focused on page load.
28
- */
29
- focus: () => boolean;
30
- /**
31
- * simpleValidate is called for grading. Rubric is the result of calling
32
- * toJSON() on the editor that created this widget.
33
- *
34
- * Should return an object representing the grading result, such as
35
- * {
36
- * type: "points",
37
- * earned: 1,
38
- * total: 1,
39
- * message: null
40
- * }
41
- */
42
- simpleValidate: (arg1: any) => any;
43
- }
44
- /**
45
- * For this widget to work, we must import this file in src/all-widgets.js
46
- */
47
- declare const _default: {
48
- name: string;
49
- displayName: string;
50
- hidden: boolean;
51
- widget: typeof SimpleMarkdownTester;
52
- transform: <T>(value: T) => T;
53
- };
54
- export default _default;