@khanacademy/perseus-editor 35.0.3 → 35.1.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/all-editors.d.ts +1 -2
- package/dist/article-editor.d.ts +1 -1
- package/dist/components/alignment-select.d.ts +1 -1
- package/dist/components/typed-single-select.d.ts +43 -0
- package/dist/components/widget-editor-settings.d.ts +1 -1
- package/dist/components/widget-editor.d.ts +3 -3
- package/dist/editor.d.ts +0 -2
- package/dist/es/index.js +38 -38
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +37 -37
- package/dist/index.js.map +1 -1
- package/dist/testing/feature-flags-util.d.ts +0 -1
- package/dist/widgets/interactive-graph-editor/components/graph-type-selector.d.ts +4 -2
- package/dist/widgets/interactive-graph-editor/interactive-graph-editor.d.ts +18 -18
- package/dist/widgets/interactive-graph-editor/locked-figures/locked-function-examples.d.ts +2 -4
- package/package.json +7 -7
- package/dist/widgets/molecule-editor.d.ts +0 -16
package/dist/all-editors.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ import LabelImageEditor from "./widgets/label-image-editor/label-image-editor";
|
|
|
18
18
|
import MatcherEditor from "./widgets/matcher-editor";
|
|
19
19
|
import MatrixEditor from "./widgets/matrix-editor";
|
|
20
20
|
import MeasurerEditor from "./widgets/measurer-editor";
|
|
21
|
-
import MoleculeEditor from "./widgets/molecule-editor";
|
|
22
21
|
import NumberLineEditor from "./widgets/number-line-editor";
|
|
23
22
|
import NumericInputEditor from "./widgets/numeric-input-editor";
|
|
24
23
|
import OrdererEditor from "./widgets/orderer-editor";
|
|
@@ -29,5 +28,5 @@ import RadioEditor from "./widgets/radio/editor";
|
|
|
29
28
|
import SorterEditor from "./widgets/sorter-editor";
|
|
30
29
|
import TableEditor from "./widgets/table-editor";
|
|
31
30
|
import VideoEditor from "./widgets/video-editor/video-editor";
|
|
32
|
-
declare const _default: (typeof CategorizerEditor | typeof CSProgramEditor | typeof DefinitionEditor | typeof DeprecatedStandinEditor | typeof DropdownEditor | typeof ExplanationEditor | typeof ExpressionEditor | typeof FreeResponseEditor | typeof GradedGroupEditor | typeof GradedGroupSetEditor | typeof GrapherEditor | typeof GroupEditor | typeof IframeEditor | typeof ImageEditor | typeof NumericInputEditor | typeof InteractionEditor | typeof InteractiveGraphEditor | typeof LabelImageEditor | typeof MatcherEditor | typeof MatrixEditor | typeof MeasurerEditor | typeof
|
|
31
|
+
declare const _default: (typeof CategorizerEditor | typeof CSProgramEditor | typeof DefinitionEditor | typeof DeprecatedStandinEditor | typeof DropdownEditor | typeof ExplanationEditor | typeof ExpressionEditor | typeof FreeResponseEditor | typeof GradedGroupEditor | typeof GradedGroupSetEditor | typeof GrapherEditor | typeof GroupEditor | typeof IframeEditor | typeof ImageEditor | typeof NumericInputEditor | typeof InteractionEditor | typeof InteractiveGraphEditor | typeof LabelImageEditor | typeof MatcherEditor | typeof MatrixEditor | typeof MeasurerEditor | typeof NumberLineEditor | typeof OrdererEditor | typeof PhetSimulationEditor | typeof PlotterEditor | typeof PythonProgramEditor | typeof RadioEditor | typeof SorterEditor | typeof TableEditor | typeof VideoEditor)[];
|
|
33
32
|
export default _default;
|
package/dist/article-editor.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export default class ArticleEditor extends React.Component<Props, State> {
|
|
|
66
66
|
isMobile?: boolean;
|
|
67
67
|
isMobileApp?: boolean;
|
|
68
68
|
hintProgressColor?: string;
|
|
69
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator"
|
|
69
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
70
70
|
}>;
|
|
71
71
|
linterContext: {
|
|
72
72
|
contentType: string;
|
|
@@ -5,7 +5,7 @@ interface Props {
|
|
|
5
5
|
supportedAlignments: ReadonlyArray<Alignment>;
|
|
6
6
|
widgetInfo: PerseusWidget;
|
|
7
7
|
isEditingDisabled: boolean;
|
|
8
|
-
onChange: (
|
|
8
|
+
onChange: (newAlignment: Alignment) => void;
|
|
9
9
|
style?: StyleType;
|
|
10
10
|
}
|
|
11
11
|
export declare function AlignmentSelect({ supportedAlignments, widgetInfo, isEditingDisabled, onChange, style, }: Props): React.JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SingleSelect } from "@khanacademy/wonder-blocks-dropdown";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import type { PropsFor } from "@khanacademy/wonder-blocks-core";
|
|
4
|
+
/**
|
|
5
|
+
* A single option in a `TypedSingleSelect`.
|
|
6
|
+
*
|
|
7
|
+
* - A non-empty string is the option's visible label.
|
|
8
|
+
* - The object form additionally allows a `leftAccessory` (e.g. an icon or
|
|
9
|
+
* swatch) to be rendered before the label. Objects are always shown, so this
|
|
10
|
+
* form is the way to render an accessory-only option (empty `label`).
|
|
11
|
+
* - Any falsey value (`""`, `false`, `null`, `undefined`) hides the option.
|
|
12
|
+
* This supports the `condition && "Label"` idiom for conditionally showing an
|
|
13
|
+
* option without dropping it from the `options` object.
|
|
14
|
+
*/
|
|
15
|
+
type SelectOption = string | null | undefined | false | {
|
|
16
|
+
label: string;
|
|
17
|
+
leftAccessory?: React.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* An object representing the options of a `<select>` element in HTML.
|
|
21
|
+
* Each property key in the object is a `value` of an option, and each
|
|
22
|
+
* property value describes how that option appears in the dropdown. If a
|
|
23
|
+
* property value is falsey, the corresponding option is hidden.
|
|
24
|
+
*/
|
|
25
|
+
type SelectOptions<ValueT extends string> = Record<ValueT, SelectOption>;
|
|
26
|
+
interface OwnProps<ValueT extends string> {
|
|
27
|
+
options: SelectOptions<ValueT>;
|
|
28
|
+
selectedValue?: NoInfer<ValueT> | null | undefined;
|
|
29
|
+
onChange: (selectedValue: NoInfer<ValueT>) => void;
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
}
|
|
32
|
+
export type Props<ValueT extends string> = OwnProps<ValueT> & Omit<PropsFor<typeof SingleSelect>, keyof OwnProps<string>>;
|
|
33
|
+
/**
|
|
34
|
+
* A typesafe version of Wonder Blocks' `SingleSelect` component. Use this
|
|
35
|
+
* when you need a `SingleSelect` to choose among the branches of a union
|
|
36
|
+
* type like `"foo" | "bar" | "baz"`.
|
|
37
|
+
*
|
|
38
|
+
* `ValueT` is inferred from the keys of `options`, so `selectedValue` and the
|
|
39
|
+
* value passed to `onChange` are guaranteed to be members of that union — no
|
|
40
|
+
* cast or runtime check is needed at the call site.
|
|
41
|
+
*/
|
|
42
|
+
export declare function TypedSingleSelect<ValueT extends string>(props: Props<ValueT>): React.JSX.Element;
|
|
43
|
+
export {};
|
|
@@ -15,7 +15,7 @@ interface WidgetEditorSettingsProps {
|
|
|
15
15
|
onGradedChange: (value: boolean) => unknown;
|
|
16
16
|
supportedAlignments: ReadonlyArray<Alignment>;
|
|
17
17
|
widgetInfo: PerseusWidget;
|
|
18
|
-
onAlignmentChange: (
|
|
18
|
+
onAlignmentChange: (newAlignment: Alignment) => unknown;
|
|
19
19
|
isEditingDisabled: boolean;
|
|
20
20
|
}
|
|
21
21
|
declare function WidgetEditorSettings(props: WidgetEditorSettingsProps): React.JSX.Element | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type Editor from "../editor";
|
|
3
3
|
import type { APIOptions } from "@khanacademy/perseus";
|
|
4
|
-
import type { PerseusWidget } from "@khanacademy/perseus-core";
|
|
4
|
+
import type { Alignment, PerseusWidget } from "@khanacademy/perseus-core";
|
|
5
5
|
export type WidgetEditorProps = {
|
|
6
6
|
id: string;
|
|
7
7
|
onChange: (widgetInfo: PerseusWidget, cb?: () => unknown, silent?: boolean) => unknown;
|
|
@@ -22,10 +22,10 @@ declare class WidgetEditor extends React.Component<WidgetEditorProps, WidgetEdit
|
|
|
22
22
|
_handleWidgetChange: (newProps: WidgetEditorProps, cb: () => unknown, silent: boolean) => void;
|
|
23
23
|
_setStatic: (value: boolean) => void;
|
|
24
24
|
_setGraded: (value: boolean) => void;
|
|
25
|
-
_handleAlignmentChange: (
|
|
25
|
+
_handleAlignmentChange: (newAlignment: Alignment) => void;
|
|
26
26
|
getSaveWarnings: () => any;
|
|
27
27
|
serialize: () => {
|
|
28
|
-
type: "categorizer" | "iframe" | "table" | "video" | "image" | "radio" | "cs-program" | "definition" | "group" | "dropdown" | "explanation" | "expression" | "free-response" | "grapher" | "graded-group-set" | "graded-group" | "input-number" | "interaction" | "interactive-graph" | "label-image" | "matcher" | "matrix" | "measurer" | "
|
|
28
|
+
type: "categorizer" | "iframe" | "table" | "video" | "image" | "radio" | "cs-program" | "definition" | "group" | "dropdown" | "explanation" | "expression" | "free-response" | "grapher" | "graded-group-set" | "graded-group" | "input-number" | "interaction" | "interactive-graph" | "label-image" | "matcher" | "matrix" | "measurer" | "number-line" | "numeric-input" | "orderer" | "phet-simulation" | "python-program" | "plotter" | "sorter" | "mock-widget" | "deprecated-standin";
|
|
29
29
|
alignment: string | undefined;
|
|
30
30
|
static: boolean | undefined;
|
|
31
31
|
graded: boolean | undefined;
|
package/dist/editor.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ type Props = Readonly<{
|
|
|
11
11
|
images: any;
|
|
12
12
|
disabled: boolean;
|
|
13
13
|
widgetEnabled: boolean;
|
|
14
|
-
immutableWidgets: boolean;
|
|
15
14
|
showWordCount: boolean;
|
|
16
15
|
warnNoPrompt: boolean;
|
|
17
16
|
warnNoWidgets: boolean;
|
|
@@ -23,7 +22,6 @@ type DefaultProps = {
|
|
|
23
22
|
content: string;
|
|
24
23
|
disabled: boolean;
|
|
25
24
|
images: Record<any, any>;
|
|
26
|
-
immutableWidgets: boolean;
|
|
27
25
|
placeholder: string;
|
|
28
26
|
showWordCount: boolean;
|
|
29
27
|
warnNoPrompt: boolean;
|