@khanacademy/perseus-core 3.2.0 → 3.4.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/data-schema.d.ts +57 -12
- package/dist/es/index.js +2968 -280
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +80 -1
- package/dist/index.js +3027 -281
- package/dist/index.js.map +1 -1
- package/dist/parse-perseus-json/error-tracking-parse-context.d.ts +9 -0
- package/dist/parse-perseus-json/exhaustive-test-tool/index.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/any.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/array.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/array.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/general-purpose-parsers/boolean.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/constant.d.ts +4 -0
- package/dist/parse-perseus-json/general-purpose-parsers/convert.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/defaulted.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/discriminated-union.d.ts +21 -0
- package/dist/parse-perseus-json/general-purpose-parsers/discriminated-union.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/general-purpose-parsers/enumeration.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/enumeration.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/general-purpose-parsers/index.d.ts +17 -0
- package/dist/parse-perseus-json/general-purpose-parsers/is-object.d.ts +1 -0
- package/dist/parse-perseus-json/general-purpose-parsers/nullable.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/number.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/object.d.ts +6 -0
- package/dist/parse-perseus-json/general-purpose-parsers/optional.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/pair.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/pipe-parsers.d.ts +7 -0
- package/dist/parse-perseus-json/general-purpose-parsers/pipe-parsers.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/general-purpose-parsers/record.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/string-to-number.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/string.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/test-helpers.d.ts +8 -0
- package/dist/parse-perseus-json/general-purpose-parsers/trio.d.ts +2 -0
- package/dist/parse-perseus-json/general-purpose-parsers/union.d.ts +7 -0
- package/dist/parse-perseus-json/general-purpose-parsers/union.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/general-purpose-parsers/unknown.d.ts +2 -0
- package/dist/parse-perseus-json/index.d.ts +45 -0
- package/dist/parse-perseus-json/object-path.d.ts +2 -0
- package/dist/parse-perseus-json/parse-failure-detail.d.ts +2 -0
- package/dist/parse-perseus-json/parse.d.ts +3 -0
- package/dist/parse-perseus-json/parser-types.d.ts +30 -0
- package/dist/parse-perseus-json/perseus-parsers/categorizer-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/cs-program-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/definition-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/dropdown-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/explanation-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/expression-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/graded-group-set-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/graded-group-widget.d.ts +16 -0
- package/dist/parse-perseus-json/perseus-parsers/grapher-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/group-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/hint.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/iframe-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/image-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/images-map.d.ts +5 -0
- package/dist/parse-perseus-json/perseus-parsers/input-number-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/interaction-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/interactive-graph-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/label-image-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/matcher-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/matrix-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/measurer-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/molecule-renderer-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/number-line-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/numeric-input-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/orderer-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/passage-ref-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/passage-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/perseus-article.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/perseus-image-background.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/perseus-item.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/perseus-renderer.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/phet-simulation-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/plotter-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/python-program-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/radio-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/sorter-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/table-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/versioned-widget-options.d.ts +36 -0
- package/dist/parse-perseus-json/perseus-parsers/video-widget.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/widget.d.ts +7 -0
- package/dist/parse-perseus-json/perseus-parsers/widgets-map.d.ts +3 -0
- package/dist/parse-perseus-json/result.d.ts +16 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils/is-real-json-parse.d.ts +1 -0
- package/dist/utils/widget-id-utils.d.ts +38 -0
- package/dist/widgets/categorizer/categorizer-util.d.ts +17 -0
- package/dist/widgets/categorizer/index.d.ts +5 -0
- package/dist/widgets/core-widget-registry.d.ts +28 -0
- package/dist/widgets/cs-program/cs-program-util.d.ts +2 -0
- package/dist/widgets/cs-program/index.d.ts +5 -0
- package/dist/widgets/definition/index.d.ts +5 -0
- package/dist/widgets/dropdown/dropdown-util.d.ts +20 -0
- package/dist/widgets/dropdown/index.d.ts +5 -0
- package/dist/widgets/explanation/index.d.ts +5 -0
- package/dist/widgets/expression/expression-upgrade.d.ts +10 -0
- package/dist/widgets/expression/expression-util.d.ts +19 -0
- package/dist/widgets/expression/index.d.ts +4 -0
- package/dist/widgets/graded-group/index.d.ts +5 -0
- package/dist/widgets/graded-group-set/index.d.ts +5 -0
- package/dist/widgets/grapher/index.d.ts +5 -0
- package/dist/widgets/group/index.d.ts +5 -0
- package/dist/widgets/iframe/index.d.ts +5 -0
- package/dist/widgets/image/index.d.ts +5 -0
- package/dist/widgets/input-number/index.d.ts +5 -0
- package/dist/widgets/interaction/index.d.ts +5 -0
- package/dist/widgets/interactive-graph/index.d.ts +5 -0
- package/dist/widgets/label-image/index.d.ts +5 -0
- package/dist/widgets/label-image/label-image-util.d.ts +19 -0
- package/dist/widgets/logic-export.types.d.ts +13 -0
- package/dist/widgets/matcher/index.d.ts +5 -0
- package/dist/widgets/matrix/index.d.ts +5 -0
- package/dist/widgets/measurer/index.d.ts +4 -0
- package/dist/widgets/measurer/measurer-upgrade.d.ts +10 -0
- package/dist/widgets/number-line/index.d.ts +5 -0
- package/dist/widgets/number-line/number-line-util.d.ts +4 -0
- package/dist/widgets/numeric-input/index.d.ts +5 -0
- package/dist/widgets/numeric-input/numeric-input-util.d.ts +19 -0
- package/dist/widgets/orderer/index.d.ts +5 -0
- package/dist/widgets/orderer/orderer-util.d.ts +16 -0
- package/dist/widgets/passage/index.d.ts +5 -0
- package/dist/widgets/passage-ref/index.d.ts +4 -0
- package/dist/widgets/passage-ref/passage-ref-upgrade.d.ts +7 -0
- package/dist/widgets/passage-ref-target/index.d.ts +5 -0
- package/dist/widgets/phet-simulation/index.d.ts +5 -0
- package/dist/widgets/plotter/index.d.ts +5 -0
- package/dist/widgets/python-program/index.d.ts +5 -0
- package/dist/widgets/radio/index.d.ts +4 -0
- package/dist/widgets/radio/radio-upgrade.d.ts +10 -0
- package/dist/widgets/sorter/index.d.ts +5 -0
- package/dist/widgets/sorter/sorter-util.d.ts +16 -0
- package/dist/widgets/table/index.d.ts +5 -0
- package/dist/widgets/upgrade.d.ts +3 -0
- package/dist/widgets/video/index.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PerseusCategorizerWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
|
+
/**
|
|
3
|
+
* For details on the individual options, see the
|
|
4
|
+
* PerseusCategorizerWidgetOptions type
|
|
5
|
+
*/
|
|
6
|
+
type CategorizerPublicWidgetOptions = {
|
|
7
|
+
items: PerseusCategorizerWidgetOptions["items"];
|
|
8
|
+
categories: PerseusCategorizerWidgetOptions["categories"];
|
|
9
|
+
randomizeItems: PerseusCategorizerWidgetOptions["randomizeItems"];
|
|
10
|
+
static: PerseusCategorizerWidgetOptions["static"];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Given a PerseusCategorizerWidgetOptions object, return a new object with only
|
|
14
|
+
* the public options that should be exposed to the client.
|
|
15
|
+
*/
|
|
16
|
+
declare function getCategorizerPublicWidgetOptions(options: PerseusCategorizerWidgetOptions): CategorizerPublicWidgetOptions;
|
|
17
|
+
export default getCategorizerPublicWidgetOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusCategorizerWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type CategorizerDefaultWidgetOptions = Pick<PerseusCategorizerWidgetOptions, "items" | "categories" | "values" | "randomizeItems">;
|
|
4
|
+
declare const categorizerWidgetLogic: WidgetLogic;
|
|
5
|
+
export default categorizerWidgetLogic;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Alignment } from "../types";
|
|
2
|
+
export declare function isWidgetRegistered(type: string): boolean;
|
|
3
|
+
export declare function getCurrentVersion(type: string): any;
|
|
4
|
+
export declare function getWidgetOptionsUpgrades(type: string): any;
|
|
5
|
+
export declare function getDefaultWidgetOptions(type: string): any;
|
|
6
|
+
/**
|
|
7
|
+
* Handling for the optional alignments for widgets
|
|
8
|
+
* See widget-container.jsx for details on how alignments are implemented.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Returns the list of supported alignments for the given (string) widget
|
|
12
|
+
* type. This is used primarily at editing time to display the choices
|
|
13
|
+
* for the user.
|
|
14
|
+
*
|
|
15
|
+
* Supported alignments are given as an array of strings in the exports of
|
|
16
|
+
* a widget's module.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getSupportedAlignments: (type: string) => ReadonlyArray<Alignment>;
|
|
19
|
+
/**
|
|
20
|
+
* For the given (string) widget type, determine the default alignment for
|
|
21
|
+
* the widget. This is used at rendering time to go from "default" alignment
|
|
22
|
+
* to the actual alignment displayed on the screen.
|
|
23
|
+
*
|
|
24
|
+
* The default alignment is given either as a string (called
|
|
25
|
+
* `defaultAlignment`) or a function (called `getDefaultAlignment`) on
|
|
26
|
+
* the exports of a widget's module.
|
|
27
|
+
*/
|
|
28
|
+
export declare const getDefaultAlignment: (type: string) => Alignment;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusCSProgramWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type CSProgramDefaultWidgetOptions = Pick<PerseusCSProgramWidgetOptions, "programID" | "programType" | "settings" | "showEditor" | "showButtons" | "height">;
|
|
4
|
+
declare const csProgramWidgetLogic: WidgetLogic;
|
|
5
|
+
export default csProgramWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusDefinitionWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type DefinitionDefaultWidgetOptions = Pick<PerseusDefinitionWidgetOptions, "togglePrompt" | "definition">;
|
|
4
|
+
declare const definitionWidgetLogic: WidgetLogic;
|
|
5
|
+
export default definitionWidgetLogic;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PerseusDropdownWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
|
+
/**
|
|
3
|
+
* For details on the individual options, see the
|
|
4
|
+
* PerseusDropdownWidgetOptions type
|
|
5
|
+
*/
|
|
6
|
+
type DropdownPublicWidgetOptions = {
|
|
7
|
+
choices: ReadonlyArray<{
|
|
8
|
+
content: string;
|
|
9
|
+
}>;
|
|
10
|
+
placeholder: PerseusDropdownWidgetOptions["placeholder"];
|
|
11
|
+
static: PerseusDropdownWidgetOptions["static"];
|
|
12
|
+
visibleLabel?: PerseusDropdownWidgetOptions["visibleLabel"];
|
|
13
|
+
ariaLabel?: PerseusDropdownWidgetOptions["ariaLabel"];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Given a PerseusDropdownWidgetOptions object, return a new object with only
|
|
17
|
+
* the public options that should be exposed to the client.
|
|
18
|
+
*/
|
|
19
|
+
declare function getDropdownPublicWidgetOptions(options: PerseusDropdownWidgetOptions): DropdownPublicWidgetOptions;
|
|
20
|
+
export default getDropdownPublicWidgetOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusDropdownWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type DropdownDefaultWidgetOptions = Pick<PerseusDropdownWidgetOptions, "placeholder" | "choices">;
|
|
4
|
+
declare const dropdownWidgetLogic: WidgetLogic;
|
|
5
|
+
export default dropdownWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusExplanationWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type ExplanationDefaultWidgetOptions = Pick<PerseusExplanationWidgetOptions, "showPrompt" | "hidePrompt" | "explanation" | "widgets">;
|
|
4
|
+
declare const explanationWidgetLogic: WidgetLogic;
|
|
5
|
+
export default explanationWidgetLogic;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PerseusExpressionWidgetOptions } from "../../data-schema";
|
|
2
|
+
export declare const currentVersion: {
|
|
3
|
+
major: number;
|
|
4
|
+
minor: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const widgetOptionsUpgrades: {
|
|
7
|
+
readonly "1": (v0options: any) => PerseusExpressionWidgetOptions;
|
|
8
|
+
};
|
|
9
|
+
export type ExpressionDefaultWidgetOptions = Pick<PerseusExpressionWidgetOptions, "answerForms" | "times" | "buttonSets" | "functions">;
|
|
10
|
+
export declare const defaultWidgetOptions: ExpressionDefaultWidgetOptions;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PerseusExpressionWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
|
+
/**
|
|
3
|
+
* For details on the individual options, see the
|
|
4
|
+
* PerseusExpressionWidgetOptions type
|
|
5
|
+
*/
|
|
6
|
+
type ExpressionPublicWidgetOptions = {
|
|
7
|
+
buttonSets: PerseusExpressionWidgetOptions["buttonSets"];
|
|
8
|
+
functions: PerseusExpressionWidgetOptions["functions"];
|
|
9
|
+
times: PerseusExpressionWidgetOptions["times"];
|
|
10
|
+
visibleLabel?: PerseusExpressionWidgetOptions["visibleLabel"];
|
|
11
|
+
ariaLabel?: PerseusExpressionWidgetOptions["ariaLabel"];
|
|
12
|
+
buttonsVisible?: PerseusExpressionWidgetOptions["buttonsVisible"];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Given a PerseusExpressionWidgetOptions object, return a new object with only
|
|
16
|
+
* the public options that should be exposed to the client.
|
|
17
|
+
*/
|
|
18
|
+
declare function getExpressionPublicWidgetOptions(options: PerseusExpressionWidgetOptions): ExpressionPublicWidgetOptions;
|
|
19
|
+
export default getExpressionPublicWidgetOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusGradedGroupWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type GradedGroupDefaultWidgetOptions = Pick<PerseusGradedGroupWidgetOptions, "title" | "content" | "widgets" | "images" | "hint">;
|
|
4
|
+
declare const gradedGroupWidgetLogic: WidgetLogic;
|
|
5
|
+
export default gradedGroupWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusGradedGroupSetWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type GradedGroupSetDefaultWidgetOptions = Pick<PerseusGradedGroupSetWidgetOptions, "gradedGroups">;
|
|
4
|
+
declare const gradedGroupSetWidgetLogic: WidgetLogic;
|
|
5
|
+
export default gradedGroupSetWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusGrapherWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type GrapherDefaultWidgetOptions = Pick<PerseusGrapherWidgetOptions, "graph" | "correct" | "availableTypes">;
|
|
4
|
+
declare const grapherWidgetLogic: WidgetLogic;
|
|
5
|
+
export default grapherWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusGroupWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type GroupDefaultWidgetOptions = Pick<PerseusGroupWidgetOptions, "content" | "widgets" | "images" | "metadata">;
|
|
4
|
+
declare const groupWidgetLogic: WidgetLogic;
|
|
5
|
+
export default groupWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusIFrameWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type IFrameDefaultWidgetOptions = Pick<PerseusIFrameWidgetOptions, "url" | "settings" | "width" | "height" | "allowFullScreen" | "allowTopNavigation">;
|
|
4
|
+
declare const iframeWidgetLogic: WidgetLogic;
|
|
5
|
+
export default iframeWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusImageWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type ImageDefaultWidgetOptions = Pick<PerseusImageWidgetOptions, "title" | "range" | "box" | "backgroundImage" | "labels" | "alt" | "caption">;
|
|
4
|
+
declare const imageWidgetLogic: WidgetLogic;
|
|
5
|
+
export default imageWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusInputNumberWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type InputNumberDefaultWidgetOptions = Pick<PerseusInputNumberWidgetOptions, "value" | "simplify" | "size" | "inexact" | "maxError" | "answerType" | "rightAlign">;
|
|
4
|
+
declare const inputNumberWidgetLogic: WidgetLogic;
|
|
5
|
+
export default inputNumberWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusInteractionWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type InteractionDefaultWidgetOptions = Pick<PerseusInteractionWidgetOptions, "graph" | "elements">;
|
|
4
|
+
declare const interactionWidgetLogic: WidgetLogic;
|
|
5
|
+
export default interactionWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusInteractiveGraphWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type InteractiveGraphDefaultWidgetOptions = Pick<PerseusInteractiveGraphWidgetOptions, "labels" | "range" | "step" | "backgroundImage" | "markings" | "showTooltips" | "showProtractor" | "graph" | "correct">;
|
|
4
|
+
declare const interactiveGraphWidgetLogic: WidgetLogic;
|
|
5
|
+
export default interactiveGraphWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusLabelImageWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type LabelImageDefaultWidgetOptions = Pick<PerseusLabelImageWidgetOptions, "choices" | "imageAlt" | "imageUrl" | "imageWidth" | "imageHeight" | "markers" | "multipleAnswers" | "hideChoicesFromInstructions">;
|
|
4
|
+
declare const labelImageWidgetLogic: WidgetLogic;
|
|
5
|
+
export default labelImageWidgetLogic;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PerseusLabelImageMarker, PerseusLabelImageWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
|
+
/**
|
|
3
|
+
* For details on the individual options, see the
|
|
4
|
+
* PerseusLabelImageWidgetOptions type
|
|
5
|
+
*/
|
|
6
|
+
type LabelImagePublicWidgetOptions = {
|
|
7
|
+
choices: PerseusLabelImageWidgetOptions["choices"];
|
|
8
|
+
imageUrl: PerseusLabelImageWidgetOptions["imageUrl"];
|
|
9
|
+
imageAlt: PerseusLabelImageWidgetOptions["imageAlt"];
|
|
10
|
+
imageHeight: PerseusLabelImageWidgetOptions["imageHeight"];
|
|
11
|
+
imageWidth: PerseusLabelImageWidgetOptions["imageWidth"];
|
|
12
|
+
markers: ReadonlyArray<LabelImageMarkerPublicData>;
|
|
13
|
+
hideChoicesFromInstructions: PerseusLabelImageWidgetOptions["hideChoicesFromInstructions"];
|
|
14
|
+
multipleAnswers: PerseusLabelImageWidgetOptions["multipleAnswers"];
|
|
15
|
+
static: PerseusLabelImageWidgetOptions["static"];
|
|
16
|
+
};
|
|
17
|
+
type LabelImageMarkerPublicData = Pick<PerseusLabelImageMarker, "x" | "y" | "label">;
|
|
18
|
+
export default function getLabelImagePublicWidgetOptions(options: PerseusLabelImageWidgetOptions): LabelImagePublicWidgetOptions;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Version } from "../data-schema";
|
|
2
|
+
import type { Alignment } from "../types";
|
|
3
|
+
export type WidgetOptionsUpgradeMap = {
|
|
4
|
+
[targetMajorVersion: string]: (arg1: any) => any;
|
|
5
|
+
};
|
|
6
|
+
export type WidgetLogic = {
|
|
7
|
+
name: string;
|
|
8
|
+
version?: Version;
|
|
9
|
+
widgetOptionsUpgrades?: WidgetOptionsUpgradeMap;
|
|
10
|
+
defaultWidgetOptions?: any;
|
|
11
|
+
supportedAlignments?: ReadonlyArray<Alignment>;
|
|
12
|
+
defaultAlignment?: Alignment;
|
|
13
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusMatcherWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type MatcherDefaultWidgetOptions = Pick<PerseusMatcherWidgetOptions, "left" | "right" | "labels" | "orderMatters" | "padding">;
|
|
4
|
+
declare const matcherWidgetLogic: WidgetLogic;
|
|
5
|
+
export default matcherWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusMatrixWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type MatrixDefaultWidgetOptions = Pick<PerseusMatrixWidgetOptions, "matrixBoardSize" | "answers" | "prefix" | "suffix" | "cursorPosition">;
|
|
4
|
+
declare const matrixWidgetLogic: WidgetLogic;
|
|
5
|
+
export default matrixWidgetLogic;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PerseusMeasurerWidgetOptions } from "../../data-schema";
|
|
2
|
+
export declare const currentVersion: {
|
|
3
|
+
major: number;
|
|
4
|
+
minor: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const widgetOptionsUpgrades: {
|
|
7
|
+
readonly "1": (v0options: any) => PerseusMeasurerWidgetOptions;
|
|
8
|
+
};
|
|
9
|
+
export type MeasurerDefaultWidgetOptions = Pick<PerseusMeasurerWidgetOptions, "box" | "image" | "showProtractor" | "showRuler" | "rulerLabel" | "rulerTicks" | "rulerPixels" | "rulerLength">;
|
|
10
|
+
export declare const defaultWidgetOptions: MeasurerDefaultWidgetOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusNumberLineWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type NumberLineDefaultWidgetOptions = Pick<PerseusNumberLineWidgetOptions, "range" | "labelRange" | "labelStyle" | "labelTicks" | "divisionRange" | "numDivisions" | "snapDivisions" | "tickStep" | "correctRel" | "correctX" | "initialX" | "showTooltips">;
|
|
4
|
+
declare const numberLineWidgetLogic: WidgetLogic;
|
|
5
|
+
export default numberLineWidgetLogic;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PerseusNumberLineWidgetOptions } from "../../data-schema";
|
|
2
|
+
type NumberLinePublicWidgetOptions = Pick<PerseusNumberLineWidgetOptions, "range" | "labelRange" | "labelStyle" | "labelTicks" | "isTickCtrl" | "divisionRange" | "numDivisions" | "snapDivisions" | "tickStep" | "initialX" | "showTooltips" | "static">;
|
|
3
|
+
export default function getNumberLinePublicWidgetOptions(options: PerseusNumberLineWidgetOptions): NumberLinePublicWidgetOptions;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusNumericInputWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type NumericInputDefaultWidgetOptions = Pick<PerseusNumericInputWidgetOptions, "answers" | "size" | "coefficient" | "labelText" | "rightAlign">;
|
|
4
|
+
declare const numericInputWidgetLogic: WidgetLogic;
|
|
5
|
+
export default numericInputWidgetLogic;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
|
+
/**
|
|
3
|
+
* For details on the individual options, see the
|
|
4
|
+
* PerseusNumericInputWidgetOptions type
|
|
5
|
+
*/
|
|
6
|
+
type NumericInputPublicWidgetOptions = {
|
|
7
|
+
labelText?: PerseusNumericInputWidgetOptions["labelText"];
|
|
8
|
+
size: PerseusNumericInputWidgetOptions["size"];
|
|
9
|
+
coefficient: PerseusNumericInputWidgetOptions["coefficient"];
|
|
10
|
+
rightAlign?: PerseusNumericInputWidgetOptions["rightAlign"];
|
|
11
|
+
static: PerseusNumericInputWidgetOptions["static"];
|
|
12
|
+
answerForms?: PerseusNumericInputWidgetOptions["answerForms"];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Given a PerseusNumericInputWidgetOptions object, return a new object with only
|
|
16
|
+
* the public options that should be exposed to the client.
|
|
17
|
+
*/
|
|
18
|
+
declare function getNumericInputPublicWidgetOptions(options: PerseusNumericInputWidgetOptions): NumericInputPublicWidgetOptions;
|
|
19
|
+
export default getNumericInputPublicWidgetOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusOrdererWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type OrdererDefaultWidgetOptions = Pick<PerseusOrdererWidgetOptions, "correctOptions" | "otherOptions" | "height" | "layout">;
|
|
4
|
+
declare const ordererWidgetLogic: WidgetLogic;
|
|
5
|
+
export default ordererWidgetLogic;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PerseusOrdererWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
|
+
/**
|
|
3
|
+
* For details on the individual options, see the
|
|
4
|
+
* PerseusOrdererWidgetOptions type
|
|
5
|
+
*/
|
|
6
|
+
type OrdererPublicWidgetOptions = {
|
|
7
|
+
options: PerseusOrdererWidgetOptions["options"];
|
|
8
|
+
height: PerseusOrdererWidgetOptions["height"];
|
|
9
|
+
layout: PerseusOrdererWidgetOptions["layout"];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Given a PerseusOrdererWidgetOptions object, return a new object with only
|
|
13
|
+
* the public options that should be exposed to the client.
|
|
14
|
+
*/
|
|
15
|
+
declare function getOrdererPublicWidgetOptions(options: PerseusOrdererWidgetOptions): OrdererPublicWidgetOptions;
|
|
16
|
+
export default getOrdererPublicWidgetOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusPassageWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type PassageDefaultWidgetOptions = Pick<PerseusPassageWidgetOptions, "passageTitle" | "passageText" | "footnotes" | "showLineNumbers">;
|
|
4
|
+
declare const passageWidgetLogic: WidgetLogic;
|
|
5
|
+
export default passageWidgetLogic;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PerseusPassageRefWidgetOptions } from "../../data-schema";
|
|
2
|
+
export declare const currentVersion: {
|
|
3
|
+
major: number;
|
|
4
|
+
minor: number;
|
|
5
|
+
};
|
|
6
|
+
export type PassageRefDefaultWidgetOptions = Pick<PerseusPassageRefWidgetOptions, "passageNumber" | "referenceNumber" | "summaryText">;
|
|
7
|
+
export declare const defaultWidgetOptions: PassageRefDefaultWidgetOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusPassageRefTargetWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type PassageRefTargetDefaultWidgetOptions = Pick<PerseusPassageRefTargetWidgetOptions, "content">;
|
|
4
|
+
declare const passageRefTargetWidgetLogic: WidgetLogic;
|
|
5
|
+
export default passageRefTargetWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusPhetSimulationWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type PhetSimulationDefaultWidgetOptions = Pick<PerseusPhetSimulationWidgetOptions, "url" | "description">;
|
|
4
|
+
declare const phetSimulationWidgetLogic: WidgetLogic;
|
|
5
|
+
export default phetSimulationWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusPlotterWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type PlotterDefaultWidgetOptions = Pick<PerseusPlotterWidgetOptions, "scaleY" | "maxY" | "snapsPerLine" | "correct" | "starting" | "type" | "labels" | "categories" | "picSize" | "picBoxHeight" | "plotDimensions" | "labelInterval" | "picUrl">;
|
|
4
|
+
declare const plotterWidgetLogic: WidgetLogic;
|
|
5
|
+
export default plotterWidgetLogic;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusPythonProgramWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type PythonProgramDefaultWidgetOptions = Pick<PerseusPythonProgramWidgetOptions, "programID" | "height">;
|
|
4
|
+
declare const pythonProgramWidgetLogic: WidgetLogic;
|
|
5
|
+
export default pythonProgramWidgetLogic;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PerseusRadioWidgetOptions } from "../../data-schema";
|
|
2
|
+
export declare const currentVersion: {
|
|
3
|
+
major: number;
|
|
4
|
+
minor: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const widgetOptionsUpgrades: {
|
|
7
|
+
readonly "1": (v0props: any) => PerseusRadioWidgetOptions;
|
|
8
|
+
};
|
|
9
|
+
export type RadioDefaultWidgetOptions = Pick<PerseusRadioWidgetOptions, "choices" | "displayCount" | "randomize" | "hasNoneOfTheAbove" | "multipleSelect" | "countChoices" | "deselectEnabled">;
|
|
10
|
+
export declare const defaultWidgetOptions: RadioDefaultWidgetOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusSorterWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type SorterDefaultWidgetOptions = Pick<PerseusSorterWidgetOptions, "correct" | "layout" | "padding">;
|
|
4
|
+
declare const sorterWidgetLogic: WidgetLogic;
|
|
5
|
+
export default sorterWidgetLogic;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PerseusSorterWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
|
+
/**
|
|
3
|
+
* For details on the individual options, see the
|
|
4
|
+
* PerseusSorterWidgetOptions type
|
|
5
|
+
*/
|
|
6
|
+
type SorterPublicWidgetOptions = {
|
|
7
|
+
correct: PerseusSorterWidgetOptions["correct"];
|
|
8
|
+
padding: PerseusSorterWidgetOptions["padding"];
|
|
9
|
+
layout: PerseusSorterWidgetOptions["layout"];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Given a PerseusSorterWidgetOptions object, return a new object with only
|
|
13
|
+
* the public options that should be exposed to the client.
|
|
14
|
+
*/
|
|
15
|
+
declare function getSorterPublicWidgetOptions(options: PerseusSorterWidgetOptions): SorterPublicWidgetOptions;
|
|
16
|
+
export default getSorterPublicWidgetOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusTableWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type TableDefaultWidgetOptions = Pick<PerseusTableWidgetOptions, "headers" | "rows" | "columns" | "answers">;
|
|
4
|
+
declare const tableWidgetLogic: WidgetLogic;
|
|
5
|
+
export default tableWidgetLogic;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { PerseusWidget, PerseusWidgetsMap } from "../data-schema";
|
|
2
|
+
export declare const upgradeWidgetInfoToLatestVersion: (oldWidgetInfo: PerseusWidget) => PerseusWidget;
|
|
3
|
+
export declare function getUpgradedWidgetOptions(oldWidgetOptions: PerseusWidgetsMap): PerseusWidgetsMap;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PerseusVideoWidgetOptions } from "../../data-schema";
|
|
2
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
3
|
+
export type VideoDefaultWidgetOptions = Pick<PerseusVideoWidgetOptions, "location">;
|
|
4
|
+
declare const videoWidgetLogic: WidgetLogic;
|
|
5
|
+
export default videoWidgetLogic;
|