@khanacademy/perseus-editor 17.6.1 → 17.8.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 (35) hide show
  1. package/LICENSE +18 -0
  2. package/dist/diffs/article-diff.d.ts +2 -35
  3. package/dist/diffs/item-diff.d.ts +2 -11
  4. package/dist/diffs/text-diff.d.ts +3 -4
  5. package/dist/diffs/widget-diff.d.ts +4 -13
  6. package/dist/es/index.js +495 -64941
  7. package/dist/es/index.js.map +1 -1
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.js +640 -65079
  10. package/dist/index.js.map +1 -1
  11. package/dist/shared-utils/add-library-version-to-perseus-debug.d.ts +9 -0
  12. package/dist/widgets/categorizer-editor.d.ts +6 -32
  13. package/dist/widgets/cs-program-editor.d.ts +1 -2
  14. package/dist/widgets/definition-editor.d.ts +4 -5
  15. package/dist/widgets/dropdown-editor.d.ts +2 -6
  16. package/dist/widgets/explanation-editor.d.ts +6 -7
  17. package/dist/widgets/graded-group-editor.d.ts +6 -32
  18. package/dist/widgets/graded-group-set-editor.d.ts +3 -29
  19. package/dist/widgets/grapher-editor.d.ts +1 -1
  20. package/dist/widgets/group-editor.d.ts +5 -33
  21. package/dist/widgets/iframe-editor.d.ts +1 -2
  22. package/dist/widgets/interactive-graph-editor/components/interactive-graph-settings.d.ts +1 -1
  23. package/dist/widgets/interactive-graph-editor/interactive-graph-editor.d.ts +41 -82
  24. package/dist/widgets/matcher-editor.d.ts +5 -6
  25. package/dist/widgets/matrix-editor.d.ts +6 -7
  26. package/dist/widgets/measurer-editor.d.ts +9 -14
  27. package/dist/widgets/molecule-editor.d.ts +3 -4
  28. package/dist/widgets/orderer-editor.d.ts +5 -6
  29. package/dist/widgets/passage-editor.d.ts +5 -6
  30. package/dist/widgets/passage-ref-target-editor.d.ts +2 -3
  31. package/dist/widgets/radio/editor.d.ts +10 -40
  32. package/dist/widgets/sorter-editor.d.ts +3 -4
  33. package/dist/widgets/table-editor.d.ts +4 -5
  34. package/dist/widgets/video-editor.d.ts +2 -3
  35. package/package.json +103 -102
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Adds the given perseus library version information to the __perseus_debug__
3
+ * object and ensures that the object is attached to `globalThis` (`window` in
4
+ * browser environments).
5
+ *
6
+ * This allows each library to provide runtime version information to assist in
7
+ * debugging in production environments.
8
+ */
9
+ export declare const addLibraryVersionToPerseusDebug: (libraryName: string, libraryVersion: string) => void;
@@ -1,40 +1,14 @@
1
- import PropTypes from "prop-types";
2
1
  import * as React from "react";
3
2
  import type { CategorizerDefaultWidgetOptions } from "@khanacademy/perseus-core";
4
3
  type Props = any;
5
4
  declare class CategorizerEditor extends React.Component<Props> {
6
5
  static propTypes: {
7
- apiOptions: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
8
- isArticle: PropTypes.Validator<boolean>;
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
- hintProgressColor: PropTypes.Requireable<string>;
29
- canScrollPage: PropTypes.Requireable<boolean>;
30
- crossOutEnabled: PropTypes.Requireable<boolean>;
31
- editorChangeDelay: PropTypes.Requireable<number>;
32
- }>>>;
33
- items: PropTypes.Requireable<(string | null | undefined)[]>;
34
- categories: PropTypes.Requireable<(string | null | undefined)[]>;
35
- values: PropTypes.Requireable<(number | null | undefined)[]>;
36
- randomizeItems: PropTypes.Requireable<boolean>;
37
- onChange: PropTypes.Validator<(...args: any[]) => any>;
6
+ apiOptions: any;
7
+ items: any;
8
+ categories: any;
9
+ values: any;
10
+ randomizeItems: any;
11
+ onChange: any;
38
12
  };
39
13
  static widgetName: "categorizer";
40
14
  static defaultProps: CategorizerDefaultWidgetOptions;
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * This editor is for embedding Khan Academy CS programs.
3
3
  */
4
- import PropTypes from "prop-types";
5
4
  import * as React from "react";
