@khanacademy/perseus-editor 37.1.0 → 38.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/components/widget-editor.d.ts +15 -12
- package/dist/es/index.js +33 -29
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +36 -32
- package/dist/index.js.map +1 -1
- package/dist/mixins/changeable.d.ts +37 -0
- package/dist/mixins/editor-jsonify.d.ts +8 -0
- package/dist/widgets/categorizer-editor/categorizer-editor.d.ts +2 -2
- package/dist/widgets/cs-program-editor/cs-program-editor.d.ts +2 -2
- package/dist/widgets/definition-editor/definition-editor.d.ts +2 -2
- package/dist/widgets/explanation-editor/explanation-editor.d.ts +2 -2
- package/dist/widgets/graded-group-editor/graded-group-editor.d.ts +2 -2
- package/dist/widgets/graded-group-set-editor/graded-group-set-editor.d.ts +2 -2
- package/dist/widgets/iframe-editor/iframe-editor.d.ts +2 -2
- package/dist/widgets/image-editor/components/dark-mode-toggle.d.ts +5 -0
- package/dist/widgets/interaction-editor/constraint-editor.d.ts +2 -2
- package/dist/widgets/interaction-editor/function-editor.d.ts +2 -2
- package/dist/widgets/interaction-editor/label-editor.d.ts +2 -2
- package/dist/widgets/interaction-editor/line-editor.d.ts +2 -2
- package/dist/widgets/interaction-editor/movable-line-editor.d.ts +2 -3
- package/dist/widgets/interaction-editor/movable-point-editor.d.ts +2 -3
- package/dist/widgets/interaction-editor/parametric-editor.d.ts +2 -2
- package/dist/widgets/interaction-editor/point-editor.d.ts +2 -2
- package/dist/widgets/interaction-editor/rectangle-editor.d.ts +2 -2
- package/dist/widgets/interactive-graph-editor/components/interactive-graph-settings.d.ts +1 -5
- package/dist/widgets/matrix-editor/matrix-editor.d.ts +2 -2
- package/dist/widgets/measurer-editor/measurer-editor.d.ts +2 -2
- package/dist/widgets/number-line-editor/number-line-editor.d.ts +2 -2
- package/dist/widgets/numeric-input-editor/numeric-input-editor.d.ts +1 -2
- package/dist/widgets/python-program-editor/python-program-editor.d.ts +2 -2
- package/package.json +8 -8
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Changeable
|
|
3
|
+
*
|
|
4
|
+
* Adds a this.change() function to a component
|
|
5
|
+
*
|
|
6
|
+
* This.change takes prop changes as parameters, and calls
|
|
7
|
+
* this.props.onChange with the modified props.
|
|
8
|
+
*/
|
|
9
|
+
export type ChangeFn = (newPropsOrSinglePropName: string | {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}, propValue?: any, callback?: () => unknown) => any;
|
|
12
|
+
/**
|
|
13
|
+
* this.change()
|
|
14
|
+
*
|
|
15
|
+
* Can be called as follows:
|
|
16
|
+
* this.change(newProps, callback);
|
|
17
|
+
*
|
|
18
|
+
* this.change(propName, propValue, callback);
|
|
19
|
+
*
|
|
20
|
+
* this.change(propName) -> returns a lambda that takes a prop value to
|
|
21
|
+
* set and a callback to call after having set that value.
|
|
22
|
+
*
|
|
23
|
+
* TODO(LEMS-3245) remove Changeable
|
|
24
|
+
*
|
|
25
|
+
* @deprecated
|
|
26
|
+
*/
|
|
27
|
+
export declare const deprecatedChangeableChange: ChangeFn;
|
|
28
|
+
/**
|
|
29
|
+
* TODO(LEMS-3245) remove Changeable
|
|
30
|
+
*
|
|
31
|
+
* @deprecated
|
|
32
|
+
*/
|
|
33
|
+
export type ChangeableProps = {
|
|
34
|
+
onChange: (values: {
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
}, callback?: (() => unknown) | null | undefined, silent?: boolean) => unknown;
|
|
37
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
3
|
import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
|
|
4
4
|
import type { CategorizerDefaultWidgetOptions } from "@khanacademy/perseus-core";
|
|
5
|
-
interface Props extends CategorizerDefaultWidgetOptions,
|
|
5
|
+
interface Props extends CategorizerDefaultWidgetOptions, ChangeableProps {
|
|
6
6
|
apiOptions?: APIOptionsWithDefaults;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This editor is for embedding Khan Academy CS programs.
|
|
3
3
|
*/
|
|
4
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
5
4
|
import * as React from "react";
|
|
5
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
6
6
|
import type { CSProgramDefaultWidgetOptions } from "@khanacademy/perseus-core";
|
|
7
|
-
interface CSProgramEditorProps extends CSProgramDefaultWidgetOptions,
|
|
7
|
+
interface CSProgramEditorProps extends CSProgramDefaultWidgetOptions, ChangeableProps {
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* This is the main editor for this widget, to specify all the options.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import type { InitializeWidgetOptionsParams } from "../../editor";
|
|
3
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
4
4
|
import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
|
|
5
5
|
import type { DefinitionDefaultWidgetOptions } from "@khanacademy/perseus-core";
|
|
6
|
-
interface Props extends DefinitionDefaultWidgetOptions,
|
|
6
|
+
interface Props extends DefinitionDefaultWidgetOptions, ChangeableProps {
|
|
7
7
|
apiOptions?: APIOptionsWithDefaults;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
3
|
import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
|
|
4
4
|
import type { ExplanationDefaultWidgetOptions } from "@khanacademy/perseus-core";
|
|
5
|
-
interface Props extends ExplanationDefaultWidgetOptions,
|
|
5
|
+
interface Props extends ExplanationDefaultWidgetOptions, ChangeableProps {
|
|
6
6
|
apiOptions?: APIOptionsWithDefaults;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import Editor from "../../editor";
|
|
3
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
4
4
|
import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
|
|
5
5
|
import type { GradedGroupDefaultWidgetOptions } from "@khanacademy/perseus-core";
|
|
6
|
-
interface Props extends GradedGroupDefaultWidgetOptions,
|
|
6
|
+
interface Props extends GradedGroupDefaultWidgetOptions, ChangeableProps {
|
|
7
7
|
apiOptions?: APIOptionsWithDefaults;
|
|
8
8
|
}
|
|
9
9
|
declare class GradedGroupEditor extends React.Component<Props> {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
3
|
import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
|
|
4
4
|
import type { GradedGroupSetDefaultWidgetOptions } from "@khanacademy/perseus-core";
|
|
5
|
-
interface Props extends GradedGroupSetDefaultWidgetOptions,
|
|
5
|
+
interface Props extends GradedGroupSetDefaultWidgetOptions, ChangeableProps {
|
|
6
6
|
apiOptions?: APIOptionsWithDefaults;
|
|
7
7
|
}
|
|
8
8
|
declare class GradedGroupSetEditor extends React.Component<Props> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import { type IFrameDefaultWidgetOptions } from "@khanacademy/perseus-core";
|
|
3
2
|
import * as React from "react";
|
|
4
|
-
|
|
3
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
4
|
+
interface IframeEditorProps extends IFrameDefaultWidgetOptions, ChangeableProps {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* This is the main editor for this widget, to specify all the options.
|
|
@@ -8,4 +8,9 @@ interface Props {
|
|
|
8
8
|
onSuppressToggle: ImageEditorProps["onChange"];
|
|
9
9
|
}
|
|
10
10
|
export default function DarkModeToggle({ backgroundImage, onShowToggle, onSuppressToggle, editingDisabled, }: Props): React.JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* Determines whether an image is a "graphical" type (PNG or SVG) with large
|
|
13
|
+
* flat areas of meaningful color and potentially a transparent background.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isGraphicalImage(url: string | null | undefined): boolean;
|
|
11
16
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
type
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
|
+
type Props = ChangeableProps & {
|
|
4
4
|
constraint: string;
|
|
5
5
|
constraintFn: string;
|
|
6
6
|
constraintXMax: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
type
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
|
+
type Props = ChangeableProps & {
|
|
4
4
|
value: string;
|
|
5
5
|
rangeMin: string;
|
|
6
6
|
rangeMax: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
type
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
|
+
type Props = ChangeableProps & {
|
|
4
4
|
color: string;
|
|
5
5
|
coordX: string;
|
|
6
6
|
coordY: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
type
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
|
+
type Props = ChangeableProps & {
|
|
4
4
|
startX: string;
|
|
5
5
|
startY: string;
|
|
6
6
|
endX: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
type ChangeFn
|
|
4
|
-
type Props =
|
|
2
|
+
import type { ChangeableProps, ChangeFn } from "../../mixins/changeable";
|
|
3
|
+
type Props = ChangeableProps & {
|
|
5
4
|
startX: string;
|
|
6
5
|
startY: string;
|
|
7
6
|
endX: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
type ChangeFn
|
|
4
|
-
type Props =
|
|
2
|
+
import type { ChangeableProps, ChangeFn } from "../../mixins/changeable";
|
|
3
|
+
type Props = ChangeableProps & {
|
|
5
4
|
startX: string;
|
|
6
5
|
startY: string;
|
|
7
6
|
constraint: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
type
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
|
+
type Props = ChangeableProps & {
|
|
4
4
|
x: string;
|
|
5
5
|
y: string;
|
|
6
6
|
rangeMin: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
type
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
|
+
type Props = ChangeableProps & {
|
|
4
4
|
coordX: string;
|
|
5
5
|
coordY: string;
|
|
6
6
|
color: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
type
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
|
+
type Props = ChangeableProps & {
|
|
4
4
|
color: string;
|
|
5
5
|
coordX: string;
|
|
6
6
|
coordY: string;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Used in the editor for the InteractiveGraph widget.
|
|
3
|
-
*/
|
|
4
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
5
1
|
import * as React from "react";
|
|
2
|
+
import type { ChangeFn } from "../../../mixins/changeable";
|
|
6
3
|
import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
|
|
7
4
|
import type { AxisLabelLocation, ShowAxisArrows, ShowAxisTicks, MarkingsType, PerseusImageBackground } from "@khanacademy/perseus-core";
|
|
8
|
-
type ChangeFn = typeof Changeable.change;
|
|
9
5
|
type Range = [min: number, max: number];
|
|
10
6
|
interface Props {
|
|
11
7
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
3
|
import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
|
|
4
4
|
import type { MatrixDefaultWidgetOptions } from "@khanacademy/perseus-core";
|
|
5
|
-
interface Props extends MatrixDefaultWidgetOptions,
|
|
5
|
+
interface Props extends MatrixDefaultWidgetOptions, ChangeableProps {
|
|
6
6
|
apiOptions: APIOptionsWithDefaults;
|
|
7
7
|
}
|
|
8
8
|
declare class MatrixEditor extends React.Component<Props> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
3
|
import type { MeasurerDefaultWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
|
-
interface Props extends MeasurerDefaultWidgetOptions,
|
|
4
|
+
interface Props extends MeasurerDefaultWidgetOptions, ChangeableProps {
|
|
5
5
|
}
|
|
6
6
|
declare class MeasurerEditor extends React.Component<Props> {
|
|
7
7
|
static widgetName: "measurer";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type NumberLineDefaultWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
4
4
|
type Range = [number, number];
|
|
5
5
|
type Props = {
|
|
6
6
|
range: number[];
|
|
@@ -17,7 +17,7 @@ type Props = {
|
|
|
17
17
|
isTickCtrl?: boolean;
|
|
18
18
|
static?: boolean;
|
|
19
19
|
showTooltips: boolean;
|
|
20
|
-
} &
|
|
20
|
+
} & ChangeableProps;
|
|
21
21
|
/**
|
|
22
22
|
* An editor for adding a number line widget that allows users to mark
|
|
23
23
|
* positions, intervals, and points on a number line.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import { type PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
|
|
3
2
|
import * as React from "react";
|
|
3
|
+
import type { ChangeFn } from "../../mixins/changeable";
|
|
4
4
|
import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
|
|
5
|
-
type ChangeFn = typeof Changeable.change;
|
|
6
5
|
type Props = Omit<PerseusNumericInputWidgetOptions, "static"> & {
|
|
7
6
|
onChange: (results: any) => any;
|
|
8
7
|
apiOptions: APIOptionsWithDefaults;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Changeable } from "@khanacademy/perseus";
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
import type { ChangeableProps } from "../../mixins/changeable";
|
|
3
3
|
import type { PerseusPythonProgramWidgetOptions, PythonProgramDefaultWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
|
-
type Props =
|
|
4
|
+
type Props = ChangeableProps & {
|
|
5
5
|
programID: string;
|
|
6
6
|
height: number;
|
|
7
7
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Perseus editors",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "38.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"mafs": "^0.19.0",
|
|
37
37
|
"tiny-invariant": "1.3.1",
|
|
38
38
|
"@khanacademy/kas": "2.2.6",
|
|
39
|
-
"@khanacademy/
|
|
40
|
-
"@khanacademy/
|
|
41
|
-
"@khanacademy/math-input": "27.0.
|
|
42
|
-
"@khanacademy/perseus
|
|
43
|
-
"@khanacademy/
|
|
44
|
-
"@khanacademy/perseus-
|
|
45
|
-
"@khanacademy/
|
|
39
|
+
"@khanacademy/keypad-context": "3.2.85",
|
|
40
|
+
"@khanacademy/kmath": "2.4.44",
|
|
41
|
+
"@khanacademy/math-input": "27.0.5",
|
|
42
|
+
"@khanacademy/perseus": "85.0.0",
|
|
43
|
+
"@khanacademy/perseus-core": "37.0.0",
|
|
44
|
+
"@khanacademy/perseus-linter": "5.1.25",
|
|
45
|
+
"@khanacademy/perseus-utils": "2.1.5"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@khanacademy/mathjax-renderer": "3.1.4",
|