@khanacademy/perseus-core 0.0.0-PR862-20231207182125 → 0.0.0-PR875-20250221232857
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/LICENSE +18 -0
- package/dist/analytics.d.ts +37 -1
- package/dist/data-schema.d.ts +1033 -0
- package/dist/error/errors.d.ts +41 -0
- package/dist/error/perseus-error.d.ts +11 -0
- package/dist/es/index.js +3804 -36
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +103 -2
- package/dist/index.js +3921 -35
- 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 +16 -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 +9 -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/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/legacy-button-sets.d.ts +2 -0
- package/dist/parse-perseus-json/perseus-parsers/legacy-button-sets.typetest.d.ts +1 -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-answer-area.d.ts +2 -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 +23 -0
- package/dist/types.d.ts +13 -1
- package/dist/utils/deep-clone.d.ts +3 -0
- package/dist/utils/equality.d.ts +9 -0
- package/dist/utils/get-decimal-separator.d.ts +5 -0
- package/dist/utils/get-matrix-size.d.ts +2 -0
- package/dist/utils/grapher-types.d.ts +58 -0
- package/dist/utils/grapher-util.d.ts +20 -0
- package/dist/utils/is-real-json-parse.d.ts +1 -0
- package/dist/utils/objective_.d.ts +30 -0
- package/dist/utils/random-util.d.ts +5 -0
- package/dist/utils/split-perseus-item.d.ts +2 -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 +30 -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/grapher-util.d.ts +4 -0
- package/dist/widgets/grapher/index.d.ts +5 -0
- package/dist/widgets/group/index.d.ts +5 -0
- package/dist/widgets/iframe/iframe-util.d.ts +2 -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/interactive-graph/interactive-graph-util.d.ts +3 -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 +42 -0
- package/dist/widgets/matcher/index.d.ts +5 -0
- package/dist/widgets/matcher/matcher-util.d.ts +28 -0
- package/dist/widgets/matrix/index.d.ts +5 -0
- package/dist/widgets/matrix/matrix-util.d.ts +4 -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/plotter/plotter-util.d.ts +12 -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/radio/radio-util.d.ts +26 -0
- package/dist/widgets/sorter/index.d.ts +5 -0
- package/dist/widgets/sorter/sorter-util.d.ts +17 -0
- package/dist/widgets/table/index.d.ts +5 -0
- package/dist/widgets/table/table-util.d.ts +4 -0
- package/dist/widgets/upgrade.d.ts +3 -0
- package/dist/widgets/video/index.d.ts +5 -0
- package/package.json +34 -27
- package/.babelrc.js +0 -8
- package/.eslintrc.js +0 -12
- package/CHANGELOG.md +0 -85
- package/src/analytics.ts +0 -64
- package/src/index.ts +0 -11
- package/src/types.ts +0 -30
- package/src/utils/add-library-version-to-perseus-debug.test.ts +0 -109
- package/src/utils/add-library-version-to-perseus-debug.ts +0 -52
- package/src/version.ts +0 -10
- package/tsconfig-build.json +0 -19
- package/tsconfig-build.tsbuildinfo +0 -1
- /package/dist/{utils → shared-utils}/add-library-version-to-perseus-debug.d.ts +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* APPROXIMATE equality on numbers and primitives.
|
|
3
|
+
*/
|
|
4
|
+
export declare function approximateEqual<T>(x: T, y: T): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Deep APPROXIMATE equality on primitives, numbers, arrays, and objects.
|
|
7
|
+
* Recursive.
|
|
8
|
+
*/
|
|
9
|
+
export declare function approximateDeepEqual<T>(x: T, y: T): boolean;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Coord } from "../data-schema";
|
|
2
|
+
export type Coords = [Coord, Coord];
|
|
3
|
+
type SharedGrapherType = {
|
|
4
|
+
url: string;
|
|
5
|
+
defaultCoords: Coords;
|
|
6
|
+
getFunctionForCoeffs: (coeffs: ReadonlyArray<number>, x: number) => number;
|
|
7
|
+
getEquationString: (coords: Coords, asymptote?: Coords) => string | null;
|
|
8
|
+
areEqual: (coeffs1: ReadonlyArray<number>, coeffs2: ReadonlyArray<number>) => boolean;
|
|
9
|
+
Movable: any;
|
|
10
|
+
getCoefficients: (coords: Coords, asymptote?: Coords) => ReadonlyArray<number> | undefined;
|
|
11
|
+
};
|
|
12
|
+
type AsymptoticGraphsType = {
|
|
13
|
+
defaultAsymptote: Coords;
|
|
14
|
+
extraCoordConstraint: (newCoord: Coord, oldCoord: Coord, coords: Coords, asymptote: Coords, graph: any) => boolean | Coord;
|
|
15
|
+
extraAsymptoteConstraint: (newCoord: Coord, oldCoord: Coord, coords: Coords, asymptote: Coords, graph: any) => Coord;
|
|
16
|
+
allowReflectOverAsymptote: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type LinearType = SharedGrapherType & {
|
|
19
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
20
|
+
fn: any;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type QuadraticType = SharedGrapherType & {
|
|
24
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
25
|
+
a: number;
|
|
26
|
+
b: number;
|
|
27
|
+
c: number;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type SinusoidType = SharedGrapherType & {
|
|
31
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
32
|
+
a: number;
|
|
33
|
+
b: number;
|
|
34
|
+
c: number;
|
|
35
|
+
d: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export type TangentType = SharedGrapherType & {
|
|
39
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
40
|
+
fn: any;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type ExponentialType = SharedGrapherType & AsymptoticGraphsType & {
|
|
44
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
45
|
+
fn: any;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type LogarithmType = SharedGrapherType & AsymptoticGraphsType & {
|
|
49
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
50
|
+
fn: any;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export type AbsoluteValueType = SharedGrapherType & {
|
|
54
|
+
getPropsForCoeffs: (coeffs: ReadonlyArray<number>) => {
|
|
55
|
+
fn: any;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { LinearType, QuadraticType, SinusoidType, TangentType, ExponentialType, LogarithmType, AbsoluteValueType } from "./grapher-types";
|
|
2
|
+
export declare const MOVABLES: {
|
|
3
|
+
PLOT: string;
|
|
4
|
+
PARABOLA: string;
|
|
5
|
+
SINUSOID: string;
|
|
6
|
+
};
|
|
7
|
+
declare const functionTypeMapping: {
|
|
8
|
+
readonly linear: LinearType;
|
|
9
|
+
readonly quadratic: QuadraticType;
|
|
10
|
+
readonly sinusoid: SinusoidType;
|
|
11
|
+
readonly tangent: TangentType;
|
|
12
|
+
readonly exponential: ExponentialType;
|
|
13
|
+
readonly logarithm: LogarithmType;
|
|
14
|
+
readonly absolute_value: AbsoluteValueType;
|
|
15
|
+
};
|
|
16
|
+
export declare const allTypes: any;
|
|
17
|
+
export type FunctionTypeMappingKeys = keyof typeof functionTypeMapping;
|
|
18
|
+
type ConditionalGraderType<T extends FunctionTypeMappingKeys> = T extends "linear" ? LinearType : T extends "quadratic" ? QuadraticType : T extends "sinusoid" ? SinusoidType : T extends "tangent" ? TangentType : T extends "exponential" ? ExponentialType : T extends "logarithm" ? LogarithmType : T extends "absolute_value" ? AbsoluteValueType : never;
|
|
19
|
+
export declare function functionForType<T extends FunctionTypeMappingKeys>(type: T): ConditionalGraderType<T>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isRealJSONParse(jsonParse: typeof JSON.parse): boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* _ utilities for objects
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Does a pluck on keys inside objects in an object
|
|
6
|
+
*
|
|
7
|
+
* Ex:
|
|
8
|
+
* tools = {
|
|
9
|
+
* translation: {
|
|
10
|
+
* enabled: true
|
|
11
|
+
* },
|
|
12
|
+
* rotation: {
|
|
13
|
+
* enabled: false
|
|
14
|
+
* }
|
|
15
|
+
* };
|
|
16
|
+
* pluckObject(tools, "enabled") returns {
|
|
17
|
+
* translation: true
|
|
18
|
+
* rotation: false
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export declare const pluck: (table: any, subKey: string) => any;
|
|
22
|
+
/**
|
|
23
|
+
* Maps an object to an object
|
|
24
|
+
*
|
|
25
|
+
* > mapObject({a: '1', b: '2'}, (value, key) => {
|
|
26
|
+
* return value + 1;
|
|
27
|
+
* });
|
|
28
|
+
* {a: 2, b: 3}
|
|
29
|
+
*/
|
|
30
|
+
export declare const mapObject: <K extends string, V, U>(obj: Record<K, V>, lambda: (arg1: V, arg2: K) => U) => Record<K, U>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PerseusWidgetsMap } from "../data-schema";
|
|
2
|
+
/**
|
|
3
|
+
* Add a widget placeholder using the widget ID.
|
|
4
|
+
* ex. addWidget("radio 1") => "[[☃ radio 1]]"
|
|
5
|
+
*
|
|
6
|
+
* @param {string} id
|
|
7
|
+
* @returns {string}
|
|
8
|
+
*/
|
|
9
|
+
export declare function addWidget(id: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Regex for widget placeholders in a string.
|
|
12
|
+
*
|
|
13
|
+
* First capture group is the widget ID (ex. 'radio 1')
|
|
14
|
+
* Second capture group is the widget type (ex. "radio)
|
|
15
|
+
* exec return will look like: ['[[☃ radio 1]]', 'radio 1', 'radio']
|
|
16
|
+
*/
|
|
17
|
+
export declare function getWidgetRegex(): RegExp;
|
|
18
|
+
/**
|
|
19
|
+
* Extract all widget IDs, which includes the widget type and instance number.
|
|
20
|
+
* example output: ['radio 1', 'categorizer 1', 'categorizor 2']
|
|
21
|
+
*
|
|
22
|
+
* Content should contain Perseus widget placeholders,
|
|
23
|
+
* which look like: '[[☃ radio 1]]'.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} content
|
|
26
|
+
* @returns {ReadonlyArray<string>} widgetIds
|
|
27
|
+
*/
|
|
28
|
+
export declare function getWidgetIdsFromContent(content: string): ReadonlyArray<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Get a list of widget IDs from content,
|
|
31
|
+
* but only for specific widget types
|
|
32
|
+
*
|
|
33
|
+
* @param {string} type the type of widget (ie "radio")
|
|
34
|
+
* @param {string} content the string to parse
|
|
35
|
+
* @param {PerseusWidgetsMap} widgetMap widget ID to widget map
|
|
36
|
+
* @returns {ReadonlyArray<string>} the widget type (ie "radio")
|
|
37
|
+
*/
|
|
38
|
+
export declare function getWidgetIdsFromContentByType(type: string, content: string, widgetMap: PerseusWidgetsMap): ReadonlyArray<string>;
|
|
@@ -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,30 @@
|
|
|
1
|
+
import type { PublicWidgetOptionsFunction } from "./logic-export.types";
|
|
2
|
+
import type { Alignment } from "../types";
|
|
3
|
+
export declare function isWidgetRegistered(type: string): boolean;
|
|
4
|
+
export declare function getCurrentVersion(type: string): any;
|
|
5
|
+
export declare const getPublicWidgetOptionsFunction: (name: string) => PublicWidgetOptionsFunction;
|
|
6
|
+
export declare function getWidgetOptionsUpgrades(type: string): any;
|
|
7
|
+
export declare function getDefaultWidgetOptions(type: string): any;
|
|
8
|
+
/**
|
|
9
|
+
* Handling for the optional alignments for widgets
|
|
10
|
+
* See widget-container.jsx for details on how alignments are implemented.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Returns the list of supported alignments for the given (string) widget
|
|
14
|
+
* type. This is used primarily at editing time to display the choices
|
|
15
|
+
* for the user.
|
|
16
|
+
*
|
|
17
|
+
* Supported alignments are given as an array of strings in the exports of
|
|
18
|
+
* a widget's module.
|
|
19
|
+
*/
|
|
20
|
+
export declare const getSupportedAlignments: (type: string) => ReadonlyArray<Alignment>;
|
|
21
|
+
/**
|
|
22
|
+
* For the given (string) widget type, determine the default alignment for
|
|
23
|
+
* the widget. This is used at rendering time to go from "default" alignment
|
|
24
|
+
* to the actual alignment displayed on the screen.
|
|
25
|
+
*
|
|
26
|
+
* The default alignment is given either as a string (called
|
|
27
|
+
* `defaultAlignment`) or a function (called `getDefaultAlignment`) on
|
|
28
|
+
* the exports of a widget's module.
|
|
29
|
+
*/
|
|
30
|
+
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
|
+
export 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,4 @@
|
|
|
1
|
+
import type { PerseusGrapherWidgetOptions } from "../../data-schema";
|
|
2
|
+
type GrapherPublicWidgetOptions = Pick<PerseusGrapherWidgetOptions, "availableTypes" | "graph">;
|
|
3
|
+
export default function getGrapherPublicWidgetOptions(options: PerseusGrapherWidgetOptions): GrapherPublicWidgetOptions;
|
|
4
|
+
export {};
|
|
@@ -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">;
|
|
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,3 @@
|
|
|
1
|
+
import type { PerseusInteractiveGraphWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
|
+
export type InteractiveGraphPublicWidgetOptions = Pick<PerseusInteractiveGraphWidgetOptions, "step" | "gridStep" | "snapStep" | "backgroundImage" | "markings" | "labels" | "showProtractor" | "showRuler" | "showTooltips" | "rulerLabel" | "rulerTicks" | "range" | "graph" | "lockedFigures" | "fullGraphAriaLabel" | "fullGraphAriaDescription">;
|
|
3
|
+
export default function getInteractiveGraphPublicWidgetOptions(options: PerseusInteractiveGraphWidgetOptions): InteractiveGraphPublicWidgetOptions;
|
|
@@ -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,42 @@
|
|
|
1
|
+
import type getCategorizerPublicWidgetOptions from "./categorizer/categorizer-util";
|
|
2
|
+
import type getCSProgramPublicWidgetOptions from "./cs-program/cs-program-util";
|
|
3
|
+
import type getDropdownPublicWidgetOptions from "./dropdown/dropdown-util";
|
|
4
|
+
import type getExpressionPublicWidgetOptions from "./expression/expression-util";
|
|
5
|
+
import type getGrapherPublicWidgetOptions from "./grapher/grapher-util";
|
|
6
|
+
import type getIFramePublicWidgetOptions from "./iframe/iframe-util";
|
|
7
|
+
import type getInteractiveGraphPublicWidgetOptions from "./interactive-graph/interactive-graph-util";
|
|
8
|
+
import type getLabelImagePublicWidgetOptions from "./label-image/label-image-util";
|
|
9
|
+
import type getMatcherPublicWidgetOptions from "./matcher/matcher-util";
|
|
10
|
+
import type getMatrixPublicWidgetOptions from "./matrix/matrix-util";
|
|
11
|
+
import type getNumberLinePublicWidgetOptions from "./number-line/number-line-util";
|
|
12
|
+
import type getNumericInputPublicWidgetOptions from "./numeric-input/numeric-input-util";
|
|
13
|
+
import type getOrdererPublicWidgetOptions from "./orderer/orderer-util";
|
|
14
|
+
import type getPlotterPublicWidgetOptions from "./plotter/plotter-util";
|
|
15
|
+
import type getRadioPublicWidgetOptions from "./radio/radio-util";
|
|
16
|
+
import type getSorterPublicWidgetOptions from "./sorter/sorter-util";
|
|
17
|
+
import type getTablePublicWidgetOptions from "./table/table-util";
|
|
18
|
+
import type { Version } from "../data-schema";
|
|
19
|
+
import type { Alignment } from "../types";
|
|
20
|
+
export type WidgetOptionsUpgradeMap = {
|
|
21
|
+
[targetMajorVersion: string]: (arg1: any) => any;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A union type of all the functions that provide public widget options.
|
|
25
|
+
*
|
|
26
|
+
* TODO(LEMS-2870): figure out how to make this generic so we don't need to be
|
|
27
|
+
* so reliant on a set group of widgets
|
|
28
|
+
*/
|
|
29
|
+
export type PublicWidgetOptionsFunction = typeof getMatcherPublicWidgetOptions | typeof getPlotterPublicWidgetOptions | typeof getIFramePublicWidgetOptions | typeof getRadioPublicWidgetOptions | typeof getNumericInputPublicWidgetOptions | typeof getDropdownPublicWidgetOptions | typeof getCategorizerPublicWidgetOptions | typeof getOrdererPublicWidgetOptions | typeof getExpressionPublicWidgetOptions | typeof getInteractiveGraphPublicWidgetOptions | typeof getLabelImagePublicWidgetOptions | typeof getSorterPublicWidgetOptions | typeof getCSProgramPublicWidgetOptions | typeof getNumberLinePublicWidgetOptions | typeof getTablePublicWidgetOptions | typeof getGrapherPublicWidgetOptions | typeof getMatrixPublicWidgetOptions;
|
|
30
|
+
export type WidgetLogic = {
|
|
31
|
+
name: string;
|
|
32
|
+
version?: Version;
|
|
33
|
+
widgetOptionsUpgrades?: WidgetOptionsUpgradeMap;
|
|
34
|
+
defaultWidgetOptions?: any;
|
|
35
|
+
supportedAlignments?: ReadonlyArray<Alignment>;
|
|
36
|
+
defaultAlignment?: Alignment;
|
|
37
|
+
/**
|
|
38
|
+
* A function that provides a public version of the widget options that can
|
|
39
|
+
* be shared with the client.
|
|
40
|
+
*/
|
|
41
|
+
getPublicWidgetOptions?: PublicWidgetOptionsFunction;
|
|
42
|
+
};
|
|
@@ -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,28 @@
|
|
|
1
|
+
import type { PerseusMatcherWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
|
+
type MatcherInfo = {
|
|
3
|
+
left: ReadonlyArray<string>;
|
|
4
|
+
right: ReadonlyArray<string>;
|
|
5
|
+
orderMatters: boolean;
|
|
6
|
+
problemNum: number | null | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare const shuffleMatcher: (props: MatcherInfo) => {
|
|
9
|
+
left: ReadonlyArray<string>;
|
|
10
|
+
right: ReadonlyArray<string>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* For details on the individual options, see the
|
|
14
|
+
* PerseusMatcherWidgetOptions type
|
|
15
|
+
*/
|
|
16
|
+
type MatcherPublicWidgetOptions = {
|
|
17
|
+
labels: PerseusMatcherWidgetOptions["labels"];
|
|
18
|
+
left: PerseusMatcherWidgetOptions["left"];
|
|
19
|
+
right: PerseusMatcherWidgetOptions["right"];
|
|
20
|
+
orderMatters: PerseusMatcherWidgetOptions["orderMatters"];
|
|
21
|
+
padding: PerseusMatcherWidgetOptions["padding"];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Given a PerseusMatcherWidgetOptions object, return a new object with only
|
|
25
|
+
* the public options that should be exposed to the client.
|
|
26
|
+
*/
|
|
27
|
+
declare function getMatcherPublicWidgetOptions(options: PerseusMatcherWidgetOptions): MatcherPublicWidgetOptions;
|
|
28
|
+
export default getMatcherPublicWidgetOptions;
|
|
@@ -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,4 @@
|
|
|
1
|
+
import type { PerseusMatrixWidgetOptions } from "@khanacademy/perseus-core";
|
|
2
|
+
type MatrixPublicWidgetOptions = Pick<PerseusMatrixWidgetOptions, "prefix" | "suffix" | "cursorPosition" | "matrixBoardSize" | "static">;
|
|
3
|
+
export default function getMatrixPublicWidgetOptions(options: PerseusMatrixWidgetOptions): MatrixPublicWidgetOptions;
|
|
4
|
+
export {};
|
|
@@ -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;
|