@khanacademy/perseus-editor 13.0.1 → 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 (34) 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/content-preview.d.ts +22 -0
  5. package/dist/es/index.js +202 -633
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/index.d.ts +2 -2
  8. package/dist/index.js +748 -1197
  9. package/dist/index.js.map +1 -1
  10. package/dist/widgets/expression-editor.d.ts +1 -1
  11. package/dist/widgets/graded-group-editor.d.ts +1 -1
  12. package/dist/widgets/grapher-editor.d.ts +1 -1
  13. package/dist/widgets/group-editor.d.ts +1 -1
  14. package/dist/widgets/iframe-editor.d.ts +1 -1
  15. package/dist/widgets/image-editor.d.ts +2 -2
  16. package/dist/widgets/input-number-editor.d.ts +1 -1
  17. package/dist/widgets/interactive-graph-editor.d.ts +8 -114
  18. package/dist/widgets/matcher-editor.d.ts +1 -1
  19. package/dist/widgets/matrix-editor.d.ts +1 -1
  20. package/dist/widgets/measurer-editor.d.ts +1 -1
  21. package/dist/widgets/numeric-input-editor.d.ts +1 -1
  22. package/dist/widgets/orderer-editor.d.ts +1 -1
  23. package/dist/widgets/phet-simulation-editor.d.ts +2 -1
  24. package/dist/widgets/radio/editor.d.ts +1 -1
  25. package/dist/widgets/table-editor.d.ts +1 -1
  26. package/package.json +36 -35
  27. package/dist/all-widgets.d.ts +0 -22
  28. package/dist/testing-widgets.d.ts +0 -22
  29. package/dist/widgets/example-graphie-widget-editor.d.ts +0 -18
  30. package/dist/widgets/example-graphie-widget.d.ts +0 -61
  31. package/dist/widgets/example-widget-editor.d.ts +0 -20
  32. package/dist/widgets/example-widget.d.ts +0 -89
  33. package/dist/widgets/simple-markdown-tester-editor.d.ts +0 -21
  34. package/dist/widgets/simple-markdown-tester.d.ts +0 -54
@@ -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;