6
5
  import type { CSProgramDefaultWidgetOptions } from "@khanacademy/perseus-core";
7
6
  /**
@@ -9,7 +8,7 @@ import type { CSProgramDefaultWidgetOptions } from "@khanacademy/perseus-core";
9
8
  */
10
9
  declare class CSProgramEditor extends React.Component<any> {
11
10
  static propTypes: {
12
- onChange: PropTypes.Validator<(...args: any[]) => any>;
11
+ onChange: any;
13
12
  };
14
13
  static widgetName: "cs-program";
15
14
  static defaultProps: CSProgramDefaultWidgetOptions;
@@ -1,13 +1,12 @@
1
- import PropTypes from "prop-types";
2
1
  import * as React from "react";
3
2
  import type { DefinitionDefaultWidgetOptions } from "@khanacademy/perseus-core";
4
3
  type Props = any;
5
4
  declare class DefinitionEditor extends React.Component<Props> {
6
5
  static propTypes: {
7
- togglePrompt: PropTypes.Requireable<string>;
8
- definition: PropTypes.Requireable<string>;
9
- apiOptions: PropTypes.Requireable<any>;
10
- onChange: PropTypes.Validator<(...args: any[]) => any>;
6
+ togglePrompt: any;
7
+ definition: any;
8
+ apiOptions: any;
9
+ onChange: any;
11
10
  };
12
11
  static widgetName: "definition";
13
12
  static defaultProps: DefinitionDefaultWidgetOptions;
@@ -1,14 +1,10 @@
1
1
  import { type DropdownDefaultWidgetOptions } from "@khanacademy/perseus-core";
2
- import PropTypes from "prop-types";
3
2
  import * as React from "react";
4
3
  type Props = any;
5
4
  declare class DropdownEditor extends React.Component<Props> {
6
5
  static propTypes: {
7
- choices: PropTypes.Requireable<(PropTypes.InferProps<{
8
- content: PropTypes.Requireable<string>;
9
- correct: PropTypes.Requireable<boolean>;
10
- }> | null | undefined)[]>;
11
- placeholder: PropTypes.Requireable<string>;
6
+ choices: any;
7
+ placeholder: any;
12
8
  };
13
9
  static widgetName: "dropdown";
14
10
  static defaultProps: DropdownDefaultWidgetOptions;
@@ -1,16 +1,15 @@
1
- import PropTypes from "prop-types";
2
1
  import * as React from "react";
3
2
  import type { ExplanationDefaultWidgetOptions } from "@khanacademy/perseus-core";
4
3
  type Props = any;
5
4
  type State = any;
6
5
  declare class ExplanationEditor extends React.Component<Props, State> {
7
6
  static propTypes: {
8
- showPrompt: PropTypes.Requireable<string>;
9
- hidePrompt: PropTypes.Requireable<string>;
10
- explanation: PropTypes.Requireable<string>;
11
- widgets: PropTypes.Requireable<object>;
12
- apiOptions: PropTypes.Requireable<any>;
13
- onChange: PropTypes.Validator<(...args: any[]) => any>;
7
+ showPrompt: any;
8
+ hidePrompt: any;
9
+ explanation: any;
10
+ widgets: any;
11
+ apiOptions: any;
12
+ onChange: any;
14
13
  };
15
14
  static widgetName: "explanation";
16
15
  static defaultProps: ExplanationDefaultWidgetOptions;
@@ -1,41 +1,15 @@
1
- import PropTypes from "prop-types";
2
1
  import * as React from "react";
3
2
  import Editor from "../editor";
4
3
  import type { GradedGroupDefaultWidgetOptions } from "@khanacademy/perseus-core";
5
4
  type Props = any;
6
5
  declare class GradedGroupEditor extends React.Component<Props> {
7
6
  static propTypes: {
8
- title: PropTypes.Requireable<string>;
9
- content: PropTypes.Requireable<string>;
10
- widgets: PropTypes.Requireable<object>;
11
- images: PropTypes.Requireable<object>;
12
- apiOptions: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
13
- isArticle: PropTypes.Validator<boolean>;
14
- onFocusChange: PropTypes.Validator<(...args: any[]) => any>;
15
- GroupMetadataEditor: PropTypes.Validator<(...args: any[]) => any>;
16
- showAlignmentOptions: PropTypes.Validator<boolean>;
17
- readOnly: PropTypes.Validator<boolean>;
18
- answerableCallback: PropTypes.Requireable<(...args: any[]) => any>;
19
- getAnotherHint: PropTypes.Requireable<(...args: any[]) => any>;
20
- interactionCallback: PropTypes.Requireable<(...args: any[]) => any>;
21
- groupAnnotator: PropTypes.Validator<(...args: any[]) => any>;
22
- imagePlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
23
- widgetPlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
24
- baseElements: PropTypes.Requireable<PropTypes.InferProps<{
25
- Link: PropTypes.Requireable<(...args: any[]) => any>;
26
- }>>;
27
- imagePreloader: PropTypes.Requireable<(...args: any[]) => any>;
28
- trackInteraction: PropTypes.Requireable<(...args: any[]) => any>;
29
- customKeypad: PropTypes.Requireable<boolean>;
30
- nativeKeypadProxy: PropTypes.Requireable<(...args: any[]) => any>;
31
- isMobile: PropTypes.Requireable<boolean>;
32
- setDrawingAreaAvailable: PropTypes.Requireable<(...args: any[]) => any>;
33
- hintProgressColor: PropTypes.Requireable<string>;
34
- canScrollPage: PropTypes.Requireable<boolean>;
35
- crossOutEnabled: PropTypes.Requireable<boolean>;
36
- editorChangeDelay: PropTypes.Requireable<number>;
37
- }>>>;
38
- onChange: PropTypes.Validator<(...args: any[]) => any>;
7
+ title: any;
8
+ content: any;
9
+ widgets: any;
10
+ images: any;
11
+ apiOptions: any;
12
+ onChange: any;
39
13
  };
40
14
  static widgetName: "graded-group";
41
15
  static defaultProps: GradedGroupDefaultWidgetOptions;
@@ -1,38 +1,12 @@
1
- import PropTypes from "prop-types";
2
1
  import * as React from "react";
3
2
  import type { GradedGroupSetDefaultWidgetOptions } from "@khanacademy/perseus-core";
4
3
  type Props = any;
5
4
  declare class GradedGroupSetEditor extends React.Component<Props> {
6
5
  _editors: Array<any>;
7
6
  static propTypes: {
8
- apiOptions: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
9
- isArticle: PropTypes.Validator<boolean>;
10
- onFocusChange: PropTypes.Validator<(...args: any[]) => any>;
11
- GroupMetadataEditor: PropTypes.Validator<(...args: any[]) => any>;
12
- showAlignmentOptions: PropTypes.Validator<boolean>;
13
- readOnly: PropTypes.Validator<boolean>;
14
- answerableCallback: PropTypes.Requireable<(...args: any[]) => any>;
15
- getAnotherHint: PropTypes.Requireable<(...args: any[]) => any>;
16
- interactionCallback: PropTypes.Requireable<(...args: any[]) => any>;
17
- groupAnnotator: PropTypes.Validator<(...args: any[]) => any>;
18
- imagePlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
19
- widgetPlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
20
- baseElements: PropTypes.Requireable<PropTypes.InferProps<{
21
- Link: PropTypes.Requireable<(...args: any[]) => any>;
22
- }>>;
23
- imagePreloader: PropTypes.Requireable<(...args: any[]) => any>;
24
- trackInteraction: PropTypes.Requireable<(...args: any[]) => any>;
25
- customKeypad: PropTypes.Requireable<boolean>;
26
- nativeKeypadProxy: PropTypes.Requireable<(...args: any[]) => any>;
27
- isMobile: PropTypes.Requireable<boolean>;
28
- setDrawingAreaAvailable: PropTypes.Requireable<(...args: any[]) => any>;
29
- hintProgressColor: PropTypes.Requireable<string>;
30
- canScrollPage: PropTypes.Requireable<boolean>;
31
- crossOutEnabled: PropTypes.Requireable<boolean>;
32
- editorChangeDelay: PropTypes.Requireable<number>;
33
- }>>>;
34
- gradedGroups: PropTypes.Requireable<any[]>;
35
- onChange: PropTypes.Validator<(...args: any[]) => any>;
7
+ apiOptions: any;
8
+ gradedGroups: any;
9
+ onChange: any;
36
10
  };
37
11
  static widgetName: "graded-group-set";
38
12
  static defaultProps: GradedGroupSetDefaultWidgetOptions;
@@ -3,7 +3,7 @@ import type { GrapherDefaultWidgetOptions } from "@khanacademy/perseus-core";
3
3
  type Props = any;
4
4
  declare class GrapherEditor extends React.Component<Props> {
5
5
  static propTypes: {
6
- onChange: import("prop-types").Validator<(...args: any[]) => any>;
6
+ onChange: any;
7
7
  };
8
8
  static widgetName: "grapher";
9
9
  static defaultProps: GrapherDefaultWidgetOptions;
@@ -1,46 +1,18 @@
1
1
  import { type GroupDefaultWidgetOptions } from "@khanacademy/perseus-core";
2
- import PropTypes from "prop-types";
3
2
  import * as React from "react";
4
3
  import Editor from "../editor";
5
4
  type Props = any;
6
5
  declare class GroupEditor extends React.Component<Props> {
7
6
  static propTypes: {
8
- content: PropTypes.Requireable<string>;
9
- widgets: PropTypes.Requireable<object>;
10
- images: PropTypes.Requireable<object>;
11
- metadata: PropTypes.Requireable<any>;
12
- apiOptions: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
13
- isArticle: PropTypes.Validator<boolean>;
14
- onFocusChange: PropTypes.Validator<(...args: any[]) => any>;
15
- GroupMetadataEditor: PropTypes.Validator<(...args: any[]) => any>;
16
- showAlignmentOptions: PropTypes.Validator<boolean>;
17
- readOnly: PropTypes.Validator<boolean>;
18
- answerableCallback: PropTypes.Requireable<(...args: any[]) => any>;
19
- getAnotherHint: PropTypes.Requireable<(...args: any[]) => any>;
20
- interactionCallback: PropTypes.Requireable<(...args: any[]) => any>;
21
- groupAnnotator: PropTypes.Validator<(...args: any[]) => any>;
22
- imagePlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
23
- widgetPlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
24
- baseElements: PropTypes.Requireable<PropTypes.InferProps<{
25
- Link: PropTypes.Requireable<(...args: any[]) => any>;
26
- }>>;
27
- imagePreloader: PropTypes.Requireable<(...args: any[]) => any>;
28
- trackInteraction: PropTypes.Requireable<(...args: any[]) => any>;
29
- customKeypad: PropTypes.Requireable<boolean>;
30
- nativeKeypadProxy: PropTypes.Requireable<(...args: any[]) => any>;
31
- isMobile: PropTypes.Requireable<boolean>;
32
- setDrawingAreaAvailable: PropTypes.Requireable<(...args: any[]) => any>;
33
- hintProgressColor: PropTypes.Requireable<string>;
34
- canScrollPage: PropTypes.Requireable<boolean>;
35
- crossOutEnabled: PropTypes.Requireable<boolean>;
36
- editorChangeDelay: PropTypes.Requireable<number>;
37
- }>>>;
38
- onChange: PropTypes.Validator<(...args: any[]) => any>;
7
+ content: any;
8
+ widgets: any;
9
+ images: any;
10
+ apiOptions: any;
11
+ onChange: any;
39
12
  };
40
13
  static widgetName: "group";
41
14
  static defaultProps: GroupDefaultWidgetOptions;
42
15
  editor: React.RefObject<Editor>;
43
- _renderMetadataEditor: () => React.ReactElement;
44
16
  change: (arg1: any, arg2: any, arg3: any) => any;
45
17
  getSaveWarnings: () => ReadonlyArray<any>;
46
18
  serialize: () => any;
@@ -1,5 +1,4 @@
1
1
  import { type IFrameDefaultWidgetOptions } from "@khanacademy/perseus-core";
2
- import PropTypes from "prop-types";
3
2
  import * as React from "react";
4
3
  type IframeEditorProps = any;
5
4
  /**
@@ -7,7 +6,7 @@ type IframeEditorProps = any;
7
6
  */
8
7
  declare class IframeEditor extends React.Component<IframeEditorProps> {
9
8
  static propTypes: {
10
- onChange: PropTypes.Validator<(...args: any[]) => any>;
9
+ onChange: any;
11
10
  };
12
11
  static widgetName: "iframe";
13
12
  static defaultProps: IFrameDefaultWidgetOptions;
@@ -85,7 +85,7 @@ declare class InteractiveGraphSettings extends React.Component<Props, State> {
85
85
  height?: number;
86
86
  top?: number;
87
87
  left?: number;
88
- scale?: number | string;
88
+ scale?: number;
89
89
  bottom?: number;
90
90
  };
91
91
  